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
2 changed files with 31 additions and 4 deletions
|
@ -18,6 +18,8 @@ class Application_Model_ShowBuilder {
|
||||||
private $contentDT;
|
private $contentDT;
|
||||||
private $epoch_now;
|
private $epoch_now;
|
||||||
|
|
||||||
|
private $hasCurrent;
|
||||||
|
|
||||||
private $defaultRowArray = array(
|
private $defaultRowArray = array(
|
||||||
"header" => false,
|
"header" => false,
|
||||||
"footer" => false,
|
"footer" => false,
|
||||||
|
@ -51,6 +53,8 @@ class Application_Model_ShowBuilder {
|
||||||
$this->user = Application_Model_User::GetCurrentUser();
|
$this->user = Application_Model_User::GetCurrentUser();
|
||||||
$this->opts = $p_opts;
|
$this->opts = $p_opts;
|
||||||
$this->epoch_now = time();
|
$this->epoch_now = time();
|
||||||
|
|
||||||
|
$this->hasCurrent = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
//check to see if this row should be editable.
|
//check to see if this row should be editable.
|
||||||
|
@ -98,6 +102,8 @@ class Application_Model_ShowBuilder {
|
||||||
$row["current"] = true;
|
$row["current"] = true;
|
||||||
//how many seconds the view should wait to redraw itself.
|
//how many seconds the view should wait to redraw itself.
|
||||||
$row["refresh"] = $p_epochItemEnd - $this->epoch_now;
|
$row["refresh"] = $p_epochItemEnd - $this->epoch_now;
|
||||||
|
|
||||||
|
$this->hasCurrent = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -115,6 +121,7 @@ class Application_Model_ShowBuilder {
|
||||||
|
|
||||||
$row["header"] = true;
|
$row["header"] = true;
|
||||||
$row["starts"] = $showStartDT->format("Y-m-d H:i");
|
$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["ends"] = $showEndDT->format("Y-m-d H:i");
|
||||||
$row["duration"] = $showEndDT->format("U") - $showStartDT->format("U");
|
$row["duration"] = $showEndDT->format("U") - $showStartDT->format("U");
|
||||||
$row["title"] = $p_item["show_name"];
|
$row["title"] = $p_item["show_name"];
|
||||||
|
@ -285,6 +292,10 @@ class Application_Model_ShowBuilder {
|
||||||
$display_items[] = $this->makeFooterRow($scheduled_items[count($scheduled_items)-1]);
|
$display_items[] = $this->makeFooterRow($scheduled_items[count($scheduled_items)-1]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!$this->hasCurrent) {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
return $display_items;
|
return $display_items;
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -14,6 +14,8 @@ var AIRTIME = (function(AIRTIME){
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
mod.timeout = undefined;
|
||||||
|
|
||||||
mod.resetTimestamp = function() {
|
mod.resetTimestamp = function() {
|
||||||
var timestamp = $("#sb_timestamp");
|
var timestamp = $("#sb_timestamp");
|
||||||
//reset timestamp value since input values could have changed.
|
//reset timestamp value since input values could have changed.
|
||||||
|
@ -301,7 +303,11 @@ var AIRTIME = (function(AIRTIME){
|
||||||
markerDiv,
|
markerDiv,
|
||||||
td,
|
td,
|
||||||
$lib = $("#library_content"),
|
$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.
|
//only create the cursor arrows if the library is on the page.
|
||||||
if ($lib.length > 0 && $lib.filter(":visible").length > 0) {
|
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.
|
//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");
|
tr = tableDiv.find("tr.sb-now-playing");
|
||||||
|
|
||||||
if (tr.length > 0) {
|
if (tr.length > 0) {
|
||||||
var oTable = $('#show_builder_table').dataTable(),
|
|
||||||
aData = tr.data("aData");
|
aData = tr.data("aData");
|
||||||
|
|
||||||
setTimeout(function(){
|
setTimeout(function(){
|
||||||
|
@ -338,6 +344,16 @@ var AIRTIME = (function(AIRTIME){
|
||||||
oTable.fnDraw();
|
oTable.fnDraw();
|
||||||
}, aData.refresh * 1000); //need refresh in milliseconds
|
}, 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) {
|
"fnHeaderCallback": function(nHead) {
|
||||||
$(nHead).find("input[type=checkbox]").attr("checked", false);
|
$(nHead).find("input[type=checkbox]").attr("checked", false);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue