Bugzilla – Attachment 66852 Details for
Bug 18483
Customised help: Enhance staff client with news based, easily editable help system
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 18483 - Customised help: Enhance staff client with news based, easily editable help system
Bug-18483---Customised-help-Enhance-staff-client-w.patch (text/plain), 38.36 KB, created by
Marc Véron
on 2017-09-05 13:47:10 UTC
(
hide
)
Description:
Bug 18483 - Customised help: Enhance staff client with news based, easily editable help system
Filename:
MIME Type:
Creator:
Marc Véron
Created:
2017-09-05 13:47:10 UTC
Size:
38.36 KB
patch
obsolete
>From 2b3c576b27917eb475bbd7ecd36465fe02185dd5 Mon Sep 17 00:00:00 2001 >From: =?UTF-8?q?Marc=20V=C3=A9ron?= <veron@veron.ch> >Date: Sun, 23 Apr 2017 00:22:51 +0200 >Subject: [PATCH] Bug 18483 - Customised help: Enhance staff client with news > based, easily editable help system > >Koha's staff client has a file based help system with an edit function for >customising. However, the edited files have to be saved and restored with each >release. Otherwise they are overwritten. > >As an enhancement or alternative, the existing news system is used to implement a >complementing help system. Similar to the news, the text can be created for all >branches or for individual branches. Help is context sensitive (based on the >existing help system), and it can be created / edited directly from the help page >(based on a user permission). Du to the need of this user permissen, a user >permission for editing news is implemented as well. > >Display can be managed with a system preference (Bug 18472: Add system preference >to manage online help system). Preferences default to legacy (fiele based) help. > >To test: >- Apply patch on top of Bug 18472, restart memcached and plack >- Update database (Alternative: fresh install) >- Log in as superlibrarian (later we test the permisisons) >- Verify that news behave as before >- Verify that legacy help works as before >- Locate system preferences 'EnableEditingFilebasedHelp' and 'Help system' >- For our tests, set 'EnableEditingFilebasedHelp' to 'No' >- In 'HelpSystem', uncheck 'File based' (none selected) >- Refresh any page and verify that 'Help' Link in the main menu has vanished >- Check both 'File based' and 'News based' >- Verify that 'Help appears again in top menu >- Click 'Help' for any page, verify that, above the 'classic' filebased help, you > see a title 'Help for (library name) and two buttons 'Add help for this page' > and 'Add help for all pages' >- Close the help page >- Go back to system preferences, select 'News based' only for 'HelpSystem' >- Open Help again for any page >- Verify that the text from file based help no longer displays, you should have > a title and buttons only at the moment. >- Click 'Add help for this page'. You are taken to the form you already know from > editing 'News' >- Click 'Cancel'. You should be taken back to the help page as before >- Again click 'Add help for this page' and add an easyly identifiable title and > some text, like you would do with news. >- Leave the new field 'Help key' unchanged. >- Submit. You should be taken back to the help you just created should appear >- Close help page and open it again to verify that the text persists (for this > page) >- Go to an other page and verify that the help you added for the first page does > not appear. >- Add a help entry using the button 'Add help for all pages' >- Go back to the first page you entered help for and verify, that it displays it's > own help text and the text for all pages >- Edit one of the texts, verify that it saves correctly >- Add some more entries and verify that they appear as expected >- Go to More > Tools (in an other tab) >- Verify that the menu entry for News appears/disappears and changes text > depending on the settings of system preference 'HelpSystem' >- Open 'News' rsp. 'Help', verify that entries appear depending on the settings > of syspref 'HelpSystem' >- Verify that the filter for 'Display location' works >- Verify that in the 'Location' column a hint about the page appears the entry > was created for >- Edit a staff help entry, verify that submit or close takes you back to the list >- Bonus test: Edit a staff help entry, change the key to 'all', verify that the > entry now appears for all pages. Change the key to 'help/admin/preferences' and > verify that it appears now for the preferences page >- Create a staff user with following permisisons only: catalogue (for login), > edit_help and edit_news >- Test visibility of news / help editing functionality depending on the > edit_ permissions >- Run QA tools > >Signed-off-by: Josef Moravec <josef.moravec@gmail.com> > >(Amended to resolve minor merge conflict. 2017-09-05 mv) >--- > edithelp.pl | 13 +- > help.pl | 53 +++++++- > ...dd_system_preference_CustomOnlineHelpStaff.perl | 2 +- > .../bug_18483_news-driven-help-system.perl | 17 +++ > installer/data/mysql/sysprefs.sql | 2 +- > installer/data/mysql/userpermissions.sql | 1 + > .../intranet-tmpl/prog/en/includes/header.inc | 2 +- > .../intranet-tmpl/prog/en/includes/help-bottom.inc | 15 ++- > .../intranet-tmpl/prog/en/includes/help-top.inc | 54 +++++--- > .../intranet-tmpl/prog/en/includes/permissions.inc | 1 + > .../prog/en/modules/admin/preferences/admin.pref | 1 + > .../intranet-tmpl/prog/en/modules/help/mainpage.tt | 5 +- > .../prog/en/modules/help/nohelptext.tt | 2 + > .../prog/en/modules/tools/koha-news.tt | 144 +++++++++++++-------- > .../prog/en/modules/tools/tools-home.tt | 14 +- > tools/koha-news.pl | 48 ++++++- > 16 files changed, 267 insertions(+), 107 deletions(-) > create mode 100644 installer/data/mysql/atomicupdate/bug_18483_news-driven-help-system.perl > create mode 100644 koha-tmpl/intranet-tmpl/prog/en/modules/help/nohelptext.tt > >diff --git a/edithelp.pl b/edithelp.pl >index dca61b1..e2ec5f4 100755 >--- a/edithelp.pl >+++ b/edithelp.pl >@@ -18,6 +18,7 @@ > # along with Koha; if not, see <http://www.gnu.org/licenses>. > > use Modern::Perl; >+use C4::Koha; > use C4::Output; > use C4::Templates; > use C4::Auth; >@@ -45,17 +46,7 @@ my ( $template, $loggedinuser, $cookie ) = get_template_and_user( > query => $input, > type => "intranet", > authnotrequired => 0, >- flagsrequired => { >- catalogue => 1, >- circulate => 1, >- parameters => 1, >- borrowers => 1, >- permissions => 1, >- reserveforothers => 1, >- reserveforself => 1, >- editcatalogue => 1, >- updatecharges => 1, >- }, >+ flagsrequired => { tools => 'edit_help' }, > debug => 1, > } > ); >diff --git a/help.pl b/help.pl >index ad86a2d..4d13684 100755 >--- a/help.pl >+++ b/help.pl >@@ -21,7 +21,8 @@ use strict; > use warnings; > use C4::Templates; > use C4::Output; >-# use C4::Auth; >+use C4::NewsChannels; # GetNewsToDisplay >+use C4::Auth; > use C4::Context; > use CGI qw ( -utf8 ); > >@@ -43,28 +44,72 @@ my $query = new CGI; > # This is usually set by get_template_and_user > C4::Context->interface('intranet'); > >+my $helpsys = C4::Context->preference('HelpSystem'); >+ > # find the script that called the online help using the CGI referer() > our $refer = $query->param('url'); > $refer = $query->referer() if !$refer || $refer eq 'undefined'; >+# replace referer if we come back from news edit popup >+$refer = $query->param('popupreferer') if defined $query->param('popupreferer') ; >+ > my $from = _help_template_file_of_url($refer); >+my $helpkey = substr( $from, 0, rindex( $from, q{.} ) ); > my $htdocs = C4::Context->config('intrahtdocs'); > >-# >+#Template for 'classic' Koha help text (filebased) if needed, otherwise no text >+ > # checking that the help file exist, otherwise, display nohelp.tt page >-# > my ( $theme, $lang ) = C4::Templates::themelanguage( $htdocs, $from, "intranet", $query ); >+ > unless ( -e "$htdocs/$theme/$lang/modules/$from" ) { > $from = "help/nohelp.tt"; > ( $theme, $lang ) = C4::Templates::themelanguage( $htdocs, $from, "intranet", $query ); > } > >-my $template = C4::Templates::gettemplate($from, 'intranet', $query); >+# Classic Koha help text not used >+if ( $helpsys eq 'newsbased' ) { >+ #Template without classic Koha help text >+ $from = "help/nohelptext.tt"; >+ ( $theme, $lang ) = C4::Templates::themelanguage( $htdocs, $from, "intranet", $query ); >+} >+ >+#my $template = C4::Templates::gettemplate($from, 'intranet', $query); >+ >+my ( $template, $borrowernumber, $cookie ) = get_template_and_user( >+ { >+ template_name => $from, >+ query => $query, >+ type => "intranet", >+ authnotrequired => 0, >+ } >+); >+ >+ >+ >+ > $template->param( > referer => $refer, >+ helpkey => $helpkey, > intranetstylesheet => C4::Context->preference("intranetstylesheet"), > intranetcolorstylesheet => C4::Context->preference("intranetcolorstylesheet"), >+ helpsystem => $helpsys, > ); > >+if ( index($helpsys,'newsbased') != -1 || index ($helpsys,'filebased') != -1 ) { >+ >+ my $homebranch; >+ if (C4::Context->userenv) { >+ $homebranch = C4::Context->userenv->{'branch'}; >+ } >+ my $help_from_news = &GetNewsToDisplay('staffhelp', $homebranch); >+ my $help_from_news_count = scalar @$help_from_news; >+ $template->param( >+ help_from_news => $help_from_news, >+ help_from_news_count => $help_from_news_count, >+ homebranch => $homebranch >+ ); >+} >+ > my $help_version = C4::Context->preference("Version"); > if ( $help_version =~ m|^(\d+)\.(\d{2}).*$| ) { > my $version = $1; >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 >index ce31d2d..a523c76 100644 >--- a/installer/data/mysql/atomicupdate/bug_18472-Add_system_preference_CustomOnlineHelpStaff.perl >+++ b/installer/data/mysql/atomicupdate/bug_18472-Add_system_preference_CustomOnlineHelpStaff.perl >@@ -1,7 +1,7 @@ > $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 ('HelpSystem', 'filebased', 'filebased|newsbased', '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 >diff --git a/installer/data/mysql/atomicupdate/bug_18483_news-driven-help-system.perl b/installer/data/mysql/atomicupdate/bug_18483_news-driven-help-system.perl >new file mode 100644 >index 0000000..c00c8dc >--- /dev/null >+++ b/installer/data/mysql/atomicupdate/bug_18483_news-driven-help-system.perl >@@ -0,0 +1,17 @@ >+$DBversion = 'XXXX'; # will be replaced by the RM >+if( CheckVersion( $DBversion ) ) { >+ # you can use $dbh here like: >+ $dbh->do( "UPDATE systempreferences SET VALUE = 'filebased', OPTIONS = 'filebased|newsbased' where variable = 'HelpSystem'" ); >+ >+ $dbh->do( "ALTER TABLE opac_news ADD COLUMN helpkey varchar(250) AFTER lang "); >+ $dbh->do( "INSERT IGNORE INTO permissions (module_bit, code, description) VALUES (13, 'edit_help', 'Edit custom help');" ); >+ >+ # 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 18483 - Customised help: Enhance staff client with news based, easily editable help system)\n"; >+} >diff --git a/installer/data/mysql/sysprefs.sql b/installer/data/mysql/sysprefs.sql >index f9cbc16..cd25f6f 100644 >--- a/installer/data/mysql/sysprefs.sql >+++ b/installer/data/mysql/sysprefs.sql >@@ -115,7 +115,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'), >-('HelpSystem', 'filebased', 'filebased', 'Select online help system.', 'multiple'), >+('HelpSystem', 'filebased', 'filebased|newsbased', 'Select online help system.', 'multiple'), > ('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'), >diff --git a/installer/data/mysql/userpermissions.sql b/installer/data/mysql/userpermissions.sql >index 172f4c6..ce41cc8 100644 >--- a/installer/data/mysql/userpermissions.sql >+++ b/installer/data/mysql/userpermissions.sql >@@ -30,6 +30,7 @@ INSERT INTO permissions (module_bit, code, description) VALUES > (11, 'budget_manage_all', 'Manage all budgets'), > (11, 'edi_manage', 'Manage EDIFACT transmissions'), > (13, 'edit_news', 'Write news for the OPAC and staff interfaces'), >+ (13, 'edit_help', 'Edit custom help'), > (13, 'label_creator', 'Create printable labels and barcodes from catalog and patron data'), > (13, 'edit_calendar', 'Define days when the library is closed'), > (13, 'moderate_comments', 'Moderate patron comments'), >diff --git a/koha-tmpl/intranet-tmpl/prog/en/includes/header.inc b/koha-tmpl/intranet-tmpl/prog/en/includes/header.inc >index 1bce93f..6a80b57 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/includes/header.inc >+++ b/koha-tmpl/intranet-tmpl/prog/en/includes/header.inc >@@ -99,7 +99,7 @@ > </ul> > </li> > [% INCLUDE 'langmenu-staff-top.inc' %] >- [% IF Koha.Preference('HelpSystem') == 'filebased' %] >+ [% IF Koha.Preference('HelpSystem').match('filebased|newsbased') %] > <li> > <a class="toplinks" href="/cgi-bin/koha/help.pl" id="helper">Help</a> > </li> >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 0ed2086..8d8f706 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/includes/help-bottom.inc >+++ b/koha-tmpl/intranet-tmpl/prog/en/includes/help-bottom.inc >@@ -1,10 +1,15 @@ >+[% USE Koha %] >+ > <form action="/cgi-bin/koha/edithelp.pl" method="post"> >- <fieldset class="action"><input type="button" class="close" value="Close help window" /> >- [% IF (Koha.Preference('HelpSystem') == 'filebased') && (Koha.Preference('EnableEditingFilebasedHelp') ) %] >- <input type="hidden" name="type" value="modify" /> >+ <fieldset class="action"> >+ <input type="button" class="close" value="Close help window" /> > <input type="hidden" name="referer" value="[% referer %]" /> >- <input type="submit" class="submit" value="Edit help" /></fieldset> >- [% END %] >+ [% IF ( Koha.Preference('HelpSystem').match('filebased') && Koha.Preference('EnableEditingFilebasedHelp') && CAN_user_tools_edit_help ) %] >+ <input type="hidden" name="type" value="modify" /> >+ <input type="submit" class="submit" value="Edit help" /> >+ [% END %] >+ </fieldset> > </form> >+</div> <!-- /koha-help --> > </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 ff6aeb8..b914d0e 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/includes/help-top.inc >+++ b/koha-tmpl/intranet-tmpl/prog/en/includes/help-top.inc >@@ -1,21 +1,43 @@ > [% USE Koha %] >+[% USE Branches %] > [% INCLUDE 'doc-head-open.inc' %] > <title>Online help</title> >-<meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> >-<link rel="shortcut icon" href="[% IF ( IntranetFavicon ) %][% IntranetFavicon %][% ELSE %][% interface %]/[% theme %]/img/favicon.ico[% END %]" type="image/x-icon" /> >-<link rel="stylesheet" type="text/css" href="[% interface %]/lib/jquery/jquery-ui-1.11.4.min.css" /> >-<link rel="stylesheet" type="text/css" media="print" href="[% interface %]/[% theme %]/css/print.css" /> >-[% INCLUDE intranetstylesheet.inc %] >-[% IF ( bidi ) %] >- <link rel="stylesheet" type="text/css" href="[% interface %]/[% theme %]/css/right-to-left.css" /> >-[% END %] >-<script type="text/javascript" src="[% interface %]/lib/jquery/jquery-2.2.3.min.js"></script> >-<script type="text/javascript" src="[% interface %]/lib/jquery/jquery-migrate-1.3.0.min.js"></script> >-<script type="text/javascript" src="[% interface %]/lib/jquery/jquery-ui-1.11.4.min.js"></script> >-<script type="text/javascript" src="[% interface %]/lib/shortcut/shortcut.js"></script> >-<!-- koha core js --> >-<script type="text/javascript" src="[% interface %]/[% theme %]/js/staff-global.js"></script> >- > <link rel="stylesheet" type="text/css" href="[% interface %]/[% theme %]/css/help.css" /> >-</head> >+[% USE Koha %] >+[% INCLUDE 'doc-head-close.inc' %] >+ > <body id="help" class="help"> >+ >+[% IF Koha.Preference('HelpSystem').match('newsbased') %] >+ <div id="help_from_news"> >+ <h1><span class="help_title">Help for [% Branches.GetName( homebranch ) %]</span></h1> >+ [% FOREACH helpitem IN help_from_news %] >+ [% IF (helpitem.helpkey == helpkey) || (helpitem.helpkey == 'all') %] >+ <div class="help-item-title" id="helpnews[% helpitem.idnew %]"> >+ <h4>[% helpitem.title %]</h4> >+ <div class="help-item-body">[% helpitem.content %]</div> >+ <div class="help-item-date">[% helpitem.newdate %]</div> >+ <div class="help-item-footer"> >+ [% IF CAN_user_tools_edit_help %] >+ <a class="btn btn-default btn-xs" href="/cgi-bin/koha/tools/koha-news.pl?op=add_form&id=[% helpitem.idnew %]&popup_window=1&popupreferer=[% referer %]"> >+ <i class="fa fa-pencil"></i> Edit</a> >+ [% END %] >+ </div> >+ </div> >+ [% END %] >+ [% END %] >+ [% IF CAN_user_tools_edit_help %] >+ <div class="help-item-buttons"> >+ <p><a class="btn btn-default btn-xs" href="/cgi-bin/koha/tools/koha-news.pl?op=add_form&helpkey=[% helpkey %]&lang=staffhelp&popup_window=1&popupreferer=[% referer %]"> >+ <i class="fa fa-plus"></i> Add help for this page</a> >+ <span class="hint">Key is: [% helpkey %]</span></p> >+ <p><a class="btn btn-default btn-xs" href="/cgi-bin/koha/tools/koha-news.pl?op=add_form&helpkey=all&lang=staffhelp&popup_window=1&popupreferer=[% referer %]"> >+ <i class="fa fa-plus"></i> Add help for all pages</a> >+ <span class="hint">Key is: all</span></p> >+ </div> >+ <p class="hint">Note: You can manage and / or delete help entries in More › Tools</p> >+ [% END %] >+ </div><!-- /help-from-news --> >+[% END %] >+ >+<div id="koha-help"> >diff --git a/koha-tmpl/intranet-tmpl/prog/en/includes/permissions.inc b/koha-tmpl/intranet-tmpl/prog/en/includes/permissions.inc >index 7c6275a..7d6beac 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/includes/permissions.inc >+++ b/koha-tmpl/intranet-tmpl/prog/en/includes/permissions.inc >@@ -57,6 +57,7 @@ > [%- CASE 'batch_upload_patron_images' -%]<span>Upload patron images in a batch or one at a time</span> > [%- CASE 'delete_anonymize_patrons' -%]<span>Delete old borrowers and anonymize circulation history (deletes borrower reading history)</span> > [%- CASE 'edit_calendar' -%]<span>Define days when the library is closed</span> >+ [%- CASE 'edit_help' -%]<span>Edit custom help</span> > [%- CASE 'edit_news' -%]<span>Write news for the OPAC and staff interfaces</span> > [%- CASE 'edit_notice_status_triggers' -%]<span>Set notice/status triggers for overdue items</span> > [%- CASE 'edit_notices' -%]<span>Define notices</span> >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 592994a..2401963 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 >@@ -432,6 +432,7 @@ Administration: > default: filebased > multiple: > filebased: "File based (staff client)" >+ newsbased: "News based" > - > - "Enable editing of file based Koha help: " > - pref: EnableEditingFilebasedHelp >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 ace8a28..a8354f9 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/help/mainpage.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/help/mainpage.tt >@@ -2,7 +2,6 @@ > [% INCLUDE 'help-top.inc' %] > > <h2>Welcome to Koha</h2> >- > <p>If this is your first time logging into Koha, you should now go to Koha Administration and set up all system preferences, patron categories, item types and libraries. You should also review the other settings found in Administration.</p> > > <p>Once you have set up patron categories, you should create a new user in the Patrons module with superlibrarian permissions. Once that user is created, you should log in as that user rather than the root user which is set up as part of installation.</p> >@@ -18,7 +17,8 @@ > <li><a href="http://koha-community.org/get-involved/irc/">Chat with Koha users and developers</a></li> > </ul> > >-[% IF ( Koha.Preference('HelpSystem') == 'filebased' ) %] >+ [% IF Koha.Preference('HelpSystem').match('filebased') && (Koha.Preference('EnableEditingFilebasedHelp') && CAN_user_tools_edit_help ) %] >+ > <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> >@@ -26,6 +26,7 @@ > <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><strong>Note:</strong> Files in help directory must be writeable to make this feature work. Additionally, system preference 'EnableEditingFilebasedHelp' must be set to 'Yes'.</p> > [% END %] > >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/help/nohelptext.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/help/nohelptext.tt >new file mode 100644 >index 0000000..ea6af02 >--- /dev/null >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/help/nohelptext.tt >@@ -0,0 +1,2 @@ >+[% INCLUDE 'help-top.inc' %] >+[% INCLUDE 'help-bottom.inc' %] >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/tools/koha-news.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/tools/koha-news.tt >index dd1ae84..9d73c22 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/tools/koha-news.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/tools/koha-news.tt >@@ -1,3 +1,4 @@ >+[% USE Koha %] > [% USE KohaDates %] > [% USE Branches %] > [% INCLUDE 'doc-head-open.inc' %] >@@ -72,11 +73,14 @@ tinyMCE.init({ > </script> > </head> > <body id="tools_koha-news" class="tools"> >-[% INCLUDE 'header.inc' %] >-[% INCLUDE 'cat-search.inc' %] > >-<div id="breadcrumbs"><a href="/cgi-bin/koha/mainpage.pl">Home</a> › <a href="/cgi-bin/koha/tools/tools-home.pl">Tools</a> › [% IF ( add_form ) %]<a href="/cgi-bin/koha/tools/koha-news.pl">News</a> › [% IF ( id ) %] >+[% IF not popup_window %] >+ [% INCLUDE 'header.inc' %] >+ [% INCLUDE 'cat-search.inc' %] >+ >+ <div id="breadcrumbs"><a href="/cgi-bin/koha/mainpage.pl">Home</a> › <a href="/cgi-bin/koha/tools/tools-home.pl">Tools</a> › [% IF ( add_form ) %]<a href="/cgi-bin/koha/tools/koha-news.pl">News</a> › [% IF ( id ) %] > Edit news item[% ELSE %]Add news item[% END %][% ELSE %]News[% END %]</div> >+[% END %] > > [% IF ( add_form ) %]<div id="doc" class="yui-t7">[% ELSE %]<div id="doc3" class="yui-t2">[% END %] > <div id="bd"> >@@ -92,6 +96,43 @@ Edit news item[% ELSE %]Add news item[% END %][% ELSE %]News[% END %]</div> > </div> > [% END %] > >+[% BLOCK langoptions %] >+ <label for="lang">Display location:</label> >+ <select id="lang" name="lang"> >+ [% IF CAN_user_tools_edit_news %] >+ [% IF ( default_lang == "" ) %] >+ <option value="" selected="selected">All</option> >+ [% ELSE %] >+ <option value="">All</option> >+ [% END %] >+ [% IF ( default_lang == "koha" ) %] >+ <option value="koha" selected="selected">Librarian interface</option> >+ [% ELSE %] >+ <option value="koha">Librarian interface</option> >+ [% END %] >+ [% IF ( default_lang == "slip" ) %] >+ <option value="slip" selected="selected">Slip</option> >+ [% ELSE %] >+ <option value="slip">Slip</option> >+ [% END %] >+ [% FOREACH lang_lis IN lang_list %] >+ [% IF ( lang_lis.language == default_lang ) %] >+ <option value="[% lang_lis.language %]" selected="selected">OPAC ([% lang_lis.language %])</option> >+ [% ELSE %] >+ <option value="[% lang_lis.language %]">OPAC ([% lang_lis.language %])</option> >+ [% END %] >+ [% END %] >+ [% END %] >+ [% IF ( Koha.Preference('HelpSystem').match('newsbased') && CAN_user_tools_edit_help ) %] >+ [% IF ( default_lang == "staffhelp" ) %] >+ <option value="staffhelp" selected="selected">Staff help</option> >+ [% ELSE %] >+ <option value="staffhelp">Help for staff client</option> >+ [% END %] >+ [% END %] >+ </select> >+[% END %] >+ > [% IF ( add_form ) %] > [% IF ( op == 'add' ) %][% default_lang = lang %] > [% ELSE %][% default_lang = new_detail.lang %] >@@ -99,34 +140,11 @@ Edit news item[% ELSE %]Add news item[% END %][% ELSE %]News[% END %]</div> > <form name="add_form" method="post" action="/cgi-bin/koha/tools/koha-news.pl" > > <input type="hidden" name="op" value="[% op %]" /> > <input type="hidden" name="id" value="[% id %]" /> >+ <input type="hidden" name="popupreferer" value="[% popupreferer %]" > > <fieldset class="rows"> > <legend>OPAC and Koha news</legend> >- <ol> <li> >- <label for="lang">Display location:</label> >- <select id="lang" name="lang"> >- [% IF ( default_lang == "" ) %] >- <option value="" selected="selected">All</option> >- [% ELSE %] >- <option value="" >All</option> >- [% END %] >- [% IF ( default_lang == "koha" ) %] >- <option value="koha" selected="selected">Librarian interface</option> >- [% ELSE %] >- <option value="koha" >Librarian interface</option> >- [% END %] >- [% IF ( default_lang == "slip" ) %] >- <option value="slip" selected="selected">Slip</option> >- [% ELSE %] >- <option value="slip" >Slip</option> >- [% END %] >- [% FOREACH lang_lis IN lang_list %] >- [% IF ( lang_lis.language == default_lang ) %] >- <option value="[% lang_lis.language %]" selected="selected">OPAC ([% lang_lis.language %])</option> >- [% ELSE %] >- <option value="[% lang_lis.language %]" >OPAC ([% lang_lis.language %])</option> >- [% END %] >- [% END %] >- </select> >+ <ol> <li> >+ [% INCLUDE langoptions %] > </li> > <li> > <label for="branch">Library: </label> >@@ -161,42 +179,42 @@ Edit news item[% ELSE %]Add news item[% END %][% ELSE %]News[% END %]</div> > <input id="number" size="3" name="number" type="text" /> > [% END %] > </li> >+ <li> >+ [% IF ( Koha.Preference('HelpSystem').match('newsbased') && CAN_user_tools_edit_help ) %] >+ <label for="helpkey">Help key: </label> >+ [% IF ( new_detail.helpkey ) %] >+ <input id="number" size="60" name="helpkey" type="text" value="[% new_detail.helpkey %]" /> >+ [% ELSIF ( helpkey ) %] >+ <input id="number" size="60" name="helpkey" type="text" value="[% helpkey %]" /> >+ [% ELSE %] >+ <input id="helpkey" size="60" name="helpkey" type="text" /> >+ [% END %] >+ <span class="hint">Used for staff help. Will be populated for individual page when creating a new entry from 'Help'. Example: 'help/circ/circulation'. Use 'all' for all pages.</span> >+ [% END %] >+ >+ </li> > <li><label for="content">News: </label> > <textarea name="content" id="content" cols="75" rows="10">[% new_detail.content %]</textarea> > </li> > </ol> > </fieldset> >- >- <fieldset class="action"><input class="button" type="submit" value="Submit" /> <a class="cancel" href="/cgi-bin/koha/tools/koha-news.pl">Cancel</a></fieldset> >+ >+ <fieldset class="action"> >+ [% IF popup_window %] >+ <input class="button" type="submit" value="Submit" /> >+ <a class="cancel" href="#" onclick="history.back(); return false;">Cancel</a> >+ [% ELSE %] >+ <input class="button" type="submit" value="Submit" /> >+ <a class="cancel" href="/cgi-bin/koha/tools/koha-news.pl">Cancel</a> >+ [% END %] >+ </fieldset> > </form> > [% ELSE %] > <div style="margin-bottom:5px;"> > <form name="add_form" method="post" action="/cgi-bin/koha/tools/koha-news.pl" > >- <label for="lang">Display location:</label> >- <select name="lang" id="lang"> >- [% IF ( lang == "" ) %] >- <option value="" selected="selected">All</option> >- [% ELSE %] >- <option value="" >All</option> >- [% END %] >- [% IF ( lang == "koha" ) %] >- <option value="koha" selected="selected">Librarian interface</option> >- [% ELSE %] >- <option value="koha" >Librarian interface</option> >- [% END %] >- [% IF ( lang == "slip" ) %] >- <option value="slip" selected="selected">Slip</option> >- [% ELSE %] >- <option value="slip" >Slip</option> >- [% END %] >- [% FOREACH lang_lis IN lang_list %] >- [% IF ( lang_lis.language == lang ) %] >- <option value="[% lang_lis.language %]" selected="selected">OPAC ([% lang_lis.language %])</option> >- [% ELSE %] >- <option value="[% lang_lis.language %]" >OPAC ([% lang_lis.language %])</option> >- [% END %] >- [% END %] >- </select> >+ >+ [% INCLUDE langoptions %] >+ > <label for="branch">Library: </label> > <select id="branch" name="branch"> > [% IF ( branchcode == "" ) %] >@@ -225,6 +243,12 @@ Edit news item[% ELSE %]Add news item[% END %][% ELSE %]News[% END %]</div> > <th>Actions</th> > </tr></thead> > <tbody>[% FOREACH opac_new IN opac_news %] >+ [% IF opac_new.lang == 'staffhelp' %] >+ [% NEXT IF not ( CAN_user_tools_edit_help && Koha.Preference('HelpSystem').match('newsbased') ) %] >+ [% ELSE %] >+ [% NEXT IF not CAN_user_tools_edit_news %] >+ [% END %] >+ > [% IF ( opac_new.expired ) %] > <tr class="expired"> > [% ELSE %] >@@ -240,6 +264,14 @@ Edit news item[% ELSE %]Add news item[% END %][% ELSE %]News[% END %]</div> > Slip > [% CASE "" %] > All >+ [% CASE "staffhelp" %] >+ Staff help >+ [% IF opac_new.helpkey %] >+ <span class="hint">[% opac_new.helpkey %]</span> >+ [% ELSE %] >+ <span class="hint">No page key!</span> >+ [% END %] >+ > [% CASE %] > OPAC ([% opac_new.lang %]) > [% END %] >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/tools/tools-home.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/tools/tools-home.tt >index 4c8cca9..32c070a 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/tools/tools-home.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/tools/tools-home.tt >@@ -1,3 +1,4 @@ >+[% USE Koha %] > [% INCLUDE 'doc-head-open.inc' %] > <title>Koha › Tools</title> > [% INCLUDE 'doc-head-close.inc' %] >@@ -89,9 +90,16 @@ > <dd>Browse the system logs</dd> > [% END %] > >- [% IF ( CAN_user_tools_edit_news ) %] >- <dt><a href="/cgi-bin/koha/tools/koha-news.pl">News</a></dt> >- <dd>Write news for the OPAC and staff interfaces</dd> >+ [% IF CAN_user_tools_edit_news && CAN_user_tools_edit_help && Koha.Preference('HelpSystem').match('newsbased') %] >+ <dt><a href="/cgi-bin/koha/tools/koha-news.pl">Manage news and news based help</a></dt> >+ <dd>Write news for the OPAC and staff interfaces and manage news based online help for staff interface</dd> >+ [% ELSIF CAN_user_tools_edit_help && Koha.Preference('HelpSystem').match('newsbased') %] >+ <dt><a href="/cgi-bin/koha/tools/koha-news.pl">Manage news based help</a></dt> >+ <dd>Manage news based online help for staff interface</dd> >+ [% ELSE %] >+ <dt><a href="/cgi-bin/koha/tools/koha-news.pl">Manage news</a></dt> >+ <dd>Write news for the OPAC and staff interfaces</dd> >+ > [% END %] > > [% IF ( CAN_user_tools_schedule_tasks ) %] >diff --git a/tools/koha-news.pl b/tools/koha-news.pl >index 61c3ec6..5bf0859 100755 >--- a/tools/koha-news.pl >+++ b/tools/koha-news.pl >@@ -45,6 +45,7 @@ if ( $cgi->param('expirationdate') ) { > } > my $timestamp = output_pref({ dt => dt_from_string( scalar $cgi->param('timestamp') ), dateformat => 'iso', dateonly => 1 }); > my $number = $cgi->param('number'); >+my $helpkey = $cgi->param('helpkey'); > my $lang = $cgi->param('lang'); > my $branchcode = $cgi->param('branch'); > my $error_message = $cgi->param('error_message'); >@@ -55,17 +56,34 @@ $branchcode = undef if (defined($branchcode) && $branchcode eq ''); > > my $new_detail = get_opac_new($id); > >+# flagsrequired checks for all flags listed, we need an 'or' >+# to work with edit_news or edit_help. > my ( $template, $borrowernumber, $cookie ) = get_template_and_user( > { > template_name => "tools/koha-news.tt", > query => $cgi, > type => "intranet", >- authnotrequired => 0, >- flagsrequired => { tools => 'edit_news' }, >+ authnotrequired => 1, > debug => 1, > } > ); > >+#news based help system can call this script as a popup window >+$template->param( popup_window => 1 ) if( $cgi->param('popup_window')== 1 ); >+ >+my $popupreferer = $cgi->param('popupreferer') // ''; >+if ($ popupreferer ) { >+ $template->param( popupreferer => $popupreferer ); >+} >+ >+#Check now the flags, user must have news or help edit permission >+if ( not (defined $template->{VARS}->{'CAN_user_tools_edit_news'} || >+ defined $template->{VARS}->{'CAN_user_tools_edit_help'} ) ) { >+warn "EXIT FROM koha-news.pl "; >+ print $cgi->redirect("/cgi-bin/koha/errors/403.pl"); >+} else { >+#TODO: Indent as followup to bug 18483 >+ > # Pass error message if there is one. > $template->param( error_message => $error_message ) if $error_message; > >@@ -99,7 +117,11 @@ if ( $op eq 'add_form' ) { > $template->{VARS}->{'new_detail'} = $new_detail; > } > else { >- $template->param( op => 'add' ); >+ $template->param( >+ op => 'add', >+ helpkey => $helpkey >+ ); >+ > } > } > elsif ( $op eq 'add' ) { >@@ -112,14 +134,20 @@ elsif ( $op eq 'add' ) { > expirationdate => $expirationdate, > timestamp => $timestamp, > number => $number, >+ helpkey => $helpkey, > branchcode => $branchcode, > borrowernumber => $borrowernumber, > } > ); >- print $cgi->redirect("/cgi-bin/koha/tools/koha-news.pl"); >+ >+ if ( $popupreferer ) { >+ print $cgi->redirect( "/cgi-bin/koha/help.pl?popupreferer=$popupreferer"); >+ } else { >+ print $cgi->redirect("/cgi-bin/koha/tools/koha-news.pl"); >+ } > } > else { >- print $cgi->redirect("/cgi-bin/koha/tools/koha-news.pl?error_message=title_missing"); >+ print $cgi->redirect("/cgi-bin/koha/tools/koha-news.pl?error_message=title_missing&popupreferer=$popupreferer"); > } > } > elsif ( $op eq 'edit' ) { >@@ -131,11 +159,17 @@ elsif ( $op eq 'edit' ) { > lang => $lang, > expirationdate => $expirationdate, > timestamp => $timestamp, >+ helpkey => $helpkey, > number => $number, > branchcode => $branchcode, > } > ); >- print $cgi->redirect("/cgi-bin/koha/tools/koha-news.pl"); >+ >+ if ( $popupreferer ) { >+ print $cgi->redirect("/cgi-bin/koha/help.pl?popupreferer=$popupreferer"); >+ } else { >+ print $cgi->redirect("/cgi-bin/koha/tools/koha-news.pl"); >+ } > } > elsif ( $op eq 'del' ) { > my @ids = $cgi->multi_param('ids'); >@@ -144,7 +178,6 @@ elsif ( $op eq 'del' ) { > } > > else { >- > my ( $opac_news_count, $opac_news ) = &get_opac_news( undef, $lang, $branchcode ); > > foreach my $new ( @$opac_news ) { >@@ -161,4 +194,5 @@ else { > ); > } > $template->param( lang => $lang ); >+} > output_html_with_http_headers $cgi, $cookie, $template->output; >-- >2.1.4
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 18483
:
62576
|
62577
|
62579
|
62648
|
62705
|
62718
|
62804
|
62812
|
62892
|
62898
|
62899
|
62900
|
62901
|
62952
|
66852
|
68749