5 #package to deal with marking up output
6 #You will need to edit parts of this pm
7 #set the value of path to be where your html lives
10 # Copyright 2000-2002 Katipo Communications
12 # This file is part of Koha.
14 # Koha is free software; you can redistribute it and/or modify it under the
15 # terms of the GNU General Public License as published by the Free Software
16 # Foundation; either version 2 of the License, or (at your option) any later
19 # Koha is distributed in the hope that it will be useful, but WITHOUT ANY
20 # WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
21 # A PARTICULAR PURPOSE. See the GNU General Public License for more details.
23 # You should have received a copy of the GNU General Public License along with
24 # Koha; if not, write to the Free Software Foundation, Inc., 59 Temple Place,
25 # Suite 330, Boston, MA 02111-1307 USA
27 # NOTE: I'm pretty sure this module is deprecated in favor of
37 use vars qw($VERSION @ISA @EXPORT);
39 # set the version for version checking
44 C4::Output - Functions for managing templates
54 &themelanguage &gettemplate
57 #FIXME: this is a quick fix to stop rc1 installing broken
58 #Still trying to figure out the correct fix.
59 my $path = C4::Context->config('intrahtdocs')."/default/en/includes/";
61 #---------------------------------------------------------------------------------------------------------
64 my ($tmplbase, $opac) = @_;
67 if ($opac ne "intranet") {
68 $htdocs = C4::Context->config('opachtdocs');
70 $htdocs = C4::Context->config('intrahtdocs');
73 my ($theme, $lang) = themelanguage($htdocs, $tmplbase, $opac);
75 my $template = HTML::Template->new(filename => "$htdocs/$theme/$lang/$tmplbase",
76 die_on_bad_params => 0,
78 path => ["$htdocs/$theme/$lang/includes"]);
80 # XXX temporary patch for Bug 182 for themelang
81 $template->param(themelang => ($opac ne 'intranet'? '/opac-tmpl': '/intranet-tmpl') . "/$theme/$lang",
82 interface => ($opac ne 'intranet'? '/opac-tmpl': '/intranet-tmpl'),
88 #---------------------------------------------------------------------------------------------------------
91 my ($htdocs, $tmpl, $section) = @_;
93 my $dbh = C4::Context->dbh;
96 if ( $section eq "intranet")
98 @languages = split " ", C4::Context->preference("opaclanguages");
99 @themes = split " ", C4::Context->preference("template");
103 @languages = split " ", C4::Context->preference("opaclanguages");
104 @themes = split " ", C4::Context->preference("opacthemes");
108 # searches through the themes and languages. First template it find it returns.
109 # Priority is for getting the theme right.
111 foreach my $th (@themes) {
112 foreach my $la (@languages) {
113 for (my $pass = 1; $pass <= 2; $pass += 1) {
114 $la =~ s/([-_])/ $1 eq '-'? '_': '-' /eg if $pass == 2;
115 if (-e "$htdocs/$th/$la/$tmpl") {
120 last unless $la =~ /[-_]/;
124 if ($theme and $lang) {
125 return ($theme, $lang);
127 return ('default', 'en');
132 END { } # module clean-up code here (global destructor)
141 Koha Developement team <info@koha.org>