CC-3174 : showbuilder
creating smart refresh timeout for now playing.
This commit is contained in:
parent
98d50ae4a7
commit
29b03c1181
|
@ -88,14 +88,13 @@ class Application_Model_ShowBuilder {
|
||||||
$row["timestamp"] = $ts;
|
$row["timestamp"] = $ts;
|
||||||
}
|
}
|
||||||
|
|
||||||
private function isCurrent($p_epochItemStart, $p_epochItemEnd) {
|
private function isCurrent($p_epochItemStart, $p_epochItemEnd, &$row) {
|
||||||
$current = false;
|
|
||||||
|
|
||||||
if ($this->epoch_now >= $p_epochItemStart && $this->epoch_now < $p_epochItemEnd) {
|
if ($this->epoch_now >= $p_epochItemStart && $this->epoch_now < $p_epochItemEnd) {
|
||||||
$current = true;
|
$row["current"] = true;
|
||||||
|
//how many seconds the view should wait to redraw itself.
|
||||||
|
$row["refresh"] = $p_epochItemEnd - $this->epoch_now;
|
||||||
}
|
}
|
||||||
|
|
||||||
return $current;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private function makeHeaderRow($p_item) {
|
private function makeHeaderRow($p_item) {
|
||||||
|
@ -143,9 +142,7 @@ class Application_Model_ShowBuilder {
|
||||||
$showEndEpoch = intval($showEndDT->format("U"));
|
$showEndEpoch = intval($showEndDT->format("U"));
|
||||||
|
|
||||||
//don't want an overbooked item to stay marked as current.
|
//don't want an overbooked item to stay marked as current.
|
||||||
if ($this->isCurrent($startsEpoch, min($endsEpoch, $showEndEpoch))) {
|
$this->isCurrent($startsEpoch, min($endsEpoch, $showEndEpoch), $row);
|
||||||
$row["current"] = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
$row["id"] = intval($p_item["sched_id"]);
|
$row["id"] = intval($p_item["sched_id"]);
|
||||||
$row["instance"] = intval($p_item["si_id"]);
|
$row["instance"] = intval($p_item["si_id"]);
|
||||||
|
|
|
@ -268,7 +268,8 @@ var AIRTIME = (function(AIRTIME){
|
||||||
var wrapperDiv,
|
var wrapperDiv,
|
||||||
markerDiv,
|
markerDiv,
|
||||||
td,
|
td,
|
||||||
$lib = $("#library_content");
|
$lib = $("#library_content"),
|
||||||
|
tr;
|
||||||
|
|
||||||
//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) {
|
||||||
|
@ -293,6 +294,18 @@ var AIRTIME = (function(AIRTIME){
|
||||||
td.append(markerDiv).wrapInner(wrapperDiv);
|
td.append(markerDiv).wrapInner(wrapperDiv);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//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(){
|
||||||
|
oTable.fnDraw();
|
||||||
|
}, aData.refresh * 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…
Reference in New Issue