[Koha-patches] [PATCH] Patch of Lexile Search box on Opac advance search page

Amit Gupta amit.gupta at osslabs.biz
Wed Jan 20 12:00:24 CET 2010


---
 .../opac-tmpl/prog/en/modules/opac-advsearch.tmpl  |   11 +++++++
 opac/opac-search.pl                                |   30 ++++++++++++++++++++
 2 files changed, 41 insertions(+), 0 deletions(-)

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 d12fd73..d3ec074 100644
--- a/koha-tmpl/opac-tmpl/prog/en/modules/opac-advsearch.tmpl
+++ b/koha-tmpl/opac-tmpl/prog/en/modules/opac-advsearch.tmpl
@@ -104,6 +104,17 @@
 
     </fieldset></div>
     </div>
+
+<!-- Lexile Search Box start-->
+<fieldset>
+<legend>Limit by: </legend>
+<p><label for="lex">Lexile Number:</label>
+<input size="8" name="lex" id="" value=""/>
+<label for="lex1">To</label>
+<input size="8" name="lex1" id="" value=""/>
+</p>
+<!--Lexile Search Box End-->
+</fieldset>
 <div id="pubrange" class="container">
 <fieldset>
 <!-- PUB RANGE OPTION -->
diff --git a/opac/opac-search.pl b/opac/opac-search.pl
index 344f168..9025b9d 100755
--- a/opac/opac-search.pl
+++ b/opac/opac-search.pl
@@ -52,6 +52,11 @@ elsif ($build_grouped_results) {
 elsif ((@params>=1) || ($cgi->param("q")) || ($cgi->param('multibranchlimit')) || ($cgi->param('limit-yr')) ) {
 	$template_name = 'opac-results.tmpl';
 }
+##For Lexile Search Box##
+elsif ((@params>=1) || ($cgi->param("q")) || ($cgi->param('multibranchlimit')) || ($cgi->param('lex')) || ($cgi->param('lex1')) ) {
+        $template_name = 'opac-results.tmpl';
+}
+
 else {
     $template_name = 'opac-advsearch.tmpl';
     $template_type = 'advsearch';
@@ -321,6 +326,31 @@ 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->{'lex1'}){
+#   if(($params->{'lex'} = ~/\d/ and $params->{'lex1'}= ~/\d/))
+{
+    my ($a1) = $params->{'lex'};
+    my ($a2) = $params->{'lex1'};
+    $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->{'lex1'} =~ /\d/) {
+        $lex = "lex,st-numeric,le=$params->{'lex1'}";
+        $lex_level = $params->{'lex1'};
+  push @limits,$lex;
+}
 
 # Params that can only have one value
 my $scan = $params->{'scan'};
-- 
1.5.4.5




More information about the Koha-patches mailing list