diff options
-rw-r--r-- | conf/general-example | 3 | ||||
-rw-r--r-- | db/alert_types.sql | 2 | ||||
-rw-r--r-- | web/css.css | 27 | ||||
-rw-r--r-- | web/i/feed.gif | bin | 0 -> 652 bytes | |||
-rwxr-xr-x | web/index.cgi | 12 | ||||
-rwxr-xr-x | web/rss.cgi | 36 | ||||
-rw-r--r-- | web/xsl.xsl | 82 |
7 files changed, 126 insertions, 36 deletions
diff --git a/conf/general-example b/conf/general-example index 1fbd26469..8aaa531aa 100644 --- a/conf/general-example +++ b/conf/general-example @@ -14,7 +14,7 @@ * Copyright (c) 2006 UK Citizens Online Democracy. All rights reserved. * Email: francis@mysociety.org; WWW: http://www.mysociety.org * - * $Id: general-example,v 1.6 2006-10-10 15:53:04 matthew Exp $ + * $Id: general-example,v 1.7 2007-01-26 14:19:41 matthew Exp $ * */ @@ -27,6 +27,7 @@ define('OPTION_BCI_DB_PASS', ''); define('OPTION_BASE_URL', 'http://www.example.org'); define('OPTION_CONTACT_EMAIL', 'team@example.org'); +define('OPTION_CONTACT_NAME', 'Neighbourhood Fix-It'); define('OPTION_STAGING_SITE', 1); define('OPTION_GEO_CACHE', '/cache/'); diff --git a/db/alert_types.sql b/db/alert_types.sql index 33a2ae093..5e69f5b97 100644 --- a/db/alert_types.sql +++ b/db/alert_types.sql @@ -2,7 +2,7 @@ insert into alert_type (ref, head_sql_query, head_table, head_title, head_link, head_description, item_table, item_where, item_order, item_title, item_link, item_description, template) values ('new_updates', 'select * from problem where id=?', 'problem', - 'Updates on {{title}}', '/?id={{id}}', 'Updates on {{title}}', + 'Updates on {{title}}', '/', 'Updates on {{title}}', 'comment', 'comment.state=\'confirmed\'', 'created desc', 'Update by {{name}}', '/?id={{problem_id}}#comment_{{id}}', '{{text}}', 'alert-update'); diff --git a/web/css.css b/web/css.css index 68a67bb2a..2b1f93e08 100644 --- a/web/css.css +++ b/web/css.css @@ -58,11 +58,15 @@ dt { font-size: larger; } +ul { + padding: 0 0 0 1.5em; + margin: 0; +} + ul#error { color: #cc0000; background-color: #ffeeee; - margin: 0; - padding: 0 4px 0 1.5em; + padding-right: 4px; border: solid 1px #cc0000; text-align: left; } @@ -229,7 +233,7 @@ fieldset div.checkbox label, label.n { background-color: #ffffff; color: #000000; float: right; - margin: 0 1em 1em; + margin: 0 1em 0.5em; } #compass img { @@ -253,3 +257,20 @@ ol#current img { #comments div em { border-bottom: dotted 1px #5e552b; } + +#rss_items { + width:62%; + float:left; +} +#rss_rhs { + border-left:1px dashed #999; + width:36%; + float:right; + padding: 0 0 0 0.5em; + margin: 0 0 1em 0.5em; +} +#rss_box { + padding:10px; + border:1px solid #999999; +} + diff --git a/web/i/feed.gif b/web/i/feed.gif Binary files differnew file mode 100644 index 000000000..b0e4adf1d --- /dev/null +++ b/web/i/feed.gif diff --git a/web/index.cgi b/web/index.cgi index 3218c1072..55538ac19 100755 --- a/web/index.cgi +++ b/web/index.cgi @@ -6,7 +6,7 @@ # Copyright (c) 2006 UK Citizens Online Democracy. All rights reserved. # Email: matthew@mysociety.org. WWW: http://www.mysociety.org # -# $Id: index.cgi,v 1.57 2007-01-26 01:01:23 matthew Exp $ +# $Id: index.cgi,v 1.58 2007-01-26 14:19:42 matthew Exp $ # TODO # Nothing is done about the update checkboxes - not stored anywhere on anything! @@ -411,7 +411,7 @@ EOF $out .= <<EOF; </ol> <h2>Recent problems reported within 10km</h2> - <p><a href="/rss/$x,$y?choose=1">RSS feed</a></p> + <p><a href="/rss/$x,$y"><img align="right" src="/i/feed.gif" width="16" height="16" alt="RSS feed" border="0"></a></p> <ol id="current" start="$list_start"> EOF foreach (@$current) { @@ -466,6 +466,7 @@ sub display_problem { my ($pins) = map_pins($q, $x_tile, $y_tile, $input{id}); my $out = display_map($q, $x_tile, $y_tile, 0, 1, $pins); + $out .= "<h1>$title</h1>"; $out .= <<EOF; <script type="text/javascript"> @@ -484,7 +485,7 @@ EOF } my $back = NewURL($q, id=>undef, x=>$x_tile, y=>$y_tile); - $out .= '<p align="right"><a href="' . $back . '">Back to listings</a></p>'; + $out .= '<p style="padding-bottom: 0.5em; border-bottom: dotted 1px #999999;" align="right"><a href="' . $back . '">Back to listings</a></p>'; # Display updates my $updates = select_all( @@ -492,7 +493,9 @@ EOF from comment where problem_id = ? and state='confirmed' order by created desc", $input{id}); if (@$updates) { - $out .= '<div id="updates"> <h2>Updates</h2>'; + $out .= '<div id="updates">'; + $out .= '<a href="/rss/'.$input_h{id}.'"><img align="right" src="/i/feed.gif" width="16" height="16" alt="RSS feed of updates to this problem" border="0"></a>'; + $out .= '<h2>Updates</h2>'; foreach my $row (@$updates) { $out .= "<div><em>Posted by $row->{name} at " . prettify_epoch($row->{created}); $out .= ', marked fixed' if ($row->{mark_fixed}); @@ -505,7 +508,6 @@ EOF $out .= <<EOF; <h2>Follow this problem</h2> <ul> -<li><a href="/rss/$input_h{id}?choose=1">RSS feed of updates on this problem</a> <li>Receive email when updates are left on this problem. <form action="alert" method="post"> <label class="n" for="alert_email">Email:</label> diff --git a/web/rss.cgi b/web/rss.cgi index 757f98e85..0fd0e8602 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.1 2007-01-26 01:01:23 matthew Exp $ +# $Id: rss.cgi,v 1.2 2007-01-26 14:19:42 matthew Exp $ use strict; require 5.8.0; @@ -37,35 +37,19 @@ BEGIN { sub main { my $q = shift; my $type = $q->param('type') || ''; - my $choose = $q->param('choose'); - if ($choose) { - print Page::header($q, 'Choose RSS feed'); - my $url = $ENV{SCRIPT_URI}; - $url = uri_escape($url); - print <<EOF; -<ul> -<li><a href="http://www.bloglines.com/sub?url=$url">Bloglines</a> -<li><a href="http://google.com/reader/view/feed/$url">Google Reader</a> -<li><a href="http://add.my.yahoo.com/content?url=$url">My Yahoo!</a> -<li><a href="http://my.msn.com/addtomymsn.armx?id=rss&ut=$url&tt=CENTRALDIRECTORY&ru=http://rss.msn.com">My MSN</a> -<li><a href="http://127.0.0.1:5335/system/pages/subscriptions?url=$url">Userland</a> -<li><a href="http://127.0.0.1:8888/index.html?add_url=$url">Amphetadesk</a> -<li><a href="http://www.feedmarker.com/admin.php?do=add_feed&url=$url">Feedmarker</a> -<li><a href="$ENV{SCRIPT_URL}">Plain RSS</a> -</ul> -EOF - print Page::footer(); - return; - } if ($type eq 'local_problems') { - my $x = ($q->param('x') * 5000 / 31); - my $y = ($q->param('y') * 5000 / 31); - mySociety::Alert::generate_rss($type, $x, $y); + my $x = $q->param('x'); + my $y = $q->param('y'); + my $qs = 'x='.$x.';y='.$y; + $x = ($x * 5000 / 31); + $y = ($y * 5000 / 31); + mySociety::Alert::generate_rss($type, $qs, $x, $y); } elsif ($type eq 'new_updates') { my $id = $q->param('id'); - mySociety::Alert::generate_rss($type, $id); + my $qs = 'id='.$id; + mySociety::Alert::generate_rss($type, $qs, $id); } elsif ($type eq 'new_problems') { - mySociety::Alert::generate_rss($type); + mySociety::Alert::generate_rss($type, ''); } else { throw Error::Simple('Unknown alert type') unless $type; } diff --git a/web/xsl.xsl b/web/xsl.xsl new file mode 100644 index 000000000..1572193b4 --- /dev/null +++ b/web/xsl.xsl @@ -0,0 +1,82 @@ +<?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="self" select="/rss/channel/uri"/> + <xsl:template match="/"> +<html lang="en-gb"> + <head> + <title><xsl:value-of select="$title"/> XML Feed</title> + <link rel="stylesheet" href="/css.css"/> + </head> + <body> + <div id="header"><a href="/">Neighbourhood Fix-It</a></div> + <div id="wrapper"><div id="content"> + <xsl:apply-templates select="rss/channel"/> + </div></div> + +<h2 class="v">Navigation</h2> +<ul id="navigation"> +<li><a href="/">Home</a></li> +<li><a href="/faq">Information</a></li> +<li><a href="/contact">Contact</a></li> +</ul> + +<p id="footer">Built by <a href="http://www.mysociety.org/">mySociety</a>. +Using lots of <a href="http://www.ordnancesurvey.co.uk/">Ordnance Survey</a> data, under licence, +and some <a href="https://secure.mysociety.org/cvstrac/dir?d=mysociety/bci">clever</a> <a +href="https://secure.mysociety.org/cvstrac/dir?d=mysociety/services/TilMa">code</a>.</p> + +</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 Neighbourhood Fix-It 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 (from the BBC).</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.gif" 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" vspace="3" border="0" alt="bloglines" src="http://newsimg.bbc.co.uk/shared/bsp/xsl/rss/img/bloglines.gif" /></a><br /> + <a href="http://www.feedzilla.com/mini/default.asp?ref=bbc&url={uri}"><img height="22" width="93" vspace="3" border="0" alt="feedzilla" src="http://newsimg.bbc.co.uk/shared/bsp/xsl/rss/img/feedzilla.gif" /></a><br /> + <a href="http://add.my.yahoo.com/rss?url={uri}"><img height="17" width="91" vspace="3" border="0" alt="my yahoo" src="http://newsimg.bbc.co.uk/shared/bsp/xsl/rss/img/myyahoo.gif" /></a><br /> +<a href="http://www.newsgator.com/ngs/subscriber/subext.aspx?url={uri}"><img height="17" width="91" vspace="3" border="0" alt="newsgator" src="http://newsimg.bbc.co.uk/shared/bsp/xsl/rss/img/newsgator.gif" /></a><br /> +<a href="http://www.live.com/?add={uri}"><img height="17" width="91" vspace="3" border="0" alt="Microsoft Live" src="http://newsimg.bbc.co.uk/shared/bsp/xsl/rss/img/windowslive.gif" /></a><br /> + +<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 select="description" /></div> + </li> + </xsl:template> + +</xsl:stylesheet> |