Ext.define("Auditlog.controller.Main",{extend:"Ext.app.Controller",views:["FormItems","Print","EgInfraDownloader"],refs:[{selector:"FormItems",ref:"FormItems"}],init:function(){this.buildMainData();this.control({"auditlog_widget":{"afterrender":this.afterMainRender},'auditlog_widget button[id="schedule"]':{"click":this.callSaveSchedule},'auditlog_widget button[id="save"]':{"click":this.savePdf},'auditlog_widget button[id="print"]':{"click":this.printData},'auditlog_widget button[id="csv"]':{"click":this.saveInCSVFormat},'auditlog_widget combo[id="timeline"]':{"select":this.changeTimeline},'auditlog_widget combo[id="clusterManager"]':{"select":this.populate_temp},'auditlog_widget combo[id="filterBy"]':{"select":this.populate_temp},'auditlog_widget combo[id="users"]':{"select":this.setUserName},'auditlog_widget button[id="backButton"]':{"click":this.goback}});
},populate_temp:function(a){populate(a.getId(),"onchange");},setUserName:function(){if(!validateDates()){return;}selectedUser=Ext.getCmp("users").getValue();if(selectedUser==null||selectedUser=="undefined"||selectedUser.length==0||selectedUser=="-1"){Ext.Msg.alert(pageTitle,select_user_name);return;}hideAuditlogReportPanel();
Ext.Ajax.request({url:"/final/servlet/com.eg.AuditServletExtJS?jsppage=auditlog&users="+encodeURIComponent(filterEncode(selectedUser))+"&category="+category+"&eg_timeline="+Ext.getCmp("timeline").getValue()+"&startdate="+sformattedValue+"&enddate="+eformattedValue,method:"POST",async:true,success:function(a){publicJSON=Ext.decode(a.responseText);
Ext.getCmp("clusterManager").getStore().loadRawData(publicJSON["clusterArray"]);Ext.getCmp("clusterManager").setValue("All");Ext.getCmp("filterBy").getStore().loadRawData(publicJSON["filterByArray"]);Ext.getCmp("filterBy").setValue("All");Ext.getCmp("hostip").getStore().loadRawData(publicJSON["hostip"]);
Ext.getCmp("hostip").boundList.getSelectionModel().selectAll();populate("hostip","onload");},failure:function(b){var a=window;while(a.parent!=a||a.opener!=null){mainWindow=a;a=(a.parent==a?a.opener:a.parent);}if(a.location.pathname!="/"){mainWindow=a;}mainWindow.location.href="/final/servlet/com.egurkha.Logout?errmsg=1";
mainWindow.focus();}});},goback:function(){var m="";var b="";var f="";var l="";var d="";var g=false;var h=queryString.split("&");if(h!=null){for(var e=0;e<h.length;e++){var k=h[e];var a=k.split("=");var j=a[0];var c=a[1];if(j=="timeline"){if(c!=null&&c!="null"&&c!=""){g=true;break;}}}}if(h!=null){for(var e=0;
e<h.length;e++){var k=h[e];var a=k.split("=");var j=a[0];var c=a[1];if(j=="timeline"){m=c;}if(j=="tlStrtDate"){b=c;}if(j=="tlEndDate"){f=c;}if(j=="tlFilterBy"){l=c;}if(j=="tlUser"){d=decodeURIComponent(c);}}}if(g){window.location.href="/final/admin/logons.jsp?eg_timeline="+m+"&startdate="+b+"&enddate="+f+"&filterBy="+l+"&users="+encodeURIComponent(filterEncode(d))+"&requestFrom=auditlog";
}else{window.location.href="/final/admin/logons.jsp";}},buildMainData:function(){if(thisjsppage!=null&&thisjsppage=="loginDetails"){Ext.Ajax.request({url:"/final/servlet/com.eg.AuditServletExtJS?"+queryString,method:"POST",async:false,success:function(a){publicJSON=Ext.decode(a.responseText);},failure:function(b){var a=window;
while(a.parent!=a||a.opener!=null){mainWindow=a;a=(a.parent==a?a.opener:a.parent);}if(a.location.pathname!="/"){mainWindow=a;}mainWindow.location.href="/final/servlet/com.egurkha.Logout?errmsg=1";mainWindow.focus();}});}else{Ext.Ajax.request({url:"/final/servlet/com.eg.AuditServletExtJS?"+queryString,method:"POST",async:false,success:function(a){publicJSON=Ext.decode(a.responseText);
},failure:function(b){var a=window;while(a.parent!=a||a.opener!=null){mainWindow=a;a=(a.parent==a?a.opener:a.parent);}if(a.location.pathname!="/"){mainWindow=a;}mainWindow.location.href="/final/servlet/com.egurkha.Logout?errmsg=1";mainWindow.focus();}});}},afterMainRender:function(){if(isSuperManager=="true"){Ext.getCmp("schedule").hide();
}if(thisjsppage!=null&&thisjsppage=="loginDetails"){Ext.getCmp("backButton").show();Ext.getCmp("bkSeperator").show();if(publicJSON["total_records"]!=null&&publicJSON["total_records"]!="undefined"){totalRecord=parseInt(publicJSON["total_records"]["count"]);Ext.getCmp("display_records_label").update(getRecordDispalyInfo("logindts"));
}if(publicJSON["total_pages"]!=null&&publicJSON["total_pages"]!="undefined"){total_pages=parseInt(publicJSON["total_pages"]["count"]);}if(total_pages>0){currentPageNumber=1;if(total_pages==1){Ext.getCmp("firstpage").setDisabled(true);Ext.getCmp("previouspage").setDisabled(true);Ext.getCmp("nextpage").setDisabled(true);
Ext.getCmp("lastpage").setDisabled(true);}else{if(total_pages>1){Ext.getCmp("firstpage").setDisabled(true);Ext.getCmp("previouspage").setDisabled(true);Ext.getCmp("nextpage").setDisabled(false);Ext.getCmp("lastpage").setDisabled(false);if(Ext.getCmp("nextpage").hasCls("al_next_disabled")){Ext.getCmp("nextpage").removeCls("al_next_disabled");
Ext.getCmp("nextpage").addCls("al_next_enabled");}if(Ext.getCmp("lastpage").hasCls("al_last_disabled")){Ext.getCmp("lastpage").removeCls("al_last_disabled");Ext.getCmp("lastpage").addCls("al_last_enabled");}}}Ext.get("of_label").update("&nbsp;&nbsp; "+ofLabel+"&nbsp;"+total_pages);Ext.getCmp("save").setDisabled(false);
Ext.getCmp("print").setDisabled(false);Ext.getCmp("csv").setDisabled(false);Ext.Ajax.request({url:"/final/admin/Auditlog/data/auditlogInfo.jsp?submitted=true&rowsperpage="+rowsPerPage+"&"+queryString,method:"POST",async:true,success:function(b){Ext.getCmp("auditlog_data_panel").show();Ext.getCmp("auditlog_data_component").update(b.responseText);
},failure:function(b){Ext.MessageBox.alert(pageTitle,information);}});}else{Ext.getCmp("user_session_data_not_found").show();}}else{Ext.getCmp("bkSeperator").hide();Ext.getCmp("backButton").hide();Ext.getCmp("timeline_container").show();Ext.getCmp("user_cluster_interface_container").show();Ext.getCmp("hostip_module_activity_container").show();
Ext.getCmp("showbutton_container").show();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();}}}Ext.getCmp("timeline").getStore().loadRawData(publicJSON["timelinesArray"]);Ext.getCmp("timeline").setValue(publicJSON["defaults"]["timeline"]);
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"]);buildUserMap();if(publicJSON["defaultuser"]!=null&&publicJSON["defaultuser"]!="undefined"&&publicJSON["defaultuser"].length>0){Ext.getCmp("users").setValue(publicJSON["defaultuser"]);}else{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"]);Ext.getCmp("filterBy").setValue(publicJSON["defaultFilterBy"]);
if(publicJSON["hostip"]!=null&&publicJSON["hostip"]!="undefined"&&publicJSON["hostip"].length>0){Ext.getCmp("hostip").getStore().loadRawData(publicJSON["hostip"]);Ext.getCmp("hostip").boundList.getSelectionModel().selectAll();}var a=publicJSON["labels"];Ext.getCmp("timeline").setFieldLabel(a["timeline"]);
Ext.getCmp("eg_stdate").setFieldLabel(a["eg_stdate"]);Ext.getCmp("starthr").setFieldLabel(a["starthr"]);Ext.getCmp("startmin").setFieldLabel(a["startmin"]);Ext.getCmp("eg_enddate").setFieldLabel(a["eg_enddate"]);Ext.getCmp("endhr").setFieldLabel(a["starthr"]);Ext.getCmp("endmin").setFieldLabel(a["startmin"]);
Ext.getCmp("users").setFieldLabel(a["users"]);Ext.getCmp("clusterManager").setFieldLabel(a["clusterManager"]);Ext.getCmp("filterBy").setFieldLabel(a["filterBy"]);Ext.getCmp("showbutton").setText(a["showbutton"]);populate("hostip","onload");}},callSaveSchedule:function(f){if(validateDates()){var b=Ext.getCmp("hostip").getValue();
for(var e in b){b[e]=filterEncode(b[e]);}var a=category+"AuditLog";var d="/final/admin/saveSchedule.jsp?er_timeline="+Ext.getCmp("timeline").getValue()+"&er_gtype="+a+"&er_rtype="+a+"&submitted=true&jsppage=auditlog&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()+"&"+a+"=true&s_hostip="+encodeURIComponent(b)+"&s_module="+Ext.getCmp("module").getValue()+"&category="+category+"&reloaded=true";
if(isClusterSupported=="true"){d+="&filterBy="+Ext.getCmp("filterBy").getValue();}if(auditLogEnabledForCLI=="true"){d+="&clusterManager="+Ext.getCmp("clusterManager").getValue();}if(Ext.getCmp("activity").getValue().length==0){Ext.getCmp("activity").boundList.getSelectionModel().selectAll();}var c=Ext.getCmp("activity").getValue();
for(var e in c){c[e]=filterEncode(c[e]);}d+="&s_activity="+encodeURIComponent(c);scheduleWindow(d);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(){var a="/final/admin/Auditlog/data/auditlogPrint.jsp?reload=false&reporterName=&category="+category+"&com.eg.CSRF_NONCE="+csrfToken;Ext.widget("print").show();var b=Ext.select("#printContentDiv");b.set({src:a});},changeTimeline:function(){hideAuditlogReportPanel();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();
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 k=Ext.decode(j.responseText);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();}}});function sub(){startRecord=1;endRecord=1;totalRecord=0;total_pages=0;currentPageNumber=0;var e=false;selectedUser=Ext.getCmp("users").getValue();Ext.getCmp("controlPanel").collapse();buildUserMap();if(selectedUser!=null&&selectedUser!="undefined"&&selectedUser.length>0&&selectedUser!="-1"){e=true;
}if(e&&validateDates()){var g="/final/servlet/com.eg.AuditServletExtJS?eg_timeline="+Ext.getCmp("timeline").getValue()+"&submitted=true&jsppage=auditlog&submit=true&users="+encodeURIComponent(filterEncode(Ext.getCmp("users").getValue()))+"&startdate="+sformattedValue+"&enddate="+eformattedValue+"&category="+category+"&clicked=all";
if(auditLogEnabledForCLI=="true"){g+="&filterBy="+Ext.getCmp("filterBy").getValue();}if(isClusterSupported=="true"){g+="&clusterManager="+Ext.getCmp("clusterManager").getValue();}if(Ext.getCmp("activity").getValue().length==0){Ext.getCmp("activity").boundList.getSelectionModel().selectAll();}var b=Ext.getCmp("hostip").getValue();
for(var d in b){b[d]=filterEncode(b[d]);}var c=Ext.getCmp("module").getValue();for(var d in c){c[d]=filterEncode(c[d]);}var f=Ext.getCmp("activity").getValue();for(var d in f){f[d]=filterEncode(f[d]);}var a=new Ext.LoadMask(Ext.getBody(),{msg:"Processing..."});a.show();Ext.getCmp("showbutton").setDisabled(true);
Ext.Ajax.request({url:g,method:"POST",params:{"s_hostip":b,"s_module":c,"s_activity":f},async:true,success:function(h){a.hide();Ext.getCmp("showbutton").setDisabled(false);publicJSON=Ext.decode(h.responseText);Ext.getCmp("pagenumber").setValue("1");if(publicJSON["total_records"]!=null&&publicJSON["total_records"]!="undefined"){totalRecord=parseInt(publicJSON["total_records"]["count"]);
Ext.getCmp("display_records_label").update(getRecordDispalyInfo("show"));}if(publicJSON["total_pages"]!=null&&publicJSON["total_pages"]!="undefined"){total_pages=publicJSON["total_pages"]["count"];currentPageNumber=1;if(total_pages==1){Ext.getCmp("firstpage").setDisabled(true);Ext.getCmp("previouspage").setDisabled(true);
Ext.getCmp("nextpage").setDisabled(true);Ext.getCmp("lastpage").setDisabled(true);}else{if(total_pages>1){Ext.getCmp("firstpage").setDisabled(true);Ext.getCmp("previouspage").setDisabled(true);Ext.getCmp("nextpage").setDisabled(false);Ext.getCmp("lastpage").setDisabled(false);Ext.getCmp("nextpage").removeCls("al_next_disabled");
Ext.getCmp("lastpage").removeCls("al_last_disabled");Ext.getCmp("nextpage").addCls("al_next_enabled");Ext.getCmp("lastpage").addCls("al_last_enabled");}}Ext.get("of_label").update("&nbsp;&nbsp; "+ofLabel+"&nbsp;"+total_pages);}else{Ext.get("of_label").update("&nbsp;&nbsp; "+ofLabel+"&nbsp;1");}loadData();
},failure:function(i){a.hide();Ext.getCmp("showbutton").setDisabled(false);var h=window;while(h.parent!=h||h.opener!=null){mainWindow=h;h=(h.parent==h?h.opener:h.parent);}if(h.location.pathname!="/"){mainWindow=h;}mainWindow.location.href="/final/servlet/com.egurkha.Logout?errmsg=1";mainWindow.focus();
}});}}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(){hideAuditlogReportPanel();if(validateDates()){ajaxURL="";var a=Ext.getCmp("timeline").getValue();if(a=="Any"){ajaxURL="/final/servlet/com.eg.AuditServletExtJS?jsppage=auditlog&eg_timeline=Any&hideinputs=true&category="+category+"&startdate="+sformattedValue+"&enddate="+eformattedValue;
}else{ajaxURL="/final/servlet/com.eg.AuditServletExtJS?jsppage=auditlog&eg_timeline="+a+"&category="+category+"&startdate="+sformattedValue+"&enddate="+eformattedValue;}Ext.Ajax.request({url:ajaxURL,method:"POST",async:true,success:function(b){enableAll();publicJSON=Ext.decode(b.responseText);if(publicJSON["userIdsArray"]!=null&&publicJSON["userIdsArray"]!="undefined"){Ext.getCmp("users").getStore().loadRawData(publicJSON["userIdsArray"]);
}else{disableAll();}if(publicJSON["defaultuser"]!=null&&publicJSON["defaultuser"]!="undefined"){Ext.getCmp("users").setValue(publicJSON["defaultuser"]);}else{if(publicJSON["nousersavailable"]!=null&&publicJSON["nousersavailable"]!="undefined"){Ext.getCmp("users").setValue(publicJSON["nousersavailable"]);
disableAll();}}Ext.getCmp("clusterManager").setValue("All");Ext.getCmp("filterBy").setValue("All");if(publicJSON["hostip"]==null||publicJSON["hostip"]=="undefined"){Ext.getCmp("hostip").getStore().removeAll();Ext.getCmp("module").getStore().removeAll();Ext.getCmp("activity").getStore().removeAll();}else{Ext.getCmp("hostip").getStore().loadRawData(publicJSON["hostip"]);
Ext.getCmp("hostip").suspendEvents(true);Ext.getCmp("hostip").boundList.getSelectionModel().selectAll();Ext.getCmp("hostip").resumeEvents();populate("hostip","onload");}},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();}});}}function disableAll(){Ext.getCmp("users").setDisabled(true);Ext.getCmp("clusterManager").setDisabled(true);Ext.getCmp("filterBy").setDisabled(true);Ext.getCmp("showbutton").setDisabled(true);Ext.getCmp("hostip").getStore().removeAll();
Ext.getCmp("module").getStore().removeAll();Ext.getCmp("activity").getStore().removeAll();}function enableAll(){Ext.getCmp("users").setDisabled(false);Ext.getCmp("clusterManager").setDisabled(false);Ext.getCmp("filterBy").setDisabled(false);Ext.getCmp("showbutton").setDisabled(false);}function hideAuditlogReportPanel(){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("auditlog_data_panel").hide();}function showAuditlogReportPanel(){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);Ext.getCmp("auditlog_data_panel").show();}function populate(l,k){var g=true;var j=Ext.getCmp("hostip").getValue();if(j==null||j=="undefined"||j.length==0){Ext.getCmp("module").getStore().removeAll();
Ext.getCmp("activity").getStore().removeAll();if(Ext.getCmp("hostip").getStore().getCount()>0){Ext.getCmp("hostip").boundList.getSelectionModel().selectAll();}}var h=Ext.getCmp("users").getValue();if(h==null||h=="undefined"||h.length==0||h=="-1"){return;}if(!validateDates()){g=false;return;}var a;if(k=="onload"&&(h=="undefined"||h.length==0||h=="-1")){Ext.getCmp("users").setDisabled(true);
if(auditLogEnabledForCLI){Ext.getCmp("filterBy").setDisabled(true);}if(isClusterSupported){Ext.getCmp("clusterManager").setDisabled(true);}Ext.getCmp("hostip").setDisabled(true);Ext.getCmp("module").setDisabled(true);Ext.getCmp("activity").setDisabled(true);Ext.getCmp("showbutton").setDisabled(true);
return;}if(k=="onchange"&&(h=="undefined"||h.length==0||h=="-1")){g=false;return;}var d=Ext.getCmp("timeline").getValue();if(l=="clusterManager"){Ext.getCmp("showbutton").setDisabled(true);hideAuditlogReportPanel();a="/final/servlet/com.eg.AuditServletExtJS?jsppage=auditlog&users="+encodeURIComponent(filterEncode(h))+"&eg_timeline="+d+"&startdate="+sformattedValue+"&enddate="+eformattedValue+"&clicked=clusterManager&category="+category+"&ajax=true";
}else{if(l=="filterBy"){Ext.getCmp("showbutton").setDisabled(true);hideAuditlogReportPanel();if(auditLogEnabledForCLI){var b=Ext.getCmp("filterBy").getValue();if(b=="undefined"||b.length==0||b=="-1"){g=false;return;}}a="/final/servlet/com.eg.AuditServletExtJS?jsppage=auditlog&users="+encodeURIComponent(filterEncode(h))+"&eg_timeline="+d+"&startdate="+sformattedValue+"&enddate="+eformattedValue+"&clicked=filterBy&category="+category+"&ajax=true";
}else{if(l=="hostip"){var j=Ext.getCmp("hostip").getValue();if(j==null||j=="undefined"||j.length==0){g=false;return;}for(var f in j){j[f]=filterEncode(j[f]);}a="/final/servlet/com.eg.AuditServletExtJS?jsppage=auditlog&users="+encodeURIComponent(filterEncode(h))+"&eg_timeline="+d+"&startdate="+sformattedValue+"&enddate="+eformattedValue+"&clicked=hostIP&hostip="+encodeURIComponent(j)+"&category="+category+"&ajax=true";
}else{if(l=="module"){var j=Ext.getCmp("hostip").getValue();if(j==null||j=="undefined"||j.length==0){if(Ext.getCmp("hostip").getStore().getCount()>0){Ext.getCmp("hostip").boundList.getSelectionModel().selectAll();j=Ext.getCmp("hostip").getValue();}else{g=false;return;}}for(var f in j){j[f]=filterEncode(j[f]);
}var e=Ext.getCmp("module").getValue();if(e==null||e=="undefined"||e.length==0){if(Ext.getCmp("module").getStore().getCount()>0){Ext.getCmp("module").boundList.getSelectionModel().selectAll();e=Ext.getCmp("module").getValue();}else{g=false;return;}}a="/final/servlet/com.eg.AuditServletExtJS?jsppage=auditlog&users="+encodeURIComponent(filterEncode(h))+"&eg_timeline="+d+"&startdate="+sformattedValue+"&enddate="+eformattedValue+"&clicked=module&module="+e+"&hostip="+encodeURIComponent(j)+"&category="+category+"&ajax=true";
}}}}if(auditLogEnabledForCLI){a+="&filterBy="+Ext.getCmp("filterBy").getValue()+"&isClusterSupported="+isClusterSupported;}if(isClusterSupported){a+="&clusterManager="+Ext.getCmp("clusterManager").getValue()+"&isClusterSupported="+isClusterSupported;}if(g){var j=Ext.getCmp("hostip").getValue();for(var f in j){j[f]=filterEncode(j[f]);
}var e=Ext.getCmp("module").getValue();for(var f in e){e[f]=filterEncode(e[f]);}var c=Ext.getCmp("activity").getValue();for(var f in c){c[f]=filterEncode(c[f]);}Ext.Ajax.request({url:a,method:"POST",params:{"s_hostip":j,"s_module":e,"s_activity":c},async:true,success:function(i){publicJSON=Ext.decode(i.responseText);
fillModules(l,publicJSON);},failure:function(m){var i=window;while(i.parent!=i||i.opener!=null){mainWindow=i;i=(i.parent==i?i.opener:i.parent);}if(i.location.pathname!="/"){mainWindow=i;}mainWindow.location.href="/final/servlet/com.egurkha.Logout?errmsg=1";mainWindow.focus();}});}}function fillModules(a,b){if(a=="hostip"){Ext.getCmp("module").getStore().loadRawData(b["module"]);
Ext.getCmp("module").boundList.getSelectionModel().selectAll();if(Ext.getCmp("hostip").getStore().getCount()==0){Ext.getCmp("showbutton").setDisabled(true);}else{Ext.getCmp("showbutton").setDisabled(false);}}else{if(a=="module"){Ext.getCmp("activity").getStore().loadRawData(b["activity"]);Ext.getCmp("activity").boundList.getSelectionModel().selectAll();
}else{if(a=="filterBy"){Ext.getCmp("hostip").getStore().loadRawData(b["hostip"]);}else{if(a=="clusterManager"){Ext.getCmp("clusterManager").getStore().loadRawData(b["clusterArray"]);}}}}if(a=="hostip"){populate("module","onchange");}if(a=="clusterManager"){populate("filterBy","onchange");}if(a=="filterBy"){populate("hostip","onchange");
}}function loadData(){if(total_pages==1){if(Ext.getCmp("firstpage").hasCls("al_first_enabled")){Ext.getCmp("firstpage").removeCls("al_first_enabled");Ext.getCmp("firstpage").addCls("al_first_disabled");}if(Ext.getCmp("firstpage").hasCls("al_previous_enabled")){Ext.getCmp("firstpage").removeCls("al_previous_enabled");
Ext.getCmp("firstpage").addCls("al_previous_disabled");}if(Ext.getCmp("nextpage").hasCls("al_next_enabled")){Ext.getCmp("nextpage").removeCls("al_next_enabled");Ext.getCmp("nextpage").addCls("al_next_disabled");}if(Ext.getCmp("lastpage").hasCls("al_last_enabled")){Ext.getCmp("lastpage").removeCls("al_last_enabled");
Ext.getCmp("lastpage").addCls("al_last_disabled");}}else{if(Ext.getCmp("firstpage").hasCls("al_first_enabled")){Ext.getCmp("firstpage").removeCls("al_first_enabled");Ext.getCmp("firstpage").addCls("al_first_disabled");}if(Ext.getCmp("firstpage").hasCls("al_previous_enabled")){Ext.getCmp("firstpage").removeCls("al_previous_enabled");
Ext.getCmp("firstpage").addCls("al_previous_disabled");}if(Ext.getCmp("nextpage").hasCls("al_next_disabled")){Ext.getCmp("nextpage").removeCls("al_next_disabled");Ext.getCmp("nextpage").addCls("al_next_enabled");}if(Ext.getCmp("lastpage").hasCls("al_last_disabled")){Ext.getCmp("lastpage").removeCls("al_last_disabled");
Ext.getCmp("lastpage").addCls("al_last_enabled");}}Ext.Ajax.request({url:"/final/admin/Auditlog/data/auditlogInfo.jsp?submitted=true&rowsperpage="+rowsPerPage,method:"POST",async:true,success:function(a){Ext.getCmp("auditlog_data_component").update(a.responseText);showAuditlogReportPanel();},failure:function(a){Ext.MessageBox.alert(pageTitle,information);
}});}function gotoPage(b){if(b==""||parseInt(b)<=0||parseInt(b)>parseInt(total_pages)){Ext.Msg.show({title:pageTitle,msg:information2+" "+total_pages,buttons:Ext.Msg.OK,icon:"iconExclamation",fn:function(){Ext.getCmp("pagenumber").setValue(currentPageNumber);}});return;}else{if(parseInt(previousPageNumber)==parseInt(b)){return;
}else{if(parseInt(b)>0&&parseInt(b)<=parseInt(total_pages)){if(parseInt(b)==1){currentPageNumber=1;Ext.getCmp("firstpage").setDisabled(true);Ext.getCmp("previouspage").setDisabled(true);Ext.getCmp("nextpage").setDisabled(false);Ext.getCmp("lastpage").setDisabled(false);if(Ext.getCmp("firstpage").hasCls("al_first_enabled")){Ext.getCmp("firstpage").removeCls("al_first_enabled");
Ext.getCmp("firstpage").addCls("al_first_disabled");}if(Ext.getCmp("previouspage").hasCls("al_previous_enabled")){Ext.getCmp("previouspage").removeCls("al_previous_enabled");Ext.getCmp("previouspage").addCls("al_previous_disabled");}if(Ext.getCmp("nextpage").hasCls("al_next_disabled")){Ext.getCmp("nextpage").removeCls("al_next_disabled");
Ext.getCmp("nextpage").addCls("al_next_enabled");}if(Ext.getCmp("lastpage").hasCls("al_last_disabled")){Ext.getCmp("lastpage").removeCls("al_last_disabled");Ext.getCmp("lastpage").addCls("al_last_enabled");}}else{if(parseInt(b)==parseInt(total_pages)){currentPageNumber=total_pages;Ext.getCmp("firstpage").setDisabled(false);
Ext.getCmp("previouspage").setDisabled(false);Ext.getCmp("nextpage").setDisabled(true);Ext.getCmp("lastpage").setDisabled(true);if(Ext.getCmp("firstpage").hasCls("al_first_disabled")){Ext.getCmp("firstpage").removeCls("al_first_disabled");Ext.getCmp("firstpage").addCls("al_first_enabled");}if(Ext.getCmp("previouspage").hasCls("al_previous_disabled")){Ext.getCmp("previouspage").removeCls("al_previous_disabled");
Ext.getCmp("previouspage").addCls("al_previous_enabled");}if(Ext.getCmp("nextpage").hasCls("al_next_enabled")){Ext.getCmp("nextpage").removeCls("al_next_enabled");Ext.getCmp("nextpage").addCls("al_next_disabled");}if(Ext.getCmp("lastpage").hasCls("al_last_enabled")){Ext.getCmp("lastpage").removeCls("al_last_enabled");
Ext.getCmp("lastpage").addCls("al_last_disabled");}}else{currentPageNumber=b;if((currentPageNumber-1)<=0){Ext.getCmp("firstpage").setDisabled(true);Ext.getCmp("previouspage").setDisabled(true);Ext.getCmp("nextpage").setDisabled(false);Ext.getCmp("lastpage").setDisabled(false);if(Ext.getCmp("firstpage").hasCls("al_first_enabled")){Ext.getCmp("firstpage").removeCls("al_first_enabled");
Ext.getCmp("firstpage").addCls("al_first_disabled");}if(Ext.getCmp("previouspage").hasCls("al_previous_enabled")){Ext.getCmp("previouspage").removeCls("al_previous_enabled");Ext.getCmp("previouspage").addCls("al_previous_disabled");}if(Ext.getCmp("nextpage").hasCls("al_next_disabled")){Ext.getCmp("nextpage").removeCls("al_next_disabled");
Ext.getCmp("nextpage").addCls("al_next_enabled");}if(Ext.getCmp("lastpage").hasCls("al_last_disabled")){Ext.getCmp("lastpage").removeCls("al_last_disabled");Ext.getCmp("lastpage").addCls("al_last_enabled");}}else{if((currentPageNumber+1)>=total_pages){Ext.getCmp("firstpage").setDisabled(false);Ext.getCmp("previouspage").setDisabled(false);
Ext.getCmp("nextpage").setDisabled(true);Ext.getCmp("lastpage").setDisabled(true);if(Ext.getCmp("firstpage").hasCls("al_first_disabled")){Ext.getCmp("firstpage").removeCls("al_first_disabled");Ext.getCmp("firstpage").addCls("al_first_enabled");}if(Ext.getCmp("previouspage").hasCls("al_previous_disabled")){Ext.getCmp("previouspage").removeCls("al_previous_disabled");
Ext.getCmp("previouspage").addCls("al_previous_enabled");}if(Ext.getCmp("nextpage").hasCls("al_next_enabled")){Ext.getCmp("nextpage").removeCls("al_next_enabled");Ext.getCmp("nextpage").addCls("al_next_disabled");}if(Ext.getCmp("lastpage").hasCls("al_last_enabled")){Ext.getCmp("lastpage").removeCls("al_last_enabled");
Ext.getCmp("lastpage").addCls("al_last_disabled");}}else{Ext.getCmp("firstpage").setDisabled(false);Ext.getCmp("previouspage").setDisabled(false);Ext.getCmp("nextpage").setDisabled(false);Ext.getCmp("lastpage").setDisabled(false);if(Ext.getCmp("firstpage").hasCls("al_first_disabled")){Ext.getCmp("firstpage").removeCls("al_first_disabled");
Ext.getCmp("firstpage").addCls("al_first_enabled");}if(Ext.getCmp("previouspage").hasCls("al_previous_disabled")){Ext.getCmp("previouspage").removeCls("al_previous_disabled");Ext.getCmp("previouspage").addCls("al_previous_enabled");}if(Ext.getCmp("nextpage").hasCls("al_next_disabled")){Ext.getCmp("nextpage").removeCls("al_next_disabled");
Ext.getCmp("nextpage").addCls("al_next_enabled");}if(Ext.getCmp("lastpage").hasCls("al_last_disabled")){Ext.getCmp("lastpage").removeCls("al_last_disabled");Ext.getCmp("lastpage").addCls("al_last_enabled");}}}}}Ext.getCmp("display_records_label").update(getRecordDispalyInfo("page"));previousPageNumber=b;
var a=new Ext.LoadMask(Ext.getBody(),{msg:"Processing..."});a.show();Ext.getCmp("showbutton").setDisabled(true);Ext.Ajax.request({url:"/final/admin/Auditlog/data/auditlogInfo.jsp?submitted=true&rowsperpage="+rowsPerPage+"&pageNo="+b,method:"POST",async:true,success:function(c){Ext.getCmp("auditlog_data_component").update(c.responseText);
showAuditlogReportPanel();a.hide();Ext.getCmp("showbutton").setDisabled(false);},failure:function(c){Ext.MessageBox.alert(pageTitle,information);a.hide();Ext.getCmp("showbutton").setDisabled(false);}});}}}}function pagination(b){if(b=="first"){currentPageNumber=1;Ext.getCmp("firstpage").setDisabled(true);
Ext.getCmp("previouspage").setDisabled(true);Ext.getCmp("nextpage").setDisabled(false);Ext.getCmp("lastpage").setDisabled(false);if(Ext.getCmp("firstpage").hasCls("al_first_enabled")){Ext.getCmp("firstpage").removeCls("al_first_enabled");Ext.getCmp("firstpage").addCls("al_first_disabled");}if(Ext.getCmp("previouspage").hasCls("al_previous_enabled")){Ext.getCmp("previouspage").removeCls("al_previous_enabled");
Ext.getCmp("previouspage").addCls("al_previous_disabled");}if(Ext.getCmp("nextpage").hasCls("al_next_disabled")){Ext.getCmp("nextpage").removeCls("al_next_disabled");Ext.getCmp("nextpage").addCls("al_next_enabled");}if(Ext.getCmp("lastpage").hasCls("al_last_disabled")){Ext.getCmp("lastpage").removeCls("al_last_disabled");
Ext.getCmp("lastpage").addCls("al_last_enabled");}}else{if(b=="previous"){currentPageNumber--;if((currentPageNumber-1)<1){Ext.getCmp("firstpage").setDisabled(true);Ext.getCmp("previouspage").setDisabled(true);Ext.getCmp("nextpage").setDisabled(false);Ext.getCmp("lastpage").setDisabled(false);if(Ext.getCmp("firstpage").hasCls("al_first_enabled")){Ext.getCmp("firstpage").removeCls("al_first_enabled");
Ext.getCmp("firstpage").addCls("al_first_disabled");}if(Ext.getCmp("previouspage").hasCls("al_previous_enabled")){Ext.getCmp("previouspage").removeCls("al_previous_enabled");Ext.getCmp("previouspage").addCls("al_previous_disabled");}if(Ext.getCmp("nextpage").hasCls("al_next_disabled")){Ext.getCmp("nextpage").removeCls("al_next_disabled");
Ext.getCmp("nextpage").addCls("al_next_enabled");}if(Ext.getCmp("lastpage").hasCls("al_last_disabled")){Ext.getCmp("lastpage").removeCls("al_last_disabled");Ext.getCmp("lastpage").addCls("al_last_enabled");}}else{Ext.getCmp("nextpage").setDisabled(false);Ext.getCmp("lastpage").setDisabled(false);if(Ext.getCmp("nextpage").hasCls("al_next_disabled")){Ext.getCmp("nextpage").removeCls("al_next_disabled");
Ext.getCmp("nextpage").addCls("al_next_enabled");}if(Ext.getCmp("lastpage").hasCls("al_last_disabled")){Ext.getCmp("lastpage").removeCls("al_last_disabled");Ext.getCmp("lastpage").addCls("al_last_enabled");}}}else{if(b=="next"){currentPageNumber++;if((currentPageNumber+1)>total_pages){Ext.getCmp("firstpage").setDisabled(false);
Ext.getCmp("previouspage").setDisabled(false);Ext.getCmp("nextpage").setDisabled(true);Ext.getCmp("lastpage").setDisabled(true);if(Ext.getCmp("firstpage").hasCls("al_first_disabled")){Ext.getCmp("firstpage").removeCls("al_first_disabled");Ext.getCmp("firstpage").addCls("al_first_enabled");}if(Ext.getCmp("previouspage").hasCls("al_previous_disabled")){Ext.getCmp("previouspage").removeCls("al_previous_disabled");
Ext.getCmp("previouspage").addCls("al_previous_enabled");}if(Ext.getCmp("nextpage").hasCls("al_next_enabled")){Ext.getCmp("nextpage").removeCls("al_next_enabled");Ext.getCmp("nextpage").addCls("al_next_disabled");}if(Ext.getCmp("lastpage").hasCls("al_last_enabled")){Ext.getCmp("lastpage").removeCls("al_last_enabled");
Ext.getCmp("lastpage").addCls("al_last_disabled");}}else{Ext.getCmp("firstpage").setDisabled(false);Ext.getCmp("previouspage").setDisabled(false);if(Ext.getCmp("firstpage").hasCls("al_first_disabled")){Ext.getCmp("firstpage").removeCls("al_first_disabled");Ext.getCmp("firstpage").addCls("al_first_enabled");
}if(Ext.getCmp("previouspage").hasCls("al_previous_disabled")){Ext.getCmp("previouspage").removeCls("al_previous_disabled");Ext.getCmp("previouspage").addCls("al_previous_enabled");}}}else{if(b=="last"){currentPageNumber=total_pages;Ext.getCmp("firstpage").setDisabled(false);Ext.getCmp("previouspage").setDisabled(false);
Ext.getCmp("nextpage").setDisabled(true);Ext.getCmp("lastpage").setDisabled(true);if(Ext.getCmp("firstpage").hasCls("al_first_disabled")){Ext.getCmp("firstpage").removeCls("al_first_disabled");Ext.getCmp("firstpage").addCls("al_first_enabled");}if(Ext.getCmp("previouspage").hasCls("al_previous_disabled")){Ext.getCmp("previouspage").removeCls("al_previous_disabled");
Ext.getCmp("previouspage").addCls("al_previous_enabled");}if(Ext.getCmp("nextpage").hasCls("al_next_enabled")){Ext.getCmp("nextpage").removeCls("al_next_enabled");Ext.getCmp("nextpage").addCls("al_next_disabled");}if(Ext.getCmp("lastpage").hasCls("al_last_enabled")){Ext.getCmp("lastpage").removeCls("al_last_enabled");
Ext.getCmp("lastpage").addCls("al_last_disabled");}}}}}Ext.getCmp("display_records_label").update(getRecordDispalyInfo(b));previousPageNumber=currentPageNumber;Ext.getCmp("pagenumber").setValue(currentPageNumber);var a=new Ext.LoadMask(Ext.getBody(),{msg:"Processing..."});a.show();Ext.getCmp("showbutton").setDisabled(true);
Ext.Ajax.request({url:"/final/admin/Auditlog/data/auditlogInfo.jsp?submitted=true&rowsperpage="+rowsPerPage+"&pageNo="+currentPageNumber,method:"POST",async:true,success:function(c){Ext.getCmp("auditlog_data_component").update(c.responseText);showAuditlogReportPanel();a.hide();Ext.getCmp("showbutton").setDisabled(false);
},failure:function(c){Ext.MessageBox.alert(pageTitle,information);a.hide();Ext.getCmp("showbutton").setDisabled(false);}});}function doCloseWin(){Ext.getCmp("scheduleWin").destroy();}function getStartAndEndDate(e){var d=new Array();var a="";var f="";if(e.toLowerCase()=="any"){a=Ext.Date.format(Ext.getCmp("eg_stdate").getValue(),mgrDateFormat);
a+=" "+Ext.getCmp("starthr").getValue()+":"+Ext.getCmp("startmin").getValue();f=Ext.Date.format(Ext.getCmp("eg_enddate").getValue(),mgrDateFormat);f+=" "+Ext.getCmp("endhr").getValue()+":"+Ext.getCmp("endmin").getValue();}else{var g=Number(e.substring(0,e.indexOf(" ")));var c=e.substring(e.indexOf(" ")+1).toLowerCase();
if(c.startsWith("h")){g*=3600;}if(c.startsWith("d")){g*=(24*3600);}if(c.startsWith("w")){g*=(7*24*3600);}if(c.startsWith("mo")){g*=(30*24*3600);}var b=new Date();f=Ext.Date.format(b,mgrDateFormat+" H:i");b.setTime(b.getTime()-(g*1000));a=Ext.Date.format(b,mgrDateFormat+" H:i");}d.push(a);d.push(f);return d;
}function getRecordDispalyInfo(a){if(a=="show"||a=="logindts"){if(totalRecord<rowsPerPage){endRecord=totalRecord;}else{endRecord=rowsPerPage;}}else{if(a=="page"){startRecord=((currentPageNumber-1)*rowsPerPage)+1;if(totalRecord>(currentPageNumber*rowsPerPage)){endRecord=currentPageNumber*rowsPerPage;}else{endRecord=totalRecord;
}}else{if(a=="first"){startRecord=1;endRecord=rowsPerPage;}else{if(a=="previous"){if(totalRecord>=(currentPageNumber*rowsPerPage)){endRecord=currentPageNumber*rowsPerPage;}else{endRecord=totalRecord;}startRecord=(endRecord-rowsPerPage)+1;}else{if(a=="next"){startRecord=endRecord+1;if(totalRecord>=(currentPageNumber*rowsPerPage)){endRecord=currentPageNumber*rowsPerPage;
}else{endRecord=totalRecord;}}else{if(a=="last"){startRecord=((currentPageNumber-1)*rowsPerPage)+1;endRecord=totalRecord;}}}}}}return topicsLabel+startRecord.toString()+" - "+endRecord.toString()+ofLabel+totalRecord.toString();}function buildUserMap(){userMap=new Map();if(!Ext.isEmpty(publicJSON["userIdsArray"])){Ext.getCmp("users").getStore().loadRawData(publicJSON["userIdsArray"]);
var a=publicJSON["userIdsArray"];for(var b in a){userMap.set(a[b].valueField,a[b].displayField);}}}