From 3b9aaab255e9255fb74ab34f913e49218909cb34 Mon Sep 17 00:00:00 2001 From: David Cook Date: Tue, 14 Jul 2015 17:02:17 +1000 Subject: [PATCH] Bug 11584 - Add wysiwyg editor to system preferences dealing with HTML (add system preference) 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 --- ...4-add_UseWYSIWYGinSystemPreferences_syspref.sql | 1 + installer/data/mysql/sysprefs.sql | 1 + .../prog/en/modules/admin/preferences.tt | 13 ++++++++----- .../en/modules/admin/preferences/circulation.pref | 2 +- .../prog/en/modules/admin/preferences/opac.pref | 22 +++++++++++----------- .../en/modules/admin/preferences/staff_client.pref | 8 +++++++- .../prog/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 0000000..08eed5e --- /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 ac79f44..6736a22 100644 --- a/installer/data/mysql/sysprefs.sql +++ b/installer/data/mysql/sysprefs.sql @@ -473,6 +473,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 3188f49..9d4b95f 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 f9cd822..df72493 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 2fd6867..17d0b1a 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 17f06c5..0663c2c 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 bfcab86..cea3731 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 ) %]