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 <xarragon@gmail.com>

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
This commit is contained in:
David Cook 2015-07-14 17:02:17 +10:00 committed by Tomas Cohen Arazi
parent a5beeb365e
commit acc8de8214
7 changed files with 42 additions and 27 deletions

View file

@ -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');

View file

@ -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'),

View file

@ -1,3 +1,4 @@
[% USE Koha %]
[% INCLUDE 'doc-head-open.inc' %]
<title>Koha &rsaquo; Administration &rsaquo; System preferences</title>
[% INCLUDE 'doc-head-close.inc' %]
@ -134,11 +135,13 @@
<select name="pref_[% CHUNK.name %]" id="pref_[% CHUNK.name %]" class="preference preference-[% CHUNK.class or "choice" %]" multiple="multiple">
[% FOREACH CHOICE IN CHUNK.CHOICES %][% IF ( CHOICE.selected ) %]<option value="[% CHOICE.value %]" selected="selected">[% ELSE %]<option value="[% CHOICE.value %]">[% END %][% CHOICE.text %]</option>[% END %]
</select>
[% ELSIF ( CHUNK.type_textarea ) %]
<a class="expand-textarea" style="display: none" href="#">Click to Edit</a>
<textarea name="pref_[% CHUNK.name %]" id="pref_[% CHUNK.name %]" class="preference preference-[% CHUNK.class or "short" %]" rows="10" cols="40">[% CHUNK.value %]</textarea>
[% ELSIF ( CHUNK.type_htmlarea ) %]
<textarea name="pref_[% CHUNK.name %]" id="pref_[% CHUNK.name %]" class="preference preference-[% CHUNK.class or "short" %] mce" rows="20" cols="60">[% CHUNK.value %]</textarea>
[% ELSIF ( CHUNK.type_textarea ) || ( CHUNK.type_htmlarea )%]
[% IF ( CHUNK.type_htmlarea ) && ( Koha.Preference('UseWYSIWYGinSystemPreferences') ) %]
<textarea name="pref_[% CHUNK.name %]" id="pref_[% CHUNK.name %]" class="preference preference-[% CHUNK.class or "short" %] mce" rows="20" cols="60">[% CHUNK.value %]</textarea>
[% ELSE %]
<a class="expand-textarea" style="display: none" href="#">Click to Edit</a>
<textarea name="pref_[% CHUNK.name %]" id="pref_[% CHUNK.name %]" class="preference preference-[% CHUNK.class or "short" %]" rows="10" cols="40">[% CHUNK.value %]</textarea>
[% END %]
[% ELSIF ( CHUNK.type_languages ) %]
<dl>
[% FOREACH language IN CHUNK.languages %]

View file

@ -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

View file

@ -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):'
- '<br />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:'
- '<br />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:
-

View file

@ -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.

View file

@ -1,3 +1,4 @@
[% USE Koha %]
[% INCLUDE 'doc-head-open.inc' %]
<title>Koha &rsaquo; Administration &rsaquo; [% IF ( add_form ) %] System preferences &rsaquo; [% IF ( modify ) %]Modify system preference '[% searchfield %]'[% ELSE %]Add a system preference[% END %][% END %][% IF ( add_validate ) %] System preferences &rsaquo; Data added[% END %]
[% IF ( delete_confirm ) %] System preferences &rsaquo; [% searchfield %] &rsaquo; Confirm deletion of parameter '[% searchfield %]'[% END %][% IF ( delete_confirmed ) %] System preferences &rsaquo; Parameter deleted[% END %][% IF ( else ) %]System preferences[% END %]</title>
@ -110,10 +111,12 @@
<textarea id="value" name="value" cols="[% fieldlength %]">[% value |html %]</textarea>
[% ELSIF ( type_upload ) %]
<input type="file" name="value" />
[% ELSIF ( type_htmlarea ) %]
<textarea class="mce" name="value" id="value" rows="[% rows %]" cols="[% cols %]">[% value |html %]</textarea>
[% ELSIF ( type_textarea ) %]
[% ELSIF ( type_textarea || type_htmlarea ) %]
[% IF ( type_htmlarea ) && ( Koha.Preference('UseWYSIWYGinSystemPreferences') ) %]
<textarea class="mce" name="value" id="value" rows="[% rows %]" cols="[% cols %]">[% value |html %]</textarea>
[% ELSE %]
<textarea name="value" id="value" rows="[% rows %]" cols="[% cols %]">[% value |html %]</textarea>
[% END %]
[% ELSIF ( type_choice ) %]
<select name="value" id="value">
[% FOREACH option IN options %]
@ -337,12 +340,13 @@
[% IF ( loo.type_upload ) %]
<input type="file" name="value" value="[% loo.value |html %]" />
[% END %]
[% IF ( loo.type_textarea ) %]
<a class="expand-textarea" style="display: none" href="#">Click to edit</a>
<textarea name="value" rows="[% loo.rows %]" cols="[% loo.cols %]">[% loo.value |html %]</textarea>
[% END %]
[% IF ( loo.type_htmlarea ) %]
<textarea class="mce" name="value" rows="[% loo.rows %]" cols="[% loo.cols %]">[% loo.value |html %]</textarea>
[% IF ( loo.type_textarea ) || ( loo.type_htmlarea ) %]
[% IF ( loo.type_htmlarea ) && ( Koha.Preference('UseWYSIWYGinSystemPreferences') ) %]
<textarea class="mce" name="value" rows="[% loo.rows %]" cols="[% loo.cols %]">[% loo.value |html %]</textarea>
[% ELSE %]
<a class="expand-textarea" style="display: none" href="#">Click to edit</a>
<textarea name="value" rows="[% loo.rows %]" cols="[% loo.cols %]">[% loo.value |html %]</textarea>
[% END %]
[% END %]
[% IF ( loo.type_choice ) %]
<select name="value">