diff options
-rw-r--r-- | perllib/Page.pm | 4 | ||||
-rwxr-xr-x | web/confirm.cgi | 17 | ||||
-rw-r--r-- | web/css.css | 4 | ||||
-rwxr-xr-x | web/questionnaire.cgi | 5 |
4 files changed, 19 insertions, 11 deletions
diff --git a/perllib/Page.pm b/perllib/Page.pm index 3b4e9b0f6..8e3815931 100644 --- a/perllib/Page.pm +++ b/perllib/Page.pm @@ -6,7 +6,7 @@ # Copyright (c) 2006 UK Citizens Online Democracy. All rights reserved. # Email: matthew@mysociety.org; WWW: http://www.mysociety.org/ # -# $Id: Page.pm,v 1.57 2007-06-15 14:57:52 matthew Exp $ +# $Id: Page.pm,v 1.58 2007-06-22 14:20:45 matthew Exp $ # package Page; @@ -101,7 +101,7 @@ EOF $html .= $home ? '</h1>' : '</a></div>'; $html .= '<div id="wrapper"><div id="content">'; if (mySociety::Config::get('STAGING_SITE')) { - #$html .= '<p id="error">This is a developer site; things might break at any time, and councils are not sent emails (they\'d get annoyed!).</p>'; + $html .= '<p id="error">This is a developer site; things might break at any time, and councils are not sent emails (they\'d get annoyed!).</p>'; } return $html; } diff --git a/web/confirm.cgi b/web/confirm.cgi index de4490f8c..ce2a44d11 100755 --- a/web/confirm.cgi +++ b/web/confirm.cgi @@ -6,7 +6,7 @@ # Copyright (c) 2006 UK Citizens Online Democracy. All rights reserved. # Email: matthew@mysociety.org. WWW: http://www.mysociety.org # -# $Id: confirm.cgi,v 1.22 2007-06-22 13:39:10 matthew Exp $ +# $Id: confirm.cgi,v 1.23 2007-06-22 14:20:45 matthew Exp $ use strict; require 5.8.0; @@ -40,7 +40,8 @@ sub main { my $out = ''; my $token = $q->param('token'); my $type = $q->param('type'); - my $id = mySociety::AuthToken::retrieve($type, $token); + my $tokentype = $type eq 'questionnaire' ? 'update' : $type; + my $id = mySociety::AuthToken::retrieve($tokentype, $token); if ($id) { if ($type eq 'update') { my ($o, $problem_id, $email, $creator_fixed) = confirm_update($q, $id); @@ -129,7 +130,7 @@ EOF sub ask_questionnaire { my ($token) = @_; my $out = <<EOF; -<form action="/confirm" method="post"> +<form action="/confirm" method="post" id="questionnaire"> <input type="hidden" name="type" value="questionnaire"> <input type="hidden" name="token" value="$token"> <p>Thanks, glad to hear it's been fixed! Could we just ask if you have ever reported a problem to a council before?</p> @@ -145,16 +146,20 @@ EOF return $out; } -sub add_questionnarie { +sub add_questionnaire { my ($q, $id, $token) = @_; my $problem_id = dbh()->selectrow_array("select problem_id from comment where id=?", {}, $id); my $reported = $q->param('reported'); $reported = $reported eq 'Yes' ? 't' : ($reported eq 'No' ? 'f' : undef); return ask_questionnaire($token) unless $reported; + my $already = dbh()->selectrow_array("select id from questionnaire + where problem_id=? and old_state='confirmed' and new_state='fixed'", + {}, $problem_id); dbh()->do("insert into questionnaire (problem_id, whensent, whenanswered, ever_reported, old_state, new_state) values (?, ms_current_timestamp(), - ms_current_timestamp(), ?, 'confirmed', 'fixed');", {}, $problem_id, $reported); - my $out = $q->p(sprintf('Thank you - <a href="%s">view your problem</a>.', "/?id=$problem_id")); + ms_current_timestamp(), ?, 'confirmed', 'fixed');", {}, $problem_id, $reported) + unless $already; + my $out = $q->p(sprintf('Thank you — you can <a href="%s">view your updated problem</a> on the site.', "/?id=$problem_id")); return $out; } diff --git a/web/css.css b/web/css.css index 9fc3a2c45..b60106184 100644 --- a/web/css.css +++ b/web/css.css @@ -253,6 +253,10 @@ fieldset div.checkbox label, label.n { cursor: hand; } +#questionnaire label { + float: none; +} + /* Map */ #map_box { diff --git a/web/questionnaire.cgi b/web/questionnaire.cgi index 3b17b4aa6..c0dbb6dda 100755 --- a/web/questionnaire.cgi +++ b/web/questionnaire.cgi @@ -6,7 +6,7 @@ # Copyright (c) 2007 UK Citizens Online Democracy. All rights reserved. # Email: matthew@mysociety.org. WWW: http://www.mysociety.org # -# $Id: questionnaire.cgi,v 1.11 2007-06-15 23:25:30 matthew Exp $ +# $Id: questionnaire.cgi,v 1.12 2007-06-22 14:20:45 matthew Exp $ use strict; require 5.8.0; @@ -181,9 +181,8 @@ sub display_questionnaire { no => $input{another} eq 'No' ? ' checked' : '', ); $out .= <<EOF; - <style type="text/css">label { float:none;}</style> <h1>Questionnaire</h1> -<form method="post" action="/questionnaire"> +<form method="post" action="/questionnaire" id="questionnaire"> <input type="hidden" name="token" value="$input_h{token}"> <p>The details of your problem are available on the right hand side of this page. |