Added 'labels' and 'labels_conf' tables, for spine lable tool.
[koha.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::Interface::CGI::Output;
7 # use C4::Auth;
8 use C4::Context;
9 use CGI;
10
11 my $query = new CGI;
12
13 # find the script that called the online help using the CGI referer()
14
15 my $refer  = $query->referer();
16 $refer =~ /.*koha\/(.*)\.pl.*/;
17 my $from = "help/$1.tmpl";
18
19 my $template = gethelptemplate($from,"intranet");
20 # my $template
21 output_html_with_http_headers $query, "", $template->output;
22
23
24 sub gethelptemplate {
25         my ($tmplbase) = @_;
26
27         my $htdocs;
28                 $htdocs = C4::Context->config('intrahtdocs');
29         my ($theme, $lang) = themelanguage($htdocs, $tmplbase, "intranet");
30         unless (-e "$htdocs/$theme/$lang/$tmplbase") {
31                 $tmplbase="help/nohelp.tmpl";
32                 ($theme, $lang) = themelanguage($htdocs, $tmplbase, "intranet");
33         }
34         my $template = HTML::Template->new(filename      => "$htdocs/$theme/$lang/$tmplbase",
35                                    die_on_bad_params => 0,
36                                    global_vars       => 1,
37                                    path              => ["$htdocs/$theme/$lang/includes"]);
38
39         # XXX temporary patch for Bug 182 for themelang
40         $template->param(themelang => '/intranet-tmpl' . "/$theme/$lang",
41                                                         interface => '/intranet-tmpl',
42                                                         theme => $theme,
43                                                         lang => $lang);
44         return $template;
45 }