var noListData=false;var getDiv=0;var scrollFlag=false;var kioskmodeScrollInProgress=false;Ext.define("zones.view.OptionalListPanel",{extend:"utilities.ScrollPanel",requires:["zones.view.OptionalListComponent"],alias:"widget.optionallistpanel",scroll:false,autoScroll:true,margin:"8 8 0 0",header:{padding:"0 5 0 5",margin:0},bodyStyle:{"overflow-x":"hidden !important"},cls:"outerpanel",frame:true,border:true,style:{"border":"1px solid green"},autoDestroy:true,url:null,mask:null,tools:[{xtype:"button",cls:"iconAutomaticScrollRun",id:"iconAutomaticScrollRun",margin:"0px 4px 0px 4px",ui:"action",hidden:true,style:{border:"1px"},handler:function(){scrollFlag=true;
pageScroll();Ext.getCmp("iconAutomaticScrollRun").hide();},listeners:{afterrender:function(){Ext.create("Ext.tip.ToolTip",{target:this.id,anchor:"top",cls:"yellowTip",trackMouse:true,autoDestroy:true,html:"Auto Scroll"});}}},{xtype:"button",cls:"iconAutomaticScrollStop",id:"iconAutomaticScrollStop",margin:"0px 4px 0px 4px",ui:"action",hidden:true,style:{border:"1px"},handler:function(){scrollFlag=false;
stopScroll();Ext.getCmp("iconAutomaticScrollStop").hide();},listeners:{afterrender:function(){Ext.create("Ext.tip.ToolTip",{target:this.id,anchor:"top",cls:"yellowTip",trackMouse:true,autoDestroy:true,html:"Pause"});}}},{xtype:"tbseparator",cls:"removeLineForTvMode",hidden:true,},{xtype:"button",cls:"iconAutomaticScrollJumpToTop",id:"iconAutomaticScrollJumpToTop",margin:"0px 4px 0px 4px",ui:"action",hidden:true,style:{border:"1px"},handler:function(){scrollFlag=false;
jumpScroll();Ext.getCmp("iconAutomaticScrollStop").hide();},listeners:{afterrender:function(){Ext.create("Ext.tip.ToolTip",{target:this.id,anchor:"top",cls:"yellowTip",trackMouse:true,autoDestroy:true,html:"Jump to top"});}}},{xtype:"tbseparator",cls:"removeLineForTvMode",hidden:true,},{xtype:"trigger",itemId:"zoneSearch",id:"zonelistpanelsearch",name:"zonelistpanelsearch",cls:"whitedropdown_search",margin:"0 5 0 5",onTriggerClick:function(a){this.fireEvent("click",this);
}},{xtype:"tbseparator",itemId:"associationSeparator",id:"assSeparatorId",name:"assSeparatorId"},{xtype:"button",cls:"iconAssociation",action:"association",margin:"0px 5px 0px 5px",id:"zoneAssociationId",name:"zoneAssociationId",style:{border:"0px"},listeners:{afterrender:function(){Ext.create("Ext.tip.ToolTip",{target:this.id,anchor:"top",cls:"yellowTip",trackMouse:true,html:Associations});
}}},{xtype:"tbseparator",autoDestroy:true,hidden:true,id:"backBtnSeparator",name:"backBtnSeparator"},{xtype:"tbseparator",autoDestroy:true,},{xtype:"button",hidden:true,id:"zonelistpanelbackbtn",autoDestroy:true,name:"zonelistpanelbackbtn",action:"back",cls:"backbutton",margin:"0px 5px 0px 5px",iconCls:"iconBack"}],url:null,mask:null,initComponent:function(){var a=this;
holdRefresh=true;Ext.Ajax.request({url:a.url,method:"POST",success:function(g,c){if(showDashboard){a.removeAll();var n=a.getDockedItems();if(!Ext.isEmpty(n)){for(i=0;i<n.length;i++){n[i].hide();}}holdRefresh=false;var l="&treeOpen="+requestParams.treeOpen;if(!Ext.isEmpty(requestParams.openNode)){l+="&openNode="+requestParams.openNode;
}a.hide();a.up("main").add({xtype:"zonesdashboard",currentTab:requestParams.currentTab,aggregateTab:requestParams.aggregateTab,currentZone:requestParams.selectedParam,zoneState:requestParams.zoneState,treeUrl:l,region:"center"});}else{var e=g.responseText;var j=Ext.decode(e);a.down("trigger[itemId=zoneSearch]").emptyText=j.screenLabels["searchDefaultText"]?j.screenLabels["searchDefaultText"]:"";
a.down("trigger[itemId=zoneSearch]").setValue(j.screenLabels["searchText"]?j.screenLabels["searchText"]:"");noListData=false;if(j["SearchNoListFound"]||!j["showAssociations"]){noListData=true;a.down("button[action=association]").hide();a.down("tbseparator[itemId=associationSeparator]").hide();}else{a.down("button[action=association]").show();
a.down("tbseparator[itemId=associationSeparator]").show();}a.down("button[id=zonelistpanelbackbtn]").setText(requestParams.backButtonText);a.setTitle(j.screenLabels["ListTitle"]?j.screenLabels["ListTitle"]:"");if(j["SearchNoListFound"]){var f=Ext.create("utilities.ErrorPanel",{border:false,flex:1,layout:"fit",errorMsg:'<div style="text-align:center;margin:17% auto 17% auto"><img src="/final/images/clear.png" class="iconInformation" /><br/><div class="list-empty-text">'+j["SearchNoListFoundText"]+"</div></div>",listeners:{boxready:function(){Ext.getCmp("iconAutomaticScrollRun").hide();
Ext.Element.select(".removeLineForTvMode").hide();Ext.getCmp("iconAutomaticScrollJumpToTop").hide();}}});a.add(f);}else{if(j["NoListFound"]){var d=Ext.create("utilities.ErrorPanel",{border:false,flex:1,layout:"fit",errorMsg:'<div style="text-align:center;margin:17% auto 17% auto"><img src="/final/images/clear.png" class="iconInformation" /><br/><div class="list-empty-text">'+j["NoListFoundText"]+"</div></div>",listeners:{boxready:function(){Ext.getCmp("iconAutomaticScrollRun").hide();
Ext.Element.select(".removeLineForTvMode").hide();Ext.getCmp("iconAutomaticScrollJumpToTop").hide();}}});a.add(d);}else{var k=Ext.create("Ext.container.Container",{layout:"column",margin:0,id:"componentPanel",border:true,autoScroll:false,scroll:false,listeners:{boxready:function(){if($("#optionallistpanel-body")[0].scrollHeight>$("#optionallistpanel-body").innerHeight()){}else{Ext.getCmp("iconAutomaticScrollRun").hide();
Ext.Element.select(".removeLineForTvMode").hide();Ext.getCmp("iconAutomaticScrollJumpToTop").hide();}},afterrender:function(){Ext.get("optionallistpanel-body").on("scroll",function(){var r=Ext.getCmp("optionallistpanel").body.dom;var p="zones.view.OptionalListComponent";if(isScroll==true&&r.scrollTop==(r.scrollHeight-r.offsetHeight)){var q=(startcount==null||startcount=="")?splitLen:startcount;
var o=q+splitLen;o=(o>compLength)?compLength:o;zones.app.getController("Main").bulkDataLoad(q,o,p);}});if(window.parent.isTvMode){if(fromKioskMode){scrollFlag=true;pageScroll();}}}},});rootComponentArray=j["RootItem"];compLength=rootComponentArray.length;if(compLength>splitLen){for(var m=0;m<splitLen;
m++){var b=Ext.create("zones.view.OptionalListComponent",{rootComponent:rootComponentArray[m]});k.add(b);}a.add(k);isScroll=true;}else{for(var m=0;m<rootComponentArray.length;m++){tot=m;var b=Ext.create("zones.view.OptionalListComponent",{rootComponent:rootComponentArray[m]});k.add(b);}k.doLayout();a.add(k);
}}}if(!Ext.isEmpty(a.mask)){a.mask.hide();}if(window.parent.globalsearch==true){if(window.parent.zoneSearchval!=null&&window.parent.zoneSearchval!=undefined&&window.parent.zoneSearchval!=""){a.setTitle(j.screenLabels["searchResultText"]+'  "'+window.parent.zoneSearchval+'"');}Ext.getCmp("zonelistpanelbackbtn").hide();
Ext.getCmp("zonelistpanelsearch").hide();Ext.getCmp("zoneAssociationId").hide();Ext.getCmp("backBtnSeparator").hide();Ext.getCmp("assSeparatorId").hide();}else{Ext.getCmp("zonelistpanelbackbtn").show();Ext.getCmp("zonelistpanelsearch").show();Ext.getCmp("zoneAssociationId").show();Ext.getCmp("backBtnSeparator").hide();
Ext.getCmp("assSeparatorId").show();Ext.defer(function(){zoneGroupZoneListBtn=Ext.create("Ext.container.Container",{layout:{type:"hbox"},width:100,padding:"2 0 0 0",margin:0,margin:"0 0 0 10",renderTo:"zoneView",items:[{xtype:"button",cls:"iconGroupViewDisable removeButtonCurve",margin:0,padding:0,height:20},{xtype:"button",cls:"iconListView removeButtonCurve",margin:0,padding:0,height:20,listeners:{afterrender:function(){Ext.create("Ext.tip.ToolTip",{target:this.id,anchor:"top",cls:"yellowTip",trackMouse:true,html:List_View});
}},handler:a.onListviewChange}]});},500);if(j.screenLabels["ListTitle"]){var h='<div style="float:left;">'+j.screenLabels["ListTitle"]+'</div><div style="float:left" id="zoneView"></div>';a.setTitle(h);}else{a.setTitle("&nbsp;");}delete zoneGroupZoneListBtn;}if(hideBackButton){Ext.getCmp("zonelistpanelbackbtn").hide();
}}},failure:function(){alert("failure");holdRefresh=false;}});this.callParent();},onListviewChange:function(){var c=null;var b=document.getElementsByTagName("body")[0];if(!Ext.isEmpty(Ext.get(b))){c=new Ext.LoadMask(Ext.get(b),{msg:"Loading...",cls:"maskDash"});c.show();}var e=Ext.getCmp("zoneMain");
var d="/final/monitor/zones.jsp";var f={xtype:"listpanel",id:"listpanel",region:"center",flex:4,mask:c,url:"/final/monitor/zones.jsp"};var a=[{xtype:"zonestreepanel",id:"zonestreepanel",border:false,header:false,region:"west",cls:"removeTreeLeftBorder",collapsed:!requestParams.treeOpen,url:"/final/monitor/zoneTree.jsp?tree=ZoneTreeModel&width=208&str=sessionID&node=Zone&treeTitle=Zones Navigation",split:true,collapseMode:"mini",collapsible:true,flex:1,maxWidth:350,minWidth:150},f];
e.removeAll();e.add(a);e.doLayout();}});