@@ -, +, @@ based, easily editable help system and it can be created / edited directly from the help page (based on a user permission). --- help.pl | 15 +++++++ .../intranet-tmpl/prog/en/includes/help-bottom.inc | 1 + .../intranet-tmpl/prog/en/includes/help-top.inc | 50 +++++++++++++++------- .../prog/en/modules/tools/koha-news.tt | 23 ++++++++++ tools/koha-news.pl | 14 +++++- 5 files changed, 85 insertions(+), 18 deletions(-) --- a/help.pl +++ a/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; --- a/koha-tmpl/intranet-tmpl/prog/en/includes/help-bottom.inc +++ a/koha-tmpl/intranet-tmpl/prog/en/includes/help-bottom.inc @@ -6,5 +6,6 @@ [% END %] + --- a/koha-tmpl/intranet-tmpl/prog/en/includes/help-top.inc +++ a/koha-tmpl/intranet-tmpl/prog/en/includes/help-top.inc @@ -1,21 +1,39 @@ [% USE Koha %] +[% USE Branches %] [% INCLUDE 'doc-head-open.inc' %] Online help - - - - -[% INCLUDE intranetstylesheet.inc %] -[% IF ( bidi ) %] - -[% END %] - - - - - - - - +[% INCLUDE 'doc-head-close.inc' %] + + +
+

Help for [% Branches.GetName( homebranch ) %]

+ [% FOREACH helpitem IN help_from_news %] + [% IF (helpitem.helpkey == helpkey) || (helpitem.helpkey == 'all') %] +
+

[% helpitem.title %] [% helpitem.helpkey %]

+
[% helpitem.content %]
+
[% helpitem.newdate %]
+ +
+ [% END %] + [% END %] +
+

+ New custom help for this page + Key is: [% helpkey %]

+

+ New custom help for all pages + Key is: all

+
+
+ +
--- a/koha-tmpl/intranet-tmpl/prog/en/modules/tools/koha-news.tt +++ a/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 %]
[% ELSE %] [% END %] + [% IF ( default_lang == "staffhelp" ) %] + + [% ELSE %] + + [% END %] [% FOREACH lang_lis IN lang_list %] [% IF ( lang_lis.language == default_lang ) %] @@ -161,6 +166,17 @@ Edit news item[% ELSE %]Add news item[% END %][% ELSE %]News[% END %] [% END %] +
  • + + [% IF ( new_detail.helpkey ) %] + + [% ELSIF ( helpkey ) %] + + [% ELSE %] + + [% END %] + Used for news driven custom help system +
  • @@ -189,6 +205,11 @@ Edit news item[% ELSE %]Add news item[% END %][% ELSE %]News[% END %] [% ELSE %] [% END %] + [% IF ( lang == "staffhelp" ) %] + + [% ELSE %] + + [% END %] [% FOREACH lang_lis IN lang_list %] [% IF ( lang_lis.language == lang ) %] @@ -240,6 +261,8 @@ Edit news item[% ELSE %]Add news item[% END %][% ELSE %]News[% END %] Slip [% CASE "" %] All + [% CASE "staffhelp" %] + Staff help [% opac_new.helpkey %] [% CASE %] OPAC ([% opac_new.lang %]) [% END %] --- a/tools/koha-news.pl +++ a/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'}; --