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

(-)a/Koha/Template/Plugin/KohaNews.pm (-1 / +6 lines)
Lines 32-37 sub get { Link Here
32
    my ( $self, $params ) = @_;
32
    my ( $self, $params ) = @_;
33
33
34
    my $display_location = $params->{location};
34
    my $display_location = $params->{location};
35
    my $blocktitle = $params->{blocktitle};
35
    my $lang = $params->{lang};
36
    my $lang = $params->{lang};
36
    my $library = $params->{library} || "";
37
    my $library = $params->{library} || "";
37
    my $news_lang;
38
    my $news_lang;
Lines 44-50 sub get { Link Here
44
45
45
    my $content = &GetNewsToDisplay( $news_lang, $library );
46
    my $content = &GetNewsToDisplay( $news_lang, $library );
46
47
47
    return $content;
48
    return {
49
        content => $content,
50
        location => $display_location,
51
        blocktitle => $blocktitle
52
    };
48
}
53
}
49
54
50
1;
55
1;
(-)a/installer/data/mysql/atomicupdate/bug_22880-move-opacheader-to-news.perl (+18 lines)
Line 0 Link Here
1
$DBversion = 'XXX'; # will be replaced by the RM
2
if( CheckVersion( $DBversion ) ) {
3
    my $opaclang = C4::Context->preference("opaclanguages");
4
    my @langs;
5
    push @langs, split ( '\,', $opaclang );
6
    # Get any existing value from the opacheader system preference
7
    my ($opacheader) = $dbh->selectrow_array( q|
8
        SELECT value FROM systempreferences WHERE variable='opacheader';
9
    |);
10
    if( $opacheader ){
11
        # If there is a value in the opacheader preference, insert it into opac_news
12
        $dbh->do("INSERT INTO opac_news (branchcode, lang, title, content ) VALUES (NULL, 'opacheader_$langs[0]', '', '$opacheader')");
13
    }
14
    # Remove the opacheader system preference
15
    $dbh->do("DELETE FROM systempreferences WHERE variable='opacheader'");
16
    SetVersion ($DBversion);
17
    print "Upgrade to $DBversion done (Bug 22880: Move contents of opacheader preference to Koha news system)\n";
18
}
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/opac.pref (-6 lines)
Lines 251-262 OPAC: Link Here
251
              syntax: text/html
251
              syntax: text/html
252
              class: code
252
              class: code
253
        -
253
        -
254
            - "Include the following HTML in the header of all pages in the OPAC:"
255
            - pref: opacheader
256
              type: textarea
257
              syntax: text/html
258
              class: code
259
        -
260
            - "Include the following HTML in the footer of all pages in the OPAC:"
254
            - "Include the following HTML in the footer of all pages in the OPAC:"
261
            - pref: opaccredits
255
            - pref: opaccredits
262
              type: textarea
256
              type: textarea
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/tools/koha-news.tt (-1 / +1 lines)
Lines 327-333 Edit news item[% ELSE %]Add news item[% END %][% ELSE %]News[% END %]</div> Link Here
327
    [% END %]
327
    [% END %]
328
    [% FOREACH lang_lis IN lang_list %]
328
    [% FOREACH lang_lis IN lang_list %]
329
        <optgroup label="[% lang_lis.language | html %]">
329
        <optgroup label="[% lang_lis.language | html %]">
330
            [% FOREACH location IN [ '', 'OpacNavRight' ] %]
330
            [% FOREACH location IN [ '', 'OpacNavRight', 'opacheader' ] %]
331
                [% IF ( location == '' ) %]
331
                [% IF ( location == '' ) %]
332
                    [% SET location_lang = lang_lis.language %]
332
                    [% SET location_lang = lang_lis.language %]
333
                    [% location = BLOCK %]OPAC news[% END %]
333
                    [% location = BLOCK %]OPAC news[% END %]
(-)a/koha-tmpl/opac-tmpl/bootstrap/en/includes/html_helpers.inc (-9 / +11 lines)
Lines 9-22 Link Here
9
[% END %]
9
[% END %]
10
10
11
[% BLOCK koha_news_block %]
11
[% BLOCK koha_news_block %]
12
    [% IF ( news.size > 0 ) %]
12
    [% IF ( news.content.size > 0 ) %]
13
        [% FOREACH n IN news %]
13
        <div id="[% news.location | html %]">
14
            <div class="[% n.lang | html %]_item">
14
            [% FOREACH n IN news.content %]
15
                [% IF ( n.title ) %]
15
                <div class="[% n.lang | html %]_item">
16
                    <h4 class="[% n.lang | html %]_header">[% n.title | html %]</h4>
16
                    [% IF ( n.title && news.blocktitle ) %]
17
                [% END %]
17
                        <h4 class="[% n.lang | html %]_header">[% n.title | html %]</h4>
18
                <div class="[% n.lang | html %]_body">[% n.content | $raw %]</div>
18
                    [% END %]
19
            </div>
19
                    <div class="[% n.lang | html %]_body">[% n.content | $raw %]</div>
20
        [% END %]
20
                </div>
21
            [% END %]
22
        </div>
21
    [% END %]
23
    [% END %]
22
[% END %]
24
[% END %]
(-)a/koha-tmpl/opac-tmpl/bootstrap/en/includes/masthead.inc (-10 / +3 lines)
Lines 2-7 Link Here
2
[% USE Koha %]
2
[% USE Koha %]
3
[% USE Branches %]
3
[% USE Branches %]
4
[% USE Categories %]
4
[% USE Categories %]
5
[% USE KohaNews %]
5
[% SET OpacLangSelectorMode = Koha.Preference('OpacLangSelectorMode') %]
6
[% SET OpacLangSelectorMode = Koha.Preference('OpacLangSelectorMode') %]
6
<div id="wrap">
7
<div id="wrap">
7
    <div id="header-region" class="noprint">
8
    <div id="header-region" class="noprint">
Lines 143-157 Link Here
143
            </div> <!-- /navbar-inner -->
144
            </div> <!-- /navbar-inner -->
144
        </div> <!-- /navbar -->
145
        </div> <!-- /navbar -->
145
146
146
        [% IF ( opacheader ) %]
147
        [% PROCESS koha_news_block news => KohaNews.get( location => "opacheader", lang => news_lang, library => branchcode, blocktitle => 0 ) %]
147
            <div class="container-fluid">
148
148
                <div class="row-fluid">
149
                    <div id="opacheader">
150
                        [% opacheader | $raw %]
151
                    </div>
152
                </div>
153
            </div>
154
        [% END %]
155
    </div> <!-- / header-region -->
149
    </div> <!-- / header-region -->
156
150
157
    <div class="container-fluid">
151
    <div class="container-fluid">
158
- 

Return to bug 22880