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 [2/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/kupubasetools.js
URL: http://svn.apache.org/viewcvs/myfaces/tomahawk/trunk/src/java/org/apache/myfaces/custom/inputHtml/resource/kupubasetools.js?rev=233117&r1=233116&r2=233117&view=diff
==============================================================================
--- myfaces/tomahawk/trunk/src/java/org/apache/myfaces/custom/inputHtml/resource/kupubasetools.js (original)
+++ myfaces/tomahawk/trunk/src/java/org/apache/myfaces/custom/inputHtml/resource/kupubasetools.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
@@ -65,11 +65,18 @@
};
};
+ this.enable = function() {
+ // Called when the tool is enabled after a form is dismissed.
+ }
+
+ this.disable = function() {
+ // Called when the tool is disabled (e.g. for a modal form)
+ }
// private methods
addEventHandler = addEventHandler;
this._selectSelectItem = function(select, item) {
- this.editor.logMessage('Deprecation warning: KupuTool._selectSelectItem');
+ this.editor.logMessage(_('Deprecation warning: KupuTool._selectSelectItem'));
};
this._fixTabIndex = function(element) {
var tabIndex = this.editor.getDocument().getEditable().tabIndex-1;
@@ -93,7 +100,7 @@
};
this._selectSelectItem = function(select, item) {
- this.editor.logMessage('Deprecation warning: KupuToolBox._selectSelectItem');
+ this.editor.logMessage(_('Deprecation warning: KupuToolBox._selectSelectItem'));
};
};
@@ -104,13 +111,28 @@
}
return object;
}
+
+// Helper function for enabling/disabling tools
+function KupuButtonDisable(button) {
+ button = button || this.button;
+ button.disabled = "disabled";
+ button.className += ' disabled';
+}
+function KupuButtonEnable(button) {
+ button = button || this.button;
+ button.disabled = "";
+ button.className = button.className.replace(/ *\bdisabled\b/g, '');
+}
+
+
//----------------------------------------------------------------------------
// Implementations
//----------------------------------------------------------------------------
function KupuButton(buttonid, commandfunc, tool) {
/* Base prototype for kupu button tools */
- this.button = window.document.getElementById(buttonid);
+ this.buttonid = buttonid;
+ this.button = getFromSelector(buttonid);
this.commandfunc = commandfunc;
this.tool = tool;
@@ -123,7 +145,6 @@
this.execCommand = function() {
/* exec this button's command */
this.commandfunc(this, this.editor, this.tool);
- this.editor.focusDocument();
};
this.updateState = function(selNode, event) {
@@ -131,14 +152,16 @@
look 'pressed in' or not
*/
};
+ this.disable = KupuButtonDisable;
+ this.enable = KupuButtonEnable;
};
KupuButton.prototype = new KupuTool;
-
function KupuStateButton(buttonid, commandfunc, checkfunc, offclass, onclass) {
/* A button that can have two states (e.g. pressed and
not-pressed) based on CSS classes */
- this.button = window.document.getElementById(buttonid);
+ this.buttonid = buttonid;
+ this.button = getFromSelector(buttonid);
this.commandfunc = commandfunc;
this.checkfunc = checkfunc;
this.offclass = offclass;
@@ -147,10 +170,10 @@
this.execCommand = function() {
/* exec this button's command */
- this.commandfunc(this, this.editor);
this.button.className = (this.pressed ? this.offclass : this.onclass);
this.pressed = !this.pressed;
this.editor.focusDocument();
+ this.commandfunc(this, this.editor);
};
this.updateState = function(selNode, event) {
@@ -175,10 +198,26 @@
KupuStateButton.prototype = new KupuButton;
+/* Same as the state button, but the focusDocument call is delayed.
+ * Mozilla&Firefox have a bug on windows which can cause a crash if you
+ * change CSS positioning styles on an element which has focus.
+ */
+function KupuLateFocusStateButton(buttonid, commandfunc, checkfunc, offclass, onclass) {
+ KupuStateButton.apply(this, [buttonid, commandfunc, checkfunc, offclass, onclass]);
+ this.execCommand = function() {
+ /* exec this button's command */
+ this.button.className = (this.pressed ? this.offclass : this.onclass);
+ this.pressed = !this.pressed;
+ this.commandfunc(this, this.editor);
+ this.editor.focusDocument();
+ };
+}
+KupuLateFocusStateButton.prototype = new KupuStateButton;
+
function KupuRemoveElementButton(buttonid, element_name, cssclass) {
/* A button specialized in removing elements in the current node
context. Typical usages include removing links, images, etc. */
- this.button = window.document.getElementById(buttonid);
+ this.button = getFromSelector(buttonid);
this.onclass = 'invisible';
this.offclass = cssclass;
this.pressed = false;
@@ -204,13 +243,13 @@
*/
// attributes
- this.tsselect = document.getElementById(textstyleselectid);
+ this.tsselect = getFromSelector(textstyleselectid);
this.initialize = function(editor) {
/* initialize the ui like tools */
this.editor = editor;
this._fixTabIndex(this.tsselect);
- addEventHandler(this.tsselect, 'change', this.setTextStyleHandler, this);
+ this._selectevent = addEventHandler(this.tsselect, 'change', this.setTextStyleHandler, this);
};
this.setTextStyleHandler = function(event) {
@@ -239,7 +278,7 @@
this.editor.execCommand('Cut');
} catch (e) {
if (this.editor.getBrowserName() == 'Mozilla') {
- alert('Cutting from JavaScript is disabled on your Mozilla due to security settings. For more information, read http://www.mozilla.org/editor/midasdemo/securityprefs.html');
+ alert(_('Cutting from JavaScript is disabled on your Mozilla due to security settings. For more information, read http://www.mozilla.org/editor/midasdemo/securityprefs.html'));
} else {
throw e;
};
@@ -252,7 +291,7 @@
this.editor.execCommand('Copy');
} catch (e) {
if (this.editor.getBrowserName() == 'Mozilla') {
- alert('Copying from JavaScript is disabled on your Mozilla due to security settings. For more information, read http://www.mozilla.org/editor/midasdemo/securityprefs.html');
+ alert(_('Copying from JavaScript is disabled on your Mozilla due to security settings. For more information, read http://www.mozilla.org/editor/midasdemo/securityprefs.html'));
} else {
throw e;
};
@@ -265,7 +304,7 @@
this.editor.execCommand('Paste');
} catch (e) {
if (this.editor.getBrowserName() == 'Mozilla') {
- alert('Pasting from JavaScript is disabled on your Mozilla due to security settings. For more information, read http://www.mozilla.org/editor/midasdemo/securityprefs.html');
+ alert(_('Pasting from JavaScript is disabled on your Mozilla due to security settings. For more information, read http://www.mozilla.org/editor/midasdemo/securityprefs.html'));
} else {
throw e;
};
@@ -274,12 +313,35 @@
};
this.setTextStyle = function(style) {
- /* method for the text style pulldown */
- // XXX Yuck!!
- if (this.editor.getBrowserName() == "IE") {
- style = '<' + style + '>';
+ /* method for the text style pulldown
+
+ parse the argument into a type and classname part if it contains
+ a pipe symbol (|), generate a block element
+ */
+ var classname = "";
+ var eltype = style;
+ if (style.indexOf('|') > -1) {
+ style = style.split('|');
+ eltype = style[0];
+ classname = style[1];
+ };
+
+ var command = eltype;
+ // first create the element, then find it and set the classname
+ if (this.editor.getBrowserName() == 'IE') {
+ command = '<' + eltype + '>';
+ };
+ this.editor.getDocument().execCommand('formatblock', command);
+
+ // now get a reference to the element just added
+ var selNode = this.editor.getSelectedNode();
+ var el = this.editor.getNearestParentOfType(selNode, eltype);
+
+ // now set the classname
+ if (classname) {
+ el.className = classname;
};
- this.editor.execCommand('formatblock', style);
+ this.editor.updateState();
};
this.updateState = function(selNode) {
@@ -307,11 +369,20 @@
this.createContextMenuElements = function(selNode, event) {
var ret = new Array();
- ret.push(new ContextMenuElement('Cut', this.cutButtonHandler, this));
- ret.push(new ContextMenuElement('Copy', this.copyButtonHandler, this));
- ret.push(new ContextMenuElement('Paste', this.pasteButtonHandler, this));
+ ret.push(new ContextMenuElement(_('Cut'),
+ this.cutButtonHandler, this));
+ ret.push(new ContextMenuElement(_('Copy'),
+ this.copyButtonHandler, this));
+ ret.push(new ContextMenuElement(_('Paste'),
+ this.pasteButtonHandler, this));
return ret;
};
+ this.disable = function() {
+ this.tsselect.disabled = "disabled";
+ }
+ this.enable = function() {
+ this.tsselect.disabled = "";
+ }
}
KupuUI.prototype = new KupuTool;
@@ -319,9 +390,9 @@
function ColorchooserTool(fgcolorbuttonid, hlcolorbuttonid, colorchooserid) {
/* the colorchooser */
- this.fgcolorbutton = document.getElementById(fgcolorbuttonid);
- this.hlcolorbutton = document.getElementById(hlcolorbuttonid);
- this.ccwindow = document.getElementById(colorchooserid);
+ this.fgcolorbutton = getFromSelector(fgcolorbuttonid);
+ this.hlcolorbutton = getFromSelector(hlcolorbuttonid);
+ this.ccwindow = getFromSelector(colorchooserid);
this.command = null;
this.initialize = function(editor) {
@@ -336,7 +407,7 @@
this.hide();
- this.editor.logMessage('Colorchooser tool initialized');
+ this.editor.logMessage(_('Colorchooser tool initialized'));
};
this.updateState = function(selNode) {
@@ -367,7 +438,7 @@
this.editor.execCommand(this.command, cell.getAttribute('bgColor'));
this.hide();
- this.editor.logMessage('Color chosen');
+ this.editor.logMessage(_('Color chosen'));
};
this.show = function(command) {
@@ -421,6 +492,14 @@
return table;
};
+ this.enable = function() {
+ KupuButtonEnable(this.fgcolorbutton);
+ KupuButtonEnable(this.hlcolorbutton);
+ }
+ this.disable = function() {
+ KupuButtonDisable(this.fgcolorbutton);
+ KupuButtonDisable(this.hlcolorbutton);
+ }
}
ColorchooserTool.prototype = new KupuTool;
@@ -428,8 +507,8 @@
function PropertyTool(titlefieldid, descfieldid) {
/* The property tool */
- this.titlefield = document.getElementById(titlefieldid);
- this.descfield = document.getElementById(descfieldid);
+ this.titlefield = getFromSelector(titlefieldid);
+ this.descfield = getFromSelector(descfieldid);
this.initialize = function(editor) {
/* attach the event handlers and set the initial values */
@@ -440,7 +519,7 @@
// set the fields
var heads = this.editor.getInnerDocument().getElementsByTagName('head');
if (!heads[0]) {
- this.editor.logMessage('No head in document!', 1);
+ this.editor.logMessage(_('No head in document!'), 1);
} else {
var head = heads[0];
var titles = head.getElementsByTagName('title');
@@ -461,7 +540,7 @@
}
}
- this.editor.logMessage('Property tool initialized');
+ this.editor.logMessage(_('Property tool initialized'));
};
this.updateProperties = function() {
@@ -469,7 +548,7 @@
var doc = this.editor.getInnerDocument();
var heads = doc.getElementsByTagName('HEAD');
if (!heads) {
- this.editor.logMessage('No head in document!', 1);
+ this.editor.logMessage(_('No head in document!'), 1);
return;
}
@@ -483,8 +562,19 @@
title.appendChild(text);
head.appendChild(title);
} else {
- titles[0].childNodes[0].nodeValue = this.titlefield.value;
+ var title = titles[0];
+ // IE6 title has no children, and refuses appendChild.
+ // Delete and recreate the title.
+ if (title.childNodes.length == 0) {
+ title.removeNode(true);
+ title = doc.createElement('title');
+ title.innerText = this.titlefield.value;
+ head.appendChild(title);
+ } else {
+ title.childNodes[0].nodeValue = this.titlefield.value;
+ }
}
+ document.title = this.titlefield.value;
// let's just fulfill the usecase, not think about more properties
// set the description
@@ -505,7 +595,7 @@
head.appendChild(meta);
}
- this.editor.logMessage('Properties modified');
+ this.editor.logMessage(_('Properties modified'));
};
}
@@ -516,7 +606,7 @@
this.initialize = function(editor) {
this.editor = editor;
- this.editor.logMessage('Link tool initialized');
+ this.editor.logMessage(_('Link tool initialized'));
};
this.createLinkHandler = function(event) {
@@ -599,11 +689,12 @@
var doc = this.editor.getInnerDocument();
linkel = doc.createElement("a");
linkel.setAttribute('href', url);
+ linkel.setAttribute('class', 'generated');
this.editor.getSelection().replaceWithNode(linkel, true);
this.updateLink(linkel, url, type, name, target, title);
};
}
- this.editor.logMessage('Link added');
+ this.editor.logMessage(_('Link added'));
this.editor.updateState();
};
@@ -612,7 +703,7 @@
var currnode = this.editor.getSelectedNode();
var linkel = this.editor.getNearestParentOfType(currnode, 'a');
if (!linkel) {
- this.editor.logMessage('Not inside link');
+ this.editor.logMessage(_('Not inside link'));
return;
};
while (linkel.childNodes.length) {
@@ -620,7 +711,7 @@
};
linkel.parentNode.removeChild(linkel);
- this.editor.logMessage('Link removed');
+ this.editor.logMessage(_('Link removed'));
this.editor.updateState();
};
@@ -629,9 +720,9 @@
var ret = new Array();
var link = this.editor.getNearestParentOfType(selNode, 'a');
if (link) {
- ret.push(new ContextMenuElement('Delete link', this.deleteLink, this));
+ ret.push(new ContextMenuElement(_('Delete link'), this.deleteLink, this));
} else {
- ret.push(new ContextMenuElement('Create link', this.createLinkHandler, this));
+ ret.push(new ContextMenuElement(_('Create link'), this.createLinkHandler, this));
};
return ret;
};
@@ -642,9 +733,9 @@
function LinkToolBox(inputid, buttonid, toolboxid, plainclass, activeclass) {
/* create and edit links */
- this.input = document.getElementById(inputid);
- this.button = document.getElementById(buttonid);
- this.toolboxel = document.getElementById(toolboxid);
+ this.input = getFromSelector(inputid);
+ this.button = getFromSelector(buttonid);
+ this.toolboxel = getFromSelector(toolboxid);
this.plainclass = plainclass;
this.activeclass = activeclass;
@@ -691,7 +782,7 @@
var url = this.input.value;
linkel.setAttribute('href', url);
- this.editor.logMessage('Link modified');
+ this.editor.logMessage(_('Link modified'));
};
};
@@ -703,7 +794,7 @@
this.initialize = function(editor) {
/* attach the event handlers */
this.editor = editor;
- this.editor.logMessage('Image tool initialized');
+ this.editor.logMessage(_('Image tool initialized'));
};
this.createImageHandler = function(event) {
@@ -712,39 +803,55 @@
imageWindow.imagetool = this;
imageWindow.focus();
};
-
- this.createImage = function(url, floatstyle) {
+
+ this.createImage = function(url, alttext, imgclass) {
+ /* create an image */
var img = this.editor.getInnerDocument().createElement('img');
- if (floatstyle) {
- img.style.cssFloat = floatstyle;
+ img.src = url;
+ img.removeAttribute('height');
+ img.removeAttribute('width');
+ if (alttext) {
+ img.alt = alttext;
+ };
+ if (imgclass) {
+ img.className = imgclass;
};
- img.setAttribute('src', url);
img = this.editor.insertNodeAtSelection(img, 1);
- this.editor.logMessage('Image inserted');
+ this.editor.logMessage(_('Image inserted'));
this.editor.updateState();
return img;
};
-
+
+ this.setImageClass = function(imgclass) {
+ /* set the class of the selected image */
+ var currnode = this.editor.getSelectedNode();
+ var currimg = this.editor.getNearestParentOfType(currnode, 'IMG');
+ if (currimg) {
+ currimg.className = imgclass;
+ };
+ };
+
this.createContextMenuElements = function(selNode, event) {
- return new Array(new ContextMenuElement('Create image', this.createImageHandler, this));
+ return new Array(new ContextMenuElement(_('Create image'), this.createImageHandler, this));
};
}
ImageTool.prototype = new KupuTool;
-function ImageToolBox(inputfieldid, insertbuttonid, floatselectid, toolboxid, plainclass, activeclass) {
+function ImageToolBox(inputfieldid, insertbuttonid, classselectid, toolboxid, plainclass, activeclass) {
/* toolbox for adding images */
- this.inputfield = document.getElementById(inputfieldid);
- this.insertbutton = document.getElementById(insertbuttonid);
- this.floatselect = document.getElementById(floatselectid);
- this.toolboxel = document.getElementById(toolboxid);
+ this.inputfield = getFromSelector(inputfieldid);
+ this.insertbutton = getFromSelector(insertbuttonid);
+ this.classselect = getFromSelector(classselectid);
+ this.toolboxel = getFromSelector(toolboxid);
this.plainclass = plainclass;
this.activeclass = activeclass;
this.initialize = function(tool, editor) {
this.tool = tool;
this.editor = editor;
+ addEventHandler(this.classselect, "change", this.setImageClass, this);
addEventHandler(this.insertbutton, "click", this.addImage, this);
};
@@ -756,8 +863,8 @@
if (this.toolboxel) {
this.toolboxel.className = this.activeclass;
this.inputfield.value = imageel.getAttribute('src');
- var floatstyle = imageel.style.cssFloat ? imageel.style.cssFloat : 'left';
- selectSelectItem(this.floatselect, floatstyle);
+ var imgclass = imageel.className ? imageel.className : 'image-inline';
+ selectSelectItem(this.classselect, imgclass);
};
} else {
if (this.toolboxel) {
@@ -765,12 +872,20 @@
};
};
};
-
+
this.addImage = function() {
/* add an image */
var url = this.inputfield.value;
- var floatstyle = this.floatselect.options[this.floatselect.selectedIndex].value;
- this.tool.createImage(url, floatstyle);
+ var sel_class = this.classselect.options[this.classselect.selectedIndex].value;
+ this.tool.createImage(url, null, sel_class);
+ this.editor.focusDocument();
+ };
+
+ this.setImageClass = function() {
+ /* set the class for the current image */
+ var sel_class = this.classselect.options[this.classselect.selectedIndex].value;
+ this.tool.setImageClass(sel_class);
+ this.editor.focusDocument();
};
};
@@ -784,16 +899,16 @@
var table = this.editor.getNearestParentOfType(selNode, 'table');
if (!table) {
ret = new Array();
- var el = new ContextMenuElement('Add table', this.addPlainTable, this);
+ var el = new ContextMenuElement(_('Add table'), this.addPlainTable, this);
ret.push(el);
return ret;
} else {
var ret = new Array();
- ret.push(new ContextMenuElement('Add row', this.addTableRow, this));
- ret.push(new ContextMenuElement('Delete row', this.delTableRow, this));
- ret.push(new ContextMenuElement('Add column', this.addTableColumn, this));
- ret.push(new ContextMenuElement('Delete column', this.delTableColumn, this));
- ret.push(new ContextMenuElement('Delete Table', this.delTable, this));
+ ret.push(new ContextMenuElement(_('Add row'), this.addTableRow, this));
+ ret.push(new ContextMenuElement(_('Delete row'), this.delTableRow, this));
+ ret.push(new ContextMenuElement(_('Add column'), this.addTableColumn, this));
+ ret.push(new ContextMenuElement(_('Delete column'), this.delTableColumn, this));
+ ret.push(new ContextMenuElement(_('Delete Table'), this.delTable, this));
return ret;
};
};
@@ -805,13 +920,15 @@
this.createTable = function(rows, cols, makeHeader, tableclass) {
/* add a table */
+ if (rows < 1 || rows > 99 || cols < 1 || cols > 99) {
+ this.editor.logMessage(_('Invalid table size'), 1);
+ return;
+ };
+
var doc = this.editor.getInnerDocument();
table = doc.createElement("table");
- table.setAttribute("border", "1");
- table.setAttribute("cellpadding", "8");
- table.setAttribute("cellspacing", "2");
- table.setAttribute("class", tableclass);
+ table.className = tableclass;
// If the user wants a row of headings, make them
if (makeHeader) {
@@ -842,16 +959,20 @@
this._setTableCellHandlers(table);
- this.editor.logMessage('Table added');
+ this.editor.logMessage(_('Table added'));
+ this.editor.updateState();
return table;
};
this._setTableCellHandlers = function(table) {
// make each cell select its full contents if it's clicked
+ addEventHandler(table, 'click', this._selectContentIfEmpty, this);
+
var cells = table.getElementsByTagName('td');
for (var i=0; i < cells.length; i++) {
addEventHandler(cells[i], 'click', this._selectContentIfEmpty, this);
};
+
// select the nbsp in the first cell
var firstcell = cells[0];
if (firstcell) {
@@ -930,7 +1051,8 @@
currtbody.insertBefore(newrow, nextrow);
}
- this.editor.logMessage('Table row added');
+ this.editor.focusDocument();
+ this.editor.logMessage(_('Table row added'));
};
this.delTableRow = function() {
@@ -938,14 +1060,25 @@
var currnode = this.editor.getSelectedNode();
var parentrow = this.editor.getNearestParentOfType(currnode, "TR");
if (!parentrow) {
- this.editor.logMessage('No row to delete', 1);
+ this.editor.logMessage(_('No row to delete'), 1);
return;
}
+ // move selection aside
+ // XXX: doesn't work if parentrow is the only row of thead/tbody/tfoot
+ // XXX: doesn't preserve the colindex
+ var selection = this.editor.getSelection();
+ if (parentrow.nextSibling) {
+ selection.selectNodeContents(parentrow.nextSibling.firstChild);
+ } else if (parentrow.previousSibling) {
+ selection.selectNodeContents(parentrow.previousSibling.firstChild);
+ };
+
// remove the row
parentrow.parentNode.removeChild(parentrow);
- this.editor.logMessage('Table row removed');
+ this.editor.focusDocument();
+ this.editor.logMessage(_('Table row removed'));
};
this.addTableColumn = function() {
@@ -956,7 +1089,7 @@
currtd = this.editor.getNearestParentOfType(currnode, 'TH');
}
if (!currtd) {
- this.editor.logMessage('No parentcolumn found!', 1);
+ this.editor.logMessage(_('No parentcolumn found!'), 1);
return;
}
var currtr = this.editor.getNearestParentOfType(currnode, 'TR');
@@ -964,7 +1097,8 @@
// get the current index
var tdindex = this._getColIndex(currtd);
- this.editor.logMessage('tdindex: ' + tdindex);
+ // XXX this looks like a debug message, remove
+ this.editor.logMessage(_('tdindex: ${tdindex}'));
// now add a column to all rows
// first the thead
@@ -1038,7 +1172,8 @@
}
}
}
- this.editor.logMessage('Table column added');
+ this.editor.focusDocument();
+ this.editor.logMessage(_('Table column added'));
};
this.delTableColumn = function() {
@@ -1051,6 +1186,14 @@
var currcolindex = this._getColIndex(currtd);
var currtable = this.editor.getNearestParentOfType(currnode, 'TABLE');
+ // move selection aside
+ var selection = this.editor.getSelection();
+ if (currtd.nextSibling) {
+ selection.selectNodeContents(currtd.nextSibling);
+ } else if (currtd.previousSibling) {
+ selection.selectNodeContents(currtd.previousSibling);
+ };
+
// remove the theaders
var heads = currtable.getElementsByTagName('THEAD');
if (heads.length) {
@@ -1094,7 +1237,7 @@
if (cell.nodeType != 1) {
continue;
}
- var colspan = cell.getAttribute('colspan');
+ var colspan = cell.colSpan;
if (currindex == currcolindex) {
tr.removeChild(cell);
break;
@@ -1103,7 +1246,8 @@
}
}
}
- this.editor.logMessage('Table column deleted');
+ this.editor.focusDocument();
+ this.editor.logMessage(_('Table column deleted'));
};
this.delTable = function() {
@@ -1111,11 +1255,11 @@
var currnode = this.editor.getSelectedNode();
var table = this.editor.getNearestParentOfType(currnode, 'table');
if (!table) {
- this.editor.logMessage('Not inside a table!');
+ this.editor.logMessage(_('Not inside a table!'));
return;
};
table.parentNode.removeChild(table);
- this.editor.logMessage('Table removed');
+ this.editor.logMessage(_('Table removed'));
};
this.setColumnAlign = function(newalign) {
@@ -1183,7 +1327,7 @@
if (prevsib.nodeType == 1 &&
(prevsib.tagName.toUpperCase() == "TD" ||
prevsib.tagName.toUpperCase() == "TH")) {
- var colspan = prevsib.getAttribute('colspan');
+ var colspan = prevsib.colSpan;
if (colspan) {
currcolindex += parseInt(colspan);
} else {
@@ -1192,7 +1336,7 @@
}
prevsib = prevsib.previousSibling;
if (currcolindex > 30) {
- alert("Recursion detected when counting column position");
+ alert(_("Recursion detected when counting column position"));
return;
}
}
@@ -1225,7 +1369,7 @@
var currnode = this.editor.getSelectedNode();
var table = this.editor.getNearestParentOfType(currnode, 'TABLE');
if (!table) {
- this.editor.logMessage('Not inside a table!');
+ this.editor.logMessage(_('Not inside a table!'));
return;
};
this._fixTableHelper(table);
@@ -1236,13 +1380,20 @@
var doc = this.editor.getInnerDocument();
var tbody = doc.createElement('tbody');
- var allowed_classes = new Array('plain', 'grid', 'list', 'listing', 'data');
- if (!allowed_classes.contains(table.getAttribute('class'))) {
- table.setAttribute('class', 'plain');
+ if (this.editor.config.table_classes) {
+ var allowed_classes = this.editor.config.table_classes['class'];
+ if (!allowed_classes.contains(table.className)) {
+ table.className = allowed_classes[0];
+ };
+ } else {
+ table.removeAttribute('class');
+ table.removeAttribute('className');
};
-
- table.setAttribute('cellpadding', '0');
- table.setAttribute('cellspacing', '0');
+ table.removeAttribute('border');
+ table.removeAttribute('cellpadding');
+ table.removeAttribute('cellPadding');
+ table.removeAttribute('cellspacing');
+ table.removeAttribute('cellSpacing');
// now get all the rows of the table, the rows can either be
// direct descendants of the table or inside a 'tbody', 'thead'
@@ -1323,9 +1474,8 @@
};
table.appendChild(tbody);
- this.editor.getDocument().getWindow().focus();
-
- this.editor.logMessage('Table cleaned up');
+ this.editor.focusDocument();
+ this.editor.logMessage(_('Table cleaned up'));
};
this.fixAllTables = function() {
@@ -1350,21 +1500,21 @@
// a lot of dependencies on html elements here, but most implementations
// will use them all I guess
- this.addtablediv = document.getElementById(addtabledivid);
- this.edittablediv = document.getElementById(edittabledivid);
- this.newrowsinput = document.getElementById(newrowsinputid);
- this.newcolsinput = document.getElementById(newcolsinputid);
- this.makeheaderinput = document.getElementById(makeheaderinputid);
- this.classselect = document.getElementById(classselectid);
- this.alignselect = document.getElementById(alignselectid);
- this.addtablebutton = document.getElementById(addtablebuttonid);
- this.addrowbutton = document.getElementById(addrowbuttonid);
- this.delrowbutton = document.getElementById(delrowbuttonid);
- this.addcolbutton = document.getElementById(addcolbuttonid);
- this.delcolbutton = document.getElementById(delcolbuttonid);
- this.fixbutton = document.getElementById(fixbuttonid);
- this.fixallbutton = document.getElementById(fixallbuttonid);
- this.toolboxel = document.getElementById(toolboxid);
+ this.addtablediv = getFromSelector(addtabledivid);
+ this.edittablediv = getFromSelector(edittabledivid);
+ this.newrowsinput = getFromSelector(newrowsinputid);
+ this.newcolsinput = getFromSelector(newcolsinputid);
+ this.makeheaderinput = getFromSelector(makeheaderinputid);
+ this.classselect = getFromSelector(classselectid);
+ this.alignselect = getFromSelector(alignselectid);
+ this.addtablebutton = getFromSelector(addtablebuttonid);
+ this.addrowbutton = getFromSelector(addrowbuttonid);
+ this.delrowbutton = getFromSelector(delrowbuttonid);
+ this.addcolbutton = getFromSelector(addcolbuttonid);
+ this.delcolbutton = getFromSelector(delcolbuttonid);
+ this.fixbutton = getFromSelector(fixbuttonid);
+ this.fixallbutton = getFromSelector(fixallbuttonid);
+ this.toolboxel = getFromSelector(toolboxid);
this.plainclass = plainclass;
this.activeclass = activeclass;
@@ -1399,7 +1549,7 @@
addEventHandler(this.fixallbutton, "click", this.tool.fixAllTables, this.tool);
this.addtablediv.style.display = "block";
this.edittablediv.style.display = "none";
- this.editor.logMessage('Table tool initialized');
+ this.editor.logMessage(_('Table tool initialized'));
};
this.updateState = function(selNode) {
@@ -1431,7 +1581,8 @@
var rows = this.newrowsinput.value;
var cols = this.newcolsinput.value;
var makeHeader = this.makeheaderinput.checked;
- var classchooser = document.getElementById("kupu-table-classchooser-add");
+ // XXX getFromSelector
+ var classchooser = getFromSelector("kupu-table-classchooser-add");
var tableclass = this.classselect.options[this.classselect.selectedIndex].value;
this.tool.createTable(rows, cols, makeHeader, tableclass);
@@ -1457,10 +1608,10 @@
function ListTool(addulbuttonid, addolbuttonid, ulstyleselectid, olstyleselectid) {
/* tool to set list styles */
- this.addulbutton = document.getElementById(addulbuttonid);
- this.addolbutton = document.getElementById(addolbuttonid);
- this.ulselect = document.getElementById(ulstyleselectid);
- this.olselect = document.getElementById(olstyleselectid);
+ this.addulbutton = getFromSelector(addulbuttonid);
+ this.addolbutton = getFromSelector(addolbuttonid);
+ this.ulselect = getFromSelector(ulstyleselectid);
+ this.olselect = getFromSelector(olstyleselectid);
this.style_to_type = {'decimal': '1',
'lower-alpha': 'a',
@@ -1498,7 +1649,7 @@
this.ulselect.style.display = "none";
this.olselect.style.display = "none";
- this.editor.logMessage('List style tool initialized');
+ this.editor.logMessage(_('List style tool initialized'));
};
this._handleStyles = function(currnode, onselect, offselect) {
@@ -1564,7 +1715,7 @@
l.setAttribute('type', this.style_to_type[style]);
}
this.editor.focusDocument();
- this.editor.logMessage('List style changed');
+ this.editor.logMessage(_('List style changed'));
};
this.setUnorderedListStyle = function() {
@@ -1576,6 +1727,19 @@
/* set the type of an ol */
this.setListStyle('ol', this.olselect);
};
+
+ this.enable = function() {
+ KupuButtonEnable(this.addulbutton);
+ KupuButtonEnable(this.addolbutton);
+ this.ulselect.disabled = "";
+ this.olselect.disabled = "";
+ }
+ this.disable = function() {
+ KupuButtonDisable(this.addulbutton);
+ KupuButtonDisable(this.addolbutton);
+ this.ulselect.disabled = "disabled";
+ this.olselect.disabled = "disabled";
+ }
};
ListTool.prototype = new KupuTool;
@@ -1598,12 +1762,13 @@
try {
window.status = url ?
- (path.toString() + ' - contains link to \'' + url.toString() + '\'') :
+ (path.toString() + ' - contains link to \'' +
+ url.toString() + '\'') :
path;
} catch (e) {
- this.editor.logMessage('Could not set status bar message, ' +
- 'check your browser\'s security settings.',
- 1);
+ this.editor.logMessage(_('Could not set status bar message, ' +
+ 'check your browser\'s security settings.'
+ ), 1);
};
};
};
@@ -1640,7 +1805,7 @@
this.createContextMenuElements = function(selNode, event) {
/* create the context menu element */
- return new Array(new ContextMenuElement('View source', this.viewSource, this));
+ return new Array(new ContextMenuElement(_('View source'), this.viewSource, this));
};
};
@@ -1653,7 +1818,7 @@
behaviour should be similar
*/
- this.dlbutton = document.getElementById(dlbuttonid);
+ this.dlbutton = getFromSelector(dlbuttonid);
this.initialize = function(editor) {
/* initialize the tool */
@@ -1707,7 +1872,7 @@
} else {
var dd = this.editor.getNearestParentOfType(selNode, 'dd');
if (!dd) {
- this.editor.logMessage('Not inside a definition list element!');
+ this.editor.logMessage(_('Not inside a definition list element!'));
return;
};
if (dd.childNodes.length == 1 && dd.childNodes[0].nodeValue == '\xa0') {
@@ -1859,8 +2024,8 @@
var selection = this.editor.getSelection();
selection.selectNodeContents(dt);
selection.collapse();
- this.editor.getDocument().getWindow().focus();
+ this.editor.focusDocument();
return dt;
};
@@ -1925,7 +2090,7 @@
var selection = this.editor.getSelection();
selection.selectNodeContents(p);
selection.collapse();
- this.editor.getDocument().getWindow().focus();
+ this.editor.focusDocument();
};
this._fixStructure = function(doc, dl, offsetnode) {
@@ -1956,8 +2121,10 @@
DefinitionListTool.prototype = new KupuTool;
-function KupuZoomTool(buttonid) {
- this.button = window.document.getElementById(buttonid);
+function KupuZoomTool(buttonid, firsttab, lasttab) {
+ this.button = getFromSelector(buttonid);
+ firsttab = firsttab || 'kupu-tb-styles';
+ lasttab = lasttab || 'kupu-logo-button';
this.initialize = function(editor) {
this.offclass = 'kupu-zoom';
@@ -1970,17 +2137,17 @@
addEventHandler(window, "scroll", this.onscroll, this);
/* Toolbar tabbing */
- var lastbutton = window.document.getElementById('kupu-logo-button');
- var firstbutton = window.document.getElementById('kupu-tb-styles');
+ var lastbutton = getFromSelector(lasttab);
+ var firstbutton = getFromSelector(firsttab);
var iframe = editor.getInnerDocument();
this.setTabbing(iframe, firstbutton, lastbutton);
this.setTabbing(firstbutton, null, editor.getDocument().getWindow());
- this.editor.logMessage('Zoom tool initialized');
+ this.editor.logMessage(_('Zoom tool initialized'));
};
};
-KupuZoomTool.prototype = new KupuStateButton;
+KupuZoomTool.prototype = new KupuLateFocusStateButton;
KupuZoomTool.prototype.baseinitialize = KupuZoomTool.prototype.initialize;
KupuZoomTool.prototype.onscroll = function() {
@@ -2033,11 +2200,13 @@
}
width = width + 'px';
var offset = iframe.offsetTop;
- if (sourceArea && !offset) offset = sourceArea.offsetTop-1;
- height = height - offset -1/*top border*/ + 'px';
+ if (sourceArea) offset = sourceArea.offsetTop-1;
+ // XXX: TODO: Using wrong values here, figure out why.
+ var nheight = Math.max(height - offset -1/*top border*/, 10);
+ nheight = nheight + 'px';
fulleditor.style.width = width; /*IE needs this*/
iframe.style.width = width;
- iframe.style.height = height;
+ iframe.style.height = nheight;
if (sourceArea) {
sourceArea.style.width = width;
sourceArea.style.height = height;
@@ -2050,7 +2219,7 @@
KupuZoomTool.prototype.commandfunc = function(button, editor) {
/* Toggle zoom state */
- var zoom = !button.pressed;
+ var zoom = button.pressed;
this.zoomed = zoom;
var zoomClass = 'kupu-fulleditor-zoomed';
@@ -2062,11 +2231,13 @@
html.style.overflow = 'hidden';
window.scrollTo(0, 0);
editor.setClass(zoomClass);
+ body.className += ' '+zoomClass;
this.onresize();
} else {
html.style.overflow = '';
var fulleditor = iframe.parentNode;
fulleditor.style.width = '';
+ body.className = body.className.replace(' '+zoomClass, '');
editor.clearClass(zoomClass);
iframe.style.width = '';
@@ -2084,5 +2255,5 @@
doc.designMode=doc.designMode;
window.scrollTo(0, iframe.offsetTop);
- editor.getDocument().getWindow().focus();
+ editor.focusDocument();
}
Added: myfaces/tomahawk/trunk/src/java/org/apache/myfaces/custom/inputHtml/resource/kupubeforeunload.js
URL: http://svn.apache.org/viewcvs/myfaces/tomahawk/trunk/src/java/org/apache/myfaces/custom/inputHtml/resource/kupubeforeunload.js?rev=233117&view=auto
==============================================================================
--- myfaces/tomahawk/trunk/src/java/org/apache/myfaces/custom/inputHtml/resource/kupubeforeunload.js (added)
+++ myfaces/tomahawk/trunk/src/java/org/apache/myfaces/custom/inputHtml/resource/kupubeforeunload.js Tue Aug 16 21:02:45 2005
@@ -0,0 +1,156 @@
+/* BeforeUnload form processing */
+if (!window.beforeunload) (function() {
+ var BeforeUnloadHandler = function() {
+ var self = this;
+
+ this.message = "Your form has not been saved. All changes you have made will be lost";
+ if (window._) {
+ this.message = _("Your form has not been saved. All changes you have made will be lost");
+ };
+ this.forms = [];
+ this.chkId = [];
+ this.chkType = new this.CheckType();
+ this.handlers = [this.isAnyFormChanged];
+ this.submitting = false;
+
+ this.execute = function(event) {
+ if (self.submitting) return;
+ if (!event) event = window.event;
+
+ for (var i = 0; i < self.handlers.length; i++) {
+ var fn = self.handlers[i];
+ var message = message || fn.apply(self);
+ }
+ if (message===true) message = self.message;
+ if (message===false) message = undefined;
+ if (event) event.returnValue = message;
+ return message;
+ }
+ this.execute.tool = this;
+ }
+ var Class = BeforeUnloadHandler.prototype;
+
+ // form checking code
+ Class.isAnyFormChanged = function() {
+ for (var i=0; i < this.forms.length; i++) {
+ var form = this.forms[i];
+ if (this.isElementChanged(form)) {
+ return true;
+ }
+ }
+ return false;
+ }
+ Class.addHandler = function(fn) {
+ this.handlers.push(fn);
+ }
+ Class.onsubmit = function() {
+ var tool = window.onbeforeunload && window.onbeforeunload.tool;
+ tool.submitting = true;
+ }
+ Class.addForm = function(form) {
+ for (var i = 0; i < this.forms.length; i++) {
+ if (this.forms[i]==form) return;
+ }
+ this.forms.push(form);
+ form.onsubmit = this.onsubmit;
+ var elements = form.getElementsByTagName('input');
+ for (var j = 0; j < elements.length; j++) {
+ var ele = elements[j];
+ if (ele.type=='hidden') {
+ ele.setAttribute('originalValue', ele.defaultValue);
+ }
+ }
+ }
+ Class.addForms = function() {
+ for (var i = 0; i < arguments.length; i++) {
+ var element = arguments[i];
+ if (!element) continue;
+ if (element.tagName=='FORM') {
+ this.addForm(element);
+ }
+ else {
+ var forms = element.getElementsByTagName('form');
+ for (var j = 0; j < forms.length; j++) {
+ this.addForm(forms[j]);
+ }
+ }
+ }
+ }
+ Class.removeForms = function() {
+ for (var i = 0; i < arguments.length; i++) {
+ var element = arguments[i];
+ if (!element) continue;
+ if (element.tagName=='FORM') {
+ for (var j = 0; j < arguments.length; j++) {
+ if (this.forms[j] == element) {
+ this.forms.splice(j--, 1);
+ element.onsubmit=null;
+ }
+ }
+ } else {
+ var forms = element.getElementsByTagName('form');
+ for (var j = 0; j < forms.length; j++) {
+ this.removeForms(forms[j]);
+ }
+ }
+ }
+ }
+
+ Class.CheckType = function() {};
+ var c = Class.CheckType.prototype;
+ c.checkbox = c.radio = function(ele) {
+ return ele.checked != ele.defaultChecked;
+ }
+ c.password = c.textarea = c.text = function(ele) {
+ return ele.value != ele.defaultValue;
+ }
+ // hidden: cannot tell on Mozilla without special treatment
+ c.hidden = function(ele) {
+ var orig = ele.getAttribute("originalValue");
+ return orig && (ele.value != orig);
+ }
+
+ c['select-one'] = function(ele) {
+ for (var i=0 ; i < ele.length; i++) {
+ var opt = ele.options[i];
+ if ( opt.selected != opt.defaultSelected) {
+ if (i===0 && opt.selected) continue; /* maybe no default */
+ return true;
+ }
+ }
+ return false;
+ }
+
+ c['select-multiple'] = function(ele) {
+ for (var i=0 ; i < ele.length; i++) {
+ var opt = ele.options[i];
+ if ( opt.selected != opt.defaultSelected) {
+ return true;
+ }
+ }
+ return false;
+ }
+
+ Class.chk_form = function(form) {
+ var elements = form.elements;
+ for (var i=0; i < elements.length; i++ ) {
+ var element = elements[i];
+ if (this.isElementChanged(element)) {
+ return true;
+ }
+ }
+ return false;
+ }
+
+ Class.isElementChanged = function(ele) {
+ var method = ele.id && this.chkId[ele.id];
+ if (!method && ele.type && ele.name)
+ method = this.chkType[ele.type];
+ if (!method && ele.tagName)
+ method = this['chk_'+ele.tagName.toLowerCase()];
+
+ return method? method.apply(this, [ele]) : false;
+ };
+
+ window.onbeforeunload = new BeforeUnloadHandler().execute;
+})();
Propchange: myfaces/tomahawk/trunk/src/java/org/apache/myfaces/custom/inputHtml/resource/kupubeforeunload.js
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: myfaces/tomahawk/trunk/src/java/org/apache/myfaces/custom/inputHtml/resource/kupubeforeunload.js
------------------------------------------------------------------------------
svn:keywords = "Id Author LastChangedDate LastChangedBy LastChangedRevision"
Propchange: myfaces/tomahawk/trunk/src/java/org/apache/myfaces/custom/inputHtml/resource/kupubeforeunload.js
------------------------------------------------------------------------------
svn:mime-type = text/plain
Added: myfaces/tomahawk/trunk/src/java/org/apache/myfaces/custom/inputHtml/resource/kupucnftable.js
URL: http://svn.apache.org/viewcvs/myfaces/tomahawk/trunk/src/java/org/apache/myfaces/custom/inputHtml/resource/kupucnftable.js?rev=233117&view=auto
==============================================================================
--- myfaces/tomahawk/trunk/src/java/org/apache/myfaces/custom/inputHtml/resource/kupucnftable.js (added)
+++ myfaces/tomahawk/trunk/src/java/org/apache/myfaces/custom/inputHtml/resource/kupucnftable.js Tue Aug 16 21:02:45 2005
@@ -0,0 +1,135 @@
+/*****************************************************************************
+ *
+ * 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: kupubasetools.js 6120 2004-08-22 23:23:42Z roku $
+
+TableTool.prototype.setTableRowRepeat = function() {
+ var selNode = this.editor.getSelectedNode();
+ var row = this.editor.getNearestParentOfType(selNode, 'tr');
+ if (!row) {
+ this.editor.logMessage(_('Not inside a row!'), 1);
+ return;
+ };
+ row.setAttribute('repeatable', 'repeatable');
+ row.className = 'repeatable';
+ this.editor.logMessage(_('Row repeated'));
+ this.updateState(selNode);
+};
+
+TableTool.prototype.delTableRowRepeat = function() {
+ var selNode = this.editor.getSelectedNode();
+ var row = this.editor.getNearestParentOfType(selNode, 'tr');
+ if (!row) {
+ this.editor.logMessage(_('Not inside a row!'), 1);
+ return;
+ };
+ row.removeAttribute('repeatable');
+ row.className = '';
+ row.removeAttribute('class');
+ this.editor.logMessage(_('Row repeat turned off'));
+ this.updateState(selNode);
+};
+
+function CNFTableToolBox(addtabledivid, edittabledivid, newrowsinputid,
+ newcolsinputid, makeheaderinputid, classselectid, alignselectid, addtablebuttonid,
+ addrowbuttonid, delrowbuttonid, setrowrepeatbuttonid, delrowrepeatbuttonid,
+ addcolbuttonid, delcolbuttonid, fixbuttonid,
+ fixallbuttonid, toolboxid, plainclass, activeclass) {
+
+ this.addtablediv = getFromSelector(addtabledivid);
+ this.edittablediv = getFromSelector(edittabledivid);
+ this.newrowsinput = getFromSelector(newrowsinputid);
+ this.newcolsinput = getFromSelector(newcolsinputid);
+ this.makeheaderinput = getFromSelector(makeheaderinputid);
+ this.classselect = getFromSelector(classselectid);
+ this.alignselect = getFromSelector(alignselectid);
+ this.addtablebutton = getFromSelector(addtablebuttonid);
+ this.addrowbutton = getFromSelector(addrowbuttonid);
+ this.delrowbutton = getFromSelector(delrowbuttonid);
+ this.setrowrepeatbutton = getFromSelector(setrowrepeatbuttonid);
+ this.delrowrepeatbutton = getFromSelector(delrowrepeatbuttonid);
+ this.addcolbutton = getFromSelector(addcolbuttonid);
+ this.delcolbutton = getFromSelector(delcolbuttonid);
+ this.fixbutton = getFromSelector(fixbuttonid);
+ this.fixallbutton = getFromSelector(fixallbuttonid);
+ this.toolboxel = getFromSelector(toolboxid);
+ this.plainclass = plainclass;
+ this.activeclass = activeclass;
+
+ this.initialize = function(tool, editor) {
+ /* attach the event handlers */
+ this.tool = tool;
+ this.editor = editor;
+ // build the select list of table classes if configured
+ if (this.editor.config.table_classes) {
+ var classes = this.editor.config.table_classes['class'];
+ while (this.classselect.hasChildNodes()) {
+ this.classselect.removeChild(this.classselect.firstChild);
+ };
+ for (var i=0; i < classes.length; i++) {
+ var classname = classes[i];
+ var option = document.createElement('option');
+ var content = document.createTextNode(classname);
+ option.appendChild(content);
+ option.setAttribute('value', classname);
+ this.classselect.appendChild(option);
+ };
+ };
+ addEventHandler(this.addtablebutton, "click", this.addTable, this);
+ addEventHandler(this.addrowbutton, "click", this.tool.addTableRow, this.tool);
+ addEventHandler(this.delrowbutton, "click", this.tool.delTableRow, this.tool);
+ addEventHandler(this.setrowrepeatbutton, "click", this.tool.setTableRowRepeat, this.tool);
+ addEventHandler(this.delrowrepeatbutton, "click", this.tool.delTableRowRepeat, this.tool);
+ addEventHandler(this.addcolbutton, "click", this.tool.addTableColumn, this.tool);
+ addEventHandler(this.delcolbutton, "click", this.tool.delTableColumn, this.tool);
+ addEventHandler(this.alignselect, "change", this.setColumnAlign, this);
+ addEventHandler(this.classselect, "change", this.setTableClass, this);
+ addEventHandler(this.fixbutton, "click", this.tool.fixTable, this.tool);
+ addEventHandler(this.fixallbutton, "click", this.tool.fixAllTables, this.tool);
+ this.addtablediv.style.display = "block";
+ this.edittablediv.style.display = "none";
+ this.editor.logMessage(_('Table tool initialized'));
+ };
+
+ this.updateState = function(selNode) {
+ /* update the state (add/edit) and update the pulldowns (if required) */
+ var table = this.editor.getNearestParentOfType(selNode, 'table');
+ if (table) {
+ this.addtablediv.style.display = "none";
+ this.edittablediv.style.display = "block";
+
+ var align = this.tool._getColumnAlign(selNode);
+ selectSelectItem(this.alignselect, align);
+ selectSelectItem(this.classselect, table.className);
+ if (this.toolboxel) {
+ this.toolboxel.className = this.activeclass;
+ };
+ var row = this.editor.getNearestParentOfType(selNode, 'tr');
+ var isRepeatable = row.getAttribute('repeatable');
+ if (isRepeatable) {
+ this.setrowrepeatbutton.style.display = 'none';
+ this.delrowrepeatbutton.style.display = 'inline';
+ } else {
+ this.setrowrepeatbutton.style.display = 'inline';
+ this.delrowrepeatbutton.style.display = 'none';
+ };
+ } else {
+ this.edittablediv.style.display = "none";
+ this.addtablediv.style.display = "block";
+ this.alignselect.selectedIndex = 0;
+ this.classselect.selectedIndex = 0;
+ if (this.toolboxel) {
+ this.toolboxel.className = this.plainclass;
+ };
+ };
+ };
+};
+
+CNFTableToolBox.prototype = new TableToolBox;
Propchange: myfaces/tomahawk/trunk/src/java/org/apache/myfaces/custom/inputHtml/resource/kupucnftable.js
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: myfaces/tomahawk/trunk/src/java/org/apache/myfaces/custom/inputHtml/resource/kupucnftable.js
------------------------------------------------------------------------------
svn:keywords = "Id Author LastChangedDate LastChangedBy LastChangedRevision"
Propchange: myfaces/tomahawk/trunk/src/java/org/apache/myfaces/custom/inputHtml/resource/kupucnftable.js
------------------------------------------------------------------------------
svn:mime-type = text/plain
Modified: myfaces/tomahawk/trunk/src/java/org/apache/myfaces/custom/inputHtml/resource/kupucontentfilters.js
URL: http://svn.apache.org/viewcvs/myfaces/tomahawk/trunk/src/java/org/apache/myfaces/custom/inputHtml/resource/kupucontentfilters.js?rev=233117&r1=233116&r2=233117&view=diff
==============================================================================
--- myfaces/tomahawk/trunk/src/java/org/apache/myfaces/custom/inputHtml/resource/kupucontentfilters.js (original)
+++ myfaces/tomahawk/trunk/src/java/org/apache/myfaces/custom/inputHtml/resource/kupucontentfilters.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
@@ -471,7 +471,7 @@
xhtmlnode.setAttribute(attr.name, attr.value);
};
};
- }
+ };
if (editor.getBrowserName()=="IE") {
this['class'] = function(name, htmlnode, xhtmlnode) {
var val = htmlnode.className;
@@ -501,11 +501,12 @@
for (var i = styles.length; i >= 0; i--) if (styles[i]) {
var parts = /^([^:]+): *(.*)$/.exec(styles[i]);
var name = parts[1].toLowerCase();
- if (validation.styleWhitelist[name]) {
+ // myFaces : Remove this right now as the white list is really too small
+ //if (validation.styleWhitelist[name]) {
styles[i] = name+': '+parts[2];
- } else {
- styles.splice(i,1); // delete
- }
+ //} else {
+ // styles.splice(i,1); // delete
+ //}
}
if (styles[styles.length-1]) styles.push('');
val = styles.join('; ').strip();
@@ -584,9 +585,6 @@
}
var kids = htmlnode.childNodes;
- if (kids && /base|meta|link|hr|param|img|area|input|br|basefont|isindex|col/.exec(nodename)) {
- kids = []; // IE bug: base can think it has children
- }
var permittedChildren = this.States[parentnode.tagName] || permitted;
if (kids.length == 0) {
@@ -599,6 +597,15 @@
} else {
for (var i = 0; i < kids.length; i++) {
var kid = kids[i];
+
+ if (kid.parentNode !== htmlnode) {
+ if (kid.tagName == 'BODY') {
+ if (nodename != 'html') continue;
+ } else if (kid.parentNode.tagName === htmlnode.tagName) {
+ continue; // IE bug: nodes appear multiple places
+ }
+ }
+
if (kid.nodeType == 1) {
var newkid = this._convertNodes(ownerdoc, kid, parentnode, permittedChildren);
if (newkid != null) {
Added: myfaces/tomahawk/trunk/src/java/org/apache/myfaces/custom/inputHtml/resource/kupucontentstyles.css
URL: http://svn.apache.org/viewcvs/myfaces/tomahawk/trunk/src/java/org/apache/myfaces/custom/inputHtml/resource/kupucontentstyles.css?rev=233117&view=auto
==============================================================================
--- myfaces/tomahawk/trunk/src/java/org/apache/myfaces/custom/inputHtml/resource/kupucontentstyles.css (added)
+++ myfaces/tomahawk/trunk/src/java/org/apache/myfaces/custom/inputHtml/resource/kupucontentstyles.css Tue Aug 16 21:02:45 2005
@@ -0,0 +1,98 @@
+/*****************************************************************************
+ *
+ * Kupu content styles
+ *
+ * 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
+ * designs, but give credit where credit is due.
+ *
+ *****************************************************************************/
+
+/* $Id: kupucontentstyles.css 9984 2005-03-21 14:29:21Z yuppie $ */
+
+/* this is an example CSS that defines styles for all classes set by kupu. of
+ course customizations can include completely different styles, and also for
+ different elements (changeable or not) */
+
+.image-left {
+ float: left;
+ clear: both;
+}
+
+.image-inline {
+ float: none;
+}
+
+.image-right {
+ float: right;
+ clear: both;
+}
+
+table {
+ border-width: 0px;
+ padding: 3px;
+}
+
+table.plain td {
+ border-width: 1px;
+ border-style: solid;
+ border-color: black;
+}
+
+table.listing {
+ border-width: 0px;
+}
+
+table.listing td {
+ border-style: solid;
+ border-width: 1px;
+ border-color: black;
+}
+
+table.listing th {
+ border-style: solid;
+ border-width: 1px;
+ border-color: black;
+ background-color: gray;
+ color: white;
+}
+
+table.grid {
+ border-width: 0px;
+}
+
+table.grid td {
+ border-style: solid;
+ border-width: 1px;
+ border-color: black;
+}
+
+table.grid th {
+ border-style: solid;
+ border-width: 1px;
+ border-color: black;
+}
+
+table.data {
+ border-style: solid;
+ border-width: 1px;
+ border-color: black;
+}
+
+table.data td {
+ border-style: solid;
+ border-width: 1px;
+ border-color: gray;
+}
+
+table.data th {
+ border-style: solid;
+ border-width: 1px;
+ border-color: gray;
+}
+
+.repeatable {
+ background-color: pink;
+}
Modified: myfaces/tomahawk/trunk/src/java/org/apache/myfaces/custom/inputHtml/resource/kupucontextmenu.js
URL: http://svn.apache.org/viewcvs/myfaces/tomahawk/trunk/src/java/org/apache/myfaces/custom/inputHtml/resource/kupucontextmenu.js?rev=233117&r1=233116&r2=233117&view=diff
==============================================================================
--- myfaces/tomahawk/trunk/src/java/org/apache/myfaces/custom/inputHtml/resource/kupucontextmenu.js (original)
+++ myfaces/tomahawk/trunk/src/java/org/apache/myfaces/custom/inputHtml/resource/kupucontextmenu.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
@@ -107,36 +107,22 @@
};
// now move the menu to the right position
var iframe = this.editor.getDocument().getEditable();
- var left = 0;
- var top = 0;
+ var left = event.clientX;
+ var top = event.clientY;
+ var currnode = iframe;
if (this.editor.getBrowserName() == 'IE') {
- var orgnode = event.srcElement;
- left = event.clientX;
- top = event.clientY;
- var currnode = iframe;
while (currnode) {
left += currnode.offsetLeft + currnode.clientLeft;
top += currnode.offsetTop + currnode.clientTop;
currnode = currnode.offsetParent;
};
} else {
- left = event.pageX;
- top = event.pageY;
- var body = this.editor.getInnerDocument().body;
- left -= body.scrollLeft;
- top -= body.scrollTop;
- var node = iframe;
- while (node) {
- left += node.offsetLeft;
- top += node.offsetTop;
- node = node.offsetParent;
- }
- };
- //var clienttop = event.clientY;
- /*if (clienttop > (parseInt(this.editor.getDocument().getWindow().innerHeight) -
- (parseInt(menu.style.lineHeight) * elements.length))) {
- top -= parseInt(menu.style.lineHeight) * elements.length;
- };*/
+ while (currnode) {
+ left += currnode.offsetLeft;
+ top += currnode.offsetTop;
+ currnode = currnode.offsetParent;
+ };
+ };
menu.style.left = left + 'px';
menu.style.top = top + 'px';
menu.style.visibility = 'visible';