From ecc83668ea3a931909241ac39cd000ea837e7aef Mon Sep 17 00:00:00 2001 From: Fridolyn SOMERS Date: Thu, 7 Apr 2011 16:58:18 +0200 Subject: [PATCH] BUG6120 Add search links in detail pages --- koha-tmpl/opac-tmpl/prog/en/css/opac.css | 6 +++--- koha-tmpl/opac-tmpl/prog/en/includes/masthead.inc | 4 ++-- .../opac-tmpl/prog/en/includes/search-links.inc | 11 +++++++++++ .../opac-tmpl/prog/en/modules/opac-ISBDdetail.tmpl | 1 + .../opac-tmpl/prog/en/modules/opac-MARCdetail.tmpl | 1 + .../opac-tmpl/prog/en/modules/opac-detail.tmpl | 1 + opac/opac-ISBDdetail.pl | 10 +++++++++- opac/opac-MARCdetail.pl | 10 +++++++++- opac/opac-detail.pl | 10 +++++++++- opac/opac-main.pl | 20 ++++++++++++++++++++ opac/opac-search.pl | 9 +++++++++ 11 files changed, 75 insertions(+), 8 deletions(-) create mode 100644 koha-tmpl/opac-tmpl/prog/en/includes/search-links.inc diff --git a/koha-tmpl/opac-tmpl/prog/en/css/opac.css b/koha-tmpl/opac-tmpl/prog/en/css/opac.css index f04a51c..09c43a4 100644 --- a/koha-tmpl/opac-tmpl/prog/en/css/opac.css +++ b/koha-tmpl/opac-tmpl/prog/en/css/opac.css @@ -389,20 +389,20 @@ a .term { } /* action buttons */ -#action { +#action, #searchlinks { margin-top : .5em; background-color : #F3F3F3; border : 1px solid #E8E8E8; padding-bottom : 3px; } -#action li { +#action li, #searchlinks li { list-style : none; margin : .2em; padding : .3em 0; } -#action a { +#action a, #searchlinks a { background-position : 5px center; background-repeat : no-repeat; text-decoration : none; diff --git a/koha-tmpl/opac-tmpl/prog/en/includes/masthead.inc b/koha-tmpl/opac-tmpl/prog/en/includes/masthead.inc index df0b413..85910c5 100644 --- a/koha-tmpl/opac-tmpl/prog/en/includes/masthead.inc +++ b/koha-tmpl/opac-tmpl/prog/en/includes/masthead.inc @@ -72,9 +72,9 @@ - " class="left" style="width: 35%; font-size: 111%;"/>
+ " class="left focus" style="width: 35%; font-size: 111%;"/>
-
+
" /> + diff --git a/koha-tmpl/opac-tmpl/prog/en/modules/opac-MARCdetail.tmpl b/koha-tmpl/opac-tmpl/prog/en/modules/opac-MARCdetail.tmpl index 5c50d64..983855d 100644 --- a/koha-tmpl/opac-tmpl/prog/en/modules/opac-MARCdetail.tmpl +++ b/koha-tmpl/opac-tmpl/prog/en/modules/opac-MARCdetail.tmpl @@ -257,6 +257,7 @@ $(document).ready(function(){ " /> + diff --git a/koha-tmpl/opac-tmpl/prog/en/modules/opac-detail.tmpl b/koha-tmpl/opac-tmpl/prog/en/modules/opac-detail.tmpl index 52a866b..3286b49 100644 --- a/koha-tmpl/opac-tmpl/prog/en/modules/opac-detail.tmpl +++ b/koha-tmpl/opac-tmpl/prog/en/modules/opac-detail.tmpl @@ -845,6 +845,7 @@ YAHOO.util.Event.onContentReady("furtherm", function () { " /> + diff --git a/opac/opac-ISBDdetail.pl b/opac/opac-ISBDdetail.pl index b50947d..5b070d4 100755 --- a/opac/opac-ISBDdetail.pl +++ b/opac/opac-ISBDdetail.pl @@ -42,7 +42,7 @@ the items attached to the biblio use strict; use warnings; -use C4::Auth; +use C4::Auth qw(:DEFAULT get_session); use C4::Context; use C4::Output; use CGI; @@ -202,4 +202,12 @@ if ( C4::Context->preference("OPACAmazonEnabled") == 1 ) { $template->param( AMAZONREVIEWS => \@reviews ); } +# Get current search from session +my $session = get_session($query->cookie("CGISESSID")); +if ($session) { + foreach (qw(currentsearchquery currentsearchlimit currentsearchisoneresult)) { + $template->param( $_ => $session->param( $_ ) ); + } +} + output_html_with_http_headers $query, $cookie, $template->output; diff --git a/opac/opac-MARCdetail.pl b/opac/opac-MARCdetail.pl index a5c9789..0d0a701 100755 --- a/opac/opac-MARCdetail.pl +++ b/opac/opac-MARCdetail.pl @@ -44,7 +44,7 @@ the items attached to the biblio use strict; use warnings; -use C4::Auth; +use C4::Auth qw(:DEFAULT get_session); use C4::Context; use C4::Output; use CGI; @@ -286,4 +286,12 @@ $template->param( biblionumber => $biblionumber, ); +# Get current search from session +my $session = get_session($query->cookie("CGISESSID")); +if ($session) { + foreach (qw(currentsearchquery currentsearchlimit currentsearchisoneresult)) { + $template->param( $_ => $session->param( $_ ) ); + } +} + output_html_with_http_headers $query, $cookie, $template->output; diff --git a/opac/opac-detail.pl b/opac/opac-detail.pl index f230834..a1899fc 100755 --- a/opac/opac-detail.pl +++ b/opac/opac-detail.pl @@ -23,7 +23,7 @@ use strict; use warnings; use CGI; -use C4::Auth; +use C4::Auth qw(:DEFAULT get_session); use C4::Branch; use C4::Koha; use C4::Serials; #uses getsubscriptionfrom biblionumber @@ -567,4 +567,12 @@ my $defaulttab = ? 'serialcollection' : 'subscription'; $template->param('defaulttab' => $defaulttab); +# Get current search from session +my $session = get_session($query->cookie("CGISESSID")); +if ($session) { + foreach (qw(currentsearchquery currentsearchlimit currentsearchisoneresult)) { + $template->param( $_ => $session->param( $_ ) ); + } +} + output_html_with_http_headers $query, $cookie, $template->output; diff --git a/opac/opac-main.pl b/opac/opac-main.pl index 177d812..bf3313b 100755 --- a/opac/opac-main.pl +++ b/opac/opac-main.pl @@ -95,4 +95,24 @@ if (C4::Context->preference('GoogleIndicTransliteration')) { $template->param('GoogleIndicTransliteration' => 1); } +# Restore current search index and query +# multivalued CGI paramaters are returned as a packaged string separated by "\0" (null) +my $param_idx = $input->param('idx') || ''; +my $param_q = $input->param('q') || ''; + +# indexes are query qualifiers, like 'title', 'author', etc. +# They can be single or multiple parameters separated by comma: kw,right-Truncation +my @indexes = split("\0", $param_idx); +# if a simple index (only one) display the index used in the top search box +if ($indexes[0] && !$indexes[1]) { + $template->param( "ms_".$indexes[0] => 1 ); +} + +# an operand can be a single term, a phrase, or a complete ccl query +my @operands = split("\0",$param_q); +# if a simple search, display the value in the search box +if ($operands[0] && !$operands[1]) { + $template->param( ms_value => $operands[0] ); +} + output_html_with_http_headers $input, $cookie, $template->output; diff --git a/opac/opac-search.pl b/opac/opac-search.pl index 778c7ca..e109a1b 100755 --- a/opac/opac-search.pl +++ b/opac/opac-search.pl @@ -118,6 +118,9 @@ if (C4::Context->preference('TagsEnabled')) { } } +# Read session +my $session = get_session($cgi->cookie("CGISESSID")); + ## URI Re-Writing # Deprecated, but preserved because it's interesting :-) # The same thing can be accomplished with mod_rewrite in @@ -394,6 +397,11 @@ if (C4::Context->preference('OpacSuppression')) { $template->param ( LIMIT_INPUTS => \@limit_inputs ); +# Set session variables +$session->param('currentsearchisoneresult', '0'); # init is only one result +$session->param('currentsearchquery', $query_cgi); +$session->param('currentsearchlimit', $limit_cgi); + ## II. DO THE SEARCH AND GET THE RESULTS my $total = 0; # the total results for the whole set my $facets; # this object stores the faceted results that display on the left-hand of the results page @@ -538,6 +546,7 @@ for (my $i=0;$i<@servers;$i++) { } else { print $cgi->redirect("/cgi-bin/koha/opac-detail.pl?biblionumber=$biblionumber"); } + $session->param('currentsearchisoneresult', 1); exit; } if ($hits) { -- 1.7.1