Ext.define("CompositeTest.controller.MeasureWindowController",{extend:"Ext.app.Controller",views:["AddNewTest"],requires:["CompositeTest.view.AddNewTest"],refs:[{selector:"addnewtest",ref:"addnewtest"}],init:function(){compTestCtrlr=this;this.control({"addnewtest":{"afterrender":this.afterMainRender}});
},testChanged:function(){var d=Ext.getCmp("componentType").getValue();var b=Ext.getCmp("compTest").getValue();var j=Ext.getCmp("compMeasure").getValue();var k=Ext.getCmp("testlist").getValue();var m=(b.indexOf("_")==b.lastIndexOf("_"));if(k==null||k=="-1"){Ext.getCmp("actionOnDesc").hide();Ext.getCmp("excludeDescriptors").hide();
Ext.getCmp("includeDescriptors").hide();Ext.getCmp("measuresContainer").hide();Ext.getCmp("associate_button_container").hide();Ext.getCmp(associated_test_measures_grid).hide();Ext.getCmp("addMeasures").hide();return false;}if(m){Ext.getCmp("addMeasures").show();}Ext.getCmp("itemselectHosts").fromField.store.removeAll();
Ext.getCmp("itemselectHosts").toField.store.removeAll();Ext.getCmp(associated_test_measures_grid).getSelectionModel().selectAll();var a=Ext.getCmp(associated_test_measures_grid).getSelectionModel().getSelection();var h="";var c="";var e=new Array();for(var g=0;g<a.length;g++){var l=a[g];var f=l.get(associated_test_name).trim();
if(f==k){c+=","+l.get(associated_measure_name);}if(h.length==0){h=f;}else{if((","+h+",").indexOf(","+f+",")==-1){h+=","+f;}}}if(c.length>0){c=c.substring(1);}else{c="-";}if(h.length==0){h="-1";}Ext.Ajax.request({url:"CompositeTest/data/individualTestInfo.jsp?compType="+d+"&individualTestName="+k+"&compMeasure="+j+"&compTest="+b+"&added_measure_details="+c+"&added_test_details="+h,method:"POST",async:false,success:function(n){if(n.status==200&&!Ext.isEmpty(n.responseText)){var p=Ext.decode(n.responseText);
Ext.getCmp("testlist").getStore().clearFilter(true);Ext.getCmp("testlist").getStore().suspendEvents(true);Ext.getCmp("testlist").getStore().loadRawData(p.individual_tests);Ext.getCmp("testlist").getStore().resumeEvents();Ext.getCmp("actionOnDesc").hide();Ext.getCmp("excludeDescriptors").hide();Ext.getCmp("includeDescriptors").hide();
Ext.getCmp("actionOnDesc").getStore().clearFilter(true);Ext.getCmp("actionOnDesc").getStore().suspendEvents(true);Ext.getCmp("actionOnDesc").getStore().loadRawData(p.actionOnDescriptors);Ext.getCmp("actionOnDesc").getStore().resumeEvents();Ext.getCmp("actionOnDesc").show();if(p.showIncludeDescriptor){Ext.getCmp("actionOnDesc").select(Ext.getCmp("actionOnDesc").getStore().getAt(0));
Ext.getCmp("includeDescriptors").setValue(p.includeInfoSet);Ext.getCmp("excludeDescriptors").setValue(p.excludeInfoSet);Ext.getCmp("includeDescriptors").show();}else{Ext.getCmp("actionOnDesc").select(Ext.getCmp("actionOnDesc").getStore().getAt(1));Ext.getCmp("includeDescriptors").setValue(p.includeInfoSet);
Ext.getCmp("excludeDescriptors").setValue(p.excludeInfoSet);Ext.getCmp("excludeDescriptors").show();}Ext.getCmp("addMeasures").show();if(p.associatedComponentsFound){var o=Ext.getCmp("itemselectHosts").fromField;o.store.add(p["associatedComponents"]);}if(p.availableComponentsFound){var i=Ext.getCmp("itemselectHosts").toField;
i.store.add(p["availableComponents"]);}Ext.getCmp("itemselectHosts").setVisible(true);Ext.getCmp("measuresContainer").show();Ext.getCmp("associate_button_container").show();Ext.getCmp(associated_test_measures_grid).show();Ext.getCmp("compMeasure").setReadOnly(true);start_masterInfosTest=p.masterInfosTest;
start_masterInfosTestDisplay=p.masterInfosTestDisplay;start_descriptorBasedTest=p.start_descriptorBasedTest;default_thresholds_Json=p.defaultThresholdsObj;}}});},refreshTests:function(){var d=Ext.getCmp("componentType").getValue();var b=Ext.getCmp("compTest").getValue();var j=Ext.getCmp("compMeasure").getValue();
var k=Ext.getCmp("testlist").getValue();Ext.getCmp(associated_test_measures_grid).getSelectionModel().selectAll();var a=Ext.getCmp(associated_test_measures_grid).getSelectionModel().getSelection();var h="";var c="";var e=new Array();for(var g=0;g<a.length;g++){var l=a[g];var f=l.get(associated_test_name).trim();
if(f==k){c+=","+l.get(associated_measure_name);}if(h.length==0){h=f;}else{if((","+h+",").indexOf(","+f+",")==-1){h+=","+f;}}}if(c.length>0){c=c.substring(1);}else{c="-";}if(h.length==0){h="-1";}Ext.Ajax.request({url:"CompositeTest/data/refreshIndividualTestInfo.jsp?compType="+d+"&compTest="+b+"&added_measure_details="+c+"&added_test_details="+h,method:"POST",async:false,success:function(i){if(i.status==200&&!Ext.isEmpty(i.responseText)){var m=Ext.decode(i.responseText);
Ext.getCmp("testlist").getStore().clearFilter(true);Ext.getCmp("testlist").getStore().suspendEvents(true);Ext.getCmp("testlist").getStore().loadRawData(m.individual_tests);Ext.getCmp("testlist").getStore().resumeEvents();Ext.getCmp("testlist").setValue(m.selectedTest);compTestCtrlr.testChanged();}}});
},includeExcludeChanged:function(){var a=Ext.getCmp("actionOnDesc").getValue();if(a=="Exclude"){Ext.getCmp("excludeDescriptors").show();Ext.getCmp("includeDescriptors").hide();}else{Ext.getCmp("excludeDescriptors").hide();Ext.getCmp("includeDescriptors").show();}},associateNewMeasures:function(c){var q="all";
var z="none";var y=Ext.getCmp("actionOnDesc").getValue();if(y=="Include"){q=Ext.getCmp("includeDescriptors").getValue();q=q.replace(/^\s+|\s+$/gm,"");if(Ext.isEmpty(q)){q="all";}else{if(q.indexOf("=")>-1){Ext.Msg.show({title:pageTitle1,msg:"Descriptors should not contain equals(=) symbol.",buttons:Ext.Msg.OK,icon:"iconExclamation"});
return;}}}else{if(y=="Exclude"){z=Ext.getCmp("excludeDescriptors").getValue();z=z.replace(/^\s+|\s+$/gm,"");if(Ext.isEmpty(z)){z="none";}else{if(z.indexOf("=")>-1){Ext.Msg.show({title:pageTitle1,msg:"Descriptors should not contain equals(=) symbol.",buttons:Ext.Msg.OK,icon:"iconExclamation"});return;
}}}}if(!this.measureValidation()){return;}if(Ext.getCmp("itemselectHosts").fromField.store.getCount()==0){Ext.Msg.show({title:pageTitle1,msg:emptyMeasuresAlert,buttons:Ext.Msg.OK,icon:"iconExclamation"});return;}var u=new Array();var d=Ext.getCmp("testlist").getValue();Ext.getCmp(associated_test_measures_grid).getSelectionModel().selectAll();
var F=Ext.getCmp(associated_test_measures_grid).getSelectionModel().getSelection();for(var K=0;K<F.length;K++){var N=F[K];var t=N.get(associated_test_name);var a=N.get(associated_measure_name);var f=t+":"+a;u.push(f);}Ext.getCmp(associated_test_measures_grid).getSelectionModel().deselectAll();var b=false;
var A=Ext.getCmp("testlist").getRawValue();var M=Ext.getCmp("itemselectHosts");var v=M.fromField.store;for(var J=0;J<M.fromField.store.getCount();J++){var g=v.getAt(J).get("valueField");var n=d+":"+g;if(u.indexOf(n)>-1){continue;}b=true;var e="None";var h="None";var p=default_thresholds_Json[g];if(p!=null&&p.indexOf(":")>0){e=p.substring(0,p.indexOf(":"));
h=p.substring(p.indexOf(":")+1);}Ext.getCmp(associated_test_measures_grid).getStore().add({"default_checked":"true",associated_test_name:d,associated_test_description:A,associated_measure_name:g,associated_measure_description:v.getAt(J).get("displayField"),associated_measure_min_threshold:e,associated_measure_max_threshold:h,associated_measure_type:"Key"});
}var B=new Ext.form.field.ComboBox({cls:"dropdown",sortable:false,editable:false,displayField:"displayField",valueField:"valueField",queryMode:"local",fields:["displayField","valueField"],store:[["Key","Key"],["Sup","Non-key"]]});Ext.getCmp("measureTypeId").setEditor(B);var E=c.id;var k=this;var x=Ext.getCmp("compTest").getValue();
var w=Ext.getCmp("compMeasure").getValue();var D=Ext.getCmp("measure_display_name").getValue();var o=Ext.getCmp("alarm_display_string").getValue();var l=Ext.getCmp("testlist").getValue();Ext.getCmp(associated_test_measures_grid).getSelectionModel().selectAll();var F=Ext.getCmp(associated_test_measures_grid).getSelectionModel().getSelection();
var j="";for(var K=0;K<F.length;K++){var N=F[K];var t=N.get(associated_test_name);var a=N.get(associated_measure_name);var f=t+":"+a;var r=N.get(associated_measure_min_threshold);var L=N.get(associated_measure_max_threshold);if(r.trim().toLowerCase()=="none"){r="-1";}if(L.trim().toLowerCase()=="none"){L="-1";
}j+=","+f+"~"+N.get(associated_measure_type)+"~"+r+":"+L;}if(j.length>0){j=j.substring(1);}var G={"buttonClicked":E,"test":x,"displayName":filterEncode(encodeURIComponent(D)),"alarmDisplayString":filterEncode(encodeURIComponent(o)),"test_associated":l,"include_desc":q,"exclude_desc":z,"s_measure_details":j};
var H="individualTestInfo.jsp?individualTestName="+l+"&compType="+selectedCompType+"&compTest="+x;var C;var I="CompositeTest/data/associateMeasuresp.jsp?operationCompMeasure="+operationCompMeasure;if(!Ext.isEmpty(w)){I+="&measure="+w;}Ext.Ajax.request({url:I,method:"POST",params:G,async:false,success:function(i){if(i.status==200&&!Ext.isEmpty(i.responseText)){C=Ext.decode(i.responseText);
H+="&compMeasure="+C.measureName;Ext.getCmp("compMeasure").setValue(C.measureName);}}});if(C.messageType!=null&&C.messageType=="Alert"){Ext.Msg.show({title:pageTitle1,msg:C.message,buttons:Ext.Msg.OK,icon:"iconExclamation"});}else{if(C.messageType!=null&&C.messageType=="Result"){Ext.getCmp("compMeasure").hide();
Ext.getCmp("measure_display_name").setReadOnly(false);Ext.getCmp("alarm_display_string").setReadOnly(false);var s=C.forwardURL;k.loadAddMeasureTab(C.forwardURL);Ext.getCmp("generateCntnr").enable();operationCompMeasure="modifyCompMeasure";Ext.Ajax.request({url:"CompositeTest/data/"+H,method:"POST",async:false,success:function(i){if(i.status==200&&!Ext.isEmpty(i.responseText)){publicJSONTemp=Ext.decode(i.responseText);
Ext.getCmp("testlist").getStore().clearFilter(true);Ext.getCmp("testlist").getStore().suspendEvents(true);Ext.getCmp("testlist").getStore().loadRawData(publicJSONTemp.individual_tests);Ext.getCmp("testlist").getStore().resumeEvents();Ext.getCmp("testlist").select(l);start_masterTestForInfos=publicJSONTemp.masterInfosTest;
start_masterInfosTestDisplay=publicJSONTemp.masterInfosTestDisplay;start_descriptorBasedTest=publicJSONTemp.start_descriptorBasedTest;}}});}}},associateNewMeasures_update:function(m){var x=m.id;var A=this;var g=Ext.getCmp("compTest").getValue();var p=Ext.getCmp("compMeasure").getValue();if(!this.measureValidation()){return;
}var k=Ext.getCmp("measure_display_name").getValue();var t=Ext.getCmp("alarm_display_string").getValue();var s=Ext.getCmp("testlist").getValue();var h="all";var l="none";var y=Ext.getCmp("actionOnDesc").getValue();if(y=="Include"){h=Ext.getCmp("includeDescriptors").getValue();h=h.replace(/^\s+|\s+$/gm,"");
if(Ext.isEmpty(h)){h="all";}else{if(h.indexOf("=")>-1){Ext.Msg.show({title:pageTitle1,msg:"Descriptors should not contain equals(=) symbol.",buttons:Ext.Msg.OK,icon:"iconExclamation"});return;}}}else{if(y=="Exclude"){l=Ext.getCmp("excludeDescriptors").getValue();l=l.replace(/^\s+|\s+$/gm,"");if(Ext.isEmpty(l)){l="none";
}else{if(l.indexOf("=")>-1){Ext.Msg.show({title:pageTitle1,msg:"Descriptors should not contain equals(=) symbol.",buttons:Ext.Msg.OK,icon:"iconExclamation"});return;}}}}if(!this.validateThresholds()){return;}Ext.getCmp(associated_test_measures_grid).getSelectionModel().selectAll();var a=Ext.getCmp(associated_test_measures_grid).getSelectionModel().getSelection();
if(a.length==0){Ext.Msg.show({title:pageTitle1,msg:alert_for_no_associated_measures+" "+k,buttons:Ext.Msg.OK,icon:"iconExclamation"});return;}var B=false;var j=true;var z="";for(var v=0;v<a.length;v++){var c=a[v];var d=c.get("associated_test_description");var r=c.get("associated_measure_description");
var q=c.get(associated_test_name).trim();if(start_descriptorBasedTest.toLowerCase()=="yes"){if(start_masterInfosTest==q){B=true;}}var b=c.get(associated_measure_min_threshold).trim();var u=c.get(associated_measure_max_threshold).trim();if(b.trim().toLowerCase()=="none"){b="-1";}if(u.trim().toLowerCase()=="none"){u="-1";
}if(b=="-1"&&u=="-1"){Ext.Msg.show({title:pageTitle1,msg:"Both minimum and maximum target values cannot be none for "+r+" measure of "+d+" test",buttons:Ext.Msg.OK,icon:"iconExclamation"});j=false;break;}z+=","+q+":"+c.get(associated_measure_name)+"~"+c.get(associated_measure_type).trim()+"~"+b+":"+u;
}if(!j){return;}if(start_descriptorBasedTest.toLowerCase()=="yes"&&!B){Ext.Msg.show({title:pageTitle1,msg:"This performance rating test uses the descriptors of the "+start_masterInfosTestDisplay+" test. Please associate its measures.",buttons:Ext.Msg.OK,icon:"iconExclamation"});return;}if(z.length>0){z=z.substring(1);
}var o={"buttonClicked":x,"test":g,"displayName":filterEncode(encodeURIComponent(k)),"alarmDisplayString":filterEncode(encodeURIComponent(t)),"test_associated":s,"include_desc":h,"exclude_desc":l,"s_measure_details":z};var f;var w="CompositeTest/data/associateMeasuresp.jsp?operationCompMeasure="+operationCompMeasure;
if(!Ext.isEmpty(p)){w+="&measure="+p;}Ext.Ajax.request({url:w,method:"POST",params:o,async:false,success:function(i){if(i.status==200&&!Ext.isEmpty(i.responseText)){f=Ext.decode(i.responseText);Ext.getCmp("compMeasure").setValue(f.measureName);}}});if(f.messageType!=null&&f.messageType=="Alert"){Ext.Msg.show({title:pageTitle1,msg:f.message,buttons:Ext.Msg.OK,icon:"iconExclamation"});
}else{if(f.messageType!=null&&f.messageType=="Result"){Ext.getCmp("compMeasure").hide();Ext.getCmp("measure_display_name").setReadOnly(false);Ext.getCmp("alarm_display_string").setReadOnly(false);var n=f.forwardURL;A.loadAddMeasureTab(f.forwardURL);Ext.getCmp("generateCntnr").enable();var e=Ext.WindowManager.getActive();
if(e){e.close();}Ext.getCmp("generateCntnr").enable();Ext.getCmp("newtest").setActiveTab(2);}}},loadAddMeasureTab:function(d){var b=this;Ext.Ajax.request({url:"CompositeTest/data/"+d,method:"POST",async:false,success:function(g){if(g.status==200&&!Ext.isEmpty(g.responseText)){var h=g.responseText;publicJSON=Ext.decode(h);
}}});var f=publicJSON.measuresList;var e=Ext.getCmp("addMeasureCntnr");e.removeAll();if(publicJSON.noMeasuresAdded){Ext.getCmp("addNewMeasure").setVisible(false);Ext.getCmp("noMeasureFnd").show();Ext.getCmp("generateCntnr").disable();}else{Ext.getCmp("noMeasureFnd").hide();e.add({xtype:"container",id:"dp_container_measure",layout:{type:"hbox",pack:"center"},width:900,cls:"formOuter",padding:5,defaultType:"displayfield",defaults:{labelAlign:"top",labelSeparator:"",width:250,margin:5},margin:"5 5 10 5",items:[{fieldLabel:"<b>"+test_name_label+"</b>",value:publicJSON.test_desc_measure_panel,id:"dp_testname"},{fieldLabel:"<b>"+compTypeDesc+"</b>",value:publicJSON.type_desc_measure_panel,id:"dp_comptype"},{fieldLabel:"<b>"+descbased+"</b>",value:publicJSON.descriptor_measure_panel,id:"dp_descriptor"}]});
for(var c=0;c<f.length;c++){var a=f[c];e.add({xtype:"customgrid",ui:"newGridPanel whiteHeader",title:'<span class="font_bold12">'+a.measureDispName+"</span>"+"&nbsp;"+display_for_compmeasure,id:"display_associated_measures_grid"+c,hidden:false,border:true,flex:1,autoScroll:true,scroll:true,height:200,width:900,margin:5,columnLines:true,sortableColumns:false,store:Ext.create("Ext.data.Store",{fields:["test_name","measure_description"],data:a.display_associated_measures_grid}),columns:[{header:testLabelInTable,dataIndex:"test_name",flex:0.25},{header:measureLabelInTable,dataIndex:"measure_description",flex:0.75}],tools:[{xtype:"button",ui:"newButtonSmall",text:modifyTooltip,modifyURL:a.modifyURL,measureName:a.measureName,handler:function(){b.showModifyMeasure(this.modifyURL,this.measureName);
},margin:"2 0 2 0"},{xtype:"button",ui:"newButtonSmall",text:deleteTooltip,deleteURL:a.deleteURL,hidden:a.deleteURL=="none"?true:false,measureName:a.measureName,handler:function(){b.deleteMeasure(this.deleteURL,this.measureName,a.measureDispName);},margin:"2 0 2 5"}]});}if(publicJSON.pre_defined_test){Ext.getCmp("addNewMeasure").setVisible(false);
}else{Ext.getCmp("addNewMeasure").setVisible(true);}}},loadPopup:function(){var q=this;Ext.widget("measurewindow").show();var l=Ext.getCmp("test").getValue();var c=l;var i=(c.indexOf("_")==c.lastIndexOf("_"));var h=null;var j=Ext.getCmp("componentType").getValue();var b=false;var k=null;if(modifyCompMeasureURL==null){k="EgConfigMeasureJson.jsp?test="+l+"&compType="+j;
selectedCompType=j;}else{var f=modifyCompMeasureURL.indexOf("&");var n=modifyCompMeasureURL.substring(f+1);f=n.indexOf("&");var r=n.substring(0,f);j=r.substring(r.indexOf("=")+1);selectedCompType=j;n=n.substring(f+1);f=n.indexOf("&");var e=n.substring(0,f);c=e.substring(e.indexOf("=")+1);n=n.substring(f+1);
h=n.substring(n.indexOf("=")+1);b=true;k=modifyCompMeasureURL+"&firstTime=true";modifyCompMeasureURL=null;}Ext.Ajax.request({url:"CompositeTest/data/"+k,method:"POST",async:false,success:function(s){if(s.status==200&&!Ext.isEmpty(s.responseText)){var t=s.responseText;publicJSON=Ext.decode(t);start_masterInfosTest=publicJSON.masterInfosTest;
start_masterInfosTestDisplay=publicJSON.masterInfosTestDisplay;start_descriptorBasedTest=publicJSON.start_descriptorBasedTest;default_thresholds_Json=publicJSON.defaultThresholdsObj;}}});this.getController("CompositeTest.controller.MeasureWindowController").init();if(b){Ext.getCmp("compTest").setValue(c);
Ext.getCmp("compMeasure").setValue(h);Ext.getCmp("compMeasure").hide();Ext.getCmp("measure_display_name").setValue(publicJSON.compMeasureDesc);Ext.getCmp("alarm_display_string").setValue(publicJSON.alarmDisplayString);if(publicJSON.individualTestFound){Ext.getCmp("testlist").setFieldLabel(publicJSON.testListLabel);
Ext.getCmp("testlist").getStore().clearFilter(true);Ext.getCmp("testlist").getStore().suspendEvents(true);Ext.getCmp("testlist").getStore().loadRawData(publicJSON.individual_tests);Ext.getCmp("testlist").getStore().resumeEvents();Ext.getCmp("testlist").select(publicJSON.sitn);Ext.getCmp("actionOnDesc").getStore().clearFilter(true);
Ext.getCmp("actionOnDesc").getStore().suspendEvents(true);Ext.getCmp("actionOnDesc").getStore().loadRawData(publicJSON.actionOnDescriptors);Ext.getCmp("actionOnDesc").getStore().resumeEvents();Ext.getCmp("actionOnDesc").select(Ext.getCmp("actionOnDesc").getStore().getAt(0));}Ext.getCmp("actionOnDesc").show();
Ext.getCmp("includeDescriptors").hide();Ext.getCmp("excludeDescriptors").hide();if(publicJSON.showIncludeDescriptor){Ext.getCmp("actionOnDesc").setValue("Include");Ext.getCmp("includeDescriptors").setValue(publicJSON.includeInfoSet);Ext.getCmp("excludeDescriptors").setValue(publicJSON.excludeInfoSet);
Ext.getCmp("includeDescriptors").show();}else{Ext.getCmp("actionOnDesc").setValue("Exclude");Ext.getCmp("includeDescriptors").setValue(publicJSON.includeInfoSet);Ext.getCmp("excludeDescriptors").setValue(publicJSON.excludeInfoSet);Ext.getCmp("excludeDescriptors").show();}Ext.getCmp("measuresContainer").hide();
Ext.getCmp("associate_button_container").hide();Ext.getCmp(associated_test_measures_grid).hide();Ext.getCmp("addMeasures").hide();Ext.getCmp("measuresContainer").show();Ext.getCmp("associate_button_container").show();if(publicJSON.associatedComponentsFound){var g=Ext.getCmp("itemselectHosts").fromField;
g.store.add(publicJSON["associatedComponents"]);Ext.getCmp("defaultAssociatedMeasures").clearValue();Ext.getCmp("defaultAssociatedMeasures").getStore().loadRawData(publicJSON["associatedComponents"]);}Ext.getCmp("itemselectHosts").setVisible(true);Ext.getCmp("defaultAssociatedMeasures").setVisible(false);
if(publicJSON.availableComponentsFound){var m=Ext.getCmp("itemselectHosts").toField;m.store.add(publicJSON["availableComponents"]);}if(publicJSON.associatedComponentsFound){Ext.getCmp(associated_test_measures_grid).headerCt.items.items[0].hidden=true;Ext.getCmp(associated_test_measures_grid).headerCt.items.items[8].hidden=false;
Ext.getCmp(associated_test_measures_grid).getStore().removeAll();Ext.getCmp(associated_test_measures_grid).getStore().loadRawData(publicJSON["associated_test_measures_grid"]);var o=new Ext.form.field.ComboBox({cls:"dropdown",sortable:false,editable:false,displayField:"displayField",valueField:"valueField",queryMode:"local",fields:["displayField","valueField"],store:[["Key","Key"],["Sup","Non-key"]]});
Ext.getCmp("measureTypeId").setEditor(o);Ext.getCmp(associated_test_measures_grid).show();}Ext.getCmp("addMeasures").show();}else{Ext.getCmp("compTest").setValue(l);if(publicJSON.individualTestFound){Ext.getCmp("testlist").getStore().removeAll();Ext.getCmp("testlist").setFieldLabel(publicJSON.testListLabel);
Ext.getCmp("testlist").getStore().clearFilter(true);Ext.getCmp("testlist").getStore().suspendEvents(true);Ext.getCmp("testlist").getStore().loadRawData(publicJSON.individual_tests);Ext.getCmp("testlist").getStore().resumeEvents();Ext.getCmp("testlist").select(Ext.getCmp("testlist").getStore().getAt(0));
}Ext.getCmp(associated_test_measures_grid).headerCt.items.items[0].hidden=true;Ext.getCmp(associated_test_measures_grid).headerCt.items.items[8].hidden=false;Ext.getCmp(associated_test_measures_grid).getStore().removeAll();Ext.getCmp("actionOnDesc").hide();Ext.getCmp("excludeDescriptors").hide();Ext.getCmp("includeDescriptors").hide();
Ext.getCmp("measuresContainer").hide();Ext.getCmp("associate_button_container").hide();Ext.getCmp(associated_test_measures_grid).hide();Ext.getCmp("addMeasures").hide();Ext.getCmp("actionOnDesc").setValue("Include");var p=Ext.getCmp("testlist");var d=null;if(publicJSON.masterInfosTest!="-1"){d=publicJSON.masterInfosTest;
}else{d=publicJSON.selectDefaultTest;}p.select(d);var a=p.getStore().findRecord("name",d);p.fireEvent("select",p,[a]);}Ext.getCmp("measure_display_name").focus(true,true);},measureValidation:function(){var c=this;var a=Ext.getCmp("measure_display_name");var b=Ext.getCmp("alarm_display_string");if(!checkblank(a.getValue())){Ext.Msg.show({title:pageTitle1,msg:measureDisplayAlert,buttons:Ext.Msg.OK,icon:"iconExclamation",fn:function(){a.focus(true);
}});return false;}else{if(!checkblank(b.getValue())){Ext.Msg.show({title:pageTitle1,msg:alarmDisplayAlert,buttons:Ext.Msg.OK,icon:"iconExclamation",fn:function(){b.focus(true);}});return false;}else{if(!this.checkSpecialChar(a.getValue(),"~!@#$%^&*()|:,;'<>={}[]?/\"")){Ext.Msg.show({title:pageTitle1,msg:splCharAlert3,buttons:Ext.Msg.OK,icon:"iconExclamation",fn:function(){a.focus(true);
}});return false;}else{if(!this.checkSpecialChar(b.getValue(),"~!@#$%^&*()|:,;'<>={}[]?/\"")){Ext.Msg.show({title:pageTitle1,msg:splCharAlert4,buttons:Ext.Msg.OK,icon:"iconExclamation",fn:function(){b.focus(true);}});return false;}}}}return true;},deleteMeasure:function(d,c,a){var b=this;Ext.Msg.show({title:pageTitle1,msg:deleteMeasureAlert+" '"+a+"'?",buttons:Ext.Msg.OKCANCEL,icon:"iconConfirmation",fn:function(e){if(e=="ok"){Ext.Ajax.request({url:"CompositeTest/data/"+d,method:"POST",async:false,success:function(f){if(f.status==200&&!Ext.isEmpty(f.responseText)){var g=f.responseText;
publicJSON=Ext.decode(g);}}});if(publicJSON.AlertType=="Result"){Ext.Msg.show({title:pageTitle1,msg:publicJSON.AlertMsg,buttons:Ext.Msg.OK,icon:"iconInformation",fn:function(f){if(f=="ok"){Ext.getCmp("addMeasureTab").enable();var g=publicJSON.forwardURL;b.loadAddMeasureTab(g);}}});}}}});},showModifyMeasure:function(a,b){operationCompMeasure="modifyCompMeasure";
modifyCompMeasureURL=a;this.loadPopup();},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;},validateThresholds:function(){var c=Ext.getCmp(associated_test_measures_grid);
var h=c.getPlugin(associated_plugin_id);Ext.getCmp(associated_test_measures_grid).getSelectionModel().selectAll();var j=Ext.getCmp(associated_test_measures_grid).getSelectionModel();var d=Ext.getCmp(associated_test_measures_grid).getStore();for(var f=0;f<d.getCount();f++){var e=d.getAt(f);if(j.isSelected(d.getAt(f))){var a=null;
var g=d.getAt(f).get(associated_measure_max_threshold);var b=d.getAt(f).get(associated_measure_min_threshold);if(b.indexOf(" ")>-1){Ext.Msg.show({title:pageTitle1,msg:alert28,buttons:Ext.Msg.OK,icon:"iconExclamation",fn:function(){h.startEditByPosition({row:f,column:5});}});return false;}if(g.indexOf(" ")>-1){Ext.Msg.show({title:pageTitle1,msg:alert29,buttons:Ext.Msg.OK,icon:"iconExclamation",fn:function(){h.startEditByPosition({row:f,column:6});
}});return false;}if(b=="-1"){Ext.Msg.show({title:pageTitle1,msg:alert30,buttons:Ext.Msg.OK,icon:"iconExclamation",fn:function(){h.startEditByPosition({row:f,column:5});}});allowUpdate=false;return false;}if(g=="-1"){Ext.Msg.show({title:pageTitle1,msg:alert31,buttons:Ext.Msg.OK,icon:"iconExclamation",fn:function(){h.startEditByPosition({row:f,column:6});
}});allowUpdate=false;return false;}if(b.trim().toLowerCase()=="none"){b="-1";}if(g.trim().toLowerCase()=="none"){g="-1";}if(b=="-1"&&g=="-1"){Ext.Msg.show({title:pageTitle1,msg:alert27,buttons:Ext.Msg.OK,icon:"iconExclamation",fn:function(){h.startEditByPosition({row:f,column:5});}});allowUpdate=false;
return false;}if(b=="-/-/-"||!correctFormat(b)){Ext.Msg.show({title:pageTitle1,msg:alert32,buttons:Ext.Msg.OK,icon:"iconExclamation",fn:function(){h.startEditByPosition({row:f,column:5});}});return false;}else{if(!checkValidValue(b)){Ext.Msg.show({title:pageTitle1,msg:minimumValuesAlert,buttons:Ext.Msg.OK,icon:"iconExclamation",fn:function(){h.startEditByPosition({row:f,column:5});
}});return false;}else{if(!checkAscendingOrder(b)){Ext.Msg.show({title:pageTitle1,msg:maxThreshAlert,buttons:Ext.Msg.OK,icon:"iconExclamation",fn:function(){h.startEditByPosition({row:f,column:5});}});return false;}else{if((a=validateTargetValues(b,true))!="0"){Ext.Msg.show({title:pageTitle1,msg:a,buttons:Ext.Msg.OK,icon:"iconExclamation",fn:function(){h.startEditByPosition({row:f,column:5});
}});return false;}else{if(checkSpecialChars(b)){Ext.Msg.show({title:pageTitle1,msg:invalid_chars_found,buttons:Ext.Msg.OK,icon:"iconExclamation",fn:function(){h.startEditByPosition({row:f,column:5});}});return false;}}}}}if(g=="-/-/-"||!correctFormat(g)){Ext.Msg.show({title:pageTitle1,msg:alert33,buttons:Ext.Msg.OK,icon:"iconExclamation",fn:function(){h.startEditByPosition({row:f,column:6});
}});return false;}else{if(!checkValidValue(g)){Ext.Msg.show({title:pageTitle1,msg:maximumValuesAlert,buttons:Ext.Msg.OK,icon:"iconExclamation",fn:function(){h.startEditByPosition({row:f,column:6});}});return false;}else{if(!checkDescendingOrder(g)){Ext.Msg.show({title:pageTitle1,msg:minThreshAlert,buttons:Ext.Msg.OK,icon:"iconExclamation",fn:function(){h.startEditByPosition({row:f,column:6});
}});return false;}else{if((a=validateTargetValues(g,false))!="0"){Ext.Msg.show({title:pageTitle1,msg:a,buttons:Ext.Msg.OK,icon:"iconExclamation",fn:function(){h.startEditByPosition({row:f,column:6});}});return false;}else{if(checkSpecialChars(g)){Ext.Msg.show({title:pageTitle1,msg:invalid_chars_found,buttons:Ext.Msg.OK,icon:"iconExclamation",fn:function(){h.startEditByPosition({row:f,column:6});
}});return false;}}}}}}}return true;}});function checkAscendingOrder(e){e=e.trim();if(e.toLowerCase()=="-1"){return true;}var b=e.split("/");if(b.length!=3){return false;}var d,f,a;d=b[0];f=b[1];a=b[2];var c=true;if(d!="-"&&f!="-"){if(parseFloat(d)>=parseFloat(f)){c=false;}}if(f!="-"&&a!="-"){if(parseFloat(f)>=parseFloat(a)){c=false;
}}if(d!="-"&&a!="-"){if(parseFloat(d)>=parseFloat(a)){c=false;}}return c;}function checkDescendingOrder(e){e=e.trim();if(e.toLowerCase()=="-1"){return true;}var b=e.split("/");if(b.length!=3){return false;}var d,f,a;d=b[0];f=b[1];a=b[2];var c=true;if(d!="-"&&f!="-"){if(parseFloat(d)<=parseFloat(f)){c=false;
}}if(f!="-"&&a!="-"){if(parseFloat(f)<=parseFloat(a)){c=false;}}if(d!="-"&&a!="-"){if(parseFloat(d)<=parseFloat(a)){c=false;}}return c;}function checkSpecialChars(b){var a="0123456789-/.";for(var c=0;c<b.length;c++){if(a.indexOf(b.charAt(c))==-1){return true;}}return false;}function checkValidValue(f){f=f.trim();
if(f.toLowerCase()=="-1"){return true;}var b=f.split("/");if(b.length!=3){return false;}var e,g,a;e=b[0];g=b[1];a=b[2];var d=/^(\-)$|^(\-|\-?(([0-9]+\.|\.)?[0-9]+))$/i;var c=d.test(e);if(!c){c=d.test(g);}if(!c){c=d.test(a);}return c;}function validateTargetValues(g,d){g=g.trim();if(g.toLowerCase()=="-1"){return"0";
}var b=g.split("/");if(b.length!=3){if(d){return alert25;}else{return alert26;}}var c=b[0].trim();var f=b[1].trim();var e=b[2].trim();var a=null;if(c!="-"){a=privatemethod(c,d,"critical");if(a!="0"){return a;}}if(f!="-"){a=privatemethod(f,d,"major");if(a!="0"){return a;}}if(e!="-"){a=privatemethod(e,d,"minor");
if(a!="0"){return a;}}return"0";}function privatemethod(h,c,e){var g="0";var d=/^[0-9]{0,10}(\.[0-9]{1,4})?$/;if((h.indexOf("-")!=h.lastIndexOf("-"))||(h.indexOf(".")!=h.lastIndexOf("."))){if(c){if(e=="critical"){g=alert1;}else{if(e=="major"){g=alert2;}else{if(e=="minor"){g=alert3;}}}}else{if(e=="critical"){g=alert4;
}else{if(e=="major"){g=alert5;}else{if(e=="minor"){g=alert6;}}}}}else{if(parseFloat(h)<0){if(c){if(e=="critical"){g=alert19;}else{if(e=="major"){g=alert20;}else{if(e=="minor"){g=alert21;}}}}else{if(e=="critical"){g=alert22;}else{if(e=="major"){g=alert23;}else{if(e=="minor"){g=alert24;}}}}}else{if(!d.test(h)){var f=h;
var b="";var a=h.indexOf(".");if(a>-1){f=h.substring(0,a);b=h.substring(a+1);}if(f.length>10){if(c){if(e=="critical"){g=alert7;}else{if(e=="major"){g=alert8;}else{if(e=="minor"){g=alert9;}}}}else{if(e=="critical"){g=alert10;}else{if(e=="major"){g=alert11;}else{if(e=="minor"){g=alert12;}}}}}else{if(b.length>4){if(c){if(e=="critical"){g=alert13;
}else{if(e=="major"){g=alert14;}else{if(e=="minor"){g=alert15;}}}}else{if(e=="critical"){g=alert16;}else{if(e=="major"){g=alert17;}else{if(e=="minor"){g=alert18;}}}}}}}}}return g;}function correctFormat(d){d=d.trim();if(d.toLowerCase()=="-1"){return true;}if(d.toLowerCase().indexOf("none")>-1){return false;
}var b=d.split("/");if(b.length!=3){return false;}var c,e,a;c=b[0];e=b[1];a=b[2];if(Ext.isEmpty(c)||Ext.isEmpty(e)||Ext.isEmpty(a)){return false;}if(c.length==0||e.length==0||a.length==0){return false;}return true;}