Author: earle
Date: 2005-10-09 23:51:40 +0100 (Sun, 09 Oct 2005)
New Revision: 683
Modified:
trunk/Changes
trunk/lib/OpenGuides.pm
trunk/lib/OpenGuides/RDF.pm
trunk/lib/OpenGuides/Template.pm
trunk/t/21_rdf.t
trunk/templates/edit_form.tt
Log:
new "summary" metadata field
Modified: trunk/Changes
===================================================================
--- trunk/Changes 2005-10-09 21:26:12 UTC (rev 682)
+++ trunk/Changes 2005-10-09 22:51:40 UTC (rev 683)
@@ -1,4 +1,6 @@
0.51
+ New "summary" metadata field for one-line summaries of nodes.
+ Add "summary" field to RDF as dc:description.
Add "address" field that had got missed out from the RDF.
Replace underscores in node names in redirection message with spaces.
Redirection message now links to a rendered version of the old page
Modified: trunk/lib/OpenGuides/RDF.pm
===================================================================
--- trunk/lib/OpenGuides/RDF.pm 2005-10-09 21:26:12 UTC (rev 682)
+++ trunk/lib/OpenGuides/RDF.pm 2005-10-09 22:51:40 UTC (rev 683)
@@ -77,6 +77,7 @@
my $os_y = $node_data{metadata}{os_y}[0] || '';
my $catrefs = $node_data{metadata}{category};
my @locales = @{ $node_data{metadata}{locale} || [] };
+ my $summary = $node_data{metadata}{summary}[0] || '';
# replace any errant characters in data to prevent illegal XML
foreach ($phone, $fax, $website, $opening_hours_text, $postcode, $city, $country,
@@ -139,6 +140,8 @@
<$objType rdf:ID="obj" dc:title="$node_name">
};
+ $rdf .= " <dc:description>$summary</dc:description>\n" if $summary;
+
$rdf .= "\n <!-- categories -->\n\n" if $catrefs;
$rdf .= " <dc:subject>$_</dc:subject>\n" foreach @{$catrefs};
Modified: trunk/lib/OpenGuides/Template.pm
===================================================================
--- trunk/lib/OpenGuides/Template.pm 2005-10-09 21:26:12 UTC (rev 682)
+++ trunk/lib/OpenGuides/Template.pm 2005-10-09 22:51:40 UTC (rev 683)
@@ -281,18 +281,24 @@
my $hours_text = $args{metadata} ? $metadata{opening_hours_text}[0]
: $q->param("hours_text");
+
+ my $summary = $args{metadata} ? $metadata{summary}[0]
+ : $q->param("summary");
+
my %vars = (
categories => \@categories,
locales => \@locales,
category => \@catlist,
locale => \@loclist,
formatted_website_text => $formatted_website_text,
- hours_text => $hours_text
+ hours_text => $hours_text,
+ summary => $summary,
);
if ( $args{metadata} ) {
foreach my $var ( qw( phone fax address postcode os_x os_y osie_x
- osie_y latitude longitude map_link website) ) {
+ osie_y latitude longitude map_link website
+ summary) ) {
$vars{$var} = $metadata{$var}[0];
}
# Data for the distance search forms on the node display.
@@ -332,7 +338,7 @@
);
}
} else {
- foreach my $var ( qw( phone fax address postcode map_link website) ) {
+ foreach my $var ( qw( phone fax address postcode map_link website summary) ) {
$vars{$var} = $q->param($var);
}
Modified: trunk/lib/OpenGuides.pm
===================================================================
--- trunk/lib/OpenGuides.pm 2005-10-09 21:26:12 UTC (rev 682)
+++ trunk/lib/OpenGuides.pm 2005-10-09 22:51:40 UTC (rev 683)
@@ -733,7 +733,7 @@
}
}
- foreach my $var ( qw( username comment edit_type ) ) {
+ foreach my $var ( qw( summary username comment edit_type ) ) {
$metadata{$var} = $q->param($var) || "";
}
$metadata{host} = $ENV{REMOTE_ADDR};
Modified: trunk/t/21_rdf.t
===================================================================
--- trunk/t/21_rdf.t 2005-10-09 21:26:12 UTC (rev 682)
+++ trunk/t/21_rdf.t 2005-10-09 22:51:40 UTC (rev 683)
@@ -5,7 +5,7 @@
use OpenGuides::Utils;
use OpenGuides::Test;
use URI::Escape;
-use Test::More tests => 25;
+use Test::More tests => 26;
eval { require DBD::SQLite; };
my $have_sqlite = $@ ? 0 : 1;
@@ -57,7 +57,8 @@
website => "test website",
opening_hours_text => "test hours",
latitude => "51.524193",
- longitude => "-0.114436"
+ longitude => "-0.114436",
+ summary => "a nice pub",
}
);
@@ -98,6 +99,7 @@
like( $rdfxml, qr|<postalCode>WC1X 8JR</postalCode>|, "postcode" );
like( $rdfxml, qr|<geo:lat>51.524193</geo:lat>|, "latitude" );
like( $rdfxml, qr|<geo:long>-0.114436</geo:long>|, "longitude" );
+ like( $rdfxml, qr|<dc:description>a nice pub</dc:description>|, "summary (description)" );
like( $rdfxml, qr|<dc:date>|, "date element included" );
unlike( $rdfxml, qr|<dc:date>1970|, "hasn't defaulted to the epoch" );
Modified: trunk/templates/edit_form.tt
===================================================================
--- trunk/templates/edit_form.tt 2005-10-09 21:26:12 UTC (rev 682)
+++ trunk/templates/edit_form.tt 2005-10-09 22:51:40 UTC (rev 683)
@@ -59,6 +59,12 @@
<legend>Metadata (optional)</legend>
<table summary="Form for entering metadata about the subject of this node">
<tr>
+ <td class="label" colspan="2"><label for="summary">One-line summary of this node:</label></td>
+ </tr>
+ <tr>
+ <td colspan="2"><input type="text" size="50" id="summary" name="summary" value="[% summary %]" /></td>
+ </tr>
+ <tr>
<td class="label"><label for="phone">Phone:</label></td>
<td><input type="text" size="50" id="phone" name="phone" value="[% phone %]" /></td>
</tr>