Revert "new virtual shelves changes, keyed by biblionumber -- approved"
[koha-equinox.git] / help.pl
1 #!/usr/bin/perl
2 use HTML::Template;
3 use strict;
4 require Exporter;
5 use C4::Output;  # contains gettemplate
6 # use C4::Auth;
7 use C4::Context;
8 use CGI;
9
10 my $query = new CGI;
11
12 # find the script that called the online help using the CGI referer()
13 my $refer  = $query->referer();
14 # workaround for popup not functioning correctly in IE
15 my $referurl = $query->param('url');
16 if($referurl){
17     $refer = $query->param('url');
18 }
19
20 $refer =~ /.*koha\/(.*)\.pl.*/;
21 my $from = "help/$1.tmpl";
22
23 my $template = gethelptemplate($from,"intranet");
24 # my $template
25 output_html_with_http_headers $query, "", $template->output;
26
27
28 sub gethelptemplate {
29         my ($tmplbase) = @_;
30
31         my $htdocs;
32                 $htdocs = C4::Context->config('intrahtdocs');
33         my ($theme, $lang) = themelanguage($htdocs, $tmplbase, "intranet");
34         unless (-e "$htdocs/$theme/$lang/$tmplbase") {
35                 $tmplbase="help/nohelp.tmpl";
36                 ($theme, $lang) = themelanguage($htdocs, $tmplbase, "intranet");
37         }
38         my $template = HTML::Template->new(filename      => "$htdocs/$theme/$lang/$tmplbase",
39                                    die_on_bad_params => 0,
40                                    global_vars       => 1,
41                                    path              => ["$htdocs/$theme/$lang/includes"]);
42
43         # XXX temporary patch for Bug 182 for themelang
44         $template->param(themelang => '/intranet-tmpl' . "/$theme/$lang",
45                                                         interface => '/intranet-tmpl',
46                                                         theme => $theme,
47                                                         lang => $lang,
48                                                         intranetcolorstylesheet => C4::Context->preference("intranetcolorstylesheet"),
49                 intranetstylesheet => C4::Context->preference("intranetstylesheet"),
50                 IntranetNav => C4::Context->preference("IntranetNav"),
51                 referer => $refer,
52                         );
53         return $template;
54 }