Ext.Msg.bodyPadding="10 0";Ext.Msg.cls="adminAlert";Ext.define("SuccessfulLogons.controller.Main",{extend:"Ext.app.Controller",views:["FormItems","LoginResultPanel","Print","EgInfraDownloader"],refs:[{selector:"FormItems",ref:"FormItems"},{selector:"LoginResultPanel",ref:"LoginResultPanel"},],init:function(){this.buildMainData();
this.control({"logons_widget":{"afterrender":this.afterMainRender},'logons_widget button[id="schedule"]':{"click":this.callSaveSchedule},'logons_widget button[id="save"]':{"click":this.savePdf},'logons_widget button[id="print"]':{"click":this.printData},'logons_widget button[id="csv"]':{"click":this.saveInCSVFormat},'logons_widget button[id="showbutton"]':{"click":this.showAgain},'logons_widget combo[id="timeline"]':{"select":this.changeTimeline},'logons_widget combo[id="users"]':{"select":this.clearResultPanel},'logons_widget combo[id="clusterManager"]':{"select":this.clearResultPanel},'logons_widget combo[id="filterBy"]':{"select":this.clearResultPanel}});
},buildMainData:function(){var a="";if(reqFrom!=null&&reqFrom!=""&&reqFrom=="auditlog"){reqFrom="ownPage";a="/final/servlet/com.eg.AuditServletExtJS?"+queryString+"&jsppage=logons&reqfrom=navlink&submitted=true";}else{a="/final/servlet/com.eg.AuditServletExtJS?jsppage=logons&reqfrom=navlink";}Ext.Ajax.request({url:a,method:"POST",async:false,success:function(b){var c=b.responseText;
publicJSON=Ext.decode(c);},failure:function(c){var b=window;while(b.parent!=b||b.opener!=null){mainWindow=b;b=(b.parent==b?b.opener:b.parent);}if(b.location.pathname!="/"){mainWindow=b;}mainWindow.location.href="/final/servlet/com.egurkha.Logout?errmsg=1";mainWindow.focus();}});},clearResultPanel:function(){hideResultPanel();
},afterMainRender:function(){if(isClusterSupported=="false"&&auditLogEnabledForCLI=="false"){Ext.getCmp("clusterManager").hide();Ext.getCmp("filterBy").hide();}else{if(isClusterSupported=="true"&&auditLogEnabledForCLI=="true"){Ext.getCmp("clusterManager").show();Ext.getCmp("filterBy").show();}else{if(isClusterSupported=="true"){Ext.getCmp("clusterManager").show();
Ext.getCmp("filterBy").hide();}else{Ext.getCmp("clusterManager").hide();Ext.getCmp("filterBy").show();}}}var e=publicJSON["defaults"]["timeline"];if(e!=""&&e!=undefined&&e!="Any"){Ext.getCmp("eg_stdate").setDisabled(true);Ext.getCmp("starthr").setDisabled(true);Ext.getCmp("startmin").setDisabled(true);
Ext.getCmp("eg_enddate").setDisabled(true);Ext.getCmp("endhr").setDisabled(true);Ext.getCmp("endmin").setDisabled(true);Ext.getCmp("icon_go").hide();}else{Ext.getCmp("icon_go").show();Ext.getCmp("eg_stdate").setDisabled(false);Ext.getCmp("starthr").setDisabled(false);Ext.getCmp("startmin").setDisabled(false);
Ext.getCmp("eg_enddate").setDisabled(false);Ext.getCmp("endhr").setDisabled(false);Ext.getCmp("endmin").setDisabled(false);}Ext.getCmp("timeline").getStore().loadRawData(publicJSON["timelinesArray"]);Ext.getCmp("timeline").setValue(e);Ext.getCmp("eg_stdate").setValue(publicJSON["defaults"]["eg_stdate"]);
Ext.getCmp("starthr").setValue(publicJSON["defaults"]["starthr"]);Ext.getCmp("startmin").setValue(publicJSON["defaults"]["startmin"]);Ext.getCmp("eg_enddate").setValue(publicJSON["defaults"]["eg_enddate"]);Ext.getCmp("endhr").setValue(publicJSON["defaults"]["endhr"]);Ext.getCmp("endmin").setValue(publicJSON["defaults"]["endmin"]);
Ext.getCmp("users").getStore().loadRawData(publicJSON["userIdsArray"]);if(publicJSON["selectedUser"]!=null&&publicJSON["selectedUser"]!="undefined"){Ext.getCmp("users").setValue(publicJSON["selectedUser"]);}else{Ext.getCmp("users").setValue(publicJSON["defaultuser"]);}if(publicJSON["nousersavailable"]!=null&&publicJSON["nousersavailable"]!="undefined"){Ext.getCmp("users").setValue(publicJSON["nousersavailable"]);
disableAll();}Ext.getCmp("clusterManager").getStore().loadRawData(publicJSON["clusterArray"]);Ext.getCmp("clusterManager").setValue(publicJSON["defaultClusterManager"]);Ext.getCmp("filterBy").getStore().loadRawData(publicJSON["filterByArray"]);if(publicJSON["selectedFilterBy"]!=null&&publicJSON["selectedFilterBy"]!=undefined){Ext.getCmp("filterBy").setValue(publicJSON["selectedFilterBy"]);
}else{Ext.getCmp("filterBy").setValue(publicJSON["defaultFilterBy"]);}if(publicJSON["columns"]!=null&&publicJSON["columns"]!="undefined"){var a=publicJSON["gridTitle"]["title"];var c=publicJSON["columns"];var b=publicJSON["rowDataArray"];getGridPanel(b,c,a);if(isSuperManager=="true"){Ext.getCmp("schedule").hide();
}Ext.getCmp("schedule").setDisabled(false);Ext.getCmp("save").setDisabled(false);Ext.getCmp("print").setDisabled(false);Ext.getCmp("csv").setDisabled(false);}else{if(isSuperManager=="true"){Ext.getCmp("schedule").hide();}Ext.getCmp("schedule").setDisabled(true);Ext.getCmp("save").setDisabled(true);Ext.getCmp("print").setDisabled(true);
Ext.getCmp("csv").setDisabled(true);}var d=publicJSON["labels"];Ext.getCmp("timeline").setFieldLabel(d["timeline"]);Ext.getCmp("eg_stdate").setFieldLabel(d["eg_stdate"]);Ext.getCmp("starthr").setFieldLabel(d["starthr"]);Ext.getCmp("startmin").setFieldLabel(d["startmin"]);Ext.getCmp("eg_enddate").setFieldLabel(d["eg_enddate"]);
Ext.getCmp("endhr").setFieldLabel(d["starthr"]);Ext.getCmp("endmin").setFieldLabel(d["startmin"]);Ext.getCmp("users").setFieldLabel(d["users"]);Ext.getCmp("clusterManager").setFieldLabel(d["clusterManager"]);Ext.getCmp("filterBy").setFieldLabel(d["filterBy"]);Ext.getCmp("showbutton").setText(d["showbutton"]);
},callSaveSchedule:function(b){if(validateDates()){var a="/final/admin/saveSchedule.jsp?er_timeline="+Ext.getCmp("timeline").getValue()+"&er_gtype=Logons&er_rtype=Logons&submitted=true&jsppage=logons&submit=true&users="+encodeURIComponent(filterEncode(Ext.getCmp("users").getValue()))+"&er_userid="+encodeURIComponent(filterEncode(Ext.getCmp("users").getValue()))+"&startdate="+sformattedValue+"&enddate="+eformattedValue+"&eg_timeline="+Ext.getCmp("timeline").getValue()+"&SuccessfulLogons=true";
if(auditLogEnabledForCLI=="true"&&isClusterSupported=="true"){a+="&filterBy="+Ext.getCmp("filterBy").getValue()+"&clusterManager="+Ext.getCmp("clusterManager").getValue();}else{if(auditLogEnabledForCLI=="true"){a+="&filterBy="+Ext.getCmp("filterBy").getValue();}else{if(isClusterSupported=="true"){a+="&clusterManager="+Ext.getCmp("clusterManager").getValue();
}}}scheduleWindow(a);Ext.getCmp("scheduleWin").setTitle(scheduleTitle);}},savePdf:function(){var a=Ext.widget("savepdf");a.savePDF(pdfURLString);},saveInCSVFormat:function(){window.location.href="/final/servlet/com.eg.SaveInCSVFormat?user_language="+trackerLanguage;},printData:function(){s_username=Ext.getCmp("users").getValue();
if(s_username==null||s_username=="undefined"||s_username.length==0){s_username="-";}var a="/final/admin/SuccessfulLogons/data/LogonsPrint.jsp?user="+encodeURIComponent(filterEncode(s_username))+"&printpage=true&frmPage=logons&title=Logons Report&com.eg.CSRF_NONCE="+csrfToken;Ext.widget("print").show();
var b=Ext.select("#printContentDiv");b.set({src:a});},changeTimeline:function(){var g=Ext.getCmp("timeline");if(g.getValue()=="Any"){Ext.getCmp("eg_stdate").setDisabled(false);Ext.getCmp("starthr").setDisabled(false);Ext.getCmp("startmin").setDisabled(false);Ext.getCmp("eg_enddate").setDisabled(false);
Ext.getCmp("endhr").setDisabled(false);Ext.getCmp("endmin").setDisabled(false);Ext.getCmp("icon_go").show();hideResultPanel();disableAll();}else{Ext.getCmp("eg_stdate").setDisabled(true);Ext.getCmp("starthr").setDisabled(true);Ext.getCmp("startmin").setDisabled(true);Ext.getCmp("eg_enddate").setDisabled(true);
Ext.getCmp("endhr").setDisabled(true);Ext.getCmp("endmin").setDisabled(true);Ext.getCmp("icon_go").hide();var e=Ext.getCmp("timeline").getValue();var d=Ext.getCmp("eg_stdate").getValue();var c=Ext.getCmp("eg_enddate").getValue();var a=Ext.getCmp("starthr").getValue();var b=Ext.getCmp("endhr").getValue();
d=Ext.Date.dateFormat(d,mgrDateFormat);c=Ext.Date.dateFormat(c,mgrDateFormat);var f="&P0=["+e+"]&P1=["+d+"]&P2=["+c+"]&P3=["+a+"]&P4=["+b+"]&P5=["+dateFormatForTimeline+"]";var h="F=getTime&C=id"+f;Ext.Ajax.request({url:"/final/servlet/com.eg.ErRemoteScriptingServlet",params:h,scope:this,method:"POST",success:function(j){var l=j.responseText;
var k=Ext.decode(l);if(!Ext.isEmpty(k)){var i=k.timeline;Ext.getCmp("eg_stdate").setValue(i[6]);Ext.getCmp("eg_stdate").dataArray=i[0];Ext.getCmp("eg_enddate").setValue(i[7]);Ext.getCmp("eg_enddate").dataArray=i[1];Ext.getCmp("starthr").setValue(i[8]);Ext.getCmp("starthr").dataArray=i[2];Ext.getCmp("endhr").setValue(i[9]);
Ext.getCmp("endhr").dataArray=i[3];Ext.getCmp("startmin").setValue(i[10]);Ext.getCmp("startmin").dataArray=i[11];Ext.getCmp("endmin").setValue(i[10]);Ext.getCmp("endmin").dataArray=i[11];}}});findUsers();}},showAgain:function(){if(validateDates()){var b="/final/servlet/com.eg.AuditServletExtJS?eg_timeline="+Ext.getCmp("timeline").getValue()+"&submitted=true&jsppage=logons&submit=true&users="+encodeURIComponent(filterEncode(Ext.getCmp("users").getValue()))+"&startdate="+sformattedValue+"&enddate="+eformattedValue;
if(auditLogEnabledForCLI=="true"&&isClusterSupported=="true"){b+="&filterBy="+Ext.getCmp("filterBy").getValue()+"&clusterManager="+Ext.getCmp("clusterManager").getValue();}else{if(auditLogEnabledForCLI=="true"){b+="&filterBy="+Ext.getCmp("filterBy").getValue();}else{if(isClusterSupported=="true"){b+="&clusterManager="+Ext.getCmp("clusterManager").getValue();
}}}var a=new Ext.LoadMask(Ext.getBody(),{msg:"Processing..."});a.show();Ext.Ajax.request({url:b,method:"POST",async:true,success:function(e){a.hide();var f=e.responseText;publicJSON=Ext.decode(f);if(publicJSON["columns"]==null||publicJSON["columns"]=="undefined"){hideResultPanel();Ext.MessageBox.alert(pageTitle,no_records_found);
}else{var c=publicJSON["gridTitle"]["title"];var g=publicJSON["columns"];var d=publicJSON["rowDataArray"];Ext.getCmp("users").getStore().loadRawData(publicJSON["userIdsArray"]);getGridPanel(d,g,c);if(isSuperManager=="true"){Ext.getCmp("schedule").hide();}Ext.getCmp("schedule").setDisabled(false);Ext.getCmp("save").setDisabled(false);
Ext.getCmp("print").setDisabled(false);Ext.getCmp("csv").setDisabled(false);}},failure:function(d){a.hide();var c=window;while(c.parent!=c||c.opener!=null){mainWindow=c;c=(c.parent==c?c.opener:c.parent);}if(c.location.pathname!="/"){mainWindow=c;}mainWindow.location.href="/final/servlet/com.egurkha.Logout?errmsg=1";
mainWindow.focus();}});}}});function getGridPanel(a,h,d){var c=new Array();var e=new Array();for(var i in h){var f=h[i];c.push(i);if(i=="Login_time"){e.push({header:f,sortable:true,dataIndex:i,menuDisabled:true,flex:1,renderer:Ext.util.Format.dateRenderer(mgrDateFormat+" H:i:s")});}else{if(i=="HIDDEN_COLUMN"){e.push({header:"hiddenCol",dataIndex:i,hidden:true,});
}else{if(i=="User_id"){e.push({header:f,sortable:true,dataIndex:i,menuDisabled:true,flex:1,renderer:function(n,k,j,p,m,l,o){return'<a id="eg_monlink" href = "javascript:void(0);" onclick="javascript:gotoAuditlogPage('+p+')">'+n+"</a>";}});}else{e.push({header:f,sortable:true,dataIndex:i,menuDisabled:true,flex:1,renderer:function(n,k,j,p,m,l,o){return n;
}});}}}}var g=Ext.widget("detailsgrid",{store:new Ext.data.Store({fields:c,data:a,proxy:{type:"pagingmemory",reader:{type:"json"}},autoLoad:true,pageSize:16}),sortableColumns:true,columns:e,viewConfig:{forceFit:true,stripeRows:true}});var b=Ext.getCmp("loginresultpanel_in_formitem");b.show();b.removeAll();
b.removeCls("dataPanel");b.add(g);}function validateDates(){if(Ext.getCmp("timeline").getValue()!="Any"){return true;}else{var c=Ext.getCmp("eg_stdate").getValue();var b=Ext.getCmp("starthr").getValue();var g=Ext.getCmp("startmin").getValue();var f=Ext.getCmp("eg_enddate").getValue();var h=Ext.getCmp("endhr").getValue();
var a=Ext.getCmp("endmin").getValue();var e=Ext.Date.format(Ext.getCmp("eg_stdate").getValue(),"m/d/Y");var d=Ext.Date.format(Ext.getCmp("eg_enddate").getValue(),"m/d/Y");if(!checkExtTime(e,d,b,h,g,a)){sformattedValue=null;eformattedValue=null;Ext.Msg.alert(pageTitle,dateAlert);return false;}else{sformattedValue=Ext.Date.format(c,"m/d/Y")+" "+b+":"+g+":00";
eformattedValue=Ext.Date.format(f,"m/d/Y")+" "+h+":"+a+":00";return true;}}}function findUsers(){hideResultPanel();var b=null;var a=Ext.getCmp("timeline").getValue();if(a=="Any"){b="/final/servlet/com.eg.AuditServletExtJS?jsppage=logons&eg_timeline=Any";}else{b="/final/servlet/com.eg.AuditServletExtJS?jsppage=logons&eg_timeline="+a;
}if(validateDates()){b+="&startdate="+sformattedValue+"&enddate="+eformattedValue;Ext.Ajax.request({url:b,method:"POST",async:true,success:function(c){enableAll();Ext.getCmp("users").clearValue();var d=c.responseText;publicJSON=Ext.decode(d);Ext.getCmp("users").getStore().loadRawData(publicJSON["userIdsArray"]);
if(publicJSON["selectedUser"]!=null&&publicJSON["selectedUser"]!="undefined"){Ext.getCmp("users").setValue(publicJSON["selectedUser"]);}else{Ext.getCmp("users").setValue(publicJSON["defaultuser"]);}if(publicJSON["nousersavailable"]!=null&&publicJSON["nousersavailable"]!="undefined"){Ext.getCmp("users").setValue(publicJSON["nousersavailable"]);
disableAll();}Ext.getCmp("clusterManager").getStore().loadRawData(publicJSON["clusterArray"]);Ext.getCmp("clusterManager").setValue(publicJSON["defaultClusterManager"]);Ext.getCmp("filterBy").getStore().loadRawData(publicJSON["filterByArray"]);if(publicJSON["selectedFilterBy"]!=null&&publicJSON["selectedFilterBy"]!=undefined){Ext.getCmp("filterBy").setValue(publicJSON["selectedFilterBy"]);
}else{Ext.getCmp("filterBy").setValue(publicJSON["defaultFilterBy"]);}},failure:function(d){var c=window;while(c.parent!=c||c.opener!=null){mainWindow=c;c=(c.parent==c?c.opener:c.parent);}if(c.location.pathname!="/"){mainWindow=c;}mainWindow.location.href="/final/servlet/com.egurkha.Logout?errmsg=1";
mainWindow.focus();}});}}function disableAll(){Ext.getCmp("users").setDisabled(true);Ext.getCmp("clusterManager").setDisabled(true);Ext.getCmp("filterBy").setDisabled(true);Ext.getCmp("showbutton").setDisabled(true);}function enableAll(){Ext.getCmp("users").setDisabled(false);Ext.getCmp("clusterManager").setDisabled(false);
Ext.getCmp("filterBy").setDisabled(false);Ext.getCmp("showbutton").setDisabled(false);}function hideResultPanel(){if(isSuperManager=="true"){Ext.getCmp("schedule").hide();}Ext.getCmp("schedule").setDisabled(true);Ext.getCmp("save").setDisabled(true);Ext.getCmp("print").setDisabled(true);Ext.getCmp("csv").setDisabled(true);
Ext.getCmp("loginresultpanel_in_formitem").hide();}function gotoAuditlogPage(a){var c=Ext.getCmp("detailsgrid").getStore();var g=c.getAt(a).get("HIDDEN_COLUMN");var f="";var e=g.split("&");for(var b in e){if(e[b].startsWith("hostIp=")){var d=e[b].substring(e[b].indexOf("=")+1);e[b]="hostIp="+encodeURIComponent(filterEncode(d));
f+=e[b]+"&";}else{f+=e[b]+"&";}}f=f.substring(0,f.lastIndexOf("&"));window.location.href=f;}function doCloseWin(){Ext.getCmp("scheduleWin").destroy();}