diff --git a/rss/lastAcquired.conf b/rss/lastAcquired.conf new file mode 100755 index 0000000000..e133157f48 --- /dev/null +++ b/rss/lastAcquired.conf @@ -0,0 +1,15 @@ +channel +title=Recent Koha Acquisitions +link=http://www.koha.org +desc=The 15 most recent acquisitions +lang=en +lastBuild=Fri, 09 May 2003 08:00:00 +image +title=Koha, the world's best Open Source Library System +url=http://www.koha.org/images/foo.jpg +link=http://www.koha.org +config +tmpl=lastAcquired.tmpl +output=lastAcquired.xml +query=select biblioitems.isbn as isbn, biblio.title as title, biblio.author as author from biblio, biblioitems, items where biblioitems.biblionumber = items.biblionumber and biblio.biblionumber = items.biblionumber and items.dateaccessioned is not NULL order by items.dateaccessioned desc + diff --git a/rss/lastAcquired.tmpl b/rss/lastAcquired.tmpl new file mode 100644 index 0000000000..99893bc896 --- /dev/null +++ b/rss/lastAcquired.tmpl @@ -0,0 +1,30 @@ + + + + + + + + <TMPL_VAR CHANNELTITLE> + + + + + + + <TMPL_VAR IMAGETITLE> + + + + + + + <TMPL_VAR TITLE>, by <TMPL_VAR AUTHOR> + http://opac.library.org.nz/cgi-bin/koha/opac-searchresults.pl?isbn= + + + + + + diff --git a/rss/longestUnseen.conf b/rss/longestUnseen.conf new file mode 100755 index 0000000000..91d7186ffe --- /dev/null +++ b/rss/longestUnseen.conf @@ -0,0 +1,14 @@ +channel +title=Longest Unseen Koha Items +link=http://www.koha.org +desc=The 15 least recently seen items +lang=en +image +title=Koha, the worlds best Open Source Library System +url=http://www.koha.org/images/foo.jpg +link=http://www.koha.org +config +tmpl=longestUnseen.tmpl +output=longestUnseen.xml +query=select biblioitems.isbn as isbn, biblio.title as title, biblio.author as author from biblio, biblioitems, items where biblioitems.biblionumber = items.biblionumber and biblio.biblionumber = items.biblionumber and items.datelastseen is not NULL and items.datelastseen != items.datelastborrowed order by items.datelastseen + diff --git a/rss/longestUnseen.tmpl b/rss/longestUnseen.tmpl new file mode 100644 index 0000000000..99893bc896 --- /dev/null +++ b/rss/longestUnseen.tmpl @@ -0,0 +1,30 @@ + + + + + + + + <TMPL_VAR CHANNELTITLE> + + + + + + + <TMPL_VAR IMAGETITLE> + + + + + + + <TMPL_VAR TITLE>, by <TMPL_VAR AUTHOR> + http://opac.library.org.nz/cgi-bin/koha/opac-searchresults.pl?isbn= + + + + + + diff --git a/rss/mostReserved.conf b/rss/mostReserved.conf new file mode 100755 index 0000000000..437b660a80 --- /dev/null +++ b/rss/mostReserved.conf @@ -0,0 +1,14 @@ +channel +title=Most Reserved Items +link=http://www.koha.org +desc=The 15 most reserved items +lang=en +image +title=Koha, the worlds best Open Source Library System +url=http://www.koha.org/images/foo.jpg +link=http://www.koha.org +config +tmpl=mostReserved.tmpl +output=mostReserved.xml +query=select biblioitems.isbn as isbn, biblio.title as title, biblio.author as author from biblio, biblioitems, items where biblioitems.biblionumber = items.biblionumber and biblio.biblionumber = items.biblionumber and items.reserves is not NULL order by items.reserves desc + diff --git a/rss/mostReserved.tmpl b/rss/mostReserved.tmpl new file mode 100644 index 0000000000..99893bc896 --- /dev/null +++ b/rss/mostReserved.tmpl @@ -0,0 +1,30 @@ + + + + + + + + <TMPL_VAR CHANNELTITLE> + + + + + + + <TMPL_VAR IMAGETITLE> + + + + + + + <TMPL_VAR TITLE>, by <TMPL_VAR AUTHOR> + http://opac.library.org.nz/cgi-bin/koha/opac-searchresults.pl?isbn= + + + + + + diff --git a/rss/rss.pl b/rss/rss.pl new file mode 100755 index 0000000000..a37cf4ae9d --- /dev/null +++ b/rss/rss.pl @@ -0,0 +1,109 @@ +#!/usr/bin/perl -w + +# This script can be used to generate rss 0.91 files for syndication. + + +# it should be run from cron like: +# +# rss.pl config.conf +# + +# Copyright 2003 Katipo Communications +# +# This file is part of Koha. +# +# Koha is free software; you can redistribute it and/or modify it under the +# terms of the GNU General Public License as published by the Free Software +# Foundation; either version 2 of the License, or (at your option) any later +# version. +# +# Koha is distributed in the hope that it will be useful, but WITHOUT ANY +# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR +# A PARTICULAR PURPOSE. See the GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License along with +# Koha; if not, write to the Free Software Foundation, Inc., 59 Temple Place, +# Suite 330, Boston, MA 02111-1307 USA + + +use strict; +use HTML::Template; +use C4::Context; +use Time::Local; + +my $file = $ARGV[0]; +my %config = getConf("config"); +my $outFile = $config{"output"}; +my $feed = HTML::Template->new(filename => $config{"tmpl"}); + +my %channel = getConf("channel"); +$feed->param(CHANNELTITLE => $channel{'title'}); +$feed->param(CHANNELLINK => $channel{'link'}); +$feed->param(CHANNELDESC => $channel{'desc'}); +$feed->param(CHANNELLANG => $channel{'lang'}); +$feed->param(CHANNELLASTBUILD => getDate()); + +my %image = getConf("image"); +$feed->param(IMAGETITLE => $image{'title'}); +$feed->param(IMAGEURL => $image{'url'}); +$feed->param(IMAGELINK => $image{'link'}); + +# +# handle the items +# +$feed->param(ITEMS => getItems($config{'query'})); + +open(FILE, ">$outFile") or die "can't open $outFile"; +print FILE $feed->output(); +close FILE; + +sub getDate { + my $date = localtime(timelocal(localtime)); + return $date; +} + +sub getConf { + my $section = shift; + my %return; + my $inSection = 0; + + open(FILE,$file) or die "can't open $file"; + while () { + if ($inSection) { + my @line = split(/=/,$_,2); + unless ($line[1]) { + $inSection=0; + } else { + my ($key, $value) = @line; + chomp $value; + $return{$key} = $value; + } + } else { + if ($_ eq "$section\n") { $inSection = 1 } + } + } + return %return; +} +sub getItems { + my $query = shift; + $query .= " limit 15"; + my $dbh = C4::Context->dbh; + my $sth=$dbh->prepare($query); + $sth->execute; + my @return; + while (my $data = $sth->fetchrow_hashref) { + foreach my $key (keys %$data) { + my $value=$data->{$key}; + $value=~s/\&/\&/g and $data->{$key}=$value; + } + push @return, $data; + } + $sth->finish; + return \@return; +} + + + + + + diff --git a/rss/sm-koha-icon.jpg b/rss/sm-koha-icon.jpg new file mode 100644 index 0000000000..152d6c9b54 Binary files /dev/null and b/rss/sm-koha-icon.jpg differ