switching from searchdesc to query_desc and limit_desc,
authorJoshua Ferraro <jmf@liblime.com>
Thu, 22 Nov 2007 00:34:08 +0000 (18:34 -0600)
committerJoshua Ferraro <jmf@liblime.com>
Thu, 22 Nov 2007 00:40:53 +0000 (18:40 -0600)
searchdesc is now just a flag

Signed-off-by: Chris Cormack <crc@liblime.com>
Signed-off-by: Joshua Ferraro <jmf@liblime.com>
C4/Search.pm
catalogue/search.pl
koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/results.tmpl

index 5f15f96..0e54fee 100644 (file)
@@ -833,9 +833,10 @@ sub buildQuery {
                # these are treated as OR
         elsif ( $this_limit =~ /mc/ ) {
             $group_OR_limits .= " or " if $group_OR_limits;
+                       $limit_desc .=" or " if $group_OR_limits;
                        $group_OR_limits .= "$this_limit";
                        $limit_cgi .="&limit=$this_limit";
-            $limit_desc .= " or $this_limit";
+                       $limit_desc .= "$this_limit";
         }
 
                # regular old limits
index 9acd2ea..4be9a40 100755 (executable)
@@ -395,12 +395,12 @@ my $hits;
 my $expanded_facet = $params->{'expand'};
 
 # Define some global variables
-my ( $error,$query,$simple_query,$query_cgi,$query_search_desc,$limit,$limit_cgi,$limit_desc,$query_type);
+my ( $error,$query,$simple_query,$query_cgi,$query_desc,$limit,$limit_cgi,$limit_desc,$query_type);
 
 my @results;
 
 ## I. BUILD THE QUERY
-( $error,$query,$simple_query,$query_cgi,$query_search_desc,$limit,$limit_cgi,$limit_desc,$query_type) = buildQuery(\@operators,\@operands,\@indexes,\@limits,\@sort_by);
+( $error,$query,$simple_query,$query_cgi,$query_desc,$limit,$limit_cgi,$limit_desc,$query_type) = buildQuery(\@operators,\@operands,\@indexes,\@limits,\@sort_by);
 
 ## parse the query_cgi string and put it into a form suitable for <input>s
 my @query_inputs;
@@ -480,13 +480,17 @@ for (my $i=0;$i<=@servers;$i++) {
     if ($server =~/biblioserver/) { # this is the local bibliographic server
         $hits = $results_hashref->{$server}->{"hits"};
         my $page = $cgi->param('page') || 0;
-        my @newresults = searchResults( $query_search_desc,$hits,$results_per_page,$offset,@{$results_hashref->{$server}->{"RECORDS"}});
+        my @newresults = searchResults( $query_desc,$hits,$results_per_page,$offset,@{$results_hashref->{$server}->{"RECORDS"}});
         $total = $total + $results_hashref->{$server}->{"hits"};
         if ($hits) {
             $template->param(total => $hits);
                        $template->param(limit_cgi => $limit_cgi);
                        $template->param(query_cgi => $query_cgi);
-            $template->param(searchdesc => ($query_type?"$query_type=":"")."$query_search_desc" );
+                       $template->param(query_desc => $query_desc);
+                       $template->param(limit_desc => $limit_desc);
+                       if ($query_desc || $limit_desc) {
+               $template->param(searchdesc => 1);
+                       }
             $template->param(results_per_page =>  $results_per_page);
             $template->param(SEARCH_RESULTS => \@newresults);
                        ## Build the page numbers on the bottom of the page
@@ -564,17 +568,21 @@ for (my $i=0;$i<=@servers;$i++) {
 $template->param(
             #classlist => $classlist,
             total => $total,
-            searchdesc => ($query_type?"$query_type=":"")."$query_search_desc",
             opacfacets => 1,
             facets_loop => $facets,
             scan => $scan,
             search_error => $error,
 );
+
+if ($query_desc || $limit_desc) {
+       $template->param(searchdesc => 1);
+}
+
 ## Now let's find out if we have any supplemental data to show the user
 #  and in the meantime, save the current query for statistical purposes, etc.
 my $koha_spsuggest; # a flag to tell if we've got suggestions coming from Koha
 my @koha_spsuggest; # place we store the suggestions to be returned to the template as LOOP
-my $phrases = $query_search_desc;
+my $phrases = $query_desc;
 my $ipaddress;
 
 if ( C4::Context->preference("kohaspsuggest") ) {
index 4060533..6d48827 100644 (file)
@@ -1,12 +1,12 @@
 <!-- TMPL_INCLUDE NAME="doc-head-open.inc" -->
-<title>Koha &rsaquo; Catalog &rsaquo; <!-- TMPL_IF NAME="searchdesc" -->Results of Search for '<!-- TMPL_VAR NAME="searchdesc" -->'<!-- TMPL_ELSE -->You did not specify any search criteria<!-- /TMPL_IF --></title>
+<title>Koha &rsaquo; Catalog &rsaquo; <!-- TMPL_IF NAME="searchdesc" -->Results of Search for '<!-- TMPL_VAR NAME="query_desc" --><!-- TMPL_VAR NAME="limit_desc" -->'<!-- TMPL_ELSE -->You did not specify any search criteria<!-- /TMPL_IF --></title>
 <!-- TMPL_INCLUDE NAME="doc-head-close.inc" -->
 </head>
 <body>
 <!-- TMPL_INCLUDE NAME="header.inc" -->
 <!-- TMPL_INCLUDE NAME="cat-search.inc" -->
 
-<div id="breadcrumbs"><a href="/cgi-bin/koha/mainpage.pl">Home</a> &rsaquo; <a href="/cgi-bin/koha/catalogue/search.pl">Catalogue</a>  &rsaquo; Search for <i><!-- TMPL_VAR NAME="searchdesc" --></i></div>
+<div id="breadcrumbs"><a href="/cgi-bin/koha/mainpage.pl">Home</a> &rsaquo; <a href="/cgi-bin/koha/catalogue/search.pl">Catalogue</a>  &rsaquo; Search for <i><!-- TMPL_VAR NAME="query_desc" --><!-- TMPL_VAR NAME="limit_desc" --></i></div>
 
 <div id="doc3" class="yui-t2">
    
     <!-- /TMPL_IF -->
     <!-- TMPL_IF NAME="total" -->
     <h3>
-        <!-- TMPL_VAR NAME="total" --> results found for '<!-- TMPL_VAR NAME="searchdesc" -->'
+        <!-- TMPL_VAR NAME="total" --> results found for '<!-- TMPL_VAR NAME="query_desc" --><!-- TMPL_VAR NAME="limit_desc" -->'
     </h3>
     <!-- TMPL_ELSE -->
         <!-- TMPL_IF NAME="searchdesc" -->
             <h3>No results found</h3>
             <p>
-                No results match your search for <span style="font-weight: bold;">&ldquo;<!-- TMPL_VAR NAME="searchdesc" -->&rdquo;</span> in <!-- TMPL_VAR NAME="LibraryName" --> Catalog.
+                No results match your search for <span style="font-weight: bold;">&ldquo;<!-- TMPL_VAR NAME="query_desc" --><!-- TMPL_VAR NAME="limit_desc" -->&rdquo;</span> in <!-- TMPL_VAR NAME="LibraryName" --> Catalog.
             </p>
         <!-- TMPL_ELSE -->
             <h3>No results found</h3>