Bug 3708 - Add another customizable region to the OPAC: right sidebar nav
authorPaul Poulain <paul.poulain@biblibre.com>
Wed, 20 Jun 2012 21:11:06 +0000 (23:11 +0200)
committerPaul Poulain <paul.poulain@biblibre.com>
Wed, 20 Jun 2012 21:11:06 +0000 (23:11 +0200)
This patch creates a new system preference, OpacNavRight, in
which the librarian can add HTML which will appear on the OPAC
main page under the login form. If the user is logged in the content
will appear in place of the login form.

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Paul Poulain <paul.poulain@biblibre.com>
C4/Auth.pm
installer/data/mysql/sysprefs.sql
installer/data/mysql/updatedatabase.pl
koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/opac.pref
koha-tmpl/opac-tmpl/prog/en/modules/opac-main.tt

index 66e70bd..143fe3f 100644 (file)
@@ -428,6 +428,7 @@ sub get_template_and_user {
             OpacKohaUrl               => C4::Context->preference("OpacKohaUrl"),
             OpacMainUserBlock         => "" . C4::Context->preference("OpacMainUserBlock"),
             OpacNav                   => "" . C4::Context->preference("OpacNav"),
+            OpacNavRight              => "" . C4::Context->preference("OpacNavRight"),
             OpacNavBottom             => "" . C4::Context->preference("OpacNavBottom"),
             OpacPasswordChange        => C4::Context->preference("OpacPasswordChange"),
             OPACPatronDetails        => C4::Context->preference("OPACPatronDetails"),
@@ -964,6 +965,7 @@ sub checkauth {
         LibraryName          => C4::Context->preference("LibraryName"),
         opacuserlogin        => C4::Context->preference("opacuserlogin"),
         OpacNav              => C4::Context->preference("OpacNav"),
+        OpacNavRight         => C4::Context->preference("OpacNavRight"),
         OpacNavBottom        => C4::Context->preference("OpacNavBottom"),
         opaccredits          => C4::Context->preference("opaccredits"),
         OpacFavicon          => C4::Context->preference("OpacFavicon"),
index 934427a..6c6d91b 100644 (file)
@@ -82,6 +82,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('OpacNavRight','','Show the following HTML in the right hand column of the main page under the main login form','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');
index 7bc73b0..d06a188 100755 (executable)
@@ -5385,6 +5385,13 @@ if (C4::Context->preference("Version") < TransformToNum($DBversion)) {
     SetVersion ($DBversion);
 }
 
+$DBversion = "3.09.00.017";
+if (C4::Context->preference("Version") < TransformToNum($DBversion)) {
+    $dbh->do("INSERT INTO systempreferences (variable,value,options,explanation,type) VALUES ('OpacNavRight', '', '70|10', 'Show the following HTML in the right hand column of the main page under the main login form', 'Textarea');");
+    print "Upgrade to $DBversion done (Add customizable OpacNavRight region to the OPAC main page)\n";
+    SetVersion ($DBversion);
+}
+
 =head1 FUNCTIONS
 
 =head2 TableExists($table)
index 4f9092b..7ca4692 100644 (file)
@@ -171,6 +171,11 @@ OPAC:
             - pref: OpacNav
               type: textarea
               class: code
+        -
+            - "Show the following HTML in the right hand column of the main page under the main login form:"
+            - pref: OpacNavRight
+              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
index a89c473..d291b2a 100644 (file)
        <div class="yui-b">
      [% IF ( opacuserlogin ) %]
         [% IF ( loggedinusername ) %]
-            <div id="loggedin" class="yui-g">
-            <div>
+         <div id="loggedin" class="yui-ge">
         [% ELSE %]
-            <div id="notloggedin" class="yui-ge">
-            <div class="yui-u first">
+        <div id="notloggedin" class="yui-ge">
          [% END %]
      [% ELSE %]
-         <div id="notloggedin" class="yui-g">
-        <div>
+        <div id="notloggedin" class="yui-ge">
     [% END %]
-       
+        <div class="yui-u first">
        [% IF ( koha_news_count ) %]
 <div id="news" class="container">
     <table>
 
 </div>
                
-       [% IF ( opacuserlogin ) %]
+    [% IF ( opacuserlogin || OpacNavRight ) %]
+    <div class="yui-u">
+    [% IF ( opacuserlogin ) %]
     [% UNLESS ( loggedinusername ) %]
     [% UNLESS ( casAuthentication ) %]
-    <div class="yui-u">
-       <div id="login" class="container">
+    <div id="login" class="container clearfix">
        <form action="/cgi-bin/koha/opac-user.pl" method="post" name="auth" id="auth">
     <input type="hidden" name="koha_login_context" value="opac" />
        <fieldset class="brief">
         </fieldset></fieldset>
        </form>
        </div>
-        </div>
     [% END %]
     [% END %]
-       
-[% END %]
+    [% END %]
+    [% IF ( OpacNavRight ) %]<div id="opacrightsidebar" class="container">[% OpacNavRight %]</div>[% END %]
+    </div>
+    [% END %]
 </div>
 </div>
 </div>