Bug 18472

Summary: Add system preferences to manage online help system
Product: Koha Reporter: Marc Véron <veron>
Component: Staff interfaceAssignee: Marc Véron <veron>
Status: BLOCKED --- QA Contact: Testopia <testopia>
Severity: enhancement    
Priority: P5 - low CC: gmcharlt, jonathan.druart, m.de.rooy, mtompset, nick, tomascohen
Version: master   
Hardware: All   
OS: All   
See Also: https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=10232
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=15003
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=19817
Change sponsored?: --- Patch complexity: Trivial patch
Documentation contact: Documentation submission:
Text to go in the release notes:
Version(s) released in:
Bug Depends on:    
Bug Blocks: 18483    
Attachments: Bug 18472: Add system preference CustomOnlineHelpStaff to hide / select custom online help system
Bug 18472: Add system preference CustomOnlineHelpStaff to hide / select custom online help system
Bug 18472: (followup) Add system preference CustomOnlineHelpStaff
Bug 18472: Some architectural changes...
Bug 18472: Add system preferences to manage online help system
Bug 18472: Add system preferences to manage online help system
Bug 18472: Add system preferences to manage online help system
Bug 18472: Add system preferences to manage online help system
Bug 18472: Add system preferences to manage online help system
Bug 18472: Add system preferences to manage online help system
[SIGNED-OFF] Bug 18472: Add system preferences to manage online help system
Bug 18472: Add system preferences to manage online help system
Bug 18472: Add system preferences to manage online help system

Description Marc Véron 2017-04-21 13:31:09 UTC
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).
Comment 1 Marc Véron 2017-04-21 13:57:13 UTC
Created attachment 62525 [details] [review]
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.

Note to QAers: Please have a close look at
koha-tmpl/intranet-tmpl/prog/en/modules/help/mainpage.tt
I had to include there [% USE Koha %] again, to trigger
Koha.Preference('CustomOnlineHelpStaff').(It should trigger,
because [% USE Koha %] is already included help-top.inc)
Comment 2 Jonathan Druart 2017-04-21 15:32:17 UTC
(In reply to Marc Véron from comment #1)
> Note to QAers: Please have a close look at
> koha-tmpl/intranet-tmpl/prog/en/modules/help/mainpage.tt
> I had to include there [% USE Koha %] again, to trigger
> Koha.Preference('CustomOnlineHelpStaff').(It should trigger,
> because [% USE Koha %] is already included help-top.inc)

No problem with that, but the USE should be moved to the top of the file.
Comment 3 Marc Véron 2017-04-21 17:49:59 UTC
Created attachment 62556 [details] [review]
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
Comment 4 Marc Véron 2017-04-24 20:05:38 UTC Comment hidden (obsolete)
Comment 5 Marc Véron 2017-04-25 16:45:25 UTC
Created attachment 62692 [details] [review]
Bug 18472: Some architectural changes...
Comment 6 Marc Véron 2017-04-25 17:14:48 UTC
Created attachment 62693 [details] [review]
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
Comment 7 Marc Véron 2017-04-26 11:47:41 UTC Comment hidden (obsolete)
Comment 8 Marc Véron 2017-04-28 19:45:41 UTC Comment hidden (obsolete)
Comment 9 Marc Véron 2017-04-28 19:52:00 UTC
Created attachment 62866 [details] [review]
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
Comment 10 Mark Tompsett 2017-04-29 01:55:06 UTC
Comment on attachment 62866 [details] [review]
Bug 18472: Add system preferences to manage online help system

Review of attachment 62866 [details] [review]:
-----------------------------------------------------------------

::: installer/data/mysql/sysprefs.sql
@@ +115,5 @@
>  ('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')" ),

This line is wrong. Looks like a cut and paste which didn't get tweaked properly. A fresh install will fail.

::: koha-tmpl/intranet-tmpl/prog/en/includes/help-top.inc
@@ +1,1 @@
> +[% USE Koha %]

doc-head-open.inc has a [% USE Koha %] -- Is this necessary or preferred?

::: koha-tmpl/intranet-tmpl/prog/en/modules/help/mainpage.tt
@@ +1,1 @@
> +[% USE Koha %]

help-top.inc includes doc-head-open.inc which has a [% USE Koha %] -- Is this necessary or preferred?
Comment 11 Mark Tompsett 2017-04-29 01:56:04 UTC
Setting to Failed QA due to "installer/data/mysql/sysprefs.sql" issue.
Comment 12 Marc Véron 2017-04-29 07:24:21 UTC
(In reply to M. Tompsett from comment #10)
> Comment on attachment 62866 [details] [review] [review]
> Bug 18472: Add system preferences to manage online help system
> 
> Review of attachment 62866 [details] [review] [review]:
> -----------------------------------------------------------------
(...)
> 
> ::: koha-tmpl/intranet-tmpl/prog/en/includes/help-top.inc
> @@ +1,1 @@
> > +[% USE Koha %]
> 
> doc-head-open.inc has a [% USE Koha %] -- Is this necessary or preferred?
> 
> ::: koha-tmpl/intranet-tmpl/prog/en/modules/help/mainpage.tt
> @@ +1,1 @@
> > +[% USE Koha %]
> 
> help-top.inc includes doc-head-open.inc which has a [% USE Koha %] -- Is
> this necessary or preferred?

Yes, see comment #2
If I do not include them, Koha.Preference('HelpSystem') does not trigger.
Comment 13 Marc Véron 2017-04-29 08:26:34 UTC
Created attachment 62896 [details] [review]
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

(Amended to correct wrong line in sysprefs.sql 201-04-29 mv)
Comment 14 Marc Véron 2017-04-29 08:31:52 UTC
Created attachment 62897 [details] [review]
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

(Amended to correct wrong line in sysprefs.sql 201-04-29 mv)
Comment 15 Marc Véron 2017-04-29 09:50:14 UTC
(In reply to M. Tompsett from comment #10)
> Comment on attachment 62866 [details] [review] [review]
> Bug 18472: Add system preferences to manage online help system
> 
> Review of attachment 62866 [details] [review] [review]:
> -----------------------------------------------------------------
> 
> ::: installer/data/mysql/sysprefs.sql
> @@ +115,5 @@
> >  ('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')" ),
> 
> This line is wrong. Looks like a cut and paste which didn't get tweaked
> properly. A fresh install will fail.

Fixed edit error with latest patch

Went through install
- without patch 583 rows in systempreferences
- with patch: 585 rows in system preferences (2 more, as expected).
Comment 16 Josef Moravec 2017-05-02 10:53:20 UTC
Created attachment 62950 [details] [review]
[SIGNED-OFF] 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

(Amended to correct wrong line in sysprefs.sql 201-04-29 mv)

Signed-off-by: Josef Moravec <josef.moravec@gmail.com>
Comment 17 Jonathan Druart 2017-05-03 19:22:43 UTC
Could you explain why did you reuse the news system instead of creating a new fresh module?
Comment 18 Marc Véron 2017-05-03 20:22:59 UTC
(In reply to Jonathan Druart from comment #17)
> Could you explain why did you reuse the news system instead of creating a
> new fresh module?

Because the news module contains all the functionality needed, and users are used to it. I did not want to reinvent the wheel.
Comment 19 Jonathan Druart 2017-05-03 20:39:03 UTC
I personally do not think it is a good idea, I'd like to get other QAers point of view.
Comment 20 Marcel de Rooy 2017-05-04 06:55:21 UTC
(In reply to Jonathan Druart from comment #19)
> I personally do not think it is a good idea, I'd like to get other QAers
> point of view.

At first glance, I would think so too. But I did not study all code changes.

Marc: Could you convince the QA team why this is a good idea? What is the impact on the news module itself?
Comment 21 Marc Véron 2017-05-04 08:02:21 UTC
(In reply to Marcel de Rooy from comment #20)
> (In reply to Jonathan Druart from comment #19)
> > I personally do not think it is a good idea, I'd like to get other QAers
> > point of view.
> 
> At first glance, I would think so too. But I did not study all code changes.
> 
> Marc: Could you convince the QA team why this is a good idea? What is the
> impact on the news module itself?


Need:
- Having a user editable, page aware help system is a long outstanding need. First time I was asked for goes back to 2012.
- We have libraries interested in Koha who ask for in their requirements.
- Writing a brand new help module would take a lot of time. And who would fund it?

User:
- The news system works very well and libraries are used to use it. The help additons introduced in Bug 18483 enhances the news system to host custom help as well.
- From a user standpoint it is easy to use, you can add whatever you want / need as help. All the benefits of the news system can be used. Custom help items can easyly be added / edited. 
- It can turned on and off (combined with the existing file based help system or 'standalone'). This Bug 18472 is the basis for turning on and off and/or add additional help systems. 
- There is no change in behavior of news and file based help system if turned off (however this patch allows to turn off the edit function of the existing file based help system).

Impact:
- In Bug 18483, I paid great attention to have a minimal impact on existing code. No changes in .pm files were needed. 
- There is a small database change to have a field to host the page key if a news item is used as help item.

Things to come:
- Since the news system works for both staff client and OPAC it will be easy to implement the editable help for OPAC as well (Bug 18515)

So I kindly ask for Bug 18472 and Bug 18483 to make part of Koha.

Marc
Comment 22 Marc Véron 2017-05-18 07:18:44 UTC Comment hidden (obsolete)
Comment 23 Marc Véron 2017-06-20 15:20:07 UTC Comment hidden (obsolete)
Comment 24 Marc Véron 2017-08-04 09:25:58 UTC
Still applies on current master.

BTW: This bug is only about enabling / disabling the current help system and, if enabled, allow or disallow editing. Disabling the edit functionality is a long outstanding issue, because it does not work out of the box.

Additionaly it prepares the possibility to implement an alternative help system. That's why I will copy parts of the comments to Bug 18483 - Customised help: Enhance staff client with news based, easily editable help system
Comment 25 Marc Véron 2017-09-05 13:33:00 UTC
Created attachment 66851 [details] [review]
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

(Amended to correct wrong line in sysprefs.sql 201-04-29 mv)

Signed-off-by: Josef Moravec <josef.moravec@gmail.com>

(Minor change to make it apply on current master 2017-09-05 mv)
Comment 26 Kyle M Hall 2017-10-27 15:03:29 UTC
Created attachment 68744 [details] [review]
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

(Amended to correct wrong line in sysprefs.sql 201-04-29 mv)

Signed-off-by: Josef Moravec <josef.moravec@gmail.com>

(Minor change to make it apply on current master 2017-09-05 mv)

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Comment 27 Jonathan Druart 2018-01-09 19:05:07 UTC
I am waiting for answers, feedbacks and suggestions on bug 19817.