function Controller(){function e(e){d.is("news e",e),d.i("NewClicked="+e.source),Alloy.createController("newsDetail",{id:e.source.newsId}).openWin()}function t(){clearTimeout(a)}function s(e){var t=e.news;if(d.is("news",t),!_.isEmpty(t)){if(void 0!==m.titleText&&i.newsItems.add(i.UI.create("Label",{text:"   "+m.titleText,classes:["header","bold"]})),!m.noHeader){var s=_.first(t);i.newsItems.add(Alloy.createController("newsTableHeader",{id:s.newsId,image:s.imageUrl.medium,category:void 0!==s.tags[0]?s.tags[0].name:void 0,headline:s.titleShort}).getView());var t=_.rest(t)}_.each(t,function(e){var t=Alloy.createController("newsTableRow",{id:e.newsId,image:e.imageUrl.small,category:void 0!==e.tags[0]?e.tags[0].name:"",datetime:e.date,headline:e.titleShort}).getView();i.newsItems.add(t)}),_.defer(function(){Alloy.Globals.loading.showHide("hide")})}}function l(){Alloy.Globals.loading.showHide("hide")}function n(e,r){r||t(),g>0&&!m.noRefresh&&(a=setTimeout(function(){n(e,!0)},g));var o=void 0!==m.feedUrl?m.feedUrl:Alloy.CFG.feedUrls.news;if(void 0!==e&&(o=o+"&section="+e),0!==i.newsItems.children.length){var d=i.newsItems.children.slice(0);_.each(d,function(e){i.newsItems.remove(e),e.destroy&&e.destroy()})}var v=c.signUrl(o.replace("{{count}}",u));w.getData({getUrl:v},s,l)}require("alloy/controllers/BaseController").apply(this,Array.prototype.slice.call(arguments)),this.__controllerPath="newsItems",arguments[0]?arguments[0].__parentSymbol:null,arguments[0]?arguments[0].$model:null,arguments[0]?arguments[0].__itemTemplate:null;var i=this,r={},o={};i.__views.newsItems=Ti.UI.createView({layout:"vertical",height:Ti.UI.SIZE,id:"newsItems"}),i.__views.newsItems&&i.addTopLevelView(i.__views.newsItems),e?i.__views.newsItems.addEventListener("click",e):o["$.__views.newsItems!click!newsClicked"]=!0,r.destroy=function(){},_.extend(i,i.__views);var a,d=require("helpers"),c=require("feedSigner"),w=require("netConnect"),m=arguments[0]||{},u=void 0!==m.itemCount?m.itemCount:"30",g=100*Alloy.Globals.settings.refreshNews;n(),r.getNews=n,r.cancelRefresh=t,o["$.__views.newsItems!click!newsClicked"]&&i.__views.newsItems.addEventListener("click",e),_.extend(i,r)}var Alloy=require("alloy"),Backbone=Alloy.Backbone,_=Alloy._;module.exports=Controller;