Ext.define("AggregateShowTypes.controller.Main",{extend:"Ext.app.Controller",views:["FormPanel"],refs:[{selector:"formPanel",ref:"formPanel"}],init:function(){appCnt=this;this.rowBodyTrSelector=".x-grid-rowbody-tr";this.rowBodyHiddenCls="x-grid-row-body-hidden";this.rowCollapsedCls="x-grid-row-collapsed";
this.recordsExpanded={};this.isViewExpaned=false;this.isViewExpaned2=false;this.control({"formPanel":{"afterrender":this.afterMainRender,},'formPanel button[id="addAllButton"]':{"click":this.callAddAll},'formPanel button[id="backbutton"]':{"click":this.back},'formPanel trigger[name="searchBox"]':{"change":this.egTitleSearch},'formPanel button[id="showAll"]':{"click":this.showAllPreUsers}});
},showAllPreUsers:function(c){var a=Ext.getCmp("resultGrid").getStore();if(c.status=="hidden"){c.status="shown";c.setText(intnlLabel11);for(var b=0;b<a.getCount();b++){this.expandRow(b,Ext.getCmp("resultGrid"));}}else{c.status="hidden";c.setText(intnlLabel10);for(var b=0;b<a.getCount();b++){this.collapseRow(b,Ext.getCmp("resultGrid"));
}}this.getFormPanel().doLayout();},expandRow:function(c,a){var b=a.view.getNode(c);row=Ext.get(b);nextBd=Ext.get(row).down(this.rowBodyTrSelector);record=a.view.getRecord(b);if(row.hasCls(this.rowCollapsedCls)){row.removeCls(this.rowCollapsedCls);nextBd.removeCls(this.rowBodyHiddenCls);this.recordsExpanded[record.internalId]=true;
a.view.fireEvent("expandbody",b,record,nextBd.dom);}},collapseRow:function(c,a){var b=a.view.getNode(c);row=Ext.get(b);nextBd=Ext.get(row).down(this.rowBodyTrSelector);record=a.view.getRecord(b);if(!row.hasCls(this.rowCollapsedCls)){row.addCls(this.rowCollapsedCls);nextBd.addCls(this.rowBodyHiddenCls);
this.recordsExpanded[record.internalId]=false;a.view.fireEvent("collapsebody",b,record,nextBd.dom);}},afterMainRender:function(){Ext.getCmp("showAll").setText(intnlLabel10);Ext.Ajax.request({url:"/final/admin/AggregateShowTypes/data/aggShowTypesJSON.jsp",params:"operation="+operation+"&element="+element+"&name="+name,method:"POST",async:false,success:function(a){if(a.status==200&&!Ext.isEmpty(a.responseText)){Ext.getCmp("searchBox").enable();
var c=a.responseText;publicJSON=Ext.decode(c);Ext.getCmp("resultGrid").show();Ext.getCmp("addAllButton").show();Ext.getCmp("noAssociation").hide();var b=publicJSON["gridValues"];Ext.getCmp("resultGrid").getStore().loadRawData(b);}}});},callAddAll:function(){addAll();},back:function(){window.location.href="aggDispServer.jsp?qctr=0&reqfrom=navlink&isAggregateLink=true?fromWizard="+fromWizard+"&compGlanceCompType="+compGlanceCompType;
},egTitleSearch:function(){var a=Ext.getCmp("searchBox").getValue();if(a==""||a.length==0){Ext.get("MyTrigger_0").setStyle("display","none");Ext.get("MyTrigger_1").setStyle("display","block");}else{Ext.get("MyTrigger_1").setStyle("display","none");Ext.get("MyTrigger_0").setStyle("display","block");}if(a!=null){Ext.Ajax.request({url:"AggregateShowTypes/data/aggShowTypesJSON.jsp?operation="+operation+"&egTitleSearchStr="+encodeURIComponent(filterEncode(a)),method:"POST",success:function(b){if(b.status==200&&!Ext.isEmpty(b.responseText)){var e=b.responseText;
publicJSON=Ext.decode(e);}var d=publicJSON["gridValues"];if(d!=null&&d.length>0){Ext.getCmp("resultGrid").show();Ext.getCmp("addAllButton").show();Ext.getCmp("resultGrid").getStore().loadRawData(publicJSON["gridValues"]);Ext.getCmp("showAll").enable();}else{Ext.getCmp("resultGrid").getStore().loadRawData(publicJSON["gridValues"]);
var c=Ext.getCmp("resultGrid").getStore().getCount();if(c==0){Ext.getCmp("addAllButton").hide();Ext.getCmp("resultGrid").getStore().removeAll();Ext.get("noCompAlrtDiv").update(srcNotFnd);Ext.get("noCompAlrtDiv").update(srcNotFnd);Ext.getCmp("showAll").disable();}}}});}},nickTable:function(h){var b=h.split("#");
var g=0;var d=1;var c="<table border='1' bordercolor='#E6EBF5' cellpadding='1' ><tr>";if(b.length>2){var f=b.length-1;for(var e=0;e<f;e++){var a=b[e].split("@");if(b[e]!=""&&f==2){if(a[0].indexOf("(")>-1){c=c+"<td height='20' title='"+a[2]+"' width='225' height='20'><a class='eg_monlink' href='"+a[1]+"' ><b>"+"&nbsp;"+a[0].substring(0,a[0].indexOf("("))+"</b></a></td>";
}else{c=c+"<td height='20' title='"+a[2]+"' width='225' height='20'><a class='eg_monlink' href='"+a[1]+"' >"+"&nbsp;"+a[0]+"</a></td>";}}else{g++;if(g==3){c=c+"<td height='20' title='"+a[2]+"' width='150' height='20'><a class='eg_monlink' href='"+a[1]+"' >"+"&nbsp;"+a[0]+"</a></td></tr><tr>";g=0;}else{if(a[0].indexOf("(")>-1){c=c+"<td height='20' title='"+a[2]+"' width='150' height='20'><a class='eg_monlink' href='"+a[1]+"' ><b>"+"&nbsp;"+a[0].substring(0,a[0].indexOf("("))+"</b></a></td>";
}else{c=c+"<td height='20' title='"+a[2]+"' width='150' height='20'><a class='eg_monlink' href='"+a[1]+"' >"+"&nbsp;"+a[0]+"</a></td>";}}}}if(g==2){c=c+"<td width='150'>&nbsp;</td>";}else{if(g==1){c=c+"<td>&nbsp;</td>";c=c+"<td>&nbsp;</td>";}}c=c+"</tr></table>";return c;}else{if(h.indexOf("#")>0&&h.indexOf("@")>0){var k=new Array();
k=h.split("@");if(k[0].indexOf("(")>-1){c=c+"<td width='450' height='20'><a class='eg_monlink' href='"+k[1]+"' title='"+k[2].substring(0,k[2].indexOf("#"))+"'><b>"+"&nbsp;"+k[0].substring(0,k[0].indexOf("("))+"</b></a></td></tr></table>";return c;}else{c=c+"<td width='450' height='20'><a class='eg_monlink' href='"+k[1]+"' title='"+k[2].substring(0,k[2].indexOf("#"))+"'>"+"&nbsp;"+k[0]+"</a></td></tr></table>";
return c;}}else{return h;}}}});function addAll(){var g="";var f=0;var b=0;if(publicJSON["allowed_count"]!=null&&publicJSON["allowed_count"]!="undefined"){b=parseInt(publicJSON["allowed_count"]);g=publicJSON["allowed_count_0_msg"];}var e=Ext.getCmp("resultGrid").getSelectionModel();var d=Ext.getCmp("resultGrid").getStore();
var h="";for(var c=0;c<d.getCount();c++){if(e.isSelected(d.getAt(c))){f++;if(h.length==0){h=d.getAt(c).get("agg_type");}else{h+=","+d.getAt(c).get("agg_type");}}}if(b!=-1&&f>b){if(b==0){Ext.MessageBox.alert(infoTitle,g);}else{if(b==1){Ext.MessageBox.alert(infoTitle,licence_allow_onlyone);}else{Ext.MessageBox.alert(infoTitle,countExceed+" "+(f-b));
}}}else{if(h.length>0){Ext.getCmp("selected_server_types").setValue(h);var a=Ext.getCmp("formpanel").getForm();if(a.isValid()){a.submit({url:"/final/admin/aggAddAll.jsp",method:"POST",standardSubmit:true,success:function(i,j){}});}else{Ext.MessageBox.alert(infoTitle,invalid_form);}}else{Ext.MessageBox.alert(infoTitle,notSelectd);
}}}