diff options
Diffstat (limited to 'perllib/FixMyStreet/App/Controller/Around.pm')
-rw-r--r-- | perllib/FixMyStreet/App/Controller/Around.pm | 185 |
1 files changed, 183 insertions, 2 deletions
diff --git a/perllib/FixMyStreet/App/Controller/Around.pm b/perllib/FixMyStreet/App/Controller/Around.pm index 6a6e82d02..4cdf07dad 100644 --- a/perllib/FixMyStreet/App/Controller/Around.pm +++ b/perllib/FixMyStreet/App/Controller/Around.pm @@ -54,8 +54,189 @@ sub around_index : Path : Args(0) { warn "FIXME - implement"; # Show the nearby reports - die "show nearby reports"; - + $c->forward('display_location'); + +} + +=head2 display_location + +Display a specific lat/lng location (which may have come from a pc search). + +=cut + +sub display_location : Private { + my ( $self, $c ) = @_; + +# # Deal with pin hiding/age +# my ( $hide_link, $hide_text, $all_link, $all_text, $interval ); +# if ( $input{all_pins} ) { +# $all_link = +# NewURL( $q, -retain => 1, no_pins => undef, all_pins => undef ); +# $all_text = _('Hide stale reports'); +# } +# else { +# $all_link = NewURL( $q, -retain => 1, no_pins => undef, all_pins => 1 ); +# $all_text = _('Include stale reports'); +# $interval = '6 months'; +# } + +# my ( $on_map_all, $on_map, $around_map, $dist ) = +# FixMyStreet::Map::map_features( $q, $latitude, $longitude, $interval ); +# my @pins; +# foreach (@$on_map_all) { +# push @pins, +# [ +# $_->{latitude}, $_->{longitude}, +# ( $_->{state} eq 'fixed' ? 'green' : 'red' ), $_->{id} +# ]; +# } +# my $on_list = ''; +# foreach (@$on_map) { +# my $report_url = NewURL( $q, -url => '/report/' . $_->{id} ); +# $report_url = Cobrand::url( $cobrand, $report_url, $q ); +# $on_list .= '<li><a href="' . $report_url . '">'; +# $on_list .= ent( $_->{title} ) . '</a> <small>('; +# $on_list .= Page::prettify_epoch( $q, $_->{time}, 1 ) . ')</small>'; +# $on_list .= ' <small>' . _('(fixed)') . '</small>' +# if $_->{state} eq 'fixed'; +# $on_list .= '</li>'; +# } +# $on_list = $q->li( _('No problems have been reported yet.') ) +# unless $on_list; +# +# my $around_list = ''; +# foreach (@$around_map) { +# my $report_url = +# Cobrand::url( $cobrand, NewURL( $q, -url => '/report/' . $_->{id} ), +# $q ); +# $around_list .= '<li><a href="' . $report_url . '">'; +# my $dist = int( $_->{distance} * 10 + 0.5 ); +# $dist = $dist / 10; +# $around_list .= ent( $_->{title} ) . '</a> <small>('; +# $around_list .= Page::prettify_epoch( $q, $_->{time}, 1 ) . ', '; +# $around_list .= $dist . 'km)</small>'; +# $around_list .= ' <small>' . _('(fixed)') . '</small>' +# if $_->{state} eq 'fixed'; +# $around_list .= '</li>'; +# push @pins, +# [ +# $_->{latitude}, $_->{longitude}, +# ( $_->{state} eq 'fixed' ? 'green' : 'red' ), $_->{id} +# ]; +# } +# $around_list = $q->li( _('No problems found.') ) +# unless $around_list; + +# if ( $input{no_pins} ) { +# $hide_link = NewURL( $q, -retain => 1, no_pins => undef ); +# $hide_text = _('Show pins'); +# @pins = (); +# } +# else { +# $hide_link = NewURL( $q, -retain => 1, no_pins => 1 ); +# $hide_text = _('Hide pins'); +# } + +# my $map_links = +# "<p id='sub_map_links'><a id='hide_pins_link' rel='nofollow' href='$hide_link'>$hide_text</a>"; +# if ( mySociety::Config::get('COUNTRY') eq 'GB' ) { +# $map_links .= +# " | <a id='all_pins_link' rel='nofollow' href='$all_link'>$all_text</a></p> <input type='hidden' id='all_pins' name='all_pins' value='$input_h{all_pins}'>"; +# } +# else { +# $map_links .= "</p>"; +# } + +# # truncate the lat,lon for nicer rss urls, and strings for outputting +# my ( $short_lat, $short_lon ) = +# map { Utils::truncate_coordinate($_) } # +# ( $latitude, $longitude ); +# +# my $url_skip = NewURL( +# $q, +# -url => '/report/new', +# -retain => 1, +# x => undef, +# y => undef, +# latitude => $short_lat, +# longitude => $short_lon, +# submit_map => 1, +# skipped => 1 +# ); +# +# my $pc_h = ent( $q->param('pc') || '' ); +# +# my $rss_url; +# if ($pc_h) { +# $rss_url = "/rss/pc/" . URI::Escape::uri_escape_utf8($pc_h); +# } +# else { +# $rss_url = "/rss/l/$short_lat,$short_lon"; +# } +# $rss_url = Cobrand::url( $cobrand, NewURL( $q, -url => $rss_url ), $q ); +# +# my %vars = ( +# 'map' => FixMyStreet::Map::display_map( +# $q, +# latitude => $short_lat, +# longitude => $short_lon, +# type => 1, +# pins => \@pins, +# post => $map_links +# ), +# map_end => FixMyStreet::Map::display_map_end(1), +# url_home => Cobrand::url( $cobrand, '/', $q ), +# url_rss => $rss_url, +# url_email => Cobrand::url( +# $cobrand, +# NewURL( +# $q, +# lat => $short_lat, +# lon => $short_lon, +# -url => '/alert', +# feed => "local:$short_lat:$short_lon" +# ), +# $q +# ), +# url_skip => $url_skip, +# email_me => _('Email me new local problems'), +# rss_alt => _('RSS feed'), +# rss_title => _('RSS feed of recent local problems'), +# reports_on_around => $on_list, +# reports_nearby => $around_list, +# heading_problems => _('Problems in this area'), +# heading_on_around => _('Reports on and around the map'), +# heading_closest => sprintf( +# _('Closest nearby problems <small>(within %skm)</small>'), +# $dist +# ), +# distance => $dist, +# pc_h => $pc_h, +# errors => @errors +# ? '<ul class="error"><li>' . join( '</li><li>', @errors ) . '</li></ul>' +# : '', +# text_to_report => _( +# 'To report a problem, simply +# <strong>click on the map</strong> at the correct location.' +# ), +# text_skip => sprintf( +# _( +# "<small>If you cannot see the map, <a href='%s' rel='nofollow'>skip this +# step</a>.</small>" +# ), +# $url_skip +# ), +# ); +# +# my %params = ( +# rss => [ _('Recent local problems, FixMyStreet'), $rss_url ], +# js => FixMyStreet::Map::header_js(), +# robots => 'noindex,nofollow', +# ); +# +# return ( +# Page::template_include( 'map', $q, Page::template_root($q), %vars ), +# %params ); } =head2 determine_location_from_coords |