CC-3820 : when using reupload to soundcloud on calendar, progress icon never goes away unless you refresh the page

This commit is contained in:
Naomi Aro 2012-05-14 16:30:18 +02:00
parent 803c44611a
commit 71c279a2f9
2 changed files with 51 additions and 18 deletions

View file

@ -467,7 +467,7 @@ var AIRTIME = (function(AIRTIME) {
checkImportStatus(); checkImportStatus();
setInterval(checkImportStatus, 5000); setInterval(checkImportStatus, 5000);
setInterval(checkSCUploadStatus, 5000); setInterval(checkLibrarySCUploadStatus, 5000);
addQtipToSCIcons(); addQtipToSCIcons();
@ -653,28 +653,32 @@ function addProgressIcon(id) {
} }
} }
function checkSCUploadStatus(){ function checkLibrarySCUploadStatus(){
var url = '/Library/get-upload-to-soundcloud-status'; var url = '/Library/get-upload-to-soundcloud-status',
span,
id;
$("span[class*=progress]").each(function(){ function checkSCUploadStatusCallback(json) {
var span, id;
span = $(this);
id = span.parent().parent().data("aData").id;
$.post(url, {format: "json", id: id, type:"file"}, function(json){
if (json.sc_id > 0) { if (json.sc_id > 0) {
span.removeClass("progress") span.removeClass("progress").addClass("soundcloud");
.addClass("soundcloud");
} }
else if (json.sc_id == "-3") { else if (json.sc_id == "-3") {
span.removeClass("progress") span.removeClass("progress").addClass("sc-error");
.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);
} }
function addQtipToSCIcons(){ function addQtipToSCIcons(){

View file

@ -79,6 +79,34 @@ function uploadToSoundCloud(show_instance_id){
} }
} }
function checkCalendarSCUploadStatus(){
var url = '/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("div.fc-event").data("event").id;
$.post(url, {format: "json", id: id, type:"show"}, checkSCUploadStatusCallback);
}
$("#schedule_calendar span.progress").each(checkSCUploadStatusRequest);
}
function findViewportDimensions() { function findViewportDimensions() {
var viewportwidth, var viewportwidth,
viewportheight; viewportheight;
@ -254,6 +282,7 @@ $(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){}}); , error:function(jqXHR, textStatus, errorThrown){}});
setInterval(checkCalendarSCUploadStatus, 5000);
$.contextMenu({ $.contextMenu({
selector: 'div.fc-event', selector: 'div.fc-event',