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

(-)a/installer/data/mysql/atomicupdate/bug_23797-move-OpacLoginInstructions-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 OpacLoginInstructions system preference
16
    my ($opaclogininstructions) = $dbh->selectrow_array( q|
17
        SELECT value FROM systempreferences WHERE variable='OpacLoginInstructions';
18
    |);
19
    if( $opaclogininstructions ){
20
        foreach my $lang ( @langs ) {
21
            print "Inserting OpacLoginInstructions contents into $lang news item...\n";
22
            # If there is a value in the OpacLoginInstructions preference, insert it into opac_news
23
            $dbh->do("INSERT INTO opac_news (branchcode, lang, title, content ) VALUES (NULL, ?, '', ?)", undef, "OpacLoginInstructions_$lang", $opaclogininstructions);
24
        }
25
    }
26
    # Remove the OpacLoginInstructions system preference
27
    $dbh->do("DELETE FROM systempreferences WHERE variable='OpacLoginInstructions'");
28
    SetVersion ($DBversion);
29
    print "Upgrade to $DBversion done (Bug 23797: Convert OpacLoginInstructions system preference to news block)\n";
30
}
(-)a/installer/data/mysql/sysprefs.sql (-1 lines)
Lines 406-412 INSERT INTO systempreferences ( `variable`, `value`, `options`, `explanation`, ` Link Here
406
('OPACLocalCoverImages','0','1','Display local cover images on OPAC search and details pages.','YesNo'),
406
('OPACLocalCoverImages','0','1','Display local cover images on OPAC search and details pages.','YesNo'),
407
('OpacLocationBranchToDisplay','holding','holding|home|both','In the OPAC, under location show which branch for Location in the record details.','Choice'),
407
('OpacLocationBranchToDisplay','holding','holding|home|both','In the OPAC, under location show which branch for Location in the record details.','Choice'),
408
('OpacLocationOnDetail','holding','holding|home|both|column','In the OPAC detail, display the shelving location on its own column or under a library columns.',  'Choice'),
408
('OpacLocationOnDetail','holding','holding|home|both|column','In the OPAC detail, display the shelving location on its own column or under a library columns.',  'Choice'),
409
('OpacLoginInstructions', '', '60|10', 'Instructions to display on the OPAC login form when a patron is not logged in', 'Textarea'),
410
('OpacMaintenance','0','','If ON, enables maintenance warning in OPAC','YesNo'),
409
('OpacMaintenance','0','','If ON, enables maintenance warning in OPAC','YesNo'),
411
('OpacMaintenanceNotice','','','A user-defined block of HTML to appear on screen when OpacMaintenace is enabled','Textarea'),
410
('OpacMaintenanceNotice','','','A user-defined block of HTML to appear on screen when OpacMaintenace is enabled','Textarea'),
412
('OpacMaxItemsToDisplay','50','','Max items to display at the OPAC on a biblio detail','Integer'),
411
('OpacMaxItemsToDisplay','50','','Max items to display at the OPAC on a biblio detail','Integer'),
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/opac.pref (-6 lines)
Lines 352-363 OPAC: Link Here
352
              class: integer
352
              class: integer
353
            - items on the bibliographic record detail page (if the bibliographic record has more items than this, a link is displayed instead that allows the user to choose to display all items).
353
            - items on the bibliographic record detail page (if the bibliographic record has more items than this, a link is displayed instead that allows the user to choose to display all items).
354
        -
354
        -
355
            - "Show the following HTML on the OPAC login form when a patron is not logged in:"
356
            - pref: OpacLoginInstructions
357
              type: textarea
358
              syntax: text/html
359
              class: code
360
        -
361
            - "Replace the search box at the top of OPAC pages with the following HTML:"
355
            - "Replace the search box at the top of OPAC pages with the following HTML:"
362
            - pref: OpacCustomSearch
356
            - pref: OpacCustomSearch
363
              type: textarea
357
              type: textarea
(-)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', 'OpacMainUserBlock' ] %]
334
            [% FOREACH location IN [ '', 'OpacNavRight', 'opacheader', 'OpacMainUserBlock', 'OpacLoginInstructions' ] %]
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/modules/opac-auth.tt (-2 / +5 lines)
Lines 1-6 Link Here
1
[% USE raw %]
1
[% USE raw %]
2
[% USE Koha %]
2
[% USE Koha %]
3
[% USE Categories %]
3
[% USE Categories %]
4
[% USE KohaNews %]
5
[% PROCESS 'html_helpers.inc' %]
6
[% SET OpacLoginInstructions = KohaNews.get( location => "OpacLoginInstructions", lang => lang, library => branchcode ) %]
4
[% INCLUDE 'doc-head-open.inc' %]
7
[% INCLUDE 'doc-head-open.inc' %]
5
<title>[% IF ( LibraryNameTitle ) %][% LibraryNameTitle | html %][% ELSE %]Koha online[% END %] catalog &rsaquo;
8
<title>[% IF ( LibraryNameTitle ) %][% LibraryNameTitle | html %][% ELSE %]Koha online[% END %] catalog &rsaquo;
6
[% IF Koha.Preference( 'opacuserlogin' ) == 1 %]
9
[% IF Koha.Preference( 'opacuserlogin' ) == 1 %]
Lines 176-183 Link Here
176
                                </div>
179
                                </div>
177
                            [% END %]
180
                            [% END %]
178
                            <div id="nologininstructions">
181
                            <div id="nologininstructions">
179
                            [% IF Koha.Preference('OpacLoginInstructions') %]
182
                            [% IF ( OpacLoginInstructions ) %]
180
                                [% Koha.Preference('OpacLoginInstructions') | $raw %]
183
                                [% PROCESS koha_news_block news => OpacLoginInstructions %]
181
                            [% ELSE %]
184
                            [% ELSE %]
182
                                <h5>Don't have a password yet?</h5>
185
                                <h5>Don't have a password yet?</h5>
183
                                <p>If you don't have a password yet, stop by the circulation desk the next time you're in the library. We'll happily set one up for you.</p>
186
                                <p>If you don't have a password yet, stop by the circulation desk the next time you're in the library. We'll happily set one up for you.</p>
(-)a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-main.tt (-3 / +3 lines)
Lines 7-12 Link Here
7
[% USE KohaNews %]
7
[% USE KohaNews %]
8
[% SET OpacNavRight = KohaNews.get( location => "OpacNavRight", lang => lang, library => branchcode ) %]
8
[% SET OpacNavRight = KohaNews.get( location => "OpacNavRight", lang => lang, library => branchcode ) %]
9
[% SET OpacMainUserBlock = KohaNews.get( location => "OpacMainUserBlock", lang => lang, library => branchcode ) %]
9
[% SET OpacMainUserBlock = KohaNews.get( location => "OpacMainUserBlock", lang => lang, library => branchcode ) %]
10
[% SET OpacLoginInstructions = KohaNews.get( location => "OpacLoginInstructions", lang => lang, library => branchcode ) %]
10
[% INCLUDE 'doc-head-open.inc' %]
11
[% INCLUDE 'doc-head-open.inc' %]
11
<title>[% IF ( LibraryNameTitle ) %][% LibraryNameTitle | html %][% ELSE %]Koha online[% END %] catalog</title>
12
<title>[% IF ( LibraryNameTitle ) %][% LibraryNameTitle | html %][% ELSE %]Koha online[% END %] catalog</title>
12
[% INCLUDE 'doc-head-close.inc' %]
13
[% INCLUDE 'doc-head-close.inc' %]
Lines 175-183 Link Here
175
                                        <fieldset class="action">
176
                                        <fieldset class="action">
176
                                            <input type="submit" value="Log in" class="btn" />
177
                                            <input type="submit" value="Log in" class="btn" />
177
                                        </fieldset>
178
                                        </fieldset>
178
                                        [% IF Koha.Preference( 'OpacLoginInstructions' ) %]
179
                                        [% IF ( OpacLoginInstructions ) %]
179
                                            <div id="nologininstructions-main" class="nologininstructions">
180
                                            <div id="nologininstructions-main" class="nologininstructions">
180
                                                [% Koha.Preference( 'OpacLoginInstructions' ) | $raw %]
181
                                                [% PROCESS koha_news_block news => OpacLoginInstructions %]
181
                                            </div>
182
                                            </div>
182
                                        [% END %]
183
                                        [% END %]
183
                                        [% IF Koha.Preference('OpacPasswordChange') && Categories.can_any_reset_password %]
184
                                        [% IF Koha.Preference('OpacPasswordChange') && Categories.can_any_reset_password %]
184
- 

Return to bug 23797