(bug #3778) GetBranchesLoop and searchMyLibraryFirst
[koha.git] / help.pl
blobff02bd92b6e6311da97574dc4090cd734b8f863d
1 #!/usr/bin/perl
3 use strict;
4 use HTML::Template::Pro;
6 use C4::Output; # contains gettemplate
7 # use C4::Auth;
8 use C4::Context;
9 use CGI;
11 my $query = new CGI;
13 # find the script that called the online help using the CGI referer()
14 our $refer = $query->referer();
16 # workaround for popup not functioning correctly in IE
17 my $referurl = $query->param('url');
18 if ($referurl) {
19 $refer = $query->param('url');
22 $refer =~ /.*koha\/(.*)\.pl.*/;
23 my $from = "modules/help/$1.tmpl";
25 my $template = gethelptemplate( $from, "intranet" );
27 # my $template
28 output_html_with_http_headers $query, "", $template->output;
30 sub gethelptemplate {
31 my ($tmplbase) = @_;
33 my $htdocs;
34 $htdocs = C4::Context->config('intrahtdocs');
35 my ( $theme, $lang ) = themelanguage( $htdocs, $tmplbase, "intranet", $query );
36 unless ( -e "$htdocs/$theme/$lang/$tmplbase" ) {
37 $tmplbase = "modules/help/nohelp.tmpl";
38 ( $theme, $lang ) = themelanguage( $htdocs, $tmplbase, "intranet", $query );
40 my $template = HTML::Template::Pro->new(
41 filename => "$htdocs/$theme/$lang/$tmplbase",
42 die_on_bad_params => 0,
43 global_vars => 1,
44 path => ["$htdocs/$theme/$lang/includes"]
47 # XXX temporary patch for Bug 182 for themelang
48 $template->param(
49 themelang => '/intranet-tmpl' . "/$theme/$lang",
50 interface => '/intranet-tmpl',
51 theme => $theme,
52 lang => $lang,
53 intranetcolorstylesheet =>
54 C4::Context->preference("intranetcolorstylesheet"),
55 intranetstylesheet => C4::Context->preference("intranetstylesheet"),
56 IntranetNav => C4::Context->preference("IntranetNav"),
57 yuipath => (C4::Context->preference("yuipath") eq "local"?"/intranet-tmpl/$theme/$lang/lib/yui":C4::Context->preference("yuipath")),
58 referer => $refer,
60 return $template;