diff options
-rwxr-xr-x | web/reports.cgi | 5 | ||||
-rwxr-xr-x | web/rss.cgi | 16 | ||||
-rw-r--r-- | web/xsl.eha.xsl | 95 | ||||
-rw-r--r-- | web/xsl.xsl | 1 |
4 files changed, 107 insertions, 10 deletions
diff --git a/web/reports.cgi b/web/reports.cgi index 91d90d7de..0450a4bc0 100755 --- a/web/reports.cgi +++ b/web/reports.cgi @@ -7,7 +7,7 @@ # Copyright (c) 2007 UK Citizens Online Democracy. All rights reserved. # Email: matthew@mysociety.org. WWW: http://www.mysociety.org # -# $Id: reports.cgi,v 1.23 2008-11-17 18:01:26 matthew Exp $ +# $Id: reports.cgi,v 1.24 2008-12-08 10:54:16 matthew Exp $ use strict; use Standard; @@ -95,7 +95,8 @@ sub main { $type = 'area_problems'; # Problems within an area } print $q->header( -type => 'application/xml; charset=utf-8' ); - my $out = mySociety::Alert::generate_rss($type, "/$url", \@params, \%title_params); + my $xsl = $q->{site} eq 'emptyhomes' ? '/xsl.eha.xsl' : '/xsl.xsl'; + my $out = mySociety::Alert::generate_rss($type, $xsl, "/$url", \@params, \%title_params); $out =~ s/FixMyStreet/EnviroCrime/g if $q->{site} eq 'scambs'; $out =~ s/matthew.fixmystreet/scambs.matthew.fixmystreet/g if $q->{site} eq 'scambs'; # XXX Temp $out =~ s/matthew.fixmystreet/emptyhomes.matthew.fixmystreet/g if $q->{site} eq 'emptyhomes'; diff --git a/web/rss.cgi b/web/rss.cgi index ea9a15237..e89629a73 100755 --- a/web/rss.cgi +++ b/web/rss.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: rss.cgi,v 1.25 2008-09-25 12:55:07 matthew Exp $ +# $Id: rss.cgi,v 1.26 2008-12-08 10:54:16 matthew Exp $ use strict; use Error qw(:try); @@ -20,26 +20,27 @@ use mySociety::Gaze; sub main { my $q = shift; my $type = $q->param('type') || ''; + my $xsl = $q->{site} eq 'emptyhomes' ? '/xsl.eha.xsl' : '/xsl.xsl'; my $out; if ($type eq 'local_problems') { $out = rss_local_problems($q); } elsif ($type eq 'new_updates') { my $id = $q->param('id'); my $qs = 'report/' . $id; - $out = mySociety::Alert::generate_rss($type, $qs, [$id]); + $out = mySociety::Alert::generate_rss($type, $xsl, $qs, [$id]); } elsif ($type eq 'new_problems' || $type eq 'new_fixed_problems') { - $out = mySociety::Alert::generate_rss($type, ''); + $out = mySociety::Alert::generate_rss($type, $xsl, ''); } elsif ($type eq 'council_problems') { my $id = $q->param('id'); my $qs = '/'.$id; - $out = mySociety::Alert::generate_rss($type, $qs, [$id]); + $out = mySociety::Alert::generate_rss($type, $xsl, $qs, [$id]); } elsif ($type eq 'area_problems') { my $id = $q->param('id'); my $va_info = mySociety::MaPit::get_voting_area_info($id); my $qs = '/'.$id; - $out = mySociety::Alert::generate_rss($type, $qs, [$id], { NAME => $va_info->{name} }); + $out = mySociety::Alert::generate_rss($type, $xsl, $qs, [$id], { NAME => $va_info->{name} }); } elsif ($type eq 'all_problems') { - $out = mySociety::Alert::generate_rss($type, ''); + $out = mySociety::Alert::generate_rss($type, $xsl, ''); } else { print $q->redirect('http://www.fixmystreet.com/alert'); exit; @@ -91,6 +92,7 @@ sub rss_local_problems { $d = mySociety::Gaze::get_radius_containing_population($lat, $lon, 200000); $d = int($d*10+0.5)/10; } - return mySociety::Alert::generate_rss('local_problems', $qs, [$e, $n, $d]); + my $xsl = $q->{site} eq 'emptyhomes' ? '/xsl.eha.xsl' : '/xsl.xsl'; + return mySociety::Alert::generate_rss('local_problems', $xsl, $qs, [$e, $n, $d]); } diff --git a/web/xsl.eha.xsl b/web/xsl.eha.xsl new file mode 100644 index 000000000..b79abb9f5 --- /dev/null +++ b/web/xsl.eha.xsl @@ -0,0 +1,95 @@ +<?xml version="1.0" encoding="ISO-8859-1"?> +<xsl:stylesheet version="1.1" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> + <xsl:output method="html" /> + <xsl:variable name="title" select="/rss/channel/title"/> + <xsl:variable name="uri" select="/rss/channel/uri"/> + <xsl:template match="/"> +<html lang="en-gb"> + <head> + <title><xsl:value-of select="$title"/> RSS Feed</title> + <link rel="stylesheet" href="/css/core.css"/> + <link rel="stylesheet" href="/css/emptyhomes.css"/> + </head> + <body> + <div id="header"><a href="http://www.emptyhomes.com/"><img border="0" src="/i/eha.png" alt="Empty Homes Agency" width="272" height="71"/></a></div> + <div id="navigation"> + <ul> + <li><a href="/">Report a property</a></li> + <li><a href="/reports">Reports</a></li> + <li><a href="/alert">Get local reports</a></li> + <li><a href="/faq">FAQs</a></li> + <li><a href="/about">About us</a></li> + </ul> + </div> + + <div id="wrapper"><div id="content"> + <xsl:apply-templates select="rss/channel"/> + </div></div> + +<div id="footer"> +Empty Homes Agency <br/> +Downstream Building, 1 London Bridge, London, SE1 9BG + +<br/> +Tel: 020 7022 1870 <br/> +Fax: 020 7681 3214 <br/> +Email: <a href="mailto:info@emptyhomes.com">info@emptyhomes.com</a> +</div> + +</body> +</html> + </xsl:template> + + <xsl:template match="channel"> + <div id="rss_box"> + <h1>What is this page?</h1> + <p>This is an RSS feed from the ReportEmptyHomes website. RSS feeds allow you to stay up to date with the latest changes and additions to the site. + To subscribe to it, you will need a News Reader or other similar device. + <br/> + <a href="http://news.bbc.co.uk/1/hi/help/3223484.stm#whatisrss"><strong>Help</strong>, I don't know what a news reader is and still don't know what this is about <small>(from the BBC)</small>.</a></p> + </div> + + <p>Below is the latest content available from this feed, + <a href="#" class="item"><img height="16" hspace="5" vspace="0" border="0" width="16" alt="RSS News feeds" src="/i/feed.png" title="RSS News feeds" /><xsl:value-of select="$title"/></a>.</p> + + <div id="rss_items"><ul><xsl:apply-templates select="item"/></ul></div> + <div id="rss_rhs"> + <h2 style="margin:0">Subscribe to this feed</h2> + <p>You can subscribe to this RSS feed in a number of ways, including the following:</p> + <ul> + <li>Drag the orange RSS button into your News Reader</li> + <li>Drag the URL of the RSS feed into your News Reader</li> + <li>Cut and paste the URL of the RSS feed into your News Reader</li> + </ul> + <h3>One-click subscriptions</h3> + <p>If you use one of the following web-based News Readers, click on the appropriate button to subscribe to the RSS feed.</p> +<a href="http://www.bloglines.com/sub/{uri}"><img height="18" width="91" hspace="3" vspace="3" border="0" alt="bloglines" src="http://newsimg.bbc.co.uk/shared/bsp/xsl/rss/img/bloglines.gif" /></a> +<a href="http://www.feedzilla.com/mini/default.asp?ref=bbc&url={uri}"><img height="22" width="93" hspace="3" vspace="3" border="0" alt="feedzilla" src="http://newsimg.bbc.co.uk/shared/bsp/xsl/rss/img/feedzilla.gif" /></a> +<a href="http://add.my.yahoo.com/rss?url={uri}"><img height="17" width="91" hspace="3" vspace="3" border="0" alt="my yahoo" src="http://newsimg.bbc.co.uk/shared/bsp/xsl/rss/img/myyahoo.gif" /></a> +<a href="http://www.newsgator.com/ngs/subscriber/subext.aspx?url={uri}"><img height="17" width="91" hspace="3" vspace="3" border="0" alt="newsgator" src="http://newsimg.bbc.co.uk/shared/bsp/xsl/rss/img/newsgator.gif" /></a> +<a href="http://www.live.com/?add={uri}"><img height="17" width="91" hspace="3" vspace="3" border="0" alt="Microsoft Live" src="http://newsimg.bbc.co.uk/shared/bsp/xsl/rss/img/windowslive.gif" /></a> +<a href="http://feeds.my.aol.com/add.jsp?url={uri}"><img hspace="3" src="http://o.aolcdn.com/myfeeds/html/vis/myaol_cta1.gif" alt="Add to My AOL" border="0"/></a> +<a href="http://www.netvibes.com/subscribe.php?url={uri}"><img hspace="3" src="http://www.netvibes.com/img/add2netvibes.gif" alt="Add to netvibes" /></a> +<a href="http://fusion.google.com/add?feedurl={uri}"><img hspace="3" src="http://buttons.googlesyndication.com/fusion/add.gif" width="104" height="17" alt="Add to Google"/></a> +<a href="http://www.pageflakes.com/subscribe.aspx?url={uri}"><img hspace="3" src="http://www.pageflakes.com/subscribe2.gif" border="0"/></a> + +<ul> +<li><a href="http://google.com/reader/view/feed/{uri}">Google Reader</a></li> +<li><a href="http://my.msn.com/addtomymsn.armx?id=rss&ut={uri}&tt=CENTRALDIRECTORY&ru=http://rss.msn.com">My MSN</a></li> +<li><a href="http://127.0.0.1:5335/system/pages/subscriptions?url={uri}">Userland</a></li> +<li><a href="http://127.0.0.1:8888/index.html?add_url={uri}">Amphetadesk</a></li> +<li><a href="http://www.feedmarker.com/admin.php?do=add_feed&url={uri}">Feedmarker</a></li> +</ul> + + </div> + + </xsl:template> + + <xsl:template match="item"> + <li> + <a href="{link}" class="item"><xsl:value-of select="title"/></a><br/> + <div><xsl:value-of disable-output-escaping="yes" select="description" /></div> + </li> + </xsl:template> + +</xsl:stylesheet> diff --git a/web/xsl.xsl b/web/xsl.xsl index f40dc2865..646eecc84 100644 --- a/web/xsl.xsl +++ b/web/xsl.xsl @@ -61,7 +61,6 @@ href="https://secure.mysociety.org/cvstrac/dir?d=mysociety/services/TilMa">code< <a href="http://www.newsgator.com/ngs/subscriber/subext.aspx?url={uri}"><img height="17" width="91" hspace="3" vspace="3" border="0" alt="newsgator" src="http://newsimg.bbc.co.uk/shared/bsp/xsl/rss/img/newsgator.gif" /></a> <a href="http://www.live.com/?add={uri}"><img height="17" width="91" hspace="3" vspace="3" border="0" alt="Microsoft Live" src="http://newsimg.bbc.co.uk/shared/bsp/xsl/rss/img/windowslive.gif" /></a> <a href="http://feeds.my.aol.com/add.jsp?url={uri}"><img hspace="3" src="http://o.aolcdn.com/myfeeds/html/vis/myaol_cta1.gif" alt="Add to My AOL" border="0"/></a> -<a href="http://www.rojo.com/add-subscription?resource={uri}"><img hspace="3" src="http://www.rojo.com/corporate/images/add-to-rojo.gif" alt="Subscribe in Rojo"/></a> <a href="http://www.netvibes.com/subscribe.php?url={uri}"><img hspace="3" src="http://www.netvibes.com/img/add2netvibes.gif" alt="Add to netvibes" /></a> <a href="http://fusion.google.com/add?feedurl={uri}"><img hspace="3" src="http://buttons.googlesyndication.com/fusion/add.gif" width="104" height="17" alt="Add to Google"/></a> <a href="http://www.pageflakes.com/subscribe.aspx?url={uri}"><img hspace="3" src="http://www.pageflakes.com/subscribe2.gif" border="0"/></a> |