Merge branch '2.1.x' into devel
Conflicts: python_apps/pypo/liquidsoap_scripts/ls_script.liq
This commit is contained in:
commit
335dd1516b
40 changed files with 1084 additions and 870 deletions
|
@ -202,13 +202,19 @@ var AIRTIME = (function(AIRTIME) {
|
|||
*/
|
||||
mod.selectCurrentPage = function() {
|
||||
$.fn.reverse = [].reverse;
|
||||
var $trs = $libTable.find("tbody input:checkbox").parents("tr").reverse();
|
||||
var $inputs = $libTable.find("tbody input:checkbox"),
|
||||
$trs = $inputs.parents("tr").reverse();
|
||||
|
||||
$inputs.attr("checked", true);
|
||||
$trs.addClass(LIB_SELECTED_CLASS);
|
||||
|
||||
$trs.each(function(i, el){
|
||||
$el = $(this);
|
||||
|
||||
mod.selectItem($el);
|
||||
mod.addToChosen($el);
|
||||
});
|
||||
|
||||
mod.checkToolBarIcons();
|
||||
|
||||
};
|
||||
|
||||
/*
|
||||
|
@ -216,14 +222,20 @@ var AIRTIME = (function(AIRTIME) {
|
|||
* (behaviour taken from gmail)
|
||||
*/
|
||||
mod.deselectCurrentPage = function() {
|
||||
var $inputs = $libTable.find("tbody input:checkbox"),
|
||||
$trs = $inputs.parents("tr"),
|
||||
id;
|
||||
|
||||
var $trs = $libTable.find("tbody input:checkbox").filter(":checked").parents("tr");
|
||||
$inputs.attr("checked", false);
|
||||
$trs.removeClass(LIB_SELECTED_CLASS);
|
||||
|
||||
$trs.each(function(i, el){
|
||||
$el = $(this);
|
||||
|
||||
mod.deselectItem($el);
|
||||
});
|
||||
id = $el.attr("id");
|
||||
delete chosenItems[id];
|
||||
});
|
||||
|
||||
mod.checkToolBarIcons();
|
||||
};
|
||||
|
||||
mod.selectNone = function() {
|
||||
|
@ -252,20 +264,22 @@ var AIRTIME = (function(AIRTIME) {
|
|||
};
|
||||
|
||||
mod.fnDeleteSelectedItems = function() {
|
||||
var aData = AIRTIME.library.getSelectedData(),
|
||||
item,
|
||||
temp,
|
||||
aMedia = [];
|
||||
|
||||
//process selected files/playlists.
|
||||
for (item in aData) {
|
||||
temp = aData[item];
|
||||
if (temp !== null && temp.hasOwnProperty('id') ) {
|
||||
aMedia.push({"id": temp.id, "type": temp.ftype});
|
||||
}
|
||||
}
|
||||
|
||||
AIRTIME.library.fnDeleteItems(aMedia);
|
||||
if (confirm('Are you sure you want to delete the selected item(s)?')) {
|
||||
var aData = AIRTIME.library.getSelectedData(),
|
||||
item,
|
||||
temp,
|
||||
aMedia = [];
|
||||
|
||||
//process selected files/playlists.
|
||||
for (item in aData) {
|
||||
temp = aData[item];
|
||||
if (temp !== null && temp.hasOwnProperty('id') ) {
|
||||
aMedia.push({"id": temp.id, "type": temp.ftype});
|
||||
}
|
||||
}
|
||||
|
||||
AIRTIME.library.fnDeleteItems(aMedia);
|
||||
}
|
||||
};
|
||||
|
||||
libraryInit = function() {
|
||||
|
|
3
airtime_mvc/public/js/airtime/login/password-restore.js
Normal file
3
airtime_mvc/public/js/airtime/login/password-restore.js
Normal file
|
@ -0,0 +1,3 @@
|
|||
function redirectToLogin(){
|
||||
window.location = "/Login"
|
||||
}
|
|
@ -1,3 +1,32 @@
|
|||
function getFileName(ext){
|
||||
var filename = $("#his_date_start").val()+"_"+$("#his_time_start").val()+"m--"+$("#his_date_end").val()+"_"+$("#his_time_end").val()+"m"
|
||||
filename = filename.replace(/:/g,"h")
|
||||
if(ext == "pdf"){
|
||||
filename = filename+".pdf"
|
||||
}else{
|
||||
filename = filename+".csv"
|
||||
}
|
||||
return filename;
|
||||
}
|
||||
|
||||
function setFlashFileName( nButton, oConfig, oFlash ) {
|
||||
var filename = getFileName(oConfig.sExtends)
|
||||
oFlash.setFileName( filename );
|
||||
if(oConfig.sExtends == "pdf"){
|
||||
this.fnSetText( oFlash,
|
||||
"title:"+ this.fnGetTitle(oConfig) +"\n"+
|
||||
"message:"+ oConfig.sPdfMessage +"\n"+
|
||||
"colWidth:"+ this.fnCalcColRatios(oConfig) +"\n"+
|
||||
"orientation:"+ oConfig.sPdfOrientation +"\n"+
|
||||
"size:"+ oConfig.sPdfSize +"\n"+
|
||||
"--/TableToolsOpts--\n" +
|
||||
this.fnGetTableData(oConfig));
|
||||
}else{
|
||||
this.fnSetText( oFlash,
|
||||
this.fnGetTableData(oConfig));
|
||||
}
|
||||
}
|
||||
|
||||
var AIRTIME = (function(AIRTIME) {
|
||||
var mod;
|
||||
|
||||
|
@ -37,7 +66,7 @@ var AIRTIME = (function(AIRTIME) {
|
|||
|
||||
"aoColumns": [
|
||||
{"sTitle": "Title", "mDataProp": "title", "sClass": "his_title"}, /* Title */
|
||||
{"sTitle": "Artist", "mDataProp": "artist", "sClass": "his_artist"}, /* Creator */
|
||||
{"sTitle": "Creator", "mDataProp": "artist", "sClass": "his_artist"}, /* Creator */
|
||||
{"sTitle": "Played", "mDataProp": "played", "sClass": "his_artist"}, /* times played */
|
||||
{"sTitle": "Length", "mDataProp": "length", "sClass": "his_length library_length"}, /* Length */
|
||||
{"sTitle": "Composer", "mDataProp": "composer", "sClass": "his_composer"}, /* Composer */
|
||||
|
@ -65,7 +94,19 @@ var AIRTIME = (function(AIRTIME) {
|
|||
"sDom": 'lf<"dt-process-rel"r><"H"T><"dataTables_scrolling"t><"F"ip>',
|
||||
|
||||
"oTableTools": {
|
||||
"sSwfPath": "/js/datatables/plugin/TableTools/swf/copy_cvs_xls_pdf.swf"
|
||||
"sSwfPath": "/js/datatables/plugin/TableTools/swf/copy_cvs_xls_pdf.swf",
|
||||
"aButtons": [
|
||||
"copy",
|
||||
{
|
||||
"sExtends": "csv",
|
||||
"fnClick": setFlashFileName
|
||||
},
|
||||
{
|
||||
"sExtends": "pdf",
|
||||
"fnClick": setFlashFileName
|
||||
},
|
||||
"print"
|
||||
]
|
||||
}
|
||||
});
|
||||
oTable.fnSetFilteringDelay(350);
|
||||
|
|
|
@ -91,6 +91,34 @@ function onEndTimeSelect(){
|
|||
$("#add_show_end_time").trigger('input');
|
||||
}
|
||||
|
||||
function padZeroes(number, length)
|
||||
{
|
||||
var str = '' + number;
|
||||
while (str.length < length) {str = '0' + str;}
|
||||
return str;
|
||||
}
|
||||
|
||||
function hashCode(str) { // java String#hashCode
|
||||
var hash = 0;
|
||||
for (var i = 0; i < str.length; i++) {
|
||||
hash = str.charCodeAt(i) + ((hash << 5) - hash);
|
||||
}
|
||||
return hash;
|
||||
}
|
||||
|
||||
function intToRGB(i){
|
||||
return (padZeroes(((i>>16)&0xFF).toString(16), 2) +
|
||||
padZeroes(((i>>8)&0xFF).toString(16), 2)+
|
||||
padZeroes((i&0xFF).toString(16), 2)
|
||||
);
|
||||
}
|
||||
|
||||
function stringToColor(s)
|
||||
{
|
||||
return intToRGB(hashCode(s));
|
||||
}
|
||||
|
||||
|
||||
function setAddShowEvents() {
|
||||
|
||||
var form = $("#add-show-form");
|
||||
|
@ -548,6 +576,12 @@ function setAddShowEvents() {
|
|||
loadingIcon.hide();
|
||||
});
|
||||
}
|
||||
|
||||
var bgColorEle = $("#add_show_background_color");
|
||||
$('#add_show_name').bind('input', 'change', function(){
|
||||
var colorCode = stringToColor($(this).val());
|
||||
bgColorEle.val(colorCode);
|
||||
});
|
||||
}
|
||||
|
||||
function showErrorSections() {
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
/**
|
||||
*
|
||||
* Full Calendar callback methods.
|
||||
* Full Calendar callback methods.
|
||||
*
|
||||
*/
|
||||
|
||||
|
@ -9,12 +9,12 @@ function scheduleRefetchEvents(json) {
|
|||
alert("The show instance doesn't exist anymore!");
|
||||
}
|
||||
if(json.show_id) {
|
||||
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 (dialog_id === json.show_id) {
|
||||
$("#add-show-close").click();
|
||||
}
|
||||
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 (dialog_id === json.show_id) {
|
||||
$("#add-show-close").click();
|
||||
}
|
||||
}
|
||||
$("#schedule_calendar").fullCalendar( 'refetchEvents' );
|
||||
}
|
||||
|
@ -31,9 +31,9 @@ function openAddShowForm() {
|
|||
$("#schedule_calendar").fullCalendar('render');
|
||||
}
|
||||
$("#schedule-show-what").show(0, function(){
|
||||
$add_show_name = $("#add_show_name");
|
||||
$add_show_name.focus();
|
||||
$add_show_name.select();
|
||||
$add_show_name = $("#add_show_name");
|
||||
$add_show_name.focus();
|
||||
$add_show_name.select();
|
||||
});
|
||||
}
|
||||
}
|
||||
|
@ -59,16 +59,16 @@ function removeAddShowButton(){
|
|||
}
|
||||
|
||||
function makeTimeStamp(date){
|
||||
var sy, sm, sd, h, m, s, timestamp;
|
||||
sy = date.getFullYear();
|
||||
sm = date.getMonth() + 1;
|
||||
sd = date.getDate();
|
||||
h = date.getHours();
|
||||
m = date.getMinutes();
|
||||
s = date.getSeconds();
|
||||
var sy, sm, sd, h, m, s, timestamp;
|
||||
sy = date.getFullYear();
|
||||
sm = date.getMonth() + 1;
|
||||
sd = date.getDate();
|
||||
h = date.getHours();
|
||||
m = date.getMinutes();
|
||||
s = date.getSeconds();
|
||||
|
||||
timestamp = sy+"-"+ pad(sm, 2) +"-"+ pad(sd, 2) +" "+ pad(h, 2) +":"+ pad(m, 2) +":"+ pad(s, 2);
|
||||
return timestamp;
|
||||
timestamp = sy+"-"+ pad(sm, 2) +"-"+ pad(sd, 2) +" "+ pad(h, 2) +":"+ pad(m, 2) +":"+ pad(s, 2);
|
||||
return timestamp;
|
||||
}
|
||||
|
||||
function dayClick(date, allDay, jsEvent, view){
|
||||
|
@ -76,9 +76,9 @@ function dayClick(date, allDay, jsEvent, view){
|
|||
// Hence, if the user if DJ then it won't open anything.
|
||||
if(userType == "A" || userType == "P"){
|
||||
var now, today, selected, chosenDate, chosenTime;
|
||||
|
||||
|
||||
now = adjustDateToServerDate(new Date(), serverTimezoneOffset);
|
||||
|
||||
|
||||
if(view.name === "month") {
|
||||
today = new Date(now.getFullYear(), now.getMonth(), now.getDate());
|
||||
selected = new Date(date.getFullYear(), date.getMonth(), date.getDate());
|
||||
|
@ -87,17 +87,17 @@ function dayClick(date, allDay, jsEvent, view){
|
|||
today = new Date(now.getFullYear(), now.getMonth(), now.getDate(), now.getHours(), now.getMinutes());
|
||||
selected = new Date(date.getFullYear(), date.getMonth(), date.getDate(), date.getHours(), date.getMinutes());
|
||||
}
|
||||
|
||||
|
||||
if(selected >= today) {
|
||||
var addShow = $('.add-button');
|
||||
|
||||
|
||||
//remove the +show button if it exists.
|
||||
if(addShow.length == 1){
|
||||
var span = $(addShow).parent();
|
||||
$(span).prev().remove();
|
||||
$(span).remove();
|
||||
}
|
||||
|
||||
|
||||
// get current duration value on the form
|
||||
var duration_string = $.trim($("#add_show_duration").val());
|
||||
var duration_info = duration_string.split(" ");
|
||||
|
@ -111,7 +111,7 @@ function dayClick(date, allDay, jsEvent, view){
|
|||
}
|
||||
// duration in milisec
|
||||
var duration = (duration_h * 60 * 60 * 1000) + (duration_m * 60 * 1000);
|
||||
|
||||
|
||||
var startTime_string, startTime
|
||||
// get start time value on the form
|
||||
if(view.name === "month") {
|
||||
|
@ -124,13 +124,13 @@ function dayClick(date, allDay, jsEvent, view){
|
|||
startTime_string = pad(selected.getHours(),2)+":"+pad(selected.getMinutes(),2)
|
||||
startTime = 0
|
||||
}
|
||||
|
||||
|
||||
// calculate endDateTime
|
||||
var endDateTime = new Date(selected.getTime() + startTime + duration);
|
||||
|
||||
|
||||
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);
|
||||
|
||||
|
||||
$("#add_show_start_date").val(chosenDate);
|
||||
$("#add_show_end_date_no_repeat").val(endDateFormat);
|
||||
$("#add_show_end_date").val(endDateFormat);
|
||||
|
@ -140,7 +140,7 @@ function dayClick(date, allDay, jsEvent, view){
|
|||
$("#add_show_end_time").val(endTimeString)
|
||||
}
|
||||
$("#schedule-show-when").show();
|
||||
|
||||
|
||||
openAddShowForm();
|
||||
}
|
||||
}
|
||||
|
@ -173,10 +173,10 @@ function viewDisplay( view ) {
|
|||
.fullCalendar('destroy')
|
||||
.fullCalendar(opt)
|
||||
.fullCalendar( 'gotoDate', date );
|
||||
|
||||
|
||||
//save slotMin value to db
|
||||
var url = '/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");
|
||||
|
@ -192,146 +192,128 @@ function viewDisplay( view ) {
|
|||
}
|
||||
|
||||
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.
|
||||
if(userType == "A" || userType == "P"){
|
||||
makeAddShowButton();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//save view name to db
|
||||
var url = '/Schedule/set-time-scale/format/json';
|
||||
$.post(url, {timeScale: view.name});
|
||||
}
|
||||
|
||||
function eventRender(event, element, view) {
|
||||
|
||||
$(element).data("event", event);
|
||||
|
||||
$(element).data("event", event);
|
||||
|
||||
//only put progress bar on shows that aren't being recorded.
|
||||
if((view.name === 'agendaDay' || view.name === 'agendaWeek') && event.record === 0) {
|
||||
var div = $('<div/>');
|
||||
div
|
||||
.height('5px')
|
||||
.width('95%')
|
||||
.css('margin-top', '1px')
|
||||
if((view.name === 'agendaDay' || view.name === 'agendaWeek') && event.record === 0) {
|
||||
var div = $('<div/>');
|
||||
div
|
||||
.height('5px')
|
||||
.width('95%')
|
||||
.css('margin-top', '1px')
|
||||
.css('margin-left', 'auto')
|
||||
.css('margin-right', 'auto')
|
||||
.progressbar({
|
||||
value: event.percent
|
||||
});
|
||||
.progressbar({
|
||||
value: event.percent
|
||||
});
|
||||
|
||||
$(element).find(".fc-event-content").append(div);
|
||||
}
|
||||
$(element).find(".fc-event-content").append(div);
|
||||
}
|
||||
|
||||
//add the record/rebroadcast icons if needed.
|
||||
//record icon (only if not on soundcloud, will always be true for future events)
|
||||
//add the record/rebroadcast/soundcloud icons if needed
|
||||
if((view.name === 'agendaDay' || view.name === 'agendaWeek') && event.record === 1 && event.soundcloud_id === -1) {
|
||||
$(element).find(".fc-event-time").before('<span id="'+event.id+'" class="small-icon recording"></span>');
|
||||
} else if ((view.name === 'agendaDay' || view.name === 'agendaWeek') && event.record === 1 && event.soundcloud_id > 0) {
|
||||
$(element).find(".fc-event-time").before('<span id="'+event.id+'" class="small-icon recording"></span><span id="'+event.id+'" class="small-icon soundcloud"></span>');
|
||||
} else if ((view.name === 'agendaDay' || view.name === 'agendaWeek') && event.record === 1 && event.soundcloud_id === -2) {
|
||||
$(element).find(".fc-event-time").before('<span id="'+event.id+'" class="small-icon recording"></span><span id="'+event.id+'" class="small-icon progress"></span>');
|
||||
} else if ((view.name === 'agendaDay' || view.name === 'agendaWeek') && event.record === 1 && event.soundcloud_id === -3) {
|
||||
$(element).find(".fc-event-time").before('<span id="'+event.id+'" class="small-icon recording"></span><span id="'+event.id+'" class="small-icon sc-error"></span>');
|
||||
}
|
||||
|
||||
$(element).find(".fc-event-time").before('<span id="'+event.id+'" class="small-icon recording"></span>');
|
||||
}
|
||||
if(view.name === 'month' && event.record === 1 && event.soundcloud_id === -1) {
|
||||
$(element).find(".fc-event-title").after('<span id="'+event.id+'" class="small-icon recording"></span>');
|
||||
} else if (view.name === 'month' && event.record === 1 && event.soundcloud_id > 0) {
|
||||
$(element).find(".fc-event-title").after('<span id="'+event.id+'" class="small-icon recording"></span><span id="'+event.id+'" class="small-icon soundcloud"></span>');
|
||||
} else if (view.name === 'month' && event.record === 1 && event.soundcloud_id === -2) {
|
||||
$(element).find(".fc-event-title").after('<span id="'+event.id+'" class="small-icon recording"></span><span id="'+event.id+'" class="small-icon progress"></span>');
|
||||
} else if (view.name === 'month' && event.record === 1 && event.soundcloud_id === -3) {
|
||||
$(element).find(".fc-event-title").after('<span id="'+event.id+'" class="small-icon recording"></span><span id="'+event.id+'" class="small-icon sc-error"></span>');
|
||||
}
|
||||
|
||||
$(element).find(".fc-event-title").after('<span id="'+event.id+'" class="small-icon recording"></span>');
|
||||
}
|
||||
//rebroadcast icon
|
||||
if((view.name === 'agendaDay' || view.name === 'agendaWeek') && event.rebroadcast === 1) {
|
||||
|
||||
$(element).find(".fc-event-time").before('<span id="'+event.id+'" class="small-icon rebroadcast"></span>');
|
||||
}
|
||||
$(element).find(".fc-event-time").before('<span id="'+event.id+'" class="small-icon rebroadcast"></span>');
|
||||
}
|
||||
if(view.name === 'month' && event.rebroadcast === 1) {
|
||||
|
||||
$(element).find(".fc-event-title").after('<span id="'+event.id+'" class="small-icon rebroadcast"></span>');
|
||||
}
|
||||
//soundcloud icon
|
||||
if((view.name === 'agendaDay' || view.name === 'agendaWeek') && event.soundcloud_id > 0 && event.record === 1) {
|
||||
|
||||
$(element).find(".fc-event-time").before('<span id="'+event.id+'" class="small-icon soundcloud"></span>');
|
||||
}
|
||||
if(view.name === 'month' && event.soundcloud_id > 0 && event.record === 1) {
|
||||
|
||||
$(element).find(".fc-event-title").after('<span id="'+event.id+'" class="small-icon soundcloud"></span>');
|
||||
}
|
||||
|
||||
//progress icon
|
||||
if((view.name === 'agendaDay' || view.name === 'agendaWeek') && event.soundcloud_id === -2 && event.record === 1) {
|
||||
|
||||
$(element).find(".fc-event-time").before('<span id="'+event.id+'" class="small-icon progress"></span>');
|
||||
}
|
||||
if(view.name === 'month' && event.soundcloud_id === -2 && event.record === 1) {
|
||||
|
||||
$(element).find(".fc-event-title").after('<span id="'+event.id+'" class="small-icon progress"></span>');
|
||||
}
|
||||
|
||||
//error icon
|
||||
if((view.name === 'agendaDay' || view.name === 'agendaWeek') && event.soundcloud_id === -3 && event.record === 1) {
|
||||
|
||||
$(element).find(".fc-event-time").before('<span id="'+event.id+'" class="small-icon sc-error"></span>');
|
||||
}
|
||||
if(view.name === 'month' && event.soundcloud_id === -3 && event.record === 1) {
|
||||
|
||||
$(element).find(".fc-event-title").after('<span id="'+event.id+'" class="small-icon sc-error"></span>');
|
||||
$(element).find(".fc-event-title").after('<span id="'+event.id+'" class="small-icon rebroadcast"></span>');
|
||||
}
|
||||
}
|
||||
|
||||
function eventAfterRender( event, element, view ) {
|
||||
|
||||
|
||||
$(element).find(".small-icon").live('mouseover',function(){
|
||||
addQtipToSCIcons($(this));
|
||||
});
|
||||
}
|
||||
|
||||
function eventDrop(event, dayDelta, minuteDelta, allDay, revertFunc, jsEvent, ui, view) {
|
||||
var url;
|
||||
var url;
|
||||
|
||||
url = '/Schedule/move-show/format/json';
|
||||
url = '/Schedule/move-show/format/json';
|
||||
|
||||
$.post(url,
|
||||
{day: dayDelta, min: minuteDelta, showInstanceId: event.id},
|
||||
function(json){
|
||||
if(json.show_error == true){
|
||||
$.post(url,
|
||||
{day: dayDelta, min: minuteDelta, showInstanceId: event.id},
|
||||
function(json){
|
||||
if(json.show_error == true){
|
||||
alertShowErrorAndReload();
|
||||
}
|
||||
if(json.error) {
|
||||
if(json.error) {
|
||||
alert(json.error);
|
||||
revertFunc();
|
||||
}
|
||||
});
|
||||
revertFunc();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
function eventResize( event, dayDelta, minuteDelta, revertFunc, jsEvent, ui, view ) {
|
||||
var url;
|
||||
var url;
|
||||
|
||||
url = '/Schedule/resize-show/format/json';
|
||||
url = '/Schedule/resize-show/format/json';
|
||||
|
||||
$.post(url,
|
||||
{day: dayDelta, min: minuteDelta, showId: event.showId},
|
||||
function(json){
|
||||
if(json.show_error == true){
|
||||
$.post(url,
|
||||
{day: dayDelta, min: minuteDelta, showId: event.showId},
|
||||
function(json){
|
||||
if(json.show_error == true){
|
||||
alertShowErrorAndReload();
|
||||
}
|
||||
if(json.error) {
|
||||
if(json.error) {
|
||||
alert(json.error);
|
||||
revertFunc();
|
||||
}
|
||||
revertFunc();
|
||||
}
|
||||
|
||||
scheduleRefetchEvents(json);
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
function getFullCalendarEvents(start, end, callback) {
|
||||
var url, start_date, end_date;
|
||||
var url, start_date, end_date;
|
||||
|
||||
start_date = makeTimeStamp(start);
|
||||
end_date = makeTimeStamp(end);
|
||||
start_date = makeTimeStamp(start);
|
||||
end_date = makeTimeStamp(end);
|
||||
|
||||
url = '/Schedule/event-feed';
|
||||
url = '/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){
|
||||
callback(json.events);
|
||||
});
|
||||
$.post(url, {format: "json", start: start_date, end: end_date, cachep: d.getTime()}, function(json){
|
||||
callback(json.events);
|
||||
});
|
||||
}
|
||||
|
||||
function checkSCUploadStatus(){
|
||||
|
@ -340,9 +322,9 @@ function checkSCUploadStatus(){
|
|||
var id = $(this).attr("id");
|
||||
$.post(url, {format: "json", id: id, type:"show"}, function(json){
|
||||
if(json.sc_id > 0){
|
||||
$("span[id="+id+"]").removeClass("progress").addClass("soundcloud");
|
||||
$("span[id="+id+"]:not(.recording)").removeClass("progress").addClass("soundcloud");
|
||||
}else if(json.sc_id == "-3"){
|
||||
$("span[id="+id+"]").removeClass("progress").addClass("sc-error");
|
||||
$("span[id="+id+"]:not(.recording)").removeClass("progress").addClass("sc-error");
|
||||
}
|
||||
});
|
||||
});
|
||||
|
|
|
@ -1,20 +1,20 @@
|
|||
var AIRTIME = (function(AIRTIME){
|
||||
var mod;
|
||||
|
||||
if (AIRTIME.schedule === undefined) {
|
||||
AIRTIME.schedule = {};
|
||||
}
|
||||
mod = AIRTIME.schedule;
|
||||
|
||||
return AIRTIME;
|
||||
|
||||
var mod;
|
||||
|
||||
if (AIRTIME.schedule === undefined) {
|
||||
AIRTIME.schedule = {};
|
||||
}
|
||||
mod = AIRTIME.schedule;
|
||||
|
||||
return AIRTIME;
|
||||
|
||||
}(AIRTIME || {}));
|
||||
|
||||
var serverTimezoneOffset = 0;
|
||||
|
||||
function closeDialog(event, ui) {
|
||||
$("#schedule_calendar").fullCalendar( 'refetchEvents' );
|
||||
$(this).remove();
|
||||
$("#schedule_calendar").fullCalendar( 'refetchEvents' );
|
||||
$(this).remove();
|
||||
}
|
||||
|
||||
function checkShowLength(json) {
|
||||
|
@ -36,11 +36,11 @@ function confirmCancelShow(show_instance_id){
|
|||
if (confirm('Cancel Current Show?')) {
|
||||
var url = "/Schedule/cancel-current-show";
|
||||
$.ajax({
|
||||
url: url,
|
||||
data: {format: "json", id: show_instance_id},
|
||||
success: function(data){
|
||||
scheduleRefetchEvents(data);
|
||||
}
|
||||
url: url,
|
||||
data: {format: "json", id: show_instance_id},
|
||||
success: function(data){
|
||||
scheduleRefetchEvents(data);
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
@ -49,11 +49,11 @@ function confirmCancelRecordedShow(show_instance_id){
|
|||
if (confirm('Stop recording current show?')) {
|
||||
var url = "/Schedule/cancel-current-show";
|
||||
$.ajax({
|
||||
url: url,
|
||||
data: {format: "json", id: show_instance_id},
|
||||
success: function(data){
|
||||
scheduleRefetchEvents(data);
|
||||
}
|
||||
url: url,
|
||||
data: {format: "json", id: show_instance_id},
|
||||
success: function(data){
|
||||
scheduleRefetchEvents(data);
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
@ -72,21 +72,21 @@ function uploadToSoundCloud(show_instance_id){
|
|||
if(span.length == 0){
|
||||
span = $(window.triggerElement).find(".soundcloud");
|
||||
span.removeClass("soundcloud")
|
||||
.addClass("progress");
|
||||
.addClass("progress");
|
||||
}else{
|
||||
span.removeClass("recording")
|
||||
.addClass("progress");
|
||||
.addClass("progress");
|
||||
}
|
||||
}
|
||||
|
||||
function checkCalendarSCUploadStatus(){
|
||||
|
||||
var url = '/Library/get-upload-to-soundcloud-status',
|
||||
span,
|
||||
id;
|
||||
span,
|
||||
id;
|
||||
|
||||
function checkSCUploadStatusCallback(json) {
|
||||
|
||||
|
||||
if (json.sc_id > 0) {
|
||||
span.removeClass("progress").addClass("soundcloud");
|
||||
|
||||
|
@ -108,113 +108,111 @@ function checkCalendarSCUploadStatus(){
|
|||
}
|
||||
|
||||
function findViewportDimensions() {
|
||||
var viewportwidth,
|
||||
viewportheight;
|
||||
|
||||
// the more standards compliant browsers (mozilla/netscape/opera/IE7) use
|
||||
// window.innerWidth and window.innerHeight
|
||||
if (typeof window.innerWidth != 'undefined') {
|
||||
viewportwidth = window.innerWidth, viewportheight = window.innerHeight;
|
||||
}
|
||||
// IE6 in standards compliant mode (i.e. with a valid doctype as the first
|
||||
// line in the document)
|
||||
else if (typeof document.documentElement != 'undefined'
|
||||
&& typeof document.documentElement.clientWidth != 'undefined'
|
||||
&& document.documentElement.clientWidth != 0) {
|
||||
viewportwidth = document.documentElement.clientWidth;
|
||||
viewportheight = document.documentElement.clientHeight;
|
||||
}
|
||||
// older versions of IE
|
||||
else {
|
||||
viewportwidth = document.getElementsByTagName('body')[0].clientWidth;
|
||||
viewportheight = document.getElementsByTagName('body')[0].clientHeight;
|
||||
}
|
||||
|
||||
return {
|
||||
width: viewportwidth,
|
||||
height: viewportheight
|
||||
};
|
||||
var viewportwidth,
|
||||
viewportheight;
|
||||
|
||||
// the more standards compliant browsers (mozilla/netscape/opera/IE7) use
|
||||
// window.innerWidth and window.innerHeight
|
||||
if (typeof window.innerWidth != 'undefined') {
|
||||
viewportwidth = window.innerWidth, viewportheight = window.innerHeight;
|
||||
}
|
||||
// IE6 in standards compliant mode (i.e. with a valid doctype as the first
|
||||
// line in the document)
|
||||
else if (typeof document.documentElement != 'undefined'
|
||||
&& typeof document.documentElement.clientWidth != 'undefined'
|
||||
&& document.documentElement.clientWidth != 0) {
|
||||
viewportwidth = document.documentElement.clientWidth;
|
||||
viewportheight = document.documentElement.clientHeight;
|
||||
}
|
||||
// older versions of IE
|
||||
else {
|
||||
viewportwidth = document.getElementsByTagName('body')[0].clientWidth;
|
||||
viewportheight = document.getElementsByTagName('body')[0].clientHeight;
|
||||
}
|
||||
|
||||
return {
|
||||
width: viewportwidth,
|
||||
height: viewportheight
|
||||
};
|
||||
}
|
||||
|
||||
function buildScheduleDialog (json) {
|
||||
|
||||
var dialog = $(json.dialog),
|
||||
viewport = findViewportDimensions(),
|
||||
height = Math.floor(viewport.height * 0.96),
|
||||
width = Math.floor(viewport.width * 0.96),
|
||||
fnServer = AIRTIME.showbuilder.fnServerData,
|
||||
//subtract padding in pixels
|
||||
widgetWidth = width - 60,
|
||||
libWidth = Math.floor(widgetWidth * 0.5),
|
||||
builderWidth = Math.floor(widgetWidth * 0.5);
|
||||
|
||||
dialog.find("#library_content")
|
||||
.height(height - 115)
|
||||
.width(libWidth);
|
||||
|
||||
dialog.find("#show_builder")
|
||||
.height(height - 115)
|
||||
.width(builderWidth);
|
||||
|
||||
dialog.dialog({
|
||||
autoOpen: false,
|
||||
title: json.title,
|
||||
width: width,
|
||||
height: height,
|
||||
resizable: false,
|
||||
draggable: true,
|
||||
modal: true,
|
||||
close: closeDialog,
|
||||
buttons: {"Ok": function() {
|
||||
dialog.remove();
|
||||
$("#schedule_calendar").fullCalendar( 'refetchEvents' );
|
||||
}}
|
||||
});
|
||||
|
||||
//set the start end times so the builder datatables knows its time range.
|
||||
fnServer.start = json.start;
|
||||
fnServer.end = json.end;
|
||||
|
||||
AIRTIME.library.libraryInit();
|
||||
AIRTIME.showbuilder.builderDataTable();
|
||||
|
||||
//set max heights of datatables.
|
||||
dialog.find(".lib-content .dataTables_scrolling")
|
||||
.css("max-height", height - 90 - 155);
|
||||
|
||||
dialog.find(".sb-content .dataTables_scrolling")
|
||||
.css("max-height", height - 90 - 60);
|
||||
|
||||
dialog.dialog('open');
|
||||
var dialog = $(json.dialog),
|
||||
viewport = findViewportDimensions(),
|
||||
height = Math.floor(viewport.height * 0.96),
|
||||
width = Math.floor(viewport.width * 0.96),
|
||||
fnServer = AIRTIME.showbuilder.fnServerData,
|
||||
//subtract padding in pixels
|
||||
widgetWidth = width - 60,
|
||||
libWidth = Math.floor(widgetWidth * 0.5),
|
||||
builderWidth = Math.floor(widgetWidth * 0.5);
|
||||
|
||||
dialog.find("#library_content")
|
||||
.height(height - 115)
|
||||
.width(libWidth);
|
||||
|
||||
dialog.find("#show_builder")
|
||||
.height(height - 115)
|
||||
.width(builderWidth);
|
||||
|
||||
dialog.dialog({
|
||||
autoOpen: false,
|
||||
title: json.title,
|
||||
width: width,
|
||||
height: height,
|
||||
resizable: false,
|
||||
draggable: true,
|
||||
modal: true,
|
||||
close: closeDialog,
|
||||
buttons: {"Ok": function() {
|
||||
$(this).dialog("close");
|
||||
}}
|
||||
});
|
||||
|
||||
//set the start end times so the builder datatables knows its time range.
|
||||
fnServer.start = json.start;
|
||||
fnServer.end = json.end;
|
||||
|
||||
AIRTIME.library.libraryInit();
|
||||
AIRTIME.showbuilder.builderDataTable();
|
||||
|
||||
//set max heights of datatables.
|
||||
dialog.find(".lib-content .dataTables_scrolling")
|
||||
.css("max-height", height - 90 - 155);
|
||||
|
||||
dialog.find(".sb-content .dataTables_scrolling")
|
||||
.css("max-height", height - 90 - 60);
|
||||
|
||||
dialog.dialog('open');
|
||||
}
|
||||
|
||||
function buildContentDialog (json){
|
||||
var dialog = $(json.dialog),
|
||||
viewport = findViewportDimensions(),
|
||||
height = viewport.height * 2/3,
|
||||
width = viewport.width * 4/5;
|
||||
|
||||
var dialog = $(json.dialog),
|
||||
viewport = findViewportDimensions(),
|
||||
height = viewport.height * 2/3,
|
||||
width = viewport.width * 4/5;
|
||||
|
||||
if (json.show_error == true){
|
||||
alertShowErrorAndReload();
|
||||
}
|
||||
|
||||
dialog.find("#show_progressbar").progressbar({
|
||||
value: json.percentFilled
|
||||
});
|
||||
|
||||
dialog.find("#show_progressbar").progressbar({
|
||||
value: json.percentFilled
|
||||
});
|
||||
|
||||
dialog.dialog({
|
||||
autoOpen: false,
|
||||
title: "Contents of Show \"" + json.showTitle + "\"",
|
||||
width: width,
|
||||
height: height,
|
||||
modal: true,
|
||||
close: closeDialog,
|
||||
buttons: {"Ok": function() {
|
||||
dialog.remove();
|
||||
}}
|
||||
});
|
||||
dialog.dialog({
|
||||
autoOpen: false,
|
||||
title: "Contents of Show \"" + json.showTitle + "\"",
|
||||
width: width,
|
||||
height: height,
|
||||
modal: true,
|
||||
close: closeDialog,
|
||||
buttons: {"Ok": function() {
|
||||
dialog.remove();
|
||||
}}
|
||||
});
|
||||
|
||||
dialog.dialog('open');
|
||||
dialog.dialog('open');
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -279,55 +277,55 @@ function alertShowErrorAndReload(){
|
|||
}
|
||||
|
||||
$(document).ready(function() {
|
||||
$.ajax({ url: "/Api/calendar-init/format/json", dataType:"json", success:createFullCalendar
|
||||
$.ajax({ url: "/Api/calendar-init/format/json", dataType:"json", success:createFullCalendar
|
||||
, error:function(jqXHR, textStatus, errorThrown){}});
|
||||
|
||||
setInterval(checkCalendarSCUploadStatus, 5000);
|
||||
|
||||
$.contextMenu({
|
||||
|
||||
setInterval(checkCalendarSCUploadStatus, 5000);
|
||||
|
||||
$.contextMenu({
|
||||
selector: 'div.fc-event',
|
||||
trigger: "left",
|
||||
ignoreRightClick: true,
|
||||
|
||||
build: function($el, e) {
|
||||
var data,
|
||||
items,
|
||||
callback;
|
||||
|
||||
data = $el.data("event");
|
||||
|
||||
function processMenuItems(oItems) {
|
||||
|
||||
//define a schedule callback.
|
||||
if (oItems.schedule !== undefined) {
|
||||
|
||||
callback = function() {
|
||||
|
||||
$.post(oItems.schedule.url, {format: "json", id: data.id}, function(json){
|
||||
buildScheduleDialog(json);
|
||||
});
|
||||
};
|
||||
|
||||
oItems.schedule.callback = callback;
|
||||
}
|
||||
|
||||
//define a clear callback.
|
||||
if (oItems.clear !== undefined) {
|
||||
|
||||
callback = function() {
|
||||
if (confirm("Remove all content?")) {
|
||||
$.post(oItems.clear.url, {format: "json", id: data.id}, function(json){
|
||||
scheduleRefetchEvents(json);
|
||||
});
|
||||
}
|
||||
};
|
||||
oItems.clear.callback = callback;
|
||||
}
|
||||
|
||||
//define an edit callback.
|
||||
if (oItems.edit !== undefined) {
|
||||
if(oItems.edit.items !== undefined){
|
||||
var edit = oItems.edit.items;
|
||||
var data,
|
||||
items,
|
||||
callback;
|
||||
|
||||
data = $el.data("event");
|
||||
|
||||
function processMenuItems(oItems) {
|
||||
|
||||
//define a schedule callback.
|
||||
if (oItems.schedule !== undefined) {
|
||||
|
||||
callback = function() {
|
||||
|
||||
$.post(oItems.schedule.url, {format: "json", id: data.id}, function(json){
|
||||
buildScheduleDialog(json);
|
||||
});
|
||||
};
|
||||
|
||||
oItems.schedule.callback = callback;
|
||||
}
|
||||
|
||||
//define a clear callback.
|
||||
if (oItems.clear !== undefined) {
|
||||
|
||||
callback = function() {
|
||||
if (confirm("Remove all content?")) {
|
||||
$.post(oItems.clear.url, {format: "json", id: data.id}, function(json){
|
||||
scheduleRefetchEvents(json);
|
||||
});
|
||||
}
|
||||
};
|
||||
oItems.clear.callback = callback;
|
||||
}
|
||||
|
||||
//define an edit callback.
|
||||
if (oItems.edit !== undefined) {
|
||||
if(oItems.edit.items !== undefined){
|
||||
var edit = oItems.edit.items;
|
||||
|
||||
//edit a single instance
|
||||
callback = function() {
|
||||
|
@ -344,55 +342,55 @@ $(document).ready(function() {
|
|||
});
|
||||
};
|
||||
edit.all.callback = callback;
|
||||
}else{
|
||||
callback = function() {
|
||||
}else{
|
||||
callback = function() {
|
||||
$.get(oItems.edit.url, {format: "json", id: data.id, type: oItems.edit._type}, function(json){
|
||||
beginEditShow(json);
|
||||
});
|
||||
};
|
||||
oItems.edit.callback = callback;
|
||||
}
|
||||
}
|
||||
|
||||
//define a content callback.
|
||||
if (oItems.content !== undefined) {
|
||||
|
||||
callback = function() {
|
||||
$.get(oItems.content.url, {format: "json", id: data.id}, function(json){
|
||||
buildContentDialog(json);
|
||||
});
|
||||
};
|
||||
oItems.content.callback = callback;
|
||||
}
|
||||
|
||||
//define a soundcloud upload callback.
|
||||
if (oItems.soundcloud_upload !== undefined) {
|
||||
|
||||
callback = function() {
|
||||
uploadToSoundCloud(data.id);
|
||||
};
|
||||
oItems.soundcloud_upload.callback = callback;
|
||||
}
|
||||
|
||||
//define a view on soundcloud callback.
|
||||
if (oItems.soundcloud_view !== undefined) {
|
||||
|
||||
callback = function() {
|
||||
}
|
||||
}
|
||||
|
||||
//define a content callback.
|
||||
if (oItems.content !== undefined) {
|
||||
|
||||
callback = function() {
|
||||
$.get(oItems.content.url, {format: "json", id: data.id}, function(json){
|
||||
buildContentDialog(json);
|
||||
});
|
||||
};
|
||||
oItems.content.callback = callback;
|
||||
}
|
||||
|
||||
//define a soundcloud upload callback.
|
||||
if (oItems.soundcloud_upload !== undefined) {
|
||||
|
||||
callback = function() {
|
||||
uploadToSoundCloud(data.id);
|
||||
};
|
||||
oItems.soundcloud_upload.callback = callback;
|
||||
}
|
||||
|
||||
//define a view on soundcloud callback.
|
||||
if (oItems.soundcloud_view !== undefined) {
|
||||
|
||||
callback = function() {
|
||||
window.open(oItems.soundcloud_view.url);
|
||||
};
|
||||
oItems.soundcloud_view.callback = callback;
|
||||
}
|
||||
|
||||
//define a cancel recorded show callback.
|
||||
if (oItems.cancel_recorded !== undefined) {
|
||||
|
||||
callback = function() {
|
||||
confirmCancelRecordedShow(data.id);
|
||||
};
|
||||
oItems.cancel_recorded.callback = callback;
|
||||
}
|
||||
|
||||
//define a view recorded callback.
|
||||
oItems.soundcloud_view.callback = callback;
|
||||
}
|
||||
|
||||
//define a cancel recorded show callback.
|
||||
if (oItems.cancel_recorded !== undefined) {
|
||||
|
||||
callback = function() {
|
||||
confirmCancelRecordedShow(data.id);
|
||||
};
|
||||
oItems.cancel_recorded.callback = callback;
|
||||
}
|
||||
|
||||
//define a view recorded callback.
|
||||
if (oItems.view_recorded !== undefined) {
|
||||
|
||||
callback = function() {
|
||||
|
@ -400,71 +398,71 @@ $(document).ready(function() {
|
|||
};
|
||||
oItems.view_recorded.callback = callback;
|
||||
}
|
||||
|
||||
//define a cancel callback.
|
||||
if (oItems.cancel !== undefined) {
|
||||
|
||||
callback = function() {
|
||||
confirmCancelShow(data.id);
|
||||
};
|
||||
oItems.cancel.callback = callback;
|
||||
}
|
||||
|
||||
//define a delete callback.
|
||||
if (oItems.del !== undefined) {
|
||||
|
||||
//repeating show multiple delete options
|
||||
if (oItems.del.items !== undefined) {
|
||||
var del = oItems.del.items;
|
||||
|
||||
//delete a single instance
|
||||
callback = function() {
|
||||
$.post(del.single.url, {format: "json", id: data.id}, function(json){
|
||||
scheduleRefetchEvents(json);
|
||||
});
|
||||
};
|
||||
del.single.callback = callback;
|
||||
|
||||
//delete this instance and all following instances.
|
||||
callback = function() {
|
||||
$.post(del.following.url, {format: "json", id: data.id}, function(json){
|
||||
scheduleRefetchEvents(json);
|
||||
});
|
||||
};
|
||||
del.following.callback = callback;
|
||||
|
||||
}
|
||||
//single show
|
||||
else {
|
||||
callback = function() {
|
||||
$.post(oItems.del.url, {format: "json", id: data.id}, function(json){
|
||||
scheduleRefetchEvents(json);
|
||||
});
|
||||
};
|
||||
oItems.del.callback = callback;
|
||||
}
|
||||
}
|
||||
|
||||
items = oItems;
|
||||
}
|
||||
|
||||
$.ajax({
|
||||
url: "/schedule/make-context-menu",
|
||||
type: "GET",
|
||||
data: {id : data.id, format: "json"},
|
||||
dataType: "json",
|
||||
async: false,
|
||||
success: function(json){
|
||||
processMenuItems(json.items);
|
||||
}
|
||||
});
|
||||
|
||||
//define a cancel callback.
|
||||
if (oItems.cancel !== undefined) {
|
||||
|
||||
callback = function() {
|
||||
confirmCancelShow(data.id);
|
||||
};
|
||||
oItems.cancel.callback = callback;
|
||||
}
|
||||
|
||||
//define a delete callback.
|
||||
if (oItems.del !== undefined) {
|
||||
|
||||
//repeating show multiple delete options
|
||||
if (oItems.del.items !== undefined) {
|
||||
var del = oItems.del.items;
|
||||
|
||||
//delete a single instance
|
||||
callback = function() {
|
||||
$.post(del.single.url, {format: "json", id: data.id}, function(json){
|
||||
scheduleRefetchEvents(json);
|
||||
});
|
||||
};
|
||||
del.single.callback = callback;
|
||||
|
||||
//delete this instance and all following instances.
|
||||
callback = function() {
|
||||
$.post(del.following.url, {format: "json", id: data.id}, function(json){
|
||||
scheduleRefetchEvents(json);
|
||||
});
|
||||
};
|
||||
del.following.callback = callback;
|
||||
|
||||
}
|
||||
//single show
|
||||
else {
|
||||
callback = function() {
|
||||
$.post(oItems.del.url, {format: "json", id: data.id}, function(json){
|
||||
scheduleRefetchEvents(json);
|
||||
});
|
||||
};
|
||||
oItems.del.callback = callback;
|
||||
}
|
||||
}
|
||||
|
||||
items = oItems;
|
||||
}
|
||||
|
||||
$.ajax({
|
||||
url: "/schedule/make-context-menu",
|
||||
type: "GET",
|
||||
data: {id : data.id, format: "json"},
|
||||
dataType: "json",
|
||||
async: false,
|
||||
success: function(json){
|
||||
processMenuItems(json.items);
|
||||
}
|
||||
});
|
||||
|
||||
return {
|
||||
items: items,
|
||||
determinePosition : function($menu, x, y) {
|
||||
$menu.css('display', 'block')
|
||||
.position({ my: "left top", at: "right top", of: this, offset: "-20 10", collision: "fit"})
|
||||
.css('display', 'none');
|
||||
$menu.css('display', 'block')
|
||||
.position({ my: "left top", at: "right top", of: this, offset: "-20 10", collision: "fit"})
|
||||
.css('display', 'none');
|
||||
}
|
||||
};
|
||||
}
|
||||
|
|
|
@ -8,7 +8,10 @@ var AIRTIME = (function(AIRTIME){
|
|||
$sbTable,
|
||||
$toolbar,
|
||||
$ul,
|
||||
$lib;
|
||||
$lib,
|
||||
cursors = [],
|
||||
cursorIds = [];
|
||||
showInstanceIds = [];
|
||||
|
||||
if (AIRTIME.showbuilder === undefined) {
|
||||
AIRTIME.showbuilder = {};
|
||||
|
@ -127,7 +130,7 @@ var AIRTIME = (function(AIRTIME){
|
|||
};
|
||||
|
||||
mod.selectCursor = function($el) {
|
||||
|
||||
|
||||
$el.addClass(CURSOR_SELECTED_CLASS);
|
||||
mod.checkToolBarIcons();
|
||||
};
|
||||
|
@ -208,11 +211,23 @@ var AIRTIME = (function(AIRTIME){
|
|||
|
||||
mod.fnItemCallback = function(json) {
|
||||
checkError(json);
|
||||
|
||||
cursorIds = [];
|
||||
/* We need to keep record of which show the cursor belongs to
|
||||
* in the case where more than one show is displayed in the show builder
|
||||
* because header and footer rows have the same id
|
||||
*/
|
||||
showInstanceIds = [];
|
||||
cursors = $(".cursor-selected-row");
|
||||
for (i = 0; i < cursors.length; i++) {
|
||||
cursorIds.push(($(cursors.get(i)).attr("id")));
|
||||
showInstanceIds.push(($(cursors.get(i)).attr("si_id")));
|
||||
}
|
||||
oSchedTable.fnDraw();
|
||||
|
||||
mod.enableUI();
|
||||
};
|
||||
|
||||
|
||||
mod.fnAdd = function(aMediaIds, aSchedIds) {
|
||||
|
||||
mod.disableUI();
|
||||
|
@ -236,11 +251,14 @@ var AIRTIME = (function(AIRTIME){
|
|||
mod.fnRemove = function(aItems) {
|
||||
|
||||
mod.disableUI();
|
||||
|
||||
$.post( "/showbuilder/schedule-remove",
|
||||
{"items": aItems, "format": "json"},
|
||||
mod.fnItemCallback
|
||||
);
|
||||
if (confirm("Delete selected item(s)?")) {
|
||||
$.post( "/showbuilder/schedule-remove",
|
||||
{"items": aItems, "format": "json"},
|
||||
mod.fnItemCallback
|
||||
);
|
||||
}else{
|
||||
mod.enableUI();
|
||||
}
|
||||
};
|
||||
|
||||
mod.fnRemoveSelectedItems = function() {
|
||||
|
@ -401,7 +419,6 @@ var AIRTIME = (function(AIRTIME){
|
|||
headerIcon;
|
||||
|
||||
fnPrepareSeparatorRow = function fnPrepareSeparatorRow(sRowContent, sClass, iNodeIndex) {
|
||||
|
||||
$node = $(nRow.children[iNodeIndex]);
|
||||
$node.html(sRowContent);
|
||||
$node.attr('colspan',100);
|
||||
|
@ -413,7 +430,7 @@ var AIRTIME = (function(AIRTIME){
|
|||
|
||||
$nRow.addClass(sClass);
|
||||
};
|
||||
|
||||
|
||||
if (aData.header === true) {
|
||||
//remove the column classes from all tds.
|
||||
$nRow.find('td').removeClass();
|
||||
|
@ -572,11 +589,13 @@ var AIRTIME = (function(AIRTIME){
|
|||
$nRow.addClass("sb-future");
|
||||
}
|
||||
|
||||
if (aData.allowed !== true) {
|
||||
if (aData.allowed !== true || aData.header === true) {
|
||||
$nRow.addClass("sb-not-allowed");
|
||||
}
|
||||
else {
|
||||
$nRow.addClass("sb-allowed");
|
||||
$nRow.attr("id", aData.id);
|
||||
$nRow.attr("si_id", aData.instance);
|
||||
}
|
||||
|
||||
//status used to colour tracks.
|
||||
|
@ -590,7 +609,7 @@ var AIRTIME = (function(AIRTIME){
|
|||
if (aData.currentShow === true) {
|
||||
$nRow.addClass("sb-current-show");
|
||||
}
|
||||
|
||||
|
||||
//call the context menu so we can prevent the event from propagating.
|
||||
$nRow.find('td:gt(1)').click(function(e){
|
||||
|
||||
|
@ -615,6 +634,7 @@ var AIRTIME = (function(AIRTIME){
|
|||
$cursorRows,
|
||||
$table = $(this),
|
||||
$parent = $table.parent(),
|
||||
$tr,
|
||||
//use this array to cache DOM heights then we can detach the table to manipulate it to increase speed.
|
||||
heights = [];
|
||||
|
||||
|
@ -653,6 +673,13 @@ var AIRTIME = (function(AIRTIME){
|
|||
});
|
||||
|
||||
$td.append(markerDiv).wrapInner(wrapperDiv);
|
||||
|
||||
}
|
||||
|
||||
//re-highlight selected cursors before draw took place
|
||||
for (i = 0; i < cursorIds.length; i++) {
|
||||
$tr = $table.find("tr[id="+cursorIds[i]+"][si_id="+showInstanceIds[i]+"]");
|
||||
mod.selectCursor($tr);
|
||||
}
|
||||
|
||||
//if there is only 1 cursor on the page highlight it by default.
|
||||
|
@ -678,8 +705,14 @@ var AIRTIME = (function(AIRTIME){
|
|||
|
||||
if (temp.length > 0) {
|
||||
aData = temp.data("aData");
|
||||
|
||||
mod.timeout = setTimeout(mod.refresh, aData.refresh * 1000); //need refresh in milliseconds
|
||||
// max time interval
|
||||
// setTimeout allows only up to (2^31)-1 millisecs timeout value
|
||||
maxRefreshInterval = Math.pow(2, 31) - 1;
|
||||
refreshInterval = aData.refresh * 1000;
|
||||
if(refreshInterval > maxRefreshInterval){
|
||||
refreshInterval = maxRefreshInterval;
|
||||
}
|
||||
mod.timeout = setTimeout(mod.refresh, refreshInterval); //need refresh in milliseconds
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -890,8 +923,8 @@ var AIRTIME = (function(AIRTIME){
|
|||
|
||||
$ul = $("<ul/>");
|
||||
$ul.append('<li class="ui-state-default sb-button-select" title="Select"><span class="ui-icon ui-icon-document-b"></span></li>')
|
||||
.append('<li class="ui-state-default ui-state-disabled sb-button-trim" title="Delete all overbooked tracks"><span class="ui-icon ui-icon-scissors"></span></li>')
|
||||
.append('<li class="ui-state-default ui-state-disabled sb-button-delete" title="Delete selected scheduled items"><span class="ui-icon ui-icon-trash"></span></li>');
|
||||
.append('<li class="ui-state-default ui-state-disabled sb-button-trim" title="Remove all overbooked tracks"><span class="ui-icon ui-icon-scissors"></span></li>')
|
||||
.append('<li class="ui-state-default ui-state-disabled sb-button-delete" title="Remove selected scheduled items"><span class="ui-icon ui-icon-trash"></span></li>');
|
||||
$toolbar.append($ul);
|
||||
|
||||
$ul = $("<ul/>");
|
||||
|
@ -1065,7 +1098,7 @@ var AIRTIME = (function(AIRTIME){
|
|||
if (oItems.del !== undefined) {
|
||||
|
||||
callback = function() {
|
||||
if (confirm("Delete selected Items?")) {
|
||||
if (confirm("Delete selected item?")) {
|
||||
AIRTIME.showbuilder.fnRemove([{
|
||||
id: data.id,
|
||||
timestamp: data.timestamp,
|
||||
|
|
|
@ -30,7 +30,7 @@ AIRTIME = (function(AIRTIME) {
|
|||
|
||||
oBaseDatePickerSettings = {
|
||||
dateFormat: 'yy-mm-dd',
|
||||
onSelect: function(sDate, oDatePicker) {
|
||||
onClick: function(sDate, oDatePicker) {
|
||||
$(this).datepicker( "setDate", sDate );
|
||||
}
|
||||
};
|
||||
|
@ -83,6 +83,34 @@ AIRTIME = (function(AIRTIME) {
|
|||
oTable.fnDraw();
|
||||
}
|
||||
}
|
||||
|
||||
function showSearchSubmit() {
|
||||
var fn,
|
||||
oRange,
|
||||
op,
|
||||
oTable = $('#show_builder_table').dataTable();
|
||||
|
||||
//reset timestamp value since input values could have changed.
|
||||
AIRTIME.showbuilder.resetTimestamp();
|
||||
|
||||
oRange = AIRTIME.utilities.fnGetScheduleRange(dateStartId, timeStartId, dateEndId, timeEndId);
|
||||
|
||||
fn = oTable.fnSettings().fnServerData;
|
||||
fn.start = oRange.start;
|
||||
fn.end = oRange.end;
|
||||
|
||||
op = $("div.sb-advanced-options");
|
||||
if (op.is(":visible")) {
|
||||
|
||||
if (fn.ops === undefined) {
|
||||
fn.ops = {};
|
||||
}
|
||||
fn.ops.showFilter = op.find("#sb_show_filter").val();
|
||||
fn.ops.myShows = op.find("#sb_my_shows").is(":checked") ? 1 : 0;
|
||||
}
|
||||
|
||||
oTable.fnDraw();
|
||||
}
|
||||
|
||||
mod.onReady = function() {
|
||||
//define module vars.
|
||||
|
@ -118,33 +146,7 @@ AIRTIME = (function(AIRTIME) {
|
|||
|
||||
$builder.find('.dataTables_scrolling').css("max-height", widgetHeight - 95);
|
||||
|
||||
$builder.on("click", "#sb_submit", function(ev){
|
||||
var fn,
|
||||
oRange,
|
||||
op,
|
||||
oTable = $('#show_builder_table').dataTable();
|
||||
|
||||
//reset timestamp value since input values could have changed.
|
||||
AIRTIME.showbuilder.resetTimestamp();
|
||||
|
||||
oRange = AIRTIME.utilities.fnGetScheduleRange(dateStartId, timeStartId, dateEndId, timeEndId);
|
||||
|
||||
fn = oTable.fnSettings().fnServerData;
|
||||
fn.start = oRange.start;
|
||||
fn.end = oRange.end;
|
||||
|
||||
op = $("div.sb-advanced-options");
|
||||
if (op.is(":visible")) {
|
||||
|
||||
if (fn.ops === undefined) {
|
||||
fn.ops = {};
|
||||
}
|
||||
fn.ops.showFilter = op.find("#sb_show_filter").val();
|
||||
fn.ops.myShows = op.find("#sb_my_shows").is(":checked") ? 1 : 0;
|
||||
}
|
||||
|
||||
oTable.fnDraw();
|
||||
});
|
||||
$builder.on("click", "#sb_submit", showSearchSubmit);
|
||||
|
||||
$builder.on("click","#sb_edit", function (ev){
|
||||
var schedTable = $("#show_builder_table").dataTable();
|
||||
|
@ -220,7 +222,9 @@ AIRTIME = (function(AIRTIME) {
|
|||
|
||||
if ($(this).is(':checked')) {
|
||||
$(ev.delegateTarget).find('#sb_show_filter').val(0);
|
||||
}
|
||||
}
|
||||
|
||||
showSearchSubmit();
|
||||
});
|
||||
|
||||
//set select event for choosing a show.
|
||||
|
@ -229,6 +233,9 @@ AIRTIME = (function(AIRTIME) {
|
|||
if ($(this).val() !== 0) {
|
||||
$(ev.delegateTarget).find('#sb_my_shows').attr("checked", false);
|
||||
}
|
||||
|
||||
showSearchSubmit();
|
||||
|
||||
});
|
||||
|
||||
function checkScheduleUpdates(){
|
||||
|
@ -277,4 +284,4 @@ AIRTIME = (function(AIRTIME) {
|
|||
} (AIRTIME || {}));
|
||||
|
||||
$(document).ready(AIRTIME.builderMain.onReady);
|
||||
$(window).resize(AIRTIME.builderMain.onResize);
|
||||
$(window).resize(AIRTIME.builderMain.onResize);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue