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 (+19 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
}
19
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/opac.pref (-6 lines)
Lines 237-248 OPAC: Link Here
237
              syntax: text/html
237
              syntax: text/html
238
              class: code
238
              class: code
239
        -
239
        -
240
            - "Include the following HTML in the header of all pages in the OPAC:"
241
            - pref: opacheader
242
              type: textarea
243
              syntax: text/html
244
              class: code
245
        -
246
            - "Include the following HTML in the footer of all pages in the OPAC:"
240
            - "Include the following HTML in the footer of all pages in the OPAC:"
247
            - pref: opaccredits
241
            - pref: opaccredits
248
              type: textarea
242
              type: textarea
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/tools/koha-news.tt (-1 / +1 lines)
Lines 278-284 Edit news item[% ELSE %]Add news item[% END %][% ELSE %]News[% END %]</div> Link Here
278
    [% END %]
278
    [% END %]
279
    [% FOREACH lang_lis IN lang_list %]
279
    [% FOREACH lang_lis IN lang_list %]
280
        <optgroup label="[% lang_lis.language | html %]">
280
        <optgroup label="[% lang_lis.language | html %]">
281
            [% FOREACH location IN [ '', 'OpacNavRight' ] %]
281
            [% FOREACH location IN [ '', 'OpacNavRight', 'opacheader' ] %]
282
                [% IF ( location == '' ) %]
282
                [% IF ( location == '' ) %]
283
                    [% SET location_lang = lang_lis.language %]
283
                    [% SET location_lang = lang_lis.language %]
284
                    [% SET location = "OPAC news" %]
284
                    [% SET location = "OPAC news" %]
(-)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 (-9 / +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 122-136 Link Here
122
            </div> <!-- /navbar-inner -->
123
            </div> <!-- /navbar-inner -->
123
        </div> <!-- /navbar -->
124
        </div> <!-- /navbar -->
124
125
125
        [% IF ( opacheader ) %]
126
        [% PROCESS koha_news_block news => KohaNews.get( location => "opacheader", lang => news_lang, library => branchcode, blocktitle => 0 ) %]
126
            <div class="container-fluid">
127
127
                <div class="row-fluid">
128
                    <div id="opacheader">
129
                        [% opacheader | $raw %]
130
                    </div>
131
                </div>
132
            </div>
133
        [% END %]
134
    </div> <!-- / header-region -->
128
    </div> <!-- / header-region -->
135
129
136
    <div class="container-fluid">
130
    <div class="container-fluid">
(-)a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-main.tt (-2 / +1 lines)
Lines 213-219 Link Here
213
                        [% END %]
213
                        [% END %]
214
                    [% END # /loggedinusername %]
214
                    [% END # /loggedinusername %]
215
                [% END # /opacuserlogin %]
215
                [% END # /opacuserlogin %]
216
                [% PROCESS koha_news_block news => KohaNews.get( location => "OpacNavRight", lang => news_lang, library => branchcode ) %]
216
                [% PROCESS koha_news_block news => KohaNews.get( location => "OpacNavRight", lang => news_lang, library => branchcode, blocktitle => 1 ) %]
217
            </div> <!-- / .span3 -->
217
            </div> <!-- / .span3 -->
218
        [% END # /opacuserlogin || OpacNavRight %]
218
        [% END # /opacuserlogin || OpacNavRight %]
219
219
220
- 

Return to bug 22880