diff --git a/application/controllers/NowplayingController.php b/application/controllers/NowplayingController.php
index e08837e3e..045bc585d 100644
--- a/application/controllers/NowplayingController.php
+++ b/application/controllers/NowplayingController.php
@@ -12,8 +12,13 @@ class NowplayingController extends Zend_Controller_Action
public function indexAction()
{
$this->view->headScript()->appendFile('/js/datatables/js/jquery.dataTables.min.js','text/javascript');
+ $this->view->headScript()->appendFile('/js/playlist/nowplayingdatagrid.js','text/javascript');
$this->view->headLink()->appendStylesheet('/css/pro_dropdown_3.css');
$this->view->headLink()->appendStylesheet('/css/styles.css');
+ //$this->view->headLink()->appendStylesheet('/css/datatables/demo_page.css');
+ //$this->view->headLink()->appendStylesheet('/css/datatables/demo_table.css');
+ //$this->view->headLink()->appendStylesheet('/css/datatables/demo_table_jui.css');
+ //$this->view->headLink()->appendStylesheet('/css/styles.css');
}
public function getDataGridDataAction()
diff --git a/application/controllers/ScheduleController.php b/application/controllers/ScheduleController.php
index 700e3c6e5..d7409eeb6 100644
--- a/application/controllers/ScheduleController.php
+++ b/application/controllers/ScheduleController.php
@@ -227,19 +227,6 @@ class ScheduleController extends Zend_Controller_Action
}
}
-/*
- public function viewPlaylistAction()
- {
- $this->view->headScript()->appendFile('/js/playlist/playlist.js','text/javascript');
- $this->view->headScript()->appendFile('/js/progressbar/jquery.progressbar.min.js','text/javascript');
-
- $this->_helper->viewRenderer->setResponseSegment('nowplaying');
-
- this->_helper->actionStack('', '');
-
- }
-*/
-
public function getCurrentPlaylistAction()
{
$this->view->entries = Schedule::GetPlayOrderRange();
diff --git a/application/views/scripts/nowplaying/index.phtml b/application/views/scripts/nowplaying/index.phtml
index 7800ad03d..11d775d98 100644
--- a/application/views/scripts/nowplaying/index.phtml
+++ b/application/views/scripts/nowplaying/index.phtml
@@ -1,97 +1 @@
-
diff --git a/application/views/scripts/partialviews/header.phtml b/application/views/scripts/partialviews/header.phtml
index 5be1a98e8..e2011330d 100644
--- a/application/views/scripts/partialviews/header.phtml
+++ b/application/views/scripts/partialviews/header.phtml
@@ -34,24 +34,3 @@
-
-
-
-
diff --git a/application/views/scripts/schedule/view-playlist.phtml b/application/views/scripts/schedule/view-playlist.phtml
deleted file mode 100644
index a940ce285..000000000
--- a/application/views/scripts/schedule/view-playlist.phtml
+++ /dev/null
@@ -1,22 +0,0 @@
-
-
-
-
Show:
-
Playlist:
-
Host:
-
-
-
-
Previous:
-
Current:
-
Upcoming:
-
-
-
- Start:
- End:
- |
-
diff --git a/public/js/playlist/nowplayingdatagrid.js b/public/js/playlist/nowplayingdatagrid.js
new file mode 100644
index 000000000..b2b47f9c6
--- /dev/null
+++ b/public/js/playlist/nowplayingdatagrid.js
@@ -0,0 +1,94 @@
+function getDateText(obj){
+ //var str = "";
+ //for (s in obj.oSettings)
+ // str += s + ", ";
+ //alert(str);
+ var str = obj.aData[ obj.iDataColumn ];
+ if (str.indexOf(" ") != -1){
+ return changeTimePrecision(str.substring(0, str.indexOf(" ")));
+ }
+ return str;
+}
+
+function getTimeText(obj){
+ var str = obj.aData[ obj.iDataColumn ];
+ if (str.indexOf(" ") != -1){
+ return changeTimePrecision(str.substring(str.indexOf(" ")+1));
+ }
+ return str;
+}
+
+function changeTimePrecisionInit(obj){
+ var str = obj.aData[ obj.iDataColumn ];
+ return changeTimePrecision(str);
+}
+
+function changeTimePrecision(str){
+ if (str.indexOf(".") != -1){
+ if (str.length - str.indexOf(".") > 2)
+ var extraLength = str.length - str.indexOf(".") -3;
+ return str.substring(0, str.length - extraLength);
+ }
+ return str;
+}
+
+function notifySongEnd(){
+ for (row in datagridData.rows){
+ if (row[0] == "c")
+ row[0] = "p";
+ if (row[0] == "n"){
+ row[0] = "c";
+ break;
+ }
+ }
+
+ createDataGrid();
+}
+
+function createDataGrid(){
+
+ datagridData.columnHeaders[1]["fnRender"] = getDateText;
+ datagridData.columnHeaders[2]["fnRender"] = getTimeText;
+ datagridData.columnHeaders[3]["fnRender"] = getTimeText;
+ datagridData.columnHeaders[4]["fnRender"] = changeTimePrecisionInit;
+
+ $('#demo').html( '' );
+ $('#nowplayingtable').dataTable( {
+ "bSort" : false,
+ "bJQueryUI": true,
+ "bFilter": false,
+ "bInfo": false,
+ "bLengthChange": false,
+ "aaData": datagridData.rows,
+ "aoColumns": datagridData.columnHeaders,
+ "fnRowCallback": function( nRow, aData, iDisplayIndex, iDisplayIndexFull ) {
+ if (aData[0] == "p"){
+ //$(nRow).attr("style", "background-color:blue;");
+ } else if (aData[0] == "c"){
+ $(nRow).attr("style", "background-color:#61B329;");
+ } else if (aData[0] == "n"){
+ }
+ return nRow;
+ }
+ } );
+}
+
+var registered = false
+
+function init2(){
+ $.ajax({ url: "/Nowplaying/get-data-grid-data/format/json", dataType:"json", success:function(data){
+ datagridData = data.entries;
+ createDataGrid();
+ }});
+
+ if (typeof registerSongEndListener == 'function' && !registered){
+ registered = true;
+ registerSongEndListener(notifySongEnd);
+ }
+
+ setTimeout(init2, 5000);
+}
+
+$(document).ready(function() {
+ init2();
+});
diff --git a/public/js/playlist/playlist.js b/public/js/playlist/playlist.js
index 83ffb6096..56a76300b 100644
--- a/public/js/playlist/playlist.js
+++ b/public/js/playlist/playlist.js
@@ -165,11 +165,11 @@ function updateProgressBarValue(){
function updatePlaybar(){
/* Column 0 update */
- $('#previous').text("none,");
+ $('#previous').text("Prev Song: N/A");
$('#prev-length').text("n/a,");
- $('#current').text("none,");
- $('#next').text("none,");
- $('#next-length').text("n/a");
+ $('#current').text("Current Song: N/A");
+ $('#next').text("Next Song: N/A");
+ $('#next-length').empty();
if (previousSongs.length > 0){
$('#previous').text(getTrackInfo(previousSongs[previousSongs.length-1]));
$('#prev-length').text(previousSongs[previousSongs.length-1].clip_length);
@@ -204,7 +204,7 @@ function updatePlaybar(){
}
/* Column 1 update */
- $('#playlist').text("Unknown");
+ $('#playlist').text("Current Show: N/A");
for (var i=0; itpercentage){if(cpercentage-incrementtpercentage){pb.config.cpercentage=tpercentage}else{pb.config.cpercentage+=increment;}}
-else{clearInterval(t);}},pb.config.speed);});};}});$.fn.extend({progressBar:$.progressBar.construct});})(jQuery);