From acc8de8214c6f8c342eb170c9ddd2be63c16354b Mon Sep 17 00:00:00 2001 From: David Cook Date: Tue, 14 Jul 2015 17:02:17 +1000 Subject: [PATCH] Bug 11584: Introduce UseWYSIWYGinSystemPreferences syspref This patch adds a system preference "UseWYSIWYGinSystemPreferences" to the Staff Client tab. By default, it is off, which means that the TinyMCE WYSIWYG editor won't be shown for system preferences with a type of "htmlarea". However, when it's on, it will show the editor for "Local Use" preferences with a "htmlarea" type, and for other system preferences in the "Opac", "Circulation", and "Staff Client" tabs, which I have re-assigned. (Basically, I grepped for HTML and changed the type for all the system preferences I found except for "IntranetNav", "OpacCustomSearch", and "OPACSearchForTitleIn", as a WYSIWYG editor would potentially break the output for these system preferences or add no value to them...) _TEST PLAN_ 0) Run `perl installer/data/mysql/updatedatabase.pl` after setting your environmental variables 1) Check the Opac tab to make sure that the WYSIWYG is nowhere to be seen 2) Change the "UseWYSIWYGinSystemPreferences" preference in "Staff Client" to "Show" 3) Refresh the Opac tab and notice that many system preferences now have a WYSIWYG editor 4) Try typing some text into these fields 5) Note that it gets marked as "modified" 6) Save the preference, and refresh the page 7) Note that the content has been saved 8) Take a look at how it's rendered on the actual webpage! Signed-off-by: Martin Persson Signed-off-by: Jonathan Druart Signed-off-by: Tomas Cohen Arazi --- ..._UseWYSIWYGinSystemPreferences_syspref.sql | 1 + installer/data/mysql/sysprefs.sql | 1 + .../prog/en/modules/admin/preferences.tt | 13 ++++++----- .../admin/preferences/circulation.pref | 2 +- .../en/modules/admin/preferences/opac.pref | 22 +++++++++---------- .../admin/preferences/staff_client.pref | 8 ++++++- .../en/modules/admin/systempreferences.tt | 22 +++++++++++-------- 7 files changed, 42 insertions(+), 27 deletions(-) create mode 100644 installer/data/mysql/atomicupdate/bug_11584-add_UseWYSIWYGinSystemPreferences_syspref.sql diff --git a/installer/data/mysql/atomicupdate/bug_11584-add_UseWYSIWYGinSystemPreferences_syspref.sql b/installer/data/mysql/atomicupdate/bug_11584-add_UseWYSIWYGinSystemPreferences_syspref.sql new file mode 100644 index 0000000000..08eed5eba7 --- /dev/null +++ b/installer/data/mysql/atomicupdate/bug_11584-add_UseWYSIWYGinSystemPreferences_syspref.sql @@ -0,0 +1 @@ +INSERT IGNORE INTO systempreferences (variable,value,explanation,options,type) VALUES ('UseWYSIWYGinSystemPreferences','0','','Show WYSIWYG editor when editing certain HTML system preferences.','YesNo'); diff --git a/installer/data/mysql/sysprefs.sql b/installer/data/mysql/sysprefs.sql index b65b89bd4a..0fa2b8195b 100644 --- a/installer/data/mysql/sysprefs.sql +++ b/installer/data/mysql/sysprefs.sql @@ -474,6 +474,7 @@ INSERT INTO systempreferences ( `variable`, `value`, `options`, `explanation`, ` ('UseKohaPlugins','0','','Enable or disable the ability to use Koha Plugins.','YesNo'), ('UseQueryParser','0',NULL,'If enabled, try to use QueryParser for queries.','YesNo'), ('UseTransportCostMatrix','0','','Use Transport Cost Matrix when filling holds','YesNo'), +('UseWYSIWYGinSystemPreferences','0','','Show WYSIWYG editor when editing certain HTML system preferences.','YesNo'), ('viewISBD','1','','Allow display of ISBD view of bibiographic records','YesNo'), ('viewLabeledMARC','0','','Allow display of labeled MARC view of bibiographic records','YesNo'), ('viewMARC','1','','Allow display of MARC view of bibiographic records','YesNo'), diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences.tt index 3188f49f5f..9d4b95f162 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences.tt @@ -1,3 +1,4 @@ +[% USE Koha %] [% INCLUDE 'doc-head-open.inc' %] Koha › Administration › System preferences [% INCLUDE 'doc-head-close.inc' %] @@ -134,11 +135,13 @@ - [% ELSIF ( CHUNK.type_textarea ) %] - - - [% ELSIF ( CHUNK.type_htmlarea ) %] - + [% ELSIF ( CHUNK.type_textarea ) || ( CHUNK.type_htmlarea )%] + [% IF ( CHUNK.type_htmlarea ) && ( Koha.Preference('UseWYSIWYGinSystemPreferences') ) %] + + [% ELSE %] + + + [% END %] [% ELSIF ( CHUNK.type_languages ) %]
[% FOREACH language IN CHUNK.languages %] diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/circulation.pref b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/circulation.pref index f9cd82209c..df72493362 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/circulation.pref +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/circulation.pref @@ -663,7 +663,7 @@ Circulation: - - "Include the following HTML in the Help page of the web-based self checkout system:" - pref: SelfCheckHelpMessage - type: textarea + type: htmlarea class: code - - pref: AutoSelfCheckAllowed diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/opac.pref b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/opac.pref index 2fd6867c40..17d0b1a15b 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/opac.pref +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/opac.pref @@ -203,32 +203,32 @@ OPAC: - - "Show the following HTML in its own column on the main page of the OPAC:" - pref: OpacMainUserBlock - type: textarea + type: htmlarea class: code - - "Show the following HTML on the left hand column of the main page and patron account on the OPAC (generally navigation links):" - pref: OpacNav - type: textarea + type: htmlarea class: code - - "Show the following HTML in the right hand column of the main page under the main login form:" - pref: OpacNavRight - type: textarea + type: htmlarea class: code - - "Show the following HTML on the left hand column of the main page and patron account on the OPAC, after OpacNav, and before patron account links if available:" - pref: OpacNavBottom - type: textarea + type: htmlarea class: code - - "Include the following HTML in the header of all pages in the OPAC:" - pref: opacheader - type: textarea + type: htmlarea class: code - - "Include the following HTML in the footer of all pages in the OPAC:" - pref: opaccredits - type: textarea + type: htmlarea class: code - - 'Include a "More Searches" box on the detail pages of items on the OPAC, with the following HTML (leave blank to disable):' @@ -240,7 +240,7 @@ OPAC: - 'Include a "Links" column on the "my summary" and "my reading history" tabs when a user is logged in to the OPAC, with the following HTML (leave blank to disable):' - '
Note: The placeholders {BIBLIONUMBER}, {TITLE}, {ISBN} and {AUTHOR} will be replaced with information from the displayed record.' - pref: OPACMySummaryHTML - type: textarea + type: htmlarea class: code - - "Note to display on the patron summary page. This note only appears if the patron is logged in:" @@ -249,7 +249,7 @@ OPAC: - - "Include the following HTML under the facets in OPAC search results:" - pref: OPACResultsSidebar - type: textarea + type: htmlarea class: code - - pref: OpacAddMastheadLibraryPulldown @@ -261,7 +261,7 @@ OPAC: - 'Display this HTML when no results are found for a search in the OPAC:' - '
Note: You can insert placeholders {QUERY_KW} that will be replaced with the keywords of the query.' - pref: OPACNoResultsFound - type: textarea + type: htmlarea class: code - - 'Display the URI in the 856u field as an image on: ' @@ -310,7 +310,7 @@ OPAC: - - "Show the following HTML on the OPAC login form when a patron is not logged in:" - pref: NoLoginInstructions - type: textarea + type: htmlarea class: code - - "Replace the search box at the top of OPAC pages with the following HTML:" @@ -682,7 +682,7 @@ OPAC: - - "Display the following additional instructions for patrons who self register via the OPAC ( HTML is allowed ):" - pref: PatronSelfRegistrationAdditionalInstructions - type: textarea + type: htmlarea class: html Advanced Search Options: - diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/staff_client.pref b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/staff_client.pref index 17f06c515d..0663c2c82c 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/staff_client.pref +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/staff_client.pref @@ -38,7 +38,7 @@ Staff Client: - - "Show the following HTML in its own column on the main page of the staff client:" - pref: IntranetmainUserblock - type: textarea + type: htmlarea class: code - - "Show the following HTML to the left of the More menu at the top of each page on the staff client (should be a list of links or blank):" @@ -128,3 +128,9 @@ Staff Client: yes: Enable no: Disable - item selection in record detail page. + - + - pref: UseWYSIWYGinSystemPreferences + choices: + yes: Show + no: "Don't show" + - WYSIWYG editor when editing certain HTML system preferences. \ No newline at end of file diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/systempreferences.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/systempreferences.tt index bfcab86bd4..cea373112f 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/systempreferences.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/systempreferences.tt @@ -1,3 +1,4 @@ +[% USE Koha %] [% INCLUDE 'doc-head-open.inc' %] Koha › Administration › [% IF ( add_form ) %] System preferences › [% IF ( modify ) %]Modify system preference '[% searchfield %]'[% ELSE %]Add a system preference[% END %][% END %][% IF ( add_validate ) %] System preferences › Data added[% END %] [% IF ( delete_confirm ) %] System preferences › [% searchfield %] › Confirm deletion of parameter '[% searchfield %]'[% END %][% IF ( delete_confirmed ) %] System preferences › Parameter deleted[% END %][% IF ( else ) %]System preferences[% END %] @@ -110,10 +111,12 @@ [% ELSIF ( type_upload ) %] - [% ELSIF ( type_htmlarea ) %] - - [% ELSIF ( type_textarea ) %] + [% ELSIF ( type_textarea || type_htmlarea ) %] + [% IF ( type_htmlarea ) && ( Koha.Preference('UseWYSIWYGinSystemPreferences') ) %] + + [% ELSE %] + [% END %] [% ELSIF ( type_choice ) %] [% END %] - [% IF ( loo.type_textarea ) %] - - - [% END %] - [% IF ( loo.type_htmlarea ) %] - + [% IF ( loo.type_textarea ) || ( loo.type_htmlarea ) %] + [% IF ( loo.type_htmlarea ) && ( Koha.Preference('UseWYSIWYGinSystemPreferences') ) %] + + [% ELSE %] + + + [% END %] [% END %] [% IF ( loo.type_choice ) %]