diff --git a/airtime_mvc/application/models/ShowBuilder.php b/airtime_mvc/application/models/ShowBuilder.php index 140d23cff..231293468 100644 --- a/airtime_mvc/application/models/ShowBuilder.php +++ b/airtime_mvc/application/models/ShowBuilder.php @@ -88,14 +88,13 @@ class Application_Model_ShowBuilder { $row["timestamp"] = $ts; } - private function isCurrent($p_epochItemStart, $p_epochItemEnd) { - $current = false; - + private function isCurrent($p_epochItemStart, $p_epochItemEnd, &$row) { + 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) { @@ -143,9 +142,7 @@ class Application_Model_ShowBuilder { $showEndEpoch = intval($showEndDT->format("U")); //don't want an overbooked item to stay marked as current. - if ($this->isCurrent($startsEpoch, min($endsEpoch, $showEndEpoch))) { - $row["current"] = true; - } + $this->isCurrent($startsEpoch, min($endsEpoch, $showEndEpoch), $row); $row["id"] = intval($p_item["sched_id"]); $row["instance"] = intval($p_item["si_id"]); diff --git a/airtime_mvc/public/js/airtime/showbuilder/builder.js b/airtime_mvc/public/js/airtime/showbuilder/builder.js index dafca8152..adaffeb6e 100644 --- a/airtime_mvc/public/js/airtime/showbuilder/builder.js +++ b/airtime_mvc/public/js/airtime/showbuilder/builder.js @@ -268,7 +268,8 @@ var AIRTIME = (function(AIRTIME){ var wrapperDiv, markerDiv, td, - $lib = $("#library_content"); + $lib = $("#library_content"), + tr; //only create the cursor arrows if the library is on the page. if ($lib.length > 0 && $lib.filter(":visible").length > 0) { @@ -293,6 +294,18 @@ var AIRTIME = (function(AIRTIME){ 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) { $(nHead).find("input[type=checkbox]").attr("checked", false);