From 65adcc13c78bb167b5e8bb984fb66a1a9103178c Mon Sep 17 00:00:00 2001 From: Aleisha Amohia Date: Mon, 14 Mar 2022 20:46:40 +1300 Subject: [PATCH] Bug 30288: Provide links to OPACUserJS and OPACUserCSS in tools This patch provides easy access to the OPACUserJS and OPACUserCSS system preferences in the Additional Contents (News and HTML customisations) sections. These links can be enabled or disabled with the new system preference OPACEnhancementPreferencesLinks. To test: 1. Apply the patch and update the database to apply the new system preference. 2. In the staff client, go to Tools -> Additional Contents (either News or HTML customisations). Notice there is a link "See News" or "See HTML customisations". 3. Go to Koha Administration -> system preferences -> Tools tab, find the OPACEnhancementPreferencesLinks system preference. Confirm it is disabled by default. Enable it (set to 'provide'). 4. Go back to Tools -> Additional contents. Confirm there are now links to "See OPACUserCSS" and "See OPACUserJS". Sponsored-by: Catalyst IT --- ...ug_30288_-_add_OPACEnhancementPreferencesLinks_syspref.pl | 12 ++++++++++++ installer/data/mysql/mandatory/sysprefs.sql | 1 + .../prog/en/modules/admin/preferences/tools.pref | 6 ++++++ .../prog/en/modules/tools/additional-contents.tt | 4 ++++ 4 files changed, 23 insertions(+) create mode 100644 installer/data/mysql/atomicupdate/bug_30288_-_add_OPACEnhancementPreferencesLinks_syspref.pl diff --git a/installer/data/mysql/atomicupdate/bug_30288_-_add_OPACEnhancementPreferencesLinks_syspref.pl b/installer/data/mysql/atomicupdate/bug_30288_-_add_OPACEnhancementPreferencesLinks_syspref.pl new file mode 100644 index 00000000000..54626c934f6 --- /dev/null +++ b/installer/data/mysql/atomicupdate/bug_30288_-_add_OPACEnhancementPreferencesLinks_syspref.pl @@ -0,0 +1,12 @@ +use Modern::Perl; + +return { + bug_number => "30288", + description => "Add new system preference OPACEnhancementPreferencesLinks", + up => sub { + my ($args) = @_; + my ($dbh, $out) = @$args{qw(dbh out)}; + + $dbh->do(q{INSERT IGNORE INTO systempreferences (variable,value,options,explanation,type) VALUES ('OPACEnhancementPreferencesLinks', '0', NULL, 'Make OPAC enhancement preferences easily accessible from the additional contents tools.', 'YesNo') }); + }, +}; diff --git a/installer/data/mysql/mandatory/sysprefs.sql b/installer/data/mysql/mandatory/sysprefs.sql index dd83a00fd8a..02d1f693516 100644 --- a/installer/data/mysql/mandatory/sysprefs.sql +++ b/installer/data/mysql/mandatory/sysprefs.sql @@ -408,6 +408,7 @@ INSERT INTO systempreferences ( `variable`, `value`, `options`, `explanation`, ` ('OPACdefaultSortOrder','dsc','asc|dsc|za|az','Specify the default sort order','Choice'), ('OPACdidyoumean','',NULL,'Did you mean? configuration for the OPAC. Do not change, as this is controlled by /cgi-bin/koha/admin/didyoumean.pl.','Free'), ('OPACDisplay856uAsImage','OFF','OFF|Details|Results|Both','Display the URI in the 856u field as an image, the corresponding OPACXSLT option must be on','Choice'), +('OPACEnhancementPreferencesLinks', '0', NULL, 'Make OPAC enhancement preferences easily accessible from the additional contents tools.', 'YesNo'), ('OpacExportOptions','bibtex,dc,marcxml,marc8,utf8,marcstd,mods,ris,isbd','','Define export options available on OPAC detail page.','multiple'), ('OPACFallback', 'prog', 'bootstrap|prog', 'Define the fallback theme for the OPAC interface.', 'Themes'), ('OpacFavicon','','','Enter a complete URL to an image to replace the default Koha favicon on the OPAC','free'), diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/tools.pref b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/tools.pref index c77d6b06d88..74841d85ce3 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/tools.pref +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/tools.pref @@ -44,6 +44,12 @@ Tools: tinymce: "a WYSIWYG editor (TinyMCE)" codemirror: "a text editor (CodeMirror)" - . + - + - pref: OPACEnhancementPreferencesLinks + choices: + 1: "Provide" + 0: "Don't provide" + - "links to OPAC enhancement preferences (OPACUserJS and OPACUserCSS) within the additional contents and news tools." Upload: - - Automatically delete temporary uploads older than diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/tools/additional-contents.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/tools/additional-contents.tt index 92fcf23cc95..bad4e6b08d0 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/tools/additional-contents.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/tools/additional-contents.tt @@ -300,6 +300,10 @@ [% ELSE %] See News [% END %] + [% IF Koha.Preference("OPACEnhancementPreferencesLinks") %] + | See OPACUserJS + | See OPACUserCSS + [% END %] [% IF additional_contents.count %]
-- 2.11.0