From d177975239506044f8df19191f2e479b2ac2b7a2 Mon Sep 17 00:00:00 2001 From: Galen Charlton Date: Sun, 1 Jun 2008 21:43:31 -0500 Subject: [PATCH] kohabug 2078 - fix feed validation errors Fix several validation errors in RSS and Atom feeds generated from the OPAC: - add missing guid to RSS elements - add missing feed ID and element ID to Atom elements - reflect OPACBaseURL changes - fix atom:link self links - add HTML escaping to fields comming from bib record - set default timestamp for Atom updated elements Issues identified but not solved in this patch: - setting Atom updated element for each bib (presumably from biblio.timestamp) - possible problems performing paging of Atom feed Based on successful validation of feeds by feedvalidatory.org, it is expected that feeds should now work in IE7 and IE6. Signed-off-by: Joshua Ferraro --- .../prog/en/modules/opac-opensearch.tmpl | 70 +++++++++++-------- opac/opac-search.pl | 5 +- 2 files changed, 45 insertions(+), 30 deletions(-) diff --git a/koha-tmpl/opac-tmpl/prog/en/modules/opac-opensearch.tmpl b/koha-tmpl/opac-tmpl/prog/en/modules/opac-opensearch.tmpl index 2bf7a07050..9e9f7c7827 100644 --- a/koha-tmpl/opac-tmpl/prog/en/modules/opac-opensearch.tmpl +++ b/koha-tmpl/opac-tmpl/prog/en/modules/opac-opensearch.tmpl @@ -1,12 +1,12 @@ - Search - Search the - koha opac - + Search + Search the + koha opac + /cgi-bin/koha/opac-search.pl?q={searchTerms}&pw={startPage?}&format=rss2"/> + template="/cgi-bin/koha/opac-search.pl?q={searchTerms}&pw={startPage?}&format=rss2"/> @@ -16,21 +16,27 @@ xmlns:opensearch="http://a9.com/-/spec/opensearch/1.1/" xmlns:atom="http://www.w3.org/2005/Atom"> - <!-- TMPL_VAR NAME="LibraryName" --> Search <!-- TMPL_IF NAME="query_desc" -->for '<!-- TMPL_VAR NAME="query_desc" -->'<!-- /TMPL_IF --><!-- TMPL_IF NAME="limit_desc" --> with limit(s): '<!-- TMPL_VAR NAME="limit_desc" -->'<!-- /TMPL_IF --> - http:///cgi-bin/koha/opac-search.pl?q=&format=rss2 - Search results for '' with limit(s): '' at + <!-- TMPL_VAR NAME="LibraryName" ESCAPE="html" --> Search <!-- TMPL_IF NAME="query_desc" ESCAPE="html" -->for '<!-- TMPL_VAR NAME="query_desc" ESCAPE="html" -->'<!-- /TMPL_IF --><!-- TMPL_IF NAME="limit_desc" ESCAPE="html" --> with limit(s): '<!-- TMPL_VAR NAME="limit_desc" ESCAPE="html" -->'<!-- /TMPL_IF --> + /cgi-bin/koha/opac-search.pl?q=&format=rss2 + /cgi-bin/koha/opac-search.pl?&format=rss2" /> + Search results for '' with limit(s): '' at - - - @@ -40,33 +46,39 @@ - <!-- TMPL_VAR NAME="LibraryName" --> Search <!-- TMPL_IF NAME="query_desc" -->for '<!-- TMPL_VAR NAME="query_desc" -->'<!-- /TMPL_IF --><!-- TMPL_IF NAME="limit_desc" --> with limit(s): '<!-- TMPL_VAR NAME="limit_desc" -->'<!-- /TMPL_IF --> - /cgi-bin/koha/opac-search.pl?q=&format=rss2"/> + /cgi-bin/koha/opac-search.pl?&format=atom + <!-- TMPL_VAR NAME="LibraryName" ESCAPE="html" --> Search <!-- TMPL_IF NAME="query_desc" -->for '<!-- TMPL_VAR NAME="query_desc" ESCAPE="html" -->'<!-- /TMPL_IF --><!-- TMPL_IF NAME="limit_desc" --> with limit(s): '<!-- TMPL_VAR NAME="limit_desc" ESCAPE="html" -->'<!-- /TMPL_IF --> + /cgi-bin/koha/opac-search.pl?q=&format=rss2"/> - + - - " startPage="" /> - /cgi-bin/koha/opac-search.pl?q=pw=" type="text/html"/> - /cgi-bin/koha/opac-search.pl?q=pw=&format=atom" type="application/atom+xml"/> - /cgi-bin/koha/opac-search.pl?q=pw=1&format=atom" type="application/atom+xml"/> - /cgi-bin/koha/opac-search.pl?q=pw=2&format=atom" type="application/atom+xml"/> - /cgi-bin/koha/opac-search.pl?q=pw=4&format=atom" type="application/atom+xml"/> - /cgi-bin/koha/opac-search.pl?q=pw=42299&format=atom" type="application/atom+xml"/> - /cgi-bin/koha/opac-search.pl?format=opensearchdescription"/> + + + + 20 + + " startPage="" /> + /cgi-bin/koha/opac-search.pl?pw=" type="text/html"/> + /cgi-bin/koha/opac-search.pl?&format=atom" type="application/atom+xml"/> + /cgi-bin/koha/opac-search.pl?pw=1&format=atom" type="application/atom+xml"/> + /cgi-bin/koha/opac-search.pl?pw=2&format=atom" type="application/atom+xml"/> + /cgi-bin/koha/opac-search.pl?pw=4&format=atom" type="application/atom+xml"/> + /cgi-bin/koha/opac-search.pl?pw=42299&format=atom" type="application/atom+xml"/> + /cgi-bin/koha/opac-search.pl?format=opensearchdescription"/> - <!-- TMPL_VAR NAME="title" --> - /cgi-bin/koha/opac-detail.pl?biblionumber="/> + <!-- TMPL_VAR NAME="title" ESCAPE="html" --> + /cgi-bin/koha/opac-detail.pl?biblionumber="/> + /cgi-bin/koha/opac-detail.pl?biblionumber= diff --git a/opac/opac-search.pl b/opac/opac-search.pl index c6a998980c..776ce554be 100755 --- a/opac/opac-search.pl +++ b/opac/opac-search.pl @@ -14,7 +14,7 @@ use C4::Search; use C4::Biblio; # GetBiblioData use C4::Koha; use C4::Tags qw(get_tags); -use POSIX qw(ceil floor); +use POSIX qw(ceil floor strftime); use C4::Branch; # GetBranches # create a new CGI object @@ -63,6 +63,9 @@ if ($cgi->param("format") eq 'rss2') { } elsif ($cgi->param("format") eq 'atom') { $template->param("atom" => 1); + # FIXME - the timestamp is a hack - the biblio update timestamp should be used for each + # entry, but not sure if that's worth an extra database query for each bib + $template->param(timestamp => strftime("%Y-%m-%dT%H:%M:%S-00:00", gmtime)); } elsif ($cgi->param("format") eq 'opensearchdescription') { $template->param("opensearchdescription" => 1); -- 2.39.5