diff options
-rw-r--r-- | conf/httpd.conf | 4 | ||||
-rw-r--r-- | perllib/FixMyStreet/App/Controller/Report.pm | 173 | ||||
-rw-r--r-- | t/app/controller/report_display.t | 0 | ||||
-rw-r--r-- | templates/web/default/report/display.html | 111 | ||||
-rw-r--r-- | templates/website/problem | 62 | ||||
-rwxr-xr-x | web/index.cgi | 276 |
6 files changed, 424 insertions, 202 deletions
diff --git a/conf/httpd.conf b/conf/httpd.conf index aa9739d25..f1125e696 100644 --- a/conf/httpd.conf +++ b/conf/httpd.conf @@ -83,8 +83,8 @@ RewriteRule ^/rss/(reports|area)/([^/]+)$ /reports.cgi?rss=$1;council= RewriteRule ^/{/rss/(.*)}$ /rss/$1 [R=permanent,L] RewriteRule ^/reports/{/rss/(.*)}$ /rss/$1 [R=permanent,L] -RewriteRule ^/report/([0-9]+)$ /index.cgi?id=$1 [QSA,L] -RewriteRule ^/report/([0-9]+) /report/$1 [R,L] +# RewriteRule ^/report/([0-9]+)$ /index.cgi?id=$1 [QSA,L] +# RewriteRule ^/report/([0-9]+) /report/$1 [R,L] RewriteRule ^/alerts/?$ /alert [R=permanent,L] # JSON API for summaries of reports diff --git a/perllib/FixMyStreet/App/Controller/Report.pm b/perllib/FixMyStreet/App/Controller/Report.pm new file mode 100644 index 000000000..022e0caff --- /dev/null +++ b/perllib/FixMyStreet/App/Controller/Report.pm @@ -0,0 +1,173 @@ +package FixMyStreet::App::Controller::Report; + +use Moose; +use namespace::autoclean; +BEGIN { extends 'Catalyst::Controller'; } + + +=head1 NAME + +FixMyStreet::App::Controller::Report - display a report + +=head1 DESCRIPTION + +Show a report + +=head1 ACTIONS + +=head2 report_display + +Display a report. + +=cut + +sub display : Path('') : Args(1) { + my ( $self, $c, $id ) = @_; +} + +# my ($q, $errors, $field_errors) = @_; +# my @errors = @$errors; +# my %field_errors = %{$field_errors}; +# my $cobrand = Page::get_cobrand($q); +# push @errors, _('There were problems with your update. Please see below.') if (scalar keys %field_errors); + + +# my @vars = qw(id name rznvy update fixed add_alert upload_fileid submit_update); +# my %input = map { $_ => $q->param($_) || '' } @vars; +# my %input_h = map { $_ => $q->param($_) ? ent($q->param($_)) : '' } @vars; +# my $base = Cobrand::base_url($cobrand); + + + +# # Some council with bad email software +# if ($input{id} =~ /^3D\d+$/) { +# $input{id} =~ s/^3D//; +# print $q->redirect(-location => $base . '/report/' . $input{id}, -status => 301); +# return ''; +# } + + + +# # Redirect old /?id=NNN URLs to /report/NNN +# if (!@errors && !scalar keys %field_errors && $ENV{SCRIPT_URL} eq '/') { +# print $q->redirect(-location => $base . '/report/' . $input{id}, -status => 301); +# return ''; +# } + + +# # Get all information from database +# return display_location($q, _('Unknown problem ID')) if !$input{id} || $input{id} =~ /\D/; + + +# my $problem = Problems::fetch_problem($input{id}); +# return display_location($q, _('Unknown problem ID')) unless $problem; +# return front_page($q, _('That report has been removed from FixMyStreet.'), '410 Gone') if $problem->{state} eq 'hidden'; + + +# my $extra_data = Cobrand::extra_data($cobrand, $q); +# my $google_link = Cobrand::base_url_for_emails($cobrand, $extra_data) +# . '/report/' . $problem->{id}; +# # truncate the lat,lon for nicer rss urls +# my ( $short_lat, $short_lon ) = +# map { Utils::truncate_coordinate($_) } # +# ( $problem->{latitude}, $problem->{longitude} ); + +# my $map_links = ''; +# $map_links = "<p id='sub_map_links'>" +# . "<a href=\"http://maps.google.co.uk/maps?output=embed&z=16&q=" +# . URI::Escape::uri_escape_utf8( $problem->{title} . ' - ' . $google_link ) +# . "\@$short_lat,$short_lon\">View on Google Maps</a></p>" +# if mySociety::Config::get('COUNTRY') eq 'GB'; + +# my $banner; +# if ($q->{site} ne 'emptyhomes' && $problem->{state} eq 'confirmed' && $problem->{duration} > 8*7*24*60*60) { +# $banner = $q->p({id => 'unknown'}, _('This problem is old and of unknown status.')); +# } +# if ($problem->{state} eq 'fixed') { +# $banner = $q->p({id => 'fixed'}, _('This problem has been fixed') . '.'); +# } + +# my $contact_url = Cobrand::url($cobrand, NewURL($q, -retain => 1, pc => undef, x => undef, 'y' => undef, -url=>'/contact?id=' . $input{id}), $q); +# my $back = Cobrand::url($cobrand, NewURL($q, -url => '/', +# lat => $short_lat, lon => $short_lon, +# -retain => 1, pc => undef, x => undef, 'y' => undef, id => undef +# ), $q); +# my $fixed = ($input{fixed}) ? ' checked' : ''; + +# my %vars = ( +# banner => $banner, +# map_start => FixMyStreet::Map::display_map($q, +# latitude => $problem->{latitude}, longitude => $problem->{longitude}, +# type => 0, +# pins => $problem->{used_map} ? [ [ $problem->{latitude}, $problem->{longitude}, 'blue' ] ] : [], +# post => $map_links +# ), +# map_end => FixMyStreet::Map::display_map_end(0), +# problem_title => ent($problem->{title}), +# problem_meta => Page::display_problem_meta_line($q, $problem), +# problem_detail => Page::display_problem_detail($problem), +# problem_photo => Page::display_problem_photo($q, $problem), +# problem_updates => Page::display_problem_updates($input{id}, $q), +# unsuitable => $q->a({rel => 'nofollow', href => $contact_url}, _('Offensive? Unsuitable? Tell us')), +# more_problems => '<a href="' . $back . '">' . _('More problems nearby') . '</a>', +# url_home => Cobrand::url($cobrand, '/', $q), +# alert_link => Cobrand::url($cobrand, NewURL($q, -url => '/alert?type=updates;id='.$input_h{id}, -retain => 1, pc => undef, x => undef, 'y' => undef ), $q), +# alert_text => _('Email me updates'), +# email_label => _('Email:'), +# subscribe => _('Subscribe'), +# blurb => _('Receive email when updates are left on this problem'), +# cobrand_form_elements1 => Cobrand::form_elements($cobrand, 'alerts', $q), +# form_alert_action => Cobrand::url($cobrand, '/alert', $q), +# rss_url => Cobrand::url($cobrand, NewURL($q, -retain=>1, -url => '/rss/'.$input_h{id}, pc => undef, x => undef, 'y' => undef, id => undef), $q), +# rss_title => _('RSS feed'), +# rss_alt => _('RSS feed of updates to this problem'), +# update_heading => $q->h2(_('Provide an update')), +# field_errors => \%field_errors, +# add_alert_checked => ($input{add_alert} || !$input{submit_update}) ? ' checked' : '', +# fixedline_box => $problem->{state} eq 'fixed' ? '' : qq{<input type="checkbox" name="fixed" id="form_fixed" value="1"$fixed>}, +# fixedline_label => $problem->{state} eq 'fixed' ? '' : qq{<label for="form_fixed">} . _('This problem has been fixed') . qq{</label>}, +# name_label => _('Name:'), +# update_label => _('Update:'), +# alert_label => _('Alert me to future updates'), +# post_label => _('Post'), +# cobrand_form_elements => Cobrand::form_elements($cobrand, 'updateForm', $q), +# form_action => Cobrand::url($cobrand, '/', $q), +# input_h => \%input_h, +# optional => _('(optional)'), +# ); +# +# $vars{update_blurb} = $q->p($q->small(_('Please note that updates are not sent to the council. If you leave your name it will be public. Your information will only be used in accordance with our <a href="/faq#privacy">privacy policy</a>'))) +# unless $q->{site} eq 'emptyhomes'; # No council blurb +# +# if (@errors) { +# $vars{errors} = '<ul class="error"><li>' . join('</li><li>', @errors) . '</li></ul>'; +# } +# +# my $allow_photo_upload = Cobrand::allow_photo_upload($cobrand); +# if ($allow_photo_upload) { +# my $photo_label = _('Photo:'); +# $vars{enctype} = ' enctype="multipart/form-data"'; +# $vars{photo_element} = <<EOF; +# <div id="fileupload_normalUI"> +# <label for="form_photo">$photo_label</label> +# <input type="file" name="photo" id="form_photo"> +# </div> +# EOF +# } +# +# my %params = ( +# rss => [ _('Updates to this problem, FixMyStreet'), "/rss/$input_h{id}" ], +# robots => 'index, nofollow', +# js => FixMyStreet::Map::header_js(), +# title => $problem->{title} +# ); +# +# my $page = Page::template_include('problem', $q, Page::template_root($q), %vars); +# return ($page, %params); +# } + + + +__PACKAGE__->meta->make_immutable; + +1; diff --git a/t/app/controller/report_display.t b/t/app/controller/report_display.t new file mode 100644 index 000000000..e69de29bb --- /dev/null +++ b/t/app/controller/report_display.t diff --git a/templates/web/default/report/display.html b/templates/web/default/report/display.html new file mode 100644 index 000000000..a50495e5b --- /dev/null +++ b/templates/web/default/report/display.html @@ -0,0 +1,111 @@ +[% + problem_title = problem.title | html; + + INCLUDE 'header.html', title => problem_title +%] + +{{ $map_start }} +{{ $banner }} + +<h1>[% problem_title %]</h1> + +<p><em>{{ $problem_meta }}</em></p> + +{{ $problem_detail }} + +{{ $problem_photo }} + +<p align="right"> + <small> + {{ $unsuitable }} + </small> +</p> + +<p style="padding-bottom: 0.5em; border-bottom: dotted 1px #999999;" align="right"> + {{ $more_problems }} +</p> + +<div id="alert_links"> + <a rel="nofollow" id="email_alert" href="{{ $alert_link }}">{{ $alert_text }}</a> + + <form action="{{ $form_alert_action }}" method="post" id="email_alert_box"> + <p>{{ $blurb }}</p> + <label class="n" for="alert_rznvy">{{ $email_label }}</label> + <input type="text" name="rznvy" id="alert_rznvy" value="{{ $input_h{rznvy} }}" size="30"> + <input type="hidden" name="id" value="{{ $input_h{id} }}"> + <input type="hidden" name="type" value="updates"> + <input type="submit" value="{{ $subscribe }}"> + {{ $cobrand_form_elements1 }} + </form> + + <a href="{{ $rss_url }}"> + <img src="/i/feed.png" width="16" height="16" title="{{ $rss_title }}" alt="{{ $rss_alt }}" border="0" style="vertical-align: middle"> + </a> +</div> + +{{ $problem_updates }} + +<div id="update_form"> + + {{ $update_heading }} + {{ $update_blurb }} + + {{ $errors }} + + <form method="post" action="{{ $form_action }}" name="updateForm" id="fieldset"{{ $enctype }}> + + <input type="hidden" name="submit_update" value="1"> + <input type="hidden" name="id" value="{{ $input_h{id} }}"> + + <div> + <label for="form_name">{{ $name_label }}</label> + <input type="text" name="name" id="form_name" value="{{ $input_h{name} }}" size="20"> {{ $optional }} + </div> + + {{ if ( $field_errors{email}) { + "<div class='form-error'>$field_errors{email}</div>"; + } }} + <div class="form-field"> + <label for="form_rznvy">{{ $email_label }}</label> + <input type="text" name="rznvy" id="form_rznvy" value="{{ $input_h{rznvy} }}" size="20"> + </div> + + + {{ if ( $field_errors{update}) { + "<div class='form-error'>$field_errors{update}</div>"; + } }} + <div class="form-field"> + <label for="form_update">{{ $update_label }}</label> + <textarea name="update" id="form_update" rows="7" cols="30">{{ $input_h{update} }}</textarea> + </div> + + + <div class="checkbox"> + {{ $fixedline_box }} + {{ $fixedline_label }} + </div> + + + {{ $photo_element }} + + + <div class="checkbox"> + <input type="checkbox" name="add_alert" id="form_add_alert" value="1"{{ $add_alert_checked }}> + <label for="form_add_alert">{{ $alert_label }}</label> + </div> + + + <div class="checkbox"> + <input type="submit" id="update_post" value="{{ $post_label }}"> + </div> + + + {{ $cobrand_form_elements }} + + + </form> +</div> + +{{ $map_end }} + +[% INCLUDE 'footer.html' %] diff --git a/templates/website/problem b/templates/website/problem deleted file mode 100644 index 4debc1d2e..000000000 --- a/templates/website/problem +++ /dev/null @@ -1,62 +0,0 @@ -{{ $map_start }} -{{ $banner }} - -<h1>{{ $problem_title }}</h1> -<p><em>{{ $problem_meta }}</em></p> -{{ $problem_detail }} -{{ $problem_photo }} - -<p align="right"><small>{{ $unsuitable }}</small></p> -<p style="padding-bottom: 0.5em; border-bottom: dotted 1px #999999;" align="right">{{ $more_problems }}</p> - -<div id="alert_links"> -<a rel="nofollow" id="email_alert" href="{{ $alert_link }}">{{ $alert_text }}</a> - -<form action="{{ $form_alert_action }}" method="post" id="email_alert_box"> -<p>{{ $blurb }}</p> -<label class="n" for="alert_rznvy">{{ $email_label }}</label> -<input type="text" name="rznvy" id="alert_rznvy" value="{{ $input_h{rznvy} }}" size="30"> -<input type="hidden" name="id" value="{{ $input_h{id} }}"> -<input type="hidden" name="type" value="updates"> -<input type="submit" value="{{ $subscribe }}"> -{{ $cobrand_form_elements1 }} -</form> - <a href="{{ $rss_url }}"><img src="/i/feed.png" width="16" height="16" title="{{ $rss_title }}" alt="{{ $rss_alt }}" border="0" style="vertical-align: middle"></a> -</div> - -{{ $problem_updates }} - -<div id="update_form"> - -{{ $update_heading }} -{{ $update_blurb }} - -{{ $errors }} - -<form method="post" action="{{ $form_action }}" name="updateForm" id="fieldset"{{ $enctype }}> -<input type="hidden" name="submit_update" value="1"> -<input type="hidden" name="id" value="{{ $input_h{id} }}"> -<div><label for="form_name">{{ $name_label }}</label> -<input type="text" name="name" id="form_name" value="{{ $input_h{name} }}" size="20"> {{ $optional }}</div> -{{ if ( $field_errors{email}) { - "<div class='form-error'>$field_errors{email}</div>"; -} }} -<div class="form-field"> -<label for="form_rznvy">{{ $email_label }}</label> -<input type="text" name="rznvy" id="form_rznvy" value="{{ $input_h{rznvy} }}" size="20"></div> -{{ if ( $field_errors{update}) { - "<div class='form-error'>$field_errors{update}</div>"; -} }} -<div class="form-field"> -<label for="form_update">{{ $update_label }}</label> -<textarea name="update" id="form_update" rows="7" cols="30">{{ $input_h{update} }}</textarea></div> -<div class="checkbox">{{ $fixedline_box }} {{ $fixedline_label }}</div> -{{ $photo_element }} -<div class="checkbox"><input type="checkbox" name="add_alert" id="form_add_alert" value="1"{{ $add_alert_checked }}> -<label for="form_add_alert">{{ $alert_label }}</label></div> -<div class="checkbox"><input type="submit" id="update_post" value="{{ $post_label }}"></div> -{{ $cobrand_form_elements }} -</form> -</div> - -{{ $map_end }} diff --git a/web/index.cgi b/web/index.cgi index 0bf2ce8a0..d04467342 100755 --- a/web/index.cgi +++ b/web/index.cgi @@ -93,10 +93,10 @@ sub main { # ( $out, %params ) = display_form( $q, [], {} ); # $params{title} = _('Reporting a problem'); # } - elsif ( $q->param('id') ) { - ( $out, %params ) = display_problem( $q, [], {} ); - $params{title} .= ' - ' . _('Viewing a problem'); - } + # elsif ( $q->param('id') ) { + # ( $out, %params ) = display_problem( $q, [], {} ); + # $params{title} .= ' - ' . _('Viewing a problem'); + # } # elsif ($q->param('pc') # || ( $q->param('x') && $q->param('y') ) @@ -1037,137 +1037,137 @@ sub submit_update { # return (Page::template_include('map', $q, Page::template_root($q), %vars), %params); # } -sub display_problem { - my ($q, $errors, $field_errors) = @_; - my @errors = @$errors; - my %field_errors = %{$field_errors}; - my $cobrand = Page::get_cobrand($q); - push @errors, _('There were problems with your update. Please see below.') if (scalar keys %field_errors); - - my @vars = qw(id name rznvy update fixed add_alert upload_fileid submit_update); - my %input = map { $_ => $q->param($_) || '' } @vars; - my %input_h = map { $_ => $q->param($_) ? ent($q->param($_)) : '' } @vars; - my $base = Cobrand::base_url($cobrand); - - # Some council with bad email software - if ($input{id} =~ /^3D\d+$/) { - $input{id} =~ s/^3D//; - print $q->redirect(-location => $base . '/report/' . $input{id}, -status => 301); - return ''; - } - - # Redirect old /?id=NNN URLs to /report/NNN - if (!@errors && !scalar keys %field_errors && $ENV{SCRIPT_URL} eq '/') { - print $q->redirect(-location => $base . '/report/' . $input{id}, -status => 301); - return ''; - } - - # Get all information from database - return display_location($q, _('Unknown problem ID')) if !$input{id} || $input{id} =~ /\D/; - my $problem = Problems::fetch_problem($input{id}); - return display_location($q, _('Unknown problem ID')) unless $problem; - return front_page($q, _('That report has been removed from FixMyStreet.'), '410 Gone') if $problem->{state} eq 'hidden'; - - my $extra_data = Cobrand::extra_data($cobrand, $q); - my $google_link = Cobrand::base_url_for_emails($cobrand, $extra_data) - . '/report/' . $problem->{id}; - - # truncate the lat,lon for nicer rss urls - my ( $short_lat, $short_lon ) = - map { Utils::truncate_coordinate($_) } # - ( $problem->{latitude}, $problem->{longitude} ); - - my $map_links = ''; - $map_links = "<p id='sub_map_links'>" - . "<a href=\"http://maps.google.co.uk/maps?output=embed&z=16&q=" - . URI::Escape::uri_escape_utf8( $problem->{title} . ' - ' . $google_link ) - . "\@$short_lat,$short_lon\">View on Google Maps</a></p>" - if mySociety::Config::get('COUNTRY') eq 'GB'; - - my $banner; - if ($q->{site} ne 'emptyhomes' && $problem->{state} eq 'confirmed' && $problem->{duration} > 8*7*24*60*60) { - $banner = $q->p({id => 'unknown'}, _('This problem is old and of unknown status.')); - } - if ($problem->{state} eq 'fixed') { - $banner = $q->p({id => 'fixed'}, _('This problem has been fixed') . '.'); - } - - my $contact_url = Cobrand::url($cobrand, NewURL($q, -retain => 1, pc => undef, x => undef, 'y' => undef, -url=>'/contact?id=' . $input{id}), $q); - my $back = Cobrand::url($cobrand, NewURL($q, -url => '/', - lat => $short_lat, lon => $short_lon, - -retain => 1, pc => undef, x => undef, 'y' => undef, id => undef - ), $q); - my $fixed = ($input{fixed}) ? ' checked' : ''; - - my %vars = ( - banner => $banner, - map_start => FixMyStreet::Map::display_map($q, - latitude => $problem->{latitude}, longitude => $problem->{longitude}, - type => 0, - pins => $problem->{used_map} ? [ [ $problem->{latitude}, $problem->{longitude}, 'blue' ] ] : [], - post => $map_links - ), - map_end => FixMyStreet::Map::display_map_end(0), - problem_title => ent($problem->{title}), - problem_meta => Page::display_problem_meta_line($q, $problem), - problem_detail => Page::display_problem_detail($problem), - problem_photo => Page::display_problem_photo($q, $problem), - problem_updates => Page::display_problem_updates($input{id}, $q), - unsuitable => $q->a({rel => 'nofollow', href => $contact_url}, _('Offensive? Unsuitable? Tell us')), - more_problems => '<a href="' . $back . '">' . _('More problems nearby') . '</a>', - url_home => Cobrand::url($cobrand, '/', $q), - alert_link => Cobrand::url($cobrand, NewURL($q, -url => '/alert?type=updates;id='.$input_h{id}, -retain => 1, pc => undef, x => undef, 'y' => undef ), $q), - alert_text => _('Email me updates'), - email_label => _('Email:'), - subscribe => _('Subscribe'), - blurb => _('Receive email when updates are left on this problem'), - cobrand_form_elements1 => Cobrand::form_elements($cobrand, 'alerts', $q), - form_alert_action => Cobrand::url($cobrand, '/alert', $q), - rss_url => Cobrand::url($cobrand, NewURL($q, -retain=>1, -url => '/rss/'.$input_h{id}, pc => undef, x => undef, 'y' => undef, id => undef), $q), - rss_title => _('RSS feed'), - rss_alt => _('RSS feed of updates to this problem'), - update_heading => $q->h2(_('Provide an update')), - field_errors => \%field_errors, - add_alert_checked => ($input{add_alert} || !$input{submit_update}) ? ' checked' : '', - fixedline_box => $problem->{state} eq 'fixed' ? '' : qq{<input type="checkbox" name="fixed" id="form_fixed" value="1"$fixed>}, - fixedline_label => $problem->{state} eq 'fixed' ? '' : qq{<label for="form_fixed">} . _('This problem has been fixed') . qq{</label>}, - name_label => _('Name:'), - update_label => _('Update:'), - alert_label => _('Alert me to future updates'), - post_label => _('Post'), - cobrand_form_elements => Cobrand::form_elements($cobrand, 'updateForm', $q), - form_action => Cobrand::url($cobrand, '/', $q), - input_h => \%input_h, - optional => _('(optional)'), - ); - - $vars{update_blurb} = $q->p($q->small(_('Please note that updates are not sent to the council. If you leave your name it will be public. Your information will only be used in accordance with our <a href="/faq#privacy">privacy policy</a>'))) - unless $q->{site} eq 'emptyhomes'; # No council blurb - - if (@errors) { - $vars{errors} = '<ul class="error"><li>' . join('</li><li>', @errors) . '</li></ul>'; - } - - my $allow_photo_upload = Cobrand::allow_photo_upload($cobrand); - if ($allow_photo_upload) { - my $photo_label = _('Photo:'); - $vars{enctype} = ' enctype="multipart/form-data"'; - $vars{photo_element} = <<EOF; -<div id="fileupload_normalUI"> -<label for="form_photo">$photo_label</label> -<input type="file" name="photo" id="form_photo"> -</div> -EOF - } - - my %params = ( - rss => [ _('Updates to this problem, FixMyStreet'), "/rss/$input_h{id}" ], - robots => 'index, nofollow', - js => FixMyStreet::Map::header_js(), - title => $problem->{title} - ); - - my $page = Page::template_include('problem', $q, Page::template_root($q), %vars); - return ($page, %params); -} - +# sub display_problem { +# my ($q, $errors, $field_errors) = @_; +# my @errors = @$errors; +# my %field_errors = %{$field_errors}; +# my $cobrand = Page::get_cobrand($q); +# push @errors, _('There were problems with your update. Please see below.') if (scalar keys %field_errors); +# +# my @vars = qw(id name rznvy update fixed add_alert upload_fileid submit_update); +# my %input = map { $_ => $q->param($_) || '' } @vars; +# my %input_h = map { $_ => $q->param($_) ? ent($q->param($_)) : '' } @vars; +# my $base = Cobrand::base_url($cobrand); +# +# # Some council with bad email software +# if ($input{id} =~ /^3D\d+$/) { +# $input{id} =~ s/^3D//; +# print $q->redirect(-location => $base . '/report/' . $input{id}, -status => 301); +# return ''; +# } +# +# # Redirect old /?id=NNN URLs to /report/NNN +# if (!@errors && !scalar keys %field_errors && $ENV{SCRIPT_URL} eq '/') { +# print $q->redirect(-location => $base . '/report/' . $input{id}, -status => 301); +# return ''; +# } +# +# # Get all information from database +# return display_location($q, _('Unknown problem ID')) if !$input{id} || $input{id} =~ /\D/; +# my $problem = Problems::fetch_problem($input{id}); +# return display_location($q, _('Unknown problem ID')) unless $problem; +# return front_page($q, _('That report has been removed from FixMyStreet.'), '410 Gone') if $problem->{state} eq 'hidden'; +# +# my $extra_data = Cobrand::extra_data($cobrand, $q); +# my $google_link = Cobrand::base_url_for_emails($cobrand, $extra_data) +# . '/report/' . $problem->{id}; +# +# # truncate the lat,lon for nicer rss urls +# my ( $short_lat, $short_lon ) = +# map { Utils::truncate_coordinate($_) } # +# ( $problem->{latitude}, $problem->{longitude} ); +# +# my $map_links = ''; +# $map_links = "<p id='sub_map_links'>" +# . "<a href=\"http://maps.google.co.uk/maps?output=embed&z=16&q=" +# . URI::Escape::uri_escape_utf8( $problem->{title} . ' - ' . $google_link ) +# . "\@$short_lat,$short_lon\">View on Google Maps</a></p>" +# if mySociety::Config::get('COUNTRY') eq 'GB'; +# +# my $banner; +# if ($q->{site} ne 'emptyhomes' && $problem->{state} eq 'confirmed' && $problem->{duration} > 8*7*24*60*60) { +# $banner = $q->p({id => 'unknown'}, _('This problem is old and of unknown status.')); +# } +# if ($problem->{state} eq 'fixed') { +# $banner = $q->p({id => 'fixed'}, _('This problem has been fixed') . '.'); +# } +# +# my $contact_url = Cobrand::url($cobrand, NewURL($q, -retain => 1, pc => undef, x => undef, 'y' => undef, -url=>'/contact?id=' . $input{id}), $q); +# my $back = Cobrand::url($cobrand, NewURL($q, -url => '/', +# lat => $short_lat, lon => $short_lon, +# -retain => 1, pc => undef, x => undef, 'y' => undef, id => undef +# ), $q); +# my $fixed = ($input{fixed}) ? ' checked' : ''; +# +# my %vars = ( +# banner => $banner, +# map_start => FixMyStreet::Map::display_map($q, +# latitude => $problem->{latitude}, longitude => $problem->{longitude}, +# type => 0, +# pins => $problem->{used_map} ? [ [ $problem->{latitude}, $problem->{longitude}, 'blue' ] ] : [], +# post => $map_links +# ), +# map_end => FixMyStreet::Map::display_map_end(0), +# problem_title => ent($problem->{title}), +# problem_meta => Page::display_problem_meta_line($q, $problem), +# problem_detail => Page::display_problem_detail($problem), +# problem_photo => Page::display_problem_photo($q, $problem), +# problem_updates => Page::display_problem_updates($input{id}, $q), +# unsuitable => $q->a({rel => 'nofollow', href => $contact_url}, _('Offensive? Unsuitable? Tell us')), +# more_problems => '<a href="' . $back . '">' . _('More problems nearby') . '</a>', +# url_home => Cobrand::url($cobrand, '/', $q), +# alert_link => Cobrand::url($cobrand, NewURL($q, -url => '/alert?type=updates;id='.$input_h{id}, -retain => 1, pc => undef, x => undef, 'y' => undef ), $q), +# alert_text => _('Email me updates'), +# email_label => _('Email:'), +# subscribe => _('Subscribe'), +# blurb => _('Receive email when updates are left on this problem'), +# cobrand_form_elements1 => Cobrand::form_elements($cobrand, 'alerts', $q), +# form_alert_action => Cobrand::url($cobrand, '/alert', $q), +# rss_url => Cobrand::url($cobrand, NewURL($q, -retain=>1, -url => '/rss/'.$input_h{id}, pc => undef, x => undef, 'y' => undef, id => undef), $q), +# rss_title => _('RSS feed'), +# rss_alt => _('RSS feed of updates to this problem'), +# update_heading => $q->h2(_('Provide an update')), +# field_errors => \%field_errors, +# add_alert_checked => ($input{add_alert} || !$input{submit_update}) ? ' checked' : '', +# fixedline_box => $problem->{state} eq 'fixed' ? '' : qq{<input type="checkbox" name="fixed" id="form_fixed" value="1"$fixed>}, +# fixedline_label => $problem->{state} eq 'fixed' ? '' : qq{<label for="form_fixed">} . _('This problem has been fixed') . qq{</label>}, +# name_label => _('Name:'), +# update_label => _('Update:'), +# alert_label => _('Alert me to future updates'), +# post_label => _('Post'), +# cobrand_form_elements => Cobrand::form_elements($cobrand, 'updateForm', $q), +# form_action => Cobrand::url($cobrand, '/', $q), +# input_h => \%input_h, +# optional => _('(optional)'), +# ); +# +# $vars{update_blurb} = $q->p($q->small(_('Please note that updates are not sent to the council. If you leave your name it will be public. Your information will only be used in accordance with our <a href="/faq#privacy">privacy policy</a>'))) +# unless $q->{site} eq 'emptyhomes'; # No council blurb +# +# if (@errors) { +# $vars{errors} = '<ul class="error"><li>' . join('</li><li>', @errors) . '</li></ul>'; +# } +# +# my $allow_photo_upload = Cobrand::allow_photo_upload($cobrand); +# if ($allow_photo_upload) { +# my $photo_label = _('Photo:'); +# $vars{enctype} = ' enctype="multipart/form-data"'; +# $vars{photo_element} = <<EOF; +# <div id="fileupload_normalUI"> +# <label for="form_photo">$photo_label</label> +# <input type="file" name="photo" id="form_photo"> +# </div> +# EOF +# } +# +# my %params = ( +# rss => [ _('Updates to this problem, FixMyStreet'), "/rss/$input_h{id}" ], +# robots => 'index, nofollow', +# js => FixMyStreet::Map::header_js(), +# title => $problem->{title} +# ); +# +# my $page = Page::template_include('problem', $q, Page::template_root($q), %vars); +# return ($page, %params); +# } +# |