Ext.define("AssetManagement.controller.Main",{extend:"Ext.app.Controller",requires:["AssetManagement.view.AssetConfiguration","utilities.CustomGrid","AssetManagement.view.FileUploadForm","AssetManagement.view.FileUpload","AssetManagement.view.Print","AssetManagement.view.DownloadUtils","AssetManagement.view.Main"],views:["AssetManagement.view.AssetConfiguration","utilities.CustomGrid","AssetManagement.view.FileUploadForm","AssetManagement.view.FileUpload","AssetManagement.view.Print","AssetManagement.view.DownloadUtils","AssetManagement.view.AssetList","AssetManagement.view.AssetListColumnConfig","AssetManagement.view.Main","AssetManagement.view.AssetMenu"],refs:[{ref:"assetConfiguration",selector:"assetConfiguration"},{ref:"fileuploadform",selector:"fileuploadform"},{ref:"fileupload",selector:"fileupload"},{ref:"downloadutils",selector:"downloadutils"},{ref:"assetList",selector:"assetList"},{ref:"assetListColumn",selector:"assetListColumn"},{ref:"main",selector:"main"},{ref:"assetmenu",selector:"assetmenu"}],init:function(){this.control({'assetmenu tabpanel[id="assetTabDashPanel"]':{tabchange:this.clickDashboardPanelFun},'assetmenu tabpanel[id="assetTabDashPanel"]':{"afterrender":this.hideButtonFun},'assetConfiguration tabpanel[id="assetTabpanel"]':{tabchange:this.clickAssetTabPanelFun},'assetConfiguration button[action="SaveConfiguration"]':{click:this.SaveConfigurationFun,},'assetmenu button[id="saveIconTool"]':{"click":this.saveFile},'assetConfiguration combo[id="assetType"]':{"select":this.onSelectAssetType},"assetConfiguration":{"afterrender":this.afterConfigPanelRendered},"assetConfiguration combo[id=componenttype]":{select:this.onSelectComboValues},"assetConfiguration combo[id=componentname]":{select:this.changeDetails},'fileupload button[action="fileUploadAction"]':{click:this.assetFileUploadFun},'assetConfiguration button[id="backButton"]':{"click":this.goBackFromAssetConfig},'assetConfiguration button[id="assetView"]':{"click":this.assetView},'assetList button[id="reportBackButton"]':{"click":this.goBackFromAssetList},"assetList":{"afterrender":this.afterAssetListPanelRendered},"assetList combo[id=asset_Type]":{select:this.assetListTypeChange},"assetList combo[id=component_type]":{select:this.assetListCompTypeChange},'assetList button[id="getAssetBtn"]':{"click":this.getAssetDetails},'assetList button[id="setupColumn"]':{"click":this.getSetupColumnWindow},"assetListColumn":{"afterrender":this.afterAssetListColumnRender},'assetListColumn button[id="saveAsstColumnBtn"]':{"click":this.saveAsstGridColumns},'assetList button[id="panelinsidetoggleDown"]':{"click":this.toggleFormDown},'assetList button[id="panelinsidetoggleUP"]':{"click":this.toggleFormUP},'main button[id="assetConfigBtn"]':{"click":this.getAssetConfigView},'main button[id="assetReportBtn"]':{"click":this.getAssetReportView},'assetmenu button[id="reportSaveAsPdfToolBtn"]':{"click":this.saveReportAsPdfToolBtn},});
},hideButtonFun:function(){Ext.getCmp("importToolBtn").hide();Ext.getCmp("excelToolBtn").hide();Ext.getCmp("saveIconTool").hide();},clickDashboardPanelFun:function(){if(Ext.getCmp("assetTabDashPanel").getActiveTab().id=="home"){Ext.Ajax.request({url:"/final/admin/AssetManagement/data/EgAssetDashboard.jsp",scope:this,method:"POST",success:function(a){jsonData=Ext.decode(a.responseText);
var b=Ext.getCmp("assetmgmtViewPort");b.removeAll();b.add({xtype:"assetmenu",margin:10,itemData:jsonData});}});}},clickAssetTabPanelFun:function(){if(Ext.getCmp("assetTabpanel").getActiveTab().id=="softwareList"){Ext.getCmp("footerSaveBar").hide();}else{Ext.getCmp("footerSaveBar").show();}},saveReportAsPdfToolBtn:function(){var c="action=EgAssetListPDFDownload";
Ext.Ajax.request({url:"/final/admin/AssetManagement/data/EgAssetListConfig.jsp",method:"POST",params:c});var a="/final/servlet/com.eg.EgPdfDownloadC";var b=Ext.widget("downloadutils");b.savePDF(a);},toggleFormDown:function(b){Ext.getCmp("panelinsidetoggleUP").show();Ext.getCmp("panelinsidetoggleDown").hide();
var a=Ext.getCmp("reportDetailsContainer");if(a.isHidden()){a.show();Ext.getCmp("selectionDetails").hide();}else{a.hide();Ext.getCmp("selectionDetails").show();}},toggleFormUP:function(b){Ext.getCmp("panelinsidetoggleUP").hide();Ext.getCmp("panelinsidetoggleDown").show();var a=Ext.getCmp("reportDetailsContainer");
if(a.isHidden()){a.show();Ext.getCmp("selectionDetails").hide();}else{a.hide();Ext.getCmp("selectionDetails").show();}},saveFile:function(){var c="action=EgAssetPDFDownload";Ext.Ajax.request({url:"/final/admin/AssetManagement/data/EgAssetListConfig.jsp",method:"POST",params:c});var a="/final/servlet/com.eg.EgPdfDownloadC";
var b=Ext.widget("downloadutils");b.savePDF(a);},getAssetConfigView:function(){var a=Ext.getCmp("assetmgmtViewPort");a.removeAll();a.add({xtype:"assetConfiguration",});a.doLayout();var b="action=loadAssetType";Ext.Ajax.request({url:"/final/admin/AssetManagement/data/EgAssetListConfig.jsp",method:"POST",params:b,success:function(h){var i=h.responseText;
var j=Ext.decode(i);var e=j["ASSET_TYPE"];var g=j["COMP_TYPE"];var k=j["COMP_NAME"];var d=j["ASSET_STATE"];var l=j["ASSET_LOCAION"];var f=j["BUSINESS_SERVICE"];Ext.getCmp("assetType").getStore().loadRawData(e);Ext.getCmp("assetType").setValue("-1");Ext.getCmp("componenttype").getStore().loadRawData(g);
Ext.getCmp("componenttype").setValue("-1");Ext.getCmp("componentname").getStore().loadRawData(k);Ext.getCmp("componentname").setValue("-1");}});},getAssetReportView:function(){var a=Ext.getCmp("assetmgmtViewPort");a.removeAll();a.add({xtype:"assetList",});a.doLayout();},goBackFromAssetList:function(){window.location.href="/final/admin/EgAssetInfo.jsp";
},getSetupColumnWindow:function(){var a=Ext.getCmp("assetmgmtViewPort");var c=Ext.getCmp("setupColumn"),e=c.el.getX(),d=c.el.getY();var b=Ext.widget("assetListColumn",{});if(b!=null){b.setTitle(setupColumnTitle);b.showAt([e-768,d+14]);}},afterAssetListPanelRendered:function(){var a="action=loadAssetType";
Ext.Ajax.request({url:"/final/admin/AssetManagement/data/EgAssetListConfig.jsp",method:"POST",params:a,success:function(e){var j=e.responseText;jsonData=Ext.decode(j);var i=jsonData["ASSET_TYPE"];var d=jsonData["COMP_TYPE"];var f=jsonData["COMP_NAME"];var h=jsonData["ASSET_STATE"];var b=jsonData["ASSET_LOCAION"];
var g=jsonData["BUSINESS_SERVICE"];Ext.getCmp("asset_Type").getStore().loadRawData(i);Ext.getCmp("asset_Type").setValue("-1");Ext.getCmp("component_type").getStore().loadRawData(d);Ext.getCmp("component_type").setValue("-1");Ext.getCmp("component_name").getStore().loadRawData(f);Ext.getCmp("component_name").setValue("-1");
Ext.getCmp("assetStateList").getStore().loadRawData(h);Ext.getCmp("assetStateList").setValue("-1");Ext.getCmp("assetLocationList").getStore().loadRawData(b);Ext.getCmp("assetLocationList").setValue("-1");Ext.getCmp("businessServices").getStore().loadRawData(g);Ext.getCmp("businessServices").setValue("-1");
}});},assetListTypeChange:function(){var a=Ext.getCmp("asset_Type").getValue();if(a=="-1"){return;}var b="action=loadCompType&assetType="+a;Ext.Ajax.request({url:"/final/admin/AssetManagement/data/EgAssetListConfig.jsp",method:"POST",params:b,success:function(f){var j=f.responseText;jsonData=Ext.decode(j);
var e=jsonData["COMP_TYPE"];var g=jsonData["COMP_NAME"];var i=jsonData["ASSET_STATE"];var d=jsonData["ASSET_LOCAION"];var h=jsonData["BUSINESS_SERVICE"];Ext.getCmp("component_type").getStore().loadRawData(e);Ext.getCmp("component_type").setValue("-1");Ext.getCmp("component_name").getStore().loadRawData(g);
Ext.getCmp("component_name").setValue("-1");Ext.getCmp("assetStateList").getStore().loadRawData(i);Ext.getCmp("assetStateList").setValue("-1");Ext.getCmp("assetLocationList").getStore().loadRawData(d);Ext.getCmp("assetLocationList").setValue("-1");Ext.getCmp("businessServices").getStore().loadRawData(h);
Ext.getCmp("businessServices").setValue("-1");}});},assetListCompTypeChange:function(){var a=Ext.getCmp("component_type").getValue();if(a=="-1"){return;}var b="action=loadCompName&compType="+a;Ext.Ajax.request({url:"/final/admin/AssetManagement/data/EgAssetListConfig.jsp",method:"POST",params:b,success:function(e){var i=e.responseText;
jsonData=Ext.decode(i);var f=jsonData["COMP_NAME"];var h=jsonData["ASSET_STATE"];var d=jsonData["ASSET_LOCAION"];var g=jsonData["BUSINESS_SERVICE"];Ext.getCmp("component_name").getStore().loadRawData(f);Ext.getCmp("component_name").setValue("allcomponents");Ext.getCmp("assetStateList").getStore().loadRawData(h);
Ext.getCmp("assetStateList").setValue("allstates");Ext.getCmp("assetLocationList").getStore().loadRawData(d);Ext.getCmp("assetLocationList").setValue("alllocation");Ext.getCmp("businessServices").getStore().loadRawData(g);Ext.getCmp("businessServices").setValue("allbusiness");}});},getAssetDetails:function(){var k=Ext.getCmp("asset_Type").getValue();
var a=Ext.getCmp("component_type").getValue();var h=Ext.getCmp("component_name").getValue();var g=Ext.getCmp("assetStateList").getValue();var b=Ext.getCmp("assetLocationList").getValue();var e=Ext.getCmp("businessServices").getValue();var j=Ext.getCmp("component_name").getValue();if(h==null||h=="-1"||h==""){Ext.Msg.show({title:assetAlertTitle,msg:compoNameLbl,buttons:Ext.MessageBox.OK,icon:"iconInformation"});
return;}if(h=="allcomponents"){h="";j="";var m=Ext.getCmp("component_name").getStore();var n=m.getCount();for(var f=0;f<n;f++){var l=m.getAt(f).get("valueField");if(l!="allcomponents"){h=h+","+l;}}if(h!=null&&h.indexOf(",")==0){h=h.substring(1);}}if(g=="allstates"){g="";}if(b=="alllocation"){b="";}if(e=="allbusiness"){e="";
}Ext.getCmp("assetDataGridContainer").show();var c=new Ext.LoadMask(Ext.getCmp("assetDataGridContainer"),{msg:"Loading ...",});c.show();var d="action=getAssetData&compType="+encodeURIComponent(a)+"&assetType="+encodeURIComponent(k)+"&compName="+encodeURIComponent(h)+"&assetStateList="+encodeURIComponent(g)+"&assetLocationList="+encodeURIComponent(b)+"&businessServices="+encodeURIComponent(e)+"&compsForTooltip="+encodeURIComponent(j);
Ext.Ajax.request({url:"/final/admin/AssetManagement/data/EgAssetListConfig.jsp",method:"POST",params:d,success:function(s){Ext.getCmp("panelinsidetoggleDown").show();Ext.getCmp("panelinsidetoggleUP").hide();var r=Ext.getCmp("selectionDetails");r.show();Ext.getCmp("reportDetailsContainer").hide();var v=s.responseText;
jsonData=Ext.decode(v);var o=jsonData["AssetGridData"]["gridCols"];var w=jsonData["AssetGridData"]["gridData"];var z=jsonData["AssetFilterData"];$("#select_assetType").html(z.assetType);$("#select_assetType").attr("data-qtip",z.assetTypeTooltip);$("#select_compType").html(z.componentType);$("#select_compType").attr("data-qtip",z.componentTypeTooltip);
$("#select_compName").html(z.componentName);$("#select_compName").attr("data-qtip",z.componentNameTooltip);$("#select_assetStateList").html(z.assetStates);$("#select_assetStateList").attr("data-qtip",z.assetStatesTooltip);$("#select_assetLocationList").html(z.assetLocations);$("#select_assetLocationList").attr("data-qtip",z.assetLocationsTooltip);
$("#select_businessServices").html(z.businessServices);$("#select_businessServices").attr("data-qtip",z.businessServicesTooltip);r.doLayout();var A=[];var t=[];var u=[];for(var y in o){var x=o[y].toString();t.push({name:x,type:"string"});A.push({header:x,dataIndex:x,sortable:false,minWidth:150});}var q=Ext.getCmp("assetGrid");
q.getStore().removeAll();var p=Ext.create("Ext.data.Store",{fields:t,data:w,pageSize:1,proxy:{type:"ajax",url:"/final/admin/AssetManagement/data/EgAssetListConfig.jsp?"+d,reader:{type:"json",root:"AssetGridData",page:"page",start:"start",limit:"limit",totalProperty:"totalCount"}},selModel:{selType:"cellmodel"}});
var i=Ext.getCmp("pagingToolBar",{store:p});q.reconfigure(p,A);c.hide();Ext.getCmp("reportSaveAsExcelToolBtn").show();Ext.getCmp("reportSaveAsPdfToolBtn").show();if(p.data.length==0){Ext.getCmp("reportSaveAsExcelToolBtn").hide();Ext.getCmp("reportSaveAsPdfToolBtn").hide();}}});},afterAssetListColumnRender:function(){var a="action=loadAssetColumns";
Ext.Ajax.request({url:"/final/admin/AssetManagement/data/EgAssetColumnConfig.jsp",method:"POST",params:a,success:function(b){var h=b.responseText;jsonData=Ext.decode(h);var e=jsonData["AssetColumns"];var d=Ext.getCmp("assetDetailsColumn");var f=[];var g={xtype:"checkboxgroup",columns:4,labelSeparator:"",cls:"checkbt",id:"assetGridColumns",items:e};
d.removeAll();d.add(g);}});},saveAsstGridColumns:function(){var d="";var b=Ext.getCmp("assetGridColumns").getChecked();for(var a=0;a<b.length;a++){d=d+","+b[a].inputValue;}if(d!=null&&d.indexOf(",")==0){d=d.substring(1);}var c="action=saveAssetGridColumns&assetGridCols="+encodeURIComponent(d);Ext.Ajax.request({url:"/final/admin/AssetManagement/data/EgAssetColumnConfig.jsp",method:"POST",params:c,success:function(e){var f=e.responseText;
jsonData=Ext.decode(f);Ext.Msg.show({title:assetAlertTitle,msg:assetColConfigAlert,buttons:Ext.MessageBox.OK,fn:function(g){Ext.getCmp("assetListColConf").close();var h=Ext.getCmp("component_name").getValue();if(h!=null&&h[0]!="-1"&&h!=""){Ext.getCmp("getAssetBtn").fireEvent("click",Ext.getCmp("getAssetBtn"));
}}});}});},afterConfigPanelRendered:function(){var a="action=loadAssetType";Ext.Ajax.request({url:"/final/admin/AssetManagement/data/EgAssetListConfig.jsp",method:"POST",params:a,success:function(g){var h=g.responseText;var i=Ext.decode(h);var d=i["ASSET_TYPE"];var f=i["COMP_TYPE"];var j=i["COMP_NAME"];
var b=i["ASSET_STATE"];var k=i["ASSET_LOCAION"];var e=i["BUSINESS_SERVICE"];Ext.getCmp("assetType").getStore().loadRawData(d);Ext.getCmp("assetType").setValue("-1");Ext.getCmp("componenttype").getStore().loadRawData(f);Ext.getCmp("componenttype").setValue("-1");Ext.getCmp("componentname").getStore().loadRawData(j);
Ext.getCmp("componentname").setValue("-1");}});},onSelectAssetType:function(){var a=Ext.getCmp("assetType").getValue();if(a=="-1"){return;}var b="action=loadCompType&assetType="+a;Ext.Ajax.request({url:"/final/admin/AssetManagement/data/EgAssetListConfig.jsp",method:"POST",params:b,success:function(f){var j=f.responseText;
jsonData=Ext.decode(j);var e=jsonData["COMP_TYPE"];var g=jsonData["COMP_NAME"];var i=jsonData["ASSET_STATE"];var d=jsonData["ASSET_LOCAION"];var h=jsonData["BUSINESS_SERVICE"];Ext.getCmp("componenttype").getStore().loadRawData(e);Ext.getCmp("componenttype").setValue("-1");Ext.getCmp("componentname").getStore().loadRawData(g);
Ext.getCmp("componentname").setValue("-1");}});},onSelectComboValues:function(){var a="";var e=Ext.getCmp("componenttype").getValue();if(e!="-1"){var c="C=true&F=getComponentsForType&P0={"+e+"}&calljson=true";var d=new Array();Ext.Ajax.request({url:"/final/servlet/com.eg.EgMonRemoteScriptingServlet",method:"POST",params:c+"&screenWidth="+(Ext.getBody().getViewSize().width)+"&screenHeight="+(Ext.getBody().getViewSize().height),scope:this,success:function(g){var j=g.responseText;
var i=Ext.decode(j);var f=new Array();if(j!=null&&j!=""){f=i["compOptsJson"];var h=Ext.getCmp("componentname");h.getStore().loadRawData(i["compOptsJson"]);a=i["compOptsJson"][0]["valueField"];h.setValue(i["compOptsJson"][0]["valueField"]);this.changeDetails(a);}},failure:function(){}});}else{var b=publicAssetJson["COMPNAME_VAL"];
Ext.getCmp("componentname").getStore().loadRawData(b);Ext.getCmp("componentname").setValue(TypeCmpVals["COMPNAME_VAL"][0]["valueField"]);}},changeDetails:function(c){var d=this;saved=null;var b=Ext.getCmp("customContainer");b.removeAll();customFields=0;var h=Ext.getCmp("componenttype").getValue();var f="";
if(c==null||c==""||c=="undefined"){f=Ext.getCmp("componentname").getValue();}else{if(typeof c=="object"){f=c.getValue();}else{f=c;}}if(f.indexOf(":")==-1){f=f+":NULL";}var a=h;var g=f;var e="serverType="+a+"&serverName="+g;Ext.Ajax.request({url:"/final/admin/AssetManagement/data/EgAssetConfiguration.jsp",method:"POST",params:e,success:function(o){if(o.status==200&&!Ext.isEmpty(o.responseText)){if(Ext.get("loadmask")){Ext.get("loadmask").remove();
}var w=o.responseText;jsonText=Ext.decode(w);Ext.getCmp("checkbox1").hide();Ext.getCmp("multiSelectAsset").hide();Ext.getCmp("SimilarLabel").hide();screenLabels=jsonText["SCREEN_LABELS"];assetFields=jsonText["ASSET_FIELDS"];assetTypeFields=jsonText["ASSET_TYPE_FIELDS"];publicAssetJson=jsonText["COMBO_VALUES"];
selectedValues=jsonText["SELECTED_VALUES"];var n=Ext.getCmp("assetmgmtViewPort");Ext.getCmp("componenttype").setFieldLabel(screenLabels["COMPTYPELABEL"]);Ext.getCmp("componentname").setFieldLabel(screenLabels["COMPNAMELABEL"]);var k=publicAssetJson["ASSET_TYPE"];Ext.getCmp("assetType").getStore().loadRawData(k);
Ext.getCmp("assetType").setValue(selectedValues["selected_AssetType"]);d.loadAssetFields();confEnabled=jsonText["CONF_ENABLED"];displayMessage=jsonText["DISPLAY_MSG"];var p=publicAssetJson["COMPTYPE_VAL"];var x=[];var v=Ext.getCmp("assetType").getValue();for(var q=0;q<p.length;q++){var t=p[q];if(v==t["serverCategory"]){x.push(t);
}}var s=selectedValues["Selected_CmpType"];Ext.getCmp("componenttype").getStore().loadRawData(x);Ext.getCmp("componenttype").setValue(s);var p=publicAssetJson["COMPNAME_VAL"];var s=selectedValues["Selected_Comp"];Ext.getCmp("componentname").getStore().loadRawData(p);Ext.getCmp("componentname").setValue(s);
if(publicAssetJson["ApplyAll_Server"]!=null){var u=Ext.getCmp("checkbox1");u.show();if(u.checked==true){u.setValue(false);}var p=publicAssetJson["ApplyAll_Server"];Ext.getCmp("multiSelectAsset").getStore().loadRawData(p);}var m=selectedValues["CUSTOM_ATTRIBUTES"];for(var r=0;r<m.length;r++){var y=m[r]["CustomDisplay"];
var l=m[r]["CustomValue"];d.createCustomData(y,l);}}}});},loadAssetFields:function(){var d=Ext.getCmp("CustomFieldContainer");if(d!=null){d.hide();}Ext.getCmp("form3").hide();var c=Ext.getCmp("form2");c.setHeight(Ext.getBody().getHeight()-300);c.show();var b=new Ext.LoadMask(Ext.getCmp("form2"),{msg:"Loading ...",});
b.show();var e=[{valueField:"-1",displayField:compoTypeLbl}];var a=Ext.getCmp("assetType").getValue();setTimeout(function(){Ext.getCmp("assetTabpanel").getComponent("assetDetail").tab.hide();Ext.getCmp("assetDetail").removeAll();Ext.getCmp("assetTabpanel").getComponent("techDetails").tab.hide();Ext.getCmp("techDetails").removeAll();
Ext.getCmp("assetTabpanel").getComponent("software").tab.hide();Ext.getCmp("software").removeAll();Ext.getCmp("assetTabpanel").getComponent("ups").tab.hide();Ext.getCmp("ups").removeAll();Ext.getCmp("assetTabpanel").getComponent("cloud").tab.hide();Ext.getCmp("cloud").removeAll();Ext.getCmp("assetTabpanel").getComponent("aws").tab.hide();
Ext.getCmp("aws").removeAll();Ext.getCmp("assetTabpanel").getComponent("misc").tab.hide();Ext.getCmp("misc").removeAll();Ext.getCmp("assetTabpanel").getComponent("softwareList").tab.hide();Ext.getCmp("softwareList").removeAll();var f=assetTypeFields[a];var j=Ext.getCmp("componenttype").getValue();for(var h=0;
h<f.length;h++){var g=f[h];if(g=="General"){loadAssetDetailsUI();Ext.getCmp("assetDetail").show();Ext.getCmp("assetTabpanel").getComponent("assetDetail").tab.show();Ext.getCmp("assetTabpanel").setActiveTab(0);}else{if(g=="Misc"){loadMiscUI();}else{if(g=="Technical"){loadTechnicalUI(g);}else{if(g=="Software"){loadSoftwareUI();
}else{if(g=="Hardware"){loadTechnicalUI(g);}else{if(g=="Network"){loadTechnicalUI(g);}else{if(g=="UPS"){loadUPSUI();}else{if(g=="Cloud"){loadCloudUI();}else{if(g=="AWS"){if(j.indexOf("AWS")>-1){loadAWSUI();}}}}}}}}}}}if(d!=null){d.show();}b.destroy();c.hide();if(Ext.getCmp("customContainer").items.length>0){Ext.getCmp("customContainer").tab.show();
Ext.getCmp("addCustomFieldBtn").hide();}else{Ext.getCmp("addCustomFieldBtn").show();Ext.getCmp("customContainer").tab.hide();}Ext.getCmp("form3").show();},1000);},createCustomData:function(b,d){var a=Ext.getCmp("customContainer");a.show();var f="CustomNameField_"+customFieldCnt;var c="CustomValueField_"+customFieldCnt;
var e="customFieldCnt_"+customFieldCnt;if(customFields<5){a.add({xtype:"container",id:e,layout:"hbox",items:[{xtype:"textfield",id:f,name:f,cls:"textbox",fieldLabel:customAttributeDisplayLbl,labelAlign:"top",labelSeparator:" ",value:b,columnWidth:0.4,width:230,margin:"0 0 0 0"},{xtype:"textfield",id:c,name:c,cls:"textbox",fieldLabel:customAttributeValueLbl,labelAlign:"top",value:d,labelSeparator:" ",columnWidth:0.4,width:230,margin:"0 0 0 20"},{xtype:"container",columnWidth:0.04,margin:"22 0 5 5",items:[{xtype:"button",id:"removeIcon_"+customFieldCnt,containerIDVal:customFieldCnt,iconCls:"iconMinus",style:{background:"none",border:"0px"},handler:function(){removeCustomField(this.containerIDVal);
},listeners:{afterrender:function(){Ext.create("Ext.tip.ToolTip",{target:this.id,anchor:"top",cls:"yellowTip",trackMouse:true,html:removeLbl});}}},{xtype:"button",iconCls:"iconPlus",style:{background:"none",border:"0px"},handler:function(){createCustomData();},listeners:{afterrender:function(){Ext.create("Ext.tip.ToolTip",{target:this.id,anchor:"top",cls:"yellowTip",trackMouse:true,html:"Add"});
}}}]}]});customFieldCnt++;customFields++;a.doLayout();}else{Ext.Msg.show({title:assetAlertTitle,msg:fieldsMsg,buttons:Ext.MessageBox.OK,icon:"iconInformation"});}},SaveConfigurationFun:function(){var H="";var K=Ext.getCmp("assetName");if(K!=null&&K!="undefined"){H=K.getValue().trim();}var y="";var aj=Ext.getCmp("assetDescription");
if(aj!=null&&aj!="undefined"){y=aj.getValue();}var t="";var U=Ext.getCmp("assetType");if(U!=null&&U!="undefined"){t=U.getValue();}var bg="";var aU=Ext.getCmp("assetState");if(aU!=null&&aU!="undefined"){bg=aU.getValue();}var Z="";var am=Ext.getCmp("hostIP");if(am!=null&&am!="undefined"){Z=am.getValue();
}var f="";var h=Ext.getCmp("mac_address");if(h!=null&&h!="undefined"){f=h.getValue().trim();}var W="";var m=Ext.getCmp("os");if(m!=null&&m!="undefined"){W=m.getValue();}var aT="";var aV=Ext.getCmp("os_version");if(aV!=null&&aV!="undefined"){aT=aV.getValue();}var s="";var a2=Ext.getCmp("memory");if(a2!=null&&a2!="undefined"){s=a2.getValue();
}var az="";var F=Ext.getCmp("diskSpace");if(F!=null&&F!="undefined"){az=F.getValue();}var ay="";var I=Ext.getCmp("cpu_speed");if(I!=null&&I!="undefined"){ay=I.getValue();}var ap="";var aF=Ext.getCmp("cpu_coreCount");if(aF!=null&&aF!="undefined"){ap=aF.getValue();}var aW="";var J=Ext.getCmp("uuid");if(J!=null&&J!="undefined"){aW=J.getValue();
}var aG="";var bd=Ext.getCmp("manufacturer");if(bd!=null&&bd!="undefined"){aG=bd.getValue();}var aN="";var ak=Ext.getCmp("serialNumber");if(ak!=null&&ak!="undefined"){aN=ak.getValue();}var D="";var M=Ext.getCmp("asmExpiryDate");if(M!=null&&M!="undefined"){D=Ext.Date.dateFormat(M.getValue(),assetDfltDateFrmt);
}var aP="";var aQ=Ext.getCmp("user");if(aQ!=null&&aQ!="undefined"){aP=aQ.getValue();}var ag="";var aI=Ext.getCmp("supportGroup");if(aI!=null&&aI!="undefined"){ag=aI.getValue();}var u="";var R=Ext.getCmp("os_servicePack");if(R!=null&&R!="undefined"){u=R.getValue();}var aS="";var a3=Ext.getCmp("location");
if(a3!=null&&a3!="undefined"){aS=a3.getValue();}var aR="";var bb=Ext.getCmp("businessImpact");if(bb!=null&&bb!="undefined"){aR=bb.getValue();}var o="";var a6=Ext.getCmp("emailAddress");if(a6!=null&&a6!="undefined"){o=a6.getValue().trim();}var k="";var z=Ext.getCmp("businessService");if(z!=null&&z!="undefined"){k=z.getValue();
}var at="";var A=Ext.getCmp("phoneNumber");if(A!=null&&A!="undefined"){at=A.getValue().trim();}var r="";var Q=Ext.getCmp("product");if(Q!=null&&Q!="undefined"){r=Q.getValue().trim();}var ai="";var an=Ext.getCmp("vendor");if(an!=null&&an!="undefined"){ai=an.getValue().trim();}var aZ="";var e=Ext.getCmp("cost");
if(e!=null&&e!="undefined"){aZ=e.getValue().trim();}var B="";var P=Ext.getCmp("licenseKey");if(P!=null&&P!="undefined"){B=P.getValue().trim();}var g="";var T=Ext.getCmp("installationDate");if(T!=null&&T!="undefined"){g=Ext.Date.dateFormat(T.getValue(),assetDfltDateFrmt);}var aD="";var ah=Ext.getCmp("licenseType");
if(ah!=null&&ah!="undefined"){aD=ah.getValue().trim();}var aE="";var aL=Ext.getCmp("licenseExpirydate");if(aL!=null&&aL!="undefined"){aE=aL.getValue();}var ax="";var aY=Ext.getCmp("licenseSerialNumber");if(aY!=null&&aY!="undefined"){ax=aY.getValue();}var G="";var a0=Ext.getCmp("version");if(a0!=null&&a0!="undefined"){G=a0.getValue().trim();
}var a1="";var ae=Ext.getCmp("domain");if(ae!=null&&ae!="undefined"){a1=ae.getValue().trim();}var d="";var V=Ext.getCmp("installedMachine");if(V!=null&&V!="undefined"){d=V.getValue().trim();}var Y="";var x=Ext.getCmp("installationPath");if(x!=null&&x!="undefined"){Y=x.getValue().trim();}var j="";var n=Ext.getCmp("warranty");
if(n!=null&&n!="undefined"){j=Ext.Date.dateFormat(n.getValue(),assetDfltDateFrmt);}var au="";var a5=Ext.getCmp("acquisitionDate");if(a5!=null&&a5!="undefined"){au=Ext.Date.dateFormat(a5.getValue(),assetDfltDateFrmt);}var a9="";var l=Ext.getCmp("bandwidth");if(l!=null&&l!="undefined"){a9=l.getValue().trim();
}var a4="";var aa=Ext.getCmp("networkRange");if(aa!=null&&aa!="undefined"){a4=aa.getValue().trim();}var w="";var aB=Ext.getCmp("batteryStatus");if(aB!=null&&aB!="undefined"){w=aB.getValue().trim();}var bh="";var aC=Ext.getCmp("batteryVoltage");if(aC!=null&&aC!="undefined"){bh=aC.getValue().trim();}var aX="";
var E=Ext.getCmp("batteryCurrent");if(E!=null&&E!="undefined"){aX=E.getValue().trim();}var q="";var p=Ext.getCmp("firmware");if(p!=null&&p!="undefined"){q=p.getValue().trim();}var av="";var b=Ext.getCmp("firmwareVersion");if(b!=null&&b!="undefined"){av=b.getValue().trim();}var X="";var ad=Ext.getCmp("subnetMask");
if(ad!=null&&ad!="undefined"){X=ad.getValue().trim();}var aJ="";var a=Ext.getCmp("lastAuditDate");if(a!=null&&a!="undefined"){aJ=Ext.Date.dateFormat(a.getValue(),assetDfltDateFrmt);}var C="";var aK=Ext.getCmp("account");if(aK!=null&&aK!="undefined"){C=aK.getValue().trim();}var ao="";var al=Ext.getCmp("region");
if(al!=null&&al!="undefined"){ao=al.getValue().trim();}var be="";var v=Ext.getCmp("availabilityZone");if(v!=null&&v!="undefined"){be=v.getValue().trim();}var ar=null;var ab=Ext.getCmp("checkbox1").checked;var aH="";var aA=Ext.getCmp("never");if(aA!=null&&aA!="undefined"){aH=aA.getValue();}var aw="";var O=Ext.getCmp("hiddenLicenseExpdate");
if(O!=null&&O!="undefined"){aw=O.getValue();}var a7="'";if(aH==true){aE=aw;}else{if(aE){aE=Ext.Date.dateFormat(aE,assetDfltDateFrmt);}}var af="";var a8="";for(var ac=0;ac<customFieldCnt;ac++){if(Ext.getCmp("CustomNameField_"+ac)!=null){if(isDoubleByteMgr=="false"){if(!this.validateSingleByte((Ext.getCmp("CustomNameField_"+ac).getValue()).trim())){Ext.Msg.show({title:assetAlertTitle,msg:"CustomNameField "+doubleByteEntry,buttons:Ext.MessageBox.OK,icon:"iconInformation",fn:function(i){Ext.getCmp("CustomNameField_"+ac).focus(true);
}});return;}else{if(!this.validateSingleByte((Ext.getCmp("CustomValueField_"+ac).getValue()))){Ext.Msg.show({title:assetAlertTitle,msg:"CustomValueField "+doubleByteEntry,buttons:Ext.MessageBox.OK,icon:"iconInformation",fn:function(i){Ext.getCmp("CustomValueField_"+ac).focus(true);}});return;}}}if(Ext.getCmp("CustomNameField_"+ac).getValue().length==0){Ext.Msg.show({title:assetAlertTitle,msg:customDisplayMsg,buttons:Ext.MessageBox.OK,icon:"iconInformation",fn:function(i){Ext.getCmp("CustomNameField_"+ac).focus(true);
}});return;}else{if(this.isValidColumnName((Ext.getCmp("CustomNameField_"+ac).getValue()).trim())==false){Ext.Msg.show({title:assetAlertTitle,msg:assetMsg,buttons:Ext.MessageBox.OK,icon:"iconInformation",fn:function(i){Ext.getCmp("CustomNameField_"+ac).focus(true);}});return;}else{if(Ext.getCmp("CustomValueField_"+ac).getValue().length==0){Ext.Msg.show({title:assetAlertTitle,msg:customAttributeValueMsg,buttons:Ext.MessageBox.OK,icon:"iconInformation",fn:function(i){Ext.getCmp("CustomValueField_"+ac).focus(true);
}});return;}else{if(this.validateFieldvalue("CustomValueField_"+ac,Ext.getCmp("CustomValueField_"+ac).getValue(),256,"'")==false){Ext.Msg.show({title:assetAlertTitle,msg:assetMsg,buttons:Ext.MessageBox.OK,icon:"iconInformation",fn:function(i){Ext.getCmp("CustomValueField_"+ac).focus(true);}});return;
}else{a8+=Ext.getCmp("CustomNameField_"+ac).getValue();a8+="~@~";af+=(Ext.getCmp("CustomNameField_"+ac).getValue()).trim();af+="~@~";af+=Ext.getCmp("CustomValueField_"+ac).getValue();af+="#~#";}}}}}}if(af.lastIndexOf("#~#")>-1){af=af.substring(0,af.lastIndexOf("#~#"));}if(this.checkduplicateValue(a8)){Ext.Msg.show({title:assetAlertTitle,msg:duplicateCustomDisplayMsg,buttons:Ext.MessageBox.OK,icon:"iconInformation"});
return;}if(ab==true){Ext.getCmp("multiSelectAsset").show();ab="on";ar=Ext.getCmp("multiSelectAsset").getValue();if(ar==null||ar==""){Ext.Msg.show({title:assetAlertTitle,msg:"Please choose atleast one server of the same name",buttons:Ext.MessageBox.OK,icon:"iconInformation"});return;}}else{ab="null";}var aR=Ext.getCmp("businessImpact").getValue();
var bg=Ext.getCmp("assetState").getValue();var bc=Ext.getCmp("componenttype").getValue();if(bc==null||bc==""||bc=="-1"){Ext.Msg.show({title:assetAlertTitle,msg:compoTypeLbl,buttons:Ext.MessageBox.OK,icon:"iconInformation"});return;}var c=Ext.getCmp("componentname").getValue();if(c==null||c==""||c=="-1"){Ext.Msg.show({title:assetAlertTitle,msg:compoNameLbl,buttons:Ext.MessageBox.OK,icon:"iconInformation"});
return;}var N=/^\w+([-+.']\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*$/;var aM;if(o!=""){aM=N.test(o);}if(isDoubleByteMgr=="false"){var aq=this.checkDoubleByte(H,y,t,aS,W,aG,aP,ag,k);if(aq!=""){Ext.Msg.show({title:assetAlertTitle,msg:aq+" "+doubleByteEntry,buttons:Ext.MessageBox.OK,icon:"iconInformation",fn:function(i){Ext.getCmp(aq).focus(true);
}});return;}}var bf=/^[0-9]+(\.[0-9]+)?(KB|MB|GB|TB|PB|EB|ZB|YB| KB| MB| GB| TB| PB| EB| ZB| YB)$/;if(s!=null&&s!=""){if(!bf.test(s)){Ext.Msg.show({title:assetAlertTitle,msg:invalidMemory,buttons:Ext.MessageBox.OK,icon:"iconInformation"});return false;}}if(az!=null&&az!=""){if(!bf.test(az)){Ext.Msg.show({title:assetAlertTitle,msg:invalidDiskSpace,buttons:Ext.MessageBox.OK,icon:"iconInformation"});
return false;}}var aO=/^[0-9]+(\.[0-9]+)?(MHz|GHz| MHz| GHz)$/;if(ay!=null&&ay!=""){if(!aO.test(ay)){Ext.Msg.show({title:assetAlertTitle,msg:invalidCPUSpeed,buttons:Ext.MessageBox.OK,icon:"iconInformation"});return false;}}var L=/^[-+]?[0-9]+(\.[0-9]+)?$/;if(aZ!=null&&aZ!=""){if(!L.test(aZ)){Ext.Msg.show({title:assetAlertTitle,msg:invalidCost,buttons:Ext.MessageBox.OK,icon:"iconInformation"});
return false;}if(aZ.length>11){Ext.Msg.show({title:assetAlertTitle,msg:costLengthMsg,buttons:Ext.MessageBox.OK,icon:"iconInformation"});return false;}}var S=/^[0-9 ]+$/;if(at!=null&&at!=""){if(!S.test(at)){Ext.Msg.show({title:assetAlertTitle,msg:numericalMsg,buttons:Ext.MessageBox.OK,icon:"iconInformation"});
return false;}if(at.length<5){Ext.Msg.show({title:assetAlertTitle,msg:phnumberLengthMsg,buttons:Ext.MessageBox.OK,icon:"iconInformation"});return false;}}if(ap!=null&&ap!=""){if(!S.test(ap)){Ext.Msg.show({title:assetAlertTitle,msg:cpuCoreCountnumericalMsg,buttons:Ext.MessageBox.OK,icon:"iconInformation"});
return false;}}if(H.length==0){Ext.Msg.show({title:assetAlertTitle,msg:emptyAssetNameMsg,buttons:Ext.MessageBox.OK,icon:"iconInformation"});}else{if(this.validateFieldvalue("assetName",H,32,a7)==false){Ext.Msg.show({title:assetAlertTitle,msg:assetMsg,buttons:Ext.MessageBox.OK,icon:"iconInformation",fn:function(i){Ext.getCmp("assetName").focus(true);
}});}else{if(this.validateFieldvalue("assetDescription",y,1024,a7)==false){Ext.Msg.show({title:assetAlertTitle,msg:assetMsg,buttons:Ext.MessageBox.OK,icon:"iconInformation",fn:function(i){Ext.getCmp("assetDescription").focus(true);}});}else{if(this.validateFieldvalue("assetType",t,32,a7)==false){Ext.Msg.show({title:assetAlertTitle,msg:assetMsg,buttons:Ext.MessageBox.OK,icon:"iconInformation",fn:function(i){Ext.getCmp("assetType").focus(true);
}});}else{if(this.validateFieldvalue("assetLocation",32,aS,a7)==false){Ext.Msg.show({title:assetAlertTitle,msg:assetMsg,buttons:Ext.MessageBox.OK,icon:"iconInformation",fn:function(i){Ext.getCmp("assetLocation").focus(true);}});}else{if((this.validateIpOrHName(Z))==false){}else{if(this.validateFieldvalue("macAddress",f,32,a7)==false){Ext.Msg.show({title:assetAlertTitle,msg:assetMsg,buttons:Ext.MessageBox.OK,icon:"iconInformation",fn:function(i){Ext.getCmp("macAddress").focus(true);
}});}else{if(this.validateFieldvalue("os",W,256,a7)==false){Ext.Msg.show({title:assetAlertTitle,msg:assetMsg,buttons:Ext.MessageBox.OK,icon:"iconInformation",fn:function(i){Ext.getCmp("os").focus(true);}});}else{if(this.validateFieldvalue("manufacturer",aG,32,a7)==false){Ext.Msg.show({title:assetAlertTitle,msg:assetMsg,buttons:Ext.MessageBox.OK,icon:"iconInformation",fn:function(i){Ext.getCmp("manufacturer").focus(true);
}});}else{if(this.validateFieldvalue("serialNumber",aN,32,a7)==false){Ext.Msg.show({title:assetAlertTitle,msg:assetMsg,buttons:Ext.MessageBox.OK,icon:"iconInformation",fn:function(i){Ext.getCmp("serialNumber").focus(true);}});}else{if(this.validateFieldvalue("licenseSerialNumber",ax,32,a7)==false){Ext.Msg.show({title:assetAlertTitle,msg:assetMsg,buttons:Ext.MessageBox.OK,icon:"iconInformation",fn:function(i){Ext.getCmp("licenseserialNumber").focus(true);
}});}else{if(this.validateFieldvalue("user",aP,32,a7)==false){Ext.Msg.show({title:assetAlertTitle,msg:assetMsg,buttons:Ext.MessageBox.OK,icon:"iconInformation",fn:function(i){Ext.getCmp("user").focus(true);}});}else{if(this.validateFieldvalue("supportGroup",ag,32,a7)==false){Ext.Msg.show({title:assetAlertTitle,msg:assetMsg,buttons:Ext.MessageBox.OK,icon:"iconInformation",fn:function(i){Ext.getCmp("supportGroup").focus(true);
}});}else{if(aM==false){Ext.Msg.show({title:assetAlertTitle,msg:emailMsg,buttons:Ext.MessageBox.OK,icon:"iconInformation",fn:function(i){}});}else{if(this.validateFieldvalue("phoneNumber",at,32,a7)==false){Ext.Msg.show({title:assetAlertTitle,msg:assetMsg,buttons:Ext.MessageBox.OK,icon:"iconInformation",fn:function(i){Ext.getCmp("phnumber").focus(true);
}});}else{if(this.validateFieldvalue("cost",aZ,32,a7)==false){Ext.Msg.show({title:assetAlertTitle,msg:assetMsg,buttons:Ext.MessageBox.OK,icon:"iconInformation",fn:function(i){Ext.getCmp("phnumber").focus(true);}});}else{if(this.validateFieldvalue("businessService",k,32,a7)==false){Ext.Msg.show({title:assetAlertTitle,msg:assetMsg,buttons:Ext.MessageBox.OK,icon:"iconInformation",fn:function(i){Ext.getCmp("businessService").focus(true);
}});}else{var ba=new Ext.LoadMask(Ext.getCmp("assetmgmtViewPort"),{msg:"Loading ...",});ba.show();bc=filterEncode(bc);c=filterEncode(c);H=filterEncode(H);t=filterEncode(t);aS=filterEncode(aS);f=filterEncode(f);aG=filterEncode(aG);ag=filterEncode(ag);aR=filterEncode(aR);y=filterEncode(y);Z=filterEncode(Z);
bg=filterEncode(bg);W=filterEncode(W);aP=filterEncode(aP);k=filterEncode(k);at=filterEncode(at);o=filterEncode(o);aE=filterEncode(aE);D=filterEncode(D);aN=filterEncode(aN);ax=filterEncode(ax);aT=filterEncode(aT);s=filterEncode(s);az=filterEncode(az);ay=filterEncode(ay);ap=filterEncode(ap);aW=filterEncode(aW);
u=filterEncode(u);r=filterEncode(r);ai=filterEncode(ai);aZ=filterEncode(aZ);B=filterEncode(B);g=filterEncode(g);aD=filterEncode(aD);G=filterEncode(G);a1=filterEncode(a1);d=filterEncode(d);Y=filterEncode(Y);j=filterEncode(j);au=filterEncode(au);a9=filterEncode(a9);a4=filterEncode(a4);w=filterEncode(w);
bh=filterEncode(bh);aX=filterEncode(aX);q=filterEncode(q);av=filterEncode(av);X=filterEncode(X);aJ=filterEncode(aJ);C=filterEncode(C);ao=filterEncode(ao);be=filterEncode(be);ab=filterEncode(ab);af=filterEncode(af);params="serverType="+encodeURIComponent(bc)+"&serverName="+encodeURIComponent(c+"")+"&AssetName="+encodeURIComponent(H)+"&AssetType="+encodeURIComponent(t)+"&AssetLocation="+encodeURIComponent(aS)+"&MacAddr="+encodeURIComponent(f)+"&Manufacturer="+encodeURIComponent(aG)+"&SupprtGroups="+encodeURIComponent(ag)+"&BusinessImpact="+encodeURIComponent(aR)+"&AssetDescription="+encodeURIComponent(y)+"&IpAddr="+encodeURIComponent(Z)+"&AssetState="+encodeURIComponent(bg)+"&OperatingSys="+encodeURIComponent(W)+"&OwnerForAsset="+encodeURIComponent(aP)+"&BusinessServc="+encodeURIComponent(k)+"&AssetPhNo="+encodeURIComponent(at)+"&AssetEmailAddr="+encodeURIComponent(o)+"&LiceDate="+encodeURIComponent(aE)+"&ASMDate="+encodeURIComponent(D)+"&AssetSerialNum="+encodeURIComponent(aN)+"&AssetLicenseSerialNum="+encodeURIComponent(ax)+"&osVersion="+encodeURIComponent(aT)+"&memory="+encodeURIComponent(s)+"&diskSpace="+encodeURIComponent(az)+"&cpuSpeed="+encodeURIComponent(ay)+"&cpuCoreCount="+encodeURIComponent(ap)+"&uuid="+encodeURIComponent(aW)+"&osServicePack="+encodeURIComponent(u)+"&product="+encodeURIComponent(r)+"&vendor="+encodeURIComponent(ai)+"&cost="+encodeURIComponent(aZ)+"&licenseKey="+encodeURIComponent(B)+"&installationDate="+encodeURIComponent(g)+"&licenseType="+encodeURIComponent(aD)+"&version="+encodeURIComponent(G)+"&domain="+encodeURIComponent(a1)+"&installedMachine="+encodeURIComponent(d)+"&installationPath="+encodeURIComponent(Y)+"&warranty="+encodeURIComponent(j)+"&acquisitionDate="+encodeURIComponent(au)+"&bandwidth="+encodeURIComponent(a9)+"&networkRange="+encodeURIComponent(a4)+"&batteryStatus="+encodeURIComponent(w)+"&batteryVoltage="+encodeURIComponent(bh)+"&batteryCurrent="+encodeURIComponent(aX)+"&firmware="+encodeURIComponent(q)+"&firmwareVersion="+encodeURIComponent(av)+"&subnetMask="+encodeURIComponent(X)+"&lastAuditDate="+encodeURIComponent(aJ)+"&account="+encodeURIComponent(C)+"&region="+encodeURIComponent(ao)+"&availabilityZone="+encodeURIComponent(be)+"&applyAll="+encodeURIComponent(ab)+"&customColVaues="+encodeURIComponent(af)+"&applyForAllServerType="+ar+"&assetAction=update&com.eg.CSRF_NONCE="+csrfToken;
Ext.Ajax.request({url:"/final/admin/AssetManagement/data/EgAssetConfigp.jsp",method:"POST",params:params,success:function(i){ba.hide();Ext.Msg.show({title:assetAlertTitle,msg:assetConfigSavedAlert,buttons:Ext.MessageBox.OK,fn:function(bi){}});}});}}}}}}}}}}}}}}}}}},validateSingleByte:function(b){for(var c=0;
c<b.length;c++){var a=b.charCodeAt(c);if(a>255){return false;}}return true;},checkDoubleByte:function(i,a,e,j,d,f,b,g,c){var h="";if(!this.validateSingleByte(i)){h="assetName";}else{if(!this.validateSingleByte(a)){h="assetDescription";}else{if(!this.validateSingleByte(e)){h="assetType";}else{if(!this.validateSingleByte(j)){h="assetLocation";
}else{if(!this.validateSingleByte(d)){h="os";}else{if(!this.validateSingleByte(f)){h="manufacturer";}else{if(!this.validateSingleByte(b)){h="owner";}else{if(!this.validateSingleByte(g)){h="supportGroup";}else{if(!this.validateSingleByte(c)){h="businessService";}}}}}}}}}return h;},isValidColumnName:function(f){var d="`~!@#$%^&*()+-={}|[]:;\"'<>?,./";
var e="0987654321";var c;var a;for(var b=0;b<f.length;b++){c=d.indexOf(f.charAt(b));a=e.indexOf(f.charAt(0));if(c>=0){assetMsg=validNameMsg;return false;}if(a>=0){assetMsg=validNameMsg;return false;}}if(isOracleDB=="true"){if(f.length>30){assetMsg=maxlength30Msg;return false;}}else{if(f.length>128){assetMsg=maxlength128Msg;
return false;}}return true;},isValidFieldValue:function(e){var d="`~!@#$%^&*()+-={}|[]:;\"'<>?,/";var f="0987654321_.";var c;var a;for(var b=0;b<e.length;b++){c=d.indexOf(e.charAt(b));a=f.indexOf(e.charAt(0));if(c>=0){assetMsg=specialCharMsg;return false;}if(a>=0){assetMsg="First character should be alphabet";
return false;}}return true;},checksplchar:function(e,d){var f=".";var c;var a;for(var b=0;b<e.length;b++){c=d.indexOf(e.charAt(b));a=f.indexOf(e.charAt(0));if(c>=0){assetMsg=specialCharMsg;return false;}if(a>=0){assetMsg="First character should not start with '.' ";return false;}}return true;},checksplcharforMac:function(b){var a=/^([0-9A-Fa-f]{2}[:-]){5}([0-9A-Fa-f]{2})$/;
if(b.length>0){if(a.test(b)==false){assetMsg="Invalid MAC Address";return false;}}return true;},checksplcharforPhone:function(b){var a=/^[+0-9() -]{5,32}$/;if(b.length>0){if(a.test(b)==false){assetMsg="Invalid Phone Number";return false;}}return true;},checksplcharforOS:function(b){var a=/^[0-9a-zA-Z -.©]*$/;
if(b.length>0){if(a.test(b)==false){assetMsg=invalidOSMsg;return false;}}return true;},checksplcharforSerialNumber:function(b){var a=/^[0-9a-zA-Z-]*$/;if(b.length>0){if(a.test(b)==false){assetMsg=invalidSerialNoMsg;return false;}}return true;},checksplcharforLicenseSerialNumber:function(b){var a=/^[0-9a-zA-Z-]*$/;
if(b.length>0){if(a.test(b)==false){assetMsg=invalidLicenseSerialNoMsg;return false;}}return true;},checkduplicateValue:function(c){var d="";d=c;var e=d.split("~@~");var b;var a;for(b=0;b<e.length;b++){for(a=b+1;a<e.length;a++){if(e[b].toLowerCase()==e[a].toLowerCase()){return true;}}}return false;},validateIpOrHName:function(n){var q=n;
var a=0;var b=false;var c=false;var g="abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ";if(q.indexOf(":")>-1){c=true;}if(c){result=checkIPv6(q);return result;}else{for(var d=0;d<q.length;d++){check_char=g.indexOf(q.charAt(d));if(check_char>=0){b=true;}}if(!b){for(var h=0;h<q.length;h++){if(q.charAt(h)=="."&&q.charAt(h+1)=="."){Ext.Msg.show({title:assetAlertTitle,msg:dotMsg,buttons:Ext.MessageBox.OK,icon:"iconInformation",fn:function(i){Ext.getCmp("hostIP").focus(true);
}});return false;}else{continue;}}for(var p=0;p<q.length;p++){if(q.charAt(p)=="."){a=a+1;}else{continue;}}if(q.length>0&&a!=3){Ext.Msg.show({title:assetAlertTitle,msg:invalidIPMsg,buttons:Ext.MessageBox.OK,icon:"iconInformation",fn:function(i){Ext.getCmp("hostIP").focus(true);}});return false;}if(q.charAt(0)=="."||q.charAt(q.length-1)=="."){Ext.Msg.show({title:assetAlertTitle,msg:IPDotMsg,buttons:Ext.MessageBox.OK,icon:"iconInformation",fn:function(i){Ext.getCmp("hostIP").focus(true);
}});return false;}}for(var o=0;o<q.length;o++){if(q.charAt(o)==" "){Ext.Msg.show({title:assetAlertTitle,msg:spaceMsg,buttons:Ext.MessageBox.OK,icon:"iconInformation",fn:function(i){Ext.getCmp("hostIP").focus(true);}});return false;}}var r="`~!@#$%^&*()_+={}[]|\\:;\"'<>,?/";for(var h=0;h<q.length;h++){check_char=r.indexOf(q.charAt(h));
if(check_char>=1){Ext.Msg.show({title:assetAlertTitle,msg:specialCharMsg,buttons:Ext.MessageBox.OK,icon:"iconInformation",fn:function(i){Ext.getCmp("hostIP").focus(true);}});return false;}}if(q.indexOf(".")>-1&&a>2){var f=q.split(".");for(var e=0;e<f.length;e++){if(f[e]<0||f[e]>255){Ext.Msg.show({title:assetAlertTitle,msg:dotBetweenMsg,buttons:Ext.MessageBox.OK,icon:"iconInformation",fn:function(i){Ext.getCmp("hostIP").focus(true);
}});return false;}}}return true;}},validateFieldvalueLength:function(a,c){var d=a;var b=true;if(d.length>c){assetMsg=maxlength32Msg;b=false;return b;}return b;},validateFieldvalue:function(f,e,a,d){var c=e;var b=true;if(c.length>a){if(a==32){assetMsg=maxlength32Msg;}else{if(a==256){assetMsg=maxlength256Msg;
}else{if(a==1024){assetMsg=maxlength1024Msg;}}}return false;}else{if(this.checksplchar(c,d)==false){return false;}}return b;},validateMacAddress:function(c,a){var b=c;if(b.length>a){if(a==32){assetMsg=maxlength32Msg;}else{if(a==256){assetMsg=maxlength256Msg;}else{if(a==1024){assetMsg=maxlength1024Msg;
}}}return false;}else{if(this.checksplcharforMac(b)==false){return false;}}return true;},validatePhoneNo:function(c,b){var a=c;if(a.length>b){if(b==32){assetMsg=maxlength32Msg;}else{if(b==256){assetMsg=maxlength256Msg;}else{if(b==1024){assetMsg=maxlength1024Msg;}}}return false;}else{if(this.checksplcharforPhone(a)==false){return false;
}}return true;},assetFileUploadFun:function(){Ext.getCmp("fileUpload").setHeight(150);Ext.getCmp("fileUpload").setAutoScroll(false);var b=Ext.getCmp("FILE_0").getValue();if(b!=null&&b!=""&&b!=undefined&&b!="undefined"){var c=b;c=c.substring(c.lastIndexOf(".")+1);if(c=="csv"||c=="xls"){url="/final/admin/AssetManagement/data/EgAssetConfigUploadJSON.jsp";
var a=this.getFileuploadform().getForm();if(a.isValid()){a.submit({url:"/final/admin/AssetManagement/data/EgAssetConfigUploadJSON.jsp",scope:this,async:true,waitMsg:"Upload in progress please wait",method:"POST",enctype:"multipart/form-data",success:function(f,h){var g=h.response.responseText;g=Ext.decode(g);
var e=g["Msg"];var d=g["Success_Msg"];var i=g["ErrMsgsJson"];if(!Ext.isEmpty(g)){if(!Ext.isEmpty(i)){Ext.Msg.show({title:fileUploadAlertTitle,msg:importErrorLbl,icon:"iconInformation",buttons:Ext.Msg.OK});this.showErrors(i);return;}else{if(!Ext.isEmpty(d)){Ext.Msg.show({title:fileUploadindTitle,msg:d,buttons:Ext.Msg.OK,icon:"iconInformation"});
Ext.getCmp("fileUpload").destroy();}else{if(!Ext.isEmpty(e)){Ext.Msg.show({title:fileUploadAlertTitle,msg:e,icon:"iconInformation",buttons:Ext.Msg.OK});return;}}}}},failure:function(d,e){alert("Failure Notice");}});}}else{Ext.Msg.show({title:assetAlertTitle,msg:selectValidxlsFile,buttons:Ext.MessageBox.OK,icon:"iconInformation"});
}}else{Ext.Msg.show({title:assetAlertTitle,msg:selectAssetInfoFile,buttons:Ext.MessageBox.OK,icon:"iconInformation"});}},showErrors:function(b){Ext.getCmp("fileUpload").setHeight(300);Ext.getCmp("fileUpload").setAutoScroll(true);Ext.create("Ext.data.Store",{storeId:"storeId",fields:["CmpName","FieldName","FieldErrMsg"],data:b,proxy:{type:"memory",reader:{type:"json",root:"items"}}});
var a=Ext.create("utilities.CustomGrid",{title:"Errors",alias:"widget.ErrWindow2",cls:"gridSkin",scroll:true,autoScroll:true,overflowY:"auto",overflowX:"auto",store:Ext.data.StoreManager.lookup("storeId"),columns:[{text:"Component Name",dataIndex:"CmpName",flex:1},{text:"Field Name",dataIndex:"FieldName",flex:1},{text:"Error",dataIndex:"FieldErrMsg",flex:1},],width:650,});
var c=Ext.getCmp("listOfErrors");c.removeAll();c.add(a);c.doLayout();},noExpiryChange:function(){var c=Ext.getCmp("licenseExpirydate");var b=Ext.getCmp("hiddenLicenseExpdate");var a=Ext.getCmp("never").getValue();if(a==true){c.setValue("");c.setDisabled(true);c.labelEl.setOpacity(1);b.setValue(noExpiryDateDfltVal);
}else{c.setDisabled(false);b.setValue("");}},assetFileImportFun:function(){Ext.widget("fileupload").show();},goBackFromAssetConfig:function(){window.location.href="/final/admin/EgAssetInfo.jsp";}});function getComponent(d,a,c){var b;if(a=="Textfield"){b={xtype:"textfield",fieldLabel:c,id:d,name:d,cls:"textbox",maxLength:32,enforceMaxLength:true};
}else{if(a=="Combo"){b={xtype:"combo",fieldLabel:c,editable:false,name:d,id:d,cls:"dropdown",displayField:"displayField",valueField:"valueField",queryMode:"local",store:new Ext.data.Store({fields:["displayField","valueField"],data:[]}),listeners:{}};}else{if(a=="Datefield"){b={xtype:"datefield",labelSeparator:"",labelAlign:"top",labelWidth:200,fieldLabel:c,name:d,id:d,disabled:false,format:userDateFormat,cls:"datepicker",dataArray:"null",editable:false,value:""};
}else{if(a=="Textarea"){b={xtype:"textareafield",fieldLabel:c,id:d,cls:"text-area",name:d,maxLength:1024,enforceMaxLength:true};}}}}return b;}function loadAssetDetailsUI(){loadUIComp("General","assetDetail");var c=publicAssetJson["ACESS_STATE"];Ext.getCmp("assetState").getStore().loadRawData(c);var b=selectedValues["Selected_state"];
if(b!=null&&b!=""){Ext.getCmp("assetState").setValue(b);}else{Ext.getCmp("assetState").setValue(publicAssetJson["ACESS_STATE"][0]["valueField"]);}if(selectedValues["Asset_Name"]!=null){var d=Ext.getCmp("assetName");if(d!=null&&d!="undefined"){d.setValue(selectedValues["Asset_Name"]);}}if(selectedValues["Asset_description"]!=null){var d=Ext.getCmp("assetDescription");
if(d!=null&&d!="undefined"){d.setValue(selectedValues["Asset_description"]);}}Ext.getCmp("assetType").show();var a=Ext.getCmp("componenttype").getValue();if(a==-1){Ext.getCmp("assetState").setValue(publicAssetJson["ACESS_STATE"][0]["valueField"]);Ext.getCmp("assetName").reset();Ext.getCmp("assetDescription").reset();
}}function loadTechnicalUI(c){if(c=="Hardware"){loadUIComp("Hardware","techDetails");}else{if(c=="Network"){loadUIComp("Network","techDetails");}else{loadUIComp("Technical","techDetails");}}if(selectedValues["Asset_ipAddess"]!=null){var g=Ext.getCmp("hostIP");if(g!=null&&g!="undefined"){g.setValue(selectedValues["Asset_ipAddess"]);
}}if(selectedValues["Asset_macAddr"]!=null){var g=Ext.getCmp("mac_address");if(g!=null&&g!="undefined"){g.setValue(selectedValues["Asset_macAddr"]);}}if(selectedValues["Asset_OS"]!=null){var g=Ext.getCmp("os");if(g!=null&&g!="undefined"){g.setValue(selectedValues["Asset_OS"]);}}if(selectedValues["os_version"]!=null){var g=Ext.getCmp("os_version");
if(g!=null&&g!="undefined"){g.setValue(selectedValues["os_version"]);}}if(selectedValues["os_servicePack"]!=null){var g=Ext.getCmp("os_servicePack");if(g!=null&&g!="undefined"){g.setValue(selectedValues["os_servicePack"]);}}if(selectedValues["memory"]!=null){var g=Ext.getCmp("memory");if(g!=null&&g!="undefined"){g.setValue(selectedValues["memory"]);
}}if(selectedValues["disk_space"]!=null){var g=Ext.getCmp("diskSpace");if(g!=null&&g!="undefined"){g.setValue(selectedValues["disk_space"]);}}if(selectedValues["cpu_speed"]!=null){var g=Ext.getCmp("cpu_speed");if(g!=null&&g!="undefined"){g.setValue(selectedValues["cpu_speed"]);}}if(selectedValues["cpu_coreCount"]!=null){var g=Ext.getCmp("cpu_coreCount");
if(g!=null&&g!="undefined"){g.setValue(selectedValues["cpu_coreCount"]);}}if(selectedValues["uuid"]!=null){var g=Ext.getCmp("uuid");if(g!=null&&g!="undefined"){g.setValue(selectedValues["uuid"]);}}if(selectedValues["Asset_manufacturer"]!=null){var g=Ext.getCmp("manufacturer");if(g!=null&&g!="undefined"){g.setValue(selectedValues["Asset_manufacturer"]);
}}if(selectedValues["Asset_serialNum"]!=null){var g=Ext.getCmp("serialNumber");if(g!=null&&g!="undefined"){g.setValue(selectedValues["Asset_serialNum"]);}}if(selectedValues["Asset_ASMExpDate"]!=null){var g=Ext.getCmp("asmExpiryDate");if(g!=null&&g!="undefined"){g.setValue(selectedValues["Asset_ASMExpDate"]);
}}if(selectedValues["warranty"]!=null){var g=Ext.getCmp("warranty");if(g!=null&&g!="undefined"){g.setValue(selectedValues["warranty"]);}}if(selectedValues["acquisition_date"]!=null){var g=Ext.getCmp("acquisitionDate");if(g!=null&&g!="undefined"){g.setValue(selectedValues["acquisition_date"]);}}if(selectedValues["cpu_speed"]!=null){var g=Ext.getCmp("cpu_speed");
if(g!=null&&g!="undefined"){g.setValue(selectedValues["cpu_speed"]);}}if(selectedValues["firmware"]!=null){var g=Ext.getCmp("firmware");if(g!=null&&g!="undefined"){g.setValue(selectedValues["firmware"]);}}if(selectedValues["firmware_version"]!=null){var g=Ext.getCmp("firmwareVersion");if(g!=null&&g!="undefined"){g.setValue(selectedValues["firmware_version"]);
}}if(selectedValues["subnet_mask"]!=null){var g=Ext.getCmp("subnetMask");if(g!=null&&g!="undefined"){g.setValue(selectedValues["subnet_mask"]);}}if(selectedValues["bandwidth"]!=null){var g=Ext.getCmp("bandwidth");if(g!=null&&g!="undefined"){g.setValue(selectedValues["bandwidth"]);}}if(selectedValues["network_range"]!=null){var g=Ext.getCmp("networkRange");
if(g!=null&&g!="undefined"){g.setValue(selectedValues["network_range"]);}}var e=Ext.getCmp("componenttype").getValue();if(e==-1){if(c=="Hardware"){var b=assetFields["Hardware"];for(var a=0;a<b.length;a++){var d=b[a];var f=d["fieldName"];Ext.getCmp(f).reset();}}else{if(c=="Network"){var b=assetFields["Network"];
for(var a=0;a<b.length;a++){var d=b[a];var f=d["fieldName"];Ext.getCmp(f).reset();}}else{var b=assetFields["Technical"];for(var a=0;a<b.length;a++){var d=b[a];var f=d["fieldName"];Ext.getCmp(f).reset();}}}}Ext.getCmp("assetTabpanel").getComponent("techDetails").tab.show();Ext.getCmp("techDetails").show();
Ext.getCmp("assetTabpanel").setActiveTab(0);}function loadSoftwareUI(){loadUIComp("Software","software");Ext.getCmp("software").add({xtype:"container",layout:{type:"hbox",align:"left"},width:230,items:[{xtype:"datefield",labelSeparator:"",labelAlign:"top",width:140,labelWidth:200,fieldLabel:licenseExpirydateLbl,name:"licenseExpirydate",id:"licenseExpirydate",disabled:false,format:userDateFormat,cls:"datepicker",dataArray:"null",editable:false,value:""},{xtype:"hiddenfield",name:"hiddenLicenseExpdate",id:"hiddenLicenseExpdate"},{xtype:"checkbox",boxLabel:noExpiryLbl,checked:false,margin:"21 0 0 10",cls:"checkbt",name:"never",id:"never",listeners:{change:function(l,i,j){var m=Ext.getCmp("licenseExpirydate");
var k=Ext.getCmp("hiddenLicenseExpdate");var h=Ext.getCmp("never").getValue();if(h==true){m.setValue("");m.setDisabled(true);k.setValue(noExpiryDateDfltVal);}else{m.setDisabled(false);k.setValue("");}}}}]});var e=selectedValues["Licens_No_expry"];if(e==noExpiryDateDfltVal){Ext.getCmp("never").setValue(true);
}else{if(selectedValues["Asset_licnsExpDate"]!=null){var g=Ext.getCmp("licenseExpirydate");if(g!=null&&g!="undefined"){g.setValue(selectedValues["Asset_licnsExpDate"]);}}}if(selectedValues["product"]!=null){var g=Ext.getCmp("product");if(g!=null&&g!="undefined"){g.setValue(selectedValues["product"]);
}}if(selectedValues["vendor"]!=null){var g=Ext.getCmp("vendor");if(g!=null&&g!="undefined"){g.setValue(selectedValues["vendor"]);}}if(selectedValues["version"]!=null){var g=Ext.getCmp("version");if(g!=null&&g!="undefined"){g.setValue(selectedValues["version"]);}}if(selectedValues["domain"]!=null){var g=Ext.getCmp("domain");
if(g!=null&&g!="undefined"){g.setValue(selectedValues["domain"]);}}if(selectedValues["cost"]!=null){var g=Ext.getCmp("cost");if(g!=null&&g!="undefined"){g.setValue(selectedValues["cost"]);}}if(selectedValues["installation_date"]!=null){var g=Ext.getCmp("installationDate");if(g!=null&&g!="undefined"){g.setValue(selectedValues["installation_date"]);
}}if(selectedValues["license_key"]!=null){var g=Ext.getCmp("licenseKey");if(g!=null&&g!="undefined"){g.setValue(selectedValues["license_key"]);}}if(selectedValues["license_type"]!=null){var g=Ext.getCmp("licenseType");if(g!=null&&g!="undefined"){g.setValue(selectedValues["license_type"]);}}if(selectedValues["Asset_licnsSerialNum"]!=null){var g=Ext.getCmp("licenseSerialNumber");
if(g!=null&&g!="undefined"){g.setValue(selectedValues["Asset_licnsSerialNum"]);}}if(selectedValues["installed_machine"]!=null){var g=Ext.getCmp("installedMachine");if(g!=null&&g!="undefined"){g.setValue(selectedValues["installed_machine"]);}}if(selectedValues["installation_path"]!=null){var g=Ext.getCmp("installationPath");
if(g!=null&&g!="undefined"){g.setValue(selectedValues["installation_path"]);}}if(selectedValues["warranty"]!=null){var g=Ext.getCmp("warranty");if(g!=null&&g!="undefined"){g.setValue(selectedValues["warranty"]);}}if(selectedValues["acquisition_date"]!=null){var g=Ext.getCmp("acquisitionDate");if(g!=null&&g!="undefined"){g.setValue(selectedValues["acquisition_date"]);
}}var d=Ext.getCmp("componenttype").getValue();if(d==-1){var b=assetFields["Software"];for(var a=0;a<b.length;a++){var c=b[a];var f=c["fieldName"];Ext.getCmp(f).reset();}Ext.getCmp("licenseExpirydate").reset();}Ext.getCmp("assetTabpanel").getComponent("software").tab.show();if(confEnabled&&(displayMessage!="")){Ext.getCmp("softwareList").add({xtype:"label",html:displayMessage});
Ext.getCmp("assetTabpanel").getComponent("softwareList").tab.show();}}function loadUIComp(g,e){Ext.getCmp(e).removeAll();var d=assetFields[g];for(var c=0;c<d.length;c++){var f=d[c];var g=f["fieldName"];var a=f["fieldType"];var b=f["fieldLabel"];Ext.getCmp(e).add(getComponent(g,a,b));}}function loadUPSUI(){loadUIComp("UPS","ups");
if(selectedValues["Asset_ipAddess"]!=null){var f=Ext.getCmp("hostIP");if(f!=null&&f!="undefined"){f.setValue(selectedValues["Asset_ipAddess"]);}}if(selectedValues["battery_status"]!=null){var f=Ext.getCmp("batteryStatus");if(f!=null&&f!="undefined"){f.setValue(selectedValues["battery_status"]);}}if(selectedValues["battery_voltage"]!=null){var f=Ext.getCmp("batteryVoltage");
if(f!=null&&f!="undefined"){f.setValue(selectedValues["battery_voltage"]);}}if(selectedValues["battery_current"]!=null){var f=Ext.getCmp("batteryCurrent");if(f!=null&&f!="undefined"){f.setValue(selectedValues["battery_current"]);}}var d=Ext.getCmp("componenttype").getValue();if(d==-1){var b=assetFields["UPS"];
for(var a=0;a<b.length;a++){var c=b[a];var e=c["fieldName"];Ext.getCmp(e).reset();}}Ext.getCmp("assetTabpanel").getComponent("ups").tab.show();}function loadCloudUI(){loadUIComp("Cloud","cloud");if(selectedValues["cost"]!=null){var f=Ext.getCmp("cost");if(f!=null&&f!="undefined"){f.setValue(selectedValues["cost"]);
}}if(selectedValues["last_auditDate"]!=null){var f=Ext.getCmp("lastAuditDate");if(f!=null&&f!="undefined"){f.setValue(selectedValues["last_auditDate"]);}}var d=Ext.getCmp("componenttype").getValue();if(d==-1){var b=assetFields["Cloud"];for(var a=0;a<b.length;a++){var c=b[a];var e=c["fieldName"];Ext.getCmp(e).reset();
}}Ext.getCmp("assetTabpanel").getComponent("cloud").tab.show();}function loadAWSUI(){loadUIComp("AWS","aws");if(selectedValues["account"]!=null){var f=Ext.getCmp("account");if(f!=null&&f!="undefined"){f.setValue(selectedValues["account"]);}}if(selectedValues["region"]!=null){var f=Ext.getCmp("region");
if(f!=null&&f!="undefined"){f.setValue(selectedValues["region"]);}}if(selectedValues["availability_zone"]!=null){var f=Ext.getCmp("availabilityZone");if(f!=null&&f!="undefined"){f.setValue(selectedValues["availability_zone"]);}}var d=Ext.getCmp("componenttype").getValue();if(d==-1){var b=assetFields["AWS"];
for(var a=0;a<b.length;a++){var c=b[a];var e=c["fieldName"];Ext.getCmp(e).reset();}}Ext.getCmp("assetTabpanel").getComponent("aws").tab.show();}function loadMiscUI(){loadUIComp("Misc","misc");var f=publicAssetJson["BUSINESS_IMPACT"];Ext.getCmp("businessImpact").getStore().loadRawData(f);var e=selectedValues["Selected_BusinessImpact"];
if(e!=null&&e!=""){Ext.getCmp("businessImpact").setValue(e);}else{Ext.getCmp("businessImpact").setValue(publicAssetJson["BUSINESS_IMPACT"][0]["valueField"]);}if(selectedValues["Asset_Owner"]!=null){var h=Ext.getCmp("user");if(h!=null&&h!="undefined"){h.setValue(selectedValues["Asset_Owner"]);}}if(selectedValues["Asset_suppotGroup"]!=null){var h=Ext.getCmp("supportGroup");
if(h!=null&&h!="undefined"){h.setValue(selectedValues["Asset_suppotGroup"]);}}if(selectedValues["location"]!=null){var h=Ext.getCmp("location");if(h!=null&&h!="undefined"){h.setValue(selectedValues["location"]);}}if(selectedValues["Asset_emailAddr"]!=null){var h=Ext.getCmp("emailAddress");if(h!=null&&h!="undefined"){h.setValue(selectedValues["Asset_emailAddr"]);
}}if(selectedValues["Asset_businessService"]!=null){var h=Ext.getCmp("businessService");if(h!=null&&h!="undefined"){h.setValue(selectedValues["Asset_businessService"]);}}if(selectedValues["Asset_phNo"]!=null){var h=Ext.getCmp("phoneNumber");if(h!=null&&h!="undefined"){h.setValue(selectedValues["Asset_phNo"]);
}}var d=Ext.getCmp("componenttype").getValue();if(d==-1){var b=assetFields["Misc"];for(var a=0;a<b.length;a++){var c=b[a];var g=c["fieldName"];Ext.getCmp(g).reset();}Ext.getCmp("businessImpact").setValue(publicAssetJson["BUSINESS_IMPACT"][0]["valueField"]);}Ext.getCmp("assetTabpanel").getComponent("misc").tab.show();
}function removeCustomField(a){var b=Ext.getCmp("customFieldCnt_"+a);b.destroy();customFields--;if(customFields=="0"){Ext.getCmp("addCustomFieldBtn").show();Ext.getCmp("assetTabpanel").getComponent("customContainer").tab.hide();Ext.getCmp("assetTabpanel").setActiveTab(0);}}function checkForSameLabel(e){for(var c=0;
c<e.length;c++){var d=e[c].toLowerCase();for(var b=c+1;b<e.length;b++){var a=e[b].toLowerCase();if(d==a){return true;}}}return false;}function checkIPv6(c){if(!checkspecialnomess(c,"`~!@#%^&*()+={}[]|\\;\"'<>,?")){return false;}if(!checkspace(c)){return false;}var j=/[\.]{2,}/;var h=/(^(\.){1,})|((\.){1,}$)/gi;
var f=/(\.\:){1,}|(\:\.){1,}/;if(c.match(j)!=null||c.match(f)!=null){return false;}if(c.match(h)!=null){return false;}var u=/[\:]{2,}/g;var q=c.match(u);if(q!=null&&q!="::"){return false;}var n=c.split(":");var r=n.length;r--;var k,g;g=c;if(n.length<=7&&c.indexOf(".")!=-1){var i=c.split(".");var e=i.length;
e--;k=c.substring((c.lastIndexOf(":")+1));g=c.substring(0,(c.lastIndexOf(":")));var b=/[0-9]{1,3}(\.){1}[0-9]{1,3}(\.){1}[0-9]{1,3}(\.){1}[0-9]{1,3}((\/){1}[0-9]{1,3})*$/gi;regIp4Res=c.match(b);if(regIp4Res==null||regIp4Res!=k){return false;}if(g.indexOf(".")!=-1){return false;}if((e>3)||(e!=3)){return false;
}var a=k.split("/");k=a[0];var t=k.split(".");for(var s=0;s<t.length;s++){if(t[s]<0||t[s]>255){return false;}}}else{if((r>7)||(q!="::")&&(r<7)){return false;}}var a=g.split("/");g=a[0];var o="";var v=/^(([a-z0-9(::)]{0,4}(\:){1,2}[a-z0-9]{0,4}){1}((\:){1,2}[a-z0-9]{0,4}){1,})|(([a-z0-9(::)]{0,4}(\:){1,2}[a-z0-9]{0,4}){1})$/gi;
var p=g.match(v);v=/^[a-f0-9]{0,4}$/gi;if(g.indexOf(":")==-1){o=g.match(v);}if(((p==null)||(p!=g))&&(o!=g)){return false;}var m=/(::){0,1}([a-f0-9(::)(\.)]*[\:]{1})+[a-f(::)(\.)0-9]*((\/){0,1}[0-9]{1,3})*/ig;var d=c.match(m);if(d==null||d!=c){return false;}return true;}function checkspecialnomess(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;}function checkspace(b){var a;if(typeof(b)=="object"){a=b.value;}else{a=b;}for(count=0;count<a.length;count++){if(a.charAt(count)==" "){return false;}}return true;}function filterEncode(i){var d=["[","]","(",")","=","&","%","'",";","\\","'",'"'];
var c=["|lsbr|","|rsbr|","|lbr|","|rbr|","|eq|","|ampsnd|","|per|","|squot|","|scol|","|slash|","|squot|","|dqt|"];try{if(i!=null&&i!=undefined&&!Ext.isEmpty(i)){for(var b in d){var f=d[b];var g=c[b];do{i=i.replace(f,g);}while(i.indexOf(f)>-1);}}}catch(h){}return i;}