[Koha-patches] [PATCH] Bug 6825 OpacNav menu hide user menu on opac-user.pl page

Frédéric Demians f.demians at tamil.fr
Sun Sep 11 11:14:07 CEST 2011


This patch add a new syspref OpacNavBottom which is placed on all pages
after OpacNav. On Patron pages, specif patron links are placed between
OpacNav and OpacNavBottom, like this:

  OpacNav
  Patron links
  OpacNavBottom

To test:

  1 Apply this patch
  2 For RM, modify kohaversion.pl and updatedatabase.pl appropriately
  3 Test that OPAC pages are displayed as before, OpacNav on the left
  4 Test OPAC patron pages: OpacNav is as before displayed after patron
    links
  5 Split OpacNav between itself and OpacNavBottom
  6 Patron pages display patron links between OpacNav and OpacNavBottom
---
 C4/Auth.pm                                         |    2 ++
 installer/data/mysql/sysprefs.sql                  |    1 +
 installer/data/mysql/updatedatabase.pl             |    8 ++++++++
 .../prog/en/modules/admin/preferences/opac.pref    |    5 +++++
 .../opac-tmpl/prog/en/includes/navigation.inc      |    7 ++++++-
 .../opac-tmpl/prog/en/modules/opac-account.tt      |    3 +--
 .../opac-tmpl/prog/en/modules/opac-messaging.tt    |    3 +--
 koha-tmpl/opac-tmpl/prog/en/modules/opac-passwd.tt |    3 +--
 .../opac-tmpl/prog/en/modules/opac-privacy.tt      |    3 +--
 .../prog/en/modules/opac-readingrecord.tt          |    3 +--
 .../prog/en/modules/opac-search-history.tt         |    6 ++----
 .../opac-tmpl/prog/en/modules/opac-shelves.tt      |    3 +--
 .../opac-tmpl/prog/en/modules/opac-suggestions.tt  |    3 +--
 koha-tmpl/opac-tmpl/prog/en/modules/opac-tags.tt   |    3 +--
 koha-tmpl/opac-tmpl/prog/en/modules/opac-user.tt   |    3 +--
 .../opac-tmpl/prog/en/modules/opac-userupdate.tt   |    3 +--
 16 files changed, 34 insertions(+), 25 deletions(-)

diff --git a/C4/Auth.pm b/C4/Auth.pm
index 495f04c..6ec71a3 100644
--- a/C4/Auth.pm
+++ b/C4/Auth.pm
@@ -437,6 +437,7 @@ sub get_template_and_user {
             OpacCloud                 => C4::Context->preference("OpacCloud"),
             OpacMainUserBlock         => "" . C4::Context->preference("OpacMainUserBlock"),
             OpacNav                   => "" . C4::Context->preference("OpacNav"),
+            OpacNavBottom             => "" . C4::Context->preference("OpacNavBottom"),
             OpacPasswordChange        => C4::Context->preference("OpacPasswordChange"),
             OPACPatronDetails        => C4::Context->preference("OPACPatronDetails"),
             OPACPrivacy               => C4::Context->preference("OPACPrivacy"),
@@ -956,6 +957,7 @@ sub checkauth {
         LibraryName          => C4::Context->preference("LibraryName"),
         opacuserlogin        => C4::Context->preference("opacuserlogin"),
         OpacNav              => C4::Context->preference("OpacNav"),
+        OpacNavBottom        => C4::Context->preference("OpacNavBottom"),
         opaccredits          => C4::Context->preference("opaccredits"),
         OpacFavicon          => C4::Context->preference("OpacFavicon"),
         opacreadinghistory   => C4::Context->preference("opacreadinghistory"),
diff --git a/installer/data/mysql/sysprefs.sql b/installer/data/mysql/sysprefs.sql
index 79d4893..3e80d5c 100755
--- a/installer/data/mysql/sysprefs.sql
+++ b/installer/data/mysql/sysprefs.sql
@@ -81,6 +81,7 @@ INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES
 INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES('OpacMaintenance',0,'If ON, enables maintenance warning in OPAC','','YesNo');
 INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES('OpacMainUserBlock','Welcome to Koha...\r\n<hr>','A user-defined block of HTML  in the main content area of the opac main page','70|10','Textarea');
 INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES('OpacNav','Important links here.','Use HTML tags to add navigational links to the left-hand navigational bar in OPAC','70|10','Textarea');
+INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES('OpacNavBottom','Important links here.','Use HTML tags to add navigational links to the left-hand navigational bar in OPAC','70|10','Textarea');
 INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES('OPACNoResultsFound','','Display this HTML when no results are found for a search in the OPAC','70|10','Textarea');
 INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES('OpacPasswordChange',1,'If ON, enables patron-initiated password change in OPAC (disable it when using LDAP auth)',NULL,'YesNo');
 INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES('OpacPrivacy', '0', 'if ON, allows patrons to define their privacy rules (reading history)',NULL,'YesNo');
diff --git a/installer/data/mysql/updatedatabase.pl b/installer/data/mysql/updatedatabase.pl
index 6b88c29..cf21e6d 100755
--- a/installer/data/mysql/updatedatabase.pl
+++ b/installer/data/mysql/updatedatabase.pl
@@ -4447,6 +4447,14 @@ if (C4::Context->preference("Version") < TransformToNum($DBversion)) {
 }
 
 
+$DBversion = "3.05.00.XXX";
+if (C4::Context->preference("Version") < TransformToNum($DBversion)) {
+    $dbh->do("INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES('OpacNavBottom','','Links after OpacNav links','70|10','Textarea')");
+    print "Upgrade to $DBversion done (add OpacNavBottom syspref (enh 6825): if appropriate, you can split OpacNav into OpacNav and OpacNavBottom)\n";
+    SetVersion($DBversion);
+}
+
+
 =head1 FUNCTIONS
 
 =head2 DropAllForeignKeys($table)
diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/opac.pref b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/opac.pref
index 8bbf692..032c85a 100644
--- a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/opac.pref
+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/opac.pref
@@ -143,6 +143,11 @@ OPAC:
               type: textarea
               class: code
         -
+            - "Show the following HTML on the left hand column of the main page and patron account on the OPAC, after OpacNav, and before patron account links if available:"
+            - pref: OpacNavBottom
+              type: textarea
+              class: code
+        -
             - "Include the following HTML in the header of all pages in the OPAC:"
             - pref: opacheader
               type: textarea
diff --git a/koha-tmpl/opac-tmpl/prog/en/includes/navigation.inc b/koha-tmpl/opac-tmpl/prog/en/includes/navigation.inc
index 637ed33..9cd2c12 100644
--- a/koha-tmpl/opac-tmpl/prog/en/includes/navigation.inc
+++ b/koha-tmpl/opac-tmpl/prog/en/includes/navigation.inc
@@ -1 +1,6 @@
-[% OpacNav %]
\ No newline at end of file
+[% OpacNav %]
+[% IF IsPatronPage %]
+[% INCLUDE usermenu.inc %]
+[% END %]
+[% OpacNavBottom %]
+
diff --git a/koha-tmpl/opac-tmpl/prog/en/modules/opac-account.tt b/koha-tmpl/opac-tmpl/prog/en/modules/opac-account.tt
index eed66d3..b28fd08 100644
--- a/koha-tmpl/opac-tmpl/prog/en/modules/opac-account.tt
+++ b/koha-tmpl/opac-tmpl/prog/en/modules/opac-account.tt
@@ -54,8 +54,7 @@
 </div>
 <div class="yui-b">
 <div id="leftmenus" class="container">
-[% INCLUDE 'navigation.inc' %]
-[% INCLUDE 'usermenu.inc' %]
+[% INCLUDE 'navigation.inc' IsPatronPage=1 %]
 </div>
 </div>
 </div>
diff --git a/koha-tmpl/opac-tmpl/prog/en/modules/opac-messaging.tt b/koha-tmpl/opac-tmpl/prog/en/modules/opac-messaging.tt
index ebb1e26..e456f0f 100644
--- a/koha-tmpl/opac-tmpl/prog/en/modules/opac-messaging.tt
+++ b/koha-tmpl/opac-tmpl/prog/en/modules/opac-messaging.tt
@@ -115,8 +115,7 @@
 </div>
 <div class="yui-b">
 <div id="leftmenus" class="container">
-[% INCLUDE 'navigation.inc' %]
-[% INCLUDE 'usermenu.inc' %]
+[% INCLUDE 'navigation.inc' IsPatronPage=1 %]
 </div>
 </div>
 </div>
diff --git a/koha-tmpl/opac-tmpl/prog/en/modules/opac-passwd.tt b/koha-tmpl/opac-tmpl/prog/en/modules/opac-passwd.tt
index 16c4532..1f3025a 100644
--- a/koha-tmpl/opac-tmpl/prog/en/modules/opac-passwd.tt
+++ b/koha-tmpl/opac-tmpl/prog/en/modules/opac-passwd.tt
@@ -54,8 +54,7 @@
 </div>
 <div class="yui-b">
 <div id="leftmenus" class="container">
-[% INCLUDE 'navigation.inc' %]
-[% INCLUDE 'usermenu.inc' %]
+[% INCLUDE 'navigation.inc' IsPatronPage=1 %]
 </div>
 </div>
 </div>
diff --git a/koha-tmpl/opac-tmpl/prog/en/modules/opac-privacy.tt b/koha-tmpl/opac-tmpl/prog/en/modules/opac-privacy.tt
index de34e02..b1c4d1f 100644
--- a/koha-tmpl/opac-tmpl/prog/en/modules/opac-privacy.tt
+++ b/koha-tmpl/opac-tmpl/prog/en/modules/opac-privacy.tt
@@ -64,8 +64,7 @@
 </div>
 <div class="yui-b">
 <div id="leftmenus" class="container">
-[% INCLUDE 'navigation.inc' %]
-[% INCLUDE 'usermenu.inc' %]
+[% INCLUDE 'navigation.inc' IsPatronPage=1 %]
 </div>
 </div>
 </div>
diff --git a/koha-tmpl/opac-tmpl/prog/en/modules/opac-readingrecord.tt b/koha-tmpl/opac-tmpl/prog/en/modules/opac-readingrecord.tt
index 683a5bd..bedae0a 100644
--- a/koha-tmpl/opac-tmpl/prog/en/modules/opac-readingrecord.tt
+++ b/koha-tmpl/opac-tmpl/prog/en/modules/opac-readingrecord.tt
@@ -95,8 +95,7 @@ You have never borrowed anything from this library.
 </div>
 <div class="yui-b">
 <div id="leftmenus" class="container">
-[% INCLUDE 'navigation.inc' %]
-[% INCLUDE 'usermenu.inc' %]
+[% INCLUDE 'navigation.inc' IsPatronPage=1 %]
 </div>
 </div>
 </div>
diff --git a/koha-tmpl/opac-tmpl/prog/en/modules/opac-search-history.tt b/koha-tmpl/opac-tmpl/prog/en/modules/opac-search-history.tt
index e9f6be1..6c2cd82 100644
--- a/koha-tmpl/opac-tmpl/prog/en/modules/opac-search-history.tt
+++ b/koha-tmpl/opac-tmpl/prog/en/modules/opac-search-history.tt
@@ -82,13 +82,11 @@
 
 [% IF ( OpacNav ) %]
 <div class="yui-b"><div id="leftmenus" class="container">
-[% INCLUDE 'navigation.inc' %]
-[% INCLUDE 'usermenu.inc' %]
+[% INCLUDE 'navigation.inc' IsPatronPage=1 %]
 </div></div>
 [% ELSIF ( loggedinusername ) %]
 <div class="yui-b"><div id="leftmenus" class="container">
-[% INCLUDE 'navigation.inc' %]
-[% INCLUDE 'usermenu.inc' %]
+[% INCLUDE 'navigation.inc' IsPatronPage=1 %]
 </div></div>
 [% ELSE %]
 [% END %]
diff --git a/koha-tmpl/opac-tmpl/prog/en/modules/opac-shelves.tt b/koha-tmpl/opac-tmpl/prog/en/modules/opac-shelves.tt
index c50cfb1..aa10dae 100644
--- a/koha-tmpl/opac-tmpl/prog/en/modules/opac-shelves.tt
+++ b/koha-tmpl/opac-tmpl/prog/en/modules/opac-shelves.tt
@@ -601,8 +601,7 @@ $(function() {
       [% IF ( OpacNav||loggedinusername ) %]
         <div class="yui-b">
           <div is="leftmenus" class="container">
-            [% INCLUDE 'navigation.inc' %]
-            [% INCLUDE 'usermenu.inc' %]
+            [% INCLUDE 'navigation.inc' IsPatronPage=1 %]
           </div>
         </div>
       [% END %]
diff --git a/koha-tmpl/opac-tmpl/prog/en/modules/opac-suggestions.tt b/koha-tmpl/opac-tmpl/prog/en/modules/opac-suggestions.tt
index 3f3aa34..d8757bb 100644
--- a/koha-tmpl/opac-tmpl/prog/en/modules/opac-suggestions.tt
+++ b/koha-tmpl/opac-tmpl/prog/en/modules/opac-suggestions.tt
@@ -212,8 +212,7 @@ $.tablesorter.addParser({
 </div>
 <div class="yui-b">
 <div id="leftmenus" class="container">
-[% INCLUDE 'navigation.inc' %]
-[% INCLUDE 'usermenu.inc' %]
+[% INCLUDE 'navigation.inc' IsPatronPage=1 %]
 </div>
 </div>
 </div>
diff --git a/koha-tmpl/opac-tmpl/prog/en/modules/opac-tags.tt b/koha-tmpl/opac-tmpl/prog/en/modules/opac-tags.tt
index e99d201..e93e00a 100644
--- a/koha-tmpl/opac-tmpl/prog/en/modules/opac-tags.tt
+++ b/koha-tmpl/opac-tmpl/prog/en/modules/opac-tags.tt
@@ -131,8 +131,7 @@
 </div>
 [% IF ( OpacNav||loggedinusername ) %]
 <div class="yui-b"><div id="leftmenus" class="container">
-[% INCLUDE 'navigation.inc' %]
-[% INCLUDE 'usermenu.inc' %]
+[% INCLUDE 'navigation.inc' IsPatronPage=1 %]
 </div></div>
 [% END %]
 </div>
diff --git a/koha-tmpl/opac-tmpl/prog/en/modules/opac-user.tt b/koha-tmpl/opac-tmpl/prog/en/modules/opac-user.tt
index 9ba6c05..d9417ec 100644
--- a/koha-tmpl/opac-tmpl/prog/en/modules/opac-user.tt
+++ b/koha-tmpl/opac-tmpl/prog/en/modules/opac-user.tt
@@ -423,8 +423,7 @@ $.tablesorter.addParser({
 </div>
 <div class="yui-b">
 <div id="leftmenus" class="container">
-[% INCLUDE 'navigation.inc' %]
-[% INCLUDE 'usermenu.inc' %]
+[% INCLUDE 'navigation.inc' IsPatronPage=1 %]
 </div>
 </div>
 </div>
diff --git a/koha-tmpl/opac-tmpl/prog/en/modules/opac-userupdate.tt b/koha-tmpl/opac-tmpl/prog/en/modules/opac-userupdate.tt
index db5f7f5..58f4d2d 100644
--- a/koha-tmpl/opac-tmpl/prog/en/modules/opac-userupdate.tt
+++ b/koha-tmpl/opac-tmpl/prog/en/modules/opac-userupdate.tt
@@ -180,8 +180,7 @@
 </div>
 <div class="yui-b">
 <div id="leftmenus" class="container">
-[% INCLUDE 'navigation.inc' %]
-[% INCLUDE 'usermenu.inc' %]
+[% INCLUDE 'navigation.inc' IsPatronPage=1 %]
 </div>
 </div>
 </div>
-- 
1.7.6.1



More information about the Koha-patches mailing list