239 lines
9.6 KiB
Plaintext
239 lines
9.6 KiB
Plaintext
Type.registerNamespace("Telerik.Web.UI");
|
|
(function(){var b=$telerik.$;
|
|
var a=Telerik.Web.UI;
|
|
a.DialogDefinition=function(){this.Width="600px";
|
|
this.Height="400px";
|
|
this.Title="";
|
|
this.Behaviors=36;
|
|
this.Modal=true;
|
|
this.VisibleStatusbar=false;
|
|
this.VisibleTitlebar=true;
|
|
this.ClientCallbackFunction="";
|
|
};
|
|
a.DialogDefinition.registerClass("Telerik.Web.UI.DialogDefinition",null);
|
|
a.DialogDefinitionsDictionary=function(f){for(var e in f){var c=f[e];
|
|
var d=new a.DialogDefinition();
|
|
for(var g in c){d[g]=c[g];
|
|
}this[e]=d;
|
|
}};
|
|
a.DialogDefinitionsDictionary.registerClass("Telerik.Web.UI.DialogDefinitionsDictionary",null);
|
|
a.DialogOpenEventArgs=function(d,c){a.DialogOpenEventArgs.initializeBase(this);
|
|
this._dialogName=d;
|
|
if(c){this._parameters=c;
|
|
}else{this._parameters={};
|
|
}};
|
|
a.DialogOpenEventArgs.prototype={get_dialogName:function(){return this._dialogName;
|
|
},set_parameters:function(c){this._parameters=c;
|
|
},get_parameters:function(){return this._parameters;
|
|
}};
|
|
a.DialogOpenEventArgs.registerClass("Telerik.Web.UI.DialogOpenEventArgs",Sys.EventArgs);
|
|
a.RadDialogOpener=function(c){a.RadDialogOpener.initializeBase(this,[c]);
|
|
this._dialogDefinitions={};
|
|
this._handlerChecked=false;
|
|
this._dialogParametersProviderTypeName="";
|
|
this._dialogUniqueID="";
|
|
this._dialogContainers={};
|
|
};
|
|
a.RadDialogOpener.prototype={initialize:function(){a.RadDialogOpener.callBaseMethod(this,"initialize");
|
|
this._dialogDefinitions=new a.DialogDefinitionsDictionary(this.get_dialogDefinitions());
|
|
},get_dialogDefinitions:function(){return this._dialogDefinitions;
|
|
},openUrl:function(k,o,p,n,e,f,j,h,d,g,i,m){m="EXTERNAL_URL"+(m||"default");
|
|
var l=this._getDialogContainer(m);
|
|
l.set_width(p+"px");
|
|
l.set_height(n+"px");
|
|
l.set_behaviors(d||a.WindowBehaviors.Default);
|
|
l.set_modal(h==true);
|
|
l.set_visibleStatusbar(g==true);
|
|
l.set_visibleTitlebar(i==true);
|
|
l.set_title(j?j:"");
|
|
l.set_keepInScreenBounds(true);
|
|
var c=new a.DialogOpenEventArgs(k,o);
|
|
this.raiseEvent("open",c);
|
|
l.ClientParameters=o;
|
|
l.set_clientCallBackFunction(e);
|
|
l.setUrl(k);
|
|
l.show();
|
|
l.center();
|
|
window.setTimeout(function(){l.setActive(true);
|
|
},100);
|
|
},open:function(c,h,k){if(!this._handlerChecked){this._checkDialogHandler(this.get_handlerUrl());
|
|
}var j=this._getDialogDefinition(c);
|
|
var d=new a.DialogOpenEventArgs(c,h);
|
|
this.raiseEvent("open",d);
|
|
var h=d.get_parameters();
|
|
if(!k){k=j.ClientCallbackFunction;
|
|
}var i;
|
|
if(this.get_useClassicDialogs()){i=$create(a.ClassicDialog,{dialogOpener:this});
|
|
i.ClientParameters=h;
|
|
this._applyParameters(c,i);
|
|
if(k){i.set_clientCallBackFunction(k);
|
|
}window.__getCurrentRadEditorRadWindowReference=function(){return i;
|
|
};
|
|
var g="width="+parseInt(j.Width)+",height="+parseInt(j.Height);
|
|
g+=",resizable=0,scrollbars=0,status=0,toolbar=0,menubar=0,directories=0";
|
|
var e=i.open(g,c);
|
|
e.radWindow=i;
|
|
return e;
|
|
}else{i=this._getDialogContainer(c);
|
|
var f=j.Height;
|
|
i.set_height(f);
|
|
i.set_width(j.Width);
|
|
i.set_behaviors(j.Behaviors);
|
|
i.set_modal(j.Modal);
|
|
i.set_visibleStatusbar(j.VisibleStatusbar);
|
|
i.set_visibleTitlebar(j.VisibleTitlebar);
|
|
i.set_keepInScreenBounds(true);
|
|
if(j.ReloadOnShow!=null){i.set_reloadOnShow(j.ReloadOnShow);
|
|
}i.ClientParameters=h;
|
|
this._applyParameters(c,i);
|
|
if(k){i.set_clientCallBackFunction(k);
|
|
}i.show();
|
|
i.set_height(f);
|
|
i.center();
|
|
window.setTimeout(function(){i.setActive(true);
|
|
},100);
|
|
}},openLight:function(c,f,i){var e=195;
|
|
var d=350;
|
|
if(f){if(f.height){e=f.height;
|
|
}if(f.width){d=f.width;
|
|
}}var h=new a.DialogOpenEventArgs(c,f);
|
|
this.raiseEvent("open",h);
|
|
var f=h.get_parameters();
|
|
var g=this._getDialogContainer(c);
|
|
g.set_height(e);
|
|
g.set_width(d);
|
|
g.set_behaviors(Telerik.Web.UI.WindowBehaviors.Move+Telerik.Web.UI.WindowBehaviors.Close);
|
|
g.set_modal(true);
|
|
g.set_visibleStatusbar(false);
|
|
g.set_visibleTitlebar(true);
|
|
if(i){g.set_clientCallBackFunction(i);
|
|
}g.ClientParameters=f;
|
|
Telerik.Web.UI.LightDialogsControllerClass.initializeLightDialog(g);
|
|
g.show();
|
|
g.set_height(e);
|
|
g.center();
|
|
window.setTimeout(function(){g.setActive(true);
|
|
},100);
|
|
},_applyParameters:function(i,d){var n=this._getDialogParameters(i);
|
|
if(!n){return;
|
|
}var c="&dp="+encodeURIComponent(n);
|
|
var g=this._getBaseDialogUrl(i);
|
|
var h=g.length+c.length;
|
|
var m=this._dialogParametersProviderTypeName=="";
|
|
var f=m&&h<=this.get_dialogUrlLengthLimit();
|
|
if(f){var k=d.get_navigateUrl();
|
|
var j=g+c;
|
|
if(k!=j){d.setUrl(j);
|
|
}else{var e=d.get_contentFrame();
|
|
if(e&&e.contentWindow&&e.contentWindow.$find){var l=e.contentWindow.initDialog;
|
|
if(l){e.contentWindow.setTimeout(function(){l();
|
|
},1);
|
|
}}}}else{d.setUrl(g);
|
|
d.DialogParameters=n;
|
|
}},_closeContainerDelegate:function(c){this.raiseEvent("close",c);
|
|
},_getDialogContainer:function(d){if(typeof(this._dialogContainers[d])=="undefined"){var c=$find(this.get_id()+d);
|
|
if(null!=c){c.dispose();
|
|
}this._dialogContainers[d]=this.get_container().clone(this.get_id()+d);
|
|
var e=this;
|
|
this._dialogContainers[d].get_dialogOpener=function(){return e;
|
|
};
|
|
this._dialogContainers[d].add_close(Function.createDelegate(this,this._closeContainerDelegate));
|
|
}return this._dialogContainers[d];
|
|
},_getBaseDialogUrl:function(e){var d=this.get_handlerUrl().indexOf("?")<0?"?":"&";
|
|
var c=this.get_handlerUrl()+d+"DialogName="+e;
|
|
if(this.get_enableTelerikManagers()){c+="&UseRSM=true";
|
|
}c+="&Skin="+this.get_skin()+"&Title="+encodeURIComponent(this._getDialogDefinition(e)["Title"])+"&doid="+this._dialogUniqueID+"&dpptn="+encodeURIComponent(this._dialogParametersProviderTypeName)+this.get_additionalQueryString();
|
|
return c;
|
|
},_getDialogDefinition:function(d){var c=this.get_dialogDefinitions()[d];
|
|
if(c){return c;
|
|
}else{throw Error.argumentNull("dialogName",String.format("Dialog Parameters for the {0} dialog do not exist",d));
|
|
}},_getDialogParameters:function(c){return this._getDialogDefinition(c)["SerializedParameters"];
|
|
},_checkDialogHandler:function(c){var d=c.indexOf("?")<0?"?":"&";
|
|
var g=c+d+"checkHandler=true";
|
|
var e=new Sys.Net.WebRequest();
|
|
e.set_url(g);
|
|
e.add_completed(Function.createDelegate(this,this._checkRequestCompleted));
|
|
var f=new Sys.Net.XMLHttpExecutor();
|
|
e.set_executor(f);
|
|
f.executeRequest();
|
|
},_checkRequestCompleted:function(c,e){if(c.get_responseAvailable()){var d=c.get_responseData();
|
|
if(d&&d.indexOf("HandlerCheckOK")>0){this._handlerChecked=true;
|
|
return;
|
|
}}window.alert("Web.config registration missing!\n The Telerik dialogs require a HttpHandler registration in the web.config file. Please, use the control's Smart Tag to add the handler automatically, or see the help for more information: Controls > RadEditor > Dialogs > Introduction");
|
|
}};
|
|
b.registerControlProperties(a.RadDialogOpener,{additionalQueryString:"",enableTelerikManagers:false,handlerUrl:"",container:null,dialogUrlLengthLimit:2000,useClassicDialogs:false,skin:""});
|
|
b.registerControlEvents(a.RadDialogOpener,["open","close"]);
|
|
a.RadDialogOpener.registerClass("Telerik.Web.UI.RadDialogOpener",a.RadWebControl);
|
|
a.ClassicDialog=function(d,c){a.ClassicDialog.initializeBase(this);
|
|
this.BrowserWindow=window;
|
|
this._dialogOpener=null;
|
|
this._clientCallBackFunction=null;
|
|
this._window=null;
|
|
this._url="";
|
|
this._events={close:[],beforeClose:[],show:[]};
|
|
};
|
|
a.ClassicDialog.prototype={close:function(d){this.raiseEvent("beforeClose");
|
|
this.raiseEvent("close");
|
|
if(null!=d&&!(d instanceof Sys.UI.DomEvent)){var c=this.get_clientCallBackFunction();
|
|
if(typeof(c)=="string"){c=eval(c);
|
|
}if(c){c(this,d);
|
|
}}var e=this.get_contentFrame();
|
|
e.setTimeout(function(){e.close();
|
|
e.parent.focus();
|
|
},100);
|
|
},open:function(d,c){this._window=window.open(this.get_navigateUrl(),c,d);
|
|
this._window.focus();
|
|
if(!this._window.contentWindow){this._window.contentWindow=this._window;
|
|
}this.raiseEvent("show");
|
|
return this._window;
|
|
},get_dialogOpener:function(){return this._dialogOpener;
|
|
},set_dialogOpener:function(c){this._dialogOpener=c;
|
|
},get_clientCallBackFunction:function(){return this._clientCallBackFunction;
|
|
},set_clientCallBackFunction:function(c){this._clientCallBackFunction=c;
|
|
},setUrl:function(c){this._url=c;
|
|
},get_navigateUrl:function(){return this._url;
|
|
},get_contentFrame:function(){return this._window;
|
|
},set_title:function(c){if(this._window&&this._window.document){this._window.document.title=c;
|
|
}},dispose:function(){this._window=null;
|
|
this._clientCallBackFunction=null;
|
|
this._dialogOpener=null;
|
|
this._events=null;
|
|
a.ClassicDialog.callBaseMethod(this,"dispose");
|
|
},add_close:function(c){Array.add(this._events.close,c);
|
|
},remove_close:function(c){Array.remove(this._events.close,c);
|
|
},add_show:function(c){Array.add(this._events.show,c);
|
|
},remove_show:function(c){Array.remove(this._events.show,c);
|
|
},add_beforeClose:function(c){Array.add(this._events.beforeClose,c);
|
|
},remove_beforeClose:function(c){Array.remove(this._events.beforeClose,c);
|
|
},raiseEvent:function(c,e){var d=this._events[c];
|
|
this._raiseEvent(d,e);
|
|
},_raiseEvent:function(e,d){if(!e||(e.length===0)){return;
|
|
}e=Array.clone(e);
|
|
if(!e._handler){e._handler=function(f,h){for(var g=0,j=e.length;
|
|
g<j;
|
|
g++){e[g](f,h);
|
|
}};
|
|
}var c=e._handler;
|
|
if(c){if(!d){d=Sys.EventArgs.Empty;
|
|
}c(this,d);
|
|
}}};
|
|
a.ClassicDialog.registerClass("Telerik.Web.UI.ClassicDialog",Sys.Component);
|
|
})();
|
|
Type.registerNamespace("Telerik.Web.UI");
|
|
if(typeof(Telerik.Web.UI.EditorCommandEventArgs)=="undefined"){Telerik.Web.UI.EditorCommandEventArgs=function(c,b,a){Telerik.Web.UI.EditorCommandEventArgs.initializeBase(this);
|
|
this._name=this._commandName=c;
|
|
this._tool=b;
|
|
this._value=a;
|
|
this.value=a;
|
|
this._callbackFunction=null;
|
|
};
|
|
Telerik.Web.UI.EditorCommandEventArgs.prototype={get_name:function(){return this._name;
|
|
},get_commandName:function(){return this._commandName;
|
|
},get_tool:function(){return this._tool;
|
|
},get_value:function(){return this._value;
|
|
},set_value:function(a){this.value=a;
|
|
this._value=a;
|
|
},set_callbackFunction:function(a){this._callbackFunction=a;
|
|
}};
|
|
Telerik.Web.UI.EditorCommandEventArgs.registerClass("Telerik.Web.UI.EditorCommandEventArgs",Sys.CancelEventArgs);
|
|
} |