Merge branch '2.1.x' of dev.sourcefabric.org:airtime into 2.1.x
This commit is contained in:
commit
42f4757288
|
@ -53,7 +53,8 @@ class Application_Common_DateHelper
|
||||||
*/
|
*/
|
||||||
function getWeekStartDate()
|
function getWeekStartDate()
|
||||||
{
|
{
|
||||||
$startDate = date('w') == 0 ? date('Y-m-d') : date('Y-m-d', strtotime('monday this week'));
|
// our week starts on monday, but php week starts on sunday.
|
||||||
|
$startDate = date('w') == 0 ? date('Y-m-d', strtotime('monday last week')) : date('Y-m-d', strtotime('monday this week'));
|
||||||
$startDateTime = new DateTime($startDate);
|
$startDateTime = new DateTime($startDate);
|
||||||
return $startDateTime->format('Y-m-d H:i:s');
|
return $startDateTime->format('Y-m-d H:i:s');
|
||||||
}
|
}
|
||||||
|
|
|
@ -274,20 +274,27 @@ class ApiController extends Zend_Controller_Action
|
||||||
if($type == "endofday") {
|
if($type == "endofday") {
|
||||||
// make GetNextShows use end of day
|
// make GetNextShows use end of day
|
||||||
$utcTimeEnd = Application_Common_DateHelper::GetDayEndTimestampInUtc();
|
$utcTimeEnd = Application_Common_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"));
|
||||||
|
}else{
|
||||||
|
|
||||||
|
$limit = $request->getParam('limit');
|
||||||
|
if($limit == "" || !is_numeric($limit)) {
|
||||||
|
$limit = "5";
|
||||||
|
}
|
||||||
|
|
||||||
|
$result = Application_Model_Schedule::GetPlayOrderRange();
|
||||||
|
|
||||||
|
//Convert from UTC to localtime for user.
|
||||||
|
Application_Model_Show::ConvertToLocalTimeZone($result["currentShow"], array("starts", "ends", "start_timestamp", "end_timestamp"));
|
||||||
|
Application_Model_Show::ConvertToLocalTimeZone($result["nextShow"], array("starts", "ends", "start_timestamp", "end_timestamp"));
|
||||||
}
|
}
|
||||||
|
|
||||||
$limit = $request->getParam('limit');
|
|
||||||
if($limit == "" || !is_numeric($limit)) {
|
|
||||||
$limit = "5";
|
|
||||||
}
|
|
||||||
|
|
||||||
$result = Application_Model_Schedule::GetPlayOrderRange();
|
|
||||||
$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.
|
||||||
|
|
||||||
//Convert from UTC to localtime for user.
|
|
||||||
Application_Model_Show::ConvertToLocalTimeZone($result["currentShow"], array("starts", "ends", "start_timestamp", "end_timestamp"));
|
|
||||||
Application_Model_Show::ConvertToLocalTimeZone($result["nextShow"], array("starts", "ends", "start_timestamp", "end_timestamp"));
|
|
||||||
|
|
||||||
//echo json_encode($result);
|
//echo json_encode($result);
|
||||||
header("Content-type: text/javascript");
|
header("Content-type: text/javascript");
|
||||||
echo $_GET['callback'].'('.json_encode($result).')';
|
echo $_GET['callback'].'('.json_encode($result).')';
|
||||||
|
|
|
@ -10,8 +10,9 @@ var AIRTIME = (function(AIRTIME){
|
||||||
$ul,
|
$ul,
|
||||||
$lib,
|
$lib,
|
||||||
cursors = [],
|
cursors = [],
|
||||||
cursorIds = [];
|
cursorIds = [],
|
||||||
showInstanceIds = [];
|
showInstanceIds = [],
|
||||||
|
headerFooter = [];
|
||||||
|
|
||||||
if (AIRTIME.showbuilder === undefined) {
|
if (AIRTIME.showbuilder === undefined) {
|
||||||
AIRTIME.showbuilder = {};
|
AIRTIME.showbuilder = {};
|
||||||
|
@ -213,15 +214,28 @@ var AIRTIME = (function(AIRTIME){
|
||||||
checkError(json);
|
checkError(json);
|
||||||
|
|
||||||
cursorIds = [];
|
cursorIds = [];
|
||||||
|
|
||||||
/* We need to keep record of which show the cursor belongs to
|
/* We need to keep record of which show the cursor belongs to
|
||||||
* in the case where more than one show is displayed in the show builder
|
* in the case where more than one show is displayed in the show builder
|
||||||
* because header and footer rows have the same id
|
* because header and footer rows have the same id
|
||||||
*/
|
*/
|
||||||
showInstanceIds = [];
|
showInstanceIds = [];
|
||||||
|
|
||||||
|
/* Keeps track if the row is a footer. We need to do this because
|
||||||
|
* header and footer rows have the save cursorIds and showInstanceId
|
||||||
|
* so both will be selected in the draw callback
|
||||||
|
*/
|
||||||
|
headerFooter = [];
|
||||||
|
|
||||||
cursors = $(".cursor-selected-row");
|
cursors = $(".cursor-selected-row");
|
||||||
for (i = 0; i < cursors.length; i++) {
|
for (i = 0; i < cursors.length; i++) {
|
||||||
cursorIds.push(($(cursors.get(i)).attr("id")));
|
cursorIds.push(($(cursors.get(i)).attr("id")));
|
||||||
showInstanceIds.push(($(cursors.get(i)).attr("si_id")));
|
showInstanceIds.push(($(cursors.get(i)).attr("si_id")));
|
||||||
|
if ($(cursors.get(i)).hasClass("sb-footer")) {
|
||||||
|
headerFooter.push("f");
|
||||||
|
} else {
|
||||||
|
headerFooter.push("n");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
oSchedTable.fnDraw();
|
oSchedTable.fnDraw();
|
||||||
|
|
||||||
|
@ -678,15 +692,26 @@ var AIRTIME = (function(AIRTIME){
|
||||||
|
|
||||||
//re-highlight selected cursors before draw took place
|
//re-highlight selected cursors before draw took place
|
||||||
for (i = 0; i < cursorIds.length; i++) {
|
for (i = 0; i < cursorIds.length; i++) {
|
||||||
$tr = $table.find("tr[id="+cursorIds[i]+"][si_id="+showInstanceIds[i]+"]");
|
if (headerFooter[i] == "f") {
|
||||||
|
$tr = $table.find("tbody tr.sb-footer[id="+cursorIds[i]+"][si_id="+showInstanceIds[i]+"]");
|
||||||
|
} else {
|
||||||
|
$tr = $table.find("tr[id="+cursorIds[i]+"][si_id="+showInstanceIds[i]+"]");
|
||||||
|
}
|
||||||
|
|
||||||
/* If the currently playing track's cursor is selected,
|
/* If the currently playing track's cursor is selected,
|
||||||
* and that track is deleted, the cursor position becomes
|
* and that track is deleted, the cursor position becomes
|
||||||
* unavailble. We have to check the position is available
|
* unavailble. We have to check the position is available
|
||||||
* before re-highlighting it.
|
* before re-highlighting it.
|
||||||
*/
|
*/
|
||||||
if ($tr.find(".sb-checkbox").children().hasClass("innerWrapper")) {
|
if ($tr.find(".sb-checkbox").children().hasClass("innerWrapper")) {
|
||||||
mod.selectCursor($tr);
|
mod.selectCursor($tr);
|
||||||
|
|
||||||
|
/* If the selected cursor is the footer row we need to
|
||||||
|
* explicitly select it because that row does not have
|
||||||
|
* innerWrapper class
|
||||||
|
*/
|
||||||
|
} else if ($tr.hasClass("sb-footer")) {
|
||||||
|
mod.selectCursor($tr);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue