Type.registerNamespace("Telerik.Web.UI");
Telerik.Web.UI.DialogDefinition=function(){
this.Width="600px";
this.Height="400px";
this.Title="";
this.Behaviors=36;
this.Modal=true;
this.VisibleStatusbar=false;
this.VisibleTitlebar=true;
this.ClientCallbackFunction="";
};
Telerik.Web.UI.DialogDefinition.registerClass("Telerik.Web.UI.DialogDefinition",null);
Telerik.Web.UI.DialogDefinitionsDictionary=function(_1){
for(var _2 in _1){
var _3=_1[_2];
var _4=new Telerik.Web.UI.DialogDefinition();
for(var _5 in _3){
_4[_5]=_3[_5];
}
this[_2]=_4;
}
};
Telerik.Web.UI.DialogDefinitionsDictionary.registerClass("Telerik.Web.UI.DialogDefinitionsDictionary",null);
Telerik.Web.UI.DialogOpenEventArgs=function(_6,_7){
Telerik.Web.UI.DialogOpenEventArgs.initializeBase(this);
this._dialogName=_6;
if(_7){
this._parameters=_7;
}else{
this._parameters={};
}
};
Telerik.Web.UI.DialogOpenEventArgs.prototype={get_dialogName:function(){
return this._dialogName;
},set_parameters:function(_8){
this._parameters=_8;
},get_parameters:function(){
return this._parameters;
}};
Telerik.Web.UI.DialogOpenEventArgs.registerClass("Telerik.Web.UI.DialogOpenEventArgs",Sys.EventArgs);
Telerik.Web.UI.DialogOpener=function(_9){
Telerik.Web.UI.DialogOpener.initializeBase(this,[_9]);
this._additionalQueryString="";
this._dialogDefinitions={};
this._handlerUrl="";
this._handlerChecked=false;
this._useClassicDialogs=false;
this._language="en-US";
this._skin="";
this._dialogParametersProviderTypeName="";
this._dialogUrlLengthLimit=2000;
this._dialogUniqueID="";
this._dialogContainers={};
this._container=null;
this._something="";
};
Telerik.Web.UI.DialogOpener.prototype={initialize:function(){
Telerik.Web.UI.DialogOpener.callBaseMethod(this,"initialize");
this._dialogDefinitions=new Telerik.Web.UI.DialogDefinitionsDictionary(this.get_dialogDefinitions());
},dispose:function(){
Telerik.Web.UI.DialogOpener.callBaseMethod(this,"dispose");
},get_container:function(){
if(this._container==null){
this._container=this._findChildControl("Window");
}
return this._container;
},get_additionalQueryString:function(){
return this._additionalQueryString;
},set_additionalQueryString:function(_a){
this._additionalQueryString=_a;
},get_dialogDefinitions:function(){
return this._dialogDefinitions;
},get_handlerUrl:function(){
return this._handlerUrl;
},set_handlerUrl:function(_b){
this._handlerUrl=_b;
},get_useClassicDialogs:function(){
return this._useClassicDialogs;
},set_useClassicDialogs:function(_c){
this._useClassicDialogs=_c;
},get_language:function(){
return this._language;
},set_language:function(_d){
this._language=_d;
},get_skin:function(){
return this._skin;
},set_skin:function(_e){
this._skin=_e;
},add_open:function(_f){
this.get_events().addHandler("open",_f);
},remove_open:function(_10){
this.get_events().removeHandler("open",_10);
},raise_open:function(_11){
this.raiseEvent("Open",_11);
},openUrl:function(url,_13,_14,_15,_16,_17,_18,_19,_1a,_1b,_1c){
var _1d=this._getDialogContainer("EXTERNAL_URL");
_1d.set_width(_14+"px");
_1d.set_height(_15+"px");
_1d.set_behaviors(_1a||Telerik.Web.UI.WindowBehaviors.Default);
_1d.set_modal(_19||true);
_1d.set_visibleStatusbar(_1b||true);
_1d.set_visibleTitlebar(_1c||true);
var _1e=new Telerik.Web.UI.DialogOpenEventArgs(url,_13);
this.raise_open(_1e);
_1d.ClientParameters=_13;
_1d.set_clientCallBackFunction(_16);
_1d.setUrl(url);
_1d.show();
_1d.center();
window.setTimeout(function(){
_1d.setActive(true);
},100);
_1d._iframe.focus();
},open:function(_1f,_20,_21){
if(!this._handlerChecked){
this._checkDialogHandler(this.get_handlerUrl());
}
var _22=this._getDialogContainer(_1f);
var _23=this._getDialogDefinition(_1f);
var _24=_23["Height"];
_22.set_height(_24);
_22.set_width(_23["Width"]);
_22.set_behaviors(_23["Behaviors"]);
_22.set_modal(_23["Modal"]);
_22.set_visibleStatusbar(_23["VisibleStatusbar"]);
_22.set_visibleTitlebar(_23["VisibleTitlebar"]);
var _25=new Telerik.Web.UI.DialogOpenEventArgs(_1f,_20);
this.raise_open(_25);
_22.ClientParameters=_25.get_parameters();
this._applyParameters(_1f,_22);
if(!_21){
_21=_23.ClientCallbackFunction;
}
if(_21){
_22.set_clientCallBackFunction(_21);
}
_22.show();
_22.set_height(_24);
_22.center();
window.setTimeout(function(){
_22.setActive(true);
},100);
if(!$telerik.isSafari||$telerik.isSafari3){
_22._iframe.focus();
}
},_applyParameters:function(_26,_27){
var _28=this._getDialogParameters(_26);
if(!_28){
return;
}
var _29="&dp="+encodeURIComponent(this._getDialogParameters(_26));
var _2a=this._getBaseDialogUrl(_26);
var _2b=_2a.length+_29.length;
var _2c=this._dialogParametersProviderTypeName=="";
var _2d=_2c&&_2b<=this._dialogUrlLengthLimit;
if(_2d){
var _2e=_27.get_navigateUrl();
var url=_2a+_29;
if(_2e!=url){
_27.setUrl(url);
}else{
var _30=_27.get_contentFrame();
if(_30&&_30.contentWindow&&_30.contentWindow.$find){
var _31=_30.contentWindow.initDialog;
if(_31){
_30.contentWindow.setTimeout(function(){
_31();
},1);
}
}
}
}else{
_27.setUrl(_2a);
_27.DialogParameters=this._getDialogParameters(_26);
}
},_getDialogContainer:function(_32){
if(typeof (this._dialogContainers[_32])=="undefined"){
var _33=$find(this.get_id()+_32);
if(null!=_33){
_33.dispose();
}
this._dialogContainers[_32]=this.get_container().clone(this.get_id()+_32);
var _34=this;
this._dialogContainers[_32].get_dialogOpener=function(){
return _34;
};
}
return this._dialogContainers[_32];
},_getBaseDialogUrl:function(_35){
var _36=this.get_handlerUrl().indexOf("?")<0?"?":"&";
return this.get_handlerUrl()+_36+"DialogName="+_35+"&Skin="+this.get_skin()+"&Title="+this._getDialogDefinition(_35)["Title"]+"&doid="+this._dialogUniqueID+"&dpptn="+encodeURIComponent(this._dialogParametersProviderTypeName)+this.get_additionalQueryString();
},_getDialogDefinition:function(_37){
var _38=this.get_dialogDefinitions()[_37];
if(_38){
return _38;
}else{
throw Error.argumentNull("dialogName",String.format("Dialog Parameters for the {0} dialog do not exist",_37));
}
},_getDialogParameters:function(_39){
return this._getDialogDefinition(_39)["SerializedParameters"];
},_checkDialogHandler:function(url){
var _3b=url.indexOf("?")<0?"?":"&";
var _3c=url+_3b+"checkHandler=true";
var _3d=new Sys.Net.WebRequest();
_3d.set_url(_3c);
_3d.add_completed(Function.createDelegate(this,this._checkRequestCompleted));
var _3e=new Sys.Net.XMLHttpExecutor();
_3d.set_executor(_3e);
_3e.executeRequest();
},_checkRequestCompleted:function(_3f,_40){
if(_3f.get_responseAvailable()){
var _41=_3f.get_webRequest();
var _42=_3f.get_responseData();
if(_42&&_42.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 > Editor > Dialogs");
}};
Telerik.Web.UI.DialogOpener.registerClass("Telerik.Web.UI.DialogOpener",Telerik.Web.UI.RadWebControl);

