Ext.define("MailAlertFilter.controller.Main",{extend:"Ext.app.Controller",requires:["MailAlertFilter.view.Main","MailAlertFilter.view.EgMailAlertSuppress","Ext.ux.form.MultiSelectSI","Ext.ux.form.ItemSelectorSI","utilities.ScrollCombo",],views:["Main"],refs:[{selector:"main",ref:"main"},{selector:"egmailalertsuppress",ref:"egmailalertsuppress"}],init:function(){appCnt=this;
this.buildMainData();this.control({"main":{"boxready":this.afterMainRender},'main button[id="backButton"]':{"click":this.goBack},'egmailalertsuppress combo[id="filter"]':{"select":this.popFilterDetails},'egmailalertsuppress combo[id="CompTypes"]':{"select":this.popCompTypes},'egmailalertsuppress combo[id="TestTypes"]':{"select":this.popTestTypes},'egmailalertsuppress combo[id="compTypesIn"]':{"select":this.viewByCriteria},'egmailalertsuppress combo[id="serseg"]':{"select":this.changeByServer},'egmailalertsuppress combo[id="Test"]':{"select":this.changeByTest},'egmailalertsuppress multiselectSi[id="compName"]':{"change":this.changeByComponentName},'egmailalertsuppress button[id="includeMore"]':{"click":this.assignAndAddMoreFilters},'egmailalertsuppress button[id="mailSubmit"]':{"click":this.submitUserFilterElements},'egmailalertsuppress button[id="btnViewFilters"]':{"click":this.viewFilteredElements},'egmailalertsuppress button[id="componentExpander"]':{"click":this.showComponentSelector},'egmailalertsuppress trigger[name="searchbox"]':{"change":this.egTitleSearch}});
},buildMainData:function(){Ext.Ajax.request({url:appURL,async:false,method:"POST",success:function(a){var c=a.responseText;publicJSON=Ext.decode(c);var b=publicJSON.isFilterControlEnabled;if(b){mailFilterOption=publicJSON.filterControlDefaultSelection;}}});},setMeasureInMailMode:function(e){var d=e.getValue().msgmode;
var a=Ext.getCmp("measure_in_mail_mode");var c=publicJSON["mailAlertSettings"]["measure_in_mail_mode"];var b=publicJSON["mailAlertSettings"]["selectedMailMode"];a.getStore().loadRawData(c);if(b!=null&&b=="DATA"){a.setValue(b);}else{a.setValue(a.getStore().getAt(0).get("valueField"));}if(d=="T"){a.getStore().removeAt(2);
}},submitUserFilterElements:function(i){var m=this;i.setDisabled(true);if(mailFilterOption=="Descriptors_Only"){var j="EgChangeUserProfile/data/EgMailAlertIncludeSuppresspJson.jsp?reqfrom="+reqFrom+"&userID="+encodeURIComponent(filterEncode(selectedUserValID));m.setFilterValues("finish");var e=Ext.getCmp("exclude");
var p=new Array();var d=new Array();var a=e.fromField.store;var k=e.toField.store;for(var l=0;l<a.getCount();l++){var c=a.getAt(l).get("valueField");d.push(c);}for(var l=0;l<k.getCount();l++){var c=k.getAt(l).get("valueField");p.push(c);}if(d.length==0&&p.length==0){Ext.Msg.alert(pageIntnl82,"Please select the required parameters to Exclude/Include");
i.setDisabled(false);return;}var o=Ext.getCmp("compName").getValue();j=j+"&compNames="+encodeURIComponent(o);var h=userMailJSON["hiddenFields"];var b=m.getHiddenFields(h);var g=m.getEgmailalertsuppress().getForm();var f=new Ext.LoadMask(Ext.getBody(),{msg:"Updating..."});f.show();if(g.isValid()){this.getEgmailalertsuppress().submit({url:j+"&"+b,method:"POST",success:function(q,r){f.hide();
Ext.Msg.show({title:pageIntnl82,msg:pageIntnl99,buttons:Ext.Msg.OK,width:400,icon:"iconInformation",fn:function(){m.showUserAddForm();}});},failure:function(q,r){f.hide();}});}}else{var n=Ext.getCmp("filter").getValue();var j="EgChangeUserProfile/data/EgMailAlertSuppresspJson.jsp?reqfrom="+reqFrom+"&userID="+encodeURIComponent(filterEncode(selectedUserValID));
m.setFilterValues("finish");if(n=="filterByDescriptor"){var o=Ext.getCmp("compName").getValue();j=j+"&compNames="+encodeURIComponent(o);}var h=userMailJSON["hiddenFields"];var b=m.getHiddenFields(h);var g=m.getEgmailalertsuppress().getForm();var f=new Ext.LoadMask(Ext.getBody(),{msg:"Updating..."});f.show();
if(g.isValid()){this.getEgmailalertsuppress().submit({url:j+"&"+b,method:"POST",success:function(q,r){f.hide();Ext.Msg.show({title:pageIntnl82,msg:pageIntnl99,buttons:Ext.Msg.OK,width:400,icon:"iconInformation",fn:function(){window.location.href="/final/admin/userProfile.jsp";}});},failure:function(q,r){f.hide();
window.location.href="/final/admin/userProfile.jsp";}});}}i.setDisabled(false);},assignAndAddMoreFilters:function(i){var m=this;i.setDisabled(true);if(mailFilterOption=="Descriptors_Only"){var n=Ext.getCmp("filter").getValue();var j="EgChangeUserProfile/data/EgMailAlertIncludeSuppresspJson.jsp?reqfrom="+reqFrom+"&userID="+encodeURIComponent(filterEncode(selectedUserValID));
var o=Ext.getCmp("compName").getValue();j=j+"&compNames="+encodeURIComponent(o);var e=Ext.getCmp("exclude");var p=new Array();var d=new Array();var a=e.fromField.store;var k=e.toField.store;for(var l=0;l<a.getCount();l++){var c=a.getAt(l).get("valueField");d.push(c);}for(var l=0;l<k.getCount();l++){var c=k.getAt(l).get("valueField");
p.push(c);}if(d.length==0&&p.length==0){Ext.Msg.alert(pageIntnl82,"Please select the required parameters to Exclude/Include");i.setDisabled(false);return;}m.setFilterValues("addMore");var h=userMailJSON["hiddenFields"];var b=m.getHiddenFields(h);var g=m.getEgmailalertsuppress().getForm();var f=new Ext.LoadMask(Ext.getBody(),{msg:"Updating..."});
f.show();if(g.isValid()){this.getEgmailalertsuppress().submit({url:j+"&"+b,method:"POST",success:function(q,r){f.hide();m.showResultText();},failure:function(q,r){f.hide();}});}}else{var n=Ext.getCmp("filter").getValue();var j="EgChangeUserProfile/data/EgMailAlertSuppresspJson.jsp?reqfrom="+reqFrom+"&userID="+encodeURIComponent(filterEncode(selectedUserValID));
if(n=="-1"){Ext.MessageBox.alert(pageIntnl82,pageIntnl90);i.setDisabled(false);return;}if(n=="filterByDescriptor"){var o=Ext.getCmp("compName").getValue();j=j+"&compNames="+encodeURIComponent(o);}m.setFilterValues("addMore");var h=userMailJSON["hiddenFields"];var b=m.getHiddenFields(h);var g=m.getEgmailalertsuppress().getForm();
var f=new Ext.LoadMask(Ext.getBody(),{msg:"Updating..."});f.show();if(g.isValid()){this.getEgmailalertsuppress().submit({url:j+"&"+b,method:"POST",success:function(q,r){f.hide();m.showResultText();},failure:function(q,r){f.hide();}});}}i.setDisabled(false);},showResultText:function(){if(Ext.getCmp("resultCt")==null||Ext.getCmp("resultCt")==undefined){var a=Ext.create("Ext.container.Container",{floatable:true,floating:true,id:"resultCt",width:380,items:[{xtype:"component",padding:0,margin:5,cls:"popupAlertUser",html:'<table border="0" width="100%"><tr><td><div class="iconRight" style="margin:4px;float:left"></div><div style="margin:4px;float:left">Changes have been updated successfully.</div><div class="iconClosePopup" style="float:right;margin:4px"></div><td></tr></table>',}]});
var c=Ext.Element.getViewportWidth();a.showAt(c-410,85);Ext.select(".iconClosePopup").on("click",function(){a.destroy();},this);var b=new Ext.util.DelayedTask(function(){a.destroy();});b.delay(2000);}},setFilterValues:function(d){var h=userMailJSON["hiddenFields"];var j=Ext.getCmp("hiddenFieldsContainer");
var g=Ext.getCmp("exclude");var i=new Array();var b=new Array();var a=g.fromField.store;var l=g.toField.store;for(var m=0;m<a.getCount();m++){var c=a.getAt(m).get("valueField");b.push(c);}for(var m=0;m<l.getCount();m++){var c=l.getAt(m).get("valueField");i.push(c);}if(userMailJSON["excludedBoxHostVal"]&&userMailJSON["excludedBoxHostVal"]!=undefined){var k=userMailJSON["excludedBoxHostVal"];
if(k!=null&&k!=""){b[b.length]=k;}}if(mailFilterOption=="Descriptors_Only"){var o={xtype:"hiddenfield",name:"excludedBoxVal",value:i};var f={xtype:"hiddenfield",name:"includedBoxVal",value:b};var n={xtype:"hiddenfield",name:"control",value:d};}else{var o={xtype:"hiddenfield",name:"includedBoxVal",value:i};
var f={xtype:"hiddenfield",name:"excludedBoxVal",value:b};var n={xtype:"hiddenfield",name:"control",value:d};}j.removeAll();j.add(o);j.add(f);j.add(n);var e={xtype:"hiddenfield",name:"previousExcVal",value:h.previousExcVal};j.add(e);},goBack:function(){window.location.href="/final/admin/userProfile.jsp";
},afterMainRender:function(){var b=Ext.getCmp("main");var d=Ext.getCmp("egmailalertsuppress");if(reqfrom!="navlink"&&reqfrom!="adduser"){Ext.getCmp("backButton").show();}var e=this;b.setTitle(pageTitle4+" '"+selectedUserID+"'");var a=selectedUserID;var c="EgChangeUserProfile/data/EgMailAlertSuppressJson.jsp?userID="+encodeURIComponent(filterEncode(selectedUserValID))+"&mailFilterOption="+mailFilterOption+"&reqfrom="+reqFrom+"&date="+new Date().getTime();
e.updateUserMailSuppressList(c);e.updateFilterComponents();var f=userMailJSON.isComponentsAssociated;if(f){if(mailFilterOption=="Descriptors_Only"){if(Ext.getCmp("egmailalertsuppress")!=undefined){Ext.getCmp("filter").hide();Ext.getCmp("filterLabelID").show();e.showFilterDetails();Ext.getCmp("btnViewFilters").setText(pageIntnl97);
}}else{if(Ext.getCmp("egmailalertsuppress")!=undefined){Ext.getCmp("filter").show();Ext.getCmp("filterLabelID").hide();Ext.getCmp("btnViewFilters").setText(pageIntnl87);}}}e.initUserMailConfigs();},getHiddenFields:function(b){var a="";for(key in b){if((key=="previousSelectedValue"||key=="previousVMs"||key=="previouscomponents"||key=="previoussegments"||key=="previousservicegroup"||key=="previousservices"||key=="previouszones"||key=="previousExcVal")&&!Ext.isEmpty(key)){continue;
}if(key=="vsTypes"){continue;}a+=key+"="+encodeURIComponent(b[key])+"&";}return a;},updateFilterComponents:function(){var d=this;var b=Ext.getCmp("main");var f=userMailJSON.isComponentsAssociated;if(f==true){var e=Ext.getCmp("egmailalertsuppress");if(e==null||e=="undefined"||e==undefined){b.removeAll();
b.add({xtype:"egmailalertsuppress"});}Ext.getCmp("filterUserID").setValue(selectedUserID);}else{var a=userMailJSON["userID"];var c='<div class = "iconInformation" style="margin:0 auto"></div><div>No components have been associated for <b>\''+a+"'</b></div>";b.removeAll();b.add({xtype:"panel",border:false,padding:160,style:{"text-align":"center"},html:c});
}},setLangEntries:function(c){for(var a in c){var b=Ext.getCmp(a);if(b==null||b=="undefined"){continue;}if(b.getXType()=="checkboxfield"||b.getXType()=="radiofield"){if(b.boxLabelEl==null||b.boxLabelEl==undefined||b.boxLabelEl=="undefined"){continue;}b.boxLabelEl.update(c[a]);}else{b.setFieldLabel(c[a]);
}}},initUserMailConfigs:function(){var f=this;var g=userMailJSON.requestStatus;if(g=="success"){var e=selectedUserID;this.setLangEntries(userMailJSON.langEntries);var b=userMailJSON.filters;var a=userMailJSON.isComponentsAssociated;if(a==true){var h=Ext.getCmp("filter");h.getStore().loadRawData(b);h.setValue("-1");
Ext.getCmp("CompTypes").hide();var c=Ext.getCmp("exclude");if(c.fromField.store.getCount()>0){c.fromField.store.removeAll();}if(c.toField.store.getCount()>0){c.toField.store.removeAll();}}else{var d=Ext.getCmp("main");var e=selectedUserID;var i='<div class = "iconInformation" style="margin:0 auto"></div><div>No components have been associated for <b>\''+e+"'</b></div>";
d.removeAll();d.add({xtype:"component",border:false,padding:160,style:{"text-align":"center"},html:i});}}else{var d=Ext.getCmp("main");var i=f.getErrorMessageTemplate(userMailJSON.errors);d.removeAll();d.add({xtype:"component",border:false,padding:160,style:{"text-align":"center"},html:i});}},getErrorMessageTemplate:function(d){var a='<div class="x-table"><table cellspacing="0" width="100%" cellpadding="5" border="0" align="center" class="x-grid-table" style="border:1px solid #c3c3c3"><thead><tr class="x-grid-row"><th class=" x-grid-cell x-grid-cell-first"><div class="x-grid-cell-inner">Error</div></td></tr></thead>';
for(var c in d){if(c=="title"){continue;}var b=d[c];a=a+'<tr class="x-grid-row"><td class=" x-grid-cell x-grid-cell-first"><div class="x-grid-cell-inner" >'+b+"</div></td></tr>";}a=a+"</table></div>";return a;},updateFilterResultPanel:function(){var g=this;var i=Ext.getCmp("userFilterContainer");var b=userMailJSON.filters;
i.removeAll();if(userMailJSON["isFiltersAvailable"]!=null&&userMailJSON["isFiltersAvailable"]!=undefined&&userMailJSON["isFiltersAvailable"]==true){var a=userMailJSON.excludedElements;var h=userMailJSON.gridHeaderMapping;for(var j in a){var c=a[j];if(j=="excludedComponents"||j=="allExcludedLayersByType"||j=="exculdedTestsForAllTypes"||j=="exculdedDescriptor"){var d=h[j];
if(c==""||c.length==0){continue;}var e={xtype:"panel",cls:"outerpanel",border:false,width:"95%",title:d,html:c};i.add(e);}else{var d=h[j];if(Ext.isEmpty(c)){continue;}var f=g.getGridPanel(c,d);i.add(f);}}i.doLayout();}else{var k='<div class = "iconInformation" style="margin:0 auto"></div><div>No elements are excluded for this user</b></div>';
var e={xtype:"component",border:false,padding:120,html:k};i.add(e);}Ext.getCmp("userFilterWindow").doLayout();},updateHTMLFilterResultPanel:function(b){var a=this;Ext.Ajax.request({url:b,method:"POST",success:function(c){var e=c.responseText;var d=Ext.getCmp("userFilterContainer");d.update(e);Ext.getCmp("userFilterWindow").doLayout();
delete e;delete d;}});},updateDescriptorHTMLFiltePanel:function(b){var a=this;Ext.Ajax.request({url:b,method:"POST",success:function(c){var e=c.responseText;var d=Ext.getCmp("userFilterContainer");d.update(e);Ext.getCmp("userFilterWindow").doLayout();delete e;delete d;}});},updateFilterResultPanel2:function(){var f=this;
var h=Ext.getCmp("userFilterContainer");var b=userMailJSON.filters;h.removeAll();if(userMailJSON["isFiltersAvailable"]!=null&&userMailJSON["isFiltersAvailable"]!=undefined&&userMailJSON["isFiltersAvailable"]==true){var a=userMailJSON.excludedElements;var g=userMailJSON.gridHeaderMapping;for(var i in a){var c=a[i];
if(i=="exculdedDescriptor"){var d=g[i];if(c==""||c.length==0){continue;}var e={xtype:"panel",cls:"outerpanel",border:false,width:"95%",title:d,html:c};h.add(e);}}}else{var j='<div class = "iconInformation" style="margin:0 auto"></div><div>No elements are included for this user</b></div>';var e={xtype:"component",border:false,padding:120,html:j};
h.add(e);}Ext.getCmp("userFilterWindow").doLayout();},getGridPanel:function(c,b){var f=new Array();f.push("compType_1");f.push("compType_2");f.push("compType_3");var h=new Array();var e=new Array();for(var d in f){var a=f[d];h.push({header:a,dataIndex:a,align:"left",flex:1});}var g=Ext.widget("usergridpanel",{store:new Ext.data.Store({fields:f,data:c}),sortableColumns:false,cls:"gridSkin",title:b,width:"95%",columns:h,viewConfig:{forceFit:true,stripeRows:false},sortable:false,hideable:false,hideHeaders:true});
return g;},showComponentSelector:function(){var a=this;if(Ext.getCmp("componentWinSelector")==undefined){var c=Ext.getCmp("compName").getStore();var b=Ext.create("Ext.window.Window",{title:"Components",id:"componentWinSelector",doClose:function(){this.destroy();},buttonAlign:"center",items:[{xype:"container",cls:"multisearchlist",width:580,layout:{type:"hbox",pack:"center"},margin:"5 5 0 5",items:[{xtype:"trigger",name:"componentSearch",id:"componentSearch",trigger1Cls:"x-form-clear-trigger",trigger2Cls:"x-form-search-trigger",cls:"whitedropdown_search",emptyText:"Search",margin:"5 5 5 5",labelAlign:"top",width:400,getTriggerMarkup:function(){var h=this,f=0,l=(h.readOnly||h.hideTrigger),d,j=h.triggerBaseCls,k=[],g=Ext.dom.Element.unselectableCls,e="width:"+h.triggerWidth+"px;"+(l?"display:none;":""),m=h.extraTriggerCls+" "+Ext.baseCSSPrefix+"trigger-cell "+g;
if(!h.trigger1Cls){h.trigger1Cls=h.triggerCls;}for(f=0;(d=h["trigger"+(f+1)+"Cls"])||f<1;f++){if(f==0){k.push({tag:"td",role:"presentation",valign:"top",cls:m,id:"MyTrigger_"+f,style:e+"display:none;",cn:{cls:[Ext.baseCSSPrefix+"trigger-index-"+f,j,d].join(" "),role:"presentation"}});}else{k.push({tag:"td",role:"presentation",valign:"top",cls:m,id:"MyTrigger_"+f,style:e,cn:{cls:[Ext.baseCSSPrefix+"trigger-index-"+f,j,d].join(" "),role:"presentation"}});
}}k[0].cn.cls+=" "+j+"-first";return Ext.DomHelper.markup(k);},onTrigger1Click:function(){this.reset();},onTriggerClick:function(){a.egTitleSearch(this.getValue());},listeners:{specialkey:function(f,d){if(d.getKey()==d.ENTER){a.egTitleSearch(f.getValue());}}}}]},{xtype:"multiselectfieldSi",margin:"0 5 5 5",autoScroll:true,scroll:true,name:"multiselect",id:"componentClonedID",store:c,value:Ext.getCmp("compName").getValue(),displayField:"displayField",valueField:"valueField",queryMode:"local",width:580,height:230}],buttons:[{text:"Select",id:"expand",cls:"button20",name:"expand",handler:function(){if(Ext.getCmp("componentClonedID").getValue()!=""){var d=Ext.getCmp("componentClonedID").getValue();
Ext.getCmp("compName").setValue(d);b.destroy();}}}]}).show();}},egTitleSearch:function(c){var k=c.value;var j=Ext.getCmp("compName").getStore();var l=compNameArrTemp;var f=Ext.getCmp("compName");var b=Ext.getCmp("exclude");b.getStore().removeAll();if(b.fromField.store.getCount()>0){b.fromField.store.removeAll();
}if(b.toField.store.getCount()>0){b.toField.store.removeAll();}if(Ext.isEmpty(k)){Ext.get("MyTrigger_searchbox_0").setStyle("display","none");Ext.get("MyTrigger_searchbox_1").setStyle("display","block");f.getStore().loadRawData(compNameArrTemp);}else{Ext.get("MyTrigger_searchbox_1").setStyle("display","none");
Ext.get("MyTrigger_searchbox_0").setStyle("display","block");var f=Ext.getCmp("compName");var d=k;var g=false;var e=new Array();for(var h=0;h<l.length;h++){var a=l[h]["displayField"];if(a.toLowerCase().indexOf(d.toLowerCase())>-1){g=true;e.push({"displayField":l[h]["displayField"],"valueField":l[h]["valueField"],});
}}f.getStore().removeAll();if(g){f.getStore().loadRawData(e);}else{f.store.loadData({"displayField":"No data found","valueField":"-1",},true);}Ext.getCmp("searchbox").focus();}},popFilterDetails:function(e){var b=this;var c="EgChangeUserProfile/data/EgMailAlertSuppressJson.jsp?userID="+encodeURIComponent(filterEncode(selectedUserValID))+"&mailFilterOption="+mailFilterOption+"&reqfrom="+reqFrom;
var a=e.getValue();if(a!="-1"){c=c+"&filterBy="+a;if(a=="filterByCName"||a=="filterByDescriptor"){c=c+"&serverType=-1";}else{if(a=="filterByLayer"||a=="filterByTest"){c=c+"&serverType=filterByAll";}}c=c+"&date="+new Date().getTime();Ext.Ajax.request({url:c,method:"POST",success:function(i){userMailJSON=Ext.decode(i.responseText);
var h=Ext.getCmp("exclude");var m=userMailJSON["includedAlerts"];var o=userMailJSON["excludedAlerts"];h.getStore().removeAll();if(h.fromField.store.getCount()>0){h.fromField.store.removeAll();}if(h.toField.store.getCount()>0){h.toField.store.removeAll();}if(!Ext.isEmpty(o)){h.fromField.store.add(o);}if(!Ext.isEmpty(m)){h.toField.store.add(m);
}var p=Ext.getCmp("CompTypes");var j=Ext.getCmp("compTypesIn");var n=Ext.getCmp("serverTestsOuterCt");p.hide();j.hide();n.hide();Ext.getCmp("serseg").hide();if(a=="filterByCName"||a=="filterByLayer"||a=="filterByTest"||a=="filterByDescriptor"){var l=Ext.getCmp("CompTypes");var k=userMailJSON["compopnentTypes"];
l.getStore().loadRawData(k);if(a=="filterByCName"||a=="filterByDescriptor"){l.setValue("-1");}else{l.setValue("filterByAll");}if(userMailJSON.isOtherGroupsFound){j.getStore().loadRawData(userMailJSON.viewBy);j.setValue(userMailJSON.displayText);j.show();if(j.getValue()!="cType"){Ext.getCmp("serseg").show();
}}else{j.hide();}p.show();if(a=="filterByDescriptor"){var g=Ext.getCmp("Test");Ext.getCmp("compName").getStore().removeAll();n.show();Ext.getCmp("searchbox").setDisabled(true);Ext.getCmp("searchbox").setValue("");g.show();g.getStore().removeAll();g.getStore().loadRawData(userMailJSON.testArray);g.setValue("-1");
}}var f=Ext.getCmp("TestTypes");if(isConfigEnabled=="true"){if(a=="filterByTest"){f.show();f.getStore().removeAll();f.getStore().loadRawData(userMailJSON.testTypesArr);f.setValue("performance");}else{f.hide();}}else{f.hide();}h.fromField.getComponent(0).setTitle(userMailJSON["itemTitle1"]);h.toField.getComponent(0).setTitle(userMailJSON["itemTitle2"]);
}});}else{Ext.suspendLayouts();var d=Ext.getCmp("exclude");d.fromField.getComponent(0).setTitle("Excluded from alerts");d.toField.getComponent(0).setTitle("Included for alerts");Ext.getCmp("CompTypes").hide();Ext.getCmp("compTypesIn").hide();Ext.getCmp("serseg").hide();Ext.getCmp("serverTestsOuterCt").hide();
Ext.resumeLayouts(true);}},showFilterDetails:function(c){var a=this;var b="EgChangeUserProfile/data/EgMailAlertIncludeSuppressJson.jsp?selectedTab=4&userID="+encodeURIComponent(filterEncode(selectedUserValID))+"&mailFilterOption="+mailFilterOption+"&filterBy=filterByDescriptor&reqfrom="+reqFrom;Ext.Ajax.request({url:b,method:"POST",success:function(f){userMailJSON=Ext.decode(f.responseText);
var e=Ext.getCmp("exclude");var j=userMailJSON["includedAlerts"];var l=userMailJSON["excludedAlerts"];e.getStore().removeAll();if(e.fromField.store.getCount()>0){e.fromField.store.removeAll();}if(e.toField.store.getCount()>0){e.toField.store.removeAll();}if(!Ext.isEmpty(l)){e.fromField.store.add(l);}if(!Ext.isEmpty(j)){e.toField.store.add(j);
}var m=Ext.getCmp("CompTypes");var g=Ext.getCmp("compTypesIn");var k=Ext.getCmp("serverTestsOuterCt");m.hide();g.hide();k.hide();Ext.getCmp("serseg").hide();var i=Ext.getCmp("CompTypes");var h=userMailJSON["compopnentTypes"];i.getStore().loadRawData(h);i.setValue("-1");if(userMailJSON.isOtherGroupsFound){g.getStore().loadRawData(userMailJSON.viewBy);
g.setValue(userMailJSON.displayText);g.show();if(g.getValue()!="cType"){Ext.getCmp("serseg").show();}}else{g.hide();}m.show();var d=Ext.getCmp("Test");Ext.getCmp("compName").getStore().removeAll();k.show();d.show();d.getStore().removeAll();d.getStore().loadRawData(userMailJSON.testArray);d.setValue("-1");
}});},viewByCriteria:function(d){var b=d.getValue();var c=Ext.getCmp("filter");var i=c.getValue();var e=Ext.getCmp("serseg");var a=Ext.getCmp("Test");var h=Ext.getCmp("CompTypes");var f="";var g=this;if(mailFilterOption=="Descriptors_Only"){f="2:31 EgChangeUserProfile/data/EgMailAlertIncludeSuppressJson.jsp?selectedTab=4&userID="+encodeURIComponent(filterEncode(selectedUserValID))+"&mailFilterOption="+mailFilterOption+"&reqfrom="+reqFrom;
f=f+"&filterBy=filterByDescriptor&compTypesIn="+encodeURIComponent(b)+"&date="+new Date().getTime();Ext.Ajax.request({url:f,method:"POST",success:function(j){userMailJSON=Ext.decode(j.responseText);var m=Ext.getCmp("exclude");var k=userMailJSON["includedAlerts"];var l=userMailJSON["excludedAlerts"];m.getStore().removeAll();
if(m.fromField.store.getCount()>0){m.fromField.store.removeAll();}if(m.toField.store.getCount()>0){m.toField.store.removeAll();}if(b!="cType"){e.setFieldLabel(userMailJSON.trDisplayText);e.getStore().loadRawData(userMailJSON.viewByType);e.setValue(userMailJSON.selectedGrpText);e.show();h.getStore().removeAll();
h.getStore().loadData([{"displayField":"Not Applicable","valueField":"-1"}]);a.getStore().removeAll();a.getStore().loadData([{"displayField":"Not Applicable","valueField":"-1"}]);Ext.getCmp("compName").getStore().removeAll();Ext.getCmp("searchbox").setDisabled(true);Ext.getCmp("searchbox").setValue("");
}else{g.popFilterDetails(c);e.hide();}if(h.getStore().getCount()>0){h.setValue(h.getStore().getAt(0));}if(a.getStore().getCount()>0){a.setValue(a.getStore().getAt(0));}if(mailFilterOption=="Descriptors_Only"){m.fromField.getComponent(0).setTitle(pageIntnl95);m.toField.getComponent(0).setTitle(pageIntnl96);
}}});}else{f="EgChangeUserProfile/data/EgMailAlertSuppressJson.jsp?selectedTab=4&userID="+encodeURIComponent(filterEncode(selectedUserValID))+"&mailFilterOption="+mailFilterOption+"&reqfrom="+reqFrom;f=f+"&filterBy="+i+"&compTypesIn="+encodeURIComponent(b)+"&date="+new Date().getTime();Ext.Ajax.request({url:f,method:"POST",success:function(j){userMailJSON=Ext.decode(j.responseText);
var m=Ext.getCmp("exclude");var k=userMailJSON["includedAlerts"];var l=userMailJSON["excludedAlerts"];m.getStore().removeAll();if(m.fromField.store.getCount()>0){m.fromField.store.removeAll();}if(m.toField.store.getCount()>0){m.toField.store.removeAll();}if(b!="cType"){e.setFieldLabel(userMailJSON.trDisplayText);
e.getStore().loadRawData(userMailJSON.viewByType);e.setValue(userMailJSON.selectedGrpText);e.show();h.getStore().removeAll();h.getStore().loadData([{"displayField":"Not Applicable","valueField":"-1"}]);a.getStore().removeAll();a.getStore().loadData([{"displayField":"Not Applicable","valueField":"-1"}]);
Ext.getCmp("compName").getStore().removeAll();Ext.getCmp("searchbox").setDisabled(true);Ext.getCmp("searchbox").setValue("");}else{g.popFilterDetails(c);e.hide();}if(h.getStore().getCount()>0){h.setValue(h.getStore().getAt(0));}if(a.getStore().getCount()>0){a.setValue(a.getStore().getAt(0));}if(mailFilterOption=="Descriptors_Only"){m.fromField.getComponent(0).setTitle(pageIntnl95);
m.toField.getComponent(0).setTitle(pageIntnl96);}}});}},changeByServer:function(f){var d=f.getValue();var a=Ext.getCmp("filter").getValue();var c=Ext.getCmp("compTypesIn").getValue();var b=Ext.getCmp("CompTypes");var g=Ext.getCmp("Test");var e="";if(mailFilterOption=="Descriptors_Only"){e="EgChangeUserProfile/data/EgMailAlertIncludeSuppressJson.jsp?selectedTab=4&userID="+encodeURIComponent(filterEncode(selectedUserValID))+"&mailFilterOption="+mailFilterOption+"&reqfrom="+reqFrom;
e=e+"&filterBy=filterByDescriptor&compTypesIn="+encodeURIComponent(c)+"&serseg="+encodeURIComponent(d)+"&date="+new Date().getTime();}else{e="EgChangeUserProfile/data/EgMailAlertSuppressJson.jsp?selectedTab=4&userID="+encodeURIComponent(filterEncode(selectedUserValID))+"&mailFilterOption="+mailFilterOption+"&reqfrom="+reqFrom;
e=e+"&filterBy="+a+"&compTypesIn="+encodeURIComponent(c)+"&serseg="+encodeURIComponent(d)+"&date="+new Date().getTime();}Ext.Ajax.request({url:e,method:"POST",success:function(h){userMailJSON=Ext.decode(h.responseText);var i=Ext.getCmp("exclude");i.getStore().removeAll();if(i.fromField.store.getCount()>0){i.fromField.store.removeAll();
}if(i.toField.store.getCount()>0){i.toField.store.removeAll();}b.getStore().loadRawData(userMailJSON.compopnentTypes);if(d=="-1"){b.getStore().removeAll();b.getStore().loadData([{"displayField":"Not Applicable","valueField":"-1"}]);}g.getStore().removeAll();g.getStore().loadData([{"displayField":"Not Applicable","valueField":"-1"}]);
Ext.getCmp("compName").getStore().removeAll();Ext.getCmp("searchbox").setDisabled(true);Ext.getCmp("searchbox").setValue("");if(b.getStore().getCount()>0){b.setValue(b.getStore().getAt(0));}if(g.getStore().getCount()>0){g.setValue(g.getStore().getAt(0));}if(mailFilterOption=="Descriptors_Only"){i.fromField.getComponent(0).setTitle(pageIntnl95);
i.toField.getComponent(0).setTitle(pageIntnl96);}}});},changeByTest:function(d){var i=d.getValue();var h=Ext.getCmp("filter").getValue();var b=Ext.getCmp("compTypesIn").getValue();var g=Ext.getCmp("CompTypes").getValue();var a=Ext.getCmp("serseg").getValue();var f="no";if(isConfigEnabled=="true"){var c=Ext.getCmp("TestTypes").getValue();
if(c=="configuration"){f="yes";}}var e="";if(mailFilterOption=="Descriptors_Only"){e="EgChangeUserProfile/data/EgMailAlertIncludeSuppressJson.jsp?selectedTab=4&userID="+encodeURIComponent(filterEncode(selectedUserValID))+"&mailFilterOption="+mailFilterOption+"&reqfrom="+reqFrom;e=e+"&filterBy=filterByDescriptor&compTypesIn="+encodeURIComponent(b)+"&serseg="+encodeURIComponent(a)+"&serverType="+encodeURIComponent(g)+"&Test="+encodeURIComponent(i)+"&date="+new Date().getTime();
}else{e="EgChangeUserProfile/data/EgMailAlertSuppressJson.jsp?selectedTab=4&userID="+encodeURIComponent(filterEncode(selectedUserValID))+"&mailFilterOption="+mailFilterOption+"&reqfrom="+reqFrom+"&configTestType="+f;e=e+"&filterBy="+h+"&compTypesIn="+encodeURIComponent(b)+"&serseg="+encodeURIComponent(a)+"&serverType="+encodeURIComponent(g)+"&Test="+encodeURIComponent(i)+"&date="+new Date().getTime();
}if(!Ext.isEmpty(i)&&i=="-1"){Ext.getCmp("searchbox").setDisabled(true);Ext.getCmp("searchbox").setValue("");}else{Ext.getCmp("searchbox").setDisabled(false);Ext.getCmp("searchbox").setValue("");}Ext.Ajax.request({url:e,method:"POST",success:function(k){userMailJSON=Ext.decode(k.responseText);var l=Ext.getCmp("exclude");
l.getStore().removeAll();if(l.fromField.store.getCount()>0){l.fromField.store.removeAll();}if(l.toField.store.getCount()>0){l.toField.store.removeAll();}var j=Ext.getCmp("compName");j.getStore().loadRawData(userMailJSON.compNameArr);compNameArrTemp=userMailJSON.compNameArr;if(mailFilterOption=="Descriptors_Only"){l.fromField.getComponent(0).setTitle(pageIntnl95);
l.toField.getComponent(0).setTitle(pageIntnl96);}}});},changeByComponentName:function(e){var j=e.getValue();if(j==""||j=="-1"){var a=Ext.getCmp("exclude");a.getStore().removeAll();if(a.fromField.store.getCount()>0){a.fromField.store.removeAll();}if(a.toField.store.getCount()>0){a.toField.store.removeAll();
}return;}var i=Ext.getCmp("filter").getValue();var k=Ext.getCmp("Test").getValue();var h=Ext.getCmp("CompTypes").getValue();var b=Ext.getCmp("compTypesIn");var g="";if(mailFilterOption=="Descriptors_Only"){g="EgChangeUserProfile/data/EgMailAlertIncludeSuppressJson.jsp?selectedTab=4&userID="+encodeURIComponent(filterEncode(selectedUserValID))+"&mailFilterOption="+mailFilterOption+"&reqfrom="+reqFrom;
g=g+"&filterBy=filterByDescriptor&compNames="+encodeURIComponent(j)+"&serverType="+encodeURIComponent(h)+"&Test="+encodeURIComponent(k);if(userMailJSON.isOtherGroupsFound==true){var c=b.getValue();g=g+"&compTypesIn="+c;if(b.getValue()!="cType"){var f=Ext.getCmp("serseg");if(f!=null&&f!=undefined){var d=f.getValue();
if(d!=null&&d!=undefined&&d!=""){g=g+"&serseg="+d;}}}}Ext.Ajax.request({url:g,method:"POST",success:function(l){userMailJSON=Ext.decode(l.responseText);var o=Ext.getCmp("exclude");o.getStore().removeAll();if(o.fromField.store.getCount()>0){o.fromField.store.removeAll();}if(o.toField.store.getCount()>0){o.toField.store.removeAll();
}var m=userMailJSON["includedAlerts"];var n=userMailJSON["excludedAlerts"];if(!Ext.isEmpty(m)){o.fromField.store.add(m);}if(!Ext.isEmpty(n)){o.toField.store.add(n);}if(mailFilterOption=="Descriptors_Only"){o.fromField.getComponent(0).setTitle(pageIntnl95);o.toField.getComponent(0).setTitle(pageIntnl96);
}}});}else{g="EgChangeUserProfile/data/EgMailAlertSuppressJson.jsp?selectedTab=4&userID="+encodeURIComponent(filterEncode(selectedUserValID))+"&mailFilterOption="+mailFilterOption+"&reqfrom="+reqFrom;g=g+"&filterBy="+i+"&compNames="+encodeURIComponent(j)+"&serverType="+encodeURIComponent(h)+"&Test="+encodeURIComponent(k);
if(userMailJSON.isOtherGroupsFound==true){var c=b.getValue();g=g+"&compTypesIn="+c;if(b.getValue()!="cType"){var f=Ext.getCmp("serseg");if(f!=null&&f!=undefined){var d=f.getValue();if(d!=null&&d!=undefined&&d!=""){g=g+"&serseg="+d;}}}}Ext.Ajax.request({url:g,method:"POST",success:function(l){userMailJSON=Ext.decode(l.responseText);
var o=Ext.getCmp("exclude");o.getStore().removeAll();if(o.fromField.store.getCount()>0){o.fromField.store.removeAll();}if(o.toField.store.getCount()>0){o.toField.store.removeAll();}var m=userMailJSON["includedAlerts"];var n=userMailJSON["excludedAlerts"];if(!Ext.isEmpty(n)){o.fromField.store.add(n);}if(!Ext.isEmpty(m)){o.toField.store.add(m);
}if(mailFilterOption=="Descriptors_Only"){o.fromField.getComponent(0).setTitle(pageIntnl95);o.toField.getComponent(0).setTitle(pageIntnl96);}}});}},popCompTypes:function(g){var b=publicJSON.userID;var a=Ext.getCmp("filter").getValue();var c=g.getValue();var e="no";if(isConfigEnabled=="true"){var d=Ext.getCmp("TestTypes").getValue();
if(d=="configuration"){e="yes";}}var f="";if(mailFilterOption=="Descriptors_Only"){f="EgChangeUserProfile/data/EgMailAlertIncludeSuppressJson.jsp?selectedTab=4&userID="+encodeURIComponent(filterEncode(selectedUserValID))+"&mailFilterOption="+mailFilterOption+"&reqfrom="+reqFrom+"&configTestType="+e;f=f+"&filterBy=filterByDescriptor&serverType="+encodeURIComponent(c)+"&date="+new Date().getTime();
Ext.Ajax.request({url:f,method:"POST",success:function(h){userMailJSON=Ext.decode(h.responseText);var l=Ext.getCmp("exclude");var i=userMailJSON["includedAlerts"];var k=userMailJSON["excludedAlerts"];l.getStore().removeAll();if(l.fromField.store.getCount()>0){l.fromField.store.removeAll();}if(l.toField.store.getCount()>0){l.toField.store.removeAll();
}if(!Ext.isEmpty(k)){l.fromField.store.add(k);}if(!Ext.isEmpty(i)){l.toField.store.add(i);}var m=Ext.getCmp("serverTestsOuterCt");var j=Ext.getCmp("Test");Ext.getCmp("searchbox").setDisabled(true);Ext.getCmp("searchbox").setValue("");j.getStore().removeAll();Ext.getCmp("compName").getStore().removeAll();
j.getStore().loadRawData(userMailJSON.testArray);j.setValue(userMailJSON.selectedDescriptorText);if(mailFilterOption=="Descriptors_Only"){l.fromField.getComponent(0).setTitle(pageIntnl95);l.toField.getComponent(0).setTitle(pageIntnl96);}}});}else{f="EgChangeUserProfile/data/EgMailAlertSuppressJson.jsp?selectedTab=4&userID="+encodeURIComponent(filterEncode(selectedUserValID))+"&mailFilterOption="+mailFilterOption+"&reqfrom="+reqFrom;
f=f+"&filterBy="+a+"&serverType="+encodeURIComponent(c)+"&date="+new Date().getTime();Ext.Ajax.request({url:f,method:"POST",success:function(h){userMailJSON=Ext.decode(h.responseText);var l=Ext.getCmp("exclude");var i=userMailJSON["includedAlerts"];var k=userMailJSON["excludedAlerts"];l.getStore().removeAll();
if(l.fromField.store.getCount()>0){l.fromField.store.removeAll();}if(l.toField.store.getCount()>0){l.toField.store.removeAll();}if(!Ext.isEmpty(k)){l.fromField.store.add(k);}if(!Ext.isEmpty(i)){l.toField.store.add(i);}var m=Ext.getCmp("serverTestsOuterCt");var j=Ext.getCmp("Test");if(a=="filterByDescriptor"){j.getStore().removeAll();
j.getStore().loadRawData(userMailJSON.testArray);j.setValue(userMailJSON.selectedDescriptorText);m.show();Ext.getCmp("compName").getStore().removeAll();Ext.getCmp("searchbox").setDisabled(true);Ext.getCmp("searchbox").setValue("");j.show();}else{m.hide();j.hide();}if(mailFilterOption=="Descriptors_Only"){l.fromField.getComponent(0).setTitle(pageIntnl95);
l.toField.getComponent(0).setTitle(pageIntnl96);}}});}},popTestTypes:function(d){updateSettings=false;var e=Ext.getCmp("uname").getValue();var i=Ext.getCmp("filter").getValue();var c=d.getValue();var b=Ext.getCmp("compTypesIn").getValue();var h=Ext.getCmp("CompTypes").getValue();var a=Ext.getCmp("serseg").getValue();
var g="no";if(c=="configuration"){g="yes";}var f="";if(mailFilterOption=="Descriptors_Only"){f="EgChangeUserProfile/data/EgMailAlertIncludeSuppressJson.jsp?selectedTab=4&userID="+encodeURIComponent(filterEncode(selectedUserValID))+"&mailFilterOption="+mailFilterOption+"&reqfrom="+reqFrom+"&configTestType="+g;
f=f+"&filterBy=filterByDescriptor&compTypesIn="+encodeURIComponent(b)+"&serseg="+encodeURIComponent(a)+"&serverType="+encodeURIComponent(h)+"&Test="+encodeURIComponent(viewByTest)+"&date="+new Date().getTime();}else{f="EgChangeUserProfile/data/EgMailAlertSuppressJson.jsp?selectedTab=4&userID="+encodeURIComponent(filterEncode(selectedUserValID))+"&mailFilterOption="+mailFilterOption+"&reqfrom="+reqFrom+"&serverType="+encodeURIComponent(h)+"&configTestType="+g;
f=f+"&filterBy="+i+"&serverType="+encodeURIComponent(serverType)+"&compTypesIn="+encodeURIComponent(b)+"&serseg="+encodeURIComponent(a)+"&date="+new Date().getTime();}Ext.Ajax.request({url:f,method:"POST",success:function(j){userMailJSON=Ext.decode(j.responseText);var n=Ext.getCmp("exclude");var k=userMailJSON["includedAlerts"];
var m=userMailJSON["excludedAlerts"];n.getStore().removeAll();if(n.fromField.store.getCount()>0){n.fromField.store.removeAll();}if(n.toField.store.getCount()>0){n.toField.store.removeAll();}if(!Ext.isEmpty(m)){n.fromField.store.add(m);}if(!Ext.isEmpty(k)){n.toField.store.add(k);}var o=Ext.getCmp("serverTestsOuterCt");
var l=Ext.getCmp("Test");if(i=="filterByDescriptor"){l.getStore().removeAll();l.getStore().loadRawData(userMailJSON.testArray);l.setValue(userMailJSON.selectedDescriptorText);o.show();Ext.getCmp("compName").getStore().removeAll();Ext.getCmp("searchbox").setDisabled(true);Ext.getCmp("searchbox").setValue("");
l.show();}else{o.hide();l.hide();}if(mailFilterOption=="Descriptors_Only"){n.fromField.getComponent(0).setTitle(pageIntnl95);n.toField.getComponent(0).setTitle(pageIntnl96);}}});},updateResultPanel:function(){var c=userElementJSON.isElementsAssociated;var a=Ext.getCmp("userAssociationContainer");var b=Ext.getCmp("elementassociationcontainer");
a.removeAll();if(c==true){a.add({xtype:"componentgroupedsummarygrid",store:new Ext.data.Store({fields:["col_1","category","col_2","col_3"],groupField:"category",data:userElementJSON.userTableData,})});a.doLayout();Ext.getCmp("Expand").show();}else{Ext.getCmp("Expand").hide();var d='<div class = "iconInformation" style="margin:12% auto auto auto"></div><div>'+intnlLabel5+".</div>";
var e={xtype:"component",width:"100%",border:false,style:{"text-align":"center"},html:d};a.add(e);}},updateUserMailSuppressList:function(a){Ext.Ajax.request({url:a,method:"POST",async:false,success:function(b){var c=b.responseText;userMailJSON=Ext.decode(c);}});},viewFilteredElements:function(){var a=this;
Ext.widget("window",{extend:"Ext.panel.Panel",id:"userFilterWindow",width:"95%",height:450,border:false,modal:true,autoScroll:true,closeAction:"destory",doClose:function(){this.destroy();},listeners:{afterrender:function(){if(mailFilterOption=="Descriptors_Only"){var c=filterMessage2+": "+selectedUserID;
Ext.getCmp("userFilterWindow").setTitle(c);var b="EgChangeUserProfile/data/EgMailAlertIncludeSuppress.jsp?showAssociatedData=yes&selectedTab=4&userID="+encodeURIComponent(filterEncode(selectedUserValID))+"&mailFilterOption="+mailFilterOption+"&reqfrom="+reqFrom+"&date="+new Date().getTime();a.updateDescriptorHTMLFiltePanel(b);
}else{var c=filterMessage+": "+selectedUserID;Ext.getCmp("userFilterWindow").setTitle(c);var b="EgChangeUserProfile/data/EgMailAlertSuppress.jsp?showAssociatedData=yes&selectedTab=4&userID="+encodeURIComponent(filterEncode(selectedUserValID))+"&mailFilterOption="+mailFilterOption+"&reqfrom="+reqFrom+"&date="+new Date().getTime();
a.updateHTMLFilterResultPanel(b);}}},items:[{xtype:"container",id:"userFilterContainer",layout:{type:"vbox",pack:"center",align:"center"},defaults:{margin:8}}]}).show();}});