[Koha-patches] [PATCH] BUG6120 Add search links in detail pages

Fridolyn SOMERS fridolyn.somers at progilone.fr
Tue May 17 19:59:50 CEST 2011


---
 koha-tmpl/opac-tmpl/prog/en/css/opac.css           |    4 ++++
 koha-tmpl/opac-tmpl/prog/en/includes/masthead.inc  |    4 ++--
 .../opac-tmpl/prog/en/modules/opac-ISBDdetail.tt   |    4 ++++
 .../opac-tmpl/prog/en/modules/opac-MARCdetail.tt   |    4 ++++
 koha-tmpl/opac-tmpl/prog/en/modules/opac-detail.tt |    4 ++++
 koha-tmpl/opac-tmpl/prog/images/previous.gif       |  Bin 0 -> 483 bytes
 opac/opac-ISBDdetail.pl                            |   10 +++++++++-
 opac/opac-MARCdetail.pl                            |   10 +++++++++-
 opac/opac-detail.pl                                |   10 +++++++++-
 opac/opac-search.pl                                |   12 ++++++++++--
 10 files changed, 55 insertions(+), 7 deletions(-)
 create mode 100644 koha-tmpl/opac-tmpl/prog/images/previous.gif

diff --git a/koha-tmpl/opac-tmpl/prog/en/css/opac.css b/koha-tmpl/opac-tmpl/prog/en/css/opac.css
index aa295c9..10a7acb 100644
--- a/koha-tmpl/opac-tmpl/prog/en/css/opac.css
+++ b/koha-tmpl/opac-tmpl/prog/en/css/opac.css
@@ -441,6 +441,10 @@ a .term {
 	background-image:url(../../images/cart2.gif);
 }
 
+#action a.comeback {
+    background-image:url(../../images/previous.gif);
+}
+
 /* toolbar buttons */
 
 #toolbar {
diff --git a/koha-tmpl/opac-tmpl/prog/en/includes/masthead.inc b/koha-tmpl/opac-tmpl/prog/en/includes/masthead.inc
index 0f532d8..bd36367 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 @@
         <option value="callnum">Call Number</option>
 		[% END %]</select>
 [% IF ( ms_value ) %]
-        <input type="text" id = "transl1" name="q" value="[% ms_value |html %]" class="left" style="width: 35%; font-size: 111%;"/><div id="translControl"></div>
+        <input type="text" id = "transl1" name="q" value="[% ms_value |html %]" class="left focus" style="width: 35%; font-size: 111%;"/><div id="translControl"></div>
 [% ELSE %]
-        <input type="text" id = "transl1" name="q" class="left" style="width: 35%; font-size: 111%;"/><div id="translControl"></div>
+        <input type="text" id = "transl1" name="q" class="left focus" style="width: 35%; font-size: 111%;"/><div id="translControl"></div>
 [% END %]
    [% IF ( OpacAddMastheadLibraryPulldown ) %]
       <select name="limit" id="masthead_search" class="left" style="max-width:10em;width:10em;">
diff --git a/koha-tmpl/opac-tmpl/prog/en/modules/opac-ISBDdetail.tt b/koha-tmpl/opac-tmpl/prog/en/modules/opac-ISBDdetail.tt
index 35fffc8..633567e 100644
--- a/koha-tmpl/opac-tmpl/prog/en/modules/opac-ISBDdetail.tt
+++ b/koha-tmpl/opac-tmpl/prog/en/modules/opac-ISBDdetail.tt
@@ -48,6 +48,10 @@
 	<div id="ulactioncontainer" class="container">
 <ul id="action">
 
+    [% IF ( currentsearchquery ) %][% UNLESS ( currentsearchisoneresult ) %]
+    <li><a class="comeback" href="/cgi-bin/koha/opac-search.pl?[% currentsearchquery %][% currentsearchlimit %]">Back to results</a></li>
+    [% END %][% END %]
+
 [% UNLESS ( norequests ) %]
         [% IF ( opacuserlogin ) %]
 		[% IF ( RequestOnOpac ) %]
diff --git a/koha-tmpl/opac-tmpl/prog/en/modules/opac-MARCdetail.tt b/koha-tmpl/opac-tmpl/prog/en/modules/opac-MARCdetail.tt
index 68b0148..02f09eb 100644
--- a/koha-tmpl/opac-tmpl/prog/en/modules/opac-MARCdetail.tt
+++ b/koha-tmpl/opac-tmpl/prog/en/modules/opac-MARCdetail.tt
@@ -203,6 +203,10 @@ $(document).ready(function(){
     <div id="ulactioncontainer" class="container">
 <ul id="action">
 
+    [% IF ( currentsearchquery ) %][% UNLESS ( currentsearchisoneresult ) %]
+    <li><a class="comeback" href="/cgi-bin/koha/opac-search.pl?[% currentsearchquery %][% currentsearchlimit %]">Back to results</a></li>
+    [% END %][% END %]
+
 [% UNLESS ( norequests ) %]
         [% IF ( opacuserlogin ) %]
         [% IF ( RequestOnOpac ) %]
diff --git a/koha-tmpl/opac-tmpl/prog/en/modules/opac-detail.tt b/koha-tmpl/opac-tmpl/prog/en/modules/opac-detail.tt
index 7263b1e..d30581d 100644
--- a/koha-tmpl/opac-tmpl/prog/en/modules/opac-detail.tt
+++ b/koha-tmpl/opac-tmpl/prog/en/modules/opac-detail.tt
@@ -795,6 +795,10 @@ YAHOO.util.Event.onContentReady("furtherm", function () {
 <div id="ulactioncontainer" class="container">
 <ul id="action">
 
+    [% IF ( currentsearchquery ) %][% UNLESS ( currentsearchisoneresult ) %]
+    <li><a class="comeback" href="/cgi-bin/koha/opac-search.pl?[% currentsearchquery %][% currentsearchlimit %]">Back to results</a></li>
+    [% END %][% END %]
+
 [% UNLESS ( norequests ) %]
         [% IF ( opacuserlogin ) %]
 		[% IF ( RequestOnOpac ) %]
diff --git a/koha-tmpl/opac-tmpl/prog/images/previous.gif b/koha-tmpl/opac-tmpl/prog/images/previous.gif
new file mode 100644
index 0000000000000000000000000000000000000000..b765ba752d4062566934f58da2668dd5aeb2acaa
GIT binary patch
literal 483
zcmZ?wbhEHb6lCCMIOfA3 at 71ONLhTCP9g5!Via^q*UD2mQ34}V8eL9tVJCuF9RD8RX
z{kl~AI#v9-RQ<Zt0(#VgdbGp(4I?MprOma=TIyQ3(yL&pZ^hb>%GCk2n*(aM1lMm3
zYuFsxxIMISM|jir at aCPdO<N*bc0{)9jB4E#)3z(VZD&mT?zoQK at tr`lC!upseD}Vz
zuAS+<dsF)MWlz|bGhtumq(cQ$4(3lilsD~2{<I^7GmaI`JYF>WWa*p}WphuI&pTN;
z?{vldlT`~&)hs+!x9D{Jl5=e<FLtcH)V20<@A|9#8?OHQcl!Sz28usf7`Yhg8FUzc
z02C(-><$g}P0jV<;w>E=;@<6 at o!vcsUEWjLrcH02FlF|fiLG-NOr5`QLEDmr?X#9I
dTD*GR+U31Xv!-vIynfQm9XmH~>S$!J1_1GZHc|ip

literal 0
HcmV?d00001

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 8e492aa..5cf38d2 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 b357a56..4a04a12 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
@@ -582,4 +582,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-search.pl b/opac/opac-search.pl
index 68018b6..56ec112 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
@@ -395,6 +398,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,7 +546,8 @@ for (my $i=0;$i<@servers;$i++) {
                 print $cgi->redirect("/cgi-bin/koha/opac-MARCdetail.pl?biblionumber=$biblionumber");
             } else {
                 print $cgi->redirect("/cgi-bin/koha/opac-detail.pl?biblionumber=$biblionumber");
-            } 
+            }
+            $session->param('currentsearchisoneresult', 1);
             exit;
         }
         if ($hits) {
@@ -647,7 +656,6 @@ if ($query_desc || $limit_desc) {
 
 # VI. BUILD THE TEMPLATE
 # Build drop-down list for 'Add To:' menu...
-my $session = get_session($cgi->cookie("CGISESSID"));
 my @addpubshelves;
 my $pubshelves = $session->param('pubshelves');
 my $barshelves = $session->param('barshelves');
-- 
1.7.1



More information about the Koha-patches mailing list