From 161fa80d6487683ee3cb07ec845511d5a169cbb8 Mon Sep 17 00:00:00 2001 From: Yuchen Wang Date: Wed, 23 Nov 2011 12:00:54 -0500 Subject: [PATCH] CC-3091: Widget "Today's Program" doesn't show any content It's not showing anything because I thought it's not suppose to display the currently playing show. Fixed by retrieving the currently playing show along with next shows, and display them. todayInfoAction is no longer needed since liveInfoAction does the same thing. --- .../application/controllers/ApiController.php | 26 ------------------- widgets/js/jquery.showinfo.js | 6 +++-- 2 files changed, 4 insertions(+), 28 deletions(-) diff --git a/airtime_mvc/application/controllers/ApiController.php b/airtime_mvc/application/controllers/ApiController.php index 590edb35e..2d42aff47 100644 --- a/airtime_mvc/application/controllers/ApiController.php +++ b/airtime_mvc/application/controllers/ApiController.php @@ -202,32 +202,6 @@ class ApiController extends Zend_Controller_Action exit; } } - - public function todayInfoAction() - { - if (Application_Model_Preference::GetAllow3rdPartyApi()){ - // disable the view and the layout - $this->view->layout()->disableLayout(); - $this->_helper->viewRenderer->setNoRender(true); - - $date = new Application_Model_DateHelper; - $utcTimeNow = $date->getUtcTimestamp(); - $utctimeEnd = Application_Model_DateHelper::GetDayEndTimestampInUtc(); - - $result = array("env"=>APPLICATION_ENV, - "schedulerTime"=>gmdate("Y-m-d H:i:s"), - "nextShow"=>Application_Model_Show::GetNextShows($utcTimeNow, 5, $utcTimeEnd)); - - Application_Model_Show::ConvertToLocalTimeZone($result["nextShow"], array("starts", "ends", "start_timestamp", "end_timestamp")); - - header("Content-type: text/javascript"); - echo $_GET['callback'].'('.json_encode($result).')'; - } else { - header('HTTP/1.0 401 Unauthorized'); - print 'You are not allowed to access this resource. '; - exit; - } - } public function weekInfoAction() { diff --git a/widgets/js/jquery.showinfo.js b/widgets/js/jquery.showinfo.js index b57f8d7c4..1c75b7918 100644 --- a/widgets/js/jquery.showinfo.js +++ b/widgets/js/jquery.showinfo.js @@ -16,7 +16,9 @@ getServerData(); function updateWidget(){ - var shows = sd.getNextShows(); + var currentShow = sd.getCurrentShow(); + var nextShows = sd.getNextShows(); + var shows = currentShow.length == 0 ? nextShows : currentShow.concat(nextShows); tableString = ""; tableString += "

" + options.text.onAirToday + "

"; @@ -50,7 +52,7 @@ } function getServerData(){ - $.ajax({ url: options.sourceDomain + "api/today-info/", dataType:"jsonp", success:function(data){ + $.ajax({ url: options.sourceDomain + "api/live-info/", dataType:"jsonp", success:function(data){ processData(data); }, error:airtimeScheduleJsonpError}); setTimeout(getServerData, options.updatePeriod*1000);