CC-3174 : showbuilder
setting a timeout to refresh when the first item on the timeline starts incse there is no "current" item.
This commit is contained in:
parent
20db8d6fdf
commit
3b32a16813
|
@ -18,6 +18,8 @@ class Application_Model_ShowBuilder {
|
|||
private $contentDT;
|
||||
private $epoch_now;
|
||||
|
||||
private $hasCurrent;
|
||||
|
||||
private $defaultRowArray = array(
|
||||
"header" => false,
|
||||
"footer" => false,
|
||||
|
@ -51,6 +53,8 @@ class Application_Model_ShowBuilder {
|
|||
$this->user = Application_Model_User::GetCurrentUser();
|
||||
$this->opts = $p_opts;
|
||||
$this->epoch_now = time();
|
||||
|
||||
$this->hasCurrent = false;
|
||||
}
|
||||
|
||||
//check to see if this row should be editable.
|
||||
|
@ -98,6 +102,8 @@ class Application_Model_ShowBuilder {
|
|||
$row["current"] = true;
|
||||
//how many seconds the view should wait to redraw itself.
|
||||
$row["refresh"] = $p_epochItemEnd - $this->epoch_now;
|
||||
|
||||
$this->hasCurrent = true;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -115,6 +121,7 @@ class Application_Model_ShowBuilder {
|
|||
|
||||
$row["header"] = true;
|
||||
$row["starts"] = $showStartDT->format("Y-m-d H:i");
|
||||
$row["timeUntil"] = intval($showStartDT->format("U")) - $this->epoch_now;
|
||||
$row["ends"] = $showEndDT->format("Y-m-d H:i");
|
||||
$row["duration"] = $showEndDT->format("U") - $showStartDT->format("U");
|
||||
$row["title"] = $p_item["show_name"];
|
||||
|
@ -285,6 +292,10 @@ class Application_Model_ShowBuilder {
|
|||
$display_items[] = $this->makeFooterRow($scheduled_items[count($scheduled_items)-1]);
|
||||
}
|
||||
|
||||
if (!$this->hasCurrent) {
|
||||
|
||||
}
|
||||
|
||||
return $display_items;
|
||||
}
|
||||
}
|
|
@ -14,6 +14,8 @@ var AIRTIME = (function(AIRTIME){
|
|||
}
|
||||
}
|
||||
|
||||
mod.timeout = undefined;
|
||||
|
||||
mod.resetTimestamp = function() {
|
||||
var timestamp = $("#sb_timestamp");
|
||||
//reset timestamp value since input values could have changed.
|
||||
|
@ -301,7 +303,11 @@ var AIRTIME = (function(AIRTIME){
|
|||
markerDiv,
|
||||
td,
|
||||
$lib = $("#library_content"),
|
||||
tr;
|
||||
tr,
|
||||
oTable = $('#show_builder_table').dataTable(),
|
||||
aData;
|
||||
|
||||
clearTimeout(AIRTIME.showbuilder.timeout);
|
||||
|
||||
//only create the cursor arrows if the library is on the page.
|
||||
if ($lib.length > 0 && $lib.filter(":visible").length > 0) {
|
||||
|
@ -329,8 +335,8 @@ var AIRTIME = (function(AIRTIME){
|
|||
|
||||
//if the now playing song is visible set a timeout to redraw the table at the start of the next song.
|
||||
tr = tableDiv.find("tr.sb-now-playing");
|
||||
|
||||
if (tr.length > 0) {
|
||||
var oTable = $('#show_builder_table').dataTable(),
|
||||
aData = tr.data("aData");
|
||||
|
||||
setTimeout(function(){
|
||||
|
@ -338,6 +344,16 @@ var AIRTIME = (function(AIRTIME){
|
|||
oTable.fnDraw();
|
||||
}, aData.refresh * 1000); //need refresh in milliseconds
|
||||
}
|
||||
//current song is not set, set a timeout to refresh when the first item on the timeline starts.
|
||||
else {
|
||||
tr = tableDiv.find("tbody tr:first");
|
||||
aData = tr.data("aData");
|
||||
|
||||
AIRTIME.showbuilder.timeout = setTimeout(function(){
|
||||
AIRTIME.showbuilder.resetTimestamp();
|
||||
oTable.fnDraw();
|
||||
}, aData.timeUntil * 1000); //need refresh in milliseconds
|
||||
}
|
||||
},
|
||||
"fnHeaderCallback": function(nHead) {
|
||||
$(nHead).find("input[type=checkbox]").attr("checked", false);
|
||||
|
|
Loading…
Reference in New Issue