var tplData=new Ext.XTemplate('<div class="x-table"><table cellspacing="0" width="100%" cellpadding="5" border="0" align="center"  class="x-grid-table x-table-border" style="width:100%;">','<tpl for=".">','<tr class="x-grid-row">','<td class="x-grid-cell"><div class="x-grid-cell-inner" >{col_1}<div></td>','<td class="x-grid-cell"><div class="x-grid-cell-inner" >{col_2}<div></td>','<td class="x-grid-cell"><div class="x-grid-cell-inner" >{col_3}<div></td>',"</tr>","</tpl>","</table></div>");
var failLoadCount=0;var colCount=4;var user_colCount=4;var primaryManager="";var secondaryManager="";var backTrue="";Ext.define("License.controller.Main",{extend:"Ext.app.Controller",views:["LicenseInfo","NamedUsersReport","UserNames","CcUsersDrillDownReport","UsedCountDetails"],requires:["License.view.LicenseInfo"],refs:[{selector:"licenseinfo",ref:"licenseinfo"},{selector:"namedusersreport",ref:"namedusersreport"},{selector:"ccusersdrilldownreport",ref:"ccusersdrilldownreport"},{selector:"usernames",ref:"usernames"},{selector:"usedcountdetails",ref:"usedcountdetails"}],init:function(){ctrler=this;
this.buildMainData();this.control({"licenseinfo":{"afterrender":this.afterMainRender},'namedusersreport combo[id="graphDuration"]':{"select":this.durationChange},'namedusersreport button[id="show"]':{"click":this.graphModeChangeAny},'usernames  button[id="saveCSV"]':{"click":this.saveInCSVUserNames},'usernames button[id="backBtn"]':{"click":this.goBack},'usernames button[id="submit"]':{"click":this.dateWiseUserNames},'usedcountdetails button[id="backBtn"]':{"click":this.goBack},'usedcountdetails  button[id="saveCSV"]':{"click":this.saveInCSVFormat},'ccusersdrilldownreport combo[id="ccGraphMode"]':{"select":this.ccUserGraphmodeChange},'licenseinfo button[id="agentStatus"]':{"click":this.goToAgentStatus},'licenseinfo button[id="backBtnMain"]':{"click":this.goHome},'licenseinfo trigger[id="searchBox"]':{"change":this.searchUser},'licenseinfo trigger[id="searchBoxZone"]':{"change":this.searchZone},'licenseinfo  button[id="saveCSVOrg"]':{"click":this.saveInCSVFormatOrg},'licenseinfo  button[id="saveCSVUser"]':{"click":this.saveInCSVFormatUser},'licenseinfo  button[id="saveCSVZone"]':{"click":this.saveInCSVFormatZone},'licenseinfo  button[id="saveCSVUserNew"]':{"click":this.saveInCSVFormatUserNew},'licenseinfo  button[id="saveCSVLicUsage"]':{"click":this.saveInCSVTotalUsage}});
},buildMainData:function(){Ext.Ajax.request({url:"License/data/EgLicenseInfoJson.jsp",method:"POST",async:false,success:function(a){if(a.status==200&&!Ext.isEmpty(a.responseText)){var b=a.responseText;publicJSON=Ext.decode(b);}}});},tabchange:function(a){Ext.Ajax.request({url:"License/data/licensehelpJson.jsp?selectTab="+a,method:"POST",async:false});
},afterMainRender:function(){if(isLimitedAdmin=="false"){Ext.getCmp("product").setValue(publicJSON.product);Ext.getCmp("version").setValue(publicJSON.version);Ext.getCmp("ipAddr").setValue(publicJSON.IPAddress);Ext.getCmp("hostID").setValue(publicJSON.hostID);Ext.getCmp("expDate").setValue(publicJSON.expDate);
Ext.getCmp("certValid").setValue(publicJSON.licIsValidFor);Ext.getCmp("mailSender").setValue(publicJSON.mailSenderID);Ext.getCmp("companyName").setValue(publicJSON.companyName);Ext.getCmp("clusType").setValue(publicJSON.clusterType);primaryManager=publicJSON.primaryManager;secondaryManager=publicJSON.secondaryManager;
Ext.getCmp("ic").setValue(publicJSON.IC);Ext.getCmp("ttMgr").setValue(publicJSON.TTMgr);Ext.getCmp("dd").setValue(publicJSON.DD);Ext.getCmp("extSuperMgr").setValue(publicJSON.extSuperMgr);Ext.getCmp("egSuperMgr").setValue(publicJSON.eGSuperMgr);Ext.getCmp("egReporter").setValue(publicJSON.eGReporter);
Ext.getCmp("remCtrlActs").setValue(publicJSON.rmtCtrlActs);Ext.getCmp("smsAlerts").setValue(publicJSON.SMSAlerts);Ext.getCmp("configMgmt").setValue(publicJSON.configMgmt);Ext.getCmp("metricAgg").setValue(publicJSON.metricAgg);Ext.getCmp("agentPerSys").setValue(publicJSON.agentPerSys);Ext.getCmp("clntEmul").setValue(publicJSON.clientEmul);
Ext.getCmp("advAnalytics").setValue(publicJSON.advAnalytics);if(publicJSON.showLicenseId){Ext.getCmp("licenseId").show();Ext.getCmp("licenseId").setValue(publicJSON.licenseId);}else{Ext.getCmp("licenseId").hide();}Ext.getCmp("grid1").getStore().loadRawData(publicJSON.grid1);if(Ext.isEmpty(publicJSON.grid2)){Ext.getCmp("grid2").hide();
}else{Ext.getCmp("grid2").show();Ext.getCmp("grid2").getStore().loadRawData(publicJSON.grid2);if(publicJSON.CCUsersCertCheck!=undefined){CCUsersCertCheck=publicJSON.CCUsersCertCheck;}}if(from=="AdminHome"){Ext.getCmp("backBtnMain").show();}if(userWiseCertUsg=="true"){Ext.getCmp("certInfoTab").child("#tab3").tab.show();
ctrler.userWiseTabLoad();}else{Ext.getCmp("certInfoTab").child("#tab3").tab.hide();}if(zoneWiseCertUsg=="true"){Ext.getCmp("certInfoTab").child("#tab4").tab.show();ctrler.zoneWiseTabLoad();}else{Ext.getCmp("certInfoTab").child("#tab4").tab.hide();}}else{Ext.getCmp("certInfoTab").child("#tab1").tab.hide();
Ext.getCmp("certInfoTab").child("#tab2").tab.hide();Ext.getCmp("certInfoTab").child("#tab4").tab.hide();if(isNonSharedUser){Ext.getCmp("certInfoTab").child("#tab6").tab.hide();}if(backTrue==""){Ext.getCmp("certInfoTab").setActiveTab(Ext.getCmp("usrWiseTabNew"));}Ext.getCmp("certInfoTab").child("#tab5").tab.show();
ctrler.userWiseTabLoadNew();if(showUsersTab=="true"){Ext.getCmp("certInfoTab").child("#tab3").tab.show();ctrler.userWiseTabLoad();}}this.orgTabLoad();if((from!=null||from!=undefined)&&from.toLowerCase()=="agentstatus"){Ext.getCmp("certInfoTab").setActiveTab(1);ctrler.tabchange("certUsage");}else{var a=Ext.getCmp("certInfoTab").getActiveTab().id;
Ext.getCmp("certInfoTab").setActiveTab(a);ctrler.tabchange(Ext.getCmp(a).getItemId());}},showGraph:function(){this.buildMainData();var a=this;Ext.widget("window",{extend:"Ext.container.Container",alias:"widget.groupWindow",title:totNamedUsrs,id:"namedUsersGraph",width:900,height:505,padding:"5px",modal:true,border:false,floatable:true,floating:true,autoScroll:false,ghost:false,draggable:true,closeAction:"destory",doClose:function(){this.destroy();
},layout:{type:"fit"},items:[{xtype:"namedusersreport",listeners:{"resize":function(){var b=($("#nameUserReportId").height())-108;var c=($("#nameUserReportId").width())-230;if(failLoadCount!=0){resizeHighChart("namedUserGraph",c,b);}}}}]}).show();Ext.getCmp("graphDuration").getStore().loadRawData(publicJSON.timelines);
Ext.getCmp("graphDuration").setValue(publicJSON.timelineSelected);Ext.getCmp("graphMode").getStore().loadRawData(publicJSON.modes);Ext.getCmp("graphMode").setValue("3D");this.modeChange();},showHourlyGraph:function(d){var a=d.substring(0,d.indexOf("^"));var b=d.substring(d.indexOf("^")+1);Ext.widget("window",{extend:"Ext.container.Container",alias:"widget.groupWindow",title:concUsrGrTitle+" "+b,id:"ccUsersGraph",width:900,height:505,padding:"5px",modal:true,border:false,ghost:false,floatable:true,floating:true,autoScroll:false,closeAction:"destory",doClose:function(){this.destroy();
},layout:{type:"fit"},items:[{xtype:"ccusersdrilldownreport",}]}).show();Ext.getCmp("selDate").setValue(a);var f="/final/admin/License/data/EgCcUserDetailedGraph.jsp?";var c=Ext.getCmp("ccGraphMode").getValue();f+="&er_mode="+c;f+="&selDate="+a;var e=Ext.select("#ccUserGraph");e.set({src:f});},durationChange:function(){this.modeChange();
},modeChange:function(){var a=Ext.getCmp("graphDuration").getValue();if(a=="Any"){Ext.getCmp("datepickfrom").enable();Ext.getCmp("datepickTo").enable();Ext.getCmp("show").enable();a="2 weeks";}else{Ext.getCmp("datepickfrom").disable();Ext.getCmp("datepickTo").disable();Ext.getCmp("show").disable();}var b="/final/admin/License/data/EgUserLicenseInfoGraph.jsp?er_timeline="+a;
Ext.Ajax.request({url:b,method:"POST",async:false,success:function(e){if(e.status==200&&!Ext.isEmpty(e.responseText)){var d=e.responseText;var c=Ext.decode(d);Ext.getCmp("datepickfrom").setValue(c["startDate"]);Ext.getCmp("datepickTo").setValue(c["endDate"]);var g=e.responseText;var f=Ext.decode(g);if(!Ext.isEmpty(f)&&Ext.isEmpty(f.errormsg)){highChart={};
highChart=jQuery.extend(true,{},getHighChartsBarInstance("namedUserGraph",f.chartHeight,f.chartWidth),highChart);f.offset=80;highChart.setData(f,"<%=currentDateFormat%>","",f.chartType);highChart.drawChart();highChartIns=highChart;failLoadCount++;}else{if(Ext.isEmpty(f)){failLoadCount=0;Ext.fly("namedUserGraph").update('<table style="text-align:center;width:100%;height:100%;margin:12% auto 0px auto"><tr><td valign="middle"><div class = "iconExclamation" style="margin:0 auto 0 auto;"></div><div class="font_normal12" style="text-align:center"><b> '+errorMsg+" </b></div></td></tr></table>");
}else{if(!Ext.isEmpty(f.errormsg)){failLoadCount=0;Ext.fly("namedUserGraph").update('<table style="text-align:center;width:100%;height:100%;margin:12% auto 0px auto"><tr><td valign="middle"><div class = "iconExclamation" style="margin:0 auto 0 auto;"></div><div class="font_normal12" style="text-align:center"><b>'+errorMsg+"</b></div></td></tr></table>");
}}}}},failure:function(){Ext.fly("namedUserGraph").update('<table style="text-align:center;width:100%;height:100%;margin:12% auto 0px auto"><tr><td valign="middle"><div class = "iconExclamation" style="margin:0 auto 0 auto;"></div><div class="font_normal12" style="text-align:center"><b> '+errorMsg+" </b></div></td></tr></table>");
}});},graphModeChangeAny:function(){var b=Ext.getCmp("graphDuration").getValue();var c=Ext.getCmp("datepickfrom").getValue();var f=Ext.Date.format(c,"m/d/y");var d=Ext.getCmp("datepickTo").getValue();var a=Ext.Date.format(d,"m/d/y");c=c.toString();c=c.substring(4,10)+","+c.substring(10,15);d=d.toString();
d=d.substring(4,10)+","+d.substring(10,15);var e="/final/admin/License/data/EgUserLicenseInfoGraph.jsp?er_timeline="+b;if(dateValidation(f,a)==-1){Ext.MessageBox.show({title:"Alert",msg:dateAlert,buttons:Ext.Msg.OK,icon:"iconExclamation",});}else{Ext.Ajax.request({url:e,method:"POST",params:{"datePickFrom":c,"datePickTo":d},async:false,success:function(g){if(g.status==200&&!Ext.isEmpty(g.responseText)){var i=g.responseText;
var h=Ext.decode(i);if(!Ext.isEmpty(h)&&Ext.isEmpty(h.errormsg)){highChart={};highChart=jQuery.extend(true,{},getHighChartsBarInstance("namedUserGraph",h.chartHeight,h.chartWidth),highChart);highChart.setData(h,"<%=currentDateFormat%>","",h.chartType);highChart.drawChart();highChartIns=highChart;failLoadCount++;
}else{if(Ext.isEmpty(h)){failLoadCount=0;Ext.fly("namedUserGraph").update('<table style="text-align:center;width:100%;height:100%;margin:12% auto 0px auto"><tr><td valign="middle"><div class = "iconExclamation" style="margin:0 auto 0 auto;"></div><div class="font_normal12" style="text-align:center"><b> '+errorMsg+" </b></div></td></tr></table>");
}else{if(!Ext.isEmpty(h.errormsg)){failLoadCount=0;Ext.fly("namedUserGraph").update('<table style="text-align:center;width:100%;height:100%;margin:12% auto 0px auto"><tr><td valign="middle"><div class = "iconExclamation" style="margin:0 auto 0 auto;"></div><div class="font_normal12" style="text-align:center"><b>'+errorMsg+"</b></div></td></tr></table>");
}}}}},failure:function(){Ext.fly("namedUserGraph").update('<table style="text-align:center;width:100%;height:100%;margin:12% auto 0px auto"><tr><td valign="middle"><div class = "iconExclamation" style="margin:0 auto 0 auto;"></div><div class="font_normal12" style="text-align:center"><b> '+errorMsg+" </b></div></td></tr></table>");
}});}},ccUserGraphmodeChange:function(){var d="/final/admin/License/data/EgCcUserDetailedGraph.jsp?";var b=Ext.getCmp("ccGraphMode").getValue();var a=Ext.getCmp("selDate").getValue();d+="&er_mode="+b;d+="&selDate="+a;var c=Ext.select("#ccUserGraph");c.set({src:d});},getSelectedUsersData:function(g){var a=g.getValue();
var c=Ext.getCmp("datepick").getValue();var b=c.toString().substring(4,15);var f=Ext.Date.add(c,Ext.Date.DAY,1);c=Ext.util.Format.date(f,"m/d/Y");Ext.getCmp("usersCnt").hide();Ext.getCmp("defaultCont").hide();Ext.getCmp("NoUserAvailable").hide();if(this.getUsernames().down("#searchTrigger")){this.getUsernames().down("#searchTrigger").disable();
this.getUsernames().down("#searchTrigger").setValue("");}var d=Ext.getCmp("userNames").getEl();var h=Ext.getCmp("gridCont");d.mask("Loading...","maskCenter");var e="License/data/UserNamesJson.jsp?date="+c+"&datePickVal="+b+"&usertype="+a;Ext.Ajax.request({url:e,method:"POST",success:function(o){if(o.status==200&&!Ext.isEmpty(o.responseText)){var m=o.responseText;
publicJSON=Ext.decode(m);var s=publicJSON["selectedUsersDataArr"];if(!Ext.isEmpty(s)){Ext.getCmp("userGrid").getStore().removeAll();Ext.getCmp("pagingtoolbarid").getStore().removeAll();var l=setCountLabelTitle(fromUserType,a,publicJSON);if(!Ext.isEmpty(l)){Ext.getCmp("usersCnt").show();Ext.getCmp("usersCnt").update(l);
}var n=publicJSON["columnArr"];var q=new Array();var j=new Array();for(var p=0;p<n.length;p++){var k=65;if(p==0||(p==n.length-1)){k=170;}q[q.length]=n[p];j.push({header:n[p],minWidth:k,flex:0.2,dataIndex:n[p],renderer:function(i){return'<div style="white-space:normal !important;word-wrap:break-word;">'+i+"</div>";
}});}Ext.define("GridModel",{extend:"Ext.data.Model",fields:n});var r=Ext.create("Ext.data.Store",{pageSize:250,model:"GridModel",proxy:{type:"ajax",url:e,reader:{type:"json",root:"selectedUsersDataArr",totalProperty:"totalProperty",}},storeId:"store",sorters:[{property:"User",direction:"ASC"}],remoteFilter:true,remoteSort:false});
Ext.getCmp("userGrid").reconfigure(r,j);Ext.getCmp("pagingtoolbarid").bindStore(r);ctrler.getUsernames().down("#searchTrigger").enable();Ext.getCmp("saveCSV").enable();r.load();}else{Ext.getCmp("userGrid").getStore().removeAll();Ext.getCmp("pagingtoolbarid").getStore().removeAll();Ext.getCmp("saveCSV").disable();
Ext.getCmp("pagingtoolbarid").onLoad();Ext.getCmp("pagingtoolbarid").down("#refresh").setDisabled(true);Ext.getCmp("userGrid").getView().emptyText='<div class="egFlexCenterByColumnWise" style="height:98%"><div class="iconInformation"></div><div class="commonErrorMsgText">No data found.</div></div>';Ext.getCmp("userGrid").getView().refresh();
}h.doLayout();d.unmask();}},failure:function(j,i){h.doLayout();d.unmask();}});},showUserNames:function(){var v=new Date();var b=Ext.Date.add(v,Ext.Date.DAY,-1);b=b.toString().substring(4,15);v=Ext.util.Format.date(v,"m/d/Y");var h="all";var s="License/data/UserNamesJson.jsp?date="+v+"&datePickVal="+b+"&usertype="+h;
Ext.Ajax.request({url:s,method:"POST",async:false,success:function(i){if(i.status==200&&!Ext.isEmpty(i.responseText)){var z=i.responseText;publicJSON=Ext.decode(z);}}});var r=Ext.getCmp("licenseviewport");r.removeAll();r.add({xtype:"usernames"});var f=Ext.Date.add(new Date(),Ext.Date.DAY,-1);var w=Ext.Date.format(f,mgrDateFormat);
Ext.getCmp("datepick").setValue(w);var l=publicJSON.isDefaultViewInUserNames;if(l){if(fromUserType=="NamedUsers"){Ext.getCmp("totCnt").update("Total "+namedUserOrVm+": "+publicJSON.totCount);}else{Ext.getCmp("totCnt").update("Total "+concUserOrVm+": "+publicJSON.totCount);}if(publicJSON.totCount>0){Ext.getCmp("saveCSV").enable();
var j=Ext.getCmp("ctxFldSet");var k=Ext.getCmp("vdiFldSet");var x=Ext.getCmp("trmFldSet");Ext.getCmp("defaultCont").show();if(publicJSON.ctxCount>0){j.show();j.setTitle("Citrix Users ("+publicJSON.ctxCount+")");}else{j.hide();}if(publicJSON.vdiCount>0){k.show();k.setTitle("VDI Users ("+publicJSON.vdiCount+")");
}else{k.hide();}if(publicJSON.trmCount>0){x.show();x.setTitle("Cloud/Terminal Users ("+publicJSON.trmCount+")");}else{x.hide();}var e=Ext.getCmp("ctxData");e.tpl=tplData;e.update(publicJSON.ctxUsers);var o=Ext.getCmp("vdiData");o.tpl=tplData;o.update(publicJSON.vdiUsers);var m=Ext.getCmp("trmData");m.tpl=tplData;
m.update(publicJSON.trmUsers);}else{Ext.getCmp("defaultCont").hide();Ext.getCmp("NoUserAvailable").show();}}else{var p=Ext.getCmp("userNames").getEl();var t=Ext.getCmp("gridCont");p.mask("Loading...","maskCenter");if(publicJSON.totCount>0){Ext.getCmp("saveCSV").enable();Ext.getCmp("NoUserAvailable").hide();
Ext.getCmp("defaultCont").hide();Ext.getCmp("gridCont").show();var n=publicJSON["selectedUsersDataArr"];if(!Ext.isEmpty(n)){var u=publicJSON["columnArr"];var g=new Array();var y=new Array();for(var q=0;q<u.length;q++){var c=65;g[g.length]=u[q];y.push({header:u[q],minWidth:c,flex:0.2,dataIndex:u[q],renderer:function(i){return'<div style="white-space:normal !important;word-wrap:break-word;">'+i+"</div>";
}});}Ext.define("GridModel",{extend:"Ext.data.Model",fields:u});var d=Ext.create("Ext.data.Store",{pageSize:250,model:"GridModel",proxy:{type:"ajax",url:s,reader:{type:"json",root:"selectedUsersDataArr",totalProperty:"totalProperty",}},storeId:"store",remoteFilter:true,remoteSort:false,sorters:[{property:"User",direction:"ASC"}],});
t.add({xtype:"customgrid",ui:"newGridPanel",border:true,id:"userGrid",margin:10,flex:1,scroll:true,autoScroll:true,store:d,dockedItems:[{xtype:"pagingtoolbar",id:"pagingtoolbarid",store:d,dock:"bottom",cls:"pagingtoolbar",displayInfo:true}],columns:y,tbar:[{xtype:"scrollcombo",editable:false,fieldLabel:"User type",itemId:"filterby",store:new Ext.data.Store({fields:["displayField","valueField"],data:[{"displayField":"All","valueField":"all"},{"displayField":"Citrix users","valueField":"ctxusers"},{"displayField":"VDI users","valueField":"vdiusers"},{"displayField":"Cloud/Terminal users","valueField":"termusers"}]}),displayField:"displayField",valueField:"valueField",value:"all",queryMode:"local",labelAlign:"left",labelSeparator:" ",width:250,labelWidth:80,margin:"5 5 5 0",listeners:{select:function(){ctrler.getSelectedUsersData(this);
}}},{xtype:"label",text:"",labelSeparator:" ",id:"usersCnt",margin:"5 5 5 10"},{xtype:"tbfill",},{xtype:"toolbar",ui:"footer",items:[{xtype:"trigger",labelAlign:"top",labelSeparator:" ",itemId:"searchTrigger",trigger1Cls:"x-form-clear-trigger",trigger2Cls:"x-form-search-trigger",cls:"whitedropdown_search",emptyText:"Search user",disabled:true,getTriggerMarkup:function(){var D=this,B=0,G=(D.readOnly||D.hideTrigger),z,E=D.triggerBaseCls,F=[],C=Ext.dom.Element.unselectableCls,A="width:"+D.triggerWidth+"px;"+(G?"display:none;":""),H=D.extraTriggerCls+" "+Ext.baseCSSPrefix+"trigger-cell "+C;
if(!D.trigger1Cls){D.trigger1Cls=D.triggerCls;}for(B=0;(z=D["trigger"+(B+1)+"Cls"])||B<1;B++){if(B==0){F.push({tag:"td",role:"presentation",valign:"top",cls:H,id:"MyTrigger_"+B,style:A+"display:none;",cn:{cls:[Ext.baseCSSPrefix+"trigger-index-"+B,E,z].join(" "),role:"presentation"}});}else{F.push({tag:"td",role:"presentation",valign:"top",cls:H,id:"MyTrigger_"+B,style:A,cn:{cls:[Ext.baseCSSPrefix+"trigger-index-"+B,E,z].join(" "),role:"presentation"}});
}}F[0].cn.cls+=" "+E+"-first";return Ext.DomHelper.markup(F);},onTrigger1Click:function(){this.reset();},onTrigger2Click:function(){ctrler.onSearchAction(this);}}]}]});d.load();}var a=setCountLabelTitle(fromUserType,h,publicJSON);if(!Ext.isEmpty(a)){Ext.getCmp("usersCnt").show();Ext.getCmp("usersCnt").update(a);
}else{Ext.getCmp("usersCnt").hide();}if(this.getUsernames().down("#searchTrigger")){this.getUsernames().down("#searchTrigger").enable();}}else{Ext.getCmp("gridCont").hide();Ext.getCmp("defaultCont").hide();Ext.getCmp("saveCSV").disable();if(this.getUsernames().down("#searchTrigger")){this.getUsernames().down("#searchTrigger").disable();
}Ext.getCmp("NoUserAvailable").show();}t.doLayout();p.unmask();}},onSearchAction:function(d){var a=this.getUsernames().down("#filterby").getValue();var b=Ext.getStore("store");value=d.getValue();Ext.getCmp("usersCnt").hide();Ext.getCmp("saveCSV").disable();b.clearFilter(true);if(value){b.filter("User",value);
}var c=Ext.getCmp("userNames").getEl();var e=Ext.getCmp("gridCont");c.mask("Loading...","maskCenter");b.load(function(h,g,k){if(k){var i="No data found";var f=g.response.responseText;var l=Ext.decode(f);var j=setCountLabelTitle(fromUserType,a,l);if(!Ext.isEmpty(j)){Ext.getCmp("usersCnt").show();Ext.getCmp("usersCnt").update(j);
}if(l.totalProperty==0){Ext.getCmp("saveCSV").disable();i="No data found for your search";Ext.getCmp("userGrid").getView().emptyText='<div class="egFlexCenterByColumnWise" style="height:98%"><div class="iconInformation"></div><div class="commonErrorMsgText">'+i+".</div></div>";}else{Ext.getCmp("saveCSV").enable();
Ext.getCmp("userGrid").getView().emptyText='<div class="egFlexCenterByColumnWise" style="height:98%"><div class="iconInformation"></div><div class="commonErrorMsgText">'+i+".</div></div>";}Ext.getCmp("userGrid").getView().refresh();}});e.doLayout();c.unmask();},showPeakUserNames:function(){var u=peakdateForUserNames;
var b=Ext.Date.add(u,Ext.Date.DAY,-1);b=b.toString().substring(4,15);u=Ext.util.Format.date(u,"m/d/Y");var g="all";var r="License/data/UserNamesJson.jsp?currentValue=peakUsage&date="+u+"&datePickVal="+b+"&usertype="+g;Ext.Ajax.request({url:r,method:"POST",async:false,success:function(i){if(i.status==200&&!Ext.isEmpty(i.responseText)){var y=i.responseText;
publicJSON=Ext.decode(y);}}});var q=Ext.getCmp("licenseviewport");q.removeAll();q.add({xtype:"usernames"});currDate=new Date(publicJSON.datePick);var v=Ext.Date.format(currDate,mgrDateFormat);Ext.getCmp("datepick").setValue(v);var k=publicJSON.isDefaultViewInUserNames;if(k){if(fromUserType=="NamedUsers"){Ext.getCmp("totCnt").update("Total Named Users: "+publicJSON.totCount);
}if(fromUserType=="ConcurrentUser"){Ext.getCmp("totCnt").update("Total Concurrent Users: "+publicJSON.totCount);}if(publicJSON.totCount>0){Ext.getCmp("saveCSV").enable();Ext.getCmp("NoUserAvailable").hide();var h=Ext.getCmp("ctxFldSet");var j=Ext.getCmp("vdiFldSet");var w=Ext.getCmp("trmFldSet");Ext.getCmp("gridCont").hide();
Ext.getCmp("defaultCont").show();if(publicJSON.ctxCount>0){h.show();h.setTitle("Citrix Users ("+publicJSON.ctxCount+")");}else{Ext.getCmp("totCnt").hide();Ext.getCmp("ctxFldSet").hide();Ext.getCmp("vdiFldSet").hide();Ext.getCmp("trmFldSet").hide();}if(publicJSON.vdiCount>0){j.show();j.setTitle("VDI Users ("+publicJSON.vdiCount+")");
}else{j.hide();}if(publicJSON.trmCount>0){w.show();w.setTitle("Cloud/Terminal Users ("+publicJSON.trmCount+")");}else{w.hide();}var e=Ext.getCmp("ctxData");e.tpl=tplData;e.update(publicJSON.ctxUsers);var n=Ext.getCmp("vdiData");n.tpl=tplData;n.update(publicJSON.vdiUsers);var l=Ext.getCmp("trmData");l.tpl=tplData;
l.update(publicJSON.trmUsers);}else{Ext.getCmp("gridCont").hide();Ext.getCmp("defaultCont").hide();Ext.getCmp("NoUserAvailable").show();}}else{var o=Ext.getCmp("userNames").getEl();var s=Ext.getCmp("gridCont");o.mask("Loading...","maskCenter");if(publicJSON.totCount>0){Ext.getCmp("saveCSV").enable();
Ext.getCmp("NoUserAvailable").hide();Ext.getCmp("gridCont").show();Ext.getCmp("defaultCont").hide();var m=publicJSON["selectedUsersDataArr"];if(!Ext.isEmpty(m)){var t=publicJSON["columnArr"];var f=new Array();var x=new Array();for(var p=0;p<t.length;p++){var c=65;if(p==0||(p==t.length-1)){c=170;}f[f.length]=t[p];
x.push({header:t[p],minWidth:c,flex:0.2,dataIndex:t[p],renderer:function(i){return'<div style="white-space:normal !important;word-wrap:break-word;">'+i+"</div>";}});}Ext.define("GridModel",{extend:"Ext.data.Model",fields:t});var d=Ext.create("Ext.data.Store",{pageSize:250,model:"GridModel",proxy:{type:"ajax",url:r,reader:{type:"json",root:"selectedUsersDataArr",totalProperty:"totalProperty",}},storeId:"store",sorters:[{property:"User",direction:"ASC"}],remoteFilter:true,remoteSort:false});
s.add({xtype:"customgrid",ui:"newGridPanel",border:true,id:"userGrid",margin:10,flex:1,scroll:true,height:380,autoScroll:true,store:d,dockedItems:[{xtype:"pagingtoolbar",id:"pagingtoolbarid",store:d,dock:"bottom",cls:"pagingtoolbar",displayInfo:true}],columns:x,tbar:[{xtype:"scrollcombo",editable:false,fieldLabel:"User type",id:"filterby",itemId:"filterby",store:new Ext.data.Store({fields:["displayField","valueField"],data:[{"displayField":"All","valueField":"all"},{"displayField":"Citrix users","valueField":"ctxusers"},{"displayField":"VDI users","valueField":"vdiusers"},{"displayField":"Cloud/Terminal users","valueField":"termusers"}]}),displayField:"displayField",valueField:"valueField",value:"all",queryMode:"local",labelAlign:"left",labelSeparator:" ",width:250,labelWidth:80,margin:"5 5 5 0",listeners:{select:function(){ctrler.getSelectedUsersData(this);
}}},{xtype:"label",text:"",labelSeparator:" ",id:"usersCnt",margin:"5 5 5 10"},{xtype:"tbfill",},{xtype:"toolbar",ui:"footer",items:[{xtype:"trigger",labelAlign:"top",labelSeparator:" ",itemId:"searchTrigger",trigger1Cls:"x-form-clear-trigger",trigger2Cls:"x-form-search-trigger",cls:"whitedropdown_search",emptyText:"Search user",disabled:true,getTriggerMarkup:function(){var C=this,A=0,F=(C.readOnly||C.hideTrigger),y,D=C.triggerBaseCls,E=[],B=Ext.dom.Element.unselectableCls,z="width:"+C.triggerWidth+"px;"+(F?"display:none;":""),G=C.extraTriggerCls+" "+Ext.baseCSSPrefix+"trigger-cell "+B;
if(!C.trigger1Cls){C.trigger1Cls=C.triggerCls;}for(A=0;(y=C["trigger"+(A+1)+"Cls"])||A<1;A++){if(A==0){E.push({tag:"td",role:"presentation",valign:"top",cls:G,id:"MyTrigger_"+A,style:z+"display:none;",cn:{cls:[Ext.baseCSSPrefix+"trigger-index-"+A,D,y].join(" "),role:"presentation"}});}else{E.push({tag:"td",role:"presentation",valign:"top",cls:G,id:"MyTrigger_"+A,style:z,cn:{cls:[Ext.baseCSSPrefix+"trigger-index-"+A,D,y].join(" "),role:"presentation"}});
}}E[0].cn.cls+=" "+D+"-first";return Ext.DomHelper.markup(E);},onTrigger1Click:function(){this.reset();},onTrigger2Click:function(){ctrler.onSearchAction(this);}}]}]});d.load();}var a=setCountLabelTitle(fromUserType,g,publicJSON);if(!Ext.isEmpty(a)){Ext.getCmp("usersCnt").show();Ext.getCmp("usersCnt").update(a);
}else{Ext.getCmp("usersCnt").hide();}if(this.getUsernames().down("#searchTrigger")){this.getUsernames().down("#searchTrigger").enable();}}else{Ext.getCmp("gridCont").hide();Ext.getCmp("defaultCont").hide();if(this.getUsernames().down("#searchTrigger")){this.getUsernames().down("#searchTrigger").disable();
}Ext.getCmp("saveCSV").disable();Ext.getCmp("NoUserAvailable").show();}s.doLayout();o.unmask();}},dateWiseUserNames:function(){var w=Ext.getCmp("datepick").getValue();var b=w.toString().substring(4,15);var h=Ext.Date.add(w,Ext.Date.DAY,1);w=Ext.util.Format.date(h,"m/d/Y");var j="all";var t="License/data/UserNamesJson.jsp?date="+w+"&datePickVal="+b+"&usertype="+j;
Ext.Ajax.request({url:t,method:"POST",async:false,success:function(i){if(i.status==200&&!Ext.isEmpty(i.responseText)){var A=i.responseText;publicJSON=Ext.decode(A);}}});var s=Ext.getCmp("licenseviewport");s.removeAll();s.add({xtype:"usernames"});var m=publicJSON.isDefaultViewInUserNames;var f=new Date(publicJSON.datePick);
var x=Ext.Date.format(f,mgrDateFormat);Ext.getCmp("datepick").setValue(x);if(m){if(fromUserType=="NamedUsers"){Ext.getCmp("totCnt").update("Total Named Users: "+publicJSON.totCount);}else{Ext.getCmp("totCnt").update("Total Concurrent Users: "+publicJSON.totCount);}if(publicJSON.totCount>0){Ext.getCmp("saveCSV").enable();
Ext.getCmp("NoUserAvailable").hide();var k=Ext.getCmp("ctxFldSet");var l=Ext.getCmp("vdiFldSet");var y=Ext.getCmp("trmFldSet");Ext.getCmp("gridCont").hide();Ext.getCmp("defaultCont").show();if(publicJSON.ctxCount>0){k.show();k.setTitle("Citrix Users ("+publicJSON.ctxCount+")");}else{Ext.getCmp("totCnt").hide();
Ext.getCmp("ctxFldSet").hide();Ext.getCmp("vdiFldSet").hide();Ext.getCmp("trmFldSet").hide();}if(publicJSON.vdiCount>0){l.show();l.setTitle("VDI Users ("+publicJSON.vdiCount+")");}else{l.hide();}if(publicJSON.trmCount>0){y.show();y.setTitle("Cloud/Teminal Users  ("+publicJSON.trmCount+")");}else{y.hide();
}var e=Ext.getCmp("ctxData");e.tpl=tplData;e.update(publicJSON.ctxUsers);var p=Ext.getCmp("vdiData");p.tpl=tplData;p.update(publicJSON.vdiUsers);var o=Ext.getCmp("trmData");o.tpl=tplData;o.update(publicJSON.trmUsers);}else{Ext.getCmp("gridCont").hide();Ext.getCmp("defaultCont").hide();Ext.getCmp("NoUserAvailable").show();
}}else{var q=Ext.getCmp("userNames").getEl();var u=Ext.getCmp("gridCont");q.mask("Loading...","maskCenter");if(publicJSON.totCount>0){Ext.getCmp("saveCSV").enable();Ext.getCmp("NoUserAvailable").hide();Ext.getCmp("gridCont").show();Ext.getCmp("defaultCont").hide();var n=publicJSON["selectedUsersDataArr"];
if(!Ext.isEmpty(n)){var v=publicJSON["columnArr"];var g=new Array();var z=new Array();for(var r=0;r<v.length;r++){var c=65;if(r==0||(r==v.length-1)){c=170;}g[g.length]=v[r];z.push({header:v[r],minWidth:c,flex:0.2,dataIndex:v[r],renderer:function(i){return'<div style="white-space:normal !important;word-wrap:break-word;">'+i+"</div>";
}});}Ext.define("GridModel",{extend:"Ext.data.Model",fields:v});var d=Ext.create("Ext.data.Store",{pageSize:250,model:"GridModel",proxy:{type:"ajax",url:t,reader:{type:"json",root:"selectedUsersDataArr",totalProperty:"totalProperty",}},storeId:"store",sorters:[{property:"User",direction:"ASC"}],remoteFilter:true,remoteSort:false});
u.add({xtype:"customgrid",ui:"newGridPanel",border:true,id:"userGrid",margin:10,flex:1,scroll:true,height:380,autoScroll:true,store:d,dockedItems:[{xtype:"pagingtoolbar",id:"pagingtoolbarid",store:d,dock:"bottom",cls:"pagingtoolbar",displayInfo:true}],columns:z,tbar:[{xtype:"scrollcombo",editable:false,fieldLabel:"User type",itemId:"filterby",store:new Ext.data.Store({fields:["displayField","valueField"],data:[{"displayField":"All","valueField":"all"},{"displayField":"Citrix users","valueField":"ctxusers"},{"displayField":"VDI users","valueField":"vdiusers"},{"displayField":"Cloud/Terminal users","valueField":"termusers"}]}),displayField:"displayField",valueField:"valueField",value:"all",queryMode:"local",labelAlign:"left",labelSeparator:" ",width:250,labelWidth:80,margin:"5 5 5 0",listeners:{select:function(){ctrler.getSelectedUsersData(this);
}}},{xtype:"label",text:"",labelSeparator:" ",id:"usersCnt",margin:"5 5 5 10"},{xtype:"tbfill",},{xtype:"toolbar",ui:"footer",items:[{xtype:"trigger",labelAlign:"top",labelSeparator:" ",itemId:"searchTrigger",trigger1Cls:"x-form-clear-trigger",trigger2Cls:"x-form-search-trigger",cls:"whitedropdown_search",emptyText:"Search user",disabled:true,getTriggerMarkup:function(){var E=this,C=0,H=(E.readOnly||E.hideTrigger),A,F=E.triggerBaseCls,G=[],D=Ext.dom.Element.unselectableCls,B="width:"+E.triggerWidth+"px;"+(H?"display:none;":""),I=E.extraTriggerCls+" "+Ext.baseCSSPrefix+"trigger-cell "+D;
if(!E.trigger1Cls){E.trigger1Cls=E.triggerCls;}for(C=0;(A=E["trigger"+(C+1)+"Cls"])||C<1;C++){if(C==0){G.push({tag:"td",role:"presentation",valign:"top",cls:I,id:"MyTrigger_"+C,style:B+"display:none;",cn:{cls:[Ext.baseCSSPrefix+"trigger-index-"+C,F,A].join(" "),role:"presentation"}});}else{G.push({tag:"td",role:"presentation",valign:"top",cls:I,id:"MyTrigger_"+C,style:B,cn:{cls:[Ext.baseCSSPrefix+"trigger-index-"+C,F,A].join(" "),role:"presentation"}});
}}G[0].cn.cls+=" "+F+"-first";return Ext.DomHelper.markup(G);},onTrigger1Click:function(){this.reset();},onTrigger2Click:function(){ctrler.onSearchAction(this);}}]}]});d.load();}var a=setCountLabelTitle(fromUserType,j,publicJSON);if(!Ext.isEmpty(a)){Ext.getCmp("usersCnt").show();Ext.getCmp("usersCnt").update(a);
}else{Ext.getCmp("usersCnt").hide();}if(this.getUsernames().down("#searchTrigger")){this.getUsernames().down("#searchTrigger").enable();}}else{Ext.getCmp("gridCont").hide();Ext.getCmp("defaultCont").hide();if(this.getUsernames().down("#searchTrigger")){this.getUsernames().down("#searchTrigger").disable();
}Ext.getCmp("saveCSV").disable();Ext.getCmp("NoUserAvailable").show();}u.doLayout();q.unmask();}},saveInCSVUserNames:function(){window.location.href="/final/servlet/com.eg.SaveInCSVFormat?user_language="+userLanguage+"&filePrefix="+csvfilename;},saveInCSVFormat:function(){window.location.href="/final/servlet/com.eg.SaveInCSVFormat?user_language="+userLanguage;
},saveInCSVFormatUser:function(){var c="UserWiseLicenseUsageReport";var a=Ext.getCmp("searchBox").getValue();a=encodeURIComponent(a);var b="License/data/ZoneAndUserWiseReportJson.jsp?tab=User&searchStr="+a;Ext.Ajax.request({url:b,method:"POST",async:false});window.location.href="/final/servlet/com.eg.SaveInCSVFormat?user_language="+userLanguage+"&filePrefix="+c;
},saveInCSVFormatOrg:function(){var c="OrgWiseLicenseUsageReport";var a=Ext.getCmp("searchbox").getValue();a=encodeURIComponent(a);var b="License/data/LicenseUsageByOrgJson.jsp?searchStr="+a;Ext.Ajax.request({url:b,method:"POST",async:false});window.location.href="/final/servlet/com.eg.SaveInCSVFormat?user_language="+userLanguage+"&filePrefix="+c;
},saveInCSVFormatUserNew:function(){var f="UserWiseLicenseUsageReport";var e=Ext.getCmp("searchBox").getValue();e=encodeURIComponent(e);var d="License/data/LicenseUsageForUserJson.jsp?tab=User&searchStr="+e;Ext.Ajax.request({url:d,method:"POST",async:false,waitMsg:"downloading csv...",});window.location.href="/final/servlet/com.eg.SaveInCSVFormat?user_language="+userLanguage+"&filePrefix="+f;
},saveInCSVFormatZone:function(){var c="ZoneWiseLicenseUsageReport";var a=Ext.getCmp("searchBox").getValue();a=encodeURIComponent(a);var b="License/data/ZoneAndUserWiseReportJson.jsp?tab=Zone&searchStr="+a;Ext.Ajax.request({url:b,method:"POST",async:false});window.location.href="/final/servlet/com.eg.SaveInCSVFormat?user_language="+userLanguage+"&filePrefix="+c;
},saveInCSVTotalUsage:function(){var b="TotalLicenseUsage";var a="License/data/EgLicenseInfoJson.jsp";Ext.Ajax.request({url:a,method:"POST",async:false});window.location.href="/final/servlet/com.eg.SaveInCSVFormat?user_language="+userLanguage+"&filePrefix="+b;},goBack:function(){this.buildMainData();
var a=Ext.getCmp("licenseviewport");a.removeAll();backTrue=selectedTab;a.add({xtype:"licenseinfo"});if(selectedTab=="certUsage"){Ext.getCmp("certInfoTab").setActiveTab(1);}else{if(selectedTab=="usrWiseTabNew"){Ext.getCmp("certInfoTab").setActiveTab(2);}else{if(selectedTab=="orgWiseTabNew"){Ext.getCmp("certInfoTab").setActiveTab(3);
}else{if(selectedTab=="zoneWiseTab"){Ext.getCmp("certInfoTab").setActiveTab(Ext.getCmp("zoneWiseTab"));}}}}},goToAgentStatus:function(){window.location.href="/final/admin/EgServerList.jsp?from=licenseoverview";},goHome:function(){window.location.href=backHref;},showDetails:function(b){var d="License/data/UsedCountDetailsJson.jsp?attribute="+b;
Ext.Ajax.request({url:d,method:"POST",async:false,success:function(e){if(e.status==200&&!Ext.isEmpty(e.responseText)){var f=e.responseText;publicJSON=Ext.decode(f);}}});var a=Ext.getCmp("licenseviewport");a.removeAll();a.add({xtype:"usedcountdetails"});Ext.getCmp("usedCount").update(b+" : "+publicJSON.count);
var c=Ext.getCmp("attributeData");c.tpl=tplData;c.update(publicJSON.details);},showOrgLicenseDetails:function(d){var a=d.indexOf("@#@");var f=d.substring(0,a);var c=d.substring(a+3);if(f!=""){var g="License/data/UserLicenseCountDetailsJson.jsp?userName="+f+"&monType="+c+"&orgUnitName="+orgUnitName;Ext.Ajax.request({url:g,method:"POST",async:false,success:function(h){if(h.status==200&&!Ext.isEmpty(h.responseText)){var i=h.responseText;
publicJSON=Ext.decode(i);}}});var b=Ext.getCmp("licenseviewport");b.removeAll();b.add({xtype:"usedcountdetails"});if(isLimitedAdmin=="false"){Ext.getCmp("orgName").update(orgUnitName.replace(/ /g,"")+" ");Ext.getCmp("userName").update(":"+"&nbsp&nbsp"+f);}Ext.getCmp("usedCount").update("&nbsp&nbsp&nbsp&nbsp&nbsp"+c+" : "+publicJSON.Count);
var e=Ext.getCmp("attributeData");e.tpl=tplData;e.update(publicJSON.details);}},showZoneDetails:function(d,f){var a=d.indexOf(",");var f=d.substring(a+1);var c=","+f;d=d.replace(c,"");var g="License/data/UsedCountDetailsJson.jsp?zoneAttr="+d+"&zoneName="+f;Ext.Ajax.request({url:g,method:"POST",async:false,success:function(h){if(h.status==200&&!Ext.isEmpty(h.responseText)){var i=h.responseText;
publicJSON=Ext.decode(i);}}});var b=Ext.getCmp("licenseviewport");b.removeAll();b.add({xtype:"usedcountdetails"});Ext.getCmp("usedCount").update(publicJSON.zoneName+":"+" "+d+" : "+publicJSON.count);var e=Ext.getCmp("attributeData");e.tpl=tplData;e.update(publicJSON.details);},orgTabLoad:function(){var a="License/data/LicenseUsageByOrgJson.jsp";
Ext.Ajax.request({url:a,method:"POST",async:false,success:function(c){if(c.status==200&&!Ext.isEmpty(c.responseText)){var g=c.responseText;publicJSON=Ext.decode(g);var f=publicJSON["isUsersCreated"];if(f!=false){var d={text:"Choose Organization / Organizational Unit",id:"-1",name:"-1",expanded:true,children:publicJSON["exportDataArr"]};
var h=Ext.getCmp("unameTree");h.setRootNode(d);h.show();var b=Ext.getElementById("noUserFound");if(b){b.style.display="none";}var e=((publicJSON.isMgrUsedBased!=undefined||publicJSON.isMgrUsedBased!="")&&publicJSON.isMgrUsedBased=="true");if(e){h.columns[5].show();h.getView().refresh();}else{if(!e){h.columns[5].hide();
}}}}}});},userWiseTabLoad:function(){var b="License/data/ZoneAndUserWiseReportJson.jsp?tab=User";Ext.Ajax.request({url:b,method:"POST",async:false,success:function(c){if(c.status==200&&!Ext.isEmpty(c.responseText)){var d=c.responseText;publicJSON=Ext.decode(d);}}});user_colCount=3;var a=Ext.getCmp("UserWiseGrid");
a.getStore().loadRawData(publicJSON.gridDetails);if(publicJSON.enableSearch){Ext.getCmp("searchBox").enable();}else{a.store.loadData("");a.normalGrid.getView().emptyText='<div class="egFlexCenterByColumnWise" style="height:98%"><div class="iconInformation"></div><div class="commonErrorMsgText">'+noUsers+"</div></div>";
a.normalGrid.getView().refresh();Ext.getCmp("searchBox").disable();Ext.getCmp("saveCSVUser").disable();}if(publicJSON.hideExtAgtCol){a.normalGrid.columns[3].hide();}else{a.normalGrid.columns[3].show();user_colCount+=1;}if(publicJSON.hideUserCertCol){a.normalGrid.columns[4].hide();}else{a.normalGrid.columns[4].show();
user_colCount+=1;}if(publicJSON.hideMonTrgtsCol){a.normalGrid.columns[5].hide();}else{a.normalGrid.columns[5].show();user_colCount+=1;}if(publicJSON.hideAppsCol){a.normalGrid.columns[6].hide();}else{a.normalGrid.columns[6].show();user_colCount+=1;}if(publicJSON.hideNwDevsCol){a.normalGrid.columns[7].hide();
}else{a.normalGrid.columns[7].show();user_colCount+=1;}if(publicJSON.hideServsCol){a.normalGrid.columns[8].hide();}else{a.normalGrid.columns[8].show();user_colCount+=1;}if(publicJSON.hideSegsCol){a.normalGrid.columns[9].hide();}else{a.normalGrid.columns[9].show();user_colCount+=1;}},searchUser:function(){var a=Ext.getCmp("searchBox").getValue();
a=filterEncode(a);a=encodeURIComponent(a);var b="License/data/ZoneAndUserWiseReportJson.jsp?tab=User&searchStr="+a;if(a==""||a.length==0){Ext.get("UserTrigger_0").setStyle("display","none");Ext.get("UserTrigger_1").setStyle("display","block");}else{Ext.get("UserTrigger_1").setStyle("display","none");
Ext.get("UserTrigger_0").setStyle("display","block");}Ext.Ajax.request({url:b,method:"POST",async:false,success:function(c){if(c.status==200&&!Ext.isEmpty(c.responseText)){var d=c.responseText;publicJSON=Ext.decode(d);}}});Ext.getCmp("UserWiseGrid").getStore().loadRawData(publicJSON.gridDetails);},zoneWiseTabLoad:function(){var b="License/data/ZoneAndUserWiseReportJson.jsp?tab=Zone";
Ext.Ajax.request({url:b,method:"POST",async:false,success:function(c){if(c.status==200&&!Ext.isEmpty(c.responseText)){var d=c.responseText;publicJSON=Ext.decode(d);}}});colCount=4;var a=Ext.getCmp("ZoneWiseGrid");a.getStore().loadRawData(publicJSON.gridDetails);if(publicJSON.enableSearch){Ext.getCmp("searchBoxZone").enable();
}else{a.store.loadData("");a.normalGrid.getView().emptyText='<div class="egFlexCenterByColumnWise" style="height:98%"><div class="iconInformation"></div><div class="commonErrorMsgText">'+noZones+"</div></div>";a.normalGrid.getView().refresh();Ext.getCmp("searchBoxZone").disable();Ext.getCmp("saveCSVZone").disable();
}if(publicJSON.hideUserCertCol){a.normalGrid.columns[4].hide();}else{colCount+=1;a.normalGrid.columns[4].show();}if(publicJSON.hideMonTrgtsCol){a.normalGrid.columns[5].hide();}else{a.normalGrid.columns[5].show();colCount+=1;}if(publicJSON.hideAppsCol){a.normalGrid.columns[6].hide();}else{a.normalGrid.columns[6].show();
colCount+=1;}if(publicJSON.hideNwDevsCol){a.normalGrid.columns[7].hide();}else{a.normalGrid.columns[7].show();colCount+=1;}if(publicJSON.hideServsCol){a.normalGrid.columns[8].hide();}else{a.normalGrid.columns[8].show();colCount+=1;}if(publicJSON.hideSegsCol){a.normalGrid.columns[9].hide();}else{a.normalGrid.columns[9].show();
colCount+=1;}},searchZone:function(){var a=Ext.getCmp("searchBoxZone").getValue();a=filterEncode(a);a=encodeURIComponent(a);var b="License/data/ZoneAndUserWiseReportJson.jsp?tab=Zone&searchStr="+a;if(a==""||a.length==0){Ext.get("ZoneTrigger_0").setStyle("display","none");Ext.get("ZoneTrigger_1").setStyle("display","block");
}else{Ext.get("ZoneTrigger_1").setStyle("display","none");Ext.get("ZoneTrigger_0").setStyle("display","block");}Ext.Ajax.request({url:b,method:"POST",async:false,success:function(c){if(c.status==200&&!Ext.isEmpty(c.responseText)){var d=c.responseText;publicJSON=Ext.decode(d);}}});Ext.getCmp("ZoneWiseGrid").getStore().loadRawData(publicJSON.gridDetails);
},userWiseTabLoadNew:function(){var c="License/data/LicenseUsageForUserJson.jsp?tab=User";Ext.Ajax.request({url:c,method:"POST",async:false,success:function(b){if(b.status==200&&!Ext.isEmpty(b.responseText)){var a=b.responseText;publicJSON=Ext.decode(a);}}});var d=Ext.getCmp("UserWiseNewGrid");d.getStore().loadRawData(publicJSON.gridNewDetails);
},showManagerInfo:function(){var d=Ext.getCmp("managerInfo");var e=!Ext.isEmpty(d);if(e){d.destroy();}var g='<table border="0">'+'<tr><th style="padding:5px;text-decoration:underline;">'+manager+"</th>"+'<th style="padding:5px;text-decoration:underline;">'+url+"</th></tr>"+'<tr><td style="padding:5px">'+primary+'</td><td style="padding:5px">'+primaryManager+"</td></tr>"+'<tr><td style="padding:5px">'+secondary+'</td><td style="padding:5px">'+secondaryManager+"</td></tr>"+"</table>";
var j=Ext.getCmp("certInfoTab1").getBox().x;var h=Ext.getCmp("certInfoTab1").getBox().y;var b=Ext.getCmp("clusType").getBox().x;var i=Ext.getCmp("clusType").getBox().y;var c=j+(b-84);var a=h+(i-54);var f=130;if(b<=58){c=j+(b-94);}Ext.create("Ext.tip.ToolTip",{target:"clusType",height:120,width:250,maxWidth:900,anchor:"top",anchorOffset:f,dismissDelay:60000,id:"managerInfo",cls:"adminInfoTooltip",title:"Cluster Details",listeners:{hide:function(){this.destroy();
}},html:g}).showAt([c,a]);}});function dateValidation(d,g){var l=parseInt(d.substring((d.lastIndexOf("/")+1)));var f=parseInt(d.substring((d.indexOf("/")+1),d.lastIndexOf("/")));var a=parseInt(d.substring(0,d.indexOf("/")));var h=parseInt(g.substring((g.lastIndexOf("/")+1)));var c=parseInt(g.substring((g.indexOf("/")+1),g.lastIndexOf("/")));
var i=parseInt(g.substring(0,g.indexOf("/")));var j=0;if(l>h){j=-1;}else{if(l==h){if(a>i){j=-1;}else{if(a==i){if(f>c){j=-1;}}}}}return j;}function setCountLabelTitle(b,a,e){var c="";var d=e.totalProperty;if(a.toLowerCase()!="all"){if(a.toLowerCase()=="ctxusers"){if(d!=0){c="Total Citrix Users: "+d;}}else{if(a.toLowerCase()=="vdiusers"){if(d!=0){c="Total VDI Users: "+d;
}}else{if(a.toLowerCase()=="termusers"){if(d!=0){c="Total Cloud/Terminal Users: "+d;}}}}}else{if(b=="NamedUsers"){if(d!=0){c="Total Named Users: "+d;}}else{if(d!=0){c="Total Concurrent Users: "+d;}}}return c;}function egTitleSearch(){var e=Ext.getCmp("unameTree");var b=Ext.getCmp("searchbox").getValue();
var d="MyTrigger_searchbox_0";var c="MyTrigger_searchbox_1";if(b==""||b.length==0){Ext.get(d).setStyle("display","none");Ext.get(c).setStyle("display","block");}else{Ext.get(c).setStyle("display","none");Ext.get(d).setStyle("display","block");}if(b==null||b==""){Ext.getCmp("unameTree").filterBy(b,"UserID");
var a=Ext.getElementById("noDataFound");if(a){a.style.display="none";}}else{Ext.getCmp("unameTree").filterBy(b,"UserID");}}