This patch adds a system preference called 'NewsToolEditor' which allows for the choice between TinyMCE and CodeMirror in the News Feature.
TEST PLAN:
1. Apply patch and run updatedatabase
2. Go to Tools > News and make a new entry or edit an existing News item.
3. When you initially load you should gte the TinyMCE editor (WYSIWYG)
4. Search for the NewsToolEditor system preference and switch to CodeMirror.
5. Reload your News item and now you should see the CodeMirror editor.
6. Try saving content with both and maki sure it works.
7. Try adding some different HTML tags in CodeMirror mode, saving, and making sure it looks right when you switch back to TinyMCE
Signed-off-by: Owen Leonard <oleonard@myacpl.org>
Signed-off-by: Lisette Scheer <lisetteslatah@gmail.com>
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
--- /dev/null
+$DBversion = 'XXX'; # will be replaced by the RM
+if( CheckVersion( $DBversion ) ) {
+ $dbh->do( "INSERT IGNORE INTO systempreferences (variable,value,explanation,options,type) VALUES('NewsToolEditor','tinymce', 'Choose tool for editing News','tinymce|codemirror','Choice')" );
+
+ NewVersion( $DBversion, 22660, "Adds NewsToolEditor system preference");
+}
('minPasswordLength','8',NULL,'Specify the minimum length of a patron/staff password','free'),
('NewItemsDefaultLocation','','','If set, all new items will have a location of the given Location Code ( Authorized Value type LOC )',''),
('NewsAuthorDisplay','none','none|opac|staff|both','Display the author name for news items.','Choice'),
+('NewsToolEditor','tinymce','tinymce|codemirror','Choose tool for editing News.', 'Choice'),
('noissuescharge','5','','Define maximum amount withstanding before check outs are blocked','Integer'),
('NoIssuesChargeGuarantees','','','Define maximum amount withstanding before check outs are blocked','Integer'),
('noItemTypeImages','0',NULL,'If ON, disables itemtype images in the staff interface','YesNo'),
opac: "OPAC only"
staff: "Staff client only"
both: "Both OPAC and staff client"
- -
+ -
+ - Use
+ - pref: NewsToolEditor
+ choices:
+ tinymce: "TinyMCE (WYSIWYG)"
+ codemirror: "CodeMirror"
+ - when editing News.
Upload:
-
- Automatically delete temporary uploads older than
[% USE Branches %]
[% SET footerjs = 1 %]
[% INCLUDE 'doc-head-open.inc' %]
+[% Asset.css("lib/codemirror/codemirror.css") | $raw %]
+<style>
+.CodeMirror {
+ resize: vertical;
+}
+</style>
<title>Koha › Tools › News</title>
[% INCLUDE 'doc-head-close.inc' %]
[% IF ( opac_news_count ) %]
[% MACRO jsinclude BLOCK %]
[% INCLUDE 'calendar.inc' %]
[% Asset.js("js/tools-menu.js") | $raw %]
+ [% Asset.js("lib/d3c3/d3.min.js") | $raw %]
+ [% Asset.js("lib/d3c3/c3.min.js") | $raw %]
[% IF ( opac_news_count ) %]
[% INCLUDE 'datatables.inc' %]
<script>
});
</script>
[% END %]
+ [% Asset.js( "lib/codemirror/codemirror.min.js" ) | $raw %]
[% Asset.js("lib/tiny_mce/tinymce.min.js") | $raw %]
[% INCLUDE 'str/tinymce_i18n.inc' %]
<script>
+ [% IF Koha.Preference('NewsToolEditor') == 'codemirror' %]
+ var editor = CodeMirror.fromTextArea(document.getElementById('content'), {
+ lineNumbers: true,
+ mode: "text/html",
+ lineWrapping: true
+ });
+ [% ELSE %]
tinyMCE.init({
verify_html: false,
force_br_newlines : false,
"table | bullist numlist | undo redo | removeformat | emoticons charmap | forecolor backcolor | code visualaid help"
],
});
+ [% END %]
</script>
[% END %]