[Koha-patches] [PATCH] [SIGNED-OFF] Bug #6143 - New feature: capability to limit the RSS results
Stéphane Delaune
stephane.delaune at biblibre.com
Mon Apr 11 14:04:36 CEST 2011
Signed-off-by: Stéphane Delaune <stephane.delaune at biblibre.com>
---
installer/data/mysql/en/mandatory/sysprefs.sql | 1 +
installer/data/mysql/updatedatabase.pl | 9 +++++++++
.../prog/en/modules/admin/preferences/opac.pref | 4 ++++
koha-tmpl/opac-tmpl/prog/en/includes/masthead.inc | 2 +-
.../opac-tmpl/prog/en/modules/opac-results.tt | 2 +-
kohaversion.pl | 2 +-
opac/opac-search.pl | 2 ++
7 files changed, 19 insertions(+), 3 deletions(-)
diff --git a/installer/data/mysql/en/mandatory/sysprefs.sql b/installer/data/mysql/en/mandatory/sysprefs.sql
index 8b90a24..3f33410 100755
--- a/installer/data/mysql/en/mandatory/sysprefs.sql
+++ b/installer/data/mysql/en/mandatory/sysprefs.sql
@@ -310,3 +310,4 @@ INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES
INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES('AlternateHoldingsField','','The MARC field/subfield that contains alternate holdings information for bibs taht do not have items attached (e.g. 852abchi for libraries converting from MARC Magician).',NULL,'free');
INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES('AlternateHoldingsSeparator','','The string to use to separate subfields in alternate holdings displays.',NULL,'free');
INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES('OpacHiddenItems','','This syspref allows to define custom rules for hiding specific items at opac. See docs/opac/OpacHiddenItems.txt for more informations.','','Textarea');
+INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES('numSearchRSSResults',50,'Specify the maximum number of results to display on a RSS page of results',NULL,'Integer');
diff --git a/installer/data/mysql/updatedatabase.pl b/installer/data/mysql/updatedatabase.pl
index aba0696..77b80bb 100755
--- a/installer/data/mysql/updatedatabase.pl
+++ b/installer/data/mysql/updatedatabase.pl
@@ -4304,6 +4304,15 @@ if (C4::Context->preference("Version") < TransformToNum($DBversion)) {
SetVersion ($DBversion);
}
+$DBversion = "XXX";
+if ( C4::Context->preference("Version") < TransformToNum($DBversion) ) {
+ $dbh->do(qq{
+ INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES('numSearchRSSResults',50,'Specify the maximum number of results to display on a RSS page of results',NULL,'Integer');
+ });
+ print "Upgrade to $DBversion done (Adds New System preference numSearchRSSResults)\n";
+ SetVersion($DBversion);
+}
+
=head1 FUNCTIONS
=head2 DropAllForeignKeys($table)
diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/opac.pref b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/opac.pref
index 9591f59..ffc6819 100644
--- a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/opac.pref
+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/opac.pref
@@ -257,6 +257,10 @@ OPAC:
yes: Allow
no: "Don't allow"
- patrons to place holds on items from the OPAC.
+ -
+ - pref: numSearchRSSResults
+ class: long
+ - Specify the maximum number of results to display on a RSS page of results.
Policy:
-
- pref: singleBranchMode
diff --git a/koha-tmpl/opac-tmpl/prog/en/includes/masthead.inc b/koha-tmpl/opac-tmpl/prog/en/includes/masthead.inc
index bac0741..0f532d8 100644
--- a/koha-tmpl/opac-tmpl/prog/en/includes/masthead.inc
+++ b/koha-tmpl/opac-tmpl/prog/en/includes/masthead.inc
@@ -176,7 +176,7 @@
</div>
<div id="breadcrumbs" class="yui-g">
[% IF ( searchdesc ) %]<p>[% IF ( total ) %]<strong>“[% query_desc |html %] [% limit_desc |html %]” </strong>returned [% total |html %] results. [% IF ( related ) %] (related searches: [% FOREACH relate IN related %][% relate.related_search %][% END %]). [% END %]
-<a href="[% OPACBaseurl %]/cgi-bin/koha/opac-search.pl?[% query_cgi |html %][% limit_cgi |html %][% IF ( sort_by ) %]&sort_by=[% sort_by |html %][% END %]&format=rss2"><img src="/opac-tmpl/prog/images/feed-icon-16x16.png" alt="Subscribe to this search" title="Subscribe to this search" border="0" /></a>
+<a href="[% OPACBaseurl %]/cgi-bin/koha/opac-search.pl?[% query_cgi |html %][% limit_cgi |html %]&count=[% countrss |html %]&sort_by=acqdate_dsc&format=rss2"><img src="/opac-tmpl/prog/images/feed-icon-16x16.png" alt="Subscribe to this search" title="Subscribe to this search" border="0" /></a>
[% ELSE %]
<strong>No Results Found!</strong>
<p>
diff --git a/koha-tmpl/opac-tmpl/prog/en/modules/opac-results.tt b/koha-tmpl/opac-tmpl/prog/en/modules/opac-results.tt
index e389758..02e6215 100644
--- a/koha-tmpl/opac-tmpl/prog/en/modules/opac-results.tt
+++ b/koha-tmpl/opac-tmpl/prog/en/modules/opac-results.tt
@@ -6,7 +6,7 @@
You did not specify any search criteria.
[% END %]
[% INCLUDE 'doc-head-close.inc' %]
-<link rel="alternate" type="application/rss+xml" title="[% LibraryName |html %] Search RSS Feed" href="[% OPACBaseurl %]/cgi-bin/koha/opac-search.pl?[% query_cgi |html %][% limit_cgi |html %][% IF ( sort_by ) %]&sort_by=[% sort_by |html %][% END %]&format=rss2" />
+<link rel="alternate" type="application/rss+xml" title="[% LibraryName |html %] Search RSS Feed" href="[% OPACBaseurl %]/cgi-bin/koha/opac-search.pl?[% query_cgi |html %][% limit_cgi |html %]&count=[% countrss |html %]&sort_by=acqdate_dsc&format=rss2" />
<script type="text/javascript" src="[% themelang %]/lib/jquery/plugins/jquery.checkboxes.min.js"></script>
diff --git a/kohaversion.pl b/kohaversion.pl
index bde751d..aa2eac2 100644
--- a/kohaversion.pl
+++ b/kohaversion.pl
@@ -16,7 +16,7 @@ the kohaversion is divided in 4 parts :
use strict;
sub kohaversion {
- our $VERSION = '3.03.00.051';
+ our $VERSION = 'XXX';
# version needs to be set this way
# so that it can be picked up by Makefile.PL
# during install
diff --git a/opac/opac-search.pl b/opac/opac-search.pl
index 778c7ca..fbaf53f 100755
--- a/opac/opac-search.pl
+++ b/opac/opac-search.pl
@@ -348,6 +348,7 @@ if ($params->{'limit-yr'}) {
# Params that can only have one value
my $scan = $params->{'scan'};
my $count = C4::Context->preference('OPACnumSearchResults') || 20;
+my $countRSS = C4::Context->preference('numSearchRSSResults') || 50;
my $results_per_page = $params->{'count'} || $count;
my $offset = $params->{'offset'} || 0;
my $page = $cgi->param('page') || 1;
@@ -546,6 +547,7 @@ for (my $i=0;$i<@servers;$i++) {
$limit_cgi_not_availablity =~ s/&limit=available//g if defined $limit_cgi_not_availablity;
$template->param(limit_cgi_not_availablity => $limit_cgi_not_availablity);
$template->param(limit_cgi => $limit_cgi);
+ $template->param(countrss => $countRSS );
$template->param(query_cgi => $query_cgi);
$template->param(query_desc => $query_desc);
$template->param(limit_desc => $limit_desc);
--
1.7.0.4
More information about the Koha-patches
mailing list