[Koha-patches] [PATCH] Patch of Lexile Search box on Opac advance search page with system preference
amit
amit.gupta at osslabs.biz
Tue Aug 10 13:01:09 CEST 2010
From: Amit Gupta <amit.gupta at osslabs.biz>
---
C4/Auth.pm | 3 +-
installer/data/mysql/updatedatabase.pl | 9 +++++
.../prog/en/modules/admin/preferences/opac.pref | 11 ++++++-
.../opac-tmpl/prog/en/modules/opac-advsearch.tmpl | 13 ++++++++
kohaversion.pl | 2 +-
opac/opac-main.pl | 5 ++-
opac/opac-search.pl | 33 +++++++++++++++++++-
7 files changed, 71 insertions(+), 5 deletions(-)
diff --git a/C4/Auth.pm b/C4/Auth.pm
index d0927c7..c515949 100644
--- a/C4/Auth.pm
+++ b/C4/Auth.pm
@@ -439,7 +439,8 @@ sub get_template_and_user {
reviewson => C4::Context->preference("reviewson"),
suggestion => "" . C4::Context->preference("suggestion"),
virtualshelves => "" . C4::Context->preference("virtualshelves"),
- GoogleTransliteration => C4::Context->preference("GoogleTransliteration"),
+ GoogleTransliteration => C4::Context->preference("GoogleTransliteration"),
+ lex => C4::Context->preference("lex"),
OPACSerialIssueDisplayCount => C4::Context->preference("OPACSerialIssueDisplayCount"),
OpacAddMastheadLibraryPulldown => C4::Context->preference("OpacAddMastheadLibraryPulldown"),
OPACXSLTDetailsDisplay => C4::Context->preference("OPACXSLTDetailsDisplay"),
diff --git a/installer/data/mysql/updatedatabase.pl b/installer/data/mysql/updatedatabase.pl
index 9f4ab90..0979715 100755
--- a/installer/data/mysql/updatedatabase.pl
+++ b/installer/data/mysql/updatedatabase.pl
@@ -3710,6 +3710,15 @@ INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES
SetVersion ($DBversion);
}
+$DBversion = '3.01.00.147';
+if (C4::Context->preference("lex") < TransformToNum($DBversion)) {
+ $dbh->do(q{
+INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES('lex','0','Show lexile search on the opac advance search page.','','YesNo');
+});
+ print "Upgrade to $DBversion done (Add lexile search on the opac advance search page)\n";
+ SetVersion ($DBversion);
+}
+
=item 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 74a2783..4cb2e06 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
@@ -2,7 +2,15 @@
# Broken, omitted: OPACDisplayExtendedSubInfo, OPACSubscriptionDisplay
OPAC:
-
+
+ Lexile Search:
+ -
+ - pref: lex
+ choices:
+ yes: Show
+ no: "Don't show"
+ - Show lexile search on the opac advance search page.
+
GoogleTransliteration:
-
- pref: GoogleTransliteration
@@ -302,6 +310,7 @@ OPAC:
yes: Show
no: "Don't show"
- purchase suggestions from other patrons on the OPAC.
+
Privacy:
-
- pref: EnableOpacSearchHistory
diff --git a/koha-tmpl/opac-tmpl/prog/en/modules/opac-advsearch.tmpl b/koha-tmpl/opac-tmpl/prog/en/modules/opac-advsearch.tmpl
index 52b00e7..ec4d22a 100644
--- a/koha-tmpl/opac-tmpl/prog/en/modules/opac-advsearch.tmpl
+++ b/koha-tmpl/opac-tmpl/prog/en/modules/opac-advsearch.tmpl
@@ -126,6 +126,19 @@
<!-- /PUB RANGE OPTION -->
</div>
</div>
+<!-- TMPL_IF NAME="lex" -->
+<fieldset>
+<legend>Limit by: </legend>
+<!-- Lexile Search Box start-->
+<p><label for="lex">Lexile Number:</label>
+<input size="8" name="lex" id="" value=""/>
+<label for="lex_limit">To</label>
+<input size="8" name="lex_limit" id="" value=""/>
+</p>
+<!--Lexile Search Box End-->
+</fieldset>
+<!-- /TMPL_IF -->
+</fieldset>
<div class="yui-g">
<!-- /BOOLEAN SEARCH OPTIONS -->
<div id="advsearch-itemtype" class="container">
diff --git a/kohaversion.pl b/kohaversion.pl
index ffd2e69..75e30ac 100644
--- a/kohaversion.pl
+++ b/kohaversion.pl
@@ -11,7 +11,7 @@ use strict;
sub kohaversion {
- our $VERSION = '3.01.00.146';
+ our $VERSION = '3.01.00.147';
# version needs to be set this way
# so that it can be picked up by Makefile.PL
diff --git a/opac/opac-main.pl b/opac/opac-main.pl
index 39b8bfa..5066ebd 100755
--- a/opac/opac-main.pl
+++ b/opac/opac-main.pl
@@ -89,7 +89,10 @@ $template->param(
koha_news => $all_koha_news,
koha_news_count => $koha_news_count
);
-
+#Lexile Search
+if (C4::Context->preference('lex')) {
+ $template->param('lex' => 1);
+}
# If GoogleTransliteration system preference is On Set paramter to load Google's javascript in OPAC search screens
if (C4::Context->preference('GoogleTransliteration')) {
$template->param('GoogleTransliteration' => 1);
diff --git a/opac/opac-search.pl b/opac/opac-search.pl
index 26154ef..3e3527a 100755
--- a/opac/opac-search.pl
+++ b/opac/opac-search.pl
@@ -71,6 +71,10 @@ elsif ($build_grouped_results) {
elsif ((@params>=1) || ($cgi->param("q")) || ($cgi->param('multibranchlimit')) || ($cgi->param('limit-yr')) ) {
$template_name = 'opac-results.tmpl';
}
+##lexile Search Box##
+elsif ((@params>=1) || ($cgi->param("q")) || ($cgi->param('multibranchlimit')) || ($cgi->param('lex')) || ($cgi->param('lex_limit')) ) {
+ $template_name = 'opac-results.tmpl';
+}
else {
$template_name = 'opac-advsearch.tmpl';
$template_type = 'advsearch';
@@ -340,6 +344,30 @@ if ($params->{'limit-yr'}) {
#FIXME: Should return a error to the user, incorect date format specified
}
}
+##Lexile Search Box##
+my $lex;
+my $lex_level;
+if ($params->{'lex'} and $params->{'lex_limit'}){
+{
+ my ($a1) = $params->{'lex'};
+ my ($a2) = $params->{'lex_limit'};
+ $lex = "lex,st-numeric,ge=$a1 and lex,st-numeric,le=$a2";
+ $lex_level= "$a1-$a2";
+ }
+ push @limits,$lex;
+}
+elsif ($params->{'lex'} =~ /\d/) {
+ $lex = "lex,st-numeric,ge=$params->{'lex'}";
+ $lex_level = $params->{'lex'};
+
+ push @limits,$lex;
+
+}
+ elsif ($params->{'lex_limit'} =~ /\d/) {
+ $lex = "lex,st-numeric,le=$params->{'lex_limit'}";
+ $lex_level = $params->{'lex_limit'};
+ push @limits,$lex;
+}
# Params that can only have one value
my $scan = $params->{'scan'};
@@ -649,7 +677,10 @@ if (defined $barshelves) {
}
my $content_type = ($format eq 'rss' or $format eq 'atom') ? $format : 'html';
-
+#Lexile Search
+if (C4::Context->preference('lex')) {
+ $template->param('lex' => 1);
+}
# If GoogleTransliteration system preference is On Set paramter to load Google's javascript in OPAC search screens
if (C4::Context->preference('GoogleTransliteration')) {
$template->param('GoogleTransliteration' => 1);
--
1.5.4.5
More information about the Koha-patches
mailing list