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.
This commit is contained in:
Yuchen Wang 2011-11-23 12:00:54 -05:00
parent 37da2bf0c5
commit 161fa80d64
2 changed files with 4 additions and 28 deletions

View File

@ -202,32 +202,6 @@ class ApiController extends Zend_Controller_Action
exit; 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() public function weekInfoAction()
{ {

View File

@ -16,7 +16,9 @@
getServerData(); getServerData();
function updateWidget(){ 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 = "";
tableString += "<h3>" + options.text.onAirToday + "</h3>"; tableString += "<h3>" + options.text.onAirToday + "</h3>";
@ -50,7 +52,7 @@
} }
function getServerData(){ 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); processData(data);
}, error:airtimeScheduleJsonpError}); }, error:airtimeScheduleJsonpError});
setTimeout(getServerData, options.updatePeriod*1000); setTimeout(getServerData, options.updatePeriod*1000);