You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@myfaces.apache.org by sv...@apache.org on 2005/08/17 06:03:20 UTC
svn commit: r233117 [3/5] - in
/myfaces/tomahawk/trunk/src/java/org/apache/myfaces/custom/inputHtml: ./
resource/ resource/i18n.js/ resource/kupudrawers/ resource/kupuimages/
resource/kupupopups/
Modified: myfaces/tomahawk/trunk/src/java/org/apache/myfaces/custom/inputHtml/resource/kupudrawers.js
URL: http://svn.apache.org/viewcvs/myfaces/tomahawk/trunk/src/java/org/apache/myfaces/custom/inputHtml/resource/kupudrawers.js?rev=233117&r1=233116&r2=233117&view=diff
==============================================================================
--- myfaces/tomahawk/trunk/src/java/org/apache/myfaces/custom/inputHtml/resource/kupudrawers.js (original)
+++ myfaces/tomahawk/trunk/src/java/org/apache/myfaces/custom/inputHtml/resource/kupudrawers.js Tue Aug 16 21:02:45 2005
@@ -1,6 +1,6 @@
/*****************************************************************************
*
- * Copyright (c) 2003-2004 Kupu Contributors. All rights reserved.
+ * 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
@@ -20,13 +20,14 @@
this.initialize = function(editor) {
this.editor = editor;
+ this.isIE = this.editor.getBrowserName() == 'IE';
// this essentially makes the drawertool a singleton
window.drawertool = this;
};
- this.registerDrawer = function(id, drawer) {
+ this.registerDrawer = function(id, drawer, editor) {
this.drawers[id] = drawer;
- drawer.initialize(this.editor, this);
+ drawer.initialize(editor || this.editor, this);
};
this.openDrawer = function(id) {
@@ -34,48 +35,47 @@
if (this.current_drawer) {
this.closeDrawer();
};
- if (this.editor.getBrowserName() == 'IE') {
- this.editor._saveSelection();
- }
var drawer = this.drawers[id];
+ if (this.isIE) {
+ drawer.editor._saveSelection();
+ }
drawer.createContent();
+ drawer.editor.suspendEditing();
this.current_drawer = drawer;
};
this.updateState = function(selNode) {
- if (this.current_drawer) {
- this.closeDrawer();
- };
};
- this.closeDrawer = function() {
+ this.closeDrawer = function(button) {
if (!this.current_drawer) {
return;
};
this.current_drawer.hide();
+ this.current_drawer.editor.resumeEditing();
this.current_drawer = null;
};
- this.getDrawerEnv = function(iframe_win) {
- var drawer = null;
- for (var id in this.drawers) {
- var ldrawer = this.drawers[id];
- // Note that we require drawers to provide us with an
- // element property!
- if (ldrawer.element.contentWindow == iframe_win) {
- drawer = ldrawer;
- };
- };
- if (!drawer) {
- this.editor.logMessage("Drawer not found", 1);
- return;
- };
- return {
- 'drawer': drawer,
- 'drawertool': this,
- 'tool': drawer.tool
- };
- };
+// this.getDrawerEnv = function(iframe_win) {
+// var drawer = null;
+// for (var id in this.drawers) {
+// var ldrawer = this.drawers[id];
+// // Note that we require drawers to provide us with an
+// // element property!
+// if (ldrawer.element.contentWindow == iframe_win) {
+// drawer = ldrawer;
+// };
+// };
+// if (!drawer) {
+// this.editor.logMessage("Drawer not found", 1);
+// return;
+// };
+// return {
+// 'drawer': drawer,
+// 'drawertool': this,
+// 'tool': drawer.tool
+// };
+// };
};
DrawerTool.prototype = new KupuTool;
@@ -83,7 +83,7 @@
function Drawer(elementid, tool) {
/* base prototype for drawers */
- this.element = document.getElementById(elementid);
+ this.element = getFromSelector(elementid);
this.tool = tool;
this.initialize = function(editor, drawertool) {
@@ -96,26 +96,49 @@
// here's where any intelligence and XSLT transformation and such
// is done
this.element.style.display = 'block';
- if (this.editor.getBrowserName() == 'IE') {
- this.element.focus();
- }
+ this.focusElement();
};
this.hide = function() {
this.element.style.display = 'none';
+ this.focussed = false;
};
+
+ this.focusElement = function() {
+ // IE can focus the drawer element, but Mozilla needs more help
+ this.focussed = false;
+ var iterator = new NodeIterator(this.element);
+ var currnode = iterator.next();
+ while (currnode) {
+ if (currnode.tagName && (currnode.tagName.toUpperCase()=='BUTTON' ||
+ (currnode.tagName.toUpperCase()=='INPUT' && !(/nofocus/.test(currnode.className)))
+ )) {
+ this.focussed = true;
+ function focusit() {
+ currnode.focus();
+ }
+ timer_instance.registerFunction(this, focusit, 100);
+ return;
+ }
+ currnode = iterator.next();
+ }
+ }
};
-function LinkDrawer(elementid, tool) {
+function LinkDrawer(elementid, tool, wrap) {
/* Link drawer */
- this.element = document.getElementById(elementid);
+ this.element = getFromSelector(elementid);
this.tool = tool;
+ function wrap(id, tag) {
+ return '#'+this.element.id+' '+tag+'.'+id;
+ }
+ var input = getBaseTagClass(this.element, 'input', 'kupu-linkdrawer-input');
+ var preview = getBaseTagClass(this.element, 'iframe', 'kupu-linkdrawer-preview');
this.createContent = function() {
/* display the drawer */
var currnode = this.editor.getSelectedNode();
var linkel = this.editor.getNearestParentOfType(currnode, 'a');
- var input = document.getElementById('kupu-linkdrawer-input');
input.value = "";
this.preview();
if (linkel) {
@@ -124,14 +147,12 @@
input.value = 'http://';
};
this.element.style.display = 'block';
- if (this.editor.getBrowserName() == 'IE') {
- this.element.focus();
- }
+ this.focusElement();
};
this.save = function() {
/* add or modify a link */
- var input = document.getElementById('kupu-linkdrawer-input');
+ this.editor.resumeEditing();
var url = input.value;
var target = '_self';
if (this.target) target = this.target;
@@ -145,8 +166,6 @@
};
this.preview = function() {
- var input = document.getElementById('kupu-linkdrawer-input');
- var preview = document.getElementById('kupu-linkdrawer-preview');
preview.src = input.value;
if (this.editor.getBrowserName() == 'IE') {
preview.width = "800";
@@ -155,8 +174,6 @@
};
}
this.preview_loaded = function() {
- var input = document.getElementById('kupu-linkdrawer-input');
- var preview = document.getElementById('kupu-linkdrawer-preview');
if (input.value != preview.src) {
input.value = preview.src;
}
@@ -167,19 +184,20 @@
function TableDrawer(elementid, tool) {
/* Table drawer */
- this.element = document.getElementById(elementid);
+ this.element = getFromSelector(elementid);
this.tool = tool;
- this.addpanelid = 'kupu-tabledrawer-addtable';
- this.editpanelid = 'kupu-tabledrawer-edittable';
-
- this.addpanel = document.getElementById(this.addpanelid);
- this.editpanel = document.getElementById(this.editpanelid);
+ this.addpanel = getBaseTagClass(this.element, 'div', 'kupu-tabledrawer-addtable');
+ this.editpanel = getBaseTagClass(this.element, 'div', 'kupu-tabledrawer-edittable');
+ var classselect = getBaseTagClass(this.element, 'select', 'kupu-tabledrawer-classchooser');
+ var alignselect = getBaseTagClass(this.element, 'select', 'kupu-tabledrawer-alignchooser');
+ var newrowsinput = getBaseTagClass(this.element, 'input', 'kupu-tabledrawer-newrows');
+ var newcolsinput = getBaseTagClass(this.element, 'input', 'kupu-tabledrawer-newcols');
+ var makeheadercheck = getBaseTagClass(this.element, 'input', 'kupu-tabledrawer-makeheader');
this.createContent = function() {
var selNode = this.editor.getSelectedNode();
if (this.editor.config.table_classes) {
- var classselect = document.getElementById('kupu-tabledrawer-classchooser');
var classes = this.editor.config.table_classes['class'];
while (classselect.hasChildNodes()) {
classselect.removeChild(classselect.firstChild);
@@ -205,32 +223,69 @@
show = this.editpanel;
hide = this.addpanel;
var align = this.tool._getColumnAlign(selNode);
- var alignselect = document.getElementById('kupu-tabledrawer-alignchooser');
selectSelectItem(alignselect, align);
- var classselect = document.getElementById('kupu-tabledrawer-classchooser');
selectSelectItem(classselect, table.className);
};
hide.style.display = 'none';
show.style.display = 'block';
this.element.style.display = 'block';
- if (this.editor.getBrowserName() == 'IE') {
- this.element.focus();
- }
+ this.focusElement();
};
this.createTable = function() {
- var rows = document.getElementById('kupu-tabledrawer-newrows').value;
- var cols = document.getElementById('kupu-tabledrawer-newcols').value;
- var style = document.getElementById('kupu-tabledrawer-classchooser').value;
- var add_header = document.getElementById('kupu-tabledrawer-makeheader').checked;
+ this.editor.resumeEditing();
+ var rows = newrowsinput.value;
+ var cols = newcolsinput.value;
+ var style = classselect.value;
+ var add_header = makeheadercheck.checked;
this.tool.createTable(parseInt(rows), parseInt(cols), add_header, style);
this.drawertool.closeDrawer();
};
+ this.delTableRow = function() {
+ this.editor.resumeEditing();
+ this.tool.delTableRow();
+ this.editor.suspendEditing();
+ };
+ this.addTableRow = function() {
+ this.editor.resumeEditing();
+ this.tool.addTableRow();
+ this.editor.suspendEditing();
+ };
+ this.delTableColumn = function() {
+ this.editor.resumeEditing();
+ this.tool.delTableColumn();
+ this.editor.suspendEditing();
+ };
+ this.addTableColumn = function() {
+ this.editor.resumeEditing();
+ this.tool.addTableColumn();
+ this.editor.suspendEditing();
+ };
+ this.fixTable = function() {
+ this.editor.resumeEditing();
+ this.tool.fixTable();
+ this.editor.suspendEditing();
+ };
+ this.fixAllTables = function() {
+ this.editor.resumeEditing();
+ this.tool.fixAllTables();
+ this.editor.suspendEditing();
+ };
+ this.setTableClass = function(className) {
+ this.editor.resumeEditing();
+ this.tool.setTableClass(className);
+ this.editor.suspendEditing();
+ };
+ this.setColumnAlign = function(align) {
+ this.editor.resumeEditing();
+ this.tool.setColumnAlign(align);
+ this.editor.suspendEditing();
+ };
};
TableDrawer.prototype = new Drawer;
-function LibraryDrawer(tool, xsluri, libsuri, searchuri) {
+function LibraryDrawer(tool, xsluri, libsuri, searchuri, baseelement) {
/* a drawer that loads XSLT and XML from the server
and converts the XML to XHTML for the drawer using the XSLT
@@ -241,7 +296,7 @@
all XML loading is done async, since sync loading can freeze Mozilla
*/
- this.init = function(tool, xsluri, libsuri, searchuri) {
+ this.init = function(tool, xsluri, libsuri, searchuri, baseelement) {
/* This method is there to thin out the constructor and to be
able to inherit it in sub-prototypes. Don't confuse this
method with the component initializer (initialize()).
@@ -254,35 +309,51 @@
this.resourcespanelid = 'kupu-resourcespanel';
this.propertiespanelid = 'kupu-propertiespanel';
+ if (baseelement) {
+ this.baseelement = getFromSelector(baseelement);
+ } else {
+ this.baseelement = getBaseTagClass(document.body, 'div', 'kupu-librarydrawer-parent');
+ }
+
this.tool = tool;
this.element = document.getElementById(this.drawerid);
- this.xsluri = xsluri;
- this.libsuri = libsuri;
- this.searchuri = searchuri;
+ if (!this.element) {
+ var e = document.createElement('div');
+ e.id = this.drawerid;
+ e.className = 'kupu-drawer '+this.drawerid;
+ this.baseelement.appendChild(e);
+ this.element = e;
+ }
+ this.shared.xsluri = xsluri;
+ this.shared.libsuri = libsuri;
+ this.shared.searchuri = searchuri;
// marker that gets set when a new image has been uploaded
- this.newimages = null;
+ this.shared.newimages = null;
// the following vars will be available after this.initialize()
// has been called
// this will be filled by this._libXslCallback()
- this.xsl = null;
+ this.shared.xsl = null;
// this will be filled by this.loadLibraries(), which is called
// somewhere further down the chain starting with
// this._libsXslCallback()
- this.xmldata = null;
+ this.shared.xmldata = null;
};
- this.init(tool, xsluri, libsuri, searchuri);
+ if (tool) {
+ this.init(tool, xsluri, libsuri, searchuri);
+ }
this.initialize = function(editor, drawertool) {
this.editor = editor;
this.drawertool = drawertool;
+ this.selecteditemid = '';
// load the xsl and the initial xml
var wrapped_callback = new ContextFixer(this._libsXslCallback, this);
- this._loadXML(this.xsluri, wrapped_callback.execute);
+ this._loadXML(this.shared.xsluri, wrapped_callback.execute);
};
/*** bootstrapping ***/
@@ -295,18 +366,19 @@
so there's no way to wait until the XSL is loaded) this
will also make the first loadLibraries call
*/
- this.xsl = dom;
+ this.shared.xsl = dom;
// Change by Paul to have cached xslt transformers for reuse of
// multiple transforms and also xslt params
try {
- this.xsltproc = new XSLTProcessor();
- this.xsltproc.importStylesheet(dom);
- this.xsltproc.setParameter("", "drawertype", this.drawertype);
- this.xsltproc.setParameter("", "drawertitle", this.drawertitle);
- this.xsltproc.setParameter("", "showupload", this.showupload);
+ var xsltproc = new XSLTProcessor();
+ this.shared.xsltproc = xsltproc;
+ xsltproc.importStylesheet(dom);
+ xsltproc.setParameter("", "drawertype", this.drawertype);
+ xsltproc.setParameter("", "drawertitle", this.drawertitle);
+ xsltproc.setParameter("", "showupload", this.showupload);
if (this.editor.config.captions) {
- this.xsltproc.setParameter("", "usecaptions", 'yes');
+ xsltproc.setParameter("", "usecaptions", 'yes');
}
} catch(e) {
return; // No XSLT Processor, maybe IE 5.5?
@@ -314,29 +386,31 @@
};
this.createContent = function() {
+ // Make sure the drawer XML is in the current Kupu instance
+ if (this.element.parentNode != this.baseelement) {
+ this.baseelement.appendChild(this.element);
+ }
// load the initial XML
- if(!this.xmldata) {
+ if(!this.shared.xmldata) {
// Do a meaningful test to see if this is IE5.5 or some other
// editor-enabled version whose XML support isn't good enough
// for the drawers
- if (!Sarissa.IS_ENABLED_XSLTPROC) {
+ if (!window.XSLTProcessor) {
alert("This function requires better XML support in your browser.");
return;
}
this.loadLibraries();
} else {
- if (this.newimages) {
+ if (this.shared.newimages) {
this.reloadCurrent();
- this.newimages = null;
+ this.shared.newimages = null;
};
this.updateDisplay();
+ this.initialSelection();
};
// display the drawer div
this.element.style.display = 'block';
- if (this.editor.getBrowserName() == 'IE') {
- this.element.focus();
- }
};
this._singleLibsXslCallback = function(dom) {
@@ -351,7 +425,7 @@
this.loadLibraries = function() {
/* load the libraries and display them in a redrawn drawer */
var wrapped_callback = new ContextFixer(this._libsContentCallback, this);
- this._loadXML(this.libsuri, wrapped_callback.execute);
+ this._loadXML(this.shared.libsuri, wrapped_callback.execute);
};
this._libsContentCallback = function(dom) {
@@ -360,13 +434,23 @@
does the xslt transformation to set up or renew the drawer's full
content and adds the content to the drawer
*/
- this.xmldata = dom;
- this.xmldata.setProperty("SelectionLanguage", "XPath");
+ this.shared.xmldata = dom;
+ this.shared.xmldata.setProperty("SelectionLanguage", "XPath");
// replace whatever is in there with our stuff
this.updateDisplay(this.drawerid);
+ this.initialSelection();
};
+ this.initialSelection = function() {
+ var libnode_path = '/libraries/library[@selected]';
+ var libnode = this.shared.xmldata.selectSingleNode(libnode_path);
+ if (libnode) {
+ var id = libnode.getAttribute('id');
+ this.selectLibrary(id);
+ }
+ }
+
this.updateDisplay = function(id) {
/* (re-)transform XML and (re-)display the necessary part
*/
@@ -374,12 +458,16 @@
id = this.drawerid;
};
try {
- this.xsltproc.setParameter("", "showupload", this.showupload);
+ this.shared.xsltproc.setParameter("", "showupload", this.showupload);
} catch(e) {};
var doc = this._transformXml();
var sourcenode = doc.selectSingleNode('//*[@id="'+id+'"]');
var targetnode = document.getElementById(id);
- this._replaceNodeContents(document, targetnode, sourcenode);
+ sourcenode = document.importNode(sourcenode, true);
+ Sarissa.copyChildNodes(sourcenode, targetnode);
+ if (!this.focussed) {
+ this.focusElement();
+ }
if (this.editor.getBrowserName() == 'IE' && id == this.resourcespanelid) {
this.updateDisplay(this.drawerid);
@@ -390,7 +478,7 @@
/* Deselect the currently active collection or library */
while (1) {
// deselect selected DOM node
- var selected = this.xmldata.selectSingleNode('//*[@selected]');
+ var selected = this.shared.xmldata.selectSingleNode('//*[@selected]');
if (!selected) {
return;
};
@@ -418,13 +506,13 @@
};
var libnode_path = '/libraries/library[@id="' + id + '"]';
- var libnode = this.xmldata.selectSingleNode(libnode_path);
+ var libnode = this.shared.xmldata.selectSingleNode(libnode_path);
libnode.setAttribute('selected', '1');
var items_xpath = "items";
var items_node = libnode.selectSingleNode(items_xpath);
- if (items_node && !this.newimages) {
+ if (items_node && !this.shared.newimages) {
// The library has already been loaded before or was
// already provided with an items list. No need to do
// anything except for displaying the contents in the
@@ -440,7 +528,7 @@
// to load the XML, do this via a call back
var wrapped_callback = new ContextFixer(this._libraryContentCallback, this);
this._loadXML(src_uri, wrapped_callback.execute, null);
- this.newimages = null;
+ this.shared.newimages = null;
};
// instead of running the full transformations again we get a
// reference to the element and set the classname...
@@ -454,7 +542,7 @@
This is also used as he handler for reloading a standard
collection.
*/
- var libnode = this.xmldata.selectSingleNode('//*[@selected]');
+ var libnode = this.shared.xmldata.selectSingleNode('//*[@selected]');
var itemsnode = libnode.selectSingleNode("items");
var newitemsnode = dom.selectSingleNode("//items");
@@ -464,7 +552,7 @@
if (this.editor.getBrowserName() == 'IE') {
newitemsnode = newitemsnode.cloneNode(true);
} else {
- newitemsnode = this.xmldata.importNode(newitemsnode, true);
+ newitemsnode = this.shared.xmldata.importNode(newitemsnode, true);
}
if (!itemsnode) {
// We're loading this for the first time
@@ -486,14 +574,14 @@
this.removeSelection();
var leafnode_path = "//collection[@id='" + id + "']";
- var leafnode = this.xmldata.selectSingleNode(leafnode_path);
+ var leafnode = this.shared.xmldata.selectSingleNode(leafnode_path);
// Case 1: We've already loaded the data, so we just need to
// refer to the data by id.
var loadedInNode = leafnode.getAttribute('loadedInNode');
if (loadedInNode) {
var collnode_path = "/libraries/collection[@id='" + loadedInNode + "']";
- var collnode = this.xmldata.selectSingleNode(collnode_path);
+ var collnode = this.shared.xmldata.selectSingleNode(collnode_path);
if (collnode) {
collnode.setAttribute('selected', '1');
this.updateDisplay(this.resourcespanelid);
@@ -507,7 +595,7 @@
uri = leafnode.selectSingleNode('uri/text()').nodeValue;
uri = (new String(uri)).strip(); // needs kupuhelpers.js
var collnode_path = "/libraries/collection/uri[text()='" + uri + "']/..";
- var collnode = this.xmldata.selectSingleNode(collnode_path);
+ var collnode = this.shared.xmldata.selectSingleNode(collnode_path);
if (collnode) {
id = collnode.getAttribute('id');
leafnode.setAttribute('loadedInNode', id);
@@ -538,7 +626,7 @@
// attach 'loadedInNode' attribute to leaf node so Case 1
// applies next time.
- var leafnode = this.xmldata.selectSingleNode('//*[@selected]');
+ var leafnode = this.shared.xmldata.selectSingleNode('//*[@selected]');
leafnode.setAttribute('loadedInNode', time);
this.deselectActiveCollection()
@@ -546,13 +634,13 @@
collnode.setAttribute('id', time);
collnode.setAttribute('selected', '1');
- var libraries = this.xmldata.selectSingleNode('/libraries');
+ var libraries = this.shared.xmldata.selectSingleNode('/libraries');
// IE does not support importNode on XML documet nodes
if (this.editor.getBrowserName() == 'IE') {
collnode = collnode.cloneNode(true);
} else {
- collnode = this.xmldata.importNode(collnode, true);
+ collnode = this.shared.xmldata.importNode(collnode, true);
}
libraries.appendChild(collnode);
this.updateDisplay(this.resourcespanelid);
@@ -564,7 +652,7 @@
this.reloadCurrent = function() {
// Reload current collection or library
this.showupload = '';
- var current = this.xmldata.selectSingleNode('//*[@selected]');
+ var current = this.shared.xmldata.selectSingleNode('//*[@selected]');
// make sure we're dealing with a collection even though a
// resource might be selected
if (current.tagName == "resource") {
@@ -590,10 +678,21 @@
this.removeSelection = function() {
// turn off current selection, if any
var oldselxpath = '/libraries/*[@selected]//resource[@selected]';
- var oldselitem = this.xmldata.selectSingleNode(oldselxpath);
+ var oldselitem = this.shared.xmldata.selectSingleNode(oldselxpath);
if (oldselitem) {
oldselitem.removeAttribute("selected");
};
+ if (this.selecteditemid) {
+ var item = document.getElementById(this.selecteditemid);
+ if (item) {
+ var span = item.getElementsByTagName('span');
+ if (span.length > 0) {
+ span = span[0];
+ span.className = span.className.replace(' selected-item', '');
+ }
+ }
+ this.selecteditemid = '';
+ }
this.showupload = '';
}
@@ -605,7 +704,7 @@
}
/*** Selecting a resource ***/
- this.selectItem = function (id) {
+ this.selectItem = function (item, id) {
/* select an item in the item pane, show the item's metadata */
// First turn off current selection, if any
@@ -613,18 +712,33 @@
// Grab XML DOM node for clicked "resource" and mark it selected
var newselxpath = '/libraries/*[@selected]//resource[@id="' + id + '"]';
- var newselitem = this.xmldata.selectSingleNode(newselxpath);
+ var newselitem = this.shared.xmldata.selectSingleNode(newselxpath);
newselitem.setAttribute("selected", "1");
-
- this.updateDisplay(this.resourcespanelid);
+ //this.updateDisplay(this.resourcespanelid);
this.updateDisplay(this.propertiespanelid);
+
+ // Don't want to reload the resource panel xml as it scrolls to
+ // the top.
+ var span = item.getElementsByTagName('span');
+ if (span.length > 0) {
+ span = span[0];
+ span.className += ' selected-item';
+ }
+ this.selecteditemid = id;
+ if (this.editor.getBrowserName() == 'IE') {
+ var ppanel = document.getElementById(this.propertiespanelid)
+ var height = ppanel.clientHeight;
+ if (height > ppanel.scrollHeight) height = ppanel.scrollHeight;
+ if (height < 260) height = 260;
+ document.getElementById(this.resourcespanelid).style.height = height+'px';
+ }
return;
}
this.search = function() {
/* search */
- var searchvalue = document.getElementById('kupu-searchbox-input').value;
+ var searchvalue = getFromSelector('kupu-searchbox-input').value;
//XXX make search variable configurable
var body = 'SearchableText=' + escape(searchvalue);
@@ -632,7 +746,7 @@
// style. We want to do a POST though, so find any possible
// parameters, trim them from the URI and append them to the
// POST body instead.
- var chunks = this.searchuri.split('?');
+ var chunks = this.shared.searchuri.split('?');
var searchuri = chunks[0];
if (chunks[1]) {
body += "&" + chunks[1];
@@ -665,13 +779,13 @@
if (this.editor.getBrowserName() == 'IE') {
resultlib = resultlib.cloneNode(true);
} else {
- this.xmldata.importNode(resultlib, true);
+ this.shared.xmldata.importNode(resultlib, true);
}
- var libraries = this.xmldata.selectSingleNode("/libraries");
+ var libraries = this.shared.xmldata.selectSingleNode("/libraries");
libraries.appendChild(resultlib);
this.updateDisplay(this.drawerid);
- var newseldiv = document.getElementById(time);
+ var newseldiv = getFromSelector(time);
newseldiv.className = 'selected';
};
@@ -683,13 +797,9 @@
/*** Auxiliary methods ***/
this._transformXml = function() {
- /* transform this.xmldata to HTML using this.xsl and return it */
+ /* transform this.shared.xmldata to HTML using this.shared.xsl and return it */
var doc = Sarissa.getDomDocument();
-
- //var xsltproc = new XSLTProcessor();
- var result = this.xsltproc.transformToDocument(this.xmldata);
-
- // this.xmldata.transformNodeToObject(this.xsl, doc);
+ var result = this.shared.xsltproc.transformToDocument(this.shared.xmldata);
return result;
};
@@ -699,7 +809,7 @@
calls callback with one arg (the XML DOM) when done
the (optional) body arg should contain the body for the request
*/
- var xmlhttp = Sarissa.getXmlHttpRequest();
+ var xmlhttp = new XMLHttpRequest();
var method = 'GET';
if (body) {
method = 'POST';
@@ -724,27 +834,6 @@
xmlhttp.send(body);
};
- this._replaceNodeContents = function(doc, target, container) {
- /* replace all childnodes in target with all childnodes in container */
- var importedContainer = doc.importNode(container, true);
- // XXX it seems that IE doesn't allow hacks like these
- // no need to worry anyway, since the transformed HTML seems
- // to have the right JS context variables anyway.
-
- if (this.editor.getBrowserName() != 'IE') {
- container.ownerDocument.contentWindow = doc.contentWindow;
- };
- while (target.hasChildNodes()) {
- target.removeChild(target.firstChild);
- };
- // XXX don't know if this works since i'm not sure whether
- // appendChild actually removes a child from a previous
- // location (although i think it does)
- while (importedContainer.hasChildNodes()) {
- target.appendChild(importedContainer.firstChild);
- };
- };
-
this._sarissaCallback = function(user_callback, uri) {
/* callback for Sarissa
when the callback is called because the data's ready it
@@ -771,14 +860,17 @@
};
LibraryDrawer.prototype = new Drawer;
+LibraryDrawer.prototype.shared = {}; // Shared data
-function ImageLibraryDrawer(tool, xsluri, libsuri, searchuri) {
+function ImageLibraryDrawer(tool, xsluri, libsuri, searchuri, baseelement) {
/* a specific LibraryDrawer for images */
- this.drawertitle = "Image Library";
+ this.drawertitle = "Insert Image";
this.drawertype = "image";
this.showupload = '';
- this.init(tool, xsluri, libsuri, searchuri);
+ if (tool) {
+ this.init(tool, xsluri, libsuri, searchuri, baseelement);
+ }
// upload, on submit/insert press
@@ -791,14 +883,14 @@
return;
};
- var targeturi = this.xmldata.selectSingleNode('/libraries/*[@selected]/uri/text()').nodeValue
+ var targeturi = this.shared.xmldata.selectSingleNode('/libraries/*[@selected]/uri/text()').nodeValue
document.kupu_upload_form.action = targeturi + "/kupuUploadImage";
document.kupu_upload_form.submit();
};
// called for example when no permission to upload for some reason
this.cancelUpload = function(msg) {
- var s = this.xmldata.selectSingleNode('/libraries/*[@selected]');
+ var s = this.shared.xmldata.selectSingleNode('/libraries/*[@selected]');
s.removeAttribute("selected");
this.updateDisplay();
if (msg != '') {
@@ -808,24 +900,27 @@
// called by onLoad within document sent by server
this.finishUpload = function(url) {
- var img = this.tool.createImage(url);
+ this.editor.resumeEditing();
+ var imgclass = 'image-inline';
if (this.editor.config.captions) {
- img.className = img.className + " captioned";
- }
- this.newimages = 1;
+ imgclass += " captioned";
+ };
+ this.tool.createImage(url, null, imgclass);
+ this.shared.newimages = 1;
this.drawertool.closeDrawer();
};
this.save = function() {
+ this.editor.resumeEditing();
/* create an image in the iframe according to collected data
from the drawer */
var selxpath = '//resource[@selected]';
- var selnode = this.xmldata.selectSingleNode(selxpath);
+ var selnode = this.shared.xmldata.selectSingleNode(selxpath);
// If no image resource is selected, check for upload
if (!selnode) {
- var uploadbutton = this.xmldata.selectSingleNode("/libraries/*[@selected]//uploadbutton");
+ var uploadbutton = this.shared.xmldata.selectSingleNode("/libraries/*[@selected]//uploadbutton");
if (uploadbutton) {
this.uploadImage();
};
@@ -834,42 +929,44 @@
var uri = selnode.selectSingleNode('uri/text()').nodeValue;
uri = uri.strip(); // needs kupuhelpers.js
- var img = this.tool.createImage(uri);
- var alt = document.getElementById('image_alt').value;
- img.setAttribute('alt', alt);
+ var alt = getFromSelector('image_alt').value;
- // Set image class from the alignment radio buttons
var radios = document.getElementsByName('image-align');
for (var i = 0; i < radios.length; i++) {
if (radios[i].checked) {
- img.className = radios[i].value;
- }
- }
+ var imgclass = radios[i].value;
+ };
+ };
var caption = document.getElementsByName('image-caption');
if (caption && caption.length>0 && caption[0].checked) {
- img.className = img.className + " captioned";
- }
+ imgclass += " captioned";
+ };
+ this.tool.createImage(uri, alt, imgclass);
this.drawertool.closeDrawer();
};
};
ImageLibraryDrawer.prototype = new LibraryDrawer;
+ImageLibraryDrawer.prototype.shared = {}; // Shared data
-function LinkLibraryDrawer(tool, xsluri, libsuri, searchuri) {
+function LinkLibraryDrawer(tool, xsluri, libsuri, searchuri, baseelement) {
/* a specific LibraryDrawer for links */
- this.drawertitle = "Link Drawer";
+ this.drawertitle = "Insert Link";
this.drawertype = "link";
this.showupload = '';
- this.init(tool, xsluri, libsuri, searchuri);
+ if (tool) {
+ this.init(tool, xsluri, libsuri, searchuri, baseelement);
+ }
this.save = function() {
+ this.editor.resumeEditing();
/* create a link in the iframe according to collected data
from the drawer */
var selxpath = '//resource[@selected]';
- var selnode = this.xmldata.selectSingleNode(selxpath);
+ var selnode = this.shared.xmldata.selectSingleNode(selxpath);
if (!selnode) {
return;
};
@@ -883,13 +980,36 @@
// XXX requiring the user to know what link type to enter is a
// little too much I think. (philiKON)
var type = null;
- var name = document.getElementById('link_name').value;
+ var name = getFromSelector('link_name').value;
var target = null;
- if (document.getElementById('link_target') && document.getElementById('link_target').value != '')
- target = document.getElementById('link_target').value;
+ if (getFromSelector('link_target') && getFromSelector('link_target').value != '')
+ target = getFromSelector('link_target').value;
this.tool.createLink(uri, type, name, target, title);
+ this.drawertool.closeDrawer();
};
};
LinkLibraryDrawer.prototype = new LibraryDrawer;
+LinkLibraryDrawer.prototype.shared = {}; // Shared data
+
+/* Function to suppress enter key in drawers */
+function HandleDrawerEnter(event, clickid) {
+ var key;
+ event = event || window.event;
+ key = event.which || event.keyCode;
+
+ if (key==13) {
+ if (clickid) {
+ var button = document.getElementById(clickid);
+ if (button) {
+ button.click();
+ }
+ }
+ event.cancelBubble = true;
+ if (event.stopPropogation) event.stopPropogation();
+
+ return false;
+ }
+ return true;
+}
Modified: myfaces/tomahawk/trunk/src/java/org/apache/myfaces/custom/inputHtml/resource/kupudrawers/drawer.xsl
URL: http://svn.apache.org/viewcvs/myfaces/tomahawk/trunk/src/java/org/apache/myfaces/custom/inputHtml/resource/kupudrawers/drawer.xsl?rev=233117&r1=233116&r2=233117&view=diff
==============================================================================
--- myfaces/tomahawk/trunk/src/java/org/apache/myfaces/custom/inputHtml/resource/kupudrawers/drawer.xsl (original)
+++ myfaces/tomahawk/trunk/src/java/org/apache/myfaces/custom/inputHtml/resource/kupudrawers/drawer.xsl Tue Aug 16 21:02:45 2005
@@ -1,8 +1,8 @@
-<?xml version="1.0" encoding="UTF-8" ?>
+<?xml version="1.0" encoding="utf-8" ?>
<!--
##############################################################################
#
-# Copyright (c) 2003-2004 Kupu Contributors. All rights reserved.
+# 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
@@ -17,17 +17,26 @@
-->
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0"
xmlns:tal="http://xml.zope.org/namespaces/tal" xmlns="http://www.w3.org/1999/xhtml"
- xmlns:i18n="http://xml.zope.org/namespaces/i18n">
+ xmlns:i18n="http://xml.zope.org/namespaces/i18n"
+ i18n:domain="kupu">
+ <tal:block define="x python:request.RESPONSE.setHeader('Content-Type', 'text/xml;;charset=UTF-8')" />
<xsl:param name="drawertype">image</xsl:param>
<xsl:param name="drawertitle">Image Drawer</xsl:param>
<xsl:param name="showupload"></xsl:param>
<xsl:param name="usecaptions"></xsl:param>
- <xsl:variable name="titlelength" select="20"/>
+ <xsl:variable name="titlelength" select="60"/>
+ <xsl:variable name="i18n_drawertitle">
+ <xsl:choose>
+ <xsl:when i18n:translate="imagedrawer_title" test="$drawertype='image'">Insert Image</xsl:when>
+ <xsl:when i18n:translate="linkdrawer_title"
+test="$drawertype='link'">Insert Link</xsl:when>
+ </xsl:choose>
+</xsl:variable>
<xsl:template match="/">
<html lang="en" xml:lang="en" xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>
- <xsl:value-of select="$drawertitle"/>
+ <xsl:value-of select="$i18n_drawertitle"/>
</title>
<link type="text/css" rel="stylesheet">
<xsl:attribute name="href">kupudrawerstyles.css </xsl:attribute>
@@ -37,14 +46,23 @@
<div style="width: 500px; border: solid black 1px; width: 100px">
<div id="kupu-librarydrawer">
<h1 style="padding: 0;float: left;">
- <xsl:value-of select="$drawertitle"/>
+ <xsl:value-of select="$i18n_drawertitle"/>
</h1>
<div id="kupu-searchbox" style="text-align: right">
<form onsubmit="return false;">
+ <xsl:variable name="search_value"
+ i18n:translate="kupudrawer_search">search</xsl:variable>
<input id="kupu-searchbox-input"
- name="searchbox" value="search"
- style="font-style: italic"
- onclick="if (this.value == 'search') this.value = ''; this.style.fontStyle='normal';" onkeyup="if (event.keyCode == 13 ) drawertool.current_drawer.search();"/>
+ class="kupu-searchbox-input nofocus"
+ name="searchbox"
+ style="font-style: italic;"
+ onkeyup="if (event.keyCode == 13 ) drawertool.current_drawer.search();">
+ <xsl:attribute name="value">
+ <xsl:value-of select="$search_value" />
+ </xsl:attribute>
+ <xsl:attribute name="onclick">
+ if (this.value == '<xsl:value-of select="$search_value" />') this.value = ''; this.style.fontStyle='normal';</xsl:attribute>
+ </input>
</form>
</div>
<div class="kupu-panels">
@@ -84,8 +102,14 @@
</table>
</div>
<div class="kupu-dialogbuttons">
- <button type="button" onclick="drawertool.current_drawer.save();">Ok</button>
- <button type="button" onclick="drawertool.closeDrawer();">Cancel</button>
+ <button type="button"
+ class="kupu-dialog-button"
+ i18n:translate=""
+ onclick="drawertool.current_drawer.save();">Ok</button>
+ <button type="button"
+ class="kupu-dialog-button"
+ i18n:translate=""
+ onclick="drawertool.closeDrawer();">Cancel</button>
</div>
</div>
</div>
@@ -98,12 +122,8 @@
<xsl:attribute name="id">
<xsl:value-of select="@id"/>
</xsl:attribute>
- <div>
- <xsl:apply-templates select="icon"/>
- </div>
- <span class="drawer-item-title">
- <xsl:value-of select="title"/>
- </span>
+ <xsl:apply-templates select="icon"/>
+ <span class="drawer-item-title"><xsl:value-of select="title"/></span>
</div>
</xsl:template>
<xsl:template match="items">
@@ -116,7 +136,7 @@
<xsl:when
test="local-name()='collection'">drawertool.current_drawer.selectCollection('<xsl:value-of select="@id"/>');</xsl:when>
- <xsl:otherwise>drawertool.current_drawer.selectItem('<xsl:value-of select="@id"/>')</xsl:otherwise>
+ <xsl:otherwise>drawertool.current_drawer.selectItem(this, '<xsl:value-of select="@id"/>')</xsl:otherwise>
</xsl:choose>
</xsl:attribute>
<xsl:apply-templates select="icon"/>
@@ -128,7 +148,8 @@
<xsl:attribute name="onclick">
drawertool.current_drawer.selectUpload();
</xsl:attribute>
- <span class="drawer-item-title">Upload ...</span>
+ <span class="drawer-item-title"
+ i18n:translate="imagedrawer_upload_link">Upload ...</span>
</div>
</xsl:template>
<xsl:template match="icon">
@@ -140,7 +161,7 @@
<xsl:template match="label|title">
<span class="drawer-item-title">
<xsl:if test="../@selected">
- <xsl:attribute name="style">background-color: #C0C0C0</xsl:attribute>
+ <xsl:attribute name="class">drawer-item-title selected-item</xsl:attribute>
</xsl:if>
<xsl:choose>
<xsl:when test="string-length() > $titlelength">
@@ -179,7 +200,7 @@
<xsl:when test="preview">
<tr>
<td>
- <strong>Preview</strong>
+ <strong i18n:translate="imagedrawer_upload_preview_label">Preview</strong>
<br/>
<img src="{preview}" title="{title}" height="{height}"
width="{width}" alt="{title}"/>
@@ -189,30 +210,29 @@
</xsl:choose>
<div>
<xsl:value-of select="size"/>
- <xsl:if test="width"> (<xsl:value-of select="width"/> by
- <xsl:value-of select="height"/>)</xsl:if>
+ <xsl:if test="width" i18n:translate="imagedrawer_size">(<span i18n:name="width"><xsl:value-of select="width" /></span> by <span i18n:name="height"><xsl:value-of select="height" /></span>)</xsl:if>
</div>
<div>
<xsl:value-of select="description"/>
</div>
<div>
<form onsubmit="return false;">
- <strong>ALT-text</strong>
+ <strong i18n:translate="imagedrawer_upload_alt_text">ALT-text</strong>
<br/>
<input type="text" id="image_alt" size="20" value="{title}"/>
<br/>
<input type="radio" name="image-align" id="image-align-left"
checked="checked" value="image-left"/>
- <label for="image-align-left">Left</label>
+ <label for="image-align-left" i18n:translate="imagedrawer_left">Left</label>
<input type="radio" name="image-align" id="image-align-inline" value="image-inline"/>
- <label for="image-align-inline">Inline</label>
+ <label for="image-align-inline" i18n:translate="imagedrawer_inline">Inline</label>
<input type="radio" name="image-align" id="image-align-right" value="image-right"/>
- <label for="image-align-right">Right</label>
+ <label for="image-align-right" i18n:translate="imagedrawer_right">Right</label>
<xsl:if test="$usecaptions='yes'">
<br/>
<input type="checkbox" name="image-caption"
id="image-caption" checked="checked"/>
- <label for="image-caption">Caption</label>
+ <label for="image-caption" i18n:translate="imagedrawer_caption_label">Caption</label>
</xsl:if>
</form>
</div>
@@ -222,30 +242,31 @@
<table>
<tr class="kupu-linkdrawer-title-row">
<td>
- <strong>Title</strong>
+ <strong i18n:translate="linkdrawer_title_label">Title</strong>
<br/>
<xsl:value-of select="title"/>
</td>
</tr>
<tr class="kupu-linkdrawer-description-row">
<td>
- <strong>Description</strong>
+ <strong i18n:translate="linkdrawer_description_label">Description</strong>
<br/>
<xsl:value-of select="description"/>
</td>
</tr>
<tr class="kupu-linkdrawer-name-row">
<td>
- <strong>Name</strong>
+ <strong i18n:translate="linkdrawer_name_label">Name</strong>
<br/>
<input type="text" id="link_name" size="10"/>
</td>
</tr>
<tr class="kupu-linkdrawer-target-row">
<td>
- <strong>Target</strong>
+ <strong i18n:translate="linkdrawer_target_label">Target</strong>
<br/>
- <input type="text" id="link_target" value="_self" size="10"/>
+ <input type="text" id="link_target" value="_self"
+ size="10"/>
</td>
</tr>
</table>
@@ -254,24 +275,26 @@
<!-- image upload form -->
<xsl:template match="uploadbutton" mode="image-upload">
- <div id="kupu-upload-instructions" i18n:translate="upload-instructions">
- Select an image from your computer and click ok to have it automatically uploaded to selected folder and inserted into the editor.
- </div><br/>
+ <div>
+ <div id="kupu-upload-instructions" i18n:translate="imagedrawer_upload_instructions">
+ Select an image from your computer and click ok to have it
+ automatically uploaded to selected folder and inserted into the
+ editor.
+ </div>
<form name="kupu_upload_form" method="POST" action="" scrolling="off" target="kupu_upload_form_target"
enctype="multipart/form-data" style="margin: 0; border: 0;">
- <span id="kupu-upload-to"><strong>Upload to: </strong> <xsl:value-of select="/libraries/*[@selected]/title"/> </span><br/>
- <input id="kupu-upload-file" type="file" name="node_prop_image" /><br/>
- <label>Title:
- <input id="kupu-upload-title" type="text" name="node_prop_caption" size="23" value=""/>
- </label><br/>
- <input type="reset" i18n:translate="upload-resetform" value="Clear"/>
-
+ <label for="kupu-upload-file" i18n:translate="imagedrawer_upload_to_label">Upload to: <span i18n:name="folder"><xsl:value-of select='/libraries/*[@selected]/title' /></span></label>
+ <input id="kupu-upload-file" type="file" name="node_prop_image" size="20"/><br/>
+ <label for="kupu-upload-title"
+i18n:translate="imagedrawer_upload_title_label">Title:</label>
+ <input id="kupu-upload-title" type="text" name="node_prop_caption" size="23" value=""/><br/>
</form>
<iframe id="kupu-upload-form-target" name="kupu_upload_form_target"
src="kupublank.html" scrolling="off" frameborder="0" width="0px" height="0px" display="None">
</iframe>
+ </div>
</xsl:template>
</xsl:stylesheet>
Added: myfaces/tomahawk/trunk/src/java/org/apache/myfaces/custom/inputHtml/resource/kupudrawers/drawer.xsl.metadata
URL: http://svn.apache.org/viewcvs/myfaces/tomahawk/trunk/src/java/org/apache/myfaces/custom/inputHtml/resource/kupudrawers/drawer.xsl.metadata?rev=233117&view=auto
==============================================================================
--- myfaces/tomahawk/trunk/src/java/org/apache/myfaces/custom/inputHtml/resource/kupudrawers/drawer.xsl.metadata (added)
+++ myfaces/tomahawk/trunk/src/java/org/apache/myfaces/custom/inputHtml/resource/kupudrawers/drawer.xsl.metadata Tue Aug 16 21:02:45 2005
@@ -0,0 +1,2 @@
+[default]
+keep_extension=1
Added: myfaces/tomahawk/trunk/src/java/org/apache/myfaces/custom/inputHtml/resource/kupudrawers/linklibrary.xml
URL: http://svn.apache.org/viewcvs/myfaces/tomahawk/trunk/src/java/org/apache/myfaces/custom/inputHtml/resource/kupudrawers/linklibrary.xml?rev=233117&view=auto
==============================================================================
--- myfaces/tomahawk/trunk/src/java/org/apache/myfaces/custom/inputHtml/resource/kupudrawers/linklibrary.xml (added)
+++ myfaces/tomahawk/trunk/src/java/org/apache/myfaces/custom/inputHtml/resource/kupudrawers/linklibrary.xml Tue Aug 16 21:02:45 2005
@@ -0,0 +1,22 @@
+<?xml version="1.0" ?>
+<libraries>
+ <library id="logos">
+ <uri>kupudrawers/logos.xml</uri>
+ <title>Logo's</title>
+ <src>kupudrawers/logos.xml</src>
+ <icon>kupuimages/kupulibrary.png</icon>
+ </library>
+ <library id="kupubuttons">
+ <uri>kupudrawers/kupubuttons.xml</uri>
+ <title>Kupu buttons</title>
+ <src>kupudrawers/kupubuttons.xml</src>
+ <icon>kupuimages/kupulibrary.png</icon>
+ </library>
+ <library id="allimages">
+ <uri>kupudrawers/allimages.xml</uri>
+ <title>All images</title>
+ <src>kupudrawers/allimages.xml</src>
+ <icon>kupuimages/kupulibrary.png</icon>
+ </library>
+
+</libraries>
Propchange: myfaces/tomahawk/trunk/src/java/org/apache/myfaces/custom/inputHtml/resource/kupudrawers/linklibrary.xml
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: myfaces/tomahawk/trunk/src/java/org/apache/myfaces/custom/inputHtml/resource/kupudrawers/linklibrary.xml
------------------------------------------------------------------------------
svn:executable = *
Propchange: myfaces/tomahawk/trunk/src/java/org/apache/myfaces/custom/inputHtml/resource/kupudrawers/linklibrary.xml
------------------------------------------------------------------------------
svn:keywords = "Id Author LastChangedDate LastChangedBy LastChangedRevision"
Propchange: myfaces/tomahawk/trunk/src/java/org/apache/myfaces/custom/inputHtml/resource/kupudrawers/linklibrary.xml
------------------------------------------------------------------------------
svn:mime-type = text/xml
Added: myfaces/tomahawk/trunk/src/java/org/apache/myfaces/custom/inputHtml/resource/kupudrawers/logos.xml
URL: http://svn.apache.org/viewcvs/myfaces/tomahawk/trunk/src/java/org/apache/myfaces/custom/inputHtml/resource/kupudrawers/logos.xml?rev=233117&view=auto
==============================================================================
--- myfaces/tomahawk/trunk/src/java/org/apache/myfaces/custom/inputHtml/resource/kupudrawers/logos.xml (added)
+++ myfaces/tomahawk/trunk/src/java/org/apache/myfaces/custom/inputHtml/resource/kupudrawers/logos.xml Tue Aug 16 21:02:45 2005
@@ -0,0 +1,162 @@
+<?xml version="1.0" ?>
+<collection>
+ <uri>kupudrawers/logos.xml</uri>
+ <icon>kupuimages/kupulibrary.png</icon>
+ <title>Logo's</title>
+ <src>kupudrawers/logos.xml</src>
+ <items>
+ <resource id="bitflux_logo.png">
+ <uri>kupudrawers/logos/bitflux_logo.png</uri>
+ <title>Bitflux logo</title>
+ <description>Bitflux CMS: http://bitflux.ch</description>
+ <size>957b</size>
+ <height>60</height>
+ <width>160</width>
+ <preview>kupudrawers/logos/bitflux_logo_preview.png</preview>
+ </resource>
+ <resource id="bubnbros.png">
+ <uri>kupudrawers/logos/bubnbros.png</uri>
+ <title>Bub'n'bros banner</title>
+ <description>Bub'n'bros game: http://bub-n-bros.sourceforge.net/</description>
+ <size>4806b</size>
+ <height>51</height>
+ <width>461</width>
+ <preview>kupudrawers/logos/bubnbros_preview.png</preview>
+ </resource>
+ <resource id="codespeak_logo.png">
+ <uri>kupudrawers/logos/codespeak_logo.png</uri>
+ <title>Codespeak logo</title>
+ <description>Codespeak: http://codespeak.net</description>
+ <size>4270b</size>
+ <height>75</height>
+ <width>154</width>
+ <preview>kupudrawers/logos/codespeak_logo_preview.png</preview>
+ </resource>
+ <resource id="diver_logo.png">
+ <uri>kupudrawers/logos/diver_logo.png</uri>
+ <title>Diver logo</title>
+ <description>ver.di: http://www.verdi.de</description>
+ <size>1800b</size>
+ <height>53</height>
+ <width>215</width>
+ <preview>kupudrawers/logos/diver_logo_preview.png</preview>
+ </resource>
+ <resource id="eth_logo.png">
+ <uri>kupudrawers/logos/eth_logo.png</uri>
+ <title>ETH logo</title>
+ <description>ETH: http://www.ethz.ch</description>
+ <size>4030b</size>
+ <height>103</height>
+ <width>400</width>
+ <preview>kupudrawers/logos/eth_logo_preview.png</preview>
+ </resource>
+ <resource id="infrae_logo.png">
+ <uri>kupudrawers/logos/infrae_logo.png</uri>
+ <title>Infrae logo</title>
+ <description>Infrae: http://www.infrae.com</description>
+ <size>3846b</size>
+ <height>140</height>
+ <width>280</width>
+ <preview>kupudrawers/logos/infrae_logo_preview.png</preview>
+ </resource>
+ <resource id="kupu_logo.png">
+ <uri>kupudrawers/logos/kupu_logo.png</uri>
+ <title>Kupu logo</title>
+ <description>Kupu: http://kupu.oscom.org</description>
+ <size>17489b</size>
+ <height>115</height>
+ <width>175</width>
+ <preview>kupudrawers/logos/kupu_logo_preview.png</preview>
+ </resource>
+ <resource id="lenya_logo.png">
+ <uri>kupudrawers/logos/lenya_logo.png</uri>
+ <title>Lenya logo</title>
+ <description>Lenya: http://lenya.apache.org</description>
+ <size>3469b</size>
+ <height>86</height>
+ <width>330</width>
+ <preview>kupudrawers/logos/lenya_logo_preview.png</preview>
+ </resource>
+ <resource id="opensource.png">
+ <uri>kupudrawers/logos/opensource.png</uri>
+ <title>Open Source icon</title>
+ <description>OSI: http://www.opensource.org</description>
+ <size>7767b</size>
+ <height>216</height>
+ <width>250</width>
+ <preview>kupudrawers/logos/opensource_preview.png</preview>
+ </resource>
+ <resource id="oscom4_banner.png">
+ <uri>kupudrawers/logos/oscom4_banner.gif</uri>
+ <title>OSCOM 4 banner</title>
+ <description>OSCOM: http://www.oscom.org</description>
+ <size>15129b</size>
+ <height>60</height>
+ <width>460</width>
+ <preview>kupudrawers/logos/oscom4_banner_preview.png</preview>
+ </resource>
+ <resource id="oscom_logo.png">
+ <uri>kupudrawers/logos/oscom_logo.png</uri>
+ <title>OSCOM logo</title>
+ <description>OSCOM: http://www.oscom.org</description>
+ <size>3233b</size>
+ <height>54</height>
+ <width>330</width>
+ <preview>kupudrawers/logos/oscom_logo_preview.png</preview>
+ </resource>
+ <resource id="plone_logo.png">
+ <uri>kupudrawers/logos/plone_logo.png</uri>
+ <title>Plone logo</title>
+ <description>Plone: http://plone.org</description>
+ <size>10624b</size>
+ <height>57</height>
+ <width>219</width>
+ <preview>kupudrawers/logos/plone_logo_preview.png</preview>
+ </resource>
+ <resource id="pypy_logo.png">
+ <uri>kupudrawers/logos/pypy_logo.png</uri>
+ <title>PYPY logo</title>
+ <description>PYPY: http://codespeak.net/pypy/</description>
+ <size>2163b</size>
+ <height>110</height>
+ <width>149</width>
+ <preview>kupudrawers/logos/pypy_logo_preview.png</preview>
+ </resource>
+ <resource id="silva_logo.png">
+ <uri>kupudrawers/logos/silva_logo.png</uri>
+ <title>Silva icon</title>
+ <description>Silva: http://www.infrae.com/products/silva/</description>
+ <size>22033b</size>
+ <height>250</height>
+ <width>250</width>
+ <preview>kupudrawers/logos/silva_logo_preview.png</preview>
+ </resource>
+ <resource id="twiki_logo.png">
+ <uri>kupudrawers/logos/twiki_logo.png</uri>
+ <title>TWiki logo</title>
+ <description>TWiki: http://www.twiki.org</description>
+ <size>7218b</size>
+ <height>64</height>
+ <width>131</width>
+ <preview>kupudrawers/logos/twiki_logo_preview.png</preview>
+ </resource>
+ <resource id="zea_logo.png">
+ <uri>kupudrawers/logos/zea_logo.png</uri>
+ <title>ZEA logo</title>
+ <description>Zope Europe Association: http://www.zope-europe.org</description>
+ <size>15027b</size>
+ <height>54</height>
+ <width>287</width>
+ <preview>kupudrawers/logos/zea_logo_preview.png</preview>
+ </resource>
+ <resource id="zope_logo.png">
+ <uri>kupudrawers/logos/zope_logo.png</uri>
+ <title>Zope logo</title>
+ <description>Zope: http://www.zope.org</description>
+ <size>1799b</size>
+ <height>54</height>
+ <width>201</width>
+ <preview>kupudrawers/logos/zope_logo_preview.png</preview>
+ </resource>
+ </items>
+</collection>
Propchange: myfaces/tomahawk/trunk/src/java/org/apache/myfaces/custom/inputHtml/resource/kupudrawers/logos.xml
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: myfaces/tomahawk/trunk/src/java/org/apache/myfaces/custom/inputHtml/resource/kupudrawers/logos.xml
------------------------------------------------------------------------------
svn:executable = *
Propchange: myfaces/tomahawk/trunk/src/java/org/apache/myfaces/custom/inputHtml/resource/kupudrawers/logos.xml
------------------------------------------------------------------------------
svn:keywords = "Id Author LastChangedDate LastChangedBy LastChangedRevision"
Propchange: myfaces/tomahawk/trunk/src/java/org/apache/myfaces/custom/inputHtml/resource/kupudrawers/logos.xml
------------------------------------------------------------------------------
svn:mime-type = text/xml
Modified: myfaces/tomahawk/trunk/src/java/org/apache/myfaces/custom/inputHtml/resource/kupudrawerstyles.css
URL: http://svn.apache.org/viewcvs/myfaces/tomahawk/trunk/src/java/org/apache/myfaces/custom/inputHtml/resource/kupudrawerstyles.css?rev=233117&r1=233116&r2=233117&view=diff
==============================================================================
--- myfaces/tomahawk/trunk/src/java/org/apache/myfaces/custom/inputHtml/resource/kupudrawerstyles.css (original)
+++ myfaces/tomahawk/trunk/src/java/org/apache/myfaces/custom/inputHtml/resource/kupudrawerstyles.css Tue Aug 16 21:02:45 2005
@@ -2,7 +2,7 @@
*
* Kupu drawer styles
*
- * Copyright (c) 2003-2004 Kupu Contributors. See CREDITS.txt
+ * Copyright (c) 2003-2005 Kupu Contributors. See CREDITS.txt
*
* Instead of customizing this file, it is recommended to add your own
* CSS file. Feel free to use whole or parts of this for your own
@@ -20,16 +20,22 @@
background-color: ButtonFace;
padding: 0 8px 8px 8px;
height: auto;
- width: 520px;
+ width: 640px;
z-index: 2;
}
-.kupu-drawer h1 {
- height: auto; width: auto;
+.kupu-tabledrawer {
+ width: 408px;
+ left: 320px;
+}
+.kupu-tabledrawer .kupu-panels,
+.kupu-tabledrawer .kupu-panels table,
+.kupu-tabledrawer div.kupu-dialogbuttons {
+ width: 400px;
}
-div#kupu-drawerheader, div#kupu-dialogbuttons {
- font-family: sans-serif;
+.kupu-drawer h1 {
+ height: auto; width: auto;
}
input#kupu-searchbox-input {
@@ -39,8 +45,14 @@
padding: 2px;
}
-input#kupu-linkdrawer-input {
- width: 400px;
+div.kupu-linkdrawer-addlink td {
+ border: 0;
+}
+input.kupu-linkdrawer-input {
+ width: 500px;
+}
+iframe.kupu-linkdrawer-preview {
+ width: 100%;
}
div#kupu-librarydrawer h1, div.kupu-drawer h1 {
@@ -51,10 +63,11 @@
text-align: right;
margin-top: 6px;
margin-bottom: 6px;
+ width: 640px; /* Mozilla bug */
}
-div.kupu-dialogbuttons button {
- margin-left: 0.3em;
+div.kupu-drawer button {
+ margin-right: 0.3em;
}
div.kupu-panels {
@@ -64,11 +77,9 @@
}
div.kupu-panels td {
- font-family: sans-serif;
- font-size: 12px;
+/* font-size: 12px;*/
background-color: white;
vertical-align: top;
- padding: 6px;
}
div.kupu-panels td.kupu-preview-button {
@@ -76,7 +87,7 @@
}
div.kupu-panels table {
- width: 100%;
+ width: 100%;
margin: 0;
padding: 0;
border: 0;
@@ -87,30 +98,38 @@
}
td#kupu-librariespanel {
- width: 22%;
+ overflow: auto;
+ width: 105px;
}
-td#kupu-resourcespanel {
- width: 33%;
+div#kupu-librariesitems {
+ width: 105px;
+ white-space: pre;
+ height: 100%;
}
-td#kupu-propertiespanel {
- width: 45%;
+td#kupu-resourcespanel {
+ overflow: auto;
+ width: 185px;
}
div#kupu-resourceitems {
+ white-space: pre;
+ width: 200px;
height: 100%;
}
-.overflow {
- overflow: auto;
+div#kupu-properties {
height: 100%;
}
-div.kupu-libsource, div.kupu-libsource-selected {
- text-align: center;
- padding-top: 0.2em;
- padding-bottom: 0.6em;
+div#kupu-librariesitems, div#kupu-resourceitems, div#kupu-properties {
+ padding: 6px;
+}
+
+.overflow {
+ overflow: auto;
+ height: 100%;
}
div.response, div.collection {
@@ -122,25 +141,26 @@
padding-top: 4px;
}
-div.kupu-libsource, div.kupu-libsource-selected,
+div.kupu-libsource, div.kupu-libsource-selected,
div.kupu-resource, div.kupu-collection, div.kupu-upload {
cursor: pointer;
margin-bottom: 2px;
vertical-align: text-bottom;
+ white-space: pre;
}
div.kupu-upload {
text-align: right; font-style: italic;
}
-div.kupu-libsource-selected {
+/*div.kupu-libsource-selected {
background-repeat: no-repeat;
-}
+}*/
-div.kupu-libsource-selected span,
+/*div.kupu-libsource-selected span,
div.kupu-libsource span{
margin-top: 3px;
- display: block;
-}
+ display: inline;
+}*/
div.kupu-libsource-selected span {
background-color: ButtonFace;
@@ -162,28 +182,28 @@
padding-top: 2px;
}
-/* Local image upload form */
-
-#kupu-upload-to {
- margin-top: 10px;
- margin-bottom: 10px;
- clear:both;
+span.drawer-item-title.selected-item {
+ background-color:#C0C0C0;
}
-#kupu-upload-file {
- margin-top: 10px;
- margin-bottom: 10px;
- clear:both;
-}
+/* Local image upload form */
-#kupu-upload-title {
- margin-top: 10px;
- margin-bottom: 10px;
+#kupu-upload-file, #kupu-upload-title {
+ margin-top: 0.1em;
+ margin-bottom: 0.5em;
+ width: 95%;
clear:both;
}
#kupu-upload-instructions {
- margin-top:10px;
- margin-bottom: 20px;
+ margin-top: 0.5em;
+ margin-bottom: 1em;
clear:both;
+ line-height: normal;
}
+
+th.kupu-toolbox-label {
+ text-align:right;
+ width: 5%;
+ white-space: nowrap;
+}
\ No newline at end of file
Modified: myfaces/tomahawk/trunk/src/java/org/apache/myfaces/custom/inputHtml/resource/kupueditor.js
URL: http://svn.apache.org/viewcvs/myfaces/tomahawk/trunk/src/java/org/apache/myfaces/custom/inputHtml/resource/kupueditor.js?rev=233117&r1=233116&r2=233117&view=diff
==============================================================================
--- myfaces/tomahawk/trunk/src/java/org/apache/myfaces/custom/inputHtml/resource/kupueditor.js (original)
+++ myfaces/tomahawk/trunk/src/java/org/apache/myfaces/custom/inputHtml/resource/kupueditor.js Tue Aug 16 21:02:45 2005
@@ -1,6 +1,6 @@
/*****************************************************************************
*
- * Copyright (c) 2003-2004 Kupu Contributors. All rights reserved.
+ * 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
@@ -34,8 +34,7 @@
// methods
this.execCommand = function(command, arg) {
/* delegate execCommand */
- // XXX Is the command always a string? Can't it be '' or 0 or so?
- if (!arg) arg = null;
+ if (arg === undefined) arg = null;
this.document.execCommand(command, false, arg);
};
@@ -103,7 +102,6 @@
/* Should be called on iframe.onload, will initialize the editor */
//DOM2Event.initRegistration();
this._initializeEventHandlers();
- this.focusDocument();
if (this.getBrowserName() == "IE") {
var body = this.getInnerDocument().getElementsByTagName('body')[0];
body.setAttribute('contentEditable', 'true');
@@ -117,7 +115,7 @@
} else {
this._setDesignModeWhenReady();
};
- this.logMessage('Editor initialized');
+ this.logMessage(_('Editor initialized'));
};
this.setContextMenu = function(menu) {
@@ -156,9 +154,7 @@
// 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._saveSelection();
if (event.type == 'click' || event.type=='mouseup' ||
(event.type == 'keyup' &&
@@ -184,7 +180,9 @@
this.updateState(event);
break;
} else {
- this.logMessage('Exception while processing updateState on ' + id + ': ' + e, 2);
+ this.logMessage(
+ _('Exception while processing updateState on ' +
+ '${id}: ${msg}', {'id': id, 'msg': e}), 2);
};
};
};
@@ -199,7 +197,7 @@
// if no dst is available, bail out
if (!this.config.dst) {
- this.logMessage('No destination URL available!', 2);
+ this.logMessage(_('No destination URL available!'), 2);
return;
}
var sourcetool = this.getTool('sourceedittool');
@@ -212,7 +210,7 @@
this._initialized = false;
// set the window status so people can see we're actually saving
- window.status= "Please wait while saving document...";
+ window.status= _("Please wait while saving document...");
// call (optional) beforeSave() method on all tools
for (var id in this.tools) {
@@ -229,14 +227,14 @@
};
// pass the content through the filters
- this.logMessage("Starting HTML cleanup");
+ this.logMessage(_("Starting HTML cleanup"));
var transform = this._filterContent(this.getInnerDocument().documentElement);
// serialize to a string
var contents = this._serializeOutputToString(transform);
- this.logMessage("Cleanup done, sending document to server");
- var request = Sarissa.getXmlHttpRequest();
+ this.logMessage(_("Cleanup done, sending document to server"));
+ var request = new XMLHttpRequest();
if (!synchronous) {
request.onreadystatechange = (new ContextFixer(this._saveCallback,
@@ -244,9 +242,9 @@
request.open("PUT", this.config.dst, true);
request.setRequestHeader("Content-type", this.config.content_type);
request.send(contents);
- this.logMessage("Request sent to server");
+ this.logMessage(_("Request sent to server"));
} else {
- this.logMessage('Sending request to server');
+ this.logMessage(_('Sending request to server'));
request.open("PUT", this.config.dst, false);
request.setRequestHeader("Content-type", this.config.content_type);
request.send(contents);
@@ -270,12 +268,11 @@
this._initialized = false;
// set the window status so people can see we're actually saving
- window.status= "Please wait while saving document...";
-/* Removed for MyFaces
- TODO : Evaluate how to handle this.
+ window.status= _("Please wait while saving document...");
+
// call (optional) beforeSave() method on all tools
- for (var id in this.tools) {
- var tool = this.tools[id];
+ for (var tid in this.tools) {
+ var tool = this.tools[tid];
if (tool.beforeSave) {
try {
tool.beforeSave();
@@ -286,14 +283,14 @@
};
};
};
-*/
+
// set a default id
if (!id) {
id = 'kupu';
};
// pass the content through the filters
- this.logMessage("Starting HTML cleanup");
+ this.logMessage(_("Starting HTML cleanup"));
var transform = this._filterContent(this.getInnerDocument().documentElement);
// XXX need to fix this. Sometimes a spurious "\n\n" text
@@ -301,7 +298,7 @@
// serializer on .xml
var contents = this._serializeOutputToString(transform);
- this.logMessage("Cleanup done, sending document to server");
+ 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
@@ -325,7 +322,7 @@
and adding basic elements such as lists
*/
if (!this._initialized) {
- this.logMessage('Editor not initialized yet!');
+ this.logMessage(_('Editor not initialized yet!'));
return;
};
if (this.getBrowserName() == "IE") {
@@ -342,25 +339,24 @@
};
};
this.getDocument().execCommand(command, param);
- var message = 'Command ' + command + ' executed';
+ var message = _('Command ${command} executed', {'command': command});
if (param) {
- message += ' with parameter ' + param;
+ message = _('Command ${command} executed with parameter ${param}',
+ {'command': command, 'param': param});
}
this.updateState();
this.logMessage(message);
};
-
+
this.getSelection = function() {
/* returns a Selection object wrapping the current selection */
- if (this.getBrowserName() == "IE") {
- this._restoreSelection();
- };
+ this._restoreSelection();
return this.getDocument().getSelection();
};
-
+
this.getSelectedNode = function() {
/* returns the selected node (read: parent) or none */
- return this.getSelection().getSelectedNode();
+ return this.getSelection().parentElement();
};
this.getNearestParentOfType = function(node, type) {
@@ -402,7 +398,7 @@
this.insertNodeAtSelection = function(insertNode, selectNode) {
/* insert a newly created node into the document */
if (!this._initialized) {
- this.logMessage('Editor not initialized yet!');
+ this.logMessage(_('Editor not initialized yet!'));
return;
};
@@ -414,10 +410,7 @@
};
var ret = this.getSelection().replaceWithNode(insertNode, selectNode);
-
- if (browser == 'IE') {
- this._saveSelection();
- };
+ this._saveSelection();
return ret;
};
@@ -446,16 +439,21 @@
} else if (_SARISSA_IS_IE) {
return "IE";
} else {
- throw "Browser not supported!";
+ throw _("Browser not supported!");
}
};
this.handleSaveResponse = function(request, redirect) {
- if (request.status != '200' && request.status != '204'){
- alert('Error saving your data.\nResponse status: ' +
- request.status +
- '.\nCheck your server log for more information.')
- window.status = "Error saving document"
+ // mind the 1223 status, somehow IE gives that sometimes (on 204?)
+ // at first we didn't want to add it here, since it's a specific IE
+ // bug, but too many users had trouble with it...
+ if (request.status != '200' && request.status != '204' &&
+ request.status != '1223') {
+ var msg = _('Error saving your data.\nResponse status: ' +
+ '${status}.\nCheck your server log for more ' +
+ 'information.', {'status': request.status});
+ alert(msg);
+ window.status = _("Error saving document");
} else if (redirect) { // && (!request.status || request.status == '200' || request.status == '204'))
window.document.location = redirect;
this.content_changed = false;
@@ -466,7 +464,7 @@
this.reloadSrc();
};
// we're done so we can start editing again
- window.status= "Document saved";
+ window.status= _("Document saved");
};
this._initialized = true;
};
@@ -518,7 +516,7 @@
*/
this._designModeSetAttempts++;
if (this._designModeSetAttempts > 25) {
- alert('Couldn\'t set design mode. Kupu will not work on this browser.');
+ alert(_('Couldn\'t set design mode. Kupu will not work on this browser.'));
return;
};
var success = false;
@@ -558,15 +556,21 @@
this._restoreSelection = function() {
/* re-selects the previous selection in IE. We only restore if the
- current selection is not in the document.*/
+ current selection is not in the document.*/
if (this._previous_range && !this._isDocumentSelected()) {
try {
this._previous_range.select();
} catch (e) {
- this.logMessage('Error placing back selection');
+ alert("Error placing back selection");
+ this.logMessage(_('Error placing back selection'));
};
};
};
+
+ if (this.getBrowserName() != "IE") {
+ this._saveSelection = function() {};
+ this._restoreSelection = function() {};
+ }
this._isDocumentSelected = function() {
var editable_body = this.getInnerDocument().getElementsByTagName('body')[0];
@@ -589,7 +593,7 @@
this._previous_range = null;
};
- this._filterContent = function(documentElement) {
+ this._filterContent = function(documentElement) {
/* pass the content through all the filters */
// first copy all nodes to a Sarissa document so it's usable
var xhtmldoc = Sarissa.getDomDocument();
@@ -608,9 +612,9 @@
var bodies = transform.getElementsByTagName('body');
var data = '';
for (var i = 0; i < bodies.length; i++) {
- data += bodies[i].xml;
+ data += Sarissa.serialize(bodies[i]);
}
- return data;
+ return this.escapeEntities(data);
};
this.getHTMLBody = function() {
@@ -621,7 +625,7 @@
for (var i = 0; i < bodies.length; i++) {
data += bodies[i].innerHTML;
}
- return data;
+ return this.escapeEntities(data);
};
// If we have multiple bodies this needs to remove the extras.
@@ -720,23 +724,32 @@
if (this.config.strict_output) {
var contents = '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" ' +
'"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">\n' +
- '<html xmlns="http://www.w3.org/1999/xhtml">' +
- transform.getElementsByTagName("head")[0].xml +
- transform.getElementsByTagName("body")[0].xml +
+ '<html xmlns="http://www.w3.org/1999/xhtml">' +
+ Sarissa.serialize(transform.getElementsByTagName("head")[0]) +
+ Sarissa.serialize(transform.getElementsByTagName("body")[0]) +
'</html>';
} else {
var contents = '<html>' +
- transform.getElementsByTagName("head")[0].xml +
- transform.getElementsByTagName("body")[0].xml +
+ Sarissa.serialize(transform.getElementsByTagName("head")[0]) +
+ Sarissa.serialize(transform.getElementsByTagName("body")[0]) +
'</html>';
};
+ contents = this.escapeEntities(contents);
+
if (this.config.compatible_singletons) {
contents = this._fixupSingletons(contents);
};
return contents;
};
+ this.escapeEntities = function(xml) {
+ // Escape non-ascii characters as entities.
+ return xml.replace(/[^\r\n -\177]/g,
+ function(c) {
+ return '&#'+c.charCodeAt(0)+';';
+ });
+ }
this.getFullEditor = function() {
var fulleditor = this.getDocument().getEditable();
@@ -753,6 +766,44 @@
this.clearClass = function(name) {
var fulleditor = this.getFullEditor();
fulleditor.className = fulleditor.className.replace(' '+name, '');
+ }
+
+ this.suspendEditing = function() {
+ this._previous_range = this.getSelection().getRange();
+ this.setClass('kupu-modal');
+ for (var id in this.tools) {
+ this.tools[id].disable();
+ }
+ if (this.getBrowserName() == "IE") {
+ var body = this.getInnerDocument().getElementsByTagName('body')[0];
+ body.setAttribute('contentEditable', 'false');
+ } else {
+
+ this.getInnerDocument().designMode = "Off";
+ var iframe = this.getDocument().getEditable();
+ iframe.style.position = iframe.style.position?"":"relative"; // Changing this disables designMode!
+ }
+ this.suspended = true;
+ }
+
+ this.resumeEditing = function() {
+ if (!this.suspended) {
+ return;
+ }
+ this.suspended = false;
+ this.clearClass('kupu-modal');
+ for (var id in this.tools) {
+ this.tools[id].enable();
+ }
+ if (this.getBrowserName() == "IE") {
+ this._restoreSelection();
+ var body = this.getInnerDocument().getElementsByTagName('body')[0];
+ body.setAttribute('contentEditable', 'true');
+ } else {
+ var doc = this.getInnerDocument();
+ doc.designMode = "On";
+ this.getSelection().restoreRange(this._previous_range);
+ }
}
}