Ext.define("applicationlaunch.controller.ApplicationLaunchController",{extend:"Ext.app.Controller",refs:[{selector:"newUtilities",ref:"newUtilities"},{selector:"main",ref:"main"},{selector:"nomeasurepanel",ref:"nomeasurepanel"},{selector:"ReporterSettings",ref:"ReporterSettings"}],foregroundJspUrl:"/final/reporter/ErApplicationLaunchCountReportJson.jsp",foregroundControllerUrl:"../servlet/com.eg.ErApplicationLaunchCountReportC",backgroundControllerUrl:"../servlet/com.eg.ErStartBackGroundReportC",isNewFav:false,isNewSch:false,init:function(){this.control({"main":{"afterrender":this.boxready},"mainform":{"afterrender":this.loadForm},"newUtilities":{"render":this.loadTools},"applicationlaunchsettings":{"afterrender":this.loadSettings},'applicationlaunchform combo[name="er_type"]':{"select":this.onReportChange},'applicationlaunchform combo[name="select_farm"]':{"select":this.onZoneChange},'applicationlaunchform combo[name="er_detailsBasedOn"]':{"select":this.onDetailsChange},'applicationlaunchsettings combo[name="reportGeneration"]':{"select":this.onChangeReportGeneration},'applicationlaunchsettings button[id="moreOptionCloseId"]':{"click":this.validateAndCloseSettings},'applicationlaunchsettings button[id="submitViaSetting"]':{"click":this.closeSettingAndSubmit},'applicationlaunchform combo[name="er_compType"]':{"select":this.onComponentTypeChange},'applicationlaunchform button[name="submit"]':{"click":this.showResult},'egcomponent button[id="compExpand"]':{"click":this.expandMe},'egcomponent multiselect[id="er_component"]':{"change":this.onChangeComponent},'fieldcontainer button[id="vmExpand"]':{"click":this.expandMe},'egcomponent trigger[id="compSearch"]':{"change":this.filterMultiselect},'fieldcontainer trigger[id="vmSearch"]':{"change":this.filterMultiselect},'application button[id="appExpand"]':{"click":this.expandMe},'application trigger[id="appSearch"]':{"change":this.filterMultiselect},'user button[id="userExpand"]':{"click":this.expandMe},'user trigger[id="userSearch"]':{"change":this.filterMultiselect},'adgroup button[id="adgroupExpand"]':{"click":this.expandMe},'adgroup trigger[id="adgroupSearch"]':{"change":this.filterMultiselect},"newUtilities > #printTool > button":{"click":this.printFile},"newUtilities > #saveTool > button":{"click":this.saveReportAsPDF},"newUtilities > #mailTool > button":{"click":this.sendMail},"newUtilities > #csvTool > button":{"click":this.saveCsv},'main button[id="excelToolBtn"]':{"click":this.saveExcel},"newUtilities > #favoriteTool > button":{"click":this.saveFavorite},"newUtilities > #scheduleTool > button":{"click":this.saveSchedule},'applicationlaunchform button[name="save"]':{"click":this.goTo},'mainform button[id="panelinsidetoggle"]':{"click":this.toggleForm},'mainform combo[id="er_option"]':{"select":this.onSelectAnalysisBy},'mainform combo[id="er_site"]':{"select":this.er_siteOnChange}});
},onChangeComponent:function(h,b,a){if(a==undefined||a=="undefined"){return;}var f=Ext.getCmp("er_option").getValue();var g="er_option="+f+"&er_type="+Ext.getCmp("er_type").getValue()+"&er_compType="+Ext.getCmp("er_compType").getValue();if(Ext.getCmp("er_type").getValue()=="No"){var c=Ext.getCmp("er_compType").getValue();
var e=appConstants.vmComponentListEntry.indexOf(c);if(e>=0){if(appConstants.isLaunchByVm){g+="&islaunchByVm=true";}}}if(f=="Zone"){g+="&select_farm="+Ext.getCmp("select_farm").getValue();}else{if(f=="Group"||f=="Service"||f=="Segment"){g+="&er_site="+Ext.getCmp("er_site").getValue();}}var j=h.getValue();
for(var k in j){g+="&er_component="+j[k];}this.getAjaxData(this.foregroundJspUrl,g);var i=this;var d=new Ext.util.DelayedTask(function(){i.loadApplications();});d.delay(1000);this.loadComboField("er_workerGroup","workerGroupCombo","workerGroupLabel","workerGroupSelected",appConstants.publicJsonData,false,null,true);
this.loadUsers();},onSelectAnalysisBy:function(b){var a=b.getValue();var c="er_option="+a+"&er_type="+Ext.getCmp("er_type").getValue();this.getAjaxData(this.foregroundJspUrl,c);this.loadComboField("er_compType","componentTypeCombo","componentTypeLabel","componentTypeSelected",appConstants.publicJsonData,false,null,true);
if(a=="Component"){Ext.getCmp("select_farm").hide();Ext.getCmp("er_site").hide();}else{if(a=="Zone"){Ext.getCmp("select_farm").show();Ext.getCmp("er_site").hide();this.loadComboField("select_farm","zoneCombo","zoneLabel","zoneSelected",appConstants.publicJsonData,false,null,true);}else{Ext.getCmp("select_farm").hide();
this.loadComboField("er_site","siteCombo","siteComboLabel","selectedSiteCombo",appConstants.publicJsonData,false,null,true);}}if(Ext.getCmp("er_type").getValue()=="No"){this.loadComboField("er_component","componentCombo","componentLabel","componentSelected",appConstants.publicJsonData,true,"componentpane",false);
}this.loadDataForReportChange();this.loadApplications();this.loadComboField("er_workerGroup","workerGroupCombo","workerGroupLabel","workerGroupSelected",appConstants.publicJsonData,false,null,true);this.loadUsers();},er_siteOnChange:function(a){var c=a.getValue();var b="er_option="+Ext.getCmp("er_option").getValue()+"&er_site="+Ext.getCmp("er_site").getValue()+"&er_type="+Ext.getCmp("er_type").getValue();
this.getAjaxData(this.foregroundJspUrl,b);this.loadComboField("er_compType","componentTypeCombo","componentTypeLabel","componentTypeSelected",appConstants.publicJsonData,false,null,true);this.loadDataForReportChange();this.loadApplications();this.loadComboField("er_workerGroup","workerGroupCombo","workerGroupLabel","workerGroupSelected",appConstants.publicJsonData,false,null,true);
this.loadUsers();},goTo:function(a){if(appConstants.frmSchModify=="Yes"){this.saveSchedule(a);}else{this.saveFavorite(a);}},saveSchedule:function(d){if(this.validateMainForm(false)&&Ext.getCmp("er_timeline").getValue()=="Any"){Ext.MessageBox.show({title:"Application Launch",msg:"Chosen timeline not allowed",buttons:Ext.MessageBox.OK,icon:Ext.MessageBox.WARNING});
return false;}if(d.getId()=="save"){var c="/final/reporter/ErSaveSchedule.jsp?"+this.getQueryString(true,true,true,true)+"&option=data&com.eg.CSRF_NONCE="+csrfToken;if(c!=undefined&&c.indexOf("schedule_id")==-1){c+="&schedule_id="+appConstants.schedule_id;}c+="&showSchWindow=no";var b=c.substr(0,c.indexOf("?"));
var e=c.substr(c.indexOf("?")+1,c.length-1);var a=Ext.create("Ext.form.Panel");a.submit({url:b,params:e,standardSubmit:true,method:"POST"});}else{this.isNewSch=true;var c="/final/reporter/ErSaveSchedule.jsp?"+this.getQueryString(true,true,true)+"&option=data&com.eg.CSRF_NONCE="+csrfToken;parent.scheduleWindowFn(c);
}},saveFavorite:function(e){var d=this.validateMainForm(false);var c="";if(e.getId()=="save"){this.isNewFav=false;c="/final/reporter/ErSaveFavorite.jsp?"+this.getQueryString(true,true,true,true)+"&er_view=GRAPH&cmd=client&fromFavoriteModify=Yes"+"&er_RmDispName="+appConstants.er_RmDispName+"&com.eg.CSRF_NONCE="+csrfToken;
if(c!=undefined&&c.indexOf("FavoriteId")==-1){c+="&FavoriteId="+appConstants.favorite_id;}c+="&showSchWindow=no";var b=c.substr(0,c.indexOf("?"));var f=c.substr(c.indexOf("?")+1,c.length-1);var a=Ext.create("Ext.form.Panel");a.submit({url:b,params:f,standardSubmit:true,method:"POST"});}else{this.isNewFav=true;
c="../servlet/com.eg.ErFavoriteC?"+this.getQueryString(true,true,true)+"&er_view=GRAPH&cmd=client"+"&er_RmDispName="+appConstants.er_RmDispName+"&com.eg.CSRF_NONCE="+csrfToken;parent.favouriteWindowFn(c);}},saveReportAsPDF:function(){var a="../reporter/ErHtmlToSavePdf.jsp?"+appConstants.publicJsonData.urlFields.saveQueryString;
if(Ext.isEmpty(appConstants.erUtils)){appConstants.erUtils=Ext.widget("erutils");}appConstants.erUtils.savePDF(a);},bookletQuery:function(b){var a=appConstants.publicJsonData.urlFields.saveQueryString;return a;},bookletScheduleQuery:function(b){var a=this.getQueryString(true,true,true)+"&option=data";
return a;},bookletPreview:function(){this.printFile();},printFile:function(){var a="/final/reporter/ErApplicationLaunchCountReportPrint.jsp?"+appConstants.publicJsonData.urlFields.saveQueryString+"&er_view=PRINT&pdfPrint=yes";parent.printWindowFn(a);},sendMail:function(){Ext.widget("sendmail").show();
},saveExcel:function(){var b=Ext.getCmp("er_compType").getValue();var c=Ext.getCmp("er_detailsBasedOn").getValue();var d="";if(isSettingsEnabled){var a=Ext.getCmp("clientGeoDetails");if(!a.isHidden()){d+="&geoDetails="+a.getValue().geoDetails;}}window.location="../servlet/com.eg.ErApplicationLaunchCountReportC?er_csvrequest=yes"+"&er_compType="+b+"&er_detailsBasedOn="+c+d;
},saveCsv:function(){window.location="../servlet/egurkha.reporter.SaveInCSVFormat";},filterMultiselect:function(a){a.toggleTriggger();if(Ext.isEmpty(appConstants.erUtils)){appConstants.erUtils=Ext.widget("erutils");}if(a.getId()=="compSearch"){appConstants.erUtils.filterComboStore(a,Ext.getCmp("er_component"),appConstants.publicJsonData.combo.componentCombo);
}else{if(a.getId()=="appSearch"){if(Ext.getCmp("applicationpane").fieldLabel=="User"){appConstants.erUtils.filterComboStore(a,Ext.getCmp("er_application"),appConstants.publicJsonData.combo.userCombo);}else{appConstants.erUtils.filterComboStore(a,Ext.getCmp("er_application"),appConstants.publicJsonData.combo.applicationCombo);
}}else{if(a.getId()=="userSearch"){if(Ext.getCmp("userpane").fieldLabel=="Applications"){appConstants.erUtils.filterComboStore(a,Ext.getCmp("er_user"),appConstants.publicJsonData.combo.applicationCombo);}else{appConstants.erUtils.filterComboStore(a,Ext.getCmp("er_user"),appConstants.publicJsonData.combo.userCombo);
}}else{if(a.getId()=="adgroupSearch"){appConstants.erUtils.filterComboStore(a,Ext.getCmp("er_adGroup"),appConstants.publicJsonData.combo.adGroupCombo);}else{if(a.getId()=="vmSearch"){appConstants.erUtils.filterComboStore(a,Ext.getCmp("er_vm"),appConstants.publicJsonData.combo.vmOptsJson);}}}}}},expandMe:function(a){var b=Ext.getCmp("er_detailsBasedOn").getValue();
if(Ext.isEmpty(appConstants.erUtils)){appConstants.erUtils=Ext.widget("erutils");}if(a.getId()=="compExpand"){appConstants.erUtils.expandMultiComboButton(Ext.getCmp("er_component"),"Components",a);}else{if(a.getId()=="vmExpand"){appConstants.erUtils.expandMultiComboButton(Ext.getCmp("er_vm"),"DESKTOP",a);
}else{if(a.getId()=="appExpand"){if(b!=null&&b=="user"){appConstants.erUtils.expandMultiComboButton(Ext.getCmp("er_application"),"Users",a);}else{appConstants.erUtils.expandMultiComboButton(Ext.getCmp("er_application"),"Applications",a);}}else{if(a.getId()=="userExpand"){if(b!=null&&b=="user"){appConstants.erUtils.expandMultiComboButton(Ext.getCmp("er_user"),"Applications",a);
}else{appConstants.erUtils.expandMultiComboButton(Ext.getCmp("er_user"),"Users",a);}}else{if(a.getId()=="adgroupExpand"){appConstants.erUtils.expandMultiComboButton(Ext.getCmp("er_adGroup"),"Ad Group",a);}}}}}},toggleChildTables:function(d){var c=$("#"+d).hasClass("iconTreeExpand");var b=d.split("_");
if(c){$("#"+d).removeClass("iconTreeExpand");$("#"+d).addClass("iconTreeCollapse");}else{$("#"+d).removeClass("iconTreeCollapse");$("#"+d).addClass("iconTreeExpand");}if(b[0]=="data"){var a="child_tr"+b[1]+"_";$("#anbu tr[id^="+a+"]").each(function(e,f){if(c){f.style.display="table-row";}else{f.style.display="none";
}});}else{if(b[0]=="child"){if(c){document.getElementById("subChild_tr_"+b[1]+"_"+b[2]).style.display="table-row";}else{document.getElementById("subChild_tr_"+b[1]+"_"+b[2]).style.display="none";}}else{conosle.log("issue in toggling");}}Ext.getCmp("resultContainer").doLayout();},loadReportData:function(){var d=Ext.getCmp("resultContainer");
var S=Ext.getCmp("er_compType").getValue();var u=Ext.getCmp("er_detailsBasedOn").getValue();var V=appConstants.publicJsonData.selectedFields.reportGenerationSelected;this.hideResults();var U=Ext.getCmp("er_stdate").getValue();U.setHours(Ext.getCmp("er_sthr").getValue());var E=Ext.getCmp("er_enddate").getValue();
E.setHours(Ext.getCmp("er_endhr").getValue());var v=checkDateTime(U,E);if(!v){return;}if(V=="foreground"){d.removeAll();if(appConstants.publicJsonData.hasOwnProperty("graph")){if(appConstants.publicJsonData.graph.hasOwnProperty("noMeasures")){this.disableTools();this.getNomeasurepanel().show();}else{Ext.getCmp("selectionDetails").setSelectionDetailsData(appConstants.publicJsonData.selectionDetails);
this.enableTools();d.show();var D=appConstants.publicJsonData.graph;var i=appConstants.publicJsonData.durationGraph;var K=appConstants.publicJsonData.isAppLaunchDuarationColumnEnabled;var h='<table width="100%" height='+(D.chartHeight+40)+">";h+='<tr><td class="font_normal12" style="text-align:center;height:30px;">'+" "+"</td></tr>";
h+='<tr><td align="center" valign="middle"><div id="topgraphdiv" height="100%" style="padding:10px;"></div></td></tr>';h+="</table>";if(appConstants.chartType.toLowerCase()=="fusionchart"){d.add({xtype:"panel",ui:"newGraphPanel",margin:10,listeners:{boxready:function(){if(FusionCharts("barchartid")){FusionCharts("barchartid").dispose();
}var aa=new FusionCharts(D.fusionChartTypeUrl,"barchartid","80%",D.chartHeight,"0","1");aa.setDataXML(D.fusionChartXml);aa.setTransparent(true);aa.render("topgraphdiv");}}});d.setTitle(i.panelTitle);}else{if(u!=null&&u!=undefined&&u=="application"&&appConstants.chartType.toLowerCase()=="highchart"){var v='<div style="width:100%"><table width="100%"  class="htmlGraphTable" style="border:0px;background-color:transparent"><col width="50%"><col width="50%"><tr>';
v+='<td style="padding:0px 5px 10px 10px">';v+='<div width="100%" class="graphMainDiv" >';v+='<div class="htmlGraphTableHeader">';v+=D.chartTitle;v+="</div>";v+='<div id="topgraphdiv1" style="height:330px;width:100% !important;overflow:auto;padding:0px" class="htmlGraphTableBody">';v+="</div>";v+="</div></td>";
if(K){v+='<td style="padding:0px 10px 10px 5px">';v+='<div width="100%" class="graphMainDiv">';v+='<div class="htmlGraphTableHeader">';v+=i.chartTitle;v+="</div>";v+='<div id="topgraphdiv2" style="height:330px;width:100%;overflow:auto;padding:0px" class="htmlGraphTableBody">';v+="</div>";v+="</div></td>";
}v+="</tr></table></div>";d.add({xtype:"panel",columnWidth:1,title:i.panelTitle,margin:"0 10 10 10",ui:"multiGraphPanel",items:[{border:false,html:v,id:"html_content",}],listeners:{boxready:function(){var ab={};ab=jQuery.extend(true,{},getHighChartsBarInstance("topgraphdiv1",D.chartHeight,D.chartWidth),ab);
ab.setData(D,"<%=currentDateFormat%>","");ab.drawChart();if(K){var aa={};aa=jQuery.extend(true,{},getHighChartsBarInstance("topgraphdiv2",i.chartHeight,i.chartWidth),aa);aa.setData(i,"<%=currentDateFormat%>","");aa.drawChart();}document.getElementById("topgraphdiv1").style.width="100%";if(K){document.getElementById("topgraphdiv2").style.width="100%";
}}}});}else{if(appConstants.chartType.toLowerCase()=="highchart"){d.add({xtype:"panel",ui:"newGraphPanel",margin:"0 10 10 10",title:i.panelTitle,html:h,listeners:{boxready:function(){var aa={};aa=jQuery.extend(true,{},getHighChartsBarInstance("topgraphdiv",D.chartHeight,D.chartWidth),aa);aa.setData(D,"<%=currentDateFormat%>","");
aa.drawChart();}}});}}}}}else{if(appConstants.publicJsonData.hasOwnProperty("data")){if(appConstants.publicJsonData.data.hasOwnProperty("noMeasures")){this.disableTools();this.getNomeasurepanel().show();}else{Ext.getCmp("selectionDetails").setSelectionDetailsData(appConstants.publicJsonData.selectionDetails);
var H=appConstants.publicJsonData.data;var W=H.table;var K=H.isAppLaunchDuarationColumnEnabled;var b=new Array();var s=new Array();var o=0.3;var X=false;if(K&&u!=null&&u!=undefined&&u=="application"){X=true;o=0.25;}var y=this.getSummaryData(s,H.TotalUniqueUsers,H.s2,o,"");y=this.getSummaryData(y,H.TotalAppLaunches,H.s4,o,"");
y=this.getSummaryData(y,H.TotalUniqueApplications,H.s5,o,"");if(X){y=this.getSummaryData(y,H.totalAvgLaunchduration,H.s6,o,"(Secs)");}b.push({xtype:"panel",ui:"newGraphPanel",margin:"10 10 10 10",title:"Summary",columnWidth:1,layout:"column",items:y});var L='<div id="anbu" >';L+='<div class="newTable">';
if(X){L+='<table width="100%"><col width="65%"><col width="5%"><col width="20%"><col width="15%">';}else{L+='<table width="100%"><col width="80%"><col width="10%"><col width="10%">';}L+="<thead><tr>";L+="<th>";L+=H.c1;L+="</th>";L+='<th style="text-align:center">';L+=H.c2;L+="</th>";if(appConstants.publicJsonData.selectedFields.detailsBasedOnSelected=="application"){if(K){L+='<th style="text-align:center">';
L+=H.v2;L+="</th>";}L+='<th style="text-align:center">';L+=H.s3;L+="</th>";}L+="</tr></thead><tbody>";for(var r in W){var j=W[r];for(var Y in j){if(Y!="subMenu"){if(appConstants.publicJsonData.selectedFields.detailsBasedOnSelected=="application"){var p=j[Y];L+="<tr>";L+="<td>";L+='<div><div style="cursor:pointer;"><div class="iconTreeExpand" id="data_'+r+'" onclick="javascript:toggleChildTables(this.id)" style="float:left;margin-right:4px">';
L+="</div></div>";L+='<div style="float:left;">';L+=Y;L+="</div></div>";L+="</td>";for(var c in p){L+="<td>";L+='<div style="text-align:center">';L+=c;L+="</div>";L+="</td>";if(K){var f=p[c].toString();f=f.substring(f.indexOf(",")+1,f.length);L+="<td>";L+='<div style="text-align:center">';L+=f;L+="</div>";
L+="</td>";var Z=p[c].toString();Z=Z.substring(0,Z.indexOf(","));L+="<td>";L+='<div style="text-align:center">';L+=Z;L+="</div>";L+="</td>";}else{L+="<td>";L+='<div style="text-align:center">';L+=p[c];L+="</div>";L+="</td>";}}L+="</tr>";}else{L+="<tr>";L+="<td>";L+='<div><div style="cursor:pointer;"><div class="iconTreeExpand" id="data_'+r+'" onclick="javascript:toggleChildTables(this.id)" style="float:left;margin-right:4px">';
L+="</div></div>";L+='<div style="float:left;">';if(K){var I=Y.toString();I=I.substring(0,I.indexOf(","));L+=I;L+="</div></div>";L+="</td>";}else{L+=Y;L+="</div></div>";L+="</td>";}L+="<td>";L+="<div>";L+=j[Y];L+="</div>";L+="</td>";if(K&&u!=null&&u=="application"){var a=Y.toString();a=a.substring(a.indexOf(",")+1,a.length);
L+="<td>";L+="<div>";L+=a;L+="</div>";L+="</td>";}L+="</tr>";}}else{var F=j[Y];L+='<tr id="child_tr'+r+"_"+J+'" style="display:none;">';if(K&&u!=null&&u!=undefined&&u=="application"){L+='<td colspan="4">';}else{if(u!=null&&u!=undefined&&u=="application"){L+='<td colspan="3">';}else{L+='<td colspan="2">';
}}if(K&&u!=null&&u!=undefined&&u=="application"){L+='<div class="newTable" style="margin:10px 10px 10px 10px;"><table width="100%"><col width="65%"><col width="14%"><col width="21%">';}else{L+='<div class="newTable" style="margin:10px 10px 10px;"><table width="100%"><col width="80%"><col width="20%">';
}L+="<thead><tr>";L+="<th>";L+="<div>";L+=F[0].cols[0];L+="</div>";L+="</th>";if(K&&u!=null&&u=="application"){L+="<th>";L+="<div>";L+=F[0].cols[2];L+="</div>";L+="</th>";}L+="<th>";L+="<div>";L+=F[0].cols[1];L+="</div>";L+="</th>";L+="</tr></thead>";for(var J in F){var G=F[J];for(var B in G){if(B=="cols"){continue;
}if(B!="children"){var x=G[B].toString();x=x.substring(0,x.indexOf(","));var t=G[B].toString();t=t.substring(t.lastIndexOf(",")+1,t.length);var g=G[B].toString();g=g.substring(g.indexOf(",")+1,g.lastIndexOf(","));L+="<tbody><tr>";L+="<td>";L+='<div style="cursor:pointer;"><div class="iconTreeExpand" id="child_'+r+"_"+J+'" onclick="javascript:toggleChildTables(this.id)" style="float:left;margin-right:4px">';
L+="</div></div>";L+='<div style="float:left;">';if(K){L+=x;L+="</div>";L+="</td>";L+="<td>";L+='<div style="text-align:center;">';L+=g;L+="</div>";L+="</td>";if(u!=null&&u=="application"){L+="<td>";L+='<div style="text-align:center;">';L+=t;L+="</div>";L+="</td>";}}else{L+=B;L+="</div>";L+="</td>";L+="<td>";
L+='<div style="text-align:center;">';L+=G[B];L+="</div>";L+="</td>";}L+="</tr>";}else{var q=G[B];var N=q.cols;var M=q.dat;var k=Object.keys(N).length;var w="";var T="left";for(var C=0;C<N.length;C++){w=N[C];}L+='<tr style="display:none;" id="subChild_tr_'+r+"_"+J+'">';if(K){L+='<td colspan="3">';}else{if(u!=null&&u!=undefined&&u=="application"){L+='<td colspan="2">';
}else{L+='<td colspan="2">';}}L+='<div class="newTable" style="margin:10px 10px 10px 10px;"><table width="100%">';L+="<thead><tr>";for(var l in N){L+="<th>";L+="<div>";L+=N[l];L+="</div>";L+="</th>";}L+="</tr></thead>";L+="<tbody><tr>";var P=0;for(var A in M){if(P==k){P=0;L+="</tr>";L+="<tr>";}if(w!=null&&w=="LAUNCH DURATION"){T="center";
}L+="<td>";L+='<div style="text-align:'+T+'">';L+=M[A];L+="</div>";L+="</td>";P++;}L+="</tr>";L+="</tbody></table></div>";L+="</td>";L+="</tr>";}}}L+="</tbody></table></div>";L+="</td>";L+="</tr>";}}}L+"</tbody></table>";L+"</div>";b.push({xtype:"panel",ui:"newGraphPanel",margin:"10 10 10 10",title:"Application Launch",items:[{xtype:"container",margin:"10 10 10 10",html:L}]});
d.show();d.add(b);this.enableTools();}}}}else{if(V=="background"){var Q=Ext.getCmp("backGroundPanel");var e=appConstants.publicJsonData.labelFields.bgStatus;if(e=="success"){var n=appConstants.publicJsonData.labelFields.bgResponseText;var m=appConstants.publicJsonData.labelFields.bgAnchor;var R=appConstants.publicJsonData.urlFields.bgUrl;
var z=m;Q.update('<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">'+n+".</br>"+'<a class="backgroundMsgLink" href='+R+">"+z+"</a></div></td></tr></table></td></tr></table>");
}else{if(e=="duplicate"){var n=appConstants.publicJsonData.labelFields.bgResponseText;var m=appConstants.publicJsonData.labelFields.bgAnchor;var R=appConstants.publicJsonData.urlFields.bgUrl;var z=m;Q.update('<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">'+n+".</br>"+'<a class="backgroundMsgLink" href='+R+">"+z+"</a></div></td></tr></table></td></tr></table>");
}else{var n=appConstants.publicJsonData.labelFields.bgResponseText;Q.update('<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">'+n+"</div></td></tr></table></td></tr></table>");
}}Q.show();}else{if(V=="background-xls"){var Q=Ext.getCmp("backGroundPanel");var e=appConstants.publicJsonData.labelFields.bgStatus;if(e=="success"){var n=appConstants.publicJsonData.labelFields.bgResponseText;var m=appConstants.publicJsonData.labelFields.bgAnchor;var R=appConstants.publicJsonData.urlFields.bgUrl;
var z=m;Q.update('<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">'+n+".</br>"+'<a class="backgroundMsgLink" href='+R+">"+z+"</a></div></td></tr></table></td></tr></table>");
}else{if(e=="duplicate"){var n=appConstants.publicJsonData.labelFields.bgResponseText;var m=appConstants.publicJsonData.labelFields.bgAnchor;var R=appConstants.publicJsonData.urlFields.bgUrl;var z=m;Q.update('<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">'+n+".</br>"+'<a class="backgroundMsgLink" href='+R+">"+z+"</a></div></td></tr></table></td></tr></table>");
}else{var n=appConstants.publicJsonData.labelFields.bgResponseText;Q.update('<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">'+n+"</div></td></tr></table></td></tr></table>");
}}Q.show();}else{if(V=="background-csv"){var Q=Ext.getCmp("backGroundPanel");var O=Ext.getCmp("bgReportName").getValue();O=checkFileName(O);var e=appConstants.publicJsonData.labelFields.bgStatus;if(e!="undefined"){if(e=="success"){var n=appConstants.publicJsonData.labelFields.bgResponseText;var m=appConstants.publicJsonData.labelFields.bgAnchor;
var R=appConstants.publicJsonData.urlFields.bgUrl;var z=m;Q.update('<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">'+n+".</br>"+'<a class="backgroundMsgLink" href='+R+">"+z+"</a></div></td></tr></table></td></tr></table>");
}else{if(e=="duplicate"){var n=appConstants.publicJsonData.labelFields.bgResponseText;var m=appConstants.publicJsonData.labelFields.bgAnchor;var R=appConstants.publicJsonData.urlFields.bgUrl;var z=m;Q.update('<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">'+n+".</br>"+'<a class="backgroundMsgLink" href='+R+">"+z+"</a></div></td></tr></table></td></tr></table>");
}else{var n=appConstants.publicJsonData.labelFields.bgResponseText;Q.update('<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">'+n+"</div></td></tr></table></td></tr></table>");
}}}else{Q.update('<center><div style="font-size:13px;padding:8px;margin-top:50px;text-align:left;display:block;width:480px;height:90" class="panelwithoutheader"><div style="margin:20px;display:block;width:38px;height:34px;float:left;" class="iconExclamation"></div><div style="margin-top:20px"><b>Error In BackGround Generation</div></div></center>');
}Q.show();}else{console.log("No data found for report generation in json");}}}}},getSummaryData:function(b,d,e,c,a){b.push({xtype:"container",align:"center",columnWidth:c,margin:"10 0 10 0",autoSize:true,layout:{type:"table",columns:1,align:"center",tableAttrs:{style:{align:"center",margin:"auto auto",}},tdAttrs:{style:{textAlign:"center"}}},defaults:{bodyStyle:"padding:10px 5px 5px 5px",align:"center",},items:[{html:'<table align="center" ><tr><td align="right" style="padding-right:5px"><div class="" ></div></td><td style="text-align:left;padding-left:5px" class="newFont_bold28" >'+d+'</td><td valign="bottom"><div class="newFont_normal13" style="margin-bottom:3px;">'+a+"</div></td></tr></table>",width:"100%",style:{textAlign:"center",width:"50px"}},{html:'<span class="newFont_normal13">'+e+"</span>",}]});
return b;},showResult:function(a){var b;if(isSettingsEnabled){b=Ext.getCmp("reportGeneration").getValue();}else{b=appConstants.publicJsonData.selectedFields.reportGenerationSelected;}if(b=="foreground"&&this.validateMainForm(true)){this.getAjaxDataForSubmit(this.foregroundControllerUrl,this.getQueryString(true,true,true));
}else{if(b=="background-csv"&&this.validateMainForm(true)){this.getAjaxDataForSubmit("../servlet/com.eg.ErStartBackGroundReportC?isSubmit=true&SaveFormat=CSV&isBackgroundCSV=Yes",this.getQueryString(true,true,true));}else{if(b=="background"&&this.validateMainForm(true)){this.getAjaxDataForSubmit(this.backgroundControllerUrl,this.getQueryString(true,true,true));
}else{if(b=="background-xls"&&this.validateMainForm(true)){this.getAjaxDataForSubmit("../servlet/com.eg.ErStartBackGroundReportC?isSubmit=true&SaveFormat=XLSX",this.getQueryString(true,true,true));}}}}},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);Ext.getCmp("excelTool").setDisabled(true);},enableTools:function(){Ext.getCmp("bookletTool").setDisabled(false);Ext.getCmp("saveTool").setDisabled(false);Ext.getCmp("printTool").setDisabled(false);
Ext.getCmp("mailTool").setDisabled(false);if(Ext.getCmp("er_type").getValue()=="Yes"){Ext.getCmp("csvTool").setDisabled(true);Ext.getCmp("excelTool").setDisabled(true);}else{Ext.getCmp("csvTool").setDisabled(false);Ext.getCmp("excelTool").setDisabled(false);}},hideResults:function(){Ext.getCmp("resultContainer").hide();
Ext.getCmp("backGroundPanel").hide();this.getNomeasurepanel().hide();},onChangeReportGeneration:function(a){this.hideResults();this.disableTools();Ext.getCmp("submitViaSetting").show();Ext.getCmp("moreOptionCloseId").hide();if(a.getValue()=="background"){Ext.getCmp("bgReportName").setValue("");Ext.getCmp("bgReportName").show();
}else{if(a.getValue()=="background-xls"){Ext.getCmp("bgReportName").setValue("");Ext.getCmp("bgReportName").show();}else{if(a.getValue()=="background-csv"){Ext.getCmp("bgReportName").setValue("");Ext.getCmp("bgReportName").show();}else{Ext.getCmp("bgReportName").hide();Ext.getCmp("submitViaSetting").hide();
Ext.getCmp("moreOptionCloseId").show();}}}},onDetailsChange:function(c){this.hideResults();var b=Ext.getCmp("er_detailsBasedOn").getValue();var a=Ext.getCmp("appSearch");var d=Ext.getCmp("userSearch");if(c.getValue()=="application"){this.loadComboField("er_application","applicationCombo","applicationLabel","applicationSelected",appConstants.publicJsonData,true,"applicationpane",true);
a.emptyText="Search Applications";a.applyEmptyText();a.show();if(isSettingsEnabled){this.loadComboField("er_user","userCombo","userLabel","userSelected",appConstants.publicJsonData,true,"userpane",true);d.emptyText="Search Users";d.applyEmptyText();d.show();}}else{this.loadComboField("er_application","userCombo","userLabel","userSelected",appConstants.publicJsonData,true,"applicationpane",true);
a.emptyText="Search Users";a.applyEmptyText();a.show();if(isSettingsEnabled){this.loadComboField("er_user","applicationCombo","applicationLabel","applicationSelected",appConstants.publicJsonData,true,"userpane",true);d.emptyText="Search Applications";d.applyEmptyText();d.show();}}if(Ext.getCmp("er_type").getValue()=="No"){if(isSettingsEnabled){if(b=="user"){this.loadComboField("er_groupBy","groupByComboForUser","groupByLabel","groupBySelectedAppln",appConstants.publicJsonData,false,null,true);
}else{this.loadComboField("er_groupBy","groupByCombo","groupByLabel","groupBySelected",appConstants.publicJsonData,false,null,true);}}}},onComponentTypeChange:function(c){this.hideResults();this.getAjaxData(this.foregroundJspUrl,this.getQueryString(true,false,false));var a=Ext.getCmp("er_compType").getValue();
var b=appConstants.vmComponentListEntry.indexOf(a);if(Ext.getCmp("er_type").getValue()=="No"){if(b>=0&&appConstants.isLaunchByVm){this.loadComboField("er_vm","vmOptsJson","","vmSelected",appConstants.publicJsonData,true,"vmpane",false);Ext.getCmp("vmpane").show();this.loadComboField("er_component","componentCombo","componentLabel","componentSelected",appConstants.publicJsonData,true,"componentpane",false);
Ext.getCmp("componentpane").hide();}else{this.loadComboField("er_component","componentCombo","componentLabel","componentSelected",appConstants.publicJsonData,true,"componentpane",true);Ext.getCmp("vmpane").hide();Ext.getCmp("componentpane").show();}if(isSettingsEnabled){if(appConstants.publicJsonData.hiddenFields.showGeoDetails=="Yes"){Ext.getCmp("clientGeoDetails").show();
}else{Ext.getCmp("clientGeoDetails").hide();}}}this.loadApplications();this.loadComboField("er_workerGroup","workerGroupCombo","workerGroupLabel","workerGroupSelected",appConstants.publicJsonData,false,null,true);this.loadUsers();},onZoneChange:function(c){this.hideResults();var d="er_option="+Ext.getCmp("er_option").getValue()+"&select_farm="+Ext.getCmp("select_farm").getValue()+"&er_type="+Ext.getCmp("er_type").getValue();
if(Ext.getCmp("er_type").getValue()=="No"){var a=Ext.getCmp("er_compType").getValue();var b=appConstants.vmComponentListEntry.indexOf(a);if(b>=0){if(appConstants.isLaunchByVm){d+="&islaunchByVm=true";}}}this.getAjaxData(this.foregroundJspUrl,d);this.loadComboField("er_compType","componentTypeCombo","componentTypeLabel","componentTypeSelected",appConstants.publicJsonData,false,null,true);
var a=Ext.getCmp("er_compType").getValue();var b=appConstants.vmComponentListEntry.indexOf(a);if(Ext.getCmp("er_type").getValue()=="No"){if(b>=0&&appConstants.isLaunchByVm){this.loadComboField("er_vm","vmOptsJson","","vmSelected",appConstants.publicJsonData,true,"vmpane",false);this.loadComboField("er_component","componentCombo","componentLabel","componentSelected",appConstants.publicJsonData,true,"componentpane",true);
Ext.getCmp("vmpane").show();Ext.getCmp("componentpane").hide();}else{this.loadComboField("er_component","componentCombo","componentLabel","componentSelected",appConstants.publicJsonData,true,"componentpane",true);Ext.getCmp("vmpane").hide();Ext.getCmp("componentpane").show();}}else{this.loadComboField("er_component","componentCombo","componentLabel","componentSelected",appConstants.publicJsonData,true,"componentpane",true);
}this.loadApplications();this.loadComboField("er_workerGroup","workerGroupCombo","workerGroupLabel","workerGroupSelected",appConstants.publicJsonData,false,null,true);this.loadUsers();},loadDataForReportChange:function(){var a=Ext.getCmp("er_detailsBasedOn").getValue();var b=Ext.getCmp("er_compType").getValue();
var c=appConstants.vmComponentListEntry.indexOf(b);if(Ext.getCmp("er_type").getValue()=="No"){if(c>=0&&appConstants.isLaunchByVm){this.loadComboField("er_vm","vmOptsJson","","vmSelected",appConstants.publicJsonData,true,"vmpane",false);this.loadComboField("er_component","componentCombo","componentLabel","componentSelected",appConstants.publicJsonData,true,"componentpane",true);
Ext.getCmp("componentpane").hide();Ext.getCmp("vmpane").show();}else{this.loadComboField("er_component","componentCombo","componentLabel","componentSelected",appConstants.publicJsonData,true,"componentpane",true);Ext.getCmp("vmpane").hide();Ext.getCmp("componentpane").show();}}else{this.loadComboField("er_component","componentCombo","componentLabel","componentSelected",appConstants.publicJsonData,true,"componentpane",true);
}if(isSettingsEnabled){this.loadComboField("er_top","showCombo","showLabel","showSelected",appConstants.publicJsonData,false,null,true);if(a=="user"){this.loadComboField("er_groupBy","groupByComboForUser","groupByLabel","groupBySelectedAppln",appConstants.publicJsonData,false,null,true);}else{this.loadComboField("er_groupBy","groupByCombo","groupByLabel","groupBySelected",appConstants.publicJsonData,false,null,true);
}this.loadComboField("reportGeneration","reportGenerationCombo","reportGenerationLabel","reportGenerationSelected",appConstants.publicJsonData,false,null,true);}},onReportChange:function(f){this.hideResults();var e=Ext.getCmp("er_option").getValue();var g="er_option="+e+"&er_type="+Ext.getCmp("er_type").getValue();
if(e=="Zone"){g+="&select_farm="+Ext.getCmp("select_farm").getValue();}else{if(e=="Group"||e=="Segment"||e=="Service"){g+="&er_site="+Ext.getCmp("er_site").getValue();}}if(Ext.getCmp("er_type").getValue()=="No"){var b=Ext.getCmp("er_compType").getValue();var d=appConstants.vmComponentListEntry.indexOf(b);
if(d>=0){if(appConstants.isLaunchByVm){g+="&islaunchByVm=true";}}if(isSettingsEnabled){if(appConstants.publicJsonData.hiddenFields.showGeoDetails=="Yes"){Ext.getCmp("clientGeoDetails").show();}}}if(Ext.getCmp("er_type").getValue()=="Yes"){Ext.getCmp("vmpane").hide();if(isSettingsEnabled){Ext.getCmp("clientGeoDetails").hide();
}}this.getAjaxData(this.foregroundJspUrl,g);this.loadComboField("er_compType","componentTypeCombo","componentTypeLabel","componentTypeSelected",appConstants.publicJsonData,false,null,true);if(isSettingsEnabled){this.loadComboField("reportGeneration","reportGenerationCombo","Report Generation","reportGenerationSelected",appConstants.publicJsonData,false,null,true);
var a=Ext.getCmp("reportGeneration").getValue();var c=Ext.getCmp("bgReportName");if(a!=undefined&&a=="foreground"){c.hide();}else{c.show();}}this.loadDataForReportChange();this.loadApplications();},getAjaxData:function(a,b){Ext.Ajax.request({url:a,params:b,async:false,scope:this,success:function(c){appConstants.publicJsonData=Ext.decode(c.responseText);
}});},getAjaxDataForSubmit:function(a,c){var b=this;Ext.Ajax.request({url:a,params:c,scope:this,success:function(d){appConstants.publicJsonData=Ext.decode(d.responseText);b.loadReportData();}});},getQueryString:function(c,a,b){getQueryString(c,a,b,false);},getQueryString:function(j,h,q,m){if(Ext.isEmpty(appConstants.erUtils)){appConstants.erUtils=Ext.widget("erutils");
}var d;var o,B,e,z,C,c,E,i,v,x;if(isSettingsEnabled){o=Ext.getCmp("timefrom").getValue();B=Ext.getCmp("minfrom").getValue();e=Ext.getCmp("timeto").getValue();z=Ext.getCmp("minto").getValue();C=Ext.getCmp("er_excwe").getValue();c=Ext.getCmp("reportGeneration").getValue();E=Ext.getCmp("bgReportName").getValue();
i=Ext.getCmp("er_top").getValue();v=Ext.getCmp("er_groupBy").getValue();x=Ext.getCmp("er_launchDuration").getValue();}else{var n=appConstants.publicJsonData.selectedFields;o=n.selectedTimeFrom;B=n.selectedMinsFrom;e=n.selectedTimeTo;z=n.selectedMinsTo;C=n.excludeWeekendsSelected;c=n.reportGenerationSelected;
E=n.reportNameSelected;i=n.showSelected;v=n.groupBySelected;x=n.er_launchDuration;}var A=Ext.getCmp("er_option").getValue();d="er_type="+Ext.getCmp("er_type").getValue();if(A=="Zone"){d+="&select_farm="+Ext.getCmp("select_farm").getValue();}else{if(A=="Group"||A=="Segment"||A=="Service"){d+="&er_site="+Ext.getCmp("er_site").getValue();
}}if(j){d+="&er_compType="+Ext.getCmp("er_compType").getValue()+"&er_option="+Ext.getCmp("er_option").getValue();}if(q){var p=Ext.Date.dateFormat(Ext.getCmp("er_stdate").getValue(),mgrDateFormat);var a=Ext.Date.dateFormat(Ext.getCmp("er_enddate").getValue(),mgrDateFormat);var g=Ext.getCmp("er_sthr").dataArray;
d+="&er_timeline="+Ext.getCmp("er_timeline").getValue()+"&startdate="+p+"&enddate="+a+"&starthr="+Ext.getCmp("er_sthr").dataArray+"&endhr="+Ext.getCmp("er_endhr").dataArray+"&startmin="+mgr_stmin+"&endmin="+mgr_enmin;d+="&timefrom="+o+"&minfrom="+B+"&timeto="+e+"&minto="+z;d+="&er_excwe="+C;if(c=="foreground"){d+="&er_reportgenration="+c+"&isSubmit=true&responseType=json";
}else{E=checkFileName(E);d+="&er_reportgenration="+c+"&bg_reportname="+E+"&isSubmit=true";}}d+="&er_launchDuration="+x;if(h){var b=new Array();if(Ext.getCmp("er_type").getValue()=="Yes"){d+="&er_top="+i;}else{d+="&er_groupBy="+v;}var r=Ext.getCmp("er_detailsBasedOn").getValue();d+="&er_detailsBasedOn="+r;
if(r=="application"){b=Ext.getCmp("er_application").getValue();for(var D in b){d+="&er_application="+encodeURIComponent(b[D]);}if(isSettingsEnabled){b=Ext.getCmp("er_user").getValue();for(var D in b){d+="&er_user="+appConstants.erUtils.specialCharEncode(b[D]);}}else{b=n.userSelected;}}else{b=Ext.getCmp("er_application").getValue();
for(var D in b){d+="&er_user="+appConstants.erUtils.specialCharEncode(b[D]);}if(isSettingsEnabled){b=Ext.getCmp("er_user").getValue();for(var D in b){d+="&er_application="+encodeURIComponent(b[D]);}}else{b=n.applcationSelected;}}if(isSettingsEnabled){var u=Ext.getCmp("er_adGroup");if(!u.isHidden()){b=u.getValue();
for(var D in b){if(m){d+="&er_adGroup="+encodeURIComponent(b[D]);}else{d+="&er_adGroup="+b[D];}}}var t=Ext.getCmp("clientGeoDetails");if(!t.isHidden()){d+="&geoDetails="+t.getValue().geoDetails;}}else{if(!Ext.isEmpty(n.adGroupSelected)){b=n.adGroupSelected;}}if(appConstants.publicJsonData.hasOwnProperty("hiddenFields")){var l=appConstants.publicJsonData.hiddenFields;
for(var f in l){if(this.isNewFav!=undefined&&this.isNewFav){if(f!=undefined&&f=="ID"){continue;}if(f!=undefined&&f=="FavoriteId"){continue;}}else{if(this.isNewSch!=undefined&&this.isNewSch){if(f!=undefined&&f=="ID"){continue;}}}d+="&"+f+"="+l[f];}}}d+="&er_RmDispName="+appConstants.er_RmDispName;d+="&chartType="+appConstants.chartType;
var w=Ext.getCmp("er_vm");if(!w.isHidden()){if(h){var b=new Array();b=w.getValue();for(var D in b){var y=replaceAll(b[D],"#","0eghash0");d+="&er_vm="+y;}}}if(h){var b=new Array();if(Ext.getCmp("er_type").getValue()=="No"){b=Ext.getCmp("er_component").getValue();for(var D in b){d+="&er_component="+b[D];
}}if(Ext.getCmp("er_type").getValue()=="No"){var s=Ext.getCmp("er_compType").getValue();var k=appConstants.vmComponentListEntry.indexOf(s);if(k>=0){d+="&isSearchByVmComp=true";}}}if(Ext.getCmp("er_type").getValue()=="No"){var s=Ext.getCmp("er_compType").getValue();var k=appConstants.vmComponentListEntry.indexOf(s);
if(k>=0){if(appConstants.isLaunchByVm){d+="&islaunchByVm=true";}}}return d;},boxready:function(){registerAjaxEvents();var a=this;if(!appConstants.hideBackButton){Ext.getCmp("mainform").add({xtype:"hidden",id:"ID",name:"ID",value:appConstants.publicJsonData["ID"]});}this.getMain().setTitle(appConstants.er_RmDispName);
if(appConstants.frmFavModify!=undefined&&appConstants.frmFavModify=="Yes"){return;}if(appConstants.isForceSubmit=="true"){this.loadReportData(appConstants.publicjsonData);}else{if(appConstants.isSubmit=="true"){this.loadReportData(appConstants.publicjsonData);}}},loadForm:function(){this.loadFormFields();
var d=appConstants.frmSchModify;var a=appConstants.frmFavModify;if(d=="Yes"||a=="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 c=appConstants.publicJsonData.selectedFields.startDateForDisplay;
var b=Ext.getCmp("er_stdate");b.setValue(c);b.dataArray=c;c=appConstants.publicJsonData.selectedFields.endDateForDisplay;b=Ext.getCmp("er_enddate");b.setValue(c);b.dataArray=c;Ext.getCmp("er_sthr").setValue(appConstants.publicJsonData.selectedFields.startHourForDisplay);Ext.getCmp("er_endhr").setValue(appConstants.publicJsonData.selectedFields.endHourForDisplay);
Ext.getCmp("er_sthr").dataArray=appConstants.publicJsonData.selectedFields.startHour;Ext.getCmp("er_endhr").dataArray=appConstants.publicJsonData.selectedFields.endHour;stmin=appConstants.publicJsonData.selectedFields.startMinForDisplay;enmin=appConstants.publicJsonData.selectedFields.endMinForDisplay;
mgr_stmin=appConstants.publicJsonData.selectedFields.startmin;mgr_enmin=appConstants.publicJsonData.selectedFields.endmin;},loadFormFields:function(){this.loadComboField("er_type","reportTypeCombo","reportTypeLabel","reportTypeSelected",appConstants.publicJsonData,false,null,true);this.loadComboField("er_option","analysisByCombo","","selectedAnalysisByCombo",appConstants.publicJsonData,false,null,true);
this.loadComboField("select_farm","zoneCombo","zoneLabel","zoneSelected",appConstants.publicJsonData,false,null,true);this.loadComboField("er_compType","componentTypeCombo","componentTypeLabel","componentTypeSelected",appConstants.publicJsonData,false,null,true);this.loadComboField("er_detailsBasedOn","detailsBasedOnCombo","detailsBasedOnLabel","detailsBasedOnSelected",appConstants.publicJsonData,false,null,true);
this.loadComboField("er_workerGroup","workerGroupCombo","workerGroupLabel","workerGroupSelected",appConstants.publicJsonData,false,null,true);this.loadComboField("er_timeline","timelineCombo","","selectedTimeline",appConstants.publicJsonData,false,null,false);this.loadComboField("er_site","siteCombo","siteComboLabel","selectedSiteCombo",appConstants.publicJsonData,false,null,true);
var a=Ext.getCmp("er_compType").getValue();var b=appConstants.vmComponentListEntry.indexOf(a);if(Ext.getCmp("er_type").getValue()=="No"){if(b>=0&&appConstants.isLaunchByVm){this.loadComboField("er_vm","vmOptsJson","","vmSelected",appConstants.publicJsonData,true,"vmpane",false);this.loadComboField("er_component","componentCombo","componentLabel","componentSelected",appConstants.publicJsonData,true,"componentpane",true);
Ext.getCmp("vmpane").show();Ext.getCmp("componentpane").hide();}else{this.loadComboField("er_component","componentCombo","componentLabel","componentSelected",appConstants.publicJsonData,true,"componentpane",true);Ext.getCmp("vmpane").hide();Ext.getCmp("componentpane").show();}}else{this.loadComboField("er_component","componentCombo","componentLabel","componentSelected",appConstants.publicJsonData,true,"componentpane",true);
}this.loadComboField("er_application","applicationCombo","applicationLabel","applicationSelected",appConstants.publicJsonData,true,"applicationpane",true);this.loadApplications();},loadApplications:function(){var a=Ext.getCmp("appSearch");if(Ext.getCmp("er_detailsBasedOn").getValue()=="application"){this.loadComboField("er_application","applicationCombo","applicationLabel","applicationSelected",appConstants.publicJsonData,true,"applicationpane",true);
a.emptyText="Search Applications";a.applyEmptyText();a.show();}else{this.loadComboField("er_application","userCombo","userLabel","userSelected",appConstants.publicJsonData,true,"applicationpane",true);a.emptyText="Search Users";a.applyEmptyText();a.show();}},loadUsers:function(){if(isSettingsEnabled){var a=Ext.getCmp("userSearch");
if(Ext.getCmp("er_detailsBasedOn").getValue()=="application"){this.loadComboField("er_user","userCombo","userLabel","userSelected",appConstants.publicJsonData,true,"userpane",true);a.emptyText="Search Users";a.applyEmptyText();a.show();}else{this.loadComboField("er_user","applicationCombo","applicationLabel","applicationSelected",appConstants.publicJsonData,true,"userpane",true);
a.emptyText="Search Applications";a.applyEmptyText();a.show();}}},loadSettings:function(){var d=appConstants.publicJsonData.hiddenFields;var c=d["FavoriteId"];if(!Ext.isEmpty(c)){Ext.getCmp("reportGeneration").setDisabled(true);}Ext.getCmp("moreOptionCloseId").show();this.loadUsers();this.loadComboField("er_adGroup","adGroupCombo","adGroupLabel","adGroupSelected",appConstants.publicJsonData,true,"adgrouppane",true);
this.loadComboField("er_excwe","excludeWeekendsCombo","excludeWeekendsLabel","excludeWeekendsSelected",appConstants.publicJsonData,false,null,true);this.loadComboField("reportGeneration","reportGenerationCombo","reportGenerationLabel","reportGenerationSelected",appConstants.publicJsonData,false,null,true);
this.loadComboField("er_top","showCombo","showLabel","showSelected",appConstants.publicJsonData,false,null,true);var b=Ext.getCmp("er_detailsBasedOn").getValue();var a=appConstants.publicJsonData.selectedFields;if(Ext.getCmp("er_launchDuration")!=undefined&&a!=undefined){Ext.getCmp("er_launchDuration").setValue(a.er_launchDuration);
}if(b=="user"){this.loadComboField("er_groupBy","groupByComboForUser","groupByLabel","groupBySelectedAppln",appConstants.publicJsonData,false,null,true);}else{this.loadComboField("er_groupBy","groupByCombo","groupByLabel","groupBySelected",appConstants.publicJsonData,false,null,true);}Ext.getCmp("timefrom").setValue(a.selectedTimeFrom);
Ext.getCmp("minfrom").setValue(a.selectedMinsFrom);Ext.getCmp("timeto").setValue(a.selectedTimeTo);Ext.getCmp("minto").setValue(a.selectedMinsTo);if(a.hasOwnProperty("reportNameSelected")){Ext.getCmp("bgReportName").setValue(a.reportNameSelected);}a=null;delete a;if(Ext.getCmp("er_type").getValue()=="No"){if(appConstants.publicJsonData.hiddenFields.showGeoDetails=="Yes"){Ext.getCmp("clientGeoDetails").show();
if(appConstants.geoDetails!=null&&appConstants.geoDetails=="Yes"){Ext.getCmp("clientGeoDetails").setValue({geoDetails:"Yes"});}}else{Ext.getCmp("clientGeoDetails").hide();}}},showConfigDropdown:function(){Ext.widget("configform");isSettingsEnabled=true;var a=this;Ext.get("closeSettings").on("click",function(){a.validateAndCloseSettings();
});},validateAndCloseSettings:function(){if(this.validateSettings()){Ext.get("configMod").animate({duration:500,to:{y:-500}});return true;}return false;},closeSettingAndSubmit:function(){if(this.validateAndCloseSettings()){this.showResult();}},loadComboField:function(c,f,g,i,e,b,j,k){var h=Ext.ComponentManager.get(c);
if(e.combo.hasOwnProperty(f)){var a=e.combo[f];h.getStore().clearFilter(true);h.getStore().loadRawData(a);if(e.selectedFields.hasOwnProperty(i)){h.setValue(e.selectedFields[i]);}else{h.setValue(a[0].valueField);}if(k){if(e.labelFields.hasOwnProperty(g)){if(!b){h.setFieldLabel(e.labelFields[g]);}else{Ext.ComponentManager.get(j).setFieldLabel(e.labelFields[g]);
}}}if(!b){if(h.isHidden()){h.show();}}else{var d=Ext.ComponentManager.get(j);if(d.isHidden()){d.show();}}}else{if(!b){if(!h.isHidden()){h.hide();}}else{var d=Ext.ComponentManager.get(j);if(!d.isHidden()){d.hide();}}}},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);},toggleForm:function(b){Ext.getCmp("panelinsidetoggle").show();Ext.getCmp("panelinsidetoggle").setDisabled(false);var a=Ext.getCmp("mainform");if(a.isHidden()){a.show();Ext.getCmp("selectionDetails").hide();}else{a.hide();
Ext.getCmp("selectionDetails").show();}},getMessageBox:function(b,a){Ext.MessageBox.show({title:b,msg:a,buttons:Ext.MessageBox.OK,icon:Ext.MessageBox.WARNING});return false;},validateMainForm:function(j){var b=appConstants.publicJsonData.hiddenFields;var f=b.getMaxDaysInMonth;var g=b.userTimeline;var h=Ext.getCmp("er_timeline").getValue();
var k=Ext.getCmp("er_stdate").getValue();var a=Ext.getCmp("er_enddate").getValue();var e=Ext.getCmp("er_sthr").getValue();var i=Ext.getCmp("er_endhr").getValue();k.setHours(e);a.setHours(i);var c=appConstants.publicJsonData.selectedFields.reportGenerationSelected;if(isSettingsEnabled){c=Ext.getCmp("reportGeneration").getValue();
}if(g!=null&&g!="-1"){var m=isUserTimelineLimitExceeded(g,f,k,a);if(!m){Ext.MessageBox.show({title:"Operation Reports Settings",msg:_invalidUserTime,buttons:Ext.MessageBox.OK,icon:Ext.MessageBox.WARNING});return false;}}obj=Ext.getCmp("er_compType");if(obj.getValue()=="-1"){this.getMessageBox("Application launch",obj.getStore().getAt(0).get("displayField"));
return false;}obj=Ext.getCmp("er_component");if(obj.getValue()=="-1"&&!obj.isHidden()){this.getMessageBox("Application launch",obj.getStore().getAt(0).get("displayField"));return false;}obj=Ext.getCmp("er_application");if(obj.getValue()=="-1"&&!obj.isHidden()){this.getMessageBox("Application launch",obj.getStore().getAt(0).get("displayField"));
return false;}if(c=="foreground"){if(j){var d=b.limitforbg;if(!Ext.isEmpty(d)){if(!checkTimeLineForBgLimit(d,f,k,a)){Ext.MessageBox.confirm("Confirm",appConstants.forGrdReportConfirmMsg,this.showConfirmResult,this);return false;}}}}else{var l=Ext.getCmp("bgReportName").getValue();if(!validateTextBoxWithSpecialChars(l,"Attachment",true)){return false;
}}return true;},validateMainFormForFavAndSch:function(){var b=appConstants.publicJsonData.hiddenFields;var e=b.getMaxDaysInMonth;var f=b.userTimeline;var g=Ext.getCmp("er_timeline").getValue();var j=Ext.getCmp("er_stdate").getValue();var a=Ext.getCmp("er_enddate").getValue();var d=Ext.getCmp("er_sthr").getValue();
var i=Ext.getCmp("er_endhr").getValue();j.setHours(d);a.setHours(i);var c=appConstants.publicJsonData.selectedFields.reportGenerationSelected;if(isSettingsEnabled){c=Ext.getCmp("reportGeneration").getValue();}if(f!=null&&f!="-1"){var k=isUserTimelineLimitExceeded(f,e,j,a);if(!k){Ext.MessageBox.show({title:"Operation Reports Settings",msg:_invalidUserTime,buttons:Ext.MessageBox.OK,icon:Ext.MessageBox.WARNING});
return false;}}var h=Ext.getCmp("select_farm");if(h.getValue()=="-1"){this.getMessageBox("Application launch",h.getStore().getAt(0).get("displayField"));return false;}h=Ext.getCmp("er_compType");if(h.getValue()=="-1"){this.getMessageBox("Application launch",h.getStore().getAt(0).get("displayField"));
return false;}h=Ext.getCmp("er_component");if(h.getValue()=="-1"&&!h.isHidden()){this.getMessageBox("Application launch",h.getStore().getAt(0).get("displayField"));return false;}return true;},showConfirmResult:function(c){if(c=="yes"){var b=Ext.getCmp("submit");b.setDisabled(false);if(isSettingsEnabled){Ext.get("configMod").animate({duration:500,to:{y:-500}});
}this.getAjaxDataForSubmit(this.foregroundControllerUrl,this.getQueryString(true,true,true));}else{this.getReporterSettings().down("button").fireHandler();var a=Ext.getCmp("reportGeneration");var d=Ext.getCmp("bgReportName");a.setValue("background");d.setValue("");d.show();d.focus(false,1000);Ext.getCmp("submitViaSetting").show();
Ext.getCmp("moreOptionCloseId").hide();validateTextBoxWithSpecialChars(d.getValue(),"Attachment",true);return false;}},validateSettings:function(){var a=true;var e=Ext.getCmp("reportGeneration").getValue();var c=Ext.getCmp("timefrom").getValue();var d=Ext.getCmp("minfrom").getValue();var b=Ext.getCmp("timeto").getValue();
var f=Ext.getCmp("minto").getValue();if(!checkTimePeriod(c,d,b,f)){a=false;}if(e!=null&&(e=="background"||e=="background-xls"||e=="background-csv")){var g=Ext.getCmp("bgReportName").getValue();if(!validateTextBoxWithSpecialChars(g,"Attachment",true)){a=false;}}return a;}});