incubator-graffito-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From clomb...@apache.org
Subject svn commit: r454522 [8/10] - in /incubator/graffito/trunk: applications/browser/src/java/org/apache/portals/graffito/servlets/ applications/browser/src/java/org/apache/portals/graffito/servlets/browser/ applications/browser/src/webapp/META-INF/ applica...
Date Mon, 09 Oct 2006 21:28:32 GMT
Added: incubator/graffito/trunk/applications/browser/src/webapp/kupu-1.3.5/kupuinit.js
URL: http://svn.apache.org/viewvc/incubator/graffito/trunk/applications/browser/src/webapp/kupu-1.3.5/kupuinit.js?view=auto&rev=454522
==============================================================================
--- incubator/graffito/trunk/applications/browser/src/webapp/kupu-1.3.5/kupuinit.js (added)
+++ incubator/graffito/trunk/applications/browser/src/webapp/kupu-1.3.5/kupuinit.js Mon Oct  9 14:28:27 2006
@@ -0,0 +1,268 @@
+/*****************************************************************************
+ *
+ * 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.js 16467 2005-08-25 11:08:10Z guido $
+
+
+//----------------------------------------------------------------------------
+// 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(new Array('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(new Array('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(new Array('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(new Array('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(new Array('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
+    // XXX would it be better to pass along elements instead of ids?
+    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-fixall-button', 'kupu-toolbox-tables',
+        'kupu-toolbox', 'kupu-toolbox-active'
+        );
+    tabletool.registerToolBox('tabletoolbox', tabletoolbox);
+
+    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.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 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['link_images_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 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: incubator/graffito/trunk/applications/browser/src/webapp/kupu-1.3.5/kupuinit_experimental.js
URL: http://svn.apache.org/viewvc/incubator/graffito/trunk/applications/browser/src/webapp/kupu-1.3.5/kupuinit_experimental.js?view=auto&rev=454522
==============================================================================
--- incubator/graffito/trunk/applications/browser/src/webapp/kupu-1.3.5/kupuinit_experimental.js (added)
+++ incubator/graffito/trunk/applications/browser/src/webapp/kupu-1.3.5/kupuinit_experimental.js Mon Oct  9 14:28:27 2006
@@ -0,0 +1,220 @@
+/*****************************************************************************
+ *
+ * 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_experimental.js 9879 2005-03-18 12:04:00Z 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(new Array('b', 'strong'),
+                                             'fontWeight', 'bold');
+    var boldbutton = new KupuStateButton('kupu-bold-button', 
+                                         execCommand('bold'),
+                                         boldchecker,
+                                         'kupu-bold',
+                                         'kupu-bold-pressed');
+    kupu.registerTool('boldbutton', boldbutton);
+
+    var italicschecker = ParentWithStyleChecker(new Array('i', 'em'),
+                                                'fontStyle', 'italic');
+    var italicsbutton = new KupuStateButton('kupu-italic-button', 
+                                           execCommand('italic'),
+                                           italicschecker, 
+                                           'kupu-italic', 
+                                           'kupu-italic-pressed');
+    kupu.registerTool('italicsbutton', italicsbutton);
+
+    var underlinechecker = ParentWithStyleChecker(new Array('u'),
+                                                'textDecoration', 'underline');
+    var underlinebutton = new KupuStateButton('kupu-underline-button', 
+                                              execCommand('underline'),
+                                              underlinechecker,
+                                              'kupu-underline', 
+                                              'kupu-underline-pressed');
+    kupu.registerTool('underlinebutton', underlinebutton);
+
+    var subscriptchecker = ParentWithStyleChecker(new Array('sub'));
+    var subscriptbutton = new KupuStateButton('kupu-subscript-button',
+                                              execCommand('subscript'),
+                                              subscriptchecker,
+                                              'kupu-subscript',
+                                              'kupu-subscript-pressed');
+    kupu.registerTool('subscriptbutton', subscriptbutton);
+
+    var superscriptchecker = ParentWithStyleChecker(new Array('super', 'sup'));
+    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
+    // XXX would it be better to pass along elements instead of ids?
+    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);
+
+    // since we use the inspector we don't need much else ;)
+    var inspector = new KupuInspector('kupu-inspector-form');
+    kupu.registerTool('inspector', inspector);
+    
+    var linktool = new LinkTool();
+    kupu.registerTool('linktool', linktool);
+
+    var imagetool = new ImageTool();
+    kupu.registerTool('imagetool', imagetool);
+
+    var tabletool = new TableTool();
+    kupu.registerTool('tabletool', tabletool);
+
+    var showpathtool = new ShowPathTool();
+    kupu.registerTool('showpathtool', showpathtool);
+    
+    var viewsourcetool = new ViewSourceTool();
+    kupu.registerTool('viewsourcetool', viewsourcetool);
+
+    // 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 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);
+
+    var linklibdrawer = new LinkLibrarydrawer(linktool, conf['link_xsl_uri'],
+                                              conf['link_libraries_uri'],
+                                              conf['link_images_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);
+
+    var linkdrawer = new LinkDrawer('kupu-linkdrawer', linktool);
+    drawertool.registerDrawer('linkdrawer', linkdrawer);
+
+    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: incubator/graffito/trunk/applications/browser/src/webapp/kupu-1.3.5/kupuinit_form.js
URL: http://svn.apache.org/viewvc/incubator/graffito/trunk/applications/browser/src/webapp/kupu-1.3.5/kupuinit_form.js?view=auto&rev=454522
==============================================================================
--- incubator/graffito/trunk/applications/browser/src/webapp/kupu-1.3.5/kupuinit_form.js (added)
+++ incubator/graffito/trunk/applications/browser/src/webapp/kupu-1.3.5/kupuinit_form.js Mon Oct  9 14:28:27 2006
@@ -0,0 +1,242 @@
+/*****************************************************************************
+ *
+ * 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.js 4015 2004-04-13 13:31:49Z guido $
+
+
+function initKupu(iframe) {
+    /* 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
+    */
+
+    // 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(new Array('b', 'strong'),
+                                             'fontWeight', 'bold');
+    var boldbutton = new KupuStateButton('kupu-bold-button', 
+                                         execCommand('bold'),
+                                         boldchecker,
+                                         'kupu-bold',
+                                         'kupu-bold-pressed');
+    kupu.registerTool('boldbutton', boldbutton);
+
+    var italicschecker = ParentWithStyleChecker(new Array('i', 'em'),
+                                                'fontStyle', 'italic');
+    var italicsbutton = new KupuStateButton('kupu-italic-button', 
+                                           execCommand('italic'),
+                                           italicschecker, 
+                                           'kupu-italic', 
+                                           'kupu-italic-pressed');
+    kupu.registerTool('italicsbutton', italicsbutton);
+
+    var underlinechecker = ParentWithStyleChecker(new Array('u'),
+                                                'textDecoration', 'underline');
+    var underlinebutton = new KupuStateButton('kupu-underline-button', 
+                                              execCommand('underline'),
+                                              underlinechecker,
+                                              'kupu-underline', 
+                                              'kupu-underline-pressed');
+    kupu.registerTool('underlinebutton', underlinebutton);
+
+    var subscriptchecker = ParentWithStyleChecker(new Array('sub'));
+    var subscriptbutton = new KupuStateButton('kupu-subscript-button',
+                                              execCommand('subscript'),
+                                              subscriptchecker,
+                                              'kupu-subscript',
+                                              'kupu-subscript-pressed');
+    kupu.registerTool('subscriptbutton', subscriptbutton);
+
+    var superscriptchecker = ParentWithStyleChecker(new Array('super', 'sup'));
+    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
+    // XXX would it be better to pass along elements instead of ids?
+    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-fixall-button', 'kupu-toolbox-tables',
+        'kupu-toolbox', 'kupu-toolbox-active'
+        );
+    tabletool.registerToolBox('tabletoolbox', tabletoolbox);
+
+    var showpathtool = new ShowPathTool();
+    kupu.registerTool('showpathtool', showpathtool);
+
+    var sourceedittool = new SourceEditTool('kupu-source-button',
+                                            'kupu-editor-textarea');
+    kupu.registerTool('sourceedittool', sourceedittool);
+
+    // 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 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);
+
+    var linklibdrawer = new LinkLibraryDrawer(linktool, conf['link_xsl_uri'],
+                                              conf['link_libraries_uri'],
+                                              conf['link_images_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);
+
+    var linkdrawer = new LinkDrawer('kupu-linkdrawer', linktool);
+    drawertool.registerDrawer('linkdrawer', linkdrawer);
+
+    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() {
+        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);
+
+    return kupu;
+};

Added: incubator/graffito/trunk/applications/browser/src/webapp/kupu-1.3.5/kupuinit_genericelements.js
URL: http://svn.apache.org/viewvc/incubator/graffito/trunk/applications/browser/src/webapp/kupu-1.3.5/kupuinit_genericelements.js?view=auto&rev=454522
==============================================================================
--- incubator/graffito/trunk/applications/browser/src/webapp/kupu-1.3.5/kupuinit_genericelements.js (added)
+++ incubator/graffito/trunk/applications/browser/src/webapp/kupu-1.3.5/kupuinit_genericelements.js Mon Oct  9 14:28:27 2006
@@ -0,0 +1,262 @@
+/*****************************************************************************
+ *
+ * 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.js 5482 2004-07-08 10:55:08Z guido $
+
+
+//----------------------------------------------------------------------------
+// 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(new Array('b', 'strong'),
+                                             'fontWeight', 'bold');
+    var boldbutton = new KupuStateButton('kupu-bold-button', 
+                                         execCommand('bold'),
+                                         boldchecker,
+                                         'kupu-bold',
+                                         'kupu-bold-pressed');
+    kupu.registerTool('boldbutton', boldbutton);
+
+    var italicschecker = ParentWithStyleChecker(new Array('i', 'em'),
+                                                'fontStyle', 'italic');
+    var italicsbutton = new KupuStateButton('kupu-italic-button', 
+                                           execCommand('italic'),
+                                           italicschecker, 
+                                           'kupu-italic', 
+                                           'kupu-italic-pressed');
+    kupu.registerTool('italicsbutton', italicsbutton);
+
+    var underlinechecker = ParentWithStyleChecker(new Array('u'),
+                                                'textDecoration', 'underline');
+    var underlinebutton = new KupuStateButton('kupu-underline-button', 
+                                              execCommand('underline'),
+                                              underlinechecker,
+                                              'kupu-underline', 
+                                              'kupu-underline-pressed');
+    kupu.registerTool('underlinebutton', underlinebutton);
+
+    var subscriptchecker = ParentWithStyleChecker(new Array('sub'));
+    var subscriptbutton = new KupuStateButton('kupu-subscript-button',
+                                              execCommand('subscript'),
+                                              subscriptchecker,
+                                              'kupu-subscript',
+                                              'kupu-subscript-pressed');
+    kupu.registerTool('subscriptbutton', subscriptbutton);
+
+    var superscriptchecker = ParentWithStyleChecker(new Array('super', 'sup'));
+    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
+    // XXX would it be better to pass along elements instead of ids?
+    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 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 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['link_images_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 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: incubator/graffito/trunk/applications/browser/src/webapp/kupu-1.3.5/kupuinit_multi.js
URL: http://svn.apache.org/viewvc/incubator/graffito/trunk/applications/browser/src/webapp/kupu-1.3.5/kupuinit_multi.js?view=auto&rev=454522
==============================================================================
--- incubator/graffito/trunk/applications/browser/src/webapp/kupu-1.3.5/kupuinit_multi.js (added)
+++ incubator/graffito/trunk/applications/browser/src/webapp/kupu-1.3.5/kupuinit_multi.js Mon Oct  9 14:28:27 2006
@@ -0,0 +1,239 @@
+/*****************************************************************************
+ *
+ * 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_multi.js 6259 2004-09-01 15:25:36Z guido $
+
+
+//----------------------------------------------------------------------------
+// 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 = new Array();
+    for (var i=0; i < iframeids.length; i++) {
+        var iframe = getFromSelector(iframeids[i]);
+        documents.push(new KupuDocument(iframe));
+    };
+
+    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(new Array('b', 'strong'),
+                                             'fontWeight', 'bold');
+    var boldbutton = new KupuStateButton('kupu-bold-button', 
+                                         execCommand('bold'),
+                                         boldchecker,
+                                         'kupu-bold',
+                                         'kupu-bold-pressed');
+    kupu.registerTool('boldbutton', boldbutton);
+
+    var italicschecker = ParentWithStyleChecker(new Array('i', 'em'),
+                                                'fontStyle', 'italic');
+    var italicsbutton = new KupuStateButton('kupu-italic-button', 
+                                           execCommand('italic'),
+                                           italicschecker, 
+                                           'kupu-italic', 
+                                           'kupu-italic-pressed');
+    kupu.registerTool('italicsbutton', italicsbutton);
+
+    var underlinechecker = ParentWithStyleChecker(new Array('u'),
+                                                'textDecoration', 'underline');
+    var underlinebutton = new KupuStateButton('kupu-underline-button', 
+                                              execCommand('underline'),
+                                              underlinechecker,
+                                              'kupu-underline', 
+                                              'kupu-underline-pressed');
+    kupu.registerTool('underlinebutton', underlinebutton);
+
+    var subscriptchecker = ParentWithStyleChecker(new Array('sub'));
+    var subscriptbutton = new KupuStateButton('kupu-subscript-button',
+                                              execCommand('subscript'),
+                                              subscriptchecker,
+                                              'kupu-subscript',
+                                              'kupu-subscript-pressed');
+    kupu.registerTool('subscriptbutton', subscriptbutton);
+
+    var superscriptchecker = ParentWithStyleChecker(new Array('super', 'sup'));
+    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
+    // XXX would it be better to pass along elements instead of ids?
+    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-fixall-button', 'kupu-toolbox-tables',
+        'kupu-toolbox', 'kupu-toolbox-active'
+        );
+    tabletool.registerToolBox('tabletoolbox', tabletoolbox);
+
+    var showpathtool = new ShowPathTool();
+    kupu.registerTool('showpathtool', showpathtool);
+
+    var sourceedittool = new MultiSourceEditTool('kupu-source-button',
+                                                    'kupu-editor-textarea-');
+    kupu.registerTool('sourceedittool', sourceedittool);
+
+    // 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 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);
+
+    var linklibdrawer = new LinkLibraryDrawer(linktool, conf['link_xsl_uri'],
+                                              conf['link_libraries_uri'],
+                                              conf['link_images_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);
+
+    var linkdrawer = new LinkDrawer('kupu-linkdrawer', linktool);
+    drawertool.registerDrawer('linkdrawer', linkdrawer);
+
+    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: incubator/graffito/trunk/applications/browser/src/webapp/kupu-1.3.5/kupuinspector.js
URL: http://svn.apache.org/viewvc/incubator/graffito/trunk/applications/browser/src/webapp/kupu-1.3.5/kupuinspector.js?view=auto&rev=454522
==============================================================================
--- incubator/graffito/trunk/applications/browser/src/webapp/kupu-1.3.5/kupuinspector.js (added)
+++ incubator/graffito/trunk/applications/browser/src/webapp/kupu-1.3.5/kupuinspector.js Mon Oct  9 14:28:27 2006
@@ -0,0 +1,229 @@
+/*****************************************************************************
+ *
+ * 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 9879 2005-03-18 12:04:00Z yuppie $
+
+/* 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 = new Array();
+    
+    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 = new Array();
+    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 = new Array('id', 'className');
+    this.special_attrs = {'a': new Array('href', 'name', 'target'),
+                            'img': new Array('url', 'width', 'height'),
+                            'ul': new Array('type'),
+                            'ol': new Array('type'),
+                            'table': new Array('border', 'cellPadding', 'cellSpacing'),
+                            'td': new Array('align')
+                            };
+    this.styles = new Array('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 = new Array();
+            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: incubator/graffito/trunk/applications/browser/src/webapp/kupu-1.3.5/kupuloggers.js
URL: http://svn.apache.org/viewvc/incubator/graffito/trunk/applications/browser/src/webapp/kupu-1.3.5/kupuloggers.js?view=auto&rev=454522
==============================================================================
--- incubator/graffito/trunk/applications/browser/src/webapp/kupu-1.3.5/kupuloggers.js (added)
+++ incubator/graffito/trunk/applications/browser/src/webapp/kupu-1.3.5/kupuloggers.js Mon Oct  9 14:28:27 2006
@@ -0,0 +1,73 @@
+/*****************************************************************************
+ *
+ * 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 9879 2005-03-18 12:04:00Z yuppie $
+
+
+//----------------------------------------------------------------------------
+// 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;
+        }
+    };
+};



Mime
View raw message