EDITJS.JS
资源名称:OA300.rar [点击查看]
上传用户:cctv0805
上传日期:2010-01-03
资源大小:345k
文件大小:44k
源码类别:
OA系统
开发平台:
ASP/ASPX
- var alloweditsource = new Array();
- var tabview = new Array();
- var ae_fieldname = new Array();
- var ae_imagedata = new Array();
- var ae_imageurl = new Array();
- var ae_defaultfont = new Array();
- var ae_baseurl = new Array();
- var ae_breakonenter = new Array();
- var inc = '';
- ae_breakonenter[1] = true;
- ae_baseurl[1] = document.location;
- ae_defaultfont[1] = "";
- tabview[1] = false;
- alloweditsource[1] = true;
- ae_imagedata[1] = '';
- //ae_imageurl[1] = '/media';
- ae_imageurl[1] = '../piclibrary';
- DECMD_BOLD = 5000;
- DECMD_COPY = 5002;
- DECMD_CUT = 5003;
- DECMD_DELETE = 5004;
- DECMD_DELETECELLS = 5005;
- DECMD_DELETECOLS = 5006;
- DECMD_DELETEROWS = 5007;
- DECMD_FINDTEXT = 5008;
- DECMD_FONT = 5009;
- DECMD_GETBACKCOLOR = 5010;
- DECMD_GETBLOCKFMT = 5011;
- DECMD_GETBLOCKFMTNAMES = 5012;
- DECMD_GETFONTNAME = 5013;
- DECMD_GETFONTSIZE = 5014;
- DECMD_GETFORECOLOR = 5015;
- DECMD_HYPERLINK = 5016;
- DECMD_IMAGE = 5017;
- DECMD_INDENT = 5018;
- DECMD_INSERTCELL = 5019;
- DECMD_INSERTCOL = 5020;
- DECMD_INSERTROW = 5021;
- DECMD_INSERTTABLE = 5022;
- DECMD_ITALIC = 5023;
- DECMD_JUSTIFYCENTER = 5024;
- DECMD_JUSTIFYLEFT = 5025;
- DECMD_JUSTIFYRIGHT = 5026;
- DECMD_LOCK_ELEMENT = 5027;
- DECMD_MAKE_ABSOLUTE = 5028;
- DECMD_MERGECELLS = 5029;
- DECMD_ORDERLIST = 5030;
- DECMD_OUTDENT = 5031;
- DECMD_PASTE = 5032;
- DECMD_REDO = 5033;
- DECMD_REMOVEFORMAT = 5034;
- DECMD_SELECTALL = 5035;
- DECMD_SEND_BACKWARD = 5036;
- DECMD_BRING_FORWARD = 5037;
- DECMD_SEND_BELOW_TEXT = 5038;
- DECMD_BRING_ABOVE_TEXT = 5039;
- DECMD_SEND_TO_BACK = 5040;
- DECMD_BRING_TO_FRONT = 5041;
- DECMD_SETBACKCOLOR = 5042;
- DECMD_SETBLOCKFMT = 5043;
- DECMD_SETFONTNAME = 5044;
- DECMD_SETFONTSIZE = 5045;
- DECMD_SETFORECOLOR = 5046;
- DECMD_SPLITCELL = 5047;
- DECMD_UNDERLINE = 5048;
- DECMD_UNDO = 5049;
- DECMD_UNLINK = 5050;
- DECMD_UNORDERLIST = 5051;
- DECMD_PROPERTIES = 5052;
- DECMD_VIEWSOURCE = 6000;
- DECMD_EDITSOURCE = 6001;
- DECMD_ABOUT = 6002;
- DECMD_TOGGLE_DETAILS = 6004;
- DECMD_SAVE = 6005;
- DECMD_EDITTABLE = 6006;
- DECMD_SPELLCHECK = 6007;
- DECMD_SPECIAL_CHARS = 6008;
- DECMD_IMAGE_PROPERTIES = 6009;
- DECMD_HR = 6010;
- OLECMDEXECOPT_DODEFAULT = 0;
- OLECMDEXECOPT_PROMPTUSER = 1;
- OLECMDEXECOPT_DONTPROMPTUSER = 2;
- DECMDF_NOTSUPPORTED = 0;
- DECMDF_DISABLED = 1;
- DECMDF_ENABLED = 3;
- DECMDF_LATCHED = 7;
- DECMDF_NINCHED = 11;
- DEAPPEARANCE_FLAT = 0;
- DEAPPEARANCE_3D = 1;
- OLE_TRISTATE_UNCHECKED = 0;
- OLE_TRISTATE_CHECKED = 1;
- OLE_TRISTATE_GRAY = 2;
- function ae_onerror(msg, detail, popup) {
- errwin = this;
- if(popup) errwin = window.open("","","scrollbars=yes,width=500,height=400,resizable=yes", true);
- errwin.document.write("<HR>对不起,操作出错。</H4><P>");
- errwin.document.write(msg);
- errwin.document.write(detail);
- errwin.document.write("<P><P></TD></TR></TABLE><P><HR>");
- }
- var ae_olddocmd;
- aeObjects = new Array();
- var aeFieldnames = new Array();
- var DHTMLSafe;
- var ae_count;
- var ae_hot;
- var ae_sourceview=false;
- var ae_oldfontfamily='';
- var ae_oldfontsize='';
- var ae_HTMLMode = new Array();
- var tableparamobj=new ActiveXObject("DEInsertTableParam.DEInsertTableParam");
- tableparamobj.NumRows=3;
- tableparamobj.NumCols=3;
- tableparamobj.Caption="";
- tableparamobj.TableAttrs="border=0 cellpadding=0 cellspacing=0 width=75%";
- tableparamobj.CellAttrs="";
- var is_ie4 = ((parseInt(navigator.appVersion) == 4) && (navigator.userAgent.toLowerCase().indexOf("msie 5")==-1) && (navigator.userAgent.toLowerCase().indexOf("msie 6")==-1) );
- function ae_previewNewWin(p) {
- prevWin = window.open("", "", "left=40,top=10,width=720,height=540,menubar=no,toolbar=no,location=no,status=no,resizable=yes,scrollbars=yes");
- if (ae_HTMLMode[1] == true){
- prevWin.document.write("<body size=2>" + DHTMLSafe.DOM.body.innerText);
- }else{
- prevWin.document.write("<body size=2>" + DHTMLSafe.DOM.body.innerHTML);
- }
- if (p==0){
- prevWin.document.title = "内容预览";
- }else{
- prevWin.document.write ("n<OBJECT classid=CLSID:8856F961-340A-11D0-A96B-00C04FD705A2 height=0 id=WB width=0></OBJECT>n<script language="JavaScript">WB.ExecWB(7,1);</script>");
- prevWin.document.close;
- }
- }
- function ae_initialize(num) {
- ae_count=num;
- thisContentItem=eval("document.all.TempContent");
- thisForm=thisContentItem;
- while(thisForm.tagName!="FORM"&&thisForm.tagName!="HTML") {
- thisForm=thisForm.parentElement;
- }
- if(thisForm.tagName!="HTML") {
- DHTMLSafe = eval("thisForm.DHTMLSafe"+num);
- aeObjects[num] = DHTMLSafe;
- aeObjects[thisContentItem.name] = DHTMLSafe;
- aeFieldnames[num] = thisContentItem.name;
- thisForm.onsubmit = ae_onSubmit;
- }
- else {
- alert("对不起,操作出错。", "", true);
- return;
- }
- DHTMLSafe.NewDocument();
- DHTMLSafe.BaseURL=ae_baseurl[num];
- set_tbstates(num);
- ae_onLoad(num);
- ae_HTMLMode[num] = false;
- }
- function ae_onLoad(num) {
- DHTMLSafe=aeObjects[num];
- if(DHTMLSafe.Busy) {
- setTimeout("ae_onLoad("+num+");", 100);
- return;
- }
- if(num==1) window.onunload = ae_onUnload;
- if(ae_defaultfont[num].length)
- DHTMLSafe.DOM.body.style.font=ae_defaultfont[num];
- else {
- DHTMLSafe.DOM.body.style.fontFamily="宋体";
- DHTMLSafe.DOM.body.style.fontSize="12px";
- }
- if(oSel=eval('document.all.oQuickFormat'+num)) { //Populate QuickFormat Box
- var f=new ActiveXObject("DEGetBlockFmtNamesParam.DEGetBlockFmtNamesParam");
- DHTMLSafe.ExecCommand(DECMD_GETBLOCKFMTNAMES,OLECMDEXECOPT_DODEFAULT,f);
- vbarr = new VBArray(f.Names);
- arr = vbarr.toArray();
- for (var i=0;i<arr.length;i++) {
- oOption = document.createElement("OPTION");
- oSel.options.add(oOption);
- oOption.text=arr[i];
- oOption.name=arr[i];
- }
- }
- thisContentItem=eval("document.all.TempContent");
- if(thisContentItem.value.length)
- aeObjects[num].DOM.body.innerHTML = thisContentItem.value;
- else
- aeObjects[num].DOM.body.innerHTML = " ";
- set_tbstates(num);
- if(typeof(aeapi_local_onLoad)=='function')
- aeapi_local_onLoad(DHTMLSafe, aeFieldnames[num]);
- if (typeof(aeapi_onLoad)=='function')
- aeapi_onLoad(DHTMLSafe, aeFieldnames[num]);
- }
- function ae_onUnload() {
- var ae_content = "";
- var i;
- for(i=1;i<=ae_count;i++) {
- DHTMLSafe=aeObjects[i];
- thisContentItem = eval("document.all.TempContent");
- if(ae_sourceview) ae_editsourceinline(i,false);
- var content = DHTMLSafe.DOM.body.innerHTML;
- thisContentItem.value = content;
- }
- }
- function ae_onSubmit() {
- var ae_content = "";
- var i;
- for(i=1;i<=ae_count;i++) {
- DHTMLSafe=aeObjects[i];
- if(ae_sourceview) ae_editsourceinline(i,false);
- thisContentItem = eval("document.all.TempContent");
- if(typeof(aeapi_local_onBeforeSave)=='function')
- ae_content = aeapi_local_onBeforeSave(DHTMLSafe, aeFieldnames[i]);
- else if (typeof(aeapi_onBeforeSave)=='function')
- ae_content = aeapi_onBeforeSave(DHTMLSafe, aeFieldnames[i]);
- else
- ae_content = ae_onBeforeSave(DHTMLSafe, aeFieldnames[i]);
- thisContentItem.value = ae_content;
- }
- }
- function ae_onkeypress(num) {
- var sel;
- DHTMLSafe=aeObjects[num];
- if(ae_breakonenter[num]||ae_sourceview) {
- switch(DHTMLSafe.DOM.parentWindow.event.keyCode) {
- case 10:
- DHTMLSafe.DOM.parentWindow.event.keyCode = 13;
- break;
- case 13:
- if(DHTMLSafe.QueryStatus(DECMD_UNORDERLIST)!=DECMDF_LATCHED) {
- DHTMLSafe.DOM.parentWindow.event.returnValue = false;
- sel = DHTMLSafe.DOM.selection.createRange();
- sel.pasteHTML("<BR>");
- sel.collapse(false);
- sel.select();
- }
- break;
- default:
- break;
- }
- }
- }
- function ae_clear(){
- if (confirm("您真的要清除所写的内容吗?")){
- DHTMLSafe.DOM.body.innerHTML="";
- }
- DHTMLSafe.focus();
- DHTMLSafe.DOM.body.focus();
- }
- function ae_onmousedown(num) {
- if(typeof(document.all.frame1) != "undefined") {
- if(document.all.frame1.style.visibility == "visible") {
- cancelTable(false);
- return;
- }
- }
- }
- function ae_onclick(num) {
- set_tbstates(num);
- }
- function ae_ondisplaychange(num) {
- if(DHTMLSafe.Busy) return;
- set_tbstates(num);
- }
- function ae_onmenuaction(itemIndex, num) {
- ae_onCommand(ContextMenu[itemIndex].cmdId, num);
- }
- function ae_Clear(cmdId, num) {
- }
- //未完成1.加删除线;2.自定义修改意见;3.加批注
- function ae_insertPage(){
- DHTMLSafe.DOM.selection.createRange().pasteHTML("<br>[---P---]<br>");
- DHTMLSafe.focus();
- DHTMLSafe.DOM.body.focus();
- }
- function insertDelMark(){
- DHTMLSafe.document.execCommand('ForeColor', "", "#FF0000");
- DHTMLSafe.document.execCommand('StrikeThrough', "", "");
- }
- function insertErrorMe() {
- content =prompt("请写入错误内容:","");
- if(content!=null) {
- var m_objHTML = DHTMLSafe.DOM.document.selection.createRange();
- DHTMLSafe.document.execCommand('underline');
- originHTML = m_objHTML.htmlText;
- targetHTML = "<span id style=color:red>"+originHTML+"</span>"+"<img style="cursor:hand;" src=EditorImg/face0.gif alt='"+content+"'>";
- m_objHTML.pasteHTML(targetHTML);
- DHTMLSafe.document.execCommand('underline');
- }
- }
- function insertPostil(){
- if (!validateMode()) return;
- content = prompt("请加批注:","");
- if(content!=null){
- content = "<font color='red'>【" + content + "】</font>";
- DHTMLSafe.DOM.document.selection.createRange().pasteHTML(content);
- }
- pureText = false;
- DHTMLSafe.focus();
- }
- //至此
- function ae_onCommand(cmdId, num) {
- if (ae_HTMLMode[num]) { alert("请先切换到可视编辑模式。");return; }
- if(typeof(num)=="undefined") {
- num=ae_hot;
- }
- DHTMLSafe=aeObjects[num];
- if(cmdId==null) cmdid=eval(window.event.srcElement.cid);
- else cmdid=cmdId;
- doFocus=true;
- switch(parseInt(cmdid)) {
- case DECMD_IMAGE:
- oSel = DHTMLSafe.DOM.selection;
- if (oSel.type == "Control") {
- ae_imageProperties(num);
- }else {
- DHTMLSafe.DOM.selection.createRange().collapse(false);
- onImagewin(num);
- }
- doFocus=false;
- break;
- case DECMD_INSERTTABLE:
- onTableWin(num);
- doFocus=false;
- break;
- case DECMD_EDITSOURCE:
- if(tabview[num]) ae_editsourceinline(num);
- else {
- ae_editsource(num);
- doFocus=false;
- }
- break;
- case DECMD_ABOUT:
- ae_about();
- doFocus=false;
- break;
- case DECMD_TOGGLE_DETAILS:
- ae_onToggleDetails(null, num);
- break;
- //case DECMD_SAVE:
- //if (confirm("你确定要保存内容吗?tn点击 [确定] 后保存并将关闭本窗口tnn注意:n如果你不想保留更改内容n请点击 [取消] 后直接关闭窗口。t")){
- //document.form1.TempContent.value=DHTMLSafe.DOM.body.innerHTML;
- //window.returnValue=DHTMLSafe.DOM.innerHTML;
- //window.close();
- //}
- //editform.ae_tx_content1.value=DHTMLSafe.DOM.body.innerHTML;
- //break;
- case DECMD_EDITTABLE:
- editTableWin(num);
- doFocus=false;
- break;
- case DECMD_HYPERLINK:
- ae_hyperlinkwin(num);
- doFocus=false;
- break;
- case DECMD_SPELLCHECK:
- ae_spellcheckwin(num);
- doFocus=false;
- break;
- case DECMD_SPECIAL_CHARS:
- ae_specialchars();
- doFocus=false;
- break;
- //加
- case DECMD_IMAGE_PROPERTIES:
- oSel = DHTMLSafe.DOM.selection.createRange();
- for (i=0; i<oSel.length; i++) {
- if (oSel(i).tagName == "IMG") {
- ae_imageProperties(num);
- doFocus=false;
- }
- }
- break;
- case DECMD_PASTE:
- ae_onPaste(num);
- doFocus=false;
- break;
- case DECMD_HR:
- oSel = DHTMLSafe.DOM.selection;
- if (oSel.type == "Control") {
- alert("您已选中水平线。n如需插入新的水平线,请先取消选择。");
- return;
- }else{
- ae_onHr(num);
- doFocus=false;
- }
- break;
- //至此
- default:
- if(DHTMLSafe.QueryStatus(cmdid)!=DECMDF_DISABLED) {
- DHTMLSafe.ExecCommand(cmdid, OLECMDEXECOPT_DODEFAULT);
- }
- break;
- }
- if (doFocus) {
- DHTMLSafe.focus();
- DHTMLSafe.DOM.body.focus();
- }
- //原if (doFocus) DHTMLSafe.focus();
- }
- //加
- function ae_onHr(num) {
- DHTMLSafe=aeObjects[num];
- DHTMLSafe.focus();
- if (typeof(ae_hrwin) == "undefined" || ae_hrwin.closed) { //short circuit eval
- var szURL=inc + "../editor/hr.htm?instance=" + num;
- ae_hrwin = window.showModalDialog(szURL,window,"dialogHeight: 210px; dialogWidth: 355px; dialogTop: 150px; dialogLeft: 150px; center: Yes; help: No; resizable: No; status: No;");
- }
- }
- function ae_imageProperties(num) {
- DHTMLSafe=aeObjects[num];
- DHTMLSafe.focus();
- if (typeof(ae_imgpropwin) == "undefined" || ae_imgpropwin.closed) { //short circuit eval
- var szURL=inc + "../editor/imageProperties.htm?instance=" + num;
- ae_imgpropwin = window.showModalDialog(szURL,window,"dialogHeight: 300px; dialogWidth: 420px; dialogTop: 150px; dialogLeft: 150px; center: Yes; help: No; resizable: No; status: No;");
- }
- }
- function replaceFontsWithSpans(aeObject, oElement, sNewClass) {
- for(var i=0;i<oElement.childNodes.length;i++) {
- replaceFontsWithSpans(aeObject, oElement.childNodes[i], sNewClass);
- }
- if(oElement.tagName=="FONT") {
- if(oElement.face=="ae_newclass") {
- sPreserve=oElement.innerHTML;
- oNewNode=aeObject.DOM.createElement("SPAN");
- oElement.replaceNode(oNewNode);
- oNewNode.innerHTML=sPreserve;
- oNewNode.className=sNewClass;
- }
- if(oElement.xclass!=null) {
- sPreserve=oElement.innerHTML;
- sClass=oElement.xclass;
- oNewNode=aeObject.DOM.createElement("SPAN");
- oElement.replaceNode(oNewNode);
- oNewNode.innerHTML=sPreserve;
- oNewNode.className=sClass;
- }
- else {
- var style = "";
- if (oElement.face.length) {
- style += "font-family: " + oElement.face + ";";
- }
- if (oElement.size.length) {
- var sizeMap = new Array(7,7,9,12,14,18,24,36);
- var size = oElement.size;
- if (size > 7) size = 7;
- if (size==-1) size = 2;
- if (size==-2) size = 1;
- if (size < -2) size = 1;
- var ptsize = sizeMap[size];
- style += "font-size: " + ptsize + "pt;";
- }
- if (oElement.color.length) {
- style += "color: " + oElement.color + ";";
- }
- if (style.length) {
- sPreserve=oElement.innerHTML;
- oNewNode=aeObject.DOM.createElement("SPAN");
- oElement.replaceNode(oNewNode);
- oNewNode.innerHTML=sPreserve;
- oNewNode.style.cssText=style;
- }
- }
- }
- }
- function condenseSpans(aeObject, oElement, oPrevious) {
- for(var i=0;i<oElement.childNodes.length;i++) {
- var child = oElement.childNodes[i];
- oElement = condenseSpans(aeObject, child, oElement);
- }
- if (oElement.tagName=="SPAN" && oPrevious != null && oPrevious.tagName =="SPAN") {
- if (oElement.innerText == oPrevious.innerText) {
- cClass=oElement.className;
- pClass=oPrevious.className;
- if(pClass.length && !cClass.length) {
- oElement.setAttribute("class", pClass);
- }
- var css = oPrevious.style.cssText;
- var styleProps = css.split("; ");
- var curStyleProps = oElement.style.cssText.split("; ");
- for (var i=0;i<styleProps.length;i++) {
- var kv = styleProps[i].split(":");
- var key = kv[0];
- var value = kv[1];
- var hasProp = false;
- for (var k=0;k<curStyleProps.length;k++) {
- var ckv = curStyleProps[k].split(":");
- var cProp = ckv[0];
- var cValue = ckv[1];
- if (cProp == key) {
- hasProp = true;
- break;
- }
- }
- if (!hasProp) {
- oElement.style.cssText = oElement.style.cssText + ";" + key + ":" + value;
- }
- }
- oPrevious.removeNode(false);
- return oElement;
- }
- }
- return oPrevious;
- }
- function removeExtraniousSpans(aeObject, oElement, oPrevious) {
- for(var i=0;i<oElement.childNodes.length;i++) {
- removeExtraniousSpans(aeObject, oElement.childNodes[i], oElement);
- }
- if (oElement.tagName=="SPAN" && oPrevious != null && oPrevious.tagName =="P") {
- if (oElement.innerText == oPrevious.innerText) {
- cClass=oElement.className;
- pClass=oPrevious.className;
- if(cClass.length) {
- oPrevious.setAttribute("class", pClass);
- }
- var css = oPrevious.style.cssText;
- var styleProps = css.split("; ");
- var curStyleProps = oElement.style.cssText.split("; ");
- for (var i=0;i<curStyleProps.length;i++) {
- var kv = curStyleProps[i].split(":");
- var cProp = kv[0];
- var cValue = kv[1];
- var hasProp = false;
- for (var k=0;k<styleProps.length;k++) {
- var pkv = styleProps[k].split(":");
- var pProp = pkv[0];
- var pValue = pkv[1];
- if (cProp == pProp) {
- hasProp = true;
- break;
- }
- }
- if (!hasProp) {
- oPrevious.style.cssText = oPrevious.style.cssText + ";" + cProp + ":" + cValue;
- }
- }
- oElement.removeNode(false);
- }
- }
- }
- function ae_cleanWord(aeObject) {
- //var newData = "sadad";
- //var newData = aeObject.DOM.body.innerHTML;
- //newData = newData.replace(/<o:p> </o:p>/g, "");
- //newData = newData.replace(/<o:p></o:p>/g, "");
- //newData = newData.replace(/o:/g, "");
- //newData = newData.replace(/<st1:.*?>/g, "");
- //newData = newData.replace(/<?xml:.*?/>/g, "");
- //newData = newData.replace(/<P> </P>/g, "");
- //newData = newData.replace(/ /g, "");
- //newData = newData.replace(/\r/g, "<BR>");
- //newData = newData.replace(/\n/g, "<BR>");
- //newData = newData.replace(/class=MsoNormal/g, "");
- //newData = newData.replace(/class=MsoHeader/g, "");
- //newData = newData.replace(/class=MsoBodyText/g, "");
- //newData = newData.replace(/style="mso-cellspacing.*"/g, "cellspacing=0");
- //newData = newData.replace(/mso-[^";]*/g, "");
- //aeObject.DOM.body.innerHTML = newData;
- //newData = aeObject.DOM.body.innerHTML;
- //newData = newData.replace(/<P></P>/g, "");
- //newData = newData.replace(/<P> </P>/g, "");
- //newData = newData.replace(/<SPAN></SPAN>/g, "");
- //newData = newData.replace(/<SPAN> </SPAN>/g, " ");
- //aeObject.DOM.body.innerHTML = newData;
- //removeExtraniousSpans(aeObject, aeObject.DOM.body, null);
- }
- function ae_onPaste(num) {
- DHTMLSafe=aeObjects[num];
- window.event.returnValue = true;
- var tr = DHTMLSafe.DOM.selection.createRange();
- tr.execCommand("Paste");
- replaceFontsWithSpans(DHTMLSafe, DHTMLSafe.DOM.body, null);
- condenseSpans(DHTMLSafe, DHTMLSafe.DOM.body, null);
- //ae_cleanWord(DHTMLSafe);
- }
- //至此
- function ae_onToggleDetails(bVal, num) {
- DHTMLSafe=aeObjects[num];
- if (bVal == null) {
- DHTMLSafe.ShowDetails = !(DHTMLSafe.ShowDetails);
- }
- else {
- DHTMLSafe.ShowDetails = bVal;
- }
- }
- function editTableWin(num) {
- editTbl = window.showModalDialog(inc + "../editor/edittable.htm",window,"dialogHeight: 350px; dialogWidth: 350px; dialogTop: 150px; dialogLeft: 150px; center: Yes; help: No; resizable: No; status: No;");
- }
- function onTableWin(num) {
- DHTMLSafe=aeObjects[num];
- if(DHTMLSafe.QueryStatus(DECMD_INSERTTABLE) == DECMDF_DISABLED)
- {
- DHTMLSafe.focus();
- return;
- }
- ae_hot = num;
- arr = window.showModalDialog(inc + "../editor/table.htm",window,"dialogHeight: 250px; dialogWidth: 480px; dialogTop: 150px; dialogLeft: 150px; center: Yes; help: No; resizable: No; status: No;");
- }
- function onTable(num) {
- if (ae_HTMLMode[num]) { return; }
- DHTMLSafe=aeObjects[num];
- if(DHTMLSafe.QueryStatus(DECMD_INSERTTABLE) == DECMDF_DISABLED)
- {
- DHTMLSafe.focus();
- return;
- }
- if( document.all.frame1.style.visibility == "visible" ) {
- cancelTable();
- return;
- }
- var str = "<div id="tblsel" style="background-color:#000066;position:absolute;";
- str = str + "width:0;height:0;z-index:-1;"></div>";
- str = str + makeTable(4, 5);
- str = str + "<div style="text-align:center;background-color:menu;font-size: 12px" id="tblstat">插入表格</div>";
- var ifrm = document.frames("frame1");
- var obj=eval("document.all.ae_tbtn"+num);
- var x=0;
- var y=0;
- ifrm.document.body.innerHTML=str;
- while(obj.tagName!="BODY") {
- x+=obj.offsetLeft;
- y+=obj.offsetTop;
- obj=obj.offsetParent;
- }
- document.all.frame1.style.pixelTop = y + 24;
- document.all.frame1.style.pixelLeft = x;
- document.all.frame1.style.pixelWidth = 0;
- document.all.frame1.style.pixelHeight = 0;
- document.all.frame1.style.visibility = "visible";
- ae_hot=num;
- document.frames("frame1").document.body.onmouseover = paintTable;
- document.frames("frame1").document.body.onclick = insertTable;
- if(typeof(document.onmousedown)=="function")
- ae_olddocmd = document.onmousedown;
- else ae_olddoccmd=null;
- document.onmousedown = cancelTable;
- DHTMLSafe.onmousedown = cancelTable;
- event.cancelBubble = true;
- ifrm.document.body.onselectstart=new Function("return false;");
- document.all.frame1.style.pixelWidth = ifrm.document.all.oTable.offsetWidth + 3
- document.all.frame1.style.pixelHeight = ifrm.document.all.oTable.offsetHeight + 3 +
- ifrm.document.all.tblstat.offsetHeight;
- }
- function insertTable(rows, cols, attrs, num) {
- if(typeof(num)=="undefined")
- num=ae_hot;
- DHTMLSafe=aeObjects[num];
- if (typeof(rows) == "undefined") {
- var se = document.frames('frame1').window.event.srcElement;
- if(se.tagName!='TD') {
- cancelTable();
- return;
- }
- tableparamobj.NumRows = se.parentElement.rowIndex + 1;
- tableparamobj.NumCols = se.cellIndex + 1;
- tableparamobj.TableAttrs = "style='border-collapse:collapse;' border=1 bordercolor=#000000 cellPadding=1 cellSpacing=0 width=98% align=center";
- cancelTable();
- }
- else {
- tableparamobj.NumRows = rows;
- tableparamobj.NumCols = cols;
- tableparamobj.TableAttrs = attrs;
- }
- DHTMLSafe.ExecCommand(DECMD_INSERTTABLE,OLECMDEXECOPT_DODEFAULT, tableparamobj);
- DHTMLSafe.focus();
- }
- function paintTable() {
- var se = document.frames('frame1').window.event.srcElement;
- var sr, sc, tbl, fAll;
- fAll = document.frames('frame1').document.all;
- if(se.tagName!='TD') {
- sr = 0;
- sc = 0;
- var str=" Cancel";
- fAll.tblsel.style.width = 0;
- fAll.tblsel.style.height = 0;
- return;
- }
- tbl=fAll.oTable;
- sr=se.parentElement.rowIndex;
- sc=se.cellIndex;
- if(!is_ie4) {
- if(tbl.rows.length == sr+1) {
- var r = tbl.insertRow(-1);
- var td;
- for(var i=0;i<tbl.rows(1).cells.length;i++) {
- td = r.insertCell(-1);
- td.innerHTML = " ";
- td.style.pixelWidth = 20;
- td.style.pixelHeight = 20;
- }
- var bdy = document.frames("frame1").document.body;
- var ifrm = document.frames("frame1");
- document.all.frame1.style.pixelWidth = ifrm.document.all.oTable.offsetWidth + 3
- document.all.frame1.style.pixelHeight = ifrm.document.all.oTable.offsetHeight + 3 +
- ifrm.document.all.tblstat.offsetHeight;
- }
- if(tbl.rows(1).cells.length == sc+1) {
- var td;
- for(var i=0;i<tbl.rows.length;i++) {
- td = tbl.rows(i).insertCell(-1);
- td.innerHTML = " ";
- td.style.pixelWidth = 20;
- td.style.pixelHeight = 20;
- }
- var bdy = document.frames("frame1").document.body;
- document.all.frame1.style.pixelWidth = bdy.createTextRange().boundingWidth + 5;
- document.all.frame1.style.pixelHeight = bdy.createTextRange().boundingHeight + 5;
- }
- }
- var str=(sr+1) + "×" + (sc+1) + "表格";
- fAll.tblsel.style.width = se.offsetWidth*(sc+1)+5;
- fAll.tblsel.style.height = se.offsetHeight*(sr+1)+5;
- fAll.tblstat.innerHTML = str;
- }
- function makeTable(rows, cols) {
- var a, b, str, n;
- str = "<table style="table-layout:fixed;border-style:solid; cursor:default;" ";
- str = str + "id="oTable" cellpadding="0" ";
- str = str + "cellspacing="0" cols=" + cols;
- str = str + " border=6>n";
- for (a=0;a<rows;a++) {
- str = str + "<tr>n";
- for(b=0;b<cols;b++) {
- str = str + "<td width="20">"
- str = str + " </td>n";
- }
- str = str + "</tr>n";
- }
- str = str + "</table>"
- return str;
- }
- function cancelTable(a) {
- document.onmousedown=null;
- document.all.frame1.style.visibility = "hidden";
- document.all.frame1.style.pixelWidth = 0;
- document.all.frame1.style.pixelHeight = 0;
- if(a==false) return;
- if(typeof(ae_olddocmd)=="function") {
- ae_olddocmd(false);
- document.onmousedown = ae_olddocmd;
- }
- ae_olddocmd = null;
- document.all.frame1.style.pixelWidth = 10;
- document.all.frame1.style.pixelHeight = 10;
- }
- function onImagewin(num) {
- DHTMLSafe=aeObjects[num];
- DHTMLSafe.focus();
- if (typeof(ae_imgwin) == "undefined" || ae_imgwin.closed) { //short circuit eval
- var szURL;
- szURL= "../editor/insertimages.htm";
- //ae_imgwin = window.showModalDialog(szURL,window,"dialogHeight: 240px; dialogWidth: 330px; dialogTop: 150px; dialogLeft: 150px; center: Yes; help: No; resizable: No; status: No;scroll:no;");
- ae_imgwin = window.open(szURL, "ae_imgwin", "left=240,top=200,width=330,height=240,menubar=no,toolbar=no,location=no,status=no,resizable=yes,scrollbars=yes");
- }
- //ae_imgwin.focus();
- }
- function onImage(u, base_url, iborder, ialign, ialt, num) {
- DHTMLSafe=aeObjects[num];
- var img = "<img src="" + u + "" border="" + iborder + "" align="" + ialign + "" alt="" + ialt + "">";
- DHTMLSafe.DOM.selection.createRange().pasteHTML(img);
- //ae_imgwin.close();
- }
- function ae_onBeforeSave(aeObject) {
- for (var i=0;i<aeObject.DOM.images.length;i++) {
- hs=aeObject.DOM.images[i].getAttribute("STYLE",0).height;
- ws=aeObject.DOM.images[i].getAttribute("STYLE",0).width;
- if(hs.length) {
- aeObject.DOM.images[i].removeAttribute("HEIGHT", 0);
- aeObject.DOM.images[i].setAttribute("HEIGHT", replaceString("px", "", hs),0);
- aeObject.DOM.images[i].getAttribute("STYLE",0).removeAttribute("HEIGHT",0);
- }
- if(ws.length) {
- aeObject.DOM.images[i].removeAttribute("WIDTH", 0);
- aeObject.DOM.images[i].setAttribute("WIDTH", replaceString("px", "", ws),0);
- aeObject.DOM.images[i].getAttribute("STYLE",0).removeAttribute("WIDTH",0);
- }
- }
- for (var k=0;k<aeObject.DOM.all.tags("TABLE").length;k++) {
- hs=aeObject.DOM.all.tags("TABLE").item(k).getAttribute("STYLE",0).height;
- ws=aeObject.DOM.all.tags("TABLE").item(k).getAttribute("STYLE",0).width;
- if(hs.length) {
- aeObject.DOM.all.tags("TABLE").item(k).removeAttribute("HEIGHT", 0);
- aeObject.DOM.all.tags("TABLE").item(k).setAttribute("HEIGHT", replaceString("px", "", hs),0);
- aeObject.DOM.all.tags("TABLE").item(k).getAttribute("STYLE",0).removeAttribute("HEIGHT",0);
- }
- if(ws.length) {
- aeObject.DOM.all.tags("TABLE").item(k).removeAttribute("WIDTH", 0);
- aeObject.DOM.all.tags("TABLE").item(k).setAttribute("WIDTH", replaceString("px", "", ws),0);
- aeObject.DOM.all.tags("TABLE").item(k).getAttribute("STYLE",0).removeAttribute("WIDTH",0);
- }
- }
- var content = aeObject.DOM.body.innerHTML;
- if(content.length) {
- content = aeObject.FilterSourceCode(content);
- }
- replaceString("", " ", content);
- return content;
- }
- function ae_submit_form(obj, field) {
- var i;
- for(i=1;i<=ae_count;i++) {
- DHTMLSafe=aeObjects[i];
- if (typeof(aeapi_local_onBeforeSave) == "function") {
- var ae_content = aeapi_local_onBeforeSave(DHTMLSafe, aeFieldnames[num]);
- }
- else if (typeof(aeapi_onBeforeSave) == "function") {
- var ae_content = aeapi_onBeforeSave(DHTMLSafe, aeFieldnames[num]);
- }
- else {
- var ae_content = ae_onBeforeSave(DHTMLSafe, aeFieldnames[num]);
- }
- eval(obj).elements[element_idx].value = ae_content;
- }
- eval(obj).submit();
- }
- function replaceString(oldS,newS,fullS) {
- for (var i=0; i<fullS.length; i++) {
- if (fullS.substring(i,i+oldS.length) == oldS) {
- fullS = fullS.substring(0,i)+newS+fullS.substring(i+oldS.length,fullS.length);
- }
- }
- return fullS;
- }
- function ae_about() {
- window.showModalDialog(inc + "../editor/about.htm","","dialogHeight: 260px; dialogWidth: 400px; dialogTop: 150px; dialogLeft: 150px; center: Yes; help: No; resizable: No; status: No;");
- }
- function ae_editsource(num) {
- DHTMLSafe=aeObjects[num];
- DHTMLSafe.DOM.selection.empty();
- codewin =window.showModalDialog(inc + "../editor/editsource.htm",window,"dialogHeight: 490px; dialogWidth: 485px; dialogTop: 70px; dialogLeft: 150px; center: Yes; help: No; resizable: No; status: No;");
- }
- function ae_editsourceinline(num, bVal) {
- DHTMLSafe=aeObjects[num];
- thisContentItem=eval("document.all.TempContent");
- if(ae_HTMLMode[num]==bVal) return;
- DHTMLSafe.DOM.selection.empty();
- if(ae_HTMLMode[num]) {
- document.normaltag.className="latched";
- document.normaltag.type="";
- document.htmltag.className="flat";
- document.htmltag.type="btn";
- if(ae_defaultfont[num].length)
- DHTMLSafe.DOM.body.style.font=ae_defaultfont[num];
- else {
- DHTMLSafe.DOM.body.style.fontFamily="宋体";
- DHTMLSafe.DOM.body.style.fontSize="12px";
- }
- thisContentItem.value=DHTMLSafe.DOM.body.createTextRange().text;
- DHTMLSafe.DOM.body.innerHTML = thisContentItem.value;
- ae_HTMLMode[num] = false;
- }
- else {
- var re=/((<br>)+)/ig;
- document.normaltag.className="flat";
- document.normaltag.type="btn";
- document.htmltag.className="latched";
- document.htmltag.type="";
- DHTMLSafe.DOM.body.style.fontFamily = "宋体";
- DHTMLSafe.DOM.body.style.fontSize = "12px";
- thisContentItem.value=DHTMLSafe.DOM.body.innerHTML;
- DHTMLSafe.DOM.body.innerHTML = "";
- DHTMLSafe.DOM.body.createTextRange().text = thisContentItem.value.replace(re, "$1n");
- ae_HTMLMode[num] = true;
- }
- }
- function ae_specialchars() {
- var szURL = inc + "../editor/specialchars.htm";
- ae_specialwin = window.showModalDialog(szURL,window,"dialogHeight: 275px; dialogWidth: 390px; dialogTop: 70px; dialogLeft: 150px; center: Yes; help: No; resizable: No; status: No;");
- }
- function ae_quickfont(num) {
- if (ae_HTMLMode[num]) { return; }
- DHTMLSafe=aeObjects[num];
- oSel=eval('document.all.oQuickFont'+num);
- DHTMLSafe.ExecCommand(DECMD_SETFONTNAME, OLECMDEXECOPT_DODEFAULT, oSel.options[oSel.selectedIndex].name);
- DHTMLSafe.focus();
- DHTMLSafe.DOM.body.focus();
- replaceFontsWithSpans(DHTMLSafe, DHTMLSafe.DOM.body, null);
- condenseSpans(DHTMLSafe, DHTMLSafe.DOM.body, null);
- }
- function ae_quickfontsize(num) {
- if (ae_HTMLMode[num]) { return; }
- DHTMLSafe=aeObjects[num];
- oSel=eval('document.all.oQuickFontSize'+num);
- DHTMLSafe.ExecCommand(DECMD_SETFONTSIZE, OLECMDEXECOPT_DODEFAULT, oSel.options[oSel.selectedIndex].value);
- DHTMLSafe.focus();
- }
- function ae_quickformat(num) {
- if (ae_HTMLMode[num]) { return; }
- DHTMLSafe=aeObjects[num];
- oSel=eval('document.all.oQuickFormat'+num);
- DHTMLSafe.ExecCommand(DECMD_SETBLOCKFMT, OLECMDEXECOPT_DODEFAULT, oSel.options[oSel.selectedIndex].name);
- DHTMLSafe.focus();
- }
- function ae_hyperlinkwin(num) {
- ae_hot=num;
- DHTMLSafe=aeObjects[num];
- DHTMLSafe.focus();
- if(DHTMLSafe.DOM.selection.type=="Control") {
- var el=DHTMLSafe.DOM.selection.createRange().commonParentElement();
- var tr = DHTMLSafe.DOM.body.createTextRange();
- tr.moveToElementText(el);
- tr.select();
- }
- if (typeof(ae_linkwin) == "undefined" || ae_linkwin.closed) { //short circuit eval
- var szURL=inc + "../editor/hyperlink.htm";
- ae_linkwin = window.showModalDialog(szURL,window,"dialogHeight: 240px; dialogWidth: 400px; dialogTop: 70px; dialogLeft: 150px; center: Yes; help: No; resizable: No; status: No;");
- }
- }
- //加
- function ae_imagepropertywin(num) {
- ae_imgpropertywin =window.showModalDialog(inc + "../editor/imgproperties.htm",window,"dialogHeight: 350px; dialogWidth: 490px; dialogTop: 70px; dialogLeft: 150px; center: Yes; help: No; resizable: No; status: No;");
- }
- function ae_imageproperty(num, aWidth, aHeight, aBorder, aSrc, aAlt, aAlign) {
- DHTMLSafe=aeObjects[num];
- var oSel=DHTMLSafe.DOM.selection.createRange().commonParentElement();
- var tr = DHTMLSafe.DOM.body.createTextRange();
- hs=oSel.getAttribute("STYLE",0).height;
- ws=oSel.getAttribute("STYLE",0).width;
- if (hs.length) {
- oSel.getAttribute("STYLE",0).removeAttribute("HEIGHT",0);
- }
- if (ws.length) {
- oSel.getAttribute("STYLE",0).removeAttribute("WIDTH",0);
- }
- oSel.width=aWidth;
- oSel.height=aHeight;
- oSel.border=aBorder;
- oSel.src=aSrc;
- oSel.alt=aAlt;
- oSel.align=aAlign;
- DHTMLSafe.focus();
- DHTMLSafe.DOM.body.focus();
- tr.moveToElementText(oSel);
- tr.collapse(false);
- tr.select();
- }
- //至此
- function ae_hyperlink(num, iHref, iTarget, iStyle, iClass, iName) {
- DHTMLSafe=aeObjects[num];
- var uid="ae"+Math.random().toString();
- if(iHref=="" && !iName.length) { // Unlink
- if(DHTMLSafe.QueryStatus(DECMD_UNLINK)==DECMDF_ENABLED)
- DHTMLSafe.ExecCommand(DECMD_UNLINK);
- }
- else {
- var trSel=DHTMLSafe.DOM.selection.createRange();
- if(trSel.compareEndPoints("StartToEnd",trSel)==0) { // Need a brand new link
- txtHTML="<A href=""+iHref+"" ";
- if(iTarget.length)
- txtHTML+="target=""+iTarget+"" ";
- if(iStyle.length)
- txtHTML+="style=""+iStyle+"" ";
- if(iClass.length)
- txtHTML+="class=""+iClass+"" ";
- if(iName.length)
- txtHTML+="name=""+iName+"" ";
- txtHTML+=">"+iHref+"</a>";
- trSel.pasteHTML(txtHTML);
- }
- else {
- DHTMLSafe.ExecCommand(DECMD_HYPERLINK,OLECMDEXECOPT_DONTPROMPTUSER,uid);
- var coll=DHTMLSafe.DOM.all.tags("A");
- for(i=0;i<coll.length;i++) {
- if(coll[i].href==uid) {
- coll[i].href=iHref;
- if(iTarget.length) coll[i].target=iTarget;
- else coll[i].removeAttribute("TARGET",0);
- if(iStyle.length) coll[i].style.cssText=iStyle;
- else {
- coll[i].style.cssText="";
- }
- if(iClass.length) coll[i].className=iClass;
- else {
- coll[i].className="";
- }
- }
- }
- }
- }
- DHTMLSafe.focus();
- }
- function ae_spellcheckwin(num) {
- if (typeof(ae_spellwin) == "undefined" || ae_spellwin.closed) { //short circuit eval
- var szURL=inc + "spellchecker/window.cfm?jsvar=aeObjects["+num+"].DOM.body.innerHTML";
- //window.showModalDialog(inc + "editsource.htm",window,"dialogHeight: 490px; dialogWidth: 485px; dialogTop: 70px; dialogLeft: 150px; center: Yes; help: No; resizable: No; status: No;");
- ae_spellwin = window.open(szURL, null, "height=230,width=450,status=no,toolbar=no,menubar=no,location=no");
- }
- ae_spellwin.focus();
- }
- function ShowMenu(num) {
- var menuStrings = new Array();
- var menuStates = new Array();
- var state;
- var i;
- var idx = 0;
- ae_hot=num;
- DHTMLSafe=aeObjects[num];
- ContextMenu.length = 0;
- if(alloweditsource[num]) i=0;
- else i=2;
- for (;i<GeneralContextMenu.length; i++) {
- ContextMenu[idx++] = GeneralContextMenu[i];
- }
- if (DHTMLSafe.QueryStatus(DECMD_INSERTROW) != DECMDF_DISABLED) {
- for (i=0; i<TableContextMenu.length; i++) {
- ContextMenu[idx++] = TableContextMenu[i];
- }
- }
- var tr = DHTMLSafe.DOM.selection.createRange();
- if (DHTMLSafe.DOM.selection.type == "Control") {
- for (i=0; i<ImageContextMenu.length; i++) {
- ContextMenu[idx++] = ImageContextMenu[i];
- }
- }
- for (i=0; i<ContextMenu.length; i++) {
- menuStrings[i] = ContextMenu[i].string;
- if ((menuStrings[i] != MENU_SEPARATOR) && (ContextMenu[i].cmdId < 6000)) {
- state = DHTMLSafe.QueryStatus(ContextMenu[i].cmdId);
- }
- else {
- state = DECMDF_ENABLED;
- }
- if (state == DECMDF_DISABLED || state == DECMDF_NOTSUPPORTED) {
- menuStates[i] = OLE_TRISTATE_GRAY;
- }
- else if (state == DECMDF_ENABLED || state == DECMDF_NINCHED) {
- menuStates[i] = OLE_TRISTATE_UNCHECKED;
- }
- else {
- menuStates[i] = OLE_TRISTATE_CHECKED;
- }
- if (ContextMenu[i].cmdId == DECMD_TOGGLE_DETAILS) {
- if (DHTMLSafe.ShowDetails) {
- menuStates[i] = OLE_TRISTATE_CHECKED;
- }
- else {
- menuStates[i] = OLE_TRISTATE_UNCHECKED;
- }
- }
- if(ContextMenu[i].cmdId == DECMD_EDITSOURCE) {
- if(ae_sourceview) {
- menuStates[i] = OLE_TRISTATE_CHECKED;
- }
- else {
- menuStates[i] = OLE_TRISTATE_UNCHECKED;
- }
- }
- }
- DHTMLSafe.SetContextMenu(menuStrings, menuStates);
- }
- function ContextMenuItem(string, cmdId) {
- this.string = string;
- this.cmdId = cmdId;
- }
- function QueryStatusItem(command, element) {
- this.command = command;
- this.element = element;
- }
- var MENU_SEPARATOR = "";
- var ContextMenu = new Array();
- var GeneralContextMenu = new Array();
- var TableContextMenu = new Array();
- var ImageContextMenu = new Array();
- var genId = 0;
- var tblId = 0;
- var imgId = 0;
- GeneralContextMenu[genId++] = new ContextMenuItem("编辑源代码", DECMD_EDITSOURCE);
- GeneralContextMenu[genId++] = new ContextMenuItem(MENU_SEPARATOR, 0);
- if (!is_ie4) {
- TableContextMenu[tblId++] = new ContextMenuItem(MENU_SEPARATOR, 0);
- TableContextMenu[tblId++] = new ContextMenuItem("表格属性", DECMD_EDITTABLE);
- }
- TableContextMenu[tblId++] = new ContextMenuItem(MENU_SEPARATOR, 0);
- TableContextMenu[tblId++] = new ContextMenuItem("插入行", DECMD_INSERTROW);
- TableContextMenu[tblId++] = new ContextMenuItem("删除行", DECMD_DELETEROWS);
- TableContextMenu[tblId++] = new ContextMenuItem(MENU_SEPARATOR, 0);
- TableContextMenu[tblId++] = new ContextMenuItem("插入列", DECMD_INSERTCOL);
- TableContextMenu[tblId++] = new ContextMenuItem("删除列", DECMD_DELETECOLS);
- TableContextMenu[tblId++] = new ContextMenuItem(MENU_SEPARATOR, 0);
- TableContextMenu[tblId++] = new ContextMenuItem("插入单元格", DECMD_INSERTCELL);
- TableContextMenu[tblId++] = new ContextMenuItem("删除单元格", DECMD_DELETECELLS);
- TableContextMenu[tblId++] = new ContextMenuItem("合并单元格", DECMD_MERGECELLS);
- TableContextMenu[tblId++] = new ContextMenuItem("拆分单元格", DECMD_SPLITCELL);
- ImageContextMenu[imgId++] = new ContextMenuItem(MENU_SEPARATOR, 0);
- ImageContextMenu[imgId++] = new ContextMenuItem("图片属性", DECMD_IMAGE_PROPERTIES);
- GeneralContextMenu[genId++] = new ContextMenuItem("查找", DECMD_FINDTEXT);
- GeneralContextMenu[genId++] = new ContextMenuItem("全部显示", DECMD_TOGGLE_DETAILS);
- GeneralContextMenu[genId++] = new ContextMenuItem(MENU_SEPARATOR, 0);
- GeneralContextMenu[genId++] = new ContextMenuItem("关于", DECMD_ABOUT);
- function ae_m_out(src) {
- if(src.state==0) return;
- if(src.state==2) { src.className="latched"; return; }
- if(src.type=="btn") {
- window.status="";
- src.className="flat";
- }
- }
- function ae_m_over(src) {
- if(src.state==0) return;
- if(src.state==2) return;
- if(src.type=="btn") {
- window.status=src.alt;
- src.className="outset";
- }
- }
- function ae_m_down(src) {
- if(src.state==0) return;
- if(src.type=="btn") {
- src.className="inset";
- }
- }
- function ae_m_up(src) {
- if(src.state==0) return;
- if(src.state==2) { src.className="latched"; return; }
- if(src.type=="btn") {
- src.className="outset";
- }
- }
- function set_tbstates(num) {
- var pbtn;
- var cid;
- var state;
- DHTMLSafe=aeObjects[num];
- ae_tbar=eval("ae_tbar"+num);
- if(DHTMLSafe.QueryStatus(5002)!=DHTMLSafe.QueryStatus(5003)) return;
- for(var i=0;i<ae_tbar.all.length;i++) {
- pbtn= ae_tbar.all(i);
- cid=pbtn.cid;
- if(cid < 6000&&cid!=DECMD_HYPERLINK) {
- if (!is_ie4) pbtn.style.visibility="visible";
- state=DHTMLSafe.QueryStatus(cid)
- if(state == DECMDF_DISABLED || state == DECMDF_NOTSUPPORTED) {
- if(pbtn.state!=0) {
- pbtn.className = "disabled";
- pbtn.state = 0;
- }
- }
- else if(state == DECMDF_ENABLED || state == DECMDF_NINCHED){
- if(pbtn.state!=1) {
- pbtn.className = "flat";
- pbtn.state = 1;
- }
- }
- else {
- if(pbtn.state!=2) {
- pbtn.className = "latched";
- pbtn.state = 2;
- }
- }
- }
- else if(cid==6004) {
- if(DHTMLSafe.ShowDetails) {
- if(pbtn.state!=2) {
- pbtn.className = "latched";
- pbtn.state = 2;
- }
- }
- else {
- if(pbtn.state!=1) {
- pbtn.className = "flat";
- pbtn.state = 1;
- }
- }
- }
- }
- if(oSel=eval('document.all.oQuickFont'+num)){
- if(DHTMLSafe.QueryStatus(DECMD_SETFONTNAME)!=DECMDF_DISABLED&&DHTMLSafe.DOM.selection.type!="control") {
- if(oSel.disabled) oSel.disabled=false;
- fontname=DHTMLSafe.ExecCommand(DECMD_GETFONTNAME);
- if(fontname!=""&&fontname!=null) {
- fCreateNew=true;
- window.status="MoonDowner";
- for(i=0;i<oSel.options.length;i++) {
- if(oSel.options[i].name==fontname) {
- if(!oSel.options[i].selected)
- oSel.options[i].selected=true;
- fCreateNew=false;
- }
- }
- if(fCreateNew) {
- var oOption = document.createElement("OPTION");
- oSel.options.add(oOption,0);
- oOption.text = fontname;
- oOption.name = fontname;
- oOption.selected=true;
- }
- }
- else {
- oSel.selectedIndex=-1;
- }
- }
- else {
- if(!oSel.disabled) oSel.disabled=true;
- }
- }
- if(oSel=eval('document.all.oQuickFontSize'+num)){
- if(DHTMLSafe.QueryStatus(DECMD_SETFONTSIZE)!=DECMDF_DISABLED&&DHTMLSafe.DOM.selection.type!="control") {
- if(oSel.disabled) oSel.disabled=false;
- fs=DHTMLSafe.ExecCommand(DECMD_GETFONTSIZE);
- if(fs!=null&&fs!="") {
- for(i=0;i<oSel.options.length;i++) {
- if(oSel.options[i].name=="ae_fs"+fs&&!oSel.options[i].selected)
- oSel.options[i].selected=true;
- }
- }
- else {
- oSel.selectedIndex=-1;
- }
- }
- else {
- if(!oSel.disabled) oSel.disabled=true;
- }
- }
- if(oSel=eval('document.all.oQuickFormat'+num)){
- if(DHTMLSafe.QueryStatus(DECMD_SETBLOCKFMT)!=DECMDF_DISABLED&&DHTMLSafe.DOM.selection.type!="control") {
- if(oSel.disabled) oSel.disabled=false;
- fmt=DHTMLSafe.ExecCommand(DECMD_GETBLOCKFMT);
- if(fmt!=""&&fmt!=null) {
- for(i=0;i<oSel.options.length;i++) {
- if(oSel.options[i].name==fmt&&!oSel.options[i].selected)
- oSel.options[i].selected=true;
- }
- }
- else {
- oSel.selectedIndex=-1;
- }
- }
- else {
- if(!oSel.disabled) oSel.disabled=true;
- }
- }
- }
- function aeapi_onLoad(aeObject) {
- aeObject.ShowBorders = true;
- }
- function aeapi_onBeforeSave(aeObject) {
- for (var i=0;i<aeObject.DOM.images.length;i++) {
- hs=aeObject.DOM.images[i].getAttribute("STYLE",0).height;
- ws=aeObject.DOM.images[i].getAttribute("STYLE",0).width;
- if(hs.length) {
- aeObject.DOM.images[i].removeAttribute("HEIGHT", 0);
- aeObject.DOM.images[i].setAttribute("HEIGHT", replaceString("px", "", hs),0);
- aeObject.DOM.images[i].getAttribute("STYLE",0).removeAttribute("HEIGHT",0);
- }
- if(ws.length) {
- aeObject.DOM.images[i].removeAttribute("WIDTH", 0);
- aeObject.DOM.images[i].setAttribute("WIDTH", replaceString("px", "", ws),0);
- aeObject.DOM.images[i].getAttribute("STYLE",0).removeAttribute("WIDTH",0);
- }
- }
- for (var k=0;k<aeObject.DOM.all.tags("TABLE").length;k++) {
- hs=aeObject.DOM.all.tags("TABLE").item(k).getAttribute("STYLE",0).height;
- ws=aeObject.DOM.all.tags("TABLE").item(k).getAttribute("STYLE",0).width;
- if(hs.length) {
- aeObject.DOM.all.tags("TABLE").item(k).removeAttribute("HEIGHT", 0);
- aeObject.DOM.all.tags("TABLE").item(k).setAttribute("HEIGHT", replaceString("px", "", hs),0);
- aeObject.DOM.all.tags("TABLE").item(k).getAttribute("STYLE",0).removeAttribute("HEIGHT",0);
- }
- if(ws.length) {
- aeObject.DOM.all.tags("TABLE").item(k).removeAttribute("WIDTH", 0);
- aeObject.DOM.all.tags("TABLE").item(k).setAttribute("WIDTH", replaceString("px", "", ws),0);
- aeObject.DOM.all.tags("TABLE").item(k).getAttribute("STYLE",0).removeAttribute("WIDTH",0);
- }
- }
- var content = aeObject.DOM.body.innerHTML;
- if(content.length) {
- content = aeObject.FilterSourceCode(content);
- }
- replaceString("", " ", content);
- return content;
- }