fix bug on widget

This commit is contained in:
James 2012-08-10 12:14:15 -04:00
parent 63a51081c1
commit 8b13af2e04
2 changed files with 14 additions and 14 deletions

View File

@ -259,7 +259,7 @@ class ApiController extends Zend_Controller_Action
$request = $this->getRequest(); $request = $this->getRequest();
$type = $request->getParam('type'); $type = $request->getParam('type');
/* This is some *extremely* lazy programming that needs to bi fixed. For some reason /* This is some *extremely* lazy programming that needs to bi fixed. For some reason
* we are using two entirely different codepaths for very similar functionality (type = endofday * we are using two entirely different codepaths for very similar functionality (type = endofday
* vs type = interval). Needs to be fixed for 2.2 - MK */ * vs type = interval). Needs to be fixed for 2.2 - MK */
if ($type == "endofday") { if ($type == "endofday") {
$limit = $request->getParam('limit'); $limit = $request->getParam('limit');
@ -275,25 +275,25 @@ class ApiController extends Zend_Controller_Action
"nextShow"=>Application_Model_Show::getNextShows($utcTimeNow, $limit, $utcTimeEnd) "nextShow"=>Application_Model_Show::getNextShows($utcTimeNow, $limit, $utcTimeEnd)
); );
Application_Model_Show::convertToLocalTimeZone($result["currentShow"], Application_Model_Show::convertToLocalTimeZone($result["currentShow"],
array("starts", "ends", "start_timestamp", "end_timestamp")); array("starts", "ends", "start_timestamp", "end_timestamp"));
Application_Model_Show::convertToLocalTimeZone($result["nextShow"], Application_Model_Show::convertToLocalTimeZone($result["nextShow"],
array("starts", "ends", "start_timestamp", "end_timestamp")); array("starts", "ends", "start_timestamp", "end_timestamp"));
} else { } else {
$result = Application_Model_Schedule::GetPlayOrderRange(); $result = Application_Model_Schedule::GetPlayOrderRange();
//Convert from UTC to localtime for Web Browser. //Convert from UTC to localtime for Web Browser.
Application_Model_Show::ConvertToLocalTimeZone($result["currentShow"], Application_Model_Show::ConvertToLocalTimeZone($result["currentShow"],
array("starts", "ends", "start_timestamp", "end_timestamp")); array("starts", "ends", "start_timestamp", "end_timestamp"));
Application_Model_Show::ConvertToLocalTimeZone($result["nextShow"], Application_Model_Show::ConvertToLocalTimeZone($result["nextShow"],
array("starts", "ends", "start_timestamp", "end_timestamp")); array("starts", "ends", "start_timestamp", "end_timestamp"));
} }
//used by caller to determine if the airtime they are running or widgets in use is out of date. //used by caller to determine if the airtime they are running or widgets in use is out of date.
$result['AIRTIME_API_VERSION'] = AIRTIME_API_VERSION; $result['AIRTIME_API_VERSION'] = AIRTIME_API_VERSION;
header("Content-type: text/javascript"); header("Content-type: text/javascript");
// If a callback is not given, then just provide the raw JSON. // If a callback is not given, then just provide the raw JSON.
echo isset($_GET['callback']) ? $_GET['callback'].'('.json_encode($result).')' : json_encode($result); echo isset($_GET['callback']) ? $_GET['callback'].'('.json_encode($result).')' : json_encode($result);
} else { } else {
header('HTTP/1.0 401 Unauthorized'); header('HTTP/1.0 401 Unauthorized');
@ -327,8 +327,8 @@ class ApiController extends Zend_Controller_Action
} }
$result['AIRTIME_API_VERSION'] = AIRTIME_API_VERSION; //used by caller to determine if the airtime they are running or widgets in use is out of date. $result['AIRTIME_API_VERSION'] = AIRTIME_API_VERSION; //used by caller to determine if the airtime they are running or widgets in use is out of date.
header("Content-type: text/javascript"); header("Content-type: text/javascript");
Logging::log($result);
// If a callback is not given, then just provide the raw JSON. // If a callback is not given, then just provide the raw JSON.
echo isset($_GET['callback']) ? $_GET['callback'].'('.json_encode($result).')' : json_encode($result); echo isset($_GET['callback']) ? $_GET['callback'].'('.json_encode($result).')' : json_encode($result);
} else { } else {
header('HTTP/1.0 401 Unauthorized'); header('HTTP/1.0 401 Unauthorized');
@ -466,8 +466,8 @@ class ApiController extends Zend_Controller_Action
$this->view->watched_dirs = $watchedDirsPath; $this->view->watched_dirs = $watchedDirsPath;
} }
public function dispatchMetadataAction($md, $mode, $dry_run=false) public function dispatchMetadataAction($md, $mode, $dry_run=false)
{ {
// Replace this compound result in a hash with proper error handling later on // Replace this compound result in a hash with proper error handling later on
$return_hash = array(); $return_hash = array();
if ( $dry_run ) { // for debugging we return garbage not to screw around with the db if ( $dry_run ) { // for debugging we return garbage not to screw around with the db
@ -550,7 +550,7 @@ class ApiController extends Zend_Controller_Action
} }
$return_hash['fileid'] = $file->getId(); $return_hash['fileid'] = $file->getId();
return $return_hash; return $return_hash;
} }
public function reloadMetadataGroupAction() public function reloadMetadataGroupAction()
{ {
@ -595,7 +595,7 @@ class ApiController extends Zend_Controller_Action
$response['key'] = $k; $response['key'] = $k;
array_push($responses, $response); array_push($responses, $response);
// On recorded show requests we do some extra work here. Not sure what it actually is and it // On recorded show requests we do some extra work here. Not sure what it actually is and it
// was usually called from the python api client. Now we just call it straight from the controller to // was usually called from the python api client. Now we just call it straight from the controller to
// save the http roundtrip // save the http roundtrip
if( $info_json['is_record'] and !array_key_exists('error', $response) ) { if( $info_json['is_record'] and !array_key_exists('error', $response) ) {
$this->uploadRecordedActionParam($info_json['showinstanceid'],$info_json['fileid'],$dry_run=$dry); $this->uploadRecordedActionParam($info_json['showinstanceid'],$info_json['fileid'],$dry_run=$dry);

View File

@ -1902,7 +1902,7 @@ class Application_Model_Show
} }
//TODO, returning starts + ends twice (once with an alias). Unify this after the 2.0 release. --Martin //TODO, returning starts + ends twice (once with an alias). Unify this after the 2.0 release. --Martin
$sql = "SELECT si.starts as start_timestamp, si.ends as end_timestamp, s.name, s.id, si.id as instance_id, si.record, s.url, starts, ends" $sql = "SELECT si.starts as start_timestamp, si.ends as end_timestamp, s.name, s.id, si.id as instance_id, si.record, s.url, starts, ends FROM"
." $CC_CONFIG[showInstances] si, $CC_CONFIG[showTable] s" ." $CC_CONFIG[showInstances] si, $CC_CONFIG[showTable] s"
." WHERE si.show_id = s.id" ." WHERE si.show_id = s.id"
." AND si.starts >= TIMESTAMP '$timeStart'" ." AND si.starts >= TIMESTAMP '$timeStart'"