Follow up for new translation wrapper
[koha.git] / help.pl
blobda564d629057643323f45ae3d68d113bc4f13bf6
1 #!/usr/bin/perl
3 # Copyright 2010 Koha Development team
5 # This file is part of Koha.
7 # Koha is free software; you can redistribute it and/or modify it under the
8 # terms of the GNU General Public License as published by the Free Software
9 # Foundation; either version 2 of the License, or (at your option) any later
10 # version.
12 # Koha is distributed in the hope that it will be useful, but WITHOUT ANY
13 # WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
14 # A PARTICULAR PURPOSE. See the GNU General Public License for more details.
16 # You should have received a copy of the GNU General Public License along with
17 # Koha; if not, write to the Free Software Foundation, Inc., 59 Temple Place,
18 # Suite 330, Boston, MA 02111-1307 USA
20 use strict;
21 use HTML::Template::Pro;
22 use warnings;
23 use C4::Output; # contains gettemplate
24 # use C4::Auth;
25 use C4::Context;
26 use CGI;
28 my $query = new CGI;
30 # find the script that called the online help using the CGI referer()
31 our $refer = $query->referer();
33 # workaround for popup not functioning correctly in IE
34 my $referurl = $query->param('url');
35 if ($referurl) {
36 $refer = $query->param('url');
39 $refer =~ /.*koha\/(.*)\.pl.*/;
40 my $from = "modules/help/$1.tmpl";
42 my $template = gethelptemplate( $from, "intranet" );
44 # my $template
45 output_html_with_http_headers $query, "", $template->output;
47 sub gethelptemplate {
48 my ($tmplbase) = @_;
50 my $htdocs;
51 $htdocs = C4::Context->config('intrahtdocs');
52 my ( $theme, $lang ) = themelanguage( $htdocs, $tmplbase, "intranet", $query );
53 unless ( -e "$htdocs/$theme/$lang/$tmplbase" ) {
54 $tmplbase = "modules/help/nohelp.tmpl";
55 ( $theme, $lang ) = themelanguage( $htdocs, $tmplbase, "intranet", $query );
57 my $template = HTML::Template::Pro->new(
58 filename => "$htdocs/$theme/$lang/$tmplbase",
59 die_on_bad_params => 0,
60 global_vars => 1,
61 path => ["$htdocs/$theme/$lang/includes"]
64 # XXX temporary patch for Bug 182 for themelang
65 $template->param(
66 themelang => '/intranet-tmpl' . "/$theme/$lang",
67 interface => '/intranet-tmpl',
68 theme => $theme,
69 lang => $lang,
70 intranetcolorstylesheet =>
71 C4::Context->preference("intranetcolorstylesheet"),
72 intranetstylesheet => C4::Context->preference("intranetstylesheet"),
73 IntranetNav => C4::Context->preference("IntranetNav"),
74 yuipath => (C4::Context->preference("yuipath") eq "local"?"/intranet-tmpl/$theme/$lang/lib/yui":C4::Context->preference("yuipath")),
75 referer => $refer,
77 return $template;