|
Lines 18-26
Link Here
|
| 18 |
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. |
18 |
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. |
| 19 |
|
19 |
|
| 20 |
use strict; |
20 |
use strict; |
| 21 |
use HTML::Template::Pro; |
|
|
| 22 |
use warnings; |
21 |
use warnings; |
| 23 |
use C4::Output; # contains gettemplate |
22 |
use C4::Templates; |
|
|
23 |
use C4::Output; |
| 24 |
# use C4::Auth; |
24 |
# use C4::Auth; |
| 25 |
use C4::Context; |
25 |
use C4::Context; |
| 26 |
use CGI; |
26 |
use CGI; |
|
Lines 30-78
my $query = new CGI;
Link Here
|
| 30 |
# find the script that called the online help using the CGI referer() |
30 |
# find the script that called the online help using the CGI referer() |
| 31 |
our $refer = $query->referer(); |
31 |
our $refer = $query->referer(); |
| 32 |
|
32 |
|
| 33 |
# workaround for popup not functioning correctly in IE |
33 |
$refer =~ /koha\/(.*)\.pl/; |
| 34 |
my $referurl = $query->param('url'); |
34 |
my $from = "modules/help/$1.tt"; |
| 35 |
if ($referurl) { |
|
|
| 36 |
$refer = $query->param('url'); |
| 37 |
} |
| 38 |
|
| 39 |
$refer =~ /.*koha\/(.*)\.pl.*/; |
| 40 |
my $from = "modules/help/$1.tmpl"; |
| 41 |
|
35 |
|
| 42 |
my $template = gethelptemplate( $from, "intranet" ); |
36 |
my $htdocs = C4::Context->config('intrahtdocs'); |
|
|
37 |
my ( $theme, $lang ) = themelanguage( $htdocs, $from, "intranet", $query ); |
| 38 |
unless ( -e "$htdocs/$theme/$lang/$from" ) { |
| 39 |
$from = "modules/help/nohelp.tt"; |
| 40 |
( $theme, $lang ) = themelanguage( $htdocs, $from, "intranet", $query ); |
| 41 |
} |
| 42 |
my $template = C4::Templates->new('intranet', "$htdocs/$theme/$lang/$from"); |
| 43 |
|
43 |
|
| 44 |
# my $template |
|
|
| 45 |
output_html_with_http_headers $query, "", $template->output; |
44 |
output_html_with_http_headers $query, "", $template->output; |
| 46 |
|
45 |
|
| 47 |
sub gethelptemplate { |
|
|
| 48 |
my ($tmplbase) = @_; |
| 49 |
|
| 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 ); |
| 56 |
} |
| 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"] |
| 62 |
); |
| 63 |
|
| 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, |
| 76 |
); |
| 77 |
return $template; |
| 78 |
} |
| 79 |
- |