Merge branch 'CC-3174' into devel
This commit is contained in:
commit
451b573c52
|
@ -111,7 +111,7 @@ class ShowbuilderController extends Zend_Controller_Action
|
|||
$item = CcScheduleQuery::create()->findPK($id);
|
||||
$instance = $item->getCcShowInstances();
|
||||
|
||||
if ($now < intval($item->getDbStarts("U")) && $user->canSchedule($instance->getDbShowId())) {
|
||||
if ($now < intval($item->getDbEnds("U")) && $user->canSchedule($instance->getDbShowId())) {
|
||||
$menu["del"] = array("name"=> "Delete", "icon" => "delete", "url" => "/showbuilder/schedule-remove");
|
||||
}
|
||||
|
||||
|
|
|
@ -89,7 +89,7 @@ class Application_Model_Scheduler {
|
|||
*
|
||||
* @return DateTime endDT in UTC
|
||||
*/
|
||||
public static function findEndTime($p_startDT, $p_duration) {
|
||||
private static function findEndTime($p_startDT, $p_duration) {
|
||||
|
||||
$startEpoch = $p_startDT->format("U.u");
|
||||
$durationSeconds = Application_Model_Playlist::playlistTimeToSeconds($p_duration);
|
||||
|
@ -109,6 +109,39 @@ class Application_Model_Scheduler {
|
|||
|
||||
return $dt;
|
||||
}
|
||||
|
||||
private function findNextStartTime($DT, $instance) {
|
||||
|
||||
//check to see if the show has started.
|
||||
$nowDT = new DateTime("now", new DateTimeZone("UTC"));
|
||||
|
||||
$sEpoch = intval($DT->format("U"));
|
||||
$nEpoch = intval($nowDT->format("U"));
|
||||
|
||||
//check for if the show has started.
|
||||
if ($nEpoch > $sEpoch) {
|
||||
//need some kind of placeholder for cc_schedule.
|
||||
//playout_status will be -1.
|
||||
$nextDT = $nowDT;
|
||||
|
||||
$length = $nEpoch - $sEpoch;
|
||||
$cliplength = Application_Model_Playlist::secondsToPlaylistTime($length);
|
||||
|
||||
//fillers are for only storing a chunk of time space that has already passed.
|
||||
$filler = new CcSchedule();
|
||||
$filler->setDbStarts($DT)
|
||||
->setDbEnds($nowDT)
|
||||
->setDbClipLength($cliplength)
|
||||
->setDbPlayoutStatus(-1)
|
||||
->setDbInstanceId($instance->getDbId())
|
||||
->save($this->con);
|
||||
}
|
||||
else {
|
||||
$nextDT = $DT;
|
||||
}
|
||||
|
||||
return $nextDT;
|
||||
}
|
||||
|
||||
/*
|
||||
* @param array $scheduledIds
|
||||
|
@ -145,12 +178,16 @@ class Application_Model_Scheduler {
|
|||
if (intval($schedule["instance"]) !== $instance->getDbId()) {
|
||||
throw new OutDatedScheduleException("The schedule you're viewing is out of date!");
|
||||
}
|
||||
$nextStartDT = $schedItem->getDbEnds(null);
|
||||
$schedItemEndDT = $schedItem->getDbEnds(null);
|
||||
$nextStartDT = $this->findNextStartTime($schedItemEndDT, $instance);
|
||||
}
|
||||
//selected empty row to add after
|
||||
else {
|
||||
$instance = CcShowInstancesQuery::create()->findPK($schedule["instance"], $this->con);
|
||||
$nextStartDT = $instance->getDbStarts(null);
|
||||
|
||||
//check to see if the show has started.
|
||||
$showStartDT = $instance->getDbStarts(null);
|
||||
$nextStartDT = $this->findNextStartTime($showStartDT, $instance);
|
||||
}
|
||||
|
||||
$currTs = intval($instance->getDbLastScheduled("U")) ? : 0;
|
||||
|
@ -244,6 +281,7 @@ class Application_Model_Scheduler {
|
|||
->update(array('DbLastScheduled' => new DateTime("now", new DateTimeZone("UTC"))), $this->con);
|
||||
}
|
||||
catch (Exception $e) {
|
||||
Logging::debug($e->getMessage());
|
||||
throw $e;
|
||||
}
|
||||
}
|
||||
|
@ -387,6 +425,8 @@ class Application_Model_Scheduler {
|
|||
|
||||
$removedItems = CcScheduleQuery::create()->findPks(array_keys($scheduledIds));
|
||||
|
||||
//check to see if the current item is being deleted so we can truncate the record.
|
||||
$currentItem = null;
|
||||
//check to make sure all items selected are up to date
|
||||
foreach ($removedItems as $removedItem) {
|
||||
$ts = $scheduledIds[$removedItem->getDbId()];
|
||||
|
@ -400,10 +440,25 @@ class Application_Model_Scheduler {
|
|||
$show = $instance->getCcShow($this->con);
|
||||
throw new OutDatedScheduleException("The show {$show->getDbName()} has been previously updated!");
|
||||
}
|
||||
|
||||
//check to truncate the currently playing item instead of deleting it.
|
||||
if ($removedItem->isCurrentItem()) {
|
||||
$now = new DateTime("now", new DateTimeZone("UTC"));
|
||||
|
||||
$nEpoch = floatval($now->format('U.u'));
|
||||
$sEpoch = floatval($removedItem->getDbStarts('U.u'));
|
||||
$length = $nEpoch - $sEpoch;
|
||||
$cliplength = Application_Model_Playlist::secondsToPlaylistTime($length);
|
||||
|
||||
$removedItem->setDbClipLength($cliplength);
|
||||
$removedItem->setDbEnds($now);
|
||||
$removedItem->save($this->con);
|
||||
}
|
||||
else {
|
||||
$removedItem->delete($this->con);
|
||||
}
|
||||
}
|
||||
|
||||
$removedItems->delete($this->con);
|
||||
|
||||
if ($adjustSched === true) {
|
||||
//get the show instances of the shows we must adjust times for.
|
||||
foreach ($removedItems as $item) {
|
||||
|
|
|
@ -51,10 +51,10 @@ class Application_Model_ShowBuilder {
|
|||
$this->timezone = date_default_timezone_get();
|
||||
$this->user = Application_Model_User::GetCurrentUser();
|
||||
$this->opts = $p_opts;
|
||||
$this->epoch_now = time();
|
||||
$this->epoch_now = floatval(microtime(true));
|
||||
}
|
||||
|
||||
//check to see if this row should be editable.
|
||||
//check to see if this row should be editable by the user.
|
||||
private function isAllowed($p_item, &$row) {
|
||||
|
||||
//cannot schedule in a recorded show.
|
||||
|
@ -62,17 +62,9 @@ class Application_Model_ShowBuilder {
|
|||
return;
|
||||
}
|
||||
|
||||
$showStartDT = new DateTime($p_item["si_starts"], new DateTimeZone("UTC"));
|
||||
$schedStartDT = new DateTime($p_item["sched_starts"], new DateTimeZone("UTC"));
|
||||
|
||||
$showStartEpoch = intval($showStartDT->format('U'));
|
||||
$schedStartEpoch = intval($schedStartDT->format('U'));
|
||||
|
||||
//can only schedule the show if item hasn't started and you are allowed.
|
||||
if ($this->epoch_now < max($showStartEpoch, $schedStartEpoch)
|
||||
&& $this->user->canSchedule($p_item["show_id"]) == true) {
|
||||
if ($this->user->canSchedule($p_item["show_id"]) == true) {
|
||||
$row["allowed"] = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private function getItemColor($p_item, &$row) {
|
||||
|
@ -117,7 +109,7 @@ class Application_Model_ShowBuilder {
|
|||
* 2 = future
|
||||
*/
|
||||
private function getScheduledStatus($p_epochItemStart, $p_epochItemEnd, &$row) {
|
||||
|
||||
|
||||
if ($row["footer"] === true && $this->epoch_now > $p_epochItemStart && $this->epoch_now > $p_epochItemEnd) {
|
||||
$row["scheduled"] = 0;
|
||||
}
|
||||
|
@ -154,20 +146,20 @@ class Application_Model_ShowBuilder {
|
|||
$row = $this->defaultRowArray;
|
||||
$this->isAllowed($p_item, $row);
|
||||
$this->getRowTimestamp($p_item, $row);
|
||||
$this->getItemColor($p_item, &$row);
|
||||
$this->getItemColor($p_item, $row);
|
||||
|
||||
$showStartDT = new DateTime($p_item["si_starts"], new DateTimeZone("UTC"));
|
||||
$showStartDT->setTimezone(new DateTimeZone($this->timezone));
|
||||
$startsEpoch = intval($showStartDT->format("U"));
|
||||
$startsEpoch = floatval($showStartDT->format("U.u"));
|
||||
$showEndDT = new DateTime($p_item["si_ends"], new DateTimeZone("UTC"));
|
||||
$showEndDT->setTimezone(new DateTimeZone($this->timezone));
|
||||
$endsEpoch = intval($showEndDT->format("U"));
|
||||
$endsEpoch = floatval($showEndDT->format("U.u"));
|
||||
|
||||
$row["header"] = true;
|
||||
$row["starts"] = $showStartDT->format("Y-m-d H:i");
|
||||
$row["timeUntil"] = intval($showStartDT->format("U")) - $this->epoch_now;
|
||||
$row["timeUntil"] = floatval($showStartDT->format("U.u")) - $this->epoch_now;
|
||||
$row["ends"] = $showEndDT->format("Y-m-d H:i");
|
||||
$row["duration"] = $showEndDT->format("U") - $showStartDT->format("U");
|
||||
$row["duration"] = floatval($showEndDT->format("U.u")) - floatval($showStartDT->format("U.u"));
|
||||
$row["title"] = $p_item["show_name"];
|
||||
$row["instance"] = intval($p_item["si_id"]);
|
||||
$row["image"] = '';
|
||||
|
@ -182,10 +174,6 @@ class Application_Model_ShowBuilder {
|
|||
private function makeScheduledItemRow($p_item) {
|
||||
$row = $this->defaultRowArray;
|
||||
|
||||
$this->getItemColor($p_item, &$row);
|
||||
$this->getRowTimestamp($p_item, $row);
|
||||
$this->isAllowed($p_item, $row);
|
||||
|
||||
if (isset($p_item["sched_starts"])) {
|
||||
|
||||
$schedStartDT = new DateTime($p_item["sched_starts"], new DateTimeZone("UTC"));
|
||||
|
@ -196,9 +184,9 @@ class Application_Model_ShowBuilder {
|
|||
|
||||
$this->getItemStatus($p_item, $row);
|
||||
|
||||
$startsEpoch = intval($schedStartDT->format("U"));
|
||||
$endsEpoch = intval($schedEndDT->format("U"));
|
||||
$showEndEpoch = intval($showEndDT->format("U"));
|
||||
$startsEpoch = floatval($schedStartDT->format("U.u"));
|
||||
$endsEpoch = floatval($schedEndDT->format("U.u"));
|
||||
$showEndEpoch = floatval($showEndDT->format("U.u"));
|
||||
|
||||
//don't want an overbooked item to stay marked as current.
|
||||
$this->getScheduledStatus($startsEpoch, min($endsEpoch, $showEndEpoch), $row);
|
||||
|
@ -235,6 +223,10 @@ class Application_Model_ShowBuilder {
|
|||
$row["instance"] = intval($p_item["si_id"]);
|
||||
$row["image"] = '';
|
||||
}
|
||||
|
||||
$this->getItemColor($p_item, $row);
|
||||
$this->getRowTimestamp($p_item, $row);
|
||||
$this->isAllowed($p_item, $row);
|
||||
|
||||
return $row;
|
||||
}
|
||||
|
@ -258,12 +250,13 @@ class Application_Model_ShowBuilder {
|
|||
|
||||
$showStartDT = new DateTime($p_item["si_starts"], new DateTimeZone("UTC"));
|
||||
$showStartDT->setTimezone(new DateTimeZone($this->timezone));
|
||||
$startsEpoch = intval($showStartDT->format("U"));
|
||||
$startsEpoch = floatval($showStartDT->format("U.u"));
|
||||
$showEndDT = new DateTime($p_item["si_ends"], new DateTimeZone("UTC"));
|
||||
$showEndDT->setTimezone(new DateTimeZone($this->timezone));
|
||||
$endsEpoch = intval($showEndDT->format("U"));
|
||||
$endsEpoch = floatval($showEndDT->format("U.u"));
|
||||
|
||||
$this->getScheduledStatus($startsEpoch, $endsEpoch, $row);
|
||||
$this->getScheduledStatus($startsEpoch, $endsEpoch, $row);
|
||||
$this->isAllowed($p_item, $row);
|
||||
|
||||
return $row;
|
||||
}
|
||||
|
@ -276,9 +269,6 @@ class Application_Model_ShowBuilder {
|
|||
*/
|
||||
public function hasBeenUpdatedSince($timestamp) {
|
||||
$outdated = false;
|
||||
|
||||
Logging::log("checking if show builder has been updated since {$timestamp}");
|
||||
|
||||
$shows = Application_Model_Show::getShows($this->startDT, $this->endDT);
|
||||
|
||||
foreach ($shows as $show) {
|
||||
|
@ -327,6 +317,11 @@ class Application_Model_ShowBuilder {
|
|||
for ($i = 0, $rows = count($scheduled_items); $i < $rows; $i++) {
|
||||
|
||||
$item = $scheduled_items[$i];
|
||||
|
||||
//don't send back data for filler rows.
|
||||
if (isset($item["playout_status"]) && $item["playout_status"] < 0) {
|
||||
continue;
|
||||
}
|
||||
|
||||
//make a header row.
|
||||
if ($current_id !== $item["si_id"]) {
|
||||
|
|
|
@ -223,5 +223,18 @@ class CcSchedule extends BaseCcSchedule {
|
|||
|
||||
return $this;
|
||||
} // setDbEnds()
|
||||
|
||||
public function isCurrentItem() {
|
||||
|
||||
$epochNow = time();
|
||||
$epochStart = intval($this->getDbStarts('U'));
|
||||
$epochEnd = intval($this->getDbEnds('U'));
|
||||
|
||||
if ($epochStart < $epochNow && $epochEnd > $epochNow) {
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
} // CcSchedule
|
||||
|
|
|
@ -112,10 +112,13 @@ class CcShowInstances extends BaseCcShowInstances {
|
|||
public function updateScheduleStatus(PropelPDO $con) {
|
||||
|
||||
Logging::log("in post save for showinstances");
|
||||
|
||||
$now = time();
|
||||
|
||||
//scheduled track is in the show
|
||||
CcScheduleQuery::create()
|
||||
->filterByDbInstanceId($this->id)
|
||||
->filterByDbPlayoutStatus(0, Criteria::GREATER_EQUAL)
|
||||
->filterByDbEnds($this->ends, Criteria::LESS_EQUAL)
|
||||
->update(array('DbPlayoutStatus' => 1), $con);
|
||||
|
||||
|
@ -124,6 +127,7 @@ class CcShowInstances extends BaseCcShowInstances {
|
|||
//scheduled track is a boundary track
|
||||
CcScheduleQuery::create()
|
||||
->filterByDbInstanceId($this->id)
|
||||
->filterByDbPlayoutStatus(0, Criteria::GREATER_EQUAL)
|
||||
->filterByDbStarts($this->ends, Criteria::LESS_THAN)
|
||||
->filterByDbEnds($this->ends, Criteria::GREATER_THAN)
|
||||
->update(array('DbPlayoutStatus' => 2), $con);
|
||||
|
@ -131,6 +135,7 @@ class CcShowInstances extends BaseCcShowInstances {
|
|||
//scheduled track is overbooked.
|
||||
CcScheduleQuery::create()
|
||||
->filterByDbInstanceId($this->id)
|
||||
->filterByDbPlayoutStatus(0, Criteria::GREATER_EQUAL)
|
||||
->filterByDbStarts($this->ends, Criteria::GREATER_THAN)
|
||||
->update(array('DbPlayoutStatus' => 0), $con);
|
||||
|
||||
|
|
|
@ -726,7 +726,9 @@ abstract class BaseCcSchedule extends BaseObject implements Persistent
|
|||
if ($v !== null) {
|
||||
$v = (int) $v;
|
||||
}
|
||||
|
||||
|
||||
Logging::log('$v status is '.$v);
|
||||
|
||||
if ($this->playout_status !== $v || $this->isNew()) {
|
||||
$this->playout_status = $v;
|
||||
$this->modifiedColumns[] = CcSchedulePeer::PLAYOUT_STATUS;
|
||||
|
|
|
@ -75,10 +75,6 @@
|
|||
width:100px;
|
||||
}
|
||||
|
||||
table.datatable tr.cursor-selected-row td, table.datatable tr.cursor-selected-row th {
|
||||
border-bottom: 1px solid rgba(215, 0, 0, 1) !important;
|
||||
}
|
||||
|
||||
.sb-starts,
|
||||
.sb-ends {
|
||||
text-align: center;
|
||||
|
@ -90,7 +86,7 @@ table.datatable tr.cursor-selected-row td, table.datatable tr.cursor-selected-ro
|
|||
}
|
||||
.marker {
|
||||
background: url(images/tl-arrow.png) no-repeat scroll 3px 4px;
|
||||
bottom: -14px;
|
||||
top: -14px;
|
||||
display: block;
|
||||
height: 9px;
|
||||
left: -17px;
|
||||
|
@ -109,6 +105,10 @@ tr.cursor-selected-row .marker {
|
|||
background-color: rgba(215, 0, 0, 1);
|
||||
}
|
||||
|
||||
table.datatable tr.cursor-selected-row td, table.datatable tr.cursor-selected-row th {
|
||||
border-top: 1px solid rgba(215, 0, 0, 1) !important;
|
||||
}
|
||||
|
||||
.sb-content .sb-past {
|
||||
opacity: .6;
|
||||
}
|
||||
|
|
|
@ -109,7 +109,7 @@ var AIRTIME = (function(AIRTIME){
|
|||
|
||||
aData = [];
|
||||
$("#show_builder_table tr.cursor-selected-row").each(function(i, el){
|
||||
aData.push($(el).data("aData"));
|
||||
aData.push($(el).prev().data("aData"));
|
||||
});
|
||||
|
||||
//process selected schedule rows to add media after.
|
||||
|
|
|
@ -220,15 +220,109 @@ var AIRTIME = (function(AIRTIME){
|
|||
r,g,b,a,
|
||||
$nRow = $(nRow);
|
||||
|
||||
//call the context menu so we can prevent the event from propagating.
|
||||
$(nRow).find('td:not(.sb-checkbox)').click(function(e){
|
||||
|
||||
$(this).contextMenu({x: e.pageX, y: e.pageY});
|
||||
|
||||
return false;
|
||||
});
|
||||
fnPrepareSeparatorRow = function(sRowContent, sClass, iNodeIndex) {
|
||||
|
||||
node = nRow.children[iNodeIndex];
|
||||
node.innerHTML = sRowContent;
|
||||
node.setAttribute('colspan',100);
|
||||
for (i = iNodeIndex + 1; i < nRow.children.length; i = i+1) {
|
||||
node = nRow.children[i];
|
||||
node.innerHTML = "";
|
||||
node.setAttribute("style", "display : none");
|
||||
}
|
||||
|
||||
$(nRow).addClass(sClass);
|
||||
};
|
||||
|
||||
if (aData.header === true) {
|
||||
//remove the column classes from all tds.
|
||||
$(nRow).find('td').removeClass();
|
||||
|
||||
node = nRow.children[0];
|
||||
node.innerHTML = '';
|
||||
cl = 'sb-header';
|
||||
|
||||
sSeparatorHTML = '<span class="show-title">'+aData.title+'</span>';
|
||||
sSeparatorHTML += '<span class="push-right"><span class="show-time">'+aData.starts+'</span>-<span class="show-time">'+aData.ends+'</span></span>';
|
||||
fnPrepareSeparatorRow(sSeparatorHTML, cl, 1);
|
||||
}
|
||||
else if (aData.footer === true) {
|
||||
//remove the column classes from all tds.
|
||||
$(nRow).find('td').removeClass();
|
||||
|
||||
node = nRow.children[0];
|
||||
cl = 'sb-footer';
|
||||
|
||||
//check the show's content status.
|
||||
if (aData.runtime > 0) {
|
||||
node.innerHTML = '<span class="ui-icon ui-icon-check"></span>';
|
||||
cl = cl + ' ui-state-highlight';
|
||||
}
|
||||
else {
|
||||
node.innerHTML = '<span class="ui-icon ui-icon-notice"></span>';
|
||||
cl = cl + ' ui-state-error';
|
||||
}
|
||||
|
||||
sSeparatorHTML = '<span>'+aData.fRuntime+'</span>';
|
||||
fnPrepareSeparatorRow(sSeparatorHTML, cl, 1);
|
||||
}
|
||||
else if (aData.empty === true) {
|
||||
//remove the column classes from all tds.
|
||||
$(nRow).find('td').removeClass();
|
||||
|
||||
node = nRow.children[0];
|
||||
node.innerHTML = '';
|
||||
|
||||
sSeparatorHTML = '<span>Show Empty</span>';
|
||||
cl = cl + " sb-empty odd";
|
||||
|
||||
fnPrepareSeparatorRow(sSeparatorHTML, cl, 1);
|
||||
}
|
||||
else if (aData.record === true) {
|
||||
//remove the column classes from all tds.
|
||||
$(nRow).find('td').removeClass();
|
||||
|
||||
node = nRow.children[0];
|
||||
node.innerHTML = '';
|
||||
|
||||
sSeparatorHTML = '<span>Recording From Line In</span>';
|
||||
cl = cl + " sb-record odd";
|
||||
|
||||
fnPrepareSeparatorRow(sSeparatorHTML, cl, 1);
|
||||
}
|
||||
else {
|
||||
|
||||
node = nRow.children[0];
|
||||
if (aData.allowed === true && aData.scheduled >= 1) {
|
||||
node.innerHTML = '<input type="checkbox" name="'+aData.id+'"></input>';
|
||||
}
|
||||
else {
|
||||
node.innerHTML = '';
|
||||
}
|
||||
}
|
||||
|
||||
//save some info for reordering purposes.
|
||||
//add the show colour to the leftmost td
|
||||
if (aData.footer !== true) {
|
||||
|
||||
if ($nRow.hasClass('sb-header')) {
|
||||
a = 1;
|
||||
}
|
||||
else if ($nRow.hasClass('odd')) {
|
||||
a = 0.3;
|
||||
}
|
||||
else if ($nRow.hasClass('even')) {
|
||||
a = 0.4;
|
||||
}
|
||||
|
||||
//convert from hex to rgb.
|
||||
r = parseInt((aData.backgroundColor).substring(0,2), 16);
|
||||
g = parseInt((aData.backgroundColor).substring(2,4), 16);
|
||||
b = parseInt((aData.backgroundColor).substring(4,6), 16);
|
||||
|
||||
$nRow.find('td:first').css('background', 'rgba('+r+', '+g+', '+b+', '+a+')');
|
||||
}
|
||||
|
||||
//save some info for reordering purposes.
|
||||
$(nRow).data({"aData": aData});
|
||||
|
||||
if (aData.scheduled === 1) {
|
||||
|
@ -256,101 +350,19 @@ var AIRTIME = (function(AIRTIME){
|
|||
$(nRow).addClass("sb-over");
|
||||
}
|
||||
|
||||
fnPrepareSeparatorRow = function(sRowContent, sClass, iNodeIndex) {
|
||||
|
||||
node = nRow.children[iNodeIndex];
|
||||
node.innerHTML = sRowContent;
|
||||
node.setAttribute('colspan',100);
|
||||
for (i = iNodeIndex + 1; i < nRow.children.length; i = i+1) {
|
||||
node = nRow.children[i];
|
||||
node.innerHTML = "";
|
||||
node.setAttribute("style", "display : none");
|
||||
}
|
||||
|
||||
$(nRow).addClass(sClass);
|
||||
};
|
||||
|
||||
//add the play function to the library_type td or the speaker
|
||||
$(nRow).find('td.library_image').click(function(){
|
||||
//add the play function
|
||||
$(nRow).find('td.sb-image').click(function(){
|
||||
open_show_preview(aData.instance, iDisplayIndex);
|
||||
return false;
|
||||
});
|
||||
|
||||
if (aData.header === true) {
|
||||
node = nRow.children[0];
|
||||
node.innerHTML = '';
|
||||
cl = 'sb-header';
|
||||
|
||||
sSeparatorHTML = '<span class="show-title">'+aData.title+'</span>';
|
||||
sSeparatorHTML += '<span class="push-right"><span class="show-time">'+aData.starts+'</span>-<span class="show-time">'+aData.ends+'</span></span>';
|
||||
fnPrepareSeparatorRow(sSeparatorHTML, cl, 1);
|
||||
}
|
||||
else if (aData.footer === true) {
|
||||
node = nRow.children[0];
|
||||
cl = 'sb-footer';
|
||||
|
||||
//check the show's content status.
|
||||
if (aData.runtime > 0) {
|
||||
node.innerHTML = '<span class="ui-icon ui-icon-check"></span>';
|
||||
cl = cl + ' ui-state-highlight';
|
||||
}
|
||||
else {
|
||||
node.innerHTML = '<span class="ui-icon ui-icon-notice"></span>';
|
||||
cl = cl + ' ui-state-error';
|
||||
}
|
||||
|
||||
sSeparatorHTML = '<span>'+aData.fRuntime+'</span>';
|
||||
fnPrepareSeparatorRow(sSeparatorHTML, cl, 1);
|
||||
}
|
||||
else if (aData.empty === true) {
|
||||
node = nRow.children[0];
|
||||
node.innerHTML = '';
|
||||
|
||||
sSeparatorHTML = '<span>Show Empty</span>';
|
||||
cl = cl + " sb-empty odd";
|
||||
|
||||
fnPrepareSeparatorRow(sSeparatorHTML, cl, 1);
|
||||
}
|
||||
else if (aData.record === true) {
|
||||
node = nRow.children[0];
|
||||
node.innerHTML = '';
|
||||
|
||||
sSeparatorHTML = '<span>Recording From Line In</span>';
|
||||
cl = cl + " sb-record odd";
|
||||
|
||||
fnPrepareSeparatorRow(sSeparatorHTML, cl, 1);
|
||||
}
|
||||
else {
|
||||
|
||||
node = nRow.children[0];
|
||||
if (aData.allowed === true) {
|
||||
node.innerHTML = '<input type="checkbox" name="'+aData.id+'"></input>';
|
||||
}
|
||||
else {
|
||||
node.innerHTML = '';
|
||||
}
|
||||
}
|
||||
|
||||
//add the show colour to the leftmost td
|
||||
if (aData.footer !== true) {
|
||||
|
||||
if ($nRow.hasClass('sb-header')) {
|
||||
a = 1;
|
||||
}
|
||||
else if ($nRow.hasClass('odd')) {
|
||||
a = 0.3;
|
||||
}
|
||||
else if ($nRow.hasClass('even')) {
|
||||
a = 0.4;
|
||||
}
|
||||
|
||||
//convert from hex to rgb.
|
||||
r = parseInt((aData.backgroundColor).substring(0,2), 16);
|
||||
g = parseInt((aData.backgroundColor).substring(2,4), 16);
|
||||
b = parseInt((aData.backgroundColor).substring(4,6), 16);
|
||||
|
||||
$nRow.find('td.sb-checkbox').css('background', 'rgba('+r+', '+g+', '+b+', '+a+')');
|
||||
}
|
||||
|
||||
//call the context menu so we can prevent the event from propagating.
|
||||
$(nRow).find('td:gt(1)').click(function(e){
|
||||
|
||||
$(this).contextMenu({x: e.pageX, y: e.pageY});
|
||||
|
||||
return false;
|
||||
});
|
||||
},
|
||||
"fnDrawCallback": function(oSettings, json) {
|
||||
var wrapperDiv,
|
||||
|
@ -367,7 +379,7 @@ var AIRTIME = (function(AIRTIME){
|
|||
if ($lib.length > 0 && $lib.filter(":visible").length > 0) {
|
||||
|
||||
//create cursor arrows.
|
||||
$sbTable.find("tr.sb-now-playing, tr:not(:first, .sb-footer, .sb-empty, .sb-not-allowed)").each(function(i, el) {
|
||||
$sbTable.find("tr:not(:first, .sb-header, .sb-empty, .sb-now-playing, .sb-past, .sb-not-allowed)").each(function(i, el) {
|
||||
td = $(el).find("td:first");
|
||||
if (td.hasClass("dataTables_empty")) {
|
||||
return false;
|
||||
|
@ -404,7 +416,7 @@ var AIRTIME = (function(AIRTIME){
|
|||
}
|
||||
//current song is not set, set a timeout to refresh when the first item on the timeline starts.
|
||||
else {
|
||||
tr = $sbTable.find("tbody tr.sb-allowed.sb-header:first");
|
||||
tr = $sbTable.find("tbody tr.sb-future.sb-header:first");
|
||||
|
||||
if (tr.length > 0) {
|
||||
aData = tr.data("aData");
|
||||
|
@ -417,7 +429,7 @@ var AIRTIME = (function(AIRTIME){
|
|||
}
|
||||
|
||||
//check if there are any overbooked tracks on screen to enable the trim button.
|
||||
tr = $sbTable.find("tr.sb-over");
|
||||
tr = $sbTable.find("tr.sb-over.sb-future");
|
||||
|
||||
if (tr.length > 0) {
|
||||
//enable deleting of overbooked tracks.
|
||||
|
@ -457,7 +469,8 @@ var AIRTIME = (function(AIRTIME){
|
|||
if ($(node).hasClass("sb-header")
|
||||
|| $(node).hasClass("sb-footer")
|
||||
|| $(node).hasClass("sb-empty")
|
||||
|| $(node).hasClass("sb-not-allowed")) {
|
||||
|| $(node).hasClass("sb-not-allowed")
|
||||
|| $(node).hasClass("sb-past")) {
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
|
@ -466,7 +479,7 @@ var AIRTIME = (function(AIRTIME){
|
|||
|
||||
//seems to happen if everything is selected
|
||||
if ( node === null) {
|
||||
oTable.find("input[type=checkbox]").attr("checked", true);
|
||||
$sbTable.find("tbody input[type=checkbox]").attr("checked", true);
|
||||
}
|
||||
else {
|
||||
$(node).find("input[type=checkbox]").attr("checked", true);
|
||||
|
@ -508,7 +521,7 @@ var AIRTIME = (function(AIRTIME){
|
|||
if ($(this).is(":checked")) {
|
||||
var allowedNodes;
|
||||
|
||||
allowedNodes = oTable.find('tr:not(:first, .sb-header, .sb-empty, .sb-footer, .sb-not-allowed)');
|
||||
allowedNodes = oTable.find('tr:not(:first, .sb-header, .sb-empty, .sb-footer, .sb-not-allowed, .sb-past)');
|
||||
|
||||
allowedNodes.each(function(i, el){
|
||||
oTT.fnSelect(el);
|
||||
|
@ -658,7 +671,8 @@ var AIRTIME = (function(AIRTIME){
|
|||
|
||||
return draggingContainer;
|
||||
},
|
||||
items: 'tr:not(:first, :last, .sb-header, .sb-footer, .sb-not-allowed)',
|
||||
items: 'tr:not(:first, :last, .sb-header, .sb-not-allowed, .sb-past, .sb-now-playing)',
|
||||
cancel: '.sb-footer',
|
||||
receive: fnReceive,
|
||||
update: fnUpdate,
|
||||
start: function(event, ui) {
|
||||
|
@ -758,7 +772,7 @@ var AIRTIME = (function(AIRTIME){
|
|||
|
||||
//begin context menu initialization.
|
||||
$.contextMenu({
|
||||
selector: '#show_builder_table td:not(.sb-checkbox)',
|
||||
selector: '.sb-content table tbody tr:not(.sb-empty, .sb-footer, .sb-header) td:not(.sb-checkbox, .sb-image)',
|
||||
trigger: "left",
|
||||
ignoreRightClick: true,
|
||||
|
||||
|
|
Loading…
Reference in New Issue