CC-2591: Allow upload of any audio clip to Soundcloud

- done
- need more styling
- note there were changes in style.css
This commit is contained in:
James 2011-09-22 11:47:24 -04:00
parent 8679194c33
commit 73dc4b851d
28 changed files with 833 additions and 238 deletions

View file

@ -111,35 +111,40 @@ function dtRowCallback( nRow, aData, iDisplayIndex, iDisplayIndexFull ) {
// insert id on lenth field
$('td:eq(4)', nRow).attr("id", "length");
$('td:eq(5) img', nRow).qtip({
content: {
url: '/Library/get-file-meta-data',
type: 'post',
data: ({format: "html", id : id, type: type}),
title: {
text: aData[1] + ' MetaData',
button: 'Close' // Show a close link in the title
}
},
position: {
adjust: {
screen: true // Keep the tooltip on-screen at all times
}
},
style: {
border: {
width: 0,
radius: 4
$('td:gt(0)', nRow).qtip({
content: {
text: "Loading...",
title: {
text: aData[1] + " MetaData"
},
ajax: {
url: "/Library/get-file-meta-data",
type: "post",
data: ({format: "html", id : id, type: type}),
success: function(data, status){
this.set('content.text', data)
}
}
},
name: 'dark', // Use the default light style
width: 570 // Set the tooltip width
}
});
position: {
adjust: {
resize: true,
method: "flip flip"
},
at: "right center",
my: "left top",
viewport: $(window)
},
style: {
width: 570,
classes: "ui-tooltip-dark"
},
show: {
delay: 700
}
}
);
return nRow;
}
@ -148,6 +153,105 @@ function dtDrawCallback() {
addLibraryItemEvents();
}
function redrawDataTable() {
var dt;
dt = $('#library_display').dataTable();
dt.fnDraw(false);
}
function checkSCUploadStatus(){
var url = '/Library/get-upload-to-sc-status/format/json';
$("span[class*=progress]").each(function(){
var id = $(this).attr("id");
$.post(url, {format: "json", id: id, type:"file"}, function(json){
if(json.sc_id > 0){
$("span[id="+id+"]").removeClass("progress").addClass("soundcloud");
}else if(json.sc_id == "-3"){
$("span[id="+id+"]").removeClass("progress").addClass("sc-error");
}
});
})
}
function addQtipToSCIcons(){
$(".progress, .soundcloud, .sc-error").live('mouseover', function(){
var id = $(this).attr("id");
if($(this).hasClass("progress")){
$(this).qtip({
content: {
text: "Uploading in the progress..."
},
position:{
adjust: {
resize: true,
method: "flip flip"
},
at: "right center",
my: "left top",
viewport: $(window)
},
show: {
ready: true // Needed to make it show on first mouseover event
}
})
}else if($(this).hasClass("soundcloud")){
$(this).qtip({
content: {
text: "Retreiving data from the server...",
ajax: {
url: "/Library/get-upload-to-sc-status",
type: "post",
data: ({format: "json", id : id, type: "file"}),
success: function(json, status){
this.set('content.text', "The soundcloud id for this file is: "+json.sc_id)
}
}
},
position:{
adjust: {
resize: true,
method: "flip flip"
},
at: "right center",
my: "left top",
viewport: $(window)
},
show: {
ready: true // Needed to make it show on first mouseover event
}
})
}else if($(this).hasClass("sc-error")){
$(this).qtip({
content: {
text: "Retreiving data from the server...",
ajax: {
url: "/Library/get-upload-to-sc-status",
type: "post",
data: ({format: "json", id : id, type: "file"}),
success: function(json, status){
this.set('content.text', "There was error while uploading to soundcloud.<br>"+"Error code: "+json.error_code+
"<br>"+"Error msg: "+json.error_msg+"<br>")
}
}
},
position:{
adjust: {
resize: true,
method: "flip flip"
},
at: "right center",
my: "left top",
viewport: $(window)
},
show: {
ready: true // Needed to make it show on first mouseover event
}
})
}
});
}
$(document).ready(function() {
$('.tabs').tabs();
@ -187,4 +291,7 @@ $(document).ready(function() {
checkImportStatus()
setInterval( "checkImportStatus()", 5000 );
setInterval( "checkSCUploadStatus()", 5000 );
addQtipToSCIcons()
});

View file

@ -221,34 +221,53 @@ function eventRender(event, element, view) {
}
//add the record/rebroadcast icons if needed.
//record icon (only if not on soundcloud, will always be true for future events)
if((view.name === 'agendaDay' || view.name === 'agendaWeek') && event.record === 1 && event.soundcloud_id === -1) {
$(element).find(".fc-event-time").before('<span class="small-icon recording"></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 class="small-icon recording"></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 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 class="small-icon rebroadcast"></span>');
$(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 !== -1 && event.record === 1) {
if((view.name === 'agendaDay' || view.name === 'agendaWeek') && event.soundcloud_id > 0 && event.record === 1) {
$(element).find(".fc-event-time").before('<span class="small-icon soundcloud"></span>');
$(element).find(".fc-event-time").before('<span id="'+event.id+'" class="small-icon soundcloud"></span>');
}
if(view.name === 'month' && event.soundcloud_id !== -1 && event.record === 1) {
if(view.name === 'month' && event.soundcloud_id > 0 && event.record === 1) {
$(element).find(".fc-event-title").after('<span class="small-icon soundcloud"></span>');
$(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>');
}
}
function eventAfterRender( event, element, view ) {
@ -258,6 +277,9 @@ function eventAfterRender( event, element, view ) {
[{get:"/Schedule/make-context-menu/format/json/id/#id#"}],
{id: event.id},
{xposition: "mouse", yposition: "mouse"});
$(element).find(".small-icon").live('mouseover',function(){
addQtipToSCIcons($(this));
})
}
function eventDrop(event, dayDelta, minuteDelta, allDay, revertFunc, jsEvent, ui, view) {
@ -306,3 +328,97 @@ function getFullCalendarEvents(start, end, callback) {
callback(json.events);
});
}
function checkSCUploadStatus(){
var url = '/Library/get-upload-to-sc-status/format/json';
$("span[class*=progress]").each(function(){
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");
}else if(json.sc_id == "-3"){
$("span[id="+id+"]").removeClass("progress").addClass("sc-error");
}
});
})
}
function addQtipToSCIcons(ele){
var id = $(ele).attr("id");
if($(ele).hasClass("progress")){
$(ele).qtip({
content: {
text: "Uploading in the progress..."
},
position:{
adjust: {
resize: true,
method: "flip flip"
},
at: "right center",
my: "left top",
viewport: $(window)
},
show: {
ready: true // Needed to make it show on first mouseover event
}
})
}else if($(ele).hasClass("soundcloud")){
$(ele).qtip({
content: {
text: "Retreiving data from the server...",
ajax: {
url: "/Library/get-upload-to-sc-status",
type: "post",
data: ({format: "json", id : id, type: "file"}),
success: function(json, status){
this.set('content.text', "The soundcloud id for this file is: "+json.sc_id)
}
}
},
position:{
adjust: {
resize: true,
method: "flip flip"
},
at: "right center",
my: "left top",
viewport: $(window)
},
show: {
ready: true // Needed to make it show on first mouseover event
}
})
}else if($(ele).hasClass("sc-error")){
$(ele).qtip({
content: {
text: "Retreiving data from the server...",
ajax: {
url: "/Library/get-upload-to-sc-status",
type: "post",
data: ({format: "json", id : id, type: "show"}),
success: function(json, status){
this.set('content.text', "There was error while uploading to soundcloud.<br>"+"Error code: "+json.error_code+
"<br>"+"Error msg: "+json.error_msg+"<br>")
}
}
},
position:{
adjust: {
resize: true,
method: "flip flip"
},
at: "right center",
my: "left top",
viewport: $(window)
},
show: {
ready: true // Needed to make it show on first mouseover event
}
})
}
}
$(document).ready(function(){
setInterval( "checkSCUploadStatus()", 5000 );
})

View file

@ -180,20 +180,19 @@ function uploadToSoundCloud(show_instance_id){
var url = "/Schedule/upload-to-sound-cloud";
var span = $(window.triggerElement).find(".recording");
span.removeClass("recording")
if(span.length == 0){
span = $(window.triggerElement).find(".soundcloud");
span.removeClass("soundcloud")
.addClass("progress")
}else{
span.removeClass("recording")
.addClass("progress");
}
$.post(url,
{id: show_instance_id, format: "json"},
function(data){
if(data.error) {
span.removeClass("progress")
.addClass("recording");
alert(data.error);
return;
}
function(){
scheduleRefetchEvents();
});

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long