Merge branch '2.1.x' of dev.sourcefabric.org:airtime into 2.1.x

This commit is contained in:
Martin Konecny 2012-07-03 16:43:40 -04:00
commit 42f4757288
3 changed files with 50 additions and 17 deletions

View File

@ -53,7 +53,8 @@ class Application_Common_DateHelper
*/
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);
return $startDateTime->format('Y-m-d H:i:s');
}

View File

@ -274,20 +274,27 @@ class ApiController extends Zend_Controller_Action
if($type == "endofday") {
// make GetNextShows use end of day
$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.
//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);
header("Content-type: text/javascript");
echo $_GET['callback'].'('.json_encode($result).')';

View File

@ -10,8 +10,9 @@ var AIRTIME = (function(AIRTIME){
$ul,
$lib,
cursors = [],
cursorIds = [];
showInstanceIds = [];
cursorIds = [],
showInstanceIds = [],
headerFooter = [];
if (AIRTIME.showbuilder === undefined) {
AIRTIME.showbuilder = {};
@ -213,15 +214,28 @@ var AIRTIME = (function(AIRTIME){
checkError(json);
cursorIds = [];
/* 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
* because header and footer rows have the same id
*/
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");
for (i = 0; i < cursors.length; i++) {
cursorIds.push(($(cursors.get(i)).attr("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();
@ -678,15 +692,26 @@ var AIRTIME = (function(AIRTIME){
//re-highlight selected cursors before draw took place
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,
* and that track is deleted, the cursor position becomes
* unavailble. We have to check the position is available
* before re-highlighting it.
*/
*/
if ($tr.find(".sb-checkbox").children().hasClass("innerWrapper")) {
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);
}
}