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

(-)a/C4/Output.pm (-1 / +1 lines)
Lines 96-102 sub gettemplate { Link Here
96
    my $opacstylesheet = C4::Context->preference('opacstylesheet');
96
    my $opacstylesheet = C4::Context->preference('opacstylesheet');
97
    $tmplbase =~ s/\.tmpl$/.tt/;
97
    $tmplbase =~ s/\.tmpl$/.tt/;
98
    my ( $htdocs, $theme, $lang, $filename ) = _get_template_file( $tmplbase, $interface, $query );
98
    my ( $htdocs, $theme, $lang, $filename ) = _get_template_file( $tmplbase, $interface, $query );
99
    my $template = C4::Templates->new( $interface, $filename, $tmplbase);
99
    my $template = C4::Templates->new($interface, $filename, $tmplbase, $query);
100
    my $themelang=( $interface ne 'intranet' ? '/opac-tmpl' : '/intranet-tmpl' )
100
    my $themelang=( $interface ne 'intranet' ? '/opac-tmpl' : '/intranet-tmpl' )
101
          . "/$theme/$lang";
101
          . "/$theme/$lang";
102
    $template->param(
102
    $template->param(
(-)a/C4/Templates.pm (-1 / +2 lines)
Lines 41-46 sub new { Link Here
41
    my $interface = shift;
41
    my $interface = shift;
42
    my $filename  = shift;
42
    my $filename  = shift;
43
    my $tmplbase  = shift;
43
    my $tmplbase  = shift;
44
    my $query     = @_? shift: undef;
44
    my $htdocs;
45
    my $htdocs;
45
    if ( $interface ne "intranet" ) {
46
    if ( $interface ne "intranet" ) {
46
        $htdocs = C4::Context->config('opachtdocs');
47
        $htdocs = C4::Context->config('opachtdocs');
Lines 49-55 sub new { Link Here
49
        $htdocs = C4::Context->config('intrahtdocs');
50
        $htdocs = C4::Context->config('intrahtdocs');
50
    }
51
    }
51
52
52
    my ( $theme, $lang ) = themelanguage( $htdocs, $tmplbase, $interface );
53
    my ($theme, $lang)= C4::Output::themelanguage( $htdocs, $tmplbase, $interface, $query);
53
    my $template = Template->new(
54
    my $template = Template->new(
54
        {
55
        {
55
            EVAL_PERL    => 1,
56
            EVAL_PERL    => 1,
(-)a/opac/opac-main.pl (-28 / +1 lines)
Lines 54-86 $template->param( Link Here
54
54
55
# display news
55
# display news
56
# use cookie setting for language, bug default to syspref if it's not set
56
# use cookie setting for language, bug default to syspref if it's not set
57
(my $theme) = themelanguage(C4::Context->config('opachtdocs'),'opac-main.tmpl','opac',$input);
57
my ($theme, $news_lang) = C4::Output::themelanguage(C4::Context->config('opachtdocs'),'opac-main.tt','opac',$input);
58
59
my $translations = getTranslatedLanguages('opac',$theme);
60
my @languages = ();
61
foreach my $trans (@$translations)
62
{
63
    push(@languages, $trans->{rfc4646_subtag});
64
}
65
66
my $news_lang;
67
if($input->cookie('KohaOpacLanguage')){
68
    $news_lang = $input->cookie('KohaOpacLanguage');
69
}else{
70
    if ($ENV{HTTP_ACCEPT_LANGUAGE}) {
71
        while( !$news_lang && ( $ENV{HTTP_ACCEPT_LANGUAGE} =~ m/([a-zA-Z]{2,}-?[a-zA-Z]*)(;|,)?/g ) ){
72
            if( my @lang = grep { /^$1$/i } @languages ) {
73
                $news_lang = $lang[0];
74
            }
75
        }
76
    }
77
    if (not $news_lang) {
78
        my @languages = split ",", C4::Context->preference("opaclanguages");
79
        $news_lang = $languages[0];
80
    }
81
}
82
83
$news_lang = $news_lang ? $news_lang : 'en' ;
84
58
85
my $all_koha_news   = &GetNewsToDisplay($news_lang);
59
my $all_koha_news   = &GetNewsToDisplay($news_lang);
86
my $koha_news_count = scalar @$all_koha_news;
60
my $koha_news_count = scalar @$all_koha_news;
87
- 

Return to bug 6755