Merge branch '2.4.x' into 2.4.x-saas

Conflicts:
	python_apps/pypo/liquidsoap_scripts/ls_script.liq
	utils/phone_home_stat.php
This commit is contained in:
Naomi Aro 2013-06-26 01:25:26 -04:00
commit f2d5fa96da
114 changed files with 9850 additions and 9170 deletions

View file

@ -260,16 +260,19 @@ function parseItems(obj){
calculateTimeToNextSong();
}
currentShow = new Array();
if (obj.currentShow.length > 0) {
calcAdditionalShowData(obj.currentShow);
currentShow = obj.currentShow;
}
nextShow = new Array();
if (obj.nextShow.length > 0) {
calcAdditionalShowData(obj.nextShow);
nextShow = obj.nextShow;
calculateTimeToNextShow();
}
currentShow = obj.currentShow;
nextShow = obj.nextShow;
var schedulePosixTime = convertDateToPosixTime(obj.schedulerTime);
var date = new Date();

View file

@ -391,7 +391,9 @@ var AIRTIME = (function(AIRTIME) {
$libTable = $libContent.find("table");
var tableHeight = $libContent.height() - 130;
function getTableHeight() {
return $libContent.height() - 175;
}
function setColumnFilter(oTable){
// TODO : remove this dirty hack once js is refactored
@ -454,6 +456,13 @@ var AIRTIME = (function(AIRTIME) {
} else {
$el.hide();
}
//resize to prevent double scroll bars.
var $fs = $el.parents("fieldset"),
tableHeight = getTableHeight(),
searchHeight = $fs.height();
$libContent.find(".dataTables_scrolling").css("max-height", tableHeight - searchHeight);
}
oTable = $libTable.dataTable( {
@ -593,12 +602,12 @@ var AIRTIME = (function(AIRTIME) {
"fnRowCallback": AIRTIME.library.fnRowCallback,
"fnCreatedRow": function( nRow, aData, iDataIndex ) {
//add soundcloud icon
if (aData.soundcloud_status !== undefined) {
if (aData.soundcloud_status === "-2") {
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_status === "-3") {
} else if (aData.soundcloud_id === "-3") {
$(nRow).find("td.library_title").append('<span class="small-icon sc-error"/>');
} else if (aData.soundcloud_status !== null) {
} else if (aData.soundcloud_id !== null) {
$(nRow).find("td.library_title").append('<span class="small-icon soundcloud"/>');
}
}
@ -784,10 +793,14 @@ var AIRTIME = (function(AIRTIME) {
$libContent.on("click", "legend", function(){
$simpleSearch = $libContent.find("#library_display_filter label");
var $fs = $(this).parents("fieldset");
var $fs = $(this).parents("fieldset"),
searchHeight,
tableHeight = getTableHeight(),
height;
if ($fs.hasClass("closed")) {
$fs.removeClass("closed");
searchHeight = $fs.height();
//keep value of simple search for when user switches back to it
simpleSearchText = $simpleSearch.find('input').val();
@ -796,6 +809,10 @@ var AIRTIME = (function(AIRTIME) {
$(".dataTables_filter input").val("").keyup();
$simpleSearch.addClass("sp-invisible");
//resize the library table to avoid a double scroll bar. CC-4504
height = tableHeight - searchHeight;
$libContent.find(".dataTables_scrolling").css("max-height", height);
}
else {
// clear the advanced search fields
@ -817,9 +834,13 @@ var AIRTIME = (function(AIRTIME) {
$simpleSearch.removeClass("sp-invisible");
$fs.addClass("closed");
//resize the library table to avoid a double scroll bar. CC-4504
$libContent.find(".dataTables_scrolling").css("max-height", tableHeight);
}
});
var tableHeight = getTableHeight();
$libContent.find(".dataTables_scrolling").css("max-height", tableHeight);
AIRTIME.library.setupLibraryToolbar(oTable);
@ -1069,13 +1090,13 @@ function buildEditMetadataDialog (json){
width: 460,
height: 660,
modal: true,
close: closeDialog
close: closeDialogLibrary
});
dialog.dialog('open');
}
function closeDialog(event, ui) {
function closeDialogLibrary(event, ui) {
$(this).remove();
}
@ -1126,7 +1147,6 @@ function checkLibrarySCUploadStatus(){
else if (json.sc_id == "-3") {
span.removeClass("progress").addClass("sc-error");
}
setTimeout(checkLibrarySCUploadStatus, 5000);
}
function checkSCUploadStatusRequest() {
@ -1138,12 +1158,16 @@ function checkLibrarySCUploadStatus(){
}
$("#library_display span.progress").each(checkSCUploadStatusRequest);
setTimeout(checkLibrarySCUploadStatus, 5000);
}
function addQtipToSCIcons(){
$(".progress, .soundcloud, .sc-error").live('mouseover', function(){
function addQtipToSCIcons() {
$("#content")
.on('mouseover', ".progress, .soundcloud, .sc-error", function() {
var id = $(this).parent().parent().data("aData").id;
var aData = $(this).parents("tr").data("aData"),
id = aData.id,
sc_id = aData.soundcloud_id;
if ($(this).hasClass("progress")){
$(this).qtip({
@ -1163,24 +1187,15 @@ function addQtipToSCIcons(){
classes: "ui-tooltip-dark file-md-long"
},
show: {
ready: true // Needed to make it show on first mouseover
// event
ready: true // Needed to make it show on first mouseover event
}
});
}
else if($(this).hasClass("soundcloud")){
var sc_id = $(this).parent().parent().data("aData").soundcloud_id;
else if ($(this).hasClass("soundcloud")){
$(this).qtip({
content: {
text: $.i18n._("Retrieving 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._("The soundcloud id for this file is: ")+json.sc_id);
}
}
text: $.i18n._("The soundcloud id for this file is: ") + sc_id
},
position:{
adjust: {
@ -1195,11 +1210,11 @@ function addQtipToSCIcons(){
classes: "ui-tooltip-dark file-md-long"
},
show: {
ready: true // Needed to make it show on first mouseover
// event
ready: true // Needed to make it show on first mouseover event
}
});
}else if($(this).hasClass("sc-error")){
}
else if ($(this).hasClass("sc-error")) {
$(this).qtip({
content: {
text: $.i18n._("Retreiving data from the server..."),
@ -1227,8 +1242,7 @@ function addQtipToSCIcons(){
classes: "ui-tooltip-dark file-md-long"
},
show: {
ready: true // Needed to make it show on first mouseover
// event
ready: true // Needed to make it show on first mouseover event
}
});
}

View file

@ -209,12 +209,11 @@ var AIRTIME = (function(AIRTIME){
}
/* used from waveform pop-up */
function changeCrossfade($el, id1, id2, fadeIn, fadeOut, offset) {
function changeCrossfade($el, id1, id2, fadeIn, fadeOut, offset, id) {
var url = baseUrl+"Playlist/set-crossfade",
lastMod = getModified(),
type = $('#obj_type').val(),
li, id;
type = $('#obj_type').val();
$.post(url,
{format: "json", fadeIn: fadeIn, fadeOut: fadeOut, id1: id1, id2: id2, offset: offset, modified: lastMod, type: type},
@ -230,10 +229,9 @@ var AIRTIME = (function(AIRTIME){
setPlaylistContent(json);
id = id1 === undefined ? id2 : id1;
li = $('#side_playlist li[unqid='+id+']');
li.find('.crossfade').toggle();
highlightActive(li.find('.spl_fade_control'));
$li = $('#side_playlist li[unqid='+id+']');
$li.find('.crossfade').toggle();
highlightActive($li.find('.spl_fade_control'));
});
}
@ -589,13 +587,13 @@ var AIRTIME = (function(AIRTIME){
var extra = (ele['extra']==null)?"":"- "+ele['extra'];
$html += "<li>" +
"<span class='block-item-title'>"+ele['display_name']+"</span>" +
"<span class='block-item-criteria'>"+ele['modifier']+"</span>" +
"<span class='block-item-criteria'>"+ele['display_modifier']+"</span>" +
"<span class='block-item-criteria'>"+ele['value']+"</span>" +
"<span class='block-item-criteria'>"+extra+"</span>" +
"</li>";
});
}
$html += "<li><br /><span class='block-item-title'>"+$.i18n._("Limit to: ")+data.limit.value+" "+data.limit.modifier+"</span></li>";
$html += "<li><br /><span class='block-item-title'>"+$.i18n._("Limit to: ")+data.limit.value+" "+data.limit.display_modifier+"</span></li>";
}
$pl.find("#block_"+id+"_info").html($html).show();
mod.enableUI();
@ -1179,13 +1177,16 @@ var AIRTIME = (function(AIRTIME){
mod.showFadesWaveform = function(e) {
var $el = $(e.target),
$parent = $el.parents("dl"),
$li = $el.parents("li"),
$fadeOut = $parent.find(".spl_fade_out"),
$fadeIn = $parent.find(".spl_fade_in"),
$html = $($("#tmpl-pl-fades").html()),
tracks = [],
dim = AIRTIME.utilities.findViewportDimensions(),
playlistEditor,
id1, id2;
id1, id2,
id = $li.attr("unqid");
function removeDialog() {
playlistEditor.stop();
@ -1246,7 +1247,7 @@ var AIRTIME = (function(AIRTIME){
show: 'clip',
hide: 'clip',
width: dim.width - 100,
height: dim.height - 100,
height: 350,
buttons: [
{text: $.i18n._("Cancel"), class: "btn btn-small", click: removeDialog},
{text: $.i18n._("Save"), class: "btn btn-small btn-inverse", click: function() {
@ -1257,15 +1258,22 @@ var AIRTIME = (function(AIRTIME){
playlistEditor.stop();
if (json.length === 1) {
if (json.length === 0)
{
id1 = undefined;
id2 = undefined;
}
else if (json.length === 1) {
fade = json[0]["fades"][0];
if (fade["type"] === "FadeOut") {
fadeOut = fade["end"] - fade["start"];
id2 = undefined; //incase of track decode error.
}
else {
fadeIn = fade["end"] - fade["start"];
id1 = undefined; //incase of track decode error.
}
}
else {
@ -1282,7 +1290,7 @@ var AIRTIME = (function(AIRTIME){
fadeIn = (fadeIn === undefined) ? undefined : fadeIn.toFixed(1);
fadeOut = (fadeOut === undefined) ? undefined : fadeOut.toFixed(1);
changeCrossfade($html, id1, id2, fadeIn, fadeOut, offset);
changeCrossfade($html, id1, id2, fadeIn, fadeOut, offset, id);
}}
],
open: function (event, ui) {
@ -1291,6 +1299,7 @@ var AIRTIME = (function(AIRTIME){
resolution: 15000,
state: "cursor",
mono: true,
timescale: true,
waveHeight: 80,
container: $html[0],
UITheme: "jQueryUI",
@ -1301,7 +1310,10 @@ var AIRTIME = (function(AIRTIME){
playlistEditor.setConfig(config);
playlistEditor.init(tracks);
},
close: removeDialog
close: removeDialog,
resizeStop: function(event, ui) {
playlistEditor.resize();
}
});
};
@ -1354,7 +1366,7 @@ var AIRTIME = (function(AIRTIME){
show: 'clip',
hide: 'clip',
width: dim.width - 100,
height: dim.height - 100,
height: 325,
buttons: [
{text: $.i18n._("Cancel"), class: "btn btn-small", click: removeDialog},
{text: $.i18n._("Save"), class: "btn btn-small btn-inverse", click: function() {
@ -1371,6 +1383,7 @@ var AIRTIME = (function(AIRTIME){
var config = new Config({
resolution: 15000,
mono: true,
timescale: true,
waveHeight: 80,
container: $html[0],
UITheme: "jQueryUI",
@ -1381,7 +1394,10 @@ var AIRTIME = (function(AIRTIME){
playlistEditor.setConfig(config);
playlistEditor.init(tracks);
},
close: removeDialog
close: removeDialog,
resizeStop: function(event, ui) {
playlistEditor.resize();
}
});
};
@ -1435,13 +1451,13 @@ var AIRTIME = (function(AIRTIME){
widgetHeight = viewport.height - 185;
width = Math.floor(viewport.width - 80);
var libTableHeight = widgetHeight - 130;
var libTableHeight = widgetHeight - 175;
if (!$pl.is(':hidden')) {
$lib.height(widgetHeight)
.find(".dataTables_scrolling")
.css("max-height", libTableHeight)
.end()
.css("max-height", libTableHeight)
.end()
.width(Math.floor(width * 0.55));
$pl.height(widgetHeight)
@ -1449,8 +1465,8 @@ var AIRTIME = (function(AIRTIME){
} else {
$lib.height(widgetHeight)
.find(".dataTables_scrolling")
.css("max-height", libTableHeight)
.end()
.css("max-height", libTableHeight)
.end()
.width(width + 40);
}
}
@ -1459,8 +1475,6 @@ var AIRTIME = (function(AIRTIME){
$lib = $("#library_content");
$pl = $("#side_playlist");
setWidgetSize();
AIRTIME.library.libraryInit();

View file

@ -192,7 +192,8 @@ function setAddShowEvents() {
$(this).parent().after("<ul id='show-link-warning' class='errors'><li>"+$.i18n._("Warning: Shows cannot be re-linked")+"</li></ul>");
}
});
form.find("#add_show_linked-label").before("<span class='show_linking_help_icon'></span>");
form.find("#add_show_record").click(function(){
$(this).blur();
@ -315,7 +316,26 @@ function setAddShowEvents() {
at: "right center"
}
});
form.find(".show_linking_help_icon").qtip({
content: {
text: $.i18n._("By linking your repeating shows any media items scheduled in any repeat show will also get scheduled in the other repeat shows")
},
hide: {
delay: 500,
fixed: true
},
style: {
border: {
width: 0,
radius: 4
},
classes: "ui-tooltip-dark ui-tooltip-rounded"
},
position: {
my: "left bottom",
at: "right center"
}
});
function endDateVisibility(){
if(form.find("#add_show_no_end").is(':checked')){
form.find("#add_show_end_date").hide();

View file

@ -116,12 +116,19 @@ function dayClick(date, allDay, jsEvent, view){
// duration in milisec
var duration = (duration_h * 60 * 60 * 1000) + (duration_m * 60 * 1000);
var startTime_string, startTime
var startTime_string;
var startTime = 0;
// get start time value on the form
if(view.name === "month") {
startTime_string = $("#add_show_start_time").val();
var startTime_info = startTime_string.split(':');
startTime = (parseInt(startTime_info[0],10) * 60 * 60 * 1000) + (parseInt(startTime_info[1], 10) * 60 * 1000);
if (startTime_info.length == 2) {
var start_time_temp = (parseInt(startTime_info[0],10) * 60 * 60 * 1000)
+ (parseInt(startTime_info[1], 10) * 60 * 1000);
if (!isNaN(start_time_temp)) {
startTime = start_time_temp;
}
}
}else{
// if in day or week view, selected has all the time info as well
// so we don't ahve to calculate it explicitly
@ -210,7 +217,9 @@ function viewDisplay( view ) {
}
function eventRender(event, element, view) {
$(element).attr("id", "fc-show-instance-"+event.id);
$(element).attr("data-show-id", event.showId);
$(element).attr("data-show-linked", event.linked);
$(element).data("event", event);
//only put progress bar on shows that aren't being recorded.
@ -228,35 +237,28 @@ function eventRender(event, element, view) {
$(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
if (event.record === 1) {
if (view.name === 'agendaDay' || view.name === 'agendaWeek') {
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) {
$(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) {
$(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) {
$(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') {
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) {
$(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) {
$(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) {
$(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 +269,27 @@ function eventRender(event, element, view) {
if (event.linked) {
$(element)
.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 {
$(element)
.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) {
if (event.linked) {
$(element)
.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 {
$(element)
.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 {
if (event.linked) {
$(element)
.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') {
@ -295,27 +297,27 @@ function eventRender(event, element, view) {
if (event.linked) {
$(element)
.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 {
$(element)
.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) {
if (event.linked) {
$(element)
.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 {
$(element)
.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 {
if (event.linked) {
$(element)
.find(".fc-event-title")
.after('<span id="'+event.id+'" class="small-icon linked"></span>');
.after('<span class="small-icon linked"></span>');
}
}
}
@ -324,9 +326,9 @@ function eventRender(event, element, view) {
//rebroadcast icon
if (event.rebroadcast === 1) {
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') {
$(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 +336,7 @@ function eventRender(event, element, view) {
function eventAfterRender( event, element, view ) {
$(element).find(".small-icon").live('mouseover',function(){
addQtipsToIcons($(this));
addQtipsToIcons($(this), event.id);
});
}
@ -403,15 +405,25 @@ function getFullCalendarEvents(start, end, callback) {
}
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(){
var id = $(this).attr("id");
id = $(this).parents("div.fc-event").data("event").id;
$.post(url, {format: "json", id: id, type:"show"}, function(json){
if(json.sc_id > 0){
$("span[id="+id+"]:not(.recording)").removeClass("progress").addClass("soundcloud");
}else if(json.sc_id == "-3"){
$("span[id="+id+"]:not(.recording)").removeClass("progress").addClass("sc-error");
if (json.sc_id > 0){
$("#fc-show-instance-"+id)
.find(".progress")
.removeClass("progress")
.addClass("soundcloud");
}
else if (json.sc_id == "-3"){
$("#fc-show-instance-"+id)
.find(".progress")
.removeClass("progress")
.addClass("sc-error");
}
setTimeout(checkSCUploadStatus, 5000);
});
});
@ -425,7 +437,7 @@ function getCurrentShow(){
$el;
$.post(url, {format: "json"}, function(json) {
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') {
/* Need to remove now-playing class because if user
@ -440,40 +452,40 @@ function getCurrentShow(){
* icon will overwrite it.
*/
$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")) {
/* Without removing rebroadcast icon, the now playing
* icon will overwrite it.
*/
$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 {
$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') {
if (!$("span[class*=fc-event-title][id="+json.si_id+"]").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>');
if (!$("span[class*=fc-event-title]").siblings().hasClass("small-icon now-playing")) {
$("span[class*=fc-event-title]").after('<span class="small-icon now-playing"></span>');
}
}
}
//remove icon from shows that have ended
$(".now-playing").each(function(){
id = $(this).attr("id");
if (id != json.si_id) {
$(this).remove("span[small-icon now-playing]");
}
});
id = $(this).parents("div.fc-event").data("event").id;
if (id != json.si_id) {
$(this).remove("span[small-icon now-playing]");
}
});
setTimeout(getCurrentShow, 5000);
});
}
function addQtipsToIcons(ele){
var id = $(ele).attr("id");
if($(ele).hasClass("progress")){
function addQtipsToIcons(ele, id){
if ($(ele).hasClass("progress")){
$(ele).qtip({
content: {
text: $.i18n._("Uploading in progress...")

View file

@ -12,8 +12,8 @@ var AIRTIME = (function(AIRTIME){
var serverTimezoneOffset = 0;
function closeDialog(event, ui) {
$("#schedule_calendar").fullCalendar( 'refetchEvents' );
function closeDialogCalendar(event, ui) {
//$("#schedule_calendar").fullCalendar( 'refetchEvents' );
$(this).remove();
}
@ -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 span = $(window.triggerElement).find(".recording");
var url = baseUrl+"Schedule/upload-to-sound-cloud",
$el = $(el),
$span = $el.find(".soundcloud");
$.post(url,
{id: show_instance_id, format: "json"},
function(json){
scheduleRefetchEvents(json);
});
$.post(url, {id: show_instance_id, format: "json"});
if(span.length == 0){
span = $(window.triggerElement).find(".soundcloud");
span.removeClass("soundcloud")
.addClass("progress");
}else{
span.removeClass("recording")
.addClass("progress");
//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");
}
}
@ -93,8 +91,6 @@ function checkCalendarSCUploadStatus(){
else if (json.sc_id == "-3") {
span.removeClass("progress").addClass("sc-error");
}
setTimeout(checkCalendarSCUploadStatus, 5000);
}
function checkSCUploadStatusRequest() {
@ -106,6 +102,7 @@ function checkCalendarSCUploadStatus(){
}
$("#schedule_calendar span.progress").each(checkSCUploadStatusRequest);
setTimeout(checkCalendarSCUploadStatus, 5000);
}
function findViewportDimensions() {
@ -164,7 +161,7 @@ function buildScheduleDialog (json, instance_id) {
resizable: false,
draggable: true,
modal: true,
close: closeDialog,
close: closeDialogCalendar,
buttons: [
{
text: $.i18n._("Ok"),
@ -189,10 +186,10 @@ function buildScheduleDialog (json, instance_id) {
//set max heights of datatables.
dialog.find(".lib-content .dataTables_scrolling")
.css("max-height", height - 90 - 155);
.css("max-height", height - 90 - 200);
dialog.find(".sb-content .dataTables_scrolling")
.css("max-height", height - 90 - 60);
.css("max-height", height - 90 - 65);
dialog.dialog('open');
}
@ -217,7 +214,7 @@ function buildContentDialog (json){
width: width,
height: height,
modal: true,
close: closeDialog,
close: closeDialogCalendar,
buttons: [
{
text: $.i18n._("Ok"),
@ -421,7 +418,7 @@ $(document).ready(function() {
if (oItems.soundcloud_upload !== undefined) {
callback = function() {
uploadToSoundCloud(data.id);
uploadToSoundCloud(data.id, this.context);
};
oItems.soundcloud_upload.callback = callback;
}

View file

@ -40,8 +40,6 @@ var AIRTIME = (function(AIRTIME){
};
mod.updateCalendarStatusIcon = function(json) {
//make sure we are only executing this code on the calendar view, not
//the Now Playing view.
if (window.location.pathname.toLowerCase().indexOf("schedule") < 0) {
@ -52,16 +50,24 @@ var AIRTIME = (function(AIRTIME){
var instance_id = json.schedule[0].instance;
var lastElem = json.schedule[json.schedule.length-1];
var $elem = $($(".fc-event-inner.fc-event-skin .fc-event-title#"+instance_id).parent());
$elem.find(".small-icon").remove();
var $elem = $("#fc-show-instance-"+instance_id);
//if the show is linked, then replace $elem to reference all linked
//instances
if ($elem.data("show-linked") == "1") {
var show_id = $elem.data("show-id");
$elem = $('*[data-show-id="'+show_id+'"]');
}
$elem.find(".show-empty, .show-partial-filled").remove();
if (json.schedule[1].empty) {
$elem
.find(".fc-event-title")
.after('<span id="'+instance_id+'" title="'+$.i18n._("Show is empty")+'" class="small-icon show-empty"></span>');
.find(".fc-event-inner")
.append('<span id="'+instance_id+'" title="'+$.i18n._("Show is empty")+'" class="small-icon show-empty"></span>');
} else if (lastElem["fRuntime"][0] == "-") {
$elem
.find(".fc-event-title")
.after('<span id="'+instance_id+'" title="'+$.i18n._("Show is partially filled")+'" class="small-icon show-partial-filled"></span>');
.find(".fc-event-inner")
.append('<span id="'+instance_id+'" title="'+$.i18n._("Show is partially filled")+'" class="small-icon show-partial-filled"></span>');
}
}
@ -479,7 +485,7 @@ var AIRTIME = (function(AIRTIME){
$image,
$div,
headerIcon;
fnPrepareSeparatorRow = function fnPrepareSeparatorRow(sRowContent, sClass, iNodeIndex) {
$node = $(nRow.children[iNodeIndex]);
$node.html(sRowContent);
@ -546,7 +552,7 @@ var AIRTIME = (function(AIRTIME){
cl = 'sb-footer';
//check the show's content status.
if (aData.runtime > 0) {
if (aData.runtime >= 0) {
$node.html('<span class="ui-icon ui-icon-check"></span>');
cl = cl + ' ui-state-highlight';
}
@ -614,7 +620,7 @@ var AIRTIME = (function(AIRTIME){
}
$node = $(nRow.children[0]);
if (aData.allowed === true && aData.scheduled >= 1) {
if (aData.allowed === true && aData.scheduled >= 1 && aData.linked_allowed) {
$node.html('<input type="checkbox" name="'+aData.id+'"></input>');
}
else {
@ -835,7 +841,7 @@ var AIRTIME = (function(AIRTIME){
});
$sbTable.find("tbody").on("click", "input:checkbox", function(ev) {
var $cb = $(this),
$tr = $cb.parents("tr"),
$prev;

View file

@ -35,7 +35,8 @@ AIRTIME = (function(AIRTIME) {
dayNamesMin: i18n_days_short,
onClick: function(sDate, oDatePicker) {
$(this).datepicker( "setDate", sDate );
}
},
onClose: validateTimeRange
};
oBaseTimePickerSettings = {
@ -53,7 +54,7 @@ AIRTIME = (function(AIRTIME) {
widgetHeight = viewport.height - 180;
screenWidth = Math.floor(viewport.width - 40);
var libTableHeight = widgetHeight - 130,
var libTableHeight = widgetHeight - 175,
builderTableHeight = widgetHeight - 95,
oTable;
@ -90,32 +91,61 @@ AIRTIME = (function(AIRTIME) {
}
}
function validateTimeRange() {
var oRange,
inputs = $('.sb-timerange > input'),
start, end;
oRange = AIRTIME.utilities.fnGetScheduleRange(dateStartId, timeStartId, dateEndId, timeEndId);
start = oRange.start;
end = oRange.end;
if (end >= start) {
inputs.removeClass('error');
}
else {
if (!inputs.hasClass('error')) {
inputs.addClass('error');
}
}
return {
start: start,
end: end,
isValid: end >= start
};
}
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 = $('#show_builder_table').dataTable(),
check;
check = validateTimeRange();
if (check.isValid) {
//reset timestamp value since input values could have changed.
AIRTIME.showbuilder.resetTimestamp();
fn = oTable.fnSettings().fnServerData;
fn.start = check.start;
fn.end = check.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();
}
oTable.fnDraw();
}
mod.onReady = function() {
@ -134,10 +164,22 @@ AIRTIME = (function(AIRTIME) {
$(this).removeClass("ui-state-hover");
});
$builder.find(dateStartId).datepicker(oBaseDatePickerSettings);
$builder.find(timeStartId).timepicker(oBaseTimePickerSettings);
$builder.find(dateEndId).datepicker(oBaseDatePickerSettings);
$builder.find(timeEndId).timepicker(oBaseTimePickerSettings);
$builder.find(dateStartId)
.datepicker(oBaseDatePickerSettings)
.blur(validateTimeRange);
$builder.find(timeStartId)
.timepicker(oBaseTimePickerSettings)
.blur(validateTimeRange);
$builder.find(dateEndId)
.datepicker(oBaseDatePickerSettings)
.blur(validateTimeRange);
$builder.find(timeEndId)
.timepicker(oBaseTimePickerSettings)
.blur(validateTimeRange);
oRange = AIRTIME.utilities.fnGetScheduleRange(dateStartId, timeStartId,
dateEndId, timeEndId);

View file

@ -88,19 +88,13 @@ var AIRTIME = (function(AIRTIME){
mod.fnGetScheduleRange = function(dateStart, timeStart, dateEnd, timeEnd) {
var iStart,
iEnd,
iRange,
DEFAULT_RANGE = 60*60*24;
iRange;
iStart = AIRTIME.utilities.fnGetTimestamp(dateStart, timeStart);
iEnd = AIRTIME.utilities.fnGetTimestamp(dateEnd, timeEnd);
iRange = iEnd - iStart;
if (iEnd < iStart) {
iEnd = iStart + DEFAULT_RANGE;
iRange = DEFAULT_RANGE;
}
return {
start: iStart,
end: iEnd,