diff options
Diffstat (limited to 'perllib/FixMyStreet')
-rw-r--r-- | perllib/FixMyStreet/Alert.pm | 15 | ||||
-rw-r--r-- | perllib/FixMyStreet/Geocode.pm | 1 | ||||
-rw-r--r-- | perllib/FixMyStreet/Map/OSM.pm | 2 |
3 files changed, 8 insertions, 10 deletions
diff --git a/perllib/FixMyStreet/Alert.pm b/perllib/FixMyStreet/Alert.pm index 6b50e62e6..29932a0a5 100644 --- a/perllib/FixMyStreet/Alert.pm +++ b/perllib/FixMyStreet/Alert.pm @@ -253,12 +253,10 @@ sub generate_rss ($$$;$$$$) { throw FixMyStreet::Alert::Error('Unknown alert type') unless $alert_type; # Do our own encoding - my $rss = new XML::RSS( version => '2.0', encoding => 'UTF-8', stylesheet=> $xsl, encode_output => undef ); $rss->add_module(prefix=>'georss', uri=>'http://www.georss.org/georss'); - # XXX: Not generic # Only apply a site restriction if the alert uses the problem table $site_restriction = '' unless $alert_type->{item_table} eq 'problem'; my $query = 'select * from ' . $alert_type->{item_table} . ' where ' @@ -274,19 +272,19 @@ sub generate_rss ($$$;$$$$) { $q->execute(); } - my @months = ('', 'January','February','March','April','May','June', - 'July','August','September','October','November','December'); while (my $row = $q->fetchrow_hashref) { - # XXX: How to do this properly? name might be null in comment table, hence needing this - my $pubDate; + $row->{name} ||= 'anonymous'; - # And we want pretty dates... :-/ + + my $pubDate; if ($row->{confirmed}) { $row->{confirmed} =~ /^(\d\d\d\d)-(\d\d)-(\d\d) (\d\d):(\d\d):(\d\d)/; $pubDate = mySociety::Locale::in_gb_locale { strftime("%a, %d %b %Y %H:%M:%S %z", $6, $5, $4, $3, $2-1, $1-1900, -1, -1, 0) }; - $row->{confirmed} = ordinal($3+0) . ' ' . $months[$2]; + $row->{confirmed} = strftime("%e %B", $6, $5, $4, $3, $2-1, $1-1900, -1, -1, 0); + $row->{confirmed} =~ s/^\s+//; + $row->{confirmed} =~ s/^(\d+)/ordinal($1)/e if $mySociety::Locale::lang eq 'en-gb'; } (my $title = _($alert_type->{item_title})) =~ s/{{(.*?)}}/$row->{$1}/g; @@ -301,7 +299,6 @@ sub generate_rss ($$$;$$$$) { ); $item{pubDate} = $pubDate if $pubDate; - # XXX: Not-very-generic extensions, at all my $display_photos = Cobrand::allow_photo_display($cobrand); if ($display_photos && $row->{photo}) { $item{description} .= ent("\n<br><img src=\"". Cobrand::url($cobrand, $url, $http_q) . "/photo?id=$row->{id}\">"); diff --git a/perllib/FixMyStreet/Geocode.pm b/perllib/FixMyStreet/Geocode.pm index 17a4d8539..803e32a85 100644 --- a/perllib/FixMyStreet/Geocode.pm +++ b/perllib/FixMyStreet/Geocode.pm @@ -106,6 +106,7 @@ sub string { || mySociety::Config::get('COUNTRY') ne 'GB'; $url .= '&sensor=false&key=' . mySociety::Config::get('GOOGLE_MAPS_API_KEY'); $js = LWP::Simple::get($url); + $js = encode_utf8($js) if utf8::is_utf8($js); File::Path::mkpath($cache_dir); File::Slurp::write_file($cache_file, $js) if $js && $js !~ /"code":6[12]0/; } diff --git a/perllib/FixMyStreet/Map/OSM.pm b/perllib/FixMyStreet/Map/OSM.pm index 820a4ce63..7953d16e2 100644 --- a/perllib/FixMyStreet/Map/OSM.pm +++ b/perllib/FixMyStreet/Map/OSM.pm @@ -13,7 +13,7 @@ use mySociety::Web qw(ent); sub header_js { return ' -<script type="text/javascript" src="http://openlayers.org/api/OpenLayers.js"></script> +<script type="text/javascript" src="/jslib/OpenLayers-2.10/OpenLayers.js"></script> <script type="text/javascript" src="/js/map-OpenStreetMap.js"></script> '; } |