From d30c5e54c692e61f86a7b7291135b07ca118cf06 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Marc=20V=C3=A9ron?= <veron@veron.ch>
Date: Fri, 21 Apr 2017 15:39:56 +0200
Subject: [PATCH] Bug 18472: Add system preference CustomOnlineHelpStaff to
hide / select custom online help system
Online help pages in staff client display a button 'Edit help' which is not
wanted / needed for every installation. Introduce a system variable
CustomOnlineHelpStaff to manage the online help system. In a first step it
can select between 'None' and the existing 'File based help system'
(selected by default).
To test:
- In staff client, open help on some pages, including help on main page
- They have a button 'Edit help'. On main page help, yo see a text about
'Can I edit the online help?'
- Apply patch, restart memcached and plack
- Update database
- In staff client, go to Administration > System preferences
- Search syspref 'CustomOnlineHelpStaff' verify that 'File based'
is selected by default (i.e. the legacy custom help system)
- Verify that the help pages you visited look the same as before
- Change syspref 'CustomOnlineHelpStaff' to 'None'
- Visit the pages again, verify that 'Edit help' button and text about
editing on main page help do no longer display.
Amended for comment #2 / MV
---
..._18472-Add_system_preference_CustomOnlineHelpStaff.perl | 14 ++++++++++++++
installer/data/mysql/sysprefs.sql | 1 +
koha-tmpl/intranet-tmpl/prog/en/includes/help-bottom.inc | 4 +++-
koha-tmpl/intranet-tmpl/prog/en/includes/help-top.inc | 1 +
.../prog/en/modules/admin/preferences/staff_client.pref | 7 +++++++
koha-tmpl/intranet-tmpl/prog/en/modules/help/mainpage.tt | 11 +++++++----
6 files changed, 33 insertions(+), 5 deletions(-)
create mode 100644 installer/data/mysql/atomicupdate/bug_18472-Add_system_preference_CustomOnlineHelpStaff.perl
diff --git a/installer/data/mysql/atomicupdate/bug_18472-Add_system_preference_CustomOnlineHelpStaff.perl b/installer/data/mysql/atomicupdate/bug_18472-Add_system_preference_CustomOnlineHelpStaff.perl
new file mode 100644
index 0000000..0f0d803
--- /dev/null
+++ b/installer/data/mysql/atomicupdate/bug_18472-Add_system_preference_CustomOnlineHelpStaff.perl
@@ -0,0 +1,14 @@
+$DBversion = 'XXX'; # will be replaced by the RM
+if( CheckVersion( $DBversion ) ) {
+ # you can use $dbh here like:
+ $dbh->do("INSERT IGNORE INTO systempreferences (`variable`, `value`, `options`, `explanation`, `type`) VALUES ('CustomOnlineHelpStaff', 'filebased', 'none|filebased', 'Select custom online help system for staff client.', 'Choice')" );
+
+ # or perform some test and warn
+ # if( !column_exists( 'biblio', 'biblionumber' ) ) {
+ # warn "There is something wrong";
+ # }
+
+ # Always end with this (adjust the bug info)
+ SetVersion( $DBversion );
+ print "Upgrade to $DBversion done (Bug XXXXX - description)\n";
+}
diff --git a/installer/data/mysql/sysprefs.sql b/installer/data/mysql/sysprefs.sql
index 64aa493..ac2cca0 100644
--- a/installer/data/mysql/sysprefs.sql
+++ b/installer/data/mysql/sysprefs.sql
@@ -114,6 +114,7 @@ INSERT INTO systempreferences ( `variable`, `value`, `options`, `explanation`, `
('CronjobLog','0',NULL,'If ON, log information from cron jobs.','YesNo'),
('CumulativeRestrictionPeriods',0,NULL,'Cumulate the restriction periods instead of keeping the highest','YesNo'),
('CurrencyFormat','US','US|FR|CH','Determines the display format of currencies. eg: \'36000\' is displayed as \'360 000,00\' in \'FR\' or \'360,000.00\' in \'US\'.','Choice'),
+('CustomOnlineHelpStaff', 'filebased', 'none|filebased', 'Select custom online help system for staff client.', 'Choice'),
('dateformat','us','metric|us|iso|dmydot','Define global date format (us mm/dd/yyyy, metric dd/mm/yyy, ISO yyyy-mm-dd, dmydot dd.mm.yyyy)','Choice'),
('DebugLevel','2','0|1|2','Define the level of debugging information sent to the browser when errors are encountered (set to 0 in production). 0=none, 1=some, 2=most','Choice'),
('decreaseLoanHighHolds',NULL,'','Decreases the loan period for items with number of holds above the threshold specified in decreaseLoanHighHoldsValue','YesNo'),
diff --git a/koha-tmpl/intranet-tmpl/prog/en/includes/help-bottom.inc b/koha-tmpl/intranet-tmpl/prog/en/includes/help-bottom.inc
index 9a2fb5a..7424b80 100644
--- a/koha-tmpl/intranet-tmpl/prog/en/includes/help-bottom.inc
+++ b/koha-tmpl/intranet-tmpl/prog/en/includes/help-bottom.inc
@@ -2,7 +2,9 @@
<fieldset class="action"><input type="button" class="close" value="Close help window" />
<input type="hidden" name="type" value="modify" />
<input type="hidden" name="referer" value="[% referer %]" />
- <input type="submit" class="submit" value="Edit help" /></fieldset>
+ [% IF Koha.Preference('CustomOnlineHelpStaff') == 'filebased' %]
+ <input type="submit" class="submit" value="Edit help" /></fieldset>
+ [% END %]
</form>
</body>
</html>
diff --git a/koha-tmpl/intranet-tmpl/prog/en/includes/help-top.inc b/koha-tmpl/intranet-tmpl/prog/en/includes/help-top.inc
index 7d85d95..ff6aeb8 100644
--- a/koha-tmpl/intranet-tmpl/prog/en/includes/help-top.inc
+++ b/koha-tmpl/intranet-tmpl/prog/en/includes/help-top.inc
@@ -1,3 +1,4 @@
+[% USE Koha %]
[% INCLUDE 'doc-head-open.inc' %]
<title>Online help</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/staff_client.pref b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/staff_client.pref
index e7da2e8..f1c0bb1 100644
--- a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/staff_client.pref
+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/staff_client.pref
@@ -150,6 +150,13 @@ Staff Client:
no: "Don't enable"
- audio alerts for events defined in the audio alerts section of administration.
-
+ - "Custom online help system for staff client: "
+ - pref: CustomOnlineHelpStaff
+ default: filebased
+ choices:
+ none: "None"
+ filebased: "File based"
+ -
- pref: IntranetCatalogSearchPulldown
choices:
yes: Show
diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/help/mainpage.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/help/mainpage.tt
index 84e6339..840c138 100644
--- a/koha-tmpl/intranet-tmpl/prog/en/modules/help/mainpage.tt
+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/help/mainpage.tt
@@ -1,3 +1,4 @@
+[% USE Koha %]
[% INCLUDE 'help-top.inc' %]
<h2>Welcome to Koha</h2>
@@ -17,13 +18,15 @@
<li><a href="http://koha-community.org/get-involved/irc/">Chat with Koha users and developers</a></li>
</ul>
-<h2>Can I edit the online help?</h2>
+[% IF Koha.Preference('CustomOnlineHelpStaff') == 'filebased' %]
+ <h2>Can I edit the online help?</h2>
-<p>You can edit the online help through the Koha Staff Client by clicking the "Edit Help" button. This feature has been designed so that library workflow and policies can be documented within Koha.</p>
+ <p>You can edit the online help through the Koha Staff Client by clicking the "Edit Help" button. This feature has been designed so that library workflow and policies can be documented within Koha.</p>
-<p><strong>IMPORTANT:</strong> Your online help will be overwritten by the new Help when there is an upgrade. If you want to keep a copy of your online help, you should instruct your System Administrator to upgrade the Online Help directory in the Koha file tree.</p>
+ <p><strong>IMPORTANT:</strong> Your online help will be overwritten by the new Help when there is an upgrade. If you want to keep a copy of your online help, you should instruct your System Administrator to upgrade the Online Help directory in the Koha file tree.</p>
-<p>The online help directory is: <pre>[% themelang %]/modules/help</pre></p>
+ <p>The online help directory is: <pre>[% themelang %]/modules/help</pre></p>
+[% END %]
<p><strong>See the full documentation for Koha in the <a href="http://manual.koha-community.org/[% helpVersion %]/en/">manual</a> (online).</strong></p>
--
2.1.4