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

(-)a/installer/data/mysql/atomicupdate/bug_23796-move-OpacCustomSearch-to-news.perl (+30 lines)
Line 0 Link Here
1
$DBversion = 'XXX'; # will be replaced by the RM
2
if( CheckVersion( $DBversion ) ) {
3
4
    # get list of installed translations
5
    require C4::Languages;
6
    my @langs;
7
    my $tlangs = C4::Languages::getTranslatedLanguages();
8
9
    foreach my $language ( @$tlangs ) {
10
        foreach my $sublanguage ( @{$language->{'sublanguages_loop'}} ) {
11
            push @langs, $sublanguage->{'rfc4646_subtag'};
12
        }
13
    }
14
15
    # Get any existing value from the OpacCustomSearch system preference
16
    my ($OpacCustomSearch) = $dbh->selectrow_array( q|
17
        SELECT value FROM systempreferences WHERE variable='OpacCustomSearch';
18
    |);
19
    if( $OpacCustomSearch ){
20
        foreach my $lang ( @langs ) {
21
            print "Inserting OpacCustomSearch contents into $lang news item...\n";
22
            # If there is a value in the OpacCustomSearch preference, insert it into opac_news
23
            $dbh->do("INSERT INTO opac_news (branchcode, lang, title, content ) VALUES (NULL, ?, '', ?)", undef, "OpacCustomSearch_$lang", $OpacCustomSearch);
24
        }
25
    }
26
    # Remove the OpacCustomSearch system preference
27
    $dbh->do("DELETE FROM systempreferences WHERE variable='OpacCustomSearch'");
28
    SetVersion ($DBversion);
29
    print "Upgrade to $DBversion done (Bug 23796: Convert OpacCustomSearch system preference to news block)\n";
30
}
(-)a/installer/data/mysql/sysprefs.sql (-1 lines)
Lines 376-382 INSERT INTO systempreferences ( `variable`, `value`, `options`, `explanation`, ` Link Here
376
('OpacAdditionalStylesheet','','','Define an auxiliary stylesheet for OPAC use, to override specified settings from the primary opac.css stylesheet. Enter the filename (if the file is in the server\'s css directory) or a complete URL beginning with http (if the file lives on a remote server).','free'),
376
('OpacAdditionalStylesheet','','','Define an auxiliary stylesheet for OPAC use, to override specified settings from the primary opac.css stylesheet. Enter the filename (if the file is in the server\'s css directory) or a complete URL beginning with http (if the file lives on a remote server).','free'),
377
('OpacCoce','0', NULL, 'If on, enables cover retrieval from the configured Coce server in the OPAC', 'YesNo'),
377
('OpacCoce','0', NULL, 'If on, enables cover retrieval from the configured Coce server in the OPAC', 'YesNo'),
378
('OPACCustomCoverImages','0',NULL,'If enabled, the custom cover images will be displayed at the OPAC. CustomCoverImagesURL must be defined.','YesNo'),
378
('OPACCustomCoverImages','0',NULL,'If enabled, the custom cover images will be displayed at the OPAC. CustomCoverImagesURL must be defined.','YesNo'),
379
('OpacCustomSearch','','70|10','Replace the search box on the OPAC with the provided HTML','Textarea'),
380
('opaccredits','','70|10','Define HTML Credits at the bottom of the OPAC page','Textarea'),
379
('opaccredits','','70|10','Define HTML Credits at the bottom of the OPAC page','Textarea'),
381
('OPACdefaultSortField','relevance','relevance|popularity|call_number|pubdate|acqdate|title|author','Specify the default field used for sorting','Choice'),
380
('OPACdefaultSortField','relevance','relevance|popularity|call_number|pubdate|acqdate|title|author','Specify the default field used for sorting','Choice'),
382
('OPACdefaultSortOrder','dsc','asc|dsc|za|az','Specify the default sort order','Choice'),
381
('OPACdefaultSortOrder','dsc','asc|dsc|za|az','Specify the default sort order','Choice'),
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/opac.pref (-6 lines)
Lines 364-375 OPAC: Link Here
364
              syntax: text/html
364
              syntax: text/html
365
              class: code
365
              class: code
366
        -
366
        -
367
            - "Replace the search box at the top of OPAC pages with the following HTML:"
368
            - pref: OpacCustomSearch
369
              type: textarea
370
              syntax: text/html
371
              class: code
372
        -
373
            - "Display language selector on "
367
            - "Display language selector on "
374
            - pref: OpacLangSelectorMode
368
            - pref: OpacLangSelectorMode
375
              choices:
369
              choices:
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/tools/koha-news.tt (-1 / +1 lines)
Lines 331-337 Edit news item[% ELSE %]Add news item[% END %][% ELSE %]News[% END %]</div> Link Here
331
    [% END %]
331
    [% END %]
332
    [% FOREACH lang_lis IN lang_list %]
332
    [% FOREACH lang_lis IN lang_list %]
333
        <optgroup label="[% lang_lis.language | html %]">
333
        <optgroup label="[% lang_lis.language | html %]">
334
            [% FOREACH location IN [ '', 'OpacNavRight', 'opacheader' ] %]
334
            [% FOREACH location IN [ '', 'OpacNavRight', 'opacheader', 'OpacCustomSearch' ] %]
335
                [% IF ( location == '' ) %]
335
                [% IF ( location == '' ) %]
336
                    [% SET location_lang = lang_lis.language %]
336
                    [% SET location_lang = lang_lis.language %]
337
                    [% location = BLOCK %]OPAC news[% END %]
337
                    [% location = BLOCK %]OPAC news[% END %]
(-)a/koha-tmpl/opac-tmpl/bootstrap/en/includes/masthead.inc (-5 / +5 lines)
Lines 6-11 Link Here
6
[% PROCESS 'html_helpers.inc' %]
6
[% PROCESS 'html_helpers.inc' %]
7
[% SET OpacLangSelectorMode = Koha.Preference('OpacLangSelectorMode') %]
7
[% SET OpacLangSelectorMode = Koha.Preference('OpacLangSelectorMode') %]
8
[% SET OpacHeader = KohaNews.get( location => "opacheader", lang => lang, library => branchcode, blocktitle => 0 ) %]
8
[% SET OpacHeader = KohaNews.get( location => "opacheader", lang => lang, library => branchcode, blocktitle => 0 ) %]
9
[% SET OpacCustomSearch = KohaNews.get( location => "OpacCustomSearch", lang => lang, library => branchcode, blocktitle => 0 ) %]
9
10
10
<div id="wrap">
11
<div id="wrap">
11
    <div id="header-region" class="noprint">
12
    <div id="header-region" class="noprint">
Lines 168-174 Link Here
168
                        [% ELSE %]
169
                        [% ELSE %]
169
                            <div class="mastheadsearch">
170
                            <div class="mastheadsearch">
170
                        [% END %]
171
                        [% END %]
171
                        [% IF Koha.Preference('OpacCustomSearch') == '' %]
172
                        [% IF ( OpacCustomSearch ) %]
173
                            [% PROCESS koha_news_block news => OpacCustomSearch %]
174
                        [% ELSE %]
172
                            <form name="searchform" method="get" action="/cgi-bin/koha/opac-search.pl" id="searchform" class="form-inline">
175
                            <form name="searchform" method="get" action="/cgi-bin/koha/opac-search.pl" id="searchform" class="form-inline">
173
                                <label for="masthead_search"> Search
176
                                <label for="masthead_search"> Search
174
                                    [% UNLESS ( Koha.Preference( 'OpacAddMastheadLibraryPulldown' ) == 1 ) %]
177
                                    [% UNLESS ( Koha.Preference( 'OpacAddMastheadLibraryPulldown' ) == 1 ) %]
Lines 290-298 Link Here
290
                                [% END # / OpacAddMastheadLibraryPulldown %]
293
                                [% END # / OpacAddMastheadLibraryPulldown %]
291
294
292
                            </form>
295
                            </form>
293
                        [% ELSE # / Koha.Preference('OpacCustomSearch') == '' %]
296
                        [% END # / ( OpacCustomSearch ) %]
294
                            [% Koha.Preference('OpacCustomSearch') | $raw %]
295
                        [% END # / Koha.Preference('OpacCustomSearch') == '' %]
296
                        </div> <!-- / .mastheadsearch -->
297
                        </div> <!-- / .mastheadsearch -->
297
                    [% END # / UNLESS advsearch %]
298
                    [% END # / UNLESS advsearch %]
298
299
299
- 

Return to bug 23796