Ext.Msg.cls="adminAlert";Ext.Msg.layout={type:"anchor",pack:"center",align:"center"};Ext.define("AggregateTests.controller.Main",{extend:"Ext.app.Controller",requires:["AggregateTests.view.Description","AggregateTests.view.DynamicGrid"],views:["FormItems","PercentFormItems"],refs:[{selector:"FormItems",ref:"FormItems"},{selector:"PercentFormItems",ref:"PercentFormItems"},{selector:"defaultthresholds",ref:"defaultthresholds"},{selector:"configurethresholds",ref:"configurethresholds"}],init:function(){me=this,this.control({"aggtestform":{"afterrender":this.afterMainRender},'aggtestform combo[id="component_types"]':{"select":this.changeComponentType},'aggtestform combo[id="test"]':{"select":this.reloadPage},'aggtestform combo[id="aggTest"]':{"select":this.reloadAggPage},'aggtestform combo[id="allowedId"]':{"select":this.showHideGridColumn},'aggtestform button[id="addMeasures"]':{"click":this.update_intermediate},'aggtestform button[id="modifyMeasures"]':{"click":this.update_intermediate},'aggtestform button[id="deleteMeasures"]':{"click":this.update_intermediate},'aggtestform button[id="appendMeasures"]':{"click":this.update_intermediate},'aggtestform button[id="backButton"]':{"click":this.goback},'aggtestform button[id="showAll"]':{"click":this.showPopup},"defaultthresholds":{"afterrender":this.gotoDefaultThresholdPage},'defaultthresholds [id="measureGrid"]':{itemmouseenter:this.showModifyTool,itemmouseleave:this.hideModifyTool},'defaultthresholds [id="noMeasureGrid"]':{"cellclick":this.noThreshMeasureModify,},'defaultthresholds button[id="fromDefaultBackBtn"]':{"click":this.goback,},'defaultthresholds button[id="submitBtn"]':{"click":this.submitData,},"configurethresholds":{"boxready":this.configureMainRender,},'configurethresholds button[id="updateBtn"]':{"click":this.applyThresholdsData},'configurethresholds button[id="configureBackBtn"]':{"click":this.configureThresholdsPageBack,},'configurethresholds slider[id="relMinCritical"]':{"drag":this.minRelCriticalSlider,"change":this.minRelCriticalSlider,},'configurethresholds slider[id="relMinMajor"]':{"drag":this.minRelMajorSlider,"change":this.minRelMajorSlider,},'configurethresholds slider[id="relMinMinor"]':{"drag":this.minRelMinorSlider,"change":this.minRelMinorSlider,},'configurethresholds slider[id="relMaxCritical"]':{"drag":this.maxRelCriticalSlider,"change":this.maxRelCriticalSlider,},'configurethresholds slider[id="relMaxMajor"]':{"drag":this.maxRelMajorSlider,"change":this.maxRelMajorSlider,},'configurethresholds slider[id="relMaxMinor"]':{"drag":this.maxRelMinorSlider,"change":this.maxRelMinorSlider,},'configurethresholds checkbox[id="minStaticCheck"]':{"change":this.minStaticCheckChange,},'configurethresholds checkbox[id="minAutoCheck"]':{"change":this.minAutoCheckChange,},'configurethresholds checkbox[id="maxStaticCheck"]':{"change":this.maxStaticCheckChange,},'configurethresholds checkbox[id="maxAutoCheck"]':{"change":this.maxAutoCheckChange,},'configurethresholds combo[id="alarmPolicyCombo"]':{"select":this.alarmPolicyChange,},'percentformitems button[id="updatePctMeasures"]':{"click":this.update}});
},defaultThreshBack:function(){var a=publicJson["testName"];window.location.href="/final/admin/aggShowComponentTypes.jsp?agg_test_name="+a;},goback:function(){window.location.href="/final/admin/aggDisplayTests.jsp";},afterMainRender:function(){Ext.Ajax.request({url:"/final/admin/AggregateTests/data/aggAddTestJson.jsp?"+queryString,method:"POST",timeout:300000,async:false,success:function(e){var b=e.responseText;
publicJSON=Ext.decode(b);operation=publicJSON["parameters"]["s_operation"];if(operation=="addMeasures"){var f=Ext.getCmp("upper_measures_grid");f.columns[4].setVisible(false);f.columns[5].setVisible(false);f.columns[6].setVisible(false);f.columns[7].setVisible(false);f.columns[8].setVisible(false);if(current_testfor=="managedtests"){Ext.getCmp("managedcomponents").setValue(true);
}else{Ext.getCmp("allcomponents").setValue(true);}Ext.getCmp("addtestcontainer").show();Ext.getCmp("addMeasures").show();Ext.getCmp("addMeasures").setText(publicJSON["labels"]["Include"]);Ext.getCmp("modifyMeasures").hide();Ext.getCmp("deleteMeasures").hide();Ext.getCmp("modifytestcontainer").hide();
Ext.getCmp("testforId").setFieldLabel(publicJSON["labels"]["Aggregate"]);Ext.getCmp("managedcomponents").boxLabelEl.update(publicJSON["labels"]["Managed_Components"]);Ext.getCmp("allcomponents").boxLabelEl.update(publicJSON["labels"]["All_Components"]);Ext.getCmp("component_types").show();Ext.getCmp("component_types").clearValue();
Ext.getCmp("component_types").setFieldLabel(publicJSON["labels"]["Filter_by_component_type"]);Ext.getCmp("component_types").getStore().clearFilter(true);Ext.getCmp("component_types").getStore().loadRawData(publicJSON["component_types"]);var k=publicJSON["parameters"]["s_component_type"];if(k!=null&&k!="undefined"&&k!="-1"){Ext.getCmp("component_types").setValue(k);
Ext.getCmp("test").show();}else{Ext.getCmp("component_types").setValue("-1");Ext.getCmp("test").hide();}Ext.getCmp("test").clearValue();Ext.getCmp("test").setFieldLabel(publicJSON["labels"]["Test_to_be_aggregated"]);Ext.getCmp("test").getStore().clearFilter(true);Ext.getCmp("test").getStore().loadRawData(publicJSON["tests"]);
Ext.getCmp("test").setValue("-1");var g=publicJSON["parameters"]["s_test"];if(g==null||g=="undefined"||g=="-1"){Ext.getCmp("test").setValue("-1");}else{Ext.getCmp("test").setValue(g);Ext.getCmp("aggTestDispName").show();Ext.getCmp("aggTestDispName").setFieldLabel(publicJSON["labels"]["Aggregate_test_display_name"]);
Ext.getCmp("allowedId").show();Ext.getCmp("aggTestDispName").setValue(publicJSON["displayaggname"]["displayname"]);Ext.getCmp("upper_measures_grid").show();Ext.getCmp("upper_measures_grid").getSelectionModel().deselectAll();Ext.getCmp("upper_measures_grid").getStore().loadRawData(publicJSON["upperRowDataArray"]);
var c=publicJSON["gridColumns"];for(var i in c){if(i==0||i==4){continue;}Ext.getCmp("upper_measures_grid").columns[i].setText(c[i]);}Ext.getCmp("upper_measures_button_container").show();Ext.getCmp("upper_measures_grid").setTitle(publicJSON["labels"]["Available_measures_for"]);s_aggTest=publicJSON["new_aggTest"]["s_aggTest"];
var j=Ext.getCmp("upper_measures_grid");j.columns[7].setVisible(false);var d=j.query("gridcolumn")[3];if(publicJSON.condition_fn_found_in_upper_grid){d.flex=1;}else{if(d.flex){delete d.flex;}d.setWidth(200);}j.doLayout();}}else{Ext.getCmp("addMeasures").hide();Ext.getCmp("modifyMeasures").show();Ext.getCmp("modifyMeasures").setText(publicJSON["labels"]["Modify"]);
Ext.getCmp("deleteMeasures").show();Ext.getCmp("deleteMeasures").setText(publicJSON["labels"]["Exclude"]);Ext.getCmp("addtestcontainer").hide();Ext.getCmp("modifytestcontainer").show();Ext.getCmp("aggTest").setFieldLabel(publicJSON["labels"]["Aggregate_test_name"]);Ext.getCmp("aggTest").clearValue();
Ext.getCmp("aggTest").getStore().loadRawData(publicJSON["aggTests"]);Ext.getCmp("aggTest").setValue(s_aggTest);Ext.getCmp("modify_aggTestDispName").setFieldLabel(publicJSON["labels"]["Aggregate_test_display_name"]);Ext.getCmp("modify_aggTestDispName").setValue(publicJSON.modify_displayaggname);var h=Ext.getCmp("modify_allowedId");
h.setVisible(true);if(publicJSON.descriptorAggregation=="false"){h.items.items[0].setValue(true);}else{h.items.items[1].setValue(true);}Ext.getCmp("upper_measures_grid").show();Ext.getCmp("upper_measures_grid").setTitle(publicJSON["labels"]["Included_measures_for"]);var c=publicJSON["gridColumns"];for(var i in c){if(i==0||i==4){continue;
}Ext.getCmp("upper_measures_grid").columns[i].setText(c[i]);}Ext.getCmp("upper_measures_grid").getSelectionModel().deselectAll();Ext.getCmp("upper_measures_grid").getStore().loadRawData(publicJSON["upperRowDataArray"]);Ext.getCmp("upper_measures_button_container").show();var j=Ext.getCmp("upper_measures_grid");
if(publicJSON.descriptorAggregation=="true"){j.columns[7].setVisible(true);}else{j.columns[7].setVisible(false);}measures_exist=new Array();var a=publicJSON["existingMeasures"];for(var i in a){measures_exist.push(a[i]);}var j=Ext.getCmp("upper_measures_grid");var d=j.query("gridcolumn")[3];if(publicJSON.condition_fn_found_in_upper_grid){j.columns[4].setVisible(true);
j.columns[5].setVisible(true);j.columns[6].setVisible(true);j.columns[8].setVisible(true);d.flex=1;}else{j.columns[4].setVisible(false);j.columns[5].setVisible(false);j.columns[6].setVisible(false);j.columns[7].setVisible(false);j.columns[8].setVisible(false);if(d.flex){delete d.flex;}d.setWidth(200);
}j.doLayout();Ext.getCmp("upper_measures_grid").getView().refresh();if(publicJSON["lowerRowDataArray"]!=null&&publicJSON["lowerRowDataArray"]!="undefined"){Ext.getCmp("lower_measures_grid").show();Ext.getCmp("lower_measures_grid").getSelectionModel().deselectAll();Ext.getCmp("lower_measures_grid").getStore().loadRawData(publicJSON["lowerRowDataArray"]);
var c=publicJSON["gridColumns"];for(var i in c){if(i==0||i==4){continue;}Ext.getCmp("lower_measures_grid").columns[i].setText(c[i]);}Ext.getCmp("lower_measures_grid").show();Ext.getCmp("lower_measures_button_container").show();Ext.getCmp("lower_measures_grid").setTitle(publicJSON["labels"]["Excluded_measures_for"]);
Ext.getCmp("appendMeasures").setText(publicJSON["labels"]["Include"]);var j=Ext.getCmp("lower_measures_grid");if(publicJSON.descriptorAggregation=="true"){j.columns[7].setVisible(true);}else{j.columns[7].setVisible(false);}var d=j.query("gridcolumn")[3];if(publicJSON.condition_fn_found_in_lower_grid){j.columns[4].setVisible(true);
j.columns[5].setVisible(true);j.columns[6].setVisible(true);j.columns[8].setVisible(true);d.flex=1;}else{j.columns[4].setVisible(false);j.columns[5].setVisible(false);j.columns[6].setVisible(false);j.columns[7].setVisible(false);j.columns[8].setVisible(false);if(d.flex){delete d.flex;}d.setWidth(200);
}j.doLayout();Ext.getCmp("lower_measures_grid").getView().refresh();}else{Ext.getCmp("lower_measures_grid").hide();Ext.getCmp("lower_measures_button_container").hide();}s_test=publicJSON["s_test"]["s_ind_test"];superMeasureMap=null;pctMeasureNamesArray=null;if(publicJSON["superMeasureMap"]!=null){superMeasureMap=publicJSON["superMeasureMap"];
pctMeasureNamesArray=publicJSON["pctMeasureNamesArray"];}}},failure:function(a){Ext.MessageBox.alert(pageLabel,"Could not load aggAddTestJson.jsp");}});},reloadPage:function(){var b=Ext.getCmp("component_types").getValue();var a=Ext.getCmp("test").getValue();if(a!=null&&a=="-1"){queryString="operation=addMeasures&s_test=-1&testfor="+current_testfor+"&s_component_type="+b;
}else{queryString="operation=addMeasures&s_test="+a+"&testfor="+current_testfor+"&s_component_type="+b;}Ext.Ajax.request({url:"/final/admin/AggregateTests/data/aggAddTestJson.jsp?"+queryString,method:"POST",timeout:300000,async:false,success:function(d){var i=d.responseText;publicJSON=Ext.decode(i);operation=publicJSON["parameters"]["s_operation"];
if(operation=="addMeasures"){if(current_testfor=="managedtests"){Ext.getCmp("managedcomponents").setValue(true);}else{Ext.getCmp("allcomponents").setValue(true);}Ext.getCmp("addtestcontainer").show();Ext.getCmp("addMeasures").show();Ext.getCmp("addMeasures").setText(publicJSON["labels"]["Include"]);Ext.getCmp("modifyMeasures").hide();
Ext.getCmp("deleteMeasures").hide();Ext.getCmp("modifytestcontainer").hide();Ext.getCmp("testforId").setFieldLabel(publicJSON["labels"]["Aggregate"]);Ext.getCmp("managedcomponents").boxLabelEl.update(publicJSON["labels"]["Managed_Components"]);Ext.getCmp("allcomponents").boxLabelEl.update(publicJSON["labels"]["All_Components"]);
Ext.getCmp("component_types").show();Ext.getCmp("component_types").clearValue();Ext.getCmp("component_types").setFieldLabel(publicJSON["labels"]["Filter_by_component_type"]);Ext.getCmp("component_types").getStore().clearFilter(true);Ext.getCmp("component_types").getStore().loadRawData(publicJSON["component_types"]);
var g=publicJSON["parameters"]["s_component_type"];if(g!=null&&g!="undefined"&&g!="-1"){Ext.getCmp("component_types").setValue(g);Ext.getCmp("aggTestDispName").show();Ext.getCmp("allowedId").show();Ext.getCmp("upper_measures_grid").show();}else{Ext.getCmp("component_types").setValue("-1");Ext.getCmp("aggTestDispName").hide();
Ext.getCmp("allowedId").hide();Ext.getCmp("upper_measures_grid").hide();}Ext.getCmp("test").clearValue();Ext.getCmp("test").setFieldLabel(publicJSON["labels"]["Test_to_be_aggregated"]);Ext.getCmp("test").getStore().clearFilter(true);Ext.getCmp("test").getStore().loadRawData(publicJSON["tests"]);Ext.getCmp("test").setValue("-1");
var c=publicJSON["parameters"]["s_test"];if(c==null||c=="undefined"||c=="-1"){Ext.getCmp("test").setValue("-1");Ext.getCmp("aggTestDispName").hide();Ext.getCmp("allowedId").hide();Ext.getCmp("upper_measures_grid").hide();Ext.getCmp("upper_measures_button_container").hide();}else{Ext.getCmp("test").setValue(c);
Ext.getCmp("aggTestDispName").show();Ext.getCmp("aggTestDispName").setFieldLabel(publicJSON["labels"]["Aggregate_test_display_name"]);Ext.getCmp("allowedId").show();Ext.getCmp("upper_measures_button_container").show();Ext.getCmp("allowedId").setValue({"descriptorAggregation":"false"});Ext.getCmp("aggTestDispName").setValue(publicJSON["displayaggname"]["displayname"]);
Ext.getCmp("upper_measures_grid").show();Ext.getCmp("upper_measures_grid").getSelectionModel().deselectAll();Ext.getCmp("upper_measures_grid").getStore().loadRawData(publicJSON["upperRowDataArray"]);var j=publicJSON["gridColumns"];for(var e in j){if(e==0||e==4){continue;}Ext.getCmp("upper_measures_grid").columns[e].setText(j[e]);
}Ext.getCmp("upper_measures_grid").setTitle(publicJSON["labels"]["Available_measures_for"]);s_aggTest=publicJSON["new_aggTest"]["s_aggTest"];var h=Ext.getCmp("upper_measures_grid");h.columns[7].setVisible(false);var f=h.query("gridcolumn")[3];if(publicJSON.condition_fn_found_in_upper_grid){f.flex=1;}else{if(f.flex){delete f.flex;
}f.setWidth(200);}h.doLayout();}}},failure:function(c){Ext.MessageBox.alert(pageLabel,"Could not load aggAddTestJson.jsp");}});},reloadAggPage:function(){s_aggTest=Ext.getCmp("aggTest").getValue();if(s_aggTest==null||s_aggTest=="-1"){Ext.getCmp("upper_measures_grid").hide();Ext.getCmp("upper_measures_button_container").hide();
Ext.getCmp("lower_measures_grid").hide();Ext.getCmp("lower_measures_button_container").hide();}else{queryString="operation=modifyMeasures&aggtest="+s_aggTest;Ext.Ajax.request({url:"/final/admin/AggregateTests/data/aggAddTestJson.jsp?"+queryString,method:"POST",timeout:300000,async:false,success:function(g){var b=g.responseText;
publicJSON=Ext.decode(b);operation=publicJSON["parameters"]["s_operation"];if(operation=="modifyMeasures"){Ext.getCmp("addMeasures").hide();Ext.getCmp("modifyMeasures").show();Ext.getCmp("modifyMeasures").setText(publicJSON["labels"]["Modify"]);Ext.getCmp("deleteMeasures").show();Ext.getCmp("deleteMeasures").setText(publicJSON["labels"]["Exclude"]);
Ext.getCmp("addtestcontainer").hide();Ext.getCmp("modifytestcontainer").show();Ext.getCmp("aggTest").setFieldLabel(publicJSON["labels"]["Aggregate_test_name"]);Ext.getCmp("aggTest").clearValue();Ext.getCmp("aggTest").getStore().loadRawData(publicJSON["aggTests"]);Ext.getCmp("aggTest").setValue(s_aggTest);
Ext.getCmp("modify_aggTestDispName").setFieldLabel(publicJSON["labels"]["Aggregate_test_display_name"]);Ext.getCmp("modify_aggTestDispName").setValue(publicJSON.modify_displayaggname);var n=Ext.getCmp("modify_allowedId");n.setVisible(true);if(publicJSON.descriptorAggregation=="false"){n.items.items[0].setValue(true);
}else{n.items.items[1].setValue(true);}Ext.getCmp("upper_measures_grid").show();Ext.getCmp("upper_measures_grid").setTitle(publicJSON["labels"]["Included_measures_for"]);var d=publicJSON["gridColumns"];for(var o in d){if(o==0||o==4){continue;}Ext.getCmp("upper_measures_grid").columns[o].setText(d[o]);
}Ext.getCmp("upper_measures_grid").getSelectionModel().deselectAll();Ext.getCmp("upper_measures_grid").getStore().loadRawData(publicJSON["upperRowDataArray"]);Ext.getCmp("upper_measures_button_container").show();var j=true;var k=false;var q=Ext.getCmp("upper_measures_grid");if(publicJSON.descriptorAggregation=="true"){q.columns[7].setVisible(true);
}else{q.columns[7].setVisible(false);}var f=q.query("gridcolumn")[3];if(publicJSON.condition_fn_found_in_upper_grid){f.flex=1;}else{if(f.flex){delete f.flex;}f.setWidth(200);}q.doLayout();measures_exist=new Array();var a=publicJSON["existingMeasures"];for(var o in a){measures_exist.push(a[o]);}if(publicJSON["lowerRowDataArray"]!=null&&publicJSON["lowerRowDataArray"]!="undefined"){k=true;
Ext.getCmp("lower_measures_grid").show();Ext.getCmp("lower_measures_grid").getSelectionModel().deselectAll();Ext.getCmp("lower_measures_grid").getStore().loadRawData(publicJSON["lowerRowDataArray"]);var d=publicJSON["gridColumns"];for(var o in d){if(o==0||o==4){continue;}Ext.getCmp("lower_measures_grid").columns[o].setText(d[o]);
}Ext.getCmp("lower_measures_grid").show();Ext.getCmp("lower_measures_button_container").show();Ext.getCmp("lower_measures_grid").setTitle(publicJSON["labels"]["Excluded_measures_for"]);Ext.getCmp("appendMeasures").setText(publicJSON["labels"]["Include"]);var q=Ext.getCmp("lower_measures_grid");if(publicJSON.descriptorAggregation=="true"){q.columns[7].setVisible(true);
}else{q.columns[7].setVisible(false);}}else{Ext.getCmp("lower_measures_grid").hide();Ext.getCmp("lower_measures_button_container").hide();}s_test=publicJSON["s_test"]["s_ind_test"];if(j){var p=false;var l=Ext.getCmp("upper_measures_grid");var c=l.getStore();for(var h=0;h<c.getCount();h++){var m=c.getAt(h).get("upper_aggregate_function").trim();
if(m=="Condition"||m=="Multi-Condition"){p=true;break;}}if(p){l.columns[4].setVisible(true);l.columns[5].setVisible(true);l.columns[6].setVisible(true);l.columns[8].setVisible(true);}else{l.columns[4].setVisible(false);l.columns[5].setVisible(false);l.columns[6].setVisible(false);l.columns[7].setVisible(false);
l.columns[8].setVisible(false);}Ext.getCmp("upper_measures_grid").getView().refresh();}if(k){var p=false;var e=Ext.getCmp("lower_measures_grid");var c=e.getStore();for(var h=0;h<c.getCount();h++){var m=c.getAt(h).get("lower_aggregate_function").trim();if(m=="Condition"||m=="Multi-Condition"){p=true;break;
}}if(p){e.columns[4].setVisible(true);e.columns[5].setVisible(true);e.columns[6].setVisible(true);e.columns[8].setVisible(true);}else{e.columns[4].setVisible(false);e.columns[5].setVisible(false);e.columns[6].setVisible(false);e.columns[7].setVisible(false);e.columns[8].setVisible(false);}Ext.getCmp("lower_measures_grid").getView().refresh();
}}},failure:function(a){Ext.MessageBox.alert(pageLabel,"Could not load aggAddTestJson.jsp");}});}},changeComponentType:function(){var a=Ext.getCmp("component_types").getValue();queryString="operation=addMeasures&s_component_type="+a+"&testfor="+current_testfor;Ext.Ajax.request({url:"/final/admin/AggregateTests/data/aggAddTestJson.jsp?"+queryString,method:"POST",timeout:300000,async:false,success:function(c){var g=c.responseText;
publicJSON=Ext.decode(g);operation=publicJSON["parameters"]["s_operation"];if(operation=="addMeasures"){if(current_testfor=="managedtests"){Ext.getCmp("managedcomponents").setValue(true);}else{Ext.getCmp("allcomponents").setValue(true);}Ext.getCmp("addtestcontainer").show();Ext.getCmp("addMeasures").show();
Ext.getCmp("addMeasures").setText(publicJSON["labels"]["Include"]);Ext.getCmp("modifyMeasures").hide();Ext.getCmp("deleteMeasures").hide();Ext.getCmp("modifytestcontainer").hide();Ext.getCmp("testforId").setFieldLabel(publicJSON["labels"]["Aggregate"]);Ext.getCmp("managedcomponents").boxLabelEl.update(publicJSON["labels"]["Managed_Components"]);
Ext.getCmp("allcomponents").boxLabelEl.update(publicJSON["labels"]["All_Components"]);Ext.getCmp("component_types").show();Ext.getCmp("component_types").clearValue();Ext.getCmp("component_types").setFieldLabel(publicJSON["labels"]["Filter_by_component_type"]);Ext.getCmp("component_types").getStore().clearFilter(true);
Ext.getCmp("component_types").getStore().loadRawData(publicJSON["component_types"]);var e=publicJSON["parameters"]["s_component_type"];if(e!=null&&e!="undefined"&&e!="-1"){Ext.getCmp("component_types").setValue(e);Ext.getCmp("aggTestDispName").show();Ext.getCmp("allowedId").show();Ext.getCmp("upper_measures_grid").show();
}else{Ext.getCmp("component_types").setValue("-1");Ext.getCmp("aggTestDispName").hide();Ext.getCmp("allowedId").hide();Ext.getCmp("upper_measures_grid").hide();}Ext.getCmp("test").clearValue();Ext.getCmp("test").setFieldLabel(publicJSON["labels"]["Test_to_be_aggregated"]);Ext.getCmp("test").getStore().clearFilter(true);
Ext.getCmp("test").getStore().loadRawData(publicJSON["tests"]);Ext.getCmp("test").setValue("-1");Ext.getCmp("test").show();var b=publicJSON["parameters"]["s_test"];if(b==null||b=="undefined"||b=="-1"){Ext.getCmp("test").setValue("-1");Ext.getCmp("aggTestDispName").hide();Ext.getCmp("allowedId").hide();
Ext.getCmp("upper_measures_grid").hide();Ext.getCmp("upper_measures_button_container").hide();}else{Ext.getCmp("aggTestDispName").show();Ext.getCmp("allowedId").show();Ext.getCmp("upper_measures_grid").show();Ext.getCmp("test").setValue(b);Ext.getCmp("aggTestDispName").show();Ext.getCmp("allowedId").show();
Ext.getCmp("allowedId").setValue({"descriptorAggregation":"false"});Ext.getCmp("upper_measures_button_container").show();Ext.getCmp("aggTestDispName").setValue(publicJSON["displayaggname"]["displayname"]);Ext.getCmp("upper_measures_grid").show();Ext.getCmp("upper_measures_grid").getSelectionModel().deselectAll();
Ext.getCmp("upper_measures_grid").getStore().loadRawData(publicJSON["upperRowDataArray"]);var h=publicJSON["gridColumns"];for(var d in h){if(d==0||d==4){continue;}Ext.getCmp("upper_measures_grid").columns[d].setText(h[d]);}Ext.getCmp("upper_measures_grid").setTitle(publicJSON["labels"]["Available_measures_for"]);
s_aggTest=publicJSON["new_aggTest"]["s_aggTest"];var f=Ext.getCmp("upper_measures_grid");f.columns[7].setVisible(false);}}},failure:function(b){Ext.MessageBox.alert(pageLabel,"Could not load aggAddTestJson.jsp");}});},update_intermediate:function(a){operation=a.getId();if(operation!="deleteMeasures"&&isDuplicateDescriptionFound(operation)){return false;
}else{if(operation=="addMeasures"&&!checkTestDispName(Ext.getCmp("aggTestDispName").getValue())){Ext.getCmp("aggTestDispName").focus();return;}else{if(operation=="modifyMeasures"&&!checkTestDispName(Ext.getCmp("modify_aggTestDispName").getValue())){Ext.getCmp("modify_aggTestDispName").focus();return;
}}}var L=null;var K=null;var H=null;var g=null;var b=null;if(operation=="addMeasures"||operation=="modifyMeasures"||operation=="deleteMeasures"){b="upper_plugin";g="upper_measures_grid";L="upper_m_name";K="upper_measure_description";H="upper_aggregate_function";column4="upper_relation";column5="upper_value";
column6="upper_trgt_comp";column7="upper_target_violation";column8="upper_measure_value_in";}else{b="lower_plugin";g="lower_measures_grid";L="lower_m_name";K="lower_measure_description";H="lower_aggregate_function";column4="lower_relation";column5="lower_value";column6="lower_trgt_comp";column7="lower_target_violation";
column8="lower_measure_value_in";}var h=Ext.getCmp(g);var y=h.getPlugin(b);var o=Ext.getCmp(g).getSelectionModel();var r="no";if(operation=="modifyMeasures"&&o.selected.length==0){r="yes";}var G=false;var k="false";if(operation=="addMeasures"){k=Ext.getCmp("allowedId").getValue().descriptorAggregation;
if(k=="true"){G=true;}}else{k=Ext.getCmp("modify_allowedId").getValue().modify_descriptorAggregation;if(k=="true"){G=true;}}var p=Ext.getCmp(g).getStore();for(var A=0;A<p.getCount();A++){if(r=="yes"||o.isSelected(p.getAt(A))){var d=p.getAt(A).get(K).trim();if(!checkMeasureDesc(d)){y.startEditByPosition({row:A,column:2});
return;}var u=p.getAt(A).get(H).trim();if(u=="Condition"){u="condition";}else{if(u=="Multi-Condition"){u="multi-condition";}}if(u=="condition"||u=="multi-condition"){s_trgt_condition=p.getAt(A).get(column4).trim();s_trgt_value=p.getAt(A).get(column5).trim();trgt_components=p.getAt(A).get(column6).trim();
if(G){trgt_violation_by=p.getAt(A).get(column7).trim();}else{trgt_violation_by="Majority";}unit_of_measurement=p.getAt(A).get(column8).trim();if(s_trgt_condition==">"){s_trgt_condition="GT";}else{if(s_trgt_condition=="<"){s_trgt_condition="LT";}else{if(s_trgt_condition==">="){s_trgt_condition="GE";}else{if(s_trgt_condition=="<="){s_trgt_condition="LE";
}else{if(s_trgt_condition=="="){s_trgt_condition="EQ";}}}}}if(s_trgt_condition=="Not Applicable"){Ext.MessageBox.alert(pageLabel,message_6+" "+d);return;}else{if(u=="condition"&&(s_trgt_value=="Not Applicable"||isNaN(s_trgt_value))){Ext.MessageBox.alert(pageLabel,message_7+" "+d);return;}else{if(u=="condition"&&(s_trgt_value=="Not Applicable"||(parseFloat(s_trgt_value)<0))){Ext.MessageBox.alert(pageLabel,message_18+" "+d);
return;}else{if(u=="condition"&&unit_of_measurement=="Not Applicable"){Ext.MessageBox.alert(pageLabel,message_8+" "+d);return;}else{if(u=="multi-condition"&&(unit_of_measurement=="Not Applicable"||unit_of_measurement=="%")){Ext.MessageBox.alert(pageLabel,message_9+" "+d);return;}else{if(G&&trgt_violation_by=="Not Applicable"){Ext.MessageBox.alert(pageLabel,message_11+" "+d);
return;}else{if(u=="multi-condition"&&invalidCharsFound(s_trgt_value)){Ext.MessageBox.alert(pageLabel,invalid_chars_found_trgt_val+" "+d);return;}else{if(u=="multi-condition"&&invalidCharsFound(trgt_components)){Ext.MessageBox.alert(pageLabel,invalid_chars_found_trgt_comps+" "+d);return;}else{if(u=="multi-condition"&&noValueSpecified(s_trgt_value)){Ext.MessageBox.alert(pageLabel,message_16+" "+d);
return;}else{if(u=="multi-condition"&&noValueSpecified(trgt_components)){Ext.MessageBox.alert(pageLabel,message_17+" "+d);return;}}}}}}}}}}if(u=="condition"){if(!checkValidValue(s_trgt_value)){Ext.MessageBox.alert(pageLabel,trgt_value_invalid+" "+d);return false;}else{if(!checkNonNegativeFormat_agg(s_trgt_value)){Ext.MessageBox.alert(pageLabel,trgt_value_invalid+" "+d+".\n"+possible_reason_could_be+" : \n"+"1) "+set_with_negative_value+".\n"+"2) "+six_digits+".\n"+"3) "+four_digits+".");
return false;}}}else{if(u=="multi-condition"){var n=s_trgt_value.trim().split("/");var l=n[0].trim();var v=n[1].trim();var q=n[2].trim();var J=checkValidValue(l);if(!J){Ext.MessageBox.alert(pageLabel,critial_trgt_value_invalid+" "+d);return false;}else{if(l!="-"){if(!checkNonNegativeFormat_agg(l)){Ext.MessageBox.alert(pageLabel,critial_trgt_value_invalid+" "+d+".\n"+possible_reason_could_be+" : \n"+"1) "+set_with_negative_value+".\n"+"2) "+six_digits+".\n"+"3) "+four_digits+".");
return false;}}}var z=checkValidValue(v);if(!z){Ext.MessageBox.alert(pageLabel,major_trgt_value_invalid+" "+d);return false;}else{if(v!="-"){if(!checkNonNegativeFormat_agg(v)){Ext.MessageBox.alert(pageLabel,major_trgt_value_invalid+" "+d+".\n"+possible_reason_could_be+" : \n"+"1) "+set_with_negative_value+".\n"+"2) "+six_digits+".\n"+"3) "+four_digits+".");
return false;}}}var x=checkValidValue(q);if(!x){Ext.MessageBox.alert(pageLabel,minor_trgt_value_invalid+" "+d);return false;}else{if(q!="-"){if(!checkNonNegativeFormat_agg(q)){Ext.MessageBox.alert(pageLabel,minor_trgt_value_invalid+" "+d+".\n"+possible_reason_could_be+" : \n"+"1) "+set_with_negative_value+".\n"+"2) "+six_digits+".\n"+"3) "+four_digits+".");
return false;}}}var t=checkNegativeValue(l);if(t){Ext.MessageBox.alert(pageLabel,critial_trgt_value_invalid+" "+d+" "+should_not_contain);return false;}t=checkNegativeValue(v);if(t){Ext.MessageBox.alert(pageLabel,major_trgt_value_invalid+" "+d+" "+should_not_contain);return false;}t=checkNegativeValue(q);
if(t){Ext.MessageBox.alert(pageLabel,minor_trgt_value_invalid+" "+d+" "+should_not_contain);return false;}}}if(u=="multi-condition"){var n=trgt_components.trim().split("/");var l=n[0].trim();var v=n[1].trim();var q=n[2].trim();var J=checkValidValue(l);if(!J){Ext.MessageBox.alert(pageLabel,critial_trgt_comps_invalid+" "+d);
return false;}else{if(l!="-"){if(!checkNonNegativeFormat_agg(l)){Ext.MessageBox.alert(pageLabel,critial_trgt_comps_invalid+" "+d+".\n"+possible_reason_could_be+" : \n"+"1) "+set_with_negative_value+".\n"+"2) "+six_digits+".\n"+"3) "+four_digits+".");return false;}if(parseFloat(l)>100){Ext.MessageBox.alert(pageLabel,critial_trgt_comps_100+" "+d);
return false;}}}var z=checkValidValue(v);if(!z){Ext.MessageBox.alert(pageLabel,major_trgt_comps_invalid+" "+d);return false;}else{if(v!="-"){if(!checkNonNegativeFormat_agg(v)){Ext.MessageBox.alert(pageLabel,major_trgt_comps_invalid+" "+d+".\n"+possible_reason_could_be+" : \n"+"1) "+set_with_negative_value+".\n"+"2) "+six_digits+".\n"+"3) "+four_digits+".");
return false;}if(parseFloat(v)>100){Ext.MessageBox.alert(pageLabel,major_trgt_comps_100+" "+d);return false;}}}var x=checkValidValue(q);if(!x){Ext.MessageBox.alert(pageLabel,minor_trgt_comps_invalid+" "+d);return false;}else{if(q!="-"){if(!checkNonNegativeFormat_agg(q)){Ext.MessageBox.alert(pageLabel,minor_trgt_comps_invalid+" "+d+".\n"+possible_reason_could_be+" : \n"+"1) "+set_with_negative_value+".\n"+"2) "+six_digits+".\n"+"3) "+four_digits+".");
return false;}if(parseFloat(q)>100){Ext.MessageBox.alert(pageLabel,minor_trgt_comps_100+" "+d);return false;}}}var t=checkNegativeValue(l);if(t){Ext.MessageBox.alert(pageLabel,critial_trgt_comps_invalid+" "+d+" "+should_not_contain);return false;}t=checkNegativeValue(v);if(t){Ext.MessageBox.alert(pageLabel,major_trgt_comps_invalid+" "+d+" "+should_not_contain);
return false;}t=checkNegativeValue(q);if(t){Ext.MessageBox.alert(pageLabel,minor_trgt_comps_invalid+" "+d+" "+should_not_contain);return false;}}if(u=="multi-condition"){var E=s_trgt_value.trim().split("/");var j=E[0].trim();var D=E[1].trim();var w=E[2].trim();var C=trgt_components.trim().split("/");
var f=C[0].trim();var F=C[1].trim();var B=C[2].trim();if(j=="-"&&f!="-"){Ext.MessageBox.alert(pageLabel,trgt_message_1+" "+d);return false;}else{if(j!="-"&&f=="-"){Ext.MessageBox.alert(pageLabel,trgt_message_2+" "+d);return false;}}if(D=="-"&&F!="-"){Ext.MessageBox.alert(pageLabel,trgt_message_3+" "+d);
return false;}else{if(D!="-"&&F=="-"){Ext.MessageBox.alert(pageLabel,trgt_message_4+" "+d);return false;}}if(w=="-"&&B!="-"){Ext.MessageBox.alert(pageLabel,trgt_message_5+" "+d);return false;}else{if(w!="-"&&B=="-"){Ext.MessageBox.alert(pageLabel,trgt_message_6+" "+d);return false;}}}}}}if(operation!="deleteMeasures"){individual_test_name="";
available_row_count=0;if(operation=="addMeasures"){available_row_count=0;individual_test_name=Ext.getCmp("test").getValue();}else{if(operation=="modifyMeasures"||operation=="appendMeasures"){available_row_count=Ext.getCmp("upper_measures_grid").getStore().getCount();individual_test_name=s_test;}}var m=new Array();
var I=new Array();var s=new Array();for(var A=0;A<p.getCount();A++){if(operation=="modifyMeasures"){var e=p.getAt(A).get(L).trim();var d=p.getAt(A).get(K).trim();var u=p.getAt(A).get(H).trim();if(u=="Percent"){m.push(e+"|"+d);}I.push(e);s.push(e+"|"+d);if(operation=="addMeasures"){available_row_count+=1;
}else{if(operation=="modifyMeasures"||operation=="appendMeasures"){available_row_count+=1;}}}else{if(o.isSelected(p.getAt(A))){var e=p.getAt(A).get(L).trim();var d=p.getAt(A).get(K).trim();var u=p.getAt(A).get(H).trim();if(u=="Percent"){m.push(e+"|"+d);}I.push(e);s.push(e+"|"+d);if(operation=="addMeasures"){available_row_count+=1;
}else{if(operation=="modifyMeasures"||operation=="appendMeasures"){available_row_count+=1;}}}}}if(m.length>0&&available_row_count<3){Ext.Msg.show({title:pageLabel,msg:pct_agg_function_valid_msg+".",buttons:Ext.Msg.OK,icon:"iconConfirmation",fn:function(i){}});}else{if(m.length>0&&I.length>0){var c=Ext.getCmp("viewPortId");
myMask=new Ext.LoadMask(c,{msg:"Updating..."});myMask.show();Ext.Ajax.request({url:"AggregateTests/data/updateTestPeriodsJson.jsp",method:"POST",params:{"selectedMeasures":I,"selectedMeasuresDetails":s,"measures_with_pct_fn":m,"test":individual_test_name,"operation":operation,"aggTest":s_aggTest},timeout:300000,success:function(M){if(M.status==200&&!Ext.isEmpty(M.responseText)){var i=Ext.decode(M.responseText);
Ext.widget("percentformitems").show();me.DynamicGridPanel(i["gridData"],i["gridColumns"],i);}myMask.hide();},failure:function(i){Ext.Msg.alert(pageTitle,"Unable to process");myMask.hide();}});}else{me.update(a);}}}else{me.update(a);}},update:function(h){var b="";if(h.getId()=="updatePctMeasures"){var o=new Array();
var m=new Array();for(var r in display_internal_name_mapping){var k=display_internal_name_mapping[r];o.push(k);m.push(r);}var e=false;var d=Ext.getCmp("gridPart_1");var a=d.getPlugin("pct_plugin");var l=0;var g=Ext.getCmp("gridPart_1").getStore();for(var n=0;n<g.getCount();n++){var s=g.getAt(n).get("hidden_measure_name").trim();
var f=g.getAt(n).get("measure_name").trim();var q=g.getAt(n).get("measure_name_on_numerator").trim();var j=o[m.indexOf(q)];var c=g.getAt(n).get("measure_name_on_denominator").trim();var p=o[m.indexOf(c)];if(j==p){l=n;e=true;b="";break;}b+=","+s+":"+j+":"+p;}if(e){e=false;Ext.Msg.show({title:pageLabel,msg:you_cannot_set+" "+f,buttons:Ext.Msg.OK,icon:"iconConfirmation",fn:function(i){if(i=="yes"){a.startEditByPosition({row:l,column:2});
}else{if(i=="no"){}}}});}else{if(b.length>0){b=b.substring(1);me.final_update(h,b);}}}else{me.final_update(h,"");}},final_update:function(c,t){if(Ext.getCmp("percentformitems")!=null){Ext.getCmp("percentformitems").hide();}var H="";if(operation=="addMeasures"){H=addConfirmationMsg;}else{if(operation=="modifyMeasures"){H=modifyConfirmationMsg;
}else{if(operation=="deleteMeasures"){H=deleteConfirmationMsg;}else{if(operation=="appendMeasures"){H=appendConfirmationMsg;}}}}if(operation!="deleteMeasures"&&isDuplicateDescriptionFound(operation)){return false;}var P=null;var O=null;var M=null;var m=null;var e=null;var L=false;if(operation=="addMeasures"){if(!checkTestDispName(Ext.getCmp("aggTestDispName").getValue())){Ext.getCmp("aggTestDispName").focus();
return;}}else{if(operation=="modifyMeasures"){if(!checkTestDispName(Ext.getCmp("modify_aggTestDispName").getValue())){Ext.getCmp("modify_aggTestDispName").focus();return;}}}var q="false";if(operation=="addMeasures"){q=Ext.getCmp("allowedId").getValue().descriptorAggregation;if(q=="true"){L=true;}}else{q=Ext.getCmp("modify_allowedId").getValue().modify_descriptorAggregation;
if(q=="true"){L=true;}}if(operation=="addMeasures"||operation=="modifyMeasures"||operation=="deleteMeasures"){e="upper_plugin";m="upper_measures_grid";P="upper_m_name";O="upper_measure_description";M="upper_aggregate_function";column4="upper_relation";column5="upper_value";column6="upper_trgt_comp";column7="upper_target_violation";
column8="upper_measure_value_in";}else{e="lower_plugin";m="lower_measures_grid";P="lower_m_name";O="lower_measure_description";M="lower_aggregate_function";column4="lower_relation";column5="lower_value";column6="lower_trgt_comp";column7="lower_target_violation";column8="lower_measure_value_in";}var o=Ext.getCmp(m);
var G=o.getPlugin(e);var b="";var y=Ext.getCmp(m).getSelectionModel();var A=Ext.getCmp(m).getStore();var N=new Array();var f=new Array();var r=new Array();var d=new Array();var F=A.getCount();var B=0;for(var K=0;K<A.getCount();K++){var v=A.getAt(K).get(P).trim();r.push(v);if(A.getAt(K).get(M).trim()=="Percent"){d.push(v);
}if(y.isSelected(A.getAt(K))){B++;var g=A.getAt(K).get(O).trim();if(!checkMeasureDesc(g)){G.startEditByPosition({row:K,column:2});return;}var l=A.getAt(K).get(P).trim();var C=A.getAt(K).get(M).trim();if(C=="Average"){C="avg";}else{if(C=="Sum"){C="sum";}else{if(C=="Minimum"){C="min";}else{if(C=="Maximum"){C="max";
}else{if(C=="Average Sum"){C="avg_sum";}else{if(C=="Condition"){C="condition";}else{if(C=="Multi-Condition"){C="multi-condition";}else{if(C=="Percent"){C="pct";f.push(l);}}}}}}}}N.push(l);if(C=="condition"||C=="multi-condition"){s_trgt_condition=A.getAt(K).get(column4).trim();s_trgt_value=A.getAt(K).get(column5).trim();
trgt_components=A.getAt(K).get(column6).trim();if(L){trgt_violation_by=A.getAt(K).get(column7).trim();}else{trgt_violation_by="Majority";}unit_of_measurement=A.getAt(K).get(column8).trim();if(s_trgt_condition==">"){s_trgt_condition="GT";}else{if(s_trgt_condition=="<"){s_trgt_condition="LT";}else{if(s_trgt_condition==">="){s_trgt_condition="GE";
}else{if(s_trgt_condition=="<="){s_trgt_condition="LE";}else{if(s_trgt_condition=="="){s_trgt_condition="EQ";}}}}}b+=l+":"+C+":"+g+":"+s_trgt_condition+":"+s_trgt_value+":"+trgt_components+":"+trgt_violation_by+":"+unit_of_measurement+"$";}else{b+=l+":"+C+":"+g+"$";}}}if(b.length==0){if(operation=="addMeasures"){Ext.MessageBox.alert(pageLabel,create_alert);
}else{if(operation=="modifyMeasures"){Ext.MessageBox.alert(pageLabel,modify_alert);}else{if(operation=="deleteMeasures"){Ext.MessageBox.alert(pageLabel,delete_alert);}else{if(operation=="appendMeasures"){Ext.MessageBox.alert(pageLabel,append_alert);}}}}}else{if(operation=="deleteMeasures"&&N.length>0){var D=false;
for(var K=0;K<A.getCount();K++){var x=A.getAt(K).get(P).trim();var w=A.getAt(K).get(O).trim();if(N.indexOf(x)==-1){continue;}for(var I=0;I<pctMeasureNamesArray.length;I++){var u=pctMeasureNamesArray[I];var n=superMeasureMap[u].split(",");var h=n[0];var a=n[1];if(x==h||x==a){if(N.indexOf(u)>=0){continue;
}var p="";for(var J=0;J<A.getCount();J++){var s=A.getAt(J).get(P).trim();if(u==s){p=A.getAt(J).get(O).trim();Ext.MessageBox.alert(pageLabel,w+" measure cannot be excluded as it is associated with measure "+p+" which is not selected now for exclusion");D=true;break;}}}if(D){break;}}if(D){break;}}if(D){return false;
}}if(operation=="deleteMeasures"){var z=true;if(N.length>0){for(var K=0;K<measures_exist.length;K++){if(N.indexOf(measures_exist[K])==-1){z=false;break;}}}}if(z){Ext.Msg.show({title:pageLabel,msg:confirmation_1,buttons:Ext.Msg.YESNO,icon:"iconConfirmation",fn:function(j){if(j=="yes"){var i=Ext.getCmp("formitems").getForm();
if(i.isValid()){var k=Ext.getCmp("viewPortId");myMask=new Ext.LoadMask(k,{msg:"Loading..."});myMask.show();i.submit({url:"/final/admin/aggDeleteTest.jsp",method:"POST",timeout:600,params:{"test":s_aggTest},standardSubmit:true});}}else{if(j=="no"){}}}});}else{b=b.substring(0,b.length-1);var E=null;if(operation=="deleteMeasures"){E=Ext.getCmp("modify_aggTestDispName").getValue();
Ext.Msg.show({title:pageLabel,msg:confirmation_2,buttons:Ext.Msg.YESNO,icon:"iconConfirmation",fn:function(j){if(j=="yes"){var i=Ext.getCmp("formitems").getForm();if(i.isValid()){var k=Ext.getCmp("viewPortId");myMask=new Ext.LoadMask(k,{msg:"Loading..."});myMask.show();i.submit({url:"/final/admin/AggregateTests/data/aggAddTestpJson.jsp",method:"POST",timeout:600,params:{"operation":operation,"measureNames":filterEncode(b),"test":s_test,"aggTest":s_aggTest,"add_modify_test_description":E,"descriptorAggregation_New":q,"pctdetails":t},success:function(S,T){myMask.hide();
publicJSON=Ext.decode(T.response.responseText);if(publicJSON["operationStatus"]!=null){var R=publicJSON["operationStatus"]["message"];var Q=publicJSON["operationStatus"]["errormessage"];if(R!=null&&R!="undefined"){qString="AggregateTests/data/EgDefaultJson.jsp?server=null&qctr=0&page=true&t_name="+s_aggTest+"&normalTestName="+s_test;
var U=Ext.getCmp("viewPortId");myMask=new Ext.LoadMask(U,{msg:"Loading..."});myMask.show();U.removeAll();U.add({xtype:"defaultthresholds"});}else{if(Q!=null&&Q!="undefined"){Ext.Msg.alert(pageLabel,Q);}}}},failure:function(Q,R){myMask.hide();}});}else{Ext.MessageBox.alert(pageLabel,"Invalid form can not be submitted");
}}else{if(j=="no"){}}}});}else{if(operation=="addMeasures"){E=Ext.getCmp("aggTestDispName").getValue();}else{E=Ext.getCmp("modify_aggTestDispName").getValue();}Ext.Msg.show({title:pageLabel,msg:H+". "+proceedMsg+"?",buttons:Ext.Msg.YESNO,icon:"iconConfirmation",fn:function(j){if(j=="yes"){var i=Ext.getCmp("formitems").getForm();
if(i.isValid()){var k=Ext.getCmp("viewPortId");myMask=new Ext.LoadMask(k,{msg:"Updating..."});myMask.show();i.submit({url:"/final/admin/AggregateTests/data/aggAddTestpJson.jsp",method:"POST",timeout:600,params:{"operation":operation,"measureNames":filterEncode(b),"test":s_test,"aggTest":s_aggTest,"add_modify_test_description":filterEncode(E),"descriptorAggregation_New":q,"pctdetails":t},success:function(S,T){myMask.hide();
publicJSON=Ext.decode(T.response.responseText);if(publicJSON["operationStatus"]!=null){var R=publicJSON["operationStatus"]["message"];var Q=publicJSON["operationStatus"]["errormessage"];if(R!=null&&R!="undefined"){window.location.href="/final/admin/aggShowComponentTypes.jsp?agg_test_name="+s_aggTest;
}else{if(Q!=null&&Q!="undefined"){Ext.Msg.alert(pageLabel,Q);}}}else{qString="AggregateTests/data/EgDefaultJson.jsp?server=null&qctr=0&page=true&t_name="+s_aggTest+"&normalTestName="+s_test;var U=Ext.getCmp("viewPortId");myMask=new Ext.LoadMask(U,{msg:"Loading..."});myMask.show();U.removeAll();U.add({xtype:"defaultthresholds"});
}},failure:function(Q,R){myMask.hide();}});}else{Ext.MessageBox.alert(pageLabel,"Invalid form can not be submitted");}}}});}}}},configureThresholdsPageBack:function(){var a=Ext.getCmp("viewPortId");myMask=new Ext.LoadMask(a,{msg:"Loading..."});myMask.show();a.removeAll();a.add({xtype:"defaultthresholds"});
myMask.hide();},alarmPolicyChange:function(){var a=Ext.getCmp("alarmPolicyCombo").getValue();var b=publicJson["alarmPolicyDescriptionObj"][a];Ext.getCmp("alarmDispField").el.update(b);},gotoDefaultThresholdPage:function(){Ext.Ajax.request({url:qString,method:"POST",timeout:300000,scope:this,success:function(d){if(d.status==200&&!Ext.isEmpty(d.responseText)){var f=d.responseText;
publicJson=Ext.decode(f);var a=publicJson["measureValArr"];var c=publicJson["noMeasureValArr"];var g=publicJson["hosttest_title"];var e=publicJson["desc_configure"];var b=publicJson["tableTitle"];if(b!=null&&!Ext.isEmpty(b)){Ext.getCmp("fieldTitleId").setTitle(b);}if(g!=null&&g!="undefined"){Ext.getCmp("hostTestMsgContainer").show();
Ext.getCmp("hostMsgLabel").update(g);}else{Ext.getCmp("hostTestMsgContainer").hide();}if(a!=null&&!Ext.isEmpty(a)){Ext.getCmp("measureGrid").getStore().suspendEvents();Ext.getCmp("measureGrid").getStore().removeAll();Ext.getCmp("measureGrid").getStore().loadRawData(a);Ext.getCmp("measureGrid").getStore().resumeEvents();
Ext.getCmp("measureGrid").getView().refresh();Ext.getCmp("measureGrid").show();}else{Ext.getCmp("measureGrid").hide();}if(c!=null&&!Ext.isEmpty(c)){Ext.getCmp("noMeasureGrid").getStore().suspendEvents();Ext.getCmp("noMeasureGrid").getStore().removeAll();Ext.getCmp("noMeasureGrid").getStore().loadRawData(c);
Ext.getCmp("noMeasureGrid").getStore().resumeEvents();Ext.getCmp("noMeasureGrid").getView().refresh();Ext.getCmp("noMeasureGrid").show();}else{Ext.getCmp("noMeasureGrid").hide();}}myMask.hide();}});},configureMainRender:function(){Ext.Ajax.request({url:"AggregateTests/data/EgConfigureThresholdsJson.jsp?"+hiddenFieldsVal,method:"POST",timeout:300000,scope:this,success:function(b){var z=b.responseText;
publicJson=Ext.decode(z);var w=publicJson["screenLabels"]["test_description"];var f=Ext.getCmp("testDescriptionId");var t=publicJson["alarmPolicyArr"];var G=publicJson["minThreshObj"];var r=publicJson["maxThreshObj"];var l=publicJson["selectedAlarmType"];var x=publicJson["selectedAlarmDescription"];var A=publicJson["isNegativeValuesAllowed"];
var e=publicJson["isGlobalThresholds"];if(e){Ext.getCmp("minAutoCheck").hide();Ext.getCmp("minAutoFieldContainer").hide();Ext.getCmp("maxAutoCheck").hide();Ext.getCmp("maxAutoFieldContainer").hide();}var s=G.minStaticOption;var D=G.minStaticBlock;if(s!=null&&!Ext.isEmpty(s)&&s=="selected"){var C=G.absMinCritical;
var h=G.absMinMajor;var u=G.absMinMinor;Ext.getCmp("minStaticCheck").setValue(false);Ext.getCmp("absMinCritical").setValue(C);Ext.getCmp("absMinMajor").setValue(h);Ext.getCmp("absMinMinor").setValue(u);}if(!e){if(!A){var k=G.minAutomaticOption;var o=G.minAutomaticBlock;if(k!=null&&!Ext.isEmpty(k)&&k=="selected"){var g=G.relMinCritical;
var y=G.relMinMajor;var d=G.relMinMinor;Ext.getCmp("minAutoCheck").show();Ext.getCmp("minAutoFieldContainer").show();Ext.getCmp("minAutoCheck").setValue(false);Ext.getCmp("relMinCritical").setValue(g);Ext.getCmp("relMinCriticalText").setValue(g);Ext.getCmp("relMinMajor").setValue(y);Ext.getCmp("relMinMajorText").setValue(y);
Ext.getCmp("relMinMinor").setValue(d);Ext.getCmp("relMinMinorText").setValue(d);}}}var n=r.maxStaticOption;var c=r.maxStaticBlock;if(n!=null&&!Ext.isEmpty(n)&&n=="selected"){var j=r.absMaxCritical;var p=r.absMaxMajor;var E=r.absMaxMinor;Ext.getCmp("maxStaticCheck").setValue(false);Ext.getCmp("absMaxCritical").setValue(j);
Ext.getCmp("absMaxMajor").setValue(p);Ext.getCmp("absMaxMinor").setValue(E);}if(!e){if(!A){var F=r.maxAutomaticOption;var q=r.maxAutomaticBlock;if(F!=null&&!Ext.isEmpty(F)&&F=="selected"){var B=r.relMaxCritical;var a=r.relMaxMajor;var m=r.relMaxMinor;Ext.getCmp("maxAutoCheck").show();Ext.getCmp("maxAutoFieldContainer").show();
Ext.getCmp("maxAutoCheck").setValue(false);Ext.getCmp("relMaxCritical").setValue(B);Ext.getCmp("relMaxCriticalText").setValue(B);Ext.getCmp("relMaxMajor").setValue(a);Ext.getCmp("relMaxMajorText").setValue(a);Ext.getCmp("relMaxMinor").setValue(m);Ext.getCmp("relMaxMinorText").setValue(m);}}}var i=publicJson["isHostTest"];
f.update("<center>"+w+"</center>");if(t!=null&&!Ext.isEmpty(t)){Ext.getCmp("alarmDispField").el.animate({opacity:1});Ext.getCmp("alarmPolicyCombo").getStore().removeAll();Ext.getCmp("alarmPolicyCombo").getStore().suspendEvents();Ext.getCmp("alarmPolicyCombo").getStore().loadRawData(t);Ext.getCmp("alarmPolicyCombo").getStore().resumeEvents();
if(l!=null&&!Ext.isEmpty(l)){Ext.getCmp("alarmPolicyCombo").setValue(l);}else{Ext.getCmp("alarmPolicyCombo").setValue(t[0].valueField);}if(x!=null&&!Ext.isEmpty(x)){Ext.getCmp("alarmDispField").setValue(x);}else{var v=publicJson["alarmPolicyDescriptionObj"][t[0].valueField];Ext.getCmp("alarmDispField").setValue(v);
}}}});},submitData:function(){var a=publicJson["hiddenObj"]["testName"];window.location.href="/final/admin/aggShowComponentTypes.jsp?agg_test_name="+a;},applyThresholdsData:function(){var H=true;var m=publicJson["hiddenObj"]["testName"];if(m=="null"){H=false;return false;}var X=publicJson["hiddenObj"]["measure"];
if(X=="null"){H=false;return false;}var A="mix";var U="-1";var u="-1";var N=Ext.getCmp("alarmPolicyCombo").getValue();var P="HML";var O="-";var B="-";var q="-";var s=Ext.getCmp("minStaticCheck").getValue();var n=publicJson["isNegativeValuesAllowed"];if(!s){O=Ext.getCmp("absMinCritical").getValue();B=Ext.getCmp("absMinMajor").getValue();
q=Ext.getCmp("absMinMinor").getValue();if(!n){if(!checkValidValue(O)){Ext.Msg.show({title:pageTitle1,msg:staticMinCriticalErrMsg1,buttons:Ext.Msg.OK,icon:"iconExclamation",fn:function(){Ext.getCmp("absMinCritical").focus();}});H=false;return false;}else{if(O!="-"){if(!checkNonNegativeFormat(O)){Ext.Msg.show({title:pageTitle1,msg:staticMinCriticalErrMsg1+".<br >"+errMsg1+" : <br >"+"1) "+errMsg2+".<br >"+"2) "+errMsg3+".<br >"+"3) "+errMsg4+".",buttons:Ext.Msg.OK,icon:"iconExclamation",fn:function(){Ext.getCmp("absMinCritical").focus();
}});H=false;return false;}}}if(!checkValidValue(B)){Ext.Msg.show({title:pageTitle1,msg:staticMinMajorErrMsg1,buttons:Ext.Msg.OK,icon:"iconExclamation",fn:function(){Ext.getCmp("absMinMajor").focus();}});H=false;return false;}else{if(B!="-"){if(!checkNonNegativeFormat(B)){Ext.Msg.show({title:pageTitle1,msg:staticMinMajorErrMsg1+".<br >"+errMsg1+" : <br >"+"1) "+errMsg2+".<br >"+"2) "+errMsg3+".<br >"+"3) "+errMsg4+".",buttons:Ext.Msg.OK,icon:"iconExclamation",fn:function(){Ext.getCmp("absMinMajor").focus();
}});H=false;return false;}}}if(!checkValidValue(q)){Ext.Msg.show({title:pageTitle1,msg:staticMinMinorErrMsg1,buttons:Ext.Msg.OK,icon:"iconExclamation",fn:function(){Ext.getCmp("absMinMinor").focus();}});H=false;return false;}else{if(q!="-"){if(!checkNonNegativeFormat(q)){Ext.Msg.show({title:pageTitle1,msg:staticMinMinorErrMsg1+".<br >"+errMsg1+" : <br >"+"1) "+errMsg2+".<br >"+"2) "+errMsg3+".<br >"+"3) "+errMsg4+".",buttons:Ext.Msg.OK,icon:"iconExclamation",fn:function(){Ext.getCmp("absMinMinor").focus();
}});H=false;return false;}}}var F=checkNegativeValue(O);if(F){Ext.Msg.show({title:pageTitle1,msg:errMsg5+" '"+X+"' "+errMsg6,buttons:Ext.Msg.OK,icon:"iconExclamation",fn:function(){Ext.getCmp("absMinCritical").focus();}});H=false;return false;}F=checkNegativeValue(B);if(F){Ext.Msg.show({title:pageTitle1,msg:errMsg5+" '"+X+"' "+errMsg6,buttons:Ext.Msg.OK,icon:"iconExclamation",fn:function(){Ext.getCmp("absMinMajor").focus();
}});H=false;return false;}F=checkNegativeValue(q);if(F){Ext.Msg.show({title:pageTitle1,msg:errMsg5+" '"+X+"' "+errMsg6,buttons:Ext.Msg.OK,icon:"iconExclamation",fn:function(){Ext.getCmp("absMinMinor").focus();}});H=false;return false;}}else{if(!checkValidValue(O)){Ext.Msg.show({title:pageTitle1,msg:staticMinCriticalErrMsg1,buttons:Ext.Msg.OK,icon:"iconExclamation",fn:function(){Ext.getCmp("absMinCritical").focus();
}});H=false;return false;}else{if(O!="-"){if(!checkNegativeFormat(O)){Ext.Msg.show({title:pageTitle1,msg:staticMinCriticalErrMsg1+".<br >"+errMsg1+" : <br >"+"1) "+errMsg2+".<br >"+"2) "+errMsg3+".<br >"+"3) "+errMsg4+".",buttons:Ext.Msg.OK,icon:"iconExclamation",fn:function(){Ext.getCmp("absMinCritical").focus();
}});H=false;return false;}}}if(!checkValidValue(B)){Ext.Msg.show({title:pageTitle1,msg:staticMinMajorErrMsg1,buttons:Ext.Msg.OK,icon:"iconExclamation",fn:function(){Ext.getCmp("absMinMajor").focus();}});H=false;return false;}else{if(B!="-"){if(!checkNegativeFormat(B)){Ext.Msg.show({title:pageTitle1,msg:staticMinMajorErrMsg1+".<br >"+errMsg1+" : <br >"+"1) "+errMsg2+".<br >"+"2) "+errMsg3+".<br >"+"3) "+errMsg4+".",buttons:Ext.Msg.OK,icon:"iconExclamation",fn:function(){Ext.getCmp("absMinMajor").focus();
}});H=false;return false;}}}if(!checkValidValue(q)){Ext.Msg.show({title:pageTitle1,msg:staticMinMinorErrMsg1,buttons:Ext.Msg.OK,icon:"iconExclamation",fn:function(){Ext.getCmp("absMinMinor").focus();}});H=false;return false;}else{if(q!="-"){if(!checkNegativeFormat(q)){Ext.Msg.show({title:pageTitle1,msg:staticMinMinorErrMsg1+".<br >"+errMsg1+" : <br >"+"1) "+errMsg2+".<br >"+"2) "+errMsg3+".<br >"+"3) "+errMsg4+".",buttons:Ext.Msg.OK,icon:"iconExclamation",fn:function(){Ext.getCmp("absMinMinor").focus();
}});H=false;return false;}}}}if(O!="-"&&B!="-"){if(parseFloat(O)>=parseFloat(B)){Ext.Msg.show({title:pageTitle1,msg:errMsg7,buttons:Ext.Msg.OK,icon:"iconExclamation",fn:function(){Ext.getCmp("absMinCritical").focus();}});H=false;return false;}}if(B!="-"&&q!="-"){if(parseFloat(B)>=parseFloat(q)){Ext.Msg.show({title:pageTitle1,msg:errMsg7,buttons:Ext.Msg.OK,icon:"iconExclamation",fn:function(){Ext.getCmp("absMinMajor").focus();
}});H=false;return false;}}if(O!="-"&&q!="-"){if(parseFloat(O)>=parseFloat(q)){Ext.Msg.show({title:pageTitle1,msg:errMsg7,buttons:Ext.Msg.OK,icon:"iconExclamation",fn:function(){Ext.getCmp("absMinCritical").focus();}});H=false;return false;}}}var t="-";var C="-";var r="-";var c=Ext.getCmp("minAutoCheck").getValue();
if(!c){var k=Ext.getCmp("relMinCriticalText").getValue();if(k!=0){if(k==100){t="sqc";}else{t=(k/100)+"*sqc";}}var j=Ext.getCmp("relMinMajorText").getValue();if(j!=0){if(j==100){C="sqc";}else{C=(j/100)+"*sqc";}}var i=Ext.getCmp("relMinMinorText").getValue();if(i!=0){if(i==100){r="sqc";}else{r=(i/100)+"*sqc";
}}var x,V,l;x=t;V=C;l=r;x=x.replace(/(\*sqc)/gi,"");x=x.replace(/sqc/g,"1");V=V.replace(/(\*sqc)/gi,"");V=V.replace(/sqc/g,"1");l=l.replace(/(\*sqc)/gi,"");l=l.replace(/sqc/g,"1");if(x!="-"&&V!="-"){if(parseFloat(x)>=parseFloat(V)){Ext.Msg.show({title:pageTitle1,msg:errMsg8,buttons:Ext.Msg.OK,icon:"iconExclamation"});
H=false;return false;}}if(V!="-"&&l!="-"){if(parseFloat(V)>=parseFloat(l)){Ext.Msg.show({title:pageTitle1,msg:errMsg8,buttons:Ext.Msg.OK,icon:"iconExclamation"});H=false;return false;}}if(x!="-"&&l!="-"){if(parseFloat(x)>=parseFloat(l)){Ext.Msg.show({title:pageTitle1,msg:errMsg8,buttons:Ext.Msg.OK,icon:"iconExclamation"});
H=false;return false;}}}if(O.indexOf(".")!=-1){var T=O.substring(O.indexOf(".")+1);if(T=="0000"||T=="000"||T=="00"||T=="0"){O=O.substring(0,O.indexOf("."));}else{if(T.length>1){if((T.charAt(3)=="0"&&T.charAt(2)=="0")||(T.charAt(3)=="0")){O=O.substring(0,O.lastIndexOf("0"));}}}}if(B.indexOf(".")!=-1){var D=B.substring(B.indexOf(".")+1);
if(D=="0000"||D=="000"||D=="00"||D=="0"){B=B.substring(0,B.indexOf("."));}else{if(D.length>1){if((D.charAt(3)=="0"&&D.charAt(2)=="0")||(D.charAt(3)=="0")){B=B.substring(0,B.lastIndexOf("0"));}}}}if(q.indexOf(".")!=-1){var W=q.substring(q.indexOf(".")+1);if(W=="0000"||W=="000"||W=="00"||W=="0"){q=q.substring(0,q.indexOf("."));
}else{if(W.length>1){if((W.charAt(3)=="0"&&W.charAt(2)=="0")||(W.charAt(3)=="0")){q=q.substring(0,q.lastIndexOf("0"));}}}}var f="-";if(O!="-"&&t!="-"){if(O>-1||O<0){if(O.indexOf(".")==0){O="0"+O;}O=parseFloat(O);f=O.toString()+"&"+t;}else{f=t;}}else{if(O!="-"&&t=="-"){if(O>-1||O<0){if(O.indexOf(".")==0){O="0"+O;
}O=parseFloat(O);f=O.toString();}else{f="-";}}else{if(O=="-"&&t!="-"){f=t;}}}var G="-";if(B!="-"&&C!="-"){if(B>-1||B<0){if(B.indexOf(".")==0){B="0"+B;}B=parseFloat(B);G=B.toString()+"&"+C;}else{G=C;}}else{if(B!="-"&&C=="-"){if(B>-1||B<0){if(B.indexOf(".")==0){B="0"+B;}B=parseFloat(B);G=B.toString();}else{G="-";
}}else{if(B=="-"&&C!="-"){G=C;}}}var w="-";if(q!="-"&&r!="-"){if(q>-1||q<0){if(q.indexOf(".")==0){q="0"+q;}q=parseFloat(q);w=q.toString()+"&"+r;}else{w=r;}}else{if(q!="-"&&r=="-"){if(q>-1||q<0){if(q.indexOf(".")==0){q="0"+q;}q=parseFloat(q);w=q.toString();}else{w="-";}}else{if(q=="-"&&r!="-"){w=r;}}}if(f!="-"||G!="-"||w!="-"){U=f+"/"+G+"/"+w;
}var p="-";var I="-";var y="-";var L=Ext.getCmp("maxStaticCheck").getValue();if(!L){p=Ext.getCmp("absMaxCritical").getValue();I=Ext.getCmp("absMaxMajor").getValue();y=Ext.getCmp("absMaxMinor").getValue();if(!n){if(!checkValidValue(p)){Ext.Msg.show({title:pageTitle1,msg:staticMaxCriticalErrMsg1,buttons:Ext.Msg.OK,icon:"iconExclamation",fn:function(){Ext.getCmp("absMaxCritical").focus();
}});H=false;return false;}else{if(p!="-"){if(!checkNonNegativeFormat(p)){Ext.Msg.show({title:pageTitle1,msg:staticMaxCriticalErrMsg1+".<br >"+errMsg1+" : <br >"+"1) "+errMsg2+".<br >"+"2) "+errMsg3+".<br >"+"3) "+errMsg4+".",buttons:Ext.Msg.OK,icon:"iconExclamation",fn:function(){Ext.getCmp("absMaxCritical").focus();
}});H=false;return false;}}}if(!checkValidValue(I)){Ext.Msg.show({title:pageTitle1,msg:staticMaxMajorErrMsg1,buttons:Ext.Msg.OK,icon:"iconExclamation",fn:function(){Ext.getCmp("absMaxMajor").focus();}});H=false;return false;}else{if(I!="-"){if(!checkNonNegativeFormat(I)){Ext.Msg.show({title:pageTitle1,msg:staticMaxMajorErrMsg1+".<br >"+errMsg1+" : <br >"+"1) "+errMsg2+".<br >"+"2) "+errMsg3+".<br >"+"3) "+errMsg4+".",buttons:Ext.Msg.OK,icon:"iconExclamation",fn:function(){Ext.getCmp("absMaxMajor").focus();
}});H=false;return false;}}}if(!checkValidValue(y)){Ext.Msg.show({title:pageTitle1,msg:staticMaxMinorErrMsg1,buttons:Ext.Msg.OK,icon:"iconExclamation",fn:function(){Ext.getCmp("absMaxMinor").focus();}});H=false;return false;}else{if(y!="-"){if(!checkNonNegativeFormat(y)){Ext.Msg.show({title:pageTitle1,msg:staticMaxMinorErrMsg1+".<br >"+errMsg1+" : <br >"+"1) "+errMsg2+".<br >"+"2) "+errMsg3+".<br >"+"3) "+errMsg4+".",buttons:Ext.Msg.OK,icon:"iconExclamation",fn:function(){Ext.getCmp("absMaxMinor").focus();
}});H=false;return false;}}}var F=checkNegativeValue(p);if(F){Ext.Msg.show({title:pageTitle1,msg:errMsg11+" '"+X+"' "+errMsg6,buttons:Ext.Msg.OK,icon:"iconExclamation",fn:function(){Ext.getCmp("absMaxCritical").focus();}});H=false;return false;}F=checkNegativeValue(I);if(F){Ext.Msg.show({title:pageTitle1,msg:errMsg11+" '"+X+"' "+errMsg6,buttons:Ext.Msg.OK,icon:"iconExclamation",fn:function(){Ext.getCmp("absMaxMajor").focus();
}});H=false;return false;}F=checkNegativeValue(y);if(F){Ext.Msg.show({title:pageTitle1,msg:errMsg11+" '"+X+"' "+errMsg6,buttons:Ext.Msg.OK,icon:"iconExclamation",fn:function(){Ext.getCmp("absMaxMinor").focus();}});H=false;return false;}}else{if(!checkValidValue(p)){Ext.Msg.show({title:pageTitle1,msg:staticMaxCriticalErrMsg1,buttons:Ext.Msg.OK,icon:"iconExclamation",fn:function(){Ext.getCmp("absMaxCritical").focus();
}});H=false;return false;}else{if(p!="-"){if(!checkNegativeFormat(p)){Ext.Msg.show({title:pageTitle1,msg:staticMaxCriticalErrMsg1+".<br >"+errMsg1+" : <br >"+"1) "+errMsg2+".<br >"+"2) "+errMsg3+".<br >"+"3) "+errMsg4+".",buttons:Ext.Msg.OK,icon:"iconExclamation",fn:function(){Ext.getCmp("absMaxCritical").focus();
}});H=false;return false;}}}if(!checkValidValue(I)){Ext.Msg.show({title:pageTitle1,msg:staticMaxMajorErrMsg1,buttons:Ext.Msg.OK,icon:"iconExclamation",fn:function(){Ext.getCmp("absMaxMajor").focus();}});H=false;return false;}else{if(I!="-"){if(!checkNegativeFormat(I)){Ext.Msg.show({title:pageTitle1,msg:staticMaxMajorErrMsg1+".<br >"+errMsg1+" : <br >"+"1) "+errMsg2+".<br >"+"2) "+errMsg3+".<br >"+"3) "+errMsg4+".",buttons:Ext.Msg.OK,icon:"iconExclamation",fn:function(){Ext.getCmp("absMaxMajor").focus();
}});H=false;return false;}}}if(!checkValidValue(y)){Ext.Msg.show({title:pageTitle1,msg:staticMaxMinorErrMsg1,buttons:Ext.Msg.OK,icon:"iconExclamation",fn:function(){Ext.getCmp("absMaxMinor").focus();}});H=false;return false;}else{if(y!="-"){if(!checkNegativeFormat(y)){Ext.Msg.show({title:pageTitle1,msg:staticMaxMinorErrMsg1+".<br >"+errMsg1+" : <br >"+"1) "+errMsg2+".<br >"+"2) "+errMsg3+".<br >"+"3) "+errMsg4+".",buttons:Ext.Msg.OK,icon:"iconExclamation",fn:function(){Ext.getCmp("absMaxMinor").focus();
}});H=false;return false;}}}}if(p!="-"&&I!="-"){if(parseFloat(p)<=parseFloat(I)){Ext.Msg.show({title:pageTitle1,msg:errMsg9,buttons:Ext.Msg.OK,icon:"iconExclamation",fn:function(){Ext.getCmp("absMaxCritical").focus();}});H=false;return false;}}if(I!="-"&&y!="-"){if(parseFloat(I)<=parseFloat(y)){Ext.Msg.show({title:pageTitle1,msg:errMsg9,buttons:Ext.Msg.OK,icon:"iconExclamation",fn:function(){Ext.getCmp("absMaxMajor").focus();
}});H=false;return false;}}if(p!="-"&&y!="-"){if(parseFloat(p)<=parseFloat(y)){Ext.Msg.show({title:pageTitle1,msg:errMsg9,buttons:Ext.Msg.OK,icon:"iconExclamation",fn:function(){Ext.getCmp("absMaxCritical").focus();}});H=false;return false;}}}var Y="-";var K="-";var z="-";var J=Ext.getCmp("maxAutoCheck").getValue();
if(!J){var h=Ext.getCmp("relMaxCriticalText").getValue();if(h!=0){if(h==100){Y="sqc";}else{Y=(h/100)+"*sqc";}}var g=Ext.getCmp("relMaxMajorText").getValue();if(g!=0){if(g==100){K="sqc";}else{K=(g/100)+"*sqc";}}var e=Ext.getCmp("relMaxMinorText").getValue();if(e!=0){if(e==100){z="sqc";}else{z=(e/100)+"*sqc";
}}var x,V,l;x=Y;V=K;l=z;x=x.replace(/(\*sqc)/gi,"");x=x.replace(/sqc/g,"1");V=V.replace(/(\*sqc)/gi,"");V=V.replace(/sqc/g,"1");l=l.replace(/(\*sqc)/gi,"");l=l.replace(/sqc/g,"1");if(x!="-"&&V!="-"){if(parseFloat(x)<=parseFloat(V)){Ext.Msg.show({title:pageTitle1,msg:errMsg10,buttons:Ext.Msg.OK,icon:"iconExclamation"});
H=false;return false;}}if(V!="-"&&l!="-"){if(parseFloat(V)<=parseFloat(l)){Ext.Msg.show({title:pageTitle1,msg:errMsg10,buttons:Ext.Msg.OK,icon:"iconExclamation"});H=false;return false;}}if(x!="-"&&l!="-"){if(parseFloat(x)<=parseFloat(l)){Ext.Msg.show({title:pageTitle1,msg:errMsg10,buttons:Ext.Msg.OK,icon:"iconExclamation"});
H=false;return false;}}}if(p.indexOf(".")!=-1){var b=p.substring(p.indexOf(".")+1);if(b=="0000"||b=="000"||b=="00"||b=="0"){p=p.substring(0,p.indexOf("."));}else{if(b.length>1){if((b.charAt(3)=="0"&&b.charAt(3)=="0")||(b.charAt(3)=="0")){p=p.substring(0,p.lastIndexOf("0"));}}}}if(I.indexOf(".")!=-1){var S=I.substring(I.indexOf(".")+1);
if(S=="0000"||S=="000"||S=="00"||S=="0"){I=I.substring(0,I.indexOf("."));}else{if(S.length>1){if((S.charAt(3)=="0"&&S.charAt(3)=="0")||(S.charAt(3)=="0")){I=I.substring(0,I.lastIndexOf("0"));}}}}if(y.indexOf(".")!=-1){var d=y.substring(y.indexOf(".")+1);if(d=="0000"||d=="000"||d=="00"||d=="0"){y=y.substring(0,y.indexOf("."));
}else{if(d.length>1){if((d.charAt(3)=="0"&&d.charAt(2)=="0")||(d.charAt(3)=="0")){y=y.substring(0,y.lastIndexOf("0"));}}}}var M="-";if(p!="-"&&Y!="-"){if(p>-1||p<0){if(p.indexOf(".")==0){p="0"+p;}p=parseFloat(p);M=p.toString()+"&"+Y;}else{M=Y;}}else{if(p!="-"&&Y=="-"){if(p>-1||p<0){if(p.indexOf(".")==0){p="0"+p;
}p=parseFloat(p);M=p.toString();}else{M="-";}}else{if(p=="-"&&Y!="-"){M=Y;}}}var R="-";if(I!="-"&&K!="-"){if(I>-1||I<0){if(I.indexOf(".")==0){I="0"+I;}I=parseFloat(I);R=I.toString()+"&"+K;}else{R=K;}}else{if(I!="-"&&K=="-"){if(I>-1||+I<0){if(I.indexOf(".")==0){I="0"+I;}I=parseFloat(I);R=I.toString();
}else{R="-";}}else{if(I=="-"&&K!="-"){R=K;}}}var E="-";if(y!="-"&&z!="-"){if(y>-1||y<0){if(y.indexOf(".")==0){y="0"+y;}y=parseFloat(y);E=y.toString()+"&"+z;}else{E=z;}}else{if(y!="-"&&z=="-"){if(y>-1||y<0){if(y.indexOf(".")==0){y="0"+y;}y=parseFloat(y);E=y.toString();}else{E="-";}}else{if(y=="-"&&z!="-"){E=z;
}}}if(M!="-"||R!="-"||E!="-"){u=M+"/"+R+"/"+E;}if(H){var v=new Ext.LoadMask(Ext.getBody(),{msg:"Updating..."});v.show();var o=X+":"+A+":"+U+":"+u+":"+N+":"+P;var Q="";var a="&testName="+m+"&threshold="+escape(o)+"&operation=updateThresholds";Q="AggregateTests/data/EgApplyThresholdsJson.jsp?"+a;Ext.Ajax.request({url:Q,method:"POST",timeout:60000000,scope:this,success:function(Z){if(Z.status==200&&!Ext.isEmpty(Z.responseText)){var aa=Ext.decode(Z.responseText);
if(aa.successUpdate!=null&&!Ext.isEmpty(aa.successUpdate)&&aa.successUpdate=="true"){v.hide();Ext.Msg.show({title:pageLabel,msg:successMsg1,buttons:Ext.Msg.OK,icon:"iconInformation",fn:function(){var ab=Ext.getCmp("viewPortId");myMask=new Ext.LoadMask(ab,{msg:"Updating..."});ab.removeAll();myMask.show();
ab.add({xtype:"defaultthresholds"});myMask.hide();}});}}},failure:function(Z){v.hide();Ext.Msg.show({title:pageName,msg:"Updating problem in server side...",icon:"iconExclamation",buttons:Ext.Msg.OK});}});}},maxStaticFieldChange:function(b){var a=Ext.getCmp("maxStaticCheck").getValue();copyField=Ext.getCmp(b.id);
if(a){copyField.reset();}else{copyField.clearInvalid();}},maxAutoFieldChange:function(b){var a=Ext.getCmp("maxAutoCheck").getValue();copyField=Ext.getCmp(b.id);if(a){copyField.reset();}else{copyField.clearInvalid();}},minStaticFieldChange:function(b){var a=Ext.getCmp("minStaticCheck").getValue();copyField=Ext.getCmp(b.id);
if(a){copyField.reset();}else{copyField.clearInvalid();}},minAutoFieldChange:function(b){var a=Ext.getCmp("minAutoCheck").getValue();copyField=Ext.getCmp(b.id);if(a){copyField.reset();}else{copyField.clearInvalid();}},maxStaticCheckChange:function(c,b){var a=c.ownerCt;Ext.Array.forEach(a.query("textfield"),this.maxStaticFieldChange,this);
Ext.Array.forEach(a.query("textfield"),function(d){d.setDisabled(b);if(!Ext.isIE6){d.el.animate({opacity:b?0.3:1});}});},maxAutoCheckChange:function(c,b){var a=c.ownerCt;Ext.Array.forEach(a.query("slider"),this.maxAutoFieldChange,this);Ext.Array.forEach(a.query("slider"),function(d){d.setDisabled(b);
if(!Ext.isIE6){d.el.animate({opacity:b?0.3:1});}});Ext.Array.forEach(a.query("displayfield"),this.minAutoFieldChange,this);Ext.Array.forEach(a.query("displayfield"),function(d){if(d.id=="maxThreshDisplayField"){}else{d.setDisabled(b);if(!Ext.isIE6){d.el.animate({opacity:b?0.3:1});}}});},minStaticCheckChange:function(c,b){var a=c.ownerCt;
Ext.Array.forEach(a.query("textfield"),this.minStaticFieldChange,this);Ext.Array.forEach(a.query("textfield"),function(d){d.setDisabled(b);if(!Ext.isIE6){d.el.animate({opacity:b?0.3:1});}});},minAutoCheckChange:function(c,b){var a=c.ownerCt;Ext.Array.forEach(a.query("slider"),this.minAutoFieldChange,this);
Ext.Array.forEach(a.query("slider"),function(d){d.setDisabled(b);if(!Ext.isIE6){d.el.animate({opacity:b?0.3:1});}});Ext.Array.forEach(a.query("displayfield"),this.minAutoFieldChange,this);Ext.Array.forEach(a.query("displayfield"),function(d){if(d.id=="minThreshDisplayField"){}else{d.setDisabled(b);if(!Ext.isIE6){d.el.animate({opacity:b?0.3:1});
}}});},getHiddenFields:function(b){var c=publicJson["hiddenDataObj"][b.trim()];var a="";for(key in c){a+=key+"="+encodeURIComponent(c[key])+"&";}return a;},maxRelCriticalSlider:function(){Ext.getCmp("relMaxCriticalText").setValue(Ext.getCmp("relMaxCritical").getValue());},maxRelMajorSlider:function(){Ext.getCmp("relMaxMajorText").setValue(Ext.getCmp("relMaxMajor").getValue());
},maxRelMinorSlider:function(){Ext.getCmp("relMaxMinorText").setValue(Ext.getCmp("relMaxMinor").getValue());},minRelCriticalSlider:function(){Ext.getCmp("relMinCriticalText").setValue(Ext.getCmp("relMinCritical").getValue());},minRelMajorSlider:function(){Ext.getCmp("relMinMajorText").setValue(Ext.getCmp("relMinMajor").getValue());
},minRelMinorSlider:function(){Ext.getCmp("relMinMinorText").setValue(Ext.getCmp("relMinMinor").getValue());},noThreshMeasureModify:function(a,b,h,c,g,j,d,f){var i=a.getSelectionModel().getCurrentPosition();c=a.store.getAt(i.row);colname=a.getHeaderCt().getHeaderAtIndex(h).dataIndex;cellvalue=c.data[colname];
actualMeasName=publicJson["measureDataObj"][cellvalue];if(actualMeasName!=null&&actualMeasName!="undefined"&&actualMeasName!=""){hiddenFieldsVal=this.getHiddenFields(actualMeasName);var k=Ext.getCmp("viewPortId");k.removeAll();k.add({xtype:"configurethresholds"});}},handleEditIconClick:function(a,f,b,c,d){this.showEditWindow(a.getRecord(a.findTargetByEvent(d)));
},showEditWindow:function(b){var e=b.get("Measure");var f=b.get("Thresholds");var c=b.get("AlarmPolicy");if(e.lastIndexOf(" ")!=-1){e=e.substring(0,e.lastIndexOf(" "));}var a=publicJson.measureDataObj;hiddenFieldsVal=this.getHiddenFields(a[e.trim()]);var d=this;var g=Ext.getCmp("viewPortId");g.removeAll();
g.add({xtype:"configurethresholds"});},showModifyTool:function(b,a,f,c,g){var d=Ext.DomQuery.select(".x-action-col-icon",f);Ext.each(d,function(e){});},hideModifyTool:function(b,a,g,c,h,f){var d=Ext.DomQuery.select(".x-action-col-icon",g);Ext.each(d,function(e){});},showPopup:function(){Ext.widget("description_window").show();
},DynamicGridPanel:function(b,m,j){display_internal_name_mapping=j.display_internal_name_mapping;var f=0;var l=0;var a=new Array();for(var o in m){l++;var p=m[o];var c=new Array();var g=new Array();for(var n in p){var e=p[n];c.push(n);if(n=="hidden_measure_name"){g.push({header:e,sortable:false,draggable:false,resizable:false,menuDisabled:true,hidden:true,dataIndex:n,flex:1,border:0});
}else{if(n=="measure_name"){g.push({header:e,sortable:false,draggable:false,resizable:false,menuDisabled:true,dataIndex:n,flex:1,border:0});}else{if(n=="measure_name_on_numerator"){g.push({header:e,renderer:function(q,i){i.tdCls="grid_editable_cell";return q;},sortable:false,draggable:false,resizable:false,border:0,menuDisabled:true,dataIndex:n,flex:1,editor:new Ext.form.field.ComboBox({editable:false,width:200,displayField:"displayField",valueField:"valueField",queryMode:"local",cls:"dropdown",margin:"2 0 0 0",store:new Ext.data.Store({fields:["displayField","valueField"],data:[]})})});
}else{if(n=="measure_name_on_denominator"){g.push({header:e,renderer:function(q,i){i.tdCls="grid_editable_cell";return q;},sortable:false,draggable:false,resizable:false,border:0,menuDisabled:true,dataIndex:n,flex:1,editor:new Ext.form.field.ComboBox({editable:false,width:200,displayField:"displayField",valueField:"valueField",queryMode:"local",cls:"dropdown",margin:"2 0 0 0",store:new Ext.data.Store({fields:["displayField","valueField"],data:[]})})});
}}}}}var d=new Array();var h=Ext.create("Ext.grid.plugin.CellEditing",{clicksToEdit:1,pluginId:"pct_plugin",listeners:{"beforeedit":function(u,v,s){var t=v.grid.getSelectionModel().getSelection();var q=v.grid.getSelectionModel().getSelection().length;for(var r=0;r<q;r++){d[r]=t[r].index;}ans=v.grid.getSelectionModel().isSelected(v.grid.getStore().getAt(v.rowIdx));
},"edit":function(s,t,r){if(!ans){t.grid.getSelectionModel().deselect(t.rowIdx);}else{t.grid.getSelectionModel().select(t.rowIdx);}for(var q=0;q<d.length;q++){t.grid.getSelectionModel().select(d[q],true);}}}});var k=Ext.widget("dynamicgrid",{store:new Ext.data.Store({fields:c,data:b[f++]}),width:"100%",id:"gridPart_"+l,gridCountId:l,sortableColumns:true,listeners:{"afterrender":function(s,r){for(var q=0;
q<s.getStore().getCount();q++){var t=s.columns[2].getEditor();t.getStore().suspendEvents(true);t.getStore().loadRawData(j["TimePeriodList_"+s.gridCountId+"_"+q]);t.getStore().resumeEvents();t.setValue(t.getStore().getAt(0).get("valueField"));var i=s.columns[3].getEditor();i.getStore().suspendEvents(true);
i.getStore().loadRawData(j["TimePeriodList_"+s.gridCountId+"_"+q]);i.getStore().resumeEvents();i.setValue(i.getStore().getAt(0).get("valueField"));}}},plugins:[h],columns:g,viewConfig:{forceFit:true,stripeRows:true}});a.push(k);}Ext.getCmp("dynGridContainer").removeAll();Ext.getCmp("dynGridContainer").add(a);
Ext.getCmp("dynGridContainer").doLayout();}});function isDuplicateDescriptionFound(c){if(c=="addMeasures"||c=="modifyMeasures"||c=="deleteMeasures"){s_pluginId="upper_plugin";gridid="upper_measures_grid";column1="upper_m_name";column2="upper_measure_description";}else{s_pluginId="lower_plugin";gridid="lower_measures_grid";
column1="lower_m_name";column2="lower_measure_description";}var b=Ext.getCmp(gridid);var m=b.getPlugin(s_pluginId);var q=new Array();var g=Ext.getCmp("upper_measures_grid").getSelectionModel();var d=Ext.getCmp("upper_measures_grid").getStore();var n=d.getCount();for(var f=0;f<n;f++){q.push(d.getAt(f).get("upper_measure_description").toLowerCase());
}if(c=="addMeasures"){for(var f=0;f<n;f++){if(g.isSelected(d.getAt(f))){var l=d.getAt(f).get("upper_measure_description");var p=l.toLowerCase();for(var e=0;e<n;e++){if(g.isSelected(d.getAt(e))){if(f!=e&&p==q[e]){Ext.Msg.show({title:pageLabel,msg:measure_desc_alert1+" '"+l+"' "+measure_desc_alert2,buttons:Ext.Msg.OK,icon:"iconExclamation",fn:function(){m.startEditByPosition({row:e,column:2});
}});}}}}}}else{if(c=="modifyMeasures"){for(var f=0;f<n;f++){var l=d.getAt(f).get("upper_measure_description");var p=l.toLowerCase();for(var e=0;e<n;e++){if(f!=e&&p==q[e]){Ext.Msg.show({title:pageLabel,msg:measure_desc_alert1+" '"+l+"' "+measure_desc_alert2,buttons:Ext.Msg.OK,icon:"iconExclamation",fn:function(){m.startEditByPosition({row:e,column:2});
}});return true;}}}}else{if(c=="appendMeasures"){var k=new Array();var a=Ext.getCmp("lower_measures_grid").getSelectionModel();var o=Ext.getCmp("lower_measures_grid").getStore();var h=o.getCount();for(var f=0;f<h;f++){if(a.isSelected(o.getAt(f))){var l=o.getAt(f).get("lower_measure_description");var p=l.toLowerCase();
for(var e=0;e<n;e++){if(p==q[e]){Ext.Msg.show({title:pageLabel,msg:measure_desc_alert1+" '"+l+"' "+measure_desc_alert2,buttons:Ext.Msg.OK,icon:"iconExclamation",fn:function(){m.startEditByPosition({row:f,column:2});}});return true;}}}k.push(p);}for(var f=0;f<h;f++){if(a.isSelected(o.getAt(f))){var l=o.getAt(f).get("lower_measure_description");
var p=l.toLowerCase();for(var e=0;e<h;e++){if(a.isSelected(o.getAt(e))){if(f!=e&&p==k[e]){Ext.Msg.show({title:pageLabel,msg:measure_desc_alert1+" '"+l+"' "+measure_desc_alert2,buttons:Ext.Msg.OK,icon:"iconExclamation",fn:function(){m.startEditByPosition({row:e,column:2});}});return true;}}}}}}}}return false;
}function checkTestDispName(a){if(!checkblank(a)){Ext.MessageBox.alert(pageLabel,message_1);return false;}else{if(!checkSpecialCharLocal(a,"~!@#$%^&*()|:,;<>'={}[]?/\"")){Ext.MessageBox.alert(pageLabel,message_19);return false;}}return true;}function checkMeasureDesc(a){if(!checkblank(a)){Ext.MessageBox.alert(pageLabel,message_3);
return false;}else{if(a.indexOf(".")>-1){Ext.MessageBox.alert(pageLabel,message_5);return false;}else{if(!checkSpecialCharLocal(a,"~!@#$%^&*()|:,;<>'={}[]?/\"")){Ext.MessageBox.alert(pageLabel,message_20);return false;}}}return true;}function checkSpecialCharLocal(c,b){for(var a=0;a<c.length;a++){check_char=b.indexOf(c.charAt(a));
if(check_char>=0){return false;}}return true;}function showTests(a){if(current_testfor!=a){current_testfor=a;queryString="operation=addMeasures&s_test=-1&testfor="+a;Ext.Ajax.request({url:"/final/admin/AggregateTests/data/aggAddTestJson.jsp?"+queryString,method:"POST",timeout:300000,async:false,success:function(c){var g=c.responseText;
publicJSON=Ext.decode(g);operation=publicJSON["parameters"]["s_operation"];if(operation=="addMeasures"){if(current_testfor=="managedtests"){Ext.getCmp("managedcomponents").setValue(true);}else{Ext.getCmp("allcomponents").setValue(true);}Ext.getCmp("addtestcontainer").show();Ext.getCmp("addMeasures").show();
Ext.getCmp("addMeasures").setText(publicJSON["labels"]["Include"]);Ext.getCmp("modifyMeasures").hide();Ext.getCmp("deleteMeasures").hide();Ext.getCmp("modifytestcontainer").hide();Ext.getCmp("testforId").setFieldLabel(publicJSON["labels"]["Aggregate"]);Ext.getCmp("managedcomponents").boxLabelEl.update(publicJSON["labels"]["Managed_Components"]);
Ext.getCmp("allcomponents").boxLabelEl.update(publicJSON["labels"]["All_Components"]);Ext.getCmp("component_types").show();Ext.getCmp("component_types").clearValue();Ext.getCmp("component_types").setFieldLabel(publicJSON["labels"]["Filter_by_component_type"]);Ext.getCmp("component_types").getStore().clearFilter(true);
Ext.getCmp("component_types").getStore().loadRawData(publicJSON["component_types"]);var e=publicJSON["parameters"]["s_component_type"];if(e!=null&&e!="undefined"&&e!="-1"){Ext.getCmp("component_types").setValue(e);}else{Ext.getCmp("component_types").setValue("-1");}Ext.getCmp("test").clearValue();Ext.getCmp("test").setFieldLabel(publicJSON["labels"]["Test_to_be_aggregated"]);
Ext.getCmp("test").getStore().clearFilter(true);Ext.getCmp("test").getStore().loadRawData(publicJSON["tests"]);Ext.getCmp("test").setValue("-1");var b=publicJSON["parameters"]["s_test"];if(b==null||b=="undefined"||b=="-1"){Ext.getCmp("test").setValue("-1");Ext.getCmp("aggTestDispName").hide();Ext.getCmp("allowedId").hide();
Ext.getCmp("upper_measures_grid").hide();Ext.getCmp("upper_measures_button_container").hide();}else{Ext.getCmp("aggTestDispName").show();Ext.getCmp("allowedId").show();Ext.getCmp("upper_measures_grid").show();Ext.getCmp("upper_measures_button_container").show();Ext.getCmp("test").setValue(b);Ext.getCmp("aggTestDispName").show();
Ext.getCmp("allowedId").show();Ext.getCmp("aggTestDispName").setValue(publicJSON["displayaggname"]["displayname"]);Ext.getCmp("upper_measures_grid").show();Ext.getCmp("upper_measures_grid").getSelectionModel().deselectAll();Ext.getCmp("upper_measures_grid").getStore().loadRawData(publicJSON["upperRowDataArray"]);
var h=publicJSON["gridColumns"];for(var d in h){if(d==0||d==4){continue;}Ext.getCmp("upper_measures_grid").columns[d].setText(h[d]);}Ext.getCmp("upper_measures_grid").setTitle(publicJSON["labels"]["Available_measures_for"]);s_aggTest=publicJSON["new_aggTest"]["s_aggTest"];var f=Ext.getCmp("upper_measures_grid");
f.columns[7].setVisible(false);}}},failure:function(b){Ext.MessageBox.alert(pageLabel,"Could not load aggAddTestJson.jsp");}});}}function checkValidValue(c){var b=/^(\-)$|^(\-|\-?(([0-9]+\.|\.)?[0-9]+))$/i;var a=b.test(c);return a;}function checkNegativeValue(c){if(c=="-"){c="0";}var b=/^\-([0-9]+\.|\.)?[0-9]+/;
var a=b.test(c);return a;}function checkNegativeFormat(c){var b=/^(\-{0,1})[0-9]{1,16}(\.[0-9]{1,4})?$/;var a=b.test(c);return a;}function checkNonNegativeFormat(c){var b=/^[0-9]{0,10}(\.[0-9]{1,4})?$/;var a=b.test(c);return a;}function noValueSpecified(e){e=e.trim();if(e.toLowerCase()=="-1"){return true;
}var b=e.split("/");if(b.length!=3){return true;}var d,f,a;d=b[0].trim();f=b[1].trim();a=b[2].trim();var c=false;if(d=="-"&&f=="-"&&a=="-"){c=true;}return c;}function isNegativeValueFound(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].trim();
f=b[1].trim();a=b[2].trim();var c=false;if(d!="-"&&(parseFloat(d)<0)){c=true;}if(f!="-"&&(parseFloat(f)<0)){c=true;}if(a!="-"&&(parseFloat(a)<0)){c=true;}return c;}function checkNonNegativeFormat_agg(c){var b=/^[0-9]{0,10}(\.[0-9]{1,4})?$/;var a=b.test(c);return a;}function invalidCharsFound(d){d=d.trim();
var c=false;var a="0123456789./-";for(var b=0;b<d.length;b++){if(a.indexOf(d.charAt(b))==-1){c=true;break;}}return c;}