removing warn compilation.
[koha.git] / help.pl
1 #!/usr/bin/perl
2
3 # Copyright 2006 Katipo Communications
4 #
5 # This file is part of Koha.                                                    
6 #                                                                               
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.                                                                      
11 #                                                                               
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.   
15 #                                                                               
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
19
20
21 use strict;
22 require Exporter;
23 use C4::Output;  # contains gettemplate
24 use C4::Output;
25 # use C4::Auth;
26 use C4::Context;
27 use CGI;
28
29 my $query = new CGI;
30
31 # find the script that called the online help using the CGI referer()
32
33 my $refer  = $query->referer();
34 # workaround for popup not functioning correctly in IE
35 my $referurl = $query->param('url');
36 if($referurl){
37     $refer = $query->param('url');
38 }
39
40 $refer =~ /.*koha\/(.*)\.pl.*/;
41 my $from = "help/$1.tmpl";
42
43 my $template = gethelptemplate($from,"intranet");
44 # my $template
45 output_html_with_http_headers $query, "", $template->output;
46
47
48 sub gethelptemplate {
49         my ($tmplbase) = @_;
50
51         my $htdocs;
52                 $htdocs = C4::Context->config('intrahtdocs');
53         my ($theme, $lang) = themelanguage($htdocs, $tmplbase, "intranet");
54         unless (-e "$htdocs/$theme/$lang/$tmplbase") {
55                 $tmplbase="help/nohelp.tmpl";
56                 ($theme, $lang) = themelanguage($htdocs, $tmplbase, "intranet");
57         }
58         my $template = HTML::Template->new(filename      => "$htdocs/$theme/$lang/$tmplbase",
59                                    die_on_bad_params => 0,
60                                    global_vars       => 1,
61                                    path              => ["$htdocs/$theme/$lang/includes"]);
62
63         # XXX temporary patch for Bug 182 for themelang
64         $template->param(themelang => '/intranet-tmpl' . "/$theme/$lang",
65                                                         interface => '/intranet-tmpl',
66                                                         theme => $theme,
67                                                         lang => $lang);
68         return $template;
69 }