summaryrefslogtreecommitdiff
path: root/program/js/tiny_mce/plugins/table
diff options
context:
space:
mode:
authorsvncommit <devs@roundcube.net>2006-09-14 03:49:28 +0000
committersvncommit <devs@roundcube.net>2006-09-14 03:49:28 +0000
commita0109c4933e0bfb5ed9dbcf94f932991ca689542 (patch)
tree955246969bf9da5d5335d1d7c483025fdbd50407 /program/js/tiny_mce/plugins/table
parentbb5ddfa0ade5fbd2ed9be16e51d4ce695252eece (diff)
Initial TinyMCE editor support (still need to work on spellcheck and skins)
Diffstat (limited to 'program/js/tiny_mce/plugins/table')
-rw-r--r--program/js/tiny_mce/plugins/table/cell.htm182
-rw-r--r--program/js/tiny_mce/plugins/table/css/cell.css17
-rw-r--r--program/js/tiny_mce/plugins/table/css/row.css25
-rw-r--r--program/js/tiny_mce/plugins/table/css/table.css13
-rw-r--r--program/js/tiny_mce/plugins/table/editor_plugin.js1
-rw-r--r--program/js/tiny_mce/plugins/table/editor_plugin_src.js1054
-rw-r--r--program/js/tiny_mce/plugins/table/images/buttons.gifbin0 -> 1356 bytes
-rw-r--r--program/js/tiny_mce/plugins/table/images/table.gifbin0 -> 287 bytes
-rw-r--r--program/js/tiny_mce/plugins/table/images/table_cell_props.gifbin0 -> 189 bytes
-rw-r--r--program/js/tiny_mce/plugins/table/images/table_delete.gifbin0 -> 372 bytes
-rw-r--r--program/js/tiny_mce/plugins/table/images/table_delete_col.gifbin0 -> 163 bytes
-rw-r--r--program/js/tiny_mce/plugins/table/images/table_delete_row.gifbin0 -> 171 bytes
-rw-r--r--program/js/tiny_mce/plugins/table/images/table_insert_col_after.gifbin0 -> 165 bytes
-rw-r--r--program/js/tiny_mce/plugins/table/images/table_insert_col_before.gifbin0 -> 165 bytes
-rw-r--r--program/js/tiny_mce/plugins/table/images/table_insert_row_after.gifbin0 -> 163 bytes
-rw-r--r--program/js/tiny_mce/plugins/table/images/table_insert_row_before.gifbin0 -> 159 bytes
-rw-r--r--program/js/tiny_mce/plugins/table/images/table_merge_cells.gifbin0 -> 198 bytes
-rw-r--r--program/js/tiny_mce/plugins/table/images/table_row_props.gifbin0 -> 187 bytes
-rw-r--r--program/js/tiny_mce/plugins/table/images/table_split_cells.gifbin0 -> 210 bytes
-rw-r--r--program/js/tiny_mce/plugins/table/jscripts/cell.js249
-rw-r--r--program/js/tiny_mce/plugins/table/jscripts/merge_cells.js19
-rw-r--r--program/js/tiny_mce/plugins/table/jscripts/row.js200
-rw-r--r--program/js/tiny_mce/plugins/table/jscripts/table.js344
-rw-r--r--program/js/tiny_mce/plugins/table/langs/en.js78
-rw-r--r--program/js/tiny_mce/plugins/table/merge_cells.htm37
-rw-r--r--program/js/tiny_mce/plugins/table/readme.txt1
-rw-r--r--program/js/tiny_mce/plugins/table/row.htm159
-rw-r--r--program/js/tiny_mce/plugins/table/table.htm155
28 files changed, 2534 insertions, 0 deletions
diff --git a/program/js/tiny_mce/plugins/table/cell.htm b/program/js/tiny_mce/plugins/table/cell.htm
new file mode 100644
index 000000000..7171d4faa
--- /dev/null
+++ b/program/js/tiny_mce/plugins/table/cell.htm
@@ -0,0 +1,182 @@
+<html xmlns="http://www.w3.org/1999/xhtml">
+<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" src="../../utils/mctabs.js"></script>
+ <script language="javascript" type="text/javascript" src="../../utils/form_utils.js"></script>
+ <script language="javascript" type="text/javascript" src="jscripts/cell.js"></script>
+ <link href="css/cell.css" rel="stylesheet" type="text/css" />
+ <base target="_self" />
+</head>
+<body id="tablecell" onload="tinyMCEPopup.executeOnLoad('init();');" style="display: none">
+ <form onsubmit="updateAction();return false;" action="#">
+ <div class="tabs">
+ <ul>
+ <li id="general_tab" class="current"><span><a href="javascript:mcTabs.displayTab('general_tab','general_panel');" onmousedown="return false;">{$lang_table_general_tab}</a></span></li>
+ <li id="advanced_tab"><span><a href="javascript:mcTabs.displayTab('advanced_tab','advanced_panel');" onmousedown="return false;">{$lang_table_advanced_tab}</a></span></li>
+ </ul>
+ </div>
+
+ <div class="panel_wrapper">
+ <div id="general_panel" class="panel current">
+ <fieldset>
+ <legend>{$lang_table_general_props}</legend>
+
+ <table border="0" cellpadding="4" cellspacing="0">
+ <tr>
+ <td><label for="align">{$lang_table_align}</label></td>
+ <td>
+ <select id="align" name="align">
+ <option value="">{$lang_not_set}</option>
+ <option value="center">{$lang_table_align_middle}</option>
+ <option value="left">{$lang_table_align_left}</option>
+ <option value="right">{$lang_table_align_right}</option>
+ </select>
+ </td>
+
+ <td><label for="celltype">{$lang_table_cell_type}</label></td>
+ <td>
+ <select id="celltype" name="celltype">
+ <option value="td">{$lang_table_td}</option>
+ <option value="th">{$lang_table_th}</option>
+ </select>
+ </td>
+ </tr>
+
+ <tr>
+ <td><label for="valign">{$lang_table_valign}</label></td>
+ <td>
+ <select id="valign" name="valign">
+ <option value="">{$lang_not_set}</option>
+ <option value="top">{$lang_table_align_top}</option>
+ <option value="middle">{$lang_table_align_middle}</option>
+ <option value="bottom">{$lang_table_align_bottom}</option>
+ </select>
+ </td>
+
+ <td><label for="scope">{$lang_table_scope}</label></td>
+ <td>
+ <select id="scope" name="scope">
+ <option value="">{$lang_not_set}</option>
+ <option value="col">{$lang_table_col}</option>
+ <option value="row">{$lang_table_row}</option>
+ <option value="rowgroup">{$lang_table_rowgroup}</option>
+ <option value="colgroup">{$lang_table_colgroup}</option>
+ </select>
+ </td>
+
+ </tr>
+
+ <tr>
+ <td><label for="width">{$lang_table_width}</label></td>
+ <td><input id="width" name="width" type="text" value="" size="4" maxlength="4" onchange="changedSize();" /></td>
+
+ <td><label for="height">{$lang_table_height}</label></td>
+ <td><input id="height" name="height" type="text" value="" size="4" maxlength="4" onchange="changedSize();" /></td>
+ </tr>
+
+ <tr id="styleSelectRow">
+ <td><label for="class">{$lang_class_name}</label></td>
+ <td colspan="3">
+ <select id="class" name="class">
+ <option value="" selected="selected">{$lang_not_set}</option>
+ </select>
+ </td>
+ </tr>
+ </table>
+ </fieldset>
+ </div>
+
+ <div id="advanced_panel" class="panel">
+ <fieldset>
+ <legend>{$lang_table_advanced_props}</legend>
+
+ <table border="0" cellpadding="0" cellspacing="4">
+ <tr>
+ <td class="column1"><label for="id">{$lang_table_id}</label></td>
+ <td><input id="id" name="id" type="text" value="" style="width: 200px" /></td>
+ </tr>
+
+ <tr>
+ <td><label for="style">{$lang_table_style}</label></td>
+ <td><input type="text" id="style" name="style" value="" style="width: 200px;" onchange="changedStyle();" /></td>
+ </tr>
+
+ <tr>
+ <td class="column1"><label for="dir">{$lang_table_langdir}</label></td>
+ <td>
+ <select id="dir" name="dir" style="width: 200px">
+ <option value="">{$lang_not_set}</option>
+ <option value="ltr">{$lang_table_ltr}</option>
+ <option value="rtl">{$lang_table_rtl}</option>
+ </select>
+ </td>
+ </tr>
+
+ <tr>
+ <td class="column1"><label for="lang">{$lang_table_langcode}</label></td>
+ <td>
+ <input id="lang" name="lang" type="text" value="" style="width: 200px" />
+ </td>
+ </tr>
+
+ <tr>
+ <td class="column1"><label for="backgroundimage">{$lang_table_bgimage}</label></td>
+ <td>
+ <table border="0" cellpadding="0" cellspacing="0">
+ <tr>
+ <td><input id="backgroundimage" name="backgroundimage" type="text" value="" style="width: 200px" onchange="changedBackgroundImage();" /></td>
+ <td id="backgroundimagebrowsercontainer">&nbsp;</td>
+ </tr>
+ </table>
+ </td>
+ </tr>
+
+ <tr>
+ <td class="column1"><label for="bordercolor">{$lang_table_bordercolor}</label></td>
+ <td>
+ <table border="0" cellpadding="0" cellspacing="0">
+ <tr>
+ <td><input id="bordercolor" name="bordercolor" type="text" value="" size="9" onchange="updateColor('bordercolor_pick','bordercolor');changedColor();" /></td>
+ <td id="bordercolor_pickcontainer">&nbsp;</td>
+ </tr>
+ </table>
+ </td>
+ </tr>
+
+ <tr>
+ <td class="column1"><label for="bgcolor">{$lang_table_bgcolor}</label></td>
+ <td>
+ <table border="0" cellpadding="0" cellspacing="0">
+ <tr>
+ <td><input id="bgcolor" name="bgcolor" type="text" value="" size="9" onchange="updateColor('bgcolor_pick','bgcolor');changedColor();" /></td>
+ <td id="bgcolor_pickcontainer">&nbsp;</td>
+ </tr>
+ </table>
+ </td>
+ </tr>
+ </table>
+ </fieldset>
+ </div>
+ </div>
+
+ <div class="mceActionPanel">
+ <div>
+ <select id="action" name="action">
+ <option value="cell">{$lang_table_cell_cell}</option>
+ <option value="row">{$lang_table_cell_row}</option>
+ <option value="all">{$lang_table_cell_all}</option>
+ </select>
+ </div>
+
+ <div style="float: left">
+ <div><input type="button" id="insert" name="insert" value="{$lang_update}" onclick="updateAction();" /></div>
+ </div>
+
+ <div style="float: right">
+ <input type="button" id="cancel" name="cancel" value="{$lang_cancel}" onclick="tinyMCEPopup.close();" />
+ </div>
+ </div>
+ </form>
+</body>
+</html>
diff --git a/program/js/tiny_mce/plugins/table/css/cell.css b/program/js/tiny_mce/plugins/table/css/cell.css
new file mode 100644
index 000000000..a067ecdfe
--- /dev/null
+++ b/program/js/tiny_mce/plugins/table/css/cell.css
@@ -0,0 +1,17 @@
+/* CSS file for cell dialog in the table plugin */
+
+.panel_wrapper div.current {
+ height: 200px;
+}
+
+.advfield {
+ width: 200px;
+}
+
+#action {
+ margin-bottom: 3px;
+}
+
+#class {
+ width: 150px;
+} \ No newline at end of file
diff --git a/program/js/tiny_mce/plugins/table/css/row.css b/program/js/tiny_mce/plugins/table/css/row.css
new file mode 100644
index 000000000..1f7755daf
--- /dev/null
+++ b/program/js/tiny_mce/plugins/table/css/row.css
@@ -0,0 +1,25 @@
+/* CSS file for row dialog in the table plugin */
+
+.panel_wrapper div.current {
+ height: 200px;
+}
+
+.advfield {
+ width: 200px;
+}
+
+#action {
+ margin-bottom: 3px;
+}
+
+#rowtype,#align,#valign,#class,#height {
+ width: 150px;
+}
+
+#height {
+ width: 50px;
+}
+
+.col2 {
+ padding-left: 20px;
+}
diff --git a/program/js/tiny_mce/plugins/table/css/table.css b/program/js/tiny_mce/plugins/table/css/table.css
new file mode 100644
index 000000000..804f766ee
--- /dev/null
+++ b/program/js/tiny_mce/plugins/table/css/table.css
@@ -0,0 +1,13 @@
+/* CSS file for table dialog in the table plugin */
+
+.panel_wrapper div.current {
+ height: 220px;
+}
+
+.advfield {
+ width: 200px;
+}
+
+#class {
+ width: 150px;
+}
diff --git a/program/js/tiny_mce/plugins/table/editor_plugin.js b/program/js/tiny_mce/plugins/table/editor_plugin.js
new file mode 100644
index 000000000..2e0fd012b
--- /dev/null
+++ b/program/js/tiny_mce/plugins/table/editor_plugin.js
@@ -0,0 +1 @@
+tinyMCE.importPluginLanguagePack('table','en,tr,ar,cs,da,de,el,es,fi,fr_ca,hu,it,ja,ko,nl,nb,pl,pt,pt_br,sv,tw,zh_cn,fr,de,he,nb,ru,ru_KOI8-R,ru_UTF-8,nn,cy,is,zh_tw,zh_tw_utf8,sk');var TinyMCE_TablePlugin={getInfo:function(){return{longname:'Tables',author:'Moxiecode Systems',authorurl:'http://tinymce.moxiecode.com',infourl:'http://tinymce.moxiecode.com/tinymce/docs/plugin_table.html',version:tinyMCE.majorVersion+"."+tinyMCE.minorVersion};},initInstance:function(inst){if(tinyMCE.isGecko){var doc=inst.getDoc();tinyMCE.addEvent(doc,"mouseup",TinyMCE_TablePlugin._mouseDownHandler);}inst.tableRowClipboard=null;},getControlHTML:function(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_col_after_desc','mceTableInsertColAfter'],['col_before','table_insert_col_before.gif','lang_table_col_before_desc','mceTableInsertColBefore'],['row_after','table_insert_row_after.gif','lang_table_row_after_desc','mceTableInsertRowAfter'],['row_before','table_insert_row_before.gif','lang_table_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],['split_cells','table_split_cells.gif','lang_table_split_cells_desc','mceTableSplitCells',true],['merge_cells','table_merge_cells.gif','lang_table_merge_cells_desc','mceTableMergeCells',true]);for(var i=0;i<controls.length;i++){var but=controls[i];var cmd='tinyMCE.execInstanceCommand(\'{$editor_id}\',\''+but[3]+'\', '+(but.length>4?but[4]:false)+(but.length>5?', \''+but[5]+'\'':'')+');return false;';if(but[0]==control_name)return tinyMCE.getButtonHTML(control_name,but[2],'{$pluginurl}/images/'+but[1],but[3],(but.length>4?but[4]:false));}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");html+=tinyMCE.getControlHTML("separator");html+=tinyMCE.getControlHTML("split_cells");html+=tinyMCE.getControlHTML("merge_cells");return html;}return"";},execCommand:function(editor_id,element,command,user_interface,value){switch(command){case"mceInsertTable":case"mceTableRowProps":case"mceTableCellProps":case"mceTableSplitCells":case"mceTableMergeCells":case"mceTableInsertRowBefore":case"mceTableInsertRowAfter":case"mceTableDeleteRow":case"mceTableInsertColBefore":case"mceTableInsertColAfter":case"mceTableDeleteCol":case"mceTableCutRow":case"mceTableCopyRow":case"mceTablePasteRowBefore":case"mceTablePasteRowAfter":case"mceTableDelete":var inst=tinyMCE.getInstanceById(editor_id);inst.execCommand('mceBeginUndoLevel');TinyMCE_TablePlugin._doExecCommand(editor_id,element,command,user_interface,value);inst.execCommand('mceEndUndoLevel');return true;}return false;},handleNodeChange:function(editor_id,node,undo_index,undo_levels,visual_aid,any_selection){var colspan="1",rowspan="1";var inst=tinyMCE.getInstanceById(editor_id);tinyMCE.switchClass(editor_id+'_table','mceButtonNormal');tinyMCE.switchClass(editor_id+'_row_props','mceButtonDisabled');tinyMCE.switchClass(editor_id+'_cell_props','mceButtonDisabled');tinyMCE.switchClass(editor_id+'_row_before','mceButtonDisabled');tinyMCE.switchClass(editor_id+'_row_after','mceButtonDisabled');tinyMCE.switchClass(editor_id+'_delete_row','mceButtonDisabled');tinyMCE.switchClass(editor_id+'_col_before','mceButtonDisabled');tinyMCE.switchClass(editor_id+'_col_after','mceButtonDisabled');tinyMCE.switchClass(editor_id+'_delete_col','mceButtonDisabled');tinyMCE.switchClass(editor_id+'_split_cells','mceButtonDisabled');tinyMCE.switchClass(editor_id+'_merge_cells','mceButtonDisabled');if(tdElm=tinyMCE.getParentElement(node,"td,th")){tinyMCE.switchClass(editor_id+'_cell_props','mceButtonSelected');tinyMCE.switchClass(editor_id+'_row_before','mceButtonNormal');tinyMCE.switchClass(editor_id+'_row_after','mceButtonNormal');tinyMCE.switchClass(editor_id+'_delete_row','mceButtonNormal');tinyMCE.switchClass(editor_id+'_col_before','mceButtonNormal');tinyMCE.switchClass(editor_id+'_col_after','mceButtonNormal');tinyMCE.switchClass(editor_id+'_delete_col','mceButtonNormal');colspan=tinyMCE.getAttrib(tdElm,"colspan");rowspan=tinyMCE.getAttrib(tdElm,"rowspan");colspan=colspan==""?"1":colspan;rowspan=rowspan==""?"1":rowspan;if(colspan!="1"||rowspan!="1")tinyMCE.switchClass(editor_id+'_split_cells','mceButtonNormal');}if(tinyMCE.getParentElement(node,"tr"))tinyMCE.switchClass(editor_id+'_row_props','mceButtonSelected');if(tinyMCE.getParentElement(node,"table")){tinyMCE.switchClass(editor_id+'_table','mceButtonSelected');tinyMCE.switchClass(editor_id+'_merge_cells','mceButtonNormal');}},_mouseDownHandler:function(e){var elm=tinyMCE.isMSIE?event.srcElement:e.target;var focusElm=tinyMCE.selectedInstance.getFocusElement();if(elm.nodeName=="BODY"&&(focusElm.nodeName=="TD"||focusElm.nodeName=="TH"||(focusElm.parentNode&&focusElm.parentNode.nodeName=="TD")||(focusElm.parentNode&&focusElm.parentNode.nodeName=="TH"))){window.setTimeout(function(){var tableElm=tinyMCE.getParentElement(focusElm,"table");tinyMCE.handleVisualAid(tableElm,true,tinyMCE.settings['visual'],tinyMCE.selectedInstance);},10);}},_doExecCommand:function(editor_id,element,command,user_interface,value){var inst=tinyMCE.getInstanceById(editor_id);var focusElm=inst.getFocusElement();var trElm=tinyMCE.getParentElement(focusElm,"tr");var tdElm=tinyMCE.getParentElement(focusElm,"td,th");var tableElm=tinyMCE.getParentElement(focusElm,"table");var doc=inst.contentWindow.document;var tableBorder=tableElm?tableElm.getAttribute("border"):"";if(trElm&&tdElm==null)tdElm=trElm.cells[0];function inArray(ar,v){for(var i=0;i<ar.length;i++){if(ar[i].length>0&&inArray(ar[i],v))return true;if(ar[i]==v)return true;}return false;}function makeTD(){var newTD=doc.createElement("td");newTD.innerHTML="&nbsp;";}function getColRowSpan(td){var colspan=tinyMCE.getAttrib(td,"colspan");var rowspan=tinyMCE.getAttrib(td,"rowspan");colspan=colspan==""?1:parseInt(colspan);rowspan=rowspan==""?1:parseInt(rowspan);return{colspan:colspan,rowspan:rowspan};}function getCellPos(grid,td){for(var y=0;y<grid.length;y++){for(var x=0;x<grid[y].length;x++){if(grid[y][x]==td)return{cellindex:x,rowindex:y};}}return null;}function getCell(grid,row,col){if(grid[row]&&grid[row][col])return grid[row][col];return null;}function getTableGrid(table){var grid=new Array();var rows=table.rows;for(var y=0;y<rows.length;y++){for(var x=0;x<rows[y].cells.length;x++){var td=rows[y].cells[x];var sd=getColRowSpan(td);for(xstart=x;grid[y]&&grid[y][xstart];xstart++);for(var y2=y;y2<y+sd['rowspan'];y2++){if(!grid[y2])grid[y2]=new Array();for(var x2=xstart;x2<xstart+sd['colspan'];x2++){grid[y2][x2]=td;}}}}return grid;}function trimRow(table,tr,td,new_tr){var grid=getTableGrid(table);var cpos=getCellPos(grid,td);if(new_tr.cells.length!=tr.childNodes.length){var cells=tr.childNodes;var lastElm=null;for(var x=0;td=getCell(grid,cpos.rowindex,x);x++){var remove=true;var sd=getColRowSpan(td);if(inArray(cells,td)){new_tr.childNodes[x]._delete=true;}else if((lastElm==null||td!=lastElm)&&sd.colspan>1){for(var i=x;i<x+td.colSpan;i++)new_tr.childNodes[i]._delete=true;}if((lastElm==null||td!=lastElm)&&sd.rowspan>1)td.rowSpan=sd.rowspan+1;lastElm=td;}deleteMarked(tableElm);}}function prevElm(node,name){while((node=node.previousSibling)!=null){if(node.nodeName==name)return node;}return null;}function nextElm(node,names){var namesAr=names.split(',');while((node=node.nextSibling)!=null){for(var i=0;i<namesAr.length;i++){if(node.nodeName.toLowerCase()==namesAr[i].toLowerCase())return node;}}return null;}function deleteMarked(tbl){if(tbl.rows==0)return;var tr=tbl.rows[0];do{var next=nextElm(tr,"TR");if(tr._delete){tr.parentNode.removeChild(tr);continue;}var td=tr.cells[0];if(td.cells>1){do{var nexttd=nextElm(td,"TD,TH");if(td._delete)td.parentNode.removeChild(td);}while((td=nexttd)!=null);}}while((tr=next)!=null);}function addRows(td_elm,tr_elm,rowspan){td_elm.rowSpan=1;var trNext=nextElm(tr_elm,"TR");for(var i=1;i<rowspan&&trNext;i++){var newTD=doc.createElement("td");newTD.innerHTML="&nbsp;";if(tinyMCE.isMSIE)trNext.insertBefore(newTD,trNext.cells(td_elm.cellIndex));else trNext.insertBefore(newTD,trNext.cells[td_elm.cellIndex]);trNext=nextElm(trNext,"TR");}}function copyRow(doc,table,tr){var grid=getTableGrid(table);var newTR=tr.cloneNode(false);var cpos=getCellPos(grid,tr.cells[0]);var lastCell=null;var tableBorder=tinyMCE.getAttrib(table,"border");var tdElm=null;for(var x=0;tdElm=getCell(grid,cpos.rowindex,x);x++){var newTD=null;if(lastCell!=tdElm){for(var i=0;i<tr.cells.length;i++){if(tdElm==tr.cells[i]){newTD=tdElm.cloneNode(true);break;}}}if(newTD==null){newTD=doc.createElement("td");newTD.innerHTML="&nbsp;";}newTD.colSpan=1;newTD.rowSpan=1;newTR.appendChild(newTD);lastCell=tdElm;}return newTR;}switch(command){case"mceTableRowProps":if(trElm==null)return true;if(user_interface){var template=new Array();template['file']='../../plugins/table/row.htm';template['width']=380;template['height']=295;template['width']+=tinyMCE.getLang('lang_table_rowprops_delta_width',0);template['height']+=tinyMCE.getLang('lang_table_rowprops_delta_height',0);tinyMCE.openWindow(template,{editor_id:inst.editorId,inline:"yes"});}return true;case"mceTableCellProps":if(tdElm==null)return true;if(user_interface){var template=new Array();template['file']='../../plugins/table/cell.htm';template['width']=380;template['height']=295;template['width']+=tinyMCE.getLang('lang_table_cellprops_delta_width',0);template['height']+=tinyMCE.getLang('lang_table_cellprops_delta_height',0);tinyMCE.openWindow(template,{editor_id:inst.editorId,inline:"yes"});}return true;case"mceInsertTable":if(user_interface){var template=new Array();template['file']='../../plugins/table/table.htm';template['width']=380;template['height']=295;template['width']+=tinyMCE.getLang('lang_table_table_delta_width',0);template['height']+=tinyMCE.getLang('lang_table_table_delta_height',0);tinyMCE.openWindow(template,{editor_id:inst.editorId,inline:"yes",action:value});}return true;case"mceTableDelete":var table=tinyMCE.getParentElement(inst.getFocusElement(),"table");if(table){table.parentNode.removeChild(table);inst.repaint();}return true;case"mceTableSplitCells":case"mceTableMergeCells":case"mceTableInsertRowBefore":case"mceTableInsertRowAfter":case"mceTableDeleteRow":case"mceTableInsertColBefore":case"mceTableInsertColAfter":case"mceTableDeleteCol":case"mceTableCutRow":case"mceTableCopyRow":case"mceTablePasteRowBefore":case"mceTablePasteRowAfter":if(!tableElm)return true;if(tableElm!=trElm.parentNode)tableElm=trElm.parentNode;if(tableElm&&trElm){switch(command){case"mceTableInsertRowBefore":if(!trElm||!tdElm)return true;var grid=getTableGrid(tableElm);var cpos=getCellPos(grid,tdElm);var newTR=doc.createElement("tr");var lastTDElm=null;cpos.rowindex--;if(cpos.rowindex<0)cpos.rowindex=0;for(var x=0;tdElm=getCell(grid,cpos.rowindex,x);x++){if(tdElm!=lastTDElm){var sd=getColRowSpan(tdElm);if(sd['rowspan']==1){var newTD=doc.createElement("td");newTD.innerHTML="&nbsp;";newTD.colSpan=tdElm.colSpan;newTR.appendChild(newTD);}else tdElm.rowSpan=sd['rowspan']+1;lastTDElm=tdElm;}}trElm.parentNode.insertBefore(newTR,trElm);break;case"mceTableCutRow":if(!trElm||!tdElm)return true;inst.tableRowClipboard=copyRow(doc,tableElm,trElm);inst.execCommand("mceTableDeleteRow");break;case"mceTableCopyRow":if(!trElm||!tdElm)return true;inst.tableRowClipboard=copyRow(doc,tableElm,trElm);break;case"mceTablePasteRowBefore":if(!trElm||!tdElm)return true;var newTR=inst.tableRowClipboard.cloneNode(true);var prevTR=prevElm(trElm,"TR");if(prevTR!=null)trimRow(tableElm,prevTR,prevTR.cells[0],newTR);trElm.parentNode.insertBefore(newTR,trElm);break;case"mceTablePasteRowAfter":if(!trElm||!tdElm)return true;var nextTR=nextElm(trElm,"TR");var newTR=inst.tableRowClipboard.cloneNode(true);trimRow(tableElm,trElm,tdElm,newTR);if(nextTR==null)trElm.parentNode.appendChild(newTR);else nextTR.parentNode.insertBefore(newTR,nextTR);break;case"mceTableInsertRowAfter":if(!trElm||!tdElm)return true;var grid=getTableGrid(tableElm);var cpos=getCellPos(grid,tdElm);var newTR=doc.createElement("tr");var lastTDElm=null;for(var x=0;tdElm=getCell(grid,cpos.rowindex,x);x++){if(tdElm!=lastTDElm){var sd=getColRowSpan(tdElm);if(sd['rowspan']==1){var newTD=doc.createElement("td");newTD.innerHTML="&nbsp;";newTD.colSpan=tdElm.colSpan;newTR.appendChild(newTD);}else tdElm.rowSpan=sd['rowspan']+1;lastTDElm=tdElm;}}if(newTR.hasChildNodes()){var nextTR=nextElm(trElm,"TR");if(nextTR)nextTR.parentNode.insertBefore(newTR,nextTR);else tableElm.appendChild(newTR);}break;case"mceTableDeleteRow":if(!trElm||!tdElm)return true;var grid=getTableGrid(tableElm);var cpos=getCellPos(grid,tdElm);if(grid.length==1){tableElm.parentNode.removeChild(tableElm);return true;}var cells=trElm.cells;var nextTR=nextElm(trElm,"TR");for(var x=0;x<cells.length;x++){if(cells[x].rowSpan>1){var newTD=cells[x].cloneNode(true);var sd=getColRowSpan(cells[x]);newTD.rowSpan=sd.rowspan-1;var nextTD=nextTR.cells[x];if(nextTD==null)nextTR.appendChild(newTD);else nextTR.insertBefore(newTD,nextTD);}}var lastTDElm=null;for(var x=0;tdElm=getCell(grid,cpos.rowindex,x);x++){if(tdElm!=lastTDElm){var sd=getColRowSpan(tdElm);if(sd.rowspan>1){tdElm.rowSpan=sd.rowspan-1;}else{trElm=tdElm.parentNode;if(trElm.parentNode)trElm._delete=true;}lastTDElm=tdElm;}}deleteMarked(tableElm);cpos.rowindex--;if(cpos.rowindex<0)cpos.rowindex=0;inst.selection.selectNode(getCell(grid,cpos.rowindex,0),true,true);break;case"mceTableInsertColBefore":if(!trElm||!tdElm)return true;var grid=getTableGrid(tableElm);var cpos=getCellPos(grid,tdElm);var lastTDElm=null;for(var y=0;tdElm=getCell(grid,y,cpos.cellindex);y++){if(tdElm!=lastTDElm){var sd=getColRowSpan(tdElm);if(sd['colspan']==1){var newTD=doc.createElement(tdElm.nodeName);newTD.innerHTML="&nbsp;";newTD.rowSpan=tdElm.rowSpan;tdElm.parentNode.insertBefore(newTD,tdElm);}else tdElm.colSpan++;lastTDElm=tdElm;}}break;case"mceTableInsertColAfter":if(!trElm||!tdElm)return true;var grid=getTableGrid(tableElm);var cpos=getCellPos(grid,tdElm);var lastTDElm=null;for(var y=0;tdElm=getCell(grid,y,cpos.cellindex);y++){if(tdElm!=lastTDElm){var sd=getColRowSpan(tdElm);if(sd['colspan']==1){var newTD=doc.createElement(tdElm.nodeName);newTD.innerHTML="&nbsp;";newTD.rowSpan=tdElm.rowSpan;var nextTD=nextElm(tdElm,"TD,TH");if(nextTD==null)tdElm.parentNode.appendChild(newTD);else nextTD.parentNode.insertBefore(newTD,nextTD);}else tdElm.colSpan++;lastTDElm=tdElm;}}break;case"mceTableDeleteCol":if(!trElm||!tdElm)return true;var grid=getTableGrid(tableElm);var cpos=getCellPos(grid,tdElm);var lastTDElm=null;if(grid.length>1&&grid[0].length<=1){tableElm.parentNode.removeChild(tableElm);return true;}for(var y=0;tdElm=getCell(grid,y,cpos.cellindex);y++){if(tdElm!=lastTDElm){var sd=getColRowSpan(tdElm);if(sd['colspan']>1)tdElm.colSpan=sd['colspan']-1;else{if(tdElm.parentNode)tdElm.parentNode.removeChild(tdElm);}lastTDElm=tdElm;}}cpos.cellindex--;if(cpos.cellindex<0)cpos.cellindex=0;inst.selection.selectNode(getCell(grid,0,cpos.cellindex),true,true);break;case"mceTableSplitCells":if(!trElm||!tdElm)return true;var spandata=getColRowSpan(tdElm);var colspan=spandata["colspan"];var rowspan=spandata["rowspan"];if(colspan>1||rowspan>1){tdElm.colSpan=1;for(var i=1;i<colspan;i++){var newTD=doc.createElement("td");newTD.innerHTML="&nbsp;";trElm.insertBefore(newTD,nextElm(tdElm,"TD,TH"));if(rowspan>1)addRows(newTD,trElm,rowspan);}addRows(tdElm,trElm,rowspan);}tableElm=tinyMCE.getParentElement(inst.getFocusElement(),"table");break;case"mceTableMergeCells":var rows=new Array();var sel=inst.getSel();var grid=getTableGrid(tableElm);if(tinyMCE.isMSIE||sel.rangeCount==1){if(user_interface){var template=new Array();var sp=getColRowSpan(tdElm);template['file']='../../plugins/table/merge_cells.htm';template['width']=250;template['height']=105+(tinyMCE.isNS7?25:0);template['width']+=tinyMCE.getLang('lang_table_merge_cells_delta_width',0);template['height']+=tinyMCE.getLang('lang_table_merge_cells_delta_height',0);tinyMCE.openWindow(template,{editor_id:inst.editorId,inline:"yes",action:"update",numcols:sp.colspan,numrows:sp.rowspan});return true;}else{var numRows=parseInt(value['numrows']);var numCols=parseInt(value['numcols']);var cpos=getCellPos(grid,tdElm);if((""+numRows)=="NaN")numRows=1;if((""+numCols)=="NaN")numCols=1;var tRows=tableElm.rows;for(var y=cpos.rowindex;y<grid.length;y++){var rowCells=new Array();for(var x=cpos.cellindex;x<grid[y].length;x++){var td=getCell(grid,y,x);if(td&&!inArray(rows,td)&&!inArray(rowCells,td)){var cp=getCellPos(grid,td);if(cp.cellindex<cpos.cellindex+numCols&&cp.rowindex<cpos.rowindex+numRows)rowCells[rowCells.length]=td;}}if(rowCells.length>0)rows[rows.length]=rowCells;}}}else{var cells=new Array();var sel=inst.getSel();var lastTR=null;var curRow=null;var x1=-1,y1=-1,x2,y2;if(sel.rangeCount<2)return true;for(var i=0;i<sel.rangeCount;i++){var rng=sel.getRangeAt(i);var tdElm=rng.startContainer.childNodes[rng.startOffset];if(!tdElm)break;if(tdElm.nodeName=="TD")cells[cells.length]=tdElm;}var tRows=tableElm.rows;for(var y=0;y<tRows.length;y++){var rowCells=new Array();for(var x=0;x<tRows[y].cells.length;x++){var td=tRows[y].cells[x];for(var i=0;i<cells.length;i++){if(td==cells[i]){rowCells[rowCells.length]=td;}}}if(rowCells.length>0)rows[rows.length]=rowCells;}var curRow=new Array();var lastTR=null;for(var y=0;y<grid.length;y++){for(var x=0;x<grid[y].length;x++){grid[y][x]._selected=false;for(var i=0;i<cells.length;i++){if(grid[y][x]==cells[i]){if(x1==-1){x1=x;y1=y;}x2=x;y2=y;grid[y][x]._selected=true;}}}}for(var y=y1;y<=y2;y++){for(var x=x1;x<=x2;x++){if(!grid[y][x]._selected){alert("Invalid selection for merge.");return true;}}}}var rowSpan=1,colSpan=1;var lastRowSpan=-1;for(var y=0;y<rows.length;y++){var rowColSpan=0;for(var x=0;x<rows[y].length;x++){var sd=getColRowSpan(rows[y][x]);rowColSpan+=sd['colspan'];if(lastRowSpan!=-1&&sd['rowspan']!=lastRowSpan){alert("Invalid selection for merge.");return true;}lastRowSpan=sd['rowspan'];}if(rowColSpan>colSpan)colSpan=rowColSpan;lastRowSpan=-1;}var lastColSpan=-1;for(var x=0;x<rows[0].length;x++){var colRowSpan=0;for(var y=0;y<rows.length;y++){var sd=getColRowSpan(rows[y][x]);colRowSpan+=sd['rowspan'];if(lastColSpan!=-1&&sd['colspan']!=lastColSpan){alert("Invalid selection for merge.");return true;}lastColSpan=sd['colspan'];}if(colRowSpan>rowSpan)rowSpan=colRowSpan;lastColSpan=-1;}tdElm=rows[0][0];tdElm.rowSpan=rowSpan;tdElm.colSpan=colSpan;for(var y=0;y<rows.length;y++){for(var x=0;x<rows[y].length;x++){var html=rows[y][x].innerHTML;var chk=tinyMCE.regexpReplace(html,"[ \t\r\n]","");if(chk!="<br/>"&&chk!="<br>"&&chk!="&nbsp;"&&(x+y>0))tdElm.innerHTML+=html;if(rows[y][x]!=tdElm&&!rows[y][x]._deleted){var cpos=getCellPos(grid,rows[y][x]);var tr=rows[y][x].parentNode;tr.removeChild(rows[y][x]);rows[y][x]._deleted=true;if(!tr.hasChildNodes()){tr.parentNode.removeChild(tr);var lastCell=null;for(var x=0;cellElm=getCell(grid,cpos.rowindex,x);x++){if(cellElm!=lastCell&&cellElm.rowSpan>1)cellElm.rowSpan--;lastCell=cellElm;}if(tdElm.rowSpan>1)tdElm.rowSpan--;}}}}break;}tableElm=tinyMCE.getParentElement(inst.getFocusElement(),"table");tinyMCE.handleVisualAid(tableElm,true,tinyMCE.settings['visual'],tinyMCE.selectedInstance);tinyMCE.triggerNodeChange();inst.repaint();}return true;}return false;}};tinyMCE.addPlugin("table",TinyMCE_TablePlugin); \ No newline at end of file
diff --git a/program/js/tiny_mce/plugins/table/editor_plugin_src.js b/program/js/tiny_mce/plugins/table/editor_plugin_src.js
new file mode 100644
index 000000000..4b512b42b
--- /dev/null
+++ b/program/js/tiny_mce/plugins/table/editor_plugin_src.js
@@ -0,0 +1,1054 @@
+/**
+ * $RCSfile: editor_plugin_src.js,v $
+ * $Revision: 1.38 $
+ * $Date: 2006/02/11 18:53:51 $
+ *
+ * @author Moxiecode
+ * @copyright Copyright © 2004-2006, Moxiecode Systems AB, All rights reserved.
+ */
+
+/* Import plugin specific language pack */
+tinyMCE.importPluginLanguagePack('table', 'en,tr,ar,cs,da,de,el,es,fi,fr_ca,hu,it,ja,ko,nl,nb,pl,pt,pt_br,sv,tw,zh_cn,fr,de,he,nb,ru,ru_KOI8-R,ru_UTF-8,nn,cy,is,zh_tw,zh_tw_utf8,sk');
+
+var TinyMCE_TablePlugin = {
+ getInfo : function() {
+ return {
+ longname : 'Tables',
+ author : 'Moxiecode Systems',
+ authorurl : 'http://tinymce.moxiecode.com',
+ infourl : 'http://tinymce.moxiecode.com/tinymce/docs/plugin_table.html',
+ version : tinyMCE.majorVersion + "." + tinyMCE.minorVersion
+ };
+ },
+
+ initInstance : function(inst) {
+ if (tinyMCE.isGecko) {
+ var doc = inst.getDoc();
+ tinyMCE.addEvent(doc, "mouseup", TinyMCE_TablePlugin._mouseDownHandler);
+ }
+
+ inst.tableRowClipboard = null;
+ },
+
+ /**
+ * Returns the HTML contents of the table control.
+ */
+ getControlHTML : function(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_col_after_desc', 'mceTableInsertColAfter'],
+ ['col_before', 'table_insert_col_before.gif', 'lang_table_col_before_desc', 'mceTableInsertColBefore'],
+ ['row_after', 'table_insert_row_after.gif', 'lang_table_row_after_desc', 'mceTableInsertRowAfter'],
+ ['row_before', 'table_insert_row_before.gif', 'lang_table_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],
+ ['split_cells', 'table_split_cells.gif', 'lang_table_split_cells_desc', 'mceTableSplitCells', true],
+ ['merge_cells', 'table_merge_cells.gif', 'lang_table_merge_cells_desc', 'mceTableMergeCells', true]);
+
+ // Render table control
+ for (var i=0; i<controls.length; i++) {
+ var but = controls[i];
+ var cmd = 'tinyMCE.execInstanceCommand(\'{$editor_id}\',\'' + but[3] + '\', ' + (but.length > 4 ? but[4] : false) + (but.length > 5 ? ', \'' + but[5] + '\'' : '') + ');return false;';
+
+ if (but[0] == control_name)
+ return tinyMCE.getButtonHTML(control_name, but[2], '{$pluginurl}/images/'+ but[1], but[3], (but.length > 4 ? but[4] : false));
+ }
+
+ // 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");
+ html += tinyMCE.getControlHTML("separator");
+ html += tinyMCE.getControlHTML("split_cells");
+ html += tinyMCE.getControlHTML("merge_cells");
+
+ return html;
+ }
+
+ return "";
+ },
+
+ /**
+ * Executes the table commands.
+ */
+ execCommand : function(editor_id, element, command, user_interface, value) {
+ // Is table command
+ switch (command) {
+ case "mceInsertTable":
+ case "mceTableRowProps":
+ case "mceTableCellProps":
+ case "mceTableSplitCells":
+ case "mceTableMergeCells":
+ case "mceTableInsertRowBefore":
+ case "mceTableInsertRowAfter":
+ case "mceTableDeleteRow":
+ case "mceTableInsertColBefore":
+ case "mceTableInsertColAfter":
+ case "mceTableDeleteCol":
+ case "mceTableCutRow":
+ case "mceTableCopyRow":
+ case "mceTablePasteRowBefore":
+ case "mceTablePasteRowAfter":
+ case "mceTableDelete":
+ var inst = tinyMCE.getInstanceById(editor_id);
+
+ inst.execCommand('mceBeginUndoLevel');
+ TinyMCE_TablePlugin._doExecCommand(editor_id, element, command, user_interface, value);
+ inst.execCommand('mceEndUndoLevel');
+
+ return true;
+ }
+
+ // Pass to next handler in chain
+ return false;
+ },
+
+ handleNodeChange : function(editor_id, node, undo_index, undo_levels, visual_aid, any_selection) {
+ var colspan = "1", rowspan = "1";
+
+ var inst = tinyMCE.getInstanceById(editor_id);
+
+ // Reset table controls
+ tinyMCE.switchClass(editor_id + '_table', 'mceButtonNormal');
+ tinyMCE.switchClass(editor_id + '_row_props', 'mceButtonDisabled');
+ tinyMCE.switchClass(editor_id + '_cell_props', 'mceButtonDisabled');
+ tinyMCE.switchClass(editor_id + '_row_before', 'mceButtonDisabled');
+ tinyMCE.switchClass(editor_id + '_row_after', 'mceButtonDisabled');
+ tinyMCE.switchClass(editor_id + '_delete_row', 'mceButtonDisabled');
+ tinyMCE.switchClass(editor_id + '_col_before', 'mceButtonDisabled');
+ tinyMCE.switchClass(editor_id + '_col_after', 'mceButtonDisabled');
+ tinyMCE.switchClass(editor_id + '_delete_col', 'mceButtonDisabled');
+ tinyMCE.switchClass(editor_id + '_split_cells', 'mceButtonDisabled');
+ tinyMCE.switchClass(editor_id + '_merge_cells', 'mceButtonDisabled');
+
+ // Within a td element
+ if (tdElm = tinyMCE.getParentElement(node, "td,th")) {
+ tinyMCE.switchClass(editor_id + '_cell_props', 'mceButtonSelected');
+ tinyMCE.switchClass(editor_id + '_row_before', 'mceButtonNormal');
+ tinyMCE.switchClass(editor_id + '_row_after', 'mceButtonNormal');
+ tinyMCE.switchClass(editor_id + '_delete_row', 'mceButtonNormal');
+ tinyMCE.switchClass(editor_id + '_col_before', 'mceButtonNormal');
+ tinyMCE.switchClass(editor_id + '_col_after', 'mceButtonNormal');
+ tinyMCE.switchClass(editor_id + '_delete_col', 'mceButtonNormal');
+
+ colspan = tinyMCE.getAttrib(tdElm, "colspan");
+ rowspan = tinyMCE.getAttrib(tdElm, "rowspan");
+
+ colspan = colspan == "" ? "1" : colspan;
+ rowspan = rowspan == "" ? "1" : rowspan;
+
+ if (colspan != "1" || rowspan != "1")
+ tinyMCE.switchClass(editor_id + '_split_cells', 'mceButtonNormal');
+ }
+
+ // Within a tr element
+ if (tinyMCE.getParentElement(node, "tr"))
+ tinyMCE.switchClass(editor_id + '_row_props', 'mceButtonSelected');
+
+ // Within table
+ if (tinyMCE.getParentElement(node, "table")) {
+ tinyMCE.switchClass(editor_id + '_table', 'mceButtonSelected');
+ tinyMCE.switchClass(editor_id + '_merge_cells', 'mceButtonNormal');
+ }
+ },
+
+ // Private plugin internal methods
+
+ _mouseDownHandler : function(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.nodeName == "TH" || (focusElm.parentNode && focusElm.parentNode.nodeName == "TD") ||(focusElm.parentNode && focusElm.parentNode.nodeName == "TH") )) {
+ window.setTimeout(function() {
+ var tableElm = tinyMCE.getParentElement(focusElm, "table");
+ tinyMCE.handleVisualAid(tableElm, true, tinyMCE.settings['visual'], tinyMCE.selectedInstance);
+ }, 10);
+ }
+ },
+
+ /**
+ * Executes the table commands.
+ */
+ _doExecCommand : function(editor_id, element, command, user_interface, value) {
+ var inst = tinyMCE.getInstanceById(editor_id);
+ var focusElm = inst.getFocusElement();
+ var trElm = tinyMCE.getParentElement(focusElm, "tr");
+ var tdElm = tinyMCE.getParentElement(focusElm, "td,th");
+ var tableElm = tinyMCE.getParentElement(focusElm, "table");
+ var doc = inst.contentWindow.document;
+ var tableBorder = tableElm ? tableElm.getAttribute("border") : "";
+
+ // Get first TD if no TD found
+ if (trElm && tdElm == null)
+ tdElm = trElm.cells[0];
+
+ // ------- Inner functions ---------
+ function inArray(ar, v) {
+ for (var i=0; i<ar.length; i++) {
+ // Is array
+ if (ar[i].length > 0 && inArray(ar[i], v))
+ return true;
+
+ // Found value
+ if (ar[i] == v)
+ return true;
+ }
+
+ return false;
+ }
+
+ function makeTD() {
+ var newTD = doc.createElement("td");
+ newTD.innerHTML = "&nbsp;";
+ }
+
+ function getColRowSpan(td) {
+ var colspan = tinyMCE.getAttrib(td, "colspan");
+ var rowspan = tinyMCE.getAttrib(td, "rowspan");
+
+ colspan = colspan == "" ? 1 : parseInt(colspan);
+ rowspan = rowspan == "" ? 1 : parseInt(rowspan);
+
+ return {colspan : colspan, rowspan : rowspan};
+ }
+
+ function getCellPos(grid, td) {
+ for (var y=0; y<grid.length; y++) {
+ for (var x=0; x<grid[y].length; x++) {
+ if (grid[y][x] == td)
+ return {cellindex : x, rowindex : y};
+ }
+ }
+
+ return null;
+ }
+
+ function getCell(grid, row, col) {
+ if (grid[row] && grid[row][col])
+ return grid[row][col];
+
+ return null;
+ }
+
+ function getTableGrid(table) {
+ var grid = new Array();
+ var rows = table.rows;
+
+ for (var y=0; y<rows.length; y++) {
+ for (var x=0; x<rows[y].cells.length; x++) {
+ var td = rows[y].cells[x];
+ var sd = getColRowSpan(td);
+
+ // All ready filled
+ for (xstart = x; grid[y] && grid[y][xstart]; xstart++) ;
+
+ // Fill box
+ for (var y2=y; y2<y+sd['rowspan']; y2++) {
+ if (!grid[y2])
+ grid[y2] = new Array();
+
+ for (var x2=xstart; x2<xstart+sd['colspan']; x2++) {
+ grid[y2][x2] = td;
+ }
+ }
+ }
+ }
+
+ return grid;
+ }
+
+ function trimRow(table, tr, td, new_tr) {
+ var grid = getTableGrid(table);
+ var cpos = getCellPos(grid, td);
+
+ // Time to crop away some
+ if (new_tr.cells.length != tr.childNodes.length) {
+ var cells = tr.childNodes;
+ var lastElm = null;
+
+ for (var x=0; td = getCell(grid, cpos.rowindex, x); x++) {
+ var remove = true;
+ var sd = getColRowSpan(td);
+
+ // Remove due to rowspan
+ if (inArray(cells, td)) {
+ new_tr.childNodes[x]._delete = true;
+ } else if ((lastElm == null || td != lastElm) && sd.colspan > 1) { // Remove due to colspan
+ for (var i=x; i<x+td.colSpan; i++)
+ new_tr.childNodes[i]._delete = true;
+ }
+
+ if ((lastElm == null || td != lastElm) && sd.rowspan > 1)
+ td.rowSpan = sd.rowspan + 1;
+
+ lastElm = td;
+ }
+
+ deleteMarked(tableElm);
+ }
+ }
+
+ function prevElm(node, name) {
+ while ((node = node.previousSibling) != null) {
+ if (node.nodeName == name)
+ return node;
+ }
+
+ return null;
+ }
+
+ function nextElm(node, names) {
+ var namesAr = names.split(',');
+
+ while ((node = node.nextSibling) != null) {
+ for (var i=0; i<namesAr.length; i++) {
+ if (node.nodeName.toLowerCase() == namesAr[i].toLowerCase() )
+ return node;
+ }
+ }
+
+ return null;
+ }
+
+ function deleteMarked(tbl) {
+ if (tbl.rows == 0)
+ return;
+
+ var tr = tbl.rows[0];
+ do {
+ var next = nextElm(tr, "TR");
+
+ // Delete row
+ if (tr._delete) {
+ tr.parentNode.removeChild(tr);
+ continue;
+ }
+
+ // Delete cells
+ var td = tr.cells[0];
+ if (td.cells > 1) {
+ do {
+ var nexttd = nextElm(td, "TD,TH");
+
+ if (td._delete)
+ td.parentNode.removeChild(td);
+ } while ((td = nexttd) != null);
+ }
+ } while ((tr = next) != null);
+ }
+
+ function addRows(td_elm, tr_elm, rowspan) {
+ // Add rows
+ td_elm.rowSpan = 1;
+ var trNext = nextElm(tr_elm, "TR");
+ for (var i=1; i<rowspan && trNext; i++) {
+ var newTD = doc.createElement("td");
+ newTD.innerHTML = "&nbsp;";
+
+ if (tinyMCE.isMSIE)
+ trNext.insertBefore(newTD, trNext.cells(td_elm.cellIndex));
+ else
+ trNext.insertBefore(newTD, trNext.cells[td_elm.cellIndex]);
+
+ trNext = nextElm(trNext, "TR");
+ }
+ }
+
+ function copyRow(doc, table, tr) {
+ var grid = getTableGrid(table);
+ var newTR = tr.cloneNode(false);
+ var cpos = getCellPos(grid, tr.cells[0]);
+ var lastCell = null;
+ var tableBorder = tinyMCE.getAttrib(table, "border");
+ var tdElm = null;
+
+ for (var x=0; tdElm = getCell(grid, cpos.rowindex, x); x++) {
+ var newTD = null;
+
+ if (lastCell != tdElm) {
+ for (var i=0; i<tr.cells.length; i++) {
+ if (tdElm == tr.cells[i]) {
+ newTD = tdElm.cloneNode(true);
+ break;
+ }
+ }
+ }
+
+ if (newTD == null) {
+ newTD = doc.createElement("td");
+ newTD.innerHTML = "&nbsp;";
+ }
+
+ // Reset col/row span
+ newTD.colSpan = 1;
+ newTD.rowSpan = 1;
+
+ newTR.appendChild(newTD);
+
+ lastCell = tdElm;
+ }
+
+ return newTR;
+ }
+
+ // ---- Commands -----
+
+ // 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';
+ template['width'] = 380;
+ template['height'] = 295;
+
+ // Language specific width and height addons
+ template['width'] += tinyMCE.getLang('lang_table_rowprops_delta_width', 0);
+ template['height'] += tinyMCE.getLang('lang_table_rowprops_delta_height', 0);
+
+ // Open window
+ tinyMCE.openWindow(template, {editor_id : inst.editorId, inline : "yes"});
+ }
+
+ return true;
+
+ case "mceTableCellProps":
+ if (tdElm == null)
+ return true;
+
+ if (user_interface) {
+ // Setup template
+ var template = new Array();
+
+ template['file'] = '../../plugins/table/cell.htm';
+ template['width'] = 380;
+ template['height'] = 295;
+
+ // Language specific width and height addons
+ template['width'] += tinyMCE.getLang('lang_table_cellprops_delta_width', 0);
+ template['height'] += tinyMCE.getLang('lang_table_cellprops_delta_height', 0);
+
+ // Open window
+ tinyMCE.openWindow(template, {editor_id : inst.editorId, inline : "yes"});
+ }
+
+ return true;
+
+ case "mceInsertTable":
+ if (user_interface) {
+ // Setup template
+ var template = new Array();
+
+ template['file'] = '../../plugins/table/table.htm';
+ template['width'] = 380;
+ template['height'] = 295;
+
+ // Language specific width and height addons
+ template['width'] += tinyMCE.getLang('lang_table_table_delta_width', 0);
+ template['height'] += tinyMCE.getLang('lang_table_table_delta_height', 0);
+
+ // Open window
+ tinyMCE.openWindow(template, {editor_id : inst.editorId, inline : "yes", action : value});
+ }
+
+ return true;
+
+ case "mceTableDelete":
+ var table = tinyMCE.getParentElement(inst.getFocusElement(), "table");
+ if (table) {
+ table.parentNode.removeChild(table);
+ inst.repaint();
+ }
+ return true;
+
+ case "mceTableSplitCells":
+ case "mceTableMergeCells":
+ case "mceTableInsertRowBefore":
+ case "mceTableInsertRowAfter":
+ case "mceTableDeleteRow":
+ case "mceTableInsertColBefore":
+ case "mceTableInsertColAfter":
+ case "mceTableDeleteCol":
+ case "mceTableCutRow":
+ case "mceTableCopyRow":
+ case "mceTablePasteRowBefore":
+ case "mceTablePasteRowAfter":
+ // No table just return (invalid command)
+ if (!tableElm)
+ return true;
+
+ // Table has a tbody use that reference
+ // Changed logic by ApTest 2005.07.12 (www.aptest.com)
+ // Now lookk at the focused element and take its parentNode. That will be a tbody or a table.
+ if (tableElm != trElm.parentNode)
+ tableElm = trElm.parentNode;
+
+ if (tableElm && trElm) {
+ switch (command) {
+ case "mceTableInsertRowBefore":
+ if (!trElm || !tdElm)
+ return true;
+
+ var grid = getTableGrid(tableElm);
+ var cpos = getCellPos(grid, tdElm);
+ var newTR = doc.createElement("tr");
+ var lastTDElm = null;
+
+ cpos.rowindex--;
+ if (cpos.rowindex < 0)
+ cpos.rowindex = 0;
+
+ // Create cells
+ for (var x=0; tdElm = getCell(grid, cpos.rowindex, x); x++) {
+ if (tdElm != lastTDElm) {
+ var sd = getColRowSpan(tdElm);
+
+ if (sd['rowspan'] == 1) {
+ var newTD = doc.createElement("td");
+
+ newTD.innerHTML = "&nbsp;";
+ newTD.colSpan = tdElm.colSpan;
+
+ newTR.appendChild(newTD);
+ } else
+ tdElm.rowSpan = sd['rowspan'] + 1;
+
+ lastTDElm = tdElm;
+ }
+ }
+
+ trElm.parentNode.insertBefore(newTR, trElm);
+ break;
+
+ case "mceTableCutRow":
+ if (!trElm || !tdElm)
+ return true;
+
+ inst.tableRowClipboard = copyRow(doc, tableElm, trElm);
+ inst.execCommand("mceTableDeleteRow");
+ break;
+
+ case "mceTableCopyRow":
+ if (!trElm || !tdElm)
+ return true;
+
+ inst.tableRowClipboard = copyRow(doc, tableElm, trElm);
+ break;
+
+ case "mceTablePasteRowBefore":
+ if (!trElm || !tdElm)
+ return true;
+
+ var newTR = inst.tableRowClipboard.cloneNode(true);
+
+ var prevTR = prevElm(trElm, "TR");
+ if (prevTR != null)
+ trimRow(tableElm, prevTR, prevTR.cells[0], newTR);
+
+ trElm.parentNode.insertBefore(newTR, trElm);
+ break;
+
+ case "mceTablePasteRowAfter":
+ if (!trElm || !tdElm)
+ return true;
+
+ var nextTR = nextElm(trElm, "TR");
+ var newTR = inst.tableRowClipboard.cloneNode(true);
+
+ trimRow(tableElm, trElm, tdElm, newTR);
+
+ if (nextTR == null)
+ trElm.parentNode.appendChild(newTR);
+ else
+ nextTR.parentNode.insertBefore(newTR, nextTR);
+
+ break;
+
+ case "mceTableInsertRowAfter":
+ if (!trElm || !tdElm)
+ return true;
+
+ var grid = getTableGrid(tableElm);
+ var cpos = getCellPos(grid, tdElm);
+ var newTR = doc.createElement("tr");
+ var lastTDElm = null;
+
+ // Create cells
+ for (var x=0; tdElm = getCell(grid, cpos.rowindex, x); x++) {
+ if (tdElm != lastTDElm) {
+ var sd = getColRowSpan(tdElm);
+
+ if (sd['rowspan'] == 1) {
+ var newTD = doc.createElement("td");
+
+ newTD.innerHTML = "&nbsp;";
+ newTD.colSpan = tdElm.colSpan;
+
+ newTR.appendChild(newTD);
+ } else
+ tdElm.rowSpan = sd['rowspan'] + 1;
+
+ lastTDElm = tdElm;
+ }
+ }
+
+ if (newTR.hasChildNodes()) {
+ var nextTR = nextElm(trElm, "TR");
+ if (nextTR)
+ nextTR.parentNode.insertBefore(newTR, nextTR);
+ else
+ tableElm.appendChild(newTR);
+ }
+ break;
+
+ case "mceTableDeleteRow":
+ if (!trElm || !tdElm)
+ return true;
+
+ var grid = getTableGrid(tableElm);
+ var cpos = getCellPos(grid, tdElm);
+
+ // Only one row, remove whole table
+ if (grid.length == 1) {
+ tableElm.parentNode.removeChild(tableElm);
+ return true;
+ }
+
+ // Move down row spanned cells
+ var cells = trElm.cells;
+ var nextTR = nextElm(trElm, "TR");
+ for (var x=0; x<cells.length; x++) {
+ if (cells[x].rowSpan > 1) {
+ var newTD = cells[x].cloneNode(true);
+ var sd = getColRowSpan(cells[x]);
+
+ newTD.rowSpan = sd.rowspan - 1;
+
+ var nextTD = nextTR.cells[x];
+
+ if (nextTD == null)
+ nextTR.appendChild(newTD);
+ else
+ nextTR.insertBefore(newTD, nextTD);
+ }
+ }
+
+ // Delete cells
+ var lastTDElm = null;
+ for (var x=0; tdElm = getCell(grid, cpos.rowindex, x); x++) {
+ if (tdElm != lastTDElm) {
+ var sd = getColRowSpan(tdElm);
+
+ if (sd.rowspan > 1) {
+ tdElm.rowSpan = sd.rowspan - 1;
+ } else {
+ trElm = tdElm.parentNode;
+
+ if (trElm.parentNode)
+ trElm._delete = true;
+ }
+
+ lastTDElm = tdElm;
+ }
+ }
+
+ deleteMarked(tableElm);
+
+ cpos.rowindex--;
+ if (cpos.rowindex < 0)
+ cpos.rowindex = 0;
+
+ inst.selection.selectNode(getCell(grid, cpos.rowindex, 0), true, true);
+ break;
+
+ case "mceTableInsertColBefore":
+ if (!trElm || !tdElm)
+ return true;
+
+ var grid = getTableGrid(tableElm);
+ var cpos = getCellPos(grid, tdElm);
+ var lastTDElm = null;
+
+ for (var y=0; tdElm = getCell(grid, y, cpos.cellindex); y++) {
+ if (tdElm != lastTDElm) {
+ var sd = getColRowSpan(tdElm);
+
+ if (sd['colspan'] == 1) {
+ var newTD = doc.createElement(tdElm.nodeName);
+
+ newTD.innerHTML = "&nbsp;";
+ newTD.rowSpan = tdElm.rowSpan;
+
+ tdElm.parentNode.insertBefore(newTD, tdElm);
+ } else
+ tdElm.colSpan++;
+
+ lastTDElm = tdElm;
+ }
+ }
+ break;
+
+ case "mceTableInsertColAfter":
+ if (!trElm || !tdElm)
+ return true;
+
+ var grid = getTableGrid(tableElm);
+ var cpos = getCellPos(grid, tdElm);
+ var lastTDElm = null;
+
+ for (var y=0; tdElm = getCell(grid, y, cpos.cellindex); y++) {
+ if (tdElm != lastTDElm) {
+ var sd = getColRowSpan(tdElm);
+
+ if (sd['colspan'] == 1) {
+ var newTD = doc.createElement(tdElm.nodeName);
+
+ newTD.innerHTML = "&nbsp;";
+ newTD.rowSpan = tdElm.rowSpan;
+
+ var nextTD = nextElm(tdElm, "TD,TH");
+ if (nextTD == null)
+ tdElm.parentNode.appendChild(newTD);
+ else
+ nextTD.parentNode.insertBefore(newTD, nextTD);
+ } else
+ tdElm.colSpan++;
+
+ lastTDElm = tdElm;
+ }
+ }
+ break;
+
+ case "mceTableDeleteCol":
+ if (!trElm || !tdElm)
+ return true;
+
+ var grid = getTableGrid(tableElm);
+ var cpos = getCellPos(grid, tdElm);
+ var lastTDElm = null;
+
+ // Only one col, remove whole table
+ if (grid.length > 1 && grid[0].length <= 1) {
+ tableElm.parentNode.removeChild(tableElm);
+ return true;
+ }
+
+ // Delete cells
+ for (var y=0; tdElm = getCell(grid, y, cpos.cellindex); y++) {
+ if (tdElm != lastTDElm) {
+ var sd = getColRowSpan(tdElm);
+
+ if (sd['colspan'] > 1)
+ tdElm.colSpan = sd['colspan'] - 1;
+ else {
+ if (tdElm.parentNode)
+ tdElm.parentNode.removeChild(tdElm);
+ }
+
+ lastTDElm = tdElm;
+ }
+ }
+
+ cpos.cellindex--;
+ if (cpos.cellindex < 0)
+ cpos.cellindex = 0;
+
+ inst.selection.selectNode(getCell(grid, 0, cpos.cellindex), true, true);
+ break;
+
+ case "mceTableSplitCells":
+ if (!trElm || !tdElm)
+ return true;
+
+ var spandata = getColRowSpan(tdElm);
+
+ var colspan = spandata["colspan"];
+ var rowspan = spandata["rowspan"];
+
+ // Needs splitting
+ if (colspan > 1 || rowspan > 1) {
+ // Generate cols
+ tdElm.colSpan = 1;
+ for (var i=1; i<colspan; i++) {
+ var newTD = doc.createElement("td");
+
+ newTD.innerHTML = "&nbsp;";
+
+ trElm.insertBefore(newTD, nextElm(tdElm, "TD,TH"));
+
+ if (rowspan > 1)
+ addRows(newTD, trElm, rowspan);
+ }
+
+ addRows(tdElm, trElm, rowspan);
+ }
+
+ // Apply visual aids
+ tableElm = tinyMCE.getParentElement(inst.getFocusElement(), "table");
+ break;
+
+ case "mceTableMergeCells":
+ var rows = new Array();
+ var sel = inst.getSel();
+ var grid = getTableGrid(tableElm);
+
+ if (tinyMCE.isMSIE || sel.rangeCount == 1) {
+ if (user_interface) {
+ // Setup template
+ var template = new Array();
+ var sp = getColRowSpan(tdElm);
+
+ template['file'] = '../../plugins/table/merge_cells.htm';
+ template['width'] = 250;
+ template['height'] = 105 + (tinyMCE.isNS7 ? 25 : 0);
+
+ // Language specific width and height addons
+ template['width'] += tinyMCE.getLang('lang_table_merge_cells_delta_width', 0);
+ template['height'] += tinyMCE.getLang('lang_table_merge_cells_delta_height', 0);
+
+ // Open window
+ tinyMCE.openWindow(template, {editor_id : inst.editorId, inline : "yes", action : "update", numcols : sp.colspan, numrows : sp.rowspan});
+
+ return true;
+ } else {
+ var numRows = parseInt(value['numrows']);
+ var numCols = parseInt(value['numcols']);
+ var cpos = getCellPos(grid, tdElm);
+
+ if (("" + numRows) == "NaN")
+ numRows = 1;
+
+ if (("" + numCols) == "NaN")
+ numCols = 1;
+
+ // Get rows and cells
+ var tRows = tableElm.rows;
+ for (var y=cpos.rowindex; y<grid.length; y++) {
+ var rowCells = new Array();
+
+ for (var x=cpos.cellindex; x<grid[y].length; x++) {
+ var td = getCell(grid, y, x);
+
+ if (td && !inArray(rows, td) && !inArray(rowCells, td)) {
+ var cp = getCellPos(grid, td);
+
+ // Within range
+ if (cp.cellindex < cpos.cellindex+numCols && cp.rowindex < cpos.rowindex+numRows)
+ rowCells[rowCells.length] = td;
+ }
+ }
+
+ if (rowCells.length > 0)
+ rows[rows.length] = rowCells;
+ }
+
+ //return true;
+ }
+ } else {
+ var cells = new Array();
+ var sel = inst.getSel();
+ var lastTR = null;
+ var curRow = null;
+ var x1 = -1, y1 = -1, x2, y2;
+
+ // Only one cell selected, whats the point?
+ if (sel.rangeCount < 2)
+ return true;
+
+ // Get all selected cells
+ for (var i=0; i<sel.rangeCount; i++) {
+ var rng = sel.getRangeAt(i);
+ var tdElm = rng.startContainer.childNodes[rng.startOffset];
+
+ if (!tdElm)
+ break;
+
+ if (tdElm.nodeName == "TD")
+ cells[cells.length] = tdElm;
+ }
+
+ // Get rows and cells
+ var tRows = tableElm.rows;
+ for (var y=0; y<tRows.length; y++) {
+ var rowCells = new Array();
+
+ for (var x=0; x<tRows[y].cells.length; x++) {
+ var td = tRows[y].cells[x];
+
+ for (var i=0; i<cells.length; i++) {
+ if (td == cells[i]) {
+ rowCells[rowCells.length] = td;
+ }
+ }
+ }
+
+ if (rowCells.length > 0)
+ rows[rows.length] = rowCells;
+ }
+
+ // Find selected cells in grid and box
+ var curRow = new Array();
+ var lastTR = null;
+ for (var y=0; y<grid.length; y++) {
+ for (var x=0; x<grid[y].length; x++) {
+ grid[y][x]._selected = false;
+
+ for (var i=0; i<cells.length; i++) {
+ if (grid[y][x] == cells[i]) {
+ // Get start pos
+ if (x1 == -1) {
+ x1 = x;
+ y1 = y;
+ }
+
+ // Get end pos
+ x2 = x;
+ y2 = y;
+
+ grid[y][x]._selected = true;
+ }
+ }
+ }
+ }
+
+ // Is there gaps, if so deny
+ for (var y=y1; y<=y2; y++) {
+ for (var x=x1; x<=x2; x++) {
+ if (!grid[y][x]._selected) {
+ alert("Invalid selection for merge.");
+ return true;
+ }
+ }
+ }
+ }
+
+ // Validate selection and get total rowspan and colspan
+ var rowSpan = 1, colSpan = 1;
+
+ // Validate horizontal and get total colspan
+ var lastRowSpan = -1;
+ for (var y=0; y<rows.length; y++) {
+ var rowColSpan = 0;
+
+ for (var x=0; x<rows[y].length; x++) {
+ var sd = getColRowSpan(rows[y][x]);
+
+ rowColSpan += sd['colspan'];
+
+ if (lastRowSpan != -1 && sd['rowspan'] != lastRowSpan) {
+ alert("Invalid selection for merge.");
+ return true;
+ }
+
+ lastRowSpan = sd['rowspan'];
+ }
+
+ if (rowColSpan > colSpan)
+ colSpan = rowColSpan;
+
+ lastRowSpan = -1;
+ }
+
+ // Validate vertical and get total rowspan
+ var lastColSpan = -1;
+ for (var x=0; x<rows[0].length; x++) {
+ var colRowSpan = 0;
+
+ for (var y=0; y<rows.length; y++) {
+ var sd = getColRowSpan(rows[y][x]);
+
+ colRowSpan += sd['rowspan'];
+
+ if (lastColSpan != -1 && sd['colspan'] != lastColSpan) {
+ alert("Invalid selection for merge.");
+ return true;
+ }
+
+ lastColSpan = sd['colspan'];
+ }
+
+ if (colRowSpan > rowSpan)
+ rowSpan = colRowSpan;
+
+ lastColSpan = -1;
+ }
+
+ // Setup td
+ tdElm = rows[0][0];
+ tdElm.rowSpan = rowSpan;
+ tdElm.colSpan = colSpan;
+
+ // Merge cells
+ for (var y=0; y<rows.length; y++) {
+ for (var x=0; x<rows[y].length; x++) {
+ var html = rows[y][x].innerHTML;
+ var chk = tinyMCE.regexpReplace(html, "[ \t\r\n]", "");
+
+ if (chk != "<br/>" && chk != "<br>" && chk != "&nbsp;" && (x+y > 0))
+ tdElm.innerHTML += html;
+
+ // Not current cell
+ if (rows[y][x] != tdElm && !rows[y][x]._deleted) {
+ var cpos = getCellPos(grid, rows[y][x]);
+ var tr = rows[y][x].parentNode;
+
+ tr.removeChild(rows[y][x]);
+ rows[y][x]._deleted = true;
+
+ // Empty TR, remove it
+ if (!tr.hasChildNodes()) {
+ tr.parentNode.removeChild(tr);
+
+ var lastCell = null;
+ for (var x=0; cellElm = getCell(grid, cpos.rowindex, x); x++) {
+ if (cellElm != lastCell && cellElm.rowSpan > 1)
+ cellElm.rowSpan--;
+
+ lastCell = cellElm;
+ }
+
+ if (tdElm.rowSpan > 1)
+ tdElm.rowSpan--;
+ }
+ }
+ }
+ }
+
+ break;
+ }
+
+ tableElm = tinyMCE.getParentElement(inst.getFocusElement(), "table");
+ tinyMCE.handleVisualAid(tableElm, true, tinyMCE.settings['visual'], tinyMCE.selectedInstance);
+ tinyMCE.triggerNodeChange();
+ inst.repaint();
+ }
+
+ return true;
+ }
+
+ // Pass to next handler in chain
+ return false;
+ }
+};
+
+tinyMCE.addPlugin("table", TinyMCE_TablePlugin);
diff --git a/program/js/tiny_mce/plugins/table/images/buttons.gif b/program/js/tiny_mce/plugins/table/images/buttons.gif
new file mode 100644
index 000000000..bfc1568be
--- /dev/null
+++ b/program/js/tiny_mce/plugins/table/images/buttons.gif
Binary files differ
diff --git a/program/js/tiny_mce/plugins/table/images/table.gif b/program/js/tiny_mce/plugins/table/images/table.gif
new file mode 100644
index 000000000..2911830c3
--- /dev/null
+++ b/program/js/tiny_mce/plugins/table/images/table.gif
Binary files differ
diff --git a/program/js/tiny_mce/plugins/table/images/table_cell_props.gif b/program/js/tiny_mce/plugins/table/images/table_cell_props.gif
new file mode 100644
index 000000000..bee7ed652
--- /dev/null
+++ b/program/js/tiny_mce/plugins/table/images/table_cell_props.gif
Binary files differ
diff --git a/program/js/tiny_mce/plugins/table/images/table_delete.gif b/program/js/tiny_mce/plugins/table/images/table_delete.gif
new file mode 100644
index 000000000..2a00e6ad6
--- /dev/null
+++ b/program/js/tiny_mce/plugins/table/images/table_delete.gif
Binary files differ
diff --git a/program/js/tiny_mce/plugins/table/images/table_delete_col.gif b/program/js/tiny_mce/plugins/table/images/table_delete_col.gif
new file mode 100644
index 000000000..91f53af02
--- /dev/null
+++ b/program/js/tiny_mce/plugins/table/images/table_delete_col.gif
Binary files differ
diff --git a/program/js/tiny_mce/plugins/table/images/table_delete_row.gif b/program/js/tiny_mce/plugins/table/images/table_delete_row.gif
new file mode 100644
index 000000000..7025733fe
--- /dev/null
+++ b/program/js/tiny_mce/plugins/table/images/table_delete_row.gif
Binary files differ
diff --git a/program/js/tiny_mce/plugins/table/images/table_insert_col_after.gif b/program/js/tiny_mce/plugins/table/images/table_insert_col_after.gif
new file mode 100644
index 000000000..85058080c
--- /dev/null
+++ b/program/js/tiny_mce/plugins/table/images/table_insert_col_after.gif
Binary files differ
diff --git a/program/js/tiny_mce/plugins/table/images/table_insert_col_before.gif b/program/js/tiny_mce/plugins/table/images/table_insert_col_before.gif
new file mode 100644
index 000000000..b669d4fa6
--- /dev/null
+++ b/program/js/tiny_mce/plugins/table/images/table_insert_col_before.gif
Binary files differ
diff --git a/program/js/tiny_mce/plugins/table/images/table_insert_row_after.gif b/program/js/tiny_mce/plugins/table/images/table_insert_row_after.gif
new file mode 100644
index 000000000..b9c144661
--- /dev/null
+++ b/program/js/tiny_mce/plugins/table/images/table_insert_row_after.gif
Binary files differ
diff --git a/program/js/tiny_mce/plugins/table/images/table_insert_row_before.gif b/program/js/tiny_mce/plugins/table/images/table_insert_row_before.gif
new file mode 100644
index 000000000..157d37365
--- /dev/null
+++ b/program/js/tiny_mce/plugins/table/images/table_insert_row_before.gif
Binary files differ
diff --git a/program/js/tiny_mce/plugins/table/images/table_merge_cells.gif b/program/js/tiny_mce/plugins/table/images/table_merge_cells.gif
new file mode 100644
index 000000000..6834e611e
--- /dev/null
+++ b/program/js/tiny_mce/plugins/table/images/table_merge_cells.gif
Binary files differ
diff --git a/program/js/tiny_mce/plugins/table/images/table_row_props.gif b/program/js/tiny_mce/plugins/table/images/table_row_props.gif
new file mode 100644
index 000000000..e5c7cc37a
--- /dev/null
+++ b/program/js/tiny_mce/plugins/table/images/table_row_props.gif
Binary files differ
diff --git a/program/js/tiny_mce/plugins/table/images/table_split_cells.gif b/program/js/tiny_mce/plugins/table/images/table_split_cells.gif
new file mode 100644
index 000000000..8ccb1b5f8
--- /dev/null
+++ b/program/js/tiny_mce/plugins/table/images/table_split_cells.gif
Binary files differ
diff --git a/program/js/tiny_mce/plugins/table/jscripts/cell.js b/program/js/tiny_mce/plugins/table/jscripts/cell.js
new file mode 100644
index 000000000..436eaad17
--- /dev/null
+++ b/program/js/tiny_mce/plugins/table/jscripts/cell.js
@@ -0,0 +1,249 @@
+function init() {
+ tinyMCEPopup.resizeToInnerSize();
+
+ document.getElementById('backgroundimagebrowsercontainer').innerHTML = getBrowserHTML('backgroundimagebrowser','backgroundimage','image','table');
+ document.getElementById('bordercolor_pickcontainer').innerHTML = getColorPickerHTML('bordercolor_pick','bordercolor');
+ document.getElementById('bgcolor_pickcontainer').innerHTML = getColorPickerHTML('bgcolor_pick','bgcolor')
+
+ var inst = tinyMCE.selectedInstance;
+ var tdElm = tinyMCE.getParentElement(inst.getFocusElement(), "td,th");
+ var formObj = document.forms[0];
+ var st = tinyMCE.parseStyle(tinyMCE.getAttrib(tdElm, "style"));
+
+ // Get table cell data
+ var celltype = tdElm.nodeName.toLowerCase();
+ var align = tinyMCE.getAttrib(tdElm, 'align');
+ var valign = tinyMCE.getAttrib(tdElm, 'valign');
+ var width = trimSize(getStyle(tdElm, 'width', 'width'));
+ var height = trimSize(getStyle(tdElm, 'height', 'height'));
+ var bordercolor = convertRGBToHex(getStyle(tdElm, 'bordercolor', 'borderLeftColor'));
+ var bgcolor = convertRGBToHex(getStyle(tdElm, 'bgcolor', 'backgroundColor'));
+ var className = tinyMCE.getVisualAidClass(tinyMCE.getAttrib(tdElm, 'class'), false);
+ var backgroundimage = getStyle(tdElm, 'background', 'backgroundImage').replace(new RegExp("url\\('?([^']*)'?\\)", 'gi'), "$1");;
+ var id = tinyMCE.getAttrib(tdElm, 'id');
+ var lang = tinyMCE.getAttrib(tdElm, 'lang');
+ var dir = tinyMCE.getAttrib(tdElm, 'dir');
+ var scope = tinyMCE.getAttrib(tdElm, 'scope');
+
+ // Setup form
+ addClassesToList('class', 'table_cell_styles');
+ formObj.bordercolor.value = bordercolor;
+ formObj.bgcolor.value = bgcolor;
+ formObj.backgroundimage.value = backgroundimage;
+ formObj.width.value = width;
+ formObj.height.value = height;
+ formObj.id.value = id;
+ formObj.lang.value = lang;
+ formObj.style.value = tinyMCE.serializeStyle(st);
+ selectByValue(formObj, 'align', align);
+ selectByValue(formObj, 'valign', valign);
+ selectByValue(formObj, 'class', className);
+ selectByValue(formObj, 'celltype', celltype);
+ selectByValue(formObj, 'dir', dir);
+ selectByValue(formObj, 'scope', scope);
+
+ // Resize some elements
+ if (isVisible('backgroundimagebrowser'))
+ document.getElementById('backgroundimage').style.width = '180px';
+
+ updateColor('bordercolor_pick', 'bordercolor');
+ updateColor('bgcolor_pick', 'bgcolor');
+}
+
+function updateAction() {
+ tinyMCEPopup.restoreSelection();
+
+ var inst = tinyMCE.selectedInstance;
+ var tdElm = tinyMCE.getParentElement(inst.getFocusElement(), "td,th");
+ var trElm = tinyMCE.getParentElement(inst.getFocusElement(), "tr");
+ var tableElm = tinyMCE.getParentElement(inst.getFocusElement(), "table");
+ var formObj = document.forms[0];
+
+ inst.execCommand('mceBeginUndoLevel');
+
+ switch (getSelectValue(formObj, 'action')) {
+ case "cell":
+ var celltype = getSelectValue(formObj, 'celltype');
+ var scope = getSelectValue(formObj, 'scope');
+
+ if (tinyMCE.getParam("accessibility_warnings")) {
+ if (celltype == "th" && scope == "")
+ var answer = confirm(tinyMCE.getLang('lang_table_missing_scope', '', true));
+ else
+ var answer = true;
+
+ if (!answer)
+ return;
+ }
+
+ updateCell(tdElm);
+ break;
+
+ case "row":
+ var cell = trElm.firstChild;
+
+ if (cell.nodeName != "TD" && cell.nodeName != "TH")
+ cell = nextCell(cell);
+
+ do {
+ cell = updateCell(cell, true);
+ } while ((cell = nextCell(cell)) != null);
+
+ break;
+
+ case "all":
+ var rows = tableElm.getElementsByTagName("tr");
+
+ for (var i=0; i<rows.length; i++) {
+ var cell = rows[i].firstChild;
+
+ if (cell.nodeName != "TD" && cell.nodeName != "TH")
+ cell = nextCell(cell);
+
+ do {
+ cell = updateCell(cell, true);
+ } while ((cell = nextCell(cell)) != null);
+ }
+
+ break;
+ }
+
+ tinyMCE.handleVisualAid(inst.getBody(), true, inst.visualAid, inst);
+ tinyMCE.triggerNodeChange();
+ inst.execCommand('mceEndUndoLevel');
+ tinyMCEPopup.close();
+}
+
+function nextCell(elm) {
+ while ((elm = elm.nextSibling) != null) {
+ if (elm.nodeName == "TD" || elm.nodeName == "TH")
+ return elm;
+ }
+
+ return null;
+}
+
+function updateCell(td, skip_id) {
+ var inst = tinyMCE.selectedInstance;
+ var formObj = document.forms[0];
+ var curCellType = td.nodeName.toLowerCase();
+ var celltype = getSelectValue(formObj, 'celltype');
+ var doc = inst.getDoc();
+
+ if (!skip_id)
+ td.setAttribute('id', formObj.id.value);
+
+ td.setAttribute('align', formObj.align.value);
+ td.setAttribute('vAlign', formObj.valign.value);
+ td.setAttribute('lang', formObj.lang.value);
+ td.setAttribute('dir', getSelectValue(formObj, 'dir'));
+ td.setAttribute('style', tinyMCE.serializeStyle(tinyMCE.parseStyle(formObj.style.value)));
+ td.setAttribute('scope', formObj.scope.value);
+ tinyMCE.setAttrib(td, 'class', getSelectValue(formObj, 'class'));
+
+ // Clear deprecated attributes
+ tinyMCE.setAttrib(td, 'width', '');
+ tinyMCE.setAttrib(td, 'height', '');
+ tinyMCE.setAttrib(td, 'bgColor', '');
+ tinyMCE.setAttrib(td, 'borderColor', '');
+ tinyMCE.setAttrib(td, 'background', '');
+
+ // Set styles
+ td.style.width = getCSSSize(formObj.width.value);
+ td.style.height = getCSSSize(formObj.height.value);
+ if (formObj.bordercolor.value != "") {
+ td.style.borderColor = formObj.bordercolor.value;
+ td.style.borderStyle = td.style.borderStyle == "" ? "solid" : td.style.borderStyle;
+ td.style.borderWidth = td.style.borderWidth == "" ? "1px" : td.style.borderWidth;
+ } else
+ td.style.borderColor = '';
+
+ td.style.backgroundColor = formObj.bgcolor.value;
+
+ if (formObj.backgroundimage.value != "")
+ td.style.backgroundImage = "url('" + formObj.backgroundimage.value + "')";
+ else
+ td.style.backgroundImage = '';
+
+ if (curCellType != celltype) {
+ // changing to a different node type
+ var newCell = doc.createElement(celltype);
+
+ for (var c=0; c<td.childNodes.length; c++)
+ newCell.appendChild(td.childNodes[c].cloneNode(1));
+
+ for (var a=0; a<td.attributes.length; a++) {
+ var attr = td.attributes[a];
+ newCell.setAttribute(attr.name, attr.value);
+ }
+
+ td.parentNode.replaceChild(newCell, td);
+ td = newCell;
+ }
+
+ return td;
+}
+
+function changedBackgroundImage() {
+ var formObj = document.forms[0];
+ var st = tinyMCE.parseStyle(formObj.style.value);
+
+ st['background-image'] = "url('" + formObj.backgroundimage.value + "')";
+
+ formObj.style.value = tinyMCE.serializeStyle(st);
+}
+
+function changedSize() {
+ var formObj = document.forms[0];
+ var st = tinyMCE.parseStyle(formObj.style.value);
+
+ var width = formObj.width.value;
+ if (width != "")
+ st['width'] = getCSSSize(width);
+ else
+ st['width'] = "";
+
+ var height = formObj.height.value;
+ if (height != "")
+ st['height'] = getCSSSize(height);
+ else
+ st['height'] = "";
+
+ formObj.style.value = tinyMCE.serializeStyle(st);
+}
+
+function changedColor() {
+ var formObj = document.forms[0];
+ var st = tinyMCE.parseStyle(formObj.style.value);
+
+ st['background-color'] = formObj.bgcolor.value;
+ st['border-color'] = formObj.bordercolor.value;
+
+ formObj.style.value = tinyMCE.serializeStyle(st);
+}
+
+function changedStyle() {
+ var formObj = document.forms[0];
+ var st = tinyMCE.parseStyle(formObj.style.value);
+
+ if (st['background-image'])
+ formObj.backgroundimage.value = st['background-image'].replace(new RegExp("url\\('?([^']*)'?\\)", 'gi'), "$1");
+ else
+ formObj.backgroundimage.value = '';
+
+ if (st['width'])
+ formObj.width.value = trimSize(st['width']);
+
+ if (st['height'])
+ formObj.height.value = trimSize(st['height']);
+
+ if (st['background-color']) {
+ formObj.bgcolor.value = st['background-color'];
+ updateColor('bgcolor_pick','bgcolor');
+ }
+
+ if (st['border-color']) {
+ formObj.bordercolor.value = st['border-color'];
+ updateColor('bordercolor_pick','bordercolor');
+ }
+}
diff --git a/program/js/tiny_mce/plugins/table/jscripts/merge_cells.js b/program/js/tiny_mce/plugins/table/jscripts/merge_cells.js
new file mode 100644
index 000000000..51a274962
--- /dev/null
+++ b/program/js/tiny_mce/plugins/table/jscripts/merge_cells.js
@@ -0,0 +1,19 @@
+function init() {
+ tinyMCEPopup.resizeToInnerSize();
+
+ var formObj = document.forms[0];
+
+ formObj.numcols.value = tinyMCE.getWindowArg('numcols', 1);
+ formObj.numrows.value = tinyMCE.getWindowArg('numrows', 1);
+}
+
+function mergeCells() {
+ var args = new Array();
+ var formObj = document.forms[0];
+
+ args["numcols"] = formObj.numcols.value;
+ args["numrows"] = formObj.numrows.value;
+
+ tinyMCEPopup.execCommand("mceTableMergeCells", false, args);
+ tinyMCEPopup.close();
+}
diff --git a/program/js/tiny_mce/plugins/table/jscripts/row.js b/program/js/tiny_mce/plugins/table/jscripts/row.js
new file mode 100644
index 000000000..395ddf028
--- /dev/null
+++ b/program/js/tiny_mce/plugins/table/jscripts/row.js
@@ -0,0 +1,200 @@
+function init() {
+ tinyMCEPopup.resizeToInnerSize();
+
+ document.getElementById('backgroundimagebrowsercontainer').innerHTML = getBrowserHTML('backgroundimagebrowser','backgroundimage','image','table');
+ document.getElementById('bgcolor_pickcontainer').innerHTML = getColorPickerHTML('bgcolor_pick','bgcolor');
+
+ var inst = tinyMCE.selectedInstance;
+ var trElm = tinyMCE.getParentElement(inst.getFocusElement(), "tr");
+ var formObj = document.forms[0];
+ var st = tinyMCE.parseStyle(tinyMCE.getAttrib(trElm, "style"));
+
+ // Get table row data
+ var rowtype = trElm.parentNode.nodeName.toLowerCase();
+ var align = tinyMCE.getAttrib(trElm, 'align');
+ var valign = tinyMCE.getAttrib(trElm, 'valign');
+ var height = trimSize(getStyle(trElm, 'height', 'height'));
+ var className = tinyMCE.getVisualAidClass(tinyMCE.getAttrib(trElm, 'class'), false);
+ var bgcolor = convertRGBToHex(getStyle(trElm, 'bgcolor', 'backgroundColor'));
+ var backgroundimage = getStyle(trElm, 'background', 'backgroundImage').replace(new RegExp("url\\('?([^']*)'?\\)", 'gi'), "$1");;
+ var id = tinyMCE.getAttrib(trElm, 'id');
+ var lang = tinyMCE.getAttrib(trElm, 'lang');
+ var dir = tinyMCE.getAttrib(trElm, 'dir');
+
+ // Setup form
+ addClassesToList('class', 'table_row_styles');
+ formObj.bgcolor.value = bgcolor;
+ formObj.backgroundimage.value = backgroundimage;
+ formObj.height.value = height;
+ formObj.id.value = id;
+ formObj.lang.value = lang;
+ formObj.style.value = tinyMCE.serializeStyle(st);
+ selectByValue(formObj, 'align', align);
+ selectByValue(formObj, 'valign', valign);
+ selectByValue(formObj, 'class', className);
+ selectByValue(formObj, 'rowtype', rowtype);
+ selectByValue(formObj, 'dir', dir);
+
+ // Resize some elements
+ if (isVisible('backgroundimagebrowser'))
+ document.getElementById('backgroundimage').style.width = '180px';
+
+ updateColor('bgcolor_pick', 'bgcolor');
+}
+
+function updateAction() {
+ tinyMCEPopup.restoreSelection();
+
+ var inst = tinyMCE.selectedInstance;
+ var trElm = tinyMCE.getParentElement(inst.getFocusElement(), "tr");
+ var tableElm = tinyMCE.getParentElement(inst.getFocusElement(), "table");
+ var formObj = document.forms[0];
+ var action = getSelectValue(formObj, 'action');
+
+ inst.execCommand('mceBeginUndoLevel');
+
+ switch (action) {
+ case "row":
+ updateRow(trElm);
+ break;
+
+ case "all":
+ var rows = tableElm.getElementsByTagName("tr");
+
+ for (var i=0; i<rows.length; i++)
+ updateRow(rows[i], true);
+
+ break;
+
+ case "odd":
+ case "even":
+ var rows = tableElm.getElementsByTagName("tr");
+
+ for (var i=0; i<rows.length; i++) {
+ if ((i % 2 == 0 && action == "odd") || (i % 2 != 0 && action == "even"))
+ updateRow(rows[i], true, true);
+ }
+
+ break;
+ }
+
+ tinyMCE.handleVisualAid(inst.getBody(), true, inst.visualAid, inst);
+ tinyMCE.triggerNodeChange();
+ inst.execCommand('mceEndUndoLevel');
+ tinyMCEPopup.close();
+}
+
+function updateRow(tr_elm, skip_id, skip_parent) {
+ var inst = tinyMCE.selectedInstance;
+ var formObj = document.forms[0];
+ var curRowType = tr_elm.parentNode.nodeName.toLowerCase();
+ var rowtype = getSelectValue(formObj, 'rowtype');
+ var doc = inst.getDoc();
+
+ // Update row element
+ if (!skip_id)
+ tr_elm.setAttribute('id', formObj.id.value);
+
+ tr_elm.setAttribute('align', getSelectValue(formObj, 'align'));
+ tr_elm.setAttribute('vAlign', getSelectValue(formObj, 'valign'));
+ tr_elm.setAttribute('lang', formObj.lang.value);
+ tr_elm.setAttribute('dir', getSelectValue(formObj, 'dir'));
+ tr_elm.setAttribute('style', tinyMCE.serializeStyle(tinyMCE.parseStyle(formObj.style.value)));
+ tinyMCE.setAttrib(tr_elm, 'class', getSelectValue(formObj, 'class'));
+
+ // Clear deprecated attributes
+ tr_elm.setAttribute('background', '');
+ tr_elm.setAttribute('bgColor', '');
+ tr_elm.setAttribute('height', '');
+
+ // Set styles
+ tr_elm.style.height = getCSSSize(formObj.height.value);
+ tr_elm.style.backgroundColor = formObj.bgcolor.value;
+
+ if (formObj.backgroundimage.value != "")
+ tr_elm.style.backgroundImage = "url('" + formObj.backgroundimage.value + "')";
+ else
+ tr_elm.style.backgroundImage = '';
+
+ // Setup new rowtype
+ if (curRowType != rowtype && !skip_parent) {
+ // first, clone the node we are working on
+ var newRow = tr_elm.cloneNode(1);
+
+ // next, find the parent of its new destination (creating it if necessary)
+ var theTable = tinyMCE.getParentElement(tr_elm, "table");
+ var dest = rowtype;
+ var newParent = null;
+ for (var i = 0; i < theTable.childNodes.length; i++) {
+ if (theTable.childNodes[i].nodeName.toLowerCase() == dest)
+ newParent = theTable.childNodes[i];
+ }
+
+ if (newParent == null) {
+ newParent = doc.createElement(dest);
+
+ if (dest == "thead")
+ theTable.insertBefore(newParent, theTable.firstChild);
+ else
+ theTable.appendChild(newParent);
+ }
+
+ // append the row to the new parent
+ newParent.appendChild(newRow);
+
+ // remove the original
+ tr_elm.parentNode.removeChild(tr_elm);
+
+ // set tr_elm to the new node
+ tr_elm = newRow;
+ }
+}
+
+function changedBackgroundImage() {
+ var formObj = document.forms[0];
+ var st = tinyMCE.parseStyle(formObj.style.value);
+
+ st['background-image'] = "url('" + formObj.backgroundimage.value + "')";
+
+ formObj.style.value = tinyMCE.serializeStyle(st);
+}
+
+function changedStyle() {
+ var formObj = document.forms[0];
+ var st = tinyMCE.parseStyle(formObj.style.value);
+
+ if (st['background-image'])
+ formObj.backgroundimage.value = st['background-image'].replace(new RegExp("url\\('?([^']*)'?\\)", 'gi'), "$1");
+ else
+ formObj.backgroundimage.value = '';
+
+ if (st['height'])
+ formObj.height.value = trimSize(st['height']);
+
+ if (st['background-color']) {
+ formObj.bgcolor.value = st['background-color'];
+ updateColor('bgcolor_pick','bgcolor');
+ }
+}
+
+function changedSize() {
+ var formObj = document.forms[0];
+ var st = tinyMCE.parseStyle(formObj.style.value);
+
+ var height = formObj.height.value;
+ if (height != "")
+ st['height'] = getCSSSize(height);
+ else
+ st['height'] = "";
+
+ formObj.style.value = tinyMCE.serializeStyle(st);
+}
+
+function changedColor() {
+ var formObj = document.forms[0];
+ var st = tinyMCE.parseStyle(formObj.style.value);
+
+ st['background-color'] = formObj.bgcolor.value;
+
+ formObj.style.value = tinyMCE.serializeStyle(st);
+}
diff --git a/program/js/tiny_mce/plugins/table/jscripts/table.js b/program/js/tiny_mce/plugins/table/jscripts/table.js
new file mode 100644
index 000000000..02eaeee27
--- /dev/null
+++ b/program/js/tiny_mce/plugins/table/jscripts/table.js
@@ -0,0 +1,344 @@
+var action, orgTableWidth, orgTableHeight;
+
+function insertTable() {
+ var formObj = document.forms[0];
+ var inst = tinyMCE.selectedInstance;
+ var cols = 2, rows = 2, border = 0, cellpadding = -1, cellspacing = -1, align, width, height, className;
+ var html = '';
+ var elm = tinyMCE.tableElm;
+ var cellLimit, rowLimit, colLimit;
+
+ tinyMCEPopup.restoreSelection();
+
+ // Get form data
+ cols = formObj.elements['cols'].value;
+ rows = formObj.elements['rows'].value;
+ border = formObj.elements['border'].value != "" ? formObj.elements['border'].value : 0;
+ cellpadding = formObj.elements['cellpadding'].value != "" ? formObj.elements['cellpadding'].value : "";
+ cellspacing = formObj.elements['cellspacing'].value != "" ? formObj.elements['cellspacing'].value : "";
+ align = formObj.elements['align'].options[formObj.elements['align'].selectedIndex].value;
+ width = formObj.elements['width'].value;
+ height = formObj.elements['height'].value;
+ bordercolor = formObj.elements['bordercolor'].value;
+ bgcolor = formObj.elements['bgcolor'].value;
+ className = formObj.elements['class'].options[formObj.elements['class'].selectedIndex].value;
+ id = formObj.elements['id'].value;
+ summary = formObj.elements['summary'].value;
+ style = formObj.elements['style'].value;
+ dir = formObj.elements['dir'].value;
+ lang = formObj.elements['lang'].value;
+ background = formObj.elements['backgroundimage'].value;
+
+ cellLimit = tinyMCE.getParam('table_cell_limit', false);
+ rowLimit = tinyMCE.getParam('table_row_limit', false);
+ colLimit = tinyMCE.getParam('table_col_limit', false);
+
+ // Validate table size
+ if (colLimit && cols > colLimit) {
+ alert(tinyMCE.getLang('lang_table_col_limit', '', true, {cols : colLimit}));
+ return false;
+ } else if (rowLimit && rows > rowLimit) {
+ alert(tinyMCE.getLang('lang_table_row_limit', '', true, {rows : rowLimit}));
+ return false;
+ } else if (cellLimit && cols * rows > cellLimit) {
+ alert(tinyMCE.getLang('lang_table_cell_limit', '', true, {cells : cellLimit}));
+ return false;
+ }
+
+ // Update table
+ if (action == "update") {
+ inst.execCommand('mceBeginUndoLevel');
+
+ tinyMCE.setAttrib(elm, 'cellPadding', cellpadding, true);
+ tinyMCE.setAttrib(elm, 'cellSpacing', cellspacing, true);
+ tinyMCE.setAttrib(elm, 'border', border, true);
+ tinyMCE.setAttrib(elm, 'align', align);
+ tinyMCE.setAttrib(elm, 'class', className);
+ tinyMCE.setAttrib(elm, 'style', style);
+ tinyMCE.setAttrib(elm, 'id', id);
+ tinyMCE.setAttrib(elm, 'summary', summary);
+ tinyMCE.setAttrib(elm, 'dir', dir);
+ tinyMCE.setAttrib(elm, 'lang', lang);
+
+ // Not inline styles
+ if (!tinyMCE.getParam("inline_styles"))
+ tinyMCE.setAttrib(elm, 'width', width, true);
+
+ // Remove these since they are not valid XHTML
+ tinyMCE.setAttrib(elm, 'borderColor', '');
+ tinyMCE.setAttrib(elm, 'bgColor', '');
+ tinyMCE.setAttrib(elm, 'background', '');
+ tinyMCE.setAttrib(elm, 'height', '');
+
+ if (background != '')
+ elm.style.backgroundImage = "url('" + background + "')";
+ else
+ elm.style.backgroundImage = '';
+
+ if (tinyMCE.getParam("inline_styles"))
+ elm.style.borderWidth = border + "px";
+
+ if (tinyMCE.getParam("inline_styles")) {
+ if (width != '')
+ elm.style.width = getCSSSize(width);
+ }
+
+ if (bordercolor != "") {
+ elm.style.borderColor = bordercolor;
+ elm.style.borderStyle = elm.style.borderStyle == "" ? "solid" : elm.style.borderStyle;
+ elm.style.borderWidth = border == "" ? "1px" : border;
+ } else
+ elm.style.borderColor = '';
+
+ elm.style.backgroundColor = bgcolor;
+ elm.style.height = getCSSSize(height);
+
+ tinyMCE.handleVisualAid(tinyMCE.tableElm, false, inst.visualAid, inst);
+
+ // Fix for stange MSIE align bug
+ tinyMCE.tableElm.outerHTML = tinyMCE.tableElm.outerHTML;
+
+ tinyMCE.handleVisualAid(inst.getBody(), true, inst.visualAid, inst);
+ tinyMCE.triggerNodeChange();
+ inst.execCommand('mceEndUndoLevel');
+
+ // Repaint if dimensions changed
+ if (formObj.width.value != orgTableWidth || formObj.height.value != orgTableHeight)
+ inst.repaint();
+
+ tinyMCEPopup.close();
+ return true;
+ }
+
+ // Create new table
+ html += '<table';
+
+ html += makeAttrib('id', id);
+ html += makeAttrib('border', border);
+ html += makeAttrib('cellpadding', cellpadding);
+ html += makeAttrib('cellspacing', cellspacing);
+ html += makeAttrib('width', width);
+ //html += makeAttrib('height', height);
+ //html += makeAttrib('bordercolor', bordercolor);
+ //html += makeAttrib('bgcolor', bgcolor);
+ html += makeAttrib('align', align);
+ html += makeAttrib('class', tinyMCE.getVisualAidClass(className, border == 0));
+ html += makeAttrib('style', style);
+ html += makeAttrib('summary', summary);
+ html += makeAttrib('dir', dir);
+ html += makeAttrib('lang', lang);
+
+ html += '>';
+
+ for (var y=0; y<rows; y++) {
+ html += "<tr>";
+
+ for (var x=0; x<cols; x++)
+ html += '<td>&nbsp;</td>';
+
+ html += "</tr>";
+ }
+
+ html += "</table>";
+
+ inst.execCommand('mceBeginUndoLevel');
+ inst.execCommand('mceInsertContent', false, html);
+ tinyMCE.handleVisualAid(inst.getBody(), true, tinyMCE.settings['visual']);
+ inst.execCommand('mceEndUndoLevel');
+
+ tinyMCEPopup.close();
+}
+
+function makeAttrib(attrib, value) {
+ var formObj = document.forms[0];
+ var valueElm = formObj.elements[attrib];
+
+ if (typeof(value) == "undefined" || value == null) {
+ value = "";
+
+ if (valueElm)
+ value = valueElm.value;
+ }
+
+ if (value == "")
+ return "";
+
+ // XML encode it
+ value = value.replace(/&/g, '&amp;');
+ value = value.replace(/\"/g, '&quot;');
+ value = value.replace(/</g, '&lt;');
+ value = value.replace(/>/g, '&gt;');
+
+ return ' ' + attrib + '="' + value + '"';
+}
+
+function init() {
+ tinyMCEPopup.resizeToInnerSize();
+
+ document.getElementById('backgroundimagebrowsercontainer').innerHTML = getBrowserHTML('backgroundimagebrowser','backgroundimage','image','table');
+ document.getElementById('backgroundimagebrowsercontainer').innerHTML = getBrowserHTML('backgroundimagebrowser','backgroundimage','image','table');
+ document.getElementById('bordercolor_pickcontainer').innerHTML = getColorPickerHTML('bordercolor_pick','bordercolor');
+ document.getElementById('bgcolor_pickcontainer').innerHTML = getColorPickerHTML('bgcolor_pick','bgcolor');
+
+ var cols = 2, rows = 2, border = 0, cellpadding = "", cellspacing = "";
+ var align = "", width = "", height = "", bordercolor = "", bgcolor = "", className = "";
+ var id = "", summary = "", style = "", dir = "", lang = "", background = "", bgcolor = "", bordercolor = "";
+ var inst = tinyMCE.selectedInstance;
+ var formObj = document.forms[0];
+ var elm = tinyMCE.getParentElement(inst.getFocusElement(), "table");
+
+ tinyMCE.tableElm = elm;
+ action = tinyMCE.getWindowArg('action');
+ if (action == null)
+ action = tinyMCE.tableElm ? "update" : "insert";
+
+ if (tinyMCE.tableElm && action != "insert") {
+ var rowsAr = tinyMCE.tableElm.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;
+
+ st = tinyMCE.parseStyle(tinyMCE.getAttrib(tinyMCE.tableElm, "style"));
+ border = trimSize(getStyle(elm, 'border', 'borderWidth'));
+ cellpadding = tinyMCE.getAttrib(tinyMCE.tableElm, 'cellpadding', "");
+ cellspacing = tinyMCE.getAttrib(tinyMCE.tableElm, 'cellspacing', "");
+ width = trimSize(getStyle(elm, 'width', 'width'));
+ height = trimSize(getStyle(elm, 'height', 'height'));
+ bordercolor = convertRGBToHex(getStyle(elm, 'bordercolor', 'borderLeftColor'));
+ bgcolor = convertRGBToHex(getStyle(elm, 'bgcolor', 'backgroundColor'));
+ align = tinyMCE.getAttrib(tinyMCE.tableElm, 'align', align);
+ className = tinyMCE.getVisualAidClass(tinyMCE.getAttrib(tinyMCE.tableElm, 'class'), false);
+ id = tinyMCE.getAttrib(tinyMCE.tableElm, 'id');
+ summary = tinyMCE.getAttrib(tinyMCE.tableElm, 'summary');
+ style = tinyMCE.serializeStyle(st);
+ dir = tinyMCE.getAttrib(tinyMCE.tableElm, 'dir');
+ lang = tinyMCE.getAttrib(tinyMCE.tableElm, 'lang');
+ background = getStyle(elm, 'background', 'backgroundImage').replace(new RegExp("url\\('?([^']*)'?\\)", 'gi'), "$1");
+
+ orgTableWidth = width;
+ orgTableHeight = height;
+
+ action = "update";
+ }
+
+ addClassesToList('class', "table_styles");
+
+ // Update form
+ selectByValue(formObj, 'align', align);
+ selectByValue(formObj, 'class', className);
+ formObj.cols.value = cols;
+ formObj.rows.value = rows;
+ formObj.border.value = border;
+ formObj.cellpadding.value = cellpadding;
+ formObj.cellspacing.value = cellspacing;
+ formObj.width.value = width;
+ formObj.height.value = height;
+ formObj.bordercolor.value = bordercolor;
+ formObj.bgcolor.value = bgcolor;
+ formObj.id.value = id;
+ formObj.summary.value = summary;
+ formObj.style.value = style;
+ formObj.dir.value = dir;
+ formObj.lang.value = lang;
+ formObj.backgroundimage.value = background;
+ formObj.insert.value = tinyMCE.getLang('lang_' + action, 'Insert', true);
+
+ updateColor('bordercolor_pick', 'bordercolor');
+ updateColor('bgcolor_pick', 'bgcolor');
+
+ // Resize some elements
+ if (isVisible('backgroundimagebrowser'))
+ document.getElementById('backgroundimage').style.width = '180px';
+
+ // Disable some fields in update mode
+ if (action == "update") {
+ formObj.cols.disabled = true;
+ formObj.rows.disabled = true;
+ }
+}
+
+function changedSize() {
+ var formObj = document.forms[0];
+ var st = tinyMCE.parseStyle(formObj.style.value);
+
+ var width = formObj.width.value;
+ if (width != "")
+ st['width'] = tinyMCE.getParam("inline_styles") ? getCSSSize(width) : "";
+ else
+ st['width'] = "";
+
+ var height = formObj.height.value;
+ if (height != "")
+ st['height'] = getCSSSize(height);
+ else
+ st['height'] = "";
+
+ formObj.style.value = tinyMCE.serializeStyle(st);
+}
+
+function changedBackgroundImage() {
+ var formObj = document.forms[0];
+ var st = tinyMCE.parseStyle(formObj.style.value);
+
+ st['background-image'] = "url('" + formObj.backgroundimage.value + "')";
+
+ formObj.style.value = tinyMCE.serializeStyle(st);
+}
+
+function changedBorder() {
+ var formObj = document.forms[0];
+ var st = tinyMCE.parseStyle(formObj.style.value);
+
+ // Update border width if the element has a color
+ if (formObj.border.value != "" && formObj.bordercolor.value != "")
+ st['border-width'] = formObj.border.value + "px";
+
+ formObj.style.value = tinyMCE.serializeStyle(st);
+}
+
+function changedColor() {
+ var formObj = document.forms[0];
+ var st = tinyMCE.parseStyle(formObj.style.value);
+
+ st['background-color'] = formObj.bgcolor.value;
+
+ if (formObj.bordercolor.value != "") {
+ st['border-color'] = formObj.bordercolor.value;
+
+ // Add border-width if it's missing
+ if (!st['border-width'])
+ st['border-width'] = formObj.border.value == "" ? "1px" : formObj.border.value + "px";
+ }
+
+ formObj.style.value = tinyMCE.serializeStyle(st);
+}
+
+function changedStyle() {
+ var formObj = document.forms[0];
+ var st = tinyMCE.parseStyle(formObj.style.value);
+
+ if (st['background-image'])
+ formObj.backgroundimage.value = st['background-image'].replace(new RegExp("url\\('?([^']*)'?\\)", 'gi'), "$1");
+ else
+ formObj.backgroundimage.value = '';
+
+ if (st['width'])
+ formObj.width.value = trimSize(st['width']);
+
+ if (st['height'])
+ formObj.height.value = trimSize(st['height']);
+
+ if (st['background-color']) {
+ formObj.bgcolor.value = st['background-color'];
+ updateColor('bgcolor_pick','bgcolor');
+ }
+
+ if (st['border-color']) {
+ formObj.bordercolor.value = st['border-color'];
+ updateColor('bordercolor_pick','bordercolor');
+ }
+}
diff --git a/program/js/tiny_mce/plugins/table/langs/en.js b/program/js/tiny_mce/plugins/table/langs/en.js
new file mode 100644
index 000000000..108d6afb1
--- /dev/null
+++ b/program/js/tiny_mce/plugins/table/langs/en.js
@@ -0,0 +1,78 @@
+// UK lang variables
+
+tinyMCE.addToLang('table',{
+general_tab : 'General',
+advanced_tab : 'Advanced',
+general_props : 'General properties',
+advanced_props : 'Advanced properties',
+desc : 'Inserts a new table',
+row_before_desc : 'Insert row before',
+row_after_desc : 'Insert row after',
+delete_row_desc : 'Delete row',
+col_before_desc : 'Insert column before',
+col_after_desc : 'Insert column after',
+delete_col_desc : 'Remove column',
+rowtype : 'Row in table part',
+title : 'Insert/Modify table',
+width : 'Width',
+height : 'Height',
+cols : 'Columns',
+rows : 'Rows',
+cellspacing : 'Cellspacing',
+cellpadding : 'Cellpadding',
+border : 'Border',
+align : 'Alignment',
+align_default : 'Default',
+align_left : 'Left',
+align_right : 'Right',
+align_middle : 'Center',
+row_title : 'Table row properties',
+cell_title : 'Table cell properties',
+cell_type : 'Cell type',
+row_desc : 'Table row properties',
+cell_desc : 'Table cell properties',
+valign : 'Vertical alignment',
+align_top : 'Top',
+align_bottom : 'Bottom',
+props_desc : 'Table properties',
+bordercolor : 'Border color',
+bgcolor : 'Background color',
+merge_cells_title : 'Merge table cells',
+split_cells_desc : 'Split table cells',
+merge_cells_desc : 'Merge table cells',
+cut_row_desc : 'Cut table row',
+copy_row_desc : 'Copy table row',
+paste_row_before_desc : 'Paste table row before',
+paste_row_after_desc : 'Paste table row after',
+id : 'Id',
+style: 'Style',
+langdir : 'Language direction',
+langcode : 'Language code',
+mime : 'Target MIME type',
+ltr : 'Left to right',
+rtl : 'Right to left',
+bgimage : 'Background image',
+summary : 'Summary',
+td : "Data",
+th : "Header",
+cell_cell : 'Update current cell',
+cell_row : 'Update all cells in row',
+cell_all : 'Update all cells in table',
+row_row : 'Update current row',
+row_odd : 'Update odd rows in table',
+row_even : 'Update even rows in table',
+row_all : 'Update all rows in table',
+thead : 'Table Head',
+tbody : 'Table Body',
+tfoot : 'Table Foot',
+del : 'Delete table',
+scope : 'Scope',
+row : 'Row',
+col : 'Col',
+rowgroup : 'Row Group',
+colgroup : 'Col Group',
+col_limit : 'You\'ve exceeded the maximum number of columns of {$cols}.',
+row_limit : 'You\'ve exceeded the maximum number of rows of {$rows}.',
+cell_limit : 'You\'ve exceeded the maximum number of cells of {$cells}.',
+missing_scope: 'Are you sure you want to continue without specifying a scope for this table header cell. Without it, it may be difficult for some users with disabilities to understand the content or data displayed of the table.'
+});
diff --git a/program/js/tiny_mce/plugins/table/merge_cells.htm b/program/js/tiny_mce/plugins/table/merge_cells.htm
new file mode 100644
index 000000000..be723a9fa
--- /dev/null
+++ b/program/js/tiny_mce/plugins/table/merge_cells.htm
@@ -0,0 +1,37 @@
+<html xmlns="http://www.w3.org/1999/xhtml">
+<head>
+ <title>{$lang_table_merge_cells_title}</title>
+ <script language="javascript" type="text/javascript" src="../../tiny_mce_popup.js"></script>
+ <script language="javascript" type="text/javascript" src="../../utils/mctabs.js"></script>
+ <script language="javascript" type="text/javascript" src="jscripts/merge_cells.js"></script>
+ <base target="_self" />
+</head>
+<body onload="tinyMCEPopup.executeOnLoad('init();');" style="margin: 8px" style="display: none">
+<form onsubmit="insertTable();return false;" action="#">
+ <fieldset>
+ <legend>{$lang_table_merge_cells_title}</legend>
+ <table border="0" cellpadding="0" cellspacing="3" width="100%">
+ <tr>
+ <td>{$lang_table_cols}:</td>
+ <td align="right"><input type="text" name="numcols" value="" style="width: 30px" /></td>
+ <td>
+ </tr>
+ <tr>
+ <td>{$lang_table_rows}:</td>
+ <td align="right"><input type="text" name="numrows" value="" style="width: 30px" /></td>
+ </tr>
+ </table>
+ </fieldset>
+
+ <div class="mceActionPanel">
+ <div style="float: left">
+ <input type="button" id="insert" name="insert" value="{$lang_update}" onclick="mergeCells();" />
+ </div>
+
+ <div style="float: right">
+ <input type="button" id="cancel" name="cancel" value="{$lang_cancel}" onclick="tinyMCEPopup.close();" />
+ </div>
+ </div>
+</form>
+</body>
+</html>
diff --git a/program/js/tiny_mce/plugins/table/readme.txt b/program/js/tiny_mce/plugins/table/readme.txt
new file mode 100644
index 000000000..4fdb78aec
--- /dev/null
+++ b/program/js/tiny_mce/plugins/table/readme.txt
@@ -0,0 +1 @@
+Check the TinyMCE documentation for details on this plugin.
diff --git a/program/js/tiny_mce/plugins/table/row.htm b/program/js/tiny_mce/plugins/table/row.htm
new file mode 100644
index 000000000..64f2afcb5
--- /dev/null
+++ b/program/js/tiny_mce/plugins/table/row.htm
@@ -0,0 +1,159 @@
+<html xmlns="http://www.w3.org/1999/xhtml">
+<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" src="../../utils/mctabs.js"></script>
+ <script language="javascript" type="text/javascript" src="../../utils/form_utils.js"></script>
+ <script language="javascript" type="text/javascript" src="jscripts/row.js"></script>
+ <link href="css/row.css" rel="stylesheet" type="text/css" />
+ <base target="_self" />
+</head>
+<body id="tablerow" onload="tinyMCEPopup.executeOnLoad('init();');" style="display: none">
+ <form onsubmit="updateAction();return false;">
+ <div class="tabs">
+ <ul>
+ <li id="general_tab" class="current"><span><a href="javascript:mcTabs.displayTab('general_tab','general_panel');" onmousedown="return false;">{$lang_table_general_tab}</a></span></li>
+ <li id="advanced_tab"><span><a href="javascript:mcTabs.displayTab('advanced_tab','advanced_panel');" onmousedown="return false;">{$lang_table_advanced_tab}</a></span></li>
+ </ul>
+ </div>
+
+ <div class="panel_wrapper">
+ <div id="general_panel" class="panel current">
+ <fieldset>
+ <legend>{$lang_table_general_props}</legend>
+
+ <table border="0" cellpadding="4" cellspacing="0">
+ <tr>
+ <td><label for="rowtype">{$lang_table_rowtype}</label></td>
+ <td class="col2">
+ <select id="rowtype" name="rowtype">
+ <option value="thead">{$lang_table_thead}</option>
+ <option value="tbody">{$lang_table_tbody}</option>
+ <option value="tfoot">{$lang_table_tfoot}</option>
+ </select>
+ </td>
+ </tr>
+
+ <tr>
+ <td><label for="align">{$lang_table_align}</label></td>
+ <td class="col2">
+ <select id="align" name="align">
+ <option value="">{$lang_not_set}</option>
+ <option value="center">{$lang_table_align_middle}</option>
+ <option value="left">{$lang_table_align_left}</option>
+ <option value="right">{$lang_table_align_right}</option>
+ </select>
+ </td>
+ </tr>
+
+ <tr>
+ <td><label for="valign">{$lang_table_valign}</label></td>
+ <td class="col2">
+ <select id="valign" name="valign">
+ <option value="">{$lang_not_set}</option>
+ <option value="top">{$lang_table_align_top}</option>
+ <option value="middle">{$lang_table_align_middle}</option>
+ <option value="bottom">{$lang_table_align_bottom}</option>
+ </select>
+ </td>
+ </tr>
+
+ <tr id="styleSelectRow">
+ <td><label for="class">{$lang_class_name}</label></td>
+ <td class="col2">
+ <select id="class" name="class">
+ <option value="" selected="selected">{$lang_not_set}</option>
+ </select>
+ </td>
+ </tr>
+
+ <tr>
+ <td><label for="height">{$lang_table_height}</label></td>
+ <td class="col2"><input name="height" type="text" id="height" value="" size="4" maxlength="4" onchange="changedSize();" /></td>
+ </tr>
+ </table>
+ </fieldset>
+ </div>
+
+ <div id="advanced_panel" class="panel">
+ <fieldset>
+ <legend>{$lang_table_advanced_props}</legend>
+
+ <table border="0" cellpadding="0" cellspacing="4">
+ <tr>
+ <td class="column1"><label for="id">{$lang_table_id}</label></td>
+ <td><input id="id" name="id" type="text" value="" style="width: 200px" /></td>
+ </tr>
+
+ <tr>
+ <td><label for="style">{$lang_table_style}</label></td>
+ <td><input type="text" id="style" name="style" value="" style="width: 200px;" onchange="changedStyle();" /></td>
+ </tr>
+
+ <tr>
+ <td class="column1"><label for="dir">{$lang_table_langdir}</label></td>
+ <td>
+ <select id="dir" name="dir" style="width: 200px">
+ <option value="">{$lang_not_set}</option>
+ <option value="ltr">{$lang_table_ltr}</option>
+ <option value="rtl">{$lang_table_rtl}</option>
+ </select>
+ </td>
+ </tr>
+
+ <tr>
+ <td class="column1"><label for="lang">{$lang_table_langcode}</label></td>
+ <td>
+ <input id="lang" name="lang" type="text" value="" style="width: 200px" />
+ </td>
+ </tr>
+
+ <tr>
+ <td class="column1"><label for="backgroundimage">{$lang_table_bgimage}</label></td>
+ <td>
+ <table border="0" cellpadding="0" cellspacing="0">
+ <tr>
+ <td><input id="backgroundimage" name="backgroundimage" type="text" value="" style="width: 200px" onchange="changedBackgroundImage();" /></td>
+ <td id="backgroundimagebrowsercontainer">&nbsp;</td>
+ </tr>
+ </table>
+ </td>
+ </tr>
+
+ <tr>
+ <td class="column1"><label for="bgcolor">{$lang_table_bgcolor}</label></td>
+ <td>
+ <table border="0" cellpadding="0" cellspacing="0">
+ <tr>
+ <td><input id="bgcolor" name="bgcolor" type="text" value="" size="9" onchange="updateColor('bgcolor_pick','bgcolor');changedColor();" /></td>
+ <td id="bgcolor_pickcontainer">&nbsp;</td>
+ </tr>
+ </table>
+ </td>
+ </tr>
+ </table>
+ </fieldset>
+ </div>
+ </div>
+
+ <div class="mceActionPanel">
+ <div>
+ <select id="action" name="action">
+ <option value="row">{$lang_table_row_row}</option>
+ <option value="odd">{$lang_table_row_odd}</option>
+ <option value="even">{$lang_table_row_even}</option>
+ <option value="all">{$lang_table_row_all}</option>
+ </select>
+ </div>
+
+ <div style="float: left">
+ <div><input type="button" id="insert" name="insert" value="{$lang_update}" onclick="updateAction();" /></div>
+ </div>
+
+ <div style="float: right">
+ <input type="button" id="cancel" name="cancel" value="{$lang_cancel}" onclick="tinyMCEPopup.close();" />
+ </div>
+ </div>
+ </form>
+</body>
+</html>
diff --git a/program/js/tiny_mce/plugins/table/table.htm b/program/js/tiny_mce/plugins/table/table.htm
new file mode 100644
index 000000000..846f55131
--- /dev/null
+++ b/program/js/tiny_mce/plugins/table/table.htm
@@ -0,0 +1,155 @@
+<html xmlns="http://www.w3.org/1999/xhtml">
+<head>
+ <title>{$lang_table_title}</title>
+ <script language="javascript" type="text/javascript" src="../../tiny_mce_popup.js"></script>
+ <script language="javascript" type="text/javascript" src="../../utils/mctabs.js"></script>
+ <script language="javascript" type="text/javascript" src="../../utils/form_utils.js"></script>
+ <script language="javascript" type="text/javascript" src="jscripts/table.js"></script>
+ <link href="css/table.css" rel="stylesheet" type="text/css" />
+ <base target="_self" />
+</head>
+<body id="table" onload="tinyMCEPopup.executeOnLoad('init();');" style="display: none">
+ <form onsubmit="insertTable();return false;" action="#">
+ <div class="tabs">
+ <ul>
+ <li id="general_tab" class="current"><span><a href="javascript:mcTabs.displayTab('general_tab','general_panel');" onmousedown="return false;">{$lang_table_general_tab}</a></span></li>
+ <li id="advanced_tab"><span><a href="javascript:mcTabs.displayTab('advanced_tab','advanced_panel');" onmousedown="return false;">{$lang_table_advanced_tab}</a></span></li>
+ </ul>
+ </div>
+
+ <div class="panel_wrapper">
+ <div id="general_panel" class="panel current">
+ <fieldset>
+ <legend>{$lang_table_general_props}</legend>
+
+ <table border="0" cellpadding="4" cellspacing="0" width="100%">
+ <tr>
+ <td><label id="colslabel" for="cols">{$lang_table_cols}</label></td>
+ <td><input id="cols" name="cols" type="text" value="" size="3" maxlength="3" /></td>
+ <td><label id="rowslabel" for="rows">{$lang_table_rows}</label></td>
+ <td><input id="rows" name="rows" type="text" value="" size="3" maxlength="3" /></td>
+ </tr>
+ <tr>
+ <td><label id="cellpaddinglabel" for="cellpadding">{$lang_table_cellpadding}</label></td>
+ <td><input id="cellpadding" name="cellpadding" type="text" value="" size="3" maxlength="3" /></td>
+ <td><label id="cellspacinglabel" for="cellspacing">{$lang_table_cellspacing}</label></td>
+ <td><input id="cellspacing" name="cellspacing" type="text" value="" size="3" maxlength="3" /></td>
+ </tr>
+ <tr>
+ <td><label id="alignlabel" for="align">{$lang_table_align}</label></td>
+ <td><select id="align" name="align">
+ <option value="">{$lang_not_set}</option>
+ <option value="center">{$lang_table_align_middle}</option>
+ <option value="left">{$lang_table_align_left}</option>
+ <option value="right">{$lang_table_align_right}</option>
+ </select></td>
+ <td><label id="borderlabel" for="border">{$lang_table_border}</label></td>
+ <td><input id="border" name="border" type="text" value="" size="3" maxlength="3" onchange="changedBorder();" /></td>
+ </tr>
+ <tr>
+ <td><label id="widthlabel" for="width">{$lang_table_width}</label></td>
+ <td><input name="width" type="text" id="width" value="" size="4" maxlength="4" onchange="changedSize();" /></td>
+ <td><label id="heightlabel" for="height">{$lang_table_height}</label></td>
+ <td><input name="height" type="text" id="height" value="" size="4" maxlength="4" onchange="changedSize();" /></td>
+ </tr>
+ <tr id="styleSelectRow">
+ <td><label id="classlabel" for="class">{$lang_class_name}</label></td>
+ <td colspan="3">
+ <select id="class" name="class">
+ <option value="" selected>{$lang_not_set}</option>
+ </select></td>
+ </tr>
+ </table>
+ </fieldset>
+ </div>
+
+ <div id="advanced_panel" class="panel">
+ <fieldset>
+ <legend>{$lang_table_advanced_props}</legend>
+
+ <table border="0" cellpadding="0" cellspacing="4">
+ <tr>
+ <td class="column1"><label for="id">{$lang_table_id}</label></td>
+ <td><input id="id" name="id" type="text" value="" class="advfield" /></td>
+ </tr>
+
+ <tr>
+ <td class="column1"><label for="summary">{$lang_table_summary}</label></td>
+ <td><input id="summary" name="summary" type="text" value="" class="advfield" /></td>
+ </tr>
+
+ <tr>
+ <td><label for="style">{$lang_table_style}</label></td>
+ <td><input type="text" id="style" name="style" value="" class="advfield" onchange="changedStyle();" /></td>
+ </tr>
+
+ <tr>
+ <td class="column1"><label for="dir">{$lang_table_langdir}</label></td>
+ <td>
+ <select id="dir" name="dir" class="advfield">
+ <option value="">{$lang_not_set}</option>
+ <option value="ltr">{$lang_table_ltr}</option>
+ <option value="rtl">{$lang_table_rtl}</option>
+ </select>
+ </td>
+ </tr>
+
+ <tr>
+ <td class="column1"><label id="langlabel" for="lang">{$lang_table_langcode}</label></td>
+ <td>
+ <input id="lang" name="lang" type="text" value="" class="advfield" />
+ </td>
+ </tr>
+
+ <tr>
+ <td class="column1"><label for="backgroundimage">{$lang_table_bgimage}</label></td>
+ <td>
+ <table border="0" cellpadding="0" cellspacing="0">
+ <tr>
+ <td><input id="backgroundimage" name="backgroundimage" type="text" value="" class="advfield" onchange="changedBackgroundImage();" /></td>
+ <td id="backgroundimagebrowsercontainer">&nbsp;</td>
+ </tr>
+ </table>
+ </td>
+ </tr>
+
+ <tr>
+ <td class="column1"><label for="bordercolor">{$lang_table_bordercolor}</label></td>
+ <td>
+ <table border="0" cellpadding="0" cellspacing="0">
+ <tr>
+ <td><input id="bordercolor" name="bordercolor" type="text" value="" size="9" onchange="updateColor('bordercolor_pick','bordercolor');changedColor();" /></td>
+ <td id="bordercolor_pickcontainer">&nbsp;</td>
+ </tr>
+ </table>
+ </td>
+ </tr>
+
+ <tr>
+ <td class="column1"><label for="bgcolor">{$lang_table_bgcolor}</label></td>
+ <td>
+ <table border="0" cellpadding="0" cellspacing="0">
+ <tr>
+ <td><input id="bgcolor" name="bgcolor" type="text" value="" size="9" onchange="updateColor('bgcolor_pick','bgcolor');changedColor();" /></td>
+ <td id="bgcolor_pickcontainer">&nbsp;</td>
+ </tr>
+ </table>
+ </td>
+ </tr>
+ </table>
+ </fieldset>
+ </div>
+ </div>
+
+ <div class="mceActionPanel">
+ <div style="float: left">
+ <input type="button" id="insert" name="insert" value="{$lang_insert}" onclick="insertTable();" />
+ </div>
+
+ <div style="float: right">
+ <input type="button" id="cancel" name="cancel" value="{$lang_cancel}" onclick="tinyMCEPopup.close();" />
+ </div>
+ </div>
+ </form>
+</body>
+</html>