Fix two bugs affecting OPAC RSS operation
authorFrederic Demians <f.demians@tamil.fr>
Fri, 29 Feb 2008 00:38:14 +0000 (13:38 +1300)
committerJoshua Ferraro <jmf@liblime.com>
Fri, 29 Feb 2008 15:05:34 +0000 (09:05 -0600)
OPAC RSS functionality was buggish:

1. Library Name from syspref wasn't properly displayed.
2. Filename for query result caching was containing (sometime)
   a / character preventing cache file creation.

It remains that in Zebra mode, SimpleSearch returns a resultset
which is diffrent from the one returned by opac-search.pl: less records.
It works correctly in NoZebra mode.

Signed-off-by: Chris Cormack <chris@bigballofwax.co.nz>
Signed-off-by: Joshua Ferraro <jmf@liblime.com>
opac/opac-rss.pl

index cf48f3e..0d95f7f 100755 (executable)
@@ -72,6 +72,7 @@ my $size = $cgi->param('size') || 50;
 
 # the filename of the cached rdf file.
 my $filename = md5_base64($query);
+$filename =~ s/\///g;
 my $rss = new XML::RSS( version => '1.0', encoding=>C4::Context->preference("TemplateEncoding"), output=>C4::Context->preference("TemplateEncoding"),language=>C4::Context->preference('opaclanguages'));
 
 # the site URL
@@ -88,11 +89,8 @@ if ( -e "rss/$filename" ) {
 
 # check if we have to rebuild the RSS feed (once every 30mn), or just return the actual rdf
     my $rdf_stamp = $rss->{'channel'}->{'dc'}->{'date'};
-    $rdf_stamp =~ /(.*)-(.*)-(.*):(.*):(.*):(.*)/;
-    my (
-        $stamp_year, $stamp_month, $stamp_day,
-        $stamp_hour, $stamp_min,   $stamp_sec
-    ) = ( $1, $2, $3, $4, $5, $6 );
+    my ( $stamp_year, $stamp_month, $stamp_day, $stamp_hour, $stamp_min, $stamp_sec ) =
+       ( $rdf_stamp =~ /(.*)-(.*)-(.*):(.*):(.*):(.*)/ );
 
 # if more than 30 mn since the last RDF update, rebuild the RDF. Otherwise, just return it
     unless ( ( $year - $stamp_year > 0 )
@@ -109,9 +107,9 @@ if ($RDF_update_needed) {
 
     #     warn "RDF update in progress";
     utf8::decode($query);
-    my $libname=utf8::decode(C4::Context->preference("LibraryName"));
+    my $libname = C4::Context->preference("LibraryName");
     $rss->channel(
-        title       => "Koha : $query",
+        title       => "Koha: $query",
         description => $libname,
         link        => $short_url,
         dc          => {