View | Details | Raw Unified | Return to bug 8622
Collapse All | Expand All

(-)a/C4/Output.pm (-2 / +2 lines)
Lines 42-54 BEGIN { Link Here
42
42
43
 @ISA    = qw(Exporter);
43
 @ISA    = qw(Exporter);
44
    @EXPORT_OK = qw(&is_ajax ajax_fail); # More stuff should go here instead
44
    @EXPORT_OK = qw(&is_ajax ajax_fail); # More stuff should go here instead
45
    %EXPORT_TAGS = ( all =>[qw(&themelanguage &gettemplate setlanguagecookie pagination_bar &gettemplate
45
    %EXPORT_TAGS = ( all =>[qw(setlanguagecookie pagination_bar
46
                                &output_with_http_headers &output_ajax_with_http_headers &output_html_with_http_headers)],
46
                                &output_with_http_headers &output_ajax_with_http_headers &output_html_with_http_headers)],
47
                    ajax =>[qw(&output_with_http_headers &output_ajax_with_http_headers is_ajax)],
47
                    ajax =>[qw(&output_with_http_headers &output_ajax_with_http_headers is_ajax)],
48
                    html =>[qw(&output_with_http_headers &output_html_with_http_headers)]
48
                    html =>[qw(&output_with_http_headers &output_html_with_http_headers)]
49
                );
49
                );
50
    push @EXPORT, qw(
50
    push @EXPORT, qw(
51
        &themelanguage &gettemplate setlanguagecookie getlanguagecookie pagination_bar &gettemplate
51
        setlanguagecookie getlanguagecookie pagination_bar
52
    );
52
    );
53
    push @EXPORT, qw(
53
    push @EXPORT, qw(
54
        &output_html_with_http_headers &output_ajax_with_http_headers &output_with_http_headers FormatData FormatNumber
54
        &output_html_with_http_headers &output_ajax_with_http_headers &output_with_http_headers FormatData FormatNumber
(-)a/C4/Reports/Guided.pm (-1 / +1 lines)
Lines 769-775 sub _get_column_defs { Link Here
769
	my $columns_def_file = "columns.def";
769
	my $columns_def_file = "columns.def";
770
	my $htdocs = C4::Context->config('intrahtdocs');                       
770
	my $htdocs = C4::Context->config('intrahtdocs');                       
771
	my $section='intranet';
771
	my $section='intranet';
772
	my ($theme, $lang) = C4::Templates::themelanguage($htdocs, $columns_def_file, $section,$cgi);
772
    my ($theme, $lang, $availablethemes) = C4::Templates::themelanguage($htdocs, $columns_def_file, $section,$cgi);
773
773
774
	my $full_path_to_columns_def_file="$htdocs/$theme/$lang/$columns_def_file";    
774
	my $full_path_to_columns_def_file="$htdocs/$theme/$lang/$columns_def_file";    
775
	open (COLUMNS,$full_path_to_columns_def_file);
775
	open (COLUMNS,$full_path_to_columns_def_file);
(-)a/C4/Templates.pm (-23 / +29 lines)
Lines 36-42 use C4::Languages qw(getTranslatedLanguages get_bidi regex_lang_subtags language Link Here
36
36
37
use C4::Context;
37
use C4::Context;
38
38
39
__PACKAGE__->mk_accessors(qw( theme lang filename htdocs interface vars));
39
__PACKAGE__->mk_accessors(qw( theme activethemes preferredtheme lang filename htdocs interface vars));
40
40
41
41
42
42
Lines 53-69 sub new { Link Here
53
    else {
53
    else {
54
        $htdocs = C4::Context->config('intrahtdocs');
54
        $htdocs = C4::Context->config('intrahtdocs');
55
    }
55
    }
56
    my ($theme, $lang)= themelanguage( $htdocs, $tmplbase, $interface, $query);
56
    my ($theme, $lang, $activethemes)= themelanguage( $htdocs, $tmplbase, $interface, $query);
57
    my @includes;
58
    foreach (@$activethemes) {
59
        push @includes, "$htdocs/$_/$lang/includes";
60
        push @includes, "$htdocs/$_/en/includes" unless $lang eq 'en';
61
    }
57
    my $template = Template->new(
62
    my $template = Template->new(
58
        {   EVAL_PERL    => 1,
63
        {   EVAL_PERL    => 1,
59
            ABSOLUTE     => 1,
64
            ABSOLUTE     => 1,
60
            PLUGIN_BASE => 'Koha::Template::Plugin',
65
            PLUGIN_BASE => 'Koha::Template::Plugin',
61
            COMPILE_EXT => C4::Context->config('template_cache_dir')?'.ttc':'',
66
            COMPILE_EXT => C4::Context->config('template_cache_dir')?'.ttc':'',
62
            COMPILE_DIR => C4::Context->config('template_cache_dir')?C4::Context->config('template_cache_dir'):'',,
67
            COMPILE_DIR => C4::Context->config('template_cache_dir')?C4::Context->config('template_cache_dir'):'',,
63
            INCLUDE_PATH => [
68
            INCLUDE_PATH => \@includes,
64
                "$htdocs/$theme/$lang/includes",
65
                "$htdocs/$theme/en/includes"
66
            ],
67
            FILTERS => {},
69
            FILTERS => {},
68
        }
70
        }
69
    ) or die Template->error();
71
    ) or die Template->error();
Lines 74-79 sub new { Link Here
74
    bless $self, $class;
76
    bless $self, $class;
75
    $self->theme($theme);
77
    $self->theme($theme);
76
    $self->lang($lang);
78
    $self->lang($lang);
79
    $self->activethemes($activethemes);
80
    $self->preferredtheme($activethemes->[0]);
77
    $self->filename($filename);
81
    $self->filename($filename);
78
    $self->htdocs($htdocs);
82
    $self->htdocs($htdocs);
79
    $self->interface($interface);
83
    $self->interface($interface);
Lines 95-101 sub output { Link Here
95
        $vars->{themelang} = '/opac-tmpl';
99
        $vars->{themelang} = '/opac-tmpl';
96
    }
100
    }
97
    $vars->{lang} = $self->lang;
101
    $vars->{lang} = $self->lang;
98
    $vars->{themelang} .= '/' . $self->theme . '/' . $self->lang;
102
    $vars->{themelang} .= '/' . $self->preferredtheme . '/' . $self->lang;
99
    $vars->{yuipath} =
103
    $vars->{yuipath} =
100
      ( C4::Context->preference("yuipath") eq "local"
104
      ( C4::Context->preference("yuipath") eq "local"
101
        ? $vars->{themelang} . "/lib/yui"
105
        ? $vars->{themelang} . "/lib/yui"
Lines 211-217 sub _get_template_file { Link Here
211
215
212
    my $is_intranet = $interface eq 'intranet';
216
    my $is_intranet = $interface eq 'intranet';
213
    my $htdocs = C4::Context->config($is_intranet ? 'intrahtdocs' : 'opachtdocs');
217
    my $htdocs = C4::Context->config($is_intranet ? 'intrahtdocs' : 'opachtdocs');
214
    my ($theme, $lang) = themelanguage($htdocs, $tmplbase, $interface, $query);
218
    my ($theme, $lang, $availablethemes) = themelanguage($htdocs, $tmplbase, $interface, $query);
215
219
216
    # if the template doesn't exist, load the English one as a last resort
220
    # if the template doesn't exist, load the English one as a last resort
217
    my $filename = "$htdocs/$theme/$lang/modules/$tmplbase";
221
    my $filename = "$htdocs/$theme/$lang/modules/$tmplbase";
Lines 231-249 sub gettemplate { Link Here
231
    my ($htdocs, $theme, $lang, $filename)
235
    my ($htdocs, $theme, $lang, $filename)
232
       =  _get_template_file($tmplbase, $interface, $query);
236
       =  _get_template_file($tmplbase, $interface, $query);
233
    my $template = C4::Templates->new($interface, $filename, $tmplbase, $query);
237
    my $template = C4::Templates->new($interface, $filename, $tmplbase, $query);
234
    my $is_intranet = $interface eq 'intranet';
238
# NOTE: Commenting these out rather than deleting them so that those who need
235
    my $themelang =
239
# to know how we previously shimmed these directories will be able to understand.
236
        ($is_intranet ? '/intranet-tmpl' : '/opac-tmpl') .
240
#    my $is_intranet = $interface eq 'intranet';
237
        "/$theme/$lang";
241
#    my $themelang =
238
    $template->param(
242
#        ($is_intranet ? '/intranet-tmpl' : '/opac-tmpl') .
239
        themelang => $themelang,
243
#        "/$theme/$lang";
240
        yuipath   => C4::Context->preference("yuipath") eq "local"
244
#    $template->param(
241
                     ? "$themelang/lib/yui"
245
#        themelang => $themelang,
242
                     : C4::Context->preference("yuipath"),
246
#        yuipath   => C4::Context->preference("yuipath") eq "local"
243
        interface => $is_intranet ? '/intranet-tmpl' : '/opac-tmpl',
247
#                     ? "$themelang/lib/yui"
244
        theme     => $theme,
248
#                     : C4::Context->preference("yuipath"),
245
        lang      => $lang
249
#        interface => $is_intranet ? '/intranet-tmpl' : '/opac-tmpl',
246
    );
250
#        theme     => $theme,
251
#        lang      => $lang
252
#    );
247
253
248
    # Bidirectionality
254
    # Bidirectionality
249
    my $current_lang = regex_lang_subtags($lang);
255
    my $current_lang = regex_lang_subtags($lang);
Lines 286-296 sub themelanguage { Link Here
286
    for my $theme (@themes) {
292
    for my $theme (@themes) {
287
        if ( -e "$htdocs/$theme/$lang/modules/$tmpl" ) {
293
        if ( -e "$htdocs/$theme/$lang/modules/$tmpl" ) {
288
            $_current_language = $lang;
294
            $_current_language = $lang;
289
            return ($theme, $lang)
295
            return ($theme, $lang, \@themes)
290
        }
296
        }
291
    }
297
    }
292
    # Otherwise, return prog theme in English 'en'
298
    # Otherwise, return prog theme in English 'en'
293
    return ('prog', 'en');
299
    return ('prog', 'en', \@themes);
294
}
300
}
295
301
296
302
(-)a/C4/XSLT.pm (-23 / +23 lines)
Lines 140-174 sub XSLTParse4Display { Link Here
140
    my ( $biblionumber, $orig_record, $xslsyspref, $fixamps, $hidden_items ) = @_;
140
    my ( $biblionumber, $orig_record, $xslsyspref, $fixamps, $hidden_items ) = @_;
141
    my $xslfilename = C4::Context->preference($xslsyspref);
141
    my $xslfilename = C4::Context->preference($xslsyspref);
142
    if ( $xslfilename =~ /^\s*"?default"?\s*$/i ) {
142
    if ( $xslfilename =~ /^\s*"?default"?\s*$/i ) {
143
        my $htdocs;
144
        my $theme;
145
        my $lang = C4::Templates::_current_language();
146
        my $xslfile;
143
        if ($xslsyspref eq "XSLTDetailsDisplay") {
147
        if ($xslsyspref eq "XSLTDetailsDisplay") {
144
            $xslfilename = C4::Context->config('intrahtdocs') .
148
            $htdocs  = C4::Context->config('intrahtdocs');
145
                        '/' . C4::Context->preference("template") .
149
            $theme   = C4::Context->preference("template");
146
                        '/' . C4::Templates::_current_language() .
150
            $xslfile = C4::Context->preference('marcflavour') .
147
                        '/xslt/' .
151
                       "slim2intranetDetail.xsl";
148
                        C4::Context->preference('marcflavour') .
149
                        "slim2intranetDetail.xsl";
150
        } elsif ($xslsyspref eq "XSLTResultsDisplay") {
152
        } elsif ($xslsyspref eq "XSLTResultsDisplay") {
151
            $xslfilename = C4::Context->config('intrahtdocs') .
153
            $htdocs  = C4::Context->config('intrahtdocs');
152
                        '/' . C4::Context->preference("template") .
154
            $theme   = C4::Context->preference("template");
153
                        '/' . C4::Templates::_current_language() .
155
            $xslfile = C4::Context->preference('marcflavour') .
154
                        '/xslt/' .
155
                        C4::Context->preference('marcflavour') .
156
                        "slim2intranetResults.xsl";
156
                        "slim2intranetResults.xsl";
157
        } elsif ($xslsyspref eq "OPACXSLTDetailsDisplay") {
157
        } elsif ($xslsyspref eq "OPACXSLTDetailsDisplay") {
158
            $xslfilename = C4::Context->config('opachtdocs') .
158
            $htdocs  = C4::Context->config('opachtdocs');
159
                        '/' . C4::Context->preference("opacthemes") .
159
            $theme   = C4::Context->preference("opacthemes");
160
                        '/' . C4::Templates::_current_language() .
160
            $xslfile = C4::Context->preference('marcflavour') .
161
                        '/xslt/' .
161
                       "slim2OPACDetail.xsl";
162
                        C4::Context->preference('marcflavour') .
163
                        "slim2OPACDetail.xsl";
164
        } elsif ($xslsyspref eq "OPACXSLTResultsDisplay") {
162
        } elsif ($xslsyspref eq "OPACXSLTResultsDisplay") {
165
            $xslfilename = C4::Context->config('opachtdocs') .
163
            $htdocs  = C4::Context->config('opachtdocs');
166
                        '/' . C4::Context->preference("opacthemes") .
164
            $theme   = C4::Context->preference("opacthemes");
167
                        '/' . C4::Templates::_current_language() .
165
            $xslfile = C4::Context->preference('marcflavour') .
168
                        '/xslt/' .
166
                       "slim2OPACResults.xsl";
169
                        C4::Context->preference('marcflavour') .
170
                        "slim2OPACResults.xsl";
171
        }
167
        }
168
        $xslfilename = "$htdocs/$theme/$lang/xslt/$xslfile";
169
        $xslfilename = "$htdocs/$theme/en/xslt/$xslfile" unless ( $lang ne 'en' && !-f $xslfilename );
170
        $xslfilename = "$htdocs/prog/$lang/xslt/$xslfile" unless ( !-f $xslfilename );
171
        $xslfilename = "$htdocs/prog/en/xslt/$xslfile" unless ( $lang ne 'en' && !-f $xslfilename );
172
    }
172
    }
173
173
174
    if ( $xslfilename =~ m/\{langcode\}/ ) {
174
    if ( $xslfilename =~ m/\{langcode\}/ ) {
(-)a/catalogue/moredetail.pl (-1 / +1 lines)
Lines 28-34 use C4::Items; Link Here
28
use C4::Branch;
28
use C4::Branch;
29
use C4::Acquisition;
29
use C4::Acquisition;
30
use C4::Bookseller qw(GetBookSellerFromId);
30
use C4::Bookseller qw(GetBookSellerFromId);
31
use C4::Output;             # contains gettemplate
31
use C4::Output;
32
use C4::Auth;
32
use C4::Auth;
33
use C4::Serials;
33
use C4::Serials;
34
use C4::Circulation;  # to use itemissues
34
use C4::Circulation;  # to use itemissues
(-)a/edithelp.pl (-1 / +1 lines)
Lines 67-73 sub _get_filepath ($;$) { Link Here
67
    $referer =~ /koha\/(.*)\.pl/;
67
    $referer =~ /koha\/(.*)\.pl/;
68
    my $from = "help/$1.tt";
68
    my $from = "help/$1.tt";
69
    my $htdocs = C4::Context->config('intrahtdocs');
69
    my $htdocs = C4::Context->config('intrahtdocs');
70
    my ($theme, $lang) = C4::Templates::themelanguage( $htdocs, $from, "intranet", $input );
70
    my ($theme, $lang, $availablethemes) = C4::Templates::themelanguage( $htdocs, $from, "intranet", $input );
71
	$debug and print STDERR "help filepath: $htdocs/$theme/$lang/modules/$from";
71
	$debug and print STDERR "help filepath: $htdocs/$theme/$lang/modules/$from";
72
	return "$htdocs/$theme/$lang/modules/$from";
72
	return "$htdocs/$theme/$lang/modules/$from";
73
}
73
}
(-)a/opac/opac-main.pl (-2 / +1 lines)
Lines 46-52 $template->param( Link Here
46
46
47
# display news
47
# display news
48
# use cookie setting for language, bug default to syspref if it's not set
48
# use cookie setting for language, bug default to syspref if it's not set
49
my ($theme, $news_lang) = C4::Templates::themelanguage(C4::Context->config('opachtdocs'),'opac-main.tt','opac',$input);
49
my ($theme, $news_lang, $availablethemes) = C4::Templates::themelanguage(C4::Context->config('opachtdocs'),'opac-main.tt','opac',$input);
50
50
51
my $all_koha_news   = &GetNewsToDisplay($news_lang);
51
my $all_koha_news   = &GetNewsToDisplay($news_lang);
52
my $koha_news_count = scalar @$all_koha_news;
52
my $koha_news_count = scalar @$all_koha_news;
53
- 

Return to bug 8622