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,61 +1,67 @@
function fnLibraryTableRowCallback( nRow, aData, iDisplayIndex, iDisplayIndexFull ) {
var AIRTIME = (function(AIRTIME){
var mod;
if (AIRTIME.library === undefined) {
AIRTIME.library = {}
}
AIRTIME.library.events = {};
mod = AIRTIME.library.events;
mod.fnRowCallback = function( nRow, aData, iDisplayIndex, iDisplayIndexFull ) {
var $nRow = $(nRow);
$nRow.attr("id", aData["tr_id"])
.data("aData", aData)
.data("screen", "playlist");
}
mod.fnDrawCallback = function() {
$('#library_display tr[id ^= "au"]').draggable({
helper: 'clone',
/* customize the helper on dragging to look like a pl item
*
helper: function(ev) {
var data, li;
data = $(ev.currentTarget).data("aData");
li = $("<li></li>");
li.append(data.track_title);
return li;
},
*/
cursor: 'pointer',
connectToSortable: '#spl_sortable'
});
}
/*
* @param oTable the datatables instance for the library.
*/
mod.setupLibraryToolbar = function( oLibTable ) {
var aButtons,
fnResetCol;
fnResetCol = function () {
ColReorder.fnReset( oLibTable );
return false;
};
//[0] = button text
//[1] = id
//[2] = enabled
//[3] = click event
aButtons = [["Reset Order", "library_order_reset", true, fnResetCol],
["Delete", "library_group_delete", true],
["Add", "library_group_add", true]];
addToolBarButtonsLibrary(aButtons);
}
$(nRow).attr("id", aData["tr_id"]);
$(nRow).data("aData", aData);
//var oTT = TableTools.fnGetInstance('library_display');
//oTT.fnSelect(el);
/*
$(nRow).find('td')
.jjmenu("rightClick",
[{get:"/Library/context-menu/format/json/id/#id#/type/#type#"}],
{id: aData["id"], type: aData["ftype"]},
{xposition: "mouse", yposition: "mouse"});
*/
}
function fnLibraryTableDrawCallback() {
return AIRTIME;
$('#library_display tr[id ^= "au"]').draggable({
helper: 'clone',
/*
helper: function(ev) {
var data, li;
data = $(ev.currentTarget).data("aData");
li = $("<li></li>");
li.append(data.track_title);
return li;
},
*/
cursor: 'pointer',
connectToSortable: '#spl_sortable'
});
}
/*
* @param oTable the datatables instance for the library.
*/
function setupLibraryToolbar(oLibTable) {
var aButtons,
oLibTT = TableTools.fnGetInstance('library_display'),
fnResetCol;
fnResetCol = function () {
ColReorder.fnReset( oLibTable );
return false;
};
//[0] = button text
//[1] = id
//[2] = enabled
//[3] = click event
aButtons = [["Reset Order", "library_order_reset", true, fnResetCol],
["Delete", "library_group_delete", true],
["Add", "library_group_add", true]];
addToolBarButtonsLibrary(aButtons);
}
}(AIRTIME || {}));

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 || {}));