CC-3174 : showbuilder

mostly done with new context menu, need to finish
add/delete button actions on lib table for both screens.
This commit is contained in:
Naomi Aro 2012-02-05 18:19:22 +01:00
parent da5e1ac302
commit 6c2475bf1f
9 changed files with 305 additions and 424 deletions

View file

@ -1,80 +1,92 @@
function fnLibraryTableRowCallback( nRow, aData, iDisplayIndex, iDisplayIndexFull ) {
var jRow = $(nRow);
var AIRTIME = (function(AIRTIME){
var mod;
jRow.attr("id", aData["tr_id"]);
jRow.addClass("lib-sb");
//save some info for reordering purposes.
jRow.data({"aData": aData});
}
function fnLibraryTableDrawCallback() {
if (AIRTIME.library === undefined) {
AIRTIME.library = {}
}
$('#library_display tr:not(:first)').draggable({
helper: 'clone',
cursor: 'pointer',
connectToSortable: '#show_builder_table'
});
}
function setupLibraryToolbar(oLibTable) {
var aButtons,
fnTest,
fnResetCol,
fnAddSelectedItems,
oSchedTable = $("#show_builder_table").dataTable(),
oLibTT = TableTools.fnGetInstance('library_display'),
oSchedTT = TableTools.fnGetInstance('show_builder_table');
AIRTIME.library.events = {};
mod = AIRTIME.library.events;
fnTest = function() {
alert("hi");
};
fnResetCol = function () {
ColReorder.fnReset( oLibTable );
return false;
};
fnAddSelectedItems = function() {
var aData = oLibTT.fnGetSelectedData(),
item,
temp,
aMediaIds = [],
aSchedIds = [];
mod.fnRowCallback = function( nRow, aData, iDisplayIndex, iDisplayIndexFull ) {
var $nRow = $(nRow);
//process selected files/playlists.
for (item in aData) {
temp = aData[item];
if (temp !== null && temp.hasOwnProperty('id')) {
aMediaIds.push({"id": temp.id, "type": temp.ftype});
}
}
$nRow.attr("id", aData["tr_id"])
.data("aData", aData)
.data("screen", "timeline");
}
aData = oSchedTT.fnGetSelectedData();
mod.fnDrawCallback = function() {
//process selected schedule rows to add media after.
for (item in aData) {
temp = aData[item];
if (temp !== null && temp.hasOwnProperty('id')) {
aSchedIds.push({"id": temp.id, "instance": temp.instance});
}
}
$.post("/showbuilder/schedule-add",
{"format": "json", "mediaIds": aMediaIds, "schedIds": aSchedIds},
function(json){
oLibTT.fnSelectNone();
oSchedTT.fnSelectNone();
oSchedTable.fnDraw();
});
};
//[0] = button text
//[1] = id
//[2] = enabled
//[3] = click event
aButtons = [["Reset Order", "library_order_reset", true, fnResetCol],
["Delete", "library_group_delete", true, fnTest],
["Add", "library_group_add", true, fnAddSelectedItems]];
$('#library_display tr:not(:first)').draggable({
helper: 'clone',
cursor: 'pointer',
connectToSortable: '#show_builder_table'
});
}
addToolBarButtonsLibrary(aButtons);
}
mod.setupLibraryToolbar = function(oLibTable) {
var aButtons,
fnTest,
fnResetCol,
fnAddSelectedItems,
fnTest = function() {
alert("hi");
};
fnResetCol = function () {
ColReorder.fnReset( oLibTable );
return false;
};
fnAddSelectedItems = function() {
var aData = oLibTT.fnGetSelectedData(),
item,
temp,
aMediaIds = [],
aSchedIds = [],
oSchedTable = $("#show_builder_table").dataTable(),
oLibTT = TableTools.fnGetInstance('library_display'),
oSchedTT = TableTools.fnGetInstance('show_builder_table');;
//process selected files/playlists.
for (item in aData) {
temp = aData[item];
if (temp !== null && temp.hasOwnProperty('id')) {
aMediaIds.push({"id": temp.id, "type": temp.ftype});
}
}
aData = oSchedTT.fnGetSelectedData();
//process selected schedule rows to add media after.
for (item in aData) {
temp = aData[item];
if (temp !== null && temp.hasOwnProperty('id')) {
aSchedIds.push({"id": temp.id, "instance": temp.instance});
}
}
$.post("/showbuilder/schedule-add",
{"format": "json", "mediaIds": aMediaIds, "schedIds": aSchedIds},
function(json){
oLibTT.fnSelectNone();
oSchedTT.fnSelectNone();
oSchedTable.fnDraw();
});
};
//[0] = button text
//[1] = id
//[2] = enabled
//[3] = click event
aButtons = [["Reset Order", "library_order_reset", true, fnResetCol],
["Delete", "library_group_delete", true, fnTest],
["Add", "library_group_add", true, fnAddSelectedItems]];
addToolBarButtonsLibrary(aButtons);
}
return AIRTIME;
}(AIRTIME || {}));