CC-6079 - merge and remove underscore files
This commit is contained in:
parent
5ab0850d9a
commit
3f25ab2647
38 changed files with 2131 additions and 9600 deletions
|
@ -11,7 +11,7 @@ var AIRTIME = (function(AIRTIME) {
|
|||
var selected = mod.getChosenItemsLength(), $cursor = $('tr.sb-selected'), check = false,
|
||||
shows = $('tr.sb-header'), current = $('tr.sb-current-show'),
|
||||
// TODO: this is an ugly way of doing this... we should find a more robust way of checking which view we're in.
|
||||
cursorText = (window.location.href.toLowerCase().indexOf("schedule") > -1) ? $.i18n._('Add to show') : $.i18n._('Add to next show');
|
||||
btnText = (window.location.href.toLowerCase().indexOf("schedule") > -1) ? $.i18n._('Add to show') : $.i18n._('Add to next show');
|
||||
|
||||
// make sure library items are selected and a cursor is selected.
|
||||
if (selected !== 0) {
|
||||
|
@ -22,18 +22,27 @@ var AIRTIME = (function(AIRTIME) {
|
|||
check = false;
|
||||
}
|
||||
|
||||
if (check === true) {
|
||||
if (check) {
|
||||
AIRTIME.button.enableButton("btn-group #library-plus", false);
|
||||
} else {
|
||||
AIRTIME.button.disableButton("btn-group #library-plus", false);
|
||||
}
|
||||
|
||||
if ($cursor.length !== 0) {
|
||||
cursorText = $.i18n._('Add before selected items');
|
||||
} else if (current.length !== 0) {
|
||||
cursorText = $.i18n._('Add to current show');
|
||||
if ($("#show_builder_table").is(":visible")) {
|
||||
if ($cursor.length !== 0) {
|
||||
btnText = $.i18n._('Add after selected items');
|
||||
} else if (current.length !== 0) {
|
||||
btnText = $.i18n._('Add to current show');
|
||||
}
|
||||
} else {
|
||||
var objType = $('.active-tab .obj_type').val();
|
||||
if (objType === 'block') {
|
||||
btnText = $.i18n._('Add to current smart block');
|
||||
} else {
|
||||
btnText = $.i18n._('Add to current playlist');
|
||||
}
|
||||
}
|
||||
AIRTIME.library.changeAddButtonText($('.btn-group #library-plus #lib-plus-text'), ' '+ cursorText);
|
||||
AIRTIME.library.changeAddButtonText($('.btn-group #library-plus #lib-plus-text'), btnText);
|
||||
};
|
||||
|
||||
mod.fnRowCallback = function(nRow, aData, iDisplayIndex, iDisplayIndexFull) {
|
||||
|
@ -53,7 +62,7 @@ var AIRTIME = (function(AIRTIME) {
|
|||
}
|
||||
|
||||
$nRow.attr("id", aData["tr_id"]).data("aData", aData).data("screen",
|
||||
"timeline");
|
||||
"timeline");
|
||||
};
|
||||
|
||||
mod.fnDrawCallback = function fnLibDrawCallback() {
|
||||
|
@ -61,15 +70,20 @@ var AIRTIME = (function(AIRTIME) {
|
|||
mod.redrawChosen();
|
||||
mod.checkToolBarIcons();
|
||||
|
||||
$('#library_display tr.lib-audio, tr.lib-pl, tr.lib-stream')
|
||||
.draggable(
|
||||
var cb = $('th.library_checkbox');
|
||||
if (cb.find("input").length == 0) {
|
||||
cb.append("<input id='super-checkbox' type='checkbox'>");
|
||||
}
|
||||
|
||||
if ($("#show_builder_table").is(":visible")) {
|
||||
$('#library_display tr.lib-audio, tr.lib-pl, tr.lib-stream')
|
||||
.draggable(
|
||||
{
|
||||
helper : function() {
|
||||
helper: function () {
|
||||
|
||||
var $el = $(this), selected = mod
|
||||
.getChosenItemsLength(), container, thead = $("#show_builder_table thead"), colspan = thead
|
||||
.find("th").length, width = thead.find(
|
||||
"tr:first").width(), message;
|
||||
.getChosenItemsLength(), container, thead = $("#show_builder_table thead"), colspan = thead
|
||||
.find("th").length, width = $el.width(), message;
|
||||
|
||||
// dragging an element that has an unselected
|
||||
// checkbox.
|
||||
|
@ -84,73 +98,123 @@ var AIRTIME = (function(AIRTIME) {
|
|||
}
|
||||
|
||||
container = $('<div/>').attr('id',
|
||||
'draggingContainer').append('<tr/>')
|
||||
.find("tr").append('<td/>').find("td")
|
||||
.attr("colspan", colspan).width(width)
|
||||
.addClass("ui-state-highlight").append(
|
||||
message).end().end();
|
||||
'draggingContainer').append('<tr/>')
|
||||
.find("tr").append('<td/>').find("td")
|
||||
.attr("colspan", colspan).width(width)
|
||||
.addClass("ui-state-highlight").append(
|
||||
message).end().end();
|
||||
|
||||
return container;
|
||||
},
|
||||
cursor : 'pointer',
|
||||
cursorAt: {
|
||||
top: 30,
|
||||
left: 100
|
||||
},
|
||||
connectToSortable : '#show_builder_table'
|
||||
cursor: 'pointer',
|
||||
//cursorAt: {
|
||||
// top: 30,
|
||||
// right: 10
|
||||
//},
|
||||
distance: 25, // min-distance for dragging
|
||||
connectToSortable: '#show_builder_table'
|
||||
});
|
||||
} else {
|
||||
$('#library_display tr.lib-audio, tr.lib-stream, tr.lib-pl, tr.lib-block')
|
||||
.draggable(
|
||||
{
|
||||
helper: function () {
|
||||
|
||||
var $el = $(this), selected = mod
|
||||
.getChosenAudioFilesLength(), container, message,
|
||||
width = $(this).width(), height = 55;
|
||||
|
||||
// dragging an element that has an unselected
|
||||
// checkbox.
|
||||
if (mod.isChosenItem($el) === false) {
|
||||
selected++;
|
||||
}
|
||||
|
||||
if (selected === 1) {
|
||||
message = $.i18n._("Adding 1 Item");
|
||||
} else {
|
||||
message = sprintf($.i18n._("Adding %s Items"), selected);
|
||||
}
|
||||
|
||||
container = $('<div class="helper"/>').append(
|
||||
"<li/>").find("li").addClass(
|
||||
"ui-state-default").append("<div/>")
|
||||
.find("div").addClass(
|
||||
"list-item-container").append(
|
||||
message).end().width(width)
|
||||
.height(height).end();
|
||||
|
||||
return container;
|
||||
},
|
||||
cursor: 'pointer',
|
||||
//cursorAt: {
|
||||
// top: 30,
|
||||
// right: 10
|
||||
//},
|
||||
distance: 25, // min-distance for dragging
|
||||
connectToSortable: '.active-tab .spl_sortable'
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
mod.dblClickAdd = function(data, type) {
|
||||
var i, length, temp, aMediaIds = [], aSchedIds = [], aData = [];
|
||||
|
||||
// process selected files/playlists.
|
||||
aMediaIds.push( {
|
||||
"id" : data.id,
|
||||
"type" : type
|
||||
});
|
||||
|
||||
$("#show_builder_table tr.sb-selected").each(function(i, el) {
|
||||
aData.push($(el).prev().data("aData"));
|
||||
});
|
||||
|
||||
// process selected schedule rows to add media after.
|
||||
for (i = 0, length = aData.length; i < length; i++) {
|
||||
temp = aData[i];
|
||||
aSchedIds.push( {
|
||||
"id" : temp.id,
|
||||
"instance" : temp.instance,
|
||||
"timestamp" : temp.timestamp
|
||||
if ($("#show_builder_table").is(":visible")) {
|
||||
// process selected files/playlists.
|
||||
aMediaIds.push({
|
||||
"id": data.id,
|
||||
"type": type
|
||||
});
|
||||
}
|
||||
|
||||
if (aSchedIds.length == 0) {
|
||||
if (!addToCurrentOrNext(aSchedIds)) {
|
||||
return;
|
||||
$("#show_builder_table tr.sb-selected").each(function (i, el) {
|
||||
aData.push($(el).data("aData"));
|
||||
});
|
||||
|
||||
// process selected schedule rows to add media after.
|
||||
for (i = 0, length = aData.length; i < length; i++) {
|
||||
temp = aData[i];
|
||||
aSchedIds.push({
|
||||
"id": temp.id,
|
||||
"instance": temp.instance,
|
||||
"timestamp": temp.timestamp
|
||||
});
|
||||
}
|
||||
|
||||
if (aSchedIds.length == 0) {
|
||||
if (!addToCurrentOrNext(aSchedIds)) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
AIRTIME.showbuilder.fnAdd(aMediaIds, aSchedIds);
|
||||
} else {
|
||||
// process selected files/playlists.
|
||||
aMediaIds.push(new Array(data.id, data.ftype));
|
||||
|
||||
// check if a playlist/block is open before adding items
|
||||
if ($('.active-tab .obj_type').val() == 'playlist'
|
||||
|| $('.active-tab .obj_type').val() == 'block') {
|
||||
AIRTIME.playlist.fnAddItems(aMediaIds, undefined, 'after');
|
||||
}
|
||||
}
|
||||
|
||||
AIRTIME.showbuilder.fnAdd(aMediaIds, aSchedIds);
|
||||
};
|
||||
|
||||
function addToCurrentOrNext(arr) {
|
||||
var el;
|
||||
// Get the show instance id of the first non-data row (id = 0)
|
||||
// The second last row in the table with that instance id is the
|
||||
// last schedule item for the first show. (This is important for
|
||||
// the Now Playing screen if multiple shows are in view).
|
||||
el = $("[si_id="+$("#0").attr("si_id")+"]");
|
||||
var temp = el.eq(-2).data("aData");
|
||||
// Add to the end of the current or next show by getting the footer
|
||||
el = $(".sb-footer.sb-future:first");
|
||||
var data = el.prev().data("aData");
|
||||
|
||||
if (temp === undefined) {
|
||||
alert($.i18n._("Cannot schedule outside a show."));
|
||||
if (data === undefined) {
|
||||
alert($.i18n._("Cannot schedule outside a show.\nTry creating a show first."));
|
||||
return false;
|
||||
}
|
||||
|
||||
arr.push({
|
||||
"id" : temp.id,
|
||||
"instance" : temp.instance,
|
||||
"timestamp" : temp.timestamp
|
||||
"id" : data.id,
|
||||
"instance" : data.instance,
|
||||
"timestamp" : data.timestamp
|
||||
});
|
||||
|
||||
if (!isInView(el)) {
|
||||
|
@ -159,57 +223,72 @@ var AIRTIME = (function(AIRTIME) {
|
|||
}, 0);
|
||||
}
|
||||
|
||||
return arr;
|
||||
return true;
|
||||
}
|
||||
|
||||
mod.setupLibraryToolbar = function() {
|
||||
var $toolbar = $(".lib-content .fg-toolbar:first");
|
||||
|
||||
mod.createToolbarButtons();
|
||||
mod.moveSearchBarToHeader();
|
||||
|
||||
$toolbar.append($menu);
|
||||
// add to timeline button
|
||||
$toolbar
|
||||
.find('.icon-plus').parent()
|
||||
.find('#library-plus')
|
||||
.click(
|
||||
function() {
|
||||
|
||||
if (AIRTIME.button.isDisabled('btn-group #library-plus') === true) {
|
||||
return;
|
||||
}
|
||||
|
||||
var selected = AIRTIME.library.getSelectedData(), data, i, length, temp, aMediaIds = [], aSchedIds = [], aData = [];
|
||||
|
||||
// process selected files/playlists.
|
||||
for (i = 0, length = selected.length; i < length; i++) {
|
||||
data = selected[i];
|
||||
aMediaIds.push( {
|
||||
"id" : data.id,
|
||||
"type" : data.ftype
|
||||
});
|
||||
}
|
||||
|
||||
$("#show_builder_table tr.sb-selected")
|
||||
.each(function(i, el) {
|
||||
aData.push($(el).prev().data("aData"));
|
||||
});
|
||||
|
||||
// process selected schedule rows to add media
|
||||
// after.
|
||||
for (i = 0, length = aData.length; i < length; i++) {
|
||||
temp = aData[i];
|
||||
aSchedIds.push( {
|
||||
"id" : temp.id,
|
||||
"instance" : temp.instance,
|
||||
"timestamp" : temp.timestamp
|
||||
});
|
||||
}
|
||||
|
||||
if (aSchedIds.length == 0) {
|
||||
addToCurrentOrNext(aSchedIds);
|
||||
var selected = AIRTIME.library.getSelectedData(), data, i, length, temp, aMediaIds = [], aSchedIds = [], aData = [];
|
||||
|
||||
if ($("#show_builder_table").is(":visible")) {
|
||||
for (i = 0, length = selected.length; i < length; i++) {
|
||||
data = selected[i];
|
||||
aMediaIds.push( {
|
||||
"id" : data.id,
|
||||
"type" : data.ftype
|
||||
});
|
||||
}
|
||||
|
||||
// process selected files/playlists.
|
||||
$("#show_builder_table tr.sb-selected").each(function(i, el) {
|
||||
aData.push($(el).data("aData"));
|
||||
});
|
||||
|
||||
// process selected schedule rows to add media
|
||||
// after.
|
||||
for (i = 0, length = aData.length; i < length; i++) {
|
||||
temp = aData[i];
|
||||
aSchedIds.push( {
|
||||
"id" : temp.id,
|
||||
"instance" : temp.instance,
|
||||
"timestamp" : temp.timestamp
|
||||
});
|
||||
}
|
||||
|
||||
if (aSchedIds.length == 0) {
|
||||
if (!addToCurrentOrNext(aSchedIds)) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
AIRTIME.showbuilder.fnAdd(aMediaIds, aSchedIds);
|
||||
} else {
|
||||
for (i = 0, length = selected.length; i < length; i++) {
|
||||
data = selected[i];
|
||||
aMediaIds.push([data.id, data.ftype]);
|
||||
}
|
||||
|
||||
// check if a playlist/block is open before adding items
|
||||
if ($('.active-tab .obj_type').val() == 'playlist'
|
||||
|| $('.active-tab .obj_type').val() == 'block') {
|
||||
AIRTIME.playlist.fnAddItems(aMediaIds, undefined, 'after');
|
||||
}
|
||||
}
|
||||
|
||||
AIRTIME.showbuilder.fnAdd(aMediaIds, aSchedIds);
|
||||
});
|
||||
|
||||
// delete from library.
|
||||
|
@ -222,6 +301,47 @@ var AIRTIME = (function(AIRTIME) {
|
|||
AIRTIME.library.fnDeleteSelectedItems();
|
||||
});
|
||||
|
||||
$toolbar.find('#sb-new').click(function() {
|
||||
if (AIRTIME.button.isDisabled('btn-group #sb-new') === true) {
|
||||
return;
|
||||
}
|
||||
|
||||
var selection = $(".media_type_selector.selected").attr("selection_id");
|
||||
|
||||
if (selection == 2) {
|
||||
AIRTIME.playlist.fnNew();
|
||||
} else if (selection == 3) {
|
||||
AIRTIME.playlist.fnNewBlock();
|
||||
} else if (selection == 4) {
|
||||
AIRTIME.playlist.fnWsNew();
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
$toolbar.find('#sb-edit').click(function() {
|
||||
if (AIRTIME.button.isDisabled('btn-group #sb-edit') === true) {
|
||||
return;
|
||||
}
|
||||
|
||||
var selected = $(".lib-selected");
|
||||
|
||||
selected.each(function(i, el) {
|
||||
var data = $(el).data("aData");
|
||||
|
||||
if (data.ftype === "audioclip") {
|
||||
$.get(baseUrl + "library/edit-file-md/id/" + data.id, {format: "json"}, function(json){
|
||||
AIRTIME.playlist.fileMdEdit(json);
|
||||
//buildEditMetadataDialog(json);
|
||||
});
|
||||
} else if (data.ftype === "playlist" || data.ftype === "block") {
|
||||
AIRTIME.playlist.fnEdit(data.id, data.ftype, baseUrl+'playlist/edit');
|
||||
AIRTIME.playlist.validatePlaylistElements();
|
||||
} else if (data.ftype === "stream") {
|
||||
AIRTIME.playlist.fnEdit(data.id, data.ftype, baseUrl + 'webstream/edit');
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
mod.createToolbarDropDown();
|
||||
};
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue