diff --git a/airtime_mvc/application/controllers/ScheduleController.php b/airtime_mvc/application/controllers/ScheduleController.php
index df633fcfa..cf74f305d 100644
--- a/airtime_mvc/application/controllers/ScheduleController.php
+++ b/airtime_mvc/application/controllers/ScheduleController.php
@@ -32,6 +32,7 @@ class ScheduleController extends Zend_Controller_Action
->addActionContext('edit-show-instance', 'json')
->addActionContext('dj-edit-show', 'json')
->addActionContext('calculate-duration', 'json')
+ ->addActionContext('get-current-show', 'json')
->initContext();
$this->sched_sess = new Zend_Session_Namespace("schedule");
@@ -116,6 +117,16 @@ class ScheduleController extends Zend_Controller_Action
$this->view->events = Application_Model_Show::getFullCalendarEvents($start, $end, $editable);
}
+
+ public function getCurrentShowAction() {
+ $currentShow = Application_Model_Show::GetCurrentShow();
+ if (!empty($currentShow)) {
+ $this->view->si_id = $currentShow[0]["instance_id"];
+ $this->view->current_show = true;
+ } else {
+ $this->view->current_show = false;
+ }
+ }
public function moveShowAction()
{
diff --git a/airtime_mvc/public/css/styles.css b/airtime_mvc/public/css/styles.css
index 63a6ad1b8..ae7568e67 100644
--- a/airtime_mvc/public/css/styles.css
+++ b/airtime_mvc/public/css/styles.css
@@ -1734,6 +1734,10 @@ div.errors{
background:url(images/icon_soundcloud_error2.png) no-repeat 0 0;
width:21px;
}
+.small-icon.now-playing {
+ background:url(images/icon_nowplaying_n.png) no-repeat 0 0;
+ height:8px;
+}
.small-icon.progress {
background:url(images/upload-icon.gif) no-repeat;
background-color:black;
diff --git a/airtime_mvc/public/js/airtime/schedule/full-calendar-functions.js b/airtime_mvc/public/js/airtime/schedule/full-calendar-functions.js
index d0be9d108..5a6d8bc46 100644
--- a/airtime_mvc/public/js/airtime/schedule/full-calendar-functions.js
+++ b/airtime_mvc/public/js/airtime/schedule/full-calendar-functions.js
@@ -147,7 +147,8 @@ function dayClick(date, allDay, jsEvent, view){
}
function viewDisplay( view ) {
-
+ view_name = view.name;
+
if(view.name === 'agendaDay' || view.name === 'agendaWeek') {
var calendarEl = this;
@@ -205,7 +206,8 @@ function viewDisplay( view ) {
}
function eventRender(event, element, view) {
-
+ getCurrentShow();
+
$(element).data("event", event);
//only put progress bar on shows that aren't being recorded.
@@ -223,6 +225,13 @@ function eventRender(event, element, view) {
$(element).find(".fc-event-content").append(div);
}
+
+ //need to add id for every event to find the current show
+ if (view.name === 'agendaDay' || view.name === 'agendaWeek') {
+ $(element).find(".fc-event-time").attr("id", event.id);
+ } else if (view.name === 'month') {
+ $(element).find(".fc-event-title").attr("id", event.id);
+ }
//add the record/rebroadcast/soundcloud icons if needed
if((view.name === 'agendaDay' || view.name === 'agendaWeek') && event.record === 1 && event.soundcloud_id === -1) {
@@ -247,11 +256,10 @@ function eventRender(event, element, view) {
//rebroadcast icon
if((view.name === 'agendaDay' || view.name === 'agendaWeek') && event.rebroadcast === 1) {
-
$(element).find(".fc-event-time").before('');
}
+
if(view.name === 'month' && event.rebroadcast === 1) {
-
$(element).find(".fc-event-title").after('');
}
}
@@ -310,7 +318,7 @@ function getFullCalendarEvents(start, end, callback) {
url = '/Schedule/event-feed';
var d = new Date();
-
+
$.post(url, {format: "json", start: start_date, end: end_date, cachep: d.getTime()}, function(json){
callback(json.events);
});
@@ -330,6 +338,55 @@ function checkSCUploadStatus(){
});
}
+function getCurrentShow(){
+ var url = '/Schedule/get-current-show/format/json',
+ id,
+ $el;
+ $.post(url, {format: "json"}, function(json) {
+ if (json.current_show === true) {
+ $el = $("div[class*=fc-event-time][id="+json.si_id+"]");
+ if (view_name === 'agendaDay' || view_name === 'agendaWeek') {
+
+ /* Need to remove now-playing class because if user
+ * is switching from week view to day view (and vice versa)
+ * the icon may already be there from previous view
+ */
+ $el.siblings().remove("span[class=small-icon now-playing]");
+ if (!$el.siblings().hasClass("small-icon now-playing")) {
+ if ($el.siblings().hasClass("small-icon recording")) {
+
+ /* Without removing recording icon, the now playing
+ * icon will overwrite it.
+ */
+ $el.siblings().remove("span[class=small-icon recording]");
+ $el.before('');
+ } else if ($el.siblings().hasClass("small-icon rebroadcast")) {
+
+ /* Without removing rebroadcast icon, the now playing
+ * icon will overwrite it.
+ */
+ $el.siblings().remove("span[class=small-icon rebroadcast]");
+ $el.before('');
+ } else {
+ $el.before('');
+ }
+ }
+ } else if (view_name === 'month') {
+ if (!$("span[class*=fc-event-title][id="+json.si_id+"]").siblings().hasClass("small-icon now-playing")) {
+ $("span[class*=fc-event-title][id="+json.si_id+"]").after('');
+ }
+ }
+ }
+ //remove icon from shows that have ended
+ $(".now-playing").each(function(){
+ id = $(this).attr("id");
+ if (id != json.si_id) {
+ $(this).remove("span[small-icon now-playing]");
+ }
+ });
+ });
+}
+
function addQtipToSCIcons(ele){
var id = $(ele).attr("id");
if($(ele).hasClass("progress")){
@@ -415,4 +472,7 @@ function alertShowErrorAndReload(){
$(document).ready(function(){
setInterval( "checkSCUploadStatus()", 5000 );
+ setInterval( "getCurrentShow()", 5000 );
});
+
+var view_name;