CC-6046, CC-6045, CC-6047 - New SoundCloud implementation
This commit is contained in:
parent
51a3f19f43
commit
b0b6e037ac
62 changed files with 4009 additions and 2491 deletions
|
@ -612,17 +612,6 @@ var AIRTIME = (function(AIRTIME) {
|
|||
},
|
||||
"fnRowCallback": AIRTIME.library.fnRowCallback,
|
||||
"fnCreatedRow": function( nRow, aData, iDataIndex ) {
|
||||
//add soundcloud icon
|
||||
if (aData.soundcloud_id !== undefined) {
|
||||
if (aData.soundcloud_id === "-2") {
|
||||
$(nRow).find("td.library_title").append('<span class="small-icon progress"/>');
|
||||
} else if (aData.soundcloud_id === "-3") {
|
||||
$(nRow).find("td.library_title").append('<span class="small-icon sc-error"/>');
|
||||
} else if (aData.soundcloud_id !== null) {
|
||||
$(nRow).find("td.library_title").append('<span class="small-icon soundcloud"/>');
|
||||
}
|
||||
}
|
||||
|
||||
// add checkbox
|
||||
$(nRow).find('td.library_checkbox').html("<input type='checkbox' name='cb_"+aData.id+"'>");
|
||||
|
||||
|
@ -892,10 +881,6 @@ var AIRTIME = (function(AIRTIME) {
|
|||
}
|
||||
});
|
||||
|
||||
checkLibrarySCUploadStatus();
|
||||
|
||||
addQtipToSCIcons();
|
||||
|
||||
// begin context menu initialization.
|
||||
$.contextMenu({
|
||||
selector: '#library_display td:not(.library_checkbox)',
|
||||
|
@ -1026,21 +1011,19 @@ var AIRTIME = (function(AIRTIME) {
|
|||
// add callbacks for Soundcloud menu items.
|
||||
if (oItems.soundcloud !== undefined) {
|
||||
var soundcloud = oItems.soundcloud.items;
|
||||
|
||||
|
||||
// define an upload to soundcloud callback.
|
||||
if (soundcloud.upload !== undefined) {
|
||||
|
||||
|
||||
callback = function() {
|
||||
$.post(soundcloud.upload.url, function(){
|
||||
addProgressIcon(data.id);
|
||||
});
|
||||
$.post(soundcloud.upload.url, function(){});
|
||||
};
|
||||
soundcloud.upload.callback = callback;
|
||||
}
|
||||
|
||||
|
||||
// define a view on soundcloud callback
|
||||
if (soundcloud.view !== undefined) {
|
||||
|
||||
|
||||
callback = function() {
|
||||
window.open(soundcloud.view.url);
|
||||
};
|
||||
|
@ -1140,122 +1123,6 @@ function addProgressIcon(id) {
|
|||
}
|
||||
}
|
||||
|
||||
function checkLibrarySCUploadStatus(){
|
||||
var url = baseUrl+'Library/get-upload-to-soundcloud-status',
|
||||
span,
|
||||
id;
|
||||
|
||||
function checkSCUploadStatusCallback(json) {
|
||||
|
||||
if (json.sc_id > 0) {
|
||||
span.removeClass("progress").addClass("soundcloud");
|
||||
|
||||
}
|
||||
else if (json.sc_id == "-3") {
|
||||
span.removeClass("progress").addClass("sc-error");
|
||||
}
|
||||
}
|
||||
|
||||
function checkSCUploadStatusRequest() {
|
||||
|
||||
span = $(this);
|
||||
id = span.parents("tr").data("aData").id;
|
||||
|
||||
$.post(url, {format: "json", id: id, type:"file"}, checkSCUploadStatusCallback);
|
||||
}
|
||||
|
||||
$("#library_display span.progress").each(checkSCUploadStatusRequest);
|
||||
setTimeout(checkLibrarySCUploadStatus, 5000);
|
||||
}
|
||||
|
||||
function addQtipToSCIcons() {
|
||||
$("#content")
|
||||
.on('mouseover', ".progress, .soundcloud, .sc-error", function() {
|
||||
|
||||
var aData = $(this).parents("tr").data("aData"),
|
||||
id = aData.id,
|
||||
sc_id = aData.soundcloud_id;
|
||||
|
||||
if ($(this).hasClass("progress")){
|
||||
$(this).qtip({
|
||||
content: {
|
||||
text: $.i18n._("Uploading in progress...")
|
||||
},
|
||||
position:{
|
||||
adjust: {
|
||||
resize: true,
|
||||
method: "flip flip"
|
||||
},
|
||||
at: "right center",
|
||||
my: "left top",
|
||||
viewport: $(window)
|
||||
},
|
||||
style: {
|
||||
classes: "ui-tooltip-dark file-md-long"
|
||||
},
|
||||
show: {
|
||||
ready: true // Needed to make it show on first mouseover event
|
||||
}
|
||||
});
|
||||
}
|
||||
else if ($(this).hasClass("soundcloud")){
|
||||
|
||||
$(this).qtip({
|
||||
content: {
|
||||
text: $.i18n._("The soundcloud id for this file is: ") + sc_id
|
||||
},
|
||||
position:{
|
||||
adjust: {
|
||||
resize: true,
|
||||
method: "flip flip"
|
||||
},
|
||||
at: "right center",
|
||||
my: "left top",
|
||||
viewport: $(window)
|
||||
},
|
||||
style: {
|
||||
classes: "ui-tooltip-dark file-md-long"
|
||||
},
|
||||
show: {
|
||||
ready: true // Needed to make it show on first mouseover event
|
||||
}
|
||||
});
|
||||
}
|
||||
else if ($(this).hasClass("sc-error")) {
|
||||
$(this).qtip({
|
||||
content: {
|
||||
text: $.i18n._("Retreiving data from the server..."),
|
||||
ajax: {
|
||||
url: baseUrl+"Library/get-upload-to-soundcloud-status",
|
||||
type: "post",
|
||||
data: ({format: "json", id : id, type: "file"}),
|
||||
success: function(json, status){
|
||||
this.set('content.text', $.i18n._("There was an error while uploading to soundcloud.")+"<br>"+
|
||||
$.i18n._("Error code: ")+json.error_code+
|
||||
"<br>"+$.i18n._("Error msg: ")+json.error_msg+"<br>");
|
||||
}
|
||||
}
|
||||
},
|
||||
position:{
|
||||
adjust: {
|
||||
resize: true,
|
||||
method: "flip flip"
|
||||
},
|
||||
at: "right center",
|
||||
my: "left top",
|
||||
viewport: $(window)
|
||||
},
|
||||
style: {
|
||||
classes: "ui-tooltip-dark file-md-long"
|
||||
},
|
||||
show: {
|
||||
ready: true // Needed to make it show on first mouseover event
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/*
|
||||
* This function is called from dataTables.columnFilter.js
|
||||
*/
|
||||
|
|
|
@ -82,6 +82,20 @@ function setTuneInSettingsReadonly() {
|
|||
}
|
||||
}
|
||||
|
||||
function setSoundCloudSettingsListener() {
|
||||
var connect = $("#SoundCloudConnect"),
|
||||
disconnect = $("#SoundCloudDisconnect");
|
||||
connect.click(function(e){
|
||||
e.preventDefault();
|
||||
window.location.replace(baseUrl + "soundcloud/authorize");
|
||||
});
|
||||
|
||||
disconnect.click(function(e){
|
||||
e.preventDefault();
|
||||
window.location.replace(baseUrl + "soundcloud/deauthorize");
|
||||
});
|
||||
}
|
||||
|
||||
/*
|
||||
* Enable/disable mail server authentication fields
|
||||
*/
|
||||
|
@ -118,21 +132,21 @@ function setCollapsibleWidgetJsCode() {
|
|||
$('#thirdPartyApi-element input').click(x);
|
||||
}
|
||||
|
||||
function setSoundCloudCheckBoxListener() {
|
||||
var subCheckBox= $("#UseSoundCloud,#SoundCloudDownloadbleOption");
|
||||
var mainCheckBox= $("#UploadToSoundcloudOption");
|
||||
subCheckBox.change(function(e){
|
||||
if (subCheckBox.is(':checked')) {
|
||||
mainCheckBox.attr("checked", true);
|
||||
}
|
||||
});
|
||||
|
||||
mainCheckBox.change(function(e){
|
||||
if (!mainCheckBox.is(':checked')) {
|
||||
$("#UseSoundCloud,#SoundCloudDownloadbleOption").attr("checked", false);
|
||||
}
|
||||
});
|
||||
}
|
||||
//function setSoundCloudCheckBoxListener() {
|
||||
// var subCheckBox= $("#UseSoundCloud,#SoundCloudDownloadbleOption");
|
||||
// var mainCheckBox= $("#UploadToSoundcloudOption");
|
||||
// subCheckBox.change(function(e){
|
||||
// if (subCheckBox.is(':checked')) {
|
||||
// mainCheckBox.attr("checked", true);
|
||||
// }
|
||||
// });
|
||||
//
|
||||
// mainCheckBox.change(function(e){
|
||||
// if (!mainCheckBox.is(':checked')) {
|
||||
// $("#UseSoundCloud,#SoundCloudDownloadbleOption").attr("checked", false);
|
||||
// }
|
||||
// });
|
||||
//}
|
||||
|
||||
function removeLogo() {
|
||||
$.post(baseUrl+'Preference/remove-logo', function(json){});
|
||||
|
@ -176,7 +190,7 @@ $(document).ready(function() {
|
|||
|
||||
showErrorSections();
|
||||
|
||||
setSoundCloudCheckBoxListener();
|
||||
//setSoundCloudCheckBoxListener();
|
||||
setMailServerInputReadonly();
|
||||
setSystemFromEmailReadonly();
|
||||
setConfigureMailServerListener();
|
||||
|
@ -184,4 +198,5 @@ $(document).ready(function() {
|
|||
setCollapsibleWidgetJsCode();
|
||||
setTuneInSettingsReadonly();
|
||||
setTuneInSettingsListener();
|
||||
setSoundCloudSettingsListener();
|
||||
});
|
||||
|
|
|
@ -196,29 +196,29 @@ function eventRender(event, element, view) {
|
|||
}
|
||||
|
||||
//add the record/rebroadcast/soundcloud icons if needed
|
||||
if (event.record === 1) {
|
||||
if (view.name === 'agendaDay' || view.name === 'agendaWeek') {
|
||||
if (event.soundcloud_id === -1) {
|
||||
$(element).find(".fc-event-time").before('<span class="small-icon recording"></span>');
|
||||
} else if ( event.soundcloud_id > 0) {
|
||||
$(element).find(".fc-event-time").before('<span class="small-icon recording"></span><span class="small-icon soundcloud"></span>');
|
||||
} else if (event.soundcloud_id === -2) {
|
||||
$(element).find(".fc-event-time").before('<span class="small-icon recording"></span><span class="small-icon progress"></span>');
|
||||
} else if (event.soundcloud_id === -3) {
|
||||
$(element).find(".fc-event-time").before('<span class="small-icon recording"></span><span class="small-icon sc-error"></span>');
|
||||
}
|
||||
} else if (view.name === 'month') {
|
||||
if(event.soundcloud_id === -1) {
|
||||
$(element).find(".fc-event-title").after('<span class="small-icon recording"></span>');
|
||||
} else if (event.soundcloud_id > 0) {
|
||||
$(element).find(".fc-event-title").after('<span class="small-icon recording"></span><span class="small-icon soundcloud"></span>');
|
||||
} else if (event.soundcloud_id === -2) {
|
||||
$(element).find(".fc-event-title").after('<span class="small-icon recording"></span><span class="small-icon progress"></span>');
|
||||
} else if (event.soundcloud_id === -3) {
|
||||
$(element).find(".fc-event-title").after('<span class="small-icon recording"></span><span class="small-icon sc-error"></span>');
|
||||
}
|
||||
}
|
||||
}
|
||||
//if (event.record === 1) {
|
||||
// if (view.name === 'agendaDay' || view.name === 'agendaWeek') {
|
||||
// if (event.soundcloud_id === -1) {
|
||||
// $(element).find(".fc-event-time").before('<span class="small-icon recording"></span>');
|
||||
// } else if ( event.soundcloud_id > 0) {
|
||||
// $(element).find(".fc-event-time").before('<span class="small-icon recording"></span><span class="small-icon soundcloud"></span>');
|
||||
// } else if (event.soundcloud_id === -2) {
|
||||
// $(element).find(".fc-event-time").before('<span class="small-icon recording"></span><span class="small-icon progress"></span>');
|
||||
// } else if (event.soundcloud_id === -3) {
|
||||
// $(element).find(".fc-event-time").before('<span class="small-icon recording"></span><span class="small-icon sc-error"></span>');
|
||||
// }
|
||||
// } else if (view.name === 'month') {
|
||||
// if(event.soundcloud_id === -1) {
|
||||
// $(element).find(".fc-event-title").after('<span class="small-icon recording"></span>');
|
||||
// } else if (event.soundcloud_id > 0) {
|
||||
// $(element).find(".fc-event-title").after('<span class="small-icon recording"></span><span class="small-icon soundcloud"></span>');
|
||||
// } else if (event.soundcloud_id === -2) {
|
||||
// $(element).find(".fc-event-title").after('<span class="small-icon recording"></span><span class="small-icon progress"></span>');
|
||||
// } else if (event.soundcloud_id === -3) {
|
||||
// $(element).find(".fc-event-title").after('<span class="small-icon recording"></span><span class="small-icon sc-error"></span>');
|
||||
// }
|
||||
// }
|
||||
//}
|
||||
|
||||
if (event.record === 0 && event.rebroadcast === 0) {
|
||||
if (view.name === 'agendaDay' || view.name === 'agendaWeek') {
|
||||
|
|
|
@ -63,24 +63,24 @@ function confirmCancelRecordedShow(show_instance_id){
|
|||
}
|
||||
}
|
||||
|
||||
function uploadToSoundCloud(show_instance_id, el){
|
||||
|
||||
var url = baseUrl+"Schedule/upload-to-sound-cloud",
|
||||
$el = $(el),
|
||||
$span = $el.find(".soundcloud");
|
||||
|
||||
$.post(url, {id: show_instance_id, format: "json"});
|
||||
|
||||
//first upload to soundcloud.
|
||||
if ($span.length === 0){
|
||||
$span = $("<span/>", {"class": "progress"});
|
||||
|
||||
$el.find(".fc-event-title").after($span);
|
||||
}
|
||||
else {
|
||||
$span.removeClass("soundcloud").addClass("progress");
|
||||
}
|
||||
}
|
||||
//function uploadToSoundCloud(show_instance_id, el){
|
||||
//
|
||||
// var url = baseUrl+"Schedule/upload-to-sound-cloud",
|
||||
// $el = $(el),
|
||||
// $span = $el.find(".soundcloud");
|
||||
//
|
||||
// $.post(url, {id: show_instance_id, format: "json"});
|
||||
//
|
||||
// //first upload to soundcloud.
|
||||
// if ($span.length === 0){
|
||||
// $span = $("<span/>", {"class": "progress"});
|
||||
//
|
||||
// $el.find(".fc-event-title").after($span);
|
||||
// }
|
||||
// else {
|
||||
// $span.removeClass("soundcloud").addClass("progress");
|
||||
// }
|
||||
//}
|
||||
|
||||
function checkCalendarSCUploadStatus(){
|
||||
var url = baseUrl+'Library/get-upload-to-soundcloud-status',
|
||||
|
@ -422,22 +422,22 @@ $(document).ready(function() {
|
|||
}
|
||||
|
||||
//define a soundcloud upload callback.
|
||||
if (oItems.soundcloud_upload !== undefined) {
|
||||
|
||||
callback = function() {
|
||||
uploadToSoundCloud(data.id, this.context);
|
||||
};
|
||||
oItems.soundcloud_upload.callback = callback;
|
||||
}
|
||||
//if (oItems.soundcloud_upload !== undefined) {
|
||||
//
|
||||
// callback = function() {
|
||||
// uploadToSoundCloud(data.id, this.context);
|
||||
// };
|
||||
// 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;
|
||||
}
|
||||
//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) {
|
||||
|
|
|
@ -533,7 +533,7 @@ var AIRTIME = (function(AIRTIME){
|
|||
|
||||
if (aData.record === true) {
|
||||
|
||||
headerIcon = (aData.soundcloud_id > 0) ? "soundcloud" : "recording";
|
||||
//headerIcon = (aData.soundcloud_id > 0) ? "soundcloud" : "recording";
|
||||
|
||||
$div = $("<div/>", {
|
||||
"class": "small-icon " + headerIcon
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue