Merge branch '2.4.x' into ryerson-history

This commit is contained in:
Naomi 2013-08-30 16:07:41 -04:00
commit 4fd37a4fa0
37 changed files with 2385 additions and 175 deletions

View file

@ -209,6 +209,43 @@ class ApiController extends Zend_Controller_Action
}
}
public function onAirLightAction()
{
$this->view->layout()->disableLayout();
$this->_helper->viewRenderer->setNoRender(true);
$result = array();
$result["on_air_light"] = false;
$result["on_air_light_expected_status"] = false;
$result["station_down"] = false;
$range = Application_Model_Schedule::GetPlayOrderRange();
$isItemCurrentlyScheduled = !is_null($range["current"]) && count($range["currentShow"]) > 0 ? true : false;
$isCurrentItemPlaying = $range["current"]["media_item_played"] ? true : false;
if ($isItemCurrentlyScheduled ||
Application_Model_Preference::GetSourceSwitchStatus("live_dj") == "on" ||
Application_Model_Preference::GetSourceSwitchStatus("master_dj") == "on")
{
$result["on_air_light_expected_status"] = true;
}
if (($isItemCurrentlyScheduled && $isCurrentItemPlaying) ||
Application_Model_Preference::GetSourceSwitchStatus("live_dj") == "on" ||
Application_Model_Preference::GetSourceSwitchStatus("master_dj") == "on")
{
$result["on_air_light"] = true;
}
if ($result["on_air_light_expected_status"] != $result["on_air_light"]) {
$result["station_down"] = true;
}
echo isset($_GET['callback']) ? $_GET['callback'].'('.json_encode($result).')' : json_encode($result);
}
/**
* Retrieve the currently playing show as well as upcoming shows.
* Number of shows returned and the time interval in which to
@ -972,23 +1009,30 @@ class ApiController extends Zend_Controller_Action
//calculated with silan by actually scanning the entire file. This
//process takes a really long time, and so we only do it in the background
//after the file has already been imported -MK
$length = $file->getDbLength();
if (isset($info['length'])) {
$length = $info['length'];
//length decimal number in seconds. Need to convert it to format
//HH:mm:ss to get around silly PHP limitations.
$length = Application_Common_DateHelper::secondsToPlaylistTime($length);
try {
$length = $file->getDbLength();
if (isset($info['length'])) {
$length = $info['length'];
//length decimal number in seconds. Need to convert it to format
//HH:mm:ss to get around silly PHP limitations.
$length = Application_Common_DateHelper::secondsToPlaylistTime($length);
$file->setDbLength($length);
}
$file->setDbLength($length);
$cuein = isset($info['cuein']) ? $info['cuein'] : 0;
$cueout = isset($info['cueout']) ? $info['cueout'] : $length;
$file->setDbCuein($cuein);
$file->setDbCueout($cueout);
$file->setDbSilanCheck(true);
$file->save();
} catch (Exception $e) {
Logging::info("Failed to update silan values for ".$file->getDbTrackTitle());
Logging::info("File length analyzed by Silan is: ".$length);
//set silan_check to true so we don't attempt to re-anaylze again
$file->setDbSilanCheck(true);
$file->save();
}
$cuein = isset($info['cuein']) ? $info['cuein'] : 0;
$cueout = isset($info['cueout']) ? $info['cueout'] : $length;
$file->setDbCuein($cuein);
$file->setDbCueout($cueout);
$file->setDbSilanCheck(true);
$file->save();
}
$this->_helper->json->sendJson(array());

View file

@ -46,6 +46,17 @@ class ScheduleController extends Zend_Controller_Action
$baseUrl = Application_Common_OsPath::getBaseDir();
$this->view->headScript()->appendScript(
"var calendarPref = {};\n".
"calendarPref.weekStart = ".Application_Model_Preference::GetWeekStartDay().";\n".
"calendarPref.timestamp = ".time().";\n".
"calendarPref.timezoneOffset = ".date("Z").";\n".
"calendarPref.timeScale = '".Application_Model_Preference::GetCalendarTimeScale()."';\n".
"calendarPref.timeInterval = ".Application_Model_Preference::GetCalendarTimeInterval().";\n".
"calendarPref.weekStartDay = ".Application_Model_Preference::GetWeekStartDay().";\n".
"var calendarEvents = null;"
);
$this->view->headScript()->appendFile($baseUrl.'js/contextmenu/jquery.contextMenu.js?'.$CC_CONFIG['airtime_version'],'text/javascript');
//full-calendar-functions.js requires this variable, so that datePicker widget can be offset to server time instead of client time
@ -96,16 +107,6 @@ class ScheduleController extends Zend_Controller_Action
}
$this->view->addNewShow = true;
$this->view->headScript()->appendScript(
"var calendarPref = {};\n".
"calendarPref.weekStart = ".Application_Model_Preference::GetWeekStartDay().";\n".
"calendarPref.timestamp = ".time().";\n".
"calendarPref.timezoneOffset = ".date("Z").";\n".
"calendarPref.timeScale = '".Application_Model_Preference::GetCalendarTimeScale()."';\n".
"calendarPref.timeInterval = ".Application_Model_Preference::GetCalendarTimeInterval().";\n".
"calendarPref.weekStartDay = ".Application_Model_Preference::GetWeekStartDay().";\n".
"var calendarEvents = null;"
);
}
public function eventFeedAction()