﻿
function AntaNumberFormat(integralDigits,decimalDigits,digitGrouping)
{
this.IntegralDigits=integralDigits;
this.DecimalDigits=decimalDigits;
this.DigitGrouping=digitGrouping;
}
function AntaRemoveDigitGrouping(value)
{
if(value==null||value.length==0)
{
return value;
}
var parts=value.split(",");
if(parts.length>2)
{
return value;
}
if(parts.length==2&&parts[1].indexOf(".")!=-1)
{
return value;
}
var groups=parts[0].split(".");
if(groups.length==0)
{
return value;
}
if(groups[0].length>3)
{
return value;
}
for(var i=1;i!=groups.length;i++)
{
if(groups[i].length!=3)
{
return value;
}
}
parts[0]=groups.join("");
return parts.join(",");
}
function AntaStringFormat(value)
{
var pattern=/\{\d+\}/g;
var args=arguments;
return value.replace(pattern,function(capture){return args[capture.match(/\d+/)];});
}
function AntaRound(value,decimals)
{
return parseFloat(value.toFixed(decimals));
}
function AntaEncodeInvalidASPNETUrlPart(urlPart)
{
var encodedValue="";
if(urlPart!=null&&urlPart.length>0)
{
for(i=0;i<urlPart.length;i++)
{
var c=urlPart.charAt(i);
var encodeChar=false;
switch(c)
{
case '/':
case '#':
case '_':
case '&':
case ':':
case '?':
case '*':
case '<':
case '>':
case '%':
encodeChar=true;
break;
case '.':
if(i<urlPart.length-1&&urlPart.charAt(i+1)=='.')
{
encodeChar=true;
}
}
if(encodeChar)
{
var charCode=urlPart.charCodeAt(i);
encodedValue=encodedValue+"_"+charCode.toString(16);
}
else
{
encodedValue=encodedValue+c;
}
}
}
else
{
encodedValue=urlPart;
}
return encodedValue;
}
if(!String.prototype.Format)
{
String.prototype.Format=function String_Format()
{
var pattern=/\{\d+\}/g;
var args=arguments;
return this.replace(pattern,function(capture){return args[capture.match(/\d+/)];});
};
}
if(!String.prototype.Trim)
{
String.prototype.Trim=function String_Trim()
{
return this.replace(/^\s+|\s+$/g,"");
};
}
if(!String.prototype.PadLeft)
{
String.prototype.PadLeft=function String_PadLeft(totalWidth,paddingChar)
{
var count=totalWidth-this.length;
if(count>0)
{
if(paddingChar==null)
{
paddingChar=" ";
}
else if(paddingChar.length>1)
{
paddingChar=paddingChar.substr(0,1);
}
var buffer=[];
for(var i=0;i<count;i++)
{
buffer[i]=paddingChar;
}
return buffer.join("")+this.valueOf();
}
else
{
return this.valueOf();
}
};
}
if(!String.prototype.PadRight)
{
String.prototype.PadRight=function String_PadRight(totalWidth,paddingChar)
{
var count=totalWidth-this.length;
if(count>0)
{
if(paddingChar==null)
{
paddingChar=" ";
}
else if(paddingChar.length>1)
{
paddingChar=paddingChar.substr(0,1);
}
var buffer=[];
for(var i=0;i<count;i++)
{
buffer[i]=paddingChar;
}
return this.valueOf()+buffer.join("");
}
else
{
return this.valueOf();
}
};
}
if(!String.prototype.StartsWith)
{
String.prototype.StartsWith=function String_StartsWith(str)
{
return this.slice(0,str.length)==str;
};
}
if(!String.prototype.EndsWith)
{
String.prototype.EndsWith=function String_EndsWith(str)
{
return this.slice(-str.length)==str;
};
}
if(!Number.prototype.Format)
{
Number.prototype.Format=function Number_Format(format)
{
var value=this.valueOf();
if(isNaN(value)||value===Number.NEGATIVE_INFINITY||value===Number.POSITIVE_INFINITY)
{
return value;
}
var stringValue=this.toString(10);
var displayValue=[value<0?"-":""];
var stringValueLength=stringValue.length;
var decimalSeparatorIndex=stringValue.indexOf(".");
var start=(value<0?1:0);
var end=(decimalSeparatorIndex===-1?stringValueLength:decimalSeparatorIndex);
var integralPart=(start<=end?stringValue.substring(start,end):"0");
if(format.IntegralDigits)
{
integralPart=integralPart.PadLeft(format.IntegralDigits,"0");
}
if(format.DigitGrouping&&integralPart.length>3)
{
var digitGroupCount=Math.ceil(integralPart.length/3);
var firstGroupLength=(integralPart.length-1)%3+1;
var digitGroups=[];
for(var i=0;i<digitGroupCount;i++)
{
digitGroups[i]=integralPart.substr(i===0?0:firstGroupLength+3*(i-1),i===0?firstGroupLength:3);
}
displayValue[1]=digitGroups.join(".");
}
else
{
displayValue[1]=integralPart;
}
if(format.DecimalDigits)
{
displayValue[2]=",";
displayValue[3]=(decimalSeparatorIndex===-1||decimalSeparatorIndex===stringValueLength-1?"0":stringValue.substr(decimalSeparatorIndex+1)).PadRight(format.DecimalDigits,"0");
}
return displayValue.join("");
};
}
if(!String.prototype.EscapeHTML)
{
String.prototype.EscapeHTML=function String_EscapeHTML()
{
var value=this.valueOf();
value=value.replace(/\&/g,"&amp;");
value=value.replace(/"/g,"&quot;");
value=value.replace(/</g,"&lt;");
value=value.replace(/>/g,"&gt;");
return value;
};
}
if(!String.prototype.PreserveWhitespace)
{
String.prototype.PreserveWhitespace=function String_PreserveWhitespace()
{
var value=this.valueOf();
value=value.replace(/\r\n/g,"<br/>");
value=value.replace(/\n/g,"<br/>");
value=value.replace(/\t/g,"&nsbp;&nsbp;&nsbp;&nsbp;");
return value;
};
}
function AntaParseInteger(str)
{
try
{
return parseInt(str,10);
}
catch(ex)
{
}
return NaN;
}
﻿
function AntaXmlHttpObject()
{
var xmlHttp;
if(window.XMLHttpRequest)
{
xmlHttp=new XMLHttpRequest();
}
else if(window.ActiveXObject)
{
try
{
xmlHttp=new ActiveXObject("MSXML2.XMLHTTP.3.0");
}
catch(e)
{
xmlHttp=new ActiveXObject("MICROSOFT.XMLHTTP");
}
}
return xmlHttp;
}
function AntaPostBack(url,data,contentType,async,timeout,callback)
{
StartStatistics('AntaPostBack',url);
if(callback==null)
{
callback=function(){};
}
var xmlHttp;
try
{
xmlHttp=AntaXmlHttpObject();
if(xmlHttp==null)
{
ShowDialog(2,AntaDialogButtonOK,"",AntaSR.XmlHttpNotFound,function(){AntaNavigateHome();});
return false;
}
}
catch(ex)
{
ShowDialog(2,AntaDialogButtonOK,"",AntaSR.XmlHttpNotFound,function(){AntaNavigateHome();});
return false;
}
xmlHttp.open("POST",url,async);
xmlHttp.setRequestHeader("Content-Type",contentType);
xmlHttp.send(data);
var timerId;
if(async)
{
timerId=setTimeout(OnPostBackTimeout,(timeout==null?120000:timeout));
xmlHttp.onreadystatechange=function()
{
if(xmlHttp.readyState==4)
{
EndStatistics('AntaPostBack',url);
OnPostBackReady(ValidateResponse());
}
};
}
else
{
EndStatistics('AntaPostBack',url);
OnPostBackReady(ValidateResponse());
}
return true;
function OnPostBackReady(success)
{
window.clearTimeout(timerId);
var functionalError=null;
try{functionalError=xmlHttp.getResponseHeader("AntaFunctionalError");}catch(ex){}
if(functionalError==""){functionalError=null;}
var errorReferenceId=null;
if(!success)
{
try{errorReferenceId=xmlHttp.getResponseHeader("AntaErrorReference");}catch(ex){}
if(errorReferenceId==""){errorReferenceId=null;}
}
callback(success,xmlHttp,{FunctionalError:functionalError,ErrorReference:errorReferenceId});
}
function OnPostBackTimeout()
{
xmlHttp.onreadystatechange=function(){};
xmlHttp.abort();
OnPostBackReady(false);
}
function ValidateResponse()
{
return(xmlHttp.status==200);
}
}
function GetAttributeValue(node,name)
{
return node.getAttribute(name);
}
﻿
var AntaCounter=0;
var AntaIsUnloading=false;
var AntaEvent={};
var AntaEventHandlers=null;
var AntaOnLoadCalled=false;
function AntaOnLoad(e)
{
if(!AntaOnLoadCalled)
{
AntaOnLoadCalled=true;
if(!IsDefined(typeof(e))){var e=this.document.parentWindow.event;};
AntaTry(function()
{
StoreEvent(e);
StartStatistics("AntaOnload",window.location.pathname);
InitializeRootWindow();
CallInitScripts();
document.body.onkeydown=AntaGlobalHandleKeyDown;
document.body.onkeyup=AntaGlobalHandleKeyUp;
window.onresize=AntaGlobalHandleWindowResize;
if(AntaActiveWindow!=null)
{
AntaActiveWindow.SizingBusy=true;
AntaActiveWindow.IterateWebParts(function(webPart)
{
webPart.Initialize();
return true;
});
AntaActiveWindow.SizingBusy=false;
AntaActiveWindow.HandleResize();
}
},
function(ex){OpenErrorPage(ex,null);},null,
function()
{
document.body.style.visibility='visible';
}
);
if(AntaActiveWindow!=null)
{
AntaActiveWindow.IterateWebParts(function(webPart)
{
webPart.InitializeFocus();
return true;
});
}
EndStatistics("AntaOnload",window.location.pathname);
}
}
function AntaGlobalHandleKeyDown(e)
{
if(!IsDefined(typeof(e))){var e=this.document.parentWindow.event;}
StoreEvent(e);
var taken=false;
if(AntaActiveWindow!=null)
{
if(AntaActiveWindow.Blocking===0)
{
taken=AntaActiveWindow.ExecuteAntaEventHandlers(AntaEvent.Type,e);
if(!taken)
{
taken=AntaActiveWindow.HandleKeyDown();
}
if(!taken&&AntaEvent.KeyCode==13&&AntaEvent.SrcElement.contentEditable!="true"&&AntaEvent.SrcElement.tagName!="TEXTAREA")
{
taken=true;
}
}
else
{
var blocker=AntaActiveWindow.ScreenBlockers[AntaActiveWindow.CurrentScreenBlockerId];
taken=blocker.HandleKeyDown();
}
}
if(taken)
{
e.cancelBubble=true;
e.returnValue=false;
return false;
}
else
{
e.cancelBubble=false;
e.returnValue=true;
return true;
}
}
function AntaGlobalHandleKeyUp(e)
{
if(!IsDefined(typeof(e))){var e=this.document.parentWindow.event;}
StoreEvent(e);
var taken=false;
if(AntaActiveWindow!=null&&AntaActiveWindow.Blocking===0)
{
taken=AntaActiveWindow.ExecuteAntaEventHandlers(AntaEvent.Type,e);
if(!taken)
{
taken=AntaActiveWindow.HandleKeyUp();
}
}
if(taken)
{
e.returnValue=false;
e.cancelBubble=true;
return false;
}
else
{
e.returnValue=true;
e.cancelBubble=false;
return true;
}
}
function AntaGlobalHandleWindowResize(e)
{
if(!IsDefined(typeof(e))){var e=this.document.parentWindow.event;}
StoreEvent(e);
AntaRootWindow.HandleResize();
e.cancelBubble=true;
return false;
}
function AntaOnClosing(e)
{
if(!IsDefined(typeof(e))){var e=this.document.parentWindow.event;};
StoreEvent(e);
if(AntaActiveWindow!=null)
{
return AntaActiveWindow.ExecuteAntaEventHandlers(AntaEvent.Type,e);
}
}
function AntaOnUnload(e)
{
if(!IsDefined(typeof(e))){var e=this.document.parentWindow.event;};
StoreEvent(e);
if(AntaActiveWindow!=null)
{
AntaActiveWindow.ExecuteAntaEventHandlers(AntaEvent.Type,e);
}
AntaIsUnloading=true;
if(AntaRootWindow!=null){AntaRootWindow.Unload();}
if(IsDefined(typeof(AntaDataSets))&&AntaDataSets!=null)
{
for(var dataSetId in AntaDataSets)
{
AntaDataSets[dataSetId].Unload();
}
}
}
function CallInitScripts()
{
var scripts=[];
for(var i=0;i<AntaInitScripts.length;i++)
{
scripts.push(AntaInitScripts[i]);
}
for(var i=0;i<AntaInitPartTypeScripts.length;i++)
{
scripts.push(AntaInitPartTypeScripts[i]);
}
AntaInitScripts=[];
AntaInitPartTypeScripts=[];
for(var i=0;i<scripts.length;i++)
{
scripts[i]();
}
EndStatistics("CallInitScripts");
}
function IsDefined(type,elementName)
{
if(type=="undefined"&&(typeof(elementName)!="undefined"&&typeof(elementName)!="unknown")&&elementName!=null&&elementName.indexOf(".")!=-1)
{
return($(elementName)!=null);
}
return(type!="undefined"&&type!="unknown");
}
function IsNullOrEmpty(s)
{
return s==null||s=="";
}
function StoreEvent(e)
{
if(e!=null)
{
AntaEvent={Tag:null};
if(IsDefined(typeof(e.clientX)))
{
AntaEvent.X=e.clientX;
}
else if(IsDefined(typeof(e.pageX)))
{
AntaEvent.Y=e.pageX;
}
else
{
AntaEvent.X=e.x;
}
if(IsDefined(typeof(e.clientY)))
{
AntaEvent.Y=e.clientY;
}
else if(IsDefined(typeof(e.pageY)))
{
AntaEvent.X=e.pageY;
}
else
{
AntaEvent.Y=e.y;
}
if(IsDefined(typeof(e.offsetX)))
{
AntaEvent.OffsetX=e.offsetX;
}else
{
AntaEvent.OffsetX=0;
}
if(IsDefined(typeof(e.offsetY)))
{
AntaEvent.OffsetY=e.offsetY;
}
else
{
AntaEvent.OffsetY=0;
}
AntaEvent.ScreenX=e.screenX;
AntaEvent.ScreenY=e.screenY;
AntaEvent.Type=e.type;
if(IsDefined(typeof(e.keyCode)))
{
AntaEvent.KeyCode=e.keyCode;
}
else
{
AntaEvent.KeyCode=e.which;
}
AntaEvent.ShiftKeyPressed=e.shiftKey;
AntaEvent.CtrlKeyPressed=e.ctrlKey;
AntaEvent.AltKeyPressed=e.altKey;
if(IsDefined(typeof(e.srcElement)))
{
AntaEvent.SrcElement=e.srcElement;
}
if(IsDefined(typeof(e.originalTarget))&&AntaEvent.SrcElement==null)
{
AntaEvent.SrcElement=e.originalTarget;
}
if(IsDefined(typeof(e.currentTarget))&&AntaEvent.SrcElement==null)
{
AntaEvent.SrcElement=e.currentTarget;
}
if(IsDefined(typeof(e.relatedTarget))&&AntaEvent.SrcElement==null)
{
AntaEvent.SrcElement=e.relatedTarget;
}
if(IsDefined(typeof(e.explicitOriginalTarget)))
{
AntaEvent.ExplicitOriginalTarget=e.explicitOriginalTarget;
}
}
}
var AntaDomDataArray=[];
var AntaDomDataCounter=0;
function SetDomEventData(element,domEventData)
{
SetDomData(element,"Event",domEventData);
}
function SetDomData(element,name,domEventData)
{
if(IsDefined(typeof(element[name]))&&element[name]!=null)
{
AntaDomDataArray[element[name]]=domEventData;
}
else
{
AntaDomDataArray[AntaDomDataCounter]=domEventData;
element[name]=AntaDomDataCounter;
AntaDomDataCounter++;
}
}
function GetDomEventData(element)
{
return GetDomData(element,"Event");
}
function GetDomData(element,name)
{
var domEventData=null;
if(IsDefined(typeof(element[name]))&&element[name]!=null)
{
domEventData=AntaDomDataArray[element[name]];
if(!IsDefined(typeof(domEventData))||domEventData==null)
{
if(AntaEvent.SrcElement!=null&&IsDefined(typeof(AntaEvent.SrcElement[name]))&&AntaEvent.SrcElement[name]!=null)
{
domEventData=AntaDomDataArray[AntaEvent.SrcElement[name]];
}
}
}
return domEventData;
}
function RegisterAntaEventHandler(eventType,handler,state)
{
if(AntaActiveWindow!=null)
{
AntaActiveWindow.RegisterEventHandler(eventType,handler,state);
}
}
function AntaTaskQueueConstructor()
{
this.CurrentHighPriorityId=0;
this.ExecutingHighPriorityId=null;
this.CurrentLowPriorityId=0;
this.ExecutingLowPriorityId=null;
this.HighPriorityQueue=[];
this.LowPriorityQueue=[];
this.ExecutingExclusiveTask=false;
this.ExclusiveTask=null;
AntaTaskQueueConstructor.prototype.Register=function AntaTaskQueueConstructor_Register(delegate,errorDelegate,blocking,priority,windowObject,dataObject,requireBlocking)
{
var state={
AntaQueue:this,
Delegate:delegate,
ErrorDelegate:errorDelegate,
Blocking:blocking,
Priority:priority,
WindowObject:windowObject,
DataObject:dataObject,
RequireBlocking:requireBlocking
};
if(priority<0||priority>3){throw "Invalid Task Priority!";}
AntaTry(TryRegister,CatchRegister,state);
function TryRegister(state)
{
if(state.ExclusiveTask!=null||state.AntaQueue.ExecutingExclusiveTask){throw "A task cannot be register while an exclusive task is on the queue.";}
state.DataObject.AsyncPostback=!state.Blocking;
state.DataObject.HandleError=state.ErrorDelegate;
switch(state.Priority)
{
case 0:
if(!state.Blocking){throw "Invalid value, blocking cannot be false when priority is exclusive.";}
else{state.DataObject.BlockDialog=new AntaScreenBlocker(state.WindowObject);}
state.AntaQueue.ExclusiveTask={Delegate:state.Delegate,Data:state.DataObject,Priority:state.Priority};
break;
case 1:
case 2:
if(state.Priority==1&&state.Blocking)
{
if(state.AntaQueue.ExecutingHighPriorityId==null&&state.AntaQueue.HighPriorityQueue.length==0)
{
if(state.RequireBlocking===false)
{
state.Blocking=false;
}
}
}
if(state.Blocking){state.DataObject.BlockDialog=new AntaScreenBlocker(state.WindowObject);}
state.AntaQueue.HighPriorityQueue.push({Delegate:state.Delegate,Data:state.DataObject,Priority:state.Priority});
break;
case 3:
if(state.Blocking){throw "Invalid value, blocking cannot be true when priority is low.";}
state.AntaQueue.LowPriorityQueue.push({Delegate:state.Delegate,Data:state.DataObject,Priority:state.Priority});
break;
}
state.DataObject.TabInfo=IsDefined(typeof(AntaTabInfo))?AntaTabInfo:null;
state.AntaQueue.TryExecute();
}
function CatchRegister(ex,state)
{
var dataObject=state.DataObject;
if(errorDelegate!=null)
{
errorDelegate(dataObject);
}
else
{
OpenErrorPage(ex,null);
}
}
};
AntaTaskQueueConstructor.prototype.HandleError=function AntaTaskQueueConstructor_HandleError(ex,dataObject,errorData)
{
try
{
if(dataObject.BlockDialog!=null)
{
dataObject.BlockDialog.Close();
dataObject.BlockDialog=null;
}
}
catch(ex)
{
OpenErrorPage(ex,null);
}
var errorHandler=dataObject.HandleError;
if(errorHandler!=null)
{
dataObject.HandleError=null;
dataObject.Exception=ex;
errorHandler(dataObject,errorData);
try{AntaTaskQueue.Unregister(dataObject);}
catch(ex){OpenErrorPage(ex,null);}
}
else
{
OpenErrorPage(ex,errorData);
}
};
AntaTaskQueueConstructor.prototype.TryExecute=function AntaTaskQueueConstructor_TryExecute()
{
if(this.ExecutingHighPriorityId==null)
{
var item=this.HighPriorityQueue.shift();
var hasHighPrioItem=(item!=null);
var executeHighPriorityItem=false;
if(hasHighPrioItem)
{
if(item.Priority==1||this.ExecutingLowPriorityId==null)
{
executeHighPriorityItem=true;
}
else
{
this.HighPriorityQueue.unshift(item);
}
}
if(executeHighPriorityItem)
{
this.ExecutingHighPriorityId=this.CurrentHighPriorityId++;
item.Data.TaskId=this.ExecutingHighPriorityId;
item.Data.Priority=1;
item.Delegate(item.Data);
}
else if(!hasHighPrioItem&&this.ExecutingLowPriorityId==null)
{
item=this.LowPriorityQueue.shift();
if(item!=null)
{
this.ExecutingLowPriorityId=this.CurrentLowPriorityId++;
item.Data.TaskId=this.ExecutingLowPriorityId;
item.Data.Priority=2;
item.Delegate(item.Data);
}
else
{
item=this.ExclusiveTask;
if(item!=null)
{
this.ExclusiveTask=null;
this.ExecutingExclusiveTask=true;
item.Data.Priority=0;
item.Delegate(item.Data);
}
}
}
}
};
AntaTaskQueueConstructor.prototype.Unregister=function AntaTaskQueueConstructor_Unregister(dataObject)
{
try
{
switch(dataObject.Priority)
{
case 0:
dataObject.BlockDialog.Close();
dataObject.BlockDialog=null;
if(this.ExecutingExclusiveTask)
{
this.ExecutingExclusiveTask=false;
}
else
{
OpenErrorPage(null,null);
}
if(dataObject.TabInfo!=null){HandleAntaTabInfo(dataObject.TabInfo);}
break;
case 1:
if(dataObject.BlockDialog!=null)
{
dataObject.BlockDialog.Close();
dataObject.BlockDialog=null;
if(dataObject.TabInfo!=null){HandleAntaTabInfo(dataObject.TabInfo);}
}
if(this.ExecutingHighPriorityId==dataObject.TaskId)
{
this.ExecutingHighPriorityId=null;
this.TryExecute();
}
else
{
OpenErrorPage(null,null);
}
break;
case 2:
if(this.ExecutingLowPriorityId==dataObject.TaskId)
{
this.ExecutingLowPriorityId=null;
this.TryExecute();
}
else
{
OpenErrorPage(null,null);
}
break;
}
}
catch(ex)
{
if(dataObject.HandleError!=null)
{
dataObject.HandleError(dataObject);
}
else
{
OpenErrorPage(ex,null);
}
}
};
}
var AntaTaskQueue=new AntaTaskQueueConstructor();
var AntaDebugWindow;
function AntaTraceToDebugWindow(text)
{
var timeStamp=new Date();
text=timeStamp.toTimeString().substring(0,8)+":"+new String(timeStamp.getMilliseconds()).PadLeft(3,"0")+"\n"+text;
if(IsDefined(typeof(AntaDebugActive))&&AntaDebugActive)
{
if(!IsDefined(typeof(AntaDebugWindow))||AntaDebugWindow==null||AntaDebugWindow.closed)
{
AntaDebugWindow=window.open("","debug","width=500,height=500");
if(AntaDebugWindow!=null)
{
if(AntaDebugWindow.document.getElementById("ta")==null)
{
AntaDebugWindow.document.write("<textarea id=\"ta\" rows=\"25\" cols=\"50\"></textarea><br/><button id=\"clearbut\">clear</button>");
}
}
}
if(IsDefined(typeof(AntaDebugWindow))&&AntaDebugWindow!=null&&!AntaDebugWindow.closed)
{
var wtextarea=AntaDebugWindow.document.getElementById("ta");
if(wtextarea!=null)
{
wtextarea.value+=text+"\n";
if(wtextarea.offsetHeight<wtextarea.scrollHeight)
{
wtextarea.scrollTop=(wtextarea.scrollHeight-wtextarea.offsetHeight);
}
}
var but=AntaDebugWindow.document.getElementById("clearbut");
if(but!=null)
{
but.onclick=ClearTrace;
}
}
}
function ClearTrace()
{
if(IsDefined(typeof(AntaDebugWindow))&&AntaDebugWindow!=null&&!AntaDebugWindow.closed)
{
var wtextarea=AntaDebugWindow.document.getElementById("ta");
wtextarea.value="";
}
}
}
function AntaGetCallStack(force)
{
if((IsDefined(typeof(force))&&force)||(IsDefined(typeof(AntaDebugActive))&&AntaDebugActive))
{
var callee=arguments.callee.caller;
var traceDepth=0;
return "----- stackTrace ----- \n"+BuildTrace(callee)+"---------------------- \n"
}
return "";
function BuildTrace(callee)
{
traceDepth++;
if(traceDepth<20&&callee!=null)
{
return GetFunctionName(callee)+"\n"+BuildTrace(callee.caller);
}
if(traceDepth>=20)
{
return "max trace depth (20) reached...\n";
}
return "";
}
function GetFunctionName(fn)
{
var name=/\W*function\s+([\w\$]+)\(/.exec(fn);
if(!name)
{
return "anonymous";
}
else
{
return name[1];
}
}
}
function AntaErrorFormPostBack(exception,url,data)
{
var doc;
if(data==null||IsNullOrEmpty(data.ErrorReference))
{
try
{
if(IsDefined(typeof(AntaActiveWindow))&&AntaActiveWindow!=null)
{
doc=AntaActiveWindow.WindowNode.document;
AntaActiveWindow.ClearEventHandlers("beforeunload");
AntaActiveWindow.ClearEventHandlers("unload");
}
else
{
doc=document;
}
var form=doc.body.appendChild(doc.createElement("form"));
if(!IsDefined(typeof(data))||data==null)
{
data={};
}
data.ErrorCallStack=AntaGetCallStack(true);
for(var item in exception)
{
var input=form.appendChild(doc.createElement("input"));
input.name="exception_"+item;
input.value=encodeURIComponent(exception[item]);
}
for(var item in data)
{
var input=form.appendChild(doc.createElement("input"));
input.name="errorData_"+item;
input.value=encodeURIComponent(data[item]);
}
form.action=url;
form.method="POST";
form.submit();
return;
}
catch(ex)
{
}
}
AntaRedirect(url,false,true,0);
}
﻿
function $(id,win)
{
if(!IsDefined(typeof(win))){var win=(IsDefined(typeof(AntaRootWindow))&&AntaRootWindow!=null)?AntaRootWindow.WindowNode:window;}
return win.document.getElementById(id);
}
function SwapNode(node1,node2)
{
if(node1==node2||node1==null||node2==null)
{
return;
}
if(node1.swapNode)
{
node1.swapNode(node2);
}
else
{
var parent1=node1.parentNode;
var parent2=node2.parentNode;
var clone=node1.cloneNode(true);
if(parent1!=null&&parent2!=null)
{
node2=parent2.replaceChild(clone,node2);
parent1.replaceChild(node2,node1);
parent2.replaceChild(node1,clone);
}
}
}
function CopyChildren(targetParent,sourceParent)
{
if(sourceParent.hasChildNodes())
{
for(var i=0;i<sourceParent.childNodes.length;i++)
{
targetParent.appendChild(sourceParent.childNodes[i].cloneNode(true));
}
}
}
function HideNode(node)
{
if(node!=null&&IsDefined(typeof(node.style)))
{
node.style.display="none";
}
}
function AddAfter(node,nodeToAdd)
{
if(node.parentNode!=null)
{
if(node.nextSibling==null)
{
return node.parentNode.appendChild(nodeToAdd);
}
else
{
return node.parentNode.insertBefore(nodeToAdd,node.nextSibling);
}
}
}
function AddBefore(node,nodeToAdd)
{
if(node.parentNode!=null)
{
return node.parentNode.insertBefore(nodeToAdd,node);
}
}
function ShowNode(node)
{
if(node!=null&&IsDefined(typeof(node.style)))
{
node.style.display="";
}
}
function ToPixels(number)
{
return Math.max(0,Math.floor(number))+"px";
}
function FromPixels(pixelStyle)
{
pixelStyle=pixelStyle.toLowerCase();
if(pixelStyle.indexOf("px")===-1)
{
return 0;
}
var n=parseInt(pixelStyle.replace("px",""),10);
return(isNaN(n))?0:n;
}
function ImportScriptsFromNode(node)
{
var nodeList=SelectNodes(node,".//script");
var success=false;
if(nodeList!=null)
{
success=true;
for(var i=0;i<nodeList.length;i++)
{
success=success&EvalScriptNode(nodeList[i]);
}
}
return success;
}
function SelectTextInNode(range,node)
{
if(IsDefined(typeof(range.moveToElementText)))
{
range.moveToElementText(node);
range.select();
}
else if(IsDefined(typeof(range.selectNodeContents)))
{
range.selectNodeContents(node);
var selection=getSelection();
selection.removeAllRanges();
selection.addRange(range);
}
}
function ImportScripts(request)
{
var text=request.responseText;
var doc=request.responseXML;
var success=false;
if(doc!=null&&doc.firstChild!=null)
{
success=ImportScriptsFromNode(doc);
}
if(!success)
{
var ltext=text.toLowerCase();
if(ltext.indexOf("<script")!=-1)
{
var scripts=ltext.split("<script");
var curPos=0;
for(var i=0;i<scripts.length;i++)
{
if(i>0)
{
var scriptpart=scripts[i].split("</script>");
var cdataIndex=scriptpart[0].indexOf("//<![cdata[");
var start=(cdataIndex!=-1)?(cdataIndex+11):(scriptpart[0].indexOf(">")+1);
var end=(cdataIndex!=-1)?(scriptpart[0].indexOf("//]]>")-1):scriptpart[0].length;
eval(text.substring(curPos+start,curPos+end));
}
curPos+=scripts[i].length;
curPos+=7;
}
}
}
CallInitScripts();
}
function SelectNodes(doc,xpathQuery)
{
if(IsDefined(typeof(window.ActiveXObject)))
{
return doc.selectNodes(xpathQuery);
}
else if(IsDefined(typeof(XPathEvaluator)))
{
try
{
var xpe=new XPathEvaluator();
var nsResolver=xpe.createNSResolver(doc);
var items=xpe.evaluate(xpathQuery,doc,nsResolver,XPathResult.ORDERED_NODE_SNAPSHOT_TYPE,null);
var results=[];
for(var i=0;i<items.snapshotLength;i++)
{
results[i]=items.snapshotItem(i);
}
return results;
}
catch(ex)
{
}
}
else
{
if(xpathQuery.StartsWith("/"))
{
var nodeName=xpathQuery.substring(1).toLowerCase();
if(doc.documentElement!=null)
{
if(doc.documentElement!=null&&doc.documentElement.nodeType==1&&doc.documentElement.nodeName.toLowerCase()==nodeName)
{
return doc.documentElement;
}
}
}
else if(xpathQuery.StartsWith(".//"))
{
var nodeName=xpathQuery.substring(3).toLowerCase();
return doc.getElementsByTagName(nodeName);
}
else if(xpathQuery.StartsWith("./"))
{
var nodeName=xpathQuery.substring(2).toLowerCase();
var result=[];
if(doc.childNodes!=null)
{
for(var i=0;i<doc.childNodes.length;i++)
{
if(doc.childNodes[i].nodeType==1&&doc.childNodes[i].nodeName.toLowerCase()==nodeName)
{
result.push(doc.childNodes[i]);
}
}
}
return result;
}
}
return[];
}
function SelectSingleNode(doc,xpathQuery)
{
if(IsDefined(typeof(window.ActiveXObject)))
{
return doc.selectSingleNode(xpathQuery);
}
else if(IsDefined(typeof(XPathEvaluator)))
{
try
{
var xpe=new XPathEvaluator();
var nsResolver=xpe.createNSResolver(doc);
var results=xpe.evaluate(xpathQuery,doc,nsResolver,XPathResult.FIRST_ORDERED_NODE_TYPE,null);
return results.singleNodeValue;
}
catch(ex)
{
}
}
else
{
if(xpathQuery.StartsWith("/"))
{
var nodeName=xpathQuery.substring(1).toLowerCase();
if(doc.documentElement!=null)
{
if(doc.documentElement!=null&&doc.documentElement.nodeType==1&&doc.documentElement.nodeName.toLowerCase()==nodeName)
{
return doc.documentElement;
}
}
}
else if(xpathQuery.StartsWith("./"))
{
var nodeName=xpathQuery.substring(2).toLowerCase();
if(doc.childNodes!=null)
{
for(var i=0;i<doc.childNodes.length;i++)
{
if(doc.childNodes[i].nodeType==1&&doc.childNodes[i].nodeName.toLowerCase()==nodeName)
{
return doc.childNodes[i];
}
}
}
}
}
return null;
}
function EvalScriptNode(node)
{
if(IsDefined(typeof(node.nodeTypedValue)))
{
eval(node.nodeTypedValue);
return true;
}
if(IsDefined(typeof(node.textContent)))
{
eval(scripttext=node.textContent);
return true;
}
return false;
}
function GetInnerText(element)
{
if(IsDefined(typeof(element.textContent)))
{
return element.textContent;
}
if(IsDefined(typeof(element.innerText)))
{
return element.innerText;
}
}
function CopyHtmlAttributeValue(sourceElement,attributeName,targetElement)
{
var value=GetHtmlAttributeValue(sourceElement,attributeName);
if(value!=null)
{
SetHtmlAttributeValue(targetElement,attributeName,value);
}
else
{
RemoveHtmlAttribute(targetElement,attributeName);
}
}
function SetHtmlAttributeValue(element,attributeName,value)
{
if(element!=null)
{
if(element.setAttribute)
{
element.setAttribute(attributeName,value);
}
else if(element.attributes!=null)
{
if(element.attributes.setNamedItem)
{
var namedItem=document.createAttribute(attributeName);
namedItem.value=value;
element.attributes.setNamedItem(namedItem);
}
else if(element.attributes[attributeName]!=null)
{
element.attributes[attributeName].value=value;
}
}
}
}
function GetHtmlAttributeValue(element,attributeName)
{
if(element!=null)
{
if(element.getAttribute)
{
return element.getAttribute(attributeName);
}
if(element.attributes!=null&&element.attributes[attributeName]!=null)
{
return element.attributes[attributeName].value;
}
}
return null;
}
function RemoveHtmlAttribute(element,attributeName)
{
if(element!=null&&HasHtmlAttribute(element,attributeName))
{
if(element.removeAttribute)
{
element.removeAttribute(attributeName);
}
else if(element.attributes.removeNamedItem)
{
element.attributes.removeNamedItem(attributeName);
}
}
}
function HasHtmlAttribute(element,attributeName)
{
if(element!=null)
{
if(element.hasAttribute)
{
return element.hasAttribute(attributeName);
}
if(element.getAttribute)
{
return(element.getAttribute(attributeName)!=null);
}
if(element.attributes!=null)
{
return(element.attributes[attributeName]!=null);
}
}
return false;
}
function FindParentByTag(node,tagName)
{
if(node!=null&&IsDefined(typeof(node.parentNode))&&node.parentNode!=null)
{
if(IsDefined(typeof(node.parentNode.nodeName))&&node.parentNode.nodeName.toLowerCase()==tagName.toLowerCase())
{
return node.parentNode;
}
else
{
return FindParentByTag(node.parentNode,tagName);
}
}
return null;
}
function FindFirstChildByTag(node,tagName)
{
if(node!=null&&IsDefined(typeof(node.firstChild))&&node.firstChild!=null)
{
if(IsDefined(typeof(node.firstChild.tagName))&&node.firstChild.tagName.toLowerCase()==tagName.toLowerCase())
{
return node.firstChild;
}
else
{
return FindFirstChildByTag(node.firstChild,tagName);
}
}
return null;
}
function GetFirstLevelChildByTag(node,tagName)
{
if(node!=null&&IsDefined(typeof(node.childNodes))&&node.childNodes!=null)
{
for(var i=0;i<node.childNodes.length;i++)
{
if(IsDefined(typeof(node.childNodes[i].tagName))&&node.childNodes[i].tagName.toLowerCase()==tagName.toLowerCase())
{
return node.childNodes[i];
}
}
}
return null;
}
function GetChildByTag(node,tagName)
{
if(node!=null&&IsDefined(typeof(node.childNodes))&&node.childNodes!=null)
{
for(var i=0;i<node.childNodes.length;i++)
{
if(IsDefined(typeof(node.childNodes[i].tagName))&&node.childNodes[i].tagName.toLowerCase()==tagName.toLowerCase())
{
return node.childNodes[i];
}
return GetChildByTag(node.childNodes[i],tagName);
}
}
return null;
}
function GetFirstChild(node)
{
if(node!=null&&IsDefined(typeof(node.childNodes))&&node.childNodes!=null)
{
for(var i=0;i<node.childNodes.length;i++)
{
if(IsDefined(typeof(node.childNodes[i].tagName)))
{
return node.childNodes[i];
}
}
}
return null;
}
function IsParentOf(parentNode,node)
{
if(node==null)
{
return false;
}
if(node.parentNode===parentNode)
{
return true;
}
return IsParentOf(parentNode,node.parentNode);
}
function AddUrlParameter(url,name,value)
{
if(url!=null&&url.length>0)
{
url+=(url.indexOf("?")>-1)?"&":"?";
if(url.indexOf(encodeURIComponent(name)+"=")==-1)
{
url+=encodeURIComponent(name)+"="+encodeURIComponent(value);
}
}
return url;
}
function AddSelectOption(select,option,position)
{
if(IsDefined(typeof(position)))
{
select.options.add(option,position);
}
else
{
select.options.add(option);
}
}
String.prototype.ReplaceClass=function String_ReplaceClass(findClass,replaceClass)
{
var regex=RegExp("(^|\\s+)"+findClass+"($|\\s+)","g");
var result=this.replace(regex," "+replaceClass+" ");
return result.Trim();
}
String.prototype.RemoveClass=function String_RemoveClass(findClass)
{
return this.ReplaceClass(findClass,"");
}
function AntaReplaceCssClass(node,findClass,replaceClass)
{
node.className=node.className.ReplaceClass(findClass,replaceClass)
}
function AntaRemoveCssClass(node,findClass)
{
AntaReplaceCssClass(node,findClass,"");
}
function AntaAddCssClass(node,addClass)
{
if(!AntaContainsCssClass(node,addClass))
{
node.className+=" "+addClass;
}
}
function AntaContainsCssClass(node,className)
{
return AntaTextContainsCssClass(node.className,className);
}
function AntaTextContainsCssClass(text,className)
{
var regex=RegExp("(^|\\s+)"+className+"($|\\s+)","g");
return regex.test(text);
}
String.prototype.IsListTag=function String_IsListTag()
{
var name=this.toLowerCase();
return(name=="ul"||name=="ol")
}
﻿
var AntaLastAction=null;
var AntaPartIdParameter="_anta_partid";
var AntaPartImportedIdParameter="_anta_importedpartid";
var AntaWebPartKey="_anta_domkey_WebPart";
var AntaChildWebForms={};
var AntaWebFormOutputParameters={};
AntaWebPart.prototype.ShowHeaderButton=function AntaWebPart_ShowHeaderButton(code,show)
{
for(var i=0;i<this.HeaderButtons.length;i++)
{
if(this.HeaderButtons[i].Code==code)
{
this.HeaderButtons[i].Show(show);
}
}
}
AntaWebPart.prototype.ToggleButton=function AntaWebPart_ToggleButton(buttonGroupId,buttons,buttonCode)
{
var buttonGroup=this.ButtonToggleGroups[buttonGroupId];
if(this.GetToggledButton(buttonGroupId)!=buttonCode)
{
for(var i=0;i<buttonGroup.ButtonCodes.length;i++)
{
AntaGetButton(buttons,buttonGroup.ButtonCodes[i]).Toggle(buttonGroup.ButtonCodes[i]==buttonCode);
}
}
buttonGroup.ActiveButtonCode=buttonCode;
}
AntaWebPart.prototype.GetToggledButton=function AntaWebPart_GetToggledButton(buttonGroupId)
{
var buttonGroup=this.ButtonToggleGroups[buttonGroupId];
if(IsDefined(typeof(buttonGroup))&&buttonGroup!=null)
{
return buttonGroup.ActiveButtonCode;
}
}
AntaWebPart.prototype.Child=function AntaWebPart_Child(childId)
{
var win=this.WebForm.Window;
return win.Child(this.ClientId,childId);
};
AntaWebPart.prototype.RegisterAntaControl=function AntaWebPart_RegisterAntaControl(control)
{
if(this.AntaControls==null)
{
this.AntaControls={};
}
control.WebPart=this;
this.AntaControls[control.Id]=control;
};
AntaWebPart.prototype.UnregisterAntaControl=function AntaWebPart_UnregisterAntaControl(control)
{
control.WebPart=null;
delete this.AntaControls[control.Id];
};
AntaWebPart.prototype.RegisterAction=function AntaWebPart_RegisterAction(action)
{
action.WebPart=this;
this.Actions[action.Id]=action;
};
AntaWebPart.prototype.GetMaxColumns=function AntaWebPart_GetMaxColumns()
{
var maxColumns=1;
if(this.Type==18)
{
var propTable=this.Child("Properties");
if(propTable!=null)
{
maxColumns=1+this.WebEntrySections.MaxColumns;
}
}
return maxColumns;
};
AntaWebPart.prototype.GetMaxAvailableWidth=function AntaWebPart_GetMaxAvailableWidth(withoutLabel)
{
var maxAvailableWidth=null;
var propTable=null;
switch(this.Type)
{
case 18:
propTable=this.Child("Properties");
break;
case 21:
if(IsDefined(typeof(this.Wizard)))
{
propTable=this.Child("Frame"+this.Wizard.CurrentFrame.Id+"PropertyTable");
}
break;
default:
propTable=this.Child("PropertyTable");
break;
}
if(propTable!=null)
{
var rowCount=0;
if(propTable.rows!=null&&propTable.rows.length>0)
{
var partWidth;
if(this.ScrollNode!=null)
{
partWidth=this.ScrollNode.offsetWidth;
}
else
{
partWidth=this.ContentNode.offsetWidth;
}
var maxColumns=this.GetMaxColumns();
if(withoutLabel)
{
maxAvailableWidth=(partWidth/maxColumns)-16;
}
else
{
maxAvailableWidth=((partWidth-(maxColumns*AntaPropertyLabelWidth))/maxColumns)-16;
}
}
}
return maxAvailableWidth;
};
AntaWebPart.prototype.ResizeAntaControls=function AntaWebPart_ResizeAntaControls()
{
var maxAvailableWidth=this.GetMaxAvailableWidth();
if(maxAvailableWidth!=null)
{
var maxColumns=this.GetMaxColumns();
if(this.AntaControls!=null)
{
for(var controlId in this.AntaControls)
{
var control=this.AntaControls[controlId];
if(control.Column.ControlType==6&&control.Column.UseFullWidth)
{
maxAvailableWidth=this.GetMaxAvailableWidth(true);
}
control.HandleResize(maxAvailableWidth,maxColumns);
}
}
else
{
var win=this.WebForm.Window;
for(var i=0;i<this.ReadOnlyMemoControls.length;i++)
{
this.ReadOnlyMemoControls[i].style.width=ToPixels(maxAvailableWidth-win.GetHorizontalPaddingBorder(this.ReadOnlyMemoControls[i].parentNode)-2);
}
}
}
};
AntaWebPart.prototype.RegisterShortCut=function AntaWebPart_RegisterShortCut(key,button)
{
if(key!=null)
{
this.ShortCuts[key]=new AntaShortCut(key,OnPressed);
this.ShortCuts[key].Button=button;
}
function OnPressed(shortCut)
{
if(shortCut.Button!=null)
{
shortCut.Button.Click();
}
}
};
AntaWebPart.prototype.HandleMouseDown=function AntaWebPart_HandleMouseDown(e)
{
if(!IsDefined(typeof(e))){var e=this.document.parentWindow.event;}
StoreEvent(e);
var webPart=GetDomEventData(this);
if(IsDefined(typeof(webPart))&&webPart!=null&&webPart.CanBeActivated)
{
webPart.Activate();
}
e.cancelBubble=false;
e.returnValue=true;
return true;
};
AntaWebPart.prototype.HandleHeaderMouseDown=function AntaWebPart_HandleHeaderMouseDown(e)
{
if(!IsDefined(typeof(e))){var e=this.document.parentWindow.event;}
StoreEvent(e);
var webPart=GetDomEventData(this);
if(IsDefined(typeof(webPart))&&webPart!=null&&webPart.CanBeActivated)
{
webPart.Activate();
}
e.cancelBubble=true;
return false;
};
AntaWebPart.prototype.Activate=function AntaWebPart_Activate()
{
if(this.WebForm.ActiveWebPart!=this)
{
var activeWebPart=this.WebForm.ActiveWebPart;
if(activeWebPart!=null)
{
if(IsDefined(typeof(activeWebPart.ActiveNode))&&activeWebPart.ActiveNode!=null)
{
activeWebPart.ActiveNode.className=activeWebPart.ActiveNode.className.replace(/active/,"inactive");
}
if(IsDefined(typeof(activeWebPart.OnDeactivate))&&activeWebPart.OnDeactivate!=null)
{
activeWebPart.OnDeactivate(this);
}
}
if(IsDefined(typeof(this.ActiveNode))&&this.ActiveNode!=null)
{
this.ActiveNode.className=this.ActiveNode.className.replace(/inactive/,"active");
}
this.WebForm.ActiveWebPart=this;
if(this.ActivationHandler!=null)
{
this.ActivationHandler.HandlePartActivate(this);
}
var activeWebForm=this.WebForm;
this.WebForm.Window.IterateWebForms(function(webForm)
{
if(webForm!=activeWebForm)
{
webForm.ActiveWebPart=null;
}
return true;
});
}
};
AntaWebPart.prototype.SetTitle=function AntaWebPart_SetTitle(title)
{
this.Title=title;
if(this.HeaderNode!=null)
{
this.WebForm.Window.SetInnerText(this.Child("HeaderTitle"),title);
}
};
AntaWebPart.prototype.ResetSizeState=function AntaWebPart_ResetInitState()
{
this.Maximized=false;
this.Minimized=false;
this.FilledOut=false;
this.WebForm.CheckSizeState();
}
AntaWebPart.prototype.Minimize=function AntaWebPart_Minimize()
{
this.WasMaximized=this.Maximized;
if(this.WasMaximized)
{
this.WasMinimized=false;
this.RestoreFromMaximize();
}
this.WasFilledOut=this.FilledOut;
if(this.WasFilledOut)
{
if(this.HeaderNode!=null)
{
this.ShowHeaderButton("Maximize",false);
this.ShowHeaderButton("LeaveMaximize",false);
this.ShowHeaderButton("Minimize",false);
this.ShowHeaderButton("LeaveMinimize",true);
}
}
else
{
if(this.HeaderNode!=null)
{
this.ShowHeaderButton("Maximize",true);
this.ShowHeaderButton("LeaveMaximize",false);
this.ShowHeaderButton("Minimize",false);
this.ShowHeaderButton("LeaveMinimize",true);
}
}
this.Minimized=true;
if(this.ScrollNode!=null)
{
HideNode(this.ScrollNode);
}
else
{
HideNode(this.ContentNode);
}
this.WebForm.CheckSizeState();
};
AntaWebPart.prototype.RestoreFromMinimize=function AntaWebPart_RestoreFromMinimize()
{
if(this.ScrollNode!=null)
{
ShowNode(this.ScrollNode);
}
else
{
ShowNode(this.WebPartContentNode);
}
this.Minimized=false;
if(this.WasMaximized)
{
this.WasMaximized=false;
this.Maximize();
}
else if(this.WasFilledOut)
{
this.WasFilledOut=false;
this.FillOut();
}
else
{
if(this.HeaderNode!=null)
{
this.ShowHeaderButton("Maximize",true);
this.ShowHeaderButton("LeaveMaximize",false);
this.ShowHeaderButton("Minimize",true);
this.ShowHeaderButton("LeaveMinimize",false);
}
}
this.WebForm.CheckSizeState();
};
AntaWebPart.prototype.FillOut=function AntaWebPart_FillOut()
{
this.WasFilledOut=this.FilledOut;
if(this.HeaderNode!=null)
{
this.ShowHeaderButton("Maximize",false);
this.ShowHeaderButton("LeaveMaximize",false);
this.ShowHeaderButton("Minimize",true);
this.ShowHeaderButton("LeaveMinimize",false);
}
this.FilledOut=true;
this.WebForm.CheckSizeState();
};
AntaWebPart.prototype.Maximize=function AntaWebPart_Maximize()
{
this.WasMinimized=this.Minimized;
if(this.WasMinimized)
{
this.WasMaximized=false;
this.RestoreFromMinimize();
}
if(this.HeaderNode!=null)
{
this.ShowHeaderButton("Maximize",false);
this.ShowHeaderButton("LeaveMaximize",true);
this.ShowHeaderButton("Minimize",true);
this.ShowHeaderButton("LeaveMinimize",false);
}
this.Maximized=true;
if(this.ScrollNode!=null)
{
this.OldHeight=(this.ScrollNode.style.height=="")?"auto":this.ScrollNode.style.height;
}
else
{
this.OldHeight=(this.ContentNode.style.height=="")?"auto":this.ContentNode.style.height;
}
this.OldWidth=(this.PartNode.style.width=="")?"auto":this.PartNode.style.width;
this.ScrollTop=this.WebForm.Window.ScrollNode.scrollTop;
this.WebForm.ToMaximizedZone(this);
this.WebForm.CheckSizeState();
this.Activate();
};
AntaWebPart.prototype.RestoreFromMaximize=function AntaWebPart_RestoreFromMaximize()
{
this.WebForm.FromMaximizedZone(this);
if(this.ScrollNode!=null)
{
this.ScrollNode.style.height=this.OldHeight;
}
else
{
this.ContentNode.style.height=this.OldHeight;
}
this.PartNode.style.width=this.OldWidth;
this.Maximized=false;
if(this.WasMinimized)
{
this.WasMinimized=false;
this.Minimize();
}
else
{
if(this.HeaderNode!=null)
{
this.ShowHeaderButton("Maximize",true);
this.ShowHeaderButton("LeaveMaximize",false);
this.ShowHeaderButton("Minimize",true);
this.ShowHeaderButton("LeaveMinimize",false);
}
}
this.WebForm.CheckSizeState();
this.WebForm.Window.ScrollNode.scrollTop=this.ScrollTop;
};
AntaWebPart.prototype.InitializeFocus=function AntaWebPart_InitializeFocus()
{
if(this.InitializationFocusHandler!=null)
{
this.InitializationFocusHandler.HandlePartInitializeFocus();
}
}
AntaWebPart.prototype.Initialize=function AntaWebPart_Initialize()
{
if(this.InitializationHandler!=null)
{
this.InitializationHandler.HandlePartInitialize();
}
if(IsDefined(typeof(this.InitialState)))
{
switch(this.InitialState.SizeState)
{
case 1:
this.Maximize();
break;
case 2:
this.Minimize();
break;
case 3:
this.Maximize();
if(this.HeaderNode!=null)
{
this.ShowHeaderButton("LeaveMaximize",false);
this.ShowHeaderButton("Minimize",false);
}
break;
case 4:
this.FillOut();
break;
case 5:
this.FillOut();
this.Activate();
break;
}
if(this.InitialState.Height!=""&&this.InitialState.Height!="auto")
{
this.SetHeight(this.InitialState.Height);
}
if(this.InitialState.ActivateOnStartup)
{
this.Activate();
}
}
};
AntaWebPart.prototype.HandleResize=function AntaWebPart_HandleResize()
{
if(this.ContentNode!=null)
{
this.ResizeAntaControls();
if(this.ResizeHandler!=null)
{
var height;
if(this.ScrollNode!=null)
{
height=this.ScrollNode.style.height;
}
else
{
height=this.ContentNode.style.height;
}
this.ResizeHandler.HandlePartResize(height);
}
}
};
AntaWebPart.prototype.ShowHeader=function AntaWebPart_ShowHeader(show)
{
if(this.HeaderNode!=null)
{
if(show)
{
ShowNode(this.HeaderNode);
}
else
{
HideNode(this.HeaderNode);
}
}
}
AntaWebPart.prototype.GetHeight=function AntaWebPart_GetHeight()
{
if(this.InitialState.HeightType==4)
{
return this.InitialState.Height;
}
if(this.ScrollNode!=null)
{
return this.ScrollNode.style.height;
}
else
{
return this.ContentNode.style.height;
}
}
AntaWebPart.prototype.GetPadding=function AntaWebPart_GetPadding()
{
return ToPadding(this.PartNode.style.paddingTop)+" "+ToPadding(this.PartNode.style.paddingLeft)+" "+ToPadding(this.PartNode.style.paddingBottom)+" "+ToPadding(this.PartNode.style.paddingRight);
function ToPadding(padding)
{
if(padding=="")
{
return "0px";
}
return padding;
}
}
AntaWebPart.prototype.SetPadding=function AntaWebPart_SetPadding(padding)
{
this.PartNode.style.padding=padding;
}
AntaWebPart.prototype.GetWidth=function AntaWebPart_GetWidth()
{
return this.PartNode.style.width;
}
AntaWebPart.prototype.SetHeight=function AntaWebPart_SetHeight(height,wholePart)
{
var heightToSet;
if(height==""||height=="auto")
{
heightToSet="auto";
}
else
{
var heightNum=FromPixels(height);
var headerHeight=0;
if(wholePart)
{
if(this.HeaderNode!=null)
{
heightNum-=this.HeaderNode.offsetHeight;
}
if(this.ActiveNode!=null)
{
heightNum-=this.WebForm.Window.GetVerticalPaddingBorder(this.ActiveNode);
}
if(this.LinkToSourceNode!=null)
{
heightNum-=this.LinkToSourceNode.offsetHeight;
}
}
heightToSet=ToPixels(heightNum);
}
var sizableNode;
if(this.ScrollNode!=null)
{
sizableNode=this.ScrollNode;
}
else
{
sizableNode=this.ContentNode;
}
sizableNode.style.height=heightToSet;
};
AntaWebPart.prototype.SetMinMaxHeight=function AntaWebPart_SetMinMaxHeight(minHeight,maxHeight)
{
this.InitialState.HeightType=4;
this.InitialState.Height=ToPixels(maxHeight);
this.InitialState.MinHeight=minHeight;
};
AntaWebPart.prototype.RegisterHeaderButton=function AntaWebPart_RegisterHeaderButton(buttonProperties)
{
var button=AttachWebButton(this.WebForm.Window,buttonProperties,OnClick);
button.WebPart=this;
AntaAddButton(this.HeaderButtons,button);
return button;
function OnClick(buttonObject)
{
if(buttonObject.Action!=null)
{
buttonObject.WebPart.ExecuteActionQueued(buttonObject.Action);
}
switch(buttonObject.Code)
{
case "Maximize":
buttonObject.WebPart.Maximize();
break;
case "LeaveMaximize":
buttonObject.WebPart.RestoreFromMaximize();
break;
case "Minimize":
buttonObject.WebPart.Minimize();
break;
case "LeaveMinimize":
buttonObject.WebPart.RestoreFromMinimize();
break;
case "Refresh":
buttonObject.WebPart.Refresh();
break;
}
}
};
AntaWebPart.prototype.Refresh=function AntaWebPart_Refresh(params)
{
var webPart=this;
if(this.Type==AntaPartTypeView||this.Type==AntaPartTypeMenu||this.Type==AntaPartTypeCalendar||this.Type==AntaPartTypeBanner||this.Type==AntaPartTypeImage||this.Type==AntaPartTypeVideoClip)
{
var data=this.CreateEventXml(params);
var url=this.WebForm.WebFormEventUrlPrefix+"/part/refresh";
AntaPostBack(url,data,"text/xml",false,null,RefreshCallback);
}
function RefreshCallback(success,response,errorData)
{
if(success)
{
if(response!=null)
{
webPart.RefreshFromRequest(response);
}
}
else
{
ShowUnexpectedError();
}
}
};
AntaWebPart.prototype.RefreshFromRequest=function AntaWebPart_RefreshFromRequest(response,node)
{
var win=this.WebForm.Window;
var parent=this.ContentNode.parentNode;
var partClientid=this.ClientId;
var contentid=this.ContentNode.id;
this.WebForm.Window.RemoveNode(this.ContentNode);
var newnode=this.WebForm.Window.ImportRequest(parent,response,node);
newnode.id=contentid;
this.PartNode=$(partClientid,win.WindowNode);
this.ContentNode=newnode;
this.HeaderNode=this.Child("Header");
this.ScrollNode=this.Child("Scroll");
this.LinkToSourceNode=this.Child("LinkToSource");
this.Initialize();
if(this.ScrollNode!=null)
{
this.SetHeight(this.ScrollNode.style.height,false);
}
else if(this.ContentNode!=null)
{
this.SetHeight(this.ContentNode.style.height,false);
}
this.HandleResize();
};
AntaWebPart.prototype.CreateEventXml=function AntaWebPart_CreateEventXml(props)
{
if(!IsDefined(typeof(props)))
{
props={};
}
props[AntaPartIdParameter]=this.Id;
if(this.ImportedPartId!=null)
{
props[AntaPartImportedIdParameter]=this.ImportedPartId;
}
return this.WebForm.CreateEventXml(props,this.WebFormLocation,this.WebFormQueryString,this.WebFormSessionId,this.Published);
};
AntaWebPart.prototype.ExecuteActionQueued=function AntaWebPart_ExecuteActionQueued(action)
{
var data={WebPart:this,Action:action};
if(IsDefined(typeof(AntaTaskQueue)))
{
AntaTaskQueue.Register(HandleExecute,null,true,2,this.WebForm.Window,data);
}
else
{
this.ExecuteAction(action);
}
function HandleExecute(data)
{
if(data.Action.SyncData)
{
var validationResult=null;
if(data.Action.Type==7)
{
if(data.Action.WebButton.AntaControl!=null&&data.Action.FieldValidation)
{
validationResult=data.Action.WebButton.AntaControl.Field.Validate();
}
}
else
{
validationResult=data.WebPart.DataSet.Validate(true,false);
}
if(validationResult!=null&&!validationResult.Valid)
{
ShowDialog(1,AntaDialogButtonOK,"",validationResult.Message);
AntaTaskQueue.Unregister(data);
return;
}
}
data.WebPart.ExecuteAction(data.Action);
AntaTaskQueue.Unregister(data);
}
};
AntaWebPart.prototype.ExecuteActionForPart=function AntaWebPart_ExecuteActionForPart(webPart,action,answers,queued)
{
webPart.CallbackPart=this;
if(queued)
{
webPart.ExecuteActionQueued(action);
}
else
{
webPart.ExecuteAction(action,answers);
}
}
AntaWebPart.prototype.ExecuteAction=function AntaWebPart_ExecuteAction(action,answers)
{
var webPart=this;
var urlTypePart=(action.Type===0)?"/action/":"/"+GetEventTypePart(action.Type)+"/action/";
var eventurl=webPart.WebForm.WebFormEventUrlPrefix+urlTypePart+action.Id;
var blocking=null;
if(!IsDefined(typeof(action.IsAsync))||!action.IsAsync)
{
blocking=new AntaScreenBlocker(webPart.WebForm.Window);
}
var props={};
if(action.IsSwitchable)
{
props["pressed"]=action.Pressed;
}
if(IsDefined(typeof(action.Data)))
{
props["actiondata"]=action.Data;
}
if((IsDefined(typeof(AntaDebugActive))&&AntaDebugActive)||(IsDefined(typeof(AntaTracingActive))&&AntaTracingActive))
{
var stats=GetStatistics();
if(stats!="")
{
props["statistics"]={node:stats};
}
}
if(IsDefined(typeof(action.ActionParameters))&&action.ActionParameters!=null)
{
var actionParametersNode="";
for(var key in action.ActionParameters)
{
var value="";
var nodeValue="";
if(action.ActionParameters[key]!=null)
{
if(action.ActionParameters[key].IsXml)
{
nodeValue=action.ActionParameters[key].Value;
}
else
{
value=action.ActionParameters[key].Value;
}
}
actionParametersNode+="<param id=\"" + key.EscapeHTML() + "\"";
if(nodeValue!="")
{
actionParametersNode+=">"+nodeValue+"</param>";
}
else
{
actionParametersNode+=" value=\"" + value.EscapeHTML() + "\"/>";
}
}
if(actionParametersNode!="")
{
props["actionparams"]={node:"<params>"+actionParametersNode+"</params>"};
}
}
if(action.SyncData&&IsDefined(typeof(webPart.DataSet))&&webPart.DataSet!=null)
{
var changeData=null;
if(action.Type==7)
{
changeData=webPart.DataSet.GetChangeData(null,null,null,false,true,true);
}
else
{
changeData=webPart.DataSet.GetChangeData(null,null,null,true,true,true);
}
if(changeData!=null)
{
props["syncdata"]="1";
props["dataxml"]={node:changeData.Xml};
}
}
if(IsDefined(typeof(answers))&&answers!=null&&answers.length>0)
{
props["answers"]={node:answers};
}
if(IsDefined(typeof(action.LongOperation))&&action.LongOperation)
{
action.ProgressDialog=new AntaDialog(4,AntaDialogButtonUnknown,action.Caption,AntaSR.PleaseWait);
}
var eventxml=webPart.CreateEventXml(props);
AntaPostBack(eventurl,eventxml,"text/xml",(IsDefined(typeof(action.IsAsync))&&action.IsAsync)||(IsDefined(typeof(action.LongOperation))&&action.LongOperation),null,ActionCallback);
function ActionCallback(success,response,errorData)
{
if(IsDefined(typeof(action.LongOperation))&&action.LongOperation)
{
action.ProgressDialog.Close();
}
var callbackPart;
if(IsDefined(typeof(webPart.CallbackPart))&&webPart.CallbackPart!=null)
{
callbackPart=webPart.CallbackPart;
webPart.CallbackPart=null;
}
else
{
callbackPart=webPart;
}
if(!callbackPart.HandleActionResultCallback(success,response,errorData))
{
OpenErrorPage(null,errorData);
}
if(blocking!=null)
{
blocking.Close();
}
}
function GetEventTypePart(type)
{
if(action.Type=="7")
{
return "part/field";
}
return "part";
}
};
AntaWebPart.prototype.HandleActionResultCallback=function AntaWebPart_HandleActionResultCallback(success,response,errorData)
{
if(errorData.FunctionalError!=null)
{
ShowDialog(1,AntaDialogButtonOK,AntaSR.ErrorTitle,errorData.FunctionalError);
}
else
{
if(success&&response!=null)
{
var varNode=SelectSingleNode(response.responseXML,"/var");
var resultCode="";
if(varNode!=null)
{
var type=GetAttributeValue(varNode,"type");
switch(type)
{
case "4":
resultCode=GetAttributeValue(varNode,"rc");
break;
case "9":
resultCode=this.WebForm.Window.HandleActionResult(varNode,this,response);
break;
default:
ShowUnexpectedError();
}
}
success=(resultCode!="0");
}
return success;
}
};
AntaWebPart.prototype.Unload=function AntaWebPart_Unload()
{
if(this.DataSet!=null&&IsDefined(typeof(AntaDataSets))&&IsDefined(typeof(AntaDataSets[this.DataSet.Id]))&&AntaDataSets[this.DataSet.Id]!=null)
{
this.DataSet.Unload();
this.DataSet.Unregister();
this.DataSet=null;
}
if(this.PartNode!=null)
{
this.PartNode.onmousedown=null;
this.PartNode=null;
}
if(this.HeaderNode!=null)
{
this.HeaderNode.onmousedown=null;
this.HeaderNode=null;
}
if(this.ActiveNode!=null){this.ActiveNode=null;}
if(this.ScrollNode!=null){this.ScrollNode=null;}
if(this.ContentNode!=null){this.ContentNode=null;}
this.InitializationFocusHandler=null;
if(this.WebView!=null){this.WebView.Unload();}
if(this.HeaderButtons!=null)
{
for(var i=0;i<this.HeaderButtons.length;i++)
{
this.HeaderButtons[i].Unload();
}
this.HeaderButtons=[];
}
if(this.WebLogin!=null){this.WebLogin.Unload();}
if(this.WebCalendar!=null){this.WebCalendar.Unload();}
if(this.Wizard!=null){this.Wizard.Unload();}
if(this.KeyDownHandler!=null){this.KeyDownHandler=null;}
if(this.Type==16)
{
var notificationList=this.WebForm.Window.Child(this.ClientId,"NotificationList");
if(notificationList!=null)
{
for(var i=0;i<notificationList.rows.length;i++)
{
notificationList.rows[i].onclick=null;
notificationList.rows[i].onmouseover=null;
notificationList.rows[i].onmouseout=null;
}
}
}
};
function AntaWebPart(webForm,partClientId,partObject)
{
this.WebForm=webForm;
this.ClientId=partClientId;
this.PartNode=$(partClientId,this.WebForm.Window.WindowNode);
this.Actions={};
SetDomData(this.PartNode,AntaWebPartKey,this);
this.AntaControls=null;
this.ReadOnlyMemoControls=[];
this.HeaderNode=this.Child("Header");
this.ActiveNode=this.Child("Active");
this.ScrollNode=this.Child("Scroll");
this.ContentNode=this.Child("Content");
this.LinkToSourceNode=this.Child("LinkToSource");
this.ShortCuts={};
this.ButtonToggleGroups={};
this.Minimized=false;
this.Maximized=false;
this.FilledOut=false;
this.Id=partObject.Id;
this.DataId=partObject.DataId;
this.ParentDataId=partObject.ParentDataId;
this.Type=partObject.Type;
this.SubType=partObject.SubType;
this.Title=partObject.Title;
this.InitialState=partObject.InitialState;
this.Published=partObject.Published;
this.ZoneWidth=partObject.ZoneWidth;
this.Imported=partObject.Imported;
this.ImportedPartId=partObject.ImportedPartId;
this.IsEmpty=partObject.IsEmpty;
this.ZoneId=partObject.ZoneId;
this.WebFormType=partObject.WebFormType;
this.WebFormSessionId=partObject.WebFormSessionId;
this.WebFormDataSetId=partObject.WebFormDataSetId;
this.WebFormLocation=partObject.WebFormLocation;
this.WebFormQueryString=partObject.WebFormQueryString;
this.RefreshHandler=null;
this.ResizeHandler=null;
this.ActivationHandler=null;
this.InitializationHandler=null;
this.WebForm.MappedParameters[this.WebFormLocation]=partObject.MappedParameters;
this.DataSet=AntaGetWebFormDataSet(this.WebFormSessionId);
if(this.DataSet==null)
{
this.DataSet=AntaGetWebFormDataSetById(this.WebFormDataSetId);
}
if(this.DataSet!=null)
{
this.DataSet.WebForm=this.WebForm;
this.DataSet.WebFormLocation=this.WebFormLocation;
this.DataSet.WebFormQueryString=this.WebFormQueryString;
}
if(this.HeaderNode!=null)
{
SetDomData(this.HeaderNode,AntaWebPartKey,this);
}
this.HeaderButtons=[];
SetDomEventData(this.PartNode,this);
this.PartNode.onmousedown=this.HandleMouseDown;
if(this.HeaderNode!=null)
{
SetDomEventData(this.HeaderNode,this);
this.HeaderNode.onmousedown=this.HandleHeaderMouseDown;
}
this.CanBeActivated=this.Type==AntaPartTypeFreeTab||
this.Type==AntaPartTypeProperties||
this.Type==AntaPartTypeView||
this.Type==AntaPartTypeLogin||
this.Type==AntaPartTypeSearch||
this.Type==AntaPartTypeEntryDetail||
this.Type==AntaPartTypeEntryProperties||
this.Type==AntaPartTypeWizard;
}
AntaWebForm.prototype.GetParentWebPart=function AntaWebForm_GetParentWebPart()
{
if(this.ParentWebPartClientId!=null)
{
return GetDomData($(this.ParentWebPartClientId,this.Window.WindowNode),AntaWebPartKey);
}
return null;
}
AntaWebForm.prototype.CreateEventXml=function AntaWebForm_CreateEventXml(props,webFormLocation,webFormQueryString,webFormSessionId,published,mappedParameters)
{
var parentWebPart=this.GetParentWebPart();
var rootWebFormLocation=this.WebFormLocation;
var rootWebFormClientId=this.ClientId;
if(parentWebPart!=null)
{
var rootWebFormLocation=parentWebPart.WebForm.WebFormLocation;
var rootWebFormClientId=parentWebPart.WebForm.ClientId;
}
var data="<?xml version =\"1.0\" encoding=\"utf-8\"?><event location=\""+webFormLocation.EscapeHTML()+
"\" querystring=\""+webFormQueryString.EscapeHTML()+
"\" rootlocation=\""+rootWebFormLocation.EscapeHTML()+
"\" processpath=\""+this.ProcessPath.EscapeHTML()+
"\" published=\""+published+
"\" isInContentZone=\""+this.IsInContentZone+
"\" currentlyEdited=\""+this.IsCurrentlyEdited+"\">"+
"<property name=\"sessionid\" value=\"" + webFormSessionId.EscapeHTML() + "\"/>"+
"<property name=\"rootwebformclientid\" value=\"" + rootWebFormClientId.EscapeHTML() + "\"/>"+
"<property name=\"webformclientid\" value=\"" + this.ClientId.EscapeHTML() + "\"/>";
var pageLocation;
if(AntaRootWindow==this.Window)
{
var virtualPath=this.Window.WindowNode.location.pathname.toLowerCase().replace(AntaVirtualDir.toLowerCase(),"/");
if(AntaVirtualDir.toLowerCase().indexOf(this.Window.WindowNode.location.pathname)==0)
{
virtualPath="/";
}
pageLocation=(IsDefined(typeof(AntaPageMetaInformation))&&AntaPageMetaInformation!=null)?
AntaPageMetaInformation.Link+this.Window.WindowNode.location.search:virtualPath+this.Window.WindowNode.location.search;
}
else
{
pageLocation=webFormLocation;
}
if(IsDefined(typeof(this.Window.WindowWidth)))
{
data+="<property name=\"windowwidth\" value=\"" + this.Window.WindowWidth + "\"/>"
}
data+="<property name=\"pagelocation\" value=\"" + pageLocation.EscapeHTML() + "\"/>";
if(IsDefined(typeof(props)))
{
for(var i in props)
{
if(IsDefined(typeof(props[i].node)))
{
data+="<property name=\"" + i.EscapeHTML() + "\">"+props[i].node+"</property>";
}
else
{
data+="<property name=\"" + i.EscapeHTML() + "\" value=\"" + props[i].toString().EscapeHTML() + "\"/>";
}
}
}
data+=this.GetEventMappedAndOutputParameters(webFormLocation);
data+="</event>";
return data;
};
AntaWebForm.prototype.GetEventMappedAndOutputParameters=function AntaWebForm_GetEventMappedAndOutputParameters(webFormLocation)
{
var result="";
if(this.MappedParameters[webFormLocation]!=null)
{
var mappedParameters=this.MappedParameters[webFormLocation];
result+="<mappedParameters>";
for(var inParameterId in mappedParameters)
{
var outParameterId=mappedParameters[inParameterId];
result+="<parameter id=\"" + inParameterId.EscapeHTML() + "\" value=\"" + new String(AntaWebFormOutputParameters[outParameterId]).EscapeHTML() + "\"/>";
}
result+="</mappedParameters>";
}
if(AntaWebFormOutputParameters!=null)
{
result+="<outputParameters>";
for(var outParameterId in AntaWebFormOutputParameters)
{
result+="<parameter id=\"" + outParameterId.EscapeHTML() + "\" value=\"" + new String(AntaWebFormOutputParameters[outParameterId]).EscapeHTML() + "\"/>";
}
result+="</outputParameters>";
}
return result;
}
AntaWebForm.prototype.RegisterShortCut=function AntaWebForm_RegisterShortCut(key,button)
{
if(key!=null)
{
this.ShortCuts[key]=new AntaShortCut(key,OnPressed);
this.ShortCuts[key].Button=button;
}
function OnPressed(shortCut)
{
if(shortCut.Button!=null)
{
shortCut.Button.Click();
}
}
};
AntaWebForm.prototype.IterateWebParts=function AntaWebForm_IterateWebParts(func)
{
for(var webFormLocation in this.WebParts)
{
for(var webPartClientId in this.WebParts[webFormLocation])
{
var webPart=this.WebParts[webFormLocation][webPartClientId];
if(!func(webPart))
{
return false;
}
}
}
return true;
};
AntaWebForm.prototype.HandleResize=function AntaWebForm_HandleResize()
{
if(this.Maximized&&this.MaximizedWebPart!=null)
{
var delta=this.Window.GetMaximizedDelta();
var formDelta=this.WebFormNode.parentNode.offsetHeight-this.Window.GetVerticalPaddingBorder(this.WebFormNode.offsetParent);
for(var i=0;i<this.WebFormNode.parentNode.childNodes.length;i++)
{
formDelta-=this.WebFormNode.parentNode.childNodes[i].offsetHeight;
}
var newHeight=this.MaximizedWebPart.PartNode.offsetHeight+delta+formDelta;
this.MaximizedWebPart.SetHeight(ToPixels(newHeight),true);
var zoneWidth=this.MaximizedWebPart.ZoneWidth;
var webFormWidth=this.WebFormNode.offsetWidth-this.Window.GetHorizontalMarginPaddingBorder(this.WebFormNode);
if(zoneWidth=="auto")
{
this.MaximizedWebPart.PartNode.style.width=ToPixels(webFormWidth-this.Window.GetHorizontalMarginPaddingBorder(this.MaximizedWebPart.PartNode));
}
else
{
if(zoneWidth.indexOf("%")!=-1)
{
var percent=parseInt(zoneWidth.replace("%",""),10);
this.MaximizedWebPart.PartNode.style.width=ToPixels(((webFormWidth*percent)/100)-this.Window.GetHorizontalMarginPaddingBorder(this.MaximizedWebPart.PartNode));
}
else
{
this.MaximizedWebPart.PartNode.style.width=ToPixels(FromPixels(zoneWidth)-this.Window.GetHorizontalMarginPaddingBorder(this.MaximizedWebPart.PartNode));
}
}
}
var zoneFillParts={};
this.IterateWebParts(function(webPart)
{
if(webPart.InitialState.SizeState==6)
{
if(!IsDefined(typeof(zoneFillParts[webPart.ZoneId]))||zoneFillParts[webPart.ZoneId]==null)
{
zoneFillParts[webPart.ZoneId]=[];
}
zoneFillParts[webPart.ZoneId].push(webPart);
webPart.SetHeight("auto");
webPart.InitialState.Height="auto";
webPart.ContentNode.style.height="auto";
}
else
{
webPart.HandleResize();
}
return true;
}
);
for(var zoneId in zoneFillParts)
{
var zoneNode=this.Child(zoneId);
if(IsDefined(typeof(zoneNode))&&zoneNode!=null)
{
var lastDiv=zoneNode.appendChild(this.Window.MakeNode("div"));
lastDiv.style.clear="both";
lastDiv.style.marginTop="1px";
lastDiv.style.backgroundColor="Red";
var zoneDelta=Math.floor((zoneNode.parentNode.offsetHeight-zoneNode.offsetHeight)/zoneFillParts[zoneId].length);
this.Window.RemoveNode(lastDiv);
for(var i=0;i<zoneFillParts[zoneId].length;i++)
{
var newHeight=zoneFillParts[zoneId][i].PartNode.offsetHeight+zoneDelta;
zoneFillParts[zoneId][i].SetHeight(ToPixels(newHeight),true);
zoneFillParts[zoneId][i].HandleResize();
}
}
}
if(this.Maximized&&this.MaximizedWebPart.FilledOut)
{
this.MaximizedWebPart.SetHeight(ToPixels(this.MaximizedWebPart.ContentNode.offsetHeight),false);
}
};
AntaWebForm.prototype.Child=function AAntaWebForm_Child(childId)
{
var win=this.Window;
return win.Child(this.ClientId,childId);
};
AntaWebForm.prototype.ToMaximizedZone=function AntaWebForm_ToMaximizedZone(webPart)
{
this.MaximizedZonePartNode=this.Window.MakeNode("div");
this.WebFormNode.appendChild(this.MaximizedZonePartNode);
SwapNode(this.MaximizedZonePartNode,webPart.PartNode);
HideNode(this.ZonesContainerNode);
};
AntaWebForm.prototype.FromMaximizedZone=function AntaWebForm_FromMaximizedZone(webPart)
{
ShowNode(this.ZonesContainerNode);
SwapNode(this.MaximizedZonePartNode,webPart.PartNode);
this.Window.RemoveNode(this.MaximizedZonePartNode);
};
AntaWebForm.prototype.RegisterWebPart=function AntaWebForm_RegisterWebPart(partClientId,partObject)
{
if(!IsDefined(typeof(this.WebParts[partObject.WebFormLocation]))||this.WebParts[partObject.WebFormLocation]==null)
{
this.WebParts[partObject.WebFormLocation]={};
}
var webPart=new AntaWebPart(this,partClientId,partObject);
this.WebParts[partObject.WebFormLocation][partClientId]=webPart;
return webPart;
};
AntaWebForm.prototype.GetActionsPart=function AntaWebForm_GetActionsPart()
{
var result=null;
this.IterateWebParts(function(webPart)
{
if(webPart.Type==5||webPart.Type==19)
{
result=webPart;
return false;
}
return true;
});
return result;
};
AntaWebForm.prototype.HandleKeyUp=function AntaWebForm_HandleKeyUp()
{
return false;
};
AntaWebForm.prototype.HandleKeyDown=function AntaWebForm_HandleKeyDown()
{
var taken=false;
if(AntaEvent.ShiftKeyPressed&&AntaEvent.CtrlKeyPressed)
{
for(var key in this.ShortCuts)
{
if(AntaEvent.KeyCode==this.ShortCuts[key].KeyCode)
{
this.ShortCuts[key].Press();
taken=true;
break;
}
}
this.IterateWebParts(function(webPart)
{
for(var key in webPart.ShortCuts)
{
if(AntaEvent.KeyCode==webPart.ShortCuts[key].KeyCode&&
AntaEvent.ShiftKeyPressed==webPart.ShortCuts[key].ShiftKeyPressed&&
AntaEvent.CtrlKeyPressed==webPart.ShortCuts[key].CtrlKeyPressed)
{
webPart.ShortCuts[key].Press();
taken=true;
return false;
}
return true;
}
});
}
if(this.ActiveWebPart!=null&&this.ActiveWebPart.KeyDownHandler!=null)
{
taken=this.ActiveWebPart.KeyDownHandler.HandlePartKeyDown();
}
return taken;
};
AntaWebForm.prototype.RegisterButton=function AntaWebForm_RegisterButton(buttonProperties)
{
var actionsPart=this.GetActionsPart();
if(actionsPart!=null)
{
var button=AttachWebButton(this.Window,buttonProperties,OnClick);
button.WebPart=actionsPart;
return button;
}
function OnClick(button)
{
if(button.Code=="Statistics")
{
ShowStatistics();
}
else
{
var webPart=button.WebPart;
if(webPart.WebFormType==2)
{
webPart=webPart.WebForm.WebEntryDetail;
button.Action.WebPart=webPart;
}
webPart.ExecuteActionQueued(button.Action);
}
}
};
AntaWebForm.prototype.Unload=function AntaWebForm_Unload()
{
if(this.WebParts!=null)
{
for(var webFormLocation in this.WebParts)
{
for(var webPartClientId in this.WebParts[webFormLocation])
{
var webPart=this.WebParts[webFormLocation][webPartClientId];
if(webPart!=null){webPart.Unload();}
}
}
}
if(this.ZonesContainerNode!=null){this.ZonesContainerNode=null;}
if(this.WebFormNode!=null){this.WebFormNode=null;}
};
AntaWebForm.prototype.CheckSizeState=function AntaWebForm_CheckSizeState()
{
var maximizedPart=null;
var filledPart=null;
this.IterateWebParts(function(webPart)
{
if(webPart.FilledOut)
{
filledPart=webPart;
}
if(webPart.Maximized)
{
maximizedPart=webPart;
}
return true;
}
);
if(maximizedPart!=null)
{
this.MaximizedWebPart=maximizedPart;
this.Maximized=true;
}
else if(filledPart!=null)
{
this.MaximizedWebPart=filledPart;
this.Maximized=true;
}
else
{
this.MaximizedWebPart=null;
this.Maximized=false;
}
this.HandleResize();
};
function AntaWebForm(windowObject,webFormClientId,webFormTitle,webFormSubTitle,webFormType,webFormLocation,webFormQueryString,webFormEventUrlPrefix,webFormSessionId,isCurrentlyEdited,parentWebPartClientId,layoutType,processPath,isInContentZone)
{
this.Window=windowObject;
this.ClientId=webFormClientId;
this.Title=webFormTitle;
this.SubTitle=webFormSubTitle;
this.WebFormType=webFormType;
this.WebFormSessionId=webFormSessionId;
this.ProcessPath=processPath;
this.IsCurrentlyEdited=isCurrentlyEdited;
this.LayoutType=layoutType;
this.IsInContentZone=isInContentZone;
this.ParentWebPartClientId=parentWebPartClientId;
if(parentWebPartClientId!=null)
{
AntaChildWebForms[parentWebPartClientId]=this;
}
this.ActiveWebPart=null;
this.MaximizedWebPart=null;
this.Maximized=false;
this.WebFormNode=$(this.ClientId,this.Window.WindowNode);
this.WebFormEventUrlPrefix=webFormEventUrlPrefix;
this.WebFormLocation=webFormLocation;
this.WebFormQueryString=webFormQueryString;
this.ShortCuts={};
this.ZonesContainerNode=this.Window.Child(this.ClientId,"ZoneLayout");
this.WebParts={};
this.MappedParameters={};
this.Window.AddResizeHandler(this);
}
function AntaGetWebFormDataSet(sessionId)
{
if(IsDefined(typeof(AntaDataSets))&&AntaDataSets!=null)
{
for(var dataSetId in AntaDataSets)
{
if(AntaDataSets[dataSetId].SessionId==sessionId)
{
return AntaDataSets[dataSetId];
}
}
}
}
function AntaGetWebFormDataSetById(dataSetId)
{
if(IsDefined(typeof(AntaDataSets))&&AntaDataSets!=null)
{
return AntaDataSets[dataSetId];
}
}
function AntaHandReadOnlyImageClick(e)
{
if(!IsDefined(typeof(e))){var e=this.document.parentWindow.event;}
StoreEvent(e);
var imageInfo=GetDomEventData(this);
if(imageInfo!=null)
{
ShowDialog(8,0,imageInfo.DescriptionText,"",null,null,null,true,AntaFileDownloadUrl+"/"+imageInfo.MediumFileId+"/"+AntaEncodeInvalidASPNETUrlPart(imageInfo.MediumFileName),imageInfo.MediumFileWidth,imageInfo.MediumFileHeight);
}
e.cancelBubble=true;
return false;
}
function AntaRegisterReadOnlyImage(imageClientId,imageInfo)
{
var imageNode=$(imageClientId);
if(imageNode!=null)
{
SetDomEventData(imageNode,imageInfo)
imageNode.onclick=AntaHandReadOnlyImageClick;
}
}
function AntaRegisterReadOnlyMemoControl(partClientId,id)
{
var webPart=GetDomData($(partClientId),AntaWebPartKey);
webPart.ReadOnlyMemoControls.push($(id));
}
function AntaRegisterWebPart(webFormClientId,partClientId,partObject)
{
if(AntaActiveWindow!=null)
{
var webForm=AntaActiveWindow.WebForms[webFormClientId];
if(!IsDefined(typeof(webForm)))
{
webForm=AntaRootWindow.WebForms[webFormClientId];
}
webForm.RegisterWebPart(partClientId,partObject);
}
}
function AntaRegisterWebForm(webFormClientId,webFormTitle,webFormSubTitle,webFormType,webFormLocation,webFormQueryString,webFormEventUrlPrefix,webFormSessionId,isCurrentlyEdited,parentWebPartClientId,layoutType,processPath,isInContentZone)
{
if(AntaActiveWindow!=null)
{
AntaActiveWindow.RegisterWebForm(webFormClientId,webFormTitle,webFormSubTitle,webFormType,webFormLocation,webFormQueryString,webFormEventUrlPrefix,webFormSessionId,isCurrentlyEdited,parentWebPartClientId,layoutType,processPath,isInContentZone);
}
}
function AntaRegisterWebFormOutputParameter(key,value)
{
AntaWebFormOutputParameters[key]=value;
}
﻿
var AntaActionCallbackHandlers=[];
var AntaDisabledObjects=null;
var AntaRootWindow=null;
var AntaActiveWindow=null;
var AntaWindowCounter=0;
var AntaActiveScriptWindow=null;
var IE6=(navigator.appVersion.indexOf("MSIE 6.")==-1)?false:true;
var IE7=(navigator.appVersion.indexOf("MSIE 7.")==-1)?false:true;
var IE8=(navigator.appVersion.indexOf("MSIE 8.")==-1)?false:true;
var AntaDialogButtonUnknown=0;
var AntaDialogButtonOK=32;
var AntaDialogButtonAbort=64;
var AntaDialogButtonRetry=128;
var AntaDialogButtonIgnore=256;
var AntaDialogButtonCancel=512;
var AntaDialogButtonYes=4096;
var AntaDialogButtonNo=8192;
var AntaDialogButtonYesNo=AntaDialogButtonYes|AntaDialogButtonNo;
var AntaButtonGroup_EditableWebPart="EditableWebPart";
var AntaButtonGroup_CalendarWebPart="CalendarWebPart";
var AntaButtonGroup_EntryWebPart="EntryWebPart";
var AntaButtonGroup_LoginWebPart="LoginWebPart";
var AntaButtonGroup_ToolboxWebPart="ToolboxWebPart";
var AntaButtonGroup_ViewWebPart="ViewWebPart";
var AntaButtonGroup_WizardWebPart="WizardWebPart";
var AntaButtonGroup_MenuWebPart="MenuWebPart";
var AntaButtonGroup_PartContextMenu="PartContextMenu";
var AntaButtonGroup_PartEditor="PartEditor";
var AntaButtonGroup_PartHeader="PartHeader";
var AntaButtonGroup_WebForm="WebForm";
var AntaButtonGroup_WebFormDefault="WebFormDefault";
var AntaButtonGroup_ColorPicker="ColorPickerWebPart";
var AntaButtonGroup_StyleEditor="StyleEditor";
var AntaButtonGroup_ExternalMediaBar="ExternalMediaWebPart";
var AntaPartTypeProperties=1;
var AntaPartTypeFreeTab=2;
var AntaPartTypeView=3;
var AntaPartTypeExtern=4;
var AntaPartTypeActions=5;
var AntaPartTypeFreeHTML=6;
var AntaPartTypeLogin=7;
var AntaPartTypeMenu=8;
var AntaPartTypeSearch=9;
var AntaPartTypeImage=12;
var AntaPartTypeText=14;
var AntaPartTypeWebFormContainer=15;
var AntaPartTypeNotificiation=16;
var AntaPartTypeEntryDetail=17;
var AntaPartTypeEntryProperties=18;
var AntaPartTypeEntryActions=19;
var AntaPartTypeCalendar=20;
var AntaPartTypeWizard=21;
var AntaPartTypeBreadCrum=22;
var AntaPartTypeEmpty=25;
var AntaPartTypeBanner=26;
var AntaPartTypeVideoClip=27;
var AntaPartTypeSitemap=28;
var AntaPartSubTypeTitle=1;
function AntaRect(left,top,width,height)
{
this.Left=left;
this.Top=top;
this.Width=width;
this.Height=height;
}
AntaRect.prototype.ToString=function AntaRect_ToString()
{
return "{L: "+this.Left+" T:"+this.Top+" W:"+this.Width+" H:"+this.Height+"}";
}
function AntaResizeRectToBox(rect,rectBox)
{
var resultRect=new AntaRect(0,0,0,0);
var aspectRatio=rect.Height/rect.Width;
if(rect.Width/ rectBox.Width> rect.Height/ rectBox.Height)
{
resultRect.Width=rectBox.Width;
resultRect.Height=Math.floor(resultRect.Width*aspectRatio);
}
else
{
resultRect.Height=rectBox.Height;
resultRect.Width=Math.floor(resultRect.Height/aspectRatio);
}
return resultRect;
}
function AddActionResultScript(func,hasCallback)
{
if(AntaActiveScriptWindow.ActionResultScripts==null)
{
AntaActiveScriptWindow.ActionResultScripts=[];
}
AntaActiveScriptWindow.ActionResultScripts.push({Function:func,HasCallback:hasCallback});
}
function CallActionResultScripts()
{
if(AntaActiveScriptWindow!=null&&AntaActiveScriptWindow.ActionResultScripts!=null&&AntaActiveScriptWindow.ActionResultScripts.length>0)
{
var script=AntaActiveScriptWindow.ActionResultScripts.shift();
if(script!=null)
{
script.Function();
if(!script.HasCallback)
{
CallActionResultScripts();
}
}
}
}
AntaWindow.prototype.ExecuteAntaEventHandlers=function AntaWindow_ExecuteAntaEventHandlers(eventType,e)
{
var handled=false;
var returnValue;
if(this.EventHandlers!=null)
{
var handlers=this.EventHandlers[eventType];
if(handlers!=null)
{
for(var i=0;!handled&&i<handlers.length;i++)
{
var handler=handlers[i];
returnValue=handler.Handler(e,handler.State);
if(eventType==="beforeunload")
{
if(returnValue!=null&&typeof returnValue==="string"&&returnValue.length!==0)
{
handled=true;
}
}
else
{
handled=returnValue;
}
}
}
}
if(eventType==="beforeunload")
{
if(handled)
{
return returnValue;
}
}
else
{
return returnValue;
}
}
AntaWindow.prototype.FindChildWindow=function AntaWindow_FindChildWindow(windowObject)
{
for(var childId in this.ChildWindows)
{
if(this.ChildWindows[childId].WindowNode==windowObject.WindowNode)
{
return this.ChildWindows[childId];
}
var childWindow=this.ChildWindows[childId].FindChildWindow(windowObject);
if(childWindow!=null)
{
return childWindow;
}
}
return null;
};
AntaWindow.prototype.GetParentNode=function AntaWindow_GetParentNode()
{
if(this.WindowStyle!==1)
{
if(this.WindowNode.opener!=null)
{
if(IsDefined(typeof(this.WindowNode.opener.AntaActiveWindow)))
{
var parentActiveWindow=this.WindowNode.opener.AntaActiveWindow;
if(parentActiveWindow!=null)
{
if(parentActiveWindow.WindowNode==this.WindowNode)
{
return this.WindowNode.opener;
}
if(parentActiveWindow.FindChildWindow(this)!=null)
{
return this.WindowNode.opener;
}
}
}
}
}
return null;
};
AntaWindow.prototype.AddResizeHandler=function AntaWindow_AddResizeHandler(handler)
{
this.ResizeHandlers.push(handler);
};
AntaWindow.prototype.AddScrollHandler=function AntaWindow_AddScrollHandler(handler)
{
this.ScrollHandlers.push(handler);
};
AntaWindow.prototype.RemoveResizeHandler=function AntaWindow_RemoveResizeHandler(handler)
{
for(var i=0;i<this.ResizeHandlers.length;i++)
{
if(this.ResizeHandlers[i]==handler)
{
this.ResizeHandlers.splice(i,1);
break;
}
}
};
AntaWindow.prototype.RemoveScrollHandler=function AntaWindow_RemoveScrollHandler(handler)
{
for(var i=0;i<this.ScrollHandlers.length;i++)
{
if(this.ScrollHandlers[i]==handler)
{
this.ScrollHandlers.splice(i,1);
break;
}
}
};
AntaWindow.prototype.CopyEventHandler=function AntaWindow_CopyEventHandler(eventType,fromWindow)
{
if(fromWindow.EventHandlers!=null&&IsDefined(typeof(fromWindow.EventHandlers[eventType]))&&fromWindow.EventHandlers[eventType]!=null)
{
var eventHandlers=fromWindow.EventHandlers[eventType];
for(var i=0;i<eventHandlers.length;i++)
{
this.RegisterEventHandler(eventType,eventHandlers[i].Handler,eventHandlers[i].State);
}
}
}
AntaWindow.prototype.RegisterEventHandler=function AntaWindow_RegisterEventHandler(eventType,handler,state)
{
if(this.EventHandlers==null)
{
this.EventHandlers={};
}
var handlers=this.EventHandlers[eventType];
if(handlers==null)
{
handlers=this.EventHandlers[eventType]=[];
}
handlers.push({Handler:handler,State:state});
};
AntaWindow.prototype.ClearEventHandlers=function AntaWindow_ClearEventHandlers(eventType)
{
if(this.EventHandlers!=null)
{
this.EventHandlers[eventType]=null;
}
};
AntaWindow.prototype.OnWindowClose=function AntaWindow_OnWindowClose()
{
try
{
this.ClearEventHandlers("beforeunload");
this.ClearEventHandlers("unload");
this.WindowNode.close();
}
catch(ex){}
};
AntaWindow.prototype.ClearContent=function AntaWindow_ClearContent()
{
this.IterateWebForms(function(webForm)
{
webForm.Unload();
});
if(this.ContentNode!=null)
{
var len=this.ContentNode.childNodes.length;
for(var i=0;i<len;i++)
{
this.RemoveNode(this.ContentNode.firstChild);
}
}
};
AntaWindow.prototype.RegisterWebForm=function(webFormClientId,webFormTitle,webFormSubTitle,webFormType,webFormLocation,webFormQueryString,webFormEventUrlPrefix,webFormSessionId,isCurrentlyEdited,parentWebPartClientId,layoutType,processPath,isInContentZone)
{
if(!IsDefined(typeof(this.WebForms[webFormClientId]))||this.WebForms[webFormClientId]==null)
{
var webForm=new AntaWebForm(this,webFormClientId,webFormTitle,webFormSubTitle,webFormType,webFormLocation,webFormQueryString,webFormEventUrlPrefix,webFormSessionId,isCurrentlyEdited,parentWebPartClientId,layoutType,processPath,isInContentZone);
this.WebForms[webFormClientId]=webForm;
this.RegisterKeyDownHandler(webForm);
this.RegisterKeyUpHandler(webForm);
}
};
AntaWindow.prototype.RegisterKeyDownHandler=function AntaWindow_RegisterKeyDownHandler(handler)
{
this.KeyDownHandlers.push(handler);
};
AntaWindow.prototype.RegisterKeyUpHandler=function AntaWindow_RegisterKeyUpHandler(handler)
{
this.KeyUpHandlers.push(handler);
};
AntaWindow.prototype.AddChildWindow=function AntaWindow_AddChildWindow(windowObject)
{
windowObject.ParentWindow=this;
this.ChildWindows[windowObject.Id]=windowObject;
};
AntaWindow.prototype.RemoveChildWindow=function AntaWindow_RemoveChildWindow(windowObject)
{
delete this.ChildWindows[windowObject.Id];
if(AntaActiveWindow==windowObject)
{
AntaActiveWindow=null;
this.SetActive();
}
};
AntaWindow.prototype.HandleKeyDown=function AntaWindow_HandleKeyDown()
{
var taken=false;
if(this.KeyDownHandlers!=null)
{
for(var i=0;i<this.KeyDownHandlers.length&&!taken;i++)
{
taken=this.KeyDownHandlers[i].HandleKeyDown();
}
}
return taken;
};
AntaWindow.prototype.HandleKeyUp=function AntaWindow_HandleKeyUp(e)
{
var taken=false;
if(this.KeyUpHandlers!=null)
{
for(var i=0;i<this.KeyUpHandlers.length&&!taken;i++)
{
this.KeyUpHandlers[i].HandleKeyUp();
}
}
return taken;
};
AntaWindow.prototype.HandleResize=function AntaWindow_HandleResize()
{
if(!this.SizingBusy&&this.WindowNode!=null)
{
this.SizingBusy=true;
this.Init();
for(var i=0;i<this.ResizeHandlers.length;i++)
{
this.ResizeHandlers[i].HandleResize();
}
this.SizingBusy=false;
}
};
AntaWindow.prototype.HandleScroll=function AntaWindow_HandleScroll()
{
for(var i=0;i<this.ScrollHandlers.length;i++)
{
this.ScrollHandlers[i].HandleScroll();
}
};
AntaWindow.prototype.SelectElementText=function AntaWindow_SelectElementText(inputNode,mode)
{
if(mode>0&&IsDefined(typeof(inputNode.value))&&inputNode.type!="file")
{
if(IsDefined(typeof(inputNode.setSelectionRange)))
{
inputNode.setSelectionRange((mode==1)?inputNode.value.length:0,inputNode.value.length);
}
else if(IsDefined(typeof(inputNode.createTextRange)))
{
if(mode==1)
{
var range=inputNode.createTextRange();
range.move("character",inputNode.value.length);
range.select();
}
else
{
inputNode.select();
}
}
}
};
AntaWindow.prototype.SetElementFocus=function AntaWindow_SetElementFocus(id,mode,callback)
{
var win=this;
setTimeout(SetFocus,100);
function SetFocus()
{
if(!IsNullOrEmpty(id))
{
var field=$(id,win.WindowNode);
field.focus();
win.SelectElementText(field,mode);
}
if(IsDefined(typeof(callback))&&callback!=null)
{
callback();
}
}
};
AntaWindow.prototype.EnableSelection=function AntaWindow_EnableSelection()
{
if(!IsDefined(typeof(this.WindowNode.SelectionEnabled))||!this.WindowNode.SelectionEnabled)
{
this.WindowNode.document.body.onselectstart=null;
this.WindowNode.document.body.onmousedown=null;
this.WindowNode.document.body.onclick=null;
this.WindowNode.SelectionEnabled=true;
}
};
AntaWindow.prototype.DisableSelection=function AntaWindow_DisableSelection()
{
if(IsDefined(typeof(this.WindowNode.SelectionEnabled))&&this.WindowNode.SelectionEnabled)
{
this.WindowNode.document.body.onselectstart=function(){return false;};
this.WindowNode.document.body.onmousedown=function(){return false;};
this.WindowNode.document.body.onclick=function(){return true;};
this.WindowNode.SelectionEnabled=false;
}
};
AntaWindow.prototype.IterateWebForms=function AntaWindow_IterateWebForms(func)
{
for(var webFormClientId in this.WebForms)
{
if(!func(this.WebForms[webFormClientId]))
{
return;
}
}
};
AntaWindow.prototype.IterateWebParts=function AntaWindow_IterateWebParts(func)
{
for(var webFormClientId in this.WebForms)
{
if(!this.WebForms[webFormClientId].IterateWebParts(func))
{
return;
}
}
};
AntaWindow.prototype.RemoveSelection=function AntaWindow_RemoveSelection()
{
if(IsDefined(typeof(this.WindowNode.document.selection)))
{
if(IsDefined(typeof(this.WindowNode.document.selection.empty)))
{
try
{
this.WindowNode.document.selection.empty();
}
catch(ex)
{
}
}
}
if(IsDefined(typeof(this.WindowNode.getSelection)))
{
if(IsDefined(typeof(this.WindowNode.getSelection().removeAllRanges)))
{
this.WindowNode.getSelection().removeAllRanges();
}
}
};
AntaWindow.prototype.ClearTabIndex=function AntaWindow_ClearTabIndex()
{
if(this.Tabs==null)
{
this.Tabs=[];
var boundingNode=this.BoundingNode;
if(boundingNode==null)
{
boundingNode=this.WindowNode.document.body;
}
ClearTab(this.Tabs,boundingNode,"input");
ClearTab(this.Tabs,boundingNode,"a");
ClearTab(this.Tabs,boundingNode,"textarea");
ClearTab(this.Tabs,boundingNode,"button");
ClearTab(this.Tabs,boundingNode,"select");
}
function ClearTab(tabs,node,tagName)
{
var nodeList=node.getElementsByTagName(tagName);
for(var i=0;i<nodeList.length;i++)
{
tabs.push({Node:nodeList[i],TabIndex:nodeList[i].tabIndex});
nodeList[i].tabIndex=-1;
}
}
};
AntaWindow.prototype.RestoreTabIndex=function AntaWindow_RestoreTabIndex()
{
if(this.Tabs!=null)
{
for(var i=0;i<this.Tabs.length;i++)
{
var antaTabIndex=this.Tabs[i].Node.AntaTabIndex;
this.Tabs[i].Node.tabIndex=(antaTabIndex==null)?this.Tabs[i].TabIndex:antaTabIndex;
}
this.Tabs=null;
}
};
AntaWindow.prototype.Refresh=function AntaWindow_Refresh()
{
if(this==AntaRootWindow)
{
try{this.WindowNode.document.location.reload();}catch(ex){}
}
else
{
AntaActiveScriptWindow.IterateWebParts(function(webPart)
{
webPart.Refresh();
return true;
});
}
};
AntaWindow.prototype.Close=function AntaWindow_Close()
{
AntaActiveScriptWindow=this.LastActiveScriptWindow;
if(this.CloseHandler!=null)
{
this.CloseHandler.OnWindowClose();
}
this.Unload();
};
AntaWindow.prototype.ImportRequest=function AntaWindow_ImportRequest(parent,request,node)
{
var newnode;
var text=request.responseText;
if(window.opera)
{
parent.innerHTML=text.replace(/<script[^>]*>((.|[\r\n])*?)<\\?\/script>/ig,"");
}
else
{
parent.innerHTML=text;
}
newnode=parent.firstChild;
if(newnode!=null&&newnode.tagName.toLowerCase()=="var")
{
if(newnode.getAttribute("type")=="9")
{
if(newnode.firstChild!=null)
{
var len=newnode.childNodes.length;
for(var i=0;i<len;i++)
{
SetHtmlNodeFromVarNode(parent,newnode.childNodes[i]);
}
}
}
else
{
SetHtmlNodeFromVarNode(parent,newnode);
}
this.RemoveNode(newnode);
newnode=parent.firstChild;
}
if(IsDefined(typeof(node))&&node!=null)
{
ImportScriptsFromNode(node);
}
else
{
ImportScripts(request);
}
return newnode;
function SetHtmlNodeFromVarNode(parent,varNode)
{
if(varNode.firstChild!=null)
{
var len=varNode.childNodes.length;
for(var i=0;i<len;i++)
{
if(varNode.firstChild.tagName.toLowerCase()!="script")
{
parent.appendChild(varNode.firstChild);
}
}
}
}
};
AntaWindow.prototype.RemoveNode=function AntaWindow_RemoveNode(el)
{
if(el.parentNode!=null)
{
el.parentNode.removeChild(el);
}
else
{
try
{
this.WindowNode.document.removeChild(el);
}catch(ex)
{
}
}
};
AntaWindow.prototype.AppendBodyNode=function AntaWindow_AppendBodyNode(el)
{
this.WindowNode.document.body.appendChild(el);
};
AntaWindow.prototype.MakeNode=function AntaWindow_MakeNode(tagName,className)
{
var el=this.WindowNode.document.createElement(tagName);
if(IsDefined(typeof(className))&&className!=null)
{
el.className=className;
}
return el;
};
AntaWindow.prototype.LoadScriptInclude=function AntaWindow_LoadScriptInclude(url,callback)
{
var script=this.MakeNode("script");
var win=this;
var head=win.WindowNode.document.getElementsByTagName("head");
if(head!=null||head.length===0)
{
script.type="text/javascript";
script.src=url;
script.onerror=OnError;
script.onload=OnLoad;
script.onreadystatechange=OnReadyStateChange;
head[0].appendChild(script);
}
function OnError(e)
{
if(IsDefined(typeof(e))){var e=this.document.parentWindow.event;}
callback(win);
return false;
}
function OnLoad(e)
{
if(IsDefined(typeof(e))){var e=this.document.parentWindow.event;}
callback(win);
return false;
}
function OnReadyStateChange(e)
{
if(IsDefined(typeof(e))){var e=this.document.parentWindow.event;}
if(this.readyState=="complete")
{
callback(win);
}
}
};
AntaWindow.prototype.LoadStyleSheet=function AntaWindow_LoadStyleSheet(url)
{
if(this.WindowNode.document.createStyleSheet)
{
this.WindowNode.document.createStyleSheet(url);
}
else
{
var styles="@import url('"+url+"');";
var linkNode=this.MakeNode("link",null);
linkNode.rel="stylesheet";
linkNode.href="data:text/css,"+escape(styles);
this.WindowNode.document.getElementsByTagName("head")[0].appendChild(linkNode);
}
};
AntaWindow.prototype.GetClassStyle=function AntaWindow_GetClassStyle(element)
{
if(element!=null)
{
if(IsDefined(typeof(element.currentStyle)))
{
return element.currentStyle;
}
else if(IsDefined(typeof(this.WindowNode.getComputedStyle)))
{
try
{
return this.WindowNode.getComputedStyle(element,"");
}catch(ex)
{
}
}
}
};
AntaWindow.prototype.SetElementRect=function AntaWindow_SetElementRect(el,rect,extraHeight)
{
if(el!=null)
{
rect.Width-=this.GetHorizontalPaddingBorder(el);
rect.Height-=this.GetVerticalPaddingBorder(el);
extraHeight=(extraHeight==null)?0:extraHeight;
rect.OldPosition=el.style.position;
rect.OldLeft=el.style.left;
rect.OldRight=el.style.right;
rect.OldWidth=el.style.width;
rect.OldHeight=el.style.height;
el.style.position="absolute";
el.style.left=ToPixels((rect.Left<0)?0:rect.Left);
el.style.top=ToPixels((rect.Top<0)?0:rect.Top);
el.style.width=ToPixels((rect.Left<0)?rect.Width+rect.Left:rect.Width);
el.style.height=ToPixels((rect.Top<0)?rect.Height+rect.Top+extraHeight:rect.Height+extraHeight);
}
}
AntaWindow.prototype.GetElementRect=function AntaWindow_GetElementRect(el)
{
if(el==null)
{
return null;
}
var style=this.GetClassStyle(el);
var marginLeft=(style==null)?0:FromPixels(style.marginLeft);
var marginTop=(style==null)?0:FromPixels(style.marginTop);
var marginRight=(style==null)?0:FromPixels(style.marginRight);
var marginBottom=(style==null)?0:FromPixels(style.marginBottom);
var r=new AntaRect(this.FindOffsetXBody(el)-marginLeft,this.FindOffsetYBody(el)-marginTop,el.offsetWidth+marginRight+marginLeft,el.offsetHeight+marginBottom+marginTop);
return r;
};
AntaWindow.prototype.AdjustRectToScroll=function AntaWindow_AdjustRectToScroll(r)
{
if(this.ScrollNode.scrollTop>0)
{
var newTop=this.FindOffsetYBody(this.ScrollNode)+Math.max(0,r.Top-this.FindOffsetYBody(this.ScrollNode)-this.ScrollNode.scrollTop);
var newHeight=Math.max(0,((r.Top-this.ScrollNode.scrollTop)+r.Height)-newTop);
r.Top=newTop;
r.Height=newHeight;
}
if(this.ScrollNode.scrollLeft>0)
{
var newLeft=this.FindOffsetXBody(this.ScrollNode)+Math.max(0,r.Left-this.FindOffsetXBody(this.ScrollNode)-this.ScrollNode.scrollLeft);
var newWidth=Math.max(0,((r.Left-this.ScrollNode.scrollLeft)+r.Width)-newLeft);
r.Left=newLeft;
r.Width=newWidth;
}
if(this.ScrollNode.scrollHeight>this.ScrollNode.offsetHeight)
{
r.Height=Math.max(0,Math.min(this.ScrollNode.offsetHeight-(r.Top-this.FindOffsetYBody(this.ScrollNode)),r.Height));
}
if(this.ScrollNode.scrollWidth>this.ScrollNode.offsetWidth)
{
r.Width=Math.max(0,Math.min(this.ScrollNode.offsetWidth-(r.Left-this.FindOffsetXBody(this.ScrollNode)),r.Width));
}
return r;
};
AntaWindow.prototype.IsElementChildOf=function AntaWindow_IsElementChildOf(parentElement,childElement)
{
if(parentElement==null||childElement==null||childElement.parentNode==null||childElement==this.WindowNode.document.body)
{
return false;
}
if(childElement.parentNode==parentElement)
{
return true;
}
return this.IsElementChildOf(parentElement,childElement.parentNode);
};
AntaWindow.prototype.FindOffsetX=function AntaWindow_FindOffsetX(element,rootElement)
{
return this.FindOffsetXBody(element)-this.FindOffsetXBody(rootElement);
};
AntaWindow.prototype.FindOffsetXBody=function AntaWindow_FindOffsetXBody(element)
{
if(element==this.WindowNode.document.body||element==null)
{
return 0;
}
else
{
return element.offsetLeft+this.FindOffsetX(element.offsetParent);
}
};
AntaWindow.prototype.FindOffsetY=function AntaWindow_FindOffsetY(element,rootElement)
{
return this.FindOffsetYBody(element)-this.FindOffsetYBody(rootElement);
};
AntaWindow.prototype.FindOffsetYBody=function AntaWindow_FindOffsetYBody(element)
{
if(element==this.WindowNode.document.body||element==null)
{
return 0;
}
else
{
return element.offsetTop+this.FindOffsetY(element.offsetParent);
}
};
AntaWindow.prototype.SetInnerText=function AntaWindow_SetInnerText(element,text)
{
if(IsDefined(typeof(element.innerText)))
{
element.innerText=text;
}
else
{
var textNode=this.WindowNode.document.createTextNode(text);
var len=element.childNodes.length;
for(var n=0;n<len;n++)
{
this.RemoveNode(element.firstChild);
}
element.appendChild(textNode);
}
};
AntaWindow.prototype.GetHorizontalPaddingBorder=function AntaWindow_GetHorizontalPaddingBorder(el)
{
var style=this.GetClassStyle(el);
if(style==null)
{
return 0;
}
else
{
return FromPixels(style.borderLeftWidth)+FromPixels(style.borderRightWidth)+FromPixels(style.paddingLeft)+FromPixels(style.paddingRight);
}
};
AntaWindow.prototype.GetHorizontalMarginPaddingBorder=function AntaWindow_GetHorizontalMarginPaddingBorder(el)
{
var style=this.GetClassStyle(el);
if(style==null)
{
return 0;
}
else
{
return FromPixels(style.borderLeftWidth)+FromPixels(style.borderRightWidth)+FromPixels(style.marginLeft)+FromPixels(style.marginRight)+FromPixels(style.paddingLeft)+FromPixels(style.paddingRight);
}
};
AntaWindow.prototype.GetVerticalPaddingBorder=function AntaWindow_GetVerticalPaddingBorder(el)
{
var style=this.GetClassStyle(el);
if(style==null)
{
return 0;
}
else
{
return FromPixels(style.borderTopWidth)+FromPixels(style.borderBottomWidth)+FromPixels(style.marginTop)+FromPixels(style.marginBottom)+FromPixels(style.paddingTop)+FromPixels(style.paddingBottom);
}
};
AntaWindow.prototype.Child=function AntaWindow_Child(id,childId)
{
return $(id+AntaIdSeparator+childId,this.WindowNode);
};
AntaWindow.prototype.DisableTag=function AntaWindow_DisableTag(tagName)
{
if(this.WindowNode!=null)
{
var nodeList=this.WindowNode.document.body.getElementsByTagName(tagName);
var removeList=[];
for(var i=0;i<nodeList.length;i++)
{
if(!(nodeList[i].tagName.toLowerCase()=="iframe"&&GetHtmlAttributeValue(nodeList[i],"name")=="uploadframe"))
{
if(nodeList[i].style.display!="none")
{
var div=this.MakeNode("div");
div.className=nodeList[i].className+" objectreplacement";
var width=0;
var att=GetHtmlAttributeValue(nodeList[i],"width");
if(att!=null)
{
if(att.substr(att.length-1)=="%")
{
width=parseInt(nodeList[i].offsetWidth)-this.GetHorizontalPaddingBorder(nodeList[i].offsetWidth)-this.GetHorizontalPaddingBorder(div);
}
else
{
width=parseInt(att,10)-this.GetHorizontalPaddingBorder(div);
}
}
var height=0;
var att=GetHtmlAttributeValue(nodeList[i],"height");
if(att!=null)
{
height=parseInt(att,10)-this.GetVerticalPaddingBorder(div);
}
if(width<=0)
{
width=nodeList[i].offsetWidth-this.GetHorizontalPaddingBorder(div);
}
if(height<=0)
{
height=nodeList[i].offsetHeight-this.GetVerticalPaddingBorder(div);
}
div.style.width=ToPixels(width);
div.style.height=ToPixels(height);
div.style.lineHeight=ToPixels(height);
this.SetInnerText(div,"");
ShowNode(div);
nodeList[i].parentNode.insertBefore(div,nodeList[i]);
nodeList[i]._anta_OldDiv=div;
this.AntaDisabledObjects.push(nodeList[i]);
removeList.push(nodeList[i]);
}
}
}
for(var i=0;i<removeList.length;i++)
{
HideNode(removeList[i]);
}
}
};
AntaWindow.prototype.RemoveChildNodes=function AntaWindow_RemoveChildNodes(node)
{
if(IsDefined(typeof(node.childNodes))&&node.childNodes!=null)
{
var len=node.childNodes.length;
for(var i=0;i<len;i++)
{
this.RemoveNode(node.firstChild);
}
}
}
AntaWindow.prototype.DisableFramesAndEmbed=function AntaWindow_DisableFramesAndEmbed()
{
if(IE6||IE7||this.ContainsVideoClipPart())
{
if(this.AntaDisabledObjects==null)
{
this.AntaDisabledObjects=[];
this.DisableTag("object");
this.DisableTag("embed");
this.DisableTag("iframe");
if(IE6)
{
this.DisableTag("select");
}
}
}
};
AntaWindow.prototype.ContainsVideoClipPart=function AntaWindow_ContainsVideoClipPart()
{
var containsVideoClip=false;
this.IterateWebParts(function(part)
{
if(part.Type==AntaPartTypeVideoClip&&!part.WebForm.IsCurrentlyEdited)
{
containsVideoClip=true;
return false;
}
return true;
});
return containsVideoClip;
};
AntaWindow.prototype.EnableFramesAndEmbed=function AntaWindow_EnableFramesAndEmbed()
{
if(IE6||IE7||this.ContainsVideoClipPart)
{
if(this.AntaDisabledObjects!=null)
{
for(var i=0;i<this.AntaDisabledObjects.length;i++)
{
ShowNode(this.AntaDisabledObjects[i]);
if(this.AntaDisabledObjects[i]._anta_OldDiv!=null)
{
this.RemoveNode(this.AntaDisabledObjects[i]._anta_OldDiv);
}
this.AntaDisabledObjects[i]._anta_OldDiv=null;
this.AntaDisabledObjects[i]._anta_OldDisplay=null;
}
}
this.AntaDisabledObjects=null;
}
};
AntaWindow.prototype.SetActive=function AntaWindow_SetActive()
{
if(!this.Modeless)
{
AntaActiveWindow=this;
}
};
AntaWindow.prototype.GetMaximizedDelta=function AntaWindow_GetMaximizedDelta()
{
var delta=0;
if(this.BoundingNode==null)
{
var rootScroll=this.Child(AntaPageClientId,"rootscroll");
if(this.HasOwnScroll)
{
var rootDiv=this.Child(AntaPageClientId,"rootdiv");
var rootTable=this.Child(AntaPageClientId,"roottable");
delta=rootScroll.offsetHeight-rootDiv.offsetHeight;
}
else
{
delta=this.GetMaxWindowHeight()-rootScroll.offsetHeight;
}
}
return delta;
};
AntaWindow.prototype.SetChildFocus=function AntaWindow_SetChildFocus(clientId,childId)
{
var child=this.Child(clientId,childId);
child.focus();
};
AntaWindow.prototype.GetMaxWindowWidth=function AntaWindow_GetMaxWindowWidth()
{
return GetWindowWidth();
};
AntaWindow.prototype.GetMaxWindowHeight=function AntaWindow_GetMaxWindowHeight()
{
var height=GetWindowHeight();
height-=this.GetNotificationAdminHeight()
return height;
};
AntaWindow.prototype.GetNotificationAdminHeight=function AntaWindow_GetNotificationAdminHeight()
{
var height=0;
if(this==AntaRootWindow)
{
var notificationMasterZoneNode=$(AntaPageClientId+"_masternotifications",this.WindowNode);
if(notificationMasterZoneNode!=null&&notificationMasterZoneNode.firstChild!=null)
{
height+=notificationMasterZoneNode.offsetHeight;
}
var adminMasterZoneNode=$(AntaPageClientId+"_masteradmin",this.WindowNode);
if(adminMasterZoneNode!=null&&adminMasterZoneNode.firstChild!=null)
{
height+=adminMasterZoneNode.offsetHeight;
}
}
return height;
}
AntaWindow.prototype.HandleActionResult=function AntaWindow_HandleActionResult(varNode,webPart,response)
{
var childNodes=SelectNodes(varNode,"./var");
var returnCode="1";
var divNode=null;
for(var i=0;i<childNodes.length;i++)
{
var childNode=childNodes[i];
var actionResultType=GetAttributeValue(childNode,"actionresulttype");
switch(actionResultType)
{
case "1":
if(webPart!=null)
{
webPart.RefreshFromRequest(response,childNode);
}
break;
case "3":
returnCode=GetAttributeValue(childNode,"rc");
break;
case "13":
divNode=AntaHandleEntryActionResponse(webPart.ClientId,response,childNode);
break;
case "17":
AntaExecuteUpdate(webPart.DataSet.Id);
break;
case "20":
var actionId=GetAttributeValue(childNode,"actionId");
var enableAction=(GetAttributeValue(childNode,"enableAction")=="1");
var hideAction=(GetAttributeValue(childNode,"hideAction")=="1");
var action=webPart.Actions[actionId];
action.WebButton.Enable(enableAction);
action.WebButton.Show(!hideAction);
break;
default:
ImportScriptsFromNode(childNode);
break;
}
}
CallInitScripts();
if(divNode!=null)
{
this.RemoveNode(divNode);
}
CallActionResultScripts();
return returnCode;
};
AntaWindow.prototype.AddNotification=function AntaWindow_AddNotification(notification)
{
var row;
AntaRootWindow.IterateWebParts(function(webPart)
{
if(webPart.Type==AntaPartTypeNotificiation)
{
row=Add(webPart,notification);
return false;
}
return true;
}
);
return row;
function Add(webPart,notification)
{
var notificationPart=webPart.PartNode;
var notificationContent=webPart.ContentNode;
var notificationScroll=webPart.Child("NotificationScroll");
notificationContent.style.display="";
var notificationList=webPart.Child("NotificationList");
var row=notificationList.insertRow(0)
var cell=row.insertCell(-1);
var icon=new Image();
var imagename;
switch(notification.Type)
{
case 1:
imagename="Message";
break;
case 2:
imagename="Warning";
break;
case 3:
imagename="Error";
break;
}
if(notification.Type>0)
{
SetImageSource(icon,"NotificationIcons_"+imagename)
cell.appendChild(icon);
}
cell.className="icon";
cell=row.insertCell(-1);
cell.innerHTML=notification.Message.EscapeHTML().PreserveWhitespace();
row.onclick=RowClick;
row.onmouseover=MouseOver;
row.onmouseout=MouseOut;
SetDomEventData(row,notification);
var totalHeight=0;
var maxReached=false;
for(var i=0;i<notificationList.rows.length;i++)
{
var rowHeight=notificationList.rows[i].offsetHeight;
if((totalHeight+rowHeight)>200)
{
maxReached=true;
break;
}
totalHeight+=rowHeight;
}
if(maxReached)
{
notificationScroll.style.height=ToPixels(totalHeight);
}
webPart.WebForm.Window.HandleResize();
return row;
}
function RowClick(e)
{
if(!IsDefined(typeof(e))){var e=this.document.parentWindow.event;}
StoreEvent(e);
var notification=GetDomEventData(this);
if(IsDefined(typeof(notification.onClick))&&notification.onClick!=null)
{
notification.onClick(notification);
}
}
function MouseOver(e)
{
this.className="rowselected";
if(IsDefined(typeof(notification.onmouseover))&&notification.onmouseover!=null)
{
notification.onmouseover(notification);
}
}
function MouseOut(e)
{
this.className="row";
if(IsDefined(typeof(notification.onmouseout))&&notification.onmouseout!=null)
{
notification.onmouseout(notification);
}
}
};
AntaWindow.prototype.RemoveNotification=function AntaWindow_RemoveNotification(row,dontResize)
{
AntaRootWindow.IterateWebParts(function(webPart)
{
if(webPart.Type==AntaPartTypeNotificiation)
{
Remove(webPart,row,dontResize);
return false;
}
return true;
}
);
function Remove(webPart,row,dontResize)
{
var notificationList=webPart.Child("NotificationList");
for(var i=0;i<notificationList.rows.length;i++)
{
if(row==notificationList.rows[i])
{
row.onclick=null;
row.onmouseover=null;
row.onmouseout=null;
notificationList.deleteRow(i);
break;
}
}
if(notificationList.rows.length===0)
{
var notificationContent=webPart.ContentNode;
notificationContent.style.display="none";
}
else if(notificationList.rows.length<4)
{
var notificationScroll=webPart.Child("NotificationScroll");
notificationScroll.style.height=ToPixels(notificationList.rows[0].offsetHeight*notificationList.rows.length);
}
if(!IsDefined(typeof(dontResize))||!dontResize)
{
webPart.WebForm.Window.HandleResize();
}
}
};
AntaWindow.prototype.Unload=function AntaWindow_Unload()
{
if(this.WindowNode!=null)
{
if(this.ScreenBlockers!=null)
{
for(var blockerId in this.ScreenBlockers)
{
this.ScreenBlockers[blockerId].Unload();
}
}
for(var childId in this.ChildWindows)
{
if(this.ChildWindows[childId]!=null)
{
this.ChildWindows[childId].Unload();
}
}
for(var webFormClientId in this.WebForms)
{
if(this.WebForms[webFormClientId]!=null)
{
this.WebForms[webFormClientId].Unload();
}
}
if(this.WindowNode!=null){this.WindowNode=null;}
if(this.BoundingNode!=null){this.BoundingNode=null;}
if(this.ContentNode!=null){this.ContentNode=null;}
if(this.ScrollNode!=null){try{this.ScrollNode.onscroll=null;}catch(ex){};this.ScrollNode=null;}
}
};
AntaWindow.prototype.Init=function AntaWindow_Init()
{
if(this.BoundingNode==null)
{
this.BoundingRect=new AntaRect(0,0,this.GetMaxWindowWidth(),this.GetMaxWindowHeight());
if(this.HasOwnScroll)
{
this.ScrollNode=this.Child(AntaPageClientId,"rootscroll");
var pattern=new RegExp(/iphone|ipad/gi);
var isIpadIphone=pattern.test(navigator.appVersion);
if(isIpadIphone)
{
var notificationMasterZoneNode=$(AntaPageClientId+"_masternotifications",this.WindowNode);
if(notificationMasterZoneNode!=null)
{
notificationMasterZoneNode.style.position='';
notificationMasterZoneNode.style.bottom='';
}
}
else
{
this.ScrollNode.style.height=ToPixels(this.BoundingRect.Height);
}
}
else
{
this.ScrollNode=this.WindowNode.document.documentElement;
if(IE7)
{
if(IsDefined(typeof(this.WindowNode.document.body)))
{
this.WindowNode.document.body.style.overflowY="auto";
}
}
}
SetDomData(this.ScrollNode,"Window",this);
this.ScrollNode.onscroll=AntaHandleWindowScroll;
}
else
{
this.ScrollNode=this.ContentNode;
this.BoundingRect=this.GetElementRect(this.BoundingNode);
}
}
AntaWindow.prototype.CheckVisibility=function AntaWindow_CheckVisibility()
{
if(this.WindowNode.document.body.style.visibility=='hidden')
{
this.WindowNode.document.body.style.visibility='visible';
}
}
function AntaWindow(boundingNode,contentNode,modeless,win,style)
{
this.Id="Window_"+(AntaWindowCounter++);
this.Modeless=modeless;
this.ActionResultScripts=null;
this.ResizeHandlers=[];
this.ScrollHandlers=[];
this.CloseHandler=null;
this.KeyDownHandlers=[];
this.KeyUpHandlers=[];
this.Blocking=0;
this.EventHandlers=null;
this.WindowStyle=style;
this.LastKeyUpFunctions=[];
this.LastKeyDownFunctions=[];
this.WebForms={};
this.SizingBusy=false;
if(!IsDefined(typeof(win))){var win=window;}
this.WindowNode=win;
this.BoundingNode=boundingNode;
this.ContentNode=contentNode;
this.HasOwnScroll=boundingNode!=null||(GetHtmlAttributeValue(this.WindowNode.document.body,"scroll")=="no");
this.ChildWindows={};
this.Tabs=null;
this.LastActiveScriptWindow=AntaActiveScriptWindow;
AntaActiveScriptWindow=this;
this.Init();
if(IsDefined(typeof(AntaScreenKeyDownHandler))){this.RegisterKeyDownHandler(AntaScreenKeyDownHandler);}
}
function AntaScreenBlocker(windowObject,className)
{
AntaScreenBlocker.prototype.Close=function AntaScreenBlocker_Close()
{
this.Window.RemoveResizeHandler(this);
if(this.Window.Blocking>0)
{
this.Window.Blocking--;
if(this.Window.Blocking===0)
{
this.Window.RestoreTabIndex();
}
delete this.Window.ScreenBlockers[this.Id];
this.Unload();
}
};
AntaScreenBlocker.prototype.Unload=function AntaScreenBlocker_Unload()
{
if(this.BlockBackgroundNode!=null)
{
this.Window.RemoveNode(this.BlockBackgroundNode);
this.BlockBackgroundNode.onfocus=null;
this.BlockBackgroundNode=null;
}
};
AntaScreenBlocker.prototype.SetSize=function AntaScreenBlocker_SetSize()
{
var rect=this.Window.BoundingRect;
var extraHeight=this.Window.GetNotificationAdminHeight();
this.Window.SetElementRect(this.BlockBackgroundNode,rect,extraHeight);
};
AntaScreenBlocker.prototype.HandleResize=function AntaScreenBlocker_HandleResize()
{
this.SetSize();
};
AntaScreenBlocker.prototype.HandleKeyDown=function AntaScreenBlocker_HandleKeyDown()
{
if(this.KeyDownHandler!=null)
{
this.KeyDownHandler.OnKeyDown();
}
return true;
}
this.FocusHandler=null;
this.MouseDownHandler=null;
this.KeyDownHandler=null;
if(IsDefined(typeof(className)))
{
this.ClassName=className;
}
else
{
this.ClassName="screenblocker";
}
if(IsDefined(typeof(windowObject))&&windowObject!=null)
{
this.Window=windowObject;
}
else
{
this.Window=AntaActiveWindow;
}
if(this.Window.Blocking===0)
{
this.Window.ClearTabIndex();
}
this.Window.Blocking++;
if(this.Window.ScreenBlockers==null)
{
this.Window.ScreenBlockers={};
this.Window.CurrentScreenBlockerId=0;
}
this.Id=++this.Window.CurrentScreenBlockerId;
this.Window.ScreenBlockers[this.Id]=this;
this.BlockBackgroundNode=this.Window.MakeNode("div",this.ClassName);
SetDomData(this.BlockBackgroundNode,"ScreenBlocker",this);
this.SetSize();
this.Window.AppendBodyNode(this.BlockBackgroundNode);
this.Window.AddResizeHandler(this);
this.Window.CheckVisibility();
this.BlockBackgroundNode.focus();
this.BlockBackgroundNode.onfocus=AntaHandleBlockerFocus;
this.BlockBackgroundNode.onmousedown=AntaHandleBlockerMouseDown;
}
function AntaHandleBlockerMouseDown(e)
{
if(!IsDefined(typeof(e))){var e=this.document.parentWindow.event;}
StoreEvent(e);
var screenBlocker=GetDomData(this,"ScreenBlocker");
if(!IsDefined(typeof(screenBlocker))||screenBlocker==null)
{
screenBlocker=GetDomData(AntaEvent.SrcElement,"ScreenBlocker");
}
if(screenBlocker.MouseDownHandler!=null)
{
return screenBlocker.MouseDownHandler.OnMouseDown(screenBlocker);
}
else
{
e.cancelBubble=true;
return false;
}
}
function AntaHandleBlockerFocus(e)
{
if(!IsDefined(typeof(e))){var e=this.document.parentWindow.event;}
StoreEvent(e);
var screenBlocker=GetDomData(this,"ScreenBlocker");
if(!IsDefined(typeof(screenBlocker))||screenBlocker==null)
{
screenBlocker=GetDomData(AntaEvent.SrcElement,"ScreenBlocker");
}
if(screenBlocker.FocusHandler!=null)
{
return screenBlocker.FocusHandler.OnFocus(screenBlocker);
}
else
{
e.cancelBubble=true;
return false;
}
}
function AntaHandleWindowScroll(e)
{
if(!IsDefined(typeof(e))){var e=this.document.parentWindow.event;}
StoreEvent(e);
var win=GetDomData(this,"Window");
if(win==null)
{
win=AntaActiveWindow;
}
win.HandleScroll();
e.cancelBubble=true;
return false;
}
function AntaShortCut(key,handler)
{
this.Label=key;
this.Handler=handler;
var upperKey=key.toUpperCase();
if(upperKey.length==1)
{
switch(upperKey)
{
case ".":
this.KeyCode=190;
break;
default:
this.KeyCode=upperKey.charCodeAt(0);
break;
}
}
else
{
switch(upperKey)
{
case "PAGEUP":
this.KeyCode=33;
break;
case "PAGEDOWN":
this.KeyCode=34;
break;
case "END":
this.KeyCode=35;
break;
case "HOME":
this.KeyCode=36;
break;
case "LEFT":
this.KeyCode=37;
break;
case "UP":
this.KeyCode=38;
break;
case "RIGHT":
this.KeyCode=39;
break;
case "DOWN":
this.KeyCode=40;
break;
case "INSERT":
this.KeyCode=41;
break;
case "F1":
this.KeyCode=112;
break;
case "F2":
this.KeyCode=113;
break;
case "F3":
this.KeyCode=114;
break;
case "F4":
this.KeyCode=115;
break;
case "F5":
this.KeyCode=116;
break;
case "F6":
this.KeyCode=117;
break;
case "F7":
this.KeyCode=118;
break;
case "F8":
this.KeyCode=119;
break;
case "F9":
this.KeyCode=120;
break;
case "F10":
this.KeyCode=121;
break;
case "F11":
this.KeyCode=122;
break;
case "F12":
this.KeyCode=123;
break;
}
}
AntaShortCut.prototype.Press=function AntaShortCut_Press()
{
this.Handler(this);
};
}
function AntaClearActionParameters(action)
{
if(IsDefined(typeof(action))&&action!=null)
{
action.ActionParameters=null;
}
}
function AntaClearActionParameter(action,name)
{
if(IsDefined(typeof(action))&&action!=null)
{
if(action.ActionParameters!=null)
{
delete action.ActionParameters[name];
}
}
}
function AntaAddActionParameter(action,name,value,isXml)
{
if(IsDefined(typeof(action))&&action!=null)
{
if(!IsDefined(typeof(action.ActionParameters))||action.ActionParameters==null)
{
action.ActionParameters={};
}
action.ActionParameters[name]={};
action.ActionParameters[name].IsXml=(IsDefined(typeof(isXml))&&isXml);
action.ActionParameters[name].Value=(value==null)?"":value.toString();
}
}
AntaWebButton.prototype.GetCss=function AntaWebButton_GetCss(enabled)
{
var cssClass="webbutton";
switch(this.Type)
{
case 1:
cssClass+=" webbutton-text-only";
break;
case 2:
cssClass+=" webbutton-text-image-primary";
break;
case 3:
cssClass+=" webbutton-image-only";
break;
}
cssClass+=(enabled)?" cursorpointer":" cursordefault";
return cssClass;
}
AntaWebButton.prototype.Render=function AntaWebButton_Render(parentNode)
{
var imagekey=this.Group+"_"+this.Code;
this.ButtonNode=this.Window.MakeNode("button",this.GetCss(true));
this.ButtonNode.title=this.Text;
if(this.Type!=1)
{
this.ImageNode=this.Window.MakeNode("img","webbutton-image");
this.ImageNode.border=0;
SetImageSource(this.ImageNode,imagekey);
}
if(this.Type!=3)
{
this.LiteralNode=this.Window.MakeNode("span","webbutton-text");
this.Window.SetInnerText(this.LiteralNode,this.Text);
}
switch(this.Type)
{
case 1:
this.ButtonNode.appendChild(this.LiteralNode);
break;
case 2:
this.ButtonNode.appendChild(this.ImageNode);
this.ButtonNode.appendChild(this.LiteralNode);
break;
case 3:
this.ButtonNode.appendChild(this.ImageNode);
break;
}
SetDomEventData(this.ButtonNode,this);
this.ButtonNode.onclick=AntaOnButtonClick;
this.ButtonNode.ondblclick=AntaOnButtonClick;
this.ButtonNode.onfocus=AntaOnButtonFocus;
parentNode.appendChild(this.ButtonNode);
};
AntaWebButton.prototype.Flip=function AntaWebButton_Flip()
{
if(this.Switchable)
{
this.Pressed=!this.Pressed;
if(this.Action!=null)
{
this.Action.Pressed=this.Pressed;
}
this.Redraw();
}
};
AntaWebButton.prototype.Redraw=function AntaWebButton_Redraw()
{
var imagekey=this.Group+"_"+this.Code;
if(IsDefined(typeof(this.ImageNode))&&this.ImageNode!=null)
{
if(this.Enabled)
{
SetImageSource(this.ImageNode,imagekey+((this.Pressed)?"Pressed":""));
}
else
{
SetImageSource(this.ImageNode,imagekey+((this.Pressed)?"PressedDisabled":"Disabled"),true);
}
}
}
AntaWebButton.prototype.Toggle=function AntaWebButton_Toggle(toToggle)
{
this.Show(!toToggle);
var toggleNode=$(this.ButtonNode.id+"Toggle",this.Window.WindowNode);
if(toToggle)
{
ShowNode(toggleNode);
}
else
{
HideNode(toggleNode);
}
}
AntaWebButton.prototype.Press=function AntaWebButton_Press(pressed)
{
if(this.Switchable)
{
this.Pressed=pressed;
this.Redraw();
}
};
AntaWebButton.prototype.FixWidth=function AntaWebButton_FixWidth()
{
if(!IE6&&!IE7&&!(IsDefined(typeof(this.Window.WindowNode.document.documentMode))&&this.Window.WindowNode.document.documentMode<8))
{
return;
}
if(this.ButtonNode.style.display!="none")
{
if(this.ButtonNode.className.toLowerCase().indexOf("webbutton-text-only")==-1)
{
if(!this.FixedWidth)
{
this.FixedWidth=true;
if(GetDomData(this.ButtonNode,"Skip"))
{
return;
}
var childWidth=0;
for(var i=0;i<this.ButtonNode.childNodes.length;i++)
{
childWidth+=this.ButtonNode.childNodes[i].offsetWidth;
}
if(childWidth<(this.ButtonNode.offsetWidth-4))
{
this.ButtonNode.style.width=ToPixels(Math.max(16,childWidth+4)+this.Window.GetHorizontalMarginPaddingBorder(this.ButtonNode));
}
}
}
}
}
AntaWebButton.prototype.Show=function AntaWebButton_Show(show)
{
if(show)
{
ShowNode(this.ButtonNode);
this.FixWidth();
}
else
{
HideNode(this.ButtonNode);
}
};
AntaWebButton.prototype.Enable=function AntaWebButton_Enable(enabled)
{
this.Enabled=enabled;
this.Redraw();
this.ButtonNode.className=this.GetCss(enabled);
this.ButtonNode.disabled=!enabled;
};
AntaWebButton.prototype.Click=function AntaWebButton_Click()
{
if(this.Enabled)
{
this.Flip();
if(!IsNullOrEmpty(this.SelectControlClientId))
{
var customSelect=AntaCustomSelects[this.SelectControlClientId];
if(customSelect!=null)
{
customSelect.Open(this.ButtonNode);
}
}
else
{
if(IsDefined(typeof(this.CustomSelect))&&this.CustomSelect!=null)
{
this.CustomSelect.Close();
}
this.ClickHandler(this);
}
}
};
AntaWebButton.prototype.Unload=function AntaWebButton_Unload()
{
if(this.ButtonNode!=null)
{
this.ButtonNode.onclick=null;
this.ButtonNode.ondblclick=null;
this.ButtonNode.onfocus=null;
this.ButtonNode=null;
}
if(this.ImageNode!=null){this.ImageNode=null;}
if(this.LiteralNode!=null){this.LiteralNode=null;}
};
function AntaWebButton(windowObject,type,group,code,switchable,pressed,enabled,text,clickHandler,focusHandler,mouseOverHandler,mouseOutHandler)
{
this.Window=windowObject;
this.Type=type;
this.Group=group;
this.Code=code;
this.Text=text;
this.Switchable=switchable;
this.Enabled=enabled;
this.Pressed=pressed;
this.ClickHandler=clickHandler;
this.FocusHandler=focusHandler;
this.Action=null;
this.FixedWidth=false;
this.MouseOverHandler=mouseOverHandler;
this.MouseOutHandler=mouseOutHandler;
}
function AntaOnButtonFocus(e)
{
if(!IsDefined(typeof(e))){var e=this.document.parentWindow.event;}
StoreEvent(e);
var button=GetDomEventData(this);
if(IsDefined(typeof(button.AntaControl))&&button.AntaControl!=null)
{
button.SenderId=this.id;
var eventArgs={Cancel:false,Type:AntaEvent.Type,SenderId:button.SenderId,Action:button.Action};
var sender=button.AntaControl;
if(IsDefined(typeof(button.FocusHandler)))
{
button.FocusHandler(sender,eventArgs);
}
}
}
function AntaOnButtonMouseOver(e)
{
if(!IsDefined(typeof(e))){var e=this.document.parentWindow.event;}
StoreEvent(e);
var button=GetDomEventData(this);
if(button.Enabled&&button.Window.Blocking==0)
{
if(IsDefined(typeof(button.MouseOverHandler))&&button.MouseOverHandler!=null)
{
button.MouseOverHandler(button);
}
}
e.cancelBubble=true;
return false;
}
function AntaOnButtonMouseOut(e)
{
if(!IsDefined(typeof(e))){var e=this.document.parentWindow.event;}
StoreEvent(e);
var button=GetDomEventData(this);
if(button.Enabled&&button.Window.Blocking==0)
{
if(IsDefined(typeof(button.MouseOutHandler))&&button.MouseOutHandler!=null)
{
button.MouseOutHandler(button);
}
}
e.cancelBubble=true;
return false;
}
function AntaOnButtonClick(e)
{
if(!IsDefined(typeof(e))){var e=this.document.parentWindow.event;}
StoreEvent(e);
var button=GetDomEventData(this);
if(button.Enabled&&button.Window.Blocking==0)
{
if(button.Action!=null)
{
AntaLastAction=button.Action;
}
if(IsDefined(typeof(button.AntaControl))&&button.AntaControl!=null)
{
button.SenderId=this.id;
}
if(button.Action!=null&&button.Action.ConfirmationType==1)
{
var question=AntaSR.ActionConfirm(button.Action.Caption);
if(IsDefined(typeof(button.Action.ActionConfirm))&&button.Action.ActionConfirm!=null)
{
if(typeof(button.Action.ActionConfirm)=="string")
{
question=button.Action.ActionConfirm;
}
else
{
question=button.Action.ActionConfirm(button.Action.Caption);
}
}
ShowDialog(5,AntaDialogButtonYes|AntaDialogButtonNo,"",question,HandleYesNo,button);
}
else
{
Proceed(button);
}
}
e.cancelBubble=true;
return false;
function HandleYesNo(dialog)
{
if(dialog.Result==AntaDialogButtonYes)
{
Proceed(dialog.State);
}
}
function Proceed(button)
{
if(IsDefined(typeof(button.AntaControl))&&button.AntaControl!=null)
{
var eventArgs={Cancel:false,Type:AntaEvent.Type,SenderId:button.SenderId,Action:button.Action};
var sender=button.AntaControl;
if(IsDefined(typeof(button.ClickHandler))&&button.ClickHandler!=null)
{
button.ClickHandler(sender,eventArgs);
}
}
else
{
button.Click();
}
}
}
function AttachWebButton(windowObject,buttonProperties,clickHandler,focusHandler,mouseOverHandler,mouseOutHandler)
{
var group=buttonProperties.ImageGroup;
var code=buttonProperties.Code;
var action=buttonProperties.Action;
var containerClientId=buttonProperties.ParentClientId;
var selectControlClientId=buttonProperties.SelectControlClientId;
var key=group+"_"+code+((action!=null)?"_"+action.Id:"");
var buttonNode=windowObject.Child(containerClientId,"Button"+key);
var imageNode=windowObject.Child(containerClientId,"Image"+key);
var literalNode=windowObject.Child(containerClientId,"Literal"+key);
var type;
if(imageNode==null)
{
type=1;
}
else if(literalNode==null)
{
type=3;
}
else
{
type=2;
}
var switchable=false;
if(GetHtmlAttributeValue(buttonNode,"switchable")=="1")
{
switchable=true;
}
var pressed=false;
if(GetHtmlAttributeValue(buttonNode,"pressed")=="1")
{
pressed=true;
}
var enabled=true;
if(GetHtmlAttributeValue(buttonNode,"disabled")=="disabled")
{
enabled=false;
}
var button=new AntaWebButton(windowObject,type,group,code,switchable,pressed,enabled,"",clickHandler,focusHandler,mouseOverHandler,mouseOutHandler);
button.Action=action;
if(action!=null)
{
action.WebButton=button;
}
button.ButtonNode=buttonNode;
button.ImageNode=imageNode;
button.LiteralNode=literalNode;
button.ContainerClientId=containerClientId;
button.SelectControlClientId=selectControlClientId;
SetDomEventData(button.ButtonNode,button);
button.ButtonNode.onclick=AntaOnButtonClick;
button.ButtonNode.ondblclick=AntaOnButtonClick;
button.ButtonNode.onfocus=AntaOnButtonFocus;
button.ButtonNode.onmouseover=AntaOnButtonMouseOver;
button.ButtonNode.onmouseout=AntaOnButtonMouseOut;
if(button.ImageNode!=null)
{
SetDomEventData(button.ImageNode,button);
button.ImageNode.onmouseover=AntaOnButtonMouseOver;
button.ImageNode.onmouseout=AntaOnButtonMouseOut;
}
if(button.LiteralNode!=null)
{
SetDomEventData(button.LiteralNode,button);
button.LiteralNode.onmouseover=AntaOnButtonMouseOver;
button.LiteralNode.onmouseout=AntaOnButtonMouseOut;
}
button.FixWidth();
if(IE7)
{
button.ButtonNode.style.position='static';
if(IsDefined(typeof(button.ImageNode))&&button.ImageNode!=null)
{
button.ImageNode.style.position='static';
button.ImageNode.style.margin='0px';
}
}
return button;
}
function ShowDialog(type,buttons,title,prompt,callback,state,text,readonly,imageUrl,imageWidth,imageHeight)
{
return new AntaDialog(type,buttons,title,prompt,callback,state,text,readonly,imageUrl,imageWidth,imageHeight);
}
AntaDialog.prototype.Close=function AntaDialog_Close()
{
if(this.Popup!=null)
{
this.Popup.ClosedByUser=false;
this.Popup.Close();
}
this.Unload();
};
AntaDialog.prototype.Render=function AntaDialog_Render(windowObject,parentElement)
{
this.Window=windowObject;
if(this.Type!=8&&this.Type!=9)
{
this.TextNode=null;
this.ImageNode=this.Window.MakeNode("img","dialogimage");
SetHtmlAttributeValue(this.ImageNode,"align","left");
this.PromptNode=this.Window.MakeNode("div","dialogprompt");
this.ButtonsNode=null;
this.ProgressNode=null;
if(IsDefined(typeof(this.Prompt))&&this.Prompt!=null&&this.Prompt.length>0)
{
this.PromptNode.innerHTML=this.Prompt.EscapeHTML().PreserveWhitespace();
}
parentElement.appendChild(this.PromptNode);
this.PromptNode.insertBefore(this.ImageNode,this.PromptNode.firstChild);
switch(this.Type)
{
case 2:
SetImageSource(this.ImageNode,"Dialog_Warning");
break;
case 3:
SetImageSource(this.ImageNode,"Dialog_Error");
break;
case 5:
SetImageSource(this.ImageNode,"Dialog_Question");
break;
case 6:
SetImageSource(this.ImageNode,"Dialog_Question");
this.TextNode=this.Window.MakeNode("textarea","dialogtext");
this.TextNode.value=this.Text;
if(this.ReadOnly)
{
this.TextNode.disabled=true;
}
else
{
this.TextAreaNode=this.TextNode;
}
parentElement.appendChild(this.TextNode);
break;
default:
SetImageSource(this.ImageNode,"Dialog_Message");
break;
}
if(this.Type!=4)
{
this.ButtonBarNode=this.Window.MakeNode("div","dialogbuttonbar");
this.ButtonsNode=this.Window.MakeNode("div","dialogbuttons");
var buttons=[];
var defbutton;
var buttonStart=32;
var orderedButtons=[AntaDialogButtonOK,AntaDialogButtonAbort,AntaDialogButtonRetry,AntaDialogButtonIgnore,AntaDialogButtonYes,AntaDialogButtonNo,AntaDialogButtonCancel];
for(var i=0;i<orderedButtons.length;i++)
{
var button=orderedButtons[i];
if((this.ButtonsBitPattern&button)!==0)
{
switch(button)
{
case AntaDialogButtonOK:
buttons.push({Code:AntaDialogButtonOK,Text:AntaSR.OK});
break;
case AntaDialogButtonAbort:
buttons.push({Code:AntaDialogButtonAbort,Text:AntaSR.Abort});
break;
case AntaDialogButtonRetry:
buttons.push({Code:AntaDialogButtonRetry,Text:AntaSR.Retry});
break;
case AntaDialogButtonIgnore:
buttons.push({Code:AntaDialogButtonIgnore,Text:AntaSR.Ignore});
break;
case AntaDialogButtonCancel:
buttons.push({Code:AntaDialogButtonCancel,Text:AntaSR.Cancel});
break;
case AntaDialogButtonYes:
buttons.push({Code:AntaDialogButtonYes,Text:AntaSR.Yes});
break;
case AntaDialogButtonNo:
buttons.push({Code:AntaDialogButtonNo,Text:AntaSR.No});
break;
}
}
}
if(buttons.length>0)
{
defbutton=buttons[0].Code;
}
AddButtons(this,buttons);
this.ButtonBarNode.appendChild(this.ButtonsNode);
parentElement.appendChild(this.ButtonBarNode);
for(var i=0;i<buttons.length;i++)
{
if(buttons[i].Code==defbutton)
{
this.Window.RemoveSelection();
buttons[i].ButtonObject.ButtonNode.focus();
}
}
}
else
{
this.ProgressNode=this.Window.MakeNode("div","dialogprogressindicator");
var progressImg=this.Window.MakeNode("img");
SetImageSource(progressImg,"Dialog_Progress");
this.ProgressNode.appendChild(progressImg);
parentElement.appendChild(this.ProgressNode);
}
}
else
{
AntaRenderSpecialDialog(parentElement,this)
}
this.ResizeToParent();
if(this.TextAreaNode!=null)
{
var textNode=this.TextAreaNode;
setTimeout(function(){textNode.focus();},100);
}
function AddButtons(dialog,buttons)
{
for(var i=0;i<buttons.length;i++)
{
buttons[i].ButtonObject=new AntaWebButton(dialog.Window,1,"Dialog",buttons[i].Code,false,false,true,buttons[i].Text,OnClick,null,null);
buttons[i].ButtonObject.Render(dialog.ButtonsNode);
dialog.Buttons.push(buttons[i].ButtonObject);
}
function OnClick(button)
{
dialog.Result=button.Code;
if(dialog.TextAreaNode!=null)
{
dialog.Text=dialog.TextAreaNode.value;
}
dialog.Close();
}
}
};
AntaDialog.prototype.ResizeToParent=function AntaDialog_ResizeToParent()
{
if(this.Type!=8&&this.Type!=9)
{
var parentElement=this.PromptNode.parentNode;
var height=parentElement.offsetHeight-this.Window.GetVerticalPaddingBorder(parentElement);
height-=(this.ButtonBarNode==null)?0:(this.ButtonBarNode.offsetHeight+this.Window.GetVerticalPaddingBorder(this.ButtonBarNode));
height-=(this.ProgressNode==null)?0:(this.ProgressNode.offsetHeight+this.Window.GetVerticalPaddingBorder(this.ProgressNode));
if(this.TextNode!=null)
{
height-=(this.PromptNode.offsetHeight+this.Window.GetVerticalPaddingBorder(this.PromptNode));
this.TextNode.style.height=ToPixels(height-this.Window.GetVerticalPaddingBorder(this.TextNode));
this.TextNode.style.width=ToPixels(this.PromptNode.offsetWidth-this.Window.GetHorizontalPaddingBorder(this.PromptNode)-this.Window.GetHorizontalPaddingBorder(this.TextNode));
}
else
{
this.PromptNode.style.height=ToPixels(height-this.Window.GetVerticalPaddingBorder(this.PromptNode));
}
this.ImageNode.style.paddingBottom=ToPixels(this.ImageNode.parentNode.offsetHeight-this.ImageNode.offsetHeight-this.Window.GetVerticalPaddingBorder(this.ImageNode)-this.Window.GetVerticalPaddingBorder(this.ImageNode.parentNode));
}
else
{
AntaResizeSpecialDialog(this);
}
};
AntaDialog.prototype.HandleResize=function AntaDialog_HandleResize()
{
this.ResizeToParent();
};
AntaDialog.prototype.Unload=function AntaDialog_Unload()
{
if(this.TextNode!=null){this.TextNode=null;}
if(this.ImageNode!=null){this.ImageNode=null;}
if(this.PromptNode!=null){this.PromptNode=null;}
if(this.ButtonsNode!=null){this.ButtonsNode=null;}
if(this.ProgressNode!=null){this.ProgressNode=null;}
if(this.TextNode!=null){this.TextNode=null;}
if(this.TextAreaNode!=null){this.TextAreaNode=null;}
if(this.ButtonBarNode!=null){this.ButtonBarNode=null;}
if(this.Buttons!=null)
{
for(var buttonIndex=0;buttonIndex<this.Buttons.length;buttonIndex++)
{
var buttonObject=this.Buttons[buttonIndex];
if(buttonObject!=null){buttonObject.Unload();}
}
}
};
function AntaDialog(type,buttons,title,prompt,callback,state,text,readonly,imageUrl,imageWidth,imageHeight)
{
this.Type=type;
this.ButtonsBitPattern=buttons;
this.Buttons=[];
this.Title=title;
this.Prompt=prompt;
this.Text=text;
this.ImageURL=imageUrl;
this.ImageWidth=imageWidth;
this.ImageHeight=imageHeight;
this.Callback=callback;
this.ReadOnly=readonly;
this.TextAreaNode=null;
this.State=state;
this.Popup=null;
var resizable=(this.Type==6||this.Type==7||this.Type==8);
var dialogWidth=400;
var dialogHeight=200;
if(this.Type==8&&this.ImageWidth>0&&this.ImageHeight>0)
{
dialogHeight=this.ImageHeight;
dialogWidth=this.ImageWidth;
}
this.Popup=new AntaPopup(2,"FloatingWindow_2gether",null,this.Title,(this.Type==8)?1:2,new AntaRect(0,0,dialogWidth,dialogHeight),HandleClose,HandleCallback,(this.ButtonsBitPattern&(AntaDialogButtonCancel|AntaDialogButtonOK))==0,resizable,this.Type==7,this);
function HandleClose(popup)
{
var result;
switch(popup.Dialog.Type)
{
case 1:
case 2:
case 3:
result=AntaDialogButtonOK;
break;
case 5:
result=AntaDialogButtonNo;
break;
case 6:
result=AntaDialogButtonCancel;
break;
}
popup.Dialog.Result=result;
Callback(popup.Dialog);
}
function HandleCallback(popup)
{
Callback(popup.Dialog);
}
function Callback(dialog)
{
if(IsDefined(typeof(dialog.Callback))&&dialog.Callback!=null)
{
dialog.Callback(dialog);
}
}
}
function AntaResizeSpecialDialog(dialog)
{
switch(dialog.Type)
{
case 8:
var win=dialog.Window;
var parentElement=dialog.ImageNode.parentNode;
parentElement.style.overflow='hidden';
var rect=win.GetElementRect(parentElement);
var width=rect.Width-win.GetHorizontalPaddingBorder(parentElement);
var height=rect.Height-win.GetVerticalPaddingBorder(parentElement);
dialog.ImageNode.style.width=ToPixels(width);
dialog.ImageNode.style.height=ToPixels(height);
break;
}
}
function AntaRenderSpecialDialog(parentElement,dialog)
{
switch(dialog.Type)
{
case 8:
dialog.ImageNode=dialog.Window.MakeNode("img","dialogfullimage");
dialog.ImageNode.src=dialog.ImageURL;
parentElement.appendChild(dialog.ImageNode);
break;
case 9:
if(IsDefined(typeof(AntaColorPicker)))
{
}
break;
}
}
function ShowBackendQuestion(question)
{
ShowDialog(5,question.Type,"",question.Message,AfterQuestionActionResult,question);
function AfterQuestionActionResult(dialog)
{
var question=dialog.State;
var answers="<answers>"+
"<answer id=\"" + question.Id + "\" result=\"" + dialog.Result + "\" />"+
"</answers>";
switch(AntaLastAction.WebPart.Type)
{
case 3:
AntaLastAction.WebPart.WebView.ExecuteAction(AntaLastAction,answers);
break;
default:
if(AntaLastAction.Type==4&&AntaLastAction.Id=="Finish")
{
AntaLastAction.WebPart.Wizard.Finish(answers);
}
else if(AntaLastAction.Type===0&&(AntaLastAction.Id=="AntaUpdateWebForm"||AntaLastAction.Id=="AntaUpdateBackWebForm"||AntaLastAction.Id=="AntaUpdateCloseWebForm"))
{
AntaExecuteUpdate(AntaLastAction.WebPart.DataSet.Id,answers);
}
else if(AntaLastAction.Type==2&&AntaLastAction.Id=="EntryAction")
{
AntaExecuteEntryAction(AntaLastAction.Data,answers);
}
else
{
AntaLastAction.WebPart.ExecuteAction(AntaLastAction,answers);
}
break;
}
}
}
function AntaPopup(popupStyle,icon,url,title,positionType,rect,onClose,onCallback,closable,resizable,modeless,dialog,sizingType)
{
this.ParentWindow=AntaActiveWindow;
this.Style=popupStyle;
this.Url=url;
this.Title=title;
this.PositionType=positionType;
this.SizingType=IsDefined(typeof(sizingType))?sizingType:0;
this.BoundingRect=rect;
this.OnCloseCallback=onClose;
this.OnCallback=onCallback;
this.Closable=closable;
this.Resizable=resizable;
this.Modeless=modeless;
this.Dialog=dialog;
this.Icon=icon;
this.ClosedByUser=true;
this.CloseButton=null;
this.FloatHeaderNode=null;
this.Blocked=false;
AntaPopup.prototype.OnWindowClose=function AntaPopup_OnWindowClose()
{
if(IsDefined(typeof(this.OnCallback))&&this.OnCallback!=null)
{
for(var i=0;i<AntaActionCallbackHandlers.length;i++)
{
if(AntaActionCallbackHandlers[i]===this)
{
AntaActionCallbackHandlers.splice(i,1);
if(IsDefined(typeof(this.OnCloseCallback))&&this.OnCloseCallback!=null)
{
this.OnCloseCallback(this);
}
break;
}
}
this.OnCallback=null;
}
this.CloseWindowFunc(this);
};
AntaPopup.prototype.HandleActionCallback=function AntaPopup_HandleActionCallback(success,callbackData)
{
this.Data=callbackData;
if(IsDefined(typeof(this.OnCallback))&&this.OnCallback!=null)
{
this.OnCallback(this);
this.OnCallback=null;
}
};
AntaPopup.prototype.Close=function AntaPopup_Close()
{
this.CloseWindowFunc(this);
if(IsDefined(typeof(this.Window))&&this.Window!=null)
{
this.Window.CloseHandler=null;
this.Window.Close();
}
if(this.ClosedByUser)
{
if(IsDefined(typeof(this.OnCallback))&&this.OnCallback!=null)
{
for(var i=0;i<AntaActionCallbackHandlers.length;i++)
{
if(AntaActionCallbackHandlers[i]===this)
{
AntaActionCallbackHandlers.splice(i,1);
break;
}
}
this.OnCallback=null;
}
if(IsDefined(typeof(this.OnCloseCallback))&&this.OnCloseCallback!=null)
{
this.OnCloseCallback(this);
}
}
else
{
if(IsDefined(typeof(this.OnCallback))&&this.OnCallback!=null)
{
CallActionCallback(true,null);
}
}
this.Unload();
};
AntaPopup.prototype.Refresh=function AntaPopup_Refresh()
{
this.RefreshWindowFunc(this);
};
AntaPopup.prototype.Unload=function AntaPopup_Unload()
{
if(this.CloseButton!=null){this.CloseButton.Unload();}
if(this.FloatHeaderNode!=null)
{
this.FloatHeaderNode.onmousedown=null;
this.FloatHeaderNode=null;
}
if(this.FloatResizeNode!=null)
{
this.FloatResizeNode.onmousedown=null;
this.FloatResizeNode=null;
}
};
if(this.OnCallback!=null)
{
AntaActionCallbackHandlers.push(this);
}
if(!IsDefined(typeof(this.BoundingRect))||this.BoundingRect==null)
{
this.BoundingRect=new AntaRect(0,0,400,400);
}
switch(this.Style)
{
case 1:
CreateNewBrowserWindow(this);
break;
default:
case 2:
if(this.Url!=null&&this.Url.length>0)
{
if(this.Url.indexOf(window.location.protocol+"//"+window.location.host)!=-1)
{
this.Url=this.Url.replace(window.location.protocol+"//"+window.location.host,"");
}
if(this.Url.indexOf("://")!=-1)
{
CreateNewBrowserWindow(this);
break;
}
}
CreateFloatingWindow(this);
break;
}
function CreateFloatingWindow(popup)
{
popup.ParentWindow.DisableFramesAndEmbed();
var windowWidth=Math.max(popup.BoundingRect.Width,100);
var windowHeight=Math.max(popup.BoundingRect.Height,50);
var x;
var y;
switch(popup.PositionType)
{
case 1:
x=AntaEvent.X-windowWidth/2;
y=AntaEvent.Y-windowHeight/2;
if(x<5)
{
x=5;
}
if(x>(popup.ParentWindow.BoundingRect.Width-windowWidth-30))
{
x=popup.ParentWindow.BoundingRect.Width-windowWidth-30;
}
if(y<5)
{
y=5;
}
if(y>(popup.ParentWindow.BoundingRect.Height-windowHeight-30))
{
y=popup.ParentWindow.BoundingRect.Height-windowHeight-30;
}
break;
case 2:
x=((popup.ParentWindow.HasOwnScroll)?0:popup.ParentWindow.ScrollNode.scrollLeft)+(popup.ParentWindow.BoundingRect.Width-windowWidth)/2;
y=((popup.ParentWindow.HasOwnScroll)?0:popup.ParentWindow.ScrollNode.scrollTop)+(popup.ParentWindow.BoundingRect.Height-windowHeight)/2;
break;
}
popup.BlockingParent=(!popup.Modeless)?new AntaScreenBlocker(popup.ParentWindow):null;
var floatWindow=popup.ParentWindow.MakeNode("div","float");
popup.FloatHeaderNode=popup.ParentWindow.MakeNode("div","floatheader");
floatWindow.appendChild(popup.FloatHeaderNode);
var floatContent=popup.ParentWindow.MakeNode("div","floatcontent");
floatWindow.appendChild(floatContent);
var floatFooter=popup.ParentWindow.MakeNode("div","floatfooter");
popup.FloatResizeNode=popup.ParentWindow.MakeNode("div","floatresize");
var resizeImage=popup.ParentWindow.MakeNode("img","floatresizeimage");
SetImageSource(resizeImage,"FloatingWindow_Resize");
popup.FloatResizeNode.appendChild(resizeImage);
floatFooter.appendChild(popup.FloatResizeNode);
floatWindow.appendChild(floatFooter);
var titlecell;
var headerTable=popup.ParentWindow.MakeNode("table");
headerTable.cellSpacing=0;
headerTable.cellPadding=0;
var row=headerTable.insertRow(0);
titlecell=row.insertCell(-1);
titlecell.className="floattitle";
titlecell.width="100%";
if(!IsNullOrEmpty(popup.Title))
{
popup.ParentWindow.SetInnerText(titlecell,popup.Title);
}
var cell=row.insertCell(-1);
cell.vAlign="top";
popup.CloseButton=new AntaWebButton(popup.ParentWindow,3,"FloatingWindow","Close",false,false,true,AntaSR.Close,OnCloseButtonClick,null,null);
popup.CloseButton.Popup=popup;
popup.CloseButton.Render(cell);
popup.FloatHeaderNode.appendChild(headerTable);
floatContent.style.height="auto";
popup.FloatResizeNode.style.display=popup.Resizable?"":"none";
popup.ParentWindow.WindowNode.focus();
popup.CloseButton.Enable(popup.Closable);
popup.CloseButton.ButtonNode.style.visibility=popup.Closable?"visible":"hidden";
popup.CloseWindowFunc=FloatClose;
popup.RefreshWindowFunc=FloatRefresh;
floatWindow.style.left=ToPixels(popup.ParentWindow.BoundingRect.Left+x);
floatWindow.style.top=ToPixels(popup.ParentWindow.BoundingRect.Top+y);
floatWindow.style.position="absolute";
floatWindow.style.display="";
popup.ParentWindow.AppendBodyNode(floatWindow);
floatWindow.style.width=ToPixels(windowWidth+popup.ParentWindow.GetHorizontalPaddingBorder(floatContent));
floatContent.style.width=ToPixels(windowWidth);
floatContent.style.height=ToPixels(windowHeight);
popup.Window=new AntaWindow(floatWindow,floatContent,popup.Modeless,popup.ParentWindow.WindowNode,1);
popup.Window.WindowWidth=windowWidth;
popup.Window.CopyEventHandler("beforeunload",popup.ParentWindow);
popup.Window.CopyEventHandler("unload",popup.ParentWindow);
popup.CloseButton.Window=popup.Window;
popup.Window.CloseHandler=popup;
popup.Window.RefreshHandler=popup;
popup.ParentWindow.AddChildWindow(popup.Window);
popup.FloatHeaderNode.onmousedown=HandleFloatWindowHeaderMouseDown;
SetDomEventData(popup.FloatHeaderNode,popup);
if(popup.Resizable)
{
popup.FloatResizeNode.onmousedown=HandleFloatWindowResizeMouseDown;
}
if(IsDefined(typeof(popup.Dialog))&&popup.Dialog!=null)
{
popup.Dialog.Render(popup.Window,floatContent);
popup.Window.AddResizeHandler(popup.Dialog);
popup.Window.SetActive();
}
else
{
popup.FloatWindow=floatWindow;
popup.FloatWindow.style.visibility="hidden";
popup.CloseButton.Show(false);
GetUrl(popup);
}
function GetUrl(popup)
{
var url=popup.Url;
popup.Window.SetActive();
if(url.toLowerCase().indexOf(AntaVirtualDir)===0)
{
url="/"+url.substring(AntaVirtualDir.length);
}
var insertPrefix=popup.Window.Id;
var eventProperties=
"<property name=\"namingcontainerid\" value=\"" + insertPrefix.EscapeHTML() + "\"/>"+
"<property name=\"windowwidth\" value=\"" + popup.Window.WindowWidth + "\"/>";
var pathParts=url.split("?");
var location=pathParts[0];
var querystring="";
if(pathParts.length>1)
{
querystring=pathParts[1];
}
var eventData="<event location=\"" + location.EscapeHTML() + "\" querystring=\"" + querystring.EscapeHTML() + "\">"+eventProperties+"</event>";
AntaPostBack(AntaWebFormLocationEventUrl,eventData,"text/xml",true,null,HandleUrlEvent);
function HandleUrlEvent(success,response,errorData)
{
popup.FloatWindow.style.visibility="visible";
popup.CloseButton.Show(true);
if(!success)
{
var errorDialog=ShowUnexpectedError(CloseAfterError);
errorDialog.OldPopup=popup;
}
else
{
popup.Window.ImportRequest(floatContent,response);
var popupTitle=null;
popup.Window.IterateWebParts(function(webPart)
{
webPart.Initialize();
if(webPart.Type==AntaPartTypeText&&webPart.SubType==AntaPartSubTypeTitle)
{
HideNode(webPart.PartNode);
popupTitle=GetInnerText(webPart.ContentNode);
}
return true;
});
if(IsNullOrEmpty(GetInnerText(titlecell))&&popupTitle!=null)
{
popup.ParentWindow.SetInnerText(titlecell,popupTitle);
}
if(IsNullOrEmpty(GetInnerText(titlecell)))
{
for(var webFormClientId in popup.Window.WebForms)
{
popup.ParentWindow.SetInnerText(titlecell,popup.Window.WebForms[webFormClientId].Title);
}
}
popup.Window.HandleResize();
if(popup.SizingType==1)
{
if(popup.Window.ScrollNode.offsetHeight<popup.Window.ScrollNode.scrollHeight)
{
var height=FromPixels(popup.Window.ContentNode.style.height);
height+=(popup.Window.ScrollNode.scrollHeight-popup.Window.ScrollNode.offsetHeight);
height=Math.min(AntaRootWindow.GetMaxWindowHeight()+AntaRootWindow.GetNotificationAdminHeight()-50,height);
popup.Window.ContentNode.style.height=ToPixels(height);
popup.Window.HandleResize();
}
}
else
{
setTimeout(function(){popup.Window.HandleResize();},100);
}
}
}
}
function CloseAfterError(dialog)
{
var popup=dialog.OldPopup;
popup.Close();
}
function FloatRefresh(popup)
{
}
function FloatClose(popup)
{
if(popup.BlockingParent!=null)
{
popup.BlockingParent.Close();
}
popup.ParentWindow.RemoveNode(floatWindow);
if(IsDefined(typeof(popup.Window))&&popup.Window!=null)
{
popup.ParentWindow.RemoveChildWindow(popup.Window);
}
popup.ParentWindow.EnableFramesAndEmbed();
}
function OnCloseButtonClick(button)
{
var popup=button.Popup;
if(popup.Closable)
{
popup.Close();
}
}
function HandleFloatWindowHeaderMouseDown(e)
{
if(!IsDefined(typeof(e))){var e=this.document.parentWindow.event;}
StoreEvent(e);
var timeoutId;
var dragStarted=false;
var dragOffsetX;
var dragOffsetY;
var lastMouseMoveFun;
var lastMouseUpFun=popup.ParentWindow.WindowNode.document.body.onmouseup;
if(IsDefined(typeof(popup.ParentWindow.WindowNode.document.addEventListener)))
{
popup.ParentWindow.WindowNode.document.addEventListener("mouseup",StopDrag,true);
}
else
{
popup.ParentWindow.WindowNode.document.body.onmouseup=StopDrag;
if(IsDefined(typeof(popup.ParentWindow.WindowNode.document.body.setCapture)))
{
popup.ParentWindow.WindowNode.document.body.setCapture();
}
}
StartDrag();
return false;
function StopDrag(e)
{
if(!IsDefined(typeof(e))){var e=this.document.parentWindow.event;}
StoreEvent(e);
if(dragStarted)
{
popup.ParentWindow.EnableSelection();
dragStarted=false;
popup.ParentWindow.WindowNode.document.body.onmousemove=lastMouseMoveFun;
}
if(IsDefined(typeof(popup.ParentWindow.WindowNode.document.removeEventListener)))
{
popup.ParentWindow.WindowNode.document.removeEventListener("mouseup",StopDrag,true);
}
else
{
popup.ParentWindow.WindowNode.document.body.onmouseup=lastMouseUpFun;
if(IsDefined(typeof(popup.ParentWindow.WindowNode.document.body.releaseCapture)))
{
popup.ParentWindow.WindowNode.document.body.releaseCapture();
}
}
return false;
}
function StartDrag()
{
dragStarted=true;
popup.ParentWindow.DisableSelection();
popup.ParentWindow.RemoveSelection();
dragOffsetX=AntaEvent.X-popup.ParentWindow.FindOffsetXBody(floatWindow);
dragOffsetY=AntaEvent.Y-popup.ParentWindow.FindOffsetYBody(floatWindow);
lastMouseMoveFun=popup.ParentWindow.WindowNode.document.body.onmousemove;
popup.ParentWindow.WindowNode.document.body.onmousemove=Drag;
}
function Drag(e)
{
if(!IsDefined(typeof(e))){var e=this.document.parentWindow.event;}
StoreEvent(e);
floatWindow.style.left=ToPixels(AntaEvent.X-dragOffsetX);
floatWindow.style.top=ToPixels(AntaEvent.Y-dragOffsetY);
return false;
}
}
function HandleFloatWindowResizeMouseDown(e)
{
if(!IsDefined(typeof(e))){var e=this.document.parentWindow.event;}
StoreEvent(e);
var dragStarted=false;
var lastMouseMoveFun;
var startY=AntaEvent.Y;
var startHeight=floatContent.offsetHeight;
var lastMouseUpFun=popup.Window.WindowNode.document.body.onmouseup;
if(IsDefined(typeof(popup.Window.WindowNode.document.addEventListener)))
{
popup.Window.WindowNode.document.addEventListener("mouseup",StopDrag,true);
}
else
{
popup.Window.WindowNode.document.body.onmouseup=StopDrag;
if(IsDefined(typeof(popup.Window.WindowNode.document.body.setCapture)))
{
popup.Window.WindowNode.document.body.setCapture();
}
}
StartDrag();
return false;
function StopDrag(e)
{
if(!IsDefined(typeof(e))){var e=this.document.parentWindow.event;}
StoreEvent(e);
if(dragStarted)
{
dragStarted=false;
popup.Window.WindowNode.document.body.onmousemove=lastMouseMoveFun;
popup.Window.EnableSelection();
}
if(IsDefined(typeof(popup.Window.WindowNode.document.removeEventListener)))
{
popup.Window.WindowNode.document.removeEventListener("mouseup",StopDrag,true);
}
else
{
popup.Window.WindowNode.document.body.onmouseup=lastMouseUpFun;
if(IsDefined(typeof(popup.Window.WindowNode.document.body.releaseCapture)))
{
popup.Window.WindowNode.document.body.releaseCapture();
}
}
return false;
}
function StartDrag()
{
dragStarted=true;
popup.Window.DisableSelection();
popup.Window.RemoveSelection();
lastMouseMoveFun=popup.Window.WindowNode.document.body.onmousemove;
popup.Window.WindowNode.document.body.onmousemove=Drag;
function Drag(e)
{
if(!IsDefined(typeof(e))){var e=this.document.parentWindow.event;}
StoreEvent(e);
var width=Math.max(AntaEvent.X-popup.Window.FindOffsetXBody(floatWindow),100);
floatWindow.style.width=ToPixels(width);
var height=Math.max(startHeight+AntaEvent.Y-startY,50);
floatContent.style.height=ToPixels(height);
floatContent.style.width=ToPixels(width-popup.ParentWindow.GetHorizontalPaddingBorder(floatContent));
popup.Window.HandleResize();
return false;
}
}
}
}
function CreateNewBrowserWindow(popup)
{
var popupWindow;
var x;
var y;
popup.CloseWindowFunc=PopupClose;
popup.RefreshWindowFunc=PopupRefresh;
switch(popup.PositionType)
{
case 1:
x=AntaEvent.ScreenX-popup.BoundingRect.Width/2;
y=AntaEvent.ScreenY-popup.BoundingRect.Height/2;
var overflowX=((x+screen.width)%screen.width)+popup.Width-screen.width;
var overflowY=((y+screen.height)%screen.height)+popup.Height-screen.height;
if(overflowX>-20)
{
if(overflowX>popup.BoundingRect.Width/2)
{
x+=(popup.BoundingRect.Width-overflowX)+20;
}
else
{
x-=overflowX+20;
}
}
if(overflowY>-80)
{
if(overflowY>popup.BoundingRect.Height/2)
{
y+=(popup.BoundingRect.Height-overflowY)+80;
}
else
{
y-=overflowY+80;
}
}
break;
case 2:
x=(screen.width-popup.BoundingRect.Width)/2;
y=(screen.height-popup.BoundingRect.Height)/2;
break;
}
if(IsDefined(typeof(popup.Dialog))&&popup.Dialog!=null)
{
popupWindow=OpenWindowByPosition("_blank","",x,y,popup.BoundingRect.Width,popup.BoundingRect.Height,popup.Resizable,false,false);
if(popupWindow==null)
{
return;
}
popup.CreationAttempt=1;
AfterCreation(popup,popupWindow);
}
else
{
popupWindow=OpenWindowByPosition("_blank",popup.Url,x,y,popup.BoundingRect.Width,popup.BoundingRect.Height,popup.Resizable,true,true);
if(popupWindow==null)
{
popup.ClosedByUser=false;
popup.Blocked=true;
popup.Close();
return;
}
popup.CreationAttempt=1;
AfterCreation(popup,popupWindow);
}
function AfterCreation(popupObject,windowNode)
{
if(windowNode==null)
{
popupObject.ClosedByUser=false;
popupObject.Blocked=true;
popupObject.Close();
return;
}
else if(windowNode.document==null||windowNode.document.documentElement==null)
{
if(popupObject.CreationAttempt++<100)
{
setTimeout(function(){AfterCreation(popupObject,windowNode);},100);
return;
}
else
{
popupObject.ClosedByUser=false;
popupObject.Close();
return;
}
}
else
{
if(IsDefined(typeof(popupObject.Dialog))&&popupObject.Dialog!=null)
{
popupObject.Window=new AntaWindow(null,popupWindow.document.body,popupObject.Modeless,windowNode,2);
popupObject.Dialog.Render(popupObject.Window,popupObject.Window.WindowNode.document.body);
}
else
{
popupObject.Window=new AntaWindow(null,null,popupObject.Modeless,windowNode,2);
popupObject.BlockingParent=(!popupObject.Modeless)?new AntaScreenBlocker(popupObject.ParentWindow):null;
if(popupObject.BlockingParent!=null)
{
popupObject.OnFocus=HandleParentFocus;
popupObject.OnMouseDown=HandleParentMouseDown;
popupObject.BlockingParent.FocusHandler=popupObject;
popupObject.BlockingParent.MouseDownHandler=popupObject;
}
popupObject.ParentWindow.AddChildWindow(popupObject.Window);
popupObject.Window.CloseHandler=popupObject;
popupObject.Window.SetActive();
if(!popupObject.Modeless||popupObject.OnCloseCallback!=null)
{
popupObject.windowCheckInterval=setInterval(CheckWindowClosed,100);
}
}
}
function CheckWindowClosed()
{
if(popupObject.Window.WindowNode==null||popupObject.Window.WindowNode.closed)
{
popupObject.Close();
}
}
}
function HandleParentFocus(blocker)
{
try
{
blocker.FocusHandler.Window.WindowNode.focus();
}
catch(ex)
{
}
}
function HandleParentMouseDown(blocker)
{
try
{
blocker.MouseDownHandler.Window.WindowNode.focus();
}
catch(ex)
{
}
}
function PopupRefresh(popupObject)
{
popupObject.Window.WindowNode.document.reload();
}
function PopupClose(popupObject)
{
if(popupObject.BlockingParent!=null)
{
popupObject.BlockingParent.Close();
}
if(IsDefined(typeof(popupObject.windowCheckInterval)))
{
clearInterval(popupObject.windowCheckInterval);
}
if(IsDefined(typeof(popupObject.Window))&&popupObject.Window!=null)
{
popupObject.ParentWindow.RemoveChildWindow(popupObject.Window);
if(popupObject.Window.WindowNode!=null)
{
try
{
popupObject.Window.WindowNode.close();
}
catch(ex)
{
}
}
}
}
}
}
function OpenWindow(windowId,url,w,h,resize)
{
var widthHeight="";
if(IsDefined(typeof(w))&&IsDefined(typeof(h)))
{
widthHeight="height="+h+",width="+w+",";
}
return window.open(url,windowId,widthHeight+"status=yes,toolbar=no,menubar=no,location=no,resizable="+((resize)?"yes":"no"),true);
}
function RestoreRect(el,rect)
{
if(IsDefined(typeof(rect.OldPosition)))
{
el.style.position=rect.OldPosition;
}
if(IsDefined(typeof(rect.OldLeft)))
{
el.style.left=rect.OldLeft;
}
if(IsDefined(typeof(rect.OldRight)))
{
el.style.right=rect.OldRight;
}
if(IsDefined(typeof(rect.OldWidth)))
{
el.style.width=rect.OldWidth;
}
if(IsDefined(typeof(rect.OldHeight)))
{
el.style.height=rect.OldHeight;
}
}
function MergeRects(rects,rect)
{
if(rects.length===0)
{
rects.push(rect);
}
else
{
for(var i=0;i<rects.length;i++)
{
if((rect.Top+rect.Height)>rects[i].Top)
{
if(rect.Top<rects[i].Top)
{
var top=rect.Top;
var bottom=Math.max(rects[i].Top+rects[i].Height,rect.Top+rect.Height);
rects[i].Top=top;
rects[i].Height=bottom-top;
}
else if(rect.Top<(rects[i].Top+rects[i].Height))
{
var top=rects[i].Top;
var bottom=Math.max(rects[i].Top+rects[i].Height,rect.Top+rect.Height);
rects[i].Top=top;
rects[i].Height=bottom-top;
}
else
{
rects.push(rect);
}
}
else
{
rects.push(rect);
}
}
}
}
function AntaCallCallbackAction(paramObject)
{
CallActionCallback(true,paramObject);
}
function CallActionCallback(success,data)
{
if(IsDefined(typeof(AntaActionCallbackHandlers))&&AntaActionCallbackHandlers!=null&&AntaActionCallbackHandlers.length>0)
{
AntaActionCallbackHandlers.pop().HandleActionCallback(success,data);
}
else
{
var parentNode=AntaActiveWindow.GetParentNode();
if(parentNode!=null)
{
parentNode.CallActionCallback(success,data);
}
}
}
function PointInRect(x,y,r)
{
if(r==null)
{
return false;
}
return(x>=r.Left&&x<=(r.Left+r.Width)&&
y>=r.Top&&y<=(r.Top+r.Height));
}
function OpenWindowByPosition(windowId,url,x,y,w,h,resizable,hasScrollBar,hasAddress)
{
var widthHeight="";
if(IsDefined(typeof(w))&&IsDefined(typeof(h)))
{
widthHeight="height="+h+",width="+w+",";
}
var directUrl="";
if(url.toLowerCase().indexOf(AntaFileDownloadPrefix.toLowerCase())!=-1)
{
directUrl=url;
}
var w=window.open(directUrl,windowId,"left="+x+",top="+y+","+widthHeight+"status=yes,toolbar=no,menubar=no,location="+((hasAddress)?"yes":"no")+",scrollbars="+((hasScrollBar)?"yes":"no")+",resizable="+((resizable)?"yes":"no"),true);
if(directUrl=="")
{
w.location.assign(url);
}
return w;
}
function OpenChildWindowBlocked(title,url,w,h,resizable,callback,closeCallback)
{
var windowStyle=(AntaEvent.ShiftKeyPressed&&!AntaEvent.CtrlKeyPressed)?1:2;
return new AntaPopup(windowStyle,"FloatingWindow_2gether",url,title,1,new AntaRect(0,0,w,h),closeCallback,callback,true,resizable,false,null);
}
function InitializeRootWindow()
{
AntaRootWindow=new AntaWindow(null,null,false,window,0);
AntaRootWindow.SetActive();
AntaRootWindow.CloseHandler=AntaRootWindow;
}
function ShowUnexpectedError(callback)
{
return new AntaDialog(3,AntaDialogButtonOK,AntaSR.ErrorTitle,AntaSR.UnexpectedException,callback);
}
function AntaNavigateBackParent(callerWindow,step,clearEventHandler)
{
var parentWindow=null;
var childWindow=AntaRootWindow.FindChildWindow(callerWindow);
if(childWindow!=null)
{
parentWindow=childWindow.ParentWindow;
}
if(parentWindow!=null)
{
var blocker=new AntaScreenBlocker(parentWindow);
blocker.BlockBackgroundNode.style.cursor="wait";
if(clearEventHandler)
{
parentWindow.ClearEventHandlers("beforeunload");
parentWindow.ClearEventHandlers("unload");
}
history.back(step);
}
}
function AntaNavigateBack(step,navigateParent,clearEventHandler)
{
if(navigateParent)
{
var parentNode=AntaActiveScriptWindow.GetParentNode();
if(parentNode!=null)
{
parentNode.AntaNavigateBackParent(AntaActiveScriptWindow,step,clearEventHandler);
}
return;
}
var blocker=new AntaScreenBlocker(AntaActiveScriptWindow);
blocker.BlockBackgroundNode.style.cursor="wait";
if(clearEventHandler)
{
AntaActiveScriptWindow.ClearEventHandlers("beforeunload");
AntaActiveScriptWindow.ClearEventHandlers("unload");
}
history.back(step);
}
function AntaNavigateHomeParent(callerWindow,clearEventHandler)
{
var parentWindow=null;
var childWindow=AntaRootWindow.FindChildWindow(callerWindow);
if(childWindow!=null)
{
parentWindow=childWindow.ParentWindow;
}
if(parentWindow!=null)
{
var blocker=new AntaScreenBlocker(parentWindow);
blocker.BlockBackgroundNode.style.cursor="wait";
if(clearEventHandler)
{
parentWindow.ClearEventHandlers("beforeunload");
parentWindow.ClearEventHandlers("unload");
}
parentWindow.WindowNode.location.replace(AntaVirtualDir);
}
}
function AntaNavigateHome(navigateParent,clearEventHandler)
{
if(navigateParent)
{
var parentNode=AntaActiveScriptWindow.GetParentNode();
if(parentNode!=null)
{
parentNode.AntaNavigateHomeParent(AntaActiveScriptWindow,clearEventHandler);
}
return;
}
var blocker=new AntaScreenBlocker(AntaActiveScriptWindow);
blocker.BlockBackgroundNode.style.cursor="wait";
if(clearEventHandler)
{
AntaActiveScriptWindow.ClearEventHandlers("beforeunload");
AntaActiveScriptWindow.ClearEventHandlers("unload");
}
if(IsDefined(typeof(top.NavigateBack)))
{
top.NavigateBack();
}
else
{
AntaActiveScriptWindow.WindowNode.location.replace(AntaVirtualDir);
}
}
function AntaCloseParent(callerWindow)
{
var parentWindow=null;
var childWindow=AntaRootWindow.FindChildWindow(callerWindow);
if(childWindow!=null)
{
parentWindow=childWindow.ParentWindow;
}
if(parentWindow!=null)
{
parentWindow.ClearEventHandlers("beforeunload");
parentWindow.ClearEventHandlers("unload");
parentWindow.Close();
}
}
function AntaClosePage(closeParent)
{
if(closeParent)
{
var parentNode=AntaActiveScriptWindow.GetParentNode();
if(parentNode!=null)
{
parentNode.AntaCloseParent(AntaActiveScriptWindow)
}
else
{
if(AntaActiveScriptWindow.WindowStyle==1)
{
AntaActiveScriptWindow.ParentWindow.Close();
}
}
return;
}
AntaActiveScriptWindow.Close();
}
function AntaRefreshParent(callerWindow)
{
var parentWindow=null;
if(AntaActiveWindow.WindowNode==callerWindow.WindowNode)
{
parentWindow=AntaActiveWindow.ParentWindow;
}
var childWindow=AntaRootWindow.FindChildWindow(callerWindow);
if(childWindow!=null)
{
parentWindow=childWindow.ParentWindow;
}
if(parentWindow!=null)
{
parentWindow.ClearEventHandlers("beforeunload");
parentWindow.ClearEventHandlers("unload");
parentWindow.Refresh();
}
}
function AntaRefreshPage(refreshParent)
{
if(refreshParent)
{
var parentNode=AntaActiveScriptWindow.GetParentNode();
if(parentNode!=null)
{
parentNode.AntaRefreshParent(AntaActiveScriptWindow);
return;
}
else
{
if(AntaActiveWindow.WindowStyle==1)
{
AntaActiveWindow.ParentWindow.Refresh();
}
return;
}
}
AntaActiveScriptWindow.Refresh();
}
function AntaRefreshWebPart(webFormLocation,partId,refreshParent)
{
if(refreshParent)
{
var parentNode=AntaActiveWindow.GetParentNode();
if(parentNode!=null)
{
parentNode.AntaRefreshPage(webFormLocation,partId,false)
return;
}
}
try
{
(refreshParent?AntaActiveWindow.ParentWindow:AntaActiveWindow).IterateWebForms(function(webForm)
{
if(webForm.WebFormLocation.indexOf(webFormLocation)==0)
{
webForm.IterateWebParts(function(webPart)
{
if(webPart.Id==partId)
{
webPart.Refresh();
return false;
}
return true;
}
);
return false;
}
return true;
}
);
}
catch(ex){}
}
function RegisterWebActionList(partClientId,listClientId,actions)
{
var partNode=$(partClientId);
if(partNode!=null)
{
var webPart=GetDomData(partNode,AntaWebPartKey);
var webActionListNode=$(listClientId);
webActionListNode.onchange=HandleOnChange
SetDomData(webActionListNode,"WebActionList",{Node:webActionListNode,WebPart:webPart,Actions:actions});
}
function HandleOnChange(e)
{
if(!IsDefined(typeof(e))){var e=this.document.parentWindow.event;}
StoreEvent(e);
var webActionList=GetDomData(webActionListNode,"WebActionList");
for(var i=0;i<webActionList.Actions.length;i++)
{
if(webActionList.Actions[i].Id==webActionList.Node.options[webActionList.Node.selectedIndex].value)
{
webPart.ExecuteActionQueued(webActionList.Actions[i]);
break;
}
}
return false;
}
}
function RegisterWebButtonToggleGroup(partClientId,buttonGroup)
{
var partNode=$(partClientId);
if(partNode!=null)
{
var webPart=GetDomData(partNode,AntaWebPartKey);
webPart.ButtonToggleGroups[buttonGroup.Id]=buttonGroup;
}
}
function RegisterWebButton(buttonProperties)
{
var partNode=$(buttonProperties.PartClientId);
if(partNode!=null)
{
var webPart=GetDomData(partNode,AntaWebPartKey);
var button=null;
if(buttonProperties.Action!=null&&webPart!=null)
{
webPart.RegisterAction(buttonProperties.Action);
}
switch(buttonProperties.ImageGroup)
{
case AntaButtonGroup_MenuWebPart:
var menu=webPart.WebMenu;
button=menu.RegisterButton(buttonProperties);
break;
case AntaButtonGroup_ToolboxWebPart:
var toolBox=webPart.WebToolBox;
button=toolBox.RegisterButton(buttonProperties);
break;
case AntaButtonGroup_PartHeader:
button=webPart.RegisterHeaderButton(buttonProperties);
break;
case AntaButtonGroup_CalendarWebPart:
var calendar=webPart.WebCalendar;
button=calendar.RegisterButton(buttonProperties);
break;
case AntaButtonGroup_LoginWebPart:
var webLogin=webPart.WebLogin;
button=webLogin.RegisterButton(buttonProperties);
break;
case AntaButtonGroup_ViewWebPart:
var view=webPart.WebView;
button=view.RegisterButton(buttonProperties);
break;
case AntaButtonGroup_WizardWebPart:
var wizard=webPart.Wizard;
button=wizard.RegisterButton(buttonProperties);
break;
case AntaButtonGroup_WebFormDefault:
button=webPart.WebForm.RegisterButton(buttonProperties);
break;
case AntaButtonGroup_WebForm:
button=webPart.WebForm.RegisterButton(buttonProperties);
break;
case AntaButtonGroup_PartContextMenu:
button=webPart.WebPartContextMenu.RegisterButton(buttonProperties);
break;
case AntaButtonGroup_PartEditor:
button=AntaGetToolBoxPart().WebToolBox.RegisterPartEditorButton(buttonProperties);
break;
case AntaButtonGroup_ColorPicker:
var colorPicker=webPart.WebColorPicker;
button=colorPicker.RegisterColorPickerButton(buttonProperties);
break;
case AntaButtonGroup_StyleEditor:
var themeEditor=webPart.ThemeEditor;
button=themeEditor.RegisterStyleEditorButton(buttonProperties);
break;
case AntaButtonGroup_EditableWebPart:
if(buttonProperties.Action!=null)
{
button=webPart.WebForm.RegisterButton(buttonProperties);
}
break;
case AntaButtonGroup_ExternalMediaBar:
var externalMediaBar=webPart.ExternalMediaBar;
button=externalMediaBar.RegisterButton(buttonProperties);
break;
}
if(button!=null)
{
webPart.RegisterShortCut(buttonProperties.ShortCutKey,button);
}
}
}
function GetWindowWidth()
{
var clientWindowWidth=NaN;
if(IsDefined(typeof(document.documentElement))&&document.documentElement!=null&&IsDefined(typeof(document.documentElement.clientWidth)))
{
clientWindowWidth=document.documentElement.clientWidth
}
if(isNaN(clientWindowWidth)&&IsDefined(typeof(window.innerWidth)))
{
clientWindowWidth=window.innerWidth
}
if(isNaN(clientWindowWidth))
{
clientWindowWidth=GetBodyWidth();
}
if(isNaN(clientWindowWidth))
{
clientWindowWidth=600;
}
return clientWindowWidth;
}
function GetWindowHeight()
{
var clientWindowHeight=NaN;
if(IsDefined(typeof(document.documentElement))&&document.documentElement!=null&&IsDefined(typeof(document.documentElement.clientHeight)))
{
clientWindowHeight=document.documentElement.clientHeight
}
if(isNaN(clientWindowHeight)&&IsDefined(typeof(window.innerHeight)))
{
clientWindowHeight=window.innerHeight
}
if(isNaN(clientWindowHeight))
{
clientWindowHeight=GetBodyHeight()
}
if(isNaN(clientWindowHeight))
{
clientWindowHeight=600;
}
return clientWindowHeight;
}
function GetBodyHeight()
{
if(IsDefined(typeof(document.body))&&document.body!=null&&IsDefined(typeof(document.body.offsetHeight)))
{
return document.body.offsetHeight;
}
return NaN;
}
function GetBodyWidth()
{
if(IsDefined(typeof(document.body))&&document.body!=null&&IsDefined(typeof(document.body.offsetWidth)))
{
return document.body.offsetWidth;
}
return NaN;
}
function AntaRedirect(url,replace,force,redirectTarget,popupWindowOptions,callback)
{
if(redirectTarget==1)
{
var parentNode=AntaActiveScriptWindow.GetParentNode();
if(parentNode!=null)
{
parentNode.AntaRedirect(url,replace,force,0);
}
else
{
if(AntaActiveWindow.WindowStyle==1)
{
if(url.indexOf("://")===-1)
{
url=window.location.protocol+"//"+window.location.host+url;
}
if(replace)
{
AntaActiveWindow.ParentWindow.WindowNode.location.replace(url);
}
else
{
AntaActiveWindow.ParentWindow.WindowNode.location.assign(url);
}
}
}
return;
}
if(url.indexOf("://")==-1)
{
url=window.location.protocol+"//"+window.location.host+url;
}
if(force)
{
AntaActiveWindow.ClearEventHandlers("beforeunload");
AntaActiveWindow.ClearEventHandlers("unload");
}
if(redirectTarget===0)
{
var blocker=new AntaScreenBlocker(AntaActiveScriptWindow);
blocker.BlockBackgroundNode.style.cursor="wait";
if(replace)
{
try
{
AntaActiveScriptWindow.WindowNode.location.replace(url);
setTimeout(Unblock,2500);
}
catch(ex)
{
Unblock();
}
}
else
{
try
{
if(IsDefined(typeof(AntaCurrentMasterLayout)))
{
url=AddUrlParameter(url,"_anta_mlayout",AntaCurrentMasterLayout);
}
AntaActiveScriptWindow.WindowNode.location.assign(url);
setTimeout(Unblock,2500);
}
catch(ex)
{
Unblock();
}
}
if(IsDefined(typeof(callback))&&callback!=null)
{
callback();
}
}
else
{
url=AddUrlParameter(url,"_anta_mlayout",popupWindowOptions.MasterLayout);
new AntaPopup(popupWindowOptions.Type,"FloatingWindow_2gether",url,popupWindowOptions.Title,popupWindowOptions.Position,new AntaRect(0,0,popupWindowOptions.Width,popupWindowOptions.Height),HandlePopupClose,HandlePopupCallback,true,true,!popupWindowOptions.Modal,null,popupWindowOptions.Sizing);
}
function HandlePopupClose(popup)
{
if(IsDefined(typeof(callback))&&callback!=null)
{
callback();
}
}
function HandlePopupCallback(popup)
{
if(popup.Blocked)
{
var dialog=ShowDialog(3,AntaDialogButtonOK,AntaSR.ErrorTitle,AntaSR.PopupBlockerWarning,HandlePopupBlockerCallback);
dialog.CallbackData=popup.Data;
}
else
{
if(IsDefined(typeof(callback))&&callback!=null)
{
callback(popup.Data);
}
}
}
function HandlePopupBlockerCallback(dialog)
{
var popup=new AntaPopup(popupWindowOptions.Type,"FloatingWindow_2gether",url,"",popupWindowOptions.Position,new AntaRect(0,0,popupWindowOptions.Width,popupWindowOptions.Height),HandlePopupClose,HandlePopup2Callback,true,true,!popupWindowOptions.Modal,null,popupWindowOptions.Sizing);
popup.CallbackData=dialog.CallbackData;
}
function HandlePopup2Callback(popup)
{
if(popup.Blocked)
{
var dialog=ShowDialog(3,AntaDialogButtonOK,AntaSR.ErrorTitle,AntaSR.PopupBlockerError,HandlePopup2BlockerCallback);
dialog.CallbackData=popup.CallbackData;
}
else
{
if(IsDefined(typeof(callback))&&callback!=null)
{
callback(popup.CallbackData);
}
}
}
function HandlePopup2BlockerCallback(dialog)
{
if(IsDefined(typeof(callback))&&callback!=null)
{
callback(dialog.CallbackData);
}
}
function Unblock()
{
try{blocker.Close();}
catch(ex){}
}
}
function SetImageSource(image,key)
{
if(AntaWebImages[key]!=null)
{
if(!IsDefined(typeof(AntaWebImages[key].src))||AntaWebImages[key].src==null||AntaWebImages[key].src.length==0)
{
AntaWebImages[key].src=AntaWebImages[key].srcToLoad;
}
image.src=AntaWebImages[key].src;
}
}
var AntaStatsSeparator=";";
var statistics=[];
var statcount=0;
function AddStatistics(task,data)
{
if((IsDefined(typeof(AntaDebugActive))&&AntaDebugActive)||(IsDefined(typeof(AntaTracingActive))&&AntaTracingActive))
{
if(statcount++>100)
{
statcount=0;
statistics=new Array();
}
statistics.push({DateTime:new Date(),Data:data,Task:task,Start:false,End:false});
}
}
function StartStatistics(task,data)
{
if((IsDefined(typeof(AntaDebugActive))&&AntaDebugActive)||(IsDefined(typeof(AntaTracingActive))&&AntaTracingActive))
{
if(statcount++>100)
{
statcount=0;
statistics=new Array();
}
statistics.push({DateTime:new Date(),Data:data,Task:task,Start:true,End:false});
}
}
function EndStatistics(task,data)
{
if((IsDefined(typeof(AntaDebugActive))&&AntaDebugActive)||(IsDefined(typeof(AntaTracingActive))&&AntaTracingActive))
{
if(statcount++>100)
{
statcount=0;
statistics=new Array();
}
statistics.push({DateTime:new Date(),Data:data,Task:task,Start:false,End:true});
}
}
function ShowStatistics()
{
if((IsDefined(typeof(AntaDebugActive))&&AntaDebugActive)||(IsDefined(typeof(AntaTracingActive))&&AntaTracingActive))
{
var text="";
text=GetStatistics();
ShowDialog(7,AntaDialogButtonOK,"Statistics",text);
}
}
function GetStatistics()
{
var text="";
var tasks={};
if(statistics.length>0)
{
var t0=statistics[0].DateTime;
var status="Intermediate";
var duration=0;
for(var i=0;i<statistics.length;i++)
{
if(statistics[i].Start)
{
tasks[statistics[i].Task]=statistics[i];
duration=0;
status="Started";
}
if(statistics[i].End)
{
if(IsDefined(typeof(tasks[statistics[i].Task]))&&tasks[statistics[i].Task]!=null)
{
duration=statistics[i].DateTime-tasks[statistics[i].Task].DateTime;
status="Completed";
delete tasks[statistics[i].Task]
}
else
{
duration=statistics[i].DateTime-t0;
status="Completed (Not Started)";
}
}
text+=
GetStatsTimeFormatted(statistics[i].DateTime)+AntaStatsSeparator+
GetStatsTicks(statistics[i].DateTime).toString()+AntaStatsSeparator+
duration+AntaStatsSeparator+
status+AntaStatsSeparator+
statistics[i].Task+AntaStatsSeparator+
"{1}"+AntaStatsSeparator+
"{2}"+AntaStatsSeparator+
"{3}"+
((statistics[i].Data!=null)?AntaStatsSeparator+statistics[i].Data:"")+
(i==statistics.length-1?"":"\n");
}
statistics=[];
}
return text.EscapeHTML();
}
function GetStatsTimeFormatted(dateTime)
{
return dateTime.getFullYear().toString()+"-"+
(1+dateTime.getMonth()).toString().PadLeft(2,"0")+"-"+
dateTime.getDate().toString().PadLeft(2,"0")+
" "+
dateTime.getHours().toString().PadLeft(2,"0")+":"+
dateTime.getMinutes().toString().PadLeft(2,"0")+":"+
dateTime.getSeconds().toString().PadLeft(2,"0");
}
function GetStatsTicks(dateTime)
{
return Number(dateTime);
}
var AntaFileUpload=null;
function AntaFileResponse(result)
{
if(AntaFileUpload!=null)
{
clearTimeout(AntaFileUpload.TimeOut);
AntaFileUpload.Blocker.Close();
AntaFileUpload.Callback(true,result,AntaFileUpload.State);
AntaClearFileUpload();
}
}
function AntaClearFileUpload()
{
if(IsDefined(typeof(AntaOnLoadTimout))&&AntaOnLoadTimout!=null)
{
clearTimeout(AntaOnLoadTimout);
AntaOnLoadTimout=null;
}
AntaFileUpload=null;
$("uploadframe",AntaRootWindow.WindowNode).src="javascript:false";
}
function AntaFileResponseError(message)
{
if(AntaFileUpload!=null)
{
clearTimeout(AntaFileUpload.TimeOut);
AntaFileUpload.Blocker.Close();
AntaFileUpload.Callback(false,null,AntaFileUpload.State);
AntaClearFileUpload();
}
ShowDialog(2,AntaDialogButtonOK,"",message);
}
function AntaSubmitFile(callback,win,fileInput,state)
{
AntaFileUpload={Callback:callback,State:state,Blocker:new AntaScreenBlocker(win)};
AntaFileUpload.TimeOut=setTimeout(function()
{
AntaFileUpload.Blocker.Close();
ShowDialog(2,AntaDialogButtonOK,"",AntaSR.FileUploadTimeout);
AntaFileUpload.Callback(false,null,AntaFileUpload.State);
AntaClearFileUpload();
},5*60*1000);
fileInput.form.submit();
}
var AntaOnLoadTimout=null;
function AntaOnUploadFrameLoad()
{
if(AntaOnLoadTimout==null&&AntaFileUpload!=null)
{
AntaOnLoadTimout=setTimeout(
function()
{
if(AntaFileUpload!=null)
{
clearTimeout(AntaFileUpload.TimeOut);
AntaFileUpload.Blocker.Close();
ShowDialog(2,AntaDialogButtonOK,"",AntaSR.FileUploadError);
AntaFileUpload.Callback(false,null,AntaFileUpload.State);
AntaClearFileUpload();
}
},1000);
}
}
function AntaGetButton(buttons,code)
{
for(var i=0;i<buttons.length;i++)
{
if(buttons[i].Code==code)
{
return buttons[i];
}
}
return null;
}
function AntaAddButton(buttons,button)
{
for(var i=0;i<buttons.length;i++)
{
if(buttons[i].Code==button.Code)
{
buttons[i]=button;
return;
}
}
buttons.push(button);
}
﻿var AntaCustomSelects={};
function RegisterCustomSelect(settings)
{
var partNode=$(settings.PartClientId);
if(partNode!=null)
{
var webPart=GetDomData(partNode,AntaWebPartKey);
AntaCustomSelects[settings.ControlId]=new AntaCustomSelect(webPart,settings);
}
}
function AntaCustomSelectButtonClick(e)
{
if(!IsDefined(typeof(e))){var e=this.document.parentWindow.event;}
StoreEvent(e);
var customSelect=GetDomEventData(this);
customSelect.Toggle(customSelect.ButtonNode);
}
function AntaCustomSelectOptionClick(e)
{
if(!IsDefined(typeof(e))){var e=this.document.parentWindow.event;}
StoreEvent(e);
var customSelect=GetDomEventData(this);
customSelect.SelectOption(this.OptionId);
if(customSelect.EventCallback!=null)
{
customSelect.EventCallback(customSelect,'click');
}
}
function AntaCustomSelect(webPart,settings)
{
this.WebPart=webPart;
this.Window=webPart.WebForm.Window;
this.IsOpen=false;
this.ScreenBlocker=null;
this.ControlNode=$(settings.ControlId,this.Window.WindowNode);
this.SelectNode=$(settings.SelectId,this.Window.WindowNode);
this.ValueContainer=$(settings.ValueContainerId,this.Window.WindowNode);
this.ValueNode=$(settings.ValueId,this.Window.WindowNode);
this.ButtonNode=$(settings.ButtonId,this.Window.WindowNode);
this.OptionsNode=$(settings.OptionsId,this.Window.WindowNode);
this.ChildOfButton=settings.ChildOfButton;
this.SelectedOptionId=null;
this.OptionNodes=settings.Options;
this.Options=new Array();
this.EventCallback=null;
this.Init(settings.SelectedOptionId);
}
AntaCustomSelect.prototype.Init=function AntaCustomSelect_Init(initialSelectedOptionId)
{
if(!this.ChildOfButton)
{
this.ValueContainer.onclick=AntaCustomSelectButtonClick;
SetDomEventData(this.ValueContainer,this);
this.ButtonNode.onclick=AntaCustomSelectButtonClick;
SetDomEventData(this.ButtonNode,this);
}
for(var i in this.OptionNodes)
{
var optionNode=$(this.OptionNodes[i],this.Window.WindowNode);
var isButton=optionNode.tagName.toLowerCase()=="button";
if(!isButton)
{
optionNode.onclick=AntaCustomSelectOptionClick;
optionNode.OptionId=i;
SetDomEventData(optionNode,this);
}
this.Options.push({"Id":i,"Node":optionNode,IsButton:isButton});
}
ShowNode(this.OptionsNode);
var optionsNodeRect=this.Window.GetElementRect(this.OptionsNode);
this.OrigOptionsNodeWidth=optionsNodeRect.Width+this.Window.GetHorizontalPaddingBorder(this.OptionsNode);
this.OrigOptionsNodeHeight=optionsNodeRect.Height-this.Window.GetVerticalPaddingBorder(this.OptionsNode);
HideNode(this.OptionsNode);
if(initialSelectedOptionId!=null)
{
this.SelectOption(initialSelectedOptionId);
}
this.HandleResize();
};
AntaCustomSelect.prototype.HandleResize=function AntaCustomSelect_HandleResize(partWidth)
{
if(!this.ChildOfButton)
{
if(IsDefined(typeof(partWidth)))
{
var buttonWidth=this.Window.GetElementRect(this.ButtonNode).Width+this.Window.GetHorizontalMarginPaddingBorder(this.ButtonNode);
this.ValueContainer.style.width=ToPixels(partWidth-buttonWidth-this.Window.GetHorizontalMarginPaddingBorder(this.SelectNode)-2);
this.OptionsNode.style.width=ToPixels(partWidth-this.Window.GetHorizontalMarginPaddingBorder(this.SelectNode)-2);
}
}
if(this.IsOpen)
{
this.HandleResizeOptions();
}
};
AntaCustomSelect.prototype.SelectOption=function AntaCustomSelect_SelectOption(id)
{
if(this.SelectedOptionId!=id)
{
this.SelectedOptionId=id;
for(var i=0;i<this.Options.length;i++)
{
if(this.Options[i].Id==id)
{
var optionNode=this.Options[i].Node;
this.ValueNode.innerHTML=optionNode.innerHTML;
var anchor=FindFirstChildByTag(this.ValueNode,"A");
if(anchor!=null)
{
anchor.href="#";
anchor.onclick=function(){return false;};
}
break;
}
}
}
this.Close();
};
AntaCustomSelect.prototype.Open=function AntaCustomSelect_Open(openedByButtonNode)
{
var blocker=this.ScreenBlocker=new AntaScreenBlocker(this.Window);
var eventHandler={CustomSelect:this,OnMouseDown:function(){this.CustomSelect.Close();},OnKeyDown:function(){if(AntaEvent.KeyCode==27){this.CustomSelect.Close();}}};
setTimeout(function(){blocker.MouseDownHandler=blocker.KeyDownHandler=eventHandler;},100);
var optionsDivParent=this.Window.MakeNode("div");
this.ScreenBlocker.OptionsDivNode=this.Window.MakeNode("div");
optionsDivParent.appendChild(this.ScreenBlocker.OptionsDivNode);
this.Window.AppendBodyNode(optionsDivParent);
this.OptionsNode.style.display="inline";
SwapNode(this.OptionsNode,this.ScreenBlocker.OptionsDivNode);
this.NewWindowForButtons=null;
for(var i in this.Options)
{
if(this.Options[i].IsButton)
{
if(this.NewWindowForButtons==null)
{
this.NewWindowForButtons=new AntaWindow(optionsDivParent,optionsDivParent,false,this.Window.WindowNode,0);
}
var webButton=GetDomEventData(this.Options[i].Node);
if(webButton.Window==this.Window)
{
webButton.Window=this.NewWindowForButtons;
webButton.CustomSelect=this;
}
}
}
if(IsDefined(typeof(openedByButtonNode)))
{
this.OpenedByButtonNode=openedByButtonNode;
AntaAddCssClass(this.OpenedByButtonNode,"activebutton");
}
this.OptionsNode.style.position="absolute";
this.HandleResizeOptions();
this.IsOpen=true;
};
AntaCustomSelect.prototype.HandleResizeOptions=function AntaCustomSelect_HandleResizeOptions()
{
var rect=this.Window.GetElementRect(this.ControlNode);
if(this.Window.IsElementChildOf(this.Window.ScrollNode,this.ControlNode))
{
rect=this.Window.AdjustRectToScroll(rect);
}
this.OptionsNode.style.left=ToPixels(rect.Left);
this.OptionsNode.style.top=ToPixels(rect.Top+rect.Height);
this.OptionsNode.style.height=ToPixels(this.OrigOptionsNodeHeight);
var optionsRect=this.Window.GetElementRect(this.OptionsNode);
var windowRect=this.Window.BoundingRect;
if((optionsRect.Height+optionsRect.Top)>windowRect.Height)
{
var height=Math.max(40,windowRect.Height-optionsRect.Top-this.Window.GetVerticalPaddingBorder(this.OptionsNode));
this.OptionsNode.style.height=ToPixels(height);
}
};
AntaCustomSelect.prototype.Close=function AntaCustomSelect_Close()
{
HideNode(this.OptionsNode);
if(this.ScreenBlocker!=null)
{
for(var i in this.Options)
{
if(this.Options[i].IsButton)
{
var webButton=GetDomEventData(this.Options[i].Node);
if(webButton.Window==this.NewWindowForButtons)
{
webButton.Window=this.Window;
}
}
}
if(this.NewWindowForButtons!=null)
{
this.NewWindowForButtons.Close();
}
SwapNode(this.OptionsNode,this.ScreenBlocker.OptionsDivNode);
this.ScreenBlocker.OptionsDivNode=null;
this.ScreenBlocker.Close();
}
if(IsDefined(typeof(this.OpenedByButtonNode)))
{
AntaRemoveCssClass(this.OpenedByButtonNode,"activebutton");
}
this.IsOpen=false;
};
AntaCustomSelect.prototype.Toggle=function AntaCustomSelect_Toggle(openedByButtonNode)
{
if(this.IsOpen)
{
this.Close();
}
else
{
this.Open(openedByButtonNode);
}
};
function RegisterWebColorPicker(partClientId)
{
var webPart=GetDomData($(partClientId),AntaWebPartKey);
webPart.WebColorPicker=new AntaColorPicker(webPart);
}
function AntaHandleColorPickerButtonClick(button)
{
var colorPicker=button.ColorPicker;
switch(button.Code)
{
case "OK":
colorPicker.Save();
colorPicker.Dialog.Close();
break;
case "Cancel":
colorPicker.Restore();
colorPicker.Dialog.Close();
break;
case "Transparent":
colorPicker.SetTransparent();
break;
}
}
function AntaColorPickerSelectShade(e)
{
if(!IsDefined(typeof(e))){var e=this.document.parentWindow.event;}
StoreEvent(e);
var colorPicker=GetDomEventData(this);
colorPicker.UpdateInput(this.value);
}
function AntaColorPickerMouseUp(e)
{
if(!IsDefined(typeof(e))){var e=this.document.parentWindow.event;}
StoreEvent(e);
var colorPicker=GetDomEventData(this);
colorPicker.CursorMoved();
}
function AntaColorPickerMouseDown(e)
{
if(!IsDefined(typeof(e))){var e=this.document.parentWindow.event;}
StoreEvent(e);
var colorPicker=GetDomEventData(this);
colorPicker.Core(e);
}
function AntaColorPickerCursorMouseMove(e)
{
if(!IsDefined(typeof(e))){var e=this.parentWindow.event;}
StoreEvent(e);
var colorPicker=GetDomEventData(this);
if(colorPicker!=null)
{
if(!colorPicker.Stop)
{
colorPicker.Point(colorPicker.oX,colorPicker.oY,e);
}
}
}
function AntaColorPickerCursorMouseUp(e)
{
if(!IsDefined(typeof(e))){var e=this.parentWindow.event;}
StoreEvent(e);
var colorPicker=GetDomEventData(this);
if(colorPicker!=null)
{
colorPicker.Stop=true;
document.onmousemove="";
document.onmouseup="";
}
}
function AntaColorPickerHandleInputPress(e)
{
if(!IsDefined(typeof(e))){var e=event;}
StoreEvent(e);
if(this.value.length>=6)
{
e.returnValue=false;
return false;
}
var keyChar=String.fromCharCode(e.keyCode).toUpperCase();
var allowed="0123456789ABCDEF";
var isAllowed=(allowed.indexOf(keyChar)>-1);
var isException=false;
if(!isAllowed)
{
var exceptions=[8,46,37,39,13,9];
for(var i=0;i<exceptions.length;i++)
{
if(exceptions[i]==e.keyCode)
{
isException=true;
break;
}
}
if(!isException)
{
e.returnValue=false;
return false;
}
}
return true;
}
function AntaColorPickerHandleInputUp(e)
{
if(!IsDefined(typeof(e))){var e=event;}
StoreEvent(e);
var colorPicker=GetDomEventData(this);
if(this.value.length>=6)
{
this.value=colorPicker.InputChanged(this.value);
}
}
function AntaColorPickerHandleInputPaste(e)
{
if(!IsDefined(typeof(e))){var e=event;}
StoreEvent(e);
var colorPicker=GetDomEventData(this);
event.returnValue=false;
if(e.clipboardData&&e.clipboardData.getData)
{
var value=e.clipboardData.getData("text/plain");
}
else if(window.clipboardData&&window.clipboardData.getData)
{
var value=window.clipboardData.getData("Text");
}
else
{
return false;
}
if(value.length>=6)
{
colorPicker.InputChanged(value);
}
else if(value.toLowerCase()==AntaColor.Transparent)
{
colorPicker.SetTransparent();
}
return true;
}
function AntaColorPickerHandleClose(popup)
{
if(!popup.Dialog.SavePressed)
{
popup.Dialog.Restore();
}
}
function AntaColorPicker(webPart)
{
InitColorPickerPrototypes();
this.WebPart=webPart;
this.Window=webPart.WebForm.Window;
this.Cursor=webPart.Child("Cursor");
this.ColorPickerNode=webPart.Child("ColorPickerControl");
this.ColorPreview=webPart.Child("ColorPreview");
this.ColorInput=webPart.Child("ColorInput");
this.ColorInput.onkeypress=AntaColorPickerHandleInputPress;
this.ColorInput.onkeyup=AntaColorPickerHandleInputUp;
this.ColorInput.onpaste=AntaColorPickerHandleInputPaste;
SetDomEventData(this.ColorInput,this);
this.ColorPickerContainer=webPart.Child("ColorPickerContainer");
this.ColorPickerContainer.onmouseup=AntaColorPickerMouseUp;
this.ColorPickerContainer.onmousedown=AntaColorPickerMouseDown;
SetDomEventData(this.ColorPickerContainer,this);
this.Shades={};
for(var i=0;i<4;i++)
{
this.Shades[i]=webPart.Child("Shade"+(i+1));
this.Shades[i].onclick=AntaColorPickerSelectShade;
SetDomEventData(this.Shades[i],this);
}
this.Button=null;
this.ButtonNode=null;
this.EventHandler=null;
this.OriginalValue=null;
this.Value=null;
this.ColorPickerNodeRect=null;
this.Dialog=null;
this.Buttons=new Array();
this.Hex="";
this.Hsv={H:0,S:0,V:100};
this.SpecWidth=200;
this.Stop=true;
this.SavePressed=false;
}
function InitColorPickerPrototypes()
{
AntaColorPicker.prototype.RegisterColorPickerButton=function AntaColorPicker_RegisterColorPickerButton(buttonProperties)
{
var button=AttachWebButton(this.Window,buttonProperties,AntaHandleColorPickerButtonClick);
button.ColorPicker=this;
AntaAddButton(this.Buttons,button);
return button;
};
AntaColorPicker.prototype.Render=function AntaColorPicker_Render(windowObject,parentElement)
{
var container=this.Window.MakeNode("div");
parentElement.appendChild(container);
SwapNode(this.ColorPickerNode,container);
};
AntaColorPicker.prototype.Open=function AntaColorPicker_Open()
{
ShowNode(this.ColorPickerNode);
if(this.ColorPickerNodeRect==null)
{
this.ColorPickerNodeRect=this.Window.GetElementRect(this.ColorPickerNode);
}
this.Dialog=new AntaPopup(2,"FloatingWindow_2gether",null,"Kleur",2,this.ColorPickerNodeRect,AntaColorPickerHandleClose,null,true,false,false,this);
for(var i=0;i<this.Buttons.length;i++)
{
this.Buttons[i].Window=this.Dialog.Window;
}
};
AntaColorPicker.prototype.Restore=function AntaColorPicker_Restore()
{
if(this.OriginalValue.length==6)
this.ButtonNode.style.backgroundColor="#"+this.OriginalValue;
else if(this.OriginalValue.length==7)
this.ButtonNode.style.backgroundColor=this.OriginalValue;
else
this.ButtonNode.style.backgroundColor=this.OriginalValue;
this.Hex=this.OriginalValue;
this.CursorMoved();
};
AntaColorPicker.prototype.Save=function AntaColorPicker_Save()
{
this.SavePressed=true;
this.CursorMoved();
};
AntaColorPicker.prototype.SetTransparent=function AntaColorPicker_SetTransparent()
{
this.Value=AntaColor.Transparent;
this.UpdateInput(this.Value);
};
AntaColorPicker.prototype.Load=function AntaColorPicker_Load(button,value,eventHandler)
{
this.Button=button;
this.ButtonNode=button.ButtonNode;
this.Value=this.OriginalValue=this.ParseHexColor(value);
this.EventHandler=eventHandler;
this.SavePressed=false;
this.Open();
this.UpdateFromInput();
SetDomEventData(document,this);
};
AntaColorPicker.prototype.ParseHexColor=function AntaColorPicker_ParseHexColor(hexColor)
{
if(hexColor.indexOf("#")>-1)
{
hexColor=hexColor.substring(1);
}
return hexColor;
};
AntaColorPicker.prototype.CursorMoved=function AntaColorPicker_CursorMoved()
{
if(this.Hex==AntaColor.Transparent||this.Hex.length==0)
{
this.ColorInput.value="";
}
else
{
this.ColorInput.value=this.ParseHexColor(this.Hex);
}
if(this.EventHandler!=null)
{
this.EventHandler(this.Hex,this.SavePressed);
}
};
AntaColorPicker.prototype.UpdateFromInput=function AntaColorPicker_UpdateFromInput()
{
var v=this.Value;
if(v.length==6)
{
this.ButtonNode.style.backgroundColor="#"+v;
this.Hex=v;
this.Hsv=AntaColor.RGB_HSV(AntaColor.HEX_RGB(v));
AntaColor.Cords(this.SpecWidth,this.Hsv,this.Cursor);
}
else if(v==''||v==AntaColor.Transparent)
{
v=AntaColor.Transparent;
this.ButtonNode.style.backgroundColor=v;
this.Hex=v;
}
this.UpdatePreviewColor(v);
this.CursorMoved();
};
AntaColorPicker.prototype.UpdateInput=function AntaColorPicker_UpdateInput(v)
{
this.Hex=v;
if(v.length==6)
{
this.Hsv=AntaColor.RGB_HSV(AntaColor.HEX_RGB(v));
AntaColor.Cords(this.SpecWidth,this.Hsv,this.Cursor);
this.ButtonNode.style.background="#"+v;
}
else if(v==AntaColor.Transparent)
{
this.ButtonNode.style.background=v;
}
this.UpdatePreviewColor(v);
this.CursorMoved();
};
AntaColorPicker.prototype.InputChanged=function AntaColorPicker_InputChanged(v)
{
var colorValue=this.ParseHexColor(v);
if(colorValue==AntaColor.Transparent||colorValue.length==6)
{
this.Value=colorValue;
this.UpdateFromInput();
if(colorValue!=AntaColor.Transparent)
{
return colorValue;
}
}
return "";
};
AntaColorPicker.prototype.UpdatePreviewColor=function AntaColorPicker_UpdatePreviewColor(v)
{
if(v.length==6)
{
this.ColorPreview.style.backgroundColor="#"+v;
var hsl=AntaColor.HSV_HSL(this.Hsv);
var c_20=AntaColor.HSV_HEX(AntaColor.HSL_HSV(AntaColor.Lightness(hsl,-20)));
var c_10=AntaColor.HSV_HEX(AntaColor.HSL_HSV(AntaColor.Lightness(hsl,-10)));
var c10=AntaColor.HSV_HEX(AntaColor.HSL_HSV(AntaColor.Lightness(hsl,10)));
var c20=AntaColor.HSV_HEX(AntaColor.HSL_HSV(AntaColor.Lightness(hsl,20)));
this.Shades[0].style.backgroundColor="#"+c_20;
this.Shades[0].value=c_20;
this.Shades[1].style.backgroundColor="#"+c_10;
this.Shades[1].value=c_10;
this.Shades[2].style.backgroundColor="#"+c10;
this.Shades[2].value=c10;
this.Shades[3].style.backgroundColor="#"+c20;
this.Shades[3].value=c20;
}
else if(v=='transparent')
{
this.ColorPreview.style.backgroundColor=v;
for(var i in this.Shades)
{
this.Shades[i].style.backgroundColor=v;
this.Shades[i].value=v;
}
this.Cursor.style.left=ToPixels(0);
this.Cursor.style.top=ToPixels(0);
}
};
AntaColorPicker.prototype.Core=function AntaColorPicker_Core(e)
{
if(this.Stop)
{
this.Stop=false;
var d=this.Cursor.style,eZ=this.XY(e);
var ab=this.AbPos(this.Cursor.parentNode);
this.Point(-(ab.X),-(ab.Y),e);
this.oX=this.Zero(d.left)-eZ.X;
this.oY=this.Zero(d.top)-eZ.Y;
document.onmousemove=AntaColorPickerCursorMouseMove;
document.onmouseup=AntaColorPickerCursorMouseUp;
}
};
AntaColorPicker.prototype.Point=function AntaColorPicker_Point(a,b,e)
{
eZ=this.XY(e);
this.Commit([eZ.X+a,eZ.Y+b]);
};
AntaColorPicker.prototype.Commit=function AntaColorPicker_Commit(v)
{
var W=this.SpecWidth;
var W2=W/2;
var W3=W2/2;
var x=v[0]-W2;
var y=W-v[1]-W2;
var SV=Math.sqrt(Math.pow(x,2)+Math.pow(y,2)),hue=Math.atan2(x,y)/(Math.PI*2);
this.Hsv={"H":hue>0?(hue*360):((hue*360)+360),"S":SV<W3?(SV/ W3)* 100: 100, "V": SV>= W3? Math.max(0, 1-((SV- W3)/(W2-W3)))*100:100};
this.Hex=AntaColor.HSV_HEX(this.Hsv);
this.ButtonNode.style.backgroundColor="#"+this.Hex;
this.UpdatePreviewColor(this.Hex);
AntaColor.Cords(W,this.Hsv,this.Cursor);
};
AntaColorPicker.prototype.AbPos=function AntaColorPicker_AbPos(o)
{
var z={X:0,Y:0};
while(o!=null)
{
z.X+=o.offsetLeft;
z.Y+=o.offsetTop;
o=o.offsetParent;
}
return(z);
};
AntaColorPicker.prototype.Zero=function AntaColorPicker_Zero(n)
{
return(!isNaN(n=parseFloat(n))?n:0);
};
AntaColorPicker.prototype.XY=function AntaColorPicker_XY(e,v)
{
var o=(e.clientX!=undefined)?{"X":e.clientX,"Y":e.clientY}:{"X":e.pageX,"Y":e.pageY};
return(v?o[v]:o);
};
}
var AntaColor={};
AntaColor.Transparent="transparent";
AntaColor.Cords=function AntaColor_Cords(W,hsv,cursor)
{
var W2=W/ 2, rad=(hsv.H/ 360)*(Math.PI*2),hyp=(hsv.S+(100-hsv.V))/100*(W2/2);
var _3c=Math.round(Math.abs(Math.round(Math.sin(rad)*hyp)+W2));
var _3d=Math.round(Math.abs(Math.round(Math.cos(rad)*hyp)-W2));
cursor.style.left=ToPixels(_3c-4);
cursor.style.top=ToPixels(_3d-4);
};
AntaColor.Lightness=function AntaColor_Lightness(o,_49)
{
_49=Math.min(Math.max(_49,-100),100);
var l=o.L+_49;
l=Math.min(Math.max(l,0),100);
return{"H":o.H,"S":o.S,"L":l};
};
AntaColor.HEX=function AntaColor_HEX(o)
{
o=Math.round(Math.min(Math.max(0,o),255));
return("0123456789ABCDEF".charAt((o-o%16)/16)+"0123456789ABCDEF".charAt(o%16));
};
AntaColor.RGB_HEX=function AntaColor_RGB_HEX(o)
{
var fu=AntaColor.HEX;
return(fu(o.R)+fu(o.G)+fu(o.B));
};
AntaColor.HEX_RGB=function AntaColor_HEX_RGB(r)
{
return({0:parseInt(r.substr(0,2),16),1:parseInt(r.substr(2,2),16),2:parseInt(r.substr(4,2),16)});
};
AntaColor.RGB_HSV=function AntaColor_RGB_HSV(r)
{
var max=Math.max(r[0],r[1],r[2]),_51=max-Math.min(r[0],r[1],r[2]),H,S,V;
if(max!=0)
{
S=Math.round(_51/max*100);
if(r[0]==max)
{
H=(r[1]-r[2])/_51;
}else
{
if(r[1]==max)
{
H=2+(r[2]-r[0])/_51;
}else
{
if(r[2]==max)
{
H=4+(r[0]-r[1])/_51;
}
}
}
var H=Math.min(Math.round(H*60),360);
if(H<0)
{
H+=360;
}
}
V=Math.round((max/255)*100);
return({"H":H?H:0,"S":S?S:0,"V":V?V:100});
};
AntaColor.HSV_RGB=function AntaColor_HSV_RGB(o)
{
var R,G,A,B,C,F,S=o.S/ 100, V= o.V/ 100,H=o.H/360;
if(S>0)
{
if(H>=1)
{
H=0;
}
H=6*H;
F=H-Math.floor(H);
A=Math.round(255*V*(1-S));
B=Math.round(255*V*(1-(S*F)));
C=Math.round(255*V*(1-(S*(1-F))));
V=Math.round(255*V);
switch(Math.floor(H))
{
case 0:
R=V;G=C;B=A;
break;
case 1:
R=B;G=V;B=A;
break;
case 2:
R=A;G=V;B=C;
break;
case 3:
R=A;G=B;B=V;
break;
case 4:
R=C;G=A;B=V;
break;
case 5:
R=V;G=A;B=B;
break;
}
return({"R":R?R:0,"G":G?G:0,"B":B?B:0,"A":1});
}else
{
return({"R":(V=Math.round(V*255)),"G":V,"B":V,"A":1});
}
};
AntaColor.HSV_HEX=function AntaColor_HSV_HEX(o)
{
return(AntaColor.RGB_HEX(AntaColor.HSV_RGB(o)));
};
AntaColor.HSV_HSL=function AntaColor_HSV_HSL(hsv)
{
var l=(2-hsv.S/ 100)* hsv.V/ 2;
var hsl={"H":hsv.H,"S":hsv.S*hsv.V/(l<50?l*2:200-l*2),"L":l};
if(isNaN(hsl.S))
{
hsl.S=0;
}
return hsl;
};
AntaColor.HSL_HSV=function AntaColor_HSL_HSV(hsl)
{
var t=hsl.S*(hsl.L<50?hsl.L:100-hsl.L)/100;
var hsv={"H":hsl.H,"S":200*t/(hsl.L+t),"V":t+hsl.L};
if(isNaN(hsv.S))
{
hsv.S=0;
}
return hsv;
};
AntaColor.IntToHex=function AntaColor_IntToHex(intValue)
{
var hexValue=parseInt(intValue).toString(16).toUpperCase();
if(hexValue=="00000000"||hexValue=="0")
{
return AntaColor.Transparent;
}
return hexValue;
};
AntaColor.IntToHexColor=function AntaColor_IntToHexColor(intValue)
{
var hexValue=AntaColor.IntToHex(intValue);
if(hexValue==AntaColor.Transparent)
{
return hexValue;
}
return hexValue.substr(2,8);
};
AntaColor.HexToInt=function AntaColor_HexToInt(hexValue)
{
if(hexValue==AntaColor.Transparent||hexValue=="")
{
return "00000000";
}
return parseInt("0xFF"+hexValue).toString();
};


