var restartManagerMask;var reqParams;Ext.define("eGDBCreation.controller.DbCreationController",{extend:"Ext.app.Controller",requires:["eGDBCreation.view.DbServerSettings","eGDBCreation.view.oracleView","eGDBCreation.view.resultPanel","eGDBCreation.view.ManagerConfiguration","eGDBCreation.view.FormItems"],refs:[{selector:"main",ref:"main"},{selector:"dbserversettings",ref:"dbserversettings"},{selector:"oracleview",ref:"oracleview"},{selector:"resultpanel",ref:"resultpanel"},{selector:"ManagerConfiguration",ref:"ManagerConfiguration"},{selector:"formitems",ref:"formitems"}],init:function(){appCnt=this;
Ext.Msg.bodyPadding="10 0";Ext.Msg.cls="adminAlert";this.control({"main button[id=createDB]":{"click":this.submitForm},"main button[id=clearDB]":{"click":this.clearForm},"main button[id=validatecon]":{"click":this.validateConnection},"resultpanel button[id=res_button]":{"click":this.backForm},"resultpanel radio[name=addlicense]":{"change":this.licenceUploadChange},"resultpanel button[action=fileUploadAction]":{"click":this.licenseUpload},"main tabpanel[id=dbCreationTab]":{"tabchange":this.clearForm},'ManagerConfiguration radio[id="smtpauthenticationno"]':{"change":this.radSmtpChange},'ManagerConfiguration radio[id="mailauthenticationno"]':{"change":this.radMailSetChange},'ManagerConfiguration button[id="validateBtn"]':{"click":this.validationForMailServers},'ManagerConfiguration button[id="clearBtn"]':{"click":this.clearMailServersSettings},'ManagerConfiguration radio[name="mgrmdl"]':{"change":this.managerModelChange},'ManagerConfiguration radio[name="selfReg"]':{"change":this.selfRegistrationChange}});
},submitForm:function(){var e=Ext.getCmp("hidden_dbfield").getValue();var t;if(e=="mssql"){t=this.getDbserversettings().getForm();}else{t=this.getOracleview().getForm();}if(this.validate(t)){var d=new Array();if(e=="mssql"){var h=t.findField("ssl_enab").getValue().ssl_enable;var x=t.findField("create_newdb").getValue().db_sel;
var g=t.findField("namedinstances").getValue.useinstance;if(!Ext.isEmpty(t.findField("instanceid"))){var s=t.findField("instanceid").getValue().trim();}var i=t.findField("ip").getValue();var k=t.findField("port").getValue();var w=t.findField("dbname").getValue();var v=t.findField("mdbusername").getValue();
var c=t.findField("mdbpassword").getValue();var C;var A;var v;if(!Ext.isEmpty(t.findField("dbausername").getValue())){var u=t.findField("dbausername").getValue();A=u;}else{if(!Ext.isEmpty(t.findField("mdbusername").getValue())){var u=t.findField("mdbusername").getValue();v=u;}}if(!Ext.isEmpty(t.findField("mdbpassword"))){var c=t.findField("mdbpassword").getValue();
}if(!Ext.isEmpty(t.findField("dbapassword"))){var n=t.findField("dbapassword").getValue();}var q="false";var m="false";if(!Ext.isEmpty(t.findField("windowsAuthentic_enab_User"))){q=Ext.getCmp("windowsAuthentic_enab_User").getValue().windowsAuthentic_enable;}if(!Ext.isEmpty(t.findField("windowsAuthentic_enab_AdminUser"))){m=Ext.getCmp("windowsAuthentic_enab_AdminUser").getValue().windowsAuthentic_enable_AdminUser;
}var o="false";var z="false";var j="false";if(q=="true"||m=="true"){if(!Ext.isEmpty(t.findField("ntlmv"))){o=t.findField("ntlmv").getValue().ntlmv2;}if(q=="true"){z="true";if(!Ext.isEmpty(t.findField("user_Domain"))){var f=t.findField("user_Domain").getValue();C=f;if(!Ext.isEmpty(C)&&C.indexOf(".")>0){var b=C.split(".");
C=b[0];}v=C+"\\"+v;}}if(m=="true"){j="true";if(!Ext.isEmpty(t.findField("admin_User_Domain"))){var a=t.findField("admin_User_Domain").getValue();C=a;if(!Ext.isEmpty(C)&&C.indexOf(".")>0){var b=C.split(".");C=b[0];}}}}else{C="none";}d["dbType"]=e;d["ip"]=i;d["port"]=k;d["instanceId"]=s;d["dbName"]=w;d["mdbUserName"]=v;
d["mdbPassword"]=c;d["dbaUserName"]=A;d["dbaPassword"]=n;d["isNtlmv"]=o;d["isSslEnabled"]=h;d["isNewDb"]=x;d["useInstances"]=g;d["domain"]=C;d["isDBUserWindowsAuthentic"]=z;d["isAdminWindowsAuthentic"]=j;d["action"]="createDB";}else{var i=t.findField("ipOra").getValue();var k=t.findField("portOra").getValue();
var s=t.findField("instanceidOra").getValue();var v=t.findField("mdbusernameOra").getValue();var c=t.findField("mdbpasswordOra").getValue();var l=t.findField("temporarytabspaceOra").getValue();var y=t.findField("defaulttabspaceOra").getValue();var x=t.findField("create_newdbOra").getValue().db_selOra;
var C;var A;var v;if(!Ext.isEmpty(t.findField("dbausernameOra").getValue())){var u=t.findField("dbausernameOra").getValue();if(u.indexOf("/")>0){var B=u.split("/");C=B[0];A=B[1];}else{if(u.indexOf("\\")>0){var B=u.split("\\");C=B[0];A=B[1];}else{A=u;C="none";}}}else{if(!Ext.isEmpty(t.findField("mdbusernameOra").getValue())){var u=t.findField("mdbusernameOra").getValue();
if(u.indexOf("/")>0){var B=u.split("/");C=B[0];v=B[1];}else{if(u.indexOf("\\")>0){var B=u.split("\\");C=B[0];v=B[1];}else{v=u;C="none";}}}}if(!Ext.isEmpty(t.findField("mdbpasswordOra"))){var c=t.findField("mdbpasswordOra").getValue();}if(!Ext.isEmpty(t.findField("dbapasswordOra"))){var n=t.findField("dbapasswordOra").getValue();
}d["dbType"]=e;d["ip"]=i;d["port"]=k;d["instanceId"]=s;d["mdbUserName"]=v;d["mdbPassword"]=c;d["tempTabSpace"]=l;d["defaultTabSpace"]=y;d["dbaUserName"]=A;d["dbaPassword"]=n;d["domain"]=C;d["dbName"]="";d["isNtlmv"]="";d["isSslEnabled"]="";d["isNewDb"]=x;d["action"]="createDB";}var r=Ext.urlEncode(d);
var p=new Ext.LoadMask(Ext.get(this.getMain().id),{cls:"windowModal",msg:"Database creation is in progress, please wait..."});p.show();if(e=="mssql"){Ext.Ajax.request({url:"/final/servlet/com.eg.EgDbCreationController",method:"POST",params:r,timeout:ajaxTimeOutFrequency,scope:this,success:function(E){Ext.destroy(p);
var F=Ext.decode(E.responseText);var D=F["dbStatus"];if(D!=null&&D=="dbCreated"){d["dbStatus"]=D;this.userCreation(d);Ext.getCmp("dbIconSuccess").show();Ext.getCmp("dbIconFailed").hide();}else{Ext.getCmp("dbIconSuccess").hide();Ext.getCmp("dbIconFailed").show();Ext.getCmp("mainContainer").hide();Ext.getCmp("resultContainer").show();
Ext.get("usercreationresWrong").update('<div class="errorWhileInstallText">Error while creating the eG database.</div>');Ext.get("tabcreationresWrong").update('<div style="width:500px;text-align:center;margin-top: 0px;" class="dbfont_normal12">'+F["eG Manager Configuration"]+"</div>");Ext.getCmp("topResultHideWrong").show();
Ext.getCmp("topResultHideRight").hide();Ext.getCmp("fileUploadForm").hide();Ext.getCmp("licenceMsg").hide();Ext.getCmp("fileUpladBotn").hide();Ext.getCmp("res_button").show();Ext.getCmp("upldLicence").hide();}},failure:function(){Ext.destroy(p);Ext.destroy(t);alert("Database creation request timed out. please check "+paramDecode(mgrLogPath));
}});}else{Ext.destroy(p);this.userCreation(d);}}Ext.destroy(t);},userCreation:function(c){var b=Ext.urlEncode(c);var a=new Ext.LoadMask(Ext.get(this.getMain().id),{cls:"windowModal",msg:"Database user creation is in progress, please wait..."});a.show();Ext.Ajax.request({url:"/final/servlet/com.eg.EgDbCreationController",method:"POST",params:b,timeout:ajaxTimeOutFrequency,scope:this,success:function(f){Ext.destroy(a);
var g=Ext.decode(f.responseText);var e=g["dbStatus"];if(e!=null&&e=="userCreated"){c["dbStatus"]=e;this.TablesCreation(c);Ext.getCmp("dbIconSuccess").show();Ext.getCmp("dbIconFailed").hide();}else{Ext.getCmp("dbIconSuccess").hide();Ext.getCmp("dbIconFailed").show();Ext.getCmp("mainContainer").hide();
Ext.getCmp("resultContainer").show();var d=Ext.getCmp("tablecreationresWrongCont");if(g["eG Manager Configuration"]!=null&&g["eG Manager Configuration"].indexOf("The eG Database password you have provided does not meet the Windows complex password policy requirements")>-1){Ext.get("usercreationresWrong").update('<div class="errorWhileInstallText">Error while creating the eG database user.');
d.setHeight(225);}else{Ext.get("usercreationresWrong").update('<div class="errorWhileInstallText">Error while creating the eG database user.</div>');}Ext.get("tabcreationresWrong").update('<div style="align:left">'+g["eG Manager Configuration"]+"</div>");Ext.getCmp("topResultHideWrong").show();Ext.getCmp("topResultHideRight").hide();
Ext.getCmp("fileUploadForm").hide();Ext.getCmp("licenceMsg").hide();Ext.getCmp("fileUpladBotn").hide();Ext.getCmp("res_button").show();Ext.getCmp("upldLicence").hide();}},failure:function(){Ext.destroy(a);alert("Database user creation request timed out. please check "+paramDecode(mgrLogPath));}});},TablesCreation:function(c){var b=Ext.urlEncode(c);
var a=new Ext.LoadMask(Ext.get(this.getMain().id),{cls:"windowModal",msg:"Tables creation is in progress, please wait..."});a.show();Ext.Ajax.request({url:"/final/servlet/com.eg.EgDbCreationController",method:"POST",params:b,timeout:ajaxTimeOutFrequency,scope:this,success:function(e){Ext.destroy(a);var f=Ext.decode(e.responseText);
var d=f["dbStatus"];if(d!=null&&d=="tablesCreated"){c["dbStatus"]=d;b=Ext.urlEncode(c);this.setupConfigure(b);Ext.getCmp("dbIconSuccess").show();Ext.getCmp("dbIconFailed").hide();}else{Ext.getCmp("dbIconSuccess").hide();Ext.getCmp("dbIconFailed").show();Ext.getCmp("mainContainer").hide();Ext.getCmp("resultContainer").show();
Ext.get("usercreationresWrong").update('<div class="errorWhileInstallText">Error while creating the eG database user.</div>');Ext.get("tabcreationresWrong").update('<div style="width:500px;text-align:center;margin-top: 0px;" class="dbfont_normal12">'+f["eG Manager Configuration"]+"</div>");Ext.getCmp("topResultHideWrong").show();
Ext.getCmp("topResultHideRight").hide();Ext.getCmp("fileUploadForm").hide();Ext.getCmp("licenceMsg").hide();Ext.getCmp("fileUpladBotn").hide();Ext.getCmp("res_button").show();Ext.getCmp("upldLicence").hide();}},failure:function(){Ext.destroy(a);alert("Database tables creation request timed out. please check "+paramDecode(mgrLogPath));
}});},setupConfigure:function(b){var a=new Ext.LoadMask(Ext.get(this.getMain().id),{cls:"windowModal",msg:"Configuring tomcat is in progress, please wait..."});a.show();Ext.Ajax.request({url:"/final/servlet/com.eg.EgDbCreationController",method:"POST",params:b,timeout:ajaxTimeOutFrequency,scope:this,success:function(c){Ext.destroy(a);
var d=Ext.decode(c.responseText);Ext.getCmp("mainContainer").hide();if(d["tablesCreated"].indexOf("dbIconTick")>-1&&d["eG Manager Configuration"].indexOf("dbIconTick")>-1){if(!Ext.isEmpty(d["isEvalEdition"])&&d["isEvalEdition"]=="true"){Ext.Msg.show({title:"DB Partition Confirmation",msg:"The Database Partitioning feature is available for an eG database configured on a Microsoft SQL server. Do you wish to enable this feature for the eG database? If yes, then please remember that henceforth, you should explicitly turn on this feature every time you upgrade the Microsoft SQL server that is hosting the eG database.",icon:"iconConfirmation",buttons:Ext.Msg.YESNO,width:800,height:500,fn:function(e){if(e=="no"){var f=Ext.getCmp("hidden_dbfield").getValue();
Ext.Ajax.request({url:"/final/servlet/com.eg.EgDbCreationController?disablePartition=true",method:"POST",timeout:ajaxTimeOutFrequency,scope:this,failure:function(g){console.log("Timeout : Issue in updating partition flag");}});}}});}if(!Ext.isEmpty(d["isPartitionEnableCheck"])&&d["isPartitionEnableCheck"]=="true"){Ext.Msg.show({title:"DB Partition Confirmation",msg:"Is DB Partitioning feature supported in this DB License?",icon:"iconConfirmation",buttons:Ext.Msg.YESNO,closable:false,width:800,height:500,fn:function(e){if(e=="no"){var f=Ext.getCmp("hidden_dbfield").getValue();
Ext.Ajax.request({url:"/final/servlet/com.eg.EgDbCreationController?disablePartition=true",method:"POST",timeout:ajaxTimeOutFrequency,scope:this,failure:function(g){console.log("Timeout : Issue in updating partition flag");}});}}});}Ext.getCmp("mgrConfigContainer").show();}else{Ext.getCmp("resultContainer").show();
Ext.getCmp("dbIconSuccess").hide();Ext.getCmp("dbIconFailed").show();Ext.get("usercreationresWrong").update('<div class="errorWhileInstallText">Error while creating the eG database tables.</div>');Ext.get("tabcreationresWrong").update('<div style="width:500px;text-align:center;margin-top: 0px;" class="dbfont_normal12">'+d["eG Manager Configuration"]+"</div>");
Ext.getCmp("topResultHideWrong").show();Ext.getCmp("topResultHideRight").hide();Ext.getCmp("fileUploadForm").hide();Ext.getCmp("licenceMsg").hide();Ext.getCmp("fileUpladBotn").hide();Ext.getCmp("res_button").show();Ext.getCmp("upldLicence").hide();}},failure:function(){Ext.destroy(a);alert("Database tables creation request timed out. please check "+paramDecode(mgrLogPath));
}});},backForm:function(){Ext.getCmp("resultContainer").hide();Ext.getCmp("mainContainer").show();},clearForm:function(){if(Ext.getCmp("hidden_dbfield").getValue()=="mssql"){var a=this.getDbserversettings().getForm();a.findField("ip").setValue();a.findField("namedinstances").setValue({useinstance:"no"});
a.findField("port").setValue(1433);a.findField("ntlmv").setValue({ntlmv2:"false"});a.findField("ssl_enab").setValue({ssl_enable:"false"});a.findField("create_newdb").setValue({db_sel:"yes"});if(!Ext.isEmpty(a.findField("instanceid"))){a.findField("instanceid").setValue();}a.findField("dbname").setValue();
a.findField("mdbusername").setValue();a.findField("mdbpassword").setValue();a.findField("confmdbpassword").setValue();if(!Ext.isEmpty(a.findField("dbausername"))){a.findField("dbausername").setValue();a.findField("dbapassword").setValue();a.findField("confdbapassword").setValue();}if(!Ext.isEmpty(a.findField("user_Domain"))){a.findField("user_Domain").setValue();
}if(!Ext.isEmpty(a.findField("admin_User_Domain"))){a.findField("admin_User_Domain").setValue();}}else{var a=this.getOracleview().getForm();a.findField("ipOra").setValue();a.findField("portOra").setValue(1521);a.findField("instanceidOra").setValue();a.findField("mdbusernameOra").setValue();a.findField("mdbpasswordOra").setValue();
a.findField("confmdbpasswordOra").setValue();a.findField("temporarytabspaceOra").setValue("temp");a.findField("defaulttabspaceOra").setValue("users");a.findField("create_newdbOra").setValue({db_selOra:"yes"});a.findField("dbausernameOra").setValue();a.findField("dbapasswordOra").setValue();a.findField("confdbapasswordOra").setValue();
}},clearSelDbFields:function(){var a=this.getDbserversettings().getForm();if(!Ext.isEmpty(a.findField("instanceid"))){var c=a.findField("instanceid").setValue();}var d=a.findField("dbname").setValue();var f=a.findField("mdbusername").setValue();var b=a.findField("mdbpassword").setValue();if(!Ext.isEmpty(a.findField("temporarytabspace"))){var h=a.findField("temporarytabspace").setValue();
var i=a.findField("defaulttabspace").setValue();}if(!Ext.isEmpty(a.findField("dbausername"))){var e=a.findField("dbausername").setValue();var g=a.findField("dbapassword").setValue();}},validate:function(p){var g;if(this.hostValidation()&&this.portValidation()){if(Ext.getCmp("hidden_dbfield").getValue()=="mssql"){var r=p.findField("dbname").getValue().trim();
var i=p.findField("mdbusername").getValue().trim();var h=p.findField("mdbpassword").getValue().trim();var j=p.findField("confmdbpassword").getValue().trim();var b=p.findField("dbausername").getValue().trim();var n=p.findField("dbapassword").getValue().trim();var d=p.findField("confdbapassword").getValue().trim();
var q=p.findField("instanceid").getValue().trim();var c="`~!@#$%^&()+={}[]|;<>,?'";var o=p.findField("ntlmv").getValue().ntlmv2;if(Ext.isEmpty(q)&&(Ext.getCmp("namedinstances").getValue().useinstance=="yes")){g="Please enter "+p.findField("instanceid").getFieldLabel();p.findField("instanceid").focus(false,100);
}else{if(!Ext.isEmpty(q)&&(Ext.getCmp("namedinstances").getValue().useinstance=="yes")&&!checkspecial(q,"`~!@#$%^&*()+={}[]|\\;\"'<>,?")){g="Please enter valid "+p.findField("instanceid").getFieldLabel()+"; Special characters are not allowed.";p.findField("instanceid").focus(false,100);}else{if(Ext.isEmpty(r)){g="Please enter "+Ext.getCmp("dbname").getFieldLabel();
p.findField("dbname").focus(false,100);}else{if(!Ext.isEmpty(r)&&checkSqlDBName(r)!="success"){var f=checkSqlDBName(r);if(f.length>2){g="Special characters "+f+" are not allowed. Please enter valid "+Ext.getCmp("dbname").getFieldLabel();}else{g="Special character "+f+" is not allowed. Please enter valid "+Ext.getCmp("dbname").getFieldLabel();
}p.findField("dbname").focus(false,100);}else{if(!Ext.isEmpty(r)&&r.length>128){g="Please enter valid "+Ext.getCmp("dbname").getFieldLabel()+". Maximum 128 characters are supported.";p.findField("dbname").focus(false,100);}else{if(Ext.isEmpty(i)){g="Please enter eG database username";p.findField("mdbusername").focus(false,100);
}else{if(!Ext.isEmpty(i)&&checkSqlUserName(i)!="success"){var f=checkSqlUserName(i);if(f.length>2){g="Special characters "+f+" are not allowed. Please enter valid eG database username";}else{g="Special character "+f+" is not allowed. Please enter valid eG database username";}p.findField("mdbusername").focus(false,100);
}else{if(!Ext.isEmpty(i)&&i.length>128){g="Please enter valid eG database username. Maximum 128 characters are supported.";p.findField("mdbusername").focus(false,100);}else{if(Ext.isEmpty(h)){g="Please enter eG database password";p.findField("mdbpassword").focus(false,100);}else{if(!Ext.isEmpty(h)&&checkSqlPass(h)!="success"){var f=checkSqlPass(h);
if(f.length>2){g="Special characters "+f+" are not allowed. Please enter valid eG database password";}else{g="Special character "+f+" is not allowed. Please enter valid eG database password";}p.findField("mdbpassword").focus(false,100);}else{if(Ext.isEmpty(j)){g="Please re-type eG database password";
p.findField("confmdbpassword").focus(false,100);}else{if(!Ext.isEmpty(j)&&checkSqlPass(j)!="success"){var f=checkSqlPass(j);if(f.length>2){g="Special characters "+f+" are not allowed. Please re-type valid eG database password";}else{g="Special character "+f+" is not allowed. Please re-type valid eG database password";
}p.findField("confmdbpassword").focus(false,100);}else{if(Ext.isEmpty(b)&&(p.findField("create_newdb").getValue().db_sel=="yes"||p.findField("create_newuser").getValue().cnewuser_sel=="yes")){g="Please enter DBA username";p.findField("dbausername").focus(false,100);}else{if(Ext.isEmpty(n)&&(p.findField("create_newdb").getValue().db_sel=="yes"||p.findField("create_newuser").getValue().cnewuser_sel=="yes")){g="Please enter DBA password";
p.findField("dbapassword").focus(false,100);}else{if(Ext.isEmpty(d)&&(p.findField("create_newdb").getValue().db_sel=="yes"||p.findField("create_newuser").getValue().cnewuser_sel=="yes")){g="Please re-type DBA password";p.findField("confdbapassword").focus(false,100);}else{if(!Ext.isEmpty(b)&&checkSqlUserName(b)!="success"){var f=checkSqlUserName(b);
if(f.length>2){g="Special characters "+f+" are not allowed. Please enter valid DBA username";}else{g="Special character "+f+" is not allowed. Please enter valid DBA username";}p.findField("dbausername").focus(false,100);}else{if(!Ext.isEmpty(b)&&b.length>128){g="Please enter valid DBA username; Max 128 characters supported.";
p.findField("dbausername").focus(false,100);}else{if(!Ext.isEmpty(n)&&checkSqlPass(n)!="success"){var f=checkSqlPass(n);if(f.length>2){g="Special characters "+f+" are not allowed. Please enter valid DBA password";}else{g="Special character "+f+" is not allowed. Please enter valid DBA password";}p.findField("dbapassword").focus(false,100);
}else{if(!Ext.isEmpty(d)&&checkSqlPass(d)!="success"){var f=checkSqlPass(d);if(f.length>2){g="Special characters "+f+" are not allowed. Please re-type valid DBA password";}else{g="Special character "+f+" is not allowed. Please re-type valid DBA password";}p.findField("confdbapassword").focus(false,100);
}else{if(h!=j){g="eG database password mismatch";p.findField("confmdbpassword").focus(false,100);}else{if(n!=d){g="DBA password mismatch";p.findField("confdbapassword").focus(false,100);}else{if(!Ext.isEmpty(i)){if(i=="sa"){g="Default user accounts are not allowed for eG database user";p.findField("mdbusername").focus(false,100);
}}}}}}}}}}}}}}}}}}}}}}}var m="";var l="";var e="";var a="";if(!Ext.isEmpty(p.findField("windowsAuthentic_enab_User"))){m=Ext.getCmp("windowsAuthentic_enab_User").getValue().windowsAuthentic_enable;if(m=="true"){if(!Ext.isEmpty(p.findField("user_Domain"))){e=p.findField("user_Domain").getValue();if(Ext.isEmpty(e)){g="Please enter eG Database Domain Name";
p.findField("user_Domain").focus(false,100);}}}}if(!Ext.isEmpty(p.findField("windowsAuthentic_enab_AdminUser"))){l=Ext.getCmp("windowsAuthentic_enab_AdminUser").getValue().windowsAuthentic_enable_AdminUser;if(l=="true"&&(p.findField("create_newdb").getValue().db_sel=="yes"||p.findField("create_newuser").getValue().cnewuser_sel=="yes")){if(!Ext.isEmpty(p.findField("admin_User_Domain"))){a=p.findField("admin_User_Domain").getValue();
if(Ext.isEmpty(a)){g="Please enter eG Database Domain Name";p.findField("admin_User_Domain").focus(false,100);}}}}if(m=="true"&&l=="true"){if(e!=a){g="Domain name mismatch";p.findField("admin_User_Domain").focus(false,100);}}if(!Ext.isEmpty(g)){var g=Ext.MessageBox.show({title:"Database creation",msg:'<div style="min-height:25px">'+g+"</div>",modal:true,maskCls:"windowModal",buttons:Ext.MessageBox.OK,icon:"iconExclamation",minWidth:320,maxWidth:550});
Ext.WindowManager.bringToFront(g);return false;}return true;}else{var i=p.findField("mdbusernameOra").getValue().trim();var h=p.findField("mdbpasswordOra").getValue().trim();var j=p.findField("confmdbpasswordOra").getValue().trim();var b=p.findField("dbausernameOra").getValue().trim();var n=p.findField("dbapasswordOra").getValue().trim();
var d=p.findField("confdbapasswordOra").getValue().trim();var q=p.findField("instanceidOra").getValue().trim();var k=p.findField("temporarytabspaceOra").getValue().trim();var s=p.findField("defaulttabspaceOra").getValue().trim();var c="`~!@#$%^&*()+={}[]|;<>,?'";if(Ext.isEmpty(q)){g="Please enter Oracle Database Instance name / Service name";
p.findField("instanceidOra").focus(false,100);}else{if(!Ext.isEmpty(q)&&!checkspecial(q,c+'"\\')){g="Please enter valid oracle database instance name / service name. Special characters are not allowed.";p.findField("instanceidOra").focus(false,100);}else{if(Ext.isEmpty(i)){g="Please enter eG database username";
p.findField("mdbusernameOra").focus(false,100);}else{if(!Ext.isEmpty(i)&&checkOracleUserName(i)!="success"){var f=checkOracleUserName(i);if(f.length>2){g="Special characters "+f+" are not allowed. Please enter valid eG database username";}else{g="Special character "+f+" is not allowed. Please enter valid eG database username";
}p.findField("dbausernameOra").focus(false,100);}else{if(!Ext.isEmpty(i)&&i.length>30){g="Please enter valid eG database username. Maximum 30 characters are supported.";p.findField("dbausernameOra").focus(false,100);}else{if(Ext.isEmpty(h)){g="Please enter eG database password";p.findField("mdbpasswordOra").focus(false,100);
}else{if(!Ext.isEmpty(h)&&checkOraclePass(h)!="success"){var f=checkOraclePass(h);if(f.length>2){g="Special characters "+f+" are not allowed. Please enter valid eG database password";}else{g="Special character "+f+" is not allowed. Please enter valid eG database password";}p.findField("mdbpasswordOra").focus(false,100);
}else{if(Ext.isEmpty(j)){g="Please  re-type eG database password";p.findField("confmdbpasswordOra").focus(false,100);}else{if(!Ext.isEmpty(j)&&checkOraclePass(j)!="success"){var f=checkOraclePass(j);if(f.length>2){g="Special characters "+f+" are not allowed. Please re-type valid eG database password";
}else{g="Special character "+f+" is not allowed. Please re-type valid eG database password";}p.findField("confmdbpasswordOra").focus(false,100);}else{if(Ext.isEmpty(k)){g="Please enter "+p.findField("temporarytabspaceOra").getFieldLabel();p.findField("temporarytabspaceOra").focus(false,100);}else{if(!Ext.isEmpty(k)&&!checkspecial(k,c+'"\\')){g="Please enter valid "+p.findField("temporarytabspaceOra").getFieldLabel()+". Special characters are not allowed.";
p.findField("temporarytabspaceOra").focus(false,100);}else{if(Ext.isEmpty(s)){g="Please enter "+p.findField("defaulttabspaceOra").getFieldLabel();p.findField("defaulttabspaceOra").focus(false,100);}else{if(!Ext.isEmpty(s)&&!checkspecial(s,c+'"\\')){g="Please enter valid "+p.findField("defaulttabspaceOra").getFieldLabel()+". Special characters are not allowed.";
p.findField("defaulttabspaceOra").focus(false,100);}else{if(Ext.isEmpty(b)&&(p.findField("create_newdbOra").getValue().db_selOra=="yes")){g="Please enter DBA username";p.findField("dbausernameOra").focus(false,100);}else{if(!Ext.isEmpty(b)&&checkOracleUserName(b)!="success"){var f=checkOracleUserName(b);
if(f.length>2){g="Special characters "+f+" are not allowed. Please enter valid DBA username";}else{g="Special character "+f+" is not allowed. Please enter valid DBA username";}p.findField("dbausernameOra").focus(false,100);}else{if(!Ext.isEmpty(b)&&b.length>30){g="Please enter valid DBA username. Maximum 30 characters are supported.";
p.findField("dbausernameOra").focus(false,100);}else{if(Ext.isEmpty(n)&&(p.findField("create_newdbOra").getValue().db_selOra=="yes")){g="Please enter DBA password";p.findField("dbapasswordOra").focus(false,100);}else{if(Ext.isEmpty(d)&&(p.findField("create_newdbOra").getValue().db_selOra=="yes")){g="Please  re-type DBA password";
p.findField("confdbapasswordOra").focus(false,100);}else{if(!Ext.isEmpty(n)&&checkOraclePass(n)!="success"){var f=checkOraclePass(n);if(f.length>2){g="Special characters "+f+" are not allowed. Please enter valid DBA password";}else{g="Special character "+f+" is not allowed. Please enter valid DBA password";
}p.findField("dbapasswordOra").focus(false,100);}else{if(!Ext.isEmpty(d)&&checkOraclePass(d)!="success"){var f=checkOraclePass(d);if(f.length>2){g="Special characters "+f+" are not allowed. Please re-type valid DBA password";}else{g="Special character "+f+" is not allowed. Please re-type valid DBA password";
}p.findField("confdbapasswordOra").focus(false,100);}else{if(h!=j){g="eG "+managerSmLabel+" database password mismatch";p.findField("confmdbpasswordOra").focus(false,100);}else{if(n!=d){g="DBA password mismatch";p.findField("confdbapasswordOra").focus(false,100);}else{if(!Ext.isEmpty(i)){if(i=="system"||i=="sys"){g="Default user accounts are not allowed for eG database user";
p.findField("mdbusernameOra").focus(false,100);}}}}}}}}}}}}}}}}}}}}}}}}if(!Ext.isEmpty(g)){var g=Ext.MessageBox.show({title:"Database creation",msg:'<div style="min-height:35px">'+g+"</div>",modal:true,maskCls:"windowModal",buttons:Ext.MessageBox.OK,icon:"iconExclamation",minWidth:320,maxWidth:550});
Ext.WindowManager.bringToFront(g);return false;}return true;}}else{return false;}},validateConnection:function(){var z=this;var f=Ext.getCmp("hidden_dbfield").getValue();var u;if(f=="mssql"){u=this.getDbserversettings().getForm();}else{u=this.getOracleview().getForm();}if(this.validate(u)){var d=new Array();
if(f=="mssql"){var s=Ext.getCmp("create_newdb").getValue().db_sel;var x=u.findField("dbname").getValue();var i=u.findField("ssl_enab").getValue().ssl_enable;var h=u.findField("namedinstances").getValue.useinstance;if(!Ext.isEmpty(u.findField("instanceid"))){var t=u.findField("instanceid").getValue();
}var j=u.findField("ip").getValue();var m=u.findField("port").getValue();var D;var B;var w;if(!Ext.isEmpty(u.findField("dbausername").getValue())){var v=u.findField("dbausername").getValue();B=v;}if(!Ext.isEmpty(u.findField("mdbusername").getValue())){var v=u.findField("mdbusername").getValue();w=v;}if(!Ext.isEmpty(u.findField("mdbpassword"))){var c=u.findField("mdbpassword").getValue();
}if(!Ext.isEmpty(u.findField("dbapassword"))){var o=u.findField("dbapassword").getValue();}var q="false";var n="false";if(!Ext.isEmpty(u.findField("windowsAuthentic_enab_User"))){q=Ext.getCmp("windowsAuthentic_enab_User").getValue().windowsAuthentic_enable;}if(!Ext.isEmpty(u.findField("windowsAuthentic_enab_AdminUser"))){n=Ext.getCmp("windowsAuthentic_enab_AdminUser").getValue().windowsAuthentic_enable_AdminUser;
}var p="false";var A="false";var k="false";if(q=="true"||n=="true"){if(!Ext.isEmpty(u.findField("ntlmv"))){p=u.findField("ntlmv").getValue().ntlmv2;}if(q=="true"){A="true";if(!Ext.isEmpty(u.findField("user_Domain"))){var g=u.findField("user_Domain").getValue();D=g;if(!Ext.isEmpty(D)&&D.indexOf(".")>0){var b=D.split(".");
D=b[0];}w=D+"\\"+w;}}if(n=="true"){k="true";if(!Ext.isEmpty(u.findField("admin_User_Domain"))){var a=u.findField("admin_User_Domain").getValue();D=a;if(!Ext.isEmpty(D)&&D.indexOf(".")>0){var b=D.split(".");D=b[0];}}}}else{D="none";}d["dbType"]=f;d["ip"]=j;d["port"]=m;d["instanceId"]=t;d["dbaUserName"]=B;
d["dbaPassword"]=o;d["mdbUserName"]=w;d["mdbPassword"]=c;d["isNtlmv"]=p;d["isSslEnabled"]=i;d["domain"]=D;d["dbName"]=x;d["isNewDb"]=s;d["isDBUserWindowsAuthentic"]=A;d["isAdminWindowsAuthentic"]=k;d["action"]="validateDb";}else{var j=u.findField("ipOra").getValue();var m=u.findField("portOra").getValue();
var t=u.findField("instanceidOra").getValue();var y=u.findField("create_newdbOra").getValue().db_selOra;var D;var B;var w;if(!Ext.isEmpty(u.findField("dbausernameOra").getValue())){var v=u.findField("dbausernameOra").getValue();if(v.indexOf("/")>0){var C=v.split("/");D=C[0];B=C[1];}else{if(v.indexOf("\\")>0){var C=v.split("\\");
D=C[0];B=C[1];}else{B=v;D="none";}}}if(!Ext.isEmpty(u.findField("mdbusernameOra").getValue())){var v=u.findField("mdbusernameOra").getValue();if(v.indexOf("/")>0){var C=v.split("/");D=C[0];w=C[1];}else{if(v.indexOf("\\")>0){var C=v.split("\\");D=C[0];w=C[1];}else{w=v;D="none";}}}if(!Ext.isEmpty(u.findField("mdbpasswordOra"))){var c=u.findField("mdbpasswordOra").getValue();
}if(!Ext.isEmpty(u.findField("dbapasswordOra"))){var o=u.findField("dbapasswordOra").getValue();}d["dbType"]=f;d["ip"]=j;d["port"]=m;d["instanceId"]=t;d["dbaUserName"]=B;d["dbaPassword"]=o;d["mdbUserName"]=w;d["mdbPassword"]=c;d["isNtlmv"]=p;d["isSslEnabled"]=i;d["domain"]=D;d["isNewDb"]=y;d["action"]="validateDb";
}var l=Ext.getCmp("create_newdbOra").getValue().db_selOra;var r=Ext.urlEncode(d);var e=new Ext.LoadMask(Ext.get(this.getMain().id),{cls:"windowModal",msg:"Validation in progress, please wait ..."});e.show();Ext.Ajax.request({url:"/final/servlet/com.eg.EgDbCreationController",method:"POST",params:r,timeout:240000,scope:this,success:function(F){Ext.destroy(e);
var H=Ext.decode(F.responseText);var E="iconError";if(H["msg"]=="SQL settings have been validated successfully!"||H["msg"]=="Oracle settings have been validated successfully!"){E="iconSuccess";}var I="";if(H["msg"].indexOf("eG Database username/password is incorrect or User does not Exists")>-1||H["msg"].indexOf("eG Database User does not Exists")>-1){I=Ext.MessageBox.show({title:"Database creation",msg:'<div style="min-height:35px;">'+H["msg"]+"</div>",buttonText:{yes:"YES",no:"NO"},fn:function(J){if(J=="yes"){if(f=="mssql"){Ext.getCmp("dba_container").show();
Ext.getCmp("dbausername").focus(true);u.findField("create_newuser").setValue({cnewuser_sel:"yes"});}else{if(H["msg"].indexOf("eG Database User does not Exists")>-1){z.submitForm();}Ext.getCmp("dba_container_oracle").show();Ext.getCmp("dbausernameOra").focus(true);}}else{if(f=="mssql"){Ext.getCmp("mdbusername").focus(true);
if(s=="no"){Ext.getCmp("dba_container").hide();Ext.getCmp("dbausername").setValue("");Ext.getCmp("dbapassword").setValue("");Ext.getCmp("confdbapassword").setValue("");}}else{if(l=="no"){Ext.getCmp("dba_container_oracle").hide();Ext.getCmp("dbausernameOra").setValue("");Ext.getCmp("dbapasswordOra").setValue("");
Ext.getCmp("confdbapasswordOra").setValue("");}Ext.getCmp("mdbusernameOra").focus(true);}}},maskCls:"windowModal",icon:"iconExclamation"});}else{if(H["msg"].indexOf("Database does not exists")>-1||H["msg"].indexOf("unable to access database")>-1||H["msg"].indexOf("user is not able to access the database")>-1||H["msg"].indexOf("eG Database and user already exists")>-1||H["msg"].indexOf("eG Database already exists")>-1||H["msg"].indexOf("eG Database user already exists")>-1){I=Ext.MessageBox.show({title:"Database creation",msg:'<div style="min-height:35px;">'+H["msg"]+"</div>",buttonText:{yes:"YES",no:"NO"},maskCls:"windowModal",icon:"iconExclamation",fn:function(J){if(J=="yes"){if(f=="mssql"){if(!Ext.isEmpty(u.findField("dbausername").getValue())){z.submitForm();
}else{Ext.getCmp("dba_container").show();Ext.getCmp("dbausername").focus(true);u.findField("create_newuser").setValue({cnewuser_sel:"yes"});}}else{z.submitForm();}}else{if(f=="mssql"){if(H["msg"].indexOf("eG Database user already exists")>-1){Ext.getCmp("mdbusername").focus(true);}else{Ext.getCmp("dbname").focus(true);
}}else{Ext.getCmp("mdbusernameOra").focus(true);}}},});}else{if(H["msg"].indexOf("The eG Database user exists, but lacks privileges. Do you want to grant privileges and continue?")>-1){var G='<div style="min-height:35px;">'+H["msg"]+"</div>";I=Ext.MessageBox.show({title:"Database creation",msg:G,buttonText:{yes:"YES",no:"NO"},maskCls:"windowModal",icon:"iconExclamation",fn:function(J){if(J=="yes"){if(f=="mssql"&&s=="no"){Ext.getCmp("dba_container").show();
Ext.getCmp("dbausername").focus(true);u.findField("create_newuser").setValue({cnewuser_sel:"yes"});}}else{if(f=="mssql"&&s=="no"){Ext.getCmp("dba_container").hide();Ext.getCmp("mdbusername").focus(true);}}}});}else{I=Ext.MessageBox.show({title:"Database creation",msg:'<div style="min-height:35px;">'+H["msg"]+"</div>",buttons:Ext.MessageBox.OK,maskCls:"windowModal",icon:E,minWidth:350,maxwidth:500});
}}}Ext.WindowManager.bringToFront(I);Ext.destroy(z);Ext.destroy(u);},failure:function(){Ext.destroy(z);Ext.destroy(u);}});}},hostValidation:function(){var e;if(Ext.getCmp("hidden_dbfield").getValue()=="mssql"){e="ip";}else{e="ipOra";}var d=Ext.getCmp(e).getValue();var a=Ext.getCmp(e).focus(false,100);
var b=false;if(!Ext.isEmpty(d)){if(d.indexOf(".")==-1||d.indexOf(":")==-1){hostNm=true;}}if(!Ext.isEmpty(d)){if(!hostNm&&!validateIpAddress(d)){a.focus(true);return false;}else{if(hostNm&&!validateHostField(d)){a.focus(true);return false;}else{if(hostNm&&!checkspace(d)){a.focus(true);return false;}else{if(hostNm&&!checkspecial(d,"`~!@#$%^&*()+={}[]|\\;\"'<>,?")){a.focus(true);
return false;}}}}return true;}else{a.focus(true);var c=Ext.MessageBox.show({title:"Database creation",msg:'<div style="min-height:35px">Please enter the host name/ip address</div>',buttons:Ext.MessageBox.OK,maskCls:"windowModal",icon:"iconExclamation",minWidth:320});Ext.WindowManager.bringToFront(c);
return false;}},portValidation:function(){var c;if(Ext.getCmp("hidden_dbfield").getValue()=="mssql"){c="port";}else{c="portOra";}if(!Ext.isEmpty(Ext.getCmp(c).getValue())){var d=Ext.getCmp(c);var a=Ext.getCmp(c).getValue();var b;if(isNaN(a)&&a!="none"){b='Port value Must be a number or "none"';}else{if(!checknumber("+",a)&&a!="none"){b="Port number should be numerical or none";
}else{if(!checkfordecimal(a)){d.focus(true);return false;}else{if(a=="0"){b="Only valid integers are allowed for port number";}else{if(a>99999){b="Invalid port number";}else{if(!checkspace(a)){d.focus(true);return false;}}}}}}if(!Ext.isEmpty(b)){Ext.getCmp(c).focus(false,100);var e=Ext.MessageBox.show({title:"Database creation",msg:'<div style="min-height:35px">'+b+"</div>",buttons:Ext.MessageBox.OK,maskCls:"windowModal",icon:"iconExclamation"});
Ext.WindowManager.bringToFront(e);return false;}return true;}else{Ext.getCmp(c).focus(false,100);var e=Ext.MessageBox.show({title:"Database creation",msg:'<div style="min-height:35px">Please enter port number</div>',buttons:Ext.MessageBox.OK,maskCls:"windowModal",icon:"iconExclamation"});Ext.WindowManager.bringToFront(e);
return false;}},licenceUploadChange:function(){var a=Ext.getCmp("upldLicence").getValue().addlicense;if(a=="yes"){Ext.getCmp("licenceMsg").hide();Ext.getCmp("fileUploadForm").show();Ext.getCmp("fileUpladBotn").show();}else{if(a=="no"){Ext.getCmp("licenceMsg").show();Ext.getCmp("fileUploadForm").hide();
Ext.getCmp("fileUpladBotn").hide();}}},licenseUpload:function(){var b=this;var c=Ext.getCmp("FILE_0").getValue();var d=c;if(c!=null&&c!=""&&c!=undefined&&c!="undefined"){var d=String(c)+"";d=d.substring(d.lastIndexOf("\\")+1);if(d.indexOf(".")>-1||d.indexOf("license")!=0){Ext.Msg.show({title:"Database creation",msg:"Please upload valid license.",buttons:Ext.MessageBox.OK,maskCls:"windowModal",icon:"iconExclamation"});
}else{var a=Ext.getCmp("fileUploadForm").getForm();if(a.isValid()){a.submit({url:"/final/DbLicenseUploadJson.jsp",scope:this,async:true,waitMsg:"Upload is in progress, please wait...",method:"POST",waitTitle:"eG License Upload",enctype:"multipart/form-data",success:function(f,h){var g=h.response.responseText;
g=Ext.decode(g);var e=g["Success_Msg"];var i=g["ErrMsgsJson"];if(!Ext.isEmpty(g)){if(!Ext.isEmpty(i)){Ext.Msg.show({title:"Database creation",width:280,msg:i,icon:"iconError",buttons:Ext.Msg.OK});return;}else{if(!Ext.isEmpty(e)){Ext.Msg.show({title:"Database creation",width:280,msg:e,buttons:Ext.Msg.OK,icon:"iconSuccess",fn:function(){Ext.getCmp("topResultHideRight").hide();
Ext.getCmp("topResultHideWrong").hide();Ext.getCmp("reDirectMsg").show();Ext.getCmp("successCnt").show();Ext.getCmp("failureCnt1").hide();Ext.getCmp("failureCnt2").hide();Ext.getCmp("restartMgr").hide();Ext.getCmp("upldLicence").hide();Ext.getCmp("fileUploadForm").hide();Ext.getCmp("fileUpladBotn").hide();
Ext.getCmp("topResHideRight").hide();restartManagerMask=new Ext.LoadMask(Ext.get("main"),{cls:"windowModal",msg:"eG "+managerSmLabel+" is restarting, please wait..."});restartManagerMask.show();Ext.Ajax.request({url:"/final/servlet/com.eg.TomcatRestart",method:"POST",scope:this,success:function(j){console.log("starting thread in success");
b.restartManager();},failure:function(){console.log("starting thread in failure");b.restartManager();}});}});}}}Ext.destroy(c);},failure:function(e,f){restartManagerMask.hide();Ext.getCmp("licenceMsg").show();Ext.getCmp("fileUploadForm").hide();Ext.getCmp("upldLicence").setValue({addlicense:"no"});alert("Oops! Error while importing License, please check error_log file for more details.");
Ext.destroy(c);}});}}}else{Ext.Msg.show({title:"Database creation",msg:"Please select licence",buttons:Ext.MessageBox.OK,maskCls:"windowModal",icon:"iconExclamation"});}},restartManager:function(){var a=0;setTimeout(function(){task={run:function(){Ext.Ajax.request({url:"/final/eGDatabaseCreation.jsp",method:"POST",scope:this,autoAbort:true,success:function(b){window.location.href="/final/login";
},failure:function(){console.log("please wait for few seconds...");if(++a==mgrStartupIntervalCount){restartManagerMask.hide();}}});},interval:20000,repeat:mgrStartupIntervalCount};Ext.TaskManager.start(task);task=null;delete task;},120000);},loadManagerConfigurations:function(){Ext.Ajax.request({url:"/final/scripts/eGDBCreation/data/EgManagerModelJson.jsp",method:"POST",async:false,success:function(h){if(h.status==200&&!Ext.isEmpty(h.responseText)){var i=h.responseText;
publicMailSettingsJson=Ext.decode(i);}}});var f=publicMailSettingsJson["eGMgrModel"];if(!Ext.isEmpty(f)&&f.toLowerCase()=="msp"){Ext.getCmp("selfReg").show();Ext.getCmp("mgrModelMsp").setValue(true);var e=publicMailSettingsJson["enableCloudRegistration"];if(!Ext.isEmpty(e)&&(e.toLowerCase()=="false"||e.toLowerCase()=="no")){Ext.getCmp("selfRegNo").setValue(true);
}else{Ext.getCmp("selfRegYes").setValue(true);}var g=Ext.getCmp("selfRegYes").getGroupValue();if(!Ext.isEmpty(g)&&g.toLowerCase()=="no"){Ext.getCmp("selfRegMailId").hide();}else{Ext.getCmp("selfRegMailId").show();var c=publicMailSettingsJson["selfRegistrationMailID"];if(!Ext.isEmpty(c)){Ext.getCmp("selfRegMailId").setValue(c);
}}}else{Ext.getCmp("selfReg").hide();Ext.getCmp("selfRegMailId").hide();Ext.getCmp("mgrModelEnterprise").setValue(true);}var b=publicMailSettingsJson["EnableAuditlog"];if(!Ext.isEmpty(b)&&(b.toLowerCase()=="yes"||b.toLowerCase()=="true")){Ext.getCmp("yesEnableAuditlog").setValue(true);}else{Ext.getCmp("noEnableAuditlog").setValue(true);
}Ext.getCmp("minLen").setValue(publicMailSettingsJson["pwdMinLength"]);this.setPasswordComplexity(publicMailSettingsJson["pwdComplexity"]);this.initializeFields();var d=publicMailSettingsJson["strUser"];if(d!=null&&!Ext.isEmpty(d)&&d.length>0){Ext.getCmp("smtpauthenticationyes").setValue(true);Ext.getCmp("smtpuser").show();
Ext.getCmp("smtppasssword").show();Ext.getCmp("smtpconfirmpasssword").show();Ext.getCmp("smtpuser").setValue(d);Ext.getCmp("smtppasssword").setValue(publicMailSettingsJson["strPwd"]);Ext.getCmp("smtpconfirmpasssword").setValue(publicMailSettingsJson["strPwd"]);}else{Ext.getCmp("smtpuser").hide();Ext.getCmp("smtppasssword").hide();
Ext.getCmp("smtpconfirmpasssword").hide();}var a=publicMailSettingsJson["mailReceiver"];if(a!=null&&!Ext.isEmpty(a)&&a.length>0){Ext.getCmp("mailauthenticationyes").setValue(true);Ext.getCmp("mailrcvId").show();Ext.getCmp("mailrcvpwd").show();Ext.getCmp("portforrcvmail").show();Ext.getCmp("protocolforrcvmail").show();
Ext.getCmp("serverforrcvmail").show();Ext.getCmp("mailrcvId").setValue(a);Ext.getCmp("mailrcvpwd").setValue(publicMailSettingsJson["mailReceiverPasswd"]);Ext.getCmp("portforrcvmail").setValue(publicMailSettingsJson["mailRcvPort"]);Ext.getCmp("protocolforrcvmail").setValue(publicMailSettingsJson["mailRcvProtocol"]);
Ext.getCmp("serverforrcvmail").setValue(publicMailSettingsJson["mailRcvServer"]);}else{Ext.getCmp("mailrcvId").hide();Ext.getCmp("mailrcvpwd").hide();Ext.getCmp("portforrcvmail").hide();Ext.getCmp("protocolforrcvmail").hide();Ext.getCmp("serverforrcvmail").hide();}if(!Ext.isEmpty(publicMailSettingsJson["strHost"])){Ext.getCmp("smtpmailhost").setValue(publicMailSettingsJson["strHost"]);
Ext.getCmp("validateBtn").show();}else{Ext.getCmp("validateBtn").hide();}if(publicMailSettingsJson["strPort"]==""){publicMailSettingsJson["strPort"]=25;}Ext.getCmp("smtpmailport").setValue(publicMailSettingsJson["strPort"]);Ext.getCmp("egadminmailId").setValue(publicMailSettingsJson["strSender"]);Ext.getCmp("alternatemailid").setValue(publicMailSettingsJson["mailBuff"]);
Ext.getCmp("mailhomeurl").setValue(publicMailSettingsJson["mgrUrl"]);Ext.getCmp("mailhomeurlfield").hide();},initializeFields:function(){var c=this;var b=this.getFormitems().getForm();var a=publicMailSettingsJson["strProtocol"];if(a!=null&&a.length>0&&a!=""){c.setValueWithOptionInList(b,"mailProtocol",publicMailSettingsJson["protocolArray"],a);
}else{c.setValueWithOptionInList(b,"mailProtocol",publicMailSettingsJson["protocolArray"],"SMTP");}},setValueWithOptionInList:function(c,f,e,d){Ext.getCmp(f).getStore().loadRawData(e);Ext.getCmp(f).suspendEvents(false);var a=false;for(var b=0;b<e.length;b++){if(e[b].valueField==d&&!Ext.isEmpty(d)&&d!=null){Ext.getCmp(f).setValue(d);
a=true;}}if(!a){Ext.getCmp(f).setValue(e[0].valueField);}Ext.getCmp(f).resumeEvents();},radSmtpChange:function(){var a=Ext.getCmp("smtpauthenticationno").getValue();if(a==true){Ext.getCmp("smtpuser").hide();Ext.getCmp("smtppasssword").hide();Ext.getCmp("smtpconfirmpasssword").hide();}else{Ext.getCmp("smtpuser").show();
Ext.getCmp("smtppasssword").show();Ext.getCmp("smtpconfirmpasssword").show();}},radMailSetChange:function(){var a=Ext.getCmp("mailauthenticationno").getValue();if(a==true){Ext.getCmp("mailrcvId").hide();Ext.getCmp("mailrcvpwd").hide();Ext.getCmp("portforrcvmail").hide();Ext.getCmp("protocolforrcvmail").hide();
Ext.getCmp("serverforrcvmail").hide();}else{Ext.getCmp("mailrcvId").show();Ext.getCmp("mailrcvpwd").show();Ext.getCmp("portforrcvmail").show();Ext.getCmp("protocolforrcvmail").show();Ext.getCmp("serverforrcvmail").show();}},clearMailServersSettings:function(){Ext.getCmp("formitems").getForm().reset();
this.initializeFields();Ext.getCmp("validateBtn").hide();Ext.getCmp("clearBtn").hide();var a=Ext.getCmp("mgrModelEnterprise").getGroupValue();if(!Ext.isEmpty(a)&&a.toLowerCase()=="enterprise"){Ext.getCmp("mgrConfigUpdate").setDisabled(false);}},validationForMailServers:function(){var t=this;if(getBtnId=="validateBtn"){Validate=true;
}else{Validate=false;}var l=Ext.getCmp("smtpmailhost").getValue();var g=Ext.getCmp("smtpmailport").getValue();var x=Ext.getCmp("smtpuser").getValue();var f=Ext.getCmp("smtppasssword").getValue();var n=Ext.getCmp("alternatemailid").getValue();var w=Ext.getCmp("egadminmailId").getValue();var k=true;var b;
if(n.length>0){var d=n.replace("\r","").split("\n");for(var v=0;v<d.length&&d[v]!="";v++){var s=trim(d[v]);b=validateEmail(s);if(!validateSingleByte(d[v])){Ext.Msg.show({title:PageTitle,msg:singleByte_mailIds,icon:"iconExclamation",buttons:Ext.Msg.OK,fn:function(i){Ext.getCmp("alternatemailid").focus(true);
}});k=false;return;}else{if(b==null||b==undefined||b==false){Ext.Msg.show({title:PageTitle,msg:alternate_mailId+".",icon:"iconExclamation",buttons:Ext.Msg.OK,fn:function(i){Ext.getCmp("alternatemailid").focus(true);}});k=false;break;}}}}var e="0123456789 ";var c="abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ";
var r="";var o="";var u="false";var q=Ext.getCmp("mailProtocol").getValue();if(l!=""&&l.length>0){for(var p=0;p<l.length;p++){r=c.indexOf(l.charAt(p));o=e.indexOf(l.charAt(p));if(r>=1){u="true";break;}else{if(o>=1){u="false";break;}}}}if(!t.checkUserPwd()){return;}if(!t.receiverAuthentication()){return;
}var h=Ext.getCmp("egadminmailId").getValue();var j=validateEmail(h);var a=validateMailHostExtjs(l);if(!checkblank(l)){Ext.Msg.show({title:PageTitle,msg:mailHost_Bnk+".",icon:"iconExclamation",buttons:Ext.Msg.OK,fn:function(i){Ext.getCmp("smtpmailhost").focus(true);}});}else{if(checkspaceExtjs(g)=="17"){Ext.Msg.show({title:PageTitle,msg:_checkblank+".",icon:"iconExclamation",buttons:Ext.Msg.OK,fn:function(i){Ext.getCmp("smtpmailport").focus(true);
}});}else{if(!checkdots(g)){Ext.Msg.show({title:PageTitle,msg:mailPortDot+".",icon:"iconExclamation",buttons:Ext.Msg.OK,fn:function(i){Ext.getCmp("smtpmailport").focus(true);}});}else{if(checkSpecialExtjs(g,"`~!@#$%^&*()+={}[]|\\:;\"'<>,?/")=="7"){Ext.Msg.show({title:PageTitle,msg:_checkspecial+".",icon:"iconExclamation",buttons:Ext.Msg.OK,fn:function(i){Ext.getCmp("smtpmailport").focus(true);
}});}else{if(!checknumber("+",g)){Ext.Msg.show({title:PageTitle,msg:validMailPort,icon:"iconExclamation",buttons:Ext.Msg.OK,fn:function(i){Ext.getCmp("smtpmailport").focus(true);}});}else{if(checkfordecimalExtjs(g)=="18"){Ext.Msg.show({title:PageTitle,msg:_checkfordecimal,icon:"iconExclamation",buttons:Ext.Msg.OK,fn:function(i){Ext.getCmp("smtpmailport").focus(true);
}});}else{if(g=="0"){Ext.Msg.show({title:PageTitle,msg:validInt+".",icon:"iconExclamation",buttons:Ext.Msg.OK,fn:function(i){Ext.getCmp("smtpmailport").focus(true);}});}else{if(g>99999){Ext.Msg.show({title:PageTitle,msg:invalidPrt+".",icon:"iconExclamation",buttons:Ext.Msg.OK,fn:function(i){Ext.getCmp("smtpmailport").focus(true);
}});}else{if(checkSpecialExtjs(l,"`~!@#$%^&*()+={}[]|\\:;\"'<>,?/")=="7"){Ext.Msg.show({title:PageTitle,msg:_checkspecial+".",icon:"iconExclamation",buttons:Ext.Msg.OK,fn:function(i){Ext.getCmp("smtpmailhost").focus(true);}});}else{if(!validateSingleByte(l)){Ext.Msg.show({title:PageTitle,msg:mailHstDBL+".",icon:"iconExclamation",buttons:Ext.Msg.OK,fn:function(i){Ext.getCmp("smtpmailport").focus(true);
}});}else{if(!checkblank(w)){Ext.Msg.show({title:PageTitle,msg:mailRcv_valid+".",icon:"iconExclamation",buttons:Ext.Msg.OK,fn:function(i){Ext.getCmp("egadminmailId").focus(true);}});}else{if(!validateSingleByte(w)){Ext.Msg.show({title:PageTitle,msg:mailIDDBL+".",icon:"iconExclamation",buttons:Ext.Msg.OK,fn:function(i){Ext.getCmp("egadminmailId").focus(true);
}});}else{if(j==null||j==undefined||j==false){Ext.Msg.show({title:PageTitle,msg:mailRcv_valid+".",icon:"iconExclamation",buttons:Ext.Msg.OK,fn:function(i){Ext.getCmp("egadminmailId").focus(true);}});}else{if(w.indexOf(",")!=-1){Ext.Msg.show({title:PageTitle,msg:mail_valid+".",icon:"iconExclamation",buttons:Ext.Msg.OK,fn:function(i){Ext.getCmp("egadminmailId").focus(true);
}});}else{if(u=="true"){if(checkspaceExtjs(l)=="17"){Ext.Msg.show({title:PageTitle,msg:_checkblank+".",icon:"iconExclamation",buttons:Ext.Msg.OK,fn:function(i){Ext.getCmp("smtpmailhost").focus(true);}});}else{if(!checkdots(l)){Ext.Msg.show({title:PageTitle,msg:mailDot+".",icon:"iconExclamation",buttons:Ext.Msg.OK,fn:function(i){Ext.getCmp("smtpmailhost").focus(true);
}});}else{if(k){if(!Validate){return true;}else{t.validateMailSettings();}}}}}else{if(!checkdots(l)){Ext.Msg.show({title:PageTitle,msg:mailDot+".",icon:"iconExclamation",buttons:Ext.Msg.OK,fn:function(i){Ext.getCmp("smtpmailhost").focus(true);}});}else{if(a!="0"){if(a=="19"){Ext.Msg.show({title:PageTitle,msg:_validateMailHost+".",icon:"iconExclamation",buttons:Ext.Msg.OK,fn:function(i){Ext.getCmp("smtpmailhost").focus(true);
}});}else{if(a=="10"){Ext.Msg.show({title:PageTitle,msg:_checknum+".",icon:"iconExclamation",buttons:Ext.Msg.OK,fn:function(i){Ext.getCmp("smtpmailhost").focus(true);}});}}}else{if(checkspaceExtjs(l)=="17"){Ext.Msg.show({title:PageTitle,msg:_checkblank+".",icon:"iconExclamation",buttons:Ext.Msg.OK,fn:function(i){Ext.getCmp("smtpmailhost").focus(true);
}});}else{if(k){if(!Validate){return true;}else{t.validateMailSettings();}}}}}}}}}}}}}}}}}}}}},managerModelChange:function(){var a=Ext.getCmp("mgrModelEnterprise").getGroupValue();if(!Ext.isEmpty(a)&&a.toLowerCase()=="msp"){Ext.getCmp("selfReg").show();var b=Ext.getCmp("selfRegYes").getGroupValue();if(!Ext.isEmpty(b)&&b.toLowerCase()=="no"){Ext.getCmp("selfRegMailId").hide();
}else{Ext.getCmp("selfRegMailId").show();}Ext.getCmp("mailservsettingsfield").setTitle("<b>"+'<span style="color:red;">*</span> Mail Server Settings'+"</b>");Ext.getCmp("adminMailCont").setFieldLabel('<span style="color:red;">*</span> Mail ID for admin user');Ext.getCmp("mgrConfigUpdate").setDisabled(true);
}else{Ext.getCmp("selfReg").hide();Ext.getCmp("selfRegMailId").hide();Ext.getCmp("mailservsettingsfield").setTitle("<b>"+"Mail Server Settings"+"</b>");Ext.getCmp("adminMailCont").setFieldLabel("Mail ID for admin user");Ext.getCmp("mgrConfigUpdate").setDisabled(false);}},selfRegistrationChange:function(){var a=Ext.getCmp("selfRegYes").getGroupValue();
if(!Ext.isEmpty(a)&&a.toLowerCase()=="no"){Ext.getCmp("selfRegMailId").hide();}else{Ext.getCmp("selfRegMailId").show();}},validateMailSettings:function(){var i=Ext.getCmp("smtpmailhost").getValue();var l=Ext.getCmp("smtpmailport").getValue();var p=Ext.getCmp("mailProtocol").getValue();var h=Ext.getCmp("smtpuser").getValue();
var k=Ext.getCmp("smtppasssword").getValue();var m=Ext.getCmp("egadminmailId").getValue();var a=Ext.getCmp("mailrcvId").getValue();var e=Ext.getCmp("mailrcvpwd").getValue();var o=Ext.getCmp("portforrcvmail").getValue();var g=Ext.getCmp("protocolforrcvmail").getValue();var n=Ext.getCmp("serverforrcvmail").getValue();
var f;var d=Ext.getCmp("smtpauthenticationyes").getValue();if(d==true){f="true";}else{f="false";}var j;var c=Ext.getCmp("mailauthenticationyes").getValue();if(c==true){j="true";}else{j="false";}var b="/final/scripts/eGDBCreation/data/sendMailAlertJson.jsp?activeTabId=mailsmssettings";params="option=send&mailSenderHost="+i+"&mailport="+l+"&mailProtocol="+p+"&mailSender="+m+"&authentication="+f+"&mailUser="+encodeURIComponent(h,"UTF-8")+"&mailPassword="+encodeURIComponent(k,"UTF-8")+"&revSetConfig="+j+"&receiverId="+a+"&receiverPassword="+encodeURIComponent(e,"UTF-8")+"&receiverPort="+o+"&mailRecverProtocol="+encodeURIComponent(g,"UTF-8")+"&receiverHost="+n+"&currentDate="+new Date().getTime();
this.loadAlertDiv(b,params);},loadAlertDiv:function(b,d){var c=this;var a="<table width='100%' border='0' height='90px'><tr><td align=center valign=bottom><img src=/final/monitor/eg_images/indicator_medium.gif></td></tr><tr><td vlaign=top width='50%' style='text-align:center;font-size:12px'>"+validate+".</td></tr></table>";
Ext.widget("window",{extend:"Ext.panel.Panel",title:validate,listeners:{afterrender:function(){c.validateMailCredentials(b,d);}},closeAction:"destory",id:"validateVcenterServer",height:140,align:"center",width:350,padding:"5 10 10 10",modal:true,doClose:function(){this.destroy();},items:[{id:"resultContainerStr",border:false,height:128,style:{"text-align":"center"},html:a+".",}]}).show();
},validateMailCredentials:function(a,c){var b="";Ext.Ajax.request({url:a,params:c,method:"POST",success:function(d){var f=d.responseText;var e=Ext.getCmp("resultContainerStr");e.update(f);if(f.indexOf('class="iconRight"')>-1){Ext.getCmp("mgrConfigUpdate").setDisabled(false);}else{Ext.getCmp("mgrConfigUpdate").setDisabled(true);
}}});},checkUserPwd:function(){var e=Ext.getCmp("smtpauthenticationyes").getValue();if(e==true){var b=Ext.getCmp("smtpuser").getValue();var f=Ext.getCmp("smtppasssword").getValue();var c=Ext.getCmp("smtpconfirmpasssword").getValue();var a=true;var g=true;var d=checkSpecialExtjs(b,"*+=|:;\"'<>/[]?,");
if(isDouble=="false"){a=validateSingleByte(b);g=validateSingleByte(f);}if(b=="null"){Ext.Msg.show({title:PageTitle,msg:userField+".",icon:"iconExclamation",buttons:Ext.Msg.OK,fn:function(h){Ext.getCmp("smtpuser").focus(true);}});return false;}else{if(b==""){Ext.Msg.show({title:PageTitle,msg:userField_Blank+".",icon:"iconExclamation",buttons:Ext.Msg.OK,fn:function(h){Ext.getCmp("smtpuser").focus(true);
}});return false;}else{if(b!=null&&d=="7"){Ext.Msg.show({title:PageTitle,msg:_checkspecial+".",icon:"iconExclamation",buttons:Ext.Msg.OK,fn:function(h){Ext.getCmp("smtpuser").focus(true);}});return false;}else{if(b!=null&&trim(b)==""){Ext.Msg.show({title:PageTitle,msg:Field_Blank+".",icon:"iconExclamation",buttons:Ext.Msg.OK,fn:function(h){Ext.getCmp("smtpuser").focus(true);
}});return false;}else{if(b!=null&&b.indexOf("..")>-1){Ext.Msg.alert(_checkdots);Ext.getCmp("smtpuser").focus(true);return false;}else{if(b!=null&&b.indexOf("  ")>-1){Ext.Msg.alert(_checkSpaces);Ext.getCmp("smtpuser").focus(true);return false;}else{if(!a){Ext.Msg.show({title:PageTitle,msg:auth_userByte+".",icon:"iconExclamation",buttons:Ext.Msg.OK,fn:function(h){Ext.getCmp("smtpuser").focus(true);
}});return false;}else{if(f=="null"){Ext.Msg.show({title:PageTitle,msg:passField+".",icon:"iconExclamation",buttons:Ext.Msg.OK,fn:function(h){Ext.getCmp("smtppasssword").focus(true);}});return false;}else{if(f==""){Ext.Msg.show({title:PageTitle,msg:passField_Blank+".",icon:"iconExclamation",buttons:Ext.Msg.OK,fn:function(h){Ext.getCmp("smtppasssword").focus(true);
}});return false;}else{if(f!=c){Ext.Msg.show({title:PageTitle,msg:pass_Match+".",icon:"iconExclamation",buttons:Ext.Msg.OK,fn:function(h){Ext.getCmp("smtppasssword").focus(true);}});return false;}else{if(!checkspecialnomess(f,"'\"}~|")){Ext.Msg.show({title:PageTitle,msg:passNotBeUsed+".",icon:"iconExclamation",buttons:Ext.Msg.OK,fn:function(h){Ext.getCmp("smtppasssword").focus(true);
}});return false;}else{if(!g){Ext.Msg.show({title:PageTitle,msg:passwordByte+".",icon:"iconExclamation",buttons:Ext.Msg.OK,fn:function(h){Ext.getCmp("smtppasssword").focus(true);}});return false;}}}}}}}}}}}}return true;}else{return true;}},receiverAuthentication:function(){var d=Ext.getCmp("mailauthenticationyes").getValue();
if(d==true){var g=Ext.getCmp("mailrcvId").getValue();var f=validateEmail(g);var b=Ext.getCmp("portforrcvmail").getValue();var c=Ext.getCmp("mailrcvpwd").getValue();var a=Ext.getCmp("protocolforrcvmail").getValue();var e=Ext.getCmp("serverforrcvmail").getValue();if(!checkblank(g)){Ext.Msg.show({title:PageTitle,msg:mailRcv_Blank+".",icon:"iconExclamation",buttons:Ext.Msg.OK,fn:function(h){Ext.getCmp("mailrcvId").focus(true);
}});return false;}else{if(f==null||f==undefined||f==false){Ext.Msg.show({title:PageTitle,msg:mailRcv_valid+".",icon:"iconExclamation",buttons:Ext.Msg.OK,fn:function(h){Ext.getCmp("mailrcvId").focus(true);}});return false;}else{if(c=="null"){Ext.Msg.show({title:PageTitle,msg:mailRcvPass+".",icon:"iconExclamation",buttons:Ext.Msg.OK,fn:function(h){Ext.getCmp("mailrcvpwd").focus(true);
}});return false;}else{if(c==""){Ext.Msg.show({title:PageTitle,msg:RcvPass_Blank+".",icon:"iconExclamation",buttons:Ext.Msg.OK,fn:function(h){Ext.getCmp("mailrcvpwd").focus(true);}});return false;}else{if(!checkspecialnomess(c,"'\"}~|")){Ext.Msg.show({title:PageTitle,msg:RcvChPass+".",icon:"iconExclamation",buttons:Ext.Msg.OK,fn:function(h){Ext.getCmp("mailrcvpwd").focus(true);
}});return false;}else{if(!validateSingleByte(c)){Ext.Msg.show({title:PageTitle,msg:RcvPassByte+".",icon:"iconExclamation",buttons:Ext.Msg.OK,fn:function(h){Ext.getCmp("mailrcvpwd").focus(true);}});return false;}else{if(isNaN(b)){Ext.Msg.show({title:PageTitle,msg:"' "+b+" '  "+notValidNo+".",icon:"iconExclamation",buttons:Ext.Msg.OK,fn:function(h){Ext.getCmp("portforrcvmail").focus(true);
}});return false;}else{if(isValid(b)){Ext.Msg.show({title:PageTitle,msg:notValidPort+".",icon:"iconExclamation",buttons:Ext.Msg.OK,fn:function(h){Ext.getCmp("portforrcvmail").focus(true);}});return false;}else{if(a==""){Ext.Msg.show({title:PageTitle,msg:mailRcvPrt+".",icon:"iconExclamation",buttons:Ext.Msg.OK,fn:function(h){Ext.getCmp("protocolforrcvmail").focus(true);
}});return false;}else{if(!validateSingleByte(a)){Ext.Msg.show({title:PageTitle,msg:mailRcvPrtDBL+".",icon:"iconExclamation",buttons:Ext.Msg.OK,fn:function(h){Ext.getCmp("protocolforrcvmail").focus(true);}});return false;}else{if(!checkblank(e)){Ext.Msg.show({title:PageTitle,msg:mailSrv_bnk+".",icon:"iconExclamation",buttons:Ext.Msg.OK,fn:function(h){Ext.getCmp("serverforrcvmail").focus(true);
}});return false;}else{if(checkSpecialExtjs(e,"`~!@#$%^&*()+={}[]|\\:;\"'<>,?/")=="7"){Ext.Msg.show({title:PageTitle,msg:_checkspecial+".",icon:"iconExclamation",buttons:Ext.Msg.OK,fn:function(h){Ext.getCmp("serverforrcvmail").focus(true);}});return false;}else{if(!validateSingleByte(e)){Ext.Msg.show({title:PageTitle,msg:mailDBL+".",icon:"iconExclamation",buttons:Ext.Msg.OK,fn:function(h){Ext.getCmp("serverforrcvmail").focus(true);
}});return false;}else{if(!checkdots(e)){Ext.Msg.show({title:PageTitle,msg:mailDot+".",icon:"iconExclamation",buttons:Ext.Msg.OK,fn:function(h){Ext.getCmp("serverforrcvmail").focus(true);}});return false;}else{return true;}}}}}}}}}}}}}}}else{return true;}},setPasswordComplexity:function(d){var c;if(d.indexOf(",")>-1){c=d.split(",");
for(var b=0;b<c.length;b++){var a=c[b].toLowerCase();if(a=="lc"){Ext.getCmp("lowercase").setValue(true);}else{if(a=="uc"){Ext.getCmp("uppercase").setValue(true);}else{if(a=="dg"){Ext.getCmp("number").setValue(true);}else{if(a=="sp"){Ext.getCmp("specialchar").setValue(true);}}}}}}else{c=d.toString().toLowerCase();
if(c=="uc"){Ext.getCmp("uppercase").setValue(true);}else{if(c=="dg"){Ext.getCmp("number").setValue(true);}else{if(c=="sp"){Ext.getCmp("specialchar").setValue(true);}else{Ext.getCmp("lowercase").setValue(true);}}}}},pwdComplexityCheck:function(){var d=Ext.getCmp("minLen");var f=d.getValue();var b=Ext.getCmp("lowercase").getValue();
var a=Ext.getCmp("uppercase").getValue();var e=Ext.getCmp("number").getValue();var c=Ext.getCmp("specialchar").getValue();var g=0;if(b){g++;}if(a){g++;}if(e){g++;}if(c){g++;}if(f<g){return"false";}else{return"true";}},checkpwdpolicy:function(){var a=Ext.getCmp("minLen").getValue();if(a==null){return"1";
}else{if(a<2){return"2";}else{if(a>16){return"3";}else{return"true";}}}},getPasswordComplexity:function(){var c=Ext.getCmp("lowercase").getValue();var d=Ext.getCmp("uppercase").getValue();var e=Ext.getCmp("number").getValue();var b=Ext.getCmp("specialchar").getValue();var a="";if(c){a+="LC";}if(d){a+=","+"UC";
}if(e){a+=","+"DG";}if(b){a+=","+"SP";}if(a.indexOf(",")==0){a=a.substring(1);}return a;},managerConfigurationUpdate:function(){var y=Ext.getCmp("mgrConfigUpdate").getText();if(!Ext.isEmpty(y)&&y=="Next"){var P=Ext.getCmp("mgrModelEnterprise").getGroupValue();var l="no";if(!Ext.isEmpty(P)&&P.toLowerCase()=="msp"){l="yes";
}var e=Ext.getCmp("selfRegYes").getGroupValue();var r=Ext.getCmp("selfRegMailId").getValue();var J=new Ext.LoadMask(Ext.getBody(),{msg:"Updating..."});J.show();var D=/^(\+\d\d)?[0-9]+$/g;var N=/(((([\+]?([0-9]){4,15})|([\_\#]?([a-zA-Z0-9]+[\ \_\.\-\&\#]?)*[a-zA-Z0-9])+)\@[a-zA-Z0-9][\w\.-]*[a-zA-Z0-9]\.[a-zA-Z][a-zA-Z\.]*[a-zA-Z])|((\+\d\d)?[0-9]+))/g;
var g="";var v=true;var t=Ext.getCmp("mailTo").getValue();if(t!=null&&t!="undefined"){g=t;}var G=validateEmail(t);var o=t.match(D);var k=t.match(N);var a=validateEmail(r);var I=r.match(N);if(!Ext.isEmpty(r)&&a==false&&I!=r){Ext.Msg.show({title:PageTitle,msg:validMailID,buttons:Ext.Msg.OK,icon:"iconExclamation",fn:function(R){Ext.getCmp("selfRegMailId").focus(true);
}});J.hide();return;}if(!validateSingleByte(r)){Ext.Msg.show({title:PageTitle,msg:mailNotAllowed,buttons:Ext.Msg.OK,icon:"iconExclamation",fn:function(R){Ext.getCmp("selfRegMailId").focus(true);}});J.hide();return;}if(!Ext.isEmpty(P)&&P.toLowerCase()=="msp"){if(Ext.isEmpty(g)){Ext.Msg.show({title:PageTitle,msg:"Please enter mail ID for admin",buttons:Ext.Msg.OK,icon:"iconExclamation",fn:function(R){Ext.getCmp("mailTo").focus(true);
}});J.hide();return;}}if((g!="")&&(G==false&&o==null)&&(k!=t)){Ext.Msg.show({title:PageTitle,msg:validMailandMobileNo,buttons:Ext.Msg.OK,icon:"iconExclamation",fn:function(R){Ext.getCmp("mailTo").focus(true);}});J.hide();return;}if(!validateSingleByte(t)){Ext.Msg.show({title:PageTitle,msg:toNotAllowed,buttons:Ext.Msg.OK,icon:"iconExclamation",fn:function(R){Ext.getCmp("mailTo").focus(true);
}});J.hide();return;}if(v){if(!Ext.isEmpty(P)&&P.toLowerCase()=="msp"){if(g==""&&g.length==0){Ext.Msg.show({title:PageTitle,msg:"Please enter valid To mail id and/or mobile number",buttons:Ext.Msg.OK,icon:"iconExclamation",fn:function(R){Ext.getCmp("mailTo").focus(true);}});v=false;J.hide();return;}}}var Q=Ext.getCmp("yesEnableAuditlog").getGroupValue();
var x=Ext.getCmp("minLen");var f=x.getValue();var q=this.getPasswordComplexity();var u="true";var L=this.checkpwdpolicy();if(L!="true"){if(L=="1"){Ext.Msg.show({title:PageTitle,msg:noLenAlert,buttons:Ext.Msg.OK,icon:"iconExclamation",fn:function(R){x.focus();}});}else{if(L=="2"){Ext.Msg.show({title:PageTitle,msg:defMinLenAlert,buttons:Ext.Msg.OK,icon:"iconExclamation",fn:function(R){x.focus();
}});}else{if(L=="3"){Ext.Msg.show({title:pwdpolicyTitle,msg:maxLenAlert,buttons:Ext.Msg.OK,icon:"iconExclamation",fn:function(R){x.focus();}});}}}Ext.getCmp("minLen").focus();J.hide();u="false";return;}var n=this.pwdComplexityCheck();if(n!="true"){Ext.Msg.show({title:PageTitle,msg:minLenAlert,buttons:Ext.Msg.OK,icon:"iconExclamation",fn:function(R){x.focus();
}});J.hide();u="false";return;}if(u!="true"){J.hide();return;}var s=Ext.getCmp("smtppasssword").getValue();var h=Ext.getCmp("mailrcvpwd").getValue();var w=Ext.getCmp("smtpmailhost").getValue();var c=Ext.getCmp("smtpmailport").getValue();var j=Ext.getCmp("mailProtocol").getValue();var C=Ext.getCmp("egadminmailId").getValue();
var i=Ext.getCmp("alternatemailid").getValue();var H="";var O=Ext.getCmp("mailauthenticationyes").getValue();if(O==true){H="true";}else{H="false";}var b=Ext.getCmp("mailrcvId").getValue();var h=Ext.getCmp("mailrcvpwd").getValue();var z=Ext.getCmp("portforrcvmail").getValue();var d=Ext.getCmp("protocolforrcvmail").getValue();
var F=Ext.getCmp("serverforrcvmail").getValue();var A="";var M=Ext.getCmp("smtpauthenticationyes").getValue();if(M==true){A="true";}else{A="false";}var B=Ext.getCmp("smtpuser").getValue();var p=this;var m=true;if(!Ext.isEmpty(w)||!Ext.isEmpty(C)){m=p.validationForMailServers();}else{if(!Ext.isEmpty(P)&&P.toLowerCase()=="msp"){m=p.validationForMailServers();
}}if(m){J.hide();reqParams={"eGMgrModel":P,"selfRegYes":e,"selfRegMailId":r,"issueUUID":l,"tomailid":t,"EnableAuditlog":Q,"minLen":f,"pwdComplexity":q,"mailhost":w,"mailport":c,"mailprotocol":j,"authpassword":s,"MailReceiverPasswd":h,"mailsenders":i,"mailsender":C,"revSetConfig":H,"MailReceiver":b,"MailRcvPort":z,"MailRcvProtocol":d,"MailRcvServer":F,"authenticate":A,"user":B};
Ext.getCmp("egmgrmodel").hide();Ext.getCmp("mailservsettingsfield").hide();Ext.getCmp("mailhomeurlfield").show();Ext.getCmp("mgrConfigUpdate").setText("Update");Ext.getCmp("mgrConfigBack").show();}else{Ext.getCmp("mgrConfigBack").hide();J.hide();return;}}else{var E=Ext.getCmp("mailhomeurl").getValue();
if(!checkblank(E)){Ext.Msg.show({title:PageTitle,msg:"Please enter the URL",buttons:Ext.Msg.OK,icon:"iconExclamation",fn:function(R){Ext.getCmp("mailhomeurl").focus(true);}});return false;}else{if(!validateSingleUrl(E)){Ext.Msg.show({title:PageTitle,msg:"Please enter a valid URL",buttons:Ext.Msg.OK,icon:"iconExclamation",fn:function(R){Ext.getCmp("mailhomeurl").focus(true);
}});return false;}}var K="/final/scripts/eGDBCreation/data/EgManagerModelJsonp.jsp?mailHomeURL="+encodeURIComponent(E);var J=new Ext.LoadMask(Ext.getBody(),{msg:"Updating..."});J.show();Ext.Ajax.request({url:K,method:"POST",params:reqParams,success:function(S){var T=S.responseText;var R=Ext.decode(T);
if(R["success"]=="true"){J.hide();Ext.Msg.show({title:PageTitle,msg:"Manager configuration has been updated successfully",buttons:Ext.Msg.OK,icon:"iconInformation",fn:function(U){if(U=="ok"){Ext.getCmp("mgrConfigContainer").hide();Ext.getCmp("resultContainer").show();Ext.getCmp("dbIconSuccess").show();
Ext.getCmp("dbIconFailed").hide();Ext.get("usercreationresRight").update('<div class="congratsText">Congrats! The eG '+managerSmLabel+" has been installed successfully!</div>");Ext.get("usercreationresRight").show();Ext.get("tabcreationresRight").update('<div style=" " class="dbfont_normal12">'+"eG database has been created <br><img src='/final/images/clear.png' style='padding:0px 5px; margin-top:5px; vertical-align:middle' class='dbIconTick'/>"+"</div>");
Ext.get("trigcreationresRight").update('<div style=" " class="dbfont_normal12">'+"eG manager has been configured <br><img src='/final/images/clear.png' style='padding:0px 5px; margin-top:5px; vertical-align:middle' class='dbIconTick'/>"+"</div>");Ext.getCmp("topResultHideRight").show();Ext.getCmp("topResultHideWrong").hide();
Ext.getCmp("fileUploadForm").show();Ext.getCmp("licenceMsg").hide();Ext.getCmp("fileUpladBotn").show();Ext.getCmp("res_button").hide();Ext.getCmp("upldLicence").show();}}});}else{Ext.Msg.show({title:PageTitle,msg:"Failure while updating manager configuration"+".",icon:"iconExclamation",buttons:Ext.Msg.OK});
J.hide();return;}},failure:function(){J.hide();return;}});}}});function trim(f){f=f.toString();var c=/[^\s].*[^\s]/;var e=f.match(c);return e;}function validateEmail(e){var f=/(([\+]?([0-9]){4,15})|([\_\#]?([a-zA-Z0-9]+[\ \_\.\-\&\#]?)*[a-zA-Z0-9])+)\@[a-zA-Z0-9][\w\.-]*[a-zA-Z0-9]\.[a-zA-Z][a-zA-Z\.]*[a-zA-Z]/g;
if(e!=""){e=trim(e)+"";var c=e.match(f);if(c==null||c!=e){return false;}return true;}}function isValid(a){if(a.length==0||a.indexOf("0")==0){return"false";}if(parseInt(a)<=0){return"false";}}function validateSingleUrl(b){var a=/^(http|ftp|https)\:(\\\\|\/\/)([A-Za-z0-9]+(\.)*[A-Za-z0-9]*)+/;if(a.test(b)){return true;
}else{return false;}}