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 370-376 INSERT INTO systempreferences ( `variable`, `value`, `options`, `explanation`, ` Link Here
370
('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'),
370
('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'),
371
('OpacCoce','0', NULL, 'If on, enables cover retrieval from the configured Coce server in the OPAC', 'YesNo'),
371
('OpacCoce','0', NULL, 'If on, enables cover retrieval from the configured Coce server in the OPAC', 'YesNo'),
372
('OPACCustomCoverImages','0',NULL,'If enabled, the custom cover images will be displayed at the OPAC. CustomCoverImagesURL must be defined.','YesNo'),
372
('OPACCustomCoverImages','0',NULL,'If enabled, the custom cover images will be displayed at the OPAC. CustomCoverImagesURL must be defined.','YesNo'),
373
('OpacCustomSearch','','70|10','Replace the search box on the OPAC with the provided HTML','Textarea'),
374
('opaccredits','','70|10','Define HTML Credits at the bottom of the OPAC page','Textarea'),
373
('opaccredits','','70|10','Define HTML Credits at the bottom of the OPAC page','Textarea'),
375
('OPACdefaultSortField','relevance','relevance|popularity|call_number|pubdate|acqdate|title|author','Specify the default field used for sorting','Choice'),
374
('OPACdefaultSortField','relevance','relevance|popularity|call_number|pubdate|acqdate|title|author','Specify the default field used for sorting','Choice'),
376
('OPACdefaultSortOrder','dsc','asc|dsc|za|az','Specify the default sort order','Choice'),
375
('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 357-368 OPAC: Link Here
357
              syntax: text/html
357
              syntax: text/html
358
              class: code
358
              class: code
359
        -
359
        -
360
            - "Replace the search box at the top of OPAC pages with the following HTML:"
361
            - pref: OpacCustomSearch
362
              type: textarea
363
              syntax: text/html
364
              class: code
365
        -
366
            - "Display language selector on "
360
            - "Display language selector on "
367
            - pref: OpacLangSelectorMode
361
            - pref: OpacLangSelectorMode
368
              choices:
362
              choices:
(-)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', 'opacheader' ] %]
330
            [% FOREACH location IN [ '', 'OpacNavRight', 'opacheader', 'OpacCustomSearch' ] %]
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/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 170-176 Link Here
170
                        [% ELSE %]
171
                        [% ELSE %]
171
                            <div class="mastheadsearch">
172
                            <div class="mastheadsearch">
172
                        [% END %]
173
                        [% END %]
173
                        [% IF Koha.Preference('OpacCustomSearch') == '' %]
174
                        [% IF ( OpacCustomSearch ) %]
175
                            [% PROCESS koha_news_block news => OpacCustomSearch %]
176
                        [% ELSE %]
174
                            <form name="searchform" method="get" action="/cgi-bin/koha/opac-search.pl" id="searchform" class="form-inline">
177
                            <form name="searchform" method="get" action="/cgi-bin/koha/opac-search.pl" id="searchform" class="form-inline">
175
                                <label for="masthead_search"> Search
178
                                <label for="masthead_search"> Search
176
                                    [% UNLESS ( Koha.Preference( 'OpacAddMastheadLibraryPulldown' ) == 1 ) %]
179
                                    [% UNLESS ( Koha.Preference( 'OpacAddMastheadLibraryPulldown' ) == 1 ) %]
Lines 292-300 Link Here
292
                                [% END # / OpacAddMastheadLibraryPulldown %]
295
                                [% END # / OpacAddMastheadLibraryPulldown %]
293
296
294
                            </form>
297
                            </form>
295
                        [% ELSE # / Koha.Preference('OpacCustomSearch') == '' %]
298
                        [% END # / ( OpacCustomSearch ) %]
296
                            [% Koha.Preference('OpacCustomSearch') | $raw %]
297
                        [% END # / Koha.Preference('OpacCustomSearch') == '' %]
298
                        </div> <!-- / .mastheadsearch -->
299
                        </div> <!-- / .mastheadsearch -->
299
                    [% END # / UNLESS advsearch %]
300
                    [% END # / UNLESS advsearch %]
300
301
301
- 

Return to bug 23796