From 7f8309f5a1fb7050e52f75594ff1a12e73a29e06 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Fr=C3=A9d=C3=A9rick?=
Date: Wed, 19 Mar 2014 14:40:38 -0400
Subject: [PATCH] [SIGNED OFF] Add OpacBelowLoginBox preference to add custom
text below the login box.
This patch file adds the ability to customize the text below
the login area which appears when 'Log in to your account'
in clicked in the top right of the OPAC.
TEST PLAN
----------
0) Back up your data if you care about it.
1) Open a staff client in your browser.
2) Make sure the OPAC system preference opacthemes is set
to 'prog'.
3) Make sure the OPAC system preference opacuserlogin is
set to 'Allow'.
NOTE: Required to make the 'Log in to your account' in the top
left of OPAC appear.
4) Make sure the OPAC system preference PatronSelfRegistration
is set to 'Allow'.
5) Make sure the OPAC system preference
PatronSelfRegistrationDefaultCategory is set to a value
of patron category that exists (eg. PT is a sample one)
NOTE: These are required to make the 'Register here' links
appear after the text.
6) Open the OPAC in another tab.
7) Click the 'Log in to your account' link.
8) Note the text below the login area.
9) Apply the patch and run an update.
(git bz apply 6864 -- interactive just this one)
(./installer/data/mysql/updatedatabase.pl)
10) Refresh the OPAC page.
-- the text should be identical.
11) In the staff client, modify the OPAC system preference
OpacBelowLoginText to have some text, and save.
12) Refresh the OPAC page.
-- the text should reflect what was entered in the
OpacBelowLoginText system preference.
13) Open your mysql.
14) Drop and recreate the koha database.
15) Do a web install by going to the staff client URL.
16) Log in as the system user.
17) Confirm the OPAC system preference OpacBelowLoginBox
exists.
18) Modify its value (blank, non-blank) and confirm that
the OPAC page reflects the default message or custom
message as expected each reload.
19) Run the Koha QA Test Tool
-- This will FAIL on the system preferences SQL file.
The next patch by me, Mark Tompsett, will fix it.
Signed-off-by: Mark Tompsett
---
C4/Auth.pm | 1 +
installer/data/mysql/sysprefs.sql | 3 ++-
installer/data/mysql/updatedatabase.pl | 8 ++++++++
.../prog/en/modules/admin/preferences/opac.pref | 5 +++++
koha-tmpl/opac-tmpl/prog/en/modules/opac-auth.tt | 9 +++++++--
5 files changed, 23 insertions(+), 3 deletions(-)
diff --git a/C4/Auth.pm b/C4/Auth.pm
index 44edf67..d2a8a19 100644
--- a/C4/Auth.pm
+++ b/C4/Auth.pm
@@ -1064,6 +1064,7 @@ sub checkauth {
IndependentBranches=> C4::Context->preference("IndependentBranches"),
AutoLocation => C4::Context->preference("AutoLocation"),
wrongip => $info{'wrongip'},
+ opacbelowloginbox => C4::Context->preference("OpacBelowLoginBox"),
PatronSelfRegistration => C4::Context->preference("PatronSelfRegistration"),
PatronSelfRegistrationDefaultCategory => C4::Context->preference("PatronSelfRegistrationDefaultCategory"),
persona => C4::Context->preference("Persona"),
diff --git a/installer/data/mysql/sysprefs.sql b/installer/data/mysql/sysprefs.sql
index 661910b..27b83d2 100644
--- a/installer/data/mysql/sysprefs.sql
+++ b/installer/data/mysql/sysprefs.sql
@@ -427,5 +427,6 @@ INSERT INTO systempreferences ( `variable`, `value`, `options`, `explanation`, `
('XSLTResultsDisplay','default','','Enable XSL stylesheet control over results page display on intranet','Free'),
('yuipath','local','local|http://yui.yahooapis.com/2.5.1/build','Insert the path to YUI libraries, choose local if you use koha offline','Choice'),
('z3950AuthorAuthFields','701,702,700',NULL,'Define the MARC biblio fields for Personal Name Authorities to fill biblio.author','free'),
-('z3950NormalizeAuthor','0','','If ON, Personal Name Authorities will replace authors in biblio.author','YesNo')
+('z3950NormalizeAuthor','0','','If ON, Personal Name Authorities will replace authors in biblio.author','YesNo'),
+('OpacBelowLoginBox','', '30|10','HTML to show under the login box','Textarea')
;
diff --git a/installer/data/mysql/updatedatabase.pl b/installer/data/mysql/updatedatabase.pl
index 062ecc1..a949136 100755
--- a/installer/data/mysql/updatedatabase.pl
+++ b/installer/data/mysql/updatedatabase.pl
@@ -8083,6 +8083,14 @@ if ( CheckVersion($DBversion) ) {
SetVersion($DBversion);
}
+$DBversion = "XXX";
+if ( CheckVersion($DBversion) ) {
+ $dbh->do("INSERT INTO `systempreferences` (variable,value,options,explanation,type) VALUES ('OpacBelowLoginBox','', '30|10','HTML to show under the login box','Textarea');");
+ print "Upgrade to $DBversion done (Add OpacBelowLoginBox preference)\n";
+ SetVersion($DBversion);
+}
+
+
=head1 FUNCTIONS
=head2 TableExists($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 d541440..415e4e1 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
@@ -225,6 +225,11 @@ OPAC:
type: textarea
class: code
-
+ - "Include the following HTML under the login box in the OPAC."
+ - pref: OpacBelowLoginBox
+ type: textarea
+ class: code
+ -
- 'Include a "More Searches" box on the detail pages of items on the OPAC, with the following HTML (leave blank to disable):'
- ' Note: The placeholders {BIBLIONUMBER}, {CONTROLNUMBER}, {TITLE}, {ISBN}, {ISSN} and {AUTHOR} will be replaced with information from the displayed record.'
- pref: OPACSearchForTitleIn
diff --git a/koha-tmpl/opac-tmpl/prog/en/modules/opac-auth.tt b/koha-tmpl/opac-tmpl/prog/en/modules/opac-auth.tt
index 7b8b8f9..b3685c4 100644
--- a/koha-tmpl/opac-tmpl/prog/en/modules/opac-auth.tt
+++ b/koha-tmpl/opac-tmpl/prog/en/modules/opac-auth.tt
@@ -86,8 +86,13 @@ please choose against which one you would like to authenticate:
-
Don't have a password yet?
If you don't have a password yet, stop by the circulation desk the next time you're in the library. We'll happily set one up for you.
-
Don't have a library card?
If you don't have a library card, stop by your local library to sign up[% IF PatronSelfRegistration && PatronSelfRegistrationDefaultCategory %] or register here[% END %].
+ [% IF ( opacbelowloginbox ) %]
+ [% opacbelowloginbox %]
+ [% IF PatronSelfRegistration && PatronSelfRegistrationDefaultCategory %]Register here[% END %]
+ [% ELSE %]
+
Don't have a password yet?
If you don't have a password yet, stop by the circulation desk the next time you're in the library. We'll happily set one up for you.
+
Don't have a library card?
If you don't have a library card, stop by your local library to sign up[% IF PatronSelfRegistration && PatronSelfRegistrationDefaultCategory %] or register here[% END %].