Ext.Msg.bodyPadding="0 0";Ext.Msg.cls="adminAlert";Ext.Msg.layout={type:"anchor",pack:"center",align:"center"};Ext.define("ExternalAgent.controller.Main",{extend:"Ext.app.Controller",views:["ExternalAgents","ExternalAgent","AssignExternalAgent","DeleteExternalAgents"],requires:["ExternalAgent.view.ExternalAgent","ExternalAgent.view.FileUploadForm","ExternalAgent.view.FileUpload"],refs:[{selector:"externalagents",ref:"externalagents"},{selector:"assignexternalagent",ref:"assignexternalagent"},{selector:"deleteexternalagents",ref:"deleteexternalagents"},{selector:"externalagent",ref:"externalagent"},{selector:"fileuploadform",ref:"fileuploadform"}],init:function(){appCnt=this;
this.buildMainData();this.control({"externalagents":{"afterrender":this.afterMainRender},'externalagents trigger[name="gridSearch"]':{"change":this.mainGridSearch},'externalagents button[id="addAgent"]':{"click":this.addAgent},'externalagents button[id="DeleteOver"]':{"click":this.deleteOver},'externalagent radio[id="clientemulyes"]':{"change":this.radChange},'externalagent button[id="UpdateBTN"]':{"click":this.addUpdate},'externalagents button[id="associateDissociate"]':{"click":this.associateDissociate},'externalagents button[id="dwnldAgent"]':{"click":this.dwnldAgent},'assignexternalagent combo[id="extAgent"]':{"select":this.comboFromFieldLoad},'assignexternalagent combo[id="otherExtAgent"]':{"select":this.comboToFieldLoad},'assignexternalagent button[id="UpdateBTN"]':{"click":this.updation},'assignexternalagent button[id="backbutton"]':{"click":this.backbutton},'deleteexternalagents button[id="deleteBtn"]':{"click":this.deletefun},'deleteexternalagents trigger[name="compsearch"]':{"change":this.mainFormEvent},'deleteexternalagents button[id="backDelbutton"]':{"click":this.backDelButton},'externalagents button[action="openPopupWin"]':{"click":this.openPopupWin},'fileupload button[action="bulkAgentAction"]':{click:this.bulkAgentAction}});
},buildMainData:function(){Ext.Ajax.request({url:"ExternalAgent/data/EgDispExtAgentsJson.jsp",method:"POST",async:false,success:function(a){if(a.status==200&&!Ext.isEmpty(a.responseText)){var b=a.responseText;publicJSON=Ext.decode(b);if(!Ext.isEmpty(publicJSON.exVarList)){var c=publicJSON.exVarList;ex_varStr=c.split(",");
}}}});},handleDeleteIconClick:function(d,c,b){var a=Ext.getCmp("gridDisplay").getStore().getAt(c);this.deleteTask(a,c);},handleEditIconClick:function(g,f,b){btnText="Edit";var e=Ext.getCmp("gridDisplay").getStore().getAt(f);var a=e.get("Hostname");var d=e.get("HostIP");var c=e.get("zoneLocation");var h=e.get("Clientemulation");
this.showEditWindow(a,d,h,c);},showEditWindow:function(a,f,g,d){Ext.widget("externalagent").show();Ext.getCmp("Hostname").setValue(a).disable();Ext.getCmp("Hostip").setValue(f);Ext.getCmp("zoneLocation").setValue(d);Ext.getCmp("UpdateBTN").setText("Update");Ext.getCmp("AddModView").setTitle(extModPageTitle);
this.getController("ExternalAgent.controller.AddExtCtrl").buildAddFieldData();rmtListStr=publicJSON["rmtAgentsArr"];var c=publicJSON["enableNickNameEdit"];if(c){Ext.getCmp("Hostname").setValue(a).enable();}Ext.getCmp("hostIpCt").setFieldLabel(publicJSON["screenLabels"]["admin.external.Host IP"]);Ext.getCmp("client").setFieldLabel(publicJSON["screenLabels"]["admin.external.Client emulation"]);
if(isClientEmulation=="false"){Ext.getCmp("client").hide();}else{Ext.getCmp("client").show();}var e=publicJSON["disableEmulation"];if(e=="yes"){Ext.getCmp("clientemulno").setValue(true);Ext.getCmp("clientemulyes").disable();}else{if(e=="no"){Ext.getCmp("clientemulyes").setValue(true);Ext.getCmp("clientemulno").disable();
}else{if(e=="none"){Ext.getCmp("clientemulno").enable();Ext.getCmp("clientemulyes").enable();Ext.getCmp("clientemulno").setValue(true);}}}var b=publicJSON["rmtnothaveagent"];if(b=="No"){Ext.getCmp("remoteagent").disable();Ext.getCmp("remoteagent").hide();}if(g=="Yes"){Ext.getCmp("clientemulyes").setValue(true);
Ext.getCmp("remoteagent").disable();Ext.getCmp("remoteagent").hide();}else{Ext.getCmp("clientemulno").setValue(true);Ext.getCmp("remoteagentno").setValue(true);}oldHostIp=publicJSON["hostValue"]["hostIPValue"];oldNickName=publicJSON["hostValue"]["hostNameValue"];old_emulate=publicJSON["old_emulate"];
this.radChange();},commonDelete:function(a,c){var b=this;Ext.Msg.show({title:"DELETE EXTERNAL AGENT",msg:deleteSingleAgntMsg+"'"+a+"'"+"?",icon:"iconConfirmation",buttons:Ext.Msg.YESNO,fn:function(e){if(e==="yes"){var d=new Ext.LoadMask(Ext.getBody(),{msg:"Updating..."});d.show();Ext.Ajax.request({url:"ExternalAgent/data/EgnewextagentspJson.jsp?mode=del&eagent="+encodeURIComponent(a),method:"POST",success:function(h){d.hide();
var l=h.responseText;publicJSON=Ext.decode(l);if(!Ext.isEmpty(l)&&h.status==200){var k=publicJSON["requestStatus"];if(k=="success"||k.indexOf("success")!=-1){var k=publicJSON["result"];var f=publicJSON["doubleAlert"];if(f!=undefined&&f=="true"){Ext.Msg.show({title:k["title"],msg:k["message1"],icon:"iconConfirmation",buttons:Ext.Msg.OKCANCEL,fn:function(n){if(n=="ok"){d.show();
Ext.Ajax.request({url:"RemoteAgent/data/EgnewremoteagentspJson.jsp?mode=del&eagent="+encodeURIComponent(a),method:"POST",success:function(p){d.hide();var r=p.responseText;publicJSON=Ext.decode(r);if(!Ext.isEmpty(r)&&p.status==200){var q=publicJSON["requestStatus"];if(q=="success"||q.indexOf("success")!=-1){var o=publicJSON["result"];
Ext.MessageBox.show({title:o["title"],msg:o["message1"],icon:"iconInformation",buttons:Ext.Msg.OK});}else{var q=publicJSON["error"];Ext.MessageBox.show({title:q["title"],msg:q["message1"],icon:"iconExclamation",buttons:Ext.Msg.OK});}}},failure:function(){d.hide();}});}}});}else{Ext.Msg.show({title:k["title"],msg:k["message1"],buttons:Ext.Msg.OK,icon:"iconInformation"});
}}else{var k=publicJSON["error"];Ext.MessageBox.show({title:k["title"],msg:k["message1"],icon:"iconExclamation",buttons:Ext.Msg.OK});}Ext.getCmp("gridSearch").setRawValue("");b.buildMainData();var j=publicJSON["gridExtAgents"];if(j==null||j.length==0){Ext.getCmp("gridSearch").disable();Ext.getCmp("associateDissociate").disable();
Ext.getCmp("gridDisplay").store.loadData("");Ext.getCmp("gridDisplay").getView().emptyText='<table align="center"><tr><td align="center" height="300"><table><tr><td align="center"><img src="/final/images/spacer.gif" class="iconInformation"></td></tr><tr><td align="center" class="commonErrorMsgText">'+noExtPrtDesc+".</td></tr></table></td></tr></table>";
Ext.getCmp("gridDisplay").getView().refresh();}else{Ext.getCmp("gridSearch").enable();Ext.getCmp("associateDissociate").enable();Ext.getCmp("gridDisplay").getStore().loadRawData(j);var g=Ext.getCmp("gridDisplay").getView();var m=g.headerCt;var i=m.child("gridcolumn[isCheckerHd]");if(i){i.el.removeCls(Ext.baseCSSPrefix+"grid-hd-checker-on");
}}}appCnt.buildMainData();var j=publicJSON["gridExtAgents"];Ext.getCmp("gridSearch").enable();Ext.getCmp("associateDissociate").enable();Ext.getCmp("gridDisplay").getStore().loadRawData(j);Ext.getCmp("gridSearch").setRawValue("");},failure:function(){d.hide();}});}}});},deleteTask:function(b,c){var a=b.get("Hostname");
this.commonDelete(a,c);},mainGridSearch:function(b){var a=Ext.getCmp("gridSearch").getValue();if(a==""||a.length==0){Ext.get("MyTrigger_0").setStyle("display","none");Ext.get("MyTrigger_1").setStyle("display","block");}else{Ext.get("MyTrigger_1").setStyle("display","none");Ext.get("MyTrigger_0").setStyle("display","block");
}Ext.Ajax.request({url:"ExternalAgent/data/EgDispExtAgentsJson.jsp?egTitleSearchStr="+encodeURIComponent(filterEncode(a)),method:"POST",success:function(c){if(c.status==200&&!Ext.isEmpty(c.responseText)){var e=c.responseText;publicJSON=Ext.decode(e);}var d=publicJSON["gridExtAgents"];Ext.getCmp("associateDissociate").enable();
if(d!=null&&d.length>0){Ext.getCmp("gridDisplay").store.loadData(publicJSON["gridExtAgents"]);}else{Ext.getCmp("gridDisplay").store.loadData("");Ext.getCmp("gridDisplay").getView().emptyText='<div class="egFlexCenterByColumnWise" style="height:98%"><div class="iconInformation"></div><div class="commonErrorMsgText" >'+noExtFound+".</div></div>";
Ext.getCmp("gridDisplay").getView().refresh();}}});},addAgent:function(a){btnText="Add";Ext.widget("externalagent").show();Ext.getCmp("UpdateBTN").setText("Add");Ext.getCmp("AddModView").setTitle(extAddPageTitle);this.getController("ExternalAgent.controller.AddExtCtrl").buildAddFieldData();this.getController("ExternalAgent.controller.AddExtCtrl").afterMainRender();
},openPopupWin:function(){Ext.widget("fileupload").show();},bulkAgentAction:function(){var e=this;var f=Ext.getCmp("FILE_0").getValue();var c=Ext.getCmp("bulkExtAgent").getValue().actionType;var b=addOrDeleteExtAgentInBulkTitle;if(c=="add"){b=addExtAgentInBulkTitle;}else{if(c=="delete"){b=deleteExtAgentInBulkTitle;
}}if(f!=null&&f!=""&&f!=undefined&&f!="undefined"){var d=f;d=d.substring(d.lastIndexOf(".")+1);if(d=="csv"){var a="";if(c=="add"){a="/final/servlet/com.egurkha.admin.EgCLIBulkActionController?action=addExtAgent";e.doAction(a);}else{if(c=="delete"){a="/final/servlet/com.egurkha.admin.EgCLIBulkActionController?action=deleteExtAgent";
Ext.Msg.show({title:b,msg:deleteSelected,buttons:Ext.Msg.YESNO,icon:"iconConfirmation",fn:function(g){if(g=="yes"){e.doAction(a);}}});}}}else{Ext.Msg.show({title:b,msg:selectValidFile,buttons:Ext.MessageBox.OK,icon:"iconExclamation"});}}else{Ext.Msg.show({title:b,msg:selectCompsListFile,buttons:Ext.MessageBox.OK,icon:"iconInformation"});
}},doAction:function(b){var e=this.getFileuploadform().getForm();var d=Ext.getCmp("bulkExtAgent").getValue().actionType;var c=addOrDeleteExtAgentInBulkTitle;if(d=="add"){c=addExtAgentInBulkTitle;}else{if(d=="delete"){c=deleteExtAgentInBulkTitle;}}if(e.isValid()){var a=new Ext.LoadMask("fileUpload",{msg:"Please wait..."});
a.show();e.submit({url:b,scope:this,async:true,method:"POST",enctype:"multipart/form-data",success:function(h,j){a.hide();var i=j.response.responseText;i=Ext.decode(i);var g=i["errorMsg"];var m=i["errorInfo"];var f=i["resultMsg"];var k=i["tempErrorMsg"];var l=i["ErrMsgsJson"];if(!Ext.isEmpty(i)){if(Ext.isEmpty(k)){if(!Ext.isEmpty(f)){Ext.Msg.show({title:c,msg:f,icon:"iconInformation",buttons:Ext.Msg.OK});
}else{if(!Ext.isEmpty(l)){Ext.Msg.show({title:c,msg:g,icon:"iconExclamation",buttons:Ext.Msg.OK});}else{if(!Ext.isEmpty(m)){Ext.Msg.show({title:c,msg:m,icon:"iconInformation",buttons:Ext.Msg.OK});}else{if(!Ext.isEmpty(g)){Ext.Msg.show({title:c,msg:g,icon:"iconExclamation",buttons:Ext.Msg.OK});}}}}}else{Ext.Msg.show({title:c,msg:k,icon:"iconExclamation",buttons:Ext.Msg.OK});
}}},failure:function(f,g){a.hide();Ext.Msg.show({title:c,msg:"Failure Notice",icon:"iconExclamation",buttons:Ext.Msg.OK});}});}},deleteOver:function(){var a=Ext.getCmp("DispHostName").getValue();window.location.href="ExternalAgent/data/EgnewextagentspJson.jsp?mode=del&eagent="+encodeURIComponent(a);},showAssignHosts:function(c,a){var b=Ext.getCmp(a);
var d=b.getStore().getAt(c);assignAgent=d.get("Hostname");Ext.getCmp("extviewport").removeAll();this.getController("ExternalAgent.controller.AssignExtCtrl").buildFieldData();Ext.getCmp("extviewport").add({xtype:"assignexternalagent"});this.getController("ExternalAgent.controller.AssignExtCtrl").buildGivenAgentData(assignAgent);
this.getController("ExternalAgent.controller.AssignExtCtrl").afterMainRender();},radChange:function(){var d=Ext.getCmp("clientemulyes").getValue();if(d==true){Ext.getCmp("remoteagent").disable();Ext.getCmp("remoteagent").hide();}else{var h=publicJSON["mode"];var c=publicJSON["rmtnothaveagent"];if(c=="No"){Ext.getCmp("remoteagent").hide();
}else{Ext.getCmp("remoteagent").enable();Ext.getCmp("remoteagent").show();}var g=Ext.getCmp("Hostname").getValue();var f=false;for(var b=0;b<rmtListStr.length;b++){var e=rmtListStr[b].trim();if(e==g){f=true;}}if((g.length>0)&&(ExtIpAgent==g||f)){Ext.getCmp("remoteagent").hide();}else{if(c=="No"){Ext.getCmp("remoteagent").hide();
}else{Ext.getCmp("remoteagent").enable();Ext.getCmp("remoteagent").show();}}}var a=Ext.getCmp("Hostname").getValue();if(a.toLowerCase()=="none"){Ext.getCmp("client").hide();Ext.getCmp("remoteagent").hide();}},addUpdate:function(c){var b=Ext.getCmp("Hostip").getValue();var h=Ext.getCmp("Hostname").getValue();
var i=(btnText!="Add")?"true":"false";var g=this;var j=g.validationForAddModify();if(i=="true"&&h.toLowerCase()=="none"){Ext.Msg.show({title:extPageTitle,msg:"You are not allowed to modify the existing nickname to eG reserved keyword '"+h+"'",icon:"iconExclamation",buttons:Ext.Msg.OK,fn:function(k){Ext.getCmp("Hostname").focus(true);
}});j=false;}var a=false;if(btnText!="Add"){if(oldHostIp!=null&&oldNickName!=null&&oldHostIp!=b&&oldNickName!=h){Ext.Msg.show({title:extPageTitle,msg:checkSingleEdit+".",icon:"iconExclamation",buttons:Ext.Msg.OK,fn:function(k){Ext.getCmp("Hostip").focus(true);}});j=false;}else{for(var e=0;e<rmtListStr.length;
e++){var d=rmtListStr[e].trim();if(d==oldNickName){a=true;}}}}if(j){if(oldNickName!=h){if(a){var f=Ext.getCmp("clientemulyes").getValue();if(f==true){Ext.Msg.show({title:extPageTitle,msg:clienabled1+".",icon:"iconExclamation",buttons:Ext.Msg.OK,fn:function(k){Ext.getCmp("Hostip").focus(true);}});}else{Ext.Msg.show({title:extPageTitle,msg:sameNameAlert1+". "+sameNameAlert2+". "+sameNameAlert3+".",buttons:Ext.Msg.YESNO,icon:"iconConfirmation",fn:function(k){if(k=="yes"){g.addUpdateProcess();
}}});}}else{g.addUpdateProcess();}}else{g.addUpdateProcess();}}},addUpdateProcess:function(){var n=this;var e=this;this.getController("ExternalAgent.controller.AddExtCtrl").buildAddFieldData();var o=Ext.getCmp("Hostip").getValue();var j=Ext.getCmp("Hostname").getValue();var p="";var r="";if(btnText=="Add"){p="NewAgnt";
r="null";}else{p="bmod";r="true";}var f="";var b=Ext.getCmp("remoteagentyes").getValue();if(b==true){f=true;}else{f=false;}var a="";var g=Ext.getCmp("clientemulyes").getValue();if(g==true){a="true";}else{a="false";}var h=null;var k=publicJSON["mode"];var m="";var q="";var d=Ext.getCmp("zoneLocation").getValue();
if(parent.isInternetAvailable&&!Ext.isEmpty(d)){Ext.Ajax.cors=true;Ext.Ajax.useDefaultXhrHeader=false;var c="https://maps.googleapis.com/maps/api/geocode/json?key="+google_map_key+"&address="+encodeURI(d)+"&sensor=true";Ext.Ajax.request({url:c,async:false,success:function(s,u){var v=s.responseText;var t=Ext.decode(v);
if(!Ext.isEmpty(t.results[0])){m=t.results[0].geometry.location.lat;q=t.results[0].geometry.location.lng;}},failure:function(s){console.log("failed---url->",c);}});}var l="";if(!Ext.isEmpty(m)&&!Ext.isEmpty(q)){l=r+"&remote="+f+"&mode="+k+"&hostip="+o+"&hostname="+encodeURI(j)+"&old_name="+encodeURIComponent(oldNickName)+"&old_ip="+oldHostIp+"&emulate="+a+"&old_emulate="+old_emulate+"&eagent="+h+"&Btype="+p+"&zonelocation="+d+"&lat_value="+m+"&lng_value="+q;
}else{l=r+"&remote="+f+"&mode="+k+"&hostip="+o+"&hostname="+encodeURI(j)+"&old_name="+encodeURIComponent(oldNickName)+"&old_ip="+oldHostIp+"&emulate="+a+"&old_emulate="+old_emulate+"&eagent="+h+"&Btype="+p+"&zonelocation="+d;}var i=publicJSON["OrgWithGivenNick"];if(i!=""&&i!=null&&i.length>0&&p=="NewAgnt"){Ext.Msg.show({title:extAddPageTitle,msg:nickShareMsg1+" ("+i+"). "+nickShareMsg2+". "+nickShareMsg3,buttons:Ext.Msg.OKCANCEL,icon:"iconConfirmation",fn:function(s){if(s=="ok"){l=l+"&OrgWithGivenNick="+i;
e.forwardGivenUrl1(l,o,j);}else{Ext.getCmp("AddModView").destroy();}}});}else{l=l;e.forwardGivenUrl1(l,o,j);}},forwardGivenUrl1:function(d,f,c){var b=publicJSON["OrgWithGivenNick"];var e=this;var g=this;var a=new Ext.LoadMask(Ext.getBody(),{msg:"Updating..."});a.show();Ext.Ajax.request({url:"ExternalAgent/data/EgnewextagentspJson.jsp?modify="+d,method:"POST",success:function(l){a.hide();
var h=l.responseText;publicJSON=Ext.decode(h);if(!Ext.isEmpty(h)&&l.status==200){var q=publicJSON["requestStatus"];if(q=="success"||q.indexOf("success")!=-1){var q=publicJSON["result"];var k=publicJSON["addToRemote"];var u=publicJSON["toRemoteMod"];if(k==undefined&&u==undefined){Ext.MessageBox.show({title:q["title"],msg:q["message1"],icon:"iconInformation",buttons:Ext.Msg.OK,width:400,fn:function(x){Ext.getCmp("AddModView").destroy();
}});}if(k!=null&&k=="true"){var o="";if(d.indexOf("OrgWithGivenNick")!=-1){o="mode=add&externalResultString=eG_CLI_0010&addAsRemote=true&hostip="+f+"&hostname="+encodeURIComponent(c)+"&OrgWithGivenNick="+b;}else{o="mode=add&externalResultString=eG_CLI_0010&addAsRemote=true&hostip="+f+"&hostname="+encodeURIComponent(c);
}a.show();Ext.Ajax.request({url:"RemoteAgent/data/EgnewremoteagentspJson.jsp?"+o,method:"POST",success:function(x){a.hide();var z=x.responseText;publicJSON=Ext.decode(z);if(!Ext.isEmpty(z)&&x.status==200){var y=publicJSON["requestStatus"];if(y=="success"||y.indexOf("success")!=-1){var y=publicJSON["result"];
Ext.MessageBox.show({title:y["title"],msg:y["message1"],icon:"iconInformation",buttons:Ext.Msg.OK,width:400,fn:function(A){Ext.getCmp("AddModView").destroy();}});}}},failure:function(){a.hide();}});}if(u!=null&&u=="true"){var w="";if(b!=null&&b.length>0){w="mode=add&addAsRemote=true&hostip="+f+"&hostname="+encodeURIComponent(c)+"&OrgWithGivenNick="+b;
}else{w="mode=add&addAsRemote=true&hostip="+f+"&hostname="+encodeURIComponent(c);}a.show();Ext.Ajax.request({url:"RemoteAgent/data/EgnewremoteagentspJson.jsp?"+w,method:"POST",success:function(x){a.hide();var z=x.responseText;publicJSON=Ext.decode(z);if(!Ext.isEmpty(z)&&x.status==200){var y=publicJSON["requestStatus"];
if(y=="success"||y.indexOf("success")!=-1){var y=publicJSON["result"];Ext.MessageBox.show({title:y["title"],msg:y["message1"],icon:"iconInformation",buttons:Ext.Msg.OK,fn:function(A){Ext.getCmp("AddModView").destroy();}});}}},failure:function(){a.hide();}});}}else{var i=publicJSON["error"];var n=publicJSON["notProperlyUpdated"];
var s=i["message1"];var r=i["message2"];var p=s;if(r!=null&&r!="undefined"){p+=r;}var v=publicJSON.error_type;if(v=="confirmNickSuggestion"){Ext.Msg.confirm({title:i["title"],msg:p,buttons:Ext.Msg.YESNO,icon:"iconConfirmation",fn:function(x){if(x=="yes"){var y=i.forward_URL;var A=i.IP;var z=i.nickName;
y="ExternalAgent/data/"+y;g.forwardGivenURL(y,A,z);}else{Ext.getCmp("Hostname").focus();}}});}else{if(n==undefined){Ext.MessageBox.show({title:i["title"],msg:p,buttons:Ext.Msg.OK,icon:"iconExclamation",fn:function(x){if(v=="alert"){Ext.getCmp("Hostname").focus();}else{Ext.getCmp("AddModView").destroy();
}}});}var m=publicJSON["AddSameAsRem"];if(m!=undefined&&m=="true"){Ext.Msg.show({title:i["title"],msg:i["message1"]+i["message2"]+".",icon:"iconExclamation",buttons:Ext.Msg.OKCANCEL,fn:function(x){if(x=="ok"){a.show();Ext.Ajax.request({url:"RemoteAgent/data/EgnewremoteagentspJson.jsp?mode=add&addAsRemote=true&hostip="+f+"&hostname="+encodeURI(c),method:"POST",success:function(z){a.hide();
var B=z.responseText;publicJSON=Ext.decode(B);if(!Ext.isEmpty(B)&&z.status==200){var A=publicJSON["requestStatus"];if(A=="success"||A.indexOf("success")!=-1){var y=publicJSON["result"];Ext.MessageBox.show({title:y["title"],msg:y["message1"],icon:"iconInformation",buttons:Ext.Msg.OK,fn:function(C){Ext.getCmp("AddModView").destroy();
}});}}},failure:function(){a.hide();}});}else{Ext.getCmp("AddModView").destroy();}}});}if(n!=null&&n=="true"){var t="mode=add&addAsRemote=true&hostip="+f+"&hostname="+encodeURIComponent(c);a.show();Ext.Ajax.request({url:"RemoteAgent/data/EgnewremoteagentspJson.jsp?"+t,method:"POST",success:function(x){a.hide();
var z=x.responseText;publicJSON=Ext.decode(z);if(!Ext.isEmpty(z)&&x.status==200){var y=publicJSON["requestStatus"];if(y=="success"||y.indexOf("success")!=-1){var y=publicJSON["result"];Ext.MessageBox.show({title:y["title"],msg:y["message1"],icon:"iconInformation",buttons:Ext.Msg.OK,fn:function(A){Ext.getCmp("AddModView").destroy();
}});}}},failure:function(){a.hide();}});}}}g.buildMainData();var j=publicJSON["gridExtAgents"];Ext.getCmp("gridSearch").enable();Ext.getCmp("associateDissociate").enable();Ext.getCmp("gridDisplay").getStore().loadRawData(j);Ext.getCmp("gridSearch").setRawValue("");}},failure:function(){a.hide();}});},forwardGivenURL:function(d,c,b){var e=this;
var a=new Ext.LoadMask(Ext.getBody(),{msg:"Updating..."});a.show();Ext.Ajax.request({url:d,method:"POST",success:function(j){a.hide();var f=j.responseText;publicJSON=Ext.decode(f);if(!Ext.isEmpty(f)&&j.status==200){var o=publicJSON["requestStatus"];if(o=="success"||o.indexOf("success")!=-1){var o=publicJSON["result"];
var i=publicJSON["addToRemote"];var s=publicJSON["toRemoteMod"];if(i==undefined&&s==undefined){Ext.MessageBox.show({title:o["title"],msg:o["message1"],icon:"iconInformation",buttons:Ext.Msg.OK,width:400,fn:function(u){Ext.getCmp("AddModView").destroy();}});}if(i!=null&&i=="true"){var m="mode=add&externalResultString=eG_CLI_0010&addAsRemote=true&hostip="+c+"&hostname="+encodeURIComponent(b);
a.show();Ext.Ajax.request({url:"RemoteAgent/data/EgnewremoteagentspJson.jsp?"+m,method:"POST",success:function(u){a.hide();var w=u.responseText;publicJSON=Ext.decode(w);if(!Ext.isEmpty(w)&&u.status==200){var v=publicJSON["requestStatus"];if(v=="success"||v.indexOf("success")!=-1){var v=publicJSON["result"];
Ext.MessageBox.show({title:v["title"],msg:v["message1"],icon:"iconInformation",buttons:Ext.Msg.OK,width:400,fn:function(x){Ext.getCmp("AddModView").destroy();}});}}},failure:function(){a.hide();}});}if(s!=null&&s=="true"){var t="mode=add&addAsRemote=true&hostip="+c+"&hostname="+encodeURIComponent(b);
a.show();Ext.Ajax.request({url:"RemoteAgent/data/EgnewremoteagentspJson.jsp?"+t,method:"POST",success:function(u){a.hide();var w=u.responseText;publicJSON=Ext.decode(w);if(!Ext.isEmpty(w)&&u.status==200){var v=publicJSON["requestStatus"];if(v=="success"||v.indexOf("success")!=-1){var v=publicJSON["result"];
Ext.MessageBox.show({title:v["title"],msg:v["message1"],icon:"iconInformation",buttons:Ext.Msg.OK,fn:function(x){Ext.getCmp("AddModView").destroy();}});}}},failure:function(){a.hide();}});}}else{var g=publicJSON["error"];var l=publicJSON["notProperlyUpdated"];var q=g["message1"];var p=g["message2"];var n=q;
if(p!=null&&p!="undefined"){n+=p;}if(l==undefined){Ext.MessageBox.show({title:g["title"],msg:n,buttons:Ext.Msg.OK,icon:"iconExclamation",fn:function(u){Ext.getCmp("AddModView").destroy();}});}var k=publicJSON["AddSameAsRem"];if(k!=undefined&&k=="true"){Ext.Msg.show({title:g["title"],msg:g["message1"]+g["message2"]+".",icon:"iconExclamation",buttons:Ext.Msg.OKCANCEL,fn:function(u){if(u=="ok"){a.show();
Ext.Ajax.request({url:"RemoteAgent/data/EgnewremoteagentspJson.jsp?mode=add&addAsRemote=true&hostip="+c+"&hostname="+encodeURI(b),method:"POST",success:function(w){a.hide();var y=w.responseText;publicJSON=Ext.decode(y);if(!Ext.isEmpty(y)&&w.status==200){var x=publicJSON["requestStatus"];if(x=="success"||x.indexOf("success")!=-1){var v=publicJSON["result"];
Ext.MessageBox.show({title:v["title"],msg:v["message1"],icon:"iconInformation",buttons:Ext.Msg.OK,fn:function(z){Ext.getCmp("AddModView").destroy();}});}}},failure:function(){a.hide();}});}else{Ext.getCmp("AddModView").destroy();}}});}if(l!=null&&l=="true"){var r="mode=add&addAsRemote=true&hostip="+c+"&hostname="+encodeURIComponent(b);
a.show();Ext.Ajax.request({url:"RemoteAgent/data/EgnewremoteagentspJson.jsp?"+r,method:"POST",success:function(u){a.hide();var w=u.responseText;publicJSON=Ext.decode(w);if(!Ext.isEmpty(w)&&u.status==200){var v=publicJSON["requestStatus"];if(v=="success"||v.indexOf("success")!=-1){var v=publicJSON["result"];
Ext.MessageBox.show({title:v["title"],msg:v["message1"],icon:"iconInformation",buttons:Ext.Msg.OK,fn:function(x){Ext.getCmp("AddModView").destroy();}});}}},failure:function(){a.hide();}});}}e.buildMainData();var h=publicJSON["gridExtAgents"];Ext.getCmp("gridSearch").enable();Ext.getCmp("associateDissociate").enable();
Ext.getCmp("gridDisplay").getStore().loadRawData(h);Ext.getCmp("gridSearch").setRawValue("");}},failure:function(){a.hide();}});},validationForAddModify:function(){var w=Ext.getCmp("Hostip").getValue();var l=Ext.getCmp("Hostname").getValue();var f=Ext.getCmp("zoneLocation").getValue();if(l.charAt(0)=="."||l.charAt(l.length-1)=="."){Ext.Msg.show({title:extPageTitle,msg:checkdots+".",icon:"iconExclamation",buttons:Ext.Msg.OK,fn:function(i){Ext.getCmp("Hostname").focus(true);
}});return false;}else{for(var q=0;q<l.length;q++){if(l.charAt(q)=="."&&l.charAt(q+1)=="."){Ext.MessageBox.show({title:extPageTitle,msg:checkconsecutivedots+".",icon:"iconExclamation",buttons:Ext.Msg.OK,fn:function(i){Ext.getCmp("Hostname").focus(true);}});return false;}else{continue;}}}var t=false;var g=/^(([0-9]+\.)+){3}[0-9]+$/;
var h=g.test(l);var n=true;if(isDouble=="false"){n=validateSingleByte(l);}if(btnText=="Add"){if(ex_varStr!=null){for(var r=0;r<ex_varStr.length;r++){var u=ex_varStr[r].trim();if(u.toLowerCase()==l.toLowerCase()){t=true;}}}}var x=commonValidationsExtjs(w);var v=validateIpExtjs(w);var m=validateHostFieldExtjs(w);
var y=checkspaceExtjs(w);var o=checkSpecialExtjs(w,"`~!@#$%^&*()+={}[]|;\"'<>,?/");var a=checkspaceExtjs(l);var b=checkSpecialExtjs(l,"`~!@#$%^&*()+={}[]|:;\"'<>,?\\/");var c=checkspaceExtjs(f);var e=checkSpecialExtjs(f,"`~!@#$%^&*()+={}[]|:;\"'<>,?\\/");var d=false;for(var s=0;s<intAgentsListStr.length;
s++){if(intAgentsListStr[s].trim()==l.trim()){d=true;break;}}if(!checkblank(w)){if(isAllowHostName=="false"){Ext.Msg.show({title:extPageTitle,msg:checkBlankIP+".",icon:"iconExclamation",buttons:Ext.Msg.OK,fn:function(i){Ext.getCmp("Hostip").focus(true);}});}else{Ext.Msg.show({title:extPageTitle,msg:checkBlankIPName+".",icon:"iconExclamation",buttons:Ext.Msg.OK,fn:function(i){Ext.getCmp("Hostip").focus(true);
}});}}else{if(x!="0"){var p=this.getRespectiveMsg(x);Ext.Msg.show({title:extPageTitle,msg:p+".",icon:"iconExclamation",buttons:Ext.Msg.OK,fn:function(i){Ext.getCmp("Hostip").focus(true);}});}else{if(isAllowHostName=="false"&&v!="0"){var p=this.getRespectiveMsg(v);Ext.Msg.show({title:extPageTitle,msg:p+".",icon:"iconExclamation",buttons:Ext.Msg.OK,fn:function(i){Ext.getCmp("Hostip").focus(true);
}});}else{if(isAllowHostName=="true"&&m!="0"){var p=this.getRespectiveMsg(m);Ext.Msg.show({title:extPageTitle,msg:p+".",icon:"iconExclamation",buttons:Ext.Msg.OK,fn:function(i){Ext.getCmp("Hostip").focus(true);}});return;}else{if(isAllowHostName=="true"&&y!="0"){var p=this.getRespectiveMsg(y);Ext.Msg.show({title:extPageTitle,msg:p+".",icon:"iconExclamation",buttons:Ext.Msg.OK,fn:function(i){Ext.getCmp("Hostip").focus(true);
}});}else{if(isAllowHostName=="true"&&o!="0"){var p=this.getRespectiveMsg(o);Ext.Msg.show({title:extPageTitle,msg:p+".",icon:"iconExclamation",buttons:Ext.Msg.OK,fn:function(i){Ext.getCmp("Hostip").focus(true);}});}else{if(!checkblank(l)){Ext.Msg.show({title:extPageTitle,msg:checkBlankHostName+".",icon:"iconExclamation",buttons:Ext.Msg.OK,fn:function(i){Ext.getCmp("Hostname").focus(true);
}});}else{if(a!="0"){var p=this.getRespectiveMsg(a);Ext.Msg.show({title:extPageTitle,msg:p+".",icon:"iconExclamation",buttons:Ext.Msg.OK,fn:function(i){Ext.getCmp("Hostname").focus(true);}});}else{if(b!="0"){var p=this.getRespectiveMsg(b);Ext.Msg.show({title:extPageTitle,msg:p+".",icon:"iconExclamation",buttons:Ext.Msg.OK,fn:function(i){Ext.getCmp("Hostname").focus(true);
}});}else{if(h&&w!=l){Ext.Msg.show({title:extPageTitle,msg:hostNameIsIP+".",icon:"iconExclamation",buttons:Ext.Msg.OK,fn:function(i){Ext.getCmp("Hostname").focus(true);}});}else{if(!n){Ext.Msg.show({title:extPageTitle,msg:checkDBL+".",icon:"iconExclamation",buttons:Ext.Msg.OK,fn:function(i){Ext.getCmp("Hostname").focus(true);
}});}else{if(c!="0"){var p=this.getRespectiveMsg(c);Ext.Msg.show({title:extPageTitle,msg:p+".",icon:"iconExclamation",buttons:Ext.Msg.OK,fn:function(i){Ext.getCmp("zoneLocation").focus(true);}});}else{if(e!="0"){var p=this.getRespectiveMsg(e);Ext.Msg.show({title:extPageTitle,msg:p+".",icon:"iconExclamation",buttons:Ext.Msg.OK,fn:function(i){Ext.getCmp("zoneLocation").focus(true);
}});}else{if(d){Ext.Msg.show({title:extPageTitle,msg:intAgentMappingAlert+".",icon:"iconExclamation",buttons:Ext.Msg.OK,fn:function(i){Ext.getCmp("Hostname").focus(true);}});}else{return true;}}}}}}}}}}}}}}},getRespectiveMsg:function(a){switch(a){case"1":return _checkIp;case"2":return _validateHostDot;
case"3":return _validateHostUScore;case"4":return _validateHostHypen;case"5":return _checkspaceIp;case"6":return _checkAlpha;case"7":return _checkspecial;case"8":return _valIp;case"9":return _validateIp;case"10":return _checknum;case"11":return _chkIpv6;case"12":return _doubleColon;case"13":return _grpIpv6;
case"14":return _digitIpv6;case"15":return _validateIpv6;case"16":return _checkNumberLabel;case"17":return _checkblank;}},associateDissociate:function(a){assignAgent="";Ext.getCmp("extviewport").removeAll();this.getController("ExternalAgent.controller.AssignExtCtrl").buildFieldData();Ext.getCmp("extviewport").add({xtype:"assignexternalagent"});
this.getController("ExternalAgent.controller.AssignExtCtrl").afterMainRender();},dwnldAgent:function(){window.location.href="/final/admin/EgDownloadAgentPack.jsp?from=External&fromWizard="+fromWizard;},comboFromFieldLoad:function(){var c=this;c.getController("ExternalAgent.controller.AssignExtCtrl").buildFieldData();
var b=Ext.getCmp("extAgent").getValue();var a="null";if(b==-1){b="null";}Ext.Ajax.request({url:"ExternalAgent/data/EgConfigExtAgentsJson.jsp?eagent="+encodeURIComponent(b)+"&othereagent="+encodeURIComponent(a),method:"POST",success:function(d){if(d.status==200&&!Ext.isEmpty(d.responseText)){var e=d.responseText;
publicJSON=Ext.decode(e);}if(Ext.getCmp("itemselectextagent").fromField.store.getCount()>=1){Ext.getCmp("itemselectextagent").fromField.store.removeAll();}if(Ext.getCmp("itemselectextagent").toField.store.getCount()>=1){Ext.getCmp("itemselectextagent").toField.store.removeAll();}Ext.getCmp("itemselectextagent").fromField.store.add(publicJSON["ManagedHostByThisAgent"]);
c.getController("ExternalAgent.controller.AssignExtCtrl").initializeFields2();if(b=="null"){Ext.getCmp("otherExtAgent").setDisabled(true);}else{Ext.getCmp("otherExtAgent").setDisabled(false);}Ext.getCmp("itemselectextagent").toField.store.add(publicJSON["ManagedHostByOthrAgnt"]);}});},comboToFieldLoad:function(c){this.getController("ExternalAgent.controller.AssignExtCtrl").buildFieldData();
var b=Ext.getCmp("extAgent").getValue();var a=Ext.getCmp("otherExtAgent").getValue();if(b==-1){Ext.getCmp("otherExtAgent").setValue("-1");b="null";}if(a==-1){a="null";}Ext.Ajax.request({url:"ExternalAgent/data/EgConfigExtAgentsJson.jsp?eagent="+encodeURIComponent(b)+"&othereagent="+encodeURIComponent(a),method:"POST",success:function(d){if(d.status==200&&!Ext.isEmpty(d.responseText)){var e=d.responseText;
publicJSON=Ext.decode(e);}if(Ext.getCmp("itemselectextagent").toField.store.getCount()>=1){Ext.getCmp("itemselectextagent").toField.store.removeAll();}Ext.getCmp("itemselectextagent").toField.store.add(publicJSON["ManagedHostByOthrAgnt"]);}});},updation:function(l){var B=this;var n=Ext.getCmp("extAgent").getValue();
if(n=="-1"){Ext.Msg.show({title:assignExtPageTitle,msg:publicJSON["screenLabels"]["admin.test.Please choose an external agent"]+".",icon:"iconExclamation",buttons:Ext.Msg.OK});}else{var d=publicJSON["existingAgents"];if(d!=null&&d!="undefined"){var f=d.split(",");}var o=publicJSON["ManagedHostByOthrAgnt"];
var g=Ext.getCmp("itemselectextagent").getValue();if(g==undefined){Ext.Msg.show({title:assignExtPageTitle,msg:publicJSON["screenLabels"]["admin.external.Please choose atleast one agent to manage or unmanage"]+".",icon:"iconExclamation",buttons:Ext.Msg.OK});return;}var A=new Array();for(var v=0;v<g.length;
v++){var y=false;if(o!=null&&o!="undefined"){for(var t=0;t<o.length;t++){var e=o[t];for(var C in e){if(e[C]==g[v]){y=true;break;}}}if(!y){A[A.length]=g[v];}}else{A[A.length]=g[v];}}var r=A;var h=new Array();var q=Ext.getCmp("itemselectextagent").fromField.store.getCount();var s=new Array();for(var x=0;
x<q;x++){s[s.length]=Ext.getCmp("itemselectextagent").fromField.store.getAt(x).get("valueField");}for(var t=0;t<s.length;t++){var b=false;if(d!=null&&d.length>0){var f=d.split(",");for(var w=0;w<f.length;w++){if(s[t]==f[w]){b=true;break;}}if(!b){h[h.length]=s[t];}}else{h[h.length]=s[t];}}var p=h;if(d=="undefined"||d==null){d="null";
}var u=Ext.getCmp("assignhiddencontainer");var z={xtype:"hiddenfield",name:"fmanage",value:r};u.add(z);var z={xtype:"hiddenfield",name:"existingAgents",value:d};u.add(z);var z={xtype:"hiddenfield",name:"funmanage",value:p};u.add(z);var a=new Ext.LoadMask(Ext.getBody(),{msg:"Updating..."});a.show();var c=Ext.getCmp("assignexternalagent").getForm();
c.submit({url:"ExternalAgent/data/EgconfigextagentspJson.jsp?eagent="+encodeURIComponent(n),method:"POST",timeout:500000,standardSubmit:false,success:function(j,D){a.hide();var m=D.response.responseText;publicJSON=Ext.decode(m);if(!Ext.isEmpty(m)&&D.response.status==200){var k=publicJSON["requestStatus"];
if(k=="success"||k.indexOf("success")!=-1){var k=publicJSON["result"];Ext.MessageBox.show({title:k["title"],msg:k["message1"],icon:"iconInformation",buttons:Ext.Msg.OK,fn:function(E){B.comboFromFieldLoad();}});}else{var i=publicJSON["error"];Ext.MessageBox.show({title:i["title"],msg:i["message1"],icon:"iconExclamation",buttons:Ext.Msg.OK,fn:function(E){B.comboFromFieldLoad();
}});}}u.removeAll();},failure:function(i,j){a.hide();u.removeAll();}});}},backbutton:function(){if(fromPage=="AgentStatus"){window.location.href="/final/admin/EgServerList.jsp?from=AgentAssign&agentType=ExternalAgents&agentStatus="+agentState;}else{fromAssignExt="";Ext.getCmp("extviewport").removeAll();
this.buildMainData();Ext.getCmp("extviewport").add({xtype:"externalagents"});this.afterMainRender();}},deletefun:function(){var a=Ext.getCmp("components").getValue();if(a==""||a.length==0){Ext.Msg.show({title:deleteExtPageTitle,msg:publicJSON["screenLabels"]["admin.common.Please select external agent(s)"]+".",icon:"iconExclamation",buttons:Ext.Msg.OK});
}else{Ext.MessageBox.show({title:deleteExtPageTitle,msg:deleteMsg,fn:this.deleting,icon:"iconConfirmation",buttons:Ext.Msg.YESNO,scope:this});}},handleDeleteSelected:function(){var e=Ext.getCmp("gridDisplay").getSelectionModel().getSelection();var b="";var f=new Array();var a="";if(e==""){Ext.MessageBox.show({title:"External Agents",msg:noExtSelected+".",icon:"iconExclamation",buttons:Ext.Msg.OK});
return false;}for(var d=0;d<e.length;d++){b=e[d];id=b.get("Hostname");if(id!=null){f.push(id);}}for(var c=0;c<f.length;c++){a+=f[c]+",";}Ext.Msg.show({title:"External Agents",msg:deleteSelected+".",icon:"iconConfirmation",buttons:Ext.Msg.YESNO,fn:function(h){if(h=="yes"){var g="from=deleteExternalAgentsPage"+"&externalAgents="+encodeURIComponent(a);
Ext.Ajax.request({url:"ExternalAgent/data/deletegroupsexternalpJson.jsp?"+g,method:"POST",success:function(i){var l=i.responseText;publicJSON=Ext.decode(l);if(!Ext.isEmpty(l)&&i.status==200){var k=publicJSON["requestStatus"];if(k=="success"||k.indexOf("success")!=-1){var k=publicJSON["result"];Ext.MessageBox.show({title:k["title"],msg:k["message1"],icon:"iconInformation",buttons:Ext.Msg.OK,fn:appCnt.buildMainData()});
}else{var j=publicJSON["error"];Ext.Msg.show({title:j["title"],msg:j["message1"],icon:"iconExclamation",buttons:Ext.Msg.OK});}}Ext.getCmp("gridDisplay").store.loadData(publicJSON["gridExtAgents"]);}});}}});},deleting:function(b){this.getController("ExternalAgent.controller.DeleteExtCtrl").buildDeleteFieldData();
if(b=="yes"){var a=Ext.getCmp("components").getValue();if(a==null){Ext.Msg.show({title:deleteExtPageTitle,msg:publicJSON["screenLabels"]["admin.common.Please select external agent(s)"]+".",icon:"iconExclamation",buttons:Ext.Msg.OK});}else{var d=publicJSON["deleteLink"];var c="from=deleteExternalAgentsPage"+"&externalAgents="+encodeURIComponent(a);
Ext.Ajax.request({url:"ExternalAgent/data/deletegroupsexternalpJson.jsp?"+c,method:"POST",success:function(e){var h=e.responseText;publicJSON=Ext.decode(h);if(!Ext.isEmpty(h)&&e.status==200){var g=publicJSON["requestStatus"];if(g=="success"||g.indexOf("success")!=-1){var g=publicJSON["result"];Ext.MessageBox.show({title:g["title"],msg:g["message1"],icon:"iconInformation",buttons:Ext.Msg.OK,fn:refreshDelete});
}else{var f=publicJSON["error"];Ext.Msg.show({title:f["title"],msg:f["message1"],icon:"iconExclamation",buttons:Ext.Msg.OK});}}Ext.getCmp("compsearch").setRawValue("");}});}}},mainFormEvent:function(a){this.getController("ExternalAgent.controller.DeleteExtCtrl").buildDeleteFieldData();var b=Ext.getCmp("compsearch").getValue();
if(b==""||b.length==0){Ext.get("MyTrigger_0").setStyle("display","none");Ext.get("MyTrigger_1").setStyle("display","block");}else{Ext.get("MyTrigger_1").setStyle("display","none");Ext.get("MyTrigger_0").setStyle("display","block");}Ext.Ajax.request({url:"ExternalAgent/data/DeleteExternalAgentsJson.jsp?compsearch="+b,method:"POST",success:function(c){if(c.status==200&&!Ext.isEmpty(c.responseText)){var e=c.responseText;
publicJSON=Ext.decode(e);}var d=publicJSON["searchArr"];if(d!=null&&d.length>0){Ext.getCmp("components").show();Ext.getCmp("deleteBtn").show();Ext.getCmp("delExtLabel").show();Ext.getCmp("NoDelSearchFound").hide();Ext.getCmp("components").getStore().loadRawData(publicJSON["searchArr"]);}else{Ext.getCmp("components").hide();
Ext.getCmp("deleteBtn").hide();Ext.getCmp("delExtLabel").hide();Ext.getCmp("NoDelSearchFound").show();Ext.getCmp("delSearch").update('<div class="egFlexCenterByColumnWise" style="height:98%"><div class="iconInformation"></div><div class="commonErrorMsgText" >'+noExtFound+".</div></div>");}}});},backDelButton:function(a){fromDeleteExt="";
Ext.getCmp("extviewport").removeAll();this.buildMainData();Ext.getCmp("extviewport").add({xtype:"externalagents"});this.afterMainRender();},afterMainRender:function(){if(fromAssignExt!=null&&fromAssignExt=="true"){Ext.getCmp("extviewport").removeAll();this.getController("ExternalAgent.controller.AssignExtCtrl").buildFieldData();
Ext.getCmp("extviewport").add({xtype:"assignexternalagent"});this.getController("ExternalAgent.controller.AssignExtCtrl").buildGivenAgentData(assignAgent);this.getController("ExternalAgent.controller.AssignExtCtrl").afterMainRender();}else{if(fromDeleteExt!=null&&fromDeleteExt=="true"){Ext.getCmp("extviewport").removeAll();
this.getController("ExternalAgent.controller.DeleteExtCtrl").buildDeleteFieldData();Ext.getCmp("extviewport").add({xtype:"deleteexternalagents"});this.getController("ExternalAgent.controller.DeleteExtCtrl").afterMainRender();}else{if(isClientEmulation=="false"){Ext.getCmp("ClientEmul").hide();}if(isLimitedAdmin=="true"){Ext.getCmp("bulkAddAgent").hide();
}else{Ext.getCmp("bulkAddAgent").show();}var a=publicJSON["gridExtAgents"];if(a==null||a.length==0){Ext.getCmp("associateDissociate").disable();Ext.getCmp("gridDisplay").store.loadData("");Ext.getCmp("gridDisplay").getView().emptyText='<div class="egFlexCenterByColumnWise" style="height:98%"><div class="iconInformation"></div><div class="commonErrorMsgText" >'+noExtPrtDesc+".</div></div>";
Ext.getCmp("gridDisplay").getView().refresh();}else{Ext.getCmp("associateDissociate").enable();Ext.getCmp("gridDisplay").getStore().loadRawData(a);}var b=publicJSON["NoExtFound"];if(b=="true"){Ext.getCmp("gridSearch").disable();}else{Ext.getCmp("gridSearch").enable();}}}}});function refreshDelete(a){Ext.Ajax.request({url:"ExternalAgent/data/DeleteExternalAgentsJson.jsp",method:"POST",async:false,success:function(b){if(b.status==200&&!Ext.isEmpty(b.responseText)){var c=b.responseText;
publicJSON=Ext.decode(c);}}});Ext.getCmp("components").getStore().loadData(publicJSON["externalAgentArray"]);}function refreshAssignExt(a){var b=Ext.getCmp("extAgent").getValue();Ext.Ajax.request({url:"ExternalAgent/data/EgConfigExtAgentsJson.jsp?eagent="+encodeURIComponent(b),method:"POST",success:function(c){if(c.status==200&&!Ext.isEmpty(c.responseText)){var d=c.responseText;
publicJSON=Ext.decode(d);}if(Ext.getCmp("itemselectextagent").fromField.store.getCount()>=1){Ext.getCmp("itemselectextagent").fromField.store.removeAll();}if(Ext.getCmp("itemselectextagent").toField.store.getCount()>=1){Ext.getCmp("itemselectextagent").toField.store.removeAll();}Ext.getCmp("itemselectextagent").fromField.store.add(publicJSON["ManagedHostByThisAgent"]);
Ext.getCmp("itemselectextagent").toField.store.add(publicJSON["ManagedHostByOthrAgnt"]);}});}