Ext.require("Ext.data.SortTypes");Ext.define("EgDispUserSites.controller.Main",{extend:"Ext.app.Controller",views:["Main","UserDetailsGrid","ResultPanel","LoginResultPanel"],refs:[{selector:"main",ref:"main"},{selector:"main #userSearch",ref:"searchBoxField"},{selector:"userdetailsgrid",ref:"userdetailsgrid"},{selector:"loginresultpanel",ref:"loginresultpanel"}],init:function(){appCnt=this;
this.buildMainData();this.control({"main":{"afterrender":this.afterMainRender},'main combo[id="category"]':{"select":this.selectOnChange},'main combo[id="searchCategory"]':{"select":this.searchCategoryChange},'userdetailsgrid button[id="blockDomain"]':{"click":this.showBlockDomainWin},'main trigger[id="userSearch"]':{"change":this.getAvaibleUsers},'main button[id="backButton"]':{"click":this.goBack},'main button[id="csv"]':{"click":this.saveInCSVFormat},"userdetailsgrid":{},});
},saveInCSVFormat:function(){window.location.href="/final/servlet/com.eg.SaveInCSVFormat?user_language="+trackerLanguage;},buildMainData:function(){var c="";var b="";var a="EgDispUserSites/data/EgDispUserSitesJson.jsp?expiry="+selectedCategory+"&date="+new Date().getTime();if(selectedCategory!=null&&selectedCategory=="nonactiveusers"){urlStr="/final/servlet/com.eg.AuditServletExtJS?eg_timeline=1 month&jsppage=logons&reqfrom=navlink";
Ext.Ajax.request({url:urlStr,method:"POST",async:false,success:function(i){var g=i.responseText;publicJSON=Ext.decode(g);var f=publicJSON["defaults"]["eg_stdate"];var m=publicJSON["defaults"]["starthr"];var h=publicJSON["defaults"]["startmin"];var d=publicJSON["defaults"]["eg_enddate"];var e=publicJSON["defaults"]["endhr"];
var k=publicJSON["defaults"]["endmin"];var l=new Date(f);var j=new Date(d);c=Ext.Date.format(l,"m/d/Y")+" "+m+":"+h+":00";b=Ext.Date.format(j,"m/d/Y")+" "+e+":"+k+":00";a=a+"&startDate="+encodeURIComponent(c)+"&endDate="+encodeURIComponent(b);}});}Ext.Ajax.request({url:a,method:"POST",async:false,success:function(d){publicJSON=Ext.decode(d.responseText);
},failure:function(d){}});},getAvaibleUsers:function(a){this.fetchUsers(a.getValue());},searchCategoryChange:function(){Ext.getCmp("userdetailsgrid").getStore().clearFilter();var a=Ext.getCmp("searchCategory").getValue();Ext.getCmp("userSearch").emptyText="Search "+a;Ext.getCmp("userSearch").applyEmptyText();
Ext.getCmp("userSearch").reset();},fetchUsers:function(e){if(e==""||e.length==0){Ext.get("MyTrigger_userSearch_0").setStyle("display","none");Ext.get("MyTrigger_userSearch_1").setStyle("display","block");}else{Ext.get("MyTrigger_userSearch_1").setStyle("display","none");Ext.get("MyTrigger_userSearch_0").setStyle("display","block");
}var c=Ext.getCmp("category").getValue();var f="";var a=Ext.getCmp("userdetailsgrid");if(e==""||e.length==0){a.getStore().clearFilter();}else{var b=Ext.getCmp("searchCategory").getValue();b=b.replace(" ","");a.getStore().clearFilter();var d=new Ext.util.Filter({filterFn:function(i){if(b=="CSIDownloaded"){b="AgentDownloaded";
}var j=i.get(b);if(b=="RegistrationDate"||b=="ExpiryDate"){if(!Ext.isEmpty(j)){var h="";if(b=="RegistrationDate"){h=Ext.String.format("{0} {1}",Ext.Date.dateFormat(j,extjsDateFormat+"|"),i.get(b));}else{h=Ext.String.format("{0} {1}",Ext.Date.dateFormat(j,extjsExpiryDateFormat+"|"),i.get(b));}j=h.substring(0,h.indexOf("|"));
if(b=="ExpiryDate"){if(j=="Dec 12, 9999"){j="No expiry";}}}else{if(b=="RegistrationDate"){j="Not Available";}else{j="No expiry";}}}if(b=="Email"){if(i.get("To").toLowerCase().indexOf(e.toLowerCase())!=-1||i.get("Cc").toLowerCase().indexOf(e.toLowerCase())!=-1||i.get("Bcc").toLowerCase().indexOf(e.toLowerCase())!=-1){return true;
}}else{if(b=="UserElements"){if(i.get("isElementsAssociated")==true){if(i.get("hasallcompaccess")!=true){var g="";if(i.get("Zones")!="no zones"){g+=i.get("Zones");}if(i.get("ServiceGroups")!="no service groups"){g+=i.get("ServiceGroups");}if(i.get("Services")!="no services"){g+=i.get("Services");}if(i.get("Segments")!="no segments"){g+=i.get("Segments");
}if(i.get("Components")!="no components"){g+=i.get("ComponentName");g+=i.get("ComponentsType");}if(i.get("UserVms")!="no vms"){g+=i.get("UserVms");}if(i.get("hasAutoAsscociatedComponents")!=false){g+=i.get("Auto");}if(!Ext.isEmpty(g)){if((g.toLowerCase()).indexOf(e.toLowerCase())!=-1){return true;}}}}}else{if(j.toLowerCase().indexOf(e.toLowerCase())!=-1){return true;
}}}}});a.getStore().filter(d);}if(a.getStore().getCount()==0){Ext.get("userDeferMessage").update(intnlMessage10+".");}this.getMain().doLayout();},selectOnChange:function(g){var e=this;var c=g.getValue();var a=new Ext.LoadMask(Ext.getBody(),{msg:"Loading..."});a.show();var f="";var d="";var b="EgDispUserSites/data/EgDispUserSitesJson.jsp?expiry="+c+"&date="+new Date().getTime();
if(c!=null&&c=="nonactiveusers"){urlStr="/final/servlet/com.eg.AuditServletExtJS?eg_timeline=1 month&jsppage=logons&reqfrom=navlink";Ext.Ajax.request({url:urlStr,method:"POST",async:false,success:function(m){var k=m.responseText;publicJSON=Ext.decode(k);var j=publicJSON["defaults"]["eg_stdate"];var q=publicJSON["defaults"]["starthr"];
var l=publicJSON["defaults"]["startmin"];var h=publicJSON["defaults"]["eg_enddate"];var i=publicJSON["defaults"]["endhr"];var o=publicJSON["defaults"]["endmin"];var p=new Date(j);var n=new Date(h);f=Ext.Date.format(p,"m/d/Y")+" "+q+":"+l+":00";d=Ext.Date.format(n,"m/d/Y")+" "+i+":"+o+":00";b=b+"&startDate="+encodeURIComponent(f)+"&endDate="+encodeURIComponent(d);
}});}Ext.Ajax.request({url:b,method:"POST",success:function(h){publicJSON=Ext.decode(h.responseText);e.getUserdetailsgrid().setTitle('<span class="font_bold">'+Ext.getCmp("category").getDisplayValue()+"</span>");if(!Ext.isEmpty(publicJSON.UserInfo)){var l=Ext.widget("userdetailsgrid",{store:new Ext.data.Store({fields:[{name:"UserName",sortType:Ext.data.SortTypes.asUCString},{name:"FirstName",sortType:Ext.data.SortTypes.asUCString},{name:"LastName",sortType:Ext.data.SortTypes.asUCString},"PhoneNumber",{name:"Company",sortType:Ext.data.SortTypes.asUCString},"TimeZone","Role","DateFormat",{name:"RegistrationDate",type:"date",dateFormat:extjsDateFormat},{name:"ExpiryDate",type:"date",dateFormat:extjsExpiryDateFormat},"Email","To","Cc","Bcc","AgentDownloaded","AgentInstalled","Action","isElementsAssociated","Auto","UserVms","ComponentsType","Components","Segments","Services","ServiceGroups","Zones","hasallcompaccess","hasAutoAsscociatedComponents","ServersForDeletion","BlockedUser","LocalUser","ChangePassword","LastLoginTime","ComponentName"],data:publicJSON.UserInfo,proxy:{type:"pagingmemory",reader:{type:"json"}},remoteFilter:true,remoteSort:true,autoLoad:true,pageSize:50,simpleSortMode:true}),viewConfig:{forceFit:true,stripeRows:true},sortOnLoad:true,sortInfo:{property:"RegistrationDate",direction:"DESC"}});
var i=Ext.getCmp("loginresultpanel_in_formitem");i.show();i.removeAll();i.removeCls("dataPanel");i.add(l);var k=Ext.getCmp("userSearch");if(!Ext.isEmpty(k)){e.getSearchBoxField().setDisabled(false);var j=k.getValue();if(!Ext.isEmpty(j)){appCnt.fetchUsers(j);}}Ext.getCmp("csv").setDisabled(false);Ext.getCmp("searchCategory").getStore().loadRawData(publicJSON["searchArr"]);
Ext.getCmp("searchCategory").setValue(Ext.getCmp("searchCategory").getStore().getAt(0));Ext.getCmp("userSearch").emptyText="Search "+Ext.getCmp("searchCategory").getValue();Ext.getCmp("userSearch").applyEmptyText();Ext.getCmp("searchCategory").enable();Ext.getCmp("userSearch").enable();}else{var l=Ext.widget("userdetailsgrid",{store:new Ext.data.Store({fields:[{name:"UserName",sortType:Ext.data.SortTypes.asUCString},{name:"FirstName",sortType:Ext.data.SortTypes.asUCString},{name:"LastName",sortType:Ext.data.SortTypes.asUCString},"PhoneNumber",{name:"Company",sortType:Ext.data.SortTypes.asUCString},"TimeZone","Role","DateFormat",{name:"RegistrationDate",type:"date",dateFormat:extjsDateFormat},{name:"ExpiryDate",type:"date",dateFormat:extjsExpiryDateFormat},"Email","To","Cc","Bcc","AgentDownloaded","AgentInstalled","Action","isElementsAssociated","Auto","UserVms","ComponentsType","Components","Segments","Services","ServiceGroups","Zones","hasallcompaccess","hasAutoAsscociatedComponents","ServersForDeletion","BlockedUser","LocalUser","ChangePassword","LastLoginTime","ComponentName"],data:[],proxy:{type:"pagingmemory",reader:{type:"json"}},remoteFilter:true,remoteSort:true,autoLoad:true,pageSize:50,simpleSortMode:true}),viewConfig:{forceFit:true,stripeRows:true},sortOnLoad:true,sorters:[{property:"RegistrationDate",direction:"DESC"}]});
var i=Ext.getCmp("loginresultpanel_in_formitem");i.show();i.removeAll();i.removeCls("dataPanel");i.add(l);e.getUserdetailsgrid().getStore().loadRawData(publicJSON.UserInfo);e.getUserdetailsgrid().emptyText=intnlMessage11+".";Ext.getCmp("csv").setDisabled(true);Ext.getCmp("searchCategory").getStore().loadRawData(publicJSON["searchArr"]);
Ext.getCmp("searchCategory").setValue(Ext.getCmp("searchCategory").getStore().getAt(0));Ext.getCmp("userSearch").emptyText="Search "+Ext.getCmp("searchCategory").getValue();Ext.getCmp("userSearch").applyEmptyText();Ext.getCmp("searchCategory").disable();Ext.getCmp("userSearch").disable();}a.hide();e.getMain().doLayout();
if(c!=null&&(c=="logonsimulatorusers"||c=="logonsimulatoregusers"||c=="nonactiveusers"||c=="cloudusers")){Ext.getCmp("fname").setVisible(true);Ext.getCmp("lname").setVisible(true);Ext.getCmp("phoneno").setVisible(true);Ext.getCmp("comp").setVisible(true);Ext.getCmp("ModifyOver").setVisible(true);Ext.getCmp("DeleteOver").setVisible(true);
Ext.getCmp("blockUsers").setVisible(true);Ext.getCmp("changePwd").setVisible(true);Ext.getCmp("dateFormat").setVisible(false);Ext.getCmp("userRole").setVisible(false);Ext.getCmp("expiry").setVisible(true);Ext.getCmp("RegistrationDate").setVisible(true);Ext.getCmp("registerUser").setVisible(false);Ext.getCmp("mailid").setVisible(false);
if(c=="nonactiveusers"){Ext.getCmp("LastLoginTime").setVisible(true);}else{Ext.getCmp("LastLoginTime").setVisible(false);}if(c=="cloudusers"){Ext.getCmp("agentdownload").setVisible(true);if(cloudModel!=null&&cloudModel.toLowerCase()=="phoenix"){Ext.getCmp("agentinstalled").setVisible(true);}else{Ext.getCmp("agentinstalled").setVisible(false);
}}else{Ext.getCmp("agentdownload").setVisible(false);Ext.getCmp("agentinstalled").setVisible(false);}}else{if(c!=null&&(c=="logonsimulatorregusers"||c=="cloudregusers")){Ext.getCmp("fname").setVisible(true);Ext.getCmp("lname").setVisible(true);Ext.getCmp("phoneno").setVisible(true);Ext.getCmp("comp").setVisible(true);
Ext.getCmp("ModifyOver").setVisible(false);Ext.getCmp("DeleteOver").setVisible(true);Ext.getCmp("blockUsers").setVisible(false);Ext.getCmp("changePwd").setVisible(false);Ext.getCmp("dateFormat").setVisible(false);Ext.getCmp("userRole").setVisible(false);Ext.getCmp("expiry").setVisible(false);Ext.getCmp("LastLoginTime").setVisible(false);
Ext.getCmp("RegistrationDate").setVisible(false);Ext.getCmp("registerUser").setVisible(true);Ext.getCmp("mailid").setVisible(false);Ext.getCmp("agentdownload").setVisible(false);Ext.getCmp("agentinstalled").setVisible(false);}else{Ext.getCmp("fname").setVisible(false);Ext.getCmp("lname").setVisible(false);
Ext.getCmp("phoneno").setVisible(false);Ext.getCmp("comp").setVisible(false);Ext.getCmp("ModifyOver").setVisible(true);Ext.getCmp("DeleteOver").setVisible(false);Ext.getCmp("blockUsers").setVisible(true);Ext.getCmp("changePwd").setVisible(true);Ext.getCmp("LastLoginTime").setVisible(false);Ext.getCmp("dateFormat").setVisible(true);
Ext.getCmp("userRole").setVisible(true);Ext.getCmp("expiry").setVisible(true);Ext.getCmp("RegistrationDate").setVisible(true);Ext.getCmp("registerUser").setVisible(false);Ext.getCmp("agentdownload").setVisible(false);Ext.getCmp("agentinstalled").setVisible(false);}}e.getUserdetailsgrid().setTitle('<span class="font_bold">'+Ext.getCmp("category").getDisplayValue()+"</span>");
if(c!=null&&(c=="logonsimulatorusers"||c=="logonsimulatoregusers"||c=="nonactiveusers"||c=="cloudusers")){e.getUserdetailsgrid().columns[findColumnIndex(e.getUserdetailsgrid().columns,"RegistrationDate")].setSortState("DESC");if(c=="logonsimulatorusers"){Ext.getCmp("blockDomain").show();}else{Ext.getCmp("blockDomain").hide();
}}else{Ext.getCmp("RegistrationDate").removeCls("x-column-header-sort-DESC");Ext.getCmp("blockDomain").hide();}},failure:function(h){a.hide();}});},showActions:function(a,b,d,g,f){var c=Ext.DomQuery.select(".x-action-col-icon",d);Ext.each(c,function(e){});},hideActions:function(a,b,d,g,f){var c=Ext.DomQuery.select(".x-action-col-icon",d);
Ext.each(c,function(e){});},goBack:function(){window.location.href=backHref;},afterMainRender:function(){var j=this;if(reqfrom!="navlink"){Ext.getCmp("backButton").show();}if(!Ext.isEmpty(publicJSON.UserInfo)){Ext.getCmp("userCombo").show();Ext.getCmp("category").getStore().loadRawData(publicJSON.optionsArr);
Ext.getCmp("category").setValue(selectedCategory);var k=Ext.widget("userdetailsgrid",{store:new Ext.data.Store({fields:[{name:"UserName",sortType:Ext.data.SortTypes.asUCString},{name:"FirstName",sortType:Ext.data.SortTypes.asUCString},{name:"LastName",sortType:Ext.data.SortTypes.asUCString},"PhoneNumber",{name:"Company",sortType:Ext.data.SortTypes.asUCString},"TimeZone","Role","DateFormat",{name:"RegistrationDate",type:"date",dateFormat:extjsDateFormat},{name:"ExpiryDate",type:"date",dateFormat:extjsExpiryDateFormat},"Email","To","Cc","Bcc","AgentDownloaded","AgentInstalled","Action","isElementsAssociated","Auto","UserVms","ComponentsType","Components","Segments","Services","ServiceGroups","Zones","hasallcompaccess","hasAutoAsscociatedComponents","ServersForDeletion","BlockedUser","LocalUser","ChangePassword","LastLoginTime","ComponentName"],data:publicJSON.UserInfo,proxy:{type:"pagingmemory",reader:{type:"json"}},remoteFilter:true,remoteSort:true,autoLoad:true,pageSize:50,simpleSortMode:true}),viewConfig:{forceFit:true,stripeRows:true},sortOnLoad:true,sorters:[{property:"RegistrationDate",direction:"DESC"}]});
var c=Ext.getCmp("loginresultpanel_in_formitem");c.show();c.removeAll();c.removeCls("dataPanel");c.add(k);var e=publicJSON["gridColums"];var h=Ext.getCmp("userdetailsgrid");var g=1;for(var l in e){h.columns[g++].setText(e[l]);}h.setTitle('<span class="font_bold">'+Ext.getCmp("category").getDisplayValue()+"</span>");
var b=Ext.getCmp("userSearch");if(!Ext.isEmpty(b)){j.getSearchBoxField().setDisabled(false);var a=b.getValue();if(!Ext.isEmpty(a)){appCnt.fetchUsers(a);}}Ext.getCmp("csv").setDisabled(false);Ext.getCmp("searchCategory").getStore().loadRawData(publicJSON["searchArr"]);Ext.getCmp("searchCategory").setValue(Ext.getCmp("searchCategory").getStore().getAt(0));
Ext.getCmp("userSearch").emptyText="Search "+Ext.getCmp("searchCategory").getValue();Ext.getCmp("userSearch").applyEmptyText();Ext.getCmp("searchCategory").enable();Ext.getCmp("userSearch").enable();}else{var k=Ext.widget("userdetailsgrid",{store:new Ext.data.Store({fields:[{name:"UserName",sortType:Ext.data.SortTypes.asUCString},{name:"FirstName",sortType:Ext.data.SortTypes.asUCString},{name:"LastName",sortType:Ext.data.SortTypes.asUCString},"PhoneNumber",{name:"Company",sortType:Ext.data.SortTypes.asUCString},"TimeZone","Role","DateFormat",{name:"RegistrationDate",type:"date",dateFormat:extjsDateFormat},{name:"ExpiryDate",type:"date",dateFormat:extjsExpiryDateFormat},"Email","To","Cc","Bcc","AgentDownloaded","AgentInstalled","Action","isElementsAssociated","Auto","UserVms","ComponentsType","Components","Segments","Services","ServiceGroups","Zones","hasallcompaccess","hasAutoAsscociatedComponents","ServersForDeletion","BlockedUser","LocalUser","ChangePassword","LastLoginTime","ComponentName"],data:[],proxy:{type:"pagingmemory",reader:{type:"json"}},remoteFilter:true,remoteSort:true,autoLoad:true,pageSize:50,simpleSortMode:true}),viewConfig:{forceFit:true,stripeRows:true},sortOnLoad:true,sorters:[{property:"RegistrationDate",direction:"DESC"}]});
var c=Ext.getCmp("loginresultpanel_in_formitem");c.show();c.removeAll();c.removeCls("dataPanel");c.add(k);if(selectedCategory=="all"){Ext.getCmp("loginresultpanel_in_formitem").hide();Ext.getCmp("userdetailsgrid").hide();Ext.getCmp("userCombo").hide();var f=Ext.getCmp("resultpanel");f.show();f.removeAll();
var d={xtype:"component",flex:1,html:'<div class="egFlexCenterByColumnWise" style="height:100%"><div class="iconInformation"></div><div class="commonErrorMsgText">'+intnlMessage12+"</div></div>"};f.add(d);}else{Ext.getCmp("category").getStore().loadRawData(publicJSON.optionsArr);Ext.getCmp("category").setValue(selectedCategory);
j.getUserdetailsgrid().setTitle('<span class="font_bold">'+Ext.getCmp("category").getDisplayValue()+"</span>");j.getUserdetailsgrid().getStore().loadRawData(publicJSON.UserInfo);j.getUserdetailsgrid().emptyText=intnlMessage11;Ext.getCmp("userCombo").show();}Ext.getCmp("csv").setDisabled(true);Ext.getCmp("searchCategory").getStore().loadRawData(publicJSON["searchArr"]);
Ext.getCmp("searchCategory").setValue(Ext.getCmp("searchCategory").getStore().getAt(0));Ext.getCmp("userSearch").emptyText="Search "+Ext.getCmp("searchCategory").getValue();Ext.getCmp("userSearch").applyEmptyText();Ext.getCmp("searchCategory").disable();Ext.getCmp("userSearch").disable();}if(selectedCategory!=null&&(selectedCategory=="logonsimulatorusers"||selectedCategory=="logonsimulatoregusers"||selectedCategory=="nonactiveusers"||selectedCategory=="cloudusers")){Ext.getCmp("fname").setVisible(true);
Ext.getCmp("lname").setVisible(true);Ext.getCmp("phoneno").setVisible(true);Ext.getCmp("comp").setVisible(true);Ext.getCmp("ModifyOver").setVisible(true);Ext.getCmp("DeleteOver").setVisible(true);Ext.getCmp("blockUsers").setVisible(true);Ext.getCmp("changePwd").setVisible(true);Ext.getCmp("dateFormat").setVisible(false);
Ext.getCmp("userRole").setVisible(false);Ext.getCmp("expiry").setVisible(true);Ext.getCmp("RegistrationDate").setVisible(true);Ext.getCmp("registerUser").setVisible(false);Ext.getCmp("mailid").setVisible(false);if(selectedCategory=="nonactiveusers"){Ext.getCmp("LastLoginTime").setVisible(true);}else{Ext.getCmp("LastLoginTime").setVisible(false);
}if(selectedCategory=="cloudusers"){Ext.getCmp("agentdownload").setVisible(true);if(cloudModel!=null&&cloudModel.toLowerCase()=="phoenix"){Ext.getCmp("agentinstalled").setVisible(true);}else{Ext.getCmp("agentinstalled").setVisible(false);}}else{Ext.getCmp("agentdownload").setVisible(false);Ext.getCmp("agentinstalled").setVisible(false);
}}else{if(selectedCategory!=null&&(selectedCategory=="logonsimulatorregusers"||selectedCategory=="cloudregusers")){Ext.getCmp("fname").setVisible(true);Ext.getCmp("lname").setVisible(true);Ext.getCmp("phoneno").setVisible(true);Ext.getCmp("comp").setVisible(true);Ext.getCmp("ModifyOver").setVisible(false);
Ext.getCmp("DeleteOver").setVisible(true);Ext.getCmp("blockUsers").setVisible(false);Ext.getCmp("changePwd").setVisible(false);Ext.getCmp("dateFormat").setVisible(false);Ext.getCmp("userRole").setVisible(false);Ext.getCmp("expiry").setVisible(false);Ext.getCmp("LastLoginTime").setVisible(false);Ext.getCmp("RegistrationDate").setVisible(false);
Ext.getCmp("registerUser").setVisible(true);Ext.getCmp("mailid").setVisible(false);Ext.getCmp("agentdownload").setVisible(false);Ext.getCmp("agentinstalled").setVisible(false);}else{Ext.getCmp("fname").setVisible(false);Ext.getCmp("lname").setVisible(false);Ext.getCmp("phoneno").setVisible(false);Ext.getCmp("comp").setVisible(false);
Ext.getCmp("ModifyOver").setVisible(true);Ext.getCmp("DeleteOver").setVisible(false);Ext.getCmp("blockUsers").setVisible(true);Ext.getCmp("changePwd").setVisible(true);Ext.getCmp("LastLoginTime").setVisible(false);Ext.getCmp("dateFormat").setVisible(true);Ext.getCmp("userRole").setVisible(true);Ext.getCmp("expiry").setVisible(true);
Ext.getCmp("RegistrationDate").setVisible(true);Ext.getCmp("registerUser").setVisible(false);Ext.getCmp("agentdownload").setVisible(false);Ext.getCmp("agentinstalled").setVisible(false);}}j.getUserdetailsgrid().setTitle('<span class="font_bold">'+Ext.getCmp("category").getDisplayValue()+"</span>");this.getMain().doLayout();
if(selectedCategory!=null&&(selectedCategory=="logonsimulatorusers"||selectedCategory=="logonsimulatoregusers"||selectedCategory=="nonactiveusers"||selectedCategory=="cloudusers")){if(selectedCategory=="logonsimulatorusers"){Ext.getCmp("blockDomain").show();}else{Ext.getCmp("blockDomain").hide();}j.getUserdetailsgrid().columns[findColumnIndex(j.getUserdetailsgrid().columns,"RegistrationDate")].setSortState("DESC");
}else{Ext.getCmp("blockDomain").hide();}},doSorting:function(c){var b=Ext.getCmp("RegistrationDate").up("tablepanel").store;var d=Ext.getCmp("RegistrationDate").getSortParam();customDateSorting(b,c,d,userDateFormat);Ext.getCmp("userdetailsgrid").getView().refresh();var a="x-column-header-sort-"+c;Ext.getCmp("RegistrationDate").addCls(a);
},showBlockDomainWin:function(){popUpWin=Ext.create("Ext.Window",{layout:"fit",border:false,title:"Block Domains",id:"egblockdomain",width:500,padding:"5 10 10 10",autoScroll:true,modal:true,layout:{type:"vbox",pack:"start",align:"center"},margin:10,dockedItems:[{dock:"bottom",layout:{type:"hbox",align:"stretch",pack:"center"},border:false,padding:"10 0 0 0",items:[{xtype:"button",id:"updateBlockedDomain",text:"Update",cls:"quickMenuWhiteButton",width:80,layout:{type:"hbox",pack:"center",align:"center"},listeners:{"click":function(){appCnt.updateBlockedDomains();
}}}]}],items:[{xtype:"textfield",cls:"textbox",fieldLabel:"Domains",labelAlign:"top",id:"domainVal",labelWidth:60,width:450,emptyText:"Comma-separated list of domains [@example.com,@example1.com]",labelSeparator:" ",labelStyle:{"font-weight":"bold"},margin:10}]});popUpWin.show();Ext.getCmp("domainVal").focus(true,true);
},updateBlockedDomains:function(){var b=Ext.getCmp("domainVal").getValue();if(b.indexOf(",")!=-1){var d=b.split(",");for(var c=0;c<d.length;c++){var a=d[c];if(a==null||Ext.isEmpty(a)){Ext.Msg.show({title:"Block Domains",msg:"Please specify domains.",buttons:Ext.Msg.OK,icon:"iconExclamation",fn:function(){Ext.getCmp("domainVal").focus(true,true);
}});return;}else{if(!a.startsWith("@")){Ext.Msg.show({title:"Block Domains",msg:"Domain name should start with '@' symbol.",buttons:Ext.Msg.OK,icon:"iconExclamation",fn:function(){Ext.getCmp("domainVal").focus(true);}});return;}else{if(a.lastIndexOf("@")>0){Ext.Msg.show({title:"Block Domains",msg:"Please specify valid domain names.",buttons:Ext.Msg.OK,icon:"iconExclamation",fn:function(){Ext.getCmp("domainVal").focus(true);
}});return;}else{if(a.indexOf(".")==-1){Ext.Msg.show({title:"Block Domains",msg:"Please specify valid domain names.",buttons:Ext.Msg.OK,icon:"iconExclamation",fn:function(){Ext.getCmp("domainVal").focus(true);}});return;}else{if(a.endsWith(".")){Ext.Msg.show({title:"Block Domains",msg:"Domain name should not end with a dot.",buttons:Ext.Msg.OK,icon:"iconExclamation",fn:function(){Ext.getCmp("domainVal").focus(true);
}});return;}}}}}}}else{if(b==null||Ext.isEmpty(b)){Ext.Msg.show({title:"Block Domains",msg:"Please specify domains.",buttons:Ext.Msg.OK,icon:"iconExclamation",fn:function(){Ext.getCmp("domainVal").focus(true,true);}});return;}else{if(!b.startsWith("@")){Ext.Msg.show({title:"Block Domains",msg:"Domain name should start with '@' symbol.",buttons:Ext.Msg.OK,icon:"iconExclamation",fn:function(){Ext.getCmp("domainVal").focus(true);
}});return;}else{if(b.lastIndexOf("@")>0){Ext.Msg.show({title:"Block Domains",msg:"Please specify valid domain names.",buttons:Ext.Msg.OK,icon:"iconExclamation",fn:function(){Ext.getCmp("domainVal").focus(true);}});return;}else{if(b.indexOf(".")==-1){Ext.Msg.show({title:"Block Domains",msg:"Please specify valid domain names.",buttons:Ext.Msg.OK,icon:"iconExclamation",fn:function(){Ext.getCmp("domainVal").focus(true);
}});return;}else{if(b.endsWith(".")){Ext.Msg.show({title:"Block Domains",msg:"Domain name should not end with a dot.",buttons:Ext.Msg.OK,icon:"iconExclamation",fn:function(){Ext.getCmp("domainVal").focus(true);}});return;}}}}}}Ext.Ajax.request({url:"EgDispUserSites/data/EgUserOperationsJson.jsp?blockedDomain="+encodeURIComponent(b)+"&from=blockDomain",method:"POST",success:function(f){var h=f.responseText;
var e=Ext.decode(h);var g=e["blockDomain"];if(g=="success"){Ext.Msg.show({title:"Block Domains",msg:"Domains have been blocked successfully.",buttons:Ext.Msg.OK,icon:"iconInformation",fn:function(){var i=Ext.getCmp("egblockdomain");if(i!=null&i!=undefined){i.close();}}});}}});},updateUserInfo:function(a){Ext.Ajax.request({url:a,method:"POST",async:false,success:function(b){var c=b.responseText;
publicJSON=Ext.decode(c);}});},getUserDetails:function(c){var b=c.getValue();var a="EgDispUserSites/data/EgDispUserSitesJson.jsp?action=userinfo&user="+encodeURIComponent(b);this.updateUserInfo(a);this.loadUserDetails(b);},loadUserDetails:function(l){var k=this;var g=new Array();var h=publicJSON["Servers"];
var c=publicJSON["Segments"];var o=publicJSON["Zones"];var i=publicJSON["Services"];var j=publicJSON["serviceGroups"];var a=publicJSON["userVMs"];var a=publicJSON["userVMs"];var n=publicJSON["cols"];Ext.getCmp("resultpanel").add({xtype:"userdetailscontainer"});var f=Ext.getCmp("userInfoContainer");Ext.getCmp("userID").getStore().loadRawData(availableUserIDs);
Ext.getCmp("userID").setValue(l);f.removeAll();Ext.getCmp("resultpanel").hide();var e=false;if(!Ext.isEmpty(h)){e=true;var b=k.getEgUserTab("1","USER COMPONENTS");var m=k.getGridPanel(h,n,"Servers");f.add(b);Ext.getCmp("tab1").add(m);}if(!Ext.isEmpty(c)){e=true;var b=k.getEgUserTab("2","SEGMENTS");var m=k.getGridPanel(c,n,"Segments");
f.add(b);Ext.getCmp("tab2").add(m);}if(!Ext.isEmpty(o)){e=true;var b=k.getEgUserTab("3","ZONES");var m=k.getGridPanel(o,n,"Zones");f.add(b);Ext.getCmp("tab3").add(m);}if(!Ext.isEmpty(i)){e=true;var b=k.getEgUserTab("4","SERVICES");var m=k.getGridPanel(i,n,"Services");f.add(b);Ext.getCmp("tab4").add(m);
}if(!Ext.isEmpty(j)){e=true;var b=k.getEgUserTab("5","SERVICE GROUP");var m=k.getGridPanel(j,n,"serviceGroups");f.add(b);Ext.getCmp("tab5").add(m);}if(!Ext.isEmpty(a)){e=true;var b=k.getEgUserTab("6","USER VMs");var m=k.getGridPanel(a,n,"userVMs");f.add(b);Ext.getCmp("tab6").add(m);}if(e==false){var d={xtype:"container",padding:130,style:{"text-align":"center"},html:'<div class = "iconInformation" style="margin:0 auto"></div><div>No associated elements</div>'};
f.add(d);}Ext.getCmp("loginresultpanel_in_formitem").hide();Ext.getCmp("userdetailsgrid").hide();Ext.getCmp("backButton").show();Ext.getCmp("resultpanel").show();},getEgUserTab:function(c,a){var b=Ext.create("Ext.tab.Panel",{width:"90%",margin:8,activeTab:0,items:[{title:a,cls:"tablayout",id:"tab"+c,}]});
return b;},getGridPanel:function(b,g,h){var c=new Array();var d=new Array();var a=new Array();for(var i in g){var e=g[i];c.push(e);d.push({header:e,sortable:true,dataIndex:e,align:"left",flex:1,renderer:function(s,k,p,u,l,t,j){var m=s;var o=s;if(h=="Servers"){if(m!="-"&&m.length>0){var n=m.split("|#|");
var q=n[0];var r=n[1];if(q!=null&&q.indexOf("Agg_")!=-1){o='<a style="text-decoration:none" href="EgAggregateTree.jsp?qctr=1&reqfrom=home&isAggregateLink=true&server='+encodeURIComponent(q)+'">'+r+"</a>";}else{o='<a style="text-decoration:none" href="EgDispServer.jsp?qctr=1&server='+encodeURIComponent(q)+'">'+r+"</a>";
}}}else{if(h=="Segments"){if(m!="-"&&m.length>0){o='<a style="text-decoration:none" href="EgAdminTopology.jsp?qctr=0&segment='+encodeURIComponent(m)+'">'+m+"</a>";}}else{if(h=="Zones"){if(m!="-"&&m.length>0){o='<a style="text-decoration:none" href="EgConfigZone.jsp?qctr=0&mode=modify&zone='+encodeURIComponent(m)+'">'+m+"</a>";
}}else{if(h=="Services"){if(m!="-"&&m.length>0){o='<a style="text-decoration:none" href="EgConfigSites.jsp?modify=true&site='+encodeURIComponent(m)+'">'+m+"</a>";}}else{if(h=="serviceGroups"){if(m!="-"&&m.length>0){o='<a style="text-decoration:none" href="EgConfigServiceGroup.jsp?modify=true&site='+encodeURIComponent(m)+'">'+m+"</a>";
}}}}}}return o;}});}var f=Ext.widget("egusergridpanel",{store:new Ext.data.Store({fields:c,data:b}),sortableColumns:false,ui:"newGridPanel",border:true,columns:d,bodyPadding:"0 0 20 0",viewConfig:{forceFit:true,stripeRows:false},sortable:false,hideable:false,hideHeaders:true});return f;},handleBlockIconClick:function(d,e,c){var a=Ext.getCmp("userdetailsgrid").getStore().getAt(e);
var b=a.get("UserName");Ext.Msg.show({title:pageTitle,msg:confirmation2+" '"+b+"'?",icon:"iconConfirmation",buttons:Ext.Msg.YESNO,fn:function(f){if(f=="yes"){var g=a.get("Action");Ext.Ajax.request({url:"EgDispUserSites/data/EgUserOperationsJson.jsp",method:"POST",params:{"uname":g,"from":"block"},standardSubmit:false,timeout:300000,success:function(h){if(h.status==200){Ext.MessageBox.show({title:pageTitle,msg:blockedMessage+".",icon:"iconInformation",buttons:Ext.Msg.OK});
selectedCategory=Ext.getCmp("category").getValue();appCnt.buildMainData();appCnt.afterMainRender();}},failure:function(h){}});}}});},handleUnBlockIconClick:function(e,f,d){var b=Ext.getCmp("userdetailsgrid").getStore().getAt(f);var c=b.get("UserName");var a=b.get("To");Ext.Msg.show({title:pageTitle,msg:confirmation3+" '"+c+"'?",icon:"iconConfirmation",buttons:Ext.Msg.YESNO,fn:function(g){if(g=="yes"){if(isTwoFAEnforced&&(c.toLowerCase()=="admin"||c.toLowerCase()=="supermonitor")&&(Ext.isEmpty(a)||(!Ext.isEmpty(a)&&a=="-"))){Ext.create("Ext.Window",{layout:"fit",border:false,title:confMailTitle,id:"confmailid",width:350,padding:"5 10 10 10",autoScroll:true,modal:true,layout:{type:"vbox",pack:"start",align:"center"},margin:10,dockedItems:[{dock:"bottom",layout:{type:"hbox",align:"stretch",pack:"center"},border:false,padding:"10 0 0 0",items:[{xtype:"button",id:"updatemailid",text:"Update",cls:"quickMenuWhiteButton",width:80,layout:{type:"hbox",pack:"center",align:"center"},listeners:{"click":function(){appCnt.updateMailID(e,f,d);
}}}]}],items:[{xtype:"label",margin:10,width:300,html:twofaEnforcedLabel1+". "+twofaEnforcedLabel2+" '"+c+"'."},{xtype:"textfield",fieldLabel:tomailIDLabel,id:"mailTo",name:"mailTo",cls:"textbox",labelWidth:60,width:300,margin:10}]}).show();Ext.getCmp("mailTo").focus(true,true);}else{var h=b.get("Action");
Ext.Ajax.request({url:"EgDispUserSites/data/EgUserOperationsJson.jsp",method:"POST",params:{"uname":h,"from":"unblock"},standardSubmit:false,timeout:300000,success:function(i){if(i.status==200){Ext.MessageBox.show({title:pageTitle,msg:unblockedMessage+".",icon:"iconInformation",buttons:Ext.Msg.OK});selectedCategory=Ext.getCmp("category").getValue();
appCnt.buildMainData();appCnt.afterMainRender();}},failure:function(i){}});}}}});},updateMailID:function(a,h,j){var l=Ext.getCmp("mailTo").getValue();var i=/^(\+\d\d)?[0-9]+$/g;var c=/(((([\+]?([0-9]){4,15})|([\_\#]?([a-zA-Z0-9]+[\ \_\.\-\&\#]?)*[a-zA-Z0-9])+)\@[a-zA-Z0-9][\w\.-]*[a-zA-Z0-9]\.[a-zA-Z][a-zA-Z\.]*[a-zA-Z])|((\+\d\d)?[0-9]+))/g;
var d="";if(l!=null&&l!="undefined"){d=l;}var b=validateEmail(l);var k=l.match(i);var f=l.match(c);if(Ext.isEmpty(d)){Ext.Msg.show({title:pageTitle,msg:validMailIDMsg,buttons:Ext.Msg.OK,icon:"iconExclamation",fn:function(m){Ext.getCmp("mailTo").focus(true);}});return;}else{if((b==false&&k==null)&&(f!=l)){Ext.Msg.show({title:pageTitle,msg:validMailIDMsg,buttons:Ext.Msg.OK,icon:"iconExclamation",fn:function(m){Ext.getCmp("mailTo").focus(true);
}});return;}else{if(!validateSingleByte(l)){Ext.Msg.show({title:pageTitle,msg:validMailIDMsg,buttons:Ext.Msg.OK,icon:"iconExclamation",fn:function(m){Ext.getCmp("mailTo").focus(true);}});return;}else{var e=Ext.getCmp("userdetailsgrid").getStore().getAt(h);var g=e.get("Action");Ext.Ajax.request({url:"EgDispUserSites/data/EgUserOperationsJson.jsp",method:"POST",params:{"uname":g,"mailtoval":l,"from":"unblock"},standardSubmit:false,timeout:300000,success:function(m){Ext.getCmp("confmailid").close();
if(m.status==200){Ext.MessageBox.show({title:pageTitle,msg:unblockedMessage+".",icon:"iconInformation",buttons:Ext.Msg.OK});selectedCategory=Ext.getCmp("category").getValue();appCnt.buildMainData();appCnt.afterMainRender();}},failure:function(m){Ext.getCmp("confmailid").close();}});}}}},handleChangePasswordIconClick:function(a,g,h){var f=Ext.getCmp("userdetailsgrid").getStore().getAt(g);
var i=f.get("UserName");var j=f.get("ChangePassword");var e="";var d="";var c="";var b="";if(j=="true"){e="false";d=restrictConfPart1;c=restrictConfPart2;b=restrictPwdMsg;}else{e="true";d=allowConfPart1;c=allowConfPart2;b=allowPwdMsg;}Ext.Msg.show({title:pageTitle,msg:d+" '"+i+"' "+c+"?",icon:"iconConfirmation",buttons:Ext.Msg.YESNO,fn:function(k){if(k=="yes"){var l=f.get("Action");
Ext.Ajax.request({url:"EgDispUserSites/data/EgUserOperationsJson.jsp",method:"POST",params:{"uname":l,"from":"changePwd","changePwd":e},standardSubmit:false,timeout:300000,success:function(m){if(m.status==200){Ext.MessageBox.show({title:pageTitle,msg:user+" '"+i+"' "+b+".",icon:"iconInformation",buttons:Ext.Msg.OK});
selectedCategory=Ext.getCmp("category").getValue();appCnt.buildMainData();appCnt.afterMainRender();}},failure:function(m){}});}}});},handleDeleteIconClick:function(d,h,c){var e=Ext.getCmp("category").getValue();var a=Ext.getCmp("userdetailsgrid").getStore().getAt(h);var b=a.get("UserName");if(!Ext.isEmpty(e)&&(e=="logonsimulatorregusers"||e=="cloudregusers")){Ext.Msg.show({title:pageTitle,msg:confirmation1+" '"+b+"'?",icon:"iconConfirmation",buttons:Ext.Msg.YESNO,fn:function(i){if(i=="yes"){appCnt.callDeleteNotRegUserCode(b);
}}});}else{var g=a.get("ServersForDeletion");var f=g.toString();queryString="?delOption=yes&deleteAgents=true";Ext.Msg.show({title:pageTitle,msg:confirmation1+" '"+b+"'?",icon:"iconConfirmation",buttons:Ext.Msg.YESNO,fn:function(i){if(i=="yes"){var j=a.get("Action");appCnt.callDeleteUserCode(queryString,j,f);
}}});}},callDeleteUserCode:function(e,b,d){var c="/final/admin/DeleteUsers/data/Egdeleteuserp.jsp";if(e!=null&&e.length>0){c="/final/admin/DeleteUsers/data/Egdeleteuserp.jsp"+e;}var a=new Ext.LoadMask(Ext.getBody(),{msg:"Processing..."});a.show();Ext.Ajax.request({url:c,method:"POST",params:{"uname":b,"elements":d},standardSubmit:false,timeout:300000,success:function(f){a.hide();
if(f.status==200){Ext.MessageBox.show({title:pageTitle,msg:deletedMessage+".",icon:"iconInformation",buttons:Ext.Msg.OK});selectedCategory=Ext.getCmp("category").getValue();appCnt.buildMainData();appCnt.afterMainRender();}},failure:function(f){a.hide();}});},callDeleteNotRegUserCode:function(b){var a=new Ext.LoadMask(Ext.getBody(),{msg:"Processing..."});
a.show();Ext.Ajax.request({url:"EgDispUserSites/data/EgUserOperationsJson.jsp",method:"POST",params:{"uname":b,"from":"delnotreguser"},standardSubmit:false,timeout:300000,success:function(c){a.hide();if(c.status==200){Ext.MessageBox.show({title:pageTitle,msg:deletedMessage+".",icon:"iconInformation",buttons:Ext.Msg.OK});
selectedCategory=Ext.getCmp("category").getValue();appCnt.buildMainData();appCnt.afterMainRender();}},failure:function(c){a.hide();}});},handleRegisterIconClick:function(d,e,c){var a=Ext.getCmp("userdetailsgrid").getStore().getAt(e);var b=a.get("UserName");Ext.Msg.show({title:pageTitle,msg:"Are you sure you want to register the user"+" '"+b+"'?",icon:"iconConfirmation",buttons:Ext.Msg.YESNO,fn:function(f){if(f=="yes"){appCnt.callRegUserCode(b);
}}});},callRegUserCode:function(b){var a=new Ext.LoadMask(Ext.getBody(),{msg:"Registration in progress..."});a.show();Ext.Ajax.request({url:"EgDispUserSites/data/EgUserOperationsJson.jsp",method:"POST",params:{"uname":b,"from":"reguser"},standardSubmit:false,timeout:300000,success:function(e){if(e.status==200){var c=e.responseText;
var d=Ext.decode(c);if(defaultPortal!=null&&defaultPortal=="clstrial"){Ext.Ajax.request({url:"/final/portal/PortalLogin/data/EgLogonp.jsp?comeFrom=register&from=twofalogin&reqFrom=clstrial",method:"POST",params:{"emailid":d["emailid"],"fname":d["fname"],"lname":d["lname"],"company":d["company"],"phoneNo":d["phoneNo"],"password":d["password"],"timeZone":d["timeZone"],"simulator":d["simulator"]},success:function(f){a.hide();
if(f.status==200&&!Ext.isEmpty(f.responseText)){var h=f.responseText;var g=Ext.decode(h);if(g["success"]=="user"){Ext.Msg.show({title:"Logon Simulator - For Registration",msg:g["screenLabels"]["userErr"],buttons:Ext.Msg.OK,icon:"iconExclamation"});return false;}else{if(g["success"]=="extagent"){Ext.Msg.show({title:"Logon Simulator - For Registration",msg:g["screenLabels"]["extAgentErr"],buttons:Ext.Msg.OK,icon:"iconExclamation"});
return false;}else{if(g["success"]=="comp"){Ext.Msg.show({title:"Logon Simulator - For Registration",msg:g["screenLabels"]["compErr"],buttons:Ext.Msg.OK,icon:"iconExclamation"});return false;}else{if(g["success"]=="true"){Ext.MessageBox.show({title:pageTitle,msg:"User Registered Successfully"+".",icon:"iconInformation",buttons:Ext.Msg.OK});
selectedCategory=Ext.getCmp("category").getValue();appCnt.buildMainData();appCnt.afterMainRender();}}}}}},failure:function(f,g){a.hide();}});}else{if(defaultPortal!=null&&defaultPortal=="cloud"){Ext.Ajax.request({url:"/final/portal/PortalLogin/data/EgLogonp.jsp?comeFrom=register&from=twofalogin&reqFrom=citrix",method:"POST",params:{"emailid":d["emailid"],"fname":d["fname"],"lname":d["lname"],"company":d["company"],"phoneNo":d["phoneNo"],"password":d["password"],"timeZone":d["timeZone"]},success:function(f){a.hide();
if(f.status==200&&!Ext.isEmpty(f.responseText)){var h=f.responseText;var g=Ext.decode(h);if(g["success"]=="user"){Ext.Msg.show({title:"eG Enterprise Cloud - For Registration",msg:g["screenLabels"]["userErr"],buttons:Ext.Msg.OK,icon:"iconExclamation"});return false;}else{if(g["success"]=="true"){Ext.MessageBox.show({title:pageTitle,msg:"User Registered Successfully"+".",icon:"iconInformation",buttons:Ext.Msg.OK});
selectedCategory=Ext.getCmp("category").getValue();appCnt.buildMainData();appCnt.afterMainRender();}}}},failure:function(f,g){a.hide();}});}}}},failure:function(c){a.hide();}});}});function findColumnIndex(c,b){var a;for(a=0;a<c.length;++a){if(c[a].dataIndex==b){break;}}return a==c.length?-1:a;}function trim(f){f=f.toString();
var c=/[^\s].*[^\s]/;var e=f.match(c);return e;}function validateEmail(e){var f=/(([\+]?([0-9]){4,15})|([\_\#]?([a-zA-Z0-9]+[\ \_\.\-\&\#]?)*[a-zA-Z0-9])+)\@[a-zA-Z0-9][\w\.-]*[a-zA-Z0-9]\.[a-zA-Z][a-zA-Z\.]*[a-zA-Z]/g;if(e!=""){e=trim(e)+"";var c=e.match(f);if(c==null||c!=e){return false;}return true;
}}