?? webhtmleditordialog.txt.exclude
字號:
function GetWheWindow()
{
return GetWebHtmlEditorWindowManager().GetCurrentWindow(window);
}
function GetDialogArguments()
{
var wheWindow = GetWheWindow();
if (wheWindow)
{
return wheWindow.Argument;
}
else
{
return null;
}
}
function ImageMapManagerControl(doc, id, mapObj, allMap, themePath, linkCommand, currentCulture, editor)
{
this.Document = doc;
this.Id = id;
this.ImageMapObj = mapObj;
this.ImageSrc = this.ImageMapObj.src;
this.ImageWidth = this.ImageMapObj.offsetWidth;
this.ImageHeight = this.ImageMapObj.offsetHeight;
this.ThemePath = themePath;
this.LinkCommand = linkCommand;
this.CurrentCulture = currentCulture;
this.RunTimeSystemFilePath = editor.RunTimeSystemFilePath
this.Editor = editor;
this.MapIframe = this.Document.getElementById(this.Id + "MapIframe");
this.Button_CreateNewMap = this.Document.getElementById(this.Id + "CreateNewMap");
this.UseMap = null;
this.aHref = new Array();
this.aTarget = new Array();
this.aCoords = new Array();
this.aLeft = new Array();
this.aTop = new Array();
this.aWidth = new Array();
this.aHeight = new Array();
this.aMapName = new Array();
this.Initialize(mapObj.useMap, allMap);
this.InitializeEvent();
}
ImageMapManagerControl.prototype.SetMapLink = function(returnValue, paramObject)
{
this.aHref[paramObject.NewID] = returnValue.href;
this.aTarget[paramObject.NewID] = returnValue.target;
}
ImageMapManagerControl.prototype.EditMapLink = function(elem)
{
var newID = parseInt(elem.id.substr(7));
var ParamObject= new Object();
ParamObject.LinkCaller = this;
ParamObject.NewID = newID;
var linkObject = new Object();
linkObject.realLinkObject = null;
linkObject.href = this.aHref[newID];
linkObject.className = "";
linkObject.text = "";
linkObject.target = this.aTarget[newID];
linkObject.name = "";
linkObject.title = "";
linkObject.ChildNodes = false;
linkObject.Anchors = [];
linkObject.CssClasses = [];
linkObject.Editor = this.Editor;
this.Editor.ShowDialog((this.RunTimeSystemFilePath + "IHttpHandler.ashx?Command=" + this.LinkCommand + "&CurrentCulture=" + this.CurrentCulture),linkObject,020,020,this.CallBackFunction, ParamObject);
return false;
}
ImageMapManagerControl.prototype.CallBackFunction = function (returnValue, paramObject)
{
if (!returnValue || returnValue.href == ""){return;}
paramObject.LinkCaller.SetMapLink(returnValue, paramObject);
}
ImageMapManagerControl.prototype.Initialize = function(useMap, allMap)
{
this.MapIframe.contentWindow.document.open();
this.MapIframe.contentWindow.document.write("<head><style></style></head><body></body>");
if(this.Document.all)
{
this.MapIframe.contentWindow.document.execCommand("2D-Position",true,true);
this.MapIframe.contentWindow.document.execCommand("LiveResize", true, true);
}
this.MapIframe.contentWindow.document.body.contentEditable = true;
this.MapIframe.contentWindow.document.close();
this.MapIframeDocument = this.MapIframe.contentWindow.document;
this.MapIframeBody = this.MapIframeDocument.body;
if(useMap && useMap!="")
{
useMap = useMap.toUpperCase();
var oAllMap = allMap;
for (var i=0; i<oAllMap.length; i++)
{
this.aMapName[i] = oAllMap[i].name.toUpperCase();
if (("#"+this.aMapName[i])==useMap)
{
this.UseMap = oAllMap[i];
}
}
}
var sourceimg = this.MapIframeDocument.createElement("IMG");
sourceimg.src = this.ImageSrc;
sourceimg.id = "SourceImageMap";
sourceimg.border = 0;
sourceimg.width = this.ImageWidth;
sourceimg.height = this.ImageHeight;
this.MapIframeBody.appendChild(sourceimg);
var obj = this;
if(this.UseMap)
{
for (var i=0; i<this.UseMap.areas.length; i++)
{
this.aHref[i] = this.UseMap.areas[i].href;
this.aTarget[i] = this.UseMap.areas[i].target;
this.aCoords[i] = this.UseMap.areas[i].coords;
var a = this.aCoords[i].split(",");
this.aLeft[i] = parseInt(a[0]);
this.aTop[i] = parseInt(a[1]);
this.aWidth[i] = parseInt(a[2])-this.aLeft[i];
this.aHeight[i] = parseInt(a[3])-this.aTop[i];
var img = this.MapIframeDocument.createElement("IMG");
img.src = this.ThemePath + "/Images/ButtonImage/space.gif";
img.style.position = "absolute";
img.style.width = this.aWidth[i];
img.style.height = this.aHeight[i];
img.border = 1;
img.id = "myIMAGE" + i;
img.style.left = this.aLeft[i];
img.style.top = this.aTop[i];
img.style.zIndex = (i+1);
img.ondblclick = function(){obj.EditMapLink(this);};
this.MapIframeBody.appendChild(img);
}
}
}
ImageMapManagerControl.prototype.CreateNewMap = function()
{
var n = this.aHref.length;
this.aHref[n]="";
this.aTarget[n]="";
var img = this.MapIframeDocument.createElement("IMG");
img.src = this.ThemePath + "/Images/ButtonImage/space.gif";
img.style.position = "absolute";
img.style.width = 20;
img.style.height = 20;
img.border = 1;
img.style.left = 0;
img.style.top = 0;
img.id = "myIMAGE" + n;
img.style.zIndex = (n+1);
img.ondblclick = function(){obj.EditMapLink(this);};
this.MapIframeBody.appendChild(img);
try{this.MapIframe.scrollBy(0,0);this.MapIframe.focus();}catch(e){}
}
ImageMapManagerControl.prototype.GetResult = function()
{
var b=false;
for (var i=0; i<this.aHref.length; i++)
{
var obj = this.MapIframeDocument.getElementById("myIMAGE"+i);
if (obj)
{
b=true;
}
}
var html = "";
if (b)
{
for (var i=0; i<this.aHref.length; i++)
{
var obj = this.MapIframeDocument.getElementById("myIMAGE"+i);
if (obj)
{
var nLeft = parseInt(obj.style.left);
var nTop = parseInt(obj.style.top);
var nWidth = parseInt(obj.style.width);
var nHeight = parseInt(obj.style.height);
var nRight = nLeft+nWidth;
var nBottom = nTop+nHeight;
html += "<area shape='rect' href='"+this.aHref[i]+"' target='"+this.aTarget[i]+"' coords='"+nLeft+","+nTop+","+nRight+","+nBottom+"'>";
}
}
if (this.UseMap)
{
this.UseMap.innerHTML = html;
}
else
{
this.UseMap = this.Editor.Document.createElement("MAP");
this.UseMap.name = this.GetAutoMapName();
this.UseMap.innerHTML = html;
this.ImageMapObj.useMap = "#" + this.UseMap.name;
this.Editor.Body.innerHTML += ("<map name=\""+this.UseMap.name+"\">"+html+"</map>");
}
}
else
{
if (this.UseMap)
{
this.UseMap.outerHTML = "";
this.ImageMapObj.removeAttribute("useMap",0);
}
}
var returnArg = new Object();
returnArg.SourceImageMap = this.MapIframeDocument.getElementById("SourceImageMap");
returnArg.MapId = this.UseMap;
this.ImageMapObj.width = returnArg.SourceImageMap.width;
this.ImageMapObj.height = returnArg.SourceImageMap.height;
return returnArg;
}
ImageMapManagerControl.prototype.InitializeEvent = function()
{
var obj = this;
if(this.Button_CreateNewMap)
{
this.Button_CreateNewMap.onclick=function(){obj.CreateNewMap();};
}
}
ImageMapManagerControl.prototype.GetAutoMapName = function()
{
var b=true;
var n=0;
var s=""
while (b)
{
n++;
s = "AutoMap" + n;
if (this.IsValidMapName(s))
{
b=false;
}
}
return s;
}
ImageMapManagerControl.prototype.IsValidMapName = function(str)
{
str=str.toUpperCase();
for (var i=0; i<this.aMapName.length; i++)
{
if (this.aMapName[i]==str)
{
return false;
}
}
return true;
}
function NumValidControl(doc, id, numValidEnum, message)
{
this.Document = doc;
this.Control = this.Document.getElementById(id);
this.Enum = numValidEnum;
this.InvalidMessage = message;
this.ControlValue = this.Control.value;
if (!this.Valid()){ this.Control.value=""; this.ControlValue=""; }
var obj=this ;
this.Control.onchange= function (e)
{
if (!e)e=window.event;
if (!obj.OnChange(e))
{
return false;
}
};
}
NumValidControl.prototype.RexBlank= function ()
{
return this.Control.value.replace(/^\x20*/ig,"").replace(/\x20*$/ig,"");
} ;
NumValidControl.prototype.Valid= function ()
{
var rexValue=this.RexBlank();
var validFlag= true;
switch (this.Enum)
{
case "DIMENSION":
validFlag=(rexValue == "")||rexValue.match(/^[0-9]*((%)|(px))?$/ig);
break;
case "INT":
validFlag=(rexValue == "")||rexValue.match(/[0-9]/ig);
break;
case "FLOAT":
validFlag=!(isNaN(rexValue));
break;
}
return validFlag;
} ;
NumValidControl.prototype.OnChange= function (e)
{
if (!this.Valid())
{
alert(this.InvalidMessage);
this.Control.value=this.ControlValue;
this.Control.focus();
if (e.stopPropagation)
{
e.stopPropagation();
}
e.returnValue= false;
e.cancelBubble= true;
return false;
}
else
{
this.ControlValue=this.RexBlank();
return true;
}
} ;
function TablePropertiesControl(doc, id, tableBgColorPicker, tableAlignmentSelector, tableBorderControl, tableBgImageDialogCaller, tableCellSpacingSpinBox, tableCellPaddingSpinBox)
{
this.Document = doc;
this.TableBgColorPicker = tableBgColorPicker;
this.TableAlignmentSelector = tableAlignmentSelector;
this.TableBorderControl = tableBorderControl;
this.TableBgImageDialogCaller = tableBgImageDialogCaller;
this.TableCellSpacingSpinBox = tableCellSpacingSpinBox;
this.TableCellPaddingSpinBox = tableCellPaddingSpinBox;
this.TableWidth = this.Document.getElementById(this.Id+"TableWidth");
this.TableHeight = this.Document.getElementById(this.Id+"TableHeight");
this.TableWidthValid = new NumValidControl(this.Document, this.TableWidth.id,"DIMENSION", LR["InvalidTableWidth"]);
this.TableHeightValid = new NumValidControl(this.Document, this.TableHeight.id,"DIMENSION", LR["InvalidTableHeight"]);
this.TableId = this.Document.getElementById(this.Id+"TableId");
this.Editor = null;
this.IsInitialize= false;
}
TablePropertiesControl.prototype.Initialize= function (tableToModify, editor, colorsArray)
{
if (!this.IsInitialize)
{
this.Editor = editor;
this.TableToModify = tableToModify;
this.TableBorderControl.Initialize(this.TableToModify);
this.TableBgImageDialogCaller.Initialize(this.Editor);
if(colorsArray)
{
this.TableBgColorPicker.SetColorsArray(colorsArray);
}
this.IsInitialize= true;
}
this.InitializeTableProperty(this.TableToModify);
} ;
TablePropertiesControl.prototype.InitializeTableProperty= function (tableToModify)
{
this.TableToModify = tableToModify;
if ((this.TableToModify.style.width == "")&&(this.TableToModify.width != null))
{
this.TableWidth.value=this.TableToModify.width;
}
else
{
this.TableWidth.value=this.TableToModify.style.width;
}
this.TableId.value=this.TableToModify.getAttribute("id");
if ((this.TableToModify.style.height == "")&&(this.TableToModify.height != null))
{
this.TableHeight.value=this.TableToModify.height;
}
else
{
this.TableHeight.value=this.TableToModify.style.height;
}
this.TableAlignmentSelector.SetValue(this.TableToModify.align);
this.TableCellSpacingSpinBox.Initialize(this.TableToModify.cellSpacing,062,4);
this.TableCellPaddingSpinBox.Initialize(this.TableToModify.cellPadding,062,4);
this.TableBgColorPicker.SetDisabled( true);
this.TableBgColorPicker.SelectColor(this.TableToModify.bgColor.toUpperCase());
this.TableBorderControl.Initialize(this.TableToModify);
if (this.TableBgImageDialogCaller&&this.TableToModify)
{
var imagePath=this.TableToModify.getAttribute("background");
if (!imagePath)
{
imagePath="";
}
this.TableBgImageDialogCaller.SetCallBackValue(imagePath);
}
} ;
TablePropertiesControl.prototype.UpdateTable= function ()
{
if (!this.TableWidthValid.Valid())
{
return false;
}
var rexTableWidth=this.TableWidthValid.RexBlank();
if (rexTableWidth == "")
{
this.TableToModify.removeAttribute("width", false);
if (this.TableToModify.style.removeAttribute)
{
this.TableToModify.style.removeAttribute("width", false);
}
else
{
this.TableToModify.style.width = null;
}
}
else
{
if (this.TableToModify.style.width == "")
{
this.TableToModify.width=rexTableWidth;
}
else
{
this.TableToModify.removeAttribute("width", false);
this.TableToModify.style.width = rexTableWidth;
}
}
if (!this.TableHeightValid.Valid())
{
return false;
}
var rexTableHeight = this.TableHeightValid.RexBlank();
if (rexTableHeight == "")
{
this.TableToModify.removeAttribute("height", false);
if (this.TableToModify.style.removeAttribute)
{
this.TableToModify.style.removeAttribute("height", false);
}
else
{
this.TableToModify.style.height=null;
}
}
else
{
if (this.TableToModify.style.height == "")
{
this.TableToModify.height = rexTableHeight;
}
else
{
this.TableToModify.removeAttribute("height", false);
this.TableToModify.style.height = rexTableHeight;
}
}
if (this.TableId.value)
{
this.TableToModify.setAttribute("id",this.TableId.value);
}
else
{
this.TableToModify.removeAttribute("id", false);
}
var align=this.TableAlignmentSelector.GetSelectItemAlign();
if (align)
{
this.TableToModify.align=align;
}
else
{
this.TableToModify.removeAttribute("align");
}
var tableCellSpacingValue=this.TableCellSpacingSpinBox.GetCurrValue();
if (tableCellSpacingValue&&tableCellSpacingValue>=0)
{
this.TableToModify.cellSpacing=tableCellSpacingValue;
}
else
{
this.TableToModify.removeAttribute("cellSpacing", false);
}
var tableCellPaddingValue=this.TableCellPaddingSpinBox.GetCurrValue();
if (tableCellPaddingValue&&tableCellPaddingValue>=0)
{
this.TableToModify.cellPadding=tableCellPaddingValue;
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -