Ext.define("AggregateNewComponent.controller.Main",{extend:"Ext.app.Controller",views:["AddNewComponent","IntermediateView"],requires:["AggregateNewComponent.view.AddNewComponent","AggregateNewComponent.view.IntermediateView"],refs:[{selector:"addnewcomponent",ref:"addnewcomponent"},{selector:"intermediateview",ref:"intermediateview"}],init:function(){ctrler=this;
this.buildMainData();this.control({"addnewcomponent":{"boxready":this.afterMainRender},'addnewcomponent combo[id="addCategory"]':{"select":this.categorySelection},'addnewcomponent combo[id="stype"]':{"select":this.compTypesSelection},'addnewcomponent button[id="addButton"]':{"click":this.addComponent},'intermediateview button[id="hostCheckBack"]':{"click":this.hostCheckBack},'addnewcomponent button[id="backButton"]':{"click":this.addNewBack},'addnewcomponent combobox[id="type_name"]':{"select":this.populate_type_members},'addnewcomponent combobox[id="type_members"]':{"select":this.showRestrictedCompTypes},'addnewcomponent combobox[id="exAggComonents"]':{"select":this.changeAggComponent}});
},changeAggComponent:function(){window.location.href="/final/admin/aggNewServer.jsp?server="+encodeURIComponent(Ext.getCmp("exAggComonents").getValue())+"&serverType="+encodeURIComponent(encodeURIComponent(Ext.getCmp("stype").getValue()))+"&modifyserver=true&elementType="+s_elementType+"&elementName="+s_elementName+"&operation=modify&serverGategory="+Ext.getCmp("addCategory").getValue();
},populate_type_members:function(){if(firstTime){Ext.Msg.confirm(pageTitle,confirmation1,function(a){if(a=="yes"){ctrler.getTypeMembers();firstTime=false;}else{Ext.getCmp("type_name").setValue(Ext.isEmpty(publicJSON.defaultElementType)?"-1":publicJSON.defaultElementType);}});return;}ctrler.getTypeMembers();
},getTypeMembers:function(){Ext.getCmp("itemselectHosts").fromField.store.removeAll();Ext.getCmp("itemselectHosts").toField.store.removeAll();var a=Ext.getCmp("type_name").getValue();if(a=="-1"){Ext.getCmp("type_members").hide();Ext.Ajax.request({url:"AggregateNewComponent/data/remoteScriptingHelper.jsp?_method=getAllComponentsWithMapping&pcount=1&p0="+publicJSON.normalServerType+"&from=add_or_modify_component_page",method:"POST",async:false,timeout:300000,success:function(c){if(c.status==200&&!Ext.isEmpty(c.responseText)){jsonDataHolder_vladimir=Ext.decode(c.responseText);
if(jsonDataHolder_vladimir.availableComponentsFound){var b=Ext.getCmp("itemselectHosts").toField;b.store.add(jsonDataHolder_vladimir["availableComponents"]);b.boundList.getSelectionModel().selectAll();}}}});}else{Ext.getCmp("type_members").show();if(a=="Group"){Ext.getCmp("type_members").getStore().loadRawData(publicJSON["groupNamesArray"]);
Ext.getCmp("type_members").setValue("-1");Ext.getCmp("type_members").setFieldLabel(list_of_groups);}else{if(a=="Segment"){Ext.getCmp("type_members").getStore().loadRawData(publicJSON.segmentNamesArray);Ext.getCmp("type_members").setValue("-1");Ext.getCmp("type_members").setFieldLabel(list_of_segments);
}else{if(a=="Service"){Ext.getCmp("type_members").getStore().loadRawData(publicJSON.serviceNamesArray);Ext.getCmp("type_members").setValue("-1");Ext.getCmp("type_members").setFieldLabel(list_of_services);}else{if(a=="Zone"){Ext.getCmp("type_members").getStore().loadRawData(publicJSON.zoneNamesArray);
Ext.getCmp("type_members").setValue("-1");Ext.getCmp("type_members").setFieldLabel(list_of_zones);}}}}}},showRestrictedCompTypes:function(){if(firstTime){Ext.Msg.confirm(pageTitle,confirmation1,function(a){if(a=="yes"){ctrler.getFilterMembers();firstTime=false;}else{Ext.getCmp("type_members").setValue(publicJSON.defaultElementName);
}});return;}ctrler.getFilterMembers();},getFilterMembers:function(){Ext.getCmp("itemselectHosts").fromField.store.removeAll();Ext.getCmp("itemselectHosts").toField.store.removeAll();var c=Ext.getCmp("type_name").getValue();var b=Ext.getCmp("type_members").getValue();if(b=="-1"){return;}var a="";if(currentAction=="modify"){var d=c+"@"+b+"@"+publicJSON.aggComponent;
a="_method=modifyAggComponent&pcount=1&p0="+d+"&from=add_or_modify_component_page";}else{var d=c+"@"+b+"@"+publicJSON.normalServerType;a="_method=getAllComponents&pcount=1&p0="+d+"&from=add_or_modify_component_page";}Ext.Ajax.request({url:"AggregateNewComponent/data/remoteScriptingHelper.jsp?"+a,method:"POST",async:false,timeout:300000,success:function(f){if(f.status==200&&!Ext.isEmpty(f.responseText)){jsonDataHolder_vladimir=Ext.decode(f.responseText);
if(currentAction=="modify"){if(jsonDataHolder_vladimir.associatedComponentsFound){var g=Ext.getCmp("itemselectHosts").fromField;g.store.add(jsonDataHolder_vladimir["associatedComponents"]);}if(jsonDataHolder_vladimir.availableComponentsFound){var e=Ext.getCmp("itemselectHosts").toField;e.store.add(jsonDataHolder_vladimir["availableComponents"]);
}}else{if(jsonDataHolder_vladimir.availableComponentsFound){var e=Ext.getCmp("itemselectHosts").toField;e.store.add(jsonDataHolder_vladimir["availableComponents"]);e.boundList.getSelectionModel().selectAll();}}}}});},buildMainData:function(){if(reqfrom=="comp_mng_umng"||reqfrom=="discovery_mng_umng"||reqfrom=="comp_add_modify"||reqfrom=="comp_add_mod_new"){serverType=homepage_server;
server=homepage_nickport;}var a="AggregateNewComponent/data/EgNewServerJson.jsp?serverType="+encodeURIComponent(serverType)+"&selectedServerGroup="+serverCategory;if(currentAction=="add"){a+="&server=new";}else{if(currentAction=="manage"){a="AggregateNewComponent/data/EgNewServerJson.jsp?"+qryStr;}else{a+="&server="+encodeURIComponent(server);
}}if(s_elementType.length>0&&s_elementName.length>0){a+="&elementType="+s_elementType+"&elementName="+s_elementName+"&operation="+s_operation;}Ext.Ajax.request({url:a,method:"POST",async:false,timeout:300000,success:function(b){if(b.status==200&&!Ext.isEmpty(b.responseText)){var c=b.responseText;publicJSON=Ext.decode(c);
}}});jsonDataCache=publicJSON;},getData:function(a){Ext.Ajax.request({url:a,method:"POST",async:false,timeout:300000,success:function(b){var c=b.responseText;publicJSON=Ext.decode(c);}});},afterMainRender:function(){if(publicJSON.AlertType=="Error"){Ext.Msg.show({title:publicJSON.AlertTitle,msg:publicJSON.AlertMsg,buttons:Ext.Msg.OK,icon:"iconExclamation",fn:function(d){if(d=="ok"){Ext.getCmp("addCategory").getStore().loadRawData(publicJSON.category);
Ext.getCmp("addCategory").setValue("-1");Ext.getCmp("stype").getStore().loadRawData(publicJSON.componentTypes);Ext.getCmp("stype").setValue("-1");Ext.getCmp("addPageContainer").hide();Ext.getCmp("addPageComponentContainer").hide();Ext.getCmp("buttonContainer").hide();return;}}});}if(publicJSON.serverType=="-1"){Ext.getCmp("addPageContainer").hide();
Ext.getCmp("addPageComponentContainer").hide();Ext.getCmp("buttonContainer").hide();return;}else{Ext.getCmp("addPageContainer").show();Ext.getCmp("addPageComponentContainer").show();Ext.getCmp("buttonContainer").show();}Ext.getCmp("addCategory").getStore().loadRawData(publicJSON.category);Ext.getCmp("addCategory").setValue(publicJSON.selectedServerGroup);
Ext.getCmp("stype").getStore().loadRawData(publicJSON.componentTypes);Ext.getCmp("stype").setValue(publicJSON.serverType);Ext.getCmp("remoteAgent").getStore().loadRawData(publicJSON.remoteAgentsList);Ext.getCmp("remoteAgent").setValue(publicJSON.remoteAgentSelected);Ext.getCmp("extAgents").getStore().loadRawData(publicJSON.externalAgents);
Ext.getCmp("extAgents").setValue(publicJSON.externalAgentsSelected);if(publicJSON.remoteMonitoring){Ext.getCmp("extAgents").hide();Ext.getCmp("remoteAgent").show();}else{Ext.getCmp("extAgents").show();Ext.getCmp("remoteAgent").hide();}if(currentAction=="add"){if(publicJSON.filterByArrayFound){if(s_operation=="add"){Ext.getCmp("type_name").hide();
Ext.getCmp("type_members").hide();Ext.getCmp("displayComponent").show();Ext.getCmp("displayComponent").setFieldLabel(publicJSON.displayComponentLabel);Ext.getCmp("displayComponent").setValue(s_elementName);if(s_elementType!="group"){Ext.getCmp("anchorCompRG").show();Ext.getCmp("anchorCompRG").setFieldLabel(publicJSON.anchorCompRGLabel);
Ext.getCmp("anchorCompRG").setValue({"anchorComp":"no"});}if(s_elementType=="zone"||s_elementType=="Zone"){Ext.getCmp("memberComponentRG").show();Ext.getCmp("memberComponentRG").setFieldLabel(publicJSON.memberComponentRGLabel);Ext.getCmp("memberComponentRG").setValue({"memberComponent":"no"});}}else{Ext.getCmp("type_name").show();
Ext.getCmp("type_name").getStore().loadRawData(publicJSON.filterByArray);Ext.getCmp("type_name").setValue("-1");}}}else{if(currentAction=="modify"){Ext.getCmp("hostip").setValue("0.0.0.0");Ext.getCmp("hostname").setValue(publicJSON.hostname);Ext.getCmp("addButton").setText(label_Update);Ext.getCmp("addCategory").setReadOnly(true);
Ext.getCmp("stype").setReadOnly(true);if(publicJSON.modifyAnchorComponent){Ext.getCmp("exAggComonents").show();Ext.getCmp("exAggComonents").getStore().loadRawData(publicJSON.aggComponentTypeList);Ext.getCmp("exAggComonents").setValue(publicJSON.aggComponentTypeSelected);var b=publicJSON.aggComponentTypeSelected;
Ext.getCmp("exAggComonents").setValue(b);Ext.getCmp("hostname").setValue(b.substring(0,b.indexOf(":")));Ext.getCmp("type_name").hide();Ext.getCmp("type_members").hide();Ext.getCmp("displayComponent").show();Ext.getCmp("displayComponent").setFieldLabel(publicJSON.displayComponentLabel);Ext.getCmp("displayComponent").setValue(publicJSON.elementName);
if(publicJSON.elementType!="group"){Ext.getCmp("anchorCompRG").show();Ext.getCmp("anchorCompRG").setFieldLabel(publicJSON.anchorCompRGLabel);if(publicJSON.isAnchorComponent){Ext.getCmp("anchorCompRG").setValue({"anchorComp":"yes"});}else{Ext.getCmp("anchorCompRG").setValue({"anchorComp":"no"});}}if(publicJSON.elementType=="zone"){Ext.getCmp("memberComponentRG").show();
Ext.getCmp("memberComponentRG").setFieldLabel(publicJSON.memberComponentRGLabel);if(publicJSON.isAlreadyMemberOfZone){Ext.getCmp("memberComponentRG").setValue({"memberComponent":"yes"});}else{Ext.getCmp("memberComponentRG").setValue({"memberComponent":"no"});}}}else{if(publicJSON.filterByElement){Ext.getCmp("type_name").show();
Ext.getCmp("type_name").getStore().loadRawData(publicJSON.filterByArray);Ext.getCmp("type_name").setValue("-1");Ext.getCmp("type_members").show();Ext.getCmp("type_name").setValue(publicJSON.defaultElementType);if(publicJSON.defaultElementType=="Group"){Ext.getCmp("type_members").getStore().loadRawData(publicJSON.groupNamesArray);
Ext.getCmp("type_members").setValue(publicJSON.defaultElementName);Ext.getCmp("type_members").setFieldLabel(list_of_groups);}else{if(publicJSON.defaultElementType=="Segment"){Ext.getCmp("type_members").getStore().loadRawData(publicJSON.segmentNamesArray);Ext.getCmp("type_members").setValue(publicJSON.defaultElementName);
Ext.getCmp("type_members").setFieldLabel(list_of_segments);}else{if(publicJSON.defaultElementType=="Service"){Ext.getCmp("type_members").getStore().loadRawData(publicJSON.serviceNamesArray);Ext.getCmp("type_members").setValue(publicJSON.defaultElementName);Ext.getCmp("type_members").setFieldLabel(list_of_services);
}else{if(publicJSON.defaultElementType=="Zone"){Ext.getCmp("type_members").getStore().loadRawData(publicJSON.zoneNamesArray);Ext.getCmp("type_members").setValue(publicJSON.defaultElementName);Ext.getCmp("type_members").setFieldLabel(list_of_zones);}}}}}else{if(publicJSON.filterByArrayFound){Ext.getCmp("type_name").show();
Ext.getCmp("type_name").getStore().loadRawData(publicJSON.filterByArray);Ext.getCmp("type_name").setValue("-1");}}}}}if(publicJSON.associatedComponentsFound){var c=Ext.getCmp("itemselectHosts").fromField;c.store.add(publicJSON["associatedComponents"]);}if(publicJSON.availableComponentsFound){var a=Ext.getCmp("itemselectHosts").toField;
a.store.add(publicJSON["availableComponents"]);}if(!Ext.isEmpty(compGlanceCompType)){Ext.getCmp("backButton").hide();Ext.getCmp("addnewcomponent").tools.close.toolEl.dom.hidden=false;}else{Ext.getCmp("backButton").show();if(Ext.getCmp("addnewcomponent").tools.close){Ext.getCmp("addnewcomponent").tools.close.toolEl.dom.hidden=true;
}}},addNewBack:function(){if(reqfrom=="comp_mng_umng"){window.location.href="EgConfigEnv.jsp?srvtype="+comptype+"&activeCompTypes="+activeCompTypes+"&fromWizard="+fromWizard+"&compGlanceCompType="+compGlanceCompType;return;}else{if(reqfrom=="discovery_mng_umng"){window.location.href="EgDiscoveryPane.jsp?server="+comptype+"&activeCompTypes="+activeCompTypes+"&selectedNode=node11&fromWizard="+fromWizard+"&compGlanceCompType="+compGlanceCompType;
return;}else{if(reqfrom=="comp_add_modify"){window.location.href="EgDispServer.jsp?comptype="+comptype+"&activeCompTypes="+activeCompTypes+"&fromWizard="+fromWizard+"&compGlanceCompType="+compGlanceCompType;return;}else{if(reqfrom=="comp_add_mod_new"){window.location.href="EgAdminOperations.jsp?server="+comptype+"&fromAction="+fromAction+"&classify="+classify;
return;}}}}if(backHref.indexOf("EgAggregateTree.jsp")>-1){if(backHref.endsWith("Tree.jsp")){backHref+="?fromWizard="+fromWizard+"&compGlanceCompType="+compGlanceCompType;}else{backHref+="&fromWizard="+fromWizard+"&compGlanceCompType="+compGlanceCompType;}parent.window.location.href=backHref;}else{if(backHref.indexOf("aggDispServer.jsp?")>-1){window.location.href=backHref.substring(0,backHref.indexOf("?")+1)+"&category="+Ext.getCmp("addCategory").getValue()+"&comptype="+Ext.getCmp("stype").getValue()+"&fromWizard="+fromWizard+"&compGlanceCompType="+compGlanceCompType;
}else{if(backHref.endsWith("Tree.jsp")){backHref+="?fromWizard="+fromWizard+"&compGlanceCompType="+compGlanceCompType;}else{backHref+="&fromWizard="+fromWizard+"&compGlanceCompType="+compGlanceCompType;}window.location.href=backHref;}}},categorySelection:function(){var b=Ext.getCmp("addCategory").getValue();
var a="AggregateNewComponent/data/EgNewServerJson.jsp?selectedServerGroup="+b;this.getData(a);var c=Ext.getCmp("stype").getStore();c.removeAll();c.loadRawData(publicJSON.componentTypes);Ext.getCmp("stype").setValue("-1");Ext.getCmp("addPageContainer").hide();Ext.getCmp("addPageComponentContainer").hide();
Ext.getCmp("buttonContainer").hide();},compTypesSelection:function(){var b=Ext.getCmp("stype").getValue();if(b==-1){Ext.getCmp("addPageContainer").hide();Ext.getCmp("addPageComponentContainer").hide();Ext.getCmp("buttonContainer").hide();Ext.Msg.alert(addButtonText,alertMsg32);return;}var a=Ext.getCmp("addCategory").getValue();
window.location.href="/final/admin/aggNewServer.jsp?server=new&serverType="+encodeURIComponent(b)+"&from=addnew&isAggregateLink=true&treeViewSrc=null&serverGategory="+a+"&fromWizard="+fromWizard+"&compGlanceCompType="+compGlanceCompType;},addComponent:function(){var c=this;if(currentAction=="modify"){var e=publicJSON.hiddenVals.allExtAgents;
var f=publicJSON.hiddenVals.allRemAgents;var d=publicJSON.hostname;var a=Ext.getCmp("hostname");var b=Ext.getCmp("hostname").getValue();if(!checkblank(b)){Ext.Msg.alert(pageTitle,alertMsg22,function(g){if(g=="ok"){a.focus(true);}});return false;}if(b!=""&&this.contains2(e,b)){Ext.Msg.alert(pageTitle,alertMsg38,function(g){if(g=="ok"){a.focus(true);
}});return false;}else{if(b!=""&&this.contains2(f,b)){Ext.Msg.alert(pageTitle,alertMsg39,function(g){if(g=="ok"){a.focus(true);}});return false;}else{if(b!=d){Ext.Msg.show({title:pageTitle,msg:alertMsg36,buttons:Ext.Msg.YESNO,icon:"iconConfirmation",fn:function(g){if(g=="yes"){c.addComponent1();}}});
return false;}else{this.addComponent1();}}}}else{this.addComponent1();}},addComponent1:function(){var o=this.addComponentValidation();if(!o){return;}var b=Ext.getCmp("itemselectHosts");var b=Ext.getCmp("itemselectHosts");var l=b.fromField.store.getCount();var e=b.fromField.store;var a="";for(var d=0;
d<l;d++){a+=","+e.getAt(d).get("valueField");}if(a.length==0){Ext.Msg.alert(pageTitle,associated_comps_alert);return;}var g=Ext.getCmp("stype").getValue();var i=this;var n=publicJSON.hiddenVals;var j=Ext.getCmp("hiddenContnr");j.removeAll();for(var c in n){j.add({xtype:"hidden",name:c,value:n[c]});}if(!Ext.getCmp("type_name").isDisabled()&&!Ext.getCmp("type_members").isDisabled()){var q=Ext.getCmp("type_name").getValue();
if(q!=null&&q!="undefined"&&q!="-1"){var k=Ext.getCmp("type_members").getValue();if(k!=null&&k!="undefined"&&k!="-1"){j.add({xtype:"hidden",name:"type_name",value:q});j.add({xtype:"hidden",name:"type_members",value:k});}}}j.add({xtype:"hidden",name:"servertype",value:Ext.getCmp("stype").getValue()});
j.add({xtype:"hidden",name:"isExistingAggType",value:publicJSON.isExistingAggType});j.add({xtype:"hidden",name:"fassociate",value:a.substring(1)});j.add({xtype:"hidden",name:"selectedCategory",value:Ext.getCmp("addCategory").getValue()});var f="no";if(Ext.getCmp("displayComponent").isVisible()){t_elementType=publicJSON.elementType;
t_elementName=publicJSON.elementName;if(s_elementType.length>0&&s_elementName.length>0&&currentAction=="add"){t_elementType=s_elementType;t_elementName=s_elementName;}j.add({xtype:"hidden",name:"elementType",value:t_elementType});j.add({xtype:"hidden",name:"elementName",value:t_elementName});f="yes";
}var h="/final/admin/AggregateNewComponent/data/EgHostCheckJson.jsp?strPass=&from=addNew&server=new&isAggregateType=true";if(currentAction=="modify"){h="/final/admin/AggregateNewComponent/data/EgHostCheckJson.jsp?isAggregateType=true&modifyserver=true&elementModify="+f;}var p=new Ext.LoadMask(Ext.getBody(),{msg:updating+"... "+plsWait+"."});
p.show();this.getAddnewcomponent().submit({url:h,method:"POST",timeout:300,success:function(m,t){p.hide();var x=t.response.responseText;publicJSON=Ext.decode(x);var z=publicJSON.requestStatus;if(z=="failed"){if(publicJSON.error_type=="alert"){Ext.Msg.show({title:publicJSON.error_Info.error_Title,msg:alertMsg33+"<br>"+publicJSON.error_Info.error_Msg_1+"<br>"+publicJSON.error_Info.error_Msg_2,buttons:Ext.Msg.OK,icon:"iconExclamation"});
publicJSON=jsonDataCache;}else{if(publicJSON.error_type=="radio"){var v=Ext.getCmp("newcomponentview");v.removeAll();v.add({xtype:"intermediateview"});Ext.getCmp("intermediategrid").setTitle(publicJSON.main_Msg_Title);Ext.getCmp("intermediategrid").getStore().loadRawData(publicJSON.gridData);var u=Ext.getCmp("radioOne");
var r=Ext.getCmp("radioTwo");Ext.getCmp("radioOpts").setFieldLabel(publicJSON.radio_Msg_Title);u.boxLabelEl.update(publicJSON.radio1_Msg);r.boxLabelEl.update(publicJSON.radio2_Msg);u.inputValue=publicJSON.radio1_value;r.enable();if(publicJSON.radio2_enable=="disabled"){r.disable();}if(publicJSON.radio1_checked){u.setValue(true);
}}else{if(publicJSON.error_type=="confirmNickSuggestion"){Ext.Msg.show({title:publicJSON.error_Info.error_Title,msg:alertMsg33+".<br>"+publicJSON.error_Info.error_Msg_1+"<br>"+publicJSON.error_Info.error_Msg_2,buttons:Ext.Msg.YESNO,icon:"iconConfirmation",fn:function(H){if(H=="yes"){var I=publicJSON.error_Info.forward_URL;
var B=publicJSON.error_Info.IP;var D=publicJSON.error_Info.nickName;var L=publicJSON.hiddenValues;var J=Ext.getCmp("hiddenContnr");J.removeAll();Ext.suspendLayouts();for(var G in L){var K=L[G];if(G=="hostip"){K=B;}else{if(G=="hostname"){K=D;}}J.add({xtype:"hidden",name:G,value:K});}Ext.resumeLayouts(true);
I="/final/admin/NewComponent/data/"+I;i.forwardGivenURL(I);}else{Ext.getCmp("hostname").focus();var E=encodeURIComponent(g);var F=Ext.getCmp("addCategory").getValue();F=encodeURIComponent(F);var C="NewComponent/data/EgNewServerJson.jsp?selectedServerGroup="+F+"&server=new&serverType="+E;ctrler.getData(C,true);
}}});}}}}else{if(z=="success"){if(publicJSON.forward){var w=publicJSON.forward_URL;var A=publicJSON.hiddenValues;var y=Ext.getCmp("hiddenContnr");y.removeAll();for(var s in A){y.add({xtype:"hidden",name:s,value:A[s]});}w="/final/admin/AggregateNewComponent/data/"+w;i.forwardGivenURL(w);}}}},failure:function(m,r){p.hide();
switch(r.failureType){case Ext.form.action.Action.CLIENT_INVALID:Ext.Msg.alert("Failure",alertMsg33+". Form fields may not be submitted with invalid values");break;case Ext.form.action.Action.CONNECT_FAILURE:Ext.Msg.alert("Failure",alertMsg33+". Ajax communication failed");break;case Ext.form.action.Action.SERVER_INVALID:Ext.Msg.alert("Failure",alertMsg33+". "+r.result.msg);
}}});},forwardGivenURL:function(d){var b=alertMsg34;if(currentAction=="modify"){b=alertMsg35;}var c=this;var a=new Ext.LoadMask(Ext.getBody(),{msg:updating+"... "+plsWait+"."});a.show();this.getAddnewcomponent().submit({url:d,method:"POST",timeout:300,success:function(e,f){a.hide();var i=f.response.responseText;
var g=Ext.decode(i);var h=g["requestStatus"];if(h=="success"){Ext.Msg.show({title:compnonetLabel,msg:b,buttons:Ext.Msg.OK,icon:"iconInformation",fn:function(k){if(k=="ok"){var j=g.compType;var m=g.selectedCategory;if(reqfrom=="agg_show_types"){location.href=backHref;}else{if(reqfrom!="comp_mng_umng"&&reqfrom!="discovery_mng_umng"&&reqfrom!="comp_add_modify"&&reqfrom!="comp_add_mod_new"){if(!Ext.isEmpty(fromWizard)&&fromWizard.startsWith("componentsGlance_")){window.parent.location.href="/final/admin/EgAdminOperations.jsp?fromAction="+fromWizard+"&server="+encodeURIComponent(compGlanceCompType);
}else{var l="/final/admin/aggDispServer.jsp?category="+m+"&comptype="+j+"&fromWizard="+fromWizard+"&compGlanceCompType="+compGlanceCompType;window.location.href=l;}}}}}});}else{if(h=="failed"){var i=f.response.responseText;var g=Ext.decode(i);var h=g["requestStatus"];Ext.Msg.show({title:g.Error_Title,msg:alertMsg33+"<br>"+g.Error_Info.Error_Msg_1+"<br>"+g.Error_Info.Error_Msg_2,buttons:Ext.Msg.OK,icon:"iconExclamation",fn:function(j){if(j=="ok"){var k="/final/admin/aggDispServer.jsp?category=-1&comptype=-1";
window.location.href=k+"&fromWizard="+fromWizard+"&compGlanceCompType="+compGlanceCompType;}}});}}},failure:function(e,f){a.hide();switch(f.failureType){case Ext.form.action.Action.CLIENT_INVALID:Ext.Msg.alert("Failure",alertMsg33+". Form fields may not be submitted with invalid values");break;case Ext.form.action.Action.CONNECT_FAILURE:Ext.Msg.alert("Failure",alertMsg33+". Ajax communication failed");
break;case Ext.form.action.Action.SERVER_INVALID:Ext.Msg.alert("Failure",alertMsg33+". "+f.result.msg);}}});},addComponentValidation:function(){var a=Ext.getCmp("hostname");var b=Ext.getCmp("hostname").getValue();var c=Ext.getCmp("stype").getValue();if(!checkblank(b)){Ext.Msg.alert(pageTitle,alertMsg22,function(d){if(d=="ok"){a.focus(true);
}});return false;}else{if(!this.checkspace(b)){Ext.Msg.show({title:pageTitle,msg:alertMsg41,buttons:Ext.Msg.OK,icon:"iconExclamation",fn:function(){a.focus(true);}});return false;}else{if(!this.checkSpecialChar(b,"`~!@#$%^&*()+={}[]|\\:;\"'<>,?")){Ext.Msg.show({title:pageTitle,msg:alertMsg40,buttons:Ext.Msg.OK,icon:"iconExclamation",fn:function(){a.focus(true);
}});return false;}else{if(isAllowHostName=="true"&&!this.checkForHostType(b)){Ext.Msg.alert(pageTitle,alertMsg20+alertMsg21,function(d){if(d=="ok"){a.focus(true);}});return false;}else{if(!this.checkForHostType(b)){Ext.Msg.alert(pageTitle,alertMsg20+alertMsg21,function(d){if(d=="ok"){a.focus(true);}});
return false;}else{if(isDoubleByteMgr=="false"&&!validateSingleByte(b)){Ext.Msg.alert(pageTitle,alertMsg1,function(d){if(d=="ok"){a.focus(true);}});return false;}else{if(isDoubleByteMgr=="false"&&!this.checkdots(b)){a.focus(true);return;}else{if(isDoubleByteMgr=="false"&&b.toLowerCase()==c.toLowerCase()){Ext.Msg.alert(pageTitle,alertMsg26,function(d){if(d=="ok"){a.focus(true);
}});return false;}else{return true;}}}}}}}}},checkSpecialChar:function(c,b){if(typeof(c)=="object"){obj_val=c.value;}else{obj_val=c;}for(var a=0;a<obj_val.length;a++){check_char=b.indexOf(obj_val.charAt(a));if(check_char>=0){return false;}}return true;},checkspace:function(a){if(typeof(a)=="object"){obj_val=a.value;
}else{obj_val=a;}return(obj_val.indexOf(" ")==-1);},checkdots:function(a){var c=a;if(c.charAt(0)=="."||c.charAt(c.length-1)=="."){Ext.Msg.alert(pageTitle,alertMsg30);return false;}else{for(var b=0;b<c.length;b++){if(c.charAt(b)=="."&&c.charAt(b+1)=="."){Ext.Msg.alert(pageTitle,alertMsg31);return false;
}else{continue;}}}return true;},validateHostName:function(){var c=publicJSON.hiddenVals.allExtAgents;var e=publicJSON.hiddenVals.allRemAgents;var a=Ext.getCmp("hostname").getValue();var d=false;var b=false;if(a!=""&&this.contains2(c,a)){Ext.Msg.show({title:pageTitle,msg:alertMsg38,buttons:Ext.Msg.OK,icon:"iconExclamation"});
d=true;}if(a!=""&&this.contains2(e,a)){Ext.Msg.show({title:pageTitle,msg:alertMsg39,buttons:Ext.Msg.OK,icon:"iconExclamation"});b=true;}if(d||b){return false;}else{return true;}},contains2:function(a,d){var c=a;var g=false;var f=0;var b=c.indexOf(",");while(b>-1){var e=c.substring(f,b);if(e.toLowerCase()==d.toLowerCase()){g=true;
break;}else{f=b;c=c.substring(1,c.length);b=c.indexOf(",");}}if(c.toLowerCase()==d.toLowerCase()){g=true;}return g;},checkForHostType:function(b){var c=publicJSON.servTypes;for(var a=0;a<c.length;a++){if(c[a]==b){return false;}}return true;},hostCheckBack:function(){var a="/final/admin/aggNewServer.jsp?"+addCompURL+"&fromWizard="+fromWizard+"&compGlanceCompType="+compGlanceCompType;
window.location.href=a;}});