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
File diff suppressed because it is too large
Load diff
File diff suppressed because it is too large
Load diff
|
@ -1,350 +0,0 @@
|
|||
var AIRTIME = (function(AIRTIME) {
|
||||
var mod;
|
||||
|
||||
if (AIRTIME.library === undefined) {
|
||||
AIRTIME.library = {};
|
||||
}
|
||||
|
||||
mod = AIRTIME.library;
|
||||
|
||||
mod.checkAddButton = function() {
|
||||
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.
|
||||
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) {
|
||||
check = true;
|
||||
}
|
||||
|
||||
if (shows.length === 0) {
|
||||
check = false;
|
||||
}
|
||||
|
||||
if (check) {
|
||||
AIRTIME.button.enableButton("btn-group #library-plus", false);
|
||||
} else {
|
||||
AIRTIME.button.disableButton("btn-group #library-plus", false);
|
||||
}
|
||||
|
||||
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'), btnText);
|
||||
};
|
||||
|
||||
mod.fnRowCallback = function(nRow, aData, iDisplayIndex, iDisplayIndexFull) {
|
||||
var $nRow = $(nRow);
|
||||
|
||||
if (aData.ftype === "audioclip") {
|
||||
$nRow.addClass("lib-audio");
|
||||
$image = $nRow.find('td.library_type');
|
||||
if (!isAudioSupported(aData.mime)) {
|
||||
$image.html('<span class="ui-icon ui-icon-locked"></span>');
|
||||
aData.image = '<span class="ui-icon ui-icon-locked"></span>';
|
||||
}
|
||||
} else if (aData.ftype === "stream") {
|
||||
$nRow.addClass("lib-stream");
|
||||
} else {
|
||||
$nRow.addClass("lib-pl");
|
||||
}
|
||||
|
||||
$nRow.attr("id", aData["tr_id"]).data("aData", aData).data("screen",
|
||||
"timeline");
|
||||
};
|
||||
|
||||
mod.fnDrawCallback = function fnLibDrawCallback() {
|
||||
|
||||
mod.redrawChosen();
|
||||
mod.checkToolBarIcons();
|
||||
|
||||
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 () {
|
||||
|
||||
var $el = $(this), selected = mod
|
||||
.getChosenItemsLength(), container, thead = $("#show_builder_table thead"), colspan = thead
|
||||
.find("th").length, width = $el.width(), message;
|
||||
|
||||
// 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/>').attr('id',
|
||||
'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,
|
||||
// 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 = [];
|
||||
|
||||
if ($("#show_builder_table").is(":visible")) {
|
||||
// process selected files/playlists.
|
||||
aMediaIds.push({
|
||||
"id": data.id,
|
||||
"type": type
|
||||
});
|
||||
|
||||
$("#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');
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
function addToCurrentOrNext(arr) {
|
||||
var el;
|
||||
// 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 (data === undefined) {
|
||||
alert($.i18n._("Cannot schedule outside a show.\nTry creating a show first."));
|
||||
return false;
|
||||
}
|
||||
|
||||
arr.push({
|
||||
"id" : data.id,
|
||||
"instance" : data.instance,
|
||||
"timestamp" : data.timestamp
|
||||
});
|
||||
|
||||
if (!isInView(el)) {
|
||||
$('.dataTables_scrolling.sb-padded').animate({
|
||||
scrollTop: el.offset().top
|
||||
}, 0);
|
||||
}
|
||||
|
||||
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('#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 = [];
|
||||
|
||||
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');
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
// delete from library.
|
||||
$toolbar.find('.icon-trash').parent().click(function() {
|
||||
|
||||
if (AIRTIME.button.isDisabled('icon-trash') === true) {
|
||||
return;
|
||||
}
|
||||
|
||||
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+'new-playlist/edit');
|
||||
AIRTIME.playlist.validatePlaylistElements();
|
||||
} else if (data.ftype === "stream") {
|
||||
AIRTIME.playlist.fnEdit(data.id, data.ftype, baseUrl + 'new-webstream/edit');
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
mod.createToolbarDropDown();
|
||||
};
|
||||
|
||||
return AIRTIME;
|
||||
|
||||
}(AIRTIME || {}));
|
|
@ -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();
|
||||
};
|
||||
|
||||
|
|
File diff suppressed because it is too large
Load diff
File diff suppressed because it is too large
Load diff
|
@ -1,609 +0,0 @@
|
|||
$(document).ready(function() {
|
||||
setSmartBlockEvents();
|
||||
});
|
||||
|
||||
function setSmartBlockEvents() {
|
||||
var activeTab = $('.active-tab'),
|
||||
form = activeTab.find('.smart-block-form');
|
||||
|
||||
/********** ADD CRITERIA ROW **********/
|
||||
form.find('#criteria_add').live('click', function(){
|
||||
|
||||
var div = $('dd[id="sp_criteria-element"]').children('div:visible:last');
|
||||
|
||||
div.find('.db-logic-label').text('and').show();
|
||||
div = div.next().show();
|
||||
|
||||
div.children().removeAttr('disabled');
|
||||
div = div.next();
|
||||
if (div.length === 0) {
|
||||
$(this).hide();
|
||||
}
|
||||
|
||||
appendAddButton();
|
||||
appendModAddButton();
|
||||
removeButtonCheck();
|
||||
});
|
||||
|
||||
/********** ADD MODIFIER ROW **********/
|
||||
form.find('a[id^="modifier_add"]').live('click', function(){
|
||||
var criteria_value = $(this).siblings('select[name^="sp_criteria_field"]').val();
|
||||
|
||||
|
||||
//make new modifier row
|
||||
var newRow = $(this).parent().clone(),
|
||||
newRowCrit = newRow.find('select[name^="sp_criteria_field"]'),
|
||||
newRowMod = newRow.find('select[name^="sp_criteria_modifier"]'),
|
||||
newRowVal = newRow.find('input[name^="sp_criteria_value"]'),
|
||||
newRowExtra = newRow.find('input[name^="sp_criteria_extra"]'),
|
||||
newRowRemove = newRow.find('a[id^="criteria_remove"]');
|
||||
|
||||
//remove error msg
|
||||
if (newRow.children().hasClass('errors sp-errors')) {
|
||||
newRow.find('span[class="errors sp-errors"]').remove();
|
||||
}
|
||||
|
||||
//hide the critieria field select box
|
||||
newRowCrit.addClass('sp-invisible');
|
||||
|
||||
//keep criteria value the same
|
||||
newRowCrit.val(criteria_value);
|
||||
|
||||
//reset all other values
|
||||
newRowMod.val('0');
|
||||
newRowVal.val('');
|
||||
newRowExtra.val('');
|
||||
disableAndHideExtraField(newRowVal);
|
||||
sizeTextBoxes(newRowVal, 'sp_extra_input_text', 'sp_input_text');
|
||||
|
||||
//remove the 'criteria add' button from new modifier row
|
||||
newRow.find('#criteria_add').remove();
|
||||
|
||||
$(this).parent().after(newRow);
|
||||
reindexElements();
|
||||
appendAddButton();
|
||||
appendModAddButton();
|
||||
removeButtonCheck();
|
||||
});
|
||||
|
||||
/********** REMOVE ROW **********/
|
||||
form.find('a[id^="criteria_remove"]').live('click', function(){
|
||||
var curr = $(this).parent();
|
||||
var curr_pos = curr.index();
|
||||
var list = curr.parent();
|
||||
var list_length = list.find("div:visible").length;
|
||||
var count = list_length - curr_pos;
|
||||
var next = curr.next();
|
||||
var item_to_hide;
|
||||
var prev;
|
||||
var index;
|
||||
|
||||
//remove error message from current row, if any
|
||||
var error_element = curr.find('span[class="errors sp-errors"]');
|
||||
if (error_element.is(':visible')) {
|
||||
error_element.remove();
|
||||
}
|
||||
|
||||
/* assign next row to current row for all rows below and including
|
||||
* the row getting removed
|
||||
*/
|
||||
for (var i=0; i<count; i++) {
|
||||
|
||||
index = getRowIndex(curr);
|
||||
|
||||
var criteria = next.find('[name^="sp_criteria_field"]').val();
|
||||
curr.find('[name^="sp_criteria_field"]').val(criteria);
|
||||
|
||||
var modifier = next.find('[name^="sp_criteria_modifier"]').val();
|
||||
populateModifierSelect(curr.find('[name^="sp_criteria_field"]'), false);
|
||||
curr.find('[name^="sp_criteria_modifier"]').val(modifier);
|
||||
|
||||
var criteria_value = next.find('[name^="sp_criteria_value"]').val();
|
||||
curr.find('[name^="sp_criteria_value"]').val(criteria_value);
|
||||
|
||||
/* if current and next row have the extra criteria value
|
||||
* (for 'is in the range' modifier), then assign the next
|
||||
* extra value to current and remove that element from
|
||||
* next row
|
||||
*/
|
||||
if (curr.find('[name^="sp_criteria_extra"]').attr("disabled") != "disabled"
|
||||
&& next.find('#extra_criteria').is(':visible')) {
|
||||
|
||||
var criteria_extra = next.find('[name^="sp_criteria_extra"]').val();
|
||||
curr.find('[name^="sp_criteria_extra"]').val(criteria_extra);
|
||||
disableAndHideExtraField(next.find(':first-child'), getRowIndex(next));
|
||||
|
||||
/* if only the current row has the extra criteria value,
|
||||
* then just remove the current row's extra criteria element
|
||||
*/
|
||||
} else if (curr.find('[name^="sp_criteria_extra"]').attr("disabled") != "disabled"
|
||||
&& next.find('#extra_criteria').not(':visible')) {
|
||||
disableAndHideExtraField(curr.find(':first-child'), index);
|
||||
|
||||
/* if only the next row has the extra criteria value,
|
||||
* then add the extra criteria element to current row
|
||||
* and assign next row's value to it
|
||||
*/
|
||||
} else if (next.find('#extra_criteria').is(':visible')) {
|
||||
criteria_extra = next.find('[name^="sp_criteria_extra"]').val();
|
||||
enableAndShowExtraField(curr.find(':first-child'), index);
|
||||
curr.find('[name^="sp_criteria_extra"]').val(criteria_extra);
|
||||
}
|
||||
|
||||
/* determine if current row is a modifier row
|
||||
* if it is, make the criteria select invisible
|
||||
*/
|
||||
prev = curr.prev();
|
||||
if (curr.find('[name^="sp_criteria_field"]').val() == prev.find('[name^="sp_criteria_field"]').val()) {
|
||||
if (!curr.find('select[name^="sp_criteria_field"]').hasClass('sp-invisible')) {
|
||||
curr.find('select[name^="sp_criteria_field"]').addClass('sp-invisible');
|
||||
}
|
||||
} else {
|
||||
if (curr.find('select[name^="sp_criteria_field"]').hasClass('sp-invisible')) {
|
||||
curr.find('select[name^="sp_criteria_field"]').removeClass('sp-invisible');
|
||||
}
|
||||
}
|
||||
|
||||
curr = next;
|
||||
next = curr.next();
|
||||
|
||||
}
|
||||
|
||||
/* Disable the last visible row since it holds the values the user removed
|
||||
* Reset the values to empty and resize the criteria value textbox
|
||||
* in case the row had the extra criteria textbox
|
||||
*/
|
||||
item_to_hide = list.find('div:visible:last');
|
||||
item_to_hide.children().attr('disabled', 'disabled');
|
||||
if (item_to_hide.find('select[name^="sp_criteria_field"]').hasClass('sp-invisible')) {
|
||||
item_to_hide.find('select[name^="sp_criteria_field"]').removeClass('sp-invisible');
|
||||
}
|
||||
item_to_hide.find('[name^="sp_criteria_field"]').val(0).end()
|
||||
.find('[name^="sp_criteria_modifier"]').val(0).end()
|
||||
.find('[name^="sp_criteria_value"]').val('').end()
|
||||
.find('[name^="sp_criteria_extra"]').val('');
|
||||
|
||||
sizeTextBoxes(item_to_hide.find('[name^="sp_criteria_value"]'), 'sp_extra_input_text', 'sp_input_text');
|
||||
item_to_hide.hide();
|
||||
|
||||
list.next().show();
|
||||
|
||||
//check if last row is a modifier row
|
||||
var last_row = list.find('div:visible:last');
|
||||
if (last_row.find('[name^="sp_criteria_field"]').val() == last_row.prev().find('[name^="sp_criteria_field"]').val()) {
|
||||
if (!last_row.find('select[name^="sp_criteria_field"]').hasClass('sp-invisible')) {
|
||||
last_row.find('select[name^="sp_criteria_field"]').addClass('sp-invisible');
|
||||
}
|
||||
}
|
||||
|
||||
// always put '+' button on the last enabled row
|
||||
appendAddButton();
|
||||
|
||||
reindexElements();
|
||||
|
||||
// always put '+' button on the last modifier row
|
||||
appendModAddButton();
|
||||
|
||||
// remove the 'x' button if only one row is enabled
|
||||
removeButtonCheck();
|
||||
});
|
||||
|
||||
/********** SAVE ACTION **********/
|
||||
// moved to spl.js
|
||||
|
||||
/********** GENERATE ACTION **********/
|
||||
activeTab.find('button[id="generate_button"]').live("click", function(){
|
||||
buttonClickAction('generate', 'new-playlist/smart-block-generate');
|
||||
});
|
||||
|
||||
/********** SHUFFLE ACTION **********/
|
||||
activeTab.find('button[id="shuffle_button"]').live("click", function(){
|
||||
buttonClickAction('shuffle', 'new-playlist/smart-block-shuffle');
|
||||
});
|
||||
|
||||
/********** CHANGE PLAYLIST TYPE **********/
|
||||
form.find('dd[id="sp_type-element"]').live("change", function(){
|
||||
setupUI();
|
||||
AIRTIME.library.checkAddButton();
|
||||
});
|
||||
|
||||
/********** CRITERIA CHANGE **********/
|
||||
form.find('select[id^="sp_criteria"]:not([id^="sp_criteria_modifier"])').live("change", function(){
|
||||
var index = getRowIndex($(this).parent());
|
||||
//need to change the criteria value for any modifier rows
|
||||
var critVal = $(this).val();
|
||||
var divs = $(this).parent().nextAll(':visible');
|
||||
$.each(divs, function(i, div){
|
||||
var critSelect = $(div).children('select[id^="sp_criteria_field"]');
|
||||
if (critSelect.hasClass('sp-invisible')) {
|
||||
critSelect.val(critVal);
|
||||
/* If the select box is visible we know the modifier rows
|
||||
* have ended
|
||||
*/
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
});
|
||||
|
||||
// disable extra field and hide the span
|
||||
disableAndHideExtraField($(this), index);
|
||||
populateModifierSelect(this, true);
|
||||
});
|
||||
|
||||
/********** MODIFIER CHANGE **********/
|
||||
form.find('select[id^="sp_criteria_modifier"]').live("change", function(){
|
||||
var criteria_value = $(this).next(),
|
||||
index_num = getRowIndex($(this).parent());
|
||||
|
||||
if ($(this).val() == 'is in the range') {
|
||||
enableAndShowExtraField(criteria_value, index_num);
|
||||
} else {
|
||||
disableAndHideExtraField(criteria_value, index_num);
|
||||
}
|
||||
});
|
||||
|
||||
setupUI();
|
||||
appendAddButton();
|
||||
appendModAddButton();
|
||||
removeButtonCheck();
|
||||
}
|
||||
|
||||
function getRowIndex(ele) {
|
||||
var id = ele.find('[name^="sp_criteria_field"]').attr('id'),
|
||||
delimiter = '_',
|
||||
start = 3,
|
||||
tokens = id.split(delimiter).slice(start),
|
||||
index = tokens.join(delimiter);
|
||||
|
||||
return index;
|
||||
}
|
||||
|
||||
/* This function appends a '+' button for the last
|
||||
* modifier row of each criteria.
|
||||
* If there are no modifier rows, the '+' button
|
||||
* remains at the criteria row
|
||||
*/
|
||||
function appendModAddButton() {
|
||||
var divs = $('.active-tab .smart-block-form').find('div select[name^="sp_criteria_modifier"]').parent(':visible');
|
||||
$.each(divs, function(i, div){
|
||||
if (i > 0) {
|
||||
/* If the criteria field is hidden we know it is a modifier row
|
||||
* and can hide the previous row's modifier add button
|
||||
*/
|
||||
if ($(div).find('select[name^="sp_criteria_field"]').hasClass('sp-invisible')) {
|
||||
$(div).prev().find('a[id^="modifier_add"]').addClass('sp-invisible');
|
||||
} else {
|
||||
$(div).prev().find('a[id^="modifier_add"]').removeClass('sp-invisible');
|
||||
}
|
||||
}
|
||||
|
||||
//always add modifier add button to the last row
|
||||
if (i+1 == divs.length) {
|
||||
$(div).find('a[id^="modifier_add"]').removeClass('sp-invisible');
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/* This function re-indexes all the form elements.
|
||||
* We need to do this everytime a row gets deleted
|
||||
*/
|
||||
function reindexElements() {
|
||||
var divs = $('.active-tab .smart-block-form').find('div select[name^="sp_criteria_field"]').parent(),
|
||||
index = 0,
|
||||
modIndex = 0;
|
||||
/* Hide all logic labels
|
||||
* We will re-add them as each row gets indexed
|
||||
*/
|
||||
$('.db-logic-label').text('').hide();
|
||||
|
||||
$.each(divs, function(i, div){
|
||||
if (i > 0 && index < 26) {
|
||||
|
||||
/* If the current row's criteria field is hidden we know it is
|
||||
* a modifier row
|
||||
*/
|
||||
if ($(div).find('select[name^="sp_criteria_field"]').hasClass('sp-invisible')) {
|
||||
if ($(div).is(':visible')) {
|
||||
$(div).prev().find('.db-logic-label').text('or').show();
|
||||
}
|
||||
modIndex++;
|
||||
} else {
|
||||
if ($(div).is(':visible')) {
|
||||
$(div).prev().find('.db-logic-label').text('and').show();
|
||||
}
|
||||
index++;
|
||||
modIndex = 0;
|
||||
}
|
||||
|
||||
$(div).find('select[name^="sp_criteria_field"]').attr('name', 'sp_criteria_field_'+index+'_'+modIndex);
|
||||
$(div).find('select[name^="sp_criteria_field"]').attr('id', 'sp_criteria_field_'+index+'_'+modIndex);
|
||||
$(div).find('select[name^="sp_criteria_modifier"]').attr('name', 'sp_criteria_modifier_'+index+'_'+modIndex);
|
||||
$(div).find('select[name^="sp_criteria_modifier"]').attr('id', 'sp_criteria_modifier_'+index+'_'+modIndex);
|
||||
$(div).find('input[name^="sp_criteria_value"]').attr('name', 'sp_criteria_value_'+index+'_'+modIndex);
|
||||
$(div).find('input[name^="sp_criteria_value"]').attr('id', 'sp_criteria_value_'+index+'_'+modIndex);
|
||||
$(div).find('input[name^="sp_criteria_extra"]').attr('name', 'sp_criteria_extra_'+index+'_'+modIndex);
|
||||
$(div).find('input[name^="sp_criteria_extra"]').attr('id', 'sp_criteria_extra_'+index+'_'+modIndex);
|
||||
$(div).find('a[name^="modifier_add"]').attr('id', 'modifier_add_'+index);
|
||||
$(div).find('a[id^="criteria_remove"]').attr('id', 'criteria_remove_'+index+'_'+modIndex);
|
||||
} else if (i > 0) {
|
||||
$(div).remove();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
function buttonClickAction(clickType, url){
|
||||
var data = $('.active-tab .smart-block-form').serializeArray(),
|
||||
obj_id = $('.active-tab .obj_id').val();
|
||||
|
||||
enableLoadingIcon();
|
||||
$.post(url, {format: "json", data: data, obj_id: obj_id}, function(data){
|
||||
callback(data, clickType);
|
||||
disableLoadingIcon();
|
||||
});
|
||||
}
|
||||
|
||||
function setupUI() {
|
||||
var activeTab = $('.active-tab'),
|
||||
playlist_type = activeTab.find('input:radio[name=sp_type]:checked').val();
|
||||
|
||||
/* Activate or Deactivate shuffle button
|
||||
* It is only active if playlist is not empty
|
||||
*/
|
||||
var sortable = activeTab.find('.spl_sortable'),
|
||||
plContents = sortable.children(),
|
||||
shuffleButton = activeTab.find('.sp-button, #pl-bl-clear-content');
|
||||
|
||||
if (!plContents.hasClass('spl_empty')) {
|
||||
if (shuffleButton.hasClass('ui-state-disabled')) {
|
||||
shuffleButton.removeClass('ui-state-disabled');
|
||||
shuffleButton.removeAttr('disabled');
|
||||
}
|
||||
} else if (!shuffleButton.hasClass('ui-state-disabled')) {
|
||||
shuffleButton.addClass('ui-state-disabled');
|
||||
shuffleButton.attr('disabled', 'disabled');
|
||||
}
|
||||
|
||||
if (activeTab.find('.obj_type').val() == 'block') {
|
||||
if (playlist_type == "0") {
|
||||
shuffleButton.parent().show();
|
||||
sortable.show();
|
||||
} else {
|
||||
shuffleButton.parent().hide();
|
||||
sortable.hide();
|
||||
}
|
||||
}
|
||||
|
||||
$(".playlist_type_help_icon").qtip({
|
||||
content: {
|
||||
text: $.i18n._("A static smart block will save the criteria and generate the block content immediately. This allows you to edit and view it in the Library before adding it to a show.")+"<br /><br />" +
|
||||
$.i18n._("A dynamic smart block will only save the criteria. The block content will get generated upon adding it to a show. You will not be able to view and edit the content in the Library.")
|
||||
},
|
||||
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"
|
||||
}
|
||||
});
|
||||
|
||||
$(".repeat_tracks_help_icon").qtip({
|
||||
content: {
|
||||
text: sprintf($.i18n._("The desired block length will not be reached if %s cannot find enough unique tracks to match your criteria. Enable this option if you wish to allow tracks to be added multiple times to the smart block."), PRODUCT_NAME)
|
||||
},
|
||||
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 enableAndShowExtraField(valEle, index) {
|
||||
var spanExtra = valEle.nextAll("#extra_criteria");
|
||||
spanExtra.children('#sp_criteria_extra_'+index).removeAttr("disabled");
|
||||
spanExtra.show();
|
||||
|
||||
//make value input smaller since we have extra element now
|
||||
var criteria_val = $('#sp_criteria_value_'+index);
|
||||
sizeTextBoxes(criteria_val, 'sp_input_text', 'sp_extra_input_text');
|
||||
}
|
||||
|
||||
function disableAndHideExtraField(valEle, index) {
|
||||
var spanExtra = valEle.nextAll("#extra_criteria");
|
||||
spanExtra.children('#sp_criteria_extra_'+index).val("").attr("disabled", "disabled");
|
||||
spanExtra.hide();
|
||||
|
||||
//make value input larger since we don't have extra field now
|
||||
var criteria_value = $('#sp_criteria_value_'+index);
|
||||
sizeTextBoxes(criteria_value, 'sp_extra_input_text', 'sp_input_text');
|
||||
}
|
||||
|
||||
function sizeTextBoxes(ele, classToRemove, classToAdd) {
|
||||
if (ele.hasClass(classToRemove)) {
|
||||
ele.removeClass(classToRemove).addClass(classToAdd);
|
||||
}
|
||||
}
|
||||
|
||||
function populateModifierSelect(e, popAllMods) {
|
||||
var criteria_type = getCriteriaOptionType(e),
|
||||
index = getRowIndex($(e).parent()),
|
||||
divs;
|
||||
|
||||
if (popAllMods) {
|
||||
index = index.substring(0, 1);
|
||||
}
|
||||
divs = $(e).parents().find('select[id^="sp_criteria_modifier_'+index+'"]');
|
||||
|
||||
$.each(divs, function(i, div){
|
||||
$(div).children().remove();
|
||||
|
||||
if (criteria_type == 's') {
|
||||
$.each(stringCriteriaOptions, function(key, value){
|
||||
$(div).append($('<option></option>')
|
||||
.attr('value', key)
|
||||
.text(value));
|
||||
});
|
||||
} else {
|
||||
$.each(numericCriteriaOptions, function(key, value){
|
||||
$(div).append($('<option></option>')
|
||||
.attr('value', key)
|
||||
.text(value));
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
function getCriteriaOptionType(e) {
|
||||
var criteria = $(e).val();
|
||||
return criteriaTypes[criteria];
|
||||
}
|
||||
|
||||
function callback(json, type) {
|
||||
var dt = $('table[id="library_display"]').dataTable(),
|
||||
form = $('.active-tab .smart-block-form');
|
||||
|
||||
if (type == 'shuffle' || type == 'generate') {
|
||||
if (json.error !== undefined) {
|
||||
alert(json.error);
|
||||
}
|
||||
AIRTIME.playlist.closeTab();
|
||||
AIRTIME.playlist.fnOpenPlaylist(json);
|
||||
if (json.result == "0") {
|
||||
if (type == 'shuffle') {
|
||||
form.find('.success').text($.i18n._('Smart block shuffled'));
|
||||
} else if (type == 'generate') {
|
||||
form.find('.success').text($.i18n._('Smart block generated and criteria saved'));
|
||||
//redraw library table so the length gets updated
|
||||
dt.fnStandingRedraw();
|
||||
}
|
||||
form.find('.success').show();
|
||||
}
|
||||
form.find('#smart_block_options').removeClass("closed");
|
||||
} else {
|
||||
AIRTIME.playlist.closeTab();
|
||||
AIRTIME.playlist.fnOpenPlaylist(json);
|
||||
if (json.result == "0") {
|
||||
$('.active-tab #sp-success-saved').text($.i18n._('Smart block saved')).show();
|
||||
|
||||
//redraw library table so the length gets updated
|
||||
dt.fnStandingRedraw();
|
||||
}
|
||||
form.find('#smart_block_options').removeClass("closed");
|
||||
}
|
||||
setTimeout(removeSuccessMsg, 5000);
|
||||
}
|
||||
|
||||
function appendAddButton() {
|
||||
var add_button = "<a class='btn btn-small' id='criteria_add'>" +
|
||||
"<i class='icon-white icon-plus'></i></a>";
|
||||
var rows = $('.active-tab #smart_block_options'),
|
||||
enabled = rows.find('select[name^="sp_criteria_field"]:enabled');
|
||||
|
||||
rows.find('#criteria_add').remove();
|
||||
|
||||
if (enabled.length > 1) {
|
||||
rows.find('select[name^="sp_criteria_field"]:enabled:last')
|
||||
.siblings('a[id^="criteria_remove"]')
|
||||
.after(add_button);
|
||||
} else {
|
||||
enabled.siblings('span[id="extra_criteria"]')
|
||||
.after(add_button);
|
||||
}
|
||||
}
|
||||
|
||||
function removeButtonCheck() {
|
||||
var rows = $('.active-tab dd[id="sp_criteria-element"]').children('div'),
|
||||
enabled = rows.find('select[name^="sp_criteria_field"]:enabled'),
|
||||
rmv_button = enabled.siblings('a[id^="criteria_remove"]');
|
||||
if (enabled.length == 1) {
|
||||
rmv_button.attr('disabled', 'disabled');
|
||||
rmv_button.hide();
|
||||
} else {
|
||||
rmv_button.removeAttr('disabled');
|
||||
rmv_button.show();
|
||||
}
|
||||
}
|
||||
|
||||
function enableLoadingIcon() {
|
||||
$(".side_playlist.active-tab").block({
|
||||
message: $.i18n._("Processing..."),
|
||||
theme: true,
|
||||
allowBodyStretch: true,
|
||||
applyPlatformOpacityRules: false
|
||||
});
|
||||
}
|
||||
|
||||
function disableLoadingIcon() {
|
||||
$(".side_playlist.active-tab").unblock()
|
||||
}
|
||||
// We need to know if the criteria value will be a string
|
||||
// or numeric value in order to populate the modifier
|
||||
// select list
|
||||
var criteriaTypes = {
|
||||
0 : "",
|
||||
"album_title" : "s",
|
||||
"bit_rate" : "n",
|
||||
"bpm" : "n",
|
||||
"composer" : "s",
|
||||
"conductor" : "s",
|
||||
"copyright" : "s",
|
||||
"cuein" : "n",
|
||||
"cueout" : "n",
|
||||
"artist_name" : "s",
|
||||
"encoded_by" : "s",
|
||||
"utime" : "n",
|
||||
"mtime" : "n",
|
||||
"lptime" : "n",
|
||||
"genre" : "s",
|
||||
"isrc_number" : "s",
|
||||
"label" : "s",
|
||||
"language" : "s",
|
||||
"length" : "n",
|
||||
"mime" : "s",
|
||||
"mood" : "s",
|
||||
"owner_id" : "s",
|
||||
"replay_gain" : "n",
|
||||
"sample_rate" : "n",
|
||||
"track_title" : "s",
|
||||
"track_number" : "n",
|
||||
"info_url" : "s",
|
||||
"year" : "n"
|
||||
};
|
||||
|
||||
var stringCriteriaOptions = {
|
||||
"0" : $.i18n._("Select modifier"),
|
||||
"contains" : $.i18n._("contains"),
|
||||
"does not contain" : $.i18n._("does not contain"),
|
||||
"is" : $.i18n._("is"),
|
||||
"is not" : $.i18n._("is not"),
|
||||
"starts with" : $.i18n._("starts with"),
|
||||
"ends with" : $.i18n._("ends with")
|
||||
};
|
||||
|
||||
var numericCriteriaOptions = {
|
||||
"0" : $.i18n._("Select modifier"),
|
||||
"is" : $.i18n._("is"),
|
||||
"is not" : $.i18n._("is not"),
|
||||
"is greater than" : $.i18n._("is greater than"),
|
||||
"is less than" : $.i18n._("is less than"),
|
||||
"is in the range" : $.i18n._("is in the range")
|
||||
};
|
|
@ -3,7 +3,8 @@ $(document).ready(function() {
|
|||
});
|
||||
|
||||
function setSmartBlockEvents() {
|
||||
var form = $('#smart-block-form');
|
||||
var activeTab = $('.active-tab'),
|
||||
form = activeTab.find('.smart-block-form');
|
||||
|
||||
/********** ADD CRITERIA ROW **********/
|
||||
form.find('#criteria_add').live('click', function(){
|
||||
|
@ -28,6 +29,7 @@ function setSmartBlockEvents() {
|
|||
form.find('a[id^="modifier_add"]').live('click', function(){
|
||||
var criteria_value = $(this).siblings('select[name^="sp_criteria_field"]').val();
|
||||
|
||||
|
||||
//make new modifier row
|
||||
var newRow = $(this).parent().clone(),
|
||||
newRowCrit = newRow.find('select[name^="sp_criteria_field"]'),
|
||||
|
@ -190,13 +192,13 @@ function setSmartBlockEvents() {
|
|||
// moved to spl.js
|
||||
|
||||
/********** GENERATE ACTION **********/
|
||||
$('button[id="generate_button"]').live("click", function(){
|
||||
buttonClickAction('generate', 'Playlist/smart-block-generate');
|
||||
activeTab.find('button[id="generate_button"]').live("click", function(){
|
||||
buttonClickAction('generate', 'playlist/smart-block-generate');
|
||||
});
|
||||
|
||||
/********** SHUFFLE ACTION **********/
|
||||
$('button[id="shuffle_button"]').live("click", function(){
|
||||
buttonClickAction('shuffle', 'Playlist/smart-block-shuffle');
|
||||
activeTab.find('button[id="shuffle_button"]').live("click", function(){
|
||||
buttonClickAction('shuffle', 'playlist/smart-block-shuffle');
|
||||
});
|
||||
|
||||
/********** CHANGE PLAYLIST TYPE **********/
|
||||
|
@ -262,7 +264,7 @@ function getRowIndex(ele) {
|
|||
* remains at the criteria row
|
||||
*/
|
||||
function appendModAddButton() {
|
||||
var divs = $('#smart-block-form').find('div select[name^="sp_criteria_modifier"]').parent(':visible');
|
||||
var divs = $('.active-tab .smart-block-form').find('div select[name^="sp_criteria_modifier"]').parent(':visible');
|
||||
$.each(divs, function(i, div){
|
||||
if (i > 0) {
|
||||
/* If the criteria field is hidden we know it is a modifier row
|
||||
|
@ -286,7 +288,7 @@ function appendModAddButton() {
|
|||
* We need to do this everytime a row gets deleted
|
||||
*/
|
||||
function reindexElements() {
|
||||
var divs = $('#smart-block-form').find('div select[name^="sp_criteria_field"]').parent(),
|
||||
var divs = $('.active-tab .smart-block-form').find('div select[name^="sp_criteria_field"]').parent(),
|
||||
index = 0,
|
||||
modIndex = 0;
|
||||
/* Hide all logic labels
|
||||
|
@ -330,8 +332,8 @@ function reindexElements() {
|
|||
}
|
||||
|
||||
function buttonClickAction(clickType, url){
|
||||
var data = $('#smart-block-form').serializeArray(),
|
||||
obj_id = $('.obj_id').val();
|
||||
var data = $('.active-tab .smart-block-form').serializeArray(),
|
||||
obj_id = $('.active-tab .obj_id').val();
|
||||
|
||||
enableLoadingIcon();
|
||||
$.post(url, {format: "json", data: data, obj_id: obj_id}, function(data){
|
||||
|
@ -341,17 +343,15 @@ function buttonClickAction(clickType, url){
|
|||
}
|
||||
|
||||
function setupUI() {
|
||||
var playlist_type = $('input:radio[name=sp_type]:checked').val();
|
||||
var target_length = $('input[name="sp_limit_value"]').val();
|
||||
if (target_length == '') {
|
||||
target_length = '0.0';
|
||||
}
|
||||
|
||||
var activeTab = $('.active-tab'),
|
||||
playlist_type = activeTab.find('input:radio[name=sp_type]:checked').val();
|
||||
|
||||
/* Activate or Deactivate shuffle button
|
||||
* It is only active if playlist is not empty
|
||||
*/
|
||||
var plContents = $('.spl_sortable').children();
|
||||
var shuffleButton = $('button[id="shuffle_button"], button[id="playlist_shuffle_button"], button[id="pl-bl-clear-content"]');
|
||||
var sortable = activeTab.find('.spl_sortable'),
|
||||
plContents = sortable.children(),
|
||||
shuffleButton = activeTab.find('.sp-button, #pl-bl-clear-content');
|
||||
|
||||
if (!plContents.hasClass('spl_empty')) {
|
||||
if (shuffleButton.hasClass('ui-state-disabled')) {
|
||||
|
@ -363,16 +363,13 @@ function setupUI() {
|
|||
shuffleButton.attr('disabled', 'disabled');
|
||||
}
|
||||
|
||||
var dynamic_length = target_length;
|
||||
if ($('.obj_type').val() == 'block') {
|
||||
if (activeTab.find('.obj_type').val() == 'block') {
|
||||
if (playlist_type == "0") {
|
||||
$('button[id="generate_button"]').show();
|
||||
$('button[id="shuffle_button"]').show();
|
||||
$('.spl_sortable').show();
|
||||
shuffleButton.parent().show();
|
||||
sortable.show();
|
||||
} else {
|
||||
$('button[id="generate_button"]').hide();
|
||||
$('button[id="shuffle_button"]').hide();
|
||||
$('.spl_sortable').hide();
|
||||
shuffleButton.parent().hide();
|
||||
sortable.hide();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -395,7 +392,7 @@ function setupUI() {
|
|||
position: {
|
||||
my: "left bottom",
|
||||
at: "right center"
|
||||
},
|
||||
}
|
||||
});
|
||||
|
||||
$(".repeat_tracks_help_icon").qtip({
|
||||
|
@ -416,7 +413,7 @@ function setupUI() {
|
|||
position: {
|
||||
my: "left bottom",
|
||||
at: "right center"
|
||||
},
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
@ -481,14 +478,15 @@ function getCriteriaOptionType(e) {
|
|||
}
|
||||
|
||||
function callback(json, type) {
|
||||
var dt = $('table[id="library_display"]').dataTable();
|
||||
var dt = $('table[id="library_display"]').dataTable(),
|
||||
form = $('.active-tab .smart-block-form');
|
||||
|
||||
if (type == 'shuffle' || type == 'generate') {
|
||||
if (json.error !== undefined) {
|
||||
alert(json.error);
|
||||
}
|
||||
AIRTIME.playlist.closeTab();
|
||||
AIRTIME.playlist.fnOpenPlaylist(json);
|
||||
var form = $('#smart-block-form');
|
||||
if (json.result == "0") {
|
||||
if (type == 'shuffle') {
|
||||
form.find('.success').text($.i18n._('Smart block shuffled'));
|
||||
|
@ -501,14 +499,12 @@ function callback(json, type) {
|
|||
}
|
||||
form.find('#smart_block_options').removeClass("closed");
|
||||
} else {
|
||||
AIRTIME.playlist.closeTab();
|
||||
AIRTIME.playlist.fnOpenPlaylist(json);
|
||||
var form = $('#smart-block-form');
|
||||
if (json.result == "0") {
|
||||
$('#sp-success-saved').text($.i18n._('Smart block saved'));
|
||||
$('#sp-success-saved').show();
|
||||
$('.active-tab #sp-success-saved').text($.i18n._('Smart block saved')).show();
|
||||
|
||||
//redraw library table so the length gets updated
|
||||
var dt = $('table[id="library_display"]').dataTable();
|
||||
dt.fnStandingRedraw();
|
||||
}
|
||||
form.find('#smart_block_options').removeClass("closed");
|
||||
|
@ -519,7 +515,7 @@ function callback(json, type) {
|
|||
function appendAddButton() {
|
||||
var add_button = "<a class='btn btn-small' id='criteria_add'>" +
|
||||
"<i class='icon-white icon-plus'></i></a>";
|
||||
var rows = $('#smart_block_options'),
|
||||
var rows = $('.active-tab #smart_block_options'),
|
||||
enabled = rows.find('select[name^="sp_criteria_field"]:enabled');
|
||||
|
||||
rows.find('#criteria_add').remove();
|
||||
|
@ -535,7 +531,7 @@ function appendAddButton() {
|
|||
}
|
||||
|
||||
function removeButtonCheck() {
|
||||
var rows = $('dd[id="sp_criteria-element"]').children('div'),
|
||||
var rows = $('.active-tab dd[id="sp_criteria-element"]').children('div'),
|
||||
enabled = rows.find('select[name^="sp_criteria_field"]:enabled'),
|
||||
rmv_button = enabled.siblings('a[id^="criteria_remove"]');
|
||||
if (enabled.length == 1) {
|
||||
|
@ -548,7 +544,7 @@ function removeButtonCheck() {
|
|||
}
|
||||
|
||||
function enableLoadingIcon() {
|
||||
$(".side_playlist").block({
|
||||
$(".side_playlist.active-tab").block({
|
||||
message: $.i18n._("Processing..."),
|
||||
theme: true,
|
||||
allowBodyStretch: true,
|
||||
|
@ -557,7 +553,7 @@ function enableLoadingIcon() {
|
|||
}
|
||||
|
||||
function disableLoadingIcon() {
|
||||
$(".side_playlist").unblock()
|
||||
$(".side_playlist.active-tab").unblock()
|
||||
}
|
||||
// We need to know if the criteria value will be a string
|
||||
// or numeric value in order to populate the modifier
|
||||
|
|
File diff suppressed because it is too large
Load diff
|
@ -1,360 +0,0 @@
|
|||
AIRTIME = (function(AIRTIME) {
|
||||
|
||||
var viewport,
|
||||
$lib,
|
||||
$libWrapper,
|
||||
$builder,
|
||||
$fs,
|
||||
widgetHeight,
|
||||
screenWidth,
|
||||
resizeTimeout,
|
||||
oBaseDatePickerSettings,
|
||||
oBaseTimePickerSettings,
|
||||
oRange,
|
||||
dateStartId = "#sb_date_start",
|
||||
timeStartId = "#sb_time_start",
|
||||
dateEndId = "#sb_date_end",
|
||||
timeEndId = "#sb_time_end",
|
||||
mod;
|
||||
|
||||
if (AIRTIME.builderMain === undefined) {
|
||||
AIRTIME.builderMain = {};
|
||||
}
|
||||
mod = AIRTIME.builderMain;
|
||||
|
||||
oBaseDatePickerSettings = {
|
||||
dateFormat: 'yy-mm-dd',
|
||||
//i18n_months, i18n_days_short are in common.js
|
||||
monthNames: i18n_months,
|
||||
dayNamesMin: i18n_days_short,
|
||||
onClick: function(sDate, oDatePicker) {
|
||||
$(this).datepicker( "setDate", sDate );
|
||||
},
|
||||
onClose: validateTimeRange
|
||||
};
|
||||
|
||||
oBaseTimePickerSettings = {
|
||||
showPeriodLabels: false,
|
||||
showCloseButton: true,
|
||||
closeButtonText: $.i18n._("Done"),
|
||||
showLeadingZero: false,
|
||||
defaultTime: '0:00',
|
||||
hourText: $.i18n._("Hour"),
|
||||
minuteText: $.i18n._("Minute"),
|
||||
onClose: validateTimeRange
|
||||
};
|
||||
|
||||
function setWidgetSize() {
|
||||
viewport = AIRTIME.utilities.findViewportDimensions();
|
||||
widgetHeight = viewport.height - 180;
|
||||
screenWidth = Math.floor(viewport.width - 50);
|
||||
|
||||
var libTableHeight = widgetHeight - 175,
|
||||
builderTableHeight = widgetHeight - 95,
|
||||
oTable;
|
||||
|
||||
if ($fs.is(':visible')) {
|
||||
builderTableHeight = builderTableHeight - 40;
|
||||
}
|
||||
|
||||
//set the heights of the main widgets.
|
||||
$builder//.height(widgetHeight)
|
||||
.find(".dataTables_scrolling")
|
||||
//.css("max-height", builderTableHeight)
|
||||
.end();
|
||||
//.width(screenWidth);
|
||||
|
||||
$lib//.height(widgetHeight)
|
||||
.find(".dataTables_scrolling")
|
||||
//.css("max-height", libTableHeight)
|
||||
.end();
|
||||
|
||||
if ($lib.filter(':visible').length > 0) {
|
||||
|
||||
//$lib.width(Math.floor(screenWidth * 0.47));
|
||||
|
||||
$builder//.width(Math.floor(screenWidth * 0.47))
|
||||
.find("#sb_edit")
|
||||
.remove()
|
||||
.end()
|
||||
.find("#sb_date_start")
|
||||
.css("margin-left", 0)
|
||||
.end();
|
||||
|
||||
oTable = $('#show_builder_table').dataTable();
|
||||
//oTable.fnDraw();
|
||||
}
|
||||
}
|
||||
|
||||
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,
|
||||
op,
|
||||
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();
|
||||
}
|
||||
}
|
||||
|
||||
mod.onReady = function() {
|
||||
// Normally we would just use audio/*, but it includes file types that we can't handle (like .m4a)
|
||||
// We initialize the acceptedMimeTypes variable in Bootstrap so we don't have to duplicate the list
|
||||
Dropzone.options.content = {
|
||||
url:'/rest/media',
|
||||
clickable: false,
|
||||
acceptedFiles: acceptedMimeTypes.join(),
|
||||
init: function () {
|
||||
this.on("sending", function (file, xhr, data) {
|
||||
data.append("csrf_token", $("#csrf").val());
|
||||
});
|
||||
},
|
||||
dictDefaultMessage: '',
|
||||
createImageThumbnails: false,
|
||||
previewTemplate : '<div style="display:none"></div>'
|
||||
};
|
||||
|
||||
// define module vars.
|
||||
$lib = $("#library_content");
|
||||
$builder = $("#show_builder");
|
||||
$fs = $builder.find('fieldset');
|
||||
|
||||
$("#schedule-tab").on("click", function() {
|
||||
if (!$(this).hasClass('active')) {
|
||||
AIRTIME.showbuilder.switchTab($("#show_builder .outer-datatable-wrapper"), $(this));
|
||||
}
|
||||
});
|
||||
|
||||
/*
|
||||
* Icon hover states for search.
|
||||
*/
|
||||
$builder.on("mouseenter", ".sb-timerange .ui-button", function(ev) {
|
||||
$(this).addClass("ui-state-hover");
|
||||
});
|
||||
$builder.on("mouseleave", ".sb-timerange .ui-button", function(ev) {
|
||||
$(this).removeClass("ui-state-hover");
|
||||
});
|
||||
|
||||
$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);
|
||||
AIRTIME.showbuilder.fnServerData.start = oRange.start;
|
||||
AIRTIME.showbuilder.fnServerData.end = oRange.end;
|
||||
|
||||
//the user might not have the library on the page (guest user)
|
||||
if (AIRTIME.library !== undefined) {
|
||||
AIRTIME.library.libraryInit();
|
||||
}
|
||||
|
||||
AIRTIME.showbuilder.builderDataTable();
|
||||
setWidgetSize();
|
||||
|
||||
$libWrapper = $lib.find("#library_display_wrapper");
|
||||
//$builder.find('.dataTables_scrolling').css("max-height",
|
||||
// widgetHeight - 95);
|
||||
|
||||
$builder.on("click", "#sb_submit", showSearchSubmit);
|
||||
|
||||
$builder.on("click", "#sb_edit", function(ev) {
|
||||
var schedTable = $("#show_builder_table").dataTable();
|
||||
|
||||
// reset timestamp to redraw the cursors.
|
||||
AIRTIME.showbuilder.resetTimestamp();
|
||||
|
||||
$lib.show().width(Math.floor(screenWidth * 0.48));
|
||||
|
||||
$builder.width(Math.floor(screenWidth * 0.48)).find("#sb_edit")
|
||||
.remove().end().find("#sb_date_start")
|
||||
.css("margin-left", 0).end();
|
||||
|
||||
schedTable.fnDraw();
|
||||
|
||||
$.ajax( {
|
||||
url : baseUrl+"usersettings/set-now-playing-screen-settings",
|
||||
type : "POST",
|
||||
data : {
|
||||
settings : {
|
||||
library : true
|
||||
},
|
||||
format : "json"
|
||||
},
|
||||
dataType : "json",
|
||||
success : function() {
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
$lib.on("click", "#sb_lib_close", function() {
|
||||
var schedTable = $("#show_builder_table").dataTable();
|
||||
|
||||
$lib.hide();
|
||||
$builder.width(screenWidth).find(".sb-timerange").find("#sb_date_start").css("margin-left", 30)
|
||||
.end().end();
|
||||
|
||||
schedTable.fnDraw();
|
||||
|
||||
$.ajax( {
|
||||
url : baseUrl+"usersettings/set-now-playing-screen-settings",
|
||||
type : "POST",
|
||||
data : {
|
||||
settings : {
|
||||
library : false
|
||||
},
|
||||
format : "json"
|
||||
},
|
||||
dataType : "json",
|
||||
success : function() {
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
$builder.find('legend').click(
|
||||
function(ev, item) {
|
||||
|
||||
if ($fs.hasClass("closed")) {
|
||||
|
||||
$fs.removeClass("closed");
|
||||
//$builder.find('.dataTables_scrolling').css(
|
||||
// "max-height", widgetHeight - 150);
|
||||
} else {
|
||||
$fs.addClass("closed");
|
||||
|
||||
// set defaults for the options.
|
||||
$fs.find('select').val(0);
|
||||
$fs.find('input[type="checkbox"]').attr("checked",
|
||||
false);
|
||||
//$builder.find('.dataTables_scrolling').css(
|
||||
// "max-height", widgetHeight - 110);
|
||||
}
|
||||
});
|
||||
|
||||
// set click event for all my shows checkbox.
|
||||
$builder.on("click", "#sb_my_shows", function(ev) {
|
||||
|
||||
if ($(this).is(':checked')) {
|
||||
$(ev.delegateTarget).find('#sb_show_filter').val(0);
|
||||
}
|
||||
|
||||
showSearchSubmit();
|
||||
});
|
||||
|
||||
//set select event for choosing a show.
|
||||
$builder.on("change", '#sb_show_filter', function(ev) {
|
||||
|
||||
if ($(this).val() !== 0) {
|
||||
$(ev.delegateTarget).find('#sb_my_shows')
|
||||
.attr("checked", false);
|
||||
}
|
||||
|
||||
showSearchSubmit();
|
||||
|
||||
});
|
||||
|
||||
function checkScheduleUpdates() {
|
||||
var data = {}, oTable = $('#show_builder_table').dataTable(), fn = oTable
|
||||
.fnSettings().fnServerData, start = fn.start, end = fn.end;
|
||||
|
||||
data["format"] = "json";
|
||||
data["start"] = start;
|
||||
data["end"] = end;
|
||||
data["timestamp"] = AIRTIME.showbuilder.getTimestamp();
|
||||
data["instances"] = AIRTIME.showbuilder.getShowInstances();
|
||||
|
||||
if (fn.hasOwnProperty("ops")) {
|
||||
data["myShows"] = fn.ops.myShows;
|
||||
data["showFilter"] = fn.ops.showFilter;
|
||||
data["showInstanceFilter"] = fn.ops.showInstanceFilter;
|
||||
}
|
||||
|
||||
$.ajax( {
|
||||
"dataType" : "json",
|
||||
"type" : "GET",
|
||||
"url" : baseUrl+"showbuilder/check-builder-feed",
|
||||
"data" : data,
|
||||
"success" : function(json) {
|
||||
if (json.update === true) {
|
||||
oTable.fnDraw();
|
||||
}
|
||||
setTimeout(checkScheduleUpdates, 5000);
|
||||
}
|
||||
});
|
||||
|
||||
//check if the timeline view needs updating.
|
||||
setTimeout(checkScheduleUpdates, 5000);
|
||||
}
|
||||
};
|
||||
|
||||
mod.onResize = function() {
|
||||
|
||||
clearTimeout(resizeTimeout);
|
||||
resizeTimeout = setTimeout(setWidgetSize, 100);
|
||||
};
|
||||
|
||||
return AIRTIME;
|
||||
|
||||
} (AIRTIME || {}));
|
||||
|
||||
$(document).ready(AIRTIME.builderMain.onReady);
|
||||
$(window).resize(AIRTIME.builderMain.onResize);
|
File diff suppressed because it is too large
Load diff
|
@ -15,12 +15,6 @@ AIRTIME = (function(AIRTIME) {
|
|||
timeStartId = "#sb_time_start",
|
||||
dateEndId = "#sb_date_end",
|
||||
timeEndId = "#sb_time_end",
|
||||
$toggleLib = $("<a id='sb_edit' class='btn btn-small' href='#' title='"+$.i18n._("Open library to add or remove content")+"'>"+$.i18n._("Add / Remove Content")+"</a>"),
|
||||
$libClose = $('<a />', {
|
||||
"class": "close-round",
|
||||
"href": "#",
|
||||
"id": "sb_lib_close"
|
||||
}),
|
||||
mod;
|
||||
|
||||
if (AIRTIME.builderMain === undefined) {
|
||||
|
@ -64,22 +58,22 @@ AIRTIME = (function(AIRTIME) {
|
|||
}
|
||||
|
||||
//set the heights of the main widgets.
|
||||
$builder.height(widgetHeight)
|
||||
$builder//.height(widgetHeight)
|
||||
.find(".dataTables_scrolling")
|
||||
.css("max-height", builderTableHeight)
|
||||
.end()
|
||||
.width(screenWidth);
|
||||
//.css("max-height", builderTableHeight)
|
||||
.end();
|
||||
//.width(screenWidth);
|
||||
|
||||
$lib.height(widgetHeight)
|
||||
$lib//.height(widgetHeight)
|
||||
.find(".dataTables_scrolling")
|
||||
.css("max-height", libTableHeight)
|
||||
//.css("max-height", libTableHeight)
|
||||
.end();
|
||||
|
||||
if ($lib.filter(':visible').length > 0) {
|
||||
|
||||
$lib.width(Math.floor(screenWidth * 0.47));
|
||||
//$lib.width(Math.floor(screenWidth * 0.47));
|
||||
|
||||
$builder.width(Math.floor(screenWidth * 0.47))
|
||||
$builder//.width(Math.floor(screenWidth * 0.47))
|
||||
.find("#sb_edit")
|
||||
.remove()
|
||||
.end()
|
||||
|
@ -150,11 +144,33 @@ AIRTIME = (function(AIRTIME) {
|
|||
}
|
||||
|
||||
mod.onReady = function() {
|
||||
// Normally we would just use audio/*, but it includes file types that we can't handle (like .m4a)
|
||||
// We initialize the acceptedMimeTypes variable in Bootstrap so we don't have to duplicate the list
|
||||
Dropzone.options.content = {
|
||||
url:'/rest/media',
|
||||
clickable: false,
|
||||
acceptedFiles: acceptedMimeTypes.join(),
|
||||
init: function () {
|
||||
this.on("sending", function (file, xhr, data) {
|
||||
data.append("csrf_token", $("#csrf").val());
|
||||
});
|
||||
},
|
||||
dictDefaultMessage: '',
|
||||
createImageThumbnails: false,
|
||||
previewTemplate : '<div style="display:none"></div>'
|
||||
};
|
||||
|
||||
// define module vars.
|
||||
$lib = $("#library_content");
|
||||
$builder = $("#show_builder");
|
||||
$fs = $builder.find('fieldset');
|
||||
|
||||
$("#schedule-tab").on("click", function() {
|
||||
if (!$(this).hasClass('active')) {
|
||||
AIRTIME.showbuilder.switchTab($("#show_builder .outer-datatable-wrapper"), $(this));
|
||||
}
|
||||
});
|
||||
|
||||
/*
|
||||
* Icon hover states for search.
|
||||
*/
|
||||
|
@ -196,10 +212,8 @@ AIRTIME = (function(AIRTIME) {
|
|||
setWidgetSize();
|
||||
|
||||
$libWrapper = $lib.find("#library_display_wrapper");
|
||||
$libWrapper.prepend($libClose);
|
||||
|
||||
$builder.find('.dataTables_scrolling').css("max-height",
|
||||
widgetHeight - 95);
|
||||
//$builder.find('.dataTables_scrolling').css("max-height",
|
||||
// widgetHeight - 95);
|
||||
|
||||
$builder.on("click", "#sb_submit", showSearchSubmit);
|
||||
|
||||
|
@ -236,11 +250,9 @@ AIRTIME = (function(AIRTIME) {
|
|||
var schedTable = $("#show_builder_table").dataTable();
|
||||
|
||||
$lib.hide();
|
||||
$builder.width(screenWidth).find(".sb-timerange").prepend(
|
||||
$toggleLib).find("#sb_date_start").css("margin-left", 30)
|
||||
$builder.width(screenWidth).find(".sb-timerange").find("#sb_date_start").css("margin-left", 30)
|
||||
.end().end();
|
||||
|
||||
$toggleLib.removeClass("ui-state-hover");
|
||||
schedTable.fnDraw();
|
||||
|
||||
$.ajax( {
|
||||
|
@ -264,8 +276,8 @@ AIRTIME = (function(AIRTIME) {
|
|||
if ($fs.hasClass("closed")) {
|
||||
|
||||
$fs.removeClass("closed");
|
||||
$builder.find('.dataTables_scrolling').css(
|
||||
"max-height", widgetHeight - 150);
|
||||
//$builder.find('.dataTables_scrolling').css(
|
||||
// "max-height", widgetHeight - 150);
|
||||
} else {
|
||||
$fs.addClass("closed");
|
||||
|
||||
|
@ -273,8 +285,8 @@ AIRTIME = (function(AIRTIME) {
|
|||
$fs.find('select').val(0);
|
||||
$fs.find('input[type="checkbox"]').attr("checked",
|
||||
false);
|
||||
$builder.find('.dataTables_scrolling').css(
|
||||
"max-height", widgetHeight - 110);
|
||||
//$builder.find('.dataTables_scrolling').css(
|
||||
// "max-height", widgetHeight - 110);
|
||||
}
|
||||
});
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue