Bug 15311 - Let libraries set text to display when OpacMaintenance = on

Added new systempreference OpacMaintenanceNotice.
When OpacMaintenance is ON the HTML contents of OpacMaintenanceNotice will
be displayed.
Enabling OpacMaintenance is all that is required to enable this preference.
If OpacMaintenanceNotice is undefined, the default (original) notice will
appear when OpacMaintenance is enabled.

To test:
- Enable OpacMaintenance systempreference
- Observe the default maintenance message when OPAC is viewed
- Edit OpacMaintenanceNotice systempreference, adding custom HTML
- Observe the custom HTML appear on the opac
- Remove OpacMaintenanceNotice (mindful of orphaned spaces etc.)
- Observe the default opac notice appears in the opac
- Disable OpacMaintenance
- Observce opac is back online

Moving code to atomic update and fixing merge conflict

NOTE: Accounted for an SQL typo and autoescaping of the template.
      If someone else could test this, then I would be fine with
      marking it signed off.

Signed-off-by: Mark Tompsett <mtompset@hotmail.com>

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
This commit is contained in:
Barry Cannon 2015-12-16 10:37:17 +00:00 committed by Kyle M Hall
parent 3a3b047224
commit 62860d53ae
5 changed files with 25 additions and 2 deletions

View file

@ -0,0 +1 @@
INSERT IGNORE INTO systempreferences ( `variable`, `value`, `options`, `explanation`, `type` ) VALUES ('OpacMaintenanceNotice','','','A user-defined block of HTML to appear on screen when OpacMaintenace is enabled','Textarea');

View file

@ -299,6 +299,7 @@ INSERT INTO systempreferences ( `variable`, `value`, `options`, `explanation`, `
('OpacLocationBranchToDisplay','holding','holding|home|both','In the OPAC, under location show which branch for Location in the record details.','Choice'),
('OpacLocationBranchToDisplayShelving','holding','holding|home|both','In the OPAC, display the shelving location under which which column.', 'Choice'),
('OpacMaintenance','0','','If ON, enables maintenance warning in OPAC','YesNo'),
('OpacMaintenanceNotice','','','A user-defined block of HTML to appear on screen when OpacMaintenace is enabled','Textarea'),
('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'),
('OpacMaxItemsToDisplay','50','','Max items to display at the OPAC on a biblio detail','Integer'),
('OPACMySummaryHTML','','70|10','Enter the HTML that will appear in a column on the \'my summary\' and \'my reading 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'),

View file

@ -11870,6 +11870,16 @@ if ( CheckVersion($DBversion) ) {
SetVersion($DBversion);
}
$DBversion = "3.23.00.XXX";
if(CheckVersion($DBversion)) {
$dbh->do(q{
INSERT IGNORE INTO systempreferences (variable,value,options,explanation,type)
VALUES ('OpacMaintenanceNotice','','','A user-defined block of HTML to appear on screen when OpacMaintenace is enabled','Textarea')
});
print "Upgrade to $DBversion done (Bug 15311: Let libraries set text to display when OpacMaintenance = on)\n";
SetVersion($DBversion);
}
# DEVELOPER PROCESS, search for anything to execute in the db_update directory
# SEE bug 13068
# if there is anything in the atomicupdate, read and execute it.

View file

@ -53,6 +53,12 @@ OPAC:
yes: Show
no: "Don't show"
- "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."
-
-
- "Show the following HTML when OpacMaintenance is enabled:"
- pref: OpacMaintenanceNotice
type: htmlarea
class: code
-
- By default, show bib records
- pref: BiblioDefaultView

View file

@ -1,3 +1,4 @@
[% USE Koha %]
[% INCLUDE 'doc-head-open.inc' %]
<title>[% IF ( LibraryNameTitle ) %][% LibraryNameTitle %][% ELSE %]Koha online[% END %] catalog</title>
[% INCLUDE 'doc-head-close.inc' %]
@ -26,8 +27,12 @@
<div class="row-fluid">
<div class="span12">
<div id="opac-maintenance-message">
<h2>System maintenance</h2>
<p>The [% IF ( LibraryNameTitle ) %][% LibraryNameTitle %][% ELSE %]Koha online[% END %] catalog is offline for system maintenance. We'll be back soon! If you have any questions, please contact the <a href="mailto:[% KohaAdminEmailAddress %]">site administrator</a></p>
[% IF Koha.Preference( 'OpacMaintenanceNotice' ) %]
[% Koha.Preference( 'OpacMaintenanceNotice' ).raw %]
[% ELSE %]
<h2>System Maintenance</h2>
<p>The [% IF ( LibraryNameTitle ) %][% LibraryNameTitle %][% ELSE %]Koha online[% END %] catalog is offline for system maintenance. We'll be back soon! If you have any questions, please contact the <a href="mailto:[% KohaAdminEmailAddress %]">site administrator</a></p>
[% END %]
</div>
</div>
</div>