CC-3817 : Should use soundcloud icon for recorded & uploaded shows in timeline for past shows to match calendar

This commit is contained in:
Naomi Aro 2013-05-28 13:11:47 -04:00
parent bf6437cf09
commit 5a2b9796ec
2 changed files with 70 additions and 69 deletions

View file

@ -211,6 +211,7 @@ function viewDisplay( view ) {
function eventRender(event, element, view) { function eventRender(event, element, view) {
$(element).attr("id", "fc-show-instance-"+event.id);
$(element).data("event", event); $(element).data("event", event);
//only put progress bar on shows that aren't being recorded. //only put progress bar on shows that aren't being recorded.
@ -229,34 +230,27 @@ function eventRender(event, element, view) {
$(element).find(".fc-event-content").append(div); $(element).find(".fc-event-content").append(div);
} }
//need to add id for every event to find the current show
if (view.name === 'agendaDay' || view.name === 'agendaWeek') {
$(element).find(".fc-event-time").attr("id", event.id);
} else if (view.name === 'month') {
$(element).find(".fc-event-title").attr("id", event.id);
}
//add the record/rebroadcast/soundcloud icons if needed //add the record/rebroadcast/soundcloud icons if needed
if (event.record === 1) { if (event.record === 1) {
if (view.name === 'agendaDay' || view.name === 'agendaWeek') { if (view.name === 'agendaDay' || view.name === 'agendaWeek') {
if (event.soundcloud_id === -1) { if (event.soundcloud_id === -1) {
$(element).find(".fc-event-time").before('<span id="'+event.id+'" class="small-icon recording"></span>'); $(element).find(".fc-event-time").before('<span class="small-icon recording"></span>');
} else if ( event.soundcloud_id > 0) { } else if ( 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>'); $(element).find(".fc-event-time").before('<span class="small-icon recording"></span><span class="small-icon soundcloud"></span>');
} else if (event.soundcloud_id === -2) { } else if (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>'); $(element).find(".fc-event-time").before('<span class="small-icon recording"></span><span class="small-icon progress"></span>');
} else if (event.soundcloud_id === -3) { } else if (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 class="small-icon recording"></span><span class="small-icon sc-error"></span>');
} }
} else if (view.name === 'month') { } else if (view.name === 'month') {
if(event.soundcloud_id === -1) { if(event.soundcloud_id === -1) {
$(element).find(".fc-event-title").after('<span id="'+event.id+'" class="small-icon recording"></span>'); $(element).find(".fc-event-title").after('<span class="small-icon recording"></span>');
} else if (event.soundcloud_id > 0) { } else if (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>'); $(element).find(".fc-event-title").after('<span class="small-icon recording"></span><span class="small-icon soundcloud"></span>');
} else if (event.soundcloud_id === -2) { } else if (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>'); $(element).find(".fc-event-title").after('<span class="small-icon recording"></span><span class="small-icon progress"></span>');
} else if (event.soundcloud_id === -3) { } else if (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 class="small-icon recording"></span><span class="small-icon sc-error"></span>');
} }
} }
} }
@ -267,27 +261,27 @@ function eventRender(event, element, view) {
if (event.linked) { if (event.linked) {
$(element) $(element)
.find(".fc-event-time") .find(".fc-event-time")
.before('<span id="'+event.id+'" class="small-icon linked"></span><span id="'+event.id+'" class="small-icon show-empty"></span>'); .before('<span class="small-icon linked"></span><span class="small-icon show-empty"></span>');
} else { } else {
$(element) $(element)
.find(".fc-event-time") .find(".fc-event-time")
.before('<span id="'+event.id+'" class="small-icon show-empty"></span>'); .before('<span class="small-icon show-empty"></span>');
} }
} else if (event.show_partial_filled === true) { } else if (event.show_partial_filled === true) {
if (event.linked) { if (event.linked) {
$(element) $(element)
.find(".fc-event-time") .find(".fc-event-time")
.before('<span id="'+event.id+'" class="small-icon linked"></span><span id="'+event.id+'" class="small-icon show-partial-filled"></span>'); .before('<span class="small-icon linked"></span><span class="small-icon show-partial-filled"></span>');
} else { } else {
$(element) $(element)
.find(".fc-event-time") .find(".fc-event-time")
.before('<span id="'+event.id+'" class="small-icon show-partial-filled"></span>'); .before('<span class="small-icon show-partial-filled"></span>');
} }
} else { } else {
if (event.linked) { if (event.linked) {
$(element) $(element)
.find(".fc-event-time") .find(".fc-event-time")
.before('<span id="'+event.id+'" class="small-icon linked"></span>'); .before('<span class="small-icon linked"></span>');
} }
} }
} else if (view.name === 'month') { } else if (view.name === 'month') {
@ -295,27 +289,27 @@ function eventRender(event, element, view) {
if (event.linked) { if (event.linked) {
$(element) $(element)
.find(".fc-event-title") .find(".fc-event-title")
.after('<span id="'+event.id+'" class="small-icon linked"></span><span id="'+event.id+'" title="'+$.i18n._("Show is empty")+'" class="small-icon show-empty"></span>'); .after('<span class="small-icon linked"></span><span title="'+$.i18n._("Show is empty")+'" class="small-icon show-empty"></span>');
} else { } else {
$(element) $(element)
.find(".fc-event-title") .find(".fc-event-title")
.after('<span id="'+event.id+'" title="'+$.i18n._("Show is empty")+'" class="small-icon show-empty"></span>'); .after('<span title="'+$.i18n._("Show is empty")+'" class="small-icon show-empty"></span>');
} }
} else if (event.show_partial_filled === true) { } else if (event.show_partial_filled === true) {
if (event.linked) { if (event.linked) {
$(element) $(element)
.find(".fc-event-title") .find(".fc-event-title")
.after('<span id="'+event.id+'" class="small-icon linked"></span><span id="'+event.id+'" title="'+$.i18n._("Show is partially filled")+'" class="small-icon show-partial-filled"></span>'); .after('<span class="small-icon linked"></span><span title="'+$.i18n._("Show is partially filled")+'" class="small-icon show-partial-filled"></span>');
} else { } else {
$(element) $(element)
.find(".fc-event-title") .find(".fc-event-title")
.after('<span id="'+event.id+'" title="'+$.i18n._("Show is partially filled")+'" class="small-icon show-partial-filled"></span>'); .after('<span title="'+$.i18n._("Show is partially filled")+'" class="small-icon show-partial-filled"></span>');
} }
} else { } else {
if (event.linked) { if (event.linked) {
$(element) $(element)
.find(".fc-event-title") .find(".fc-event-title")
.after('<span id="'+event.id+'" class="small-icon linked"></span>'); .after('<span class="small-icon linked"></span>');
} }
} }
} }
@ -324,9 +318,9 @@ function eventRender(event, element, view) {
//rebroadcast icon //rebroadcast icon
if (event.rebroadcast === 1) { if (event.rebroadcast === 1) {
if (view.name === 'agendaDay' || view.name === 'agendaWeek') { if (view.name === 'agendaDay' || view.name === 'agendaWeek') {
$(element).find(".fc-event-time").before('<span id="'+event.id+'" class="small-icon rebroadcast"></span>'); $(element).find(".fc-event-time").before('<span class="small-icon rebroadcast"></span>');
} else if (view.name === 'month') { } else if (view.name === 'month') {
$(element).find(".fc-event-title").after('<span id="'+event.id+'" class="small-icon rebroadcast"></span>'); $(element).find(".fc-event-title").after('<span class="small-icon rebroadcast"></span>');
} }
} }
} }
@ -334,7 +328,7 @@ function eventRender(event, element, view) {
function eventAfterRender( event, element, view ) { function eventAfterRender( event, element, view ) {
$(element).find(".small-icon").live('mouseover',function(){ $(element).find(".small-icon").live('mouseover',function(){
addQtipsToIcons($(this)); addQtipsToIcons($(this), event.id);
}); });
} }
@ -403,15 +397,25 @@ function getFullCalendarEvents(start, end, callback) {
} }
function checkSCUploadStatus(){ function checkSCUploadStatus(){
var url = baseUrl+'Library/get-upload-to-soundcloud-status/format/json'; var url = baseUrl+'Library/get-upload-to-soundcloud-status/format/json',
id;
$("span[class*=progress]").each(function(){ $("span[class*=progress]").each(function(){
var id = $(this).attr("id"); id = $(this).parents("div.fc-event").data("event").id;
$.post(url, {format: "json", id: id, type:"show"}, function(json){ $.post(url, {format: "json", id: id, type:"show"}, function(json){
if(json.sc_id > 0){ if (json.sc_id > 0){
$("span[id="+id+"]:not(.recording)").removeClass("progress").addClass("soundcloud"); $("#fc-show-instance-"+id)
}else if(json.sc_id == "-3"){ .find(".progress")
$("span[id="+id+"]:not(.recording)").removeClass("progress").addClass("sc-error"); .removeClass("progress")
.addClass("soundcloud");
} }
else if (json.sc_id == "-3"){
$("#fc-show-instance-"+id)
.find(".progress")
.removeClass("progress")
.addClass("sc-error");
}
setTimeout(checkSCUploadStatus, 5000); setTimeout(checkSCUploadStatus, 5000);
}); });
}); });
@ -425,7 +429,7 @@ function getCurrentShow(){
$el; $el;
$.post(url, {format: "json"}, function(json) { $.post(url, {format: "json"}, function(json) {
if (json.current_show === true) { if (json.current_show === true) {
$el = $("div[class*=fc-event-time][id="+json.si_id+"]"); $el = $("div[class*=fc-event-time]");
if (view_name === 'agendaDay' || view_name === 'agendaWeek') { if (view_name === 'agendaDay' || view_name === 'agendaWeek') {
/* Need to remove now-playing class because if user /* Need to remove now-playing class because if user
@ -440,40 +444,40 @@ function getCurrentShow(){
* icon will overwrite it. * icon will overwrite it.
*/ */
$el.siblings().remove("span[class=small-icon recording]"); $el.siblings().remove("span[class=small-icon recording]");
$el.before('<span id="'+json.si_id+'" class="small-icon now-playing"></span><span id="'+json.si_id+'" class="small-icon recording"></span>'); $el.before('<span class="small-icon now-playing"></span><span class="small-icon recording"></span>');
} else if ($el.siblings().hasClass("small-icon rebroadcast")) { } else if ($el.siblings().hasClass("small-icon rebroadcast")) {
/* Without removing rebroadcast icon, the now playing /* Without removing rebroadcast icon, the now playing
* icon will overwrite it. * icon will overwrite it.
*/ */
$el.siblings().remove("span[class=small-icon rebroadcast]"); $el.siblings().remove("span[class=small-icon rebroadcast]");
$el.before('<span id="'+json.si_id+'" class="small-icon now-playing"></span><span id="'+json.si_id+'" class="small-icon rebroadcast"></span>'); $el.before('<span class="small-icon now-playing"></span><span class="small-icon rebroadcast"></span>');
} else { } else {
$el.before('<span id="'+json.si_id+'" class="small-icon now-playing"></span>'); $el.before('<span class="small-icon now-playing"></span>');
} }
} }
} else if (view_name === 'month') { } else if (view_name === 'month') {
if (!$("span[class*=fc-event-title][id="+json.si_id+"]").siblings().hasClass("small-icon now-playing")) { if (!$("span[class*=fc-event-title]").siblings().hasClass("small-icon now-playing")) {
$("span[class*=fc-event-title][id="+json.si_id+"]").after('<span id="'+json.si_id+'" class="small-icon now-playing"></span>'); $("span[class*=fc-event-title]").after('<span class="small-icon now-playing"></span>');
} }
} }
} }
//remove icon from shows that have ended //remove icon from shows that have ended
$(".now-playing").each(function(){ $(".now-playing").each(function(){
id = $(this).attr("id"); id = $(this).parents("div.fc-event").data("event").id;
if (id != json.si_id) { if (id != json.si_id) {
$(this).remove("span[small-icon now-playing]"); $(this).remove("span[small-icon now-playing]");
} }
}); });
setTimeout(getCurrentShow, 5000); setTimeout(getCurrentShow, 5000);
}); });
} }
function addQtipsToIcons(ele, id){
function addQtipsToIcons(ele){ if ($(ele).hasClass("progress")){
var id = $(ele).attr("id");
if($(ele).hasClass("progress")){
$(ele).qtip({ $(ele).qtip({
content: { content: {
text: $.i18n._("Uploading in progress...") text: $.i18n._("Uploading in progress...")

View file

@ -58,24 +58,22 @@ function confirmCancelRecordedShow(show_instance_id){
} }
} }
function uploadToSoundCloud(show_instance_id){ function uploadToSoundCloud(show_instance_id, el){
var url = baseUrl+"Schedule/upload-to-sound-cloud"; var url = baseUrl+"Schedule/upload-to-sound-cloud",
var span = $(window.triggerElement).find(".recording"); $el = $(el),
$span = $el.find(".soundcloud");
$.post(url, $.post(url, {id: show_instance_id, format: "json"});
{id: show_instance_id, format: "json"},
function(json){
scheduleRefetchEvents(json);
});
if(span.length == 0){ //first upload to soundcloud.
span = $(window.triggerElement).find(".soundcloud"); if ($span.length === 0){
span.removeClass("soundcloud") $span = $("<span/>", {"class": "progress"});
.addClass("progress");
}else{ $el.find(".fc-event-title").after($span);
span.removeClass("recording") }
.addClass("progress"); else {
$span.removeClass("soundcloud").addClass("progress");
} }
} }
@ -93,8 +91,6 @@ function checkCalendarSCUploadStatus(){
else if (json.sc_id == "-3") { else if (json.sc_id == "-3") {
span.removeClass("progress").addClass("sc-error"); span.removeClass("progress").addClass("sc-error");
} }
setTimeout(checkCalendarSCUploadStatus, 5000);
} }
function checkSCUploadStatusRequest() { function checkSCUploadStatusRequest() {
@ -106,6 +102,7 @@ function checkCalendarSCUploadStatus(){
} }
$("#schedule_calendar span.progress").each(checkSCUploadStatusRequest); $("#schedule_calendar span.progress").each(checkSCUploadStatusRequest);
setTimeout(checkCalendarSCUploadStatus, 5000);
} }
function findViewportDimensions() { function findViewportDimensions() {
@ -421,7 +418,7 @@ $(document).ready(function() {
if (oItems.soundcloud_upload !== undefined) { if (oItems.soundcloud_upload !== undefined) {
callback = function() { callback = function() {
uploadToSoundCloud(data.id); uploadToSoundCloud(data.id, this.context);
}; };
oItems.soundcloud_upload.callback = callback; oItems.soundcloud_upload.callback = callback;
} }