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

(-)a/installer/data/mysql/atomicupdate/bug-23798-move-OpacMaintenanceNotice-to-additional-contents.pl (+31 lines)
Line 0 Link Here
1
use Modern::Perl;
2
3
return {
4
    bug_number  => "23798",
5
    description => "Convert OpacMaintenanceNotice system preference to additional contents",
6
    up          => sub {
7
        my ($args) = @_;
8
        my ( $dbh, $out ) = @$args{qw(dbh out)};
9
10
        # Get any existing value from the OpacMaintenanceNotice system preference
11
        my ($opacmaintenancenotice) = $dbh->selectrow_array(
12
            q|
13
            SELECT value FROM systempreferences WHERE variable='OpacMaintenanceNotice';
14
        |
15
        );
16
        if ($opacmaintenancenotice) {
17
18
            # Insert any values found from system preference into additional_contents
19
            foreach my $lang ('default') {
20
                $dbh->do(
21
                    "INSERT INTO additional_contents ( category, code, location, branchcode, title, content, lang, published_on ) VALUES ('html_customizations', 'OpacMaintenanceNotice', 'OpacMaintenanceNotice', NULL, ?, ?, ?, CAST(NOW() AS date) )",
22
                    undef, "OpacMaintenanceNotice $lang", $opacmaintenancenotice, $lang
23
                );
24
            }
25
26
            # Remove old system preference
27
            $dbh->do("DELETE FROM systempreferences WHERE variable='OpacMaintenanceNotice'");
28
            say $out "Bug 23798 update done";
29
        }
30
    }
31
    }
(-)a/installer/data/mysql/mandatory/sysprefs.sql (-1 lines)
Lines 480-486 INSERT INTO systempreferences ( `variable`, `value`, `options`, `explanation`, ` Link Here
480
('OpacLocationOnDetail','holding','holding|home|both|column','In the OPAC detail, display the shelving location on its own column or under a library columns.',  'Choice'),
480
('OpacLocationOnDetail','holding','holding|home|both|column','In the OPAC detail, display the shelving location on its own column or under a library columns.',  'Choice'),
481
('OPACMandatoryHoldDates', '', '|start|end|both', 'Define which hold dates are required on OPAC reserve form', 'Choice'),
481
('OPACMandatoryHoldDates', '', '|start|end|both', 'Define which hold dates are required on OPAC reserve form', 'Choice'),
482
('OpacMaintenance','0','','If ON, enables maintenance warning in OPAC','YesNo'),
482
('OpacMaintenance','0','','If ON, enables maintenance warning in OPAC','YesNo'),
483
('OpacMaintenanceNotice','','','A user-defined block of HTML to appear on screen when OpacMaintenace is enabled','Textarea'),
484
('OpacMaxItemsToDisplay','50','','Max items to display at the OPAC on a biblio detail','Integer'),
483
('OpacMaxItemsToDisplay','50','','Max items to display at the OPAC on a biblio detail','Integer'),
485
('OpacMetaDescription','','','This description will show in search engine results (160 characters).','Textarea'),
484
('OpacMetaDescription','','','This description will show in search engine results (160 characters).','Textarea'),
486
('OPACMySummaryHTML','','70|10','Enter the HTML that will appear in a column on the \'my summary\' and \'my checkout history\' tabs when a user is logged in to the OPAC. Enter {BIBLIONUMBER}, {TITLE}, {AUTHOR}, or {ISBN} in place of their respective variables in the HTML. Leave blank to disable.','Textarea'),
485
('OPACMySummaryHTML','','70|10','Enter the HTML that will appear in a column on the \'my summary\' and \'my checkout history\' tabs when a user is logged in to the OPAC. Enter {BIBLIONUMBER}, {TITLE}, {AUTHOR}, or {ISBN} in place of their respective variables in the HTML. Leave blank to disable.','Textarea'),
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/opac.pref (-7 / +1 lines)
Lines 55-67 OPAC: Link Here
55
              choices:
55
              choices:
56
                  1: Show
56
                  1: Show
57
                  0: "Don't show"
57
                  0: "Don't show"
58
            - "a warning that the OPAC is under maintenance, instead of the OPAC itself. Note: this shows the same warning as when the database needs to be upgraded, but unconditionally."
58
            - "a warning that the OPAC is under maintenance, instead of the OPAC itself. Note: this shows the same warning as when the database needs to be upgraded, but unconditionally. A custom message can be shown on OPAC maintenance page by creating an <a href='/cgi-bin/koha/tools/additional-contents.pl?category=html_customizations'>HTML customization</a> in the OpacMaintenanceNotice region."
59
        -
60
            - 'Show the following HTML when <a href="/cgi-bin/koha/admin/preferences.pl?op=search&searchfield=OpacMaintenance">OpacMaintenance</a> is enabled:'
61
            - pref: OpacMaintenanceNotice
62
              type: textarea
63
              syntax: text/html
64
              class: code
65
        -
59
        -
66
            - "This description will show in search engine results (160 characters)."
60
            - "This description will show in search engine results (160 characters)."
67
            - pref: OpacMetaDescription
61
            - pref: OpacMetaDescription
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/tools/additional-contents.tt (-1 / +1 lines)
Lines 523-529 Link Here
523
            [% END %]
523
            [% END %]
524
        [% END %]
524
        [% END %]
525
    [% ELSE %]
525
    [% ELSE %]
526
        [% SET available_options = [ 'OpacNavRight', 'opacheader', 'OpacCustomSearch', 'OpacMainUserBlock', 'opaccredits', 'OpacLoginInstructions', 'OpacNav', 'OpacNavBottom', 'OpacSuggestionInstructions', 'ArticleRequestsDisclaimerText', 'OpacMoreSearches', 'OpacMySummaryNote', 'OpacLibraryInfo', 'CatalogConcernHelp', 'CatalogConcernTemplate', 'CookieConsentBar', 'CookieConsentPopup' ] %]
526
        [% SET available_options = [ 'OpacNavRight', 'opacheader', 'OpacCustomSearch', 'OpacMainUserBlock', 'opaccredits', 'OpacLoginInstructions', 'OpacNav', 'OpacNavBottom', 'OpacSuggestionInstructions', 'ArticleRequestsDisclaimerText', 'OpacMoreSearches', 'OpacMySummaryNote', 'OpacLibraryInfo', 'CatalogConcernHelp', 'CatalogConcernTemplate', 'CookieConsentBar', 'CookieConsentPopup', 'OpacMaintenanceNotice' ] %]
527
        [% FOREACH l IN available_options.sort %]
527
        [% FOREACH l IN available_options.sort %]
528
            [% IF l == location %]
528
            [% IF l == location %]
529
                <option value="[% l | html %]" selected="selected">[% l | html %]</option>
529
                <option value="[% l | html %]" selected="selected">[% l | html %]</option>
(-)a/koha-tmpl/opac-tmpl/bootstrap/en/includes/opac-bottom.inc (-2 / +2 lines)
Lines 54-61 Link Here
54
    </div> <!-- / #wrapper in masthead.inc -->
54
    </div> <!-- / #wrapper in masthead.inc -->
55
55
56
    [% IF OpacLangSelectorMode == 'both' || OpacLangSelectorMode == 'footer' %]
56
    [% IF OpacLangSelectorMode == 'both' || OpacLangSelectorMode == 'footer' %]
57
        [% IF ( opaclanguagesdisplay ) %]
57
        [% IF ( Koha.Preference('opaclanguagesdisplay') ) %]
58
            [% IF ( languages_loop && opaclanguagesdisplay ) %]
58
            [% IF ( languages_loop ) %]
59
                [% UNLESS ( one_language_enabled ) %]
59
                [% UNLESS ( one_language_enabled ) %]
60
                    <footer id="changelanguage"  class="noprint">
60
                    <footer id="changelanguage"  class="noprint">
61
                        <ul class="nav">
61
                        <ul class="nav">
(-)a/koha-tmpl/opac-tmpl/bootstrap/en/modules/maintenance.tt (-3 / +34 lines)
Lines 3-12 Link Here
3
[% USE AdditionalContents %]
3
[% USE AdditionalContents %]
4
[% INCLUDE 'doc-head-open.inc' %]
4
[% INCLUDE 'doc-head-open.inc' %]
5
[% SET OpacHeader = AdditionalContents.get( location => "opacheader", lang => lang, library => logged_in_user.branchcode || default_branch, blocktitle => 0 ) %]
5
[% SET OpacHeader = AdditionalContents.get( location => "opacheader", lang => lang, library => logged_in_user.branchcode || default_branch, blocktitle => 0 ) %]
6
[% SET OpacMaintenanceNotice = AdditionalContents.get( location => "OpacMaintenanceNotice", lang => lang, library => branchcode || default_branch ) %]
7
[% SET OpacLangSelectorMode = Koha.Preference('OpacLangSelectorMode') %]
8
[% SET opaclanguagedisplay = Koha.Preference('opaclanguagedisplay') %]
6
<title>[% IF ( LibraryNameTitle ) %][% LibraryNameTitle | html %][% ELSE %]Koha online[% END %] catalog</title>
9
<title>[% IF ( LibraryNameTitle ) %][% LibraryNameTitle | html %][% ELSE %]Koha online[% END %] catalog</title>
7
[% INCLUDE 'doc-head-close.inc' %]
10
[% INCLUDE 'doc-head-close.inc' %]
8
[% BLOCK cssinclude %]
11
[% BLOCK cssinclude %]
9
    <style>
12
    <style>
13
        .navbar-expand {
14
            justify-content: space-between;
15
        }
10
        #opac-maintenance-message {
16
        #opac-maintenance-message {
11
            background:none repeat scroll 0 0 #FFFFFF;
17
            background:none repeat scroll 0 0 #FFFFFF;
12
            border:1px solid #A2A2A2;
18
            border:1px solid #A2A2A2;
Lines 19-28 Link Here
19
            top:auto;
25
            top:auto;
20
            width:50%;
26
            width:50%;
21
        }
27
        }
28
        .langlabel {
29
            display: inline;
30
        }
22
    </style>
31
    </style>
23
[% END %]
32
[% END %]
24
</head>
33
</head>
25
<body id="opac_maintenance" class="opac">
34
<body id="opac_maintenance" class="opac">
35
    <div id="wrapper">
36
        <div id="header-region" class="noprint">
37
            <nav class="navbar navbar-expand">
38
                <div id="logo">
39
                    <a class="navbar-brand" href="/cgi-bin/koha/opac-main.pl">
40
                        [% IF ( LibraryNameTitle ) %]
41
                            [% LibraryNameTitle | html %]
42
                        [% ELSE %]
43
                            Koha online
44
                        [% END %]
45
                    </a>
46
                </div>
47
48
                [% IF ( Koha.Preference( 'opaclanguagesdisplay' ) ) %]
49
                    [% INCLUDE 'masthead-langmenu.inc' %]
50
                [% END %]
51
            </nav>
52
        </div>
53
26
    [% IF ( OpacHeader ) %]
54
    [% IF ( OpacHeader ) %]
27
        <div class="container-fluid">
55
        <div class="container-fluid">
28
            <div class="row">
56
            <div class="row">
Lines 32-43 Link Here
32
            </div>
60
            </div>
33
        </div>
61
        </div>
34
    [% END %]
62
    [% END %]
63
64
<div class="main">
35
    <div class="container-fluid">
65
    <div class="container-fluid">
36
        <div class="row">
66
        <div class="row">
37
            <div class="col">
67
            <div class="col">
38
                <div id="opac-maintenance-message" class="maincontent">
68
                <div id="opac-maintenance-message" class="maincontent">
39
                    [% IF Koha.Preference( 'OpacMaintenanceNotice' ) %]
69
                    [% IF ( OpacMaintenanceNotice ) %]
40
                        [% Koha.Preference( 'OpacMaintenanceNotice' ) | $raw %]
70
                        [% PROCESS koha_news_block news => OpacMaintenanceNotice %]
41
                    [% ELSE %]
71
                    [% ELSE %]
42
                        <h1>System maintenance</h1>
72
                        <h1>System maintenance</h1>
43
                            <p>
73
                            <p>
Lines 53-58 Link Here
53
            </div>
83
            </div>
54
        </div>
84
        </div>
55
    </div>
85
    </div>
86
</div>
56
87
57
[% INCLUDE 'opac-bottom.inc' is_popup=1 %]
88
[% INCLUDE 'opac-bottom.inc' %]
58
[% BLOCK jsinclude %][% END %]
89
[% BLOCK jsinclude %][% END %]
(-)a/opac/maintenance.pl (-4 / +10 lines)
Lines 18-31 Link Here
18
use Modern::Perl;
18
use Modern::Perl;
19
19
20
use CGI qw ( -utf8 );
20
use CGI qw ( -utf8 );
21
use C4::Auth;
21
use C4::Auth qw( get_template_and_user );
22
use C4::Output qw( output_html_with_http_headers );
22
use C4::Output qw( output_html_with_http_headers );
23
use C4::Templates qw/gettemplate/;
24
23
25
use Koha;
24
use Koha;
26
25
27
my $query = CGI->new;
26
my $query = CGI->new;
28
my $template = C4::Templates::gettemplate( 'maintenance.tt', 'opac', $query );
27
28
my ( $template, $borrowernumber, $cookie ) = get_template_and_user(
29
    {
30
        template_name   => "maintenance.tt",
31
        type            => "opac",
32
        query           => $query,
33
        authnotrequired => ( C4::Context->preference("OpacPublic") ? 1 : 0 ),
34
    }
35
);
29
36
30
my $koha_db_version = C4::Context->preference('Version');
37
my $koha_db_version = C4::Context->preference('Version');
31
my $kohaversion     = Koha::version();
38
my $kohaversion     = Koha::version();
32
- 

Return to bug 23798