use clock icon to represent autoloading playlist

This commit is contained in:
ryan 2018-11-27 15:07:56 -06:00
parent 82c724a334
commit fe5b722c7f
4 changed files with 184 additions and 185 deletions

View file

@ -314,7 +314,8 @@ a.fc-event {
.fc-event-time, .fc-event-time,
.fc-event-title { .fc-event-title {
padding: 0 1px; padding: 0 1px;
} height: 12px;
}
.fc .ui-resizable-handle { /*** TODO: don't use ui-resizable anymore, change class ***/ .fc .ui-resizable-handle { /*** TODO: don't use ui-resizable anymore, change class ***/
display: block; display: block;

View file

@ -0,0 +1 @@
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><g data-name="Layer 2"><g data-name="clock"><rect width="24" height="24" transform="rotate(180 12 12)" opacity="0"/><path d="M12 2a10 10 0 1 0 10 10A10 10 0 0 0 12 2zm4 11h-4a1 1 0 0 1-1-1V8a1 1 0 0 1 2 0v3h3a1 1 0 0 1 0 2z" fill="#fff"/></g></g></svg>

After

Width:  |  Height:  |  Size: 313 B

View file

@ -204,18 +204,14 @@ img.logo
.airtime_auth_help_icon, .custom_auth_help_icon, .stream_username_help_icon, .airtime_auth_help_icon, .custom_auth_help_icon, .stream_username_help_icon,
.playlist_type_help_icon, .repeat_tracks_help_icon, .show_linking_help_icon, .playlist_type_help_icon, .repeat_tracks_help_icon, .show_linking_help_icon,
.admin_username_help_icon, .stream_type_help_icon, .admin_username_help_icon, .stream_type_help_icon,
.show_timezone_help_icon, .show_autoplaylist_help_icon { .show_timezone_help_icon{
cursor: help; cursor: help;
position: relative; position: relative;
display:inline-block; zoom:1; display:inline-block; zoom:1;
width:14px; height:14px; width:14px; height:14px;
background:url(images/icon_info.png) 0 0 no-repeat; background:url(images/icon_info.png) 0 0 no-repeat;
left: 3px; top:2px; right:7px; left: 3px;
line-height:16px !important; line-height:16px !important;
vertical-align: text-top;
}
.qtip a {
color: white;
} }
/* Clearfix */ /* Clearfix */
@ -2272,14 +2268,15 @@ span.errors.sp-errors{
height:10px; height:10px;
float:right; float:right;
margin-left:3px; margin-left:3px;
margin-top:2px;
} }
.small-icon.linked { .small-icon.linked {
background:url(images/icon_link.png) no-repeat 0 0; background:url(images/icon_link.png) no-repeat 0 0;
margin-top: 0px !important; margin-top: 0px !important;
} }
.small-icon.autoplaylist { .small-icon.autoplaylist {
background:url(images/icon_alert_cal_autoplaylist.png) no-repeat 0 0; background: url(images/icon-clock.svg) black no-repeat center center;
border-radius: 2px;
background-size: contain;
} }
.small-icon.recording { .small-icon.recording {

View file

@ -5,10 +5,10 @@
*/ */
function scheduleRefetchEvents(json) { function scheduleRefetchEvents(json) {
if(json.show_error == true){ if (json.show_error == true) {
alert($.i18n._("The show instance doesn't exist anymore!")); alert($.i18n._("The show instance doesn't exist anymore!"));
} }
if(json.show_id) { if (json.show_id) {
var dialog_id = parseInt($("#add_show_id").val(), 10); var dialog_id = parseInt($("#add_show_id").val(), 10);
//if you've deleted the show you are currently editing, close the add show dialog. //if you've deleted the show you are currently editing, close the add show dialog.
@ -16,10 +16,10 @@ function scheduleRefetchEvents(json) {
$("#add-show-close").click(); $("#add-show-close").click();
} }
} }
$("#schedule_calendar").fullCalendar( 'refetchEvents' ); $("#schedule_calendar").fullCalendar('refetchEvents');
} }
function makeTimeStamp(date){ function makeTimeStamp(date) {
var sy, sm, sd, h, m, s, timestamp; var sy, sm, sd, h, m, s, timestamp;
sy = date.getFullYear(); sy = date.getFullYear();
sm = date.getMonth() + 1; sm = date.getMonth() + 1;
@ -28,19 +28,19 @@ function makeTimeStamp(date){
m = date.getMinutes(); m = date.getMinutes();
s = date.getSeconds(); s = date.getSeconds();
timestamp = sy+"-"+ pad(sm, 2) +"-"+ pad(sd, 2) +" "+ pad(h, 2) +":"+ pad(m, 2) +":"+ pad(s, 2); timestamp = sy + "-" + pad(sm, 2) + "-" + pad(sd, 2) + " " + pad(h, 2) + ":" + pad(m, 2) + ":" + pad(s, 2);
return timestamp; return timestamp;
} }
function dayClick(date, allDay, jsEvent, view){ function dayClick(date, allDay, jsEvent, view) {
// The show from will be preloaded if the user is admin or program manager. // The show from will be preloaded if the user is admin or program manager.
// Hence, if the user if DJ then it won't open anything. // Hence, if the user if DJ then it won't open anything.
if(userType == "S" || userType == "A" || userType == "P"){ if (userType == "S" || userType == "A" || userType == "P") {
var now, today, selected, chosenDate, chosenTime; var now, today, selected, chosenDate, chosenTime;
now = adjustDateToServerDate(new Date(), serverTimezoneOffset); now = adjustDateToServerDate(new Date(), serverTimezoneOffset);
if(view.name === "month") { if (view.name === "month") {
today = new Date(now.getFullYear(), now.getMonth(), now.getDate()); today = new Date(now.getFullYear(), now.getMonth(), now.getDate());
selected = new Date(date.getFullYear(), date.getMonth(), date.getDate()); selected = new Date(date.getFullYear(), date.getMonth(), date.getDate());
} }
@ -49,12 +49,12 @@ function dayClick(date, allDay, jsEvent, view){
selected = new Date(date.getFullYear(), date.getMonth(), date.getDate(), date.getHours(), date.getMinutes()); selected = new Date(date.getFullYear(), date.getMonth(), date.getDate(), date.getHours(), date.getMinutes());
} }
if(selected >= today) { if (selected >= today) {
var addShow = $('.add-button'); var addShow = $('.add-button');
//remove the +show button if it exists. //remove the +show button if it exists.
if(addShow.length == 1){ if (addShow.length == 1) {
var span = $(addShow).parent(); var span = $(addShow).parent();
$(span).next().remove(); $(span).next().remove();
$(span).remove(); $(span).remove();
@ -65,10 +65,10 @@ function dayClick(date, allDay, jsEvent, view){
var duration_info = duration_string.split(" "); var duration_info = duration_string.split(" ");
var duration_h = 0; var duration_h = 0;
var duration_m = 0; var duration_m = 0;
if(duration_info[0] != null){ if (duration_info[0] != null) {
duration_h = parseInt(duration_info[0], 10); duration_h = parseInt(duration_info[0], 10);
} }
if(duration_info[1] != null){ if (duration_info[1] != null) {
duration_m = parseInt(duration_info[1], 10); duration_m = parseInt(duration_info[1], 10);
} }
// duration in milisec // duration in milisec
@ -77,28 +77,28 @@ function dayClick(date, allDay, jsEvent, view){
var startTime_string; var startTime_string;
var startTime = 0; var startTime = 0;
// get start time value on the form // get start time value on the form
if(view.name === "month") { if (view.name === "month") {
startTime_string = $("#add_show_start_time").val(); startTime_string = $("#add_show_start_time").val();
var startTime_info = startTime_string.split(':'); var startTime_info = startTime_string.split(':');
if (startTime_info.length == 2) { if (startTime_info.length == 2) {
var start_time_temp = (parseInt(startTime_info[0],10) * 60 * 60 * 1000) var start_time_temp = (parseInt(startTime_info[0], 10) * 60 * 60 * 1000)
+ (parseInt(startTime_info[1], 10) * 60 * 1000); + (parseInt(startTime_info[1], 10) * 60 * 1000);
if (!isNaN(start_time_temp)) { if (!isNaN(start_time_temp)) {
startTime = start_time_temp; startTime = start_time_temp;
} }
} }
}else{ } else {
// if in day or week view, selected has all the time info as well // if in day or week view, selected has all the time info as well
// so we don't ahve to calculate it explicitly // so we don't ahve to calculate it explicitly
startTime_string = pad(selected.getHours(),2)+":"+pad(selected.getMinutes(),2) startTime_string = pad(selected.getHours(), 2) + ":" + pad(selected.getMinutes(), 2)
startTime = 0 startTime = 0
} }
// calculate endDateTime // calculate endDateTime
var endDateTime = new Date(selected.getTime() + startTime + duration); var endDateTime = new Date(selected.getTime() + startTime + duration);
chosenDate = selected.getFullYear() + '-' + pad(selected.getMonth()+1,2) + '-' + pad(selected.getDate(),2); chosenDate = selected.getFullYear() + '-' + pad(selected.getMonth() + 1, 2) + '-' + pad(selected.getDate(), 2);
var endDateFormat = endDateTime.getFullYear() + '-' + pad(endDateTime.getMonth()+1,2) + '-' + pad(endDateTime.getDate(),2); var endDateFormat = endDateTime.getFullYear() + '-' + pad(endDateTime.getMonth() + 1, 2) + '-' + pad(endDateTime.getDate(), 2);
//TODO: This should all be refactored into a proper initialize() function for the show form. //TODO: This should all be refactored into a proper initialize() function for the show form.
@ -108,8 +108,8 @@ function dayClick(date, allDay, jsEvent, view){
$("#add_show_start_date").val(chosenDate); $("#add_show_start_date").val(chosenDate);
$("#add_show_end_date_no_repeat").val(endDateFormat); $("#add_show_end_date_no_repeat").val(endDateFormat);
$("#add_show_end_date").val(endDateFormat); $("#add_show_end_date").val(endDateFormat);
if(view.name !== "month") { if (view.name !== "month") {
var endTimeString = pad(endDateTime.getHours(),2)+":"+pad(endDateTime.getMinutes(),2); var endTimeString = pad(endDateTime.getHours(), 2) + ":" + pad(endDateTime.getMinutes(), 2);
$("#add_show_start_time").val(startTime_string) $("#add_show_start_time").val(startTime_string)
$("#add_show_end_time").val(endTimeString) $("#add_show_end_time").val(endTimeString)
} }
@ -123,21 +123,21 @@ function dayClick(date, allDay, jsEvent, view){
} }
} }
function viewDisplay( view ) { function viewDisplay(view) {
view_name = view.name; view_name = view.name;
if(view.name === 'agendaDay' || view.name === 'agendaWeek') { if (view.name === 'agendaDay' || view.name === 'agendaWeek') {
var calendarEl = this; var calendarEl = this;
var select = $('<select class="schedule_change_slots input_select"/>') var select = $('<select class="schedule_change_slots input_select"/>')
.append('<option value="1">'+$.i18n._("1m")+'</option>') .append('<option value="1">' + $.i18n._("1m") + '</option>')
.append('<option value="5">'+$.i18n._("5m")+'</option>') .append('<option value="5">' + $.i18n._("5m") + '</option>')
.append('<option value="10">'+$.i18n._("10m")+'</option>') .append('<option value="10">' + $.i18n._("10m") + '</option>')
.append('<option value="15">'+$.i18n._("15m")+'</option>') .append('<option value="15">' + $.i18n._("15m") + '</option>')
.append('<option value="30">'+$.i18n._("30m")+'</option>') .append('<option value="30">' + $.i18n._("30m") + '</option>')
.append('<option value="60">'+$.i18n._("60m")+'</option>') .append('<option value="60">' + $.i18n._("60m") + '</option>')
.change(function(){ .change(function () {
var slotMin = $(this).val(); var slotMin = $(this).val();
var opt = view.calendar.options; var opt = view.calendar.options;
var date = $(calendarEl).fullCalendar('getDate'); var date = $(calendarEl).fullCalendar('getDate');
@ -150,11 +150,11 @@ function viewDisplay( view ) {
$(calendarEl) $(calendarEl)
.fullCalendar('destroy') .fullCalendar('destroy')
.fullCalendar(opt) .fullCalendar(opt)
.fullCalendar( 'gotoDate', date ); .fullCalendar('gotoDate', date);
//save slotMin value to db //save slotMin value to db
var url = baseUrl+'Schedule/set-time-interval/format/json'; var url = baseUrl + 'Schedule/set-time-interval/format/json';
$.post(url, {timeInterval: slotMin}); $.post(url, { timeInterval: slotMin });
}); });
var topLeft = $(view.element).find("table.fc-agenda-days > thead th:first"); var topLeft = $(view.element).find("table.fc-agenda-days > thead th:first");
@ -166,33 +166,33 @@ function viewDisplay( view ) {
.append(select); .append(select);
var slotMin = view.calendar.options.slotMinutes; var slotMin = view.calendar.options.slotMinutes;
$('.schedule_change_slots option[value="'+slotMin+'"]').attr('selected', 'selected'); $('.schedule_change_slots option[value="' + slotMin + '"]').attr('selected', 'selected');
} }
if(($("#add-show-form").length == 1) && ($("#add-show-form").css('display')=='none') && ($('.fc-header-left > span').length == 5)) { if (($("#add-show-form").length == 1) && ($("#add-show-form").css('display') == 'none') && ($('.fc-header-left > span').length == 5)) {
//userType is defined in bootstrap.php, and is derived from the currently logged in user. //userType is defined in bootstrap.php, and is derived from the currently logged in user.
if(userType == "S" || userType == "A" || userType == "P"){ if (userType == "S" || userType == "A" || userType == "P") {
makeAddShowButton(); makeAddShowButton();
} }
} }
//save view name to db if it was changed //save view name to db if it was changed
if (calendarPref.timeScale !== view.name) { if (calendarPref.timeScale !== view.name) {
var url = baseUrl+'Schedule/set-time-scale/format/json'; var url = baseUrl + 'Schedule/set-time-scale/format/json';
$.post(url, {timeScale: view.name}); $.post(url, { timeScale: view.name });
calendarPref.timeScale = view.name; calendarPref.timeScale = view.name;
} }
} }
function eventRender(event, element, view) { function eventRender(event, element, view) {
$(element).addClass("fc-show-instance-"+event.id); $(element).addClass("fc-show-instance-" + event.id);
$(element).attr("data-show-id", event.showId); $(element).attr("data-show-id", event.showId);
$(element).attr("data-show-linked", event.linked); $(element).attr("data-show-linked", event.linked);
$(element).data("event", event); $(element).data("event", event);
//only put progress bar on shows that aren't being recorded. //only put progress bar on shows that aren't being recorded.
if((view.name === 'agendaDay' || view.name === 'agendaWeek') && event.record === 0) { if ((view.name === 'agendaDay' || view.name === 'agendaWeek') && event.record === 0) {
var div = $('<div/>'); var div = $('<div/>');
div div
.height('5px') .height('5px')
@ -212,15 +212,15 @@ function eventRender(event, element, view) {
if (event.show_empty === 1) { if (event.show_empty === 1) {
if (event.linked) { if (event.linked) {
$(element) $(element)
.find(".fc-event-time") .find(".fc-event-time")
.before('<span class="small-icon linked"></span><span class="small-icon show-empty"></span>'); .before('<span class="small-icon linked"></span><span class="small-icon show-empty"></span>');
// in theory a linked show shouldn't have an automatic playlist so adding this here // in theory a linked show shouldn't have an automatic playlist so adding this here
} else if (event.show_has_auto_playlist === true) { } else if (event.show_has_auto_playlist === true) {
$(element) $(element)
.find(".fc-event-time") .find(".fc-event-time")
.before('<span class="small-icon autoplaylist"></span><span class="small-icon show-empty"></span>'); .before('<span class="small-icon autoplaylist"></span>');
} }
else { else {
$(element) $(element)
.find(".fc-event-time") .find(".fc-event-time")
.before('<span class="small-icon show-empty"></span>'); .before('<span class="small-icon show-empty"></span>');
@ -231,10 +231,10 @@ function eventRender(event, element, view) {
.find(".fc-event-time") .find(".fc-event-time")
.before('<span class="small-icon linked"></span><span class="small-icon show-partial-filled"></span>'); .before('<span class="small-icon linked"></span><span class="small-icon show-partial-filled"></span>');
} else if (event.show_has_auto_playlist === true) { } else if (event.show_has_auto_playlist === true) {
$(element) $(element)
.find(".fc-event-time") .find(".fc-event-time")
.before('<span class="small-icon autoplaylist"></span><span class="small-icon show-partial-filled"></span>'); .before('<span class="small-icon autoplaylist"></span><span class="small-icon show-partial-filled"></span>');
} else { } else {
$(element) $(element)
.find(".fc-event-time") .find(".fc-event-time")
.before('<span class="small-icon show-partial-filled"></span>'); .before('<span class="small-icon show-partial-filled"></span>');
@ -245,25 +245,25 @@ function eventRender(event, element, view) {
.find(".fc-event-time") .find(".fc-event-time")
.before('<span class="small-icon linked"></span>'); .before('<span class="small-icon linked"></span>');
} else if (event.show_has_auto_playlist === true) { } else if (event.show_has_auto_playlist === true) {
$(element) $(element)
.find(".fc-event-time") .find(".fc-event-time")
.before('<span class="small-icon autoplaylist"></span>'); .before('<span class="small-icon autoplaylist"></span>');
} }
} }
} else if (view.name === 'month') { } else if (view.name === 'month') {
if (event.show_empty === 1) { if (event.show_empty === 1) {
if (event.linked) { if (event.linked) {
$(element) $(element)
.find(".fc-event-title") .find(".fc-event-title")
.after('<span class="small-icon linked"></span><span title="'+$.i18n._("Show is empty")+'" class="small-icon show-empty"></span>'); .after('<span class="small-icon linked"></span><span title="' + $.i18n._("Show is empty") + '" class="small-icon show-empty"></span>');
} else if (event.show_has_auto_playlist === true) { } else if (event.show_has_auto_playlist === true) {
$(element) $(element)
.find(".fc-event-title") .find(".fc-event-title")
.after('<span title="'+$.i18n._("Show has an automatic playlist")+'"class="small-icon autoplaylist"></span><span title="'+$.i18n._("Show is empty")+'" class="small-icon show-empty"></span>'); .after('<span title="' + $.i18n._("Show has an automatic playlist") + '"class="small-icon autoplaylist"></span>');
} else { } else {
$(element) $(element)
.find(".fc-event-title") .find(".fc-event-title")
.after('<span title="'+$.i18n._("Show is empty")+'" class="small-icon show-empty"></span>'); .after('<span title="' + $.i18n._("Show is empty") + '" class="small-icon show-empty"></span>');
} }
} else if (event.show_partial_filled === true) { } else if (event.show_partial_filled === true) {
if (event.linked) { if (event.linked) {
@ -271,13 +271,13 @@ function eventRender(event, element, view) {
.find(".fc-event-title") .find(".fc-event-title")
.after('<span class="small-icon linked"></span><span title="' + $.i18n._("Show is partially filled") + '" class="small-icon show-partial-filled"></span>'); .after('<span class="small-icon linked"></span><span title="' + $.i18n._("Show is partially filled") + '" class="small-icon show-partial-filled"></span>');
} else if (event.show_has_auto_playlist === true) { } else if (event.show_has_auto_playlist === true) {
$(element) $(element)
.find(".fc-event-title") .find(".fc-event-title")
.after('<span title="'+$.i18n._("Show has an automatic playlist")+'"class="small-icon autoplaylist"></span><span title="'+$.i18n._("Show is partially filled")+'" class="small-icon show-partial-filled"></span>'); .after('<span title="' + $.i18n._("Show has an automatic playlist") + '"class="small-icon autoplaylist"></span><span title="' + $.i18n._("Show is partially filled") + '" class="small-icon show-partial-filled"></span>');
} else { } else {
$(element) $(element)
.find(".fc-event-title") .find(".fc-event-title")
.after('<span title="'+$.i18n._("Show is partially filled")+'" class="small-icon show-partial-filled"></span>'); .after('<span title="' + $.i18n._("Show is partially filled") + '" class="small-icon show-partial-filled"></span>');
} }
} else { } else {
if (event.linked) { if (event.linked) {
@ -301,44 +301,44 @@ function eventRender(event, element, view) {
$(element).find(".fc-event-title").after('<span class="small-icon rebroadcast"></span>'); $(element).find(".fc-event-title").after('<span class="small-icon rebroadcast"></span>');
} }
} }
//now playing icon. //now playing icon.
var span = '<span class="small-icon now-playing"></span>'; var span = '<span class="small-icon now-playing"></span>';
if (event.nowPlaying === true) { if (event.nowPlaying === true) {
if (view_name === 'agendaDay' || view_name === 'agendaWeek') { if (view_name === 'agendaDay' || view_name === 'agendaWeek') {
$(element).find(".fc-event-time").before(span); $(element).find(".fc-event-time").before(span);
} }
else if (view_name === 'month') { else if (view_name === 'month') {
$(element).find(".fc-event-title").after(span); $(element).find(".fc-event-title").after(span);
} }
} }
} }
function eventAfterRender( event, element, view ) { function eventAfterRender(event, element, view) {
$(element).find(".small-icon").live('mouseover',function(){ $(element).find(".small-icon").live('mouseover', function () {
addQtipsToIcons($(this), event.id); addQtipsToIcons($(this), event.id);
}); });
} }
function eventDrop(event, dayDelta, minuteDelta, allDay, revertFunc, jsEvent, ui, view) { function eventDrop(event, dayDelta, minuteDelta, allDay, revertFunc, jsEvent, ui, view) {
var url = baseUrl+'Schedule/move-show/format/json'; var url = baseUrl + 'Schedule/move-show/format/json';
$.post(url, $.post(url,
{day: dayDelta, min: minuteDelta, showInstanceId: event.id}, { day: dayDelta, min: minuteDelta, showInstanceId: event.id },
function(json){ function (json) {
if(json.show_error == true){ if (json.show_error == true) {
alertShowErrorAndReload(); alertShowErrorAndReload();
} }
if(json.error) { if (json.error) {
alert(json.error); alert(json.error);
revertFunc(); revertFunc();
} }
//Workaround for cases where FullCalendar handles events over DST //Workaround for cases where FullCalendar handles events over DST
//time changes in a different way than Airtime does. //time changes in a different way than Airtime does.
//(Airtime preserves show duration, FullCalendar doesn't.) //(Airtime preserves show duration, FullCalendar doesn't.)
@ -347,16 +347,16 @@ function eventDrop(event, dayDelta, minuteDelta, allDay, revertFunc, jsEvent, ui
}); });
} }
function eventResize( event, dayDelta, minuteDelta, revertFunc, jsEvent, ui, view ) { function eventResize(event, dayDelta, minuteDelta, revertFunc, jsEvent, ui, view) {
var url = baseUrl+'Schedule/resize-show/format/json'; var url = baseUrl + 'Schedule/resize-show/format/json';
$.post(url, $.post(url,
{day: dayDelta, min: minuteDelta, showId: event.showId, instanceId: event.id}, { day: dayDelta, min: minuteDelta, showId: event.showId, instanceId: event.id },
function(json){ function (json) {
if(json.show_error == true){ if (json.show_error == true) {
alertShowErrorAndReload(); alertShowErrorAndReload();
} }
if(json.error) { if (json.error) {
alert(json.error); alert(json.error);
revertFunc(); revertFunc();
} }
@ -365,20 +365,20 @@ function eventResize( event, dayDelta, minuteDelta, revertFunc, jsEvent, ui, vie
}); });
} }
function windowResize() { function windowResize() {
// 200 px for top dashboard and 50 for padding on main content // 200 px for top dashboard and 50 for padding on main content
// this calculation was copied from schedule.js line 326 // this calculation was copied from schedule.js line 326
var mainHeight = $(window).height() - 200 - 24; var mainHeight = $(window).height() - 200 - 24;
$('#schedule_calendar').fullCalendar('option', 'contentHeight', mainHeight); $('#schedule_calendar').fullCalendar('option', 'contentHeight', mainHeight);
} }
function preloadEventFeed () { function preloadEventFeed() {
createFullCalendar({calendarInit: calendarPref}); createFullCalendar({ calendarInit: calendarPref });
} }
var initialLoad = true; var initialLoad = true;
function getFullCalendarEvents(start, end, callback) { function getFullCalendarEvents(start, end, callback) {
if (initialLoad) { if (initialLoad) {
initialLoad = false; initialLoad = false;
callback(calendarEvents); callback(calendarEvents);
@ -387,39 +387,39 @@ function getFullCalendarEvents(start, end, callback) {
start_date = makeTimeStamp(start); start_date = makeTimeStamp(start);
end_date = makeTimeStamp(end); end_date = makeTimeStamp(end);
url = baseUrl+'Schedule/event-feed'; url = baseUrl + 'Schedule/event-feed';
var d = new Date(); var d = new Date();
$.post(url, {format: "json", start: start_date, end: end_date, cachep: d.getTime()}, function(json){ $.post(url, { format: "json", start: start_date, end: end_date, cachep: d.getTime() }, function (json) {
callback(json.events); callback(json.events);
getUsabilityHint(); getUsabilityHint();
}); });
} }
$(".fc-button").addClass("btn").addClass("btn-small"); $(".fc-button").addClass("btn").addClass("btn-small");
//$("span.fc-button > :button").addClass("btn btn-small"); //$("span.fc-button > :button").addClass("btn btn-small");
} }
function checkSCUploadStatus(){ function checkSCUploadStatus() {
var url = baseUrl+'Library/get-upload-to-soundcloud-status/format/json', var url = baseUrl + 'Library/get-upload-to-soundcloud-status/format/json',
id; id;
$("span[class*=progress]").each(function(){ $("span[class*=progress]").each(function () {
id = $(this).parents("div.fc-event").data("event").id; id = $(this).parents("div.fc-event").data("event").id;
$.post(url, {format: "json", id: id, type:"show"}, function(json){ $.post(url, { format: "json", id: id, type: "show" }, function (json) {
if (json.sc_id > 0){ if (json.sc_id > 0) {
$(".fc-show-instance-"+id) $(".fc-show-instance-" + id)
.find(".progress") .find(".progress")
.removeClass("progress") .removeClass("progress")
.addClass("soundcloud"); .addClass("soundcloud");
} }
else if (json.sc_id == "-3"){ else if (json.sc_id == "-3") {
$(".fc-show-instance-"+id) $(".fc-show-instance-" + id)
.find(".progress") .find(".progress")
.removeClass("progress") .removeClass("progress")
.addClass("sc-error"); .addClass("sc-error");
} }
setTimeout(checkSCUploadStatus, 5000); setTimeout(checkSCUploadStatus, 5000);
}); });
}); });
@ -429,47 +429,47 @@ function checkSCUploadStatus(){
* show icon * show icon
*/ */
function getCurrentShow() { function getCurrentShow() {
var url = baseUrl+'Schedule/get-current-show/format/json'; var url = baseUrl + 'Schedule/get-current-show/format/json';
function addNowPlaying(json) { function addNowPlaying(json) {
var $el, var $el,
span = '<span class="small-icon now-playing"></span>'; span = '<span class="small-icon now-playing"></span>';
$(".now-playing").remove(); $(".now-playing").remove();
if (json.current_show === true) { if (json.current_show === true) {
$el = $(".fc-show-instance-"+json.si_id); $el = $(".fc-show-instance-" + json.si_id);
if (view_name === 'agendaDay' || view_name === 'agendaWeek') { if (view_name === 'agendaDay' || view_name === 'agendaWeek') {
$el.find(".fc-event-time").before(span); $el.find(".fc-event-time").before(span);
} }
else if (view_name === 'month') { else if (view_name === 'month') {
$el.find(".fc-event-title").after(span); $el.find(".fc-event-title").after(span);
} }
} }
setTimeout(getCurrentShow, 5000); setTimeout(getCurrentShow, 5000);
} }
$.post(url, {format: "json"}, addNowPlaying); $.post(url, { format: "json" }, addNowPlaying);
} }
function addQtipsToIcons(ele, id){ function addQtipsToIcons(ele, id) {
if ($(ele).hasClass("progress")){ if ($(ele).hasClass("progress")) {
$(ele).qtip({ $(ele).qtip({
content: { content: {
text: $.i18n._("Uploading in progress...") text: $.i18n._("Uploading in progress...")
}, },
position:{ position: {
adjust: { adjust: {
resize: true, resize: true,
method: "flip flip" method: "flip flip"
}, },
at: "right center", at: "right center",
my: "left top", my: "left top",
@ -482,23 +482,23 @@ function addQtipsToIcons(ele, id){
ready: true // Needed to make it show on first mouseover event ready: true // Needed to make it show on first mouseover event
} }
}); });
}else if($(ele).hasClass("soundcloud")){ } else if ($(ele).hasClass("soundcloud")) {
$(ele).qtip({ $(ele).qtip({
content: { content: {
text: $.i18n._("Retreiving data from the server..."), text: $.i18n._("Retreiving data from the server..."),
ajax: { ajax: {
url: baseUrl+"Library/get-upload-to-soundcloud-status", url: baseUrl + "Library/get-upload-to-soundcloud-status",
type: "post", type: "post",
data: ({format: "json", id : id, type: "show"}), data: ({ format: "json", id: id, type: "show" }),
success: function(json, status){ success: function (json, status) {
this.set('content.text', $.i18n._("The soundcloud id for this file is: ")+json.sc_id); this.set('content.text', $.i18n._("The soundcloud id for this file is: ") + json.sc_id);
} }
} }
}, },
position:{ position: {
adjust: { adjust: {
resize: true, resize: true,
method: "flip flip" method: "flip flip"
}, },
at: "right center", at: "right center",
my: "left top", my: "left top",
@ -511,24 +511,24 @@ function addQtipsToIcons(ele, id){
ready: true // Needed to make it show on first mouseover event ready: true // Needed to make it show on first mouseover event
} }
}); });
}else if($(ele).hasClass("sc-error")){ } else if ($(ele).hasClass("sc-error")) {
$(ele).qtip({ $(ele).qtip({
content: { content: {
text: $.i18n._("Retreiving data from the server..."), text: $.i18n._("Retreiving data from the server..."),
ajax: { ajax: {
url: baseUrl+"Library/get-upload-to-soundcloud-status", url: baseUrl + "Library/get-upload-to-soundcloud-status",
type: "post", type: "post",
data: ({format: "json", id : id, type: "show"}), data: ({ format: "json", id: id, type: "show" }),
success: function(json, status){ success: function (json, status) {
this.set('content.text', $.i18n._("There was error while uploading to soundcloud.")+"<br>"+$.i18n._("Error code: ")+json.error_code+ this.set('content.text', $.i18n._("There was error while uploading to soundcloud.") + "<br>" + $.i18n._("Error code: ") + json.error_code +
"<br>"+$.i18n._("Error msg: ")+json.error_msg+"<br>"); "<br>" + $.i18n._("Error msg: ") + json.error_msg + "<br>");
} }
} }
}, },
position:{ position: {
adjust: { adjust: {
resize: true, resize: true,
method: "flip flip" method: "flip flip"
}, },
at: "right center", at: "right center",
my: "left top", my: "left top",
@ -541,15 +541,15 @@ function addQtipsToIcons(ele, id){
ready: true // Needed to make it show on first mouseover event ready: true // Needed to make it show on first mouseover event
} }
}); });
}else if ($(ele).hasClass("show-empty")){ } else if ($(ele).hasClass("show-empty")) {
$(ele).qtip({ $(ele).qtip({
content: { content: {
text: $.i18n._("This show has no scheduled content.") text: $.i18n._("This show has no scheduled content.")
}, },
position:{ position: {
adjust: { adjust: {
resize: true, resize: true,
method: "flip flip" method: "flip flip"
}, },
at: "right center", at: "right center",
my: "left top", my: "left top",
@ -562,15 +562,15 @@ function addQtipsToIcons(ele, id){
ready: true // Needed to make it show on first mouseover event ready: true // Needed to make it show on first mouseover event
} }
}); });
} else if ($(ele).hasClass("show-partial-filled")){ } else if ($(ele).hasClass("show-partial-filled")) {
$(ele).qtip({ $(ele).qtip({
content: { content: {
text: $.i18n._("This show is not completely filled with content.") text: $.i18n._("This show is not completely filled with content.")
}, },
position:{ position: {
adjust: { adjust: {
resize: true, resize: true,
method: "flip flip" method: "flip flip"
}, },
at: "right center", at: "right center",
my: "left top", my: "left top",
@ -587,12 +587,12 @@ function addQtipsToIcons(ele, id){
} }
//Alert the error and reload the page //Alert the error and reload the page
//this function is used to resolve concurrency issue //this function is used to resolve concurrency issue
function alertShowErrorAndReload(){ function alertShowErrorAndReload() {
alert($.i18n._("The show instance doesn't exist anymore!")); alert($.i18n._("The show instance doesn't exist anymore!"));
window.location.reload(); window.location.reload();
} }
$(document).ready(function(){ $(document).ready(function () {
preloadEventFeed(); preloadEventFeed();
checkSCUploadStatus(); checkSCUploadStatus();
getCurrentShow(); getCurrentShow();