Bug 5888: Followup add a syspref (OPACPopupAuthorsSearch)
authorJonathan Druart <jonathan.druart@biblibre.com>
Mon, 11 Feb 2013 11:28:37 +0000 (12:28 +0100)
committerJared Camins-Esakov <jcamins@cpbibliography.com>
Wed, 20 Feb 2013 14:48:42 +0000 (09:48 -0500)
New syspref OPACPopupAuthorsSearch.
If it is disabled, the development has no effect.
Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Jared Camins-Esakov <jcamins@cpbibliography.com>
installer/data/mysql/updatedatabase.pl
koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/opac.pref
koha-tmpl/opac-tmpl/prog/en/modules/opac-detail.tt
opac/opac-detail.pl

index d4059cb..5469081 100755 (executable)
@@ -6421,6 +6421,14 @@ if ( C4::Context->preference("Version") < TransformToNum($DBversion) ) {
     SetVersion($DBversion);
 }
 
+$DBversion ="3.11.00.XXX";
+if ( CheckVersion($DBversion) ) {
+    $dbh->do("INSERT IGNORE INTO systempreferences (variable,value,explanation,options,type) VALUES('OPACPopupAuthorsSearch','0','Display the list of authors when clicking on one author.','','YesNo');");
+    print "Upgrade to $DBversion done (Bug 5888 - Subject search pop-up for the OPAC)\n";
+    SetVersion($DBversion);
+}
+
+
 =head1 FUNCTIONS
 
 =head2 TableExists($table)
index 300c6e1..9b698b0 100644 (file)
@@ -392,6 +392,13 @@ OPAC:
                   yes: Enable
                   no: Disable
             - Quote of the Day display on OPAC home page
+        -
+            - pref: OPACPopupAuthorsSearch
+              default: 0
+              choices:
+                yes: Display
+                no: Don't display
+            - the list of authors in a pop-up for a search.
     Policy:
         -
             - pref: singleBranchMode
index c807abc..b8f2efc 100644 (file)
@@ -370,9 +370,11 @@ YAHOO.util.Event.onContentReady("furtherm", function () {
 //]]>
 </script>
 
+[% IF OPACPopupAuthorsSearch %]
 <script type="text/JavaScript" language="JavaScript">
 //<![CDATA[
-    function showAuthors(element, authornumber){
+    function showAuthors(element){
+        var authornumber = $(element).attr("data-count");
         // Hide subjects menu if displayed
         hideMenu(".subjectSearch");
 
@@ -462,8 +464,16 @@ YAHOO.util.Event.onContentReady("furtherm", function () {
             $("#validSubjectSearch").removeAttr("href");
         }
     }
+    $(document).ready(function() {
+        $("a.showauthors").click(function(){
+            showAuthors(this);
+            return false;
+        });
+    });
+
 //]]>
 </script>
+[% END %]
 
 <style type="text/css">
 .branch-info-tooltip {
@@ -530,6 +540,7 @@ YAHOO.util.Event.onContentReady("furtherm", function () {
 
     [% IF ( MARCAUTHORS ) %]
     <span class="results_summary"><span class="label">Additional authors:</span>
+        [% IF OPACPopupAuthorsSearch %]
         <div class="authorSearch" id="authorSearch">
             <span><b>Select the item(s) to search :</b></span>
             <br />
@@ -561,12 +572,13 @@ YAHOO.util.Event.onContentReady("furtherm", function () {
             &nbsp;|&nbsp;
             <a id="validAuthorSearch">Search</a>
         </div>
+        [% END %]
         [% FOREACH MARCAUTHOR IN MARCAUTHORS %]
             [% authorsloop = loop %]
             [% FOREACH MARCAUTHOR_SUBFIELDS_LOO IN MARCAUTHOR.MARCAUTHOR_SUBFIELDS_LOOP %]
                 [% MARCAUTHOR_SUBFIELDS_LOO.separator %]
                 <a title="‡[% MARCAUTHOR_SUBFIELDS_LOO.code %] [% MARCAUTHOR_SUBFIELDS_LOO.value %]"
-                    onclick="showAuthors(this, [% authorsloop.count %]); return false;"
+                    class="showauthors" data-count="[% authorsloop.count %]"
                     href="/cgi-bin/koha/opac-search.pl?q=[% FOREACH link_loo IN MARCAUTHOR_SUBFIELDS_LOO.link_loop %][% link_loo.operator |url %][% link_loo.limit |url %]:[% link_loo.link |url %][% END %]">[% MARCAUTHOR_SUBFIELDS_LOO.value %]</a>
             [% END %]
             [% IF (MARCAUTHOR.authoritylink) %]
@@ -629,6 +641,7 @@ YAHOO.util.Event.onContentReady("furtherm", function () {
     [% IF ( MARCSUBJCTS ) %]
         <span class="results_summary">
             <span class="label">Subject(s):</span>
+            [% IF OPACPopupAuthorsSearch %]
             <div class="subjectSearch" >
                 <span><b>Select the item(s) to search :</b></span>
                 <div id="subjectsList">
@@ -666,6 +679,7 @@ YAHOO.util.Event.onContentReady("furtherm", function () {
                 &nbsp;|&nbsp;
                 <a id="validSubjectSearch">Search</a>
             </div>
+            [% END %]
             [% FOREACH MARCSUBJCT IN MARCSUBJCTS %]
                 [% subjectsloop = loop %]
                 [% FOREACH SUBFIELD IN MARCSUBJCT.MARCSUBJECT_SUBFIELDS_LOOP %]
index cc22acc..bb9cbd5 100755 (executable)
@@ -1001,6 +1001,7 @@ if (C4::Context->preference('OPACLocalCoverImages') == 1) {
 $template->{VARS}->{IDreamBooksReviews} = C4::Context->preference('IDreamBooksReviews');
 $template->{VARS}->{IDreamBooksReadometer} = C4::Context->preference('IDreamBooksReadometer');
 $template->{VARS}->{IDreamBooksResults} = C4::Context->preference('IDreamBooksResults');
+$template->{VARS}->{OPACPopupAuthorsSearch} = C4::Context->preference('OPACPopupAuthorsSearch');
 
 if (C4::Context->preference('OpacHighlightedWords')) {
     $template->{VARS}->{query_desc} = $query->param('query_desc');