@@ -, +, @@ help system as news based help system item --- help.pl | 23 +++++++++++++++++++--- .../intranet-tmpl/prog/en/includes/help-top.inc | 3 +++ .../prog/en/modules/tools/koha-news.tt | 8 ++++++-- tools/koha-news.pl | 4 +++- 4 files changed, 32 insertions(+), 6 deletions(-) --- a/help.pl +++ a/help.pl @@ -38,7 +38,21 @@ sub _help_template_file_of_url { return "help/$file.tt"; } -my $query = new CGI; +our $query = new CGI; + +# CP code for proof of concept Bug 18516, will need rework +sub _get_filepath ($;$) { + my $referer = shift; + $referer =~ /koha\/(.*)\.pl/; + my $file = $1; + $file =~ s/[^0-9a-zA-Z_\-\/]*//g; + my $from = "help/$file.tt"; + my $htdocs = C4::Context->config('intrahtdocs'); + my ($theme, $lang, $availablethemes) = C4::Templates::themelanguage( $htdocs, $from, "intranet", $query ); + return "$htdocs/$theme/$lang/modules/$from"; +} + + # Init the interface to get the correct language. # This is usually set by get_template_and_user @@ -61,6 +75,10 @@ my $htdocs = C4::Context->config('intrahtdocs'); # checking that the help file exist, otherwise, display nohelp.tt page my ( $theme, $lang ) = C4::Templates::themelanguage( $htdocs, $from, "intranet", $query ); +#my $createfrom = $from; +my $createfrom = _get_filepath($refer, 1); # 2nd argument triggers themelanguage call + + unless ( -e "$htdocs/$theme/$lang/modules/$from" ) { $from = "help/nohelp.tt"; ( $theme, $lang ) = C4::Templates::themelanguage( $htdocs, $from, "intranet", $query ); @@ -85,14 +103,13 @@ my ( $template, $borrowernumber, $cookie ) = get_template_and_user( ); - - $template->param( referer => $refer, helpkey => $helpkey, intranetstylesheet => C4::Context->preference("intranetstylesheet"), intranetcolorstylesheet => C4::Context->preference("intranetcolorstylesheet"), helpsystem => $helpsys, + createfrom => $createfrom, ); if ( index($helpsys,'newsbased') != -1 || index ($helpsys,'filebased') != -1 ) { --- a/koha-tmpl/intranet-tmpl/prog/en/includes/help-top.inc +++ a/koha-tmpl/intranet-tmpl/prog/en/includes/help-top.inc @@ -34,6 +34,9 @@

Add help for all pages Key is: all

+

+ Add help for this page using built in text + Uses installed Koha help text as a base for new entry

Note: You can manage and / or delete help entries in More › Tools

[% END %] --- a/koha-tmpl/intranet-tmpl/prog/en/modules/tools/koha-news.tt +++ a/koha-tmpl/intranet-tmpl/prog/en/modules/tools/koha-news.tt @@ -193,8 +193,12 @@ Edit news item[% ELSE %]Add news item[% END %][% ELSE %]News[% END %] [% END %] -
  • - +
  • + [% IF createfrom %] + + [% ELSE %] + + [% END %]
  • --- a/tools/koha-news.pl +++ a/tools/koha-news.pl @@ -46,6 +46,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 $createfrom = $cgi->param('createfrom'); my $lang = $cgi->param('lang'); my $branchcode = $cgi->param('branch'); my $error_message = $cgi->param('error_message'); @@ -119,7 +120,8 @@ if ( $op eq 'add_form' ) { else { $template->param( op => 'add', - helpkey => $helpkey + helpkey => $helpkey, + createfrom => $createfrom ); } --