You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@myfaces.apache.org by lu...@apache.org on 2010/03/29 03:14:49 UTC

svn commit: r928555 [9/16] - in /myfaces/tomahawk/trunk/core20/src/main/resources/META-INF/resources: oam.custom.calendar.DB/ oam.custom.calendar.WH/ oam.custom.calendar.images/ oam.custom.inputHtml.kupudrawers/ oam.custom.inputHtml.kupuimages/ oam.cus...

Added: myfaces/tomahawk/trunk/core20/src/main/resources/META-INF/resources/oam.custom.inputHtml/kupuinit_form.js
URL: http://svn.apache.org/viewvc/myfaces/tomahawk/trunk/core20/src/main/resources/META-INF/resources/oam.custom.inputHtml/kupuinit_form.js?rev=928555&view=auto
==============================================================================
--- myfaces/tomahawk/trunk/core20/src/main/resources/META-INF/resources/oam.custom.inputHtml/kupuinit_form.js (added)
+++ myfaces/tomahawk/trunk/core20/src/main/resources/META-INF/resources/oam.custom.inputHtml/kupuinit_form.js Mon Mar 29 01:14:43 2010
@@ -0,0 +1,295 @@
+/*****************************************************************************
+ *
+ * Copyright (c) 2003-2005 Kupu Contributors. All rights reserved.
+ *
+ * This software is distributed under the terms of the Kupu
+ * License. See LICENSE.txt for license text. For a list of Kupu
+ * Contributors see CREDITS.txt.
+ *
+ *****************************************************************************/
+// $Id: kupuinit_form.js 39345 2007-02-23 18:29:27Z yuppie $
+
+
+//----------------------------------------------------------------------------
+// Sample initialization function
+//
+// This is a copy of initKupu for the form support
+//
+// We only want to disable the save button, but unfortunately that currently
+// still means this method should be overridden completely
+//----------------------------------------------------------------------------
+
+function initKupu(iframe) {
+    /* Although this is meant to be a sample implementation, it can
+        be used out-of-the box to run the sample pagetemplate or for simple
+        implementations that just don't use some elements. When you want
+        to do some customization, this should probably be overridden. For
+        larger customization actions you will have to subclass or roll your
+        own UI object.
+    */
+
+    // first we create a logger
+    var l = new PlainLogger('kupu-toolbox-debuglog', 5);
+
+    // now some config values
+    var conf = loadDictFromXML(document, 'kupuconfig');
+
+    // the we create the document, hand it over the id of the iframe
+    var doc = new KupuDocument(iframe);
+
+    // now we can create the controller
+    var kupu = new KupuEditor(doc, conf, l);
+
+    var contextmenu = new ContextMenu();
+    kupu.setContextMenu(contextmenu);
+
+    // now we can create a UI object which we can use from the UI
+    var ui = new KupuUI('kupu-tb-styles');
+
+    // the ui must be registered to the editor like a tool so it can be notified
+    // of state changes
+    kupu.registerTool('ui', ui); // XXX Should this be a different method?
+
+    // function that returns a function to execute a button command
+    var execCommand = function(cmd) {
+        return function(button, editor) {
+            editor.execCommand(cmd);
+        };
+    };
+
+    var boldchecker = parentWithStyleChecker(['b', 'strong'],
+                                             'fontWeight', 'bold', 'bold');
+    var boldbutton = new KupuStateButton('kupu-bold-button',
+                                         execCommand('bold'),
+                                         boldchecker,
+                                         'kupu-bold',
+                                         'kupu-bold-pressed');
+    kupu.registerTool('boldbutton', boldbutton);
+
+    var italicschecker = parentWithStyleChecker(['i', 'em'],
+                                              'fontStyle', 'italic', 'italic');
+    var italicsbutton = new KupuStateButton('kupu-italic-button',
+                                            execCommand('italic'),
+                                            italicschecker,
+                                            'kupu-italic',
+                                            'kupu-italic-pressed');
+    kupu.registerTool('italicsbutton', italicsbutton);
+
+    var underlinechecker = parentWithStyleChecker(['u'],
+                                   'textDecoration', 'underline', 'underline');
+    var underlinebutton = new KupuStateButton('kupu-underline-button',
+                                              execCommand('underline'),
+                                              underlinechecker,
+                                              'kupu-underline',
+                                              'kupu-underline-pressed');
+    kupu.registerTool('underlinebutton', underlinebutton);
+
+    var subscriptchecker = parentWithStyleChecker(['sub'],
+                                                  null, null, 'subscript');
+    var subscriptbutton = new KupuStateButton('kupu-subscript-button',
+                                              execCommand('subscript'),
+                                              subscriptchecker,
+                                              'kupu-subscript',
+                                              'kupu-subscript-pressed');
+    kupu.registerTool('subscriptbutton', subscriptbutton);
+
+    var superscriptchecker = parentWithStyleChecker(['super', 'sup'],
+                                                    null, null, 'superscript');
+    var superscriptbutton = new KupuStateButton('kupu-superscript-button',
+                                                execCommand('superscript'),
+                                                superscriptchecker,
+                                                'kupu-superscript',
+                                                'kupu-superscript-pressed');
+    kupu.registerTool('superscriptbutton', superscriptbutton);
+
+    var justifyleftbutton = new KupuButton('kupu-justifyleft-button',
+                                           execCommand('justifyleft'));
+    kupu.registerTool('justifyleftbutton', justifyleftbutton);
+
+    var justifycenterbutton = new KupuButton('kupu-justifycenter-button',
+                                             execCommand('justifycenter'));
+    kupu.registerTool('justifycenterbutton', justifycenterbutton);
+
+    var justifyrightbutton = new KupuButton('kupu-justifyright-button',
+                                            execCommand('justifyright'));
+    kupu.registerTool('justifyrightbutton', justifyrightbutton);
+
+    var outdentbutton = new KupuButton('kupu-outdent-button', execCommand('outdent'));
+    kupu.registerTool('outdentbutton', outdentbutton);
+
+    var indentbutton = new KupuButton('kupu-indent-button', execCommand('indent'));
+    kupu.registerTool('indentbutton', indentbutton);
+
+    var undobutton = new KupuButton('kupu-undo-button', execCommand('undo'));
+    kupu.registerTool('undobutton', undobutton);
+
+    var redobutton = new KupuButton('kupu-redo-button', execCommand('redo'));
+    kupu.registerTool('redobutton', redobutton);
+
+    var removeimagebutton = new KupuRemoveElementButton('kupu-removeimage-button',
+                                                        'img',
+                                                        'kupu-removeimage');
+    kupu.registerTool('removeimagebutton', removeimagebutton);
+
+    var removelinkbutton = new KupuRemoveElementButton('kupu-removelink-button',
+                                                       'a',
+                                                       'kupu-removelink');
+    kupu.registerTool('removelinkbutton', removelinkbutton);
+
+    // add some tools
+    var colorchoosertool = new ColorchooserTool('kupu-forecolor-button',
+                                                'kupu-hilitecolor-button',
+                                                'kupu-colorchooser');
+    kupu.registerTool('colorchooser', colorchoosertool);
+
+    var listtool = new ListTool('kupu-list-ul-addbutton',
+                                'kupu-list-ol-addbutton',
+                                'kupu-ulstyles',
+                                'kupu-olstyles');
+    kupu.registerTool('listtool', listtool);
+
+    var definitionlisttool = new DefinitionListTool('kupu-list-dl-addbutton');
+    kupu.registerTool('definitionlisttool', definitionlisttool);
+
+    var proptool = new PropertyTool('kupu-properties-title', 'kupu-properties-description');
+    kupu.registerTool('proptool', proptool);
+
+    var linktool = new LinkTool();
+    kupu.registerTool('linktool', linktool);
+    var linktoolbox = new LinkToolBox("kupu-link-input", "kupu-link-button", 'kupu-toolbox-links', 'kupu-toolbox', 'kupu-toolbox-active');
+    linktool.registerToolBox('linktoolbox', linktoolbox);
+
+    var imagetool = new ImageTool();
+    kupu.registerTool('imagetool', imagetool);
+    var imagetoolbox = new ImageToolBox('kupu-image-input', 'kupu-image-addbutton',
+                                        'kupu-image-float-select', 'kupu-toolbox-images',
+                                        'kupu-toolbox', 'kupu-toolbox-active');
+    imagetool.registerToolBox('imagetoolbox', imagetoolbox);
+
+    var tabletool = new TableTool();
+    kupu.registerTool('tabletool', tabletool);
+    var tabletoolbox = new TableToolBox('kupu-toolbox-addtable',
+        'kupu-toolbox-edittable', 'kupu-table-newrows', 'kupu-table-newcols',
+        'kupu-table-makeheader', 'kupu-table-classchooser',
+        'kupu-table-alignchooser', 'kupu-table-addtable-button',
+        'kupu-table-addrow-button', 'kupu-table-delrow-button',
+        'kupu-table-addcolumn-button', 'kupu-table-delcolumn-button',
+        'kupu-table-fix-button', 'kupu-table-del-button',
+        'kupu-table-fixall-button', 'kupu-toolbox-tables',
+        'kupu-toolbox', 'kupu-toolbox-active');
+    tabletool.registerToolBox('tabletoolbox', tabletoolbox);
+
+    var anchortool = new AnchorTool();
+    kupu.registerTool('anchortool', anchortool);
+
+    var showpathtool = new ShowPathTool();
+    kupu.registerTool('showpathtool', showpathtool);
+
+    var sourceedittool = new SourceEditTool('kupu-source-button',
+                                            'kupu-editor-textarea');
+    kupu.registerTool('sourceedittool', sourceedittool);
+
+    var spellchecker = new KupuSpellChecker('kupu-spellchecker-button',
+                                            'spellcheck.cgi');
+    kupu.registerTool('spellchecker', spellchecker);
+
+    var zoom = new KupuZoomTool('kupu-zoom-button',
+                                'kupu-tb-styles',
+                                'kupu-logo-button');
+    kupu.registerTool('zoomtool', zoom);
+
+    var cleanupexpressions = new CleanupExpressionsTool(
+            'kupucleanupexpressionselect', 'kupucleanupexpressionbutton');
+    kupu.registerTool('cleanupexpressions', cleanupexpressions);
+
+    // Drawers...
+
+    // Function that returns function to open a drawer
+    var opendrawer = function(drawerid) {
+        return function(button, editor) {
+            drawertool.openDrawer(drawerid);
+        };
+    };
+
+    var imagelibdrawerbutton = new KupuButton('kupu-imagelibdrawer-button',
+                                              opendrawer('imagelibdrawer'));
+    kupu.registerTool('imagelibdrawerbutton', imagelibdrawerbutton);
+
+    var linklibdrawerbutton = new KupuButton('kupu-linklibdrawer-button',
+                                             opendrawer('linklibdrawer'));
+    kupu.registerTool('linklibdrawerbutton', linklibdrawerbutton);
+
+    var linkdrawerbutton = new KupuButton('kupu-linkdrawer-button',
+                                          opendrawer('linkdrawer'));
+    kupu.registerTool('linkdrawerbutton', linkdrawerbutton);
+
+    var anchorbutton = new KupuButton('kupu-anchors',
+                                      opendrawer('anchordrawer'));
+    kupu.registerTool('anchorbutton', anchorbutton);
+
+    var tabledrawerbutton = new KupuButton('kupu-tabledrawer-button',
+                                           opendrawer('tabledrawer'));
+    kupu.registerTool('tabledrawerbutton', tabledrawerbutton);
+
+    // create some drawers, drawers are some sort of popups that appear when a
+    // toolbar button is clicked
+    var drawertool = new DrawerTool();
+    kupu.registerTool('drawertool', drawertool);
+
+    try {
+        var linklibdrawer = new LinkLibraryDrawer(linktool,
+                                                  conf.link_xsl_uri,
+                                                  conf.link_libraries_uri,
+                                                  conf.search_links_uri);
+        drawertool.registerDrawer('linklibdrawer', linklibdrawer);
+
+        var imagelibdrawer = new ImageLibraryDrawer(imagetool,
+                                                    conf.image_xsl_uri,
+                                                    conf.image_libraries_uri,
+                                                    conf.search_images_uri);
+        drawertool.registerDrawer('imagelibdrawer', imagelibdrawer);
+    } catch(e) {
+        var msg = _('There was a problem initializing the drawers. Most ' +
+                'likely the XSLT or XML files aren\'t available. If this ' +
+                'is not the Kupu demo version, check your files or the ' +
+                'service that provide them (error: ${error}).',
+                {'error': (e.message || e.toString())});
+        alert(msg);
+    };
+
+    var linkdrawer = new LinkDrawer('kupu-linkdrawer', linktool);
+    drawertool.registerDrawer('linkdrawer', linkdrawer);
+
+    var anchordrawer = new AnchorDrawer('kupu-anchordrawer', anchortool);
+    drawertool.registerDrawer('anchordrawer', anchordrawer);
+
+    var tabledrawer = new TableDrawer('kupu-tabledrawer', tabletool);
+    drawertool.registerDrawer('tabledrawer', tabledrawer);
+
+    // make the prepareForm method get called on form submit
+    // some bug in IE makes it crash on saving the form when a lib drawer
+    // was added to the page at some point, remove it on form submit
+    var savebutton = getFromSelector('kupu-save-button');
+    function prepareForm(event) {
+        var drawer = window.document.getElementById('kupu-librarydrawer');
+        if (drawer) {
+            drawer.parentNode.removeChild(drawer);
+        }
+        kupu.prepareForm(savebutton.form, 'kupu');
+        savebutton.form.submit();
+    };
+    addEventHandler(savebutton, 'click', prepareForm, kupu);
+
+    // register some cleanup filter
+    // remove tags that aren't in the XHTML DTD
+    var nonxhtmltagfilter = new NonXHTMLTagFilter();
+    kupu.registerFilter(nonxhtmltagfilter);
+
+    if (window.kuputoolcollapser) {
+        var collapser = new window.kuputoolcollapser.Collapser(
+                                                        'kupu-toolboxes');
+        collapser.initialize();
+    };
+
+    return kupu;
+}

Added: myfaces/tomahawk/trunk/core20/src/main/resources/META-INF/resources/oam.custom.inputHtml/kupuinit_genericelements.js
URL: http://svn.apache.org/viewvc/myfaces/tomahawk/trunk/core20/src/main/resources/META-INF/resources/oam.custom.inputHtml/kupuinit_genericelements.js?rev=928555&view=auto
==============================================================================
--- myfaces/tomahawk/trunk/core20/src/main/resources/META-INF/resources/oam.custom.inputHtml/kupuinit_genericelements.js (added)
+++ myfaces/tomahawk/trunk/core20/src/main/resources/META-INF/resources/oam.custom.inputHtml/kupuinit_genericelements.js Mon Mar 29 01:14:43 2010
@@ -0,0 +1,276 @@
+/*****************************************************************************
+ *
+ * Copyright (c) 2003-2005 Kupu Contributors. All rights reserved.
+ *
+ * This software is distributed under the terms of the Kupu
+ * License. See LICENSE.txt for license text. For a list of Kupu
+ * Contributors see CREDITS.txt.
+ *
+ *****************************************************************************/
+/*extern CNFTableToolBox GenericElementsTool GenericElementsToolBox */
+// $Id: kupuinit_genericelements.js 39345 2007-02-23 18:29:27Z yuppie $
+
+
+//----------------------------------------------------------------------------
+// Sample initialization function
+//----------------------------------------------------------------------------
+
+function initKupu(iframe) {
+    /* Although this is meant to be a sample implementation, it can
+        be used out-of-the box to run the sample pagetemplate or for simple
+        implementations that just don't use some elements. When you want
+        to do some customization, this should probably be overridden. For
+        larger customization actions you will have to subclass or roll your
+        own UI object.
+    */
+
+    // first we create a logger
+    var l = new PlainLogger('kupu-toolbox-debuglog', 5);
+
+    // now some config values
+    var conf = loadDictFromXML(document, 'kupuconfig');
+
+    // the we create the document, hand it over the id of the iframe
+    var doc = new KupuDocument(iframe);
+
+    // now we can create the controller
+    var kupu = new KupuEditor(doc, conf, l);
+
+    var contextmenu = new ContextMenu();
+    kupu.setContextMenu(contextmenu);
+
+    // now we can create a UI object which we can use from the UI
+    var ui = new KupuUI('kupu-tb-styles');
+
+    // the ui must be registered to the editor like a tool so it can be notified
+    // of state changes
+    kupu.registerTool('ui', ui); // XXX Should this be a different method?
+
+    // add the buttons to the toolbar
+    var savebuttonfunc = function(button, editor) {editor.saveDocument();};
+    var savebutton = new KupuButton('kupu-save-button', savebuttonfunc);
+    kupu.registerTool('savebutton', savebutton);
+
+    // function that returns a function to execute a button command
+    var execCommand = function(cmd) {
+        return function(button, editor) {
+            editor.execCommand(cmd);
+        };
+    };
+
+    var boldchecker = parentWithStyleChecker(['b', 'strong'],
+                                             'fontWeight', 'bold', 'bold');
+    var boldbutton = new KupuStateButton('kupu-bold-button',
+                                         execCommand('bold'),
+                                         boldchecker,
+                                         'kupu-bold',
+                                         'kupu-bold-pressed');
+    kupu.registerTool('boldbutton', boldbutton);
+
+    var italicschecker = parentWithStyleChecker(['i', 'em'],
+                                              'fontStyle', 'italic', 'italic');
+    var italicsbutton = new KupuStateButton('kupu-italic-button',
+                                            execCommand('italic'),
+                                            italicschecker,
+                                            'kupu-italic',
+                                            'kupu-italic-pressed');
+    kupu.registerTool('italicsbutton', italicsbutton);
+
+    var underlinechecker = parentWithStyleChecker(['u'],
+                                   'textDecoration', 'underline', 'underline');
+    var underlinebutton = new KupuStateButton('kupu-underline-button',
+                                              execCommand('underline'),
+                                              underlinechecker,
+                                              'kupu-underline',
+                                              'kupu-underline-pressed');
+    kupu.registerTool('underlinebutton', underlinebutton);
+
+    var subscriptchecker = parentWithStyleChecker(['sub'],
+                                                  null, null, 'subscript');
+    var subscriptbutton = new KupuStateButton('kupu-subscript-button',
+                                              execCommand('subscript'),
+                                              subscriptchecker,
+                                              'kupu-subscript',
+                                              'kupu-subscript-pressed');
+    kupu.registerTool('subscriptbutton', subscriptbutton);
+
+    var superscriptchecker = parentWithStyleChecker(['super', 'sup'],
+                                                    null, null, 'superscript');
+    var superscriptbutton = new KupuStateButton('kupu-superscript-button',
+                                                execCommand('superscript'),
+                                                superscriptchecker,
+                                                'kupu-superscript',
+                                                'kupu-superscript-pressed');
+    kupu.registerTool('superscriptbutton', superscriptbutton);
+
+    var justifyleftbutton = new KupuButton('kupu-justifyleft-button',
+                                           execCommand('justifyleft'));
+    kupu.registerTool('justifyleftbutton', justifyleftbutton);
+
+    var justifycenterbutton = new KupuButton('kupu-justifycenter-button',
+                                             execCommand('justifycenter'));
+    kupu.registerTool('justifycenterbutton', justifycenterbutton);
+
+    var justifyrightbutton = new KupuButton('kupu-justifyright-button',
+                                            execCommand('justifyright'));
+    kupu.registerTool('justifyrightbutton', justifyrightbutton);
+
+    var outdentbutton = new KupuButton('kupu-outdent-button', execCommand('outdent'));
+    kupu.registerTool('outdentbutton', outdentbutton);
+
+    var indentbutton = new KupuButton('kupu-indent-button', execCommand('indent'));
+    kupu.registerTool('indentbutton', indentbutton);
+
+    var undobutton = new KupuButton('kupu-undo-button', execCommand('undo'));
+    kupu.registerTool('undobutton', undobutton);
+
+    var redobutton = new KupuButton('kupu-redo-button', execCommand('redo'));
+    kupu.registerTool('redobutton', redobutton);
+
+    var removeimagebutton = new KupuRemoveElementButton('kupu-removeimage-button',
+                                                        'img',
+                                                        'kupu-removeimage');
+    kupu.registerTool('removeimagebutton', removeimagebutton);
+
+    var removelinkbutton = new KupuRemoveElementButton('kupu-removelink-button',
+                                                       'a',
+                                                       'kupu-removelink');
+    kupu.registerTool('removelinkbutton', removelinkbutton);
+
+    // add some tools
+    var colorchoosertool = new ColorchooserTool('kupu-forecolor-button',
+                                                'kupu-hilitecolor-button',
+                                                'kupu-colorchooser');
+    kupu.registerTool('colorchooser', colorchoosertool);
+
+    var listtool = new ListTool('kupu-list-ul-addbutton',
+                                'kupu-list-ol-addbutton',
+                                'kupu-ulstyles',
+                                'kupu-olstyles');
+    kupu.registerTool('listtool', listtool);
+
+    var definitionlisttool = new DefinitionListTool('kupu-list-dl-addbutton');
+    kupu.registerTool('definitionlisttool', definitionlisttool);
+
+    var proptool = new PropertyTool('kupu-properties-title', 'kupu-properties-description');
+    kupu.registerTool('proptool', proptool);
+
+    var linktool = new LinkTool();
+    kupu.registerTool('linktool', linktool);
+    var linktoolbox = new LinkToolBox("kupu-link-input", "kupu-link-button", 'kupu-toolbox-links', 'kupu-toolbox', 'kupu-toolbox-active');
+    linktool.registerToolBox('linktoolbox', linktoolbox);
+
+    var imagetool = new ImageTool();
+    kupu.registerTool('imagetool', imagetool);
+    var imagetoolbox = new ImageToolBox('kupu-image-input', 'kupu-image-addbutton',
+                                        'kupu-image-float-select', 'kupu-toolbox-images',
+                                        'kupu-toolbox', 'kupu-toolbox-active');
+    imagetool.registerToolBox('imagetoolbox', imagetoolbox);
+
+    var tabletool = new TableTool();
+    kupu.registerTool('tabletool', tabletool);
+    // custom TableToolBox for CNF, Codename Future
+    var tabletoolbox = new CNFTableToolBox('kupu-toolbox-addtable', 
+        'kupu-toolbox-edittable', 'kupu-table-newrows', 'kupu-table-newcols',
+        'kupu-table-makeheader', 'kupu-table-classchooser',
+        'kupu-table-alignchooser', 'kupu-table-addtable-button',
+        'kupu-table-addrow-button', 'kupu-table-delrow-button',
+        'kupu-table-setrowrepeat-button', 'kupu-table-delrowrepeat-button',
+        'kupu-table-addcolumn-button', 'kupu-table-delcolumn-button',
+        'kupu-table-fix-button',
+        'kupu-table-fixall-button', 'kupu-toolbox-tables',
+        'kupu-toolbox', 'kupu-toolbox-active');
+    tabletool.registerToolBox('tabletoolbox', tabletoolbox);
+
+    var anchortool = new AnchorTool();
+    kupu.registerTool('anchortool', anchortool);
+
+    var showpathtool = new ShowPathTool();
+    kupu.registerTool('showpathtool', showpathtool);
+
+    var sourceedittool = new SourceEditTool('kupu-source-button',
+                                            'kupu-editor-textarea');
+    kupu.registerTool('sourceedittool', sourceedittool);
+
+    // Generic elements tool
+    var geneltool = new GenericElementsTool('genericelementsxml');
+    kupu.registerTool('genericelements', geneltool);
+
+    var geneltoolbox = new GenericElementsToolBox('genericelements-elid', 'genericelements-form',
+                            'genericelements-addbutton', 'genericelements-delbutton',
+                            'genericelements-copybutton', 'genericelements-pastebutton',
+                            'genericelements-cancelbutton', 'genericelements-toolbox',
+                            'kupu-toolbox', 'kupu-toolbox-active');
+    geneltool.registerToolBox('genericelementstoolbox', geneltoolbox);
+
+    // Drawers...
+
+    // Function that returns function to open a drawer
+    var opendrawer = function(drawerid) {
+        return function(button, editor) {
+            drawertool.openDrawer(drawerid);
+        };
+    };
+
+    var imagelibdrawerbutton = new KupuButton('kupu-imagelibdrawer-button',
+                                              opendrawer('imagelibdrawer'));
+    kupu.registerTool('imagelibdrawerbutton', imagelibdrawerbutton);
+
+    var linklibdrawerbutton = new KupuButton('kupu-linklibdrawer-button',
+                                             opendrawer('linklibdrawer'));
+    kupu.registerTool('linklibdrawerbutton', linklibdrawerbutton);
+
+    var linkdrawerbutton = new KupuButton('kupu-linkdrawer-button',
+                                          opendrawer('linkdrawer'));
+    kupu.registerTool('linkdrawerbutton', linkdrawerbutton);
+
+    var anchorbutton = new KupuButton('kupu-anchors',
+                                      opendrawer('anchordrawer'));
+    kupu.registerTool('anchorbutton', anchorbutton);
+
+    var tabledrawerbutton = new KupuButton('kupu-tabledrawer-button',
+                                           opendrawer('tabledrawer'));
+    kupu.registerTool('tabledrawerbutton', tabledrawerbutton);
+
+    // create some drawers, drawers are some sort of popups that appear when a
+    // toolbar button is clicked
+    var drawertool = new DrawerTool();
+    kupu.registerTool('drawertool', drawertool);
+
+    try {
+        var linklibdrawer = new LinkLibraryDrawer(linktool,
+                                                  conf.link_xsl_uri,
+                                                  conf.link_libraries_uri,
+                                                  conf.search_links_uri);
+        drawertool.registerDrawer('linklibdrawer', linklibdrawer);
+
+        var imagelibdrawer = new ImageLibraryDrawer(imagetool,
+                                                    conf.image_xsl_uri,
+                                                    conf.image_libraries_uri,
+                                                    conf.search_images_uri);
+        drawertool.registerDrawer('imagelibdrawer', imagelibdrawer);
+    } catch(e) {
+        var msg = _('There was a problem initializing the drawers. Most ' +
+                'likely the XSLT or XML files aren\'t available. If this ' +
+                'is not the Kupu demo version, check your files or the ' +
+                'service that provide them (error: ${error}).',
+                {'error': (e.message || e.toString())});
+        alert(msg);
+    };
+
+    var linkdrawer = new LinkDrawer('kupu-linkdrawer', linktool);
+    drawertool.registerDrawer('linkdrawer', linkdrawer);
+
+    var anchordrawer = new AnchorDrawer('kupu-anchordrawer', anchortool);
+    drawertool.registerDrawer('anchordrawer', anchordrawer);
+
+    var tabledrawer = new TableDrawer('kupu-tabledrawer', tabletool);
+    drawertool.registerDrawer('tabledrawer', tabledrawer);
+
+    // register some cleanup filter
+    // remove tags that aren't in the XHTML DTD
+    var nonxhtmltagfilter = new NonXHTMLTagFilter();
+    kupu.registerFilter(nonxhtmltagfilter);
+
+    return kupu;
+}

Added: myfaces/tomahawk/trunk/core20/src/main/resources/META-INF/resources/oam.custom.inputHtml/kupuinit_multi.js
URL: http://svn.apache.org/viewvc/myfaces/tomahawk/trunk/core20/src/main/resources/META-INF/resources/oam.custom.inputHtml/kupuinit_multi.js?rev=928555&view=auto
==============================================================================
--- myfaces/tomahawk/trunk/core20/src/main/resources/META-INF/resources/oam.custom.inputHtml/kupuinit_multi.js (added)
+++ myfaces/tomahawk/trunk/core20/src/main/resources/META-INF/resources/oam.custom.inputHtml/kupuinit_multi.js Mon Mar 29 01:14:43 2010
@@ -0,0 +1,275 @@
+/*****************************************************************************
+ *
+ * Copyright (c) 2003-2005 Kupu Contributors. All rights reserved.
+ *
+ * This software is distributed under the terms of the Kupu
+ * License. See LICENSE.txt for license text. For a list of Kupu
+ * Contributors see CREDITS.txt.
+ *
+ *****************************************************************************/
+/*extern KupuMultiEditor MultiSourceEditTool */
+// $Id: kupuinit_multi.js 39345 2007-02-23 18:29:27Z yuppie $
+
+
+//----------------------------------------------------------------------------
+// Sample initialization function
+//----------------------------------------------------------------------------
+
+function initKupu(iframeids) {
+    /* Although this is meant to be a sample implementation, it can
+        be used out-of-the box to run the sample pagetemplate or for simple
+        implementations that just don't use some elements. When you want
+        to do some customization, this should probably be overridden. For
+        larger customization actions you will have to subclass or roll your
+        own UI object.
+    */
+
+    // first we create a logger
+    var l = new PlainLogger('kupu-toolbox-debuglog', 5);
+
+    // now some config values
+    var conf = loadDictFromXML(document, 'kupuconfig');
+
+    var documents = [];
+    for (var i=0; i < iframeids.length; i++) {
+        var iframe = getFromSelector(iframeids[i]);
+        documents.push(new KupuDocument(iframe));
+    };
+
+    // now we can create the controller
+    var kupu = new KupuMultiEditor(documents, conf, l);
+
+    /* doesn't work yet
+    var contextmenu = new ContextMenu();
+    kupu.setContextMenu(contextmenu);
+    */
+
+    // now we can create a UI object which we can use from the UI
+    var ui = new KupuUI('kupu-tb-styles');
+
+    // the ui must be registered to the editor like a tool so it can be notified
+    // of state changes
+    kupu.registerTool('ui', ui); // XXX Should this be a different method?
+
+    // function that returns a function to execute a button command
+    var execCommand = function(cmd) {
+        return function(button, editor) {
+            editor.execCommand(cmd);
+        };
+    };
+
+    var boldchecker = parentWithStyleChecker(['b', 'strong'],
+                                             'fontWeight', 'bold', 'bold');
+    var boldbutton = new KupuStateButton('kupu-bold-button',
+                                         execCommand('bold'),
+                                         boldchecker,
+                                         'kupu-bold',
+                                         'kupu-bold-pressed');
+    kupu.registerTool('boldbutton', boldbutton);
+
+    var italicschecker = parentWithStyleChecker(['i', 'em'],
+                                              'fontStyle', 'italic', 'italic');
+    var italicsbutton = new KupuStateButton('kupu-italic-button',
+                                            execCommand('italic'),
+                                            italicschecker,
+                                            'kupu-italic',
+                                            'kupu-italic-pressed');
+    kupu.registerTool('italicsbutton', italicsbutton);
+
+    var underlinechecker = parentWithStyleChecker(['u'],
+                                   'textDecoration', 'underline', 'underline');
+    var underlinebutton = new KupuStateButton('kupu-underline-button',
+                                              execCommand('underline'),
+                                              underlinechecker,
+                                              'kupu-underline',
+                                              'kupu-underline-pressed');
+    kupu.registerTool('underlinebutton', underlinebutton);
+
+    var subscriptchecker = parentWithStyleChecker(['sub'],
+                                                  null, null, 'subscript');
+    var subscriptbutton = new KupuStateButton('kupu-subscript-button',
+                                              execCommand('subscript'),
+                                              subscriptchecker,
+                                              'kupu-subscript',
+                                              'kupu-subscript-pressed');
+    kupu.registerTool('subscriptbutton', subscriptbutton);
+
+    var superscriptchecker = parentWithStyleChecker(['super', 'sup'],
+                                                    null, null, 'superscript');
+    var superscriptbutton = new KupuStateButton('kupu-superscript-button',
+                                                execCommand('superscript'),
+                                                superscriptchecker,
+                                                'kupu-superscript',
+                                                'kupu-superscript-pressed');
+    kupu.registerTool('superscriptbutton', superscriptbutton);
+
+    var justifyleftbutton = new KupuButton('kupu-justifyleft-button',
+                                           execCommand('justifyleft'));
+    kupu.registerTool('justifyleftbutton', justifyleftbutton);
+
+    var justifycenterbutton = new KupuButton('kupu-justifycenter-button',
+                                             execCommand('justifycenter'));
+    kupu.registerTool('justifycenterbutton', justifycenterbutton);
+
+    var justifyrightbutton = new KupuButton('kupu-justifyright-button',
+                                            execCommand('justifyright'));
+    kupu.registerTool('justifyrightbutton', justifyrightbutton);
+
+    var outdentbutton = new KupuButton('kupu-outdent-button', execCommand('outdent'));
+    kupu.registerTool('outdentbutton', outdentbutton);
+
+    var indentbutton = new KupuButton('kupu-indent-button', execCommand('indent'));
+    kupu.registerTool('indentbutton', indentbutton);
+
+    var undobutton = new KupuButton('kupu-undo-button', execCommand('undo'));
+    kupu.registerTool('undobutton', undobutton);
+
+    var redobutton = new KupuButton('kupu-redo-button', execCommand('redo'));
+    kupu.registerTool('redobutton', redobutton);
+
+    var removeimagebutton = new KupuRemoveElementButton('kupu-removeimage-button',
+                                                        'img',
+                                                        'kupu-removeimage');
+    kupu.registerTool('removeimagebutton', removeimagebutton);
+
+    var removelinkbutton = new KupuRemoveElementButton('kupu-removelink-button',
+                                                       'a',
+                                                       'kupu-removelink');
+    kupu.registerTool('removelinkbutton', removelinkbutton);
+
+    // add some tools
+    var colorchoosertool = new ColorchooserTool('kupu-forecolor-button',
+                                                'kupu-hilitecolor-button',
+                                                'kupu-colorchooser');
+    kupu.registerTool('colorchooser', colorchoosertool);
+
+    var listtool = new ListTool('kupu-list-ul-addbutton',
+                                'kupu-list-ol-addbutton',
+                                'kupu-ulstyles',
+                                'kupu-olstyles');
+    kupu.registerTool('listtool', listtool);
+
+    var definitionlisttool = new DefinitionListTool('kupu-list-dl-addbutton');
+    kupu.registerTool('definitionlisttool', definitionlisttool);
+
+    /* dunno if we'll ever want to support this
+    var proptool = new PropertyTool('kupu-properties-title', 'kupu-properties-description');
+    kupu.registerTool('proptool', proptool);
+    */
+
+    var linktool = new LinkTool();
+    kupu.registerTool('linktool', linktool);
+    var linktoolbox = new LinkToolBox("kupu-link-input", "kupu-link-button", 'kupu-toolbox-links', 'kupu-toolbox', 'kupu-toolbox-active');
+    linktool.registerToolBox('linktoolbox', linktoolbox);
+
+    var imagetool = new ImageTool();
+    kupu.registerTool('imagetool', imagetool);
+    var imagetoolbox = new ImageToolBox('kupu-image-input', 'kupu-image-addbutton',
+                                        'kupu-image-float-select', 'kupu-toolbox-images',
+                                        'kupu-toolbox', 'kupu-toolbox-active');
+    imagetool.registerToolBox('imagetoolbox', imagetoolbox);
+
+    var tabletool = new TableTool();
+    kupu.registerTool('tabletool', tabletool);
+    var tabletoolbox = new TableToolBox('kupu-toolbox-addtable',
+        'kupu-toolbox-edittable', 'kupu-table-newrows', 'kupu-table-newcols',
+        'kupu-table-makeheader', 'kupu-table-classchooser',
+        'kupu-table-alignchooser', 'kupu-table-addtable-button',
+        'kupu-table-addrow-button', 'kupu-table-delrow-button',
+        'kupu-table-addcolumn-button', 'kupu-table-delcolumn-button',
+        'kupu-table-fix-button', 'kupu-table-del-button',
+        'kupu-table-fixall-button', 'kupu-toolbox-tables',
+        'kupu-toolbox', 'kupu-toolbox-active');
+    tabletool.registerToolBox('tabletoolbox', tabletoolbox);
+
+    var anchortool = new AnchorTool();
+    kupu.registerTool('anchortool', anchortool);
+
+    var showpathtool = new ShowPathTool();
+    kupu.registerTool('showpathtool', showpathtool);
+
+    var sourceedittool = new MultiSourceEditTool('kupu-source-button',
+                                                 'kupu-editor-textarea-');
+    kupu.registerTool('sourceedittool', sourceedittool);
+
+    var cleanupexpressions = new CleanupExpressionsTool(
+            'kupucleanupexpressionselect', 'kupucleanupexpressionbutton');
+    kupu.registerTool('cleanupexpressions', cleanupexpressions);
+
+    // Drawers...
+
+    // Function that returns function to open a drawer
+    var opendrawer = function(drawerid) {
+        return function(button, editor) {
+            drawertool.openDrawer(drawerid);
+        };
+    };
+
+    var imagelibdrawerbutton = new KupuButton('kupu-imagelibdrawer-button',
+                                              opendrawer('imagelibdrawer'));
+    kupu.registerTool('imagelibdrawerbutton', imagelibdrawerbutton);
+
+    var linklibdrawerbutton = new KupuButton('kupu-linklibdrawer-button',
+                                             opendrawer('linklibdrawer'));
+    kupu.registerTool('linklibdrawerbutton', linklibdrawerbutton);
+
+    var linkdrawerbutton = new KupuButton('kupu-linkdrawer-button',
+                                          opendrawer('linkdrawer'));
+    kupu.registerTool('linkdrawerbutton', linkdrawerbutton);
+
+    var anchorbutton = new KupuButton('kupu-anchors',
+                                      opendrawer('anchordrawer'));
+    kupu.registerTool('anchorbutton', anchorbutton);
+
+    var tabledrawerbutton = new KupuButton('kupu-tabledrawer-button',
+                                           opendrawer('tabledrawer'));
+    kupu.registerTool('tabledrawerbutton', tabledrawerbutton);
+
+    // create some drawers, drawers are some sort of popups that appear when a
+    // toolbar button is clicked
+    var drawertool = new DrawerTool();
+    kupu.registerTool('drawertool', drawertool);
+
+    try {
+        var linklibdrawer = new LinkLibraryDrawer(linktool,
+                                                  conf.link_xsl_uri,
+                                                  conf.link_libraries_uri,
+                                                  conf.search_links_uri);
+        drawertool.registerDrawer('linklibdrawer', linklibdrawer);
+
+        var imagelibdrawer = new ImageLibraryDrawer(imagetool,
+                                                    conf.image_xsl_uri,
+                                                    conf.image_libraries_uri,
+                                                    conf.search_images_uri);
+        drawertool.registerDrawer('imagelibdrawer', imagelibdrawer);
+    } catch(e) {
+        var msg = _('There was a problem initializing the drawers. Most ' +
+                'likely the XSLT or XML files aren\'t available. If this ' +
+                'is not the Kupu demo version, check your files or the ' +
+                'service that provide them (error: ${error}).',
+                {'error': (e.message || e.toString())});
+        alert(msg);
+    };
+
+    var linkdrawer = new LinkDrawer('kupu-linkdrawer', linktool);
+    drawertool.registerDrawer('linkdrawer', linkdrawer);
+
+    var anchordrawer = new AnchorDrawer('kupu-anchordrawer', anchortool);
+    drawertool.registerDrawer('anchordrawer', anchordrawer);
+
+    var tabledrawer = new TableDrawer('kupu-tabledrawer', tabletool);
+    drawertool.registerDrawer('tabledrawer', tabledrawer);
+
+    // register some cleanup filter
+    // remove tags that aren't in the XHTML DTD
+    var nonxhtmltagfilter = new NonXHTMLTagFilter();
+    kupu.registerFilter(nonxhtmltagfilter);
+
+    if (window.kuputoolcollapser) {
+        var collapser = new window.kuputoolcollapser.Collapser(
+                                                        'kupu-toolboxes');
+        collapser.initialize();
+    };
+
+    return kupu;
+}

Added: myfaces/tomahawk/trunk/core20/src/main/resources/META-INF/resources/oam.custom.inputHtml/kupuinspector.js
URL: http://svn.apache.org/viewvc/myfaces/tomahawk/trunk/core20/src/main/resources/META-INF/resources/oam.custom.inputHtml/kupuinspector.js?rev=928555&view=auto
==============================================================================
--- myfaces/tomahawk/trunk/core20/src/main/resources/META-INF/resources/oam.custom.inputHtml/kupuinspector.js (added)
+++ myfaces/tomahawk/trunk/core20/src/main/resources/META-INF/resources/oam.custom.inputHtml/kupuinspector.js Mon Mar 29 01:14:43 2010
@@ -0,0 +1,228 @@
+/*****************************************************************************
+ *
+ * Copyright (c) 2003-2005 Kupu Contributors. All rights reserved.
+ *
+ * This software is distributed under the terms of the Kupu
+ * License. See LICENSE.txt for license text. For a list of Kupu
+ * Contributors see CREDITS.txt.
+ *
+ *****************************************************************************/
+// $Id: kupuinspector.js 35854 2006-12-18 15:37:15Z duncan $
+
+/* The Kupu Inspector tool 
+
+    An Kupu Tool (plugin) that will can be used to show and set attributes
+    on elements. It will show a list of the current element and all of its
+    parents (starting with the body element and working to the current one)
+    with input fields for a default set of attributes and, if defined, a
+    set for that particular element type.
+*/
+
+//----------------------------------------------------------------------------
+// Helper classes
+//----------------------------------------------------------------------------
+
+function Panel() {
+    /* the container (user interface element) of the elements */
+    this.elements = [];
+    
+    this.element = document.createElement('table');
+    this.element.style.width = '100%';
+    this.tbody = document.createElement('tbody');
+    this.element.appendChild(this.tbody);
+    
+    this.addElement = function(element) {
+        this.elements.push(element);
+        for (var i=0; i < element.nodes.length; i++) {
+            this.tbody.appendChild(element.nodes[i]);
+        };
+    };
+};
+
+function Element(node, panel, visibility) {
+    /* an element in the panel (reflecting an element in the document) */
+    this.panel = panel;
+    this.node = node;
+    this.nodes = [];
+    this.default_visibility = visibility;
+    
+    // create a header
+    var labelrow = document.createElement('tr');
+    var labelcell = document.createElement('th');
+    labelcell.style.textDecoration = 'underline';
+    labelcell.style.cursor = 'default';
+    labelcell.setAttribute('colSpan', '2');
+    labelrow.appendChild(labelcell);
+    var nodename = node.nodeName.toLowerCase();
+    var labeltext = document.createTextNode(nodename);
+    labelcell.appendChild(labeltext);
+    
+    this.nodes.push(labelrow);
+
+    this._displayvar = _SARISSA_IS_IE ? 'block' : 'table-row';
+    
+    this.addAttribute = function(attr) {
+        /* add an attribute */
+        
+        function changeHandler() {
+            var name = this.getAttribute('name');
+            var value = this.value;
+            if (name == 'className') {
+                this.element.className = value;
+            } else {
+                this.element.setAttribute(name, value);
+            };
+        };
+        
+        var row = document.createElement('tr');
+        var style = this.default_visibility ? this._displayvar : 'none';
+        row.style.display = style;
+        var labelcell = document.createElement('td');
+        labelcell.style.fontSize = '10px';
+        row.appendChild(labelcell);
+        var text = document.createTextNode(attr + ': ');
+        labelcell.appendChild(text);
+        labelcell.style.color = 'blue';
+        var inputcell = document.createElement('td');
+        inputcell.setAttribute('width', '100%');
+        row.appendChild(inputcell);
+        var input = document.createElement('input');
+        input.setAttribute('type', 'text');
+        input.setAttribute('value', attr == 'className' ? node.className : node.getAttribute(attr));
+        input.setAttribute('name', attr);
+        input.style.width = "100%";
+        input.element = this.node;
+        addEventHandler(input, 'change', changeHandler, input);
+        inputcell.appendChild(input);
+        this.nodes.push(row);
+    };
+
+    this.addStyle = function(stylename) {
+        var row = document.createElement('tr');
+        var style = this.default_visibility ? this._displayvar : 'none';
+        row.style.display = style;
+        var labelcell = document.createElement('td');
+        labelcell.style.fontSize = '10px';
+        row.appendChild(labelcell);
+        var text = document.createTextNode(stylename + ': ');
+        labelcell.appendChild(text);
+        labelcell.style.color = 'red';
+        var inputcell = document.createElement('td');
+        //inputcell.setAttribute('width', '100%');
+        row.appendChild(inputcell);
+        var input = document.createElement('input');
+        input.setAttribute('type', 'text');
+        input.setAttribute('value', node.style[stylename]);
+        input.setAttribute('name', stylename);
+        input.style.width = "100%";
+        input.element = this.node;
+        addEventHandler(input, 'change', function() {this.element.style[this.getAttribute('name')] = this.value;}, input);
+        inputcell.appendChild(input);
+        this.nodes.push(row);
+    };
+
+    this.setVisibility = function(visibility) {
+        for (var i=1; i < this.nodes.length; i++) {
+            this.nodes[i].style.display = visibility ? this._displayvar : 'none';
+        };
+    };
+
+    this.setVisible = function() {
+        for (var i=0; i < this.panel.elements.length; i++) {
+            var el = this.panel.elements[i];
+            if (el != this) {
+                el.setVisibility(false);
+            };
+            this.setVisibility(true);
+        };
+    };
+
+    addEventHandler(labelrow, 'click', this.setVisible, this);
+};
+
+//----------------------------------------------------------------------------
+// The inspector
+//----------------------------------------------------------------------------
+
+function KupuInspector(inspectorelement) {
+    /* the Inspector tool, a tool to set attributes on elements */
+    
+    this.element = getFromSelector(inspectorelement);
+    this._lastnode = null;
+
+    this.default_attrs = ['id', 'className'];
+    this.special_attrs = {'a': ['href', 'name', 'target'],
+                            'img': ['url', 'width', 'height'],
+                            'ul': ['type'],
+                            'ol': ['type'],
+                            'table': ['border', 'cellPadding', 'cellSpacing'],
+                            'td': ['align']
+                            };
+    this.styles = ['background', 'borderWidth', 'borderColor', 
+                                'borderStyle', 'color', 'fontSize', 
+                                'fontFamily', 'float', 'height', 
+                                'lineHeight', 'margin', 'padding', 
+                                'textAlign', 'verticalAlign', 'whiteApace', 
+                                'width'];
+    
+    this.updateState = function(selNode, event) {
+        /* repopulate the inspector (if required) */
+        if (selNode != this._lastnode) {
+            // we need to repopulate
+            this._lastnode = selNode;
+            this._clear();
+            var panel = new Panel();
+            var currnode = selNode;
+            // walk up to the body, add the elements in an array so we can
+            // walk through it backwards later on
+            var els = [];
+            while (currnode.nodeName.toLowerCase() != 'html') {
+                // only use element nodes
+                if (currnode.nodeType == 1) {
+                    els.push(currnode);
+                };
+                currnode = currnode.parentNode;
+            };
+
+            for (var i=0; i < els.length; i++) {
+                // now build an element
+                var node = els[els.length - i - 1];
+                var nodename = node.nodeName.toLowerCase();
+                var visibility = (i == els.length - 1);
+                var element = new Element(node, panel, visibility);
+                
+                // walk through the default attrs
+                for (var j=0; j < this.default_attrs.length; j++) {
+                    var attr = this.default_attrs[j];
+                    element.addAttribute(attr);
+                };
+                // check if there are any special attrs for this type of element
+                if (nodename in this.special_attrs) {
+                    var sattrs = this.special_attrs[nodename];
+                    // add the attrs
+                    for (var j=0; j < sattrs.length; j++) {
+                        var attr = sattrs[j];
+                        element.addAttribute(attr);
+                    };
+                };
+                // and add all applicable styles
+                for (var j=0; j < this.styles.length; j++) {
+                    var style = this.styles[j];
+                    if (style in node.style) {
+                        element.addStyle(style);
+                    };
+                };
+                panel.addElement(element);
+            };
+            this.element.appendChild(panel.element);
+        };
+    };
+
+    this._clear = function() {
+        while (this.element.childNodes.length) {
+            this.element.removeChild(this.element.childNodes[0]);
+        };
+    };
+};
+
+KupuInspector.prototype = new KupuTool;

Added: myfaces/tomahawk/trunk/core20/src/main/resources/META-INF/resources/oam.custom.inputHtml/kupuloggers.js
URL: http://svn.apache.org/viewvc/myfaces/tomahawk/trunk/core20/src/main/resources/META-INF/resources/oam.custom.inputHtml/kupuloggers.js?rev=928555&view=auto
==============================================================================
--- myfaces/tomahawk/trunk/core20/src/main/resources/META-INF/resources/oam.custom.inputHtml/kupuloggers.js (added)
+++ myfaces/tomahawk/trunk/core20/src/main/resources/META-INF/resources/oam.custom.inputHtml/kupuloggers.js Mon Mar 29 01:14:43 2010
@@ -0,0 +1,72 @@
+/*****************************************************************************
+ *
+ * Copyright (c) 2003-2005 Kupu Contributors. All rights reserved.
+ *
+ * This software is distributed under the terms of the Kupu
+ * License. See LICENSE.txt for license text. For a list of Kupu
+ * Contributors see CREDITS.txt.
+ *
+ *****************************************************************************/
+// $Id: kupuloggers.js 928511 2010-03-28 22:53:14Z lu4242 $
+
+
+//----------------------------------------------------------------------------
+// Loggers
+//
+//  Loggers are pretty simple classes, that should have 1 method, called 
+//  'log'. This is called with 2 arguments, the first one is the message to
+//  log and the second is the severity, which can be 0 or some other false
+//  value for debug messages, 1 for warnings and 2 for errors (the loggers
+//  are allowed to raise an exception if that happens).
+//
+//----------------------------------------------------------------------------
+
+function DebugLogger() {
+    /* Alert all messages */
+    
+    this.log = function(message, severity) {
+        /* log a message */
+        if (severity > 1) {
+            alert("Error: " + message);
+        } else if (severity == 1) {
+            alert("Warning: " + message);
+        } else {
+            alert("Log message: " + message);
+        }
+    };
+}
+
+function PlainLogger(debugelid, maxlength) {
+    /* writes messages to a debug tool and throws errors */
+
+    this.debugel = getFromSelector(debugelid);
+    this.maxlength = maxlength;
+    
+    this.log = function(message, severity) {
+        /* log a message */
+        if (severity > 1) {
+            throw message;
+        } else {
+            if (this.maxlength) {
+                if (this.debugel.childNodes.length > this.maxlength - 1) {
+                    this.debugel.removeChild(this.debugel.childNodes[0]);
+                }
+            }
+            var now = new Date();
+            var time = now.getHours() + ':' + now.getMinutes() + ':' + now.getSeconds();
+            
+            var div = document.createElement('div');
+            var text = document.createTextNode(time + ' - ' + message);
+            div.appendChild(text);
+            this.debugel.appendChild(div);
+        }
+    };
+}
+
+function DummyLogger() {
+    this.log = function(message, severity) {
+        if (severity > 1) {
+            throw message;
+        }
+    };
+}

Added: myfaces/tomahawk/trunk/core20/src/main/resources/META-INF/resources/oam.custom.inputHtml/kupumultieditor.js
URL: http://svn.apache.org/viewvc/myfaces/tomahawk/trunk/core20/src/main/resources/META-INF/resources/oam.custom.inputHtml/kupumultieditor.js?rev=928555&view=auto
==============================================================================
--- myfaces/tomahawk/trunk/core20/src/main/resources/META-INF/resources/oam.custom.inputHtml/kupumultieditor.js (added)
+++ myfaces/tomahawk/trunk/core20/src/main/resources/META-INF/resources/oam.custom.inputHtml/kupumultieditor.js Mon Mar 29 01:14:43 2010
@@ -0,0 +1,189 @@
+/*****************************************************************************
+ *
+ * Copyright (c) 2003-2005 Kupu Contributors. All rights reserved.
+ *
+ * This software is distributed under the terms of the Kupu
+ * License. See LICENSE.txt for license text. For a list of Kupu
+ * Contributors see CREDITS.txt.
+ *
+ *****************************************************************************/
+// $Id: kupumultieditor.js 3450 2004-03-28 11:07:30Z guido $
+
+function KupuMultiEditor(documents, config, logger) {
+    /* multiple kupus in one form */
+    this.documents = documents; // array of documents
+    this.config = config;
+    this.log = logger;
+    this.tools = {};
+
+    this._designModeAttempts = 0;
+    this._initialized = false;
+
+    this._previous_range = null;
+
+    // here's where the current active document will be stored
+    this._current_document = documents[0];
+    
+    this.initialize = function() {
+        this._initializeEventHandlers();
+        this.getDocument().getWindow().focus();
+        if (this.getBrowserName() == 'IE') {
+            for (var i=0; i < this.documents.length; i++) {
+                var body = this.documents[i].getDocument().getElementsByTagName('body')[0];
+                body.setAttribute('contentEditable', 'true');
+            };
+            // provide an 'afterInit' method on KupuEditor.prototype
+            // for additional bootstrapping (after editor init)
+            this._initialized = true;
+            if (this.afterInit) {
+                this.afterInit();
+            };
+            this._saveSelection();
+            this.logMessage(_('Editor initialized'));
+        } else {
+            this._setDesignModeWhenReady();
+        };
+    };
+
+    this.updateStateHandler = function(event) {
+        /* check whether the event is interesting enough to trigger the 
+        updateState machinery and act accordingly */
+        var interesting_codes = [8, 13, 37, 38, 39, 40, 46];
+        if (event.type == 'click' || event.type == 'dblclick' || 
+                event.type == 'select' ||
+                (event.type == 'keyup' && 
+                    interesting_codes.contains(event.keyCode))) {
+            var target = event.target ? event.target : event.srcElement;
+            // find the document targeted
+            while (target.nodeType != 9) {
+                target = target.parentNode;
+            };
+            var document = null;
+            for (var i=0; i < this.documents.length; i++) {
+                document = this.documents[i];
+                if (document.getDocument() == target) {
+                    break;
+                };
+            };
+            if (!document) {
+                alert('No document found!');
+                return;
+            };
+            this._current_document = document;
+            this.updateState(event);
+        };
+        // unfortunately it's not possible to do this on blur, since that's
+        // too late. also (some versions of?) IE 5.5 doesn't support the
+        // onbeforedeactivate event, which would be ideal here...
+        if (this.getBrowserName() == 'IE') {
+            this._saveSelection();
+        };
+    };
+
+    this.saveDocument = function() {
+        throw('Not supported, use prepareForm to attach the editor to a form');
+    };
+
+    this.getDocument = function() {
+        /* return the current active document */
+        return this._current_document;
+    };
+
+    this._initializeEventHandlers = function() {
+        /* attache the event handlers to the iframe */
+        for (var i=0; i < this.documents.length; i++) {
+            var doc = this.documents[i].getDocument();
+            this._addEventHandler(doc, "click", this.updateStateHandler, this);
+            this._addEventHandler(doc, "keyup", this.updateStateHandler, this);
+            if (this.getBrowserName() == "IE") {
+                this._addEventHandler(doc, "dblclick", this.updateStateHandler, this);
+                this._addEventHandler(doc, "select", this.updateStateHandler, this);
+            };
+        };
+    };
+
+    this._setDesignModeWhenReady = function() {
+        this._designModeSetAttempts++;
+        if (this._designModeSetAttempts > 25) {
+            alert(_('Couldn\'t set design mode. Kupu will not work on this browser.'));
+            return;
+        };
+        var should_retry = false;
+        for (var i=0; i < this.documents.length; i++) {
+            var document = this.documents[i];
+            if (!document._designModeSet) {
+                try {
+                    this._setDesignMode(document);
+                    document._designModeSet = true;
+                } catch(e) {
+                    should_retry = true;
+                };
+            };
+        };
+        if (should_retry) {
+            timer_instance.registerFunction(this, this._setDesignModeWhenReady, 100);
+        } else {
+            // provide an 'afterInit' method on KupuEditor.prototype
+            // for additional bootstrapping (after editor init)
+            if (this.afterInit) {
+                this.afterInit();
+            };
+            this._initialized = true;
+        };
+    };
+
+    this._setDesignMode = function(doc) {
+        doc.getDocument().designMode = "On";
+        doc.execCommand("undo");
+    };
+
+    // XXX perhaps we can partially move this to a helper method to approve
+    // code reuse?
+    this.prepareForm = function(form, idprefix) {
+        /* add some fields to the form and place the contents of the iframes 
+        */
+        var sourcetool = this.getTool('sourceedittool');
+        if (sourcetool) {sourcetool.cancelSourceMode();};
+
+        // make sure people can't edit or save during saving
+        if (!this._initialized) {
+            return;
+        }
+        this._initialized = false;
+        
+        // set the window status so people can see we're actually saving
+        window.status= _("Please wait while saving document...");
+
+        // set a default id
+        if (!idprefix) {
+            idprefix = 'kupu';
+        };
+        
+        // pass the content through the filters
+        this.logMessage(_("Starting HTML cleanup"));
+        var contents = [];
+        for (var i=0; i < this.documents.length; i++) {
+            var transform = this._filterContent(this.documents[i].getDocument().documentElement);
+            contents.push(this._serializeOutputToString(transform));
+        };
+        
+        this.logMessage(_("Cleanup done, sending document to server"));
+        
+        // now create the form input, since IE 5.5 doesn't support the 
+        // ownerDocument property we use window.document as a fallback (which
+        // will almost by definition be correct).
+        var document = form.ownerDocument ? form.ownerDocument : window.document;
+        for (var i=0; i < contents.length; i++) {
+            var ta = document.createElement('textarea');
+            ta.style.visibility = 'hidden';
+            var text = document.createTextNode(contents[i]);
+            ta.appendChild(text);
+            ta.setAttribute('name', idprefix + '_' + i);
+            
+            // and add it to the form
+            form.appendChild(ta);
+        };
+    };
+};
+
+KupuMultiEditor.prototype = new KupuEditor;

Added: myfaces/tomahawk/trunk/core20/src/main/resources/META-INF/resources/oam.custom.inputHtml/kupunoi18n.js
URL: http://svn.apache.org/viewvc/myfaces/tomahawk/trunk/core20/src/main/resources/META-INF/resources/oam.custom.inputHtml/kupunoi18n.js?rev=928555&view=auto
==============================================================================
--- myfaces/tomahawk/trunk/core20/src/main/resources/META-INF/resources/oam.custom.inputHtml/kupunoi18n.js (added)
+++ myfaces/tomahawk/trunk/core20/src/main/resources/META-INF/resources/oam.custom.inputHtml/kupunoi18n.js Mon Mar 29 01:14:43 2010
@@ -0,0 +1,11 @@
+window._ = function(msgid, interpolations) {
+    /* dummy _ function for systems that don't want to use i18n */
+    if (interpolations) {
+        for (var id in interpolations) {
+            var value = interpolations[id];
+            var reg = new RegExp('\\\$\\\{' + id + '\\\}', 'g');
+            msgid = msgid.replace(reg, ""+value);
+        };
+    };
+    return msgid;
+};

Added: myfaces/tomahawk/trunk/core20/src/main/resources/META-INF/resources/oam.custom.inputHtml/kupusaveonpart.js
URL: http://svn.apache.org/viewvc/myfaces/tomahawk/trunk/core20/src/main/resources/META-INF/resources/oam.custom.inputHtml/kupusaveonpart.js?rev=928555&view=auto
==============================================================================
--- myfaces/tomahawk/trunk/core20/src/main/resources/META-INF/resources/oam.custom.inputHtml/kupusaveonpart.js (added)
+++ myfaces/tomahawk/trunk/core20/src/main/resources/META-INF/resources/oam.custom.inputHtml/kupusaveonpart.js Mon Mar 29 01:14:43 2010
@@ -0,0 +1,20 @@
+/*****************************************************************************
+ *
+ * Copyright (c) 2003-2005 Kupu Contributors. All rights reserved.
+ *
+ * This software is distributed under the terms of the Kupu
+ * License. See LICENSE.txt for license text. For a list of Kupu
+ * Contributors see CREDITS.txt.
+ *
+ *****************************************************************************/
+// $Id: kupusaveonpart.js 35854 2006-12-18 15:37:15Z duncan $
+
+function saveOnPart() {
+    /* ask the user if (s)he wants to save the document before leaving */
+    if (kupu.content_changed && confirm(
+            _('You are leaving the editor. Do you want to save your changes?')
+            )) {
+        kupu.config.reload_src = 0;
+        kupu.saveDocument(false, true);
+    };
+}

Added: myfaces/tomahawk/trunk/core20/src/main/resources/META-INF/resources/oam.custom.inputHtml/kupusourceedit.js
URL: http://svn.apache.org/viewvc/myfaces/tomahawk/trunk/core20/src/main/resources/META-INF/resources/oam.custom.inputHtml/kupusourceedit.js?rev=928555&view=auto
==============================================================================
--- myfaces/tomahawk/trunk/core20/src/main/resources/META-INF/resources/oam.custom.inputHtml/kupusourceedit.js (added)
+++ myfaces/tomahawk/trunk/core20/src/main/resources/META-INF/resources/oam.custom.inputHtml/kupusourceedit.js Mon Mar 29 01:14:43 2010
@@ -0,0 +1,128 @@
+/*****************************************************************************
+ *
+ * Copyright (c) 2003-2005 Kupu Contributors. All rights reserved.
+ *
+ * This software is distributed under the terms of the Kupu
+ * License. See LICENSE.txt for license text. For a list of Kupu
+ * Contributors see CREDITS.txt.
+ *
+ *****************************************************************************/
+// $Id: kupusourceedit.js 928511 2010-03-28 22:53:14Z lu4242 $
+
+
+function SourceEditTool(sourcebuttonid, sourceareaid) {
+    /* Source edit tool to edit document's html source */
+    this.sourceButton = getFromSelector(sourcebuttonid);
+    this.sourcemode = false;
+    this._currently_editing = null;
+
+    // method defined inline to support closure
+    // XXX would be nice to have this defined on the prototype too, because
+    // of subclassing issues?
+    this.getSourceArea = function() {
+        return getFromSelector(sourceareaid);
+    };
+};
+
+SourceEditTool.prototype = new KupuTool;
+
+SourceEditTool.prototype.cancelSourceMode = function() {
+    if (this._currently_editing) {
+        this.switchSourceEdit(null, true);
+    }
+};
+
+SourceEditTool.prototype.updateState = 
+        SourceEditTool.prototype.cancelSourceMode;
+
+SourceEditTool.prototype.initialize = function(editor) {
+    /* attach the event handlers */
+    this.editor = editor;
+    if (!this.sourceButton) return;
+    addEventHandler(this.sourceButton, "click", this.switchSourceEdit, this);
+    this.editor.logMessage(_('Source edit tool initialized'));
+};
+
+SourceEditTool.prototype.switchSourceEdit = function(event, nograb) {
+    var kupu = this.editor;
+    var docobj = this._currently_editing||kupu.getDocument();
+    var editorframe = docobj.getEditable();
+    var sourcearea = this.getSourceArea();
+    var kupudoc = docobj.getDocument();
+    var sourceClass = 'kupu-sourcemode';
+
+    if (!this.sourcemode) {
+        if (window.drawertool) {
+            window.drawertool.closeDrawer();
+        }
+        if (/on/i.test(kupudoc.designMode)) {
+            kupudoc.designMode = 'Off';
+        };
+        kupu._initialized = false;
+
+        var data='';
+        if(kupu.config.filtersourceedit) {
+            window.status = _('Cleaning up HTML...');
+            var transform = kupu._filterContent(kupu.getInnerDocument().documentElement);
+            data = kupu.getXMLBody(transform);
+            data = kupu._fixupSingletons(data).replace(/<\/?body[^>]*>/g, "");
+            if (kupu._getBase && kupu.makeLinksRelative) {
+                var base = kupu._getBase(transform);
+                data = kupu.makeLinksRelative(data, base).replace(/<\/?body[^>]*>/g, "");
+            };
+            window.status = '';
+        } else {
+            data = kupu.getHTMLBody();
+        }
+        sourcearea.value = data.strip();
+        kupu.setClass(sourceClass);
+        editorframe.style.display = 'none';
+        sourcearea.style.display = 'block';
+        if (!nograb) {
+            sourcearea.focus();
+        };
+        this._currently_editing = docobj;
+      } else {
+        kupu.setHTMLBody(sourcearea.value);
+        kupu.clearClass(sourceClass);
+        sourcearea.style.display = 'none';
+        editorframe.style.display = 'block';
+        if (/off/i.test(kupudoc.designMode)) {
+            kupudoc.designMode = 'On';
+        };
+        if (!nograb) {
+            docobj.getWindow().focus();
+            var selection = this.editor.getSelection();
+            selection.collapse();
+        };
+
+        kupu._initialized = true;
+        this._currently_editing = null;
+        this.editor.updateState();
+    };
+    this.sourcemode = !this.sourcemode;
+};
+
+SourceEditTool.prototype.enable = function() {
+    kupuButtonEnable(this.sourceButton);
+};
+
+SourceEditTool.prototype.disable = function() {
+    kupuButtonDisable(this.sourceButton);
+};
+
+function MultiSourceEditTool(sourcebuttonid, textareaprefix) {
+    /* Source edit tool to edit document's html source */
+    this.sourceButton = getFromSelector(sourcebuttonid);
+    this.textareaprefix = textareaprefix;
+
+    this._currently_editing = null;
+};
+
+MultiSourceEditTool.prototype = new SourceEditTool;
+
+MultiSourceEditTool.prototype.getSourceArea = function() {
+    var docobj = this._currently_editing||kupu.getDocument();
+    var sourceareaid = this.textareaprefix + docobj.getEditable().id;
+    return getFromSelector(sourceareaid);
+};

Added: myfaces/tomahawk/trunk/core20/src/main/resources/META-INF/resources/oam.custom.inputHtml/kupuspellchecker.js
URL: http://svn.apache.org/viewvc/myfaces/tomahawk/trunk/core20/src/main/resources/META-INF/resources/oam.custom.inputHtml/kupuspellchecker.js?rev=928555&view=auto
==============================================================================
--- myfaces/tomahawk/trunk/core20/src/main/resources/META-INF/resources/oam.custom.inputHtml/kupuspellchecker.js (added)
+++ myfaces/tomahawk/trunk/core20/src/main/resources/META-INF/resources/oam.custom.inputHtml/kupuspellchecker.js Mon Mar 29 01:14:43 2010
@@ -0,0 +1,201 @@
+function KupuSpellChecker(buttonid, scripturl, spanstyle, 
+                            winwidth, winheight, skip_tags) {
+    this.button = document.getElementById(buttonid);
+    this.scripturl = scripturl;
+    this.spanstyle = spanstyle || 'color: red; ' +
+                                    'text-decoration: underline;';
+    this.winwidth = winwidth || '600';
+    this.winheight = winheight || '400';
+    this.skip_tags = skip_tags || ['head', 'script'];
+};
+
+KupuSpellChecker.prototype = new KupuTool;
+
+KupuSpellChecker.prototype.initialize = function(editor) {
+    this.editor = editor;
+    if (this.button) {
+        addEventHandler(this.button, 'click', this.check, this);
+    }
+};
+
+KupuSpellChecker.prototype.check = function() {
+    var request = new XMLHttpRequest();
+    request.open('POST', this.scripturl, true);
+    request.setRequestHeader('Content-Type', 
+                                'application/x-www-form-urlencoded');
+    request.onreadystatechange = new ContextFixer(
+                                    this.stateChangeHandler,
+                                    this,
+                                    request).execute;
+    var result = this.getCurrentContents();
+    result = encodeURIComponent(result.reduceWhitespace().strip());
+    request.send('text=' + result);
+};
+
+KupuSpellChecker.prototype.stateChangeHandler = function(request) {
+    if (request.readyState == 4) {
+        if (request.status == '200') {
+            var result = request.responseXML;
+            result = this.xmlToMapping(result);
+            if (!result) {
+                alert(_('There were no errors.'));
+            } else {
+                this.displayUnrecognized(result);
+            };
+        } else {
+            alert(_('Error loading data, status ${status}',
+                    {'status': request.status}));
+        };
+    };
+};
+
+KupuSpellChecker.prototype.getCurrentContents = function() {
+    var doc = this.editor.getInnerDocument().documentElement;
+    var iterator = new NodeIterator(doc);
+    var bits = [];
+    while (true) {
+        var node = iterator.next();
+        if (!node || node.nodeName.toLowerCase() == 'body') {
+            break;
+        };
+        while (this.skip_tags.contains(node.nodeName.toLowerCase())) {
+            node = node.nextSibling;
+            iterator.setCurrent(node);
+        };
+        if (node.nodeType == 3) {
+            bits.push(node.nodeValue);
+        };
+    };
+    return bits.join(' ');
+};
+
+KupuSpellChecker.prototype.displayUnrecognized = function(mapping) {
+    // copy the current editable document into a new window
+    var doc = this.editor.getInnerDocument();
+    var docel = doc.documentElement;
+    var win = window.open('kupublank.html', 'spellchecker', 
+                            'width=' + this.winwidth + ',' +
+                            'height=' + this.winheight + ',toolbar=no,' +
+                            'menubar=no,scrollbars=yes,status=yes');
+    if (!win) {
+        alert(
+            _('This feature requires pop-ups to be enabled on your browser!'));
+        return;
+    };
+    var html = docel.innerHTML;
+    // when Moz tries to set the content-type, for some reason leaving this
+    // in breaks the feature(?!?)
+    html = html.replace(/<meta[^>]*http-equiv="[Cc]ontent-[Tt]ype"[^>]*>/gm, 
+                        '');
+    win.document.write('<html>' + html + '</html>');
+    win.deentitize = function(str) {return str.deentitize();};
+    win.document.close();
+    if (!win.document.getElementsByTagName('body').length) {
+        addEventHandler(win, 'load', this.continueDisplay, this, win, mapping);
+    } else {
+        this.continueDisplay(win, mapping);
+    };
+};
+
+KupuSpellChecker.prototype.continueDisplay = function(win, mapping) {
+    /* walk through all elements of the body, colouring the text nodes */
+    // start it all with a timeout to make Mozilla render the content first
+    timer_instance.registerFunction(this, this.continueDisplayHelper,
+                                    1000, win, mapping);
+};
+
+KupuSpellChecker.prototype.continueDisplayHelper = function(win, mapping) {
+    var body = win.document.getElementsByTagName('body')[0];
+    body.setAttribute('contentEditable', 'false');
+    var iterator = new NodeIterator(body);
+    var node = iterator.next();
+    timer_instance.registerFunction(this, this.displayHelperNodeLoop,
+                                    10, iterator, node, win, mapping);
+};
+
+KupuSpellChecker.prototype.displayHelperNodeLoop = function(iterator, node, 
+                                                                win, mapping) {
+    if (!node || node.nodeName.toLowerCase() == 'body') {
+        return;
+    };
+    var next = iterator.next();
+    if (node.nodeType == 3) {
+        if (win.closed) {
+            return;
+        };
+        var span = win.document.createElement('span');
+        var before = node.nodeValue;
+        var after = this.colourText(before, mapping);
+        if (before != after) {
+            span.innerHTML = after;
+            var last = span.lastChild;
+            var parent = node.parentNode;
+            parent.replaceChild(last, node);
+            while (span.hasChildNodes()) {
+                parent.insertBefore(span.firstChild, last);
+            };
+        };
+    } else if (node.nodeType == 1 && node.nodeName.toLowerCase() == 'a') {
+        var cancelEvent = function(e) {
+            if (e.preventDefault) {
+                e.preventDefault();
+            } else {
+                e.returnValue = false;
+            };
+            return false;
+        };
+        addEventHandler(node, 'click', cancelEvent);
+        addEventHandler(node, 'mousedown', cancelEvent);
+        addEventHandler(node, 'mouseup', cancelEvent);
+    };
+    // using a timeout here makes Moz render the coloring while it's busy, and
+    // will make it stop popping up 'do you want to continue' prompts...
+    timer_instance.registerFunction(this, this.displayHelperNodeLoop,
+                                    10, iterator, next, win, mapping);
+};
+
+KupuSpellChecker.prototype.colourText = function(text, mapping) {
+    var currtext = text;
+    var newtext = '';
+    for (var word in mapping) {
+        var replacements = mapping[word];
+        replacements = replacements.entitize();
+        replacements = replacements.replace(/\'/g, "&apos;");
+        var reg = new RegExp('^(.*\\\W)?(' + word + ')(\\\W.*)?$', 'mg');
+        while (true) {
+            var match = reg.exec(currtext);
+            if (!match) {
+                newtext += currtext;
+                currtext = newtext;
+                newtext = '';
+                break;
+            };
+            var m = (match[1] || '') + match[2];
+            newtext += currtext.substr(0, currtext.indexOf(m));
+            newtext += (match[1] || '') +
+                        '<span style="' + this.spanstyle + '" ' +
+                        'onclick="alert(deentitize(\'' + 
+                        replacements + '\'));" ' +
+                        'title="' + replacements + '">' +
+                        match[2] +
+                        '</span>';
+            currtext = currtext.substr(currtext.indexOf(m) + m.length);
+        };
+    };
+    return currtext;
+};
+
+KupuSpellChecker.prototype.xmlToMapping = function(docnode) {
+    var docel = docnode.documentElement;
+    var result = {};
+    var incorrect = docel.getElementsByTagName('incorrect');
+    for (var i=0; i < incorrect.length; i++) {
+        var word = incorrect[i].firstChild.firstChild.nodeValue;
+        var replacements = '';
+        if (incorrect[i].lastChild.hasChildNodes()) {
+            replacements = incorrect[i].lastChild.firstChild.nodeValue;
+        };
+        result[word] = replacements;
+    };
+    return result;
+};

Added: myfaces/tomahawk/trunk/core20/src/main/resources/META-INF/resources/oam.custom.inputHtml/kupustart.js
URL: http://svn.apache.org/viewvc/myfaces/tomahawk/trunk/core20/src/main/resources/META-INF/resources/oam.custom.inputHtml/kupustart.js?rev=928555&view=auto
==============================================================================
--- myfaces/tomahawk/trunk/core20/src/main/resources/META-INF/resources/oam.custom.inputHtml/kupustart.js (added)
+++ myfaces/tomahawk/trunk/core20/src/main/resources/META-INF/resources/oam.custom.inputHtml/kupustart.js Mon Mar 29 01:14:43 2010
@@ -0,0 +1,65 @@
+/*****************************************************************************
+ *
+ * Copyright (c) 2003-2005 Kupu Contributors. All rights reserved.
+ *
+ * This software is distributed under the terms of the Kupu
+ * License. See LICENSE.txt for license text. For a list of Kupu
+ * Contributors see CREDITS.txt.
+ *
+ *****************************************************************************/
+// $Id: kupustart.js 928511 2010-03-28 22:53:14Z lu4242 $
+
+// myFaces : added parameter
+function startKupu( iframeId ) {
+    // first let's load the message catalog
+    // if there's no global 'i18n_message_catalog' variable available, don't
+    // try to load any translations
+    if (window.i18n_message_catalog) {
+        var request = new XMLHttpRequest();
+        // sync request, scary...
+        request.open('GET', 'kupu-pox.cgi', false);
+        request.send('');
+        if (request.status != '200') {
+            alert('Error loading translation (status ' + status +
+                    '), falling back to english');
+        } else {
+            // load successful, continue
+            var dom = request.responseXML;
+            window.i18n_message_catalog.initialize(dom);
+        };
+    };
+    
+    // initialize the editor, initKupu groks 1 arg, a reference to the iframe
+    // myFaces : added iframeId
+    var frame = getFromSelector( iframeId ); 
+    var kupu = initKupu(frame);
+    
+    // this makes the editor's content_changed attribute set according to changes
+    // in a textarea or input (registering onchange, see saveOnPart() for more
+    // details)
+    kupu.registerContentChanger(getFromSelector('kupu-editor-textarea'));
+
+	/* myFaces : disable this
+    // let's register saveOnPart(), to ask the user if he wants to save when 
+    // leaving after editing
+    if (kupu.getBrowserName() == 'IE') {
+        // IE supports onbeforeunload, so let's use that
+        addEventHandler(window, 'beforeunload', saveOnPart);
+    } else {
+        // some versions of Mozilla support onbeforeunload (starting with 1.7)
+        // so let's try to register and if it fails fall back on onunload
+        var re = /rv:([0-9\.]+)/;
+        var match = re.exec(navigator.userAgent);
+        if (match && match[1] && parseFloat(match[1]) > 1.6) {
+            addEventHandler(window, 'beforeunload', saveOnPart);
+        } else {
+            addEventHandler(window, 'unload', saveOnPart);
+        };
+    };
+    */
+
+    // and now we can initialize...
+    kupu.initialize();
+
+    return kupu;
+}

Added: myfaces/tomahawk/trunk/core20/src/main/resources/META-INF/resources/oam.custom.inputHtml/kupustart_form.js
URL: http://svn.apache.org/viewvc/myfaces/tomahawk/trunk/core20/src/main/resources/META-INF/resources/oam.custom.inputHtml/kupustart_form.js?rev=928555&view=auto
==============================================================================
--- myfaces/tomahawk/trunk/core20/src/main/resources/META-INF/resources/oam.custom.inputHtml/kupustart_form.js (added)
+++ myfaces/tomahawk/trunk/core20/src/main/resources/META-INF/resources/oam.custom.inputHtml/kupustart_form.js Mon Mar 29 01:14:43 2010
@@ -0,0 +1,56 @@
+/*****************************************************************************
+ *
+ * Copyright (c) 2003-2005 Kupu Contributors. All rights reserved.
+ *
+ * This software is distributed under the terms of the Kupu
+ * License. See LICENSE.txt for license text. For a list of Kupu
+ * Contributors see CREDITS.txt.
+ *
+ *****************************************************************************/
+// $Id: kupustart_form.js 928511 2010-03-28 22:53:14Z lu4242 $
+
+function startKupu() {
+    // initialize the editor, initKupu groks 1 arg, a reference to the iframe
+    var frame = getFromSelector('kupu-editor'); 
+    var kupu = initKupu(frame);
+    
+    // first let's load the message catalog
+    // if there's no global 'i18n_message_catalog' variable available, don't
+    // try to load any translations
+    if (!window.i18n_message_catalog) {
+        continueStartKupu(kupu);
+        return kupu;
+    };
+    // loading will be done asynchronously (to keep Mozilla from freezing)
+    // so we'll continue in a follow-up function (continueStartKupu() below)
+    var handler = function(request) {
+        if (this.readyState == 4) {
+            var status = this.status;
+            if (status != '200') {
+            	// myFaces : alert disabled right now (Needs to be fixed)
+                //alert(_('Error loading translation (status ${status} ' +
+                //        '), falling back to english'), {'status': status});
+                continueStartKupu(kupu);
+                return;
+            };
+            var dom = this.responseXML;
+            window.i18n_message_catalog.initialize(dom);
+            continueStartKupu(kupu);
+        };
+    };
+    var request = new XMLHttpRequest();
+    request.onreadystatechange = (new ContextFixer(handler, request)).execute;
+    request.open('GET', 'kupu.pox', true);
+    request.send('');
+
+    // we need to return a reference to the editor here for certain 'external'
+    // stuff, developers should note that it's not yet initialized though, we
+    // need to wait for i18n data before we can do that
+    return kupu;
+};
+
+function continueStartKupu(kupu) {
+    kupu.initialize();
+
+    return kupu;
+}