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 401-407 INSERT INTO systempreferences ( `variable`, `value`, `options`, `explanation`, ` Link Here
401
('OPACLocalCoverImages','0','1','Display local cover images on OPAC search and details pages.','YesNo'),
401
('OPACLocalCoverImages','0','1','Display local cover images on OPAC search and details pages.','YesNo'),
402
('OpacLocationBranchToDisplay','holding','holding|home|both','In the OPAC, under location show which branch for Location in the record details.','Choice'),
402
('OpacLocationBranchToDisplay','holding','holding|home|both','In the OPAC, under location show which branch for Location in the record details.','Choice'),
403
('OpacLocationOnDetail','holding','holding|home|both|column','In the OPAC detail, display the shelving location on its own column or under a library columns.',  'Choice'),
403
('OpacLocationOnDetail','holding','holding|home|both|column','In the OPAC detail, display the shelving location on its own column or under a library columns.',  'Choice'),
404
('OpacLoginInstructions', '', '60|10', 'Instructions to display on the OPAC login form when a patron is not logged in', 'Textarea'),
405
('OpacMaintenance','0','','If ON, enables maintenance warning in OPAC','YesNo'),
404
('OpacMaintenance','0','','If ON, enables maintenance warning in OPAC','YesNo'),
406
('OpacMaintenanceNotice','','','A user-defined block of HTML to appear on screen when OpacMaintenace is enabled','Textarea'),
405
('OpacMaintenanceNotice','','','A user-defined block of HTML to appear on screen when OpacMaintenace is enabled','Textarea'),
407
('OpacMainUserBlock','Welcome to Koha...\r\n<hr>','70|10','A user-defined block of HTML  in the main content area of the opac main page','Textarea'),
406
('OpacMainUserBlock','Welcome to Koha...\r\n<hr>','70|10','A user-defined block of HTML  in the main content area of the opac main page','Textarea'),
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/opac.pref (-6 lines)
Lines 351-362 OPAC: Link Here
351
              class: integer
351
              class: integer
352
            - 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).
352
            - 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
        -
353
        -
354
            - "Show the following HTML on the OPAC login form when a patron is not logged in:"
355
            - pref: OpacLoginInstructions
356
              type: textarea
357
              syntax: text/html
358
              class: code
359
        -
360
            - "Replace the search box at the top of OPAC pages with the following HTML:"
354
            - "Replace the search box at the top of OPAC pages with the following HTML:"
361
            - pref: OpacCustomSearch
355
            - pref: OpacCustomSearch
362
              type: textarea
356
              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', 'opacheader' ] %]
330
            [% FOREACH location IN [ '', 'OpacNavRight', 'opacheader', 'OpacLoginInstructions' ] %]
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/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 5-10 Link Here
5
[% USE Categories %]
5
[% USE Categories %]
6
[% USE Price %]
6
[% USE Price %]
7
[% USE KohaNews %]
7
[% USE KohaNews %]
8
[% SET OpacLoginInstructions = KohaNews.get( location => "OpacLoginInstructions", lang => lang, library => branchcode ) %]
8
[% INCLUDE 'doc-head-open.inc' %]
9
[% INCLUDE 'doc-head-open.inc' %]
9
<title>[% IF ( LibraryNameTitle ) %][% LibraryNameTitle | html %][% ELSE %]Koha online[% END %] catalog</title>
10
<title>[% IF ( LibraryNameTitle ) %][% LibraryNameTitle | html %][% ELSE %]Koha online[% END %] catalog</title>
10
[% INCLUDE 'doc-head-close.inc' %]
11
[% INCLUDE 'doc-head-close.inc' %]
Lines 170-178 Link Here
170
                                        <fieldset class="action">
171
                                        <fieldset class="action">
171
                                            <input type="submit" value="Log in" class="btn" />
172
                                            <input type="submit" value="Log in" class="btn" />
172
                                        </fieldset>
173
                                        </fieldset>
173
                                        [% IF Koha.Preference( 'OpacLoginInstructions' ) %]
174
                                        [% IF ( OpacLoginInstructions ) %]
174
                                            <div id="nologininstructions-main" class="nologininstructions">
175
                                            <div id="nologininstructions-main" class="nologininstructions">
175
                                                [% Koha.Preference( 'OpacLoginInstructions' ) | $raw %]
176
                                                [% PROCESS koha_news_block news => OpacLoginInstructions %]
176
                                            </div>
177
                                            </div>
177
                                        [% END %]
178
                                        [% END %]
178
                                        [% IF Koha.Preference('OpacPasswordChange') && Categories.can_any_reset_password %]
179
                                        [% IF Koha.Preference('OpacPasswordChange') && Categories.can_any_reset_password %]
179
- 

Return to bug 23797