Ext.define("thinclientsessionreports.controller.ThinclientSessionReports",{extend:"Ext.app.Controller",gridColStateParam:"ASC",gridColIndexParam:-1,views:["Main"],refs:[{selector:"main",ref:"main"},{selector:"newUtilities",ref:"newUtilities"},{selector:"thinclientsessionreportsform",ref:"thinclientsessionreportsform"},{selector:"thinclientsessionsettings",ref:"thinclientsessionsettings"},{selector:"nomeasurepanel",ref:"nomeasurepanel"},{selector:"backGroundPanel",ref:"backGroundPanel"},{selector:"ReporterSettings",ref:"ReporterSettings"}],init:function(){this.control({"newUtilities":{"afterrender":this.loadTools},"main":{"boxready":this.afterMainRender},"thinclientsessionsettings":{"afterrender":this.loadSettingsElements},"thinclientsessionreportsform":{"afterrender":this.loadMainElements},"newUtilities > #printTool > button":{"click":this.printFile},"newUtilities > #saveTool > button":{"click":this.saveReportAsPDF},"newUtilities > #mailTool > button":{"click":this.sendMail},"newUtilities > #csvTool > button":{"click":this.saveCsv},"newUtilities > #favoriteTool > button":{"click":this.saveFavorite},"newUtilities > #scheduleTool > button":{"click":this.saveSchedule},'timeline combo[name="er_mode"]':{"select":this.changeEr_mode},'thinclientsessionreportsform combo[name="zoneComboBox"]':{"select":this.zoneOnChange},'thinclientsessionreportsform combo[name="compTypeComboBox"]':{"select":this.compTypeOnChange},'thinclientsessionreportsform combo[name="reportTypeComboBox"]':{"select":this.reportTypeOnChange},'thinclientsessionsettings combo[name="reportGeneration"]':{"select":this.reportGenChange},'thinclientsessionsettings combo[name="showDataComboBox"]':{"select":this.changeTrend},'thinclientsessionsettings button[id="moreOptionCloseId"]':{"click":this.validateAndCloseSettings},'thinclientsessionsettings button[id="submitViaSetting"]':{"click":this.closeAndSubmitSettings},'thinclientsessionreportsform button[name="submit"]':{"click":this.showResult},'thinclientsessionreportsform button[name="save"]':{"click":this.goTo},'thinclientsessionreportsform button[id="panelinsidetoggle"]':{"click":this.toggleForm},'thinclientsessionreportsform combo[id="er_option"]':{"select":this.onSelectAnalysisBy},'thinclientsessionreportsform combo[id="er_site"]':{"select":this.er_siteOnChange}});
},onSelectAnalysisBy:function(d){var c=d.getValue();var a=this.getThinclientsessionreportsform().getForm();var b="er_option="+c+"&er_type="+Ext.getCmp("reportTypeComboBox").getValue()+"&thinClientSessionAction=zoneOnChange";Ext.Ajax.request({url:"/final/reporter/ErCtxSessionReportJson.jsp",params:b,method:"GET",success:function(f){var l=Ext.decode(f.responseText);
var m;m=Ext.getCmp("compTypeComboBox");m.getStore().clearFilter(true);m.getStore().loadRawData(l["compTypeJson"]);m.setValue(l.pageParams["selectedCompType"]);var e=Ext.getCmp("reportTypeComboBox").getValue();if(e=="Yes"){var g=a.findField("measureComboBox");g.getStore().clearFilter(true);g.getStore().loadRawData(l["measureOpts"]);
g.setValue(l.pageParams["selectedMeasure"]);Ext.getCmp("measureComboBox").show();}else{var h=Ext.getCmp("compTypeComboBox").getValue();var j=Ext.getCmp("reportTypeComboBox").getValue();var k=a.findField("measureComboBox");if(h=="All Types"&&reportTypeCombo=="Graph"){k.getStore().clearFilter(true);}Ext.getCmp("measureComboBox").hide();
}if(c=="Zone"){Ext.getCmp("er_site").hide();var i=a.findField("zoneComboBox");i.setFieldLabel("Zone");i.getStore().clearFilter(true);i.getStore().loadRawData(l["zoneListJson"]);i.setValue(l.pageParams["selectedZone"]);i.show();}else{if(c=="Component"){Ext.getCmp("er_site").hide();Ext.getCmp("zoneComboBox").hide();
}else{Ext.getCmp("zoneComboBox").hide();m=Ext.getCmp("er_site");m.getStore().clearFilter(true);m.getStore().loadRawData(l.siteCombo);m.setFieldLabel(l.siteComboLabel);m.setValue(l.selectedSiteCombo);m.show();}}}});},er_siteOnChange:function(c){var d=c.getValue();var a=this.getThinclientsessionreportsform().getForm();
var b="er_option="+Ext.getCmp("er_option").getValue()+"&er_site="+d+"&er_type="+Ext.getCmp("reportTypeComboBox").getValue()+"&thinClientSessionAction=zoneOnChange";Ext.Ajax.request({url:"/final/reporter/ErCtxSessionReportJson.jsp",params:b,method:"GET",success:function(g){var h=Ext.decode(g.responseText);
var e;e=a.findField("compTypeComboBox");e.getStore().clearFilter(true);e.getStore().loadRawData(h["compTypeJson"]);e.setValue(h.pageParams["selectedCompType"]);var f=Ext.getCmp("reportTypeComboBox").getValue();if(f=="Yes"){var i=a.findField("measureComboBox");i.getStore().loadRawData(h["measureOpts"]);
i.setValue(h.pageParams["selectedMeasure"]);Ext.getCmp("measureComboBox").show();}else{Ext.getCmp("measureComboBox").hide();}}});},goTo:function(a){appConstants.formButtonId=a.getId();var b=appConstants.publicJsonData["hiddenParams"]["fromScheduleModify"];if((b!=null&&b=="Yes")){this.saveSchedule();}else{this.saveFavorite();
}},changeEr_mode:function(c){var a=appConstants.publicJsonData["hiddenParams"]["favorite_id"];var b=appConstants.publicJsonData["hiddenParams"]["fromScheduleModify"];if(!(a=="undefined"||a==undefined)||!(b==null||b=="null")){return;}if(Ext.get("configMod")!=null&&Ext.get("configMod")!="undefined"){Ext.get("configMod").animate({duration:250,to:{y:-530}});
}this.showResult();},zoneOnChange:function(c){var a=this.getThinclientsessionreportsform().getForm();var b=c.getValue();params1="&select_farm="+b+"&er_type="+Ext.getCmp("reportTypeComboBox").getValue();Ext.Ajax.request({url:"/final/reporter/ErCtxSessionReportJson.jsp",params:params1+"&thinClientSessionAction=zoneOnChange",scope:this,method:"POST",success:function(e){var g=e.responseText;
var f=Ext.decode(g);if(!Ext.isEmpty(f)){var d=a.findField("compTypeComboBox");d.getStore().clearFilter(true);d.getStore().loadRawData(f["compTypeJson"]);d.setValue(f.pageParams["selectedCompType"]);var h=a.findField("measureComboBox");h.getStore().clearFilter(true);h.getStore().loadRawData(f["measureOpts"]);
h.setValue(f.pageParams["selectedMeasure"]);}}});},compTypeOnChange:function(d){var a=this.getThinclientsessionreportsform().getForm();var b=a.findField("zoneComboBox");var c=b.getValue();params1="&select_farm="+c+"&er_select_server="+d.getValue();Ext.Ajax.request({url:"/final/reporter/ErCtxSessionReportJson.jsp",params:params1+"&thinClientSessionAction=compTypeOnChange",scope:this,method:"POST",success:function(e){var g=e.responseText;
var f=Ext.decode(g);if(!Ext.isEmpty(f)){var h=a.findField("measureComboBox");h.getStore().clearFilter(true);h.getStore().loadRawData(f["measureOpts"]);h.setValue(f.pageParams["selectedMeasure"]);}}});},saveReportAsPDF:function(){var q=this.getThinclientsessionreportsform().getForm();var n=null;if(isSettingsEnabled){n=this.getThinclientsessionsettings().getForm();
}var J="";var r="";var Q="";var F;var d;var y=q.findField("zoneComboBox").getValue();var z=q.findField("compTypeComboBox").getValue();var K=q.findField("reportTypeComboBox").getValue();var s="";var m=q.findField("er_mode").getValue();var E=q.findField("er_stdate").dataArray;var B=q.findField("er_enddate").dataArray;
var i=q.findField("er_timeline").getValue();var e=q.findField("er_sthr").dataArray;var a=q.findField("er_endhr").dataArray;var v=this.getSettingsFieldValue(n,"timefrom",isSettingsEnabled,"selectedFromTime");var h=this.getSettingsFieldValue(n,"timeto",isSettingsEnabled,"selectedToTime");var I=this.getSettingsFieldValue(n,"minfrom",isSettingsEnabled,"selectedFromMin");
var A=this.getSettingsFieldValue(n,"minto",isSettingsEnabled,"selectedToMin");var w=this.getSettingsFieldValue(n,"showDataComboBox",isSettingsEnabled,"selectedShowDataOption");var D=this.getSettingsFieldValue(n,"excludeWeekendsComboBox",isSettingsEnabled,"selectedExcludeWeekEndOption");var O=this.getSettingsFieldValue(n,"reportGeneration",isSettingsEnabled,"er_reportgenration");
var f=Ext.getCmp("thiClientbckButton");if(f!=undefined&&!f.isHidden()){J+="&er_type=No";K="No";}else{J+="&er_type="+encodeURIComponent(K);}if(!Ext.isEmpty(K)){var j=K;if(j=="Yes"){var l=q.findField("measureComboBox").getValue();J="select_testmes="+encodeURIComponent(l);s="chart";}else{s="data";}}var k="&timefrom="+v+"&minfrom="+I+"&timeto="+h+"&minto="+A;
var H="";var b="";var x="";var M="";var g="";var G="";var p="";var R=appConstants.publicJsonData["hiddenParams"]["daychartfor"];if(K=="No"){var N=Ext.getCmp("er_uniqueUser");if((N!=undefined&&N.checked)||appConstants.publicJsonData["er_uniqueUser"]){appConstants.publicJsonData["hiddenParams"]["daychartfor"]="uniqueuser";
}if((N!=undefined&&!N.checked)){appConstants.publicJsonData["hiddenParams"]["daychartfor"]=R;}}R=appConstants.publicJsonData["hiddenParams"]["daychartfor"];if(!Ext.isEmpty(R)){H=R;}var L=appConstants.publicJsonData["hiddenParams"]["inidate"];if(!Ext.isEmpty(L)){b=L;}var C=appConstants.publicJsonData["hiddenParams"]["uid"];
if(!Ext.isEmpty(C)){g=C;}var u=appConstants.publicJsonData["hiddenParams"]["select_server1"];if(!Ext.isEmpty(u)){G=u;if(!Ext.isEmpty(G)){G=encodeURIComponent(G);}}var S=appConstants.publicJsonData["hiddenParams"]["select_server"];if(!Ext.isEmpty(S)){p=S;if(!Ext.isEmpty(p)){p=encodeURIComponent(p);}}J=J+"&select_farm="+encodeURIComponent(y)+"&er_select_server="+encodeURIComponent(z);
var t=Ext.getCmp("er_option");if(t!=undefined){J+="&er_option="+t.getValue();if(t.getValue()=="Group"||t.getValue()=="Segment"||t.getValue()=="Service"){var P=Ext.getCmp("er_site");J+="&er_site="+P.getValue();}}r="&er_excwe="+D+"&er_trenddata="+w+"&er_mode="+m+"&er_reportgenration="+O;var F="&er_timeline="+q.findField("er_timeline").getValue()+"&startdate="+encodeURIComponent(E)+"&enddate="+encodeURIComponent(B)+"&starthr="+e+"&endhr="+a+"&startmin="+mgr_stmin+"&endmin="+mgr_enmin;
var o="&select_server="+p+"&select_server1="+G+"&er_rtype=Session&er_gtype=Citrix&er_trgttype="+encodeURIComponent("Session Report")+"&daychartfor="+H+"&er_select_comp="+encodeURIComponent(z)+"&inidate="+encodeURIComponent(b);var c="../reporter/ErHtmlToSavePdf.jsp?"+J+r+F+k+o;if(s=="chart"){c+="&opt=chart&printGraph=yes&er_view=IMAGE&uid="+g;
}else{if(s=="data"&&H==""){c+="&er_view=PRINT&uid="+g;}else{c+="&er_view=image&uid="+g;}}if(Ext.isEmpty(appConstants.erUtils)){appConstants.erUtils=Ext.widget("erutils");}c=this.getGridColSortParam(c);appConstants.erUtils.savePDF(c);},bookletQuery:function(b){var r=this.getThinclientsessionreportsform().getForm();
var o=null;if(isSettingsEnabled){o=this.getThinclientsessionsettings().getForm();}var K="";var s="";var R="";var G;var e;var z=r.findField("zoneComboBox").getValue();var A=r.findField("compTypeComboBox").getValue();var L=r.findField("reportTypeComboBox").getValue();var t="";var n=r.findField("er_mode").getValue();
var F=r.findField("er_stdate").dataArray;var C=r.findField("er_enddate").dataArray;var j=r.findField("er_timeline").getValue();var f=r.findField("er_sthr").dataArray;var a=r.findField("er_endhr").dataArray;var w=this.getSettingsFieldValue(o,"timefrom",isSettingsEnabled,"selectedFromTime");var i=this.getSettingsFieldValue(o,"timeto",isSettingsEnabled,"selectedToTime");
var J=this.getSettingsFieldValue(o,"minfrom",isSettingsEnabled,"selectedFromMin");var B=this.getSettingsFieldValue(o,"minto",isSettingsEnabled,"selectedToMin");var x=this.getSettingsFieldValue(o,"showDataComboBox",isSettingsEnabled,"selectedShowDataOption");var E=this.getSettingsFieldValue(o,"excludeWeekendsComboBox",isSettingsEnabled,"selectedExcludeWeekEndOption");
var P=this.getSettingsFieldValue(o,"reportGeneration",isSettingsEnabled,"er_reportgenration");var g=Ext.getCmp("thiClientbckButton");if(g!=undefined&&!g.isHidden()){K+="&er_type=No";L="No";}else{K+="&er_type="+encodeURIComponent(L);}if(!Ext.isEmpty(L)){var k=L;if(k=="Yes"){var m=r.findField("measureComboBox").getValue();
K="select_testmes="+encodeURIComponent(m);t="chart";}else{t="data";}}var l="&timefrom="+w+"&minfrom="+J+"&timeto="+i+"&minto="+B;var I="";var c="";var y="";var N="";var h="";var H="";var q="";var S=appConstants.publicJsonData["hiddenParams"]["daychartfor"];if(L=="No"){var O=Ext.getCmp("er_uniqueUser");
if((O!=undefined&&O.checked)||appConstants.publicJsonData["er_uniqueUser"]){appConstants.publicJsonData["hiddenParams"]["daychartfor"]="uniqueuser";}if((O!=undefined&&!O.checked)){appConstants.publicJsonData["hiddenParams"]["daychartfor"]=S;}}S=appConstants.publicJsonData["hiddenParams"]["daychartfor"];
if(!Ext.isEmpty(S)){I=S;}var M=appConstants.publicJsonData["hiddenParams"]["inidate"];if(!Ext.isEmpty(M)){c=M;}var D=appConstants.publicJsonData["hiddenParams"]["uid"];if(!Ext.isEmpty(D)){h=D;}var v=appConstants.publicJsonData["hiddenParams"]["select_server1"];if(!Ext.isEmpty(v)){H=v;if(!Ext.isEmpty(H)){H=encodeURIComponent(H);
}}var T=appConstants.publicJsonData["hiddenParams"]["select_server"];if(!Ext.isEmpty(T)){q=T;if(!Ext.isEmpty(q)){q=encodeURIComponent(q);}}K=K+"&select_farm="+encodeURIComponent(z)+"&er_select_server="+encodeURIComponent(A);var u=Ext.getCmp("er_option");if(u!=undefined){K+="&er_option="+u.getValue();
if(u.getValue()=="Group"||u.getValue()=="Segment"||u.getValue()=="Service"){var Q=Ext.getCmp("er_site");K+="&er_site="+Q.getValue();}}s="&er_excwe="+E+"&er_trenddata="+x+"&er_mode="+n+"&er_reportgenration="+P;var G="&er_timeline="+r.findField("er_timeline").getValue()+"&startdate="+encodeURIComponent(F)+"&enddate="+encodeURIComponent(C)+"&starthr="+f+"&endhr="+a+"&startmin="+mgr_stmin+"&endmin="+mgr_enmin;
var p="&select_server="+q+"&select_server1="+H+"&er_rtype=Session&er_gtype=Citrix&er_trgttype="+encodeURIComponent("Session Report")+"&daychartfor="+I+"&er_select_comp="+encodeURIComponent(A)+"&inidate="+encodeURIComponent(c);var d=K+s+G+l+p;if(t=="chart"){d+="&opt=chart&printGraph=yes&er_view=IMAGE&uid="+h;
}else{if(t=="data"&&I==""){d+="&er_view=PRINT&uid="+h;}else{d+="&er_view=image&uid="+h;}}if(Ext.isEmpty(appConstants.erUtils)){appConstants.erUtils=Ext.widget("erutils");}d=this.getGridColSortParam(d);return d;},bookletScheduleQuery:function(g){var c="";this.updateQueryString();c+=queryString+"&option=data";
var e="";var b=appConstants.publicJsonData["hiddenParams"]["topSession"];if(!Ext.isEmpty(b)){e=b;c+="&topSession="+e;}var f="";var d="";var a=appConstants.publicJsonData["hiddenParams"]["topusers"];if(!Ext.isEmpty(a)){d=a;c+="&topusers="+d;}if(c.indexOf("er_rtype")==-1){c+="&er_rtype=Session";}return c;
},bookletPreview:function(){this.printFile();},printFile:function(){var q=this.getThinclientsessionreportsform().getForm();var n=null;if(isSettingsEnabled){n=this.getThinclientsessionsettings().getForm();}var J;var r;var Q="";var F;var d;var y=q.findField("zoneComboBox").getValue();var z=q.findField("compTypeComboBox").getValue();
var K=q.findField("reportTypeComboBox").getValue();var s="";var m=q.findField("er_mode").getValue();var E=q.findField("er_stdate").dataArray;var B=q.findField("er_enddate").dataArray;var i=q.findField("er_timeline").getValue();var e=q.findField("er_sthr").dataArray;var a=q.findField("er_endhr").dataArray;
var v=this.getSettingsFieldValue(n,"timefrom",isSettingsEnabled,"selectedFromTime");var h=this.getSettingsFieldValue(n,"timeto",isSettingsEnabled,"selectedToTime");var I=this.getSettingsFieldValue(n,"minfrom",isSettingsEnabled,"selectedFromMin");var A=this.getSettingsFieldValue(n,"minto",isSettingsEnabled,"selectedToMin");
var w=this.getSettingsFieldValue(n,"showDataComboBox",isSettingsEnabled,"selectedShowDataOption");var D=this.getSettingsFieldValue(n,"excludeWeekendsComboBox",isSettingsEnabled,"selectedExcludeWeekEndOption");var O=this.getSettingsFieldValue(n,"reportGeneration",isSettingsEnabled,"er_reportgenration");
var H="";var b="";var x="";var M="";var g="";var G="";var p="";var R=appConstants.publicJsonData["hiddenParams"]["daychartfor"];if(K=="No"){var N=Ext.getCmp("er_uniqueUser");if((N!=undefined&&N.checked)||appConstants.publicJsonData["er_uniqueUser"]){appConstants.publicJsonData["hiddenParams"]["daychartfor"]="uniqueuser";
}if((N!=undefined&&!N.checked)){appConstants.publicJsonData["hiddenParams"]["daychartfor"]=R;}}R=appConstants.publicJsonData["hiddenParams"]["daychartfor"];if(!Ext.isEmpty(R)){H=R;}var L=appConstants.publicJsonData["hiddenParams"]["inidate"];if(!Ext.isEmpty(L)){b=L;}var C=appConstants.publicJsonData["hiddenParams"]["uid"];
if(!Ext.isEmpty(C)){g=C;}var u=appConstants.publicJsonData["hiddenParams"]["select_server1"];if(!Ext.isEmpty(u)){G=u;if(!Ext.isEmpty(G)){G=encodeURIComponent(G);}}var S=appConstants.publicJsonData["hiddenParams"]["select_server"];if(!Ext.isEmpty(S)){p=S;if(!Ext.isEmpty(p)){p=encodeURIComponent(p);}}J="select_farm="+encodeURIComponent(y)+"&er_select_server="+encodeURIComponent(z);
var f=Ext.getCmp("thiClientbckButton");if(f!=undefined&&!f.isHidden()){J+="&er_type=No";K="No";}else{J+="&er_type="+encodeURIComponent(K);}var t=Ext.getCmp("er_option");if(t!=undefined){J+="&er_option="+t.getValue();if(t.getValue()=="Group"||t.getValue()=="Segment"||t.getValue()=="Service"){var P=Ext.getCmp("er_site");
J+="&er_site="+P.getValue();}}if(!Ext.isEmpty(K)){var j=K;if(j=="Yes"){var l=q.findField("measureComboBox").getValue();J=J+"&select_testmes="+encodeURIComponent(l);s="chart";}else{s="data";}}r="&er_excwe="+D+"&er_trenddata="+w+"&er_mode="+m+"&er_reportgenration="+O;var k="&timefrom="+v+"&minfrom="+I+"&timeto="+h+"&minto="+A;
var F="&er_timeline="+i+"&startdate="+encodeURIComponent(E)+"&enddate="+encodeURIComponent(B)+"&starthr="+e+"&endhr="+a+"&startmin="+mgr_stmin+"&endmin="+mgr_enmin;var o="&select_server="+p+"&select_server1="+G+"&er_rtype=Session&er_gtype=Citrix&er_trgttype="+encodeURIComponent("Session Report")+"&daychartfor="+H+"&er_select_comp="+encodeURIComponent(z)+"&inidate="+encodeURIComponent(b)+"&pdfPrint=yes&isSubmit=true";
var c="../servlet/com.eg.ErCtxServerReportC?"+J+r+F+k+o;if(s=="chart"){c+="&opt=chart&printGraph=yes&er_view=IMAGE&uid="+g;}else{if(s=="data"&&H==""){c+="&er_view=PRINT&uid="+g;}else{c+="&er_view=image&uid="+g;}}c=this.getGridColSortParam(c);parent.printWindowFn(c);},getGridColSortParam:function(d){var a=d.indexOf("er_sortby");
if(a>-1){var c;var b=d.substring(a+10,a+12);if(b=="-1"){c="er_sortby="+b;}else{c="er_sortby="+parseInt(b);}d=d.replace(c,"er_sortby="+this.gridColIndexParam);}else{d+="&er_sortby="+this.gridColIndexParam;}if(this.gridColStateParam=="ASC"){this.gridColStateParam="1";}else{this.gridColStateParam="0";}return d+"&orderBy="+this.gridColStateParam;
},sendMail:function(){var a=Ext.widget("sendmail");a.show();},saveCsv:function(){window.location="../servlet/egurkha.reporter.SaveInCSVFormat";},saveSchedule:function(){var g=this.getThinclientsessionreportsform().getForm();var i=this.validateMainForm(false);if(i&&Ext.getCmp("er_timeline").getValue()=="Any"){Ext.MessageBox.show({title:"Operation Reports",msg:"Chosen timeline not allowed",buttons:Ext.MessageBox.OK,icon:Ext.MessageBox.WARNING});
i=false;}if(i){this.updateQueryString();var j="";var b=appConstants.publicJsonData["hiddenParams"]["topSession"];if(!Ext.isEmpty(b)){j=b;}var f="";var h="";var d=appConstants.publicJsonData["hiddenParams"]["topusers"];if(!Ext.isEmpty(d)){h=d;}f="/final/reporter/ErSaveSchedule.jsp?"+queryString+"&option=data&topSession="+j+"&topusers="+h+"&com.eg.CSRF_NONCE="+csrfToken;
if(appConstants.formButtonId=="save"){f+="&showSchWindow=no";var c=f.substr(0,f.indexOf("?"));var a=f.substr(f.indexOf("?")+1,f.length-1);if(a!=undefined){if(a.indexOf("er_rtype")==-1){a+="&er_rtype=Session";}}var e=Ext.create("Ext.form.Panel");e.submit({url:c,params:a,standardSubmit:true,method:"POST"});
}else{parent.scheduleWindowFn(f);}}else{return;}},saveFavorite:function(){var f=this.validateMainForm(false);if(f){this.updateQueryString();var a=appConstants.publicJsonData["hiddenParams"]["favorite_id"];var e="../servlet/com.eg.ErFavoriteC?"+queryString+"&thinClientSessionAction=submit&isSubmit=true&er_view=GRAPH&cmd=client"+"&er_RmDispName="+appConstants.er_RmDispName+"&com.eg.CSRF_NONCE="+csrfToken;
if(appConstants.formButtonId=="save"){e+="&showSchWindow=no"+"&FavoriteId="+a;var d=e.substr(0,e.indexOf("?"));var b=e.substr(e.indexOf("?")+1,e.length-1);if(b!=undefined){if(b.indexOf("er_rtype")==-1){b+="&er_rtype=Session";}}var c=Ext.create("Ext.form.Panel");c.submit({url:d,params:b,standardSubmit:true,method:"POST"});
}else{parent.favouriteWindowFn(e);}}else{return;}},validateMainForm:function(r){var g=this.getThinclientsessionreportsform().getForm();var a=g.findField("zoneComboBox").getValue();var b=g.findField("compTypeComboBox").getValue();var z=g.findField("reportTypeComboBox").getValue();var y=g.findField("er_option").getValue();
if(Ext.isEmpty(y)||y=="-1"||y=="NotApplicable"){Ext.MessageBox.show({title:"Thin Client Session",msg:"Not Applicable",buttons:Ext.MessageBox.OK,icon:Ext.MessageBox.WARNING});return false;}if(z=="Yes"){var f=g.findField("measureComboBox").getValue();if(Ext.isEmpty(f)||f=="-1"||f=="NotApplicable"){Ext.MessageBox.show({title:"Thin Client Session",msg:appConstants.measureAlertMsg,buttons:Ext.MessageBox.OK,icon:Ext.MessageBox.WARNING});
return false;}}var g=this.getThinclientsessionreportsform().getForm();var m=null;if(isSettingsEnabled){m=this.getThinclientsessionsettings().getForm();}var t=true;var q=appConstants.publicJsonData["hiddenParams"]["getMaxDaysInMonth"];var u=this.getSettingsFieldValue(m,"reportGeneration",isSettingsEnabled,"er_reportgenration");
var A="";var l=appConstants.publicJsonData["hiddenParams"]["er_usertimeline"];if(!Ext.isEmpty(l)){A=l;}var p=g.findField("er_timeline").getValue();var v=g.findField("er_stdate").getValue();var j=g.findField("er_enddate").getValue();var o=g.findField("er_sthr").getValue();var d=g.findField("er_endhr").getValue();
v.setHours(o);j.setHours(d);var n=this.getSettingsFieldValue(m,"timefrom",isSettingsEnabled,"selectedFromTime");var i=this.getSettingsFieldValue(m,"timeto",isSettingsEnabled,"selectedToTime");var x=this.getSettingsFieldValue(m,"minfrom",isSettingsEnabled,"selectedFromMin");var w=this.getSettingsFieldValue(m,"minto",isSettingsEnabled,"selectedToMin");
if(!checkTimePeriod(n,x,i,w)){t=false;}if(!checkDateTime(v,j)){t=false;}var k=true;if(!Ext.isEmpty(A)&&A!="-1"){k=isUserTimelineLimitExceeded(A,q,v,j);if(!k){Ext.MessageBox.show({title:"Thin Client Session settings",msg:_invalidUserTime,buttons:Ext.MessageBox.OK,icon:Ext.MessageBox.WARNING});t=false;
}}if(u!=null&&u=="foreground"&&k){if(r){var h=appConstants.publicJsonData["hiddenParams"]["limitforbg"];if(!Ext.isEmpty(h)){var c=h;if(!checkTimeLineForBgLimit(c,q,v,j)){Ext.MessageBox.confirm("Confirm",appConstants.forGrdReportConfirmMsg,this.showConfirmResult,this);t=false;}}}}else{if(k){var s=m.findField("bgReportName").getValue();
if(!validateTextBoxWithSpecialChars(s,"Attachment",true)){t=false;}}}if(t){var e=Ext.getCmp("submit");e.setDisabled(false);return true;}},reportTypeOnChange:function(c){Ext.getCmp("resultPanel").hide();var h=this.getThinclientsessionreportsform().getForm();var b=c.getValue();if(b=="No"){h.findField("er_mode").hide();
h.findField("measureComboBox").hide();if(Ext.getCmp("er_uniqueUser")!=undefined){Ext.getCmp("er_uniqueUser").show();}}else{h.findField("er_mode").hide();h.findField("measureComboBox").show();if(Ext.getCmp("er_uniqueUser")!=undefined){Ext.getCmp("er_uniqueUser").hide();}}var a=h.findField("compTypeComboBox").getValue();
var i=h.findField("zoneComboBox").getValue();var f=h.findField("reportTypeComboBox").getValue();var d=h.findField("er_option").getValue();var g=h.findField("er_site").getValue();var e="er_option="+d+"&er_type="+Ext.getCmp("reportTypeComboBox").getValue()+"&thinClientSessionAction=reportTypeChange";if(d=="Zone"){e+="&select_farm="+i;
}else{if(d!="Zone"&&d!="Component"){e+="&er_site="+g;}}Ext.Ajax.request({url:"/final/reporter/ErCtxSessionReportJson.jsp?&er_type="+f,params:e,scope:this,success:function(l){var p=l.responseText;if(!Ext.isEmpty(p)){var n=Ext.decode(p);appConstants.repotgene=n;var j=h.findField("compTypeComboBox");j.getStore().clearFilter(true);
j.getStore().loadRawData(n["compTypeJson"]);j.setValue(n.pageParams["selectedCompType"]);var q=h.findField("measureComboBox");q.getStore().clearFilter(true);q.getStore().loadRawData(n["measureOpts"]);q.setValue(n.pageParams["selectedMeasure"]);if(isSettingsEnabled){var k=Ext.getCmp("reportGeneration");
var o=n.repGenOptJson[0].valueField;k.setFieldLabel(appConstants.publicJsonData.screenLabels["reporter.consolidated.Report Generation"]);k.getStore().loadRawData(n.repGenOptJson);k.setValue(o);var m=Ext.getCmp("bgReportName");if(o!=undefined&&o!=null&&o=="foreground"){m.hide();}else{m.show();}}}}});},toggleForm:function(b){Ext.getCmp("panelinsidetoggle").show();
var a=Ext.getCmp("thinclientsessionreportsform");if(a.isHidden()){a.show();Ext.getCmp("selectionDetails").hide();}else{a.hide();Ext.getCmp("selectionDetails").show();}},showResult:function(){Ext.getCmp("panelinsidetoggle").setDisabled(false);var a=Ext.getCmp("resultPanel");a.removeAll();var b=this.validateMainForm(true);
if(b){this.submitReport();}else{return;}},validateSettings:function(){var b=true;var a=this.getThinclientsessionsettings().getForm();var c=a.findField("reportGeneration").getValue();if(c!=null&&(c=="background"||c=="background-csv")){var d=a.findField("bgReportName").getValue();if(!validateTextBoxWithSpecialChars(d,"Attachment",true)){b=false;
}}return b;},showConfirmResult:function(d){if(d=="yes"){var b=Ext.getCmp("submit");this.submitReport();}else{this.getReporterSettings().down("button").fireHandler();var c=this.getThinclientsessionsettings().getForm();var a=c.findField("reportGeneration");var e=c.findField("bgReportName");a.setValue("background");
e.setValue("");e.show();e.focus(false,1000);Ext.getCmp("submitViaSetting").show();Ext.getCmp("moreOptionCloseId").hide();this.showResult();}},getXmlForUrl:function(b){try{var a=null;Ext.Ajax.request({url:b,method:"POST",async:false,success:function(d){var e=d.responseText;if(!Ext.isEmpty(e)){a=Ext.decode(e);
}},failure:function(){alert("I am not loading..."+b);}});return a;}catch(c){alert("[Exception] "+c);}},showDrillDownDataForUrl:function(g){if(g!=null&&g.indexOf("?")==-1){return;}var e=this;var b=this.getThinclientsessionreportsform();var h=b.getForm();var a=g.substr(g.indexOf("?")+1);var f=Ext.getCmp("gridContainer");
var i=Ext.getCmp("dataContainer");var c=Ext.getCmp("resultPanel");var d=Ext.getCmp("selectionDetails");initLoadMask.show();Ext.Ajax.request({url:"../servlet/com.eg.ErCtxServerReportC",params:a,method:"POST",scope:this,success:function(j){var x=j.responseText;var l=Ext.decode(x);i.removeAll();c.removeAll();
appConstants.itemsArray=new Array();appConstants.isGraphDataAvailable=false;var s=l["dataAvailable"];if(!Ext.isEmpty(s)&&s=="true"){Ext.getCmp("bookletTool").setDisabled(false);Ext.getCmp("saveTool").setDisabled(false);Ext.getCmp("printTool").setDisabled(false);Ext.getCmp("mailTool").setDisabled(false);
Ext.getCmp("csvTool").setDisabled(false);var u=l["summaryTableTitle"];var v;if(u){v=l["DataType"];}if(!Ext.isEmpty(v)&&v=="dayWiseAndUserWiseData"){f.removeAll();var o=l["dayWiseChartJson"];if(!Ext.isEmpty(o)){appConstants.isGraphDataAvailable=true;var z=l["userTable"];var t={xtype:"panel",margin:"0 0 0 10",layout:{type:"hbox",align:"stretch"},items:[{xtype:"container",layout:{type:"vbox",align:"stretch",},items:[{xtype:"container",margin:"0 10 10 0",height:70,width:380,ui:"newContainer",html:'<table width="100%" height="100%"><tr><td valign="middle" class="newFont_bold14">'+uniqueUserAcessingTxt+'</td><td valign="middle" align="right" style="padding-right:10px" class="newFont_bold30">'+z.userTableValues.length+"</td></tr></table>",},{xtype:"panel",frame:false,width:380,flex:1,margin:"0 10 10 0",data:z,ui:"newGraphPanel",id:"userWiseData",name:"userWiseData",}]},{xtype:"panel",data:l,border:true,frame:false,flex:1,ui:"newGraphPanel",id:"dayWiseChart",name:"dayWiseChart",tools:[{xtype:"button",text:backText,cls:"backbutton",iconCls:"iconBack",id:"thiClientbckButton",name:"thiClientbckButton",listeners:{"click":function(){e.submitReport();
}}}]}]};appConstants.itemsArray.push(t);f.add(appConstants.itemsArray);}i.removeAll();f.show();c.hide();f.doLayout();appConstants.publicJsonData["hiddenParams"]=l["hiddenParams"];}else{var w=false;var C=l["sessionDetailsTableArr"];if(!Ext.isEmpty(C)){var m=C[0];var D=m.columns;var A=m.measureData;var B=this.getMain().getWidth();
var p=0;var F=new Array();var n=new Array();for(var E in D){var k=E;F.push(k);n.push({header:k,sortable:true,dataIndex:k,align:"center",listeners:{sortchange:function(I,J,K,H,G){e.gridColIndexParam=J.getIndex();e.gridColStateParam=J.sortState;}},doSort:function(H){var G=this.up("grid").store;var I=this.getSortParam();
G.sort({property:I,direction:H,sorterFn:function(K,J){K=K.get(I);J=J.get(I);K=Ext.isNumber(K)?K:parseFloat(String(K),10);K=isNaN(K)?0:K;J=Ext.isNumber(J)?J:parseFloat(String(J),10);J=isNaN(J)?0:J;return K>J?1:(K<J?-1:0);}});},renderer:function(N,H,L,P,J,O,G){var K=N["dispVal"];var I=N["hrefUrl"];var M=K;
if(!Ext.isEmpty(I)&&I!="-"){M='<a href="'+I+'">'+K+"</a>";}return M;}});}var y=Ext.create("Ext.data.ArrayStore",{fields:F,data:A});var r=Ext.widget("customgrid",{store:y,columns:n,ui:"newGridPanel withHeader",bodyPadding:"0 0 0 0",forceFit:true,border:true,title:'<span class="font_bold">'+u+"</span>",tools:[{xtype:"button",text:backText,cls:"backbutton",iconCls:"iconBack",id:"thiClientbckButton",name:"thiClientbckButton",listeners:{"click":function(){e.submitReport();
}}}]});var q=new Array();q.push(r);if(!Ext.isEmpty(r)){i.add({xtype:"panel",margin:"10",padding:"0 10 10 10",ui:"newGraphPanel",items:q});i.show();c.hide();i.doLayout();w=true;}}}if(!appConstants.isGraphDataAvailable&&!w){i.hide();c.removeAll();this.disableTools();c.hide();this.getNomeasurepanel().show();
}}else{i.hide();c.removeAll();this.disableTools();c.hide();this.getNomeasurepanel().show();}},callback:function(){var r=Ext.getCmp("dayWiseChart");if(!Ext.isEmpty(r)){var j=r.data;var C=j["dayWiseChartJson"];var x="";if(appConstants.isGraphDataAvailable){var s="<div class='htmlGraphTable' style='float:left;width:100%;height:100%'><table border='0' bordercolor='red' class='x-grid-table x-grid-table-resizer' align='center' cellspacing='0' cellpadding='2'  height='100%' >";
s=s+"<tr class='x-grid-row'>";s=s+"<td class='x-grid-cell' align='center' valign='middle' style='height:100%'>";s=s+"<div id='dayWiseChartCont' style='position:relative;margin:0px;border:0px solid green'></div>";s=s+"</td>";s=s+"</tr>";s=s+"</table></div>";r.update(s);if(appConstants.chartType=="fusionchart"){if(FusionCharts("dayWiseChartObj")){FusionCharts("dayWiseChartObj").dispose();
}var k=new FusionCharts(C["swfpath"],"dayWiseChartObj","100%","100%","0","1");k.setXMLData(C["xmlData"]);k.setTransparent(true);k.render("dayWiseChartCont");}else{var B={};B=jQuery.extend(true,{},getHighChartsBarInstance("dayWiseChartCont",C.chartHeight,C.chartWidth),B);B.setData(C,"<%=currentDateFormat%>","");
B.drawChart();}appConstants.isGraphDataAvailable=false;}}var m=Ext.getCmp("userWiseData");if(!Ext.isEmpty(m)){var y=m.data;var u=y["userTableValues"];if(!Ext.isEmpty(u)){var w=y["tableTitle"];m.setTitle(w);var l=m.getHeight()-65;var A=m.getHeight()-125;var o=u.length;var n='<div class="newTable" style="text-align:center;margin:0px 10px 10px 10px;height:'+l+'px"><table width="100%" ><thead><tr><th style="text-align:left;height:40px;text-transform:none" class="newFont_bold13">'+y["subTitle"]+'</th></tr></thead><tr><td width="100%" style="padding:0px;border:0px"><div style="display:inline-block;overflow:auto;margin-bottom:10px;height:'+A+'px;width:100%" class="newTable"><table width="100%" ><tbody >';
var q=1;var t=0;for(var z=0;z<u.length;z++){if(t==0){n=n+"<tr>";}else{t=0;}var v=u[z];n=n+'<td valign="top" align="left" style="width:50%"><div class="ellipsisText">';var p=v["hrefUrl"];if(p!=null&&p!="undefined"&&p!="-"){n=n+'<a href="'+v["hrefUrl"]+'"> &nbsp;'+v["val"]+"</a>";}else{n=n+"&nbsp;"+v["val"];
}n=n+"</div></td>";t++;if(q%2==0){n=n+"</tr>";}q++;}if(u.length!=0){n=n+"</tr>";}n=n+"</tbody></table></div></td></tr></table></div>";m.update(n);}else{m.hide();}}}});initLoadMask.hide();},loadThinClientSessionReportData:function(z){var x=Ext.getCmp("resultPanel");var k=Ext.getCmp("dataContainer");var t=Ext.getCmp("selectionDetails");
var p=Ext.getCmp("gridContainer");initLoadMask.hide();var c=0;if(!Ext.isEmpty(z)){x.removeAll();var A=new Array();var J=false;var d=z["dataAvailable"];if(!Ext.isEmpty(d)&&d=="true"){var D=z.pageParams["rtype"];var m;m=z["DataType"];if(!Ext.isEmpty(D)&&D=="Yes"){Ext.getCmp("gridContainer").hide();k.hide();
var K=z["chartJsonData"];var v=z["graphMainTitle"];x.setTitle("<span class='newfont_bold15'>"+v+"</span>");if(!Ext.isEmpty(K)){for(var q in K){var j=K[q];var e=j.chartUrl;var G=this.getXmlForUrl(e);if(!Ext.isEmpty(G)&&G.hasOwnProperty("xmlData")){J=true;var C={xtype:"panel",ui:"newGraphPanel",flex:0.65,margin:"0 10 10 10",title:G.chartTitle,data:G,id:"fusion"+c};
A.push(C);c++;}var I=j.graphTitle;var a=j.chartUrl2;var n=this.getXmlForUrl(a);if(!Ext.isEmpty(n)&&n.hasOwnProperty("xmlData")){J=true;var C={xtype:"panel",data:n,ui:"newGraphPanel",flex:1,margin:"0 10 10 10",id:"fusion"+c};A.push(C);c++;}}x.add(A);x.show();if(J){Ext.getCmp("bookletTool").setDisabled(false);
Ext.getCmp("saveTool").setDisabled(false);Ext.getCmp("printTool").setDisabled(false);Ext.getCmp("mailTool").setDisabled(false);Ext.getCmp("csvTool").setDisabled(true);Ext.getCmp("selectionDetails").setSelectionDetailsData(z.selDetailsJson);}}}else{if(!Ext.isEmpty(m)&&m=="dayWiseAndUserWiseData"){var b=this;
x.removeAll();p.removeAll();appConstants.itemsArray=new Array();var h=z["dayWiseChartJson"];if(!Ext.isEmpty(h)){appConstants.isGraphDataAvailable=true;F=true;var g=z["userTable"];var C={xtype:"panel",margin:"0 0 0 10",layout:{type:"hbox",align:"stretch",},items:[{xtype:"container",layout:{type:"vbox",align:"stretch",},items:[{xtype:"container",margin:"0 10 10 0",height:70,width:380,ui:"newContainer",html:'<table width="100%" height="100%"><tr><td valign="middle" class="newFont_bold14">Unique Users accessing the farm</td><td valign="middle" align="right" style="padding-right:10px" class="newFont_bold30">'+g.userTableValues.length+"</td></tr></table>",},{xtype:"panel",frame:false,data:g,width:380,flex:1,ui:"newGraphPanel",margin:"0 10 10 0",id:"userWiseData",name:"userWiseData",}],},{xtype:"panel",data:z,border:true,frame:false,flex:1,margin:"0 0 10 0",ui:"newGraphPanel",id:"dayWiseChart",name:"dayWiseChart",title:v,}]};
appConstants.itemsArray.push(C);p.add(appConstants.itemsArray);if(appConstants.isGraphDataAvailable){Ext.getCmp("bookletTool").setDisabled(false);Ext.getCmp("saveTool").setDisabled(false);Ext.getCmp("printTool").setDisabled(false);Ext.getCmp("mailTool").setDisabled(false);Ext.getCmp("csvTool").setDisabled(false);
}}k.removeAll();p.show();x.hide();p.doLayout();appConstants.publicJsonData["hiddenParams"]=z["hiddenParams"];this.loadDaywiseChart(z);}else{p.hide();k.removeAll();var v=z["summaryTableTitle"];var L="";var w=z["summaryTableJson"];var s=0;L+="<div class='newTable' style='margin:0px 10px 10px 10px'><table border='0' width='100%'>";
L=L+"<tbody>";for(var r in w){var E=w[r];var l=E["val"];var i=E["hrefUrl"];var f=l;if(!Ext.isEmpty(i)&&i!="-"){if(l!=null&&l=="top.gif"){l='<div class="iconArrowUp"></div>';}f='<div align="cen ter"><a href="javascript:void(0);" onclick=showDrillDownData("'+i+'") >'+l+"</a></div>";}else{if(l!=null&&l!="undefined"){f=l;
}else{f="-";}}s++;L=L+"<tr><td><div>"+r+"</div></td><td><div>"+f+"</div></td></tr>";}L=L+"</tbody></table></div>";if(s!=0){k.add({xtype:"container",layout:{type:"vbox",align:"center"},items:[{xtype:"panel",ui:"newGraphPanel",margin:"5 10 5 10",frame:false,overflow:scroll,border:true,width:450,height:200,title:v,html:L}]});
}else{var w=z["allTypeUniqueUsrSummary"].split(":");var B="";appConstants.userListStr=z["userListStr"].toString();B+="<div class='newTable' style='margin:0px 10px 10px 10px'><table border='0' width='100%'>";B=B+"<tbody>";var o=[sessionCompletedTxt+" ("+numberTxt+")",avgDuration+" ("+minsLbl+")",maximumDurationTxt+" ("+minsLbl+")",uniqueUserTxt];
var H="";for(var y=0;y<4;y++){if(y!=3){B+="<tr><td><div>"+o[y]+"</div></td><td><div>"+w[y]+"</div></td></tr>";}else{B+="<tr><td><div>"+o[y]+"</div></td><td><div>"+w[y]+"</div></td></tr>";}}B+="</tbody></table></div>";k.add({xtype:"container",layout:{type:"vbox",align:"center"},items:[{xtype:"panel",ui:"newGraphPanel",margin:"5 10 5 10",frame:false,overflow:scroll,border:true,width:450,height:145,title:z["summaryTableTitle"],html:B}]});
}k.show();k.doLayout();var F=false;var u=z["sessionDetailsTableArr"];if(!Ext.isEmpty(u)){publicGridData=u;F=this.loadGrid(u,z);}if(F){Ext.getCmp("bookletTool").setDisabled(false);Ext.getCmp("saveTool").setDisabled(false);Ext.getCmp("printTool").setDisabled(false);Ext.getCmp("mailTool").setDisabled(false);
Ext.getCmp("csvTool").setDisabled(false);Ext.getCmp("selectionDetails").setSelectionDetailsData(z.selDetailsJson);}else{Ext.getCmp("bookletTool").setDisabled(true);Ext.getCmp("saveTool").setDisabled(true);Ext.getCmp("printTool").setDisabled(true);Ext.getCmp("mailTool").setDisabled(true);Ext.getCmp("csvTool").setDisabled(true);
Ext.getCmp("selectionDetails").setSelectionDetailsData(z.selDetailsJson);}}}if(!J&&!F){p.hide();x.hide();k.hide();this.getNomeasurepanel().show();}}else{p.hide();x.hide();k.hide();this.getNomeasurepanel().show();}}else{p.hide();x.hide();k.hide();this.getNomeasurepanel().doLayout();this.getNomeasurepanel().show();
}this.loadCharts(J,c);},loadCharts:function(a,e){if(a){for(var c=0;c<e;c++){var g=Ext.getCmp("fusion"+c);var f=g.data;var b=f.reportData;if(Ext.isEmpty(appConstants.erUtils)){appConstants.erUtils=Ext.widget("erutils");}if(!Ext.isEmpty(f)&&f.hasOwnProperty("xmlData")){var d=f.chartType;if(d=="bar"){appConstants.erUtils.updateBarChart(appConstants.chartType,null,f.xmlData,f.swfpath,b,b.chartHeight-20,b.chartWidth,g);
}else{if(d=="pie"){appConstants.erUtils.updatePieChart(appConstants.chartType,f.legendListJsonArr,"legendColor","urlLink","legendLabel",null,f.xmlData,f.swfpath,f,g);}else{if(d=="distributionBarChart"){appConstants.erUtils.updateBarChart(appConstants.chartType,f.chartTitle,f.xmlData,f.swfpath,f,f.chartHeight,f.chartWidth,g);
}}}}else{g.update('<div><img src="/final/reporter/images/nographformeasure.gif" width="100%" /></div>');}}}},loadDaywiseChart:function(a){var i=Ext.getCmp("dayWiseChart");if(!Ext.isEmpty(i)){var a=i.data;var v=a["dayWiseChartJson"];var s="";if(appConstants.isGraphDataAvailable){var j="<div class='htmlGraphTable' style='float:left;width:100%;height:100%'><table border='0' bordercolor='red' class='x-grid-table x-grid-table-resizer' align='center' cellspacing='0' cellpadding='2'  height='100%' >";
j=j+"<tr class='x-grid-row'>";j=j+"<td class='x-grid-cell' align='center' valign='middle' style='height:100%'>";j=j+"<div id='dayWiseChartCont' style='position:relative;margin:0px;border:0px solid green'></div>";j=j+"</td>";j=j+"</tr>";j=j+"</table></div>";i.update(j);if(appConstants.chartType=="fusionchart"){if(FusionCharts("dayWiseChartObj")){FusionCharts("dayWiseChartObj").dispose();
}var b=new FusionCharts(v["swfpath"],"dayWiseChartObj","100%","100%","0","1");b.setXMLData(v["xmlData"]);b.setTransparent(true);b.render("dayWiseChartCont");}else{var u={};u=jQuery.extend(true,{},getHighChartsBarInstance("dayWiseChartCont",v.chartHeight,v.chartWidth),u);u.setData(v,"<%=currentDateFormat%>","");
u.drawChart();}appConstants.isGraphDataAvailable=false;}}var c=Ext.getCmp("userWiseData");if(!Ext.isEmpty(c)){var t=c.data;var m=t["userTableValues"];if(!Ext.isEmpty(m)){var q=t["tableTitle"];var r="";var p="";if(q!=null&&q.indexOf("-")>-1){r=q.substr(0,q.indexOf("-"));p=q.substr(q.indexOf("-")+1,q.length);
c.setTitle('<div class="font_normal12" style="line-height:1.5em;">'+q+"</div>");}else{c.setTitle('<div class="font_normal12" style="line-height:1.5em;">'+q+"</div>");}var n=c.getHeight()-65;var h=c.getHeight()-125;var e=m.length;var d='<div class="newTable" style="text-align:center;margin:0px 10px 10px 10px;height:'+n+'px"><table width="100%" ><thead><tr><th style="text-align:left;height:40px;text-transform:none" class="newFont_bold13">'+t["subTitle"]+'</th></tr></thead><tr><td width="100%" style="padding:0px;border:0px"><div style="display:inline-block;overflow:auto;margin-bottom:10px;height:'+h+'px;width:100%" class="newTable"><table width="100%" ><tbody>';
var g=1;var l=0;for(var k=0;k<m.length;k++){if(l==0){d=d+"<tr>";}else{l=0;}var o=m[k];d=d+'<td valign="top" align="left" style="width:50%"><div class="ellipsisText">';var f=o["hrefUrl"];if(f!=null&&f!="undefined"&&f!="-"){d=d+'<a href="'+o["hrefUrl"]+'">&nbsp;'+o["val"]+"</a>";}else{d=d+"&nbsp;"+o["val"];
}d=d+"</div></td>";l++;if(g%2==0){d=d+"</tr>";}g++;}if(m.length%2!=0){d=d+"<td>&nbsp;</td></tr>";}d=d+"</tbody></table></div></td></tr></table></div>";c.update(d);}else{c.hide();}}},submitReport:function(){initLoadMask.show();var b=null;if(isSettingsEnabled){b=this.getThinclientsessionsettings().getForm();
}var f=Ext.getCmp("resultPanel");var d=Ext.getCmp("selectionDetails");var h=this.getSettingsFieldValue(b,"reportGeneration",isSettingsEnabled,"er_reportgenration");var a=this.getThinclientsessionreportsform().getForm();appConstants.publicJsonData["hiddenParams"]["daychartfor"]="";var g=Ext.getCmp("reportTypeComboBox").getValue();
if(g=="No"){var c=Ext.getCmp("er_uniqueUser");if((c!=undefined&&c.checked)||appConstants.publicJsonData["er_uniqueUser"]){appConstants.publicJsonData["hiddenParams"]["daychartfor"]="uniqueuser";}if((c!=undefined&&!c.checked)){appConstants.publicJsonData["hiddenParams"]["daychartfor"]="";}}this.getNomeasurepanel().hide();
this.getBackGroundPanel().hide();if(h=="foreground"){this.updateQueryString();Ext.Ajax.request({url:"../servlet/com.eg.ErCtxServerReportC?isSubmit=true",params:queryString+"&responseType=json&thinClientSessionAction=submit",method:"POST",scope:this,success:function(i){var k=i.responseText;if(!Ext.isEmpty(k)){var j=Ext.decode(k);
this.loadThinClientSessionReportData(j);}}});}else{if(h=="background"){Ext.getCmp("gridContainer").hide();Ext.getCmp("dataContainer").hide();this.updateQueryString();f.hide();initLoadMask.show();var e=Ext.getCmp("bgReportName").getValue();e=checkFileName(e);Ext.Ajax.request({url:"../servlet/com.eg.ErStartBackGroundReportC",scope:this,params:queryString+"&bg_reportname="+e+"&isSubmit=true&responseType=json&thinClientSessionAction=showBackgroundReportResult",success:function(i){var k=i.responseText;
var j=Ext.decode(k);this.loadBgReportData(j);}});}else{if(h=="background-csv"){Ext.getCmp("gridContainer").hide();Ext.getCmp("dataContainer").hide();this.updateQueryString();f.hide();initLoadMask.show();var e=Ext.getCmp("bgReportName").getValue();e=checkFileName(e);Ext.Ajax.request({url:"../servlet/com.eg.ErStartBackGroundReportC?isSubmit=true&SaveFormat=CSV",scope:this,params:queryString+"&bg_reportname="+e+"&isSubmit=true&responseType=json&thinClientSessionAction=showBackgroundReportResult",success:function(i){var k=i.responseText;
var j=Ext.decode(k);this.loadBgReportData(j);}});}}}},loadBgReportData:function(c){var f="";var d=c.pageParams["backgroundReportStatus"];Ext.getCmp("gridContainer").hide();Ext.getCmp("resultPanel").hide();if(d!="undefined"){var a=c.pageParams["langSupportMsg"];var e=c.pageParams["bgrdUrl"];var b=c.screenLabels["linkMsg"];
if(d!=null&&d=="success"){f='<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">'+a+".</br>"+'<a class="backgroundMsgLink" href='+e+">"+b+"</a></div></td></tr></table></td></tr></table>";
}else{if(d!=null&&d=="duplicate"){f='<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">'+a+".</br>"+'<a class="backgroundMsgLink" href='+e+">"+b+"</a></div></td></tr></table></td></tr></table>";
}else{f='<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">'+a+"</div></td></tr></table></td></tr></table>";
}}}else{f='<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">Error In BackGround Generation</a></div></td></tr></table></td></tr></table>';
}this.getBackGroundPanel().update(f);this.getBackGroundPanel().show();initLoadMask.hide();},loadGrid:function(a,w){var D=false;var e=Ext.getCmp("dataContainer");var l=new Array();var n=this;if(!Ext.isEmpty(a)){for(var K in a){var k=a[K];var q=k.columns;var y=k.measureData;var M=k.TOTAL_COLUMN_COUNT;var f=k.SINGLE_SUBCOLUMN_COUNT;
var E=this.getMain().getWidth();var I=35;var N=50;var x=160;var G=0;var h=M-f;var g=150+(h*I)+(f*N);var L=k.unitForMeasure;var t=new Array();var P=new Array();var m=0;if(E>g){m=(E-(x))/M;}else{m=I;}for(var o in q){var A=o;var v=new Array();var b=new Array();v=q[o];if(v!=undefined&&!Ext.isEmpty(v)){var C=v.length;
var z=m;if(C==1){if(m<N){z=N;}}else{if(C>1){if(m<N){z=N;}z=z/C;}}for(var J in v){var H=v[J];t.push(A+"_"+H);var F=L[A];var c=H;if(!Ext.isEmpty(F)){c+=" ("+F+")";}b.push({header:c,sortable:true,dataIndex:A+"_"+H,align:"center",width:z,listeners:{sortchange:function(Q,R,S,j,i){s.gridColIndexParam=R.getIndex();
s.gridColStateParam=R.sortState;}},doSort:function(j){var i=this.up("grid").store;var Q=this.getSortParam();i.sort({property:Q,direction:j,sorterFn:function(S,R){S=S.get(Q);R=R.get(Q);S=Ext.isNumber(S)?S:parseFloat(String(S),10);S=isNaN(S)?0:S;R=Ext.isNumber(R)?R:parseFloat(String(R),10);R=isNaN(R)?0:R;
return S>R?1:(S<R?-1:0);}});},renderer:function(U,j,T,W,R,V,i){var S=U["dispVal"];if(!Ext.isEmpty(S)){var Q=U["hrefUrl"];U=S;if(!Ext.isEmpty(Q)&&Q!="-"){if(S!=null&&S=="top.gif"){this.sortable=false;S='<div class="iconArrowUp"></div>';}U='<div align="center"><a class="anchorLinkDefault" href="javascript:void(0);" onclick=showDrillDownData("'+encodeURI(Q)+'") >'+S+"</a></div>";
}if(S.indexOf("div")==-1){j.tdAttr='data-qclass=yellowTip data-qtip="'+S+'"';}}else{j.tdAttr='data-qclass=yellowTip data-qtip="'+U+'"';}return U;}});}var B=new Array();var d=L[A];var O="&nbsp;";if(!Ext.isEmpty(d)){O=" ("+L[A]+")";}P.push({header:A,columns:b,locked:false,});}else{if(G==0){t.push(A);P.push({header:A,sortable:true,locked:true,minWidth:x,dataIndex:A,align:"left",flex:1,renderer:function(U,j,T,W,R,V,i){var S=U["dispVal"];
if(!Ext.isEmpty(S)){var Q=U["hrefUrl"];U=S;if(!Ext.isEmpty(Q)&&Q!="-"){if(S!=null&&S=="top.gif"){this.sortable=false;S='<div class="iconArrowUp"></div>';}U='<div align="center"><a class="anchorLinkDefault" href="javascript:void(0);" onclick=showDrillDownData("'+encodeURI(Q)+'") >'+S+"</a></div>";}if(S.indexOf("div")==-1){j.tdAttr='data-qclass=yellowTip data-qtip="'+S+'"';
}}else{j.tdAttr='data-qclass=yellowTip data-qtip="'+U+'"';}return U;}});}else{t.push(A);b.push({header:"&nbsp",sortable:true,dataIndex:A,align:"center",width:m,listeners:{sortchange:function(Q,R,S,j,i){s.gridColIndexParam=R.getIndex();s.gridColStateParam=R.sortState;}},doSort:function(j){var i=this.up("grid").store;
var Q=this.getSortParam();i.sort({property:Q,direction:j,sorterFn:function(S,R){S=S.get(Q);R=R.get(Q);if(S["dispVal"]!=undefined){S=S["dispVal"];}if(R["dispVal"]!=undefined){R=R["dispVal"];}S=Ext.isNumber(S)?S:parseFloat(String(S),10);S=isNaN(S)?0:S;R=Ext.isNumber(R)?R:parseFloat(String(R),10);R=isNaN(R)?0:R;
return S>R?1:(S<R?-1:0);}});},renderer:function(U,j,T,W,R,V,i){var S=U["dispVal"];if(!Ext.isEmpty(S)){var Q=U["hrefUrl"];U=S;if(!Ext.isEmpty(Q)&&Q!="-"){if(S!=null&&S=="top.gif"){this.sortable=false;S='<div class="iconArrowUp"></div>';}U='<div align="center"><a class="anchorLinkDefault" href="javascript:void(0);" onclick=showDrillDownData("'+encodeURI(Q)+'") >'+S+"</a></div>";
}if(S.indexOf("div")==-1){j.tdAttr='data-qclass=yellowTip data-qtip="'+S+'"';}}else{j.tdAttr='data-qclass=yellowTip data-qtip="'+U+'"';}return U;}});P.push({header:A,locked:false,columns:b});}}G++;}var p;gridPageSize=15;if(y.length<gridPageSize){p=true;}else{p=false;}if(!Ext.isEmpty(y)){var s=this;var u=Ext.create("Ext.data.ArrayStore",{fields:t,proxy:{type:"pagingmemory",reader:{type:"array",root:"data",totalProperty:"total"},data:y,},data:y,remoteSort:true,autoLoad:true,pageSize:gridPageSize,sorters:{property:t[0],direction:"ASC"}});
l.push({xtype:"panel",ui:"newGraphPanel",margin:"10 10 10 10",title:k.tableTitle,items:[{xtype:"customgrid",store:u,columns:P,needtoFixColumn:true,id:"gridId"+K,ui:"newGridPanel",frame:false,border:true,margin:"5 10 10 10",padding:0,listeners:{sortchange:function(Q,R,S,j,i){s.gridColIndexParam=R.getIndex();
s.gridColStateParam=R.sortState;},render:function(i){}},dockedItems:[{xtype:"pagingtoolbar",cls:"newPagination",dock:"bottom",displayInfo:true,store:u,hidden:p,displayInfo:true,displayMsg:"Displaying {0} - {1} of {2}",emptyMsg:"No topics to display",listeners:{change:function(i,j){if(!Ext.isEmpty(j)){activePage=j.currentPage;
}else{activePage=1;}}}}]}]});}}Ext.getCmp("csvTool").setDisabled(false);if(!Ext.isEmpty(l)){e.add(l);e.show();e.doLayout();var r=Ext.getCmp("compTypeComboBox").getValue();if(r!="All Types"){D=this.noMeasureForData(w);}else{D=true;}}}return D;},noMeasureForData:function(b){isDataAvailable=false;var a=b["summaryTableJson"];
if(!Ext.isEmpty(a)&&b.hasOwnProperty("summaryTableJson")){for(var d in a){var c=a[d];var g=c["val"];var e=c["hrefUrl"];var f=g;if((g=="-"&&e=="-")||(c==undefined&&g==undefined&&e==undefined)){isDataAvailable=false;}else{isDataAvailable=true;}}}return isDataAvailable;},reportGenChange:function(){var b=this.getThinclientsessionsettings().getForm();
this.disableTools();var a=b.findField("reportGeneration").getValue();if(a=="background"){b.findField("bgReportName").setValue("");b.findField("bgReportName").show();Ext.getCmp("moreOptionCloseId").hide();Ext.getCmp("submitViaSetting").show();}else{if(a=="background-csv"){b.findField("bgReportName").setValue("");
b.findField("bgReportName").show();Ext.getCmp("moreOptionCloseId").hide();Ext.getCmp("submitViaSetting").show();}else{b.findField("bgReportName").hide();Ext.getCmp("moreOptionCloseId").show();Ext.getCmp("submitViaSetting").hide();}}Ext.getCmp("resultPanel").hide();Ext.getCmp("gridContainer").hide();},changeTrend:function(s){this.disableTools();
var k=null;if(isSettingsEnabled){k=this.getThinclientsessionsettings().getForm();}var f=this.getThinclientsessionreportsform().getForm();var e=f.findField("er_stdate");var q=f.findField("er_sthr");var l=f.findField("er_enddate");var p=f.findField("er_endhr");var n=f.findField("er_timeline");var u=this;
if(n.getValue()=="Any"){e.setDisabled(false);q.setDisabled(false);l.setDisabled(false);p.setDisabled(false);}else{e.setDisabled(true);q.setDisabled(true);l.setDisabled(true);p.setDisabled(true);n.suspendEvents(true);}var a="No";var g=this.getSettingsFieldValue(k,"showDataComboBox",isSettingsEnabled,"selectedShowDataOption");
var m=Ext.getCmp("er_timeline").getValue();var r="true";if(r=="true"){var i="F=gettimeline&U=123444&C=jsrs1&P0=["+g+"]";Ext.Ajax.request({url:"/final/servlet/com.eg.ErRemoteScriptingServlet",params:i,scope:this,async:true,success:function(y){var C=y.responseText;var A=Ext.decode(C);var w=A.combo;var B=A.combo;
var v=Ext.getCmp("er_timeline");v.getStore().removeAll();v.getStore().loadRawData(A.combo);var x=false;for(var z=0;z<w.length;z++){if(w[z].valueField==m){x=true;}}if(x){v.setValue(m);}else{v.setValue("1 day");}}});var t=Ext.getCmp("er_timeline").getValue();var b=Ext.getCmp("er_stdate").dataArray;var h=Ext.getCmp("er_enddate").dataArray;
var j=Ext.getCmp("er_sthr").dataArray;var o=Ext.getCmp("er_endhr").dataArray;var c=appConstants.publicJsonData["hiddenParams"]["inidate"];var d="";if(g=="No"){isTrend=false;d="F=getTime&U=123444&C=jsrs1&P0=["+t+"]&P1=["+b+"]&P2=["+h+"]&P3=["+j+"]&P4=["+o+"]&P5=["+c+"]";}else{isTrend=true;if(t=="Any"){d="F=getTime&U=123444&C=jsrs1&P0=["+t+"]&P1=["+b+"]&P2=["+h+"]&P3=["+j+"]&P4=["+o+"]&P5=["+c+"]";
}else{d="F=getTrendTime&U=123444&C=jsrs1&P0=["+t+"]&P1=["+b+"]&P2=["+h+"]&P3=["+j+"]&P4=["+o+"]&P5=["+mgr_stmin+"]&P6=["+mgr_enmin+"]&P7=["+c+"]";}}Ext.Ajax.request({url:"/final/servlet/com.eg.ErRemoteScriptingServlet",params:d,scope:this,async:true,success:function(w){var y=w.responseText;var x=Ext.decode(y);
var v=x.timeline;Ext.getCmp("er_stdate").dataArray=v[0];Ext.getCmp("er_enddate").dataArray=v[1];Ext.getCmp("er_sthr").dataArray=v[2];Ext.getCmp("er_endhr").dataArray=v[3];mgr_stmin=v[4];mgr_enmin=v[5];Ext.getCmp("er_stdate").setValue(v[6]);Ext.getCmp("er_enddate").setValue(v[7]);Ext.getCmp("er_sthr").setValue(v[8]);
Ext.getCmp("er_endhr").setValue(v[9]);stmin=v[10];enmin=v[11];}});}n.resumeEvents();},loadTools:function(){this.getNewUtilities().loadIcon(true,true,true,false,true,true,true,false,false,false,true);Ext.getCmp("favoriteTool").setDisabled(false);Ext.getCmp("scheduleTool").setDisabled(false);},disableTools:function(){Ext.getCmp("bookletTool").setDisabled(true);
Ext.getCmp("saveTool").setDisabled(true);Ext.getCmp("printTool").setDisabled(true);Ext.getCmp("mailTool").setDisabled(true);Ext.getCmp("csvTool").setDisabled(true);},updateQueryString:function(){var i=this.getThinclientsessionreportsform().getForm();var r=null;if(isSettingsEnabled){r=this.getThinclientsessionsettings().getForm();
}var l;var e;var A="";var C;var c;var b=i.findField("zoneComboBox").getValue();var w=i.findField("compTypeComboBox").getValue();if((appConstants.fromDailyMailer||appConstants.fromDailyMailer=="true")&&appConstants.analysisby!=null&&appConstants.analysisby=="ComponentType"){w=appConstants.analysis;}var F=i.findField("reportTypeComboBox").getValue();
var v=i.findField("er_mode").getValue();var t=i.findField("er_stdate").dataArray;var x=i.findField("er_enddate").dataArray;var j=i.findField("er_timeline").getValue();var o=i.findField("er_sthr").dataArray;var D=i.findField("er_endhr").dataArray;var d="";var E=this.getSettingsFieldValue(r,"timefrom",isSettingsEnabled,"selectedFromTime");
var k=this.getSettingsFieldValue(r,"timeto",isSettingsEnabled,"selectedToTime");var B=this.getSettingsFieldValue(r,"minfrom",isSettingsEnabled,"selectedFromMin");var z=this.getSettingsFieldValue(r,"minto",isSettingsEnabled,"selectedToMin");var y=this.getSettingsFieldValue(r,"showDataComboBox",isSettingsEnabled,"selectedShowDataOption");
var n=this.getSettingsFieldValue(r,"excludeWeekendsComboBox",isSettingsEnabled,"selectedExcludeWeekEndOption");var f=this.getSettingsFieldValue(r,"reportGeneration",isSettingsEnabled,"er_reportgenration");l="select_farm="+b+"&er_select_server="+w+"&er_type="+F;var u=Ext.getCmp("er_option");if(u!=undefined){l+="&er_option="+u.getValue();
if(u.getValue()=="Group"||u.getValue()=="Segment"||u.getValue()=="Service"){var q=Ext.getCmp("er_site");l+="&er_site="+q.getValue();}}if(!Ext.isEmpty(F)){var m=F;if(m=="Yes"){var h=i.findField("measureComboBox").getValue();l=l+"&select_testmes="+h;d="chart";}else{d="data";}}e="&er_excwe="+n+"&er_trenddata="+y+"&er_mode="+v+"&er_reportgenration="+f+"&opt="+d;
var C="&er_timeline="+j+"&startdate="+t+"&enddate="+x+"&starthr="+o+"&endhr="+D+"&startmin="+mgr_stmin+"&endmin="+mgr_enmin;var p="&timefrom="+E+"&minfrom="+B+"&timeto="+k+"&minto="+z;var a="";var s=appConstants.publicJsonData["hiddenParams"];for(var g in s){a+="&"+g+"="+s[g];}queryString=l+e+C+a+p;if(f!=null&&(f=="background"||f=="background-csv")){queryString=queryString+"&forwardto=ErCtxSessionReportJson";
}else{queryString=queryString+"&forwardto=ErCtxSessionReport";}if(Ext.getCmp("er_uniqueUser")!=undefined){queryString=queryString+"&er_uniqueUser="+(Ext.getCmp("er_uniqueUser").checked);}queryString=queryString+"&select_compType="+encodeURIComponent(w);queryString+="&er_RmDispName="+appConstants.er_RmDispName;
},loadMainElements:function(){var h=this.getThinclientsessionreportsform().getForm();var j=appConstants.publicJsonData.pageParams["selectedReportType"];var f=h.findField("reportTypeComboBox");f.setFieldLabel(appConstants.publicJsonData.screenLabels["reporter.common.Report Type"]);f.getStore().loadRawData(appConstants.publicJsonData["repTypeJson"]);
f.setValue(j);var f=h.findField("er_option");f.getStore().loadRawData(appConstants.publicJsonData["analysisByCombo"]);var o=appConstants.publicJsonData.selectedAnalysisByCombo;if(o!=null&&o!=""&&o!="undefined"&&o!=undefined){f.setValue(appConstants.publicJsonData.selectedAnalysisByCombo);}else{f.setValue("-1");
}var l=h.findField("zoneComboBox");l.setFieldLabel(appConstants.publicJsonData.screenLabels["reporter.thin.Zone"]);l.getStore().clearFilter(true);l.getStore().loadRawData(appConstants.publicJsonData["zoneListJson"]);var a=appConstants.publicJsonData.pageParams["selectedZone"];if(a!=null&&a!=""&&a!="undefined"&&a!=undefined){l.setValue(appConstants.publicJsonData.pageParams["selectedZone"]);
}else{l.setValue("-1");}var k=Ext.getCmp("compTypeComboBox");k.getStore().clearFilter(true);k.getStore().loadRawData(appConstants.publicJsonData["compTypeJson"]);if((appConstants.fromDailyMailer||appConstants.fromDailyMailer=="true")&&appConstants.analysisby!=null&&appConstants.analysisby=="ComponentType"){k.setValue(appConstants.analysis);
}else{k.setValue(appConstants.publicJsonData.pageParams["selectedCompType"]);}var r=h.findField("measureComboBox");r.setFieldLabel(appConstants.publicJsonData.screenLabels["reporter.thin.Criteria"]);r.getStore().clearFilter(true);r.getStore().loadRawData(appConstants.publicJsonData["measureOpts"]);r.setValue(appConstants.publicJsonData.pageParams["selectedMeasure"]);
if(!Ext.isEmpty(j)&&j=="Yes"){r.show();}else{r.hide();}var p=appConstants.publicJsonData["hiddenParams"];var n=p["fromScheduleModify"];var b=p["fromFavoriteModify"];if((n!=null&&n=="Yes")||(b!=null&&b=="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 d="";if(appConstants.publicJsonData.hasOwnProperty("selectedAnalysisByCombo")){d=appConstants.publicJsonData.selectedAnalysisByCombo;}var q=h;if(d=="Zone"){Ext.getCmp("er_site").hide();comboRawData=appConstants.publicJsonData.zoneListJson;
selectedComboOption=appConstants.publicJsonData.pageParams.selectedZone;comboObject=q.findField("zoneComboBox");comboObject.setFieldLabel("Zone");comboObject.getStore().clearFilter(true);comboObject.getStore().loadRawData(comboRawData);if(!Ext.isEmpty(selectedComboOption)){comboObject.setValue(selectedComboOption);
}else{comboObject.setValue(comboRawData[0].valueField);}}else{if(d=="Segment"){Ext.getCmp("zoneComboBox").hide();comboRawData=appConstants.publicJsonData.siteCombo;selectedComboOption=appConstants.publicJsonData.pageParams.selectedSiteCombo;comboObject=q.findField("er_site");comboObject.setFieldLabel("Segment");
comboObject.getStore().clearFilter(true);comboObject.getStore().loadRawData(comboRawData);if(!Ext.isEmpty(selectedComboOption)){comboObject.setValue(selectedComboOption);}else{comboObject.setValue(comboRawData[0].valueField);}comboObject.show();}else{if(d=="Group"){Ext.getCmp("zoneComboBox").hide();comboRawData=appConstants.publicJsonData.siteCombo;
selectedComboOption=appConstants.publicJsonData.pageParams.selectedSiteCombo;comboObject=q.findField("er_site");comboObject.setFieldLabel("Group");comboObject.getStore().clearFilter(true);comboObject.getStore().loadRawData(comboRawData);if(!Ext.isEmpty(selectedComboOption)){comboObject.setValue(selectedComboOption);
}else{comboObject.setValue(comboRawData[0].valueField);}comboObject.show();}else{if(d=="Service"){Ext.getCmp("zoneComboBox").hide();comboRawData=appConstants.publicJsonData.siteCombo;selectedComboOption=appConstants.publicJsonData.pageParams.selectedSiteCombo;comboObject=q.findField("er_site");comboObject.setFieldLabel("Service");
comboObject.getStore().clearFilter(true);comboObject.getStore().loadRawData(comboRawData);if(!Ext.isEmpty(selectedComboOption)){comboObject.setValue(selectedComboOption);}else{comboObject.setValue(comboRawData[0].valueField);}comboObject.show();}else{if(d=="Component"){Ext.getCmp("zoneComboBox").hide();
Ext.getCmp("er_site").hide();}}}}}var i=Ext.getCmp("reportTypeComboBox").getValue();if(i=="Yes"){var r=q.findField("measureComboBox");r.getStore().clearFilter(true);r.getStore().loadRawData(appConstants.publicJsonData["measureOpts"]);r.setValue(appConstants.publicJsonData.pageParams["selectedMeasure"]);
Ext.getCmp("measureComboBox").show();}else{Ext.getCmp("measureComboBox").hide();}if(appConstants.publicJsonData.pageParams["selectedShowDataOption"]=="Yes"){isTrend=true;}var c=h.findField("er_timeline");c.setFieldLabel(appConstants.publicJsonData.screenLabels["reporter.common.Timeline"]);c.getStore().loadRawData(appConstants.publicJsonData["timelineJSONArray"]);
c.setValue(appConstants.publicJsonData.pageParams["selectedTimeline"]);var g=h.findField("er_stdate");g.setValue(appConstants.publicJsonData.pageParams["startDateForDisplay"]);g.dataArray=appConstants.publicJsonData.pageParams["startDate"];var t=h.findField("er_sthr");t.setValue(appConstants.publicJsonData.pageParams["startHourForDisplay"]);
t.dataArray=appConstants.publicJsonData.pageParams["startHour"];var m=h.findField("er_enddate");m.setValue(appConstants.publicJsonData.pageParams["endDateForDisplay"]);m.dataArray=appConstants.publicJsonData.pageParams["endDate"];var s=h.findField("er_endhr");s.setValue(appConstants.publicJsonData.pageParams["endHourForDisplay"]);
s.dataArray=appConstants.publicJsonData.pageParams["endHour"];stmin=appConstants.publicJsonData.pageParams["startMinForDisplay"];enmin=appConstants.publicJsonData.pageParams["endMinForDisplay"];mgr_stmin=appConstants.publicJsonData.pageParams["startmin"];mgr_enmin=appConstants.publicJsonData.pageParams["endmin"];
var e=h.findField("er_mode");e.setFieldLabel(appConstants.publicJsonData.screenLabels["reporter.common.Graph"]);e.setValue(appConstants.publicJsonData.pageParams["graphmode"]);if(!Ext.isEmpty(j)&&j=="Yes"){e.show();}else{e.hide();}updateAppSettings();},loadSettingsElements:function(){Ext.getCmp("moreOptionCloseId").show();
var e=appConstants.publicJsonData["hiddenParams"]["favorite_id"];if(!Ext.isEmpty(e)){Ext.getCmp("reportGeneration").setDisabled(true);}var j=this.getThinclientsessionsettings().getForm();var g=appConstants.publicJsonData.pageParams["selectedReportType"];var t=Ext.getCmp("reportTypeComboBox").getValue();
if(t=="No"){if(Ext.getCmp("er_uniqueUser")!=undefined){Ext.getCmp("er_uniqueUser").show();}}else{if(Ext.getCmp("er_uniqueUser")!=undefined){Ext.getCmp("er_uniqueUser").hide();}}var h=j.findField("showDataComboBox");h.setFieldLabel(appConstants.publicJsonData.screenLabels["reporter.common.Show Data"]);
h.getStore().loadRawData(appConstants.publicJsonData["showDataOptJson"]);h.setValue(appConstants.publicJsonData.pageParams["selectedShowDataOption"]);var d=appConstants.publicJsonData.hiddenParams["trendenable"];if(d=="false"){Ext.getCmp("showDataComboBox").hide();}else{Ext.getCmp("showDataComboBox").show();
}var m=j.findField("excludeWeekendsComboBox");m.setFieldLabel(appConstants.publicJsonData.screenLabels["reporter.common.Exclude weekends"]);m.getStore().loadRawData(appConstants.publicJsonData["excludeWeekDaysOpt"]);m.setValue(appConstants.publicJsonData.pageParams["selectedExcludeWeekEndOption"]);var r=Ext.getCmp("fromTimeLbl");
r.setText(appConstants.publicJsonData.screenLabels["reporter.common.From"]);var c=Ext.getCmp("fromHrsLbl");c.setText(appConstants.publicJsonData.screenLabels["reporter.common.Hrs"]);var l=Ext.getCmp("fromMinsLbl");l.setText(appConstants.publicJsonData.screenLabels["reporter.common.Mins"]);var a=Ext.getCmp("toTimeLbl");
a.setText(appConstants.publicJsonData.screenLabels["reporter.common.To"]);var s=Ext.getCmp("toHrsLbl");s.setText(appConstants.publicJsonData.screenLabels["reporter.common.Hrs"]);var n=Ext.getCmp("toMinsLbl");n.setText(appConstants.publicJsonData.screenLabels["reporter.common.Mins"]);var k=j.findField("timefrom");
k.setValue(appConstants.publicJsonData.pageParams["selectedFromTime"]);var q=j.findField("minfrom");q.setValue(appConstants.publicJsonData.pageParams["selectedFromMin"]);var f=j.findField("timeto");f.setValue(appConstants.publicJsonData.pageParams["selectedToTime"]);var p=j.findField("minto");p.setValue(appConstants.publicJsonData.pageParams["selectedToMin"]);
stmin=appConstants.publicJsonData.pageParams["startMinForDisplay"];enmin=appConstants.publicJsonData.pageParams["endMinForDisplay"];updatingAppSettings();var i="";if(!Ext.isEmpty(appConstants.repotgene)&&appConstants.repotgene!=undefined&&appConstants.repotgene!="undefined"){i=appConstants.repotgene;
}else{i=appConstants.publicJsonData;}var b=j.findField("reportGeneration");b.setFieldLabel(appConstants.publicJsonData.screenLabels["reporter.consolidated.Report Generation"]);b.getStore().loadRawData(i["repGenOptJson"]);b.setValue(i["reportGeneration"]);Ext.getCmp("er_uniqueUser").setValue(i["er_uniqueUser"]);
var o=this;Ext.EventManager.onWindowResize(function(){Ext.get("configMod").setStyle("left","");});Ext.get("closeSettings").on("click",function(){o.validateAndCloseSettings();});},validateAndCloseSettings:function(){var b=this.validateSettings();var a=Ext.getCmp("submit");a.setDisabled(true);if(b){a.setDisabled(false);
Ext.get("configMod").animate({duration:500,to:{y:-500}});return true;}return false;},closeAndSubmitSettings:function(){if(this.validateAndCloseSettings()){this.submitReport();}},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:565,id:"configMod",ui:"settingsWindowContainer",items:[{xtype:"container",cls:"configMode_popupArrow",style:{"top":"-14px","left":"355px"}},{xtype:"container",html:a.apply(),cls:"containerHeader",style:{"top":"0px","margin":"0px"}},{xtype:"thinclientsessionsettings",parent:this}],renderTo:"thinclientsession-innerCt"});
},afterMainRender:function(){var b=this;var a="";if(isSettingsEnabled){a=this.getThinclientsessionsettings().getForm();}if(appConstants.isSubmit!=null&&appConstants.isSubmit=="true"){var c=this.getSettingsFieldValue(a,"reportGeneration",isSettingsEnabled,"er_reportgenration");if(c=="foreground"){dataType=appConstants.publicJsonData["DataType"];
if(!Ext.isEmpty(dataType)&&dataType=="dayWiseAndUserWiseData"){this.loadThinClientSessionReportData(appConstants.publicJsonData);}else{this.showResult();}}else{this.loadBgReportData(appConstants.publicJsonData);}}else{if(appConstants.isForceSubmit=="true"){this.showResult();appConstants.isForceSubmit="false";
}}if(appConstants.er_RmDispName!=null&&appConstants.er_RmDispName!="null"&&appConstants.er_RmDispName!="undefined"){this.getMain().setTitle(appConstants.er_RmDispName);}if(!hideBackButton){Ext.getCmp("thinclientsessionreportsform").add({xtype:"hidden",id:"ID",name:"ID",value:appConstants.publicJsonData["ID"]});
}initLoadMask.hide();if(appConstants.fromDailyMailer||appConstants.fromDailyMailer=="true"){this.showResult();}},getSettingsFieldValue:function(a,f,c,d){var e="";if(c){var b=a.findField(f);if(!Ext.isEmpty(b)){e=b.getValue();}}else{e=appConstants.publicJsonData.pageParams[d];}return e;},loadUniqueUsrLst:function(){var d=appConstants.userListStr.split(",");
var c='<div style="text-align:center;" class="x-table"><div class="sessionAnalysisInnerHeader" >User</div><table class="x-grid-table x-grid-table-resizer">';c=c+'<tr class="x-grid-row">';for(var a=0;a<d.length;a++){if(a%4==0){c=c+"</tr>";c=c+'<tr class="x-grid-row">';}c=c+'<td valign="top" class="x-grid-cell"><div class="x-grid-cell-inner">';
c=c+"&nbsp;"+d[a];}c=c+"</div></tr>";c=c+"</table></div>";var b=Ext.widget("uniqueUserPopup");b.add({xtype:"outerPanel",cls:"outerpanel",margin:0,frame:false,hidden:false,layout:{type:"vbox",align:"stretch"},tools:[{xtype:"uniqueUserPopupTools"}],items:[{xtype:"panel",border:true,frame:false,cls:"datapanel",id:"drillDownResultPanel",name:"drillDownResultPanel",title:"Unique user list",width:750,html:c}]});
b.show();}});