Bug 5307: Language search fields
[koha.git] / help.pl
blobf871e3c094c8b8bdc9724d100058bc93cb9c2a18
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
17 # with Koha; if not, write to the Free Software Foundation, Inc.,
18 # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 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;