
theory at bricolage
Apr 1, 2009, 1:17 PM
Post #1 of 1
(512 views)
Permalink
|
|
[8539] Got Xinha working again (Bug # 1429).
|
|
Revision: 8539 Author: theory Date: 2009-04-01 13:17:32 -0700 (Wed, 01 Apr 2009) ViewCVS: http://viewsvn.bricolage.cc/?rev=8539&view=rev Log Message: ----------- Got Xinha working again (Bug # 1429). There were a few issues: * The `editors` JavaScript variable was used as both an array and a Xinha editors object. This made it so that, when an Ajax response came in, it was unable to use it as an array. So I made these two separate variables and added code to the Ajax response to reset the array so that new editors can be added to it. * Once that was working, I had to convince the JavaScript container submit to actually submit the updated contents of Xinha fields. This was done by adding a call to `form.onsubmit()` to before serializing the contents of the container form, as `onsubmit()` is the callback that Xinha uses to serialize HTML back into the textarea fields. * Once that was working, I had to get the `onsubmit()` call to work again after the request came back by resetting the `submitting` variable to false. Our own submission callback, `confirmChanges()`, just returns false if this variable is true. I'll have to see if htmlArea and FCKEditor and JSTags still work now that I've got Xinha working again. Bugzilla Links: -------------- http://bugs.bricolage.cc/show_bug.cgi?id=1429 Modified Paths: -------------- bricolage/trunk/comp/media/js/lib.js bricolage/trunk/comp/widgets/container_prof/container.html bricolage/trunk/comp/widgets/wysiwyg/xinha.html bricolage/trunk/lib/Bric/Changes.pod Modified: bricolage/trunk/comp/media/js/lib.js =================================================================== --- bricolage/trunk/comp/media/js/lib.js 2009-04-01 17:09:31 UTC (rev 8538) +++ bricolage/trunk/comp/media/js/lib.js 2009-04-01 20:17:32 UTC (rev 8539) @@ -1430,17 +1430,24 @@ }, opts || {}); var element = $('element_' + container_id + '_content'); + var form = $('theForm'); //We need to disable the buttons on the page before we serialize the form //to prevent callback death. MWR 02-23-09 - var buttons = $('theForm').getInputs('image'); + var buttons = form.getInputs('image'); buttons.invoke('disable'); - var params = 'container_id=' + container_id + '&' + Form.serialize($('theForm')); + + // Be sure to call onsubmit() so the wysiwyg fields can be updated. + form.onsubmit(); + submitting = false; // Reset this so we can submit again! + + // Serialize the form. + var params = 'container_id=' + container_id + '&' + Form.serialize(form); if (options.extraParameters != '') { params = params + '&' + options.extraParameters; } - //Now turn the buttons back on. + // Now turn the buttons back on. buttons.invoke('enable'); // Only update the element content with the requst results if the request is Modified: bricolage/trunk/comp/widgets/container_prof/container.html =================================================================== --- bricolage/trunk/comp/widgets/container_prof/container.html 2009-04-01 17:09:31 UTC (rev 8538) +++ bricolage/trunk/comp/widgets/container_prof/container.html 2009-04-01 20:17:32 UTC (rev 8539) @@ -1,3 +1,8 @@ +% if (lc WYSIWYG_EDITOR eq 'xinha') { +<script> + editors = new Array(); +</script> +% } <& 'container.mc', widget => $widget, element => $element, @@ -3,5 +8,10 @@ parent => $parent, &> - +% if (lc WYSIWYG_EDITOR eq 'xinha') { +<script> + var xinha_editors = Xinha.makeEditors(editors, xinha_config, xinha_plugins); + Xinha.startEditors(xinha_editors); +</script> +% } <%once> my $widget = 'container_prof'; Modified: bricolage/trunk/comp/widgets/wysiwyg/xinha.html =================================================================== --- bricolage/trunk/comp/widgets/wysiwyg/xinha.html 2009-04-01 17:09:31 UTC (rev 8538) +++ bricolage/trunk/comp/widgets/wysiwyg/xinha.html 2009-04-01 20:17:32 UTC (rev 8539) @@ -19,9 +19,9 @@ xinha_config = xinha_config ? xinha_config : new Xinha.Config(); xinha_config.toolbar = <% XINHA_TOOLBAR %>; - editors = Xinha.makeEditors(editors, xinha_config, xinha_plugins); + var xinha_editors = Xinha.makeEditors(editors, xinha_config, xinha_plugins); - Xinha.startEditors(editors); + Xinha.startEditors(xinha_editors); } Event.observe(window, "load", xinha_init); Modified: bricolage/trunk/lib/Bric/Changes.pod =================================================================== --- bricolage/trunk/lib/Bric/Changes.pod 2009-04-01 17:09:31 UTC (rev 8538) +++ bricolage/trunk/lib/Bric/Changes.pod 2009-04-01 20:17:32 UTC (rev 8539) @@ -421,9 +421,12 @@ Fixed rendering issues with the action icons on the workspace/desk pages in IE6/7. [Adrian Yee] +=item * + +Xinha works again. Reported by John Durkin and Matt Rolf (Bug #1429). [David] + =back -======= =head1 VERSION 1.11.1 (2008-10-03) =head2 Improvements
|