Merge branch '2.5.x' into 2.5.x-saas
Conflicts: airtime_mvc/application/forms/AddShowWhen.php airtime_mvc/application/forms/LiveStreamingPreferences.php airtime_mvc/application/models/Schedule.php airtime_mvc/application/views/scripts/form/preferences.phtml airtime_mvc/application/views/scripts/form/preferences_livestream.phtml airtime_mvc/application/views/scripts/form/support-setting.phtml airtime_mvc/application/views/scripts/schedule/add-show-form.phtml
This commit is contained in:
commit
49474ab5c4
214 changed files with 57623 additions and 61229 deletions
|
@ -30,6 +30,21 @@ var i18n_months = [
|
|||
$.i18n._("December")
|
||||
];
|
||||
|
||||
var i18n_months_short = [
|
||||
$.i18n._("Jan"),
|
||||
$.i18n._("Feb"),
|
||||
$.i18n._("Mar"),
|
||||
$.i18n._("Apr"),
|
||||
$.i18n._("May"),
|
||||
$.i18n._("Jun"),
|
||||
$.i18n._("Jul"),
|
||||
$.i18n._("Aug"),
|
||||
$.i18n._("Sep"),
|
||||
$.i18n._("Oct"),
|
||||
$.i18n._("Nov"),
|
||||
$.i18n._("Dec")
|
||||
];
|
||||
|
||||
var i18n_days_short = [
|
||||
$.i18n._("Su"),
|
||||
$.i18n._("Mo"),
|
||||
|
|
|
@ -172,7 +172,7 @@ function updatePlaybar(){
|
|||
|
||||
$('#time-elapsed').text(convertToHHMMSS(approximateServerTime - songStartRoughly));
|
||||
$('#time-remaining').text(convertToHHMMSS(songEndRoughly - approximateServerTime));
|
||||
$('#song-length').text(convertToHHMMSSmm(currentSong.songLengthMs));
|
||||
$('#song-length').text(convertToHHMMSS(currentSong.songLengthMs));
|
||||
}
|
||||
/* Column 1 update */
|
||||
$('#playlist').text($.i18n._("Current Show:"));
|
||||
|
|
|
@ -73,10 +73,7 @@ function convertToHHMMSS(timeInMS){
|
|||
minutes = "0" + minutes;
|
||||
if (seconds.length == 1)
|
||||
seconds = "0" + seconds;
|
||||
if (hours == "00")
|
||||
return minutes + ":" + seconds;
|
||||
else
|
||||
return hours + ":" + minutes + ":" + seconds;
|
||||
return hours + ":" + minutes + ":" + seconds;
|
||||
}
|
||||
|
||||
function convertToHHMMSSmm(timeInMS){
|
||||
|
|
|
@ -760,7 +760,7 @@ var AIRTIME = (function(AIRTIME) {
|
|||
},
|
||||
"fnDrawCallback": AIRTIME.library.fnDrawCallback,
|
||||
|
||||
"aaSorting": [[3, 'asc']],
|
||||
"aaSorting": [[5, 'asc']],
|
||||
"sPaginationType": "full_numbers",
|
||||
"bJQueryUI": true,
|
||||
"bAutoWidth": false,
|
||||
|
@ -783,9 +783,6 @@ var AIRTIME = (function(AIRTIME) {
|
|||
|
||||
});
|
||||
|
||||
//sort by title, by default
|
||||
oTable.fnSort( [ [5, 'asc'] ] );
|
||||
|
||||
setColumnFilter(oTable);
|
||||
oTable.fnSetFilteringDelay(350);
|
||||
|
||||
|
|
|
@ -466,6 +466,13 @@ var AIRTIME = (function(AIRTIME) {
|
|||
}
|
||||
];
|
||||
|
||||
//set the locale names for the bootstrap calendar.
|
||||
$.fn.datetimepicker.dates = {
|
||||
daysMin: i18n_days_short,
|
||||
months: i18n_months,
|
||||
monthsShort: i18n_months_short
|
||||
};
|
||||
|
||||
|
||||
$historyContentDiv = $("#history_content");
|
||||
|
||||
|
|
|
@ -23,7 +23,7 @@ var AIRTIME = (function(AIRTIME) {
|
|||
"<li data-template='<%= id %>' data-name='<%= name %>'>" +
|
||||
"<a href='<%= editUrl %>' class='template_name'><%= name %></a>" +
|
||||
"<a href='<%= removeUrl %>' class='template_remove'><i class='icon icon-trash'></i></a>" +
|
||||
"<a href='<%= defaultUrl %>' class='template_default'>Set Default</a>" +
|
||||
"<a href='<%= defaultUrl %>' class='template_default'>" + $.i18n._('Set Default') + "</a>" +
|
||||
"</li>";
|
||||
|
||||
var template = (configured) === true ? itemConfigured : item;
|
||||
|
|
|
@ -13,11 +13,11 @@ function showErrorSections() {
|
|||
}
|
||||
function rebuildStreamURL(ele){
|
||||
var div = ele.closest("div")
|
||||
host = div.find("input:[id$=-host]").val()
|
||||
port = div.find("input:[id$=-port]").val()
|
||||
mount = div.find("input:[id$=-mount]").val()
|
||||
host = div.find("input[id$=-host]").val()
|
||||
port = div.find("input[id$=-port]").val()
|
||||
mount = div.find("input[id$=-mount]").val()
|
||||
streamurl = ""
|
||||
if(div.find("select:[id$=-output]").val()=="icecast"){
|
||||
if(div.find("select[id$=-output]").val()=="icecast"){
|
||||
streamurl = "http://"+host
|
||||
if($.trim(port) != ""){
|
||||
streamurl += ":"+port
|
||||
|
@ -180,15 +180,15 @@ function setupEventListeners() {
|
|||
rebuildStreamURL($(this));
|
||||
})
|
||||
|
||||
$("input:[id$=-host], input:[id$=-port], input:[id$=-mount]").keyup(function(){
|
||||
$("input[id$=-host], input[id$=-port], input[id$=-mount]").keyup(function(){
|
||||
rebuildStreamURL($(this));
|
||||
});
|
||||
|
||||
$("input:[id$=-port]").keypress(function(e){
|
||||
$("input[id$=-port]").keypress(function(e){
|
||||
validate($(this),e);
|
||||
});
|
||||
|
||||
$("select:[id$=-output]").change(function(){
|
||||
$("select[id$=-output]").change(function(){
|
||||
rebuildStreamURL($(this));
|
||||
});
|
||||
|
||||
|
|
|
@ -4,6 +4,87 @@
|
|||
*
|
||||
*/
|
||||
|
||||
function openAddShowForm() {
|
||||
if($("#add-show-form").length == 1) {
|
||||
if( ($("#add-show-form").css('display')=='none')) {
|
||||
$("#add-show-form").show();
|
||||
/*
|
||||
var windowWidth = $(window).width();
|
||||
// margin on showform are 16 px on each side
|
||||
var calendarWidth = 100-(($("#schedule-add-show").width() + (16 * 4))/windowWidth*100);
|
||||
var widthPercent = parseInt(calendarWidth)+"%";
|
||||
$("#schedule_calendar").css("width", widthPercent);
|
||||
|
||||
// 200 px for top dashboard and 50 for padding on main content
|
||||
// this calculation was copied from schedule.js line 326
|
||||
var mainHeight = document.documentElement.clientHeight - 200 - 50;
|
||||
$('#schedule_calendar').fullCalendar('option', 'contentHeight', mainHeight);
|
||||
*/
|
||||
windowResize();
|
||||
}
|
||||
$("#schedule-show-what").show(0, function(){
|
||||
$add_show_name = $("#add_show_name");
|
||||
$add_show_name.focus();
|
||||
$add_show_name.select();
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
function makeAddShowButton(){
|
||||
$('.fc-header-left')
|
||||
.append('<span class="fc-header-space"></span>')
|
||||
.append('<span class="fc-button"><a href="#" class="add-button"><span class="add-icon"></span>'+$.i18n._("Show")+'</a></span>')
|
||||
.find('span.fc-button:last > a')
|
||||
.click(function(){
|
||||
openAddShowForm();
|
||||
removeAddShowButton();
|
||||
});
|
||||
}
|
||||
|
||||
function removeAddShowButton(){
|
||||
var aTag = $('.fc-header-left')
|
||||
.find("span.fc-button:last > a");
|
||||
|
||||
var span = aTag.parent();
|
||||
span.prev().remove();
|
||||
span.remove();
|
||||
}
|
||||
|
||||
//$el is DOM element #add-show-form
|
||||
//form is the new form contents to append to $el
|
||||
function redrawAddShowForm($el, form) {
|
||||
|
||||
//need to clean up the color picker.
|
||||
$el.find("#schedule-show-style input").each(function(i, el){
|
||||
var $input = $(this),
|
||||
colId = $input.data("colorpickerId");
|
||||
|
||||
$("#"+colId).remove();
|
||||
$input.removeData();
|
||||
});
|
||||
|
||||
$el.empty().append(form);
|
||||
|
||||
setAddShowEvents($el);
|
||||
}
|
||||
|
||||
function closeAddShowForm(event) {
|
||||
event.stopPropagation();
|
||||
event.preventDefault();
|
||||
|
||||
var $el = $("#add-show-form");
|
||||
|
||||
$el.hide();
|
||||
windowResize();
|
||||
|
||||
$.get(baseUrl+"Schedule/get-form", {format:"json"}, function(json) {
|
||||
|
||||
redrawAddShowForm($el, json.form);
|
||||
});
|
||||
|
||||
makeAddShowButton();
|
||||
}
|
||||
|
||||
//dateText mm-dd-yy
|
||||
function startDpSelect(dateText, inst) {
|
||||
var time, date;
|
||||
|
@ -73,16 +154,14 @@ function findHosts(request, callback) {
|
|||
}
|
||||
|
||||
function beginEditShow(data){
|
||||
if(data.show_error == true){
|
||||
|
||||
if (data.show_error == true){
|
||||
alertShowErrorAndReload();
|
||||
return false;
|
||||
}
|
||||
$("#add-show-form")
|
||||
.empty()
|
||||
.append(data.newForm);
|
||||
|
||||
|
||||
redrawAddShowForm($("#add-show-form"), data.newForm);
|
||||
removeAddShowButton();
|
||||
setAddShowEvents();
|
||||
openAddShowForm();
|
||||
}
|
||||
|
||||
|
@ -130,9 +209,9 @@ function getContrastYIQ(hexcolor){
|
|||
}
|
||||
|
||||
|
||||
function setAddShowEvents() {
|
||||
function setAddShowEvents(form) {
|
||||
|
||||
var form = $("#add-show-form");
|
||||
//var form = $("#add-show-form");
|
||||
|
||||
form.find("h3").click(function(){
|
||||
$(this).next().toggle();
|
||||
|
@ -188,6 +267,13 @@ function setAddShowEvents() {
|
|||
});
|
||||
|
||||
form.find("#add_show_linked").click(function(){
|
||||
if ($(this).attr("readonly")) {
|
||||
if ($("#show-link-readonly-warning").length === 0) {
|
||||
$(this).parent().after("<ul id='show-link-readonly-warning' class='errors'><li>"+$.i18n._("Warning: You cannot change this field while the show is currently playing")+"</li></ul>");
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!$(this).attr("checked") && $("#show-link-warning").length === 0) {
|
||||
$(this).parent().after("<ul id='show-link-warning' class='errors'><li>"+$.i18n._("Warning: Shows cannot be re-linked")+"</li></ul>");
|
||||
}
|
||||
|
@ -227,6 +313,35 @@ function setAddShowEvents() {
|
|||
}
|
||||
});
|
||||
|
||||
// in case user is creating a new show, there will be
|
||||
// no show_id so we have to store the default timezone
|
||||
// to be able to do the conversion when the timezone
|
||||
// setting changes
|
||||
var currentTimezone = form.find("#add_show_timezone").val();
|
||||
|
||||
form.find("#add_show_timezone").change(function(){
|
||||
var startDateField = form.find("#add_show_start_date"),
|
||||
startTimeField = form.find("#add_show_start_time"),
|
||||
endDateField = form.find("#add_show_end_date_no_repeat"),
|
||||
endTimeField = form.find("#add_show_end_time"),
|
||||
newTimezone = form.find("#add_show_timezone").val();
|
||||
|
||||
$.post(baseUrl+"Schedule/localize-start-end-time",
|
||||
{format: "json",
|
||||
startDate: startDateField.val(),
|
||||
startTime: startTimeField.val(),
|
||||
endDate: endDateField.val(),
|
||||
endTime: endTimeField.val(),
|
||||
newTimezone: newTimezone,
|
||||
oldTimezone: currentTimezone}, function(json){
|
||||
|
||||
startDateField.val(json.start.date);
|
||||
startTimeField.val(json.start.time);
|
||||
endDateField.val(json.end.date);
|
||||
endTimeField.val(json.end.time);
|
||||
});
|
||||
});
|
||||
|
||||
form.find("#add_show_repeat_type").change(function(){
|
||||
toggleRepeatDays();
|
||||
toggleMonthlyRepeatType();
|
||||
|
@ -234,7 +349,7 @@ function setAddShowEvents() {
|
|||
toggleMonthlyRepeatType();
|
||||
toggleRepeatDays();
|
||||
function toggleRepeatDays() {
|
||||
if(form.find("#add_show_repeat_type").val() >= 2) {
|
||||
if(form.find("#add_show_repeat_type").val() == 2 || form.find("#add_show_repeat_type").val() == 3) {
|
||||
form.find("#add_show_day_check-label, #add_show_day_check-element").hide();
|
||||
//form.find("#add_show_monthly_repeat_type-label, #add_show_monthly_repeat_type-element").show();
|
||||
}
|
||||
|
@ -255,7 +370,29 @@ function setAddShowEvents() {
|
|||
form.find("#add_show_day_check-element").addClass("block-display clearfix");
|
||||
form.find("#add_show_day_check-element label").addClass("wrapp-label");
|
||||
form.find("#add_show_day_check-element br").remove();
|
||||
|
||||
|
||||
form.find(".show_timezone_help_icon").qtip({
|
||||
content: {
|
||||
text: $.i18n._("Timezone is set to the station timezone by default. Shows in the calendar will be displayed in your local time defined by the " +
|
||||
"Interface Timezone in your user settings.")
|
||||
},
|
||||
hide: {
|
||||
delay: 500,
|
||||
fixed: true
|
||||
},
|
||||
style: {
|
||||
border: {
|
||||
width: 0,
|
||||
radius: 4
|
||||
},
|
||||
classes: "ui-tooltip-dark ui-tooltip-rounded"
|
||||
},
|
||||
position: {
|
||||
my: "left bottom",
|
||||
at: "right center"
|
||||
}
|
||||
});
|
||||
|
||||
form.find(".airtime_auth_help_icon").qtip({
|
||||
content: {
|
||||
text: $.i18n._("This follows the same security pattern for the shows: only users assigned to the show can connect.")
|
||||
|
@ -448,101 +585,75 @@ function setAddShowEvents() {
|
|||
}
|
||||
});
|
||||
|
||||
form.find("#add-show-close").click(closeAddShowForm);
|
||||
|
||||
form.find("#add-show-close")
|
||||
.click(function(event){
|
||||
event.stopPropagation();
|
||||
event.preventDefault();
|
||||
form.find(".add-show-submit").click(function(event) {
|
||||
event.preventDefault();
|
||||
|
||||
var addShowButton = $(this);
|
||||
|
||||
$('#schedule-add-show').block({
|
||||
message: null,
|
||||
applyPlatformOpacityRules: false
|
||||
});
|
||||
|
||||
$("#add-show-form").hide();
|
||||
windowResize();
|
||||
//when editing a show, the record option is disabled
|
||||
//we have to enable it to get the correct value when
|
||||
//we call serializeArray()
|
||||
if (form.find("#add_show_record").attr("disabled", true)) {
|
||||
form.find("#add_show_record").attr("disabled", false);
|
||||
}
|
||||
|
||||
$.get(baseUrl+"Schedule/get-form", {format:"json"}, function(json){
|
||||
$("#add-show-form")
|
||||
.empty()
|
||||
.append(json.form);
|
||||
var data = $("form").serializeArray();
|
||||
|
||||
setAddShowEvents();
|
||||
});
|
||||
makeAddShowButton();
|
||||
});
|
||||
var hosts = $('#add_show_hosts-element input').map(function() {
|
||||
if($(this).attr("checked")) {
|
||||
return $(this).val();
|
||||
}
|
||||
}).get();
|
||||
|
||||
form.find(".add-show-submit")
|
||||
.click(function(event){
|
||||
var addShowButton = $(this);
|
||||
/*
|
||||
if (!addShowButton.hasClass("disabled")){
|
||||
addShowButton.addClass("disabled");
|
||||
var days = $('#add_show_day_check-element input').map(function() {
|
||||
if($(this).attr("checked")) {
|
||||
return $(this).val();
|
||||
}
|
||||
}).get();
|
||||
|
||||
var start_date = $("#add_show_start_date").val();
|
||||
var end_date = $("#add_show_end_date").val();
|
||||
var action = baseUrl+"Schedule/"+String(addShowButton.attr("data-action"));
|
||||
|
||||
$.post(action, {format: "json", data: data, hosts: hosts, days: days}, function(json){
|
||||
|
||||
$('#schedule-add-show').unblock();
|
||||
|
||||
var $addShowForm = $("#add-show-form");
|
||||
|
||||
if (json.form) {
|
||||
|
||||
redrawAddShowForm($addShowForm, json.form);
|
||||
|
||||
$("#add_show_end_date").val(end_date);
|
||||
$("#add_show_start_date").val(start_date);
|
||||
showErrorSections();
|
||||
}
|
||||
else if (json.edit) {
|
||||
|
||||
$("#schedule_calendar").removeAttr("style")
|
||||
.fullCalendar('render');
|
||||
|
||||
$addShowForm.hide();
|
||||
$.get(baseUrl+"Schedule/get-form", {format:"json"}, function(json){
|
||||
redrawAddShowForm($addShowForm, json.form);
|
||||
});
|
||||
makeAddShowButton();
|
||||
}
|
||||
else {
|
||||
return;
|
||||
|
||||
redrawAddShowForm($addShowForm, json.newForm);
|
||||
scheduleRefetchEvents(json);
|
||||
}
|
||||
*/
|
||||
|
||||
event.preventDefault();
|
||||
|
||||
var data = $("form").serializeArray();
|
||||
|
||||
var hosts = $('#add_show_hosts-element input').map(function() {
|
||||
if($(this).attr("checked")) {
|
||||
return $(this).val();
|
||||
}
|
||||
}).get();
|
||||
|
||||
var days = $('#add_show_day_check-element input').map(function() {
|
||||
if($(this).attr("checked")) {
|
||||
return $(this).val();
|
||||
}
|
||||
}).get();
|
||||
|
||||
var start_date = $("#add_show_start_date").val();
|
||||
var end_date = $("#add_show_end_date").val();
|
||||
|
||||
$('#schedule-add-show').block({
|
||||
message: null,
|
||||
applyPlatformOpacityRules: false
|
||||
});
|
||||
|
||||
var action = baseUrl+"Schedule/"+String(addShowButton.attr("data-action"));
|
||||
|
||||
$.post(action, {format: "json", data: data, hosts: hosts, days: days}, function(json){
|
||||
//addShowButton.removeClass("disabled");
|
||||
$('#schedule-add-show').unblock();
|
||||
if(json.form) {
|
||||
$("#add-show-form")
|
||||
.empty()
|
||||
.append(json.form);
|
||||
|
||||
setAddShowEvents();
|
||||
|
||||
$("#add_show_end_date").val(end_date);
|
||||
$("#add_show_start_date").val(start_date);
|
||||
showErrorSections();
|
||||
}else if(json.edit){
|
||||
$("#schedule_calendar").removeAttr("style")
|
||||
.fullCalendar('render');
|
||||
|
||||
$("#add-show-form").hide();
|
||||
$.get(baseUrl+"Schedule/get-form", {format:"json"}, function(json){
|
||||
$("#add-show-form")
|
||||
.empty()
|
||||
.append(json.form);
|
||||
|
||||
setAddShowEvents();
|
||||
});
|
||||
makeAddShowButton();
|
||||
}
|
||||
else {
|
||||
$("#add-show-form")
|
||||
.empty()
|
||||
.append(json.newForm);
|
||||
|
||||
|
||||
setAddShowEvents();
|
||||
scheduleRefetchEvents(json);
|
||||
}
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
var regDate = new RegExp(/^[0-9]{4}-[0-1][0-9]-[0-3][0-9]$/);
|
||||
var regTime = new RegExp(/^[0-2][0-9]:[0-5][0-9]$/);
|
||||
|
@ -586,7 +697,8 @@ function setAddShowEvents() {
|
|||
// calculate duration
|
||||
var startDateTimeString = startDateString + " " + startTimeString;
|
||||
var endDateTimeString = $('#add_show_end_date_no_repeat').val() + " " + $('#add_show_end_time').val();
|
||||
calculateDuration(startDateTimeString, endDateTimeString);
|
||||
var timezone = $("#add_show_timezone").val();
|
||||
calculateDuration(startDateTimeString, endDateTimeString, timezone);
|
||||
}
|
||||
});
|
||||
|
||||
|
@ -617,7 +729,8 @@ function setAddShowEvents() {
|
|||
// calculate duration
|
||||
var startDateTimeString = startDateString + " " + startTimeString;
|
||||
var endDateTimeString = endDateString + " " + endTimeString;
|
||||
calculateDuration(startDateTimeString, endDateTimeString);
|
||||
var timezone = $("#add_show_timezone").val();
|
||||
calculateDuration(startDateTimeString, endDateTimeString, timezone);
|
||||
}
|
||||
});
|
||||
|
||||
|
@ -635,13 +748,16 @@ function setAddShowEvents() {
|
|||
}
|
||||
})
|
||||
|
||||
function calculateDuration(endDateTime, startDateTime){
|
||||
function calculateDuration(startDateTime, endDateTime, timezone){
|
||||
var loadingIcon = $('#icon-loader-small');
|
||||
|
||||
loadingIcon.show();
|
||||
$.post(baseUrl+"Schedule/calculate-duration", {startTime: startDateTime, endTime: endDateTime}, function(data){
|
||||
$('#add_show_duration').val(JSON.parse(data));
|
||||
loadingIcon.hide();
|
||||
$.post(
|
||||
baseUrl+"Schedule/calculate-duration",
|
||||
{startTime: startDateTime, endTime: endDateTime, timezone: timezone},
|
||||
function(data) {
|
||||
$('#add_show_duration').val(JSON.parse(data));
|
||||
loadingIcon.hide();
|
||||
});
|
||||
}
|
||||
|
||||
|
@ -682,7 +798,7 @@ function showErrorSections() {
|
|||
}
|
||||
|
||||
$(document).ready(function() {
|
||||
setAddShowEvents();
|
||||
setAddShowEvents($("#add-show-form"));
|
||||
});
|
||||
|
||||
//Alert the error and reload the page
|
||||
|
@ -691,27 +807,3 @@ function alertShowErrorAndReload(){
|
|||
alert($.i18n._("The show instance doesn't exist anymore!"));
|
||||
window.location.reload();
|
||||
}
|
||||
|
||||
function windowResize() {
|
||||
var windowWidth = $(this).width();
|
||||
// margin on showform are 16 px on each side
|
||||
if(!$("#schedule-add-show").is(':hidden')){
|
||||
var calendarWidth = 100-(($("#schedule-add-show").width() + (16 * 4))/windowWidth*100);
|
||||
var widthPercent = parseInt(calendarWidth)+"%";
|
||||
$("#schedule_calendar").css("width", widthPercent);
|
||||
} else {
|
||||
$("#schedule_calendar").css("width", 98.5+"%");
|
||||
}
|
||||
|
||||
// 200 px for top dashboard and 50 for padding on main content
|
||||
// this calculation was copied from schedule.js line 326
|
||||
var mainHeight = document.documentElement.clientHeight - 200 - 50;
|
||||
$('#schedule_calendar').fullCalendar('option', 'contentHeight', mainHeight);
|
||||
|
||||
}
|
||||
|
||||
var scheduleResizeTimeout;
|
||||
$(window).resize(function(){
|
||||
clearTimeout(scheduleResizeTimeout);
|
||||
scheduleResizeTimeout = setTimeout(windowResize, 100);
|
||||
});
|
||||
|
|
|
@ -19,49 +19,6 @@ function scheduleRefetchEvents(json) {
|
|||
$("#schedule_calendar").fullCalendar( 'refetchEvents' );
|
||||
}
|
||||
|
||||
function openAddShowForm() {
|
||||
if($("#add-show-form").length == 1) {
|
||||
if( ($("#add-show-form").css('display')=='none')) {
|
||||
$("#add-show-form").show();
|
||||
var windowWidth = $(window).width();
|
||||
// margin on showform are 16 px on each side
|
||||
var calendarWidth = 100-(($("#schedule-add-show").width() + (16 * 4))/windowWidth*100);
|
||||
var widthPercent = parseInt(calendarWidth)+"%";
|
||||
$("#schedule_calendar").css("width", widthPercent);
|
||||
|
||||
// 200 px for top dashboard and 50 for padding on main content
|
||||
// this calculation was copied from schedule.js line 326
|
||||
var mainHeight = document.documentElement.clientHeight - 200 - 50;
|
||||
$('#schedule_calendar').fullCalendar('option', 'contentHeight', mainHeight);
|
||||
}
|
||||
$("#schedule-show-what").show(0, function(){
|
||||
$add_show_name = $("#add_show_name");
|
||||
$add_show_name.focus();
|
||||
$add_show_name.select();
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
function makeAddShowButton(){
|
||||
$('.fc-header-left')
|
||||
.append('<span class="fc-header-space"></span>')
|
||||
.append('<span class="fc-button"><a href="#" class="add-button"><span class="add-icon"></span>'+$.i18n._("Show")+'</a></span>')
|
||||
.find('span.fc-button:last > a')
|
||||
.click(function(){
|
||||
openAddShowForm();
|
||||
removeAddShowButton();
|
||||
});
|
||||
}
|
||||
|
||||
function removeAddShowButton(){
|
||||
var aTag = $('.fc-header-left')
|
||||
.find("span.fc-button:last > a");
|
||||
|
||||
var span = aTag.parent();
|
||||
span.prev().remove();
|
||||
span.remove();
|
||||
}
|
||||
|
||||
function makeTimeStamp(date){
|
||||
var sy, sm, sd, h, m, s, timestamp;
|
||||
sy = date.getFullYear();
|
||||
|
@ -193,8 +150,8 @@ function viewDisplay( view ) {
|
|||
|
||||
var topLeft = $(view.element).find("table.fc-agenda-days > thead th:first");
|
||||
|
||||
select.width(topLeft.width())
|
||||
.height(topLeft.height());
|
||||
//select.width(topLeft.width())
|
||||
// .height(topLeft.height());
|
||||
|
||||
topLeft.empty()
|
||||
.append(select);
|
||||
|
@ -217,7 +174,7 @@ function viewDisplay( view ) {
|
|||
}
|
||||
|
||||
function eventRender(event, element, view) {
|
||||
$(element).attr("id", "fc-show-instance-"+event.id);
|
||||
$(element).addClass("fc-show-instance-"+event.id);
|
||||
$(element).attr("data-show-id", event.showId);
|
||||
$(element).attr("data-show-linked", event.linked);
|
||||
$(element).data("event", event);
|
||||
|
@ -331,6 +288,21 @@ function eventRender(event, element, view) {
|
|||
$(element).find(".fc-event-title").after('<span class="small-icon rebroadcast"></span>');
|
||||
}
|
||||
}
|
||||
|
||||
//now playing icon.
|
||||
var span = '<span class="small-icon now-playing"></span>';
|
||||
|
||||
if (event.nowPlaying === true) {
|
||||
|
||||
if (view_name === 'agendaDay' || view_name === 'agendaWeek') {
|
||||
|
||||
$(element).find(".fc-event-time").before(span);
|
||||
}
|
||||
else if (view_name === 'month') {
|
||||
|
||||
$(element).find(".fc-event-title").after(span);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function eventAfterRender( event, element, view ) {
|
||||
|
@ -353,6 +325,12 @@ function eventDrop(event, dayDelta, minuteDelta, allDay, revertFunc, jsEvent, ui
|
|||
alert(json.error);
|
||||
revertFunc();
|
||||
}
|
||||
|
||||
//Workaround for cases where FullCalendar handles events over DST
|
||||
//time changes in a different way than Airtime does.
|
||||
//(Airtime preserves show duration, FullCalendar doesn't.)
|
||||
scheduleRefetchEvents(json);
|
||||
|
||||
});
|
||||
}
|
||||
|
||||
|
@ -360,7 +338,7 @@ function eventResize( event, dayDelta, minuteDelta, revertFunc, jsEvent, ui, vie
|
|||
var url = baseUrl+'Schedule/resize-show/format/json';
|
||||
|
||||
$.post(url,
|
||||
{day: dayDelta, min: minuteDelta, showId: event.showId},
|
||||
{day: dayDelta, min: minuteDelta, showId: event.showId, instanceId: event.id},
|
||||
function(json){
|
||||
if(json.show_error == true){
|
||||
alertShowErrorAndReload();
|
||||
|
@ -374,6 +352,13 @@ function eventResize( event, dayDelta, minuteDelta, revertFunc, jsEvent, ui, vie
|
|||
});
|
||||
}
|
||||
|
||||
function windowResize() {
|
||||
// 200 px for top dashboard and 50 for padding on main content
|
||||
// this calculation was copied from schedule.js line 326
|
||||
var mainHeight = $(window).height() - 200 - 24;
|
||||
$('#schedule_calendar').fullCalendar('option', 'contentHeight', mainHeight);
|
||||
}
|
||||
|
||||
function preloadEventFeed () {
|
||||
var url = baseUrl+'Schedule/event-feed-preload';
|
||||
var d = new Date();
|
||||
|
@ -412,13 +397,13 @@ function checkSCUploadStatus(){
|
|||
|
||||
$.post(url, {format: "json", id: id, type:"show"}, function(json){
|
||||
if (json.sc_id > 0){
|
||||
$("#fc-show-instance-"+id)
|
||||
$(".fc-show-instance-"+id)
|
||||
.find(".progress")
|
||||
.removeClass("progress")
|
||||
.addClass("soundcloud");
|
||||
}
|
||||
else if (json.sc_id == "-3"){
|
||||
$("#fc-show-instance-"+id)
|
||||
$(".fc-show-instance-"+id)
|
||||
.find(".progress")
|
||||
.removeClass("progress")
|
||||
.addClass("sc-error");
|
||||
|
@ -428,59 +413,39 @@ function checkSCUploadStatus(){
|
|||
});
|
||||
});
|
||||
}
|
||||
|
||||
/** This function adds and removes the current
|
||||
* show icon
|
||||
*/
|
||||
function getCurrentShow(){
|
||||
var url = baseUrl+'Schedule/get-current-show/format/json',
|
||||
id,
|
||||
$el;
|
||||
$.post(url, {format: "json"}, function(json) {
|
||||
function getCurrentShow() {
|
||||
|
||||
var url = baseUrl+'Schedule/get-current-show/format/json';
|
||||
|
||||
function addNowPlaying(json) {
|
||||
|
||||
var $el,
|
||||
span = '<span class="small-icon now-playing"></span>';
|
||||
|
||||
$(".now-playing").remove();
|
||||
|
||||
if (json.current_show === true) {
|
||||
$el = $("div[class*=fc-event-time]");
|
||||
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.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.recording");
|
||||
$el.before('<span class="small-icon now-playing"></span><span class="small-icon recording"></span>');
|
||||
} else if ($el.siblings().hasClass("small-icon rebroadcast")) {
|
||||
|
||||
/* Without removing rebroadcast icon, the now playing
|
||||
* icon will overwrite it.
|
||||
*/
|
||||
$el.siblings().remove("span.rebroadcast");
|
||||
$el.before('<span class="small-icon now-playing"></span><span class="small-icon rebroadcast"></span>');
|
||||
} else {
|
||||
$el.before('<span class="small-icon now-playing"></span>');
|
||||
}
|
||||
}
|
||||
} else if (view_name === 'month') {
|
||||
if (!$("span[class*=fc-event-title]").siblings().hasClass("now-playing")) {
|
||||
$("span[class*=fc-event-title]").after('<span class="small-icon now-playing"></span>');
|
||||
}
|
||||
}
|
||||
|
||||
$el = $(".fc-show-instance-"+json.si_id);
|
||||
|
||||
if (view_name === 'agendaDay' || view_name === 'agendaWeek') {
|
||||
|
||||
$el.find(".fc-event-time").before(span);
|
||||
}
|
||||
else if (view_name === 'month') {
|
||||
|
||||
$el.find(".fc-event-title").after(span);
|
||||
}
|
||||
}
|
||||
//remove icon from shows that have ended
|
||||
$(".now-playing").each(function(){
|
||||
id = $(this).parents("div.fc-event").data("event").id;
|
||||
|
||||
if (id != json.si_id) {
|
||||
$(this).remove("span.now-playing");
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
setTimeout(getCurrentShow, 5000);
|
||||
});
|
||||
}
|
||||
|
||||
$.post(url, {format: "json"}, addNowPlaying);
|
||||
}
|
||||
|
||||
function addQtipsToIcons(ele, id){
|
||||
|
@ -616,8 +581,8 @@ function alertShowErrorAndReload(){
|
|||
window.location.reload();
|
||||
}
|
||||
|
||||
preloadEventFeed();
|
||||
$(document).ready(function(){
|
||||
preloadEventFeed();
|
||||
checkSCUploadStatus();
|
||||
getCurrentShow();
|
||||
});
|
||||
|
|
|
@ -13,8 +13,13 @@ var AIRTIME = (function(AIRTIME){
|
|||
var serverTimezoneOffset = 0;
|
||||
|
||||
function closeDialogCalendar(event, ui) {
|
||||
//$("#schedule_calendar").fullCalendar( 'refetchEvents' );
|
||||
$(this).remove();
|
||||
|
||||
$el = $(this);
|
||||
$el.dialog('destroy');
|
||||
$el.remove();
|
||||
|
||||
//need to refetch the events to update scheduled status.
|
||||
$("#schedule_calendar").fullCalendar( 'refetchEvents' );
|
||||
}
|
||||
|
||||
function checkShowLength(json) {
|
||||
|
@ -247,8 +252,8 @@ function createFullCalendar(data){
|
|||
|
||||
serverTimezoneOffset = data.calendarInit.timezoneOffset;
|
||||
|
||||
var mainHeight = document.documentElement.clientHeight - 200 - 50;
|
||||
|
||||
var mainHeight = $(window).height() - 200 - 35;
|
||||
|
||||
$('#schedule_calendar').fullCalendar({
|
||||
header: {
|
||||
left: 'prev, next, today',
|
||||
|
@ -319,7 +324,8 @@ function createFullCalendar(data){
|
|||
eventRender: eventRender,
|
||||
eventAfterRender: eventAfterRender,
|
||||
eventDrop: eventDrop,
|
||||
eventResize: eventResize
|
||||
eventResize: eventResize,
|
||||
windowResize: windowResize
|
||||
});
|
||||
}
|
||||
|
||||
|
|
|
@ -178,7 +178,12 @@ var AIRTIME = (function(AIRTIME){
|
|||
};
|
||||
|
||||
mod.checkToolBarIcons = function() {
|
||||
AIRTIME.library.checkAddButton();
|
||||
|
||||
//library may not be on the page.
|
||||
if (AIRTIME.library !== undefined) {
|
||||
AIRTIME.library.checkAddButton();
|
||||
}
|
||||
|
||||
mod.checkSelectButton();
|
||||
mod.checkTrimButton();
|
||||
mod.checkDeleteButton();
|
||||
|
|
|
@ -186,7 +186,11 @@ AIRTIME = (function(AIRTIME) {
|
|||
AIRTIME.showbuilder.fnServerData.start = oRange.start;
|
||||
AIRTIME.showbuilder.fnServerData.end = oRange.end;
|
||||
|
||||
AIRTIME.library.libraryInit();
|
||||
//the user might not have the library on the page (guest user)
|
||||
if (AIRTIME.library !== undefined) {
|
||||
AIRTIME.library.libraryInit();
|
||||
}
|
||||
|
||||
AIRTIME.showbuilder.builderDataTable();
|
||||
setWidgetSize();
|
||||
|
||||
|
@ -308,7 +312,7 @@ AIRTIME = (function(AIRTIME) {
|
|||
if (fn.hasOwnProperty("ops")) {
|
||||
data["myShows"] = fn.ops.myShows;
|
||||
data["showFilter"] = fn.ops.showFilter;
|
||||
data["showFilter"] = fn.ops.showInstanceFilter;
|
||||
data["showInstanceFilter"] = fn.ops.showInstanceFilter;
|
||||
}
|
||||
|
||||
$.ajax( {
|
||||
|
|
|
@ -37,19 +37,19 @@ var AIRTIME = (function(AIRTIME){
|
|||
|
||||
mod.fnGetSecondsEpoch = function(oDate) {
|
||||
var iTime,
|
||||
iServerOffset,
|
||||
iUserOffset,
|
||||
iClientOffset;
|
||||
|
||||
iTime = oDate.getTime(); //value is in millisec.
|
||||
iTime = Math.round(iTime / 1000);
|
||||
iServerOffset = serverTimezoneOffset;
|
||||
iUserOffset = userTimezoneOffset;
|
||||
iClientOffset = oDate.getTimezoneOffset() * -60;//function returns minutes
|
||||
|
||||
//adjust for the fact the the Date object is in client time.
|
||||
iTime = iTime + iClientOffset + iServerOffset;
|
||||
iTime = iTime + iClientOffset + iUserOffset;
|
||||
|
||||
return iTime;
|
||||
}
|
||||
};
|
||||
|
||||
/*
|
||||
* Get the schedule range start in unix timestamp form (in seconds).
|
||||
|
@ -64,9 +64,6 @@ var AIRTIME = (function(AIRTIME){
|
|||
mod.fnGetTimestamp = function(sDateId, sTimeId) {
|
||||
var date,
|
||||
time,
|
||||
iTime,
|
||||
iServerOffset,
|
||||
iClientOffset,
|
||||
temp;
|
||||
|
||||
temp = $(sDateId).val();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue