Ext.define("Tvmode",{extend:"Ext.data.Model",fields:[{name:"url",type:"string"},{name:"dashboardName",type:"string"},{name:"module",type:"string"},{name:"title",type:"string"},{name:"timeFrequency",type:"number"},{name:"about",type:"boolean"}]});var tvmodetpl=new Ext.XTemplate('<ul  id="content-slider" class="content-slider">','<tpl for=".">','<li aboutSlide={about} dashboardName="{dashboardName}"  dataURI="{url}" pagefrq="{timeFrequency}"  module="{module}" class="dashboard-wrap" style="height:100%;">','<tpl if="title">','<h1 class="tvmode_header">{title}</h1>',"</tpl>","</li>","</tpl>","</ul>");
Ext.define("Tvmode",{extend:"Ext.view.View",alias:"widget.tvmode",flex:1,height:"100%",width:"100%",enableCaption:false,getTimeFrequency:null,initComponent:function(){var a=this;a.sliderAction=a.autoPlay?"pause":"play";a.mon(a,"viewready",a.loadSlider,a);a.mon(a,"resize",a.resizedash,a);a.callParent();
},tpl:tvmodetpl,itemSelector:"li.dashboard-wrap",emptyText:"No dashboard available",transactionSpeed:400,sliderObj:null,autoPlay:true,overMask:true,mode:"fade",sliderAction:"play",titleVisibile:false,intervalTransactionSpeed:10000,resizedash:function(){var a=this;a.xpso=Ext.getBody().getViewSize().width-80;
a.ypso=Ext.getBody().getViewSize().height;if(!Ext.isEmpty(Ext.getCmp("layer"))){a.xpso=Ext.getBody().getViewSize().width-80;a.ypso=Ext.getBody().getViewSize().height-Ext.getCmp("layer").getHeight();}Ext.get(window).on("mousemove",function(b){if(b.getX()>a.xpso-80){if(!Ext.isEmpty(Ext.getCmp("layer"))){Ext.getCmp("layer").show();
}}else{if(!Ext.isEmpty(Ext.getCmp("layer"))){Ext.getCmp("layer").hide();}}});},sliderControllers:function(){var b=this;var a=Ext.create("Ext.container.Container",{flex:1,width:80,height:b.ypso,id:"layer",defaults:{margin:"1 0",},floating:true,x:b.xpso,overCls:"lightlayerOver",cls:"lightlayer",items:[{xtype:"button",width:85,overCls:"btoverCls",height:85,iconAlign:"right",cls:"btselector",iconCls:"btnNext",id:"nextBtn",listeners:{"click":function(){b.sliderObj.goToNextSlide();
}}},{xtype:"button",enableToggle:true,cls:"btncls btselector",overCls:"btoverCls",pressedCls:"toogleState",width:85,height:85,iconAlign:"right",iconCls:b.autoPlay?"btnclsPause":"btnclsPlay",id:"playBtn",ifScroll:false,pressed:b.autoPlay,handler:function(c){if(c.pressed==true){if(c.ifScroll===false){b.sliderObj.play();
}c.setIconCls("btnclsPause");b.sliderAction="pause";}else{if(c.ifScroll===false){b.sliderObj.pause();}c.setIconCls("btnclsPlay");b.sliderAction="play";}}},{xtype:"button",width:85,overCls:"btoverCls",height:85,iconAlign:"right",cls:"btselector",iconCls:"btnPre",id:"preBtn",handler:function(){b.sliderObj.goToPrevSlide();
}}],layout:{pack:"center",type:"vbox",align:"stretch"}});b.up("panel").add(a);a.show();},randomColors:["#9a256b","#127f4f","#0e448b","#ba422a","#4b3b47","#157692","#c16818","#6e398d","#2b2b2b"],lazyLoad:function(){var d=this;var c="";var b="/final/Tvmodejson.jsp";var f="Tvmodule=tvModeGeneric";Ext.Ajax.request({url:b,params:f,method:"post",async:false,scope:this,success:function(h){var j=h.responseText;
var i=Ext.decode(j);c=i["logo"];}});var g=d.randomColors[Math.floor(Math.random()*d.randomColors.length)];var e=jQuery("#content-slider").find("li.dashboard-wrap"),a=e.index();if(!Ext.isEmpty(Ext.get("iframe"))||!Ext.isEmpty(Ext.get("mask"))){Ext.get("mask").destroy();$.when($("#iframe").remove()).then(function(){$("#tvmodetitle").remove();
Ext.getCmp("playBtn").ifScroll=false;d.intervalTransactionSpeed=null;});}e.each(function(k,m){var o=$(m).attr("dataURI"),l=$(m).attr("pagefrq"),j=$(m).attr("dashboardName"),h=$(m).attr("module"),p=$(m).attr("aboutSlide");var n=$("<iframe width='100%' height='100%' frameborder='0' id='iframe' src='"+o+"'></iframe>");
if(d.overMask){n=$("<div style='top:0px;left:0px;position:absolute;height:100%;width:100%;background-color:rgba(0, 0, 0, 0.0)' id='mask'></div><iframe width='100%' height='100%' frameborder='0' id='iframe' src='"+o+"'></iframe");}Ext.getCmp("playBtn").ifScroll=true;Ext.defer(function(){if($(m).hasClass("active")==true){$(m).append(n);
$("#iframe").on("load",function(){if(p==true||p=="true"){var i=$('<div style="color:#000"></div>'+'<h1 class="centered" style="background-color:'+d.randomColors[Math.floor(Math.random()*(d.randomColors.length))]+'">'+"<span>"+gettingURL[k].dashboardName+"</span>"+"</h1>"+'<div class="tvmode_footer">'+'<div style="clear:both"></div>'+'<span class="tvmode_copyrights" style="float:left">&copy; eG Innovations, Inc. All Rights Reserved - v '+gettingURL[k].ManagerVersion+"</span>"+'<span style="float:right"><img src="..'+c+'" style="vertical-align:middle" /></span>'+'<div style="clear:both"></div>'+"</div>");
$("#iframe").contents().find("body").append(i);}if(d.enableCaption){if(p!=true||p!="true"){$(m).append('<div class="tvmodetitle" id="tvmodetitle"><h1 style="font-weight:300;line-height:22px;padding:45px 0px 15px 0px">'+h+'</h1><h6 style="font-size:22px;font-weight:400">'+j+"</h6></div>");Ext.defer(function(){if(!Ext.isEmpty($("#tvmodetitle"))){$("#tvmodetitle").stop().animate({bottom:"0"},function(){d.titleVisibile=true;
Ext.defer(function(){$("#tvmodetitle").stop().animate({bottom:"-147px"});},5000);});}},200);}}});d.getTimeFrequency=l;}},50);});},loadSlider:function(){var a=this;a.sliderObj=$("#content-slider").lightSlider({item:1,pause:a.intervalTransactionSpeed,speed:a.transactionSpeed,auto:a.autoPlay,mode:a.mode,controls:false,gallery:false,pager:false,loop:true,adaptiveHeight:true,onSliderLoad:function(b){a.lazyLoad();
},onAfterSlide:function(b){a.lazyLoad();}});a.sliderControllers();$("#content-slider").height(Ext.getBody().getViewSize().height);}});Ext.onReady(function(){Ext.Ajax.request({url:url1,params:param,async:false,scope:this,success:function(a){var d=a.responseText;var b=Ext.decode(d);gettingURL=b["AllTvModulecombo"];
if(Ext.isEmpty(gettingURL)){Ext.create("Ext.window.Window",{ui:"plain",id:"no_widgets",header:false,border:false,html:'<h1 class="tvmode_header" style="text-align: center;"><span style="font-size:20px">No dashboard is configured </span><br><span style="font-size:10px">Press ESC</span></h1>',renderTo:Ext.getBody()}).show().center();
if(!Ext.isEmpty(Ext.getCmp("splash"))){Ext.destroy(Ext.getCmp("splash"));}}var c={xtype:"panel",ui:"tvmode",flex:1,padding:0,margin:0,header:false,id:"carouselAutoScrollTV",layout:{type:"vbox",align:"stretch"},items:[{xtype:"tvmode",padding:0,margin:0,id:"tvmode",store:new Ext.create("Ext.data.Store",{id:"tvmodeStore",model:"Tvmode",data:gettingURL}),flex:1}]};
Ext.create("Ext.container.Viewport",{layout:"fit",listeners:{boxready:function(e){Ext.suspendLayouts();Ext.defer(function(){if(!Ext.isEmpty(gettingURL)){Ext.get("splashcontent").animate({callback:function(){e.add(c);Ext.destroy(Ext.getCmp("splash"));},duration:1000,from:{y:0},to:{y:-3000}});}},5000);
Ext.resumeLayouts(false);},resize:function(g,i,e,f,j,h){if(!Ext.isEmpty(j)){isTvMode=false;frame=parent.document.getElementById("tvMode");frameDoc=frame.contentDocument||frame.contentWindow.document;frameDoc.write("<html><head>");frameDoc.write("</head><body>");frameDoc.write("</body></html>");frame.src="about:blank";
Ext.destroy(Ext.getCmp("carouselAutoScrollTV"));}}}});}});});