Description
David Cook
2014-01-20 01:19:23 UTC
This bug doesn't depend on 14389 per se... rather pushing 14389 will cause this bug to need an update most likely to change a manual event trigger from "change()" to "keyup()" or the like. Created attachment 40509 [details] [review] Bug 11584 - Add wysiwyg editor to system preferences dealing with HTML This patch adds the ability to use a WYSIWYG editor for system preferences. The key files that I touch are: 1) admin/systempreferences.pl 2) koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences.tt 3) koha-tmpl/intranet-tmpl/prog/en/modules/admin/systempreferences.tt I also add: 4) koha-tmpl/intranet-tmpl/prog/en/includes/wysiwyg-systempreferences.inc and 5) koha-tmpl/intranet-tmpl/lib/tiny_mce/plugins/advimage This plugin is part of the TinyMCE distribution. It used to be in Koha, but then someone removed it. It's useful for preferences like "opacheader" though. -- _TEST PLAN_ Before applying: Note that there is no WYSIWYG editors for system preferences and that it's not an option when creating a new local system preference. Apply the patch. After applying: 1) Go to Global System Preferences 2) Go to "Local use" 3) Create a new system preference with a variable type of "Htmlarea". 4) Click "Save" 5) Note that your system preference has a WYSIWYG editor instead of a textarea or some other type of input field. 6) Enter some content, bold it, insert images, etc. 7) Click "Save" 8) Reload the page 9) Note that your content is still there 10) Find koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/opac.pref* 11) Change the "type" for "opacheader" from "textarea" to "htmlarea" 12) Reload the "OPAC" tab in Global System Preferences 13) Note that there is a WYSIWYG editor instead of a textarea for "opacheader" 14) Try different ways of changing the field's contents (e.g. typing with the keyboard, pasting content using the browser's paste option [note that browser security will probably prevent you using the context menu paste option], dragging text into the WYSIWYG editor box, etc.)** 15) Note that the preference says "opacheader (modified)" and the "Save all OPAC preferences" button has been enabled. 16) Click the save button and reload the page 17) Note that the content is there exactly as you entered it! 18) Try editing it again only using editor buttons (e.g. "bold", "link", etc) and note that the preference says "opacheader (modified)" and the save button has been enabled. 19) Look on the actual OPAC to see how your content has been rendered!*** *I opted not to edit any *.pref files with this commit as I think that's a separate step to actually adding the "ability" to use the WYSIWYG **If you're using anything except IE, this should work super well. If you're using IE, it'll probably only work for keyboard input and dragging text within the editor box but not from outside of it. IE has worse security, so you can probably paste using the context menu paste. ***While I think a WYSIWYG editor can be useful, there might be times where the content is displayed differently than it is in the editor because of higher level CSS and Javascript. Created attachment 40694 [details] [review] [SIGNED OFF] Bug 11584 - Add wysiwyg editor to system preferences dealing with HTML This patch adds the ability to use a WYSIWYG editor for system preferences. The key files that I touch are: 1) admin/systempreferences.pl 2) koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences.tt 3) koha-tmpl/intranet-tmpl/prog/en/modules/admin/systempreferences.tt I also add: 4) koha-tmpl/intranet-tmpl/prog/en/includes/wysiwyg-systempreferences.inc and 5) koha-tmpl/intranet-tmpl/lib/tiny_mce/plugins/advimage This plugin is part of the TinyMCE distribution. It used to be in Koha, but then someone removed it. It's useful for preferences like "opacheader" though. -- _TEST PLAN_ Before applying: Note that there is no WYSIWYG editors for system preferences and that it's not an option when creating a new local system preference. Apply the patch. After applying: 1) Go to Global System Preferences 2) Go to "Local use" 3) Create a new system preference with a variable type of "Htmlarea". 4) Click "Save" 5) Note that your system preference has a WYSIWYG editor instead of a textarea or some other type of input field. 6) Enter some content, bold it, insert images, etc. 7) Click "Save" 8) Reload the page 9) Note that your content is still there 10) Find koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/opac.pref* 11) Change the "type" for "opacheader" from "textarea" to "htmlarea" 12) Reload the "OPAC" tab in Global System Preferences 13) Note that there is a WYSIWYG editor instead of a textarea for "opacheader" 14) Try different ways of changing the field's contents (e.g. typing with the keyboard, pasting content using the browser's paste option [note that browser security will probably prevent you using the context menu paste option], dragging text into the WYSIWYG editor box, etc.)** 15) Note that the preference says "opacheader (modified)" and the "Save all OPAC preferences" button has been enabled. 16) Click the save button and reload the page 17) Note that the content is there exactly as you entered it! 18) Try editing it again only using editor buttons (e.g. "bold", "link", etc) and note that the preference says "opacheader (modified)" and the save button has been enabled. 19) Look on the actual OPAC to see how your content has been rendered!*** *I opted not to edit any *.pref files with this commit as I think that's a separate step to actually adding the "ability" to use the WYSIWYG **If you're using anything except IE, this should work super well. If you're using IE, it'll probably only work for keyboard input and dragging text within the editor box but not from outside of it. IE has worse security, so you can probably paste using the context menu paste. ***While I think a WYSIWYG editor can be useful, there might be times where the content is displayed differently than it is in the editor because of higher level CSS and Javascript. Signed-off-by: Nick Clemens <nick@quecheelibrary.org> The one minor thing I noted was that using the WYSIWYG Save button (diskette icon) the full page reloads as opposed to the nice message and quick save with the Koha button. Excellent feature! (In reply to Nick Clemens from comment #4) > The one minor thing I noted was that using the WYSIWYG Save button (diskette > icon) the full page reloads as opposed to the nice message and quick save > with the Koha button. > > Excellent feature! Hmm, that's a good point. I wonder if I could intercept the WYSIWYG's save command and use Koha's save instead... I might take a look at that if I find some time! Hi David, Could you please add tinyMCE to the about page? Idea: why don't you add a pref to enable/disable the wysiwyg editor to all textarea pref? Please rebase, there is a conflict: CONFLICT (content): Merge conflict in koha-tmpl/intranet-tmpl/prog/en/modules/admin/systempreferences.tt (In reply to Jonathan Druart from comment #6) > Hi David, > > Could you please add tinyMCE to the about page? > Do you mean add it to the Licences section? > Idea: why don't you add a pref to enable/disable the wysiwyg editor to all > textarea pref? > I don't think the WYSIWYG would be appropriate or functional for a lot of textarea prefs (e.g. MARCAuthorityControlField008, UNIMARCAuthorityField100, ISBD, SpineLabelFormat, OPACUserCSS, opacuserjs, etc.). But I like the idea of using a system preference to disable/enable the WYSIWYG... I could add that as a second patch to this bug... > Please rebase, there is a conflict: > CONFLICT (content): Merge conflict in > koha-tmpl/intranet-tmpl/prog/en/modules/admin/systempreferences.tt Sure thing :) Created attachment 40959 [details] [review] Bug 11584 - Add wysiwyg editor to system preferences dealing with HTML This patch adds the ability to use a WYSIWYG editor for system preferences. The key files that I touch are: 1) admin/systempreferences.pl 2) koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences.tt 3) koha-tmpl/intranet-tmpl/prog/en/modules/admin/systempreferences.tt I also add: 4) koha-tmpl/intranet-tmpl/prog/en/includes/wysiwyg-systempreferences.inc and 5) koha-tmpl/intranet-tmpl/lib/tiny_mce/plugins/advimage This plugin is part of the TinyMCE distribution. It used to be in Koha, but then someone removed it. It's useful for preferences like "opacheader" though. -- _TEST PLAN_ Before applying: Note that there is no WYSIWYG editors for system preferences and that it's not an option when creating a new local system preference. Apply the patch. After applying: 1) Go to Global System Preferences 2) Go to "Local use" 3) Create a new system preference with a variable type of "Htmlarea". 4) Click "Save" 5) Note that your system preference has a WYSIWYG editor instead of a textarea or some other type of input field. 6) Enter some content, bold it, insert images, etc. 7) Click "Save" 8) Reload the page 9) Note that your content is still there 10) Find koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/opac.pref* 11) Change the "type" for "opacheader" from "textarea" to "htmlarea" 12) Reload the "OPAC" tab in Global System Preferences 13) Note that there is a WYSIWYG editor instead of a textarea for "opacheader" 14) Try different ways of changing the field's contents (e.g. typing with the keyboard, pasting content using the browser's paste option [note that browser security will probably prevent you using the context menu paste option], dragging text into the WYSIWYG editor box, etc.)** 15) Note that the preference says "opacheader (modified)" and the "Save all OPAC preferences" button has been enabled. 16) Click the save button and reload the page 17) Note that the content is there exactly as you entered it! 18) Try editing it again only using editor buttons (e.g. "bold", "link", etc) and note that the preference says "opacheader (modified)" and the save button has been enabled. 19) Look on the actual OPAC to see how your content has been rendered!*** *I opted not to edit any *.pref files with this commit as I think that's a separate step to actually adding the "ability" to use the WYSIWYG **If you're using anything except IE, this should work super well. If you're using IE, it'll probably only work for keyboard input and dragging text within the editor box but not from outside of it. IE has worse security, so you can probably paste using the context menu paste. ***While I think a WYSIWYG editor can be useful, there might be times where the content is displayed differently than it is in the editor because of higher level CSS and Javascript. (In reply to Jonathan Druart from comment #6) > Could you please add tinyMCE to the about page? > > Idea: why don't you add a pref to enable/disable the wysiwyg editor to all > textarea pref? > I'll look at doing this tomorrow, as I'm done for the day now. I'm working on changing the system preferences and wrapping the WYSIWYG editor with a a system preference... I don't think WYSIWYG editors necessarily make sense everywhere you can use HTML though. If the HTML is going into a <div>, then it's probably OK. However, if the HTML is a fragment going into an element like a <ul>, we should be careful. For instance, the HTML from "IntranetNav" should probably just be a <li> element, which TinyMCE can't do... as it'll "fix it" by wrapping it in a <ul>... even if you edit it by hand using the HTML button. By contrast, you can put pretty much anything in "IntranetmainUserblock" and it'll be all right. -- Yes: IntranetmainUserblock SelfCheckHelpMessage NoLoginInstructions opaccredits opacheader OpacMainUserBlock OPACMySummaryHTML OpacNav OpacNavBottom OpacNavRight OPACNoResultsFound OPACResultsSidebar PatronSelfRegistrationAdditionalInstructions No: IntranetNav (HTML needs to be <li> elements) OpacCustomSearch (would require hand-coding of the form and input elements...) OPACSearchForTitleIn (HTML needs to be <li> elements) Created attachment 40980 [details] [review] Bug 11584 - Add wysiwyg editor to system preferences dealing with HTML This patch adds the ability to use a WYSIWYG editor for system preferences. The key files that I touch are: 1) admin/systempreferences.pl 2) koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences.tt 3) koha-tmpl/intranet-tmpl/prog/en/modules/admin/systempreferences.tt I also add: 4) koha-tmpl/intranet-tmpl/prog/en/includes/wysiwyg-systempreferences.inc and 5) koha-tmpl/intranet-tmpl/lib/tiny_mce/plugins/advimage This plugin is part of the TinyMCE distribution. It used to be in Koha, but then someone removed it. It's useful for preferences like "opacheader" though. *If you're using anything except IE, this should work super well. If you're using IE, it'll probably only work for keyboard input and dragging text within the editor box but not from outside of it. IE has worse security, so you can probably paste using the context menu paste. *While I think a WYSIWYG editor can be useful, there might be times where the content is displayed differently than it is in the editor because of higher level CSS and Javascript. Created attachment 40981 [details] [review] Bug 11584 - Add wysiwyg editor to system preferences dealing with HTML (add licence) This patch adds the TinyMCE license info to about.pl Created attachment 40982 [details] [review] 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! Created attachment 41515 [details] [review] Bug 11584 - Add wysiwyg editor to system preferences dealing with HTML This patch adds the ability to use a WYSIWYG editor for system preferences. The key files that I touch are: 1) admin/systempreferences.pl 2) koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences.tt 3) koha-tmpl/intranet-tmpl/prog/en/modules/admin/systempreferences.tt I also add: 4) koha-tmpl/intranet-tmpl/prog/en/includes/wysiwyg-systempreferences.inc and 5) koha-tmpl/intranet-tmpl/lib/tiny_mce/plugins/advimage This plugin is part of the TinyMCE distribution. It used to be in Koha, but then someone removed it. It's useful for preferences like "opacheader" though. *If you're using anything except IE, this should work super well. If you're using IE, it'll probably only work for keyboard input and dragging text within the editor box but not from outside of it. IE has worse security, so you can probably paste using the context menu paste. *While I think a WYSIWYG editor can be useful, there might be times where the content is displayed differently than it is in the editor because of higher level CSS and Javascript. Signed-off-by: Martin Persson <xarragon@gmail.com> Created attachment 41516 [details] [review] Bug 11584 - Add wysiwyg editor to system preferences dealing with HTML (add licence) This patch adds the TinyMCE license info to about.pl Signed-off-by: Martin Persson <xarragon@gmail.com> Created attachment 41517 [details] [review] Patch to work with newly added dropdown Sorry, screwed up the patches i signed off, obsoleted the wrong ones because git-bz was a bit confusing for me. I have merged these patches so that they apply cleanly on current master and added support for the drop-down type selector. Not sure if we need a second round of sign-offs for the merge changes. Please advise. Created attachment 41518 [details] [review] Bug 11584 - Add wysiwyg editor to system preferences dealing with HTML (add licence) This patch adds the TinyMCE license info to about.pl Signed-off-by: Martin Persson <xarragon@gmail.com> Created attachment 41519 [details] [review] Bug 11584 - Add wysiwyg editor to system preferences dealing with HTML (add licence) This patch adds the TinyMCE license info to about.pl Signed-off-by: Martin Persson <xarragon@gmail.com> Created attachment 41520 [details] [review] Bug 11584 - Add wysiwyg editor to system preferences dealing with HTML This patch adds the ability to use a WYSIWYG editor for system preferences. The key files that I touch are: 1) admin/systempreferences.pl 2) koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences.tt 3) koha-tmpl/intranet-tmpl/prog/en/modules/admin/systempreferences.tt I also add: 4) koha-tmpl/intranet-tmpl/prog/en/includes/wysiwyg-systempreferences.inc and 5) koha-tmpl/intranet-tmpl/lib/tiny_mce/plugins/advimage This plugin is part of the TinyMCE distribution. It used to be in Koha, but then someone removed it. It's useful for preferences like "opacheader" though. *If you're using anything except IE, this should work super well. If you're using IE, it'll probably only work for keyboard input and dragging text within the editor box but not from outside of it. IE has worse security, so you can probably paste using the context menu paste. *While I think a WYSIWYG editor can be useful, there might be times where the content is displayed differently than it is in the editor because of higher level CSS and Javascript. Signed-off-by: Martin Persson <xarragon@gmail.com> Created attachment 41521 [details] [review] 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 <xarragon@gmail.com> Okay I tried to clear this up.. But the order of the patches are different now. They do however seem to apply and work when I test them. Sorry for the mess, I was trying to use relative names instead of sha1:s and it did not work out well since I didn't pay enough attention to the manual. Created attachment 41671 [details] [review] Bug 11584 - Add wysiwyg editor to system preferences dealing with HTML This patch adds the ability to use a WYSIWYG editor for system preferences. The key files that I touch are: 1) admin/systempreferences.pl 2) koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences.tt 3) koha-tmpl/intranet-tmpl/prog/en/modules/admin/systempreferences.tt I also add: 4) koha-tmpl/intranet-tmpl/prog/en/includes/wysiwyg-systempreferences.inc and 5) koha-tmpl/intranet-tmpl/lib/tiny_mce/plugins/advimage This plugin is part of the TinyMCE distribution. It used to be in Koha, but then someone removed it. It's useful for preferences like "opacheader" though. *If you're using anything except IE, this should work super well. If you're using IE, it'll probably only work for keyboard input and dragging text within the editor box but not from outside of it. IE has worse security, so you can probably paste using the context menu paste. *While I think a WYSIWYG editor can be useful, there might be times where the content is displayed differently than it is in the editor because of higher level CSS and Javascript. Signed-off-by: Martin Persson <xarragon@gmail.com> Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org> Created attachment 41672 [details] [review] Bug 11584 - Add wysiwyg editor to system preferences dealing with HTML (add licence) This patch adds the TinyMCE license info to about.pl Signed-off-by: Martin Persson <xarragon@gmail.com> Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org> Created attachment 41673 [details] [review] 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 <xarragon@gmail.com> Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org> Created attachment 41674 [details] [review] Bug 11584: Syspref WYSIWYG, dropdown added This patch adds the 'Htmlarea' type to the dropdown box introduced by bug 14268, commit 6e3bcc38. Sponsored-By: Halmstad County Library Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org> So, passed QA. Enhancement pushed to master. Nice one David! Created attachment 42124 [details] [review] Bug 11584: (QA followup) add missing newline at end of YAML file Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io> |