From 8ba50bcfce07b78746b6e1f85d02a019582787c5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marc=20V=C3=A9ron?= Date: Fri, 21 Apr 2017 15:39:56 +0200 Subject: [PATCH] Bug 18472: Add system preferences to manage online help system This patch introduces two new system preferences in section 'Administration' - 'HelpSystem' to select / disable the help system to use. It is designed to allow future expansions (alternative / complementing help system), thats why it is a 'Multiple choice' with one choice - 'EnableEditingFilebasedHelp' is used to toggle on/off the 'Edit' field that appears at the bottom of the durrent help pages. 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, you 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 > Administration - Locate section 'Help system', do not yet schange settings - Verify that the help pages you visited look the same as before - Change syspref 'EnableEditingFilebasedHelp' to 'No' - Visit the help pages again, verify that 'Edit help' button no longer appears. - Set the system preference 'HelpSystem' to none (deselect 'File based (staff client) - Reload any page and verify that the 'Help' link in the page header does no longer display - In syspref 'HelpSystem', check 'File based (staff client)' - Reload any page, verify that the 'Help' link is displayed --- ...18472-Add_system_preference_CustomOnlineHelpStaff.perl | 15 +++++++++++++++ installer/data/mysql/sysprefs.sql | 2 ++ koha-tmpl/intranet-tmpl/prog/en/includes/header.inc | 8 +++++--- koha-tmpl/intranet-tmpl/prog/en/includes/help-bottom.inc | 10 ++++++---- koha-tmpl/intranet-tmpl/prog/en/includes/help-top.inc | 1 + .../prog/en/modules/admin/preferences/admin.pref | 15 +++++++++++++++ koha-tmpl/intranet-tmpl/prog/en/modules/help/mainpage.tt | 12 ++++++++---- 7 files changed, 52 insertions(+), 11 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..ce31d2d --- /dev/null +++ b/installer/data/mysql/atomicupdate/bug_18472-Add_system_preference_CustomOnlineHelpStaff.perl @@ -0,0 +1,15 @@ +$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 ('HelpSystem', 'filebased', 'filebased', 'Select online help system.', 'multiple')" ); + $dbh->do("INSERT IGNORE INTO systempreferences (`variable`, `value`, `options`, `explanation`, `type`) VALUES ('EnableEditingFilebasedHelp', '1', '', 'Enable editing of file based Koha help.', 'yesno')" ); + + # 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 18472 - Add system preference CustomOnlineHelpStaff to hide / select custom online help system)\n"; +} diff --git a/installer/data/mysql/sysprefs.sql b/installer/data/mysql/sysprefs.sql index ef52c81..be140f5 100644 --- a/installer/data/mysql/sysprefs.sql +++ b/installer/data/mysql/sysprefs.sql @@ -114,6 +114,8 @@ 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'), +('HelpSystem', 'filebased', 'filebased', 'Select online help system.', 'multiple'), +("INSERT IGNORE INTO systempreferences (`variable`, `value`, `options`, `explanation`, `type`) VALUES ('EnableEditingFilebasedHelp', '1', '', 'Enable editing of file based Koha help.', 'yesno')" ), ('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/header.inc b/koha-tmpl/intranet-tmpl/prog/en/includes/header.inc index 2c88c6c..2f1b98c 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/includes/header.inc +++ b/koha-tmpl/intranet-tmpl/prog/en/includes/header.inc @@ -97,9 +97,11 @@ -
  • - Help -
  • + [% IF Koha.Preference('HelpSystem') == 'filebased' %] +
  • + Help +
  • + [% END %] [% ELSE %]
  • 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..0ed2086 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/includes/help-bottom.inc +++ b/koha-tmpl/intranet-tmpl/prog/en/includes/help-bottom.inc @@ -1,8 +1,10 @@
    -
    - - -
    +
    + [% IF (Koha.Preference('HelpSystem') == 'filebased') && (Koha.Preference('EnableEditingFilebasedHelp') ) %] + + +
    + [% END %]
    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' %] Online help diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/admin.pref b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/admin.pref index ab8cfa5..c0c4526 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/admin.pref +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/admin.pref @@ -413,3 +413,18 @@ Administration: choices: Zebra: Zebra Elasticsearch: Elasticsearch + Help system: + - + - "Select online help system: " + - pref: HelpSystem + default: filebased + multiple: + filebased: "File based (staff client)" + - + - "Enable editing of file based Koha help: " + - pref: EnableEditingFilebasedHelp + default: 1 + choices: + yes: "Yes" + no: "No" + - "Used together with 'File based (staff client)' selection in preference 'HelpSystem' 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..86ab4b7 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' %]

    Welcome to Koha

    @@ -17,13 +18,16 @@
  • Chat with Koha users and developers
  • -

    Can I edit the online help?

    +[% IF ( Koha.Preference('HelpSystem') == 'filebased' ) %] +

    Can I edit the online help?

    -

    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.

    +

    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.

    -

    IMPORTANT: 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.

    +

    IMPORTANT: 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.

    -

    The online help directory is:

    [% themelang %]/modules/help

    +

    The online help directory is:

    [% themelang %]/modules/help

    +

    Note: Files in help directory must be writeable to make this feature work. Additionally, system preference 'EnableEditingFilebasedHelp' must be set to 'Yes'.

    +[% END %]

    See the full documentation for Koha in the manual (online).

    -- 2.1.4