CC-3545 : Calendar->AddRemove (Now Playing Tab->Add Files to Show) -> changing order of tracks is not correct

removing table tools.
replacing with something simpler that will preserve order on screen.
This commit is contained in:
Naomi Aro 2012-04-02 19:03:11 +02:00
parent c5b761bff3
commit 6c25423f4e
9 changed files with 240 additions and 243 deletions

View File

@ -120,7 +120,6 @@ class PlaylistController extends Zend_Controller_Action
$this->view->headScript()->appendFile($baseUrl.'/js/datatables/plugin/dataTables.ColVis.js?'.$CC_CONFIG['airtime_version'],'text/javascript');
$this->view->headScript()->appendFile($baseUrl.'/js/datatables/plugin/dataTables.ColReorder.js?'.$CC_CONFIG['airtime_version'],'text/javascript');
$this->view->headScript()->appendFile($baseUrl.'/js/datatables/plugin/dataTables.FixedColumns.js?'.$CC_CONFIG['airtime_version'],'text/javascript');
$this->view->headScript()->appendFile($baseUrl.'/js/datatables/plugin/dataTables.TableTools.js?'.$CC_CONFIG['airtime_version'],'text/javascript');
$this->view->headScript()->appendFile($baseUrl.'/js/airtime/buttons/buttons.js?'.$CC_CONFIG['airtime_version'],'text/javascript');
$this->view->headScript()->appendFile($baseUrl.'/js/airtime/utilities/utilities.js?'.$CC_CONFIG['airtime_version'],'text/javascript');
@ -131,7 +130,6 @@ class PlaylistController extends Zend_Controller_Action
$this->view->headLink()->appendStylesheet($baseUrl.'/css/jquery.contextMenu.css?'.$CC_CONFIG['airtime_version']);
$this->view->headLink()->appendStylesheet($baseUrl.'/css/datatables/css/ColVis.css?'.$CC_CONFIG['airtime_version']);
$this->view->headLink()->appendStylesheet($baseUrl.'/css/datatables/css/ColReorder.css?'.$CC_CONFIG['airtime_version']);
$this->view->headLink()->appendStylesheet($baseUrl.'/css/TableTools.css?'.$CC_CONFIG['airtime_version']);
$this->view->headScript()->appendFile($baseUrl.'/js/airtime/library/spl.js?'.$CC_CONFIG['airtime_version'],'text/javascript');
$this->view->headLink()->appendStylesheet($baseUrl.'/css/playlist_builder.css?'.$CC_CONFIG['airtime_version']);

View File

@ -30,8 +30,7 @@ class ShowbuilderController extends Zend_Controller_Action
$this->view->headScript()->appendFile($baseUrl.'/js/datatables/plugin/dataTables.ColVis.js?'.$CC_CONFIG['airtime_version'],'text/javascript');
$this->view->headScript()->appendFile($baseUrl.'/js/datatables/plugin/dataTables.ColReorder.js?'.$CC_CONFIG['airtime_version'],'text/javascript');
$this->view->headScript()->appendFile($baseUrl.'/js/datatables/plugin/dataTables.FixedColumns.js?'.$CC_CONFIG['airtime_version'],'text/javascript');
$this->view->headScript()->appendFile($baseUrl.'/js/datatables/plugin/dataTables.TableTools.js?'.$CC_CONFIG['airtime_version'],'text/javascript');
$this->view->headScript()->appendFile($baseUrl.'/js/airtime/buttons/buttons.js?'.$CC_CONFIG['airtime_version'],'text/javascript');
$this->view->headScript()->appendFile($baseUrl.'/js/airtime/utilities/utilities.js?'.$CC_CONFIG['airtime_version'],'text/javascript');
$this->view->headScript()->appendFile($baseUrl.'/js/airtime/library/library.js?'.$CC_CONFIG['airtime_version'],'text/javascript');
@ -40,8 +39,7 @@ class ShowbuilderController extends Zend_Controller_Action
$this->view->headLink()->appendStylesheet($baseUrl.'/css/jquery.contextMenu.css?'.$CC_CONFIG['airtime_version']);
$this->view->headLink()->appendStylesheet($baseUrl.'/css/datatables/css/ColVis.css?'.$CC_CONFIG['airtime_version']);
$this->view->headLink()->appendStylesheet($baseUrl.'/css/datatables/css/ColReorder.css?'.$CC_CONFIG['airtime_version']);
$this->view->headLink()->appendStylesheet($baseUrl.'/css/TableTools.css?'.$CC_CONFIG['airtime_version']);
$this->view->headScript()->appendFile($this->view->baseUrl('/js/airtime/library/events/library_showbuilder.js?'.$CC_CONFIG['airtime_version']),'text/javascript');
$user = Application_Model_User::GetCurrentUser();

View File

@ -1,7 +1,7 @@
.lib-content .fg-toolbar ul {
float: left;
padding: 0;
margin: 0.5em 0 0 0;
margin: 0.5em 0 0 10px;
cursor: pointer;
}
@ -12,6 +12,13 @@
margin-right: 5px;
}
.lib-selected.even {
background-color: rgba(240, 109, 53, 1);
}
.lib-selected.odd {
background-color: rgba(255, 136, 56, 1);
}
#library_content {
float: left;
width: 50%;

View File

@ -12,6 +12,13 @@
margin-left: -16px;
}
.sb-selected.even {
background-color: rgba(240, 109, 53, 1);
}
.sb-selected.odd {
background-color: rgba(255, 136, 56, 1);
}
#sb_edit {
position: relative;
top: 2px;
@ -24,7 +31,7 @@
.sb-content .fg-toolbar ul {
float: left;
padding: 0;
margin: 0.5em 10px 0 0;
margin: 0.5em 0 0 10px;
cursor: pointer;
}

View File

@ -93,8 +93,7 @@ var AIRTIME = (function(AIRTIME){
return;
}
var oLibTT = TableTools.fnGetInstance('library_display'),
aData = oLibTT.fnGetSelectedData(),
var aData = AIRTIME.library.getSelectedData(),
i,
temp,
length,

View File

@ -77,7 +77,8 @@ var AIRTIME = (function(AIRTIME){
};
mod.setupLibraryToolbar = function() {
var $toolbar = $(".lib-content .fg-toolbar:first");
var $toolbar = $(".lib-content .fg-toolbar:first"),
$libTable = $("#library_display");
$toolbar
.append("<ul />")
@ -93,8 +94,8 @@ var AIRTIME = (function(AIRTIME){
return;
}
var oLibTT = TableTools.fnGetInstance('library_display'),
aData = oLibTT.fnGetSelectedData(),
var selected = AIRTIME.library.getSelectedData(),
data,
i,
length,
temp,
@ -102,9 +103,9 @@ var AIRTIME = (function(AIRTIME){
aSchedIds = [];
//process selected files/playlists.
for (i = 0, length = aData.length; i < length; i++) {
temp = aData[i];
aMediaIds.push({"id": temp.id, "type": temp.ftype});
for (i = 0, length = selected.length; i < length; i++) {
data = selected[i];
aMediaIds.push({"id": data.id, "type": data.ftype});
}
aData = [];

View File

@ -1,31 +1,54 @@
var AIRTIME = (function(AIRTIME) {
var mod,
libraryInit;
libraryInit,
oTable,
$libContent,
$libTable,
LIB_SELECTED_CLASS = "lib-selected";
if (AIRTIME.library === undefined) {
AIRTIME.library = {};
}
mod = AIRTIME.library;
mod.getSelectedData = function() {
var $selected = $libTable.find("tbody").find("input:checkbox").filter(":checked").parents("tr"),
aData = [],
i, length,
$item;
for (i = 0, length = $selected.length; i < length; i++) {
$item = $($selected.get(i));
aData.push($item.data('aData'));
}
return aData.reverse();
};
mod.selectAll = function () {
$libTable.find("input:checkbox").attr("checked", true);
};
mod.selectNone = function () {
$libTable.find("input:checkbox").attr("checked", false);
$libTable.find("tr").removeClass(LIB_SELECTED_CLASS);
};
mod.fnDeleteItems = function(aMedia) {
var oLibTT = TableTools.fnGetInstance('library_display'),
oLibTable = $("#library_display").dataTable();
$.post("/library/delete",
{"format": "json", "media": aMedia},
function(json){
if (json.message !== undefined) {
alert(json.message);
}
oLibTT.fnSelectNone();
oLibTable.fnDraw();
oTable.fnDraw();
});
};
mod.fnDeleteSelectedItems = function() {
var oLibTT = TableTools.fnGetInstance('library_display'),
aData = oLibTT.fnGetSelectedData(),
var aData = AIRTIME.library.getSelectedData(),
item,
temp,
aMedia = [];
@ -42,14 +65,13 @@ var AIRTIME = (function(AIRTIME) {
};
libraryInit = function() {
var oTable,
libContentDiv = $("#library_content"),
tableHeight = libContentDiv.height() - 130,
libLength,
libType,
libFilter;
oTable,
$libContent = $("#library_content"),
$libTable = $libContent.find("table");
oTable = $('#library_display').dataTable( {
var tableHeight = $libContent.height() - 130;
oTable = $libTable.dataTable( {
//put hidden columns at the top to insure they can never be visible on the table through column reordering.
"aoColumns": [
@ -231,14 +253,7 @@ var AIRTIME = (function(AIRTIME) {
},
"fnDrawCallback": AIRTIME.library.events.fnDrawCallback,
"fnHeaderCallback": function(nHead) {
var oTT,
checked = $(nHead).find("input[type=checkbox]").filter(":checked");
if (checked.length > 0) {
oTT = TableTools.fnGetInstance('library_display');
checked.attr("checked", false);
oTT.fnSelectNone();
}
$(nHead).find("input[type=checkbox]").attr("checked", false);
},
"aaSorting": [[3, 'asc']],
@ -249,49 +264,8 @@ var AIRTIME = (function(AIRTIME) {
"sSearch": ""
},
// R = ColReorder, C = ColVis, T = TableTools
"sDom": 'Rl<"#library_display_type">f<"dt-process-rel"r><"H"T<"library_toolbar"C>><"dataTables_scrolling"t><"F"ip>',
"oTableTools": {
"sRowSelect": "multi",
"aButtons": [],
"fnRowSelected": function ( node ) {
var selected;
//seems to happen if everything is selected
if ( node === null) {
selected = oTable.find("input[type=checkbox]");
selected.attr("checked", true);
}
else {
$(node).find("input[type=checkbox]").attr("checked", true);
selected = oTable.find("input[type=checkbox]").filter(":checked");
}
//checking to enable buttons
AIRTIME.button.enableButton("lib-button-delete");
AIRTIME.library.events.enableAddButtonCheck();
},
"fnRowDeselected": function ( node ) {
var selected;
//seems to happen if everything is deselected
if ( node === null) {
oTable.find("input[type=checkbox]").attr("checked", false);
selected = [];
}
else {
$(node).find("input[type=checkbox]").attr("checked", false);
selected = oTable.find("input[type=checkbox]").filter(":checked");
}
//checking to disable buttons
if (selected.length === 0) {
AIRTIME.button.disableButton("lib-button-delete");
}
AIRTIME.library.events.enableAddButtonCheck();
}
},
// R = ColReorder, C = ColVis
"sDom": 'Rl<"#library_display_type">f<"dt-process-rel"r><"H"<"library_toolbar"C>><"dataTables_scrolling"t><"F"ip>',
"oColVis": {
"sAlign": "right",
@ -306,7 +280,7 @@ var AIRTIME = (function(AIRTIME) {
});
oTable.fnSetFilteringDelay(350);
libContentDiv.find(".dataTables_scrolling").css("max-height", tableHeight);
$libContent.find(".dataTables_scrolling").css("max-height", tableHeight);
AIRTIME.library.events.setupLibraryToolbar(oTable);
@ -322,30 +296,65 @@ var AIRTIME = (function(AIRTIME) {
oTable.fnDraw();
});
$('[name="pl_cb_all"]').click(function(){
var oTT = TableTools.fnGetInstance('library_display');
$libTable.find('[name="pl_cb_all"]').click(function() {
var $cbs = $libTable.find("input:checkbox"),
$trs;
if ($(this).is(":checked")) {
oTT.fnSelectAll();
$cbs.attr("checked", true);
//checking to enable buttons
$trs = $cbs.parents("tr");
$trs.addClass(LIB_SELECTED_CLASS);
AIRTIME.button.enableButton("lib-button-delete");
AIRTIME.library.events.enableAddButtonCheck();
}
else {
oTT.fnSelectNone();
$cbs.attr("checked", false);
$trs = $cbs.parents("tr");
$trs.removeClass(LIB_SELECTED_CLASS);
AIRTIME.button.disableButton("lib-button-delete");
AIRTIME.button.disableButton("lib-button-add");
}
});
//calculate dynamically width for the library search input.
//libLength = libContentDiv.find("#library_display_length");
//libType = libContentDiv.find("#library_display_type");
//libFilter = libContentDiv.find("#library_display_filter");
//libFilter.find("input").width(libFilter.width() - libType.width() - libLength.width() - 80);
$libTable.find("tbody").on("click", "input[type=checkbox]", function() {
var $cb = $(this),
$selectedCb,
$tr;
if ($cb.is(":checked")) {
$tr = $cb.parents("tr");
$tr.addClass(LIB_SELECTED_CLASS);
//checking to enable buttons
AIRTIME.button.enableButton("lib-button-delete");
AIRTIME.library.events.enableAddButtonCheck();
}
else {
$selectedCb = $libTable.find("tbody input:checkbox").filter(":checked");
$tr = $cb.parents("tr");
$tr.removeClass(LIB_SELECTED_CLASS);
//checking to disable buttons
if ($selectedCb.length === 0) {
AIRTIME.button.disableButton("lib-button-delete");
}
AIRTIME.library.events.enableAddButtonCheck();
}
});
checkImportStatus();
setInterval( checkImportStatus, 5000 );
setInterval( checkSCUploadStatus, 5000 );
addQtipToSCIcons();
//begin context menu initialization.
$.contextMenu({
selector: '#library_display td:not(.library_checkbox)',

View File

@ -275,10 +275,8 @@ var AIRTIME = (function(AIRTIME){
}
function redrawLib() {
var dt = $("#library_display").dataTable(),
oLibTT = TableTools.fnGetInstance('library_display');
var dt = $("#library_display").dataTable();
oLibTT.fnSelectNone();
dt.fnStandingRedraw();
}
@ -519,12 +517,11 @@ var AIRTIME = (function(AIRTIME){
fnReceive = function(event, ui) {
var aItems = [],
aSelected,
oLibTT = TableTools.fnGetInstance('library_display'),
i,
length;
//filter out anything that isn't an audiofile.
aSelected = oLibTT.fnGetSelectedData();
aSelected = AIRTIME.library.getSelectedData();
//if nothing is checked select the dragged item.
if (aSelected.length === 0) {
aSelected.push(ui.item.data("aData"));

View File

@ -1,7 +1,11 @@
var AIRTIME = (function(AIRTIME){
var mod,
oSchedTable,
fnServerData;
SB_SELECTED_CLASS = "sb-selected",
$sbContent,
$sbTable,
$toolbar,
$lib;
if (AIRTIME.showbuilder === undefined) {
AIRTIME.showbuilder = {};
@ -42,15 +46,36 @@ var AIRTIME = (function(AIRTIME){
return val;
};
mod.getSelectedData = function() {
var $selected = $sbTable.find("tbody").find("input:checkbox").filter(":checked").parents("tr"),
aData = [],
i, length,
$item;
for (i = 0, length = $selected.length; i < length; i++) {
$item = $($selected.get(i));
aData.push($item.data('aData'));
}
return aData.reverse();
};
mod.selectAll = function () {
$sbTable.find("input:checkbox").attr("checked", true);
};
mod.selectNone = function () {
$sbTable.find("input:checkbox").attr("checked", false);
};
mod.fnAdd = function(aMediaIds, aSchedIds) {
var oLibTT = TableTools.fnGetInstance('library_display');
$.post("/showbuilder/schedule-add",
{"format": "json", "mediaIds": aMediaIds, "schedIds": aSchedIds},
function(json){
checkError(json);
oSchedTable.fnDraw();
oLibTT.fnSelectNone();
AIRTIME.library.selectNone();
});
};
@ -74,20 +99,35 @@ var AIRTIME = (function(AIRTIME){
});
};
fnServerData = function ( sSource, aoData, fnCallback ) {
mod.fnRemoveSelectedItems = function() {
var aData = mod.getSelectedData(),
i,
length,
temp,
aItems = [];
for (i=0, length = aData.length; i < length; i++) {
temp = aData[i];
aItems.push({"id": temp.id, "instance": temp.instance, "timestamp": temp.timestamp});
}
mod.fnRemove(aItems);
};
mod.fnServerData = function ( sSource, aoData, fnCallback ) {
aoData.push( { name: "timestamp", value: AIRTIME.showbuilder.getTimestamp()} );
aoData.push( { name: "format", value: "json"} );
if (fnServerData.hasOwnProperty("start")) {
aoData.push( { name: "start", value: fnServerData.start} );
if (mod.fnServerData.hasOwnProperty("start")) {
aoData.push( { name: "start", value: mod.fnServerData.start} );
}
if (fnServerData.hasOwnProperty("end")) {
aoData.push( { name: "end", value: fnServerData.end} );
if (mod.fnServerData.hasOwnProperty("end")) {
aoData.push( { name: "end", value: mod.fnServerData.end} );
}
if (fnServerData.hasOwnProperty("ops")) {
aoData.push( { name: "myShows", value: fnServerData.ops.myShows} );
aoData.push( { name: "showFilter", value: fnServerData.ops.showFilter} );
if (mod.fnServerData.hasOwnProperty("ops")) {
aoData.push( { name: "myShows", value: mod.fnServerData.ops.myShows} );
aoData.push( { name: "showFilter", value: mod.fnServerData.ops.showFilter} );
}
$.ajax( {
@ -102,45 +142,25 @@ var AIRTIME = (function(AIRTIME){
} );
};
mod.fnServerData = fnServerData;
mod.builderDataTable = function() {
var $sbContent = $('#show_builder'),
$sbTable = $sbContent.find('table'),
oTable,
fnRemoveSelectedItems,
$toolbar;
fnRemoveSelectedItems = function() {
var oTT = TableTools.fnGetInstance('show_builder_table'),
aData = oTT.fnGetSelectedData(),
i,
length,
temp,
aItems = [];
$sbContent = $('#show_builder');
$lib = $("#library_content"),
$sbTable = $sbContent.find('table');
for (i=0, length = aData.length; i < length; i++) {
temp = aData[i];
aItems.push({"id": temp.id, "instance": temp.instance, "timestamp": temp.timestamp});
}
AIRTIME.showbuilder.fnRemove(aItems);
};
oTable = $sbTable.dataTable( {
oSchedTable = $sbTable.dataTable( {
"aoColumns": [
/* checkbox */ {"mDataProp": "allowed", "sTitle": "<input type='checkbox' name='sb_cb_all'>", "sWidth": "15px", "sClass": "sb-checkbox"},
/* Type */ {"mDataProp": "image", "sTitle": "", "sClass": "library_image sb-image", "sWidth": "16px"},
/* starts */{"mDataProp": "starts", "sTitle": "Start", "sClass": "sb-starts", "sWidth": "60px"},
/* ends */{"mDataProp": "ends", "sTitle": "End", "sClass": "sb-ends", "sWidth": "60px"},
/* runtime */{"mDataProp": "runtime", "sTitle": "Duration", "sClass": "library_length sb-length", "sWidth": "65px"},
/* title */{"mDataProp": "title", "sTitle": "Title", "sClass": "sb-title"},
/* creator */{"mDataProp": "creator", "sTitle": "Creator", "sClass": "sb-creator"},
/* album */{"mDataProp": "album", "sTitle": "Album", "sClass": "sb-album"},
/* cue in */{"mDataProp": "cuein", "sTitle": "Cue In", "bVisible": false, "sClass": "sb-cue-in"},
/* cue out */{"mDataProp": "cueout", "sTitle": "Cue Out", "bVisible": false, "sClass": "sb-cue-out"},
/* fade in */{"mDataProp": "fadein", "sTitle": "Fade In", "bVisible": false, "sClass": "sb-fade-in"},
/* fade out */{"mDataProp": "fadeout", "sTitle": "Fade Out", "bVisible": false, "sClass": "sb-fade-out"}
/* starts */ {"mDataProp": "starts", "sTitle": "Start", "sClass": "sb-starts", "sWidth": "60px"},
/* ends */ {"mDataProp": "ends", "sTitle": "End", "sClass": "sb-ends", "sWidth": "60px"},
/* runtime */ {"mDataProp": "runtime", "sTitle": "Duration", "sClass": "library_length sb-length", "sWidth": "65px"},
/* title */ {"mDataProp": "title", "sTitle": "Title", "sClass": "sb-title"},
/* creator */ {"mDataProp": "creator", "sTitle": "Creator", "sClass": "sb-creator"},
/* album */ {"mDataProp": "album", "sTitle": "Album", "sClass": "sb-album"},
/* cue in */ {"mDataProp": "cuein", "sTitle": "Cue In", "bVisible": false, "sClass": "sb-cue-in"},
/* cue out */ {"mDataProp": "cueout", "sTitle": "Cue Out", "bVisible": false, "sClass": "sb-cue-out"},
/* fade in */ {"mDataProp": "fadein", "sTitle": "Fade In", "bVisible": false, "sClass": "sb-fade-in"},
/* fade out */ {"mDataProp": "fadeout", "sTitle": "Fade Out", "bVisible": false, "sClass": "sb-fade-out"}
],
"bJQueryUI": true,
@ -163,11 +183,7 @@ var AIRTIME = (function(AIRTIME){
url: "/usersettings/set-timeline-datatable",
type: "POST",
data: {settings : oData, format: "json"},
dataType: "json",
success: function(){},
error: function (jqXHR, textStatus, errorThrown) {
var x;
}
dataType: "json"
});
},
"fnStateLoad": function (oSettings) {
@ -181,10 +197,7 @@ var AIRTIME = (function(AIRTIME){
async: false,
success: function(json){
o = json.settings;
},
error: function (jqXHR, textStatus, errorThrown) {
var x;
}
}
});
return o;
@ -378,10 +391,7 @@ var AIRTIME = (function(AIRTIME){
},
//remove any selected nodes before the draw.
"fnPreDrawCallback": function( oSettings ) {
var oTT;
oTT = TableTools.fnGetInstance('show_builder_table');
oTT.fnSelectNone();
mod.selectNone();
//disable jump to current button.
AIRTIME.button.disableButton("sb-button-current");
@ -395,8 +405,6 @@ var AIRTIME = (function(AIRTIME){
markerDiv,
$td,
$tr,
$lib = $("#library_content"),
oTable = $('#show_builder_table').dataTable(),
aData,
elements,
i, length, temp,
@ -453,7 +461,7 @@ var AIRTIME = (function(AIRTIME){
setTimeout(function(){
AIRTIME.showbuilder.resetTimestamp();
oTable.fnDraw();
oSchedTable.fnDraw();
}, aData.refresh * 1000); //need refresh in milliseconds
break;
@ -491,78 +499,63 @@ var AIRTIME = (function(AIRTIME){
"iFixedColumns": 2
},
"oTableTools": {
"sRowSelect": "multi",
"aButtons": [],
"fnPreRowSelect": function ( e ) {
var node = e.currentTarget;
//don't select separating rows, or shows without privileges.
if ($(node).hasClass("sb-header")
|| $(node).hasClass("sb-footer")
|| $(node).hasClass("sb-empty")
|| $(node).hasClass("sb-not-allowed")
|| $(node).hasClass("sb-past")) {
return false;
}
return true;
},
"fnRowSelected": function ( node ) {
//seems to happen if everything is selected
if ( node === null) {
$sbTable.find("tbody input[type=checkbox]").attr("checked", true);
}
else {
$(node).find("input[type=checkbox]").attr("checked", true);
}
//checking to enable buttons
AIRTIME.button.enableButton("sb-button-delete");
},
"fnRowDeselected": function ( node ) {
var selected;
//seems to happen if everything is deselected
if ( node === null) {
$sbTable.find("input[type=checkbox]").attr("checked", false);
selected = [];
}
else {
$(node).find("input[type=checkbox]").attr("checked", false);
selected = $sbTable.find("input[type=checkbox]").filter(":checked");
}
//checking to disable buttons
if (selected.length === 0) {
AIRTIME.button.disableButton("sb-button-delete");
}
}
},
// R = ColReorderResize, C = ColVis, T = TableTools
"sDom": 'R<"dt-process-rel"r><"sb-padded"<"H"CT>><"dataTables_scrolling sb-padded"t>',
// R = ColReorderResize, C = ColVis
"sDom": 'R<"dt-process-rel"r><"sb-padded"<"H"C>><"dataTables_scrolling sb-padded"t>',
"sAjaxDataProp": "schedule",
"sAjaxSource": "/showbuilder/builder-feed"
});
$('[name="sb_cb_all"]').click(function(){
var oTT = TableTools.fnGetInstance('show_builder_table');
if ($(this).is(":checked")) {
var allowedNodes;
allowedNodes = oTable.find('tr:not(:first, .sb-header, .sb-empty, .sb-footer, .sb-not-allowed, .sb-past)');
allowedNodes.each(function(i, el){
oTT.fnSelect(el);
});
}
else {
oTT.fnSelectNone();
}
//adding checkbox events.
$sbTable.find('[name="sb_cb_all"]').click(function() {
var $cbs = $sbTable.find("input:checkbox"),
$trs;
if ($(this).is(":checked")) {
$cbs.attr("checked", true);
//checking to enable buttons
$trs = $cbs.parents("tr");
$trs.addClass(SB_SELECTED_CLASS);
AIRTIME.button.enableButton("sb-button-delete");
}
else {
$cbs.attr("checked", false);
$trs = $cbs.parents("tr");
$trs.removeClass(SB_SELECTED_CLASS);
AIRTIME.button.disableButton("sb-button-delete");
}
});
$sbTable.find("tbody").on("click", "input:checkbox", function() {
var $cb = $(this),
$selectedCb,
$tr;
if ($cb.is(":checked")) {
$tr = $cb.parents("tr");
$tr.addClass(SB_SELECTED_CLASS);
//checking to enable buttons
AIRTIME.button.enableButton("sb-button-delete");
}
else {
$selectedCb = $libTable.find("tbody input:checkbox").filter(":checked");
$tr = $cb.parents("tr");
$tr.removeClass(SB_SELECTED_CLASS);
//checking to disable buttons
if ($selectedCb.length === 0) {
AIRTIME.button.disableButton("sb-button-delete");
}
}
});
var sortableConf = (function(){
var origTrs,
aItemData = [],
@ -602,10 +595,9 @@ var AIRTIME = (function(AIRTIME){
};
fnReceive = function(event, ui) {
var aItems = [],
oLibTT = TableTools.fnGetInstance('library_display');
var aItems = [];
aItems = oLibTT.fnGetSelectedData();
aItems = AIRTIME.library.getSelectedData();
//if nothing is checked select the dragged item.
if (aItems.length === 0) {
@ -663,9 +655,7 @@ var AIRTIME = (function(AIRTIME){
forcePlaceholderSize: true,
distance: 10,
helper: function(event, item) {
var oTT = TableTools.fnGetInstance('show_builder_table'),
selected = oTT.fnGetSelectedData(),
elements = $sbTable.find('tr:not(:first) input:checked').parents('tr'),
var selected = mod.getSelectedData(),
thead = $("#show_builder_table thead"),
colspan = thead.find("th").length,
trfirst = thead.find("tr:first"),
@ -673,8 +663,6 @@ var AIRTIME = (function(AIRTIME){
height = trfirst.height(),
message;
//elements.hide();
//if nothing is checked select the dragged item.
if (selected.length === 0) {
selected = [item.data("aData")];
@ -803,12 +791,9 @@ var AIRTIME = (function(AIRTIME){
return;
}
fnRemoveSelectedItems();
mod.fnRemoveSelectedItems();
});
//set things like a reference to the table.
AIRTIME.showbuilder.init(oTable);
//add events to cursors.
$sbTable.find("tbody").on("click", "div.marker", function(event) {
var $tr = $(this).parents("tr"),
@ -930,10 +915,6 @@ var AIRTIME = (function(AIRTIME){
});
};
mod.init = function(oTable) {
oSchedTable = oTable;
};
return AIRTIME;
}(AIRTIME || {}));