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

(-)a/installer/data/mysql/atomicupdate/bug_22880-move-opacheader-to-news.perl (-2 / +5 lines)
Lines 8-15 if( CheckVersion( $DBversion ) ) { Link Here
8
        SELECT value FROM systempreferences WHERE variable='opacheader';
8
        SELECT value FROM systempreferences WHERE variable='opacheader';
9
    |);
9
    |);
10
    if( $opacheader ){
10
    if( $opacheader ){
11
        # If there is a value in the opacheader preference, insert it into opac_news
11
        foreach my $lang ( @langs ) {
12
        $dbh->do("INSERT INTO opac_news (branchcode, lang, title, content ) VALUES (NULL, ?, '', ?)", undef, "opacheader_$langs[0]", $opacheader);
12
            print "Inserting opacheader contents into $lang news item...\n";
13
            # If there is a value in the opacheader preference, insert it into opac_news
14
            $dbh->do("INSERT INTO opac_news (branchcode, lang, title, content ) VALUES (NULL, ?, 'opacheader $lang', ?)", undef, "opacheader_$lang", $opacheader);
15
        }
13
    }
16
    }
14
    # Remove the opacheader system preference
17
    # Remove the opacheader system preference
15
    $dbh->do("DELETE FROM systempreferences WHERE variable='opacheader'");
18
    $dbh->do("DELETE FROM systempreferences WHERE variable='opacheader'");
(-)a/installer/data/mysql/sysprefs.sql (-1 lines)
Lines 379-385 INSERT INTO systempreferences ( `variable`, `value`, `options`, `explanation`, ` Link Here
379
('OPACFineNoRenewals','100','','Fine limit above which user cannot renew books via OPAC','Integer'),
379
('OPACFineNoRenewals','100','','Fine limit above which user cannot renew books via OPAC','Integer'),
380
('OPACFinesTab','1','','If OFF the patron fines tab in the OPAC is disabled.','YesNo'),
380
('OPACFinesTab','1','','If OFF the patron fines tab in the OPAC is disabled.','YesNo'),
381
('OPACFRBRizeEditions','0','','If ON, the OPAC will query one or more ISBN web services for associated ISBNs and display an Editions tab on the details pages','YesNo'),
381
('OPACFRBRizeEditions','0','','If ON, the OPAC will query one or more ISBN web services for associated ISBNs and display an Editions tab on the details pages','YesNo'),
382
('opacheader','','70|10','Add HTML to be included as a custom header in the OPAC','Textarea'),
383
('OpacHiddenItems','','','This syspref allows to define custom rules for hiding specific items at the OPAC. See http://wiki.koha-community.org/wiki/OpacHiddenItems for more information.','Textarea'),
382
('OpacHiddenItems','','','This syspref allows to define custom rules for hiding specific items at the OPAC. See http://wiki.koha-community.org/wiki/OpacHiddenItems for more information.','Textarea'),
384
('OpacHiddenItemsExceptions','',NULL,'List of borrower categories, separated by |, that can see items otherwise hidden by OpacHiddenItems','Textarea'),
383
('OpacHiddenItemsExceptions','',NULL,'List of borrower categories, separated by |, that can see items otherwise hidden by OpacHiddenItems','Textarea'),
385
('OpacHighlightedWords','1','','If Set, then queried words are higlighted in OPAC','YesNo'),
384
('OpacHighlightedWords','1','','If Set, then queried words are higlighted in OPAC','YesNo'),
(-)a/koha-tmpl/opac-tmpl/bootstrap/en/includes/masthead-sco.inc (-2 / +5 lines)
Lines 1-6 Link Here
1
[% USE raw %]
1
[% USE raw %]
2
[% USE Koha %]
2
[% USE Koha %]
3
[% USE KohaNews %]
4
[% PROCESS 'html_helpers.inc' %]
3
[% SET OpacLangSelectorMode = Koha.Preference('OpacLangSelectorMode') %]
5
[% SET OpacLangSelectorMode = Koha.Preference('OpacLangSelectorMode') %]
6
[% SET OpacHeader = KohaNews.get( location => "opacheader", lang => lang, library => branchcode, blocktitle => 0 ) %]
4
<div id="wrap">
7
<div id="wrap">
5
    <div class="navbar navbar-inverse navbar-static-top">
8
    <div class="navbar navbar-inverse navbar-static-top">
6
        <div class="navbar-inner">
9
        <div class="navbar-inner">
Lines 24-34 Link Here
24
        </div> <!-- /navbar-inner -->
27
        </div> <!-- /navbar-inner -->
25
    </div> <!-- /navbar -->
28
    </div> <!-- /navbar -->
26
29
27
    [% IF ( opacheader ) %]
30
    [% IF ( OpacHeader ) %]
28
        <div class="container-fluid">
31
        <div class="container-fluid">
29
            <div class="row-fluid">
32
            <div class="row-fluid">
30
                <div id="opacheader">
33
                <div id="opacheader">
31
                    [% opacheader | $raw %]
34
                    [% PROCESS koha_news_block news => OpacHeader %]
32
                </div>
35
                </div>
33
            </div>
36
            </div>
34
        </div>
37
        </div>
(-)a/koha-tmpl/opac-tmpl/bootstrap/en/includes/masthead.inc (-1 / +1 lines)
Lines 4-10 Link Here
4
[% USE Categories %]
4
[% USE Categories %]
5
[% USE KohaNews %]
5
[% USE KohaNews %]
6
[% SET OpacLangSelectorMode = Koha.Preference('OpacLangSelectorMode') %]
6
[% SET OpacLangSelectorMode = Koha.Preference('OpacLangSelectorMode') %]
7
[% SET OpacHeader = KohaNews.get( location => "opacheader", lang => news_lang, library => branchcode, blocktitle => 0 ) %]
7
[% SET OpacHeader = KohaNews.get( location => "opacheader", lang => lang, library => branchcode, blocktitle => 0 ) %]
8
<div id="wrap">
8
<div id="wrap">
9
    <div id="header-region" class="noprint">
9
    <div id="header-region" class="noprint">
10
        <div class="navbar navbar-inverse navbar-static-top">
10
        <div class="navbar navbar-inverse navbar-static-top">
(-)a/koha-tmpl/opac-tmpl/bootstrap/en/modules/maintenance.tt (-2 / +10 lines)
Lines 1-6 Link Here
1
[% USE raw %]
1
[% USE raw %]
2
[% USE Koha %]
2
[% USE Koha %]
3
[% USE KohaNews %]
3
[% INCLUDE 'doc-head-open.inc' %]
4
[% INCLUDE 'doc-head-open.inc' %]
5
[% SET OpacHeader = KohaNews.get( location => "opacheader", lang => lang, library => branchcode, blocktitle => 0 ) %]
4
<title>[% IF ( LibraryNameTitle ) %][% LibraryNameTitle | html %][% ELSE %]Koha online[% END %] catalog</title>
6
<title>[% IF ( LibraryNameTitle ) %][% LibraryNameTitle | html %][% ELSE %]Koha online[% END %] catalog</title>
5
[% INCLUDE 'doc-head-close.inc' %]
7
[% INCLUDE 'doc-head-close.inc' %]
6
[% BLOCK cssinclude %]
8
[% BLOCK cssinclude %]
Lines 21-28 Link Here
21
[% END %]
23
[% END %]
22
</head>
24
</head>
23
<body id="opac_maintenance" class="opac">
25
<body id="opac_maintenance" class="opac">
24
    [% IF ( opacheader ) %]
26
    [% IF ( OpacHeader ) %]
25
        [% opacheader | $raw %]
27
        <div class="container-fluid">
28
            <div class="row-fluid">
29
                <div id="opacheader">
30
                    [% PROCESS koha_news_block news => OpacHeader %]
31
                </div>
32
            </div>
33
        </div>
26
    [% END %]
34
    [% END %]
27
    <div class="container-fluid">
35
    <div class="container-fluid">
28
        <div class="row-fluid">
36
        <div class="row-fluid">
(-)a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-main.tt (-1 / +1 lines)
Lines 42-48 Link Here
42
        </div>
42
        </div>
43
    [% END %]
43
    [% END %]
44
44
45
    [% SET OpacNavRight = KohaNews.get( location => "OpacNavRight", lang => news_lang, library => branchcode ) %]
45
    [% SET OpacNavRight = KohaNews.get( location => "OpacNavRight", lang => lang, library => branchcode ) %]
46
    [% IF ( OpacNav ||  OpacNavBottom  ) && (Koha.Preference( 'opacuserlogin' ) == 1 || OpacNavRight) %]
46
    [% IF ( OpacNav ||  OpacNavBottom  ) && (Koha.Preference( 'opacuserlogin' ) == 1 || OpacNavRight) %]
47
        <div class="span7">
47
        <div class="span7">
48
    [% ELSIF (Koha.Preference( 'opacuserlogin' ) == 1 || OpacNavRight) %]
48
    [% ELSIF (Koha.Preference( 'opacuserlogin' ) == 1 || OpacNavRight) %]
(-)a/koha-tmpl/opac-tmpl/bootstrap/en/modules/sci/sci-main.tt (-8 / +10 lines)
Lines 3-8 Link Here
3
[%# Includes %]
3
[%# Includes %]
4
[% USE Koha %]
4
[% USE Koha %]
5
[% USE KohaDates %]
5
[% USE KohaDates %]
6
[% USE KohaNews %]
6
[%# Helper template functions %]
7
[%# Helper template functions %]
7
[% BLOCK error_message %]
8
[% BLOCK error_message %]
8
    [% IF messages.BadBarcode %]
9
    [% IF messages.BadBarcode %]
Lines 17-23 Link Here
17
        <span>(There was a problem returning this item, please see library staff for assistance)</span>
18
        <span>(There was a problem returning this item, please see library staff for assistance)</span>
18
    [% END %]
19
    [% END %]
19
[% END %]
20
[% END %]
20
21
[% PROCESS 'html_helpers.inc' %]
22
[% SET OpacHeader = KohaNews.get( location => "opacheader", lang => lang, library => branchcode, blocktitle => 0 ) %]
21
[% INCLUDE 'doc-head-open.inc' %]
23
[% INCLUDE 'doc-head-open.inc' %]
22
24
23
<title>[% IF ( LibraryNameTitle ) %][% LibraryNameTitle | html %][% ELSE %]Koha [% END %] &rsaquo; Self check-in</title>
25
<title>[% IF ( LibraryNameTitle ) %][% LibraryNameTitle | html %][% ELSE %]Koha [% END %] &rsaquo; Self check-in</title>
Lines 71-85 Link Here
71
        </div> <!-- /.navbar-inner -->
73
        </div> <!-- /.navbar-inner -->
72
    </div> <!-- /.navbar -->
74
    </div> <!-- /.navbar -->
73
75
74
[% IF Koha.Preference( 'opacheader' ) %]
76
    [% IF ( OpacHeader ) %]
75
    <div class="container-fluid">
77
        <div class="container-fluid">
76
        <div class="row-fluid">
78
            <div class="row-fluid">
77
            <div id="opacheader">
79
                <div id="opacheader">
78
                [% Koha.Preference( 'opacheader' ) | $raw %]
80
                    [% PROCESS koha_news_block news => OpacHeader %]
81
                </div>
79
            </div>
82
            </div>
80
        </div>
83
        </div>
81
    </div>
84
    [% END %]
82
[% END %]
83
85
84
    <div class="main">
86
    <div class="main">
85
        <div class="container-fluid">
87
        <div class="container-fluid">
(-)a/opac/opac-main.pl (-6 / +1 lines)
Lines 48-57 $template->param( Link Here
48
    casAuthentication   => $casAuthentication,
48
    casAuthentication   => $casAuthentication,
49
);
49
);
50
50
51
# display news
52
# use cookie setting for language, bug default to syspref if it's not set
53
my ($theme, $news_lang, $availablethemes) = C4::Templates::themelanguage(C4::Context->config('opachtdocs'),'opac-main.tt','opac',$input);
54
55
my $homebranch;
51
my $homebranch;
56
if (C4::Context->userenv) {
52
if (C4::Context->userenv) {
57
    $homebranch = C4::Context->userenv->{'branch'};
53
    $homebranch = C4::Context->userenv->{'branch'};
Lines 74-80 if (defined $news_id){ Link Here
74
        $template->param( single_news_error => 1 );
70
        $template->param( single_news_error => 1 );
75
    }
71
    }
76
} else {
72
} else {
77
    @all_koha_news   = &GetNewsToDisplay($news_lang,$homebranch);
73
    @all_koha_news   = &GetNewsToDisplay( $template->lang, $homebranch);
78
}
74
}
79
75
80
my $quote = GetDailyQuote();   # other options are to pass in an exact quote id or select a random quote each pass... see perldoc C4::Koha
76
my $quote = GetDailyQuote();   # other options are to pass in an exact quote id or select a random quote each pass... see perldoc C4::Koha
Lines 104-110 if ( $patron ) { Link Here
104
100
105
$template->param(
101
$template->param(
106
    koha_news           => @all_koha_news,
102
    koha_news           => @all_koha_news,
107
    news_lang           => $news_lang,
108
    branchcode          => $homebranch,
103
    branchcode          => $homebranch,
109
    display_daily_quote => C4::Context->preference('QuoteOfTheDay'),
104
    display_daily_quote => C4::Context->preference('QuoteOfTheDay'),
110
    daily_quote         => $quote,
105
    daily_quote         => $quote,
(-)a/t/db_dependent/sysprefs.t (-9 / +8 lines)
Lines 27-45 my $schema = Koha::Database->new->schema; Link Here
27
$schema->storage->txn_begin;
27
$schema->storage->txn_begin;
28
my $dbh = C4::Context->dbh;
28
my $dbh = C4::Context->dbh;
29
29
30
my $opacheader    = C4::Context->preference('opacheader');
30
my $URLLinkText    = C4::Context->preference('URLLinkText');
31
my $newopacheader = "newopacheader";
31
my $newURLLinkText = "newURLLinkText";
32
32
33
C4::Context->set_preference( 'OPACHEADER', $newopacheader );
33
C4::Context->set_preference( 'URLLINKTEXT', $newURLLinkText );
34
is( C4::Context->preference('opacheader'), $newopacheader, 'The pref should have been set correctly' );
34
is( C4::Context->preference('URLLinkText'), $newURLLinkText, 'The pref should have been set correctly' );
35
35
36
C4::Context->set_preference( 'opacheader', $opacheader );
36
C4::Context->set_preference( 'URLLinkText', $URLLinkText );
37
is( C4::Context->preference('OPACHEADER'), $opacheader, 'A pref name should be case insensitive');
37
is( C4::Context->preference('URLLINKTEXT'), $URLLinkText, 'A pref name should be case insensitive');
38
38
39
$ENV{OVERRIDE_SYSPREF_opacheader} = 'this is an override';
39
$ENV{OVERRIDE_SYSPREF_URLLinkText} = 'this is an override';
40
C4::Context->clear_syspref_cache();
40
C4::Context->clear_syspref_cache();
41
is(
41
is(
42
    C4::Context->preference('opacheader'),
42
    C4::Context->preference('URLLinkText'),
43
    'this is an override',
43
    'this is an override',
44
    'system preference value overridden from environment'
44
    'system preference value overridden from environment'
45
);
45
);
46
- 

Return to bug 22880