[Phpcms-plugins-cvs] admin4phpCMS/modules/phpcms-content/wysiwyg/tiny_mce/plugins/table table.htm,NO
Brought to you by:
mjahn
Update of /cvsroot/phpcms-plugins/admin4phpCMS/modules/phpcms-content/wysiwyg/tiny_mce/plugins/table In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv19290/modules/phpcms-content/wysiwyg/tiny_mce/plugins/table Added Files: table.htm editor_plugin.js readme.txt row.htm cell.htm editor_plugin_src.js Log Message: beginning of phpcms-content and filemanager --- NEW FILE: editor_plugin_src.js --- /* Import plugin specific language pack */ tinyMCE.importPluginLanguagePack('table', 'en,ar,cs,da,de,el,es,fi,fr_ca,hu,it,ja,ko,nl,no,pl,pt,sv,tw,zh_cn,fr,de'); function TinyMCE_table_initInstance(inst) { if (tinyMCE.isGecko) tinyMCE.addEvent(inst.getDoc(), "mouseup", TinyMCE_table_mouseDownHandler); } function TinyMCE_table_mouseDownHandler(e) { var elm = tinyMCE.isMSIE ? event.srcElement : e.target; var focusElm = tinyMCE.selectedInstance.getFocusElement(); // If press on special Mozilla create TD/TR thingie if (elm.nodeName == "BODY" && (focusElm.nodeName == "TD" || (focusElm.parentNode && focusElm.parentNode.nodeName == "TD"))) { window.setTimeout(function() { var tableElm = tinyMCE.getParentElement(focusElm, "table"); tinyMCE.handleVisualAid(tableElm, true, tinyMCE.settings['visual']); }, 10); } } /** * Returns the HTML contents of the table control. */ function TinyMCE_table_getControlHTML(control_name) { var controls = new Array( ['table', 'table.gif', '{$lang_table_desc}', 'mceInsertTable', true], ['delete_col', 'table_delete_col.gif', '{$lang_table_delete_col_desc}', 'mceTableDeleteCol'], ['delete_row', 'table_delete_row.gif', '{$lang_table_delete_row_desc}', 'mceTableDeleteRow'], ['col_after', 'table_insert_col_after.gif', '{$lang_table_insert_col_after_desc}', 'mceTableInsertColAfter'], ['col_before', 'table_insert_col_before.gif', '{$lang_table_insert_col_before_desc}', 'mceTableInsertColBefore'], ['row_after', 'table_insert_row_after.gif', '{$lang_table_insert_row_after_desc}', 'mceTableInsertRowAfter'], ['row_before', 'table_insert_row_before.gif', '{$lang_table_insert_row_before_desc}', 'mceTableInsertRowBefore'], ['row_props', 'table_row_props.gif', '{$lang_table_row_desc}', 'mceTableRowProps', true], ['cell_props', 'table_cell_props.gif', '{$lang_table_cell_desc}', 'mceTableCellProps', true]); // Render table control for (var i=0; i<controls.length; i++) { var but = controls[i]; if (but[0] == control_name && (tinyMCE.isMSIE || !tinyMCE.settings['button_tile_map'])) return '<img id="{$editor_id}_' + but[0] + '" src="{$pluginurl}/images/' + but[1] + '" title="' + but[2] + '" width="20" height="20" class="mceButtonDisabled" onmouseover="tinyMCE.switchClass(this,\'mceButtonOver\');" onmouseout="tinyMCE.restoreClass(this);" onmousedown="tinyMCE.restoreAndSwitchClass(this,\'mceButtonDown\');" onclick="tinyMCE.execInstanceCommand(\'{$editor_id}\',\'' + but[3] + '\', ' + (but.length > 4 ? but[4] : false) + (but.length > 5 ? ', \'' + but[5] + '\'' : '') + ')">'; else if (but[0] == control_name) return '<img id="{$editor_id}_' + but[0] + '" src="{$themeurl}/images/spacer.gif" style="background-image:url({$pluginurl}/images/buttons.gif); background-position: ' + (0-(i*20)) + 'px 0px" title="' + but[2] + '" width="20" height="20" class="mceButtonDisabled" onmouseover="tinyMCE.switchClass(this,\'mceButtonOver\');" onmouseout="tinyMCE.restoreClass(this);" onmousedown="tinyMCE.restoreAndSwitchClass(this,\'mceButtonDown\');" onclick="tinyMCE.execInstanceCommand(\'{$editor_id}\',\'' + but[3] + '\', ' + (but.length > 4 ? but[4] : false) + (but.length > 5 ? ', \'' + but[5] + '\'' : '') + ')">'; } // Special tablecontrols if (control_name == "tablecontrols") { var html = ""; html += tinyMCE.getControlHTML("table"); html += tinyMCE.getControlHTML("separator"); html += tinyMCE.getControlHTML("row_props"); html += tinyMCE.getControlHTML("cell_props"); html += tinyMCE.getControlHTML("separator"); html += tinyMCE.getControlHTML("row_before"); html += tinyMCE.getControlHTML("row_after"); html += tinyMCE.getControlHTML("delete_row"); html += tinyMCE.getControlHTML("separator"); html += tinyMCE.getControlHTML("col_before"); html += tinyMCE.getControlHTML("col_after"); html += tinyMCE.getControlHTML("delete_col"); return html; } return ""; } /** * Executes the table commands. */ function TinyMCE_table_execCommand(editor_id, element, command, user_interface, value) { function getAttrib(elm, name) { return elm.getAttribute(name) ? elm.getAttribute(name) : ""; } var inst = tinyMCE.getInstanceById(editor_id); var focusElm = inst.getFocusElement(); var tdElm = tinyMCE.getParentElement(focusElm, "td"); var trElm = tinyMCE.getParentElement(focusElm, "tr"); // Handle commands switch (command) { case "mceTableRowProps": if (trElm == null) return true; if (user_interface) { // Setup template var template = new Array(); template['file'] = '../../plugins/table/row.htm'; if (tinyMCE.settings['table_color_fields']) { template['width'] = 400; template['height'] = 220; } else { template['width'] = 340; template['height'] = 220; } // Open window tinyMCE.openWindow(template, {editor_id : inst.editorId, align : getAttrib(trElm, 'align'), valign : getAttrib(trElm, 'valign'), height : getAttrib(trElm, 'height'), className : getAttrib(trElm, 'className'), bordercolor : getAttrib(trElm, 'bordercolor'), bgcolor : getAttrib(trElm, 'bgcolor')}); } else { trElm.setAttribute('align', value['align']); trElm.setAttribute('vAlign', value['valign']); trElm.setAttribute('height', value['height']); trElm.setAttribute('bordercolor', value['bordercolor']); trElm.setAttribute('bgcolor', value['bgcolor']); trElm.setAttribute('class', value['className']); trElm.setAttribute('className', value['className']); trElm.borderColor = value['bordercolor']; trElm.bgColor = value['bgcolor']; } return true; case "mceTableCellProps": if (tdElm == null) return true; if (user_interface) { // Setup template var template = new Array(); template['file'] = '../../plugins/table/cell.htm'; if (tinyMCE.settings['table_color_fields']) { template['width'] = 400; template['height'] = 240; } else { template['width'] = 340; template['height'] = 220; } // Open window tinyMCE.openWindow(template, {editor_id : inst.editorId, align : getAttrib(tdElm, 'align'), valign : getAttrib(tdElm, 'valign'), width : getAttrib(tdElm, 'width'), height : getAttrib(tdElm, 'height'), className : getAttrib(tdElm, 'className'), bordercolor : getAttrib(tdElm, 'bordercolor'), bgcolor : getAttrib(tdElm, 'bgcolor')}); } else { tdElm.setAttribute('align', value['align']); tdElm.setAttribute('vAlign', value['valign']); tdElm.setAttribute('width', value['width']); tdElm.setAttribute('height', value['height']); tdElm.setAttribute('bordercolor', value['bordercolor']); tdElm.setAttribute('bgcolor', value['bgcolor']); tdElm.setAttribute('class', value['className']); tdElm.setAttribute('className', value['className']); tdElm.borderColor = value['bordercolor']; tdElm.bgColor = value['bgcolor']; } return true; case "mceInsertTable": if (user_interface) { var cols = 2, rows = 2, border = 0, cellpadding = "", cellspacing = "", align = "", width = "", height = "", bordercolor = "", bgcolor = "", action = "insert", className = ""; tinyMCE.tableElement = tinyMCE.getParentElement(inst.getFocusElement(), "table"); if (tinyMCE.tableElement) { var rowsAr = tinyMCE.tableElement.rows; var cols = 0; for (var i=0; i<rowsAr.length; i++) if (rowsAr[i].cells.length > cols) cols = rowsAr[i].cells.length; cols = cols; rows = rowsAr.length; border = tinyMCE.getAttrib(tinyMCE.tableElement, 'border', border); cellpadding = tinyMCE.getAttrib(tinyMCE.tableElement, 'cellpadding', ""); cellspacing = tinyMCE.getAttrib(tinyMCE.tableElement, 'cellspacing', ""); width = tinyMCE.getAttrib(tinyMCE.tableElement, 'width', width); height = tinyMCE.getAttrib(tinyMCE.tableElement, 'height', height); bordercolor = tinyMCE.getAttrib(tinyMCE.tableElement, 'bordercolor', bordercolor); bgcolor = tinyMCE.getAttrib(tinyMCE.tableElement, 'bgcolor', bgcolor); align = tinyMCE.getAttrib(tinyMCE.tableElement, 'align', align); className = tinyMCE.getAttrib(tinyMCE.tableElement, tinyMCE.isMSIE ? 'className' : "class", ""); if (tinyMCE.isMSIE) { width = tinyMCE.tableElement.style.pixelWidth == 0 ? tinyMCE.tableElement.getAttribute("width") : tinyMCE.tableElement.style.pixelWidth; height = tinyMCE.tableElement.style.pixelHeight == 0 ? tinyMCE.tableElement.getAttribute("height") : tinyMCE.tableElement.style.pixelHeight; } action = "update"; } // Setup template var template = new Array(); template['file'] = '../../plugins/table/table.htm'; if (tinyMCE.settings['table_color_fields']) { template['width'] = 400; template['height'] = 240; } else { template['width'] = 340; template['height'] = 220; } // Language specific width and height addons template['width'] += tinyMCE.getLang('lang_insert_table_delta_width', 0); template['height'] += tinyMCE.getLang('lang_insert_table_delta_height', 0); // Open window tinyMCE.openWindow(template, {editor_id : inst.editorId, cols : cols, rows : rows, border : border, cellpadding : cellpadding, cellspacing : cellspacing, align : align, width : width, height : height, bordercolor : bordercolor, bgcolor : bgcolor, action : action, className : className}); } else { var html = ''; var cols = 2, rows = 2, border = 0, cellpadding = -1, cellspacing = -1, align, width, height, className; if (typeof(value) == 'object') { cols = value['cols']; rows = value['rows']; border = value['border'] != "" ? value['border'] : 0; cellpadding = value['cellpadding'] != "" ? value['cellpadding'] : -1; cellspacing = value['cellspacing'] != "" ? value['cellspacing'] : -1; align = value['align']; width = value['width']; height = value['height']; bordercolor = value['bordercolor']; bgcolor = value['bgcolor']; className = value['className']; } // Update table if (tinyMCE.tableElement) { tinyMCE.setAttrib(tinyMCE.tableElement, 'cellPadding', cellpadding); tinyMCE.setAttrib(tinyMCE.tableElement, 'cellSpacing', cellspacing); tinyMCE.setAttrib(tinyMCE.tableElement, 'border', border); tinyMCE.setAttrib(tinyMCE.tableElement, 'width', width); tinyMCE.setAttrib(tinyMCE.tableElement, 'height', height); tinyMCE.setAttrib(tinyMCE.tableElement, 'bordercolor', bordercolor, true); tinyMCE.setAttrib(tinyMCE.tableElement, 'bgcolor', bgcolor, true); tinyMCE.setAttrib(tinyMCE.tableElement, 'align', align, true); tinyMCE.setAttrib(tinyMCE.tableElement, tinyMCE.isMSIE ? 'className' : "class", className, true); if (tinyMCE.isMSIE) { tinyMCE.tableElement.style.pixelWidth = (width == null || width == "") ? 0 : width; tinyMCE.tableElement.style.pixelHeight = (height == null || height == "") ? 0 : height; tinyMCE.tableElement.borderColor = bordercolor; tinyMCE.tableElement.bgColor = bgcolor; } tinyMCE.handleVisualAid(tinyMCE.tableElement, false, inst.visualAid); // Fix for stange MSIE align bug tinyMCE.tableElement.outerHTML = tinyMCE.tableElement.outerHTML; //inst.contentWindow.dispatchEvent(createEvent("click")); tinyMCE.triggerNodeChange(); return true; } // Create new table html += '<table border="' + border + '" '; var visualAidStyle = inst.visualAid ? tinyMCE.settings['visual_table_style'] : ""; if (cellpadding != -1) html += 'cellpadding="' + cellpadding + '" '; if (cellspacing != -1) html += 'cellspacing="' + cellspacing + '" '; if (width != 0 && width != "") html += 'width="' + width + '" '; if (height != 0 && height != "") html += 'height="' + height + '" '; if (bordercolor != 0 && bordercolor != "") html += 'bordercolor="' + bordercolor + '" '; if (bgcolor != 0 && bgcolor != "") html += 'bgcolor="' + bgcolor + '" '; if (align) html += 'align="' + align + '" '; if (className) html += 'class="' + className + '" '; if (border == 0 && tinyMCE.settings['visual']) html += 'style="' + visualAidStyle + '" '; html += '>'; for (var y=0; y<rows; y++) { html += "<tr>"; for (var x=0; x<cols; x++) { if (border == 0 && tinyMCE.settings['visual']) html += '<td style="' + visualAidStyle + '">'; else html += '<td>'; html += " </td>"; } html += "</tr>"; } html += "</table>"; inst.execCommand('mceInsertContent', false, html); } return true; case "mceTableInsertRowBefore": case "mceTableInsertRowAfter": case "mceTableDeleteRow": case "mceTableInsertColBefore": case "mceTableInsertColAfter": case "mceTableDeleteCol": var trElement = tinyMCE.getParentElement(inst.getFocusElement(), "tr"); var tdElement = tinyMCE.getParentElement(inst.getFocusElement(), "td"); var tableElement = tinyMCE.getParentElement(inst.getFocusElement(), "table"); // No table just return (invalid command) if (!tableElement) return true; var doc = inst.contentWindow.document; var tableBorder = tableElement.getAttribute("border"); var visualAidStyle = inst.visualAid ? tinyMCE.settings['visual_table_style'] : ""; // Table has a tbody use that reference if (tableElement.firstChild && tableElement.firstChild.nodeName.toLowerCase() == "tbody") tableElement = tableElement.firstChild; if (tableElement && trElement) { switch (command) { case "mceTableInsertRowBefore": var numcells = trElement.cells.length; var rowCount = 0; var tmpTR = trElement; // Count rows while (tmpTR) { if (tmpTR.nodeName.toLowerCase() == "tr") rowCount++; tmpTR = tmpTR.previousSibling; } var r = tableElement.insertRow(rowCount == 0 ? 1 : rowCount-1); for (var i=0; i<numcells; i++) { var newTD = doc.createElement("td"); newTD.innerHTML = " "; if (tableBorder == 0) newTD.style.cssText = visualAidStyle; var c = r.appendChild(newTD); if (tdElement.parentNode.childNodes[i].colSpan) c.colSpan = tdElement.parentNode.childNodes[i].colSpan; } break; case "mceTableInsertRowAfter": var numcells = trElement.cells.length; var rowCount = 0; var tmpTR = trElement; var doc = inst.contentWindow.document; // Count rows while (tmpTR) { if (tmpTR.nodeName.toLowerCase() == "tr") rowCount++; tmpTR = tmpTR.previousSibling; } var r = tableElement.insertRow(rowCount == 0 ? 1 : rowCount); for (var i=0; i<numcells; i++) { var newTD = doc.createElement("td"); newTD.innerHTML = " "; if (tableBorder == 0) newTD.style.cssText = visualAidStyle; var c = r.appendChild(newTD); if (tdElement.parentNode.childNodes[i].colSpan) c.colSpan = tdElement.parentNode.childNodes[i].colSpan; } break; case "mceTableDeleteRow": // Remove whole table if (tableElement.rows.length <= 1) { tableElement.parentNode.removeChild(tableElement); tinyMCE.triggerNodeChange(); return true; } var selElm = inst.contentWindow.document.body; if (trElement.previousSibling) selElm = trElement.previousSibling.cells[0]; // Delete row trElement.parentNode.removeChild(trElement); if (tinyMCE.isGecko) inst.selectNode(selElm); break; case "mceTableInsertColBefore": var cellCount = tdElement.cellIndex; // Add columns for (var y=0; y<tableElement.rows.length; y++) { var cell = tableElement.rows[y].cells[cellCount]; // Can't add cell after cell that doesn't exist if (!cell) break; var newTD = doc.createElement("td"); newTD.innerHTML = " "; if (tableBorder == 0) newTD.style.cssText = visualAidStyle; cell.parentNode.insertBefore(newTD, cell); } break; case "mceTableInsertColAfter": var cellCount = tdElement.cellIndex; // Add columns for (var y=0; y<tableElement.rows.length; y++) { var append = false; var cell = tableElement.rows[y].cells[cellCount]; if (cellCount == tableElement.rows[y].cells.length-1) append = true; else cell = tableElement.rows[y].cells[cellCount+1]; var newTD = doc.createElement("td"); newTD.innerHTML = " "; if (tableBorder == 0) newTD.style.cssText = visualAidStyle; if (append) cell.parentNode.appendChild(newTD); else cell.parentNode.insertBefore(newTD, cell); } break; case "mceTableDeleteCol": var index = tdElement.cellIndex; var selElm = inst.contentWindow.document.body; var numCols = 0; for (var y=0; y<tableElement.rows.length; y++) { if (tableElement.rows[y].cells.length > numCols) numCols = tableElement.rows[y].cells.length; } // Remove whole table if (numCols <= 1) { if (tinyMCE.isGecko) inst.selectNode(selElm); tableElement.parentNode.removeChild(tableElement); tinyMCE.triggerNodeChange(); return true; } // Remove columns for (var y=0; y<tableElement.rows.length; y++) { var cell = tableElement.rows[y].cells[index]; if (cell) cell.parentNode.removeChild(cell); } if (index > 0) selElm = tableElement.rows[0].cells[index-1]; if (tinyMCE.isGecko) inst.selectNode(selElm); break; } tinyMCE.triggerNodeChange(); } return true; } // Pass to next handler in chain return false; } function TinyMCE_table_handleNodeChange(editor_id, node, undo_index, undo_levels, visual_aid, any_selection) { // Reset table controls tinyMCE.switchClassSticky(editor_id + '_table', 'mceButtonNormal'); tinyMCE.switchClassSticky(editor_id + '_row_props', 'mceButtonDisabled', true); tinyMCE.switchClassSticky(editor_id + '_cell_props', 'mceButtonDisabled', true); tinyMCE.switchClassSticky(editor_id + '_row_before', 'mceButtonDisabled', true); tinyMCE.switchClassSticky(editor_id + '_row_after', 'mceButtonDisabled', true); tinyMCE.switchClassSticky(editor_id + '_delete_row', 'mceButtonDisabled', true); tinyMCE.switchClassSticky(editor_id + '_col_before', 'mceButtonDisabled', true); tinyMCE.switchClassSticky(editor_id + '_col_after', 'mceButtonDisabled', true); tinyMCE.switchClassSticky(editor_id + '_delete_col', 'mceButtonDisabled', true); // Within a tr element if (tinyMCE.getParentElement(node, "tr")) tinyMCE.switchClassSticky(editor_id + '_row_props', 'mceButtonSelected', false); // Within a td element if (tinyMCE.getParentElement(node, "td")) { tinyMCE.switchClassSticky(editor_id + '_cell_props', 'mceButtonSelected', false); tinyMCE.switchClassSticky(editor_id + '_row_before', 'mceButtonNormal', false); tinyMCE.switchClassSticky(editor_id + '_row_after', 'mceButtonNormal', false); tinyMCE.switchClassSticky(editor_id + '_delete_row', 'mceButtonNormal', false); tinyMCE.switchClassSticky(editor_id + '_col_before', 'mceButtonNormal', false); tinyMCE.switchClassSticky(editor_id + '_col_after', 'mceButtonNormal', false); tinyMCE.switchClassSticky(editor_id + '_delete_col', 'mceButtonNormal', false); } // Within table if (tinyMCE.getParentElement(node, "table")) tinyMCE.switchClassSticky(editor_id + '_table', 'mceButtonSelected'); } --- NEW FILE: table.htm --- <html> <head> <title>{$lang_insert_table_title}</title> <script language="javascript" type="text/javascript" src="../../tiny_mce_popup.js"></script> <script language="javascript" type="text/javascript"> // Disable auto resize tinyMCE.getWindowArg('mce_windowresize', false); function insertTable() { if (window.opener) { var args = new Array(); args["cols"] = document.forms[0].cols.value; args["rows"] = document.forms[0].rows.value; args["border"] = document.forms[0].border.value; args["cellpadding"] = document.forms[0].cellpadding.value; args["cellspacing"] = document.forms[0].cellspacing.value; args["width"] = document.forms[0].width.value; args["height"] = document.forms[0].height.value; args["bordercolor"] = document.forms[0].bordercolor.value; args["bgcolor"] = document.forms[0].bgcolor.value; args["align"] = document.forms[0].align.options[document.forms[0].align.selectedIndex].value; args["className"] = document.forms[0].styleSelect.options[document.forms[0].styleSelect.selectedIndex].value; window.opener.tinyMCE.execCommand("mceInsertTable", false, args); top.close(); } } function init() { if (tinyMCE.settings['table_color_fields']) { document.getElementById('colors').style.display = tinyMCE.isMSIE ? 'block' : 'table-row'; TinyMCEPlugin_onLoad(); // Resize again } for (var i=0; i<document.forms[0].align.options.length; i++) { if (document.forms[0].align.options[i].value == tinyMCE.getWindowArg('align')) document.forms[0].align.options.selectedIndex = i; } var className = tinyMCE.getWindowArg('className'); var styleSelectElm = document.forms[0].styleSelect; var stylesAr = tinyMCE.getParam('theme_advanced_styles', false); if (stylesAr) { stylesAr = stylesAr.split(';'); for (var i=0; i<stylesAr.length; i++) { var key, value; key = stylesAr[i].split('=')[0]; value = stylesAr[i].split('=')[1]; styleSelectElm.options[styleSelectElm.length] = new Option(key, value); if (value == className) styleSelectElm.options.selectedIndex = styleSelectElm.options.length-1; } } else { var csses = tinyMCE.getCSSClasses(tinyMCE.getWindowArg('editor_id')); for (var i=0; i<csses.length; i++) { styleSelectElm.options[styleSelectElm.length] = new Option(csses[i], csses[i]); if (csses[i] == className) styleSelectElm.options.selectedIndex = styleSelectElm.options.length-1; } } if (tinyMCE.getWindowArg('action') == "update") { document.forms[0].cols.disabled = true; document.forms[0].rows.disabled = true; } var formObj = document.forms[0]; formObj.cols.value = tinyMCE.getWindowArg('cols'); formObj.rows.value = tinyMCE.getWindowArg('rows'); formObj.border.value = tinyMCE.getWindowArg('border'); formObj.cellpadding.value = tinyMCE.getWindowArg('cellpadding'); formObj.cellspacing.value = tinyMCE.getWindowArg('cellspacing'); formObj.width.value = tinyMCE.getWindowArg('width'); formObj.height.value = tinyMCE.getWindowArg('height'); formObj.bordercolor.value = tinyMCE.getWindowArg('bordercolor'); formObj.bgcolor.value = tinyMCE.getWindowArg('bgcolor'); formObj.insert.value = tinyMCE.getLang('lang_' + tinyMCE.getWindowArg('action'), 'Insert', true); // Autoresize and focus TinyMCEPopup_autoResize(); window.focus(); } function cancelAction() { top.close(); } </script> </head> <body onload="window.focus();init();"> <form onsubmit="insertTable();return false;"> <table border="0" cellpadding="0" cellspacing="0" width="200"> <tr> <td align="center" valign="middle"><table border="0" cellpadding="4" cellspacing="0"> <tr> <td colspan="4" class="title">{$lang_insert_table_title}</td> </tr> <tr> <td>{$lang_insert_table_cols}:</td> <td><input name="cols" type="text" id="cols" value="" size="3" maxlength="3"></td> <td>{$lang_insert_table_rows}:</td> <td><input name="rows" type="text" id="rows" value="" size="3" maxlength="3"></td> </tr> <tr> <td>{$lang_insert_table_cellpadding}:</td> <td><input name="cellpadding" type="text" id="cellpadding" value="" size="3" maxlength="3"></td> <td>{$lang_insert_table_cellspacing}:</td> <td><input name="cellspacing" type="text" id="cellspacing" value="" size="3" maxlength="3"></td> </tr> <tr> <td>{$lang_insert_table_align}:</td> <td><select name="align"> <option value="">{$lang_insert_table_align_default}</option> <option value="center">{$lang_insert_table_align_middle}</option> <option value="left">{$lang_insert_table_align_left}</option> <option value="right">{$lang_insert_table_align_right}</option> </select></td> <td>{$lang_insert_table_border}:</td> <td><input name="border" type="text" id="border" value="" size="3" maxlength="3"></td> </tr> <tr> <td>{$lang_insert_table_width}:</td> <td><input name="width" type="text" id="width" value="" size="4" maxlength="4"></td> <td>{$lang_insert_table_height}: </td> <td><input name="height" type="text" id="height" value="" size="4" maxlength="4"></td> </tr> <tr id="colors" style="display: none"> <td>{$lang_table_bordercolor}:</td> <td><input name="bordercolor" type="text" id="bordercolor" value="" size="9" maxlength="7"></td> <td>{$lang_table_bgcolor}:</td> <td><input name="bgcolor" type="text" id="bgcolor" value="" size="9" maxlength="7"></td> </tr> <tr> <td>{$lang_insert_table_class}:</td> <td> <select name="styleSelect"> <option value="" selected>-- {$lang_theme_style_select} --</option> </select></td> <td align="right"> </td> <td align="right"> </td> </tr> <tr> <td><input type="button" id="insert" name="insert" value="{$lang_insert}" onclick="insertTable();"></td> <td align="right"> </td> <td align="right"> </td> <td align="right"><input type="button" id="cancel" name="cancel" value="{$lang_cancel}" onclick="cancelAction();"></td> </tr> </table></td> </tr> </table> </form> </body> </html> --- NEW FILE: row.htm --- <html> <head> <title>{$lang_table_row_title}</title> <script language="javascript" type="text/javascript" src="../../tiny_mce_popup.js"></script> <script language="javascript" type="text/javascript"> // Disable auto resize tinyMCE.getWindowArg('mce_windowresize', false); function insertTable() { if (window.opener) { var args = new Array(); args["height"] = document.forms[0].height.value; args["align"] = document.forms[0].align.options[document.forms[0].align.selectedIndex].value; args["valign"] = document.forms[0].valign.options[document.forms[0].valign.selectedIndex].value; args["className"] = document.forms[0].styleSelect.options[document.forms[0].styleSelect.selectedIndex].value; args["bordercolor"] = document.forms[0].bordercolor.value; args["bgcolor"] = document.forms[0].bgcolor.value; window.opener.tinyMCE.execCommand("mceTableRowProps", false, args); top.close(); } } function init() { if (tinyMCE.settings['table_color_fields']) { document.getElementById('colors').style.display = tinyMCE.isMSIE ? 'block' : 'table-row'; TinyMCEPlugin_onLoad(); // Resize again } document.forms[0].bordercolor.value = tinyMCE.getWindowArg('bordercolor'); document.forms[0].bgcolor.value = tinyMCE.getWindowArg('bgcolor'); for (var i=0; i<document.forms[0].align.options.length; i++) { if (document.forms[0].align.options[i].value == tinyMCE.getWindowArg('align')) document.forms[0].align.options.selectedIndex = i; } for (var i=0; i<document.forms[0].valign.options.length; i++) { if (document.forms[0].valign.options[i].value == tinyMCE.getWindowArg('valign')) document.forms[0].valign.options.selectedIndex = i; } var className = tinyMCE.getWindowArg('className'); var styleSelectElm = document.forms[0].styleSelect; var stylesAr = tinyMCE.getParam('theme_advanced_styles', false); if (stylesAr) { stylesAr = stylesAr.split(';'); for (var i=0; i<stylesAr.length; i++) { var key, value; key = stylesAr[i].split('=')[0]; value = stylesAr[i].split('=')[1]; styleSelectElm.options[styleSelectElm.length] = new Option(key, value); if (value == className) styleSelectElm.options.selectedIndex = styleSelectElm.options.length-1; } } else { var csses = tinyMCE.getCSSClasses(tinyMCE.getWindowArg('editor_id')); for (var i=0; i<csses.length; i++) { styleSelectElm.options[styleSelectElm.length] = new Option(csses[i], csses[i]); if (csses[i] == className) styleSelectElm.options.selectedIndex = styleSelectElm.options.length-1; } } var formObj = document.forms[0]; formObj.height.value = tinyMCE.getWindowArg('height'); // Autoresize and focus TinyMCEPopup_autoResize(); window.focus(); } function cancelAction() { top.close(); } </script> </head> <body onload="window.focus();init();"> <form onsubmit="insertTable();return false;"> <table border="0" cellpadding="0" cellspacing="0" width="200"> <tr> <td align="center" valign="middle"><table border="0" cellpadding="4" cellspacing="0"> <tr> <td colspan="4" class="title">{$lang_table_row_title}</td> </tr> <tr> <td>{$lang_insert_table_align}:</td> <td><select name="align"> <option value="">{$lang_insert_table_align_default}</option> <option value="center">{$lang_insert_table_align_middle}</option> <option value="left">{$lang_insert_table_align_left}</option> <option value="right">{$lang_insert_table_align_right}</option> </select></td> <td>{$lang_insert_table_class}:</td> <td><select name="styleSelect"> <option value="" selected="selected">-- {$lang_theme_style_select} --</option> </select></td> </tr> <tr> <td>{$lang_insert_table_valign}:</td> <td><select name="valign"> <option value="">{$lang_insert_table_align_default}</option> <option value="top">{$lang_insert_table_align_top}</option> <option value="middle">{$lang_insert_table_align_middle}</option> <option value="bottom">{$lang_insert_table_align_bottom}</option> </select></td> <td>{$lang_insert_table_height}: </td> <td><input name="height" type="text" id="height" value="" size="4" maxlength="4" /></td> </tr> <tr id="colors" style="display: none"> <td>{$lang_table_bordercolor}:</td> <td><input name="bordercolor" type="text" id="bordercolor" value="" size="9" maxlength="7"></td> <td>{$lang_table_bgcolor}:</td> <td><input name="bgcolor" type="text" id="bgcolor" value="" size="9" maxlength="7"></td> </tr> <tr> <td><input type="button" id="insert" name="insert" value="{$lang_update}" onclick="insertTable();"></td> <td align="right"> </td> <td align="right"> </td> <td align="right"><input type="button" id="cancel" name="cancel" value="{$lang_cancel}" onclick="cancelAction();"></td> </tr> </table></td> </tr> </table> </form> </body> </html> --- NEW FILE: editor_plugin.js --- /* Import plugin specific language pack */ tinyMCE.importPluginLanguagePack('table','en,ar,cs,da,de,el,es,fi,fr_ca,hu,it,ja,ko,nl,no,pl,pt,sv,tw,zh_cn,fr,de');function TinyMCE_table_initInstance(inst){if(tinyMCE.isGecko)tinyMCE.addEvent(inst.getDoc(),"mouseup",TinyMCE_table_mouseDownHandler);}function TinyMCE_table_mouseDownHandler(e){var elm=tinyMCE.isMSIE?event.srcElement:e.target;var focusElm=tinyMCE.selectedInstance.getFocusElement();if(elm.nodeName=="BODY"&&(focusElm.nodeName=="TD"||(focusElm.parentNode&&focusElm.parentNode.nodeName=="TD"))){window.setTimeout(function(){var tableElm=tinyMCE.getParentElement(focusElm,"table");tinyMCE.handleVisualAid(tableElm,true,tinyMCE.settings['visual']);},10);}}function TinyMCE_table_getControlHTML(control_name){var controls=new Array(['table','table.gif','{$lang_table_desc}','mceInsertTable',true],['delete_col','table_delete_col.gif','{$lang_table_delete_col_desc}','mceTableDeleteCol'],['delete_row','table_delete_row.gif','{$lang_table_delete_row_desc}','mceTableDeleteRow'],['col_after','table_insert_col_after.gif','{$lang_table_insert_col_after_desc}','mceTableInsertColAfter'],['col_before','table_insert_col_before.gif','{$lang_table_insert_col_before_desc}','mceTableInsertColBefore'],['row_after','table_insert_row_after.gif','{$lang_table_insert_row_after_desc}','mceTableInsertRowAfter'],['row_before','table_insert_row_before.gif','{$lang_table_insert_row_before_desc}','mceTableInsertRowBefore'],['row_props','table_row_props.gif','{$lang_table_row_desc}','mceTableRowProps',true],['cell_props','table_cell_props.gif','{$lang_table_cell_desc}','mceTableCellProps',true]);for(var i=0;i<controls.length;i++){var but=controls[i];if(but[0]==control_name&&(tinyMCE.isMSIE||!tinyMCE.settings['button_tile_map']))return '<img id="{$editor_id}_'+but[0]+'" src="{$pluginurl}/images/'+but[1]+'" title="'+but[2]+'" width="20" height="20" class="mceButtonDisabled" onmouseover="tinyMCE.switchClass(this,\'mceButtonOver\');" onmouseout="tinyMCE.restoreClass(this);" onmousedown="tinyMCE.restoreAndSwitchClass(this,\'mceButtonDown\');" onclick="tinyMCE.execInstanceCommand(\'{$editor_id}\',\''+but[3]+'\', '+(but.length>4?but[4]:false)+(but.length>5?', \''+but[5]+'\'':'')+')">';else if(but[0]==control_name)return '<img id="{$editor_id}_'+but[0]+'" src="{$themeurl}/images/spacer.gif" style="background-image:url({$pluginurl}/images/buttons.gif); background-position: '+(0-(i*20))+'px 0px" title="'+but[2]+'" width="20" height="20" class="mceButtonDisabled" onmouseover="tinyMCE.switchClass(this,\'mceButtonOver\');" onmouseout="tinyMCE.restoreClass(this);" onmousedown="tinyMCE.restoreAndSwitchClass(this,\'mceButtonDown\');" onclick="tinyMCE.execInstanceCommand(\'{$editor_id}\',\''+but[3]+'\', '+(but.length>4?but[4]:false)+(but.length>5?', \''+but[5]+'\'':'')+')">';}if(control_name=="tablecontrols"){var html="";html+=tinyMCE.getControlHTML("table");html+=tinyMCE.getControlHTML("separator");html+=tinyMCE.getControlHTML("row_props");html+=tinyMCE.getControlHTML("cell_props");html+=tinyMCE.getControlHTML("separator");html+=tinyMCE.getControlHTML("row_before");html+=tinyMCE.getControlHTML("row_after");html+=tinyMCE.getControlHTML("delete_row");html+=tinyMCE.getControlHTML("separator");html+=tinyMCE.getControlHTML("col_before");html+=tinyMCE.getControlHTML("col_after");html+=tinyMCE.getControlHTML("delete_col");return html;}return "";}function TinyMCE_table_execCommand(editor_id,element,command,user_interface,value){function getAttrib(elm,name){return elm.getAttribute(name)?elm.getAttribute(name):"";}var inst=tinyMCE.getInstanceById(editor_id);var focusElm=inst.getFocusElement();var tdElm=tinyMCE.getParentElement(focusElm,"td");var trElm=tinyMCE.getParentElement(focusElm,"tr");switch(command){case "mceTableRowProps":if(trElm==null)return true;if(user_interface){var template=new Array();template['file']='../../plugins/table/row.htm';if(tinyMCE.settings['table_color_fields']){template['width']=400;template['height']=220;}else{template['width']=340;template['height']=220;}tinyMCE.openWindow(template,{editor_id:inst.editorId,align:getAttrib(trElm,'align'),valign:getAttrib(trElm,'valign'),height:getAttrib(trElm,'height'),className:getAttrib(trElm,'className'),bordercolor:getAttrib(trElm,'bordercolor'),bgcolor:getAttrib(trElm,'bgcolor')});}else{trElm.setAttribute('align',value['align']);trElm.setAttribute('vAlign',value['valign']);trElm.setAttribute('height',value['height']);trElm.setAttribute('bordercolor',value['bordercolor']);trElm.setAttribute('bgcolor',value['bgcolor']);trElm.setAttribute('class',value['className']);trElm.setAttribute('className',value['className']);trElm.borderColor=value['bordercolor'];trElm.bgColor=value['bgcolor'];}return true;case "mceTableCellProps":if(tdElm==null)return true;if(user_interface){var template=new Array();template['file']='../../plugins/table/cell.htm';if(tinyMCE.settings['table_color_fields']){template['width']=400;template['height']=240;}else{template['width']=340;template['height']=220;}tinyMCE.openWindow(template,{editor_id:inst.editorId,align:getAttrib(tdElm,'align'),valign:getAttrib(tdElm,'valign'),width:getAttrib(tdElm,'width'),height:getAttrib(tdElm,'height'),className:getAttrib(tdElm,'className'),bordercolor:getAttrib(tdElm,'bordercolor'),bgcolor:getAttrib(tdElm,'bgcolor')});}else{tdElm.setAttribute('align',value['align']);tdElm.setAttribute('vAlign',value['valign']);tdElm.setAttribute('width',value['width']);tdElm.setAttribute('height',value['height']);tdElm.setAttribute('bordercolor',value['bordercolor']);tdElm.setAttribute('bgcolor',value['bgcolor']);tdElm.setAttribute('class',value['className']);tdElm.setAttribute('className',value['className']);tdElm.borderColor=value['bordercolor'];tdElm.bgColor=value['bgcolor'];}return true;case "mceInsertTable":if(user_interface){var cols=2,rows=2,border=0,cellpadding="",cellspacing="",align="",width="",height="",bordercolor="",bgcolor="",action="insert",className="";tinyMCE.tableElement=tinyMCE.getParentElement(inst.getFocusElement(),"table");if(tinyMCE.tableElement){var rowsAr=tinyMCE.tableElement.rows;var cols=0;for(var i=0;i<rowsAr.length;i++)if(rowsAr[i].cells.length>cols)cols=rowsAr[i].cells.length;cols=cols;rows=rowsAr.length;border=tinyMCE.getAttrib(tinyMCE.tableElement,'border',border);cellpadding=tinyMCE.getAttrib(tinyMCE.tableElement,'cellpadding',"");cellspacing=tinyMCE.getAttrib(tinyMCE.tableElement,'cellspacing',"");width=tinyMCE.getAttrib(tinyMCE.tableElement,'width',width);height=tinyMCE.getAttrib(tinyMCE.tableElement,'height',height);bordercolor=tinyMCE.getAttrib(tinyMCE.tableElement,'bordercolor',bordercolor);bgcolor=tinyMCE.getAttrib(tinyMCE.tableElement,'bgcolor',bgcolor);align=tinyMCE.getAttrib(tinyMCE.tableElement,'align',align);className=tinyMCE.getAttrib(tinyMCE.tableElement,tinyMCE.isMSIE?'className':"class","");if(tinyMCE.isMSIE){width=tinyMCE.tableElement.style.pixelWidth==0?tinyMCE.tableElement.getAttribute("width"):tinyMCE.tableElement.style.pixelWidth;height=tinyMCE.tableElement.style.pixelHeight==0?tinyMCE.tableElement.getAttribute("height"):tinyMCE.tableElement.style.pixelHeight;}action="update";}var template=new Array();template['file']='../../plugins/table/table.htm';if(tinyMCE.settings['table_color_fields']){template['width']=400;template['height']=240;}else{template['width']=340;template['height']=220;}template['width']+=tinyMCE.getLang('lang_insert_table_delta_width',0);template['height']+=tinyMCE.getLang('lang_insert_table_delta_height',0);tinyMCE.openWindow(template,{editor_id:inst.editorId,cols:cols,rows:rows,border:border,cellpadding:cellpadding,cellspacing:cellspacing,align:align,width:width,height:height,bordercolor:bordercolor,bgcolor:bgcolor,action:action,className:className});}else{var html='';var cols=2,rows=2,border=0,cellpadding=-1,cellspacing=-1,align,width,height,className;if(typeof(value)=='object'){cols=value['cols'];rows=value['rows'];border=value['border']!=""?value['border']:0;cellpadding=value['cellpadding']!=""?value['cellpadding']:-1;cellspacing=value['cellspacing']!=""?value['cellspacing']:-1;align=value['align'];width=value['width'];height=value['height'];bordercolor=value['bordercolor'];bgcolor=value['bgcolor'];className=value['className'];}if(tinyMCE.tableElement){tinyMCE.setAttrib(tinyMCE.tableElement,'cellPadding',cellpadding);tinyMCE.setAttrib(tinyMCE.tableElement,'cellSpacing',cellspacing);tinyMCE.setAttrib(tinyMCE.tableElement,'border',border);tinyMCE.setAttrib(tinyMCE.tableElement,'width',width);tinyMCE.setAttrib(tinyMCE.tableElement,'height',height);tinyMCE.setAttrib(tinyMCE.tableElement,'bordercolor',bordercolor,true);tinyMCE.setAttrib(tinyMCE.tableElement,'bgcolor',bgcolor,true);tinyMCE.setAttrib(tinyMCE.tableElement,'align',align,true);tinyMCE.setAttrib(tinyMCE.tableElement,tinyMCE.isMSIE?'className':"class",className,true);if(tinyMCE.isMSIE){tinyMCE.tableElement.style.pixelWidth=(width==null||width=="")?0:width;tinyMCE.tableElement.style.pixelHeight=(height==null||height=="")?0:height;tinyMCE.tableElement.borderColor=bordercolor;tinyMCE.tableElement.bgColor=bgcolor;}tinyMCE.handleVisualAid(tinyMCE.tableElement,false,inst.visualAid);tinyMCE.tableElement.outerHTML=tinyMCE.tableElement.outerHTML;tinyMCE.triggerNodeChange();return true;}html+='<table border="'+border+'" ';var visualAidStyle=inst.visualAid?tinyMCE.settings['visual_table_style']:"";if(cellpadding!=-1)html+='cellpadding="'+cellpadding+'" ';if(cellspacing!=-1)html+='cellspacing="'+cellspacing+'" ';if(width!=0&&width!="")html+='width="'+width+'" ';if(height!=0&&height!="")html+='height="'+height+'" ';if(bordercolor!=0&&bordercolor!="")html+='bordercolor="'+bordercolor+'" ';if(bgcolor!=0&&bgcolor!="")html+='bgcolor="'+bgcolor+'" ';if(align)html+='align="'+align+'" ';if(className)html+='class="'+className+'" ';if(border==0&&tinyMCE.settings['visual'])html+='style="'+visualAidStyle+'" ';html+='>';for(var y=0;y<rows;y++){html+="<tr>";for(var x=0;x<cols;x++){if(border==0&&tinyMCE.settings['visual'])html+='<td style="'+visualAidStyle+'">';else html+='<td>';html+=" </td>";}html+="</tr>";}html+="</table>";inst.execCommand('mceInsertContent',false,html);}return true;case "mceTableInsertRowBefore":case "mceTableInsertRowAfter":case "mceTableDeleteRow":case "mceTableInsertColBefore":case "mceTableInsertColAfter":case "mceTableDeleteCol":var trElement=tinyMCE.getParentElement(inst.getFocusElement(),"tr");var tdElement=tinyMCE.getParentElement(inst.getFocusElement(),"td");var tableElement=tinyMCE.getParentElement(inst.getFocusElement(),"table");if(!tableElement)return true;var doc=inst.contentWindow.document;var tableBorder=tableElement.getAttribute("border");var visualAidStyle=inst.visualAid?tinyMCE.settings['visual_table_style']:"";if(tableElement.firstChild&&tableElement.firstChild.nodeName.toLowerCase()=="tbody")tableElement=tableElement.firstChild;if(tableElement&&trElement){switch(command){case "mceTableInsertRowBefore":var numcells=trElement.cells.length;var rowCount=0;var tmpTR=trElement;while(tmpTR){if(tmpTR.nodeName.toLowerCase()=="tr")rowCount++;tmpTR=tmpTR.previousSibling;}var r=tableElement.insertRow(rowCount==0?1:rowCount-1);for(var i=0;i<numcells;i++){var newTD=doc.createElement("td");newTD.innerHTML=" ";if(tableBorder==0)newTD.style.cssText=visualAidStyle;var c=r.appendChild(newTD);if(tdElement.parentNode.childNodes[i].colSpan)c.colSpan=tdElement.parentNode.childNodes[i].colSpan;}break;case "mceTableInsertRowAfter":var numcells=trElement.cells.length;var rowCount=0;var tmpTR=trElement;var doc=inst.contentWindow.document;while(tmpTR){if(tmpTR.nodeName.toLowerCase()=="tr")rowCount++;tmpTR=tmpTR.previousSibling;}var r=tableElement.insertRow(rowCount==0?1:rowCount);for(var i=0;i<numcells;i++){var newTD=doc.createElement("td");newTD.innerHTML=" ";if(tableBorder==0)newTD.style.cssText=visualAidStyle;var c=r.appendChild(newTD);if(tdElement.parentNode.childNodes[i].colSpan)c.colSpan=tdElement.parentNode.childNodes[i].colSpan;}break;case "mceTableDeleteRow":if(tableElement.rows.length<=1){tableElement.parentNode.removeChild(tableElement);tinyMCE.triggerNodeChange();return true;}var selElm=inst.contentWindow.document.body;if(trElement.previousSibling)selElm=trElement.previousSibling.cells[0];trElement.parentNode.removeChild(trElement);if(tinyMCE.isGecko)inst.selectNode(selElm);break;case "mceTableInsertColBefore":var cellCount=tdElement.cellIndex;for(var y=0;y<tableElement.rows.length;y++){var cell=tableElement.rows[y].cells[cellCount];if(!cell)break;var newTD=doc.createElement("td");newTD.innerHTML=" ";if(tableBorder==0)newTD.style.cssText=visualAidStyle;cell.parentNode.insertBefore(newTD,cell);}break;case "mceTableInsertColAfter":var cellCount=tdElement.cellIndex;for(var y=0;y<tableElement.rows.length;y++){var append=false;var cell=tableElement.rows[y].cells[cellCount];if(cellCount==tableElement.rows[y].cells.length-1)append=true;else cell=tableElement.rows[y].cells[cellCount+1];var newTD=doc.createElement("td");newTD.innerHTML=" ";if(tableBorder==0)newTD.style.cssText=visualAidStyle;if(append)cell.parentNode.appendChild(newTD);else cell.parentNode.insertBefore(newTD,cell);}break;case "mceTableDeleteCol":var index=tdElement.cellIndex;var selElm=inst.contentWindow.document.body;var numCols=0;for(var y=0;y<tableElement.rows.length;y++){if(tableElement.rows[y].cells.length>numCols)numCols=tableElement.rows[y].cells.length;}if(numCols<=1){if(tinyMCE.isGecko)inst.selectNode(selElm);tableElement.parentNode.removeChild(tableElement);tinyMCE.triggerNodeChange();return true;}for(var y=0;y<tableElement.rows.length;y++){var cell=tableElement.rows[y].cells[index];if(cell)cell.parentNode.removeChild(cell);}if(index>0)selElm=tableElement.rows[0].cells[index-1];if(tinyMCE.isGecko)inst.selectNode(selElm);break;}tinyMCE.triggerNodeChange();}return true;}return false;}function TinyMCE_table_handleNodeChange(editor_id,node,undo_index,undo_levels,visual_aid,any_selection){tinyMCE.switchClassSticky(editor_id+'_table','mceButtonNormal');tinyMCE.switchClassSticky(editor_id+'_row_props','mceButtonDisabled',true);tinyMCE.switchClassSticky(editor_id+'_cell_props','mceButtonDisabled',true);tinyMCE.switchClassSticky(editor_id+'_row_before','mceButtonDisabled',true);tinyMCE.switchClassSticky(editor_id+'_row_after','mceButtonDisabled',true);tinyMCE.switchClassSticky(editor_id+'_delete_row','mceButtonDisabled',true);tinyMCE.switchClassSticky(editor_id+'_col_before','mceButtonDisabled',true);tinyMCE.switchClassSticky(editor_id+'_col_after','mceButtonDisabled',true);tinyMCE.switchClassSticky(editor_id+'_delete_col','mceButtonDisabled',true);if(tinyMCE.getParentElement(node,"tr"))tinyMCE.switchClassSticky(editor_id+'_row_props','mceButtonSelected',false);if(tinyMCE.getParentElement(node,"td")){tinyMCE.switchClassSticky(editor_id+'_cell_props','mceButtonSelected',false);tinyMCE.switchClassSticky(editor_id+'_row_before','mceButtonNormal',false);tinyMCE.switchClassSticky(editor_id+'_row_after','mceButtonNormal',false);tinyMCE.switchClassSticky(editor_id+'_delete_row','mceButtonNormal',false);tinyMCE.switchClassSticky(editor_id+'_col_before','mceButtonNormal',false);tinyMCE.switchClassSticky(editor_id+'_col_after','mceButtonNormal',false);tinyMCE.switchClassSticky(editor_id+'_delete_col','mceButtonNormal',false);}if(tinyMCE.getParentElement(node,"table"))tinyMCE.switchClassSticky(editor_id+'_table','mceButtonSelected');} --- NEW FILE: readme.txt --- Table plugin for TinyMCE ------------------------------ Installation instructions: * Copy the table directory to the plugins directory of TinyMCE (/jscripts/tiny_mce/plugins). * Add plugin to TinyMCE plugin option list example: plugins : "table". * Add the table button name to button list, example: theme_advanced_buttons3_add_before : "tablecontrols". Initialization example: tinyMCE.init({ theme : "advanced", mode : "textareas", plugins : "table", theme_advanced_buttons3_add_before : "tablecontrols" }); Table controls: tablecontrols All table control below and some separators between them. table Insert table control. row_props Edit row properties (tr). cell_props Edit cell properties (td). delete_col Delete column control. delete_row Delete row control. col_after Column after control. col_before Column before control. row_after Row after control. row_before Row before control. row_after Row after control. row_before Row before control. Table plugin commands: mceInsertTable Inserts a new table at cursor location the default size is 2x2. If the value parameter is specified it should contain a name/value array, this array has the following options cols, rows, border, cellspacing, cellpadding. The default border is set to: 0. mceTableInsertRowBefore Inserts a row before/above the current cursor location. mceTableInsertRowAfter Inserts a row after/under the current cursor location. mceTableDeleteRow Deletes the row at the current cursor location. mceTableInsertColBefore Inserts a column before the current cursor location. mceTableInsertColAfter Inserts a column after the current cursor location. mceTableDeleteCol Deletes the column at the current cursor location. Options: table_color_fields If set to true, tables dialogs will have color fields. --- NEW FILE: cell.htm --- <html> <head> <title>{$lang_table_cell_title}</title> <script language="javascript" type="text/javascript" src="../../tiny_mce_popup.js"></script> <script language="javascript" type="text/javascript"> // Disable auto resize tinyMCE.getWindowArg('mce_windowresize', false); function insertTable() { if (window.opener) { var args = new Array(); args["width"] = document.forms[0].width.value; args["height"] = document.forms[0].height.value; args["align"] = document.forms[0].align.options[document.forms[0].align.selectedIndex].value; args["valign"] = document.forms[0].valign.options[document.forms[0].valign.selectedIndex].value; args["className"] = document.forms[0].styleSelect.options[document.forms[0].styleSelect.selectedIndex].value; args["bordercolor"] = document.forms[0].bordercolor.value; args["bgcolor"] = document.forms[0].bgcolor.value; window.opener.tinyMCE.execCommand("mceTableCellProps", false, args); top.close(); } } function init() { if (tinyMCE.settings['table_color_fields']) { document.getElementById('colors').style.display = tinyMCE.isMSIE ? 'block' : 'table-row'; TinyMCEPlugin_onLoad(); // Resize again } document.forms[0].bordercolor.value = tinyMCE.getWindowArg('bordercolor'); document.forms[0].bgcolor.value = tinyMCE.getWindowArg('bgcolor'); for (var i=0; i<document.forms[0].align.options.length; i++) { if (document.forms[0].align.options[i].value == tinyMCE.getWindowArg('align')) document.forms[0].align.options.selectedIndex = i; } for (var i=0; i<document.forms[0].valign.options.length; i++) { if (document.forms[0].valign.options[i].value == tinyMCE.getWindowArg('valign')) document.forms[0].valign.options.selectedIndex = i; } var className = tinyMCE.getWindowArg('className'); var styleSelectElm = document.forms[0].styleSelect; var stylesAr = tinyMCE.getParam('theme_advanced_styles', false); if (stylesAr) { stylesAr = stylesAr.split(';'); for (var i=0; i<stylesAr.length; i++) { var key, value; key = stylesAr[i].split('=')[0]; value = stylesAr[i].split('=')[1]; styleSelectElm.options[styleSelectElm.length] = new Option(key, value); if (value == className) styleSelectElm.options.selectedIndex = styleSelectElm.options.length-1; } } else { var csses = tinyMCE.getCSSClasses(tinyMCE.getWindowArg('editor_id')); for (var i=0; i<csses.length; i++) { styleSelectElm.options[styleSelectElm.length] = new Option(csses[i], csses[i]); if (csses[i] == className) styleSelectElm.options.selectedIndex = styleSelectElm.options.length-1; } } var formObj = document.forms[0]; formObj.width.value = tinyMCE.getWindowArg('width'); formObj.height.value = tinyMCE.getWindowArg('height'); // Autoresize and focus TinyMCEPopup_autoResize(); window.focus(); } function cancelAction() { top.close(); } </script> </head> <body onload="window.focus();init();"> <form onsubmit="insertTable();return false;"> <table border="0" cellpadding="0" cellspacing="0" width="200"> <tr> <td align="center" valign="middle"><table border="0" cellpadding="4" cellspacing="0"> <tr> <td colspan="4" class="title">{$lang_table_cell_title}</td> </tr> <tr> <td>{$lang_insert_table_align}:</td> <td><select name="align"> <option value="">{$lang_insert_table_align_default}</option> <option value="center">{$lang_insert_table_align_middle}</option> <option value="left">{$lang_insert_table_align_left}</option> <option value="right">{$lang_insert_table_align_right}</option> </select></td> <td>{$lang_insert_table_class}:</td> <td><select name="styleSelect"> <option value="" selected="selected">-- {$lang_theme_style_select} --</option> </select></td> </tr> <tr> <td>{$lang_insert_table_valign}:</td> <td><select name="valign"> <option value="">{$lang_insert_table_align_default}</option> <option value="top">{$lang_insert_table_align_top}</option> <option value="middle">{$lang_insert_table_align_middle}</option> <option value="bottom">{$lang_insert_table_align_bottom}</option> </select></td> <td> </td> <td> </td> </tr> <tr> <td>{$lang_insert_table_width}:</td> <td><input name="width" type="text" id="width" value="" size="4" maxlength="4"></td> <td>{$lang_insert_table_height}: </td> <td><input name="height" type="text" id="height" value="" size="4" maxlength="4"></td> </tr> <tr id="colors" style="display: none"> <td>{$lang_table_bordercolor}:</td> <td><input name="bordercolor" type="text" id="bordercolor" value="" size="9" maxlength="7"></td> <td>{$lang_table_bgcolor}:</td> <td><input name="bgcolor" type="text" id="bgcolor" value="" size="9" maxlength="7"></td> </tr> <tr> <td><input type="button" id="insert" name="insert" value="{$lang_update}" onclick="insertTable();"></td> <td align="right"> </td> <td align="right"> </td> <td align="right"><input type="button" id="cancel" name="cancel" value="{$lang_cancel}" onclick="cancelAction();"></td> </tr> </table></td> </tr> </table> </form> </body> </html> |