6
Hello, what I did is the following:
1. I created the AddTable.htm file in the \modules\wfsection dir (code follows;
<HTML>
<HEAD>
<TITLE>Insert Table</TITLE>
<style> td,a,input,select{font-size:9pt}</style>
<script>
function Ok(control,Name,Min,Max)
{
var t= parseInt(control.value);
if (isNaN(t))
{ alert(Name+"Invaild Input");
control.select();
control.focus();
return(null);
}
if(t<Min)
{ alert(Name+"Must larger or equal to "+Min);
control.select();
control.focus();
return(null);
}
if(t>Max)
{ alert(Name+"Must smaller or equal to "+Max);
control.select();
control.focus();
return(null);
}
return(t);
}
function ClickOk()
{
var s;
var i;
var j;
var t=document.Edit;
var iHeight=Ok(t.iHeight,"Row",1,50);
if(iHeight==null) return(false);
var iWidth=Ok(t.iWidth,"Column",1,50);
if(iWidth==null) return(false);
var CellPadding=Ok(t.CellPadding,"Cell Padding",0,100);
if(CellPadding==null) return(false);
var CellSpacing=Ok(t.CellSpacing,"Cell Spacing",0,100);
if(CellSpacing==null) return(false);
var Width=Ok(t.Width,"Table Width",1,2000);
if(Width==null) return(false);
var Border=Ok(t.Border,"Border ",0,100);
if(Border==null) return(false);
var Unit=t.Unit.value;
s="<table width=" +Width+Unit+ " cellspacing="+CellSpacing+" cellpadding="+CellPadding+" border=" + Border +">"
for(i=1 ;i<=iHeight;i++)
{ s=s+"<tr>";
for(j=1;j<=iWidth;j++)
s=s+"<td> </td>";
s=s+"</tr>"
}
s=s+"</table>";
window.returnValue=s;
window.close();
}
function ClickCancel()
{ window.returnValue="";
window.close();
}
</script>
</HEAD>
<BODY topmargin=10 leftmargin=0>
<center>
<table width="274" border="0" cellpadding="0" cellspacing=2 align=center>
<tr>
<form name="Edit">
<td width="40" align="right">Row:</td>
<td width="40">
<input type="text" name="iHeight" maxlength="3" style="width:35;height: 20" value="2">
</td>
<td width="80" align="right">Cell Padding:</td>
<td width="40">
<input type="text" name="CellPadding" maxlength="3"
style="width:35;height: 20" value="0">
</td>
<td rowspan="4" width="4" background="Images/Separator.gif"></td>
<td width="70" align="right">
<input style="width: 60; height: 21"
type="button" name="bntOk" value="OK" onclick="ClickOk();">
</td>
</tr>
<tr>
<td width="40" align="right">Col:</td>
<td width="40">
<input type="text" name="iWidth" size="3" style="width: 35; height: 20" value="2">
</td>
<td width="80" align="right">Cell Spacing:</td>
<td width="40">
<input type="text" name="CellSpacing" maxlength="3" style="width:35;height: 20" value="0">
</td>
<td width="70" align="right">
<input style="width: 60; height: 21" type="button"
name="bntCancel" value="Cancel" onClick="ClickCancel();">
</td>
</tr>
<tr>
<td width="40" align="right">Table Width:</td>
<td colspan="3">
<input type="text" name="Width" maxlength="3"
style="width:35;height: 20" value="100"><select name="Unit">
<option>px</option>
<option value="%" selected>%</option>
</select>
</td>
<td width="66" align="center"></td>
</tr>
<tr>
<td width="40" align="right">Border:</td>
<td width="40">
<input type="text" name="Border" maxlength="3" style="width:35;height: 20" value="1">
</td>
<td width="80"> </td>
<td width="40"> </td>
<td width="66"> </td>
</form>
</tr>
</table>
</center>
</BODY>
</HTML>
2. next I modified the following lines in the wysiwygeditor.php file:
function pasteHTML(HTML)
{
document.frames("<?php echo $myEditor;?>").document.frames("textEdit").innerText = document.frames("<?php echo $myEditor;?>").document.frames("textEdit").innerHTML;
format="Text";
document.frames("<?php echo $myEditor;?>").document.frames("textEdit").innerText=doFormat('Paste',HTML);
copyValue_<?php echo $textareaname;?>();
document.frames("<?php echo $myEditor;?>").document.frames("textEdit").innerHTML = document.frames("<?php echo $myEditor;?>").document.frames("textEdit").innerText;
format="HTML";
}
The thing quite works, meaning with 'quite' that wysiwyg visualization for the table only works only after 'preview' is selected
Bye