X-Git-Url: http://git.rot13.org/?a=blobdiff_plain;f=edithelp.pl;h=de4e9b12c1b53622da96be498f5a49baefcd1f55;hb=9c5e40e4923179bf0b2b630d3e09797dc4c1fdb0;hp=4d7e0c0090ce2ab8b9c49a06786d910ef3083dfb;hpb=f640a3ea5fdd85695ff7a75240c830369b5aed73;p=koha.git diff --git a/edithelp.pl b/edithelp.pl index 4d7e0c0090..de4e9b12c1 100755 --- a/edithelp.pl +++ b/edithelp.pl @@ -19,6 +19,7 @@ use strict; use C4::Output; +use C4::Templates; use C4::Auth; use CGI; use warnings; @@ -66,7 +67,7 @@ sub _get_filepath ($;$) { $referer =~ /koha\/(.*)\.pl/; my $from = "help/$1.tt"; my $htdocs = C4::Context->config('intrahtdocs'); - my ($theme, $lang) = themelanguage( $htdocs, $from, "intranet", $input ); + my ($theme, $lang, $availablethemes) = C4::Templates::themelanguage( $htdocs, $from, "intranet", $input ); $debug and print STDERR "help filepath: $htdocs/$theme/$lang/modules/$from"; return "$htdocs/$theme/$lang/modules/$from"; } @@ -95,15 +96,13 @@ elsif ( $type eq 'modify' ) { $error = "Cannot read file: '$file'."; } else { (-w $file) or $error = - "WARNING: You will not be able save, because your webserver cannot write to '$file'. Contact your admin about help file permissions."; - open (INFILE, $file) or die "Cannot read file '$file'"; # unlikely death, since we just checked + "WARNING: You will not be able to save, because your webserver cannot write to '$file'. Contact your admin about help file permissions."; + open (my $fh, '<', $file) or die "Cannot read file '$file'"; # unlikely death, since we just checked my $help = ''; - while ( my $inp = ) { - unless ( $inp =~ /INCLUDE/ ) { - $help .= $inp; - } + while ( <$fh> ) { + $help .= /\[% INCLUDE .* %\](.*)$/ ? $1 : $_; } - close INFILE; + close $fh; $template->param( 'help' => $help ); $type = 'save'; }