Bugzilla – Attachment 62576 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), 11.62 KB, created by
Marc Véron
on 2017-04-22 22:27:42 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-04-22 22:27:42 UTC
Size:
11.62 KB
patch
obsolete
>From 93a68b3f7953651ffa39de23aa35c5426dd98c14 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 can be 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). > >The display can be managed with a system preference (Bug 18472: Add system preference >CustomOnlineHelpStaff to hide / select custom online help system). > >This patch is a first draft. It is not yet ready for testing or sign-off. >--- > help.pl | 15 +++++++ > .../intranet-tmpl/prog/en/includes/help-bottom.inc | 1 + > .../intranet-tmpl/prog/en/includes/help-top.inc | 51 +++++++++++++++------- > .../prog/en/modules/tools/koha-news.tt | 23 ++++++++++ > tools/koha-news.pl | 14 +++++- > 5 files changed, 86 insertions(+), 18 deletions(-) > >diff --git a/help.pl b/help.pl >index ad86a2d..f563bb3 100755 >--- a/help.pl >+++ b/help.pl >@@ -21,6 +21,7 @@ use strict; > use warnings; > use C4::Templates; > use C4::Output; >+use C4::NewsChannels; # GetNewsToDisplay > # use C4::Auth; > use C4::Context; > use CGI qw ( -utf8 ); >@@ -61,10 +62,24 @@ unless ( -e "$htdocs/$theme/$lang/modules/$from" ) { > my $template = C4::Templates::gettemplate($from, 'intranet', $query); > $template->param( > referer => $refer, >+ helpkey => substr( $from, 0, rindex( $from, q{.} ) ), > intranetstylesheet => C4::Context->preference("intranetstylesheet"), > intranetcolorstylesheet => C4::Context->preference("intranetcolorstylesheet"), > ); > >+# Prepare help from news... >+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/koha-tmpl/intranet-tmpl/prog/en/includes/help-bottom.inc b/koha-tmpl/intranet-tmpl/prog/en/includes/help-bottom.inc >index 9a2fb5a..b0b90a9 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/includes/help-bottom.inc >+++ b/koha-tmpl/intranet-tmpl/prog/en/includes/help-bottom.inc >@@ -4,5 +4,6 @@ > <input type="hidden" name="referer" value="[% referer %]" /> > <input type="submit" class="submit" value="Edit help" /></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 7d85d95..2d6326f 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/includes/help-top.inc >+++ b/koha-tmpl/intranet-tmpl/prog/en/includes/help-top.inc >@@ -1,20 +1,39 @@ >+[% 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> >+[% INCLUDE 'doc-head-close.inc' %] >+ > <body id="help" class="help"> >+ >+<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 %] [% helpitem.helpkey %]</h4> >+ <div class="help-item-body">[% helpitem.content %]</div> >+ <div class="help-item-date">[% helpitem.newdate %]</div> >+ <div class="help-item-footer"> >+ [% IF ( 1 || CAN_edit_help ) %] >+ <a class="btn btn-default btn-xs" href="/cgi-bin/koha/tools/koha-news.pl?op=add_form&id=[% helpitem.idnew %]"> >+ <i class="fa fa-pencil"></i>Edit</a> >+ <a class="btn btn-default btn-xs" href="/cgi-bin/koha/tools/koha-news.pl?op=del&ids=[% helpitem.idnew %]"> >+ <i class="fa fa-trash"></i>Delete</a> >+ [% END %] >+ </div> >+ </div> >+ [% END %] >+ [% END %] >+ <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"> >+ <i class="fa fa-pencil"></i>New custom 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"> >+ <i class="fa fa-plus"></i>New custom help for all pages</a> >+ <span class="hint">Key is: all</span></p> >+ </div> >+</div><!-- /help-from-news --> >+ >+<div id="koha-help"> >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..393e857 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 >@@ -119,6 +119,11 @@ Edit news item[% ELSE %]Add news item[% END %][% ELSE %]News[% END %]</div> > [% ELSE %] > <option value="slip" >Slip</option> > [% END %] >+ [% IF ( default_lang == "staffhelp" ) %] >+ <option value="staffhelp" selected="selected">Staff help</option> >+ [% ELSE %] >+ <option value="staffhelp">Staffhelp</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> >@@ -161,6 +166,17 @@ Edit news item[% ELSE %]Add news item[% END %][% ELSE %]News[% END %]</div> > <input id="number" size="3" name="number" type="text" /> > [% END %] > </li> >+ <li> >+ <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 news driven custom help system</span> >+ </li> > <li><label for="content">News: </label> > <textarea name="content" id="content" cols="75" rows="10">[% new_detail.content %]</textarea> > </li> >@@ -189,6 +205,11 @@ Edit news item[% ELSE %]Add news item[% END %][% ELSE %]News[% END %]</div> > [% ELSE %] > <option value="slip" >Slip</option> > [% END %] >+ [% IF ( lang == "staffhelp" ) %] >+ <option value="staffhelp" selected="selected">Staff help</option> >+ [% ELSE %] >+ <option value="staffhelp" >Staff help</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> >@@ -240,6 +261,8 @@ Edit news item[% ELSE %]Add news item[% END %][% ELSE %]News[% END %]</div> > Slip > [% CASE "" %] > All >+ [% CASE "staffhelp" %] >+ Staff help <span class="hint">[% opac_new.helpkey %]</span> > [% CASE %] > OPAC ([% opac_new.lang %]) > [% END %] >diff --git a/tools/koha-news.pl b/tools/koha-news.pl >index 61c3ec6..9cd2adc 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'); >@@ -99,11 +100,18 @@ 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' ) { >+warn "OPACADD"; > if ($title) { >+warn "IN TITLE"; >+warn $helpkey; > add_opac_new( > { > title => $title, >@@ -112,6 +120,7 @@ elsif ( $op eq 'add' ) { > expirationdate => $expirationdate, > timestamp => $timestamp, > number => $number, >+ helpkey => $helpkey, > branchcode => $branchcode, > borrowernumber => $borrowernumber, > } >@@ -131,6 +140,7 @@ elsif ( $op eq 'edit' ) { > lang => $lang, > expirationdate => $expirationdate, > timestamp => $timestamp, >+ helpkey => $helpkey, > number => $number, > branchcode => $branchcode, > } >@@ -145,7 +155,7 @@ elsif ( $op eq 'del' ) { > > else { > >- my ( $opac_news_count, $opac_news ) = &get_opac_news( undef, $lang, $branchcode ); >+ my ( $opac_news_count, $opac_news ) = &get_opac_news( undef, 'staffhelp', $branchcode ); > > foreach my $new ( @$opac_news ) { > next unless $new->{'expirationdate'}; >-- >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