Ext.define("ComparisonReportTests.controller.Main",{extend:"Ext.app.Controller",views:["Main"],refs:[{selector:"main",ref:"main"},{selector:"newUtilities",ref:"newUtilities"},{selector:"defineconfiguration",ref:"defineconfiguration"},{selector:"defineconfigurationpopup",ref:"defineconfigurationpopup"},{selector:"configdatas",ref:"configdatas"},{selector:"showcomparisonreport",ref:"showcomparisonreport"},{selector:"backgroundresults",ref:"backgroundresults"},{selector:"backGroundPanel",ref:"backGroundPanel"},{selector:"comparisonreportsettings",ref:"comparisonreportsettings"},{selector:"ReporterSettings",ref:"ReporterSettings"}],init:function(){this.control({"main":{"boxready":this.loadDefaults,},"main newUtilities":{"afterrender":this.hideTools},"comparisonreportsettings":{"afterrender":this.afterSettingsrender},"defineconfigurationpopup":{"afterrender":this.renderPopUp},'main button[id="defineconfiguration"]':{"click":this.defineConfigurationPOPUP},'defineconfigurationpopup  button[id="expandSelector"]':{"click":this.expandMe},'defineconfigurationpopup  button[id="expandSelector2"]':{"click":this.expandMe2},'defineconfigurationpopup  button[id="addtogrid"]':{"click":this.addToGrid},'defineconfiguration button[id="submit"]':{"click":this.beforeFormSubmit},'timeline combo[name="er_mode"]':{"select":this.changeEr_mode},'defineconfiguration button[name="save"]':{"click":this.goTo},"configdatas":{afterrender:function(b){var a=this;
Ext.getBody().on("click",function(){a.defineConfigurationPOPUP();},null,{delegate:"b#linkId"});}},'defineconfigurationpopup button[id="defineConfiguration"]':{"click":this.showConfiguration},'defineconfigurationpopup combo[id="criteria"]':{"select":this.changeCriteria},'defineconfigurationpopup combo[id="Report"]':{"select":this.selectReportFor},'comparisonreportsettings combo[id="CommonMaximum"]':{"select":this.changeCommonMaximum},'comparisonreportsettings combo[id="autoMaximum"]':{"select":this.changeAutoMaximum},'defineconfigurationpopup combo[id="test"]':{"select":this.changeTest},'defineconfigurationpopup combo[id="metric"]':{"select":this.changeMetric},'defineconfigurationpopup combo[id="zone"]':{"select":this.changeZone},'defineconfigurationpopup combo[id="segment"]':{"select":this.changeSegment},'defineconfigurationpopup combo[id="service"]':{"select":this.changeService},'defineconfigurationpopup combo[id="subzone"]':{"select":this.changeZone},'defineconfigurationpopup multiselect[id="component"]':{"change":this.selectComponents},'defineconfigurationpopup trigger[id="compSearch"]':{"change":this.filterMultiselect},'defineconfigurationpopup trigger[id="descSearch"]':{"change":this.filterMultiselect},'comparisonreportsettings combo[id="showdata"]':{"select":this.changeTimeline},'comparisonreportsettings combo[id="duration"]':{"select":this.changeTrendTimeline},'reportgeneration button[id="moreOptionCloseId"]':{"click":this.validateSettings},'reportgeneration button[id="submitViaSetting"]':{"click":this.closeSettingAndSubmit},'comparisonreportsettings combo[id="reportGeneration"]':{"select":this.changeReportGeneration},"newUtilities > #saveTool > button":{"click":this.saveReport},"newUtilities > #printTool > button":{"click":this.printReport},"newUtilities > #dataTool > button":{"click":this.showReportData},"newUtilities > #mailTool > button":{"click":this.sendMail},"newUtilities > #favoriteTool > button":{"click":this.showFavorite},'defineconfiguration button[id="panelinsidetoggle"]':{"click":this.toggleForm},"newUtilities > #scheduleTool > button":{"click":this.showSchedules},'main button[id="excelToolBtn"]':{"click":this.saveExcel}});
},showConfigDropdown:function(){isSettingsEnabled=true;var a=new Ext.XTemplate('<div style="float:left;margin:0px 0px 0px 0px;">More Options</div><div style="text-align:right;float:right;"><div class="iconCloseNew" id="closeSettings"></div></div>');Ext.create("Ext.container.Container",{width:564,id:"configMod",ui:"settingsWindowContainer",items:[{xtype:"container",cls:"configMode_popupArrow",style:{"top":"-14px","left":"327px"}},{xtype:"container",html:a.apply(),cls:"containerHeader",style:{"top":"0px","margin":"0px"}},{xtype:"comparisonreportsettings",parent:this}],renderTo:"comparisonreporttests-body"});
Ext.EventManager.onWindowResize(function(){Ext.get("configMod").setStyle("left","");});var b=this;Ext.get("closeSettings").on("click",function(){var c=b.validateSettings();if(!c){return;}Ext.get("configMod").animate({duration:500,to:{y:-500}});});},afterSettingsrender:function(){Ext.getCmp("moreOptionCloseId").show();
var o=appConstants.publicJSON["hiddens"];favorite_id=o["favorite_id"];if(!Ext.isEmpty(favorite_id)){Ext.getCmp("reportGeneration").setDisabled(true);}var d=appConstants.publicJSON;var c=d["screenLabels"];var u=Ext.getCmp("configsettings").getForm();var D=u.findField("graphtype");D.setFieldLabel(c["reporter.comparison.GraphType"]);
var s=u.findField("showdata");s.setFieldLabel(c["reporter.common.ShowData"]);var h=u.findField("CommonMaximum");h.setFieldLabel(c["reporter.comparison.CommonMaximum"]);var q=u.findField("autoMaximum");q.setFieldLabel(c["reporter.comparison.AutoMaximum"]);var f=u.findField("maxValue");f.setFieldLabel(c["reporter.comparison.MaxValue"]);
var r=u.findField("reportGeneration");r.setFieldLabel(c["reporter.consolidated.ReportGeneration"]);var j=u.findField("bgReportName");j.setFieldLabel(c["reporter.consolidated.ReportName"]);var l=u.findField("graphtype");var z=d["graphTypeCombo"];var w=d["showGraphTypeSelected"];if(!Ext.isEmpty(z)){l.suspendEvents(true);
l.getStore().loadRawData(z);if(!Ext.isEmpty(w)){l.setValue(w);}else{l.setValue(z[0].valueField);}l.resumeEvents();}var s=u.findField("showdata");var b=d["showDataCombo"];if(!Ext.isEmpty(b)){var n=d["showDataSelected"];s.suspendEvents(true);s.getStore().loadRawData(b);if(!Ext.isEmpty(n)){s.setValue(n);
}s.resumeEvents();}var e=d["hiddens"].trendenable;if(e=="false"){Ext.getCmp("showdata").hide();}else{Ext.getCmp("showdata").show();}var p=u.findField("CommonMaximum");var x=d["commonMaxCombo"];if(!Ext.isEmpty(x)){var B=d["commonMaxComboSelected"];p.suspendEvents(true);p.getStore().loadRawData(x);if(!Ext.isEmpty(B)){p.setValue(B);
}p.resumeEvents();}var m=u.findField("autoMaximum");var A=d["autoMaxCombo"];if(!Ext.isEmpty(A)){var k=d["autoMaxComboSelected"];m.suspendEvents(true);m.getStore().loadRawData(A);if(!Ext.isEmpty(k)){m.setValue(k);}m.resumeEvents();}var v=u.findField("duration");var E=d["duration"];if(!Ext.isEmpty(E)){var k=d["durationcomboSelected"];
v.suspendEvents(true);v.getStore().loadRawData(E);if(!Ext.isEmpty(k)){v.setValue(k);}v.resumeEvents();}var t=u.findField("gtype");var a=d["trendGraphtypecombo"];if(!Ext.isEmpty(a)){var k=d["trendGraphtypecomboSelected"];t.suspendEvents(true);t.getStore().loadRawData(a);if(!Ext.isEmpty(k)){t.setValue(k);
}t.resumeEvents();}if(s!=undefined&&s.getValue()=="Trend"){if(v!=undefined&&t!=undefined){v.show();t.show();}}this.changeCommonMaximum();var i=d["commonMaxRangeValue"];if(!Ext.isEmpty(i)){var f=u.findField("maxValue");f.suspendEvents(true);f.setValue(i);f.resumeEvents();}var y=d["reportGeneration"];var r=u.findField("reportGeneration");
if(!Ext.isEmpty(y)){var g=d["reportGenerationSelected"];r.suspendEvents(true);r.getStore().loadRawData(y);if(!Ext.isEmpty(g)){r.setValue(g);}r.resumeEvents();}updatingAppSettings();var C=d["bgReportName"];var j=u.findField("bgReportName");if(!Ext.isEmpty(C)){j.suspendEvents(true);j.setValue(C);j.resumeEvents();
}},goTo:function(b){if(Ext.getCmp("er_timeline").getValue()=="Any"){Ext.MessageBox.show({title:"Comparision Reports",msg:"Chosen timeline not allowed",buttons:Ext.Msg.OK,icon:Ext.MessageBox.WARNING});return;}appConstants.formButtonId=b.getId();var c=appConstants.publicJSON["hiddens"];var a=c["fromFavoriteModify"];
if((a!=null&&a=="Yes")){this.showFavorite(b);}else{this.showSchedules(b);}},beforeFormSubmit:function(){Ext.getCmp("panelinsidetoggle").setDisabled(false);var f=Ext.getCmp("er_stdate").getValue();f.setHours(Ext.getCmp("er_sthr").getValue());var h=Ext.getCmp("er_enddate").getValue();h.setHours(Ext.getCmp("er_endhr").getValue());
var k=appConstants.publicJSON.hiddens["getMaxDaysInMonth"];var e=appConstants.publicJSON.hiddens["er_usertimeline"];if(f.getTime()>h.getTime()){Ext.MessageBox.show({title:"Alert",msg:appConstants.dateValidateError,buttons:Ext.MessageBox.OK,icon:Ext.MessageBox.WARNING});return;}if(e!="-1"){var j=isUserTimelineLimitExceeded(e,k,f,h);
if(!j){Ext.MessageBox.show({title:"Alert",msg:appConstants.userTimelineErrorMsg,buttons:Ext.MessageBox.OK,icon:Ext.MessageBox.WARNING});return false;}}var i=Ext.getCmp("er_stdate").getValue();i.setHours(Ext.getCmp("er_sthr").getValue());var a=Ext.getCmp("er_enddate").getValue();a.setHours(Ext.getCmp("er_endhr").getValue());
var g=true;var c=checkDateTime(i,a);if(!c){return;}var b=appConstants.publicJSON.hiddens["limitforbg"];var d=appConstants.publicJSON["reportGenerationSelected"];if(isSettingsEnabled){d=Ext.getCmp("reportGeneration").getValue();}if(d=="foreground"){if(!Ext.isEmpty(b)){if(!checkTimeLineForBgLimit(b,k,f,h)){Ext.Msg.confirm("Confirm",appConstants.forGrdReportConfirmMsg,this.showResult,this);
}else{this.showResult("yes");}}else{this.showResult("yes");}}else{this.showResult("yes");}},changeEr_mode:function(c){var b=appConstants.publicJSON["hiddens"];favorite_id=b["favorite_id"];var a=b["fromScheduleModify"];if(!(favorite_id=="undefined"||favorite_id==undefined)||!(a==null||a=="null")){return;
}Ext.get("configMod").animate({duration:250,to:{y:-530}});this.beforeFormSubmit();},showFavorite:function(g){var b=this.updateQueryString();var a="";var c=appConstants.publicJSON["hiddens"];a=c["favorite_id"];var f="/final/servlet/com.eg.ErFavoriteC?"+b+"&cmd=client&com.eg.CSRF_NONCE="+csrfToken;if(appConstants.formButtonId=="save"){f+="&showWindow=no"+"&FavoriteId="+a+"&showLegend="+Ext.getCmp("showLegend").getValue();
var e=f.substr(0,f.indexOf("?"));var h=f.substr(f.indexOf("?")+1,f.length-1);var d=Ext.create("Ext.form.Panel");d.submit({url:e,params:h,standardSubmit:true,method:"POST"});}else{targetsource=f+"&showLegend="+Ext.getCmp("showLegend").getValue();parent.favouriteWindowFn(targetsource);}},showSchedules:function(f){var a=this.updateQueryString();
var b=appConstants.publicJSON["hiddens"];var e="/final/reporter/ErSaveSchedule.jsp?"+a+"&cmd=client"+"&showLegend="+Ext.getCmp("showLegend").getValue()+"&com.eg.CSRF_NONCE="+csrfToken;e+="&CSVFileAsExcel=yes";if(appConstants.formButtonId=="save"){e+="&showSchWindow=no";var d=e.substr(0,e.indexOf("?"));
var g=e.substr(e.indexOf("?")+1,e.length-1);var c=Ext.create("Ext.form.Panel");c.submit({url:d,params:g,standardSubmit:true,method:"POST"});}else{parent.scheduleWindowFn(e);}},sendMail:function(){var a=Ext.getCmp("showLegend").getValue();if(a!=null&&a!=undefined&&a!="undefined"){appConstants.drillDownParams="&showLegend="+a;
}Ext.widget("sendmail").show();},saveExcel:function(){window.location="../servlet/com.eg.ErXlsController?er_csvrequest=yes";},showReportData:function(){parent.maximizeDataWindowLightBox(appConstants.publicJSON["DATA_URL"],"REPORTER DATA");},printReport:function(){var a=appConstants.publicJSON["PRINT_URL"]+"&showLegend="+Ext.getCmp("showLegend").getValue();
parent.printWindowFn(a);},saveReport:function(){if(!Ext.isEmpty(appConstants.publicJSON["PDF_URL"])){if(Ext.isEmpty(appConstants.erUtils)){appConstants.erUtils=Ext.widget("erutils");}var a=appConstants.publicJSON["PDF_URL"]+"&showLegend="+Ext.getCmp("showLegend").getValue();appConstants.erUtils.savePDF(a);
}},bookletQuery:function(a){if(!Ext.isEmpty(appConstants.publicJSON["PDF_URL"])){var b=appConstants.publicJSON["PDF_URL"]+"&showLegend="+Ext.getCmp("showLegend").getValue();b=b.replace("../reporter/ErHtmlToSavePdf.jsp?","");}return b;},bookletScheduleQuery:function(c){var b="";var a=this.updateQueryString();
if(a!=null){b+=a;}b+="&cmd=client"+"&showLegend="+Ext.getCmp("showLegend").getValue()+"&CSVFileAsExcel=yes";return b;},bookletPreview:function(){this.printReport();},changeReportGeneration:function(a){if(a.getValue()=="background"){Ext.getCmp("bgReportName").show();Ext.getCmp("submitViaSetting").show();
Ext.getCmp("moreOptionCloseId").hide();}else{Ext.getCmp("bgReportName").hide();Ext.getCmp("submitViaSetting").hide();Ext.getCmp("moreOptionCloseId").show();}},showData:function(a){if(!Ext.isEmpty(a)){Ext.widget("comparisondata").show();var b=Ext.select("#dataContentDiv");b.set({src:a});}else{}},filterMultiselect:function(c){var a=c.getId();
var b,d;if(a=="compSearch"){d=appConstants.rawDataForComponents;b="component";}else{if(a=="descSearch"){d=appConstants.rawDataForDescriptor;b="Descriptor";}}if(Ext.isEmpty(appConstants.erUtils)){appConstants.erUtils=Ext.widget("erutils");}c.toggleTriggger();appConstants.erUtils.filterComboStore(c,Ext.getCmp(b),d);
},selectComponents:function(f,c,a,l){if(c=="-1"||c==""){return;}else{var o=Ext.getCmp("component").getValue();if((Ext.Array.contains(o,"All")||Ext.Array.contains(o,"all"))&&o.length>1){Ext.MessageBox.show({title:alert_text,msg:all_individual_alert,buttons:Ext.MessageBox.OK,icon:Ext.MessageBox.WARNING});
return;}var n="getInfos1";if(f.getValue().length>1){n="getMultiInfos";}var j=Ext.getCmp("Report").getValue();var i=Ext.getCmp("criteria").getValue();var e="NULL";if(j=="Zone"){e=Ext.getCmp("zone").getValue();}else{if(j=="Segment"){e=Ext.getCmp("segment").getValue();}else{if(j=="Service"){e=Ext.getCmp("service").getValue();
}}}var k="";var m=Ext.getCmp("test").getValue();var b=appConstants.publicJSON.hiddens["us_id"];Ext.getCmp("descSearch_TxtField").hide();var d=Ext.getCmp("metric").getValue();if(i=="Test"){k="&P0=["+e+"]&P1=["+m+"]&P2=["+o+"]&P3=["+b+"]";}else{k="&P0=["+e+"]&P1=["+appConstants.testVal+"]&P2=["+o+"]&P3=["+b+"]";
}var h="F="+n+"&C=jsrs1"+k+"&U="+new Date().getTime()+"&fromajax=true";var g=new Ext.LoadMask(Ext.getBody(),{msg:"Loading..."});g.show();Ext.Ajax.request({url:"/final/servlet/com.eg.ErRemoteScriptingServlet",params:h,method:"POST",scope:this,success:function(q){g.hide();if(q.status==200&&!Ext.isEmpty(q.responseText)){var t=q.responseText;
var s=Ext.decode(t);var v=Ext.getCmp("Descriptor");var p=s["combo"];var w=s["disableInfoCombo"];var r=s["infoTextFieldValue"];Ext.getCmp("descSearchCont").show();if(!Ext.isEmpty(p)){appConstants.rawDataForDescriptor=p;v.suspendEvents(true);v.getStore().loadRawData(p);var u={displayField:appConstants.mappingDesc,valueField:""};
v.getStore().insert(0,u);appConstants.rawDataForDescriptor.unshift(u);v.setValue(v.getStore().getAt(0).get("valueField"));v.setDisabled(false);v.fireEvent("select");v.resumeEvents();}else{if(!Ext.isEmpty(w)&&w!=undefined&&w=="yes"){Ext.getCmp("descSearch_TxtField").show();Ext.getCmp("descSearch_TxtField").setValue(r);
Ext.getCmp("descSearchCont").hide();}else{v.suspendEvents(true);v.setDisabled(true);this.insertNotApplicable(v);v.resumeEvents();}}}}});}},showConfiguration:function(){var a=Ext.getCmp("popup");a.hide();if(!Ext.isEmpty(Ext.get("linkId"))){Ext.get("linkId").show();}var b=Ext.getCmp("defineconfiguration");
b.setDisabled(false);},updateQueryString:function(){try{var L=this.getDefineconfiguration().getForm();var t=Ext.getCmp("popup").getForm();var al="";var af=appConstants.publicJSON.hiddens["us_id"];var r="null";var b=t.findField("criteria").getValue();var w=L.findField("er_mode").getValue();var s=t.findField("Descriptor").getValue();
var Y=L.findField("er_endhr").dataArray;var ae=L.findField("er_sthr").dataArray;var q=appConstants.publicJSON.hiddens["limitforbg"];var m=appConstants.publicJSON.hiddens["inidate"];var A=t.findField("criteria").getValue();var h=(A=="Metrics")?true:false;var l=Ext.getCmp("configdatas");var d="";if(h){d="Yes";
}else{d="No";}var a=appConstants.publicJSON.hiddens["bgenabled"];var v=t.findField("test").getValue();var f=t.findField("Report").getValue();var M=t.findField("subzone").getValue();var j="null";if(f=="Zone"){j=M;}var aa=appConstants.publicJSON.hiddens["servletName"];var B=L.findField("er_stdate").dataArray;
var H=L.findField("er_timeline").getValue();var O=L.findField("er_enddate").dataArray;var J=appConstants.publicJSON.hiddens["er_usertimeline"];var k=appConstants.publicJSON.hiddens["getMaxDaysInMonth"];var ab="null";var w=L.findField("er_mode").getValue();var P=appConstants.publicJSON.hiddens["savereport"];
var C=appConstants.publicJSON.hiddens["currTime"];var Q=appConstants.publicJSON.hiddens["detailtime"];var K=appConstants.publicJSON.hiddens["forwardto"];var Z=t.findField("Report").getValue();var R=appConstants.publicJSON;var x;var u=R["commonMaxComboSelected"];var V="0";var z=R["showGraphTypeSelected"];
var F=R["reportGenerationSelected"];var g="";var ag=(R["showDataSelected"]=="Trend")?"Yes":"No";var E=(R["showDataSelected"]=="Trend")?true:false;var c=R["autoMaxComboSelected"];var S=R["durationcomboSelected"];var T=R["trendGraphtypecomboSelected"];if(isSettingsEnabled){x=Ext.getCmp("configsettings").getForm();
u=x.findField("CommonMaximum").getValue();V=x.findField("maxValue").getValue();z=x.findField("graphtype").getValue();F=x.findField("reportGeneration").getValue();g=x.findField("bgReportName").getValue();ag=(x.findField("showdata").getValue()=="Trend")?"Yes":"No";E=(x.findField("showdata").getValue()=="Trend")?true:false;
c=x.findField("autoMaximum").getValue();if(ag!=undefined&&ag=="Yes"){S=x.findField("duration").getValue();T=x.findField("gtype").getValue();}}if(Ext.isEmpty(appConstants.erUtils)){appConstants.erUtils=Ext.widget("erutils");}var n="null";var ak=appConstants.publicJSON.hiddens["fromScheduleModify"];var U=appConstants.publicJSON.hiddens["fromFavoriteModify"];
if((ak!=null&&ak=="Yes")){r=appConstants.publicJSON.hiddens["schedule_id"];}var p="null";var ad=Z;var ac=t.findField("component").getValue();var aj=appConstants.publicJSON.hiddens["er_ViewName"];var G=t.findField("measure").getValue();var W="";var X="";var y="";var D=Ext.getCmp("configdatas").getSelectionModel();
var I=Ext.getCmp("configdatas").getStore();for(var ah=0;ah<l.dataArray.length;ah++){var o=l.dataArray[ah]["Hiddens"];o=appConstants.erUtils.specialCharEncode(o);X+=o+"0eghash0eghash0";y+="&er_selection="+o;}al="uid="+encodeURIComponent(af);if(F=="background"){K="ErCompareTestJSON";g=checkFileName(g);
al+="&bg_reportname="+encodeURIComponent(g);}al+="&fromScheduleModify="+ak+"&schedule_id="+encodeURI(r)+"&er_trgttype=Tests&er_info_list="+appConstants.erUtils.specialCharEncode(s)+"&endhr="+encodeURI(Y)+"&starthr="+encodeURI(ae)+"&er_commonMaxRange="+encodeURI(V)+"&limitforbg="+encodeURI(q)+"&er_flag=true&er_trenddata="+encodeURI(ag)+"&inidate="+encodeURI(m)+"&template="+encodeURI(h)+"&bgenabled="+encodeURI(a)+"&er_gtype=Comparison&er_test="+encodeURI(appConstants.testVal)+"&includesubzone="+encodeURI(j)+"&us_id="+encodeURIComponent(af)+"&servletName="+encodeURI(aa)+"&map_measure="+encodeURI(appConstants.mapMeasureVal)+"&map_test="+encodeURI(appConstants.mapTestVal)+"&startdate="+encodeURI(B)+"&er_timeline="+encodeURI(H)+"&er_templateEnable="+encodeURI(d)+"&enddate="+encodeURI(O)+"&er_usertimeline="+encodeURI(J)+"&toScrpt=&getMaxDaysInMonth="+encodeURI(k)+"&er_rtype=Comparison&reporttype="+encodeURI(ab)+"&er_graphtype="+encodeURI(z)+"&er_reportgenration="+encodeURI(F)+"&savereport="+encodeURI(P)+"&currTime="+encodeURI(C)+"&endmin="+encodeURI(mgr_enmin)+"&startmin="+encodeURI(mgr_stmin)+"&er_measure="+encodeURI(G)+"&detailtime="+encodeURI(Q)+"&forwardto="+encodeURI(K)+"&er_commonMax="+encodeURI(u)+"&er_AutoCommonMax="+encodeURI(c)+"&er_dataFrom="+encodeURI(Z)+"&fromSchedule="+encodeURI(n)+"&toScrpText=&modify="+encodeURI(p)+"&er_optionselect="+encodeURI(ad)+"&er_component="+encodeURI(ac)+"&trendenable="+encodeURI(E)+"&userID="+encodeURI(af)+"&er_bgreportfrom=Comparison_Test&er_ViewName="+encodeURI(aj)+"&er_search=&er_combination="+X+"&toScrpText="+W+y+"&er_mode="+encodeURI(w)+"&fromFavoriteModify="+U+"&showLegend="+Ext.getCmp("showLegend").getValue();
var N="";if(f!="Component"){N=t.findField(f.toLowerCase()).getValue();al+="&er_service="+encodeURIComponent(N);}if(ag!=undefined&&ag=="Yes"){al+="&er_duration="+encodeURIComponent(S)+"&er_trendGraphType="+encodeURIComponent(T);}return al;}catch(ai){alert("[Exception] @ updateQueryString "+ai);}},formSubmit:function(c){var e=false;
var x=Ext.getCmp("configdatas");var w=Ext.getCmp("configdatas").getStore();var I=this.getDefineconfiguration().getForm();var av=true;var az=false;var E="";if(w.getCount()==0){av=false;E=appConstants.chooseCombination;}else{var Z=Ext.getCmp("configdatas").getSelectionModel();av=false;for(var R=0;R<Ext.getCmp("configdatas").getStore().getCount();
R++){if(Z.isSelected(w.getAt(R))){av=true;break;}}E=appConstants.chooseCombination;}if(Ext.isEmpty(appConstants.erUtils)){appConstants.erUtils=Ext.widget("erutils");}var au=new Ext.LoadMask(Ext.getBody(),{msg:"Loading..."});au.show();var aj=this;var ah=Ext.getCmp("popup").getForm();var ao=appConstants.publicJSON;
var k;var C=ao["commonMaxComboSelected"];var y="0";var ax=ao["showGraphTypeSelected"];var ak=ao["reportGenerationSelected"];var ay="";var S=(ao["showDataSelected"]=="Trend")?"Yes":"No";var H=(ao["showDataSelected"]=="Trend")?true:false;var at=ao["autoMaxComboSelected"];var af=ao["durationcomboSelected"];
var aB=ao["trendGraphtypecomboSelected"];if(isSettingsEnabled){k=Ext.getCmp("configsettings").getForm();C=k.findField("CommonMaximum").getValue();y=k.findField("maxValue").getValue();ax=k.findField("graphtype").getValue();ak=k.findField("reportGeneration").getValue();ay=k.findField("bgReportName").getValue();
S=(k.findField("showdata").getValue()=="Trend")?"Yes":"No";H=(k.findField("showdata").getValue()=="Trend")?true:false;if(S!=undefined&&S=="Yes"){af=k.findField("duration").getValue();aB=k.findField("gtype").getValue();}at=k.findField("autoMaximum").getValue();e=Ext.getCmp("showLegend").getValue();}e=Ext.getCmp("showLegend").getValue();
var d="";var J=appConstants.publicJSON.hiddens["us_id"];var ag="null";var z=ah.findField("criteria").getValue();var P=I.findField("er_mode").getValue();var O=ah.findField("Descriptor").getValue();var v=I.findField("er_endhr").dataArray;var j=I.findField("er_sthr").dataArray;var p=appConstants.publicJSON.hiddens["limitforbg"];
var aq=appConstants.publicJSON.hiddens["inidate"];var Q=ah.findField("criteria").getValue();var M=(Q=="Metrics")?true:false;var K="";if(M){K="Yes";}else{K="No";}var g=appConstants.publicJSON.hiddens["bgenabled"];var L=ah.findField("test").getValue();var an=ah.findField("Report").getValue();var W=ah.findField("subzone").getValue();
var B=appConstants.publicJSON.hiddens["fromScheduleModify"];if(B!=null&&B=="Yes"){ag=appConstants.publicJSON.hiddens["schedule_id"];}var m="";if(an!="Component"){m=ah.findField(an.toLowerCase()).getValue();}var ac="null";if(an=="Zone"){ac=W;}var ae=appConstants.publicJSON.hiddens["servletName"];var al=I.findField("er_stdate").dataArray;
var n=I.findField("er_timeline").getValue();var V=I.findField("er_enddate").dataArray;var U="-1";var ai=appConstants.publicJSON.hiddens["getMaxDaysInMonth"];var Y="null";if(!Ext.isEmpty(Ext.getCmp("reporttype"))){Y=appConstants.publicJSON.hiddens["reporttype"];}var P=I.findField("er_mode").getValue();
var T=appConstants.publicJSON.hiddens["savereport"];var A=appConstants.publicJSON.hiddens["currTime"];var aa=appConstants.publicJSON.hiddens["detailtime"];var a=appConstants.publicJSON.hiddens["forwardto"];var X=ah.findField("Report").getValue();var o=ah.findField("measure").getValue();var G="null";var l=Ext.getCmp("metric").getValue();
if(!Ext.isEmpty(Ext.getCmp("fromSchedule"))){G=appConstants.publicJSON.hiddens["fromSchedule"];}var u="null";if(!Ext.isEmpty(Ext.getCmp("modify"))){u=appConstants.publicJSON.hiddens["modify"];}var b=X;var ar=ah.findField("component").getValue();var t=appConstants.publicJSON.hiddens["er_ViewName"];var f="";
var am="";var F="";var Z=Ext.getCmp("configdatas").getSelectionModel();var N="";var s="";var ap="";var aw="";var D="";var aA="";var ad="";var h="";for(var R=0;R<x.dataArray.length;R++){var q=x.dataArray[R]["Hiddens"];var r=encodeURIComponent(q);q=appConstants.erUtils.specialCharEncode(q);f+=q+"0eghash0";
am+=q+"0eghash0eghash0";if(ak!=null&&ak=="foreground"){F+="&er_selection="+r;}else{F+="&er_selection="+q;}s+="|amp|"+x.dataArray[R]["Name"];ap+="|amp|"+x.dataArray[R]["Type"];aw+="|amp|"+appConstants.erUtils.specialCharEncode(x.dataArray[R]["Test"]);D+="|amp|"+appConstants.erUtils.specialCharEncode(x.dataArray[R]["Measure"]);
aA+="|amp|"+appConstants.erUtils.specialCharEncode(x.dataArray[R]["Descriptor"]);ad+="|amp|"+appConstants.erUtils.specialCharEncode(x.dataArray[R]["Hiddens"]);h+="|amp|"+x.dataArray[R]["testVal"];}var ab="";d="uid="+encodeURIComponent(J);if(ak=="foreground"){ab="/final/servlet/com.eg.ErRepoLiteC";}else{a="ErCompareTestJSON";
ab="/final/servlet/com.eg.ErStartBackGroundReportC";ay=checkFileName(ay);d+="&bg_reportname="+encodeURIComponent(ay);}d+="&fromScheduleModify="+B+"&schedule_id="+encodeURI(ag)+"&er_trgttype=Tests&er_info_list="+appConstants.erUtils.specialCharEncode(O)+"&endhr="+encodeURI(v)+"&starthr="+encodeURI(j)+"&er_commonMaxRange="+encodeURI(y)+"&er_AutoCommonMax="+encodeURI(at)+"&limitforbg="+encodeURI(p)+"&er_flag=true&er_trenddata="+encodeURI(S)+"&inidate="+encodeURI(aq)+"&template="+encodeURI(M)+"&bgenabled="+encodeURI(g)+"&er_gtype=Comparison&includesubzone="+encodeURI(ac)+"&us_id="+encodeURIComponent(J)+"&servletName="+encodeURI(ae)+"&map_measure="+encodeURI(appConstants.mapMeasureVal)+"&map_test="+encodeURI(appConstants.mapTestVal)+"&startdate="+encodeURI(al)+"&er_timeline="+encodeURI(n)+"&er_templateEnable="+encodeURI(K)+"&isSubmit=true&enddate="+encodeURI(V)+"&er_usertimeline="+encodeURI(U)+"&toScrpt=&getMaxDaysInMonth="+encodeURI(ai)+"&er_rtype=Comparison&reporttype="+encodeURI(Y)+"&er_graphtype="+encodeURI(ax)+"&er_reportgenration="+encodeURI(ak)+"&savereport="+encodeURI(T)+"&currTime="+encodeURI(A)+"&endmin="+encodeURI(mgr_enmin)+"&startmin="+encodeURI(mgr_stmin)+"&er_measure="+encodeURI(o)+"&detailtime="+encodeURI(aa)+"&forwardto="+encodeURI(a)+"&er_commonMax="+encodeURI(C)+"&er_dataFrom="+encodeURI(X)+"&fromSchedule="+encodeURI(G)+"&toScrpText=&modify="+encodeURI(u)+"&er_optionselect="+encodeURI(b)+"&er_component="+encodeURI(ar)+"&trendenable="+encodeURI(H)+"&userID="+encodeURI(J)+"&er_bgreportfrom=Comparison_Test&er_ViewName="+encodeURI(t)+"&er_search=&er_combination="+encodeURI(am)+"&toScrpText="+encodeURI(f)+F+"&er_mode="+encodeURI(P)+"&er_service="+encodeURIComponent(m)+"&er_test="+encodeURIComponent(L)+"&er_template="+encodeURI(l);
d+="&servers="+encodeURIComponent(s)+"&comptypes="+encodeURIComponent(ap)+"&tests="+encodeURIComponent(aw)+"&measures="+encodeURIComponent(D)+"&infos="+appConstants.erUtils.specialCharEncode(aA)+"&hiddens="+appConstants.erUtils.specialCharEncode(ad)+"&testVal="+encodeURIComponent(h)+"&showLegend="+e;
if(S!=undefined&&S=="Yes"){d+="&er_duration="+encodeURIComponent(af)+"&er_trendGraphType="+encodeURIComponent(aB);}if((c!=undefined&&(c.getId()=="favoriteTool"||c.getId()=="favImg"||c.getId()=="scheduleTool"||c.getId()=="scheduleImg"))||(B!=null&&B=="Yes")){az=true;}if(az){queryString=d;return;}d+="&er_RmDispName="+appConstants.er_RmDispName;
Ext.Ajax.request({url:ab,params:d+"&call=json",method:"POST",success:function(aD){if(aD.status==200&&!Ext.isEmpty(aD.responseText)){au.hide();var i=aD.responseText;var aH=Ext.decode(i);if(ak=="foreground"){aj.loadCharts(aH,ax);}else{if(ak=="background"&&!Ext.isEmpty(aH["backgroundrResponseText"])){var aC=Ext.getCmp("resultPanel");
var aE=aH["backgroundrResponseText"];var aG=aH["backgroundStatus"];var aI=aH["backgroundLinkText"];var aF=aH["backgroundURL"];aC.hide();var aJ="";if(aG=="duplicate"){aJ='<table border="0px" width="100%" height="100%"><tr><td align="center" valign="middle"><table style="width:480px;"border="0px"><tr><td><div style="margin:0px 10px 0px 0px;display:block;width:32px;height:32px;float:right;" class="iconExclamation"></div></td><td><div style="line-height:1.5em" class="font_bold11">'+aE+".</br>"+'<a class="backgroundMsgLink" href='+aF+">"+aI+"</a></div></td></tr></table></td></tr></table>";
}else{if(aG=="success"){aJ='<table border="0px" width="100%" height="100%"><tr><td align="center" valign="middle"><table style="width:480px;"border="0px"><tr><td><div style="margin:0px 10px 0px 0px;display:block;width:32px;height:32px;float:right;" class="iconSuccess"></div></td><td><div style="line-height:1.5em" class="font_bold11">'+aE+".</br>"+'<a class="backgroundMsgLink" href='+aF+">"+aI+"</a></div></td></tr></table></td></tr></table>";
}else{aJ='<table border="0px" width="100%" height="100%"><tr><td align="center" valign="middle"><table style="width:480px;"border="0px"><tr><td><div style="margin:0px 10px 0px 0px;display:block;width:32px;height:32px;float:right;" class="iconExclamation"></div></td><td><div style="line-height:1.5em" class="font_bold11">'+aE+"</div></td></tr></table></td></tr></table>";
}}aj.getBackGroundPanel().show();aj.getBackGroundPanel().update(aJ);}else{var aC=Ext.getCmp("resultPanel");aj.getBackGroundPanel().hide();aC.show();aC.removeAll();aC.add({xtype:"container",columnWidth:"1",style:"text-align:center",border:false,html:'<div style="margin:10% auto 0 auto"></div><div><img src="/final/images/'+strSkin+'/nomeasures_custom.png" /></div>'});
aC.doLayout();}}}}});},loadCharts:function(e,n){var p=Ext.getCmp("resultPanel");var k=e["results"];if(!Ext.isEmpty(k)){var a=e["timeFormat"];var h=e["chartType"];var j=new Array();var o=new Array();var d=new Array();p.show();p.removeAll();Ext.getCmp("backGroundPanel").hide();var A=new Array();if(n=="Multiple"){Ext.get("timeformate").update('<span class="xAxisLabelFontForReporter ">'+a+"</span>");
}var E=new Array();Ext.getCmp("bookletTool").setDisabled(false);Ext.getCmp("saveTool").setDisabled(false);Ext.getCmp("printTool").setDisabled(false);Ext.getCmp("mailTool").setDisabled(false);Ext.getCmp("dataTool").setDisabled(true);Ext.getCmp("excelTool").setDisabled(false);var t='<div style="width:100%"><table width="100%" border="0" class="htmlGraphTable"><col width="50%"><col width="50%"><tr>';
var g=0;for(var w=0;w<k.length;w++){var u=false;var D=k[w]["TITLE"];var q=k[w]["IMAGE_URL"];var y=k[w]["CSV_URL"];var r=k[w]["DATA_URL"];var v=k[w]["IMAGE_DRILL_DOWN_URL"];if(k.length==1){Ext.getCmp("dataTool").setDisabled(false);}else{}if(g==2){g=0;t+="</tr>";t+="<tr>";}if(w==0){if(k.length>2){t+='<td style="padding:0px 5px 5px 10px">';
}else{if(k.length==2){t+='<td style="padding:0px 5px 10px 10px">';}else{t+='<td style="padding:0px 10px 10px 10px">';}}}else{if(w==1){if(k.length>2){t+='<td style="padding:0px 10px 5px 5px">';}else{t+='<td style="padding:0px 10px 10px 5px">';}}else{if((w%2)==0){if(w==k.length-1){u=true;t+='<td style="padding:5px 5px 10px 10px">';
}else{if(w==k.length-2){t+='<td style="padding:5px 5px 10px 10px">';}else{t+='<td style="padding:5px 5px 5px 10px">';}}}else{if((w%2)!=0){if(w==k.length-1){t+='<td style="padding:5px 10px 10px 5px">';}else{t+='<td style="padding:5px 10px 5px 5px">';}}}}}t+='<div width="100%" class="graphMainDiv">';if(k.length>0){if(n=="Multiple"){t+='<div class="htmlGraphTableHeader"><div style="float:left;">'+D+"</div>";
t+='<div style="float:right;margin:3px 0px 4px 5px;">';t+='<div style="float:right;cursor:pointer;margin:0 0 0 5px" class="iconMaximize" onclick="javascript:loadUrlInDrillDown(\''+v+"');\"></div>";t+='<div style="float:right;cursor:pointer;margin:0 5px 0 5px" class="iconCsv" onclick="window.location=\''+y+"'\"></div>";
t+='<div style="float:right;cursor:pointer;margin:0 5px 0 5px" class="iconData" onclick="javascript:loadDataWindow(\''+r+"');\"></div>";t+="</div></div>";t+='<div class="headerBottomBorder" ></div>';}}var x="img_"+w;o.push(x);if(k.length==1){t+='<div id="'+x+'" style="height:450px;width:100%;" class="htmlTableBody showDiv">';
}else{t+='<div id="'+x+'" style="height:270px;width:100%;" class="htmlTableBody showDiv">';}if(h!="highchart"){t+='<table width="100%" height="100%"><tr><td valign="middle" align="center"><img src="'+q+'"></img></td></tr></table>';}else{j.push(q+"&chartType="+h);}t+="</div>";t+='<div style="height:60px;margin-right: 10px;" id="commonLeg_'+x+'" class="showDiv commonLeg">';
t+='<div id="'+x+'_legend" style="height:51px;width:100%;overflow:hidden;display:inline-block; vertical-align: middle;" class="showDiv">';t+="</div></div>";if(k.length==1&&h!="highchart"){var m=k[0]["singleSelectionDetails"];if(!Ext.isEmpty(m)){t+='<div><table width="100%">';var f=(m.length/2)*10;height+=f;
for(var z=0;z<m.length;z+=2){var c=m[z]["IMAGE_COLOR"];var C=m[z]["DESCRIPTORS"];var b="";var B="";if(!Ext.isEmpty(m[z]["IMAGE_COLOR"])&&!Ext.isEmpty(m[z]["DESCRIPTORS"])){b=m[z]["IMAGE_COLOR"];B=m[z]["DESCRIPTORS"];}t+='<tr><td width="50%"><img src="/final/servlet/com.eg.ErImageDrawC?req='+c+'" />&nbsp;'+C+'</td><td width="50%"><img src="/final/servlet/com.eg.ErImageDrawC?req='+b+'" />&nbsp;'+B+"</td></tr>";
}t+="</table></div>";}}t+="</div></td>";if(u){t+='<td style="padding:5px 10px 10px 5px;">&nbsp;</td>';}g++;}if(g==2){t+="</tr>";}t+="</table></div>";p.add({columnWidth:1,cls:"newChk",html:t,listeners:{boxready:function(){var l=Ext.getCmp("showLegend").getValue();if(l=="false"||l==false){var I=document.getElementsByClassName("commonLeg");
for(var H=0;H<I.length;H++){var G=I[H].id;var F=document.getElementById(G);if(F!=null&&F!=undefined){F.className=F.className.replace("showDiv","hideDiv");}}}}}});if(h=="highchart"){for(var s in o){reportHighStockChart(j[s],o[s],"","","");}}p.doLayout();Ext.getCmp("selectionDetails").setSelectionDetailsData(e.selectionDetails);
this.enableOrDisableTools(E);if(!Ext.isEmpty(e["PDF_URL"])){appConstants.publicJSON["PDF_URL"]=e["PDF_URL"];}if(!Ext.isEmpty(e["PRINT_URL"])){appConstants.publicJSON["PRINT_URL"]=e["PRINT_URL"];}if(!Ext.isEmpty(e["DATA_URL"])){appConstants.publicJSON["DATA_URL"]=e["DATA_URL"];}}},toggleForm:function(b){Ext.getCmp("panelinsidetoggle").show();
var a=this.getDefineconfiguration();if(a.isHidden()){a.show();Ext.getCmp("selectionDetails").hide();}else{a.hide();Ext.getCmp("selectionDetails").show();}},renderPopUp:function(a){Ext.getCmp("component").on("focus",this.callMe);Ext.EventManager.onWindowResize(function(){a.doComponentLayout();a.setWidth(Ext.getBody().getViewSize().width-80);
});},closeSettingAndSubmit:function(){if(this.validateSettings()){this.beforeFormSubmit();}},validateSettings:function(){var c=appConstants.publicJSON.hiddens["er_usertimeline"];var m=appConstants.publicJSON.hiddens["getMaxDaysInMonth"];var e=Ext.getCmp("er_stdate").getValue();if(e!="null"){e.setHours(Ext.getCmp("er_sthr").getValue());
}var j=Ext.getCmp("er_enddate").getValue();j.setHours(Ext.getCmp("er_endhr").getValue());var i=Ext.getCmp("CommonMaximum").getValue();var d=Ext.getCmp("autoMaximum").getValue();var g=Ext.getCmp("maxValue").getValue();if(isNaN(g)){Ext.MessageBox.show({title:"Alert",msg:appConstants.wrongInput,buttons:Ext.MessageBox.OK,icon:Ext.MessageBox.WARNING});
Ext.getCmp("maxValue").focus();return false;}if(i=="Yes"&&d=="No"&&(Ext.isEmpty(g)||!(g>=0||g<=0))){Ext.MessageBox.show({title:"Alert",msg:appConstants.wrongInput,buttons:Ext.MessageBox.OK,icon:Ext.MessageBox.WARNING});Ext.getCmp("maxValue").focus();return false;}if(c!="-1"){var l=isUserTimelineLimitExceeded(c,m,e,j);
if(!l){Ext.MessageBox.show({title:"Alert",msg:userTimelineErrorMsg,buttons:Ext.MessageBox.OK,icon:Ext.MessageBox.WARNING});return false;}}if(e.getTime()>j.getTime()){Ext.MessageBox.show({title:"Alert",msg:dateValidateError,buttons:Ext.MessageBox.OK,icon:Ext.MessageBox.WARNING});return false;}var a=appConstants.publicJSON.hiddens["limitforbg"];
var b=Ext.getCmp("reportGeneration").getValue();var f=true;if(b=="background"){var k=Ext.getCmp("bgReportName").getValue();var h=validateTextBoxWithSpecialChars(k,"Attachment",true);if(!h){Ext.getCmp("bgReportName").focus();return false;}else{return true;}}Ext.getCmp("submit").setDisabled(false);Ext.get("configMod").animate({duration:500,to:{y:-500}});
return f;},showResult:function(d){if(d=="yes"){var a=Ext.getCmp("submit");a.setDisabled(false);if(Ext.get("configMod")!=null){Ext.get("configMod").animate({duration:500,to:{y:-500}});}var f=appConstants.publicJSON["hiddens"];var g=f["fromScheduleModify"];var b=f["fromFavoriteModify"];if((g!=null&&g=="Yes")){var c=Ext.getCmp("submit");
var e=c.getText();if((e!=null&&e=="Save")){this.showSchedules(new Object());}}else{if((b!=null&&b=="Yes")){this.showFavorite(new Object());}else{var h=appConstants.publicJSON["reportGenerationSelected"];if(isSettingsEnabled){h=Ext.getCmp("reportGeneration").getValue();}if(h=="background"){if(!validateTextBoxWithSpecialChars(Ext.getCmp("bgReportName").getValue(),"Attachment",true)){Ext.getCmp("bgReportName").focus();
return false;}}this.formSubmit();}}}else{this.getReporterSettings().down("button").fireHandler();Ext.getCmp("reportGeneration").setValue("background");Ext.getCmp("bgReportName").show();Ext.getCmp("bgReportName").setValue("");Ext.getCmp("bgReportName").focus(false,1000);Ext.getCmp("submitViaSetting").show();
Ext.getCmp("moreOptionCloseId").hide();validateTextBoxWithSpecialChars(Ext.getCmp("bgReportName").getValue(),"Attachment",true);return false;}},insertNotApplicable2:function(c){var b=Ext.getCmp(c);var a=[];a.push({"displayField":appConstants.notApplicabletxt,"valueField":"-1"});b.suspendEvents(true);
b.getStore().loadRawData(a);if(c=="Descriptor"){appConstants.rawDataForDescriptor=a;}else{if(c=="component"){appConstants.rawDataForComponents=a;}}b.setValue("-1");b.resumeEvents();},loadDefaults:function(){Ext.getCmp("er_mode").hide();Ext.widget("defineconfigurationpopup").hide();var E=this;var V=appConstants.publicJSON;
var B=V["hiddens"];var aq=B["fromScheduleModify"];var ab=B["fromFavoriteModify"];if((aq!=null&&aq=="Yes")||(ab!=null&&ab=="Yes")){Ext.getCmp("submit").hide();Ext.getCmp("save").show();Ext.getCmp("favoriteTool").setDisabled(true);Ext.getCmp("scheduleTool").setDisabled(true);}else{Ext.getCmp("submit").show();
Ext.getCmp("save").hide();}var v=new Array();v["bookletTool"]="true";v["saveTool"]="true";v["printTool"]="true";v["mailTool"]="true";v["dataTool"]="true";v["closeTool"]="true";v["excelTool"]="true";this.enableOrDisableTools(v);var u=Ext.getCmp("popup").getForm();var R=this.getDefineconfiguration().getForm();
var V=appConstants.publicJSON;var j=V["selectedValues"];if(!Ext.isEmpty(V)){E.loadScreenLabels(V["screenLabels"]);var r=u.findField("Report");var al=V["reportForCombo"];if(!Ext.isEmpty(al)){var x=V["reportForComboSelected"];this.setValueWithOptionInList(u,"Report",al,x);if(x!="Component"){var c=V[x];
var F="";if(!Ext.isEmpty(V["er_serviceSelected"])){F=V["er_serviceSelected"];}this.setValueWithOptionInList(u,x.toLowerCase(),c,F);this.selectReportFor();}}var Q=V["criteriaCombo"];if(!Ext.isEmpty(Q)){var I="";if(!Ext.isEmpty(V["criteriaComboSelected"])){I=V["criteriaComboSelected"];}this.setValueWithOptionInList(u,"criteria",Q,I);
Ext.getCmp("configdatas").getStore().removeAll();var u=Ext.getCmp("popup").getForm();var X=u.findField("criteria");var w=u.findField("Descriptor");var O=false;if(!Ext.isEmpty(X)){var C="/final/servlet/com.eg.ErRemoteScriptingServlet";var ae="";var b=u.findField("Report").getValue();if(b=="Component"){ae="&P0=[Component]&P1=[Component]&P2=[no]";
O=true;}else{if(b=="Zone"){var q=u.findField("zone").getValue();var S=u.findField("subzone").getValue();if(q=="-1"){O=false;}else{O=true;}ae="&P0=["+b+"]&P1=["+q+"]&P2=["+S+"]";}else{if(b=="Segment"){var h=u.findField("segment").getValue();ae="&P0=["+b+"]&P1=["+h+"]&P2=[no]";if(h=="-1"){O=false;}else{O=true;
}}else{if(b=="Service"){var ao=u.findField("service").getValue();ae="&P0=["+b+"]&P1=["+ao+"]&P2=[no]";if(ao=="-1"){O=false;}else{O=true;}}}}}if(O){if(X.getValue()=="Test"){var A=u.findField("test");var an=u.findField("measure");if(!Ext.isEmpty(appConstants.publicJSON.screenLabels["reporter.comparison.Test"])){A.setFieldLabel(appConstants.publicJSON.screenLabels["reporter.comparison.Test"]);
}if(!Ext.isEmpty(appConstants.publicJSON.screenLabels["reporter.comparison.Measure"])){an.setFieldLabel(appConstants.publicJSON.screenLabels["reporter.comparison.Measure"]);}A.show();an.show();var g=u.findField("metric");g.hide();var o="F=getTestsForSite&C=jsrs1"+ae+"&U="+new Date().getTime()+"&fromajax=true";
if(appConstants.rmComponentType!="null"){o+="&er_compType="+appConstants.rmComponentType;}Ext.Ajax.request({url:C,params:o,scope:this,success:function(i){var ay=i.responseText;var ax=Ext.decode(ay);if(!Ext.isEmpty(ax)){var aw=ax["combo"];var av=u.findField("test");av.suspendEvents(true);av.getStore().clearFilter(true);
av.getStore().loadRawData(aw);var az=av.getStore();az.insert(0,{displayField:appConstants.mapping_test,valueField:"-1"});if(!Ext.isEmpty(appConstants.publicJSON["testComboSelected"])){av.setValue(appConstants.publicJSON["testComboSelected"]);}else{av.setValue("-1");}av.resumeEvents();}}});var an=u.findField("measure");
this.insertNotApplicable(an);}else{var A=u.findField("test");var an=u.findField("measure");var g=u.findField("metric");if(!Ext.isEmpty(appConstants.publicJSON.screenLabels["reporter.comparison.Metric"])){g.setFieldLabel(appConstants.publicJSON.screenLabels["reporter.comparison.Metric"]);}var o="F=getTemplateForSite&C=jsrs1"+ae+"&U=1360127833994872&fromajax=true";
if(appConstants.rmComponentType!="null"){o+="&er_compType="+appConstants.rmComponentType;}Ext.Ajax.request({url:C,params:o,scope:this,success:function(av){var ax=av.responseText;var aw=Ext.decode(ax);if(!Ext.isEmpty(aw)){var i=u.findField("metric");i.suspendEvents(true);var ay=aw["combo"];i.getStore().clearFilter(true);
i.getStore().loadRawData(ay);i.getStore().insert(0,{displayField:appConstants.mapping_metric,valueField:"-1"});if(!Ext.isEmpty(appConstants.publicJSON["metricComboSelected"])){i.setValue(appConstants.publicJSON["metricComboSelected"]);}else{i.setValue("-1");}i.resumeEvents();}}});g.show();A.hide();an.hide();
}}var A=u.findField("test");var an=u.findField("measure");var g=u.findField("metric");var L=u.findField("component");var K=u.findField("Descriptor");this.insertNotApplicable(A);this.insertNotApplicable(an);this.insertNotApplicable(g);this.insertNotApplicable(L);this.insertNotApplicable(K);}}var T=V["testCombo"];
if(!Ext.isEmpty(T)){var G=V["testComboSelected"];this.setValueWithOptionInList(u,"test",T,G);}else{this.insertNotApplicable2("test");}var ar=V["metricCombo"];if(!Ext.isEmpty(ar)){var g=Ext.getCmp("metric");var aa=V["metricComboSelected"];this.setValueWithOptionInList(u,"metric",ar,aa);u.findField("metric").setValue(aa);
}else{this.insertNotApplicable2("metric");}var n=V["measureCombo"];if(!Ext.isEmpty(n)){var an=Ext.getCmp("measure");an.getStore().clearFilter(true);an.getStore().loadRawData(n);var m=V["measureComboSelected"];this.setValueWithOptionInList(u,"measure",n,m);}else{this.insertNotApplicable2("measure");Ext.getCmp("measure").setValue("-1");
}if(V["criteriaComboSelected"]=="Test"){var D=V["testComboSelected"];var o="F=getMeasuresForTest1&C=jsrs1&P0=["+D+"]&U="+new Date().getTime()+"&fromajax=true";Ext.Ajax.request({url:C,params:o,async:false,method:"POST",success:function(i){if(i.status==200&&!Ext.isEmpty(i.responseText)){var ax=i.responseText;
var av=Ext.decode(ax);if(!Ext.isEmpty(av)){var ay=av["combo"];var aw=Ext.getCmp("measure");if(!Ext.isEmpty(ay)){aw.suspendEvents(true);aw.getStore().clearFilter(true);aw.getStore().loadRawData(ay);aw.getStore().insert(0,{displayField:appConstants.mapping_measure,valueField:"-1"});aw.setValue("-1");aw.resumeEvents();
}else{E.insertNotApplicable(aw);}}}}});if(!Ext.isEmpty(V["measureComboSelected"])){Ext.getCmp("measure").setValue(V["measureComboSelected"]);}else{Ext.getCmp("measure").setValue("-1");}var ag=appConstants.publicJSON.hiddens["us_id"];ae="&P0=["+encodeURIComponent(D)+"]&P1=["+encodeURIComponent(appConstants.publicJSON["hiddens"]["userID"])+"]";
var s=Ext.getCmp("test").getValue();var b=Ext.getCmp("Report").getValue();var a="";if(b=="Component"){ae="&P0=["+s+"]";a="getComponentsForTest1";ae="&P0=["+encodeURIComponent(s)+"]&P1=["+encodeURIComponent(ag)+"]";}else{a="getComponentsForTest";if(b=="Zone"){categoryVal=Ext.getCmp("zone").getValue();
isSubZone=Ext.getCmp("subzone").getValue().toLowerCase();ae="&P0=["+b+"]&P1=["+categoryVal+"]"+"&P2=["+isSubZone+"]&P3=["+s+"]";}else{if(b=="Segment"){categoryVal=Ext.getCmp("segment").getValue();ae="&P0=["+b+"]&P1=["+categoryVal+"]"+"&P2=[no]&P3=["+s+"]";}else{if(b=="Service"){categoryVal=Ext.getCmp("service").getValue();
ae="&P0=["+b+"]&P1=["+categoryVal+"]"+"&P2=[no]&P3=["+s+"]";}}}}var o="F="+a+"&C=jsrs1"+ae+"&U=1360217653961521&fromajax=true";Ext.Ajax.request({url:C,params:o,async:false,method:"POST",success:function(i){if(i.status==200&&!Ext.isEmpty(i.responseText)){var aw=i.responseText;var av=Ext.decode(aw);if(!Ext.isEmpty(av)){var ay=av["combo"];
var ax=Ext.getCmp("component");if(!Ext.isEmpty(ay)){ax.suspendEvents(true);ax.getStore().loadRawData(ay);E.dataArray=ax.getStore();ax.resumeEvents();}}}}});Ext.getCmp("component").setValue(appConstants.publicJSON["selectedComponent"]);}else{var C="/final/servlet/com.eg.ErRemoteScriptingServlet";var Y=appConstants.publicJSON["metricComboSelected"];
var ag=appConstants.publicJSON["hiddens"]["userID"];var ae="";var b=Ext.getCmp("Report").getValue();var o="";if(b=="Zone"){var M=Ext.getCmp("zone").getValue();ae="&P0=["+b+"]&P1=["+M+"]&P2=["+Y+"]"+"&P3=["+encodeURIComponent(ag)+"]";o="F=getComponentsForTemplate&C=jsrs1"+ae+"&U="+new Date().getTime()+"&fromajax=true";
}else{if(b=="Segment"){var au=Ext.getCmp("segment").getValue();ae="&P0=["+b+"]&P1=["+au+"]&P2=["+Y+"]"+"&P3=["+encodeURIComponent(ag)+"]";o="F=getComponentsForTemplate&C=jsrs1"+ae+"&U="+new Date().getTime()+"&fromajax=true";}else{if(b=="Service"){var ai=Ext.getCmp("service").getValue();ae="&P0=["+b+"]&P1=["+ai+"]&P2=["+Y+"]"+"&P3=["+encodeURIComponent(ag)+"]";
o="F=getComponentsForTemplate&C=jsrs1"+ae+"&U="+new Date().getTime()+"&fromajax=true";}else{ae="&P0=["+Y+"]&P1=["+encodeURIComponent(ag)+"]";o="F=getComponentsForTemplate1&C=jsrs1"+ae+"&U="+new Date().getTime()+"&fromajax=true";}}}if(Y!=undefined&&appConstants.rmComponentType!="null"){o+="&er_compType="+appConstants.rmComponentType;
}Ext.Ajax.request({url:C,params:o,method:"POST",async:false,success:function(i){if(i.status==200&&!Ext.isEmpty(i.responseText)){var aw=i.responseText;var av=Ext.decode(aw);if(!Ext.isEmpty(av)){var ay=Ext.getCmp("component");var ax=av["combo"];ay.suspendEvents(true);ay.getStore().loadRawData(ax);ay.resumeEvents();
}}}});ae="&P0=["+Y+"]";o="F=getTestForTemplate&C=jsrs1"+ae+"&U="+new Date().getTime()+"&fromajax=true";Ext.Ajax.request({url:C,params:o,async:false,success:function(av){if(av.status==200&&!Ext.isEmpty(av.responseText)){var ax=av.responseText;var aw=Ext.decode(ax);if(!Ext.isEmpty(aw)){var ay=aw["values"];
ay=JSON.stringify(ay);var i=appConstants.testVal;if(!Ext.isEmpty(ay)){if(typeof ay!="undefined"){appConstants.testVal=ay.substring(0,ay.indexOf(":"));appConstants.testVal=appConstants.testVal.substring(2);if(i!=""&&i!=appConstants.testVal){hasMultipleTest=true;}appConstants.mapTestVal=ay.substring(ay.indexOf(":")+1);
appConstants.mapTestVal=appConstants.mapTestVal.substring(0,appConstants.mapTestVal.lastIndexOf('"'));}}}}}});ae="&P0=["+Y+"]";o="F=getMeasuresForTemplate&C=jsrs1"+ae+"&U="+new Date().getTime()+"&fromajax=true";Ext.Ajax.request({url:C,params:o,async:false,success:function(i){if(i.status==200&&!Ext.isEmpty(i.responseText)){var aw=i.responseText;
var av=Ext.decode(aw);if(!Ext.isEmpty(av)){var ax=av["values"];ax=JSON.stringify(ax);if(!Ext.isEmpty(ax)){if(typeof ax!="undefined"){appConstants.measureVal=ax.substring(0,ax.indexOf(":"));appConstants.appConstants.measureVal=appConstants.measureVal.substring(2);appConstants.mapMeasureVal=ax.substring(ax.indexOf(":")+1);
appConstants.mapMeasureVal=appConstants.mapMeasureVal.substring(0,appConstants.mapMeasureVal.lastIndexOf('"'));}}}}}});Ext.getCmp("component").setValue(appConstants.publicJSON["selectedComponent"]);E.selectComponents(Ext.getCmp("component"));}if(!Ext.isEmpty(V["infosSelected"])){Ext.getCmp("Descriptor").setValue(V["infosSelected"]);
}var f=R.findField("er_timeline");var N=V["timelineCombo"];if(!Ext.isEmpty(N)){var Z=V["selectedTimeline"];f.suspendEvents(true);f.getStore().loadRawData(N);if(!Ext.isEmpty(Z)){f.setValue(Z);}f.resumeEvents();}var ac=R.findField("er_stdate");var W=V["startDate"];if(!Ext.isEmpty(W)){ac.suspendEvents(true);
ac.setValue(V["startDateForDisplay"]);ac.dataArray=W;ac.resumeEvents();}var k=R.findField("er_enddate");var af=V["endDate"];if(!Ext.isEmpty(af)){k.suspendEvents(true);k.setValue(V["endDateForDisplay"]);k.dataArray=af;k.resumeEvents();}var t=R.findField("er_sthr");var ak=V["startHour"];if(!Ext.isEmpty(ak)){t.suspendEvents(true);
t.setValue(V["startHourForDisplay"]);t.dataArray=ak;t.resumeEvents();}var e=R.findField("er_endhr");var l=V["endHour"];if(!Ext.isEmpty(l)){e.suspendEvents(true);e.setValue(V["endHourForDisplay"]);e.dataArray=l;e.resumeEvents();}var d=V["selectedGraphMode"];var H=R.findField("er_mode");if(!Ext.isEmpty(d)){H.suspendEvents(true);
H.setValue(d);H.resumeEvents();}stmin=V.startMinForDisplay;enmin=V.endMinForDisplay;mgr_stmin=V.startmin;mgr_enmin=V.endmin;}var p=Ext.getCmp("configdatas");var ap=appConstants.publicJSON["combination"];var y=Ext.getCmp("submit");var am=appConstants.publicJSON["hiddens"];var aq=am["fromScheduleModify"];
var J=am["fromFavoriteModify"];if((aq!=null&&aq=="Yes")||(J!=null&&J=="Yes")){var y=Ext.getCmp("save");y.setText(appConstants.publicJSON.screenLabels["reporter.common.SAVE"]);}else{y.setText(submitValue);}y.show();if(!Ext.isEmpty(appConstants.isSubmit)&&appConstants.isSubmit=="true"&&(aq==null||aq=="No")){var z=V["showGraphTypeSelected"];
if(isSettingsEnabled){z=settingsForm.findField("graphtype").getValue();}if(appConstants.isshowLegend=="true"||appConstants.isshowLegend==true){Ext.getCmp("showLegend").setValue(true);}this.loadCharts(V,z);}else{if(appConstants.isshowLegend=="true"||appConstants.isshowLegend==true){Ext.getCmp("showLegend").setValue(true);
}}if(!Ext.isEmpty(appConstants.publicJSON["gridValues"])){var ah=appConstants.publicJSON["gridValues"];var p=Ext.getCmp("configdatas");var ad=p.dataArray;p.getStore().removeAll();ad.splice(0,ad.length);for(var aj=0;aj<ah.length;aj++){ad.push(ah[aj]);}var P=p.activePage;var at=p.getStore().totalCount;
var U=p.getStore().pageSize;if(Math.round(at/U)<P){p.activePage=Math.round(at/U);}if(p.activePage<=0){p.activePage=1;}p.getStore().loadPage(p.activePage);if(ah.length>0){Ext.getCmp("my_formouter").show();}}if(appConstants.isForceSubmit=="true"){this.beforeFormSubmit();appConstants.isForceSubmit="false";
}if(!hideBackButton){Ext.getCmp("defineConfig").add({xtype:"hidden",id:"ID",name:"ID",value:appConstants.publicJSON["ID"]});}this.autoCompareTest();},setValueWithOptionInList:function(a,d,c,b){if(!Ext.isEmpty(c)){a.findField(d).getStore().loadRawData(c);}a.findField(d).suspendEvents(false);if(!Ext.isEmpty(b)){a.findField(d).setValue(b);
}else{a.findField(d).setValue(c[0].valueField);}a.findField(d).resumeEvents();},changeZone:function(){var b=Ext.getCmp("popup").getForm();var e=b.findField("zone").getValue();if(e!="-1"){this.changeCriteria();}else{var g=b.findField("component");var f=b.findField("Descriptor");var c=b.findField("test");
var d=b.findField("measure");var a=b.findField("metric");this.insertNotApplicable(g);this.insertNotApplicable(f);this.insertNotApplicable(c);this.insertNotApplicable(d);this.insertNotApplicable(a);}},changeSegment:function(){var b=Ext.getCmp("popup").getForm();var c=b.findField("segment").getValue();
if(c!="-1"){this.changeCriteria();}else{var g=b.findField("component");var f=b.findField("Descriptor");var d=b.findField("test");var e=b.findField("measure");var a=b.findField("metric");this.insertNotApplicable(g);this.insertNotApplicable(f);this.insertNotApplicable(d);this.insertNotApplicable(e);this.insertNotApplicable(a);
}},changeService:function(){var b=Ext.getCmp("popup").getForm();var g=b.findField("service").getValue();if(g!="-1"){this.changeCriteria();}else{var f=b.findField("component");var e=b.findField("Descriptor");var c=b.findField("test");var d=b.findField("measure");var a=b.findField("metric");this.insertNotApplicable(f);
this.insertNotApplicable(e);this.insertNotApplicable(c);this.insertNotApplicable(d);this.insertNotApplicable(a);}},changeMetric:function(d){var f="/final/servlet/com.eg.ErRemoteScriptingServlet";var h=Ext.getCmp("metric").getValue();var a=appConstants.publicJSON.hiddens["us_id"];var g="";var c=Ext.getCmp("Report").getValue();
var b="";if(c=="Zone"){var j=Ext.getCmp("zone").getValue();g="&P0=["+c+"]&P1=["+j+"]&P2=["+h+"]"+"&P3=["+encodeURIComponent(a)+"]";b="F=getComponentsForTemplate&C=jsrs1"+g+"&U="+new Date().getTime()+"&fromajax=true";}else{if(c=="Segment"){var i=Ext.getCmp("segment").getValue();g="&P0=["+c+"]&P1=["+i+"]&P2=["+h+"]"+"&P3=["+encodeURIComponent(a)+"]";
b="F=getComponentsForTemplate&C=jsrs1"+g+"&U="+new Date().getTime()+"&fromajax=true";}else{if(c=="Service"){var e=Ext.getCmp("service").getValue();g="&P0=["+c+"]&P1=["+e+"]&P2=["+h+"]"+"&P3=["+encodeURIComponent(a)+"]";b="F=getComponentsForTemplate&C=jsrs1"+g+"&U="+new Date().getTime()+"&fromajax=true";
}else{g="&P0=["+h+"]&P1=["+encodeURIComponent(a)+"]";b="F=getComponentsForTemplate1&C=jsrs1"+g+"&U="+new Date().getTime()+"&fromajax=true";}}}if(appConstants.rmComponentType!="null"){b+="&er_compType="+appConstants.rmComponentType;}if(!Ext.isEmpty(d)){Ext.Ajax.request({url:f,params:b,method:"POST",async:false,success:function(k){if(k.status==200&&!Ext.isEmpty(k.responseText)){var m=k.responseText;
var l=Ext.decode(m);if(!Ext.isEmpty(l)){var o=Ext.getCmp("component");var n=l["combo"];appConstants.rawDataForComponents=n;o.suspendEvents(true);o.getStore().loadRawData(n);o.resumeEvents();}}}});g="&P0=["+h+"]";b="F=getTestForTemplate&C=jsrs1"+g+"&U="+new Date().getTime()+"&fromajax=true";Ext.Ajax.request({url:f,params:b,async:false,success:function(l){if(l.status==200&&!Ext.isEmpty(l.responseText)){var n=l.responseText;
var m=Ext.decode(n);if(!Ext.isEmpty(m)){var o=m["values"];o=JSON.stringify(o);if(!Ext.isEmpty(o)){if(typeof o!="undefined"){var k=appConstants.testVal;appConstants.testVal=o.substring(0,o.indexOf(":"));appConstants.testVal=appConstants.testVal.substring(2);if(k!=""&&k!=appConstants.testVal){hasMultipleTest=true;
}appConstants.mapTestVal=o.substring(o.indexOf(":")+1);appConstants.mapTestVal=appConstants.mapTestVal.substring(0,appConstants.mapTestVal.lastIndexOf('"'));}}}}}});g="&P0=["+h+"]";b="F=getMeasuresForTemplate&C=jsrs1"+g+"&U="+new Date().getTime()+"&fromajax=true";Ext.Ajax.request({url:f,params:b,async:false,success:function(k){if(k.status==200&&!Ext.isEmpty(k.responseText)){var m=k.responseText;
var l=Ext.decode(m);if(!Ext.isEmpty(l)){var n=l["values"];n=JSON.stringify(n);if(!Ext.isEmpty(n)){if(typeof n!="undefined"){appConstants.measureVal=n.substring(0,n.indexOf(":"));appConstants.measureVal=appConstants.measureVal.substring(2);appConstants.mapMeasureVal=n.substring(n.indexOf(":")+1);appConstants.mapMeasureVal=appConstants.mapMeasureVal.substring(0,appConstants.mapMeasureVal.lastIndexOf('"'));
}}}}}});}},changeTest:function(e){var m=this;var h="/final/servlet/com.eg.ErRemoteScriptingServlet";var k=Ext.getCmp("test").getValue();var d=Ext.getCmp("Report").getValue();var j="";var a="no";var i="";var l="";var n="";if(k!="-1"&&!Ext.isEmpty(e)){if(d=="Component"){i="&P0=["+k+"]";n="getComponentsForTest1";
i="&P0=["+encodeURIComponent(k)+"]&P1=["+encodeURIComponent(b)+"]";}else{n="getComponentsForTest";if(d=="Zone"){j=Ext.getCmp("zone").getValue();a=Ext.getCmp("subzone").getValue().toLowerCase();i="&P0=["+d+"]&P1=["+j+"]"+"&P2=["+a+"]&P3=["+k+"]";}else{if(d=="Segment"){j=Ext.getCmp("segment").getValue();
i="&P0=["+d+"]&P1=["+j+"]"+"&P2=[no]&P3=["+k+"]";}else{if(d=="Service"){j=Ext.getCmp("service").getValue();i="&P0=["+d+"]&P1=["+j+"]"+"&P2=[no]&P3=["+k+"]";}}}}var c="F=getMeasuresForTest1&C=jsrs1&P0=["+k+"]&U=1360067356100817&fromajax=true";if(appConstants.rmComponentType!="null"){c+="&er_compType="+appConstants.rmComponentType;
}if(!Ext.isEmpty(e)){Ext.Ajax.request({url:h,params:c,async:false,method:"POST",success:function(p){if(p.status==200&&!Ext.isEmpty(p.responseText)){var s=p.responseText;var q=Ext.decode(s);if(!Ext.isEmpty(q)){var t=q["combo"];var r=Ext.getCmp("measure");if(!Ext.isEmpty(t)){r.suspendEvents(true);r.getStore().loadRawData(t);
r.getStore().insert(0,{displayField:appConstants.mapping_measure,valueField:"-1"});r.setValue("-1");r.resumeEvents();}else{m.insertNotApplicable(r);}}}}});}var b=appConstants.publicJSON.hiddens["us_id"];var c="F="+n+"&C=jsrs1"+i+"&U=1360217653961521&fromajax=true";if(appConstants.rmComponentType!="null"){c+="&er_compType="+appConstants.rmComponentType;
}Ext.Ajax.request({url:h,params:c,async:false,method:"POST",success:function(p){if(p.status==200&&!Ext.isEmpty(p.responseText)){var r=p.responseText;var q=Ext.decode(r);if(!Ext.isEmpty(q)){var t=q["combo"];var s=Ext.getCmp("component");if(!Ext.isEmpty(t)){appConstants.rawDataForComponents=t;s.suspendEvents(true);
s.getStore().loadRawData(t);m.dataArray=s.getStore();s.resumeEvents();}}}}});}else{var g=Ext.getCmp("component");var o=Ext.getCmp("Descriptor");var f=Ext.getCmp("measure");m.insertNotApplicable(g);m.insertNotApplicable(f);}var o=Ext.getCmp("Descriptor");this.insertNotApplicable(o);},changeTimeline:function(y){Ext.getCmp("resultPanel").hide();
var m=this.getDefineconfiguration().getForm();var q=Ext.getCmp("configsettings").getForm();var i=Ext.getCmp("er_timeline").getValue();var k;if(isSettingsEnabled){var q=Ext.getCmp("configsettings").getForm();k=(q.findField("showdata").getValue()=="Trend")?"Yes":"No";}else{var d=appConstants.publicJSON;
k=(d["showDataSelected"]=="Trend")?"Yes":"No";}if(k!=undefined&&k=="Yes"){var f=Ext.getCmp("CommonMaximum");if(f!=undefined){f.getEl().setStyle({"margin-top":"10px"});}var n=Ext.getCmp("autoMaximum");if(n!=undefined){n.getEl().setStyle({"margin-top":"10px"});}}else{var f=Ext.getCmp("CommonMaximum");if(f!=undefined){f.getEl().setStyle({"margin-top":"0px"});
}var n=Ext.getCmp("autoMaximum");if(n!=undefined){n.getEl().setStyle({"margin-top":"0px"});}}var x="true";if(x=="true"){var h="F=gettimeline&U=123444&C=jsrs1&P0=["+k+"]";Ext.Ajax.request({url:"/final/servlet/com.eg.ErRemoteScriptingServlet",params:h,scope:this,async:true,success:function(E){var H=E.responseText;
var G=Ext.decode(H);var C=G.combo;var B=m.findField("er_timeline");B.getStore().removeAll();B.getStore().loadRawData(G.combo);var D=false;for(var F=0;F<C.length;F++){if(C[F].valueField==i){D=true;}}if(D){B.setValue(i);}else{B.setValue("1 day");}}});}var p=m.findField("er_stdate");var w=m.findField("er_sthr");
var u=m.findField("er_enddate");var v=m.findField("er_endhr");var l=m.findField("er_timeline").getValue();if(l=="Any"){p.setDisabled(false);w.setDisabled(false);u.setDisabled(false);v.setDisabled(false);}else{p.setDisabled(true);w.setDisabled(true);u.setDisabled(true);v.setDisabled(true);}var c=q.findField("showdata").getValue();
var o=m.findField("er_timeline");var z=o.getValue();var A=m.findField("er_stdate");var r=m.findField("er_enddate");var j=m.findField("er_sthr");var t=m.findField("er_endhr");var b=appConstants.publicJSON.hiddens["inidate"];var a=Ext.Date.dateFormat(A.getValue(),mgrDateFormat);var g=Ext.Date.dateFormat(r.getValue(),mgrDateFormat);
if(c=="Trend"&&z.indexOf("hour")>-1){z="1 day";}var e="";var f=Ext.getCmp("duration");var s=Ext.getCmp("gtype");if(k=="No"){if(f!=undefined&&s!=undefined){f.hide();s.hide();}isTrend=false;e="F=getTime&U=123444&C=jsrs1&P0=["+z+"]&P1=["+a+"]&P2=["+g+"]&P3=["+j.getValue()+"]&P4=["+t.getValue()+"]&P5=["+b+"]";
}else{if(f!=undefined&&s!=undefined){f.show();s.show();}isTrend=true;if(z.indexOf("hour")>-1){z="1 day";}if(z=="Any"){e="F=getTime&U=123444&C=jsrs1&P0=["+z+"]&P1=["+a+"]&P2=["+g+"]&P3=["+j.getValue()+"]&P4=["+t.getValue()+"]&P5=["+b+"]";}else{e="F=getTrendTime&U=123444&C=jsrs1&P0=["+z+"]&P1=["+a+"]&P2=["+g+"]&P3=["+j.getValue()+"]&P4=["+t.getValue()+"]&P5=["+mgr_stmin+"]&P6=["+mgr_enmin+"]&P7=["+b+"]";
}}var m=this.getDefineconfiguration().getForm();Ext.Ajax.request({url:"/final/servlet/com.eg.ErRemoteScriptingServlet",params:e,scope:this,async:true,success:function(C){var E=C.responseText;var D=Ext.decode(E);var B=D.timeline;Ext.getCmp("er_stdate").dataArray=B[0];Ext.getCmp("er_enddate").dataArray=B[1];
Ext.getCmp("er_sthr").dataArray=B[2];Ext.getCmp("er_endhr").dataArray=B[3];mgr_stmin=B[4];mgr_enmin=B[5];Ext.getCmp("er_stdate").setValue(B[6]);Ext.getCmp("er_enddate").setValue(B[7]);Ext.getCmp("er_sthr").setValue(B[8]);Ext.getCmp("er_endhr").setValue(B[9]);stmin=B[10];enmin=B[11];}});},changeTrendTimeline:function(t){Ext.getCmp("resultPanel").hide();
var k=this.getDefineconfiguration().getForm();var n=Ext.getCmp("configsettings").getForm();var g=Ext.getCmp("er_timeline").getValue();var i;if(isSettingsEnabled){var n=Ext.getCmp("configsettings").getForm();i=n.findField("duration").getValue();}else{var c=appConstants.publicJSON;i=c["durationcomboSelected"];
}var f="F=getTrendTimeline&U=123444&C=jsrs1&P0=["+i+"]";Ext.Ajax.request({url:"/final/servlet/com.eg.ErRemoteScriptingServlet",params:f,scope:this,async:false,success:function(y){var A=y.responseText;var z=Ext.decode(A);var x=z.combo;var w=k.findField("er_timeline");w.getStore().removeAll();w.getStore().loadRawData(z.combo);
if(i=="D"){w.setValue("1 week");}else{if(i=="M"){w.setValue("3 months");}else{w.setValue("1 day");}}}});var m=k.findField("er_stdate");var s=k.findField("er_sthr");var q=k.findField("er_enddate");var r=k.findField("er_endhr");var j=k.findField("er_timeline").getValue();if(j=="Any"){m.setDisabled(false);
s.setDisabled(false);q.setDisabled(false);r.setDisabled(false);}else{m.setDisabled(true);s.setDisabled(true);q.setDisabled(true);r.setDisabled(true);}var l=k.findField("er_timeline");var u=l.getValue();var v=k.findField("er_stdate");var o=k.findField("er_enddate");var h=k.findField("er_sthr");var p=k.findField("er_endhr");
var b=appConstants.publicJSON.hiddens["inidate"];var a=Ext.Date.dateFormat(v.getValue(),mgrDateFormat);var e=Ext.Date.dateFormat(o.getValue(),mgrDateFormat);var d="";isTrend=true;if(u.indexOf("hour")>-1){u="1 day";}if(u=="Any"){d="F=getTime&U=123444&C=jsrs1&P0=["+u+"]&P1=["+a+"]&P2=["+e+"]&P3=["+h.getValue()+"]&P4=["+p.getValue()+"]&P5=["+b+"]";
}else{d="F=getTrendTime&U=123444&C=jsrs1&P0=["+u+"]&P1=["+a+"]&P2=["+e+"]&P3=["+h.getValue()+"]&P4=["+p.getValue()+"]&P5=["+mgr_stmin+"]&P6=["+mgr_enmin+"]&P7=["+b+"]";}var k=this.getDefineconfiguration().getForm();Ext.Ajax.request({url:"/final/servlet/com.eg.ErRemoteScriptingServlet",params:d,scope:this,async:true,success:function(x){var z=x.responseText;
var y=Ext.decode(z);var w=y.timeline;Ext.getCmp("er_stdate").dataArray=w[0];Ext.getCmp("er_enddate").dataArray=w[1];Ext.getCmp("er_sthr").dataArray=w[2];Ext.getCmp("er_endhr").dataArray=w[3];mgr_stmin=w[4];mgr_enmin=w[5];Ext.getCmp("er_stdate").setValue(w[6]);Ext.getCmp("er_enddate").setValue(w[7]);Ext.getCmp("er_sthr").setValue(w[8]);
Ext.getCmp("er_endhr").setValue(w[9]);stmin=w[10];enmin=w[11];}});},changeAutoMaximum:function(){var b=Ext.getCmp("autoMaximum").getValue();var a=Ext.getCmp("maxValue");if(b=="No"){a.setValue("");a.show();}else{a.hide();}},changeCommonMaximum:function(){var c=Ext.getCmp("configsettings").getForm();var f=c.findField("CommonMaximum").getValue();
var d=c.findField("autoMaximum");var a=Ext.getCmp("autoMaximum").getValue();var e=Ext.getCmp("maxValue");var g=Ext.getCmp("showdata").getValue();if(f=="Yes"){d.show();if(d.getValue()=="No"){e.show();}var b=Ext.getCmp("autoMaximum");if(b!=undefined&&g=="Detailed"){b.getEl().setStyle({"margin-top":"0px"});
}}else{d.hide();e.hide();}},selectReportFor:function(s){var u=Ext.getCmp("popup").getForm();var m=this.getDefineconfiguration().getForm();var k=u.findField("Report").getValue();var l=u.findField("zone");var g=u.findField("subzone");var e=u.findField("service");var p=u.findField("segment");var a=null;
if(k=="Zone"){a=k;l.suspendEvents(true);l.setFieldLabel(appConstants.defaultLabels["zone"]);l.resumeEvents();g.suspendEvents(true);g.setFieldLabel(appConstants.defaultLabels["subzone"]);l.show();if(!Ext.isEmpty(appConstants.publicJSON)){var v=appConstants.publicJSON["subzone"];var b=appConstants.publicJSON["subszoneSelected"];
if(!Ext.isEmpty(v)){g.getStore().loadRawData(v);if(!Ext.isEmpty(b)){g.setValue(b);}else{g.setValue(v[0].valueField);}g.resumeEvents();}}g.show();e.hide();p.hide();}else{if(k=="Segment"){a=k;p.suspendEvents(true);p.setFieldLabel(appConstants.defaultLabels["segment"]);p.resumeEvents();l.hide();g.hide();
e.hide();p.show();}else{if(k=="Service"){a=k;e.suspendEvents(true);e.setFieldLabel(appConstants.defaultLabels["service"]);e.resumeEvents();l.hide();g.hide();e.show();p.hide();}else{l.hide();g.hide();e.hide();p.hide();this.changeCriteria();}}}if(!Ext.isEmpty(s)){var c="";var h=u.findField("criteria").getValue();
c=(h=="Test")?"no":"yes";var t=m.findField("er_timeline").getValue();var i=appConstants.publicJSON["showGraphTypeSelected"];if(isSettingsEnabled){var n=Ext.getCmp("configsettings").getForm();var i=n.findField("graphtype").getValue();}var r="er_gtype="+appConstants.er_gtype+"&er_timeline="+encodeURIComponent(t)+"&er_bound=Fixed&er_graphtype="+encodeURIComponent(i)+"&er_dataFrom="+encodeURIComponent(k)+"&er_templateEnable="+c+"&er_measure=-1&er_test=-1"+"&er_service="+a;
Ext.Ajax.request({url:"/final/reporter/ErCompareTestJSON.jsp",params:r,method:"POST",success:function(z){if(z.status==200&&!Ext.isEmpty(z.responseText)){var x=z.responseText;var B=Ext.decode(x);if(!Ext.isEmpty(B)){if(k=="Zone"){var y=B["Zone"];l.suspendEvents(true);l.getStore().clearFilter(true);l.getStore().loadRawData(y);
l.setValue("-1");l.resumeEvents();var A=B["subzone"];var D=B["subszoneSelected"];if(!Ext.isEmpty(A)){var C=Ext.getCmp("subzone");C.suspendEvents(true);C.getStore().loadRawData(A);if(!Ext.isEmpty(D)){C.setValue(D);}else{C.setValue(A[0].valueField);}C.resumeEvents();}}else{if(k=="Segment"){var E=B["Segment"];
p.suspendEvents(true);p.getStore().clearFilter(true);p.getStore().loadRawData(E);p.setValue("-1");p.resumeEvents();}else{if(k=="Service"){var w=B["Service"];e.suspendEvents(true);e.getStore().clearFilter(true);e.getStore().loadRawData(w);e.setValue("-1");e.resumeEvents();}}}}}}});var j=u.findField("component");
var d=u.findField("Descriptor");var q=u.findField("test");var f=u.findField("measure");var o=u.findField("metric");this.insertNotApplicable(j);this.insertNotApplicable(d);this.insertNotApplicable(q);this.insertNotApplicable(f);this.insertNotApplicable(o);}else{}Ext.getCmp("configdatas").getStore().removeAll();
},changeCriteria:function(g){Ext.getCmp("configdatas").getStore().removeAll();var q=Ext.getCmp("popup").getForm();var h=q.findField("criteria");var p=q.findField("Descriptor");var n=false;if(!Ext.isEmpty(h)){var l="/final/servlet/com.eg.ErRemoteScriptingServlet";var a="";var m=q.findField("Report").getValue();
if(m=="Component"){a="&P0=[Component]&P1=[Component]&P2=[no]";n=true;}else{if(m=="Zone"){var r=q.findField("zone").getValue();var k=q.findField("subzone").getValue();if(r=="-1"){n=false;}else{n=true;}a="&P0=["+m+"]&P1=["+r+"]&P2=["+k+"]";}else{if(m=="Segment"){var d=q.findField("segment").getValue();
a="&P0=["+m+"]&P1=["+d+"]&P2=[no]";if(d=="-1"){n=false;}else{n=true;}}else{if(m=="Service"){var i=q.findField("service").getValue();a="&P0=["+m+"]&P1=["+i+"]&P2=[no]";if(i=="-1"){n=false;}else{n=true;}}}}}if(n){if(h.getValue()=="Test"){var o=q.findField("test");var c=q.findField("measure");if(!Ext.isEmpty(appConstants.publicJSON.screenLabels["reporter.comparison.Test"])){o.setFieldLabel(appConstants.publicJSON.screenLabels["reporter.comparison.Test"]);
}if(!Ext.isEmpty(appConstants.publicJSON.screenLabels["reporter.comparison.Measure"])){c.setFieldLabel(appConstants.publicJSON.screenLabels["reporter.comparison.Measure"]);}o.show();c.show();var j=q.findField("metric");j.hide();var e="F=getTestsForSite&C=jsrs1"+a+"&U=1360067356100817&fromajax=true";if(appConstants.rmComponentType!="null"){e+="&er_compType="+appConstants.rmComponentType;
}Ext.Ajax.request({url:l,params:e,scope:this,success:function(s){var w=s.responseText;var v=Ext.decode(w);if(!Ext.isEmpty(v)){var u=v["combo"];var t=q.findField("test");t.suspendEvents(true);t.getStore().clearFilter(true);t.getStore().loadRawData(u);var x=t.getStore();x.insert(0,{displayField:appConstants.mapping_test,valueField:"-1"});
t.setValue("-1");t.resumeEvents();}}});var c=q.findField("measure");this.insertNotApplicable(c);}else{var o=q.findField("test");var c=q.findField("measure");var j=q.findField("metric");if(!Ext.isEmpty(appConstants.publicJSON.screenLabels["reporter.comparison.Metric"])){j.setFieldLabel(appConstants.publicJSON.screenLabels["reporter.comparison.Metric"]);
}var e="F=getTemplateForSite&C=jsrs1"+a+"&U=1360127833994872&fromajax=true";if(appConstants.rmComponentType!="null"){e+="&er_compType="+appConstants.rmComponentType;}Ext.Ajax.request({url:l,params:e,scope:this,success:function(t){var v=t.responseText;var u=Ext.decode(v);if(!Ext.isEmpty(u)){var s=q.findField("metric");
s.suspendEvents(true);var w=u["combo"];s.getStore().clearFilter(true);s.getStore().loadRawData(w);s.getStore().insert(0,{displayField:appConstants.mapping_metric,valueField:"-1"});s.setValue("-1");s.resumeEvents();}}});j.show();o.hide();c.hide();}}var o=q.findField("test");var c=q.findField("measure");
var j=q.findField("metric");var f=q.findField("component");var b=q.findField("Descriptor");this.insertNotApplicable(o);this.insertNotApplicable(c);this.insertNotApplicable(j);this.insertNotApplicable(f);this.insertNotApplicable(b);}},insertNotApplicable:function(c){if(!Ext.isEmpty(c)){var b=c.getStore();
var a=[];a.push({displayField:appConstants.notApplicabletxt,valueField:"-1"});b.loadRawData(a);c.setValue("-1");if(c.getId()=="Descriptor"){appConstants.rawDataForDescriptor=a;}else{if(c.getId()=="component"){appConstants.rawDataForComponents=a;}}}},getHiddenQueryString:function(){var b=appConstants.publicJSON["hiddens"];
hiddenQStr="";for(var a in b){hiddenQStr+="&"+a+"="+encodeURIComponent(b[a]);}return hiddenQStr;},loadScreenLabels:function(p){if(appConstants.er_RmDispName!=null&&appConstants.er_RmDispName!="null"&&appConstants.er_RmDispName!="undefined"){this.getMain().setTitle(appConstants.er_RmDispName);}else{this.getMain().setTitle(p["reporter.comparison.ComparisonTitle"]);
}var o=this.getDefineconfiguration().getForm();var a=Ext.getCmp("popup").getForm();var l=a.findField("Report");l.setFieldLabel(p["reporter.comparison.Reportfor"]);var c=a.findField("criteria");c.setFieldLabel(p["reporter.comparison.SelectByCriteria"]);var b=a.findField("test");b.setFieldLabel(p["reporter.comparison.Test"]);
var i=a.findField("measure");i.setFieldLabel(p["reporter.comparison.Measure"]);var d=Ext.getCmp("compLabel");d.setText(p["reporter.comparison.Component"]);var m=Ext.getCmp("descLabel");m.setText(p["reporter.comparison.Descriptor"]);var h=Ext.getCmp("addtogrid");h.setText(p["reporter.common.Add"]);var g=o.findField("er_timeline");
var n=o.findField("er_stdate");var q=o.findField("er_enddate");var k=o.findField("er_sthr");var e=o.findField("er_endhr");var f=o.findField("er_mode");var j=Ext.getCmp("submit");},enableOrDisableTools:function(a){for(var b in a){if(!Ext.isEmpty(Ext.getCmp(b))){Ext.getCmp(b).setDisabled(a[b]);}}},hideTools:function(){this.getNewUtilities().loadIcon(true,true,true,true,false,true,true,false,false,false,true);
Ext.getCmp("scheduleTool").setDisabled(false);Ext.getCmp("favoriteTool").setDisabled(false);},sendMail:function(){var a=Ext.widget("sendmail");a.show();},defineConfigurationPOPUP:function(b){if(Ext.get("linkId")){Ext.get("linkId").hide();}var c=Ext.getCmp("defineconfiguration");c.setDisabled(true);var a=Ext.getCmp("selectionDetails");
if(!Ext.isEmpty(a)&&!a.isHidden()){this.toggleForm(a);}Ext.getCmp("popup").show();},addToGrid:function(O){if(Ext.isEmpty(appConstants.erUtils)){appConstants.erUtils=Ext.widget("erutils");}var n=Ext.getCmp("popup").getForm();var u=this;var I=this.getDefineconfigurationpopup().getForm();var i=Ext.getCmp("configdatas");
var y=i.getStore();var x=n.findField("component");var b=n.findField("component").getValue();var F=x.getStore();var p=n.findField("test").getStore();var s=n.findField("test");var L=n.findField("measure");var g=n.findField("metric");var q=n.findField("Descriptor");var e=n.findField("Report").getValue();
var j=n.findField("zone").getValue();var h=n.findField("segment").getValue();var M=n.findField("service").getValue();var H="";var z="";var f="";var E="";var B=q.getValue();var C="";if(Ext.getCmp("descSearchCont").isHidden()){C=n.findField("descSearch_TxtField").getValue();B=C.split(",");}var D=true;if(Ext.getCmp("descSearchCont").isHidden()){var G=n.findField("descSearch_TxtField").getValue();
G=G.split(",");if(G!=null&&G!="undefined"&&G.length>0){for(var K=0;G.length>K;K++){if(G[K].trim()!=""&&G[K].trim().length>0){D=false;}}}}if(Ext.getCmp("descSearchCont").isHidden()&&D){Ext.MessageBox.show({title:"Alert",msg:"Descriptor field is not empty",buttons:Ext.MessageBox.OK,icon:Ext.MessageBox.WARNING});
return false;}if(!multiSelectAllvalidation(B,"")||(B.length>1&&B.indexOf("*")>-1)){Ext.MessageBox.show({title:"Alert",msg:"Individual and aggregate Descriptor cannot be selected simultaneously",buttons:Ext.MessageBox.OK,icon:Ext.MessageBox.WARNING});return false;}var r=Ext.getCmp("criteria").getValue();
var o="";var A="";var l="";var v=true;if(e!="Component"){if(e=="Zone"&&j=="-1"){v=false;}else{if(e=="Segment"&&h=="-1"){v=false;}else{if(e=="Service"&&M=="-1"){v=false;}}}}if(r=="Test"){if(s.getValue()=="-1"){v=false;}else{if(L.getValue()=="-1"){v=false;}}}else{if(g.getValue=="-1"){v=false;}}if(Ext.isEmpty(b)||b=="-1"){v=false;
}if(!v){Ext.MessageBox.show({title:"Alert",msg:appConstants.requiredParamsMsg,buttons:Ext.MessageBox.OK,icon:Ext.MessageBox.WARNING});return;}if((Ext.Array.contains(b,"All")||Ext.Array.contains(b,"all"))&&b.length>1){Ext.MessageBox.show({title:alert_text,msg:all_individual_alert,buttons:Ext.MessageBox.OK,icon:Ext.MessageBox.WARNING});
return;}if(B.length==1&&(B[0]=="-1"||B[0]==""||B[0]=="*")){B="-";}var t="/final/servlet/com.eg.ErRemoteScriptingServlet";var d="addToGrid=yes";d+="&componentVal="+b;B=appConstants.erUtils.specialCharEncode(B);d+="&descName="+B;d+="&getCriteria="+r;d+="&testNameDisp="+appConstants.erUtils.specialCharEncode(Ext.String.htmlEncode(s.getRawValue()));
d+="&measureNameDisp="+appConstants.erUtils.specialCharEncode(Ext.String.htmlEncode(L.getRawValue()));d+="&testNameVal="+s.getValue();d+="&measureNameVal="+L.getValue();d+="&metricObj_measureName="+g.getRawValue();d+="&appTestVal="+appConstants.testVal;d+="&appMeasureVal="+appConstants.measureVal;if(y.getCount()>0){var a=new Array();
for(var K=0;K<i.dataArray.length;K++){var w=i.dataArray[K];for(var N in w){var m=w[N];if(m.indexOf("&")>-1){m=appConstants.erUtils.specialCharEncode(m);w[N]=m;}}a.push(w);}d+="&gridStore="+Ext.encode(a);}var J=new Ext.LoadMask(Ext.getBody(),{msg:"Loading..."});J.show();Ext.Ajax.request({url:t,params:d,async:false,method:"POST",success:function(P){J.hide();
var c=P.responseText;var X=Ext.decode(c);appConstants.hasMultipleTests=false;if(!Ext.isEmpty(X)){var Q=X["status"];var V=X["hasMultipleTests"];var Y=X["gridData"];if(Q=="success"){Ext.getCmp("my_formouter").show();if(V=="true"){appConstants.hasMultipleTests=true;}if(appConstants.hasMultipleTests){if(!isSettingsEnabled){u.showConfigDropdown();
}var U=appConstants.publicJSON["graphTypeComboForMultiple"];if(!Ext.isEmpty(U)){Ext.getCmp("graphtype").getStore().loadRawData(U);Ext.getCmp("graphtype").setValue(U[0].valueField);}}else{if(!isSettingsEnabled){u.showConfigDropdown();}var S=appConstants.publicJSON["graphTypeCombo"];if(!Ext.isEmpty(S)){Ext.getCmp("graphtype").getStore().loadRawData(S);
}}var T=i.dataArray;i.getStore().removeAll();T.splice(0,T.length);for(var R=0;R<Y.length;R++){T.push(Y[R]);}var k=i.activePage;var Z=i.getStore().totalCount;var W=i.getStore().pageSize;if(Math.round(Z/W)<k){i.activePage=Math.round(Z/W);}if(i.activePage<=0){i.activePage=1;}i.getStore().loadPage(i.activePage);
}else{Ext.MessageBox.show({title:"Alert",msg:appConstants.currentSelMsg,buttons:Ext.MessageBox.OK,icon:Ext.MessageBox.WARNING});return;}}}});},autoCompareTest:function(){if(appConstants.isCompareTest){var d=Ext.getCmp("configdatas");var f=d.getStore();var o=appConstants.compareATestHiddens;var i=o.split(",");
var j=d.dataArray;for(var g=0;g<i.length;g++){var q=i[g];var a=q.split("|");var l="-";if(a.length>2){l=a[2];}var c=a[0].replace("Test","");var p=a[1].replace("_"," ");var r=appConstants.compareATestName;var m=r.split(",");var h=appConstants.compareATestHiddenComParm;var b=h.split(",");var e=appConstants.compareATestType;
var n=e.split(",");j.push(q);}Ext.getCmp("my_formouter").show();d.getSelectionModel().selectAll();d.doLayout();Ext.getCmp("submit").show();this.formSubmit();}},expandMe:function(a){if(Ext.isEmpty(appConstants.erUtils)){appConstants.erUtils=Ext.widget("erutils");}appConstants.erUtils.expandMultiComboButton(Ext.getCmp("component"),Ext.getCmp("compLabel").text,a);
},expandMe2:function(a){if(Ext.isEmpty(appConstants.erUtils)){appConstants.erUtils=Ext.widget("erutils");}appConstants.erUtils.expandMultiComboButton(Ext.getCmp("Descriptor"),Ext.getCmp("descLabel").text,a);}});