diff options
-rw-r--r-- | conf/httpd.conf | 6 | ||||
-rw-r--r-- | perllib/FixMyStreet/App/Controller/Fun.pm | 33 | ||||
-rwxr-xr-x | perllib/FixMyStreet/App/Controller/Questionnaire.pm | 251 | ||||
-rw-r--r-- | perllib/FixMyStreet/App/Controller/Report/New.pm | 3 | ||||
-rw-r--r-- | perllib/FixMyStreet/App/View/Web.pm | 12 | ||||
-rw-r--r-- | perllib/FixMyStreet/DB/Result/Comment.pm | 2 | ||||
-rw-r--r-- | perllib/FixMyStreet/DB/Result/Problem.pm | 2 | ||||
-rw-r--r-- | perllib/FixMyStreet/DB/Result/User.pm | 1 | ||||
-rw-r--r-- | t/app/controller/report_updates.t | 28 | ||||
-rwxr-xr-x | templates/web/default/fun.html | 35 | ||||
-rw-r--r-- | templates/web/default/questionnaire/completed.html | 28 | ||||
-rw-r--r-- | templates/web/default/questionnaire/index.html | 6 | ||||
-rw-r--r-- | templates/web/default/report/display.html | 4 | ||||
-rw-r--r-- | templates/web/default/tokens/confirm_alert.html | 2 | ||||
-rw-r--r-- | templates/web/default/tokens/confirm_problem.html | 2 | ||||
-rw-r--r-- | templates/web/default/tokens/confirm_update.html | 2 | ||||
-rwxr-xr-x | web/fun.cgi | 56 |
17 files changed, 259 insertions, 214 deletions
diff --git a/conf/httpd.conf b/conf/httpd.conf index 84d24bb4a..deb0dabae 100644 --- a/conf/httpd.conf +++ b/conf/httpd.conf @@ -51,7 +51,7 @@ RewriteRule ^(.+)/$ $1 [R=permanent] # Confirmation tokens RewriteRule ^/[Aa]/([0-9A-Za-z]{16,18}).*$ /alert.cgi?token=$1 [QSA,L] RewriteRule ^/[Cc]/([0-9A-Za-z]{16,18}).*$ /confirm.cgi?type=update;token=$1 [QSA,L] -RewriteRule ^/[Qq]/([0-9A-Za-z]{16,18}).*$ /questionnaire.cgi?token=$1 [QSA,L] +# RewriteRule ^/[Qq]/([0-9A-Za-z]{16,18}).*$ /questionnaire.cgi?token=$1 [QSA,L] RewriteRule ^/[Ff]/([0-9A-Za-z]{16,18}).*$ /flickr.cgi?token=$1 [L] RewriteRule ^/[Tt]/([0-9A-Za-z]{16,18}).*$ /tms-signup.cgi?token=$1 [L] @@ -108,10 +108,10 @@ RewriteRule /(.+) /$1 [L] # RewriteRule ^/confirm(.*) /confirm.cgi$1 [L] # RewriteRule ^/contact(.*) /contact.cgi$1 [L] RewriteRule ^/flickr(.*) /flickr.cgi$1 [L] -RewriteRule ^/fun(.*) /fun.cgi$1 [L] +# RewriteRule ^/fun(.*) /fun.cgi$1 [L] # RewriteRule ^/json(.*) /json.cgi$1 [L] # RewriteRule ^/photo(.*) /photo.cgi$1 [L] -RewriteRule ^/questionnaire(.*) /questionnaire.cgi$1 [L] +# RewriteRule ^/questionnaire(.*) /questionnaire.cgi$1 [L] # RewriteRule ^/reports(.*) /reports.cgi$1 [L] # RewriteRule ^/rss(.*) /rss.cgi$1 [L] RewriteRule ^/test(.*) /test.cgi$1 [L] diff --git a/perllib/FixMyStreet/App/Controller/Fun.pm b/perllib/FixMyStreet/App/Controller/Fun.pm new file mode 100644 index 000000000..e5d8f9652 --- /dev/null +++ b/perllib/FixMyStreet/App/Controller/Fun.pm @@ -0,0 +1,33 @@ +package FixMyStreet::App::Controller::Fun; +use Moose; +use namespace::autoclean; + +BEGIN { extends 'Catalyst::Controller'; } + +=head1 NAME + +FixMyStreet::App::Controller::Fun - Catalyst Controller + +=head1 DESCRIPTION + +Catalyst Controller. + +=head1 METHODS + +=cut + +=head2 fun + +Show the 'fun' page. + +=cut + +sub index : Path : Args(0) { + my ( $self, $c ) = @_; + $c->stash->{template} = 'fun.html'; +} + +__PACKAGE__->meta->make_immutable; + +1; + diff --git a/perllib/FixMyStreet/App/Controller/Questionnaire.pm b/perllib/FixMyStreet/App/Controller/Questionnaire.pm index 1b1e5e547..c6d7e7634 100755 --- a/perllib/FixMyStreet/App/Controller/Questionnaire.pm +++ b/perllib/FixMyStreet/App/Controller/Questionnaire.pm @@ -2,10 +2,7 @@ package FixMyStreet::App::Controller::Questionnaire; use Moose; use namespace::autoclean; -#use Utils; -#use Error qw(:try); -#use CrossSell; -#use mySociety::Locale; +use Utils; BEGIN { extends 'Catalyst::Controller'; } @@ -15,12 +12,20 @@ FixMyStreet::App::Controller::Questionnaire - Catalyst Controller =head1 DESCRIPTION -Catalyst Controller. +Deals with report questionnaires. =head1 METHODS =cut +=head2 load_questionnaire + +Loads the questionnaire from the database, and checks it still needs answering +and is in the right state. Also finds out if this user has answered the +"ever reported" question before. + +=cut + sub load_questionnaire : Private { my ( $self, $c ) = @_; @@ -40,20 +45,23 @@ sub load_questionnaire : Private { $c->detach; } - # FIXME problem fetched information - # extract(epoch from confirmed) as time, extract(epoch from whensent-confirmed) as whensent - # state in ('confirmed','fixed') - $c->stash->{problem} = $questionnaire->problem; - # throw Error::Simple(_("I'm afraid we couldn't locate your problem in the database.\n")) unless $problem; + unless ( $questionnaire->problem->state eq 'confirmed' || $questionnaire->problem->state eq 'fixed' ) { + $c->stash->{message} = _("I'm afraid we couldn't locate your problem in the database.\n"); + $c->stash->{template} = 'questionnaire/error.html'; + $c->detach; + } - $c->stash->{answered_ever_reported} = $c->model('DB::Questionnaire')->count( - { 'problem.user_id' => $c->stash->{problem}->user_id, - ever_reported => { '!=', undef }, - }, - { join => 'problem' } - ); + $c->stash->{problem} = $questionnaire->problem; + $c->stash->{answered_ever_reported} = $questionnaire->problem->user->answered_ever_reported; } +=head2 submit + +If someone submits a questionnaire - either a full style one (when we'll have a +token), or the mini own-report one (when we'll have a problem ID). + +=cut + sub submit : Path('submit') { my ( $self, $c ) = @_; @@ -90,7 +98,7 @@ sub submit_creator_fixed : Private { ); unless ( $questionnaire->in_storage ) { - $questionnaire->ever_reported( $c->stash->{reported} eq 'Yes' ); + $questionnaire->ever_reported( $c->stash->{reported} eq 'Yes' ? 1 : 0 ); $questionnaire->whensent( \'ms_current_timestamp()' ); $questionnaire->whenanswered( \'ms_current_timestamp()' ); $questionnaire->insert; @@ -108,127 +116,113 @@ sub submit_standard : Private { $c->forward( '/tokens/load_questionnaire_id', [ $c->req->params->{token} ] ); $c->forward( 'load_questionnaire' ); - my $questionnaire = $c->stash->{questionnaire}; - my $problem = $questionnaire->problem; + my $problem = $c->stash->{problem}; - $c->stash->{num_questionnaire} = $c->model('DB::Questionnaire')->count( - { problem_id => $problem->id } - ); - - map { $c->stash->{$_} = $c->req->params->{$_} || '' } qw(been_fixed reported another update); # EHA questionnaires done for you if ($c->cobrand->moniker eq 'emptyhomes') { + $c->stash->{num_questionnaire} = $c->model('DB::Questionnaire')->count( + { problem_id => $problem->id } + ); $c->stash->{another} = $c->stash->{num_questionnaire}==1 ? 'Yes' : 'No'; } + $c->forward( 'process_questionnaire' ); + + my $new_state = ''; + $new_state = 'fixed' if $c->stash->{been_fixed} eq 'Yes' && $problem->{state} eq 'confirmed'; + $new_state = 'confirmed' if $c->stash->{been_fixed} eq 'No' && $problem->{state} eq 'fixed'; + + # Record state change, if there was one + if ( $new_state ) { + $problem->state( $new_state ); + $problem->lastupdate( \'ms_current_timestamp()' ); + } + + # If it's not fixed and they say it's still not been fixed, record time update + if ( $c->stash->{been_fixed} eq 'No' && $problem->state eq 'confirmed' ) { + $problem->lastupdate( \'ms_current_timestamp()' ); + } + + # Record questionnaire response + my $reported = undef; + $reported = 1 if $c->stash->{reported} eq 'Yes'; + $reported = 0 if $c->stash->{reported} eq 'No'; + + my $q = $c->stash->{questionnaire}; + $q->whenanswered( \'ms_current_timestamp()' ); + $q->ever_reported( $reported ); + $q->old_state( $problem->state ); + $q->new_state( $c->stash->{been_fixed} eq 'Unknown' ? 'unknown' : ($new_state ? $new_state : $problem->state) ); + $q->update; + + # Record an update if they've given one, or if there's a state change + if ( $new_state || $c->stash->{update} ) { + my $update = $c->stash->{update} || _('Questionnaire filled in by problem reporter'); + $update = $c->model('DB::Comment')->new( + { + problem => $problem, + name => $problem->name, + user => $problem->user, + text => $c->stash->{update}, + state => 'confirmed', + mark_fixed => $new_state eq 'fixed' ? 1 : 0, + mark_open => $new_state eq 'confirmed' ? 1 : 0, + lang => $c->stash->{lang_code}, + cobrand => $c->cobrand->moniker, + cobrand_data => $c->cobrand->extra_update_data, + confirmed => \'ms_current_timestamp()', + anonymous => $problem->anonymous, + } + ); + if ( my $fileid = $c->stash->{upload_fileid} ) { + my $file = file( $c->config->{UPLOAD_CACHE}, "$fileid.jpg" ); + my $blob = $file->slurp; + $file->remove; + $update->photo($blob); + } + $update->insert; + } + + # If they've said they want another questionnaire, mark as such + $problem->send_questionnaire( 1 ) + if ($c->stash->{been_fixed} eq 'No' || $c->stash->{been_fixed} eq 'Unknown') && $c->stash->{another} eq 'Yes'; + $problem->update; + + $c->stash->{new_state} = $new_state; + $c->stash->{template} = 'questionnaire/completed.html'; +} + +sub process_questionnaire : Private { + my ( $self, $c ) = @_; + + map { $c->stash->{$_} = $c->req->params->{$_} || '' } qw(been_fixed reported another update); + my @errors; - push @errors, _('Please state whether or not the problem has been fixed') unless $c->stash->{been_fixed}; - my $ask_ever_reported = $c->cobrand->ask_ever_reported; - if ($ask_ever_reported) { - push @errors, _('Please say whether you\'ve ever reported a problem to your council before') unless $c->stash->{reported} || $c->stash->{answered_ever_reported}; + push @errors, _('Please state whether or not the problem has been fixed') + unless $c->stash->{been_fixed}; + + if ($c->cobrand->ask_ever_reported) { + push @errors, _('Please say whether you\'ve ever reported a problem to your council before') + unless $c->stash->{reported} || $c->stash->{answered_ever_reported}; } + push @errors, _('Please indicate whether you\'d like to receive another questionnaire') if ($c->stash->{been_fixed} eq 'No' || $c->stash->{been_fixed} eq 'Unknown') && !$c->stash->{another}; + push @errors, _('Please provide some explanation as to why you\'re reopening this report') - if $c->stash->{been_fixed} eq 'No' && $problem->state eq 'fixed' && !$c->stash->{update}; + if $c->stash->{been_fixed} eq 'No' && $c->stash->{problem}->state eq 'fixed' && !$c->stash->{update}; + + $c->forward('/report/new/process_photo'); + push @errors, $c->stash->{photo_error} + if $c->stash->{photo_error}; + + push @errors, _('Please provide some text as well as a photo') + if $c->stash->{upload_fileid} && !$c->stash->{update}; + if (@errors) { $c->stash->{errors} = [ @errors ]; $c->detach( 'display' ); } - -# my $fh = $q->upload('photo'); -# my $image; -# if ($fh) { -# my $err = Page::check_photo($q, $fh); -# push @errors, $err if $err; -# try { -# $image = Page::process_photo($fh) unless $err; -# } catch Error::Simple with { -# my $e = shift; -# push(@errors, "That image doesn't appear to have uploaded correctly ($e), please try again."); -# }; -# } -# push @errors, _('Please provide some text as well as a photo') -# if $image && !$input{update}; -# return display_questionnaire($q, @errors) if @errors; -# -# my $new_state = ''; -# $new_state = 'fixed' if $input{been_fixed} eq 'Yes' && $problem->{state} eq 'confirmed'; -# $new_state = 'confirmed' if $input{been_fixed} eq 'No' && $problem->{state} eq 'fixed'; -# -# # Record state change, if there was one -# dbh()->do("update problem set state=?, lastupdate=ms_current_timestamp() -# where id=?", {}, $new_state, $problem->{id}) -# if $new_state; -# -# # If it's not fixed and they say it's still not been fixed, record time update -# dbh()->do("update problem set lastupdate=ms_current_timestamp() -# where id=?", {}, $problem->{id}) -# if $input{been_fixed} eq 'No' && $problem->{state} eq 'confirmed'; -# -# # Record questionnaire response -# my $reported = $input{reported} -# ? ($input{reported} eq 'Yes' ? 't' : ($input{reported} eq 'No' ? 'f' : undef)) -# : undef; -# dbh()->do('update questionnaire set whenanswered=ms_current_timestamp(), -# ever_reported=?, old_state=?, new_state=? where id=?', {}, -# $reported, $problem->{state}, $input{been_fixed} eq 'Unknown' -# ? 'unknown' -# : ($new_state ? $new_state : $problem->{state}), -# $questionnaire->{id}); -# -# # Record an update if they've given one, or if there's a state change -# my $name = $problem->{anonymous} ? undef : $problem->{name}; -# my $update = $input{update} ? $input{update} : _('Questionnaire filled in by problem reporter'); -# Utils::workaround_pg_bytea("insert into comment -# (problem_id, name, email, website, text, state, mark_fixed, mark_open, photo, lang, cobrand, cobrand_data, confirmed) -# values (?, ?, ?, '', ?, 'confirmed', ?, ?, ?, ?, ?, ?, ms_current_timestamp())", 7, -# $problem->{id}, $name, $problem->{email}, $update, -# $new_state eq 'fixed' ? 't' : 'f', $new_state eq 'confirmed' ? 't' : 'f', -# $image, $mySociety::Locale::lang, $cobrand, $c->cobrand->extra_data -# ) -# if $new_state || $input{update}; -# -# # If they've said they want another questionnaire, mark as such -# dbh()->do("update problem set send_questionnaire = 't' where id=?", {}, $problem->{id}) -# if ($input{been_fixed} eq 'No' || $input{been_fixed} eq 'Unknown') && $input{another} eq 'Yes'; -# dbh()->commit(); -# -# my $out; -# my $message; -# my $advert_outcome = 1; -# if ($input{been_fixed} eq 'Unknown') { -# $message = _(<<EOF); -# <p>Thank you very much for filling in our questionnaire; if you -# get some more information about the status of your problem, please come back to the -# site and leave an update.</p> -# EOF -# } elsif ($new_state eq 'confirmed' || (!$new_state && $problem->{state} eq 'confirmed')) { -# my $wtt_url = Cobrand::writetothem_url($cobrand, $c->cobrand->extra_data); -# $wtt_url = "http://www.writetothem.com" if (! $wtt_url); -# $message = sprintf(_(<<EOF), $wtt_url); -# <p style="font-size:150%%">We're sorry to hear that. We have two suggestions: why not try -# <a href="%s">writing direct to your councillor(s)</a> -# or, if it's a problem that could be fixed by local people working together, -# why not <a href="http://www.pledgebank.com/new">make and publicise a pledge</a>? -# </p> -# EOF -# $advert_outcome = 0; -# } else { -# $message = _(<<EOF); -# <p style="font-size:150%">Thank you very much for filling in our questionnaire; glad to hear it's been fixed.</p> -# EOF -# } -# $out = $message; -# my $display_advert = Cobrand::allow_crosssell_adverts($cobrand); -# if ($display_advert && $advert_outcome) { -# $out .= CrossSell::display_advert($q, $problem->{email}, $problem->{name}, -# council => $problem->{council}); -# } -# my %vars = (message => $message); -# my $template_page = Page::template_include('questionnaire-completed', $q, Page::template_root($q), %vars); -# return $template_page if ($template_page); -# return $out; } # Sent here from email token action. Simply load and display questionnaire. @@ -238,7 +232,12 @@ sub index : Private { $c->forward( 'display' ); } -# Displays the questionnaire, either after bad submission or from email token +=head2 display + +Displays a questionnaire, either after bad submission or directly from email token. + +=cut + sub display : Private { my ( $self, $c ) = @_; @@ -250,11 +249,10 @@ sub display : Private { map { Utils::truncate_coordinate($_) } ( $problem->latitude, $problem->longitude ); - my $updates = $c->model('DB::Comment')->search( + $c->stash->{updates} = $c->model('DB::Comment')->search( { problem_id => $problem->id, state => 'confirmed' }, { order_by => 'confirmed' } ); - $c->stash->{updates} = $updates; FixMyStreet::Map::display_map( $c, @@ -266,7 +264,6 @@ sub display : Private { colour => $problem->state eq 'fixed' ? 'green' : 'red', } ], ); - $c->stash->{cobrand_form_elements} = $c->cobrand->form_elements('questionnaireForm'); } =head2 creator_fixed diff --git a/perllib/FixMyStreet/App/Controller/Report/New.pm b/perllib/FixMyStreet/App/Controller/Report/New.pm index e113517f9..736af16b1 100644 --- a/perllib/FixMyStreet/App/Controller/Report/New.pm +++ b/perllib/FixMyStreet/App/Controller/Report/New.pm @@ -881,9 +881,6 @@ sub generate_map : Private { map { Utils::truncate_coordinate($_) } ( $c->stash->{latitude}, $c->stash->{longitude} ); - # Forms that allow photos need a different enctype - my $allow_photo_upload = $c->cobrand->allow_photo_upload; - # Don't do anything if the user skipped the map unless ( $c->req->param('skipped') ) { FixMyStreet::Map::display_map( diff --git a/perllib/FixMyStreet/App/View/Web.pm b/perllib/FixMyStreet/App/View/Web.pm index 61d7c6ca5..8f1aaa085 100644 --- a/perllib/FixMyStreet/App/View/Web.pm +++ b/perllib/FixMyStreet/App/View/Web.pm @@ -16,7 +16,7 @@ __PACKAGE__->config( ENCODING => 'utf8', render_die => 1, expose_methods => [ - 'loc', 'nget', 'tprintf', 'display_crossell_advert', 'prettify_epoch', + 'loc', 'nget', 'tprintf', 'display_crosssell_advert', 'prettify_epoch', 'split_into_lines', ], ); @@ -70,16 +70,16 @@ sub tprintf { return sprintf $format, @args; } -=head2 display_crossell_advert +=head2 display_crosssell_advert - [% display_crossell_advert( email, name ) %] + [% display_crosssell_advert( email, name ) %] Displays a crosssell advert if permitted by the cobrand. =cut -sub display_crossell_advert { - my ( $self, $c, $email, $name ) = @_; +sub display_crosssell_advert { + my ( $self, $c, $email, $name, %data ) = @_; return unless $c->cobrand->allow_crosssell_adverts(); @@ -87,7 +87,7 @@ sub display_crossell_advert { my $q = { site => $c->cobrand->moniker, }; $q->{site} = 'fixmystreet' if $q->{site} eq 'default'; - return CrossSell::display_advert( $q, $email, $name ); + return CrossSell::display_advert( $q, $email, $name, %data ); } =head2 Page::prettify_epoch diff --git a/perllib/FixMyStreet/DB/Result/Comment.pm b/perllib/FixMyStreet/DB/Result/Comment.pm index 4c70dd902..f51c939ff 100644 --- a/perllib/FixMyStreet/DB/Result/Comment.pm +++ b/perllib/FixMyStreet/DB/Result/Comment.pm @@ -134,7 +134,7 @@ sub get_photo_params { my $photo = {}; ( $photo->{width}, $photo->{height} ) = Image::Size::imgsize( \$self->photo ); - $photo->{url} = '/photo/?c=' . $self->id; + $photo->{url} = '/photo?c=' . $self->id; return $photo; } diff --git a/perllib/FixMyStreet/DB/Result/Problem.pm b/perllib/FixMyStreet/DB/Result/Problem.pm index c1ecd6576..2836f6c92 100644 --- a/perllib/FixMyStreet/DB/Result/Problem.pm +++ b/perllib/FixMyStreet/DB/Result/Problem.pm @@ -246,7 +246,7 @@ sub get_photo_params { my $photo = {}; ( $photo->{width}, $photo->{height} ) = Image::Size::imgsize( \$self->photo ); - $photo->{url} = '/photo/?id=' . $self->id; + $photo->{url} = '/photo?id=' . $self->id; return $photo; } diff --git a/perllib/FixMyStreet/DB/Result/User.pm b/perllib/FixMyStreet/DB/Result/User.pm index 228e93267..30314ffa3 100644 --- a/perllib/FixMyStreet/DB/Result/User.pm +++ b/perllib/FixMyStreet/DB/Result/User.pm @@ -114,4 +114,5 @@ sub answered_ever_reported { return $has_answered->count > 0; } + 1; diff --git a/t/app/controller/report_updates.t b/t/app/controller/report_updates.t index 89ce9b6ae..a1c630716 100644 --- a/t/app/controller/report_updates.t +++ b/t/app/controller/report_updates.t @@ -295,7 +295,7 @@ subtest "submit an update for a non registered user" => sub { submit_update => 1, rznvy => 'unregistered@example.com', update => 'update from an unregistered user', - add_alert => 0, + add_alert => undef, } }, 'submit update' @@ -353,8 +353,8 @@ for my $test ( submit_update => 1, rznvy => 'test@example.com', update => 'update from a registered user', - add_alert => 0, - fixed => 0, + add_alert => undef, + fixed => undef, }, changed => { update => 'Update from a registered user' @@ -379,9 +379,9 @@ for my $test ( submit_update => 1, rznvy => 'test@example.com', update => 'update from a registered user', - may_show_name => 0, - add_alert => 0, - fixed => 0, + may_show_name => undef, + add_alert => undef, + fixed => undef, }, changed => { update => 'Update from a registered user' @@ -408,8 +408,8 @@ for my $test ( rznvy => 'test@example.com', update => 'update from a registered user', may_show_name => 1, - add_alert => 0, - fixed => 0, + add_alert => undef, + fixed => undef, }, changed => { update => 'Update from a registered user' @@ -435,7 +435,7 @@ for my $test ( rznvy => 'test@example.com', update => 'update from a registered user', add_alert => 1, - fixed => 0, + fixed => undef, }, changed => { update => 'Update from a registered user' @@ -460,7 +460,7 @@ for my $test ( submit_update => 1, rznvy => 'commenter@example.com', update => 'update from a registered user', - add_alert => 0, + add_alert => undef, fixed => 1, }, changed => { @@ -538,7 +538,7 @@ foreach my $test ( submit_update => 1, rznvy => 'test@example.com', update => 'update from owner', - add_alert => 0, + add_alert => undef, fixed => 1, }, changed => { update => 'Update from owner' }, @@ -567,7 +567,7 @@ foreach my $test ( submit_update => 1, rznvy => 'test@example.com', update => 'update from owner', - add_alert => 0, + add_alert => undef, fixed => 1, }, changed => { update => 'Update from owner' }, @@ -594,7 +594,7 @@ foreach my $test ( submit_update => 1, rznvy => 'test@example.com', update => 'update from owner', - add_alert => 0, + add_alert => undef, fixed => 1, }, changed => { update => 'Update from owner' }, @@ -623,7 +623,7 @@ foreach my $test ( submit_update => 1, rznvy => 'test@example.com', update => 'update from owner', - add_alert => 0, + add_alert => undef, fixed => 1, }, changed => { update => 'Update from owner' }, diff --git a/templates/web/default/fun.html b/templates/web/default/fun.html new file mode 100755 index 000000000..abe9d4028 --- /dev/null +++ b/templates/web/default/fun.html @@ -0,0 +1,35 @@ +[% INCLUDE header.html + title = 'Weird and Wonderful reports' +%] + +<h1>Weird and Wonderful reports</h1> + +<p>Here are some of the best or strangest reports we’ve seen on FixMyStreet. +They’ve all been fixed, and in one case could have saved lives! +Do let us know if you find any more.</p> + +<ul style='list-style-type: none; margin:0; padding:0'> + +<li><img src='http://www.fixmystreet.com/photo?id=9468' align='right' hspace=8> + <h2>Dumped Piano (right)</h2> + <p>The reporter of this problem summed it up with their report, + which consisted solely of the one character “!”. — + <a href='http://www.fixmystreet.com/report/9468'>Problem report</a> + +<li><h2>Mad Seagull</h2> + <p>“A seagull is attacking various cars within this road. He starts at around 05:45 every morning and continues until around 19:30. This causes a lot of noisy banging and wakes up children.” — + <a href='http://www.fixmystreet.com/report/2722'>Problem report</a> + +<li><img src='http://www.fixmystreet.com/photo?id=6553' align='right' hspace=8> + <h2>Boxes full of cheese dumped (right)</h2> + <p>“About a dozen boxes full of mozzarella cheese have been dumped opposite 3 rufford street. if it warms up we could have nasty road topping problem (seriously there is a lot of cheese)” — + <a href='http://www.fixmystreet.com/report/6553'>Problem report</a> + +<li><h2>Dangerous Nivea Billboard</h2> + <p>“The Nivea 'Oxygen is a wonderful thing' billboard here has a device on it releasing bubbles and foam. This is blowing into the road which is both distracting and dangerous to drivers. A large ball of foam hit my windscreen unexpectedly and nearly caused me to have an accident” — + <a href='http://www.fixmystreet.com/report/7552'>Problem report</a> + +</ul> + +[% INCLUDE footer.html %] + diff --git a/templates/web/default/questionnaire/completed.html b/templates/web/default/questionnaire/completed.html new file mode 100644 index 000000000..0dbd2828d --- /dev/null +++ b/templates/web/default/questionnaire/completed.html @@ -0,0 +1,28 @@ +[% advert_outcome = 1 %] + +[% IF been_fixed == 'Unknown' %] + +[% loc('<p>Thank you very much for filling in our questionnaire; if you +get some more information about the status of your problem, please come back to the +site and leave an update.</p>') %] + +[% ELSIF new_state == 'confirmed' OR (!new_state AND problem.state == 'confirmed') %] + +[% tprintf( loc('<p style="font-size:150%%">We're sorry to hear that. We have two suggestions: why not try +<a href="%s">writing direct to your councillor(s)</a> +or, if it's a problem that could be fixed by local people working together, +why not <a href="http://www.pledgebank.com/new">make and publicise a pledge</a>? +</p>'), c.cobrand.writetothem_url || http://www.writetothem.com %] + +[% advert_outcome = 0 %] + +[% ELSE %] + +[% loc('<p style="font-size:150%">Thank you very much for filling in our questionnaire; glad to hear it's been fixed.</p>') %] + +[% END %] + +[% IF advert_outcome %] + [% display_crosssell_advert( problem.user.email, problem.name, { council = problem.council } ) %] +[% END %] + diff --git a/templates/web/default/questionnaire/index.html b/templates/web/default/questionnaire/index.html index f0e65de4d..6d102bac9 100644 --- a/templates/web/default/questionnaire/index.html +++ b/templates/web/default/questionnaire/index.html @@ -21,6 +21,8 @@ <input type="hidden" name="token" value="[% token | html %]"> +[% c.cobrand.form_elements('questionnaireForm') %] + [% IF c.cobrand.moniker == 'emptyhomes' %] [% IF num_questionnaires == 1 %] _(<<EOF); @@ -90,6 +92,10 @@ your experience of getting the problem fixed?') %]</p> [% IF c.cobrand.allow_photo_upload %] <div id="fileupload_normalUI"> + [% IF upload_fileid %] + <p>[% loc('You have already attached a photo to this report, attaching another one will replace it.') %]</p> + <input type="hidden" name="upload_fileid" value="[% upload_fileid %]"> + [% END %] <label for="form_photo">[% loc('Photo:') %]</label> <input type="file" name="photo" id="form_photo"> </div> diff --git a/templates/web/default/report/display.html b/templates/web/default/report/display.html index 959f76d2b..2225934a5 100644 --- a/templates/web/default/report/display.html +++ b/templates/web/default/report/display.html @@ -118,6 +118,10 @@ <div class='form-error'>[% photo_error %]</div> [% END %] <div id="fileupload_normalUI"> + [% IF upload_fileid %] + <p>[% loc('You have already attached a photo to this report, attaching another one will replace it.') %]</p> + <input type="hidden" name="upload_fileid" value="[% upload_fileid %]"> + [% END %] <label for="form_photo">[% loc('Photo:') %]</label> <input type="file" name="photo" id="form_photo"> </div> diff --git a/templates/web/default/tokens/confirm_alert.html b/templates/web/default/tokens/confirm_alert.html index 07694cbb6..d23a658ec 100644 --- a/templates/web/default/tokens/confirm_alert.html +++ b/templates/web/default/tokens/confirm_alert.html @@ -12,6 +12,6 @@ [% END %] </p> -[% display_crossell_advert( alert.user.email, alert.user.name ) %] +[% display_crosssell_advert( alert.user.email, alert.user.name ) %] [% INCLUDE 'footer.html' %] diff --git a/templates/web/default/tokens/confirm_problem.html b/templates/web/default/tokens/confirm_problem.html index cc3fb6400..756958380 100644 --- a/templates/web/default/tokens/confirm_problem.html +++ b/templates/web/default/tokens/confirm_problem.html @@ -17,6 +17,6 @@ %] </p> -[% display_crossell_advert( problem.user.email, problem.name ) %] +[% display_crosssell_advert( problem.user.email, problem.name ) %] [% INCLUDE 'footer.html' %] diff --git a/templates/web/default/tokens/confirm_update.html b/templates/web/default/tokens/confirm_update.html index cae702073..25a1235f6 100644 --- a/templates/web/default/tokens/confirm_update.html +++ b/templates/web/default/tokens/confirm_update.html @@ -15,6 +15,6 @@ [% END %] </p> -[% display_crossell_advert( update.user.email, update.name ) %] +[% display_crosssell_advert( update.user.email, update.name ) %] [% INCLUDE 'footer.html' %] diff --git a/web/fun.cgi b/web/fun.cgi deleted file mode 100755 index d93658dff..000000000 --- a/web/fun.cgi +++ /dev/null @@ -1,56 +0,0 @@ -#!/usr/bin/perl -w -I../perllib - -# fun.cgi: -# Weird and Wonderful -# -# Copyright (c) 2007 UK Citizens Online Democracy. All rights reserved. -# Email: matthew@mysociety.org. WWW: http://www.mysociety.org -# -# $Id: fun.cgi,v 1.3 2008-09-19 10:24:55 matthew Exp $ - -use strict; -use Standard -db; - -# Main code for index.cgi -sub main { - my $q = shift; - print Page::header($q, title=>_('Weird and Wonderful reports')); - print fun($q); - print Page::footer($q); -} -Page::do_fastcgi(\&main); - -sub fun { - my $q = shift; - my $out = $q->h1(_('Weird and Wonderful reports')); - $out .= $q->p('Here are some of the best or strangest reports we’ve seen on FixMyStreet. -They’ve all been fixed, and in one case could have saved lives! -Do let us know if you find any more.'); - $out .= $q->ul({style => 'list-style-type: none; margin:0; padding:0'}, - $q->li( - $q->img({src=>'http://www.fixmystreet.com/photo?id=9468', align=>'right', hspace=>8}), - $q->h2('Dumped Piano (right)'), - $q->p('The reporter of this problem summed it up with their report, -which consisted solely of the one character “!”. —', -$q->a({href=>'http://www.fixmystreet.com/report/9468'}, 'Problem report')), - ), - $q->li( - $q->h2('Mad Seagull'), - $q->p('“A seagull is attacking various cars within this road. He starts at around 05:45 every morning and continues until around 19:30. This causes a lot of noisy banging and wakes up children.” —', -$q->a({href=>'http://www.fixmystreet.com/report/2722'}, 'Problem report')), - ), - $q->li( - $q->img({src=>'http://www.fixmystreet.com/photo?id=6553', align=>'right', hspace=>8}), - $q->h2('Boxes full of cheese dumped (right)'), - $q->p('“About a dozen boxes full of mozzarella cheese have been dumped opposite 3 rufford street. if it warms up we could have nasty road topping problem (seriously there is a lot of cheese)” —', -$q->a({href=>'http://www.fixmystreet.com/report/6553'}, 'Problem report')), - ), - $q->li( - $q->h2('Dangerous Nivea Billboard'), - $q->p('“The Nivea \'Oxygen is a wonderful thing\' billboard here has a device on it releasing bubbles and foam. This is blowing into the road which is both distracting and dangerous to drivers. A large ball of foam hit my windscreen unexpectedly and nearly caused me to have an accident” —', -$q->a({href=>'http://www.fixmystreet.com/report/7552'}, 'Problem report')), - ), - ); - return $out; -} - |