Merge branch 'CC-3174' into devel

This commit is contained in:
Naomi Aro 2012-03-23 16:42:40 +01:00
commit 3ab8c3d57b
11 changed files with 290 additions and 178 deletions

View file

@ -27,8 +27,8 @@
<div class="wrapper"> <div class="wrapper">
<!--Set to z-index 254 to make it lower than the top-panel and the ZFDebug info bar, but higher than the side-playlist--> <!--Set to z-index 254 to make it lower than the top-panel and the ZFDebug info bar, but higher than the side-playlist-->
<div id="library_content" class="ui-widget ui-widget-content block-shadow alpha-block padded" style="z-index:254"><?php echo $this->layout()->library ?></div> <div id="library_content" class="lib-content ui-widget ui-widget-content block-shadow alpha-block padded" style="z-index:254"><?php echo $this->layout()->library ?></div>
<div id="side_playlist" class="ui-widget ui-widget-content block-shadow omega-block padded"><?php echo $this->layout()->spl ?></div> <div id="side_playlist" class="pl-content ui-widget ui-widget-content block-shadow omega-block padded"><?php echo $this->layout()->spl ?></div>
</div> </div>
</body> </body>
</html> </html>

View file

@ -1,3 +1,17 @@
.lib-content .fg-toolbar ul {
float: left;
padding: 0;
margin: 0.5em 0 0 0;
cursor: pointer;
}
.lib-content .fg-toolbar ul li {
list-style-type: none;
float: left;
padding: 1px 2px;
margin-right: 5px;
}
#library_content { #library_content {
float: left; float: left;
width: 50%; width: 50%;
@ -32,12 +46,12 @@
padding-top:16px; padding-top:16px;
} }
#library_display th.ui-state-default { .lib-content table th.ui-state-default {
border: 1px solid #8f8f8f;
background-color: #a2a2a2;
background: -moz-linear-gradient(top, #b2b2b2 0, #a2a2a2 100%); background: -moz-linear-gradient(top, #b2b2b2 0, #a2a2a2 100%);
background: -webkit-gradient(linear, left top, left bottom, color-stop(0, #b2b2b2), color-stop(100%, #a2a2a2)); background: -webkit-gradient(linear, left top, left bottom, color-stop(0, #b2b2b2), color-stop(100%, #a2a2a2));
color: #363636; background: linear-gradient(top, #b2b2b2 0, #a2a2a2 100%);
border: 1px solid #8F8F8F;
color: #363636;
} }
.paginationControl { .paginationControl {

View file

@ -12,6 +12,20 @@
margin-left: -16px; margin-left: -16px;
} }
.sb-content .fg-toolbar ul {
float: left;
padding: 0;
margin: 0.5em 0 0 0;
cursor: pointer;
}
.sb-content .fg-toolbar ul li {
list-style-type: none;
float: left;
padding: 1px 2px;
margin-right: 5px;
}
.sb-padded { .sb-padded {
/* /*
the padding is needed here so that the cursor arrows with a negative margin are displayable. the padding is needed here so that the cursor arrows with a negative margin are displayable.
@ -39,6 +53,10 @@
top: 3px; top: 3px;
} }
.sb-content fieldset {
margin-bottom: 8px;
}
.sb-content fieldset.closed { .sb-content fieldset.closed {
border-width: 1px 0 0; border-width: 1px 0 0;
margin-bottom: -16px; margin-bottom: -16px;
@ -89,6 +107,11 @@ tr.cursor-selected-row .marker {
opacity: .6; opacity: .6;
} }
.sb-placeholder {
height: 35px;
padding: 5px;
}
.sb-boundry td.sb-image, .sb-boundry td.sb-image,
.sb-boundry td.sb-starts, .sb-boundry td.sb-starts,
.sb-boundry td.sb-ends, .sb-boundry td.sb-ends,
@ -204,8 +227,4 @@ table.datatable tr.sb-header.odd:hover td, table.datatable tr.sb-header.even:hov
.ui-dialog .sb_content .padded { .ui-dialog .sb_content .padded {
padding: 5px 10px 5px 16px; padding: 5px 10px 5px 16px;
}
.ui-dialog .ui-buttonset {
margin-right: 0 !important;
} }

View file

@ -637,10 +637,6 @@ dl.inline-list dd {
background-color:#c7c7c7; background-color:#c7c7c7;
} }
.datatable .show-builder-placeholder {
height: 30px;
}
.datatable tr.even.selected td { .datatable tr.even.selected td {
background-color: #abcfe2; background-color: #abcfe2;
} }
@ -698,15 +694,30 @@ dl.inline-list dd {
line-height:22px; line-height:22px;
} }
.dataTables_filter { .dataTables_filter {
margin:0 0 0 8px; margin:0 0 8px 8px;
} }
.dataTables_filter .auto-search { .dataTables_filter .auto-search {
width:55%; width:55%;
} }
.dt-process-rel {
position: relative;
}
.dataTables_processing { .dataTables_processing {
font-size:11px; opacity: 1 !important;
font-weight:normal; position: absolute;
margin:2px 0 3px 8px; top: 100px;
left: 10%;
width: 80%;
height: 50px;
text-align: center;
font-size:14px;
font-weight:bold;
padding-top: 40px;
background: -moz-linear-gradient(top, #b2b2b2 0, #a2a2a2 100%);
background: -webkit-gradient(linear, left top, left bottom, color-stop(0, #b2b2b2), color-stop(100%, #a2a2a2));
background: linear-gradient(top, #b2b2b2 0, #a2a2a2 100%);
border: 1px solid #8F8F8F;
color: #ffffff;
} }
#library_display_wrapper .ui-widget-header:first-child { #library_display_wrapper .ui-widget-header:first-child {
background:none; background:none;
@ -742,7 +753,7 @@ dl.inline-list dd {
} }
.dataTables_filter input { .dataTables_filter input {
background: url("images/search_auto_bg.png") no-repeat scroll 0 0 #DDDDDD; background: url("images/search_auto_bg.png") no-repeat scroll 0 0 #DDDDDD;
width: 55%; width: 50%;
border: 1px solid #5B5B5B; border: 1px solid #5B5B5B;
margin-left: -8px; margin-left: -8px;
padding: 5px 3px 4px 25px; padding: 5px 3px 4px 25px;
@ -765,7 +776,6 @@ dl.inline-list dd {
#library_display thead th.library_title { #library_display thead th.library_title {
cursor: default; cursor: default;
} }
.ColVis.TableTools .ui-button { .ColVis.TableTools .ui-button {
height: 21px; height: 21px;
} }
@ -779,7 +789,7 @@ button.ColVis_Button.ColVis_ShowAll {
font-size:12px; font-size:12px;
font-weight:normal; font-weight:normal;
padding: 0.2em 1em; padding: 0.2em 1em;
margin: 0.5em 0.2em -0.5em 0.2em; margin: 0.5em 7px -0.5em -2px;
} }
.library_length { .library_length {

View file

@ -8,8 +8,18 @@ var AIRTIME = (function(AIRTIME){
} }
mod = AIRTIME.button; mod = AIRTIME.button;
mod.isDisabled = function(c) {
var button = $("."+c);
if (button.hasClass(DISABLED_CLASS)) {
return true;
}
return false;
};
mod.enableButton = function(c) { mod.enableButton = function(c) {
var button = $("."+c).find("button"); var button = $("."+c);
if (button.hasClass(DISABLED_CLASS)) { if (button.hasClass(DISABLED_CLASS)) {
button.removeClass(DISABLED_CLASS); button.removeClass(DISABLED_CLASS);
@ -17,7 +27,7 @@ var AIRTIME = (function(AIRTIME){
}; };
mod.disableButton = function(c) { mod.disableButton = function(c) {
var button = $("."+c).find("button"); var button = $("."+c);
if (!button.hasClass(DISABLED_CLASS)) { if (!button.hasClass(DISABLED_CLASS)) {
button.addClass(DISABLED_CLASS); button.addClass(DISABLED_CLASS);

View file

@ -19,10 +19,10 @@ var AIRTIME = (function(AIRTIME){
} }
if (check === true) { if (check === true) {
AIRTIME.button.enableButton("library_group_add"); AIRTIME.button.enableButton("lib-button-add");
} }
else { else {
AIRTIME.button.disableButton("library_group_add"); AIRTIME.button.disableButton("lib-button-add");
} }
}; };
@ -76,43 +76,53 @@ var AIRTIME = (function(AIRTIME){
}); });
}; };
/* mod.setupLibraryToolbar = function() {
* @param oTable the datatables instance for the library. var $toolbar = $(".lib-content .fg-toolbar:first");
*/
mod.setupLibraryToolbar = function( oLibTable ) {
var aButtons,
fnAddSelectedItems;
fnAddSelectedItems = function() { $toolbar
var oLibTT = TableTools.fnGetInstance('library_display'), .append("<ul />")
aData = oLibTT.fnGetSelectedData(), .find('ul')
i, .append('<li class="ui-state-default ui-state-disabled lib-button-add" title="add selected items to playlist"><span class="ui-icon ui-icon-plusthick"></span></li>')
temp, .append('<li class="ui-state-default ui-state-disabled lib-button-delete" title="delete selected items"><span class="ui-icon ui-icon-trash"></span></li>');
length,
aMediaIds = []; //add to playlist button
$toolbar.find('.lib-button-add')
//process selected files/playlists. .click(function() {
for (i = 0, length = aData.length; i < length; i++) {
temp = aData[i]; if (AIRTIME.button.isDisabled('lib-button-add') === true) {
if (temp.ftype === "audioclip") { return;
aMediaIds.push(temp.id); }
var oLibTT = TableTools.fnGetInstance('library_display'),
aData = oLibTT.fnGetSelectedData(),
i,
temp,
length,
aMediaIds = [];
//process selected files/playlists.
for (i = 0, length = aData.length; i < length; i++) {
temp = aData[i];
if (temp.ftype === "audioclip") {
aMediaIds.push(temp.id);
}
} }
}
AIRTIME.playlist.fnAddItems(aMediaIds, undefined, 'after');
};
//[0] = button text AIRTIME.playlist.fnAddItems(aMediaIds, undefined, 'after');
//[1] = id });
//[2] = enabled
//[3] = click event
aButtons = [["Delete", "library_group_delete", false, AIRTIME.library.fnDeleteSelectedItems],
["Add", "library_group_add", false, fnAddSelectedItems]];
addToolBarButtonsLibrary(aButtons); //delete from library.
$toolbar.find('.lib-button-delete')
.click(function() {
if (AIRTIME.button.isDisabled('lib-button-delete') === true) {
return;
}
AIRTIME.library.fnDeleteSelectedItems();
});
}; };
return AIRTIME; return AIRTIME;
}(AIRTIME || {})); }(AIRTIME || {}));

View file

@ -19,10 +19,10 @@ var AIRTIME = (function(AIRTIME){
} }
if (check === true) { if (check === true) {
AIRTIME.button.enableButton("library_group_add"); AIRTIME.button.enableButton("lib-button-add");
} }
else { else {
AIRTIME.button.disableButton("library_group_add"); AIRTIME.button.disableButton("lib-button-add");
} }
}; };
@ -76,47 +76,61 @@ var AIRTIME = (function(AIRTIME){
}); });
}; };
mod.setupLibraryToolbar = function(oLibTable) { mod.setupLibraryToolbar = function() {
var aButtons, var $toolbar = $(".lib-content .fg-toolbar:first");
fnAddSelectedItems,
fnAddSelectedItems = function() { $toolbar
var oLibTT = TableTools.fnGetInstance('library_display'), .append("<ul />")
aData = oLibTT.fnGetSelectedData(), .find('ul')
i, .append('<li class="ui-state-default ui-state-disabled lib-button-add" title="add selected items to playlist"><span class="ui-icon ui-icon-plusthick"></span></li>')
length, .append('<li class="ui-state-default ui-state-disabled lib-button-delete" title="delete selected items"><span class="ui-icon ui-icon-trash"></span></li>');
temp,
aMediaIds = [], //add to timeline button
aSchedIds = []; $toolbar.find('.lib-button-add')
.click(function() {
if (AIRTIME.button.isDisabled('lib-button-add') === true) {
return;
}
var oLibTT = TableTools.fnGetInstance('library_display'),
aData = oLibTT.fnGetSelectedData(),
i,
length,
temp,
aMediaIds = [],
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});
}
aData = [];
$("#show_builder_table tr.cursor-selected-row").each(function(i, el){
aData.push($(el).data("aData"));
});
//process selected files/playlists. //process selected schedule rows to add media after.
for (i = 0, length = aData.length; i < length; i++) { for (i=0, length = aData.length; i < length; i++) {
temp = aData[i]; temp = aData[i];
aMediaIds.push({"id": temp.id, "type": temp.ftype}); aSchedIds.push({"id": temp.id, "instance": temp.instance, "timestamp": temp.timestamp});
} }
aData = []; AIRTIME.showbuilder.fnAdd(aMediaIds, aSchedIds);
$("#show_builder_table tr.cursor-selected-row").each(function(i, el){
aData.push($(el).data("aData"));
}); });
//process selected schedule rows to add media after. //delete from library.
for (i=0, length = aData.length; i < length; i++) { $toolbar.find('.lib-button-delete')
temp = aData[i]; .click(function() {
aSchedIds.push({"id": temp.id, "instance": temp.instance, "timestamp": temp.timestamp});
} if (AIRTIME.button.isDisabled('lib-button-delete') === true) {
return;
AIRTIME.showbuilder.fnAdd(aMediaIds, aSchedIds); }
};
AIRTIME.library.fnDeleteSelectedItems();
//[0] = button text });
//[1] = id
//[2] = enabled
//[3] = click event
aButtons = [["Delete", "library_group_delete", false, AIRTIME.library.fnDeleteSelectedItems],
["Add", "library_group_add", false, fnAddSelectedItems]];
addToolBarButtonsLibrary(aButtons);
}; };
return AIRTIME; return AIRTIME;

View file

@ -43,8 +43,11 @@ var AIRTIME = (function(AIRTIME) {
libraryInit = function() { libraryInit = function() {
var oTable, var oTable,
libContentDiv = $("#library_content"); libContentDiv = $("#library_content"),
tableHeight = libContentDiv.height() - 140; tableHeight = libContentDiv.height() - 130,
libLength,
libType,
libFilter;
oTable = $('#library_display').dataTable( { oTable = $('#library_display').dataTable( {
@ -247,7 +250,7 @@ var AIRTIME = (function(AIRTIME) {
}, },
// R = ColReorder, C = ColVis, T = TableTools // R = ColReorder, C = ColVis, T = TableTools
"sDom": 'Rl<"#library_display_type">fr<"H"T<"library_toolbar"C>><"dataTables_scrolling"t><"F"ip>', "sDom": 'Rl<"#library_display_type">f<"dt-process-rel"r><"H"T<"library_toolbar"C>><"dataTables_scrolling"t><"F"ip>',
"oTableTools": { "oTableTools": {
"sRowSelect": "multi", "sRowSelect": "multi",
@ -266,7 +269,7 @@ var AIRTIME = (function(AIRTIME) {
} }
//checking to enable buttons //checking to enable buttons
AIRTIME.button.enableButton("library_group_delete"); AIRTIME.button.enableButton("lib-button-delete");
AIRTIME.library.events.enableAddButtonCheck(); AIRTIME.library.events.enableAddButtonCheck();
}, },
"fnRowDeselected": function ( node ) { "fnRowDeselected": function ( node ) {
@ -284,14 +287,13 @@ var AIRTIME = (function(AIRTIME) {
//checking to disable buttons //checking to disable buttons
if (selected.length === 0) { if (selected.length === 0) {
AIRTIME.button.disableButton("library_group_delete"); AIRTIME.button.disableButton("lib-button-delete");
} }
AIRTIME.library.events.enableAddButtonCheck(); AIRTIME.library.events.enableAddButtonCheck();
} }
}, },
"oColVis": { "oColVis": {
"buttonText": "Show/Hide Columns",
"sAlign": "right", "sAlign": "right",
"aiExclude": [0, 1, 2], "aiExclude": [0, 1, 2],
"sSize": "css" "sSize": "css"
@ -331,6 +333,12 @@ var AIRTIME = (function(AIRTIME) {
} }
}); });
//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);
checkImportStatus(); checkImportStatus();
setInterval( checkImportStatus, 5000 ); setInterval( checkImportStatus, 5000 );
setInterval( checkSCUploadStatus, 5000 ); setInterval( checkSCUploadStatus, 5000 );
@ -488,48 +496,6 @@ var AIRTIME = (function(AIRTIME) {
}(AIRTIME || {})); }(AIRTIME || {}));
function addToolBarButtonsLibrary(aButtons) {
var i,
length = aButtons.length,
libToolBar = $(".library_toolbar"),
html,
buttonClass = '',
DEFAULT_CLASS = 'ui-button ui-state-default',
DISABLED_CLASS = 'ui-state-disabled',
fn;
for ( i = 0; i < length; i += 1 ) {
buttonClass = '';
//add disabled class if not enabled.
if (aButtons[i][2] === false) {
buttonClass += DISABLED_CLASS;
}
html = '<div class="ColVis TableTools '+aButtons[i][1]+'"><button class="'+DEFAULT_CLASS+' '+buttonClass+'"><span>'+aButtons[i][0]+'</span></button></div>';
libToolBar.append(html);
//create a closure to preserve the state of i.
(function(index){
libToolBar.find("."+aButtons[index][1]).click(function(){
fn = function() {
var $button = $(this).find("button");
//only call the passed function if the button is enabled.
if (!$button.hasClass(DISABLED_CLASS)) {
aButtons[index][3]();
}
};
fn.call(this);
});
}(i));
}
}
function checkImportStatus(){ function checkImportStatus(){
$.getJSON('/Preference/is-import-in-progress', function(data){ $.getJSON('/Preference/is-import-in-progress', function(data){
var div = $('#import_status'); var div = $('#import_status');

View file

@ -106,10 +106,7 @@ function buildScheduleDialog (json) {
//subtract padding in pixels //subtract padding in pixels
widgetWidth = width - 60, widgetWidth = width - 60,
libWidth = Math.floor(widgetWidth * 0.5), libWidth = Math.floor(widgetWidth * 0.5),
builderWidth = Math.floor(widgetWidth * 0.5), builderWidth = Math.floor(widgetWidth * 0.5);
libLength,
libType,
libFilter;
dialog.find("#library_content") dialog.find("#library_content")
.height(height - 115) .height(height - 115)
@ -143,19 +140,12 @@ function buildScheduleDialog (json) {
//set max heights of datatables. //set max heights of datatables.
dialog.find(".lib-content .dataTables_scrolling") dialog.find(".lib-content .dataTables_scrolling")
.css("max-height", height - 110 - 155); .css("max-height", height - 90 - 155);
dialog.find(".sb-content .dataTables_scrolling") dialog.find(".sb-content .dataTables_scrolling")
.css("max-height", height - 110 - 60); .css("max-height", height - 90 - 60);
dialog.dialog('open'); dialog.dialog('open');
//calculate dynamically width for the library search input.
libLength = dialog.find("#library_display_length");
libType = dialog.find("#library_display_type");
libFilter = dialog.find("#library_display_filter");
libFilter.find("input").width(libFilter.width() - libType.width() - libLength.width() - 80);
} }
function buildContentDialog (json){ function buildContentDialog (json){

View file

@ -105,10 +105,12 @@ var AIRTIME = (function(AIRTIME){
mod.fnServerData = fnServerData; mod.fnServerData = fnServerData;
mod.builderDataTable = function() { mod.builderDataTable = function() {
var tableDiv = $('#show_builder_table'), var $sbContent = $('#show_builder'),
$sbTable = $sbContent.find('table'),
oTable, oTable,
fnRemoveSelectedItems, fnRemoveSelectedItems,
tableHeight; tableHeight,
$toolbar;
fnRemoveSelectedItems = function() { fnRemoveSelectedItems = function() {
var oTT = TableTools.fnGetInstance('show_builder_table'), var oTT = TableTools.fnGetInstance('show_builder_table'),
@ -126,7 +128,7 @@ var AIRTIME = (function(AIRTIME){
AIRTIME.showbuilder.fnRemove(aItems); AIRTIME.showbuilder.fnRemove(aItems);
}; };
oTable = tableDiv.dataTable( { oTable = $sbTable.dataTable( {
"aoColumns": [ "aoColumns": [
/* checkbox */ {"mDataProp": "allowed", "sTitle": "<input type='checkbox' name='sb_cb_all'>", "sWidth": "15px", "sClass": "sb-checkbox"}, /* 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": "25px", "bVisible": true}, /* Type */ {"mDataProp": "image", "sTitle": "", "sClass": "library_image sb-image", "sWidth": "25px", "bVisible": true},
@ -235,6 +237,9 @@ var AIRTIME = (function(AIRTIME){
else if (aData.scheduled === 0) { else if (aData.scheduled === 0) {
$(nRow).addClass("sb-past"); $(nRow).addClass("sb-past");
} }
else {
$(nRow).addClass("sb-future");
}
if (aData.allowed !== true) { if (aData.allowed !== true) {
$(nRow).addClass("sb-not-allowed"); $(nRow).addClass("sb-not-allowed");
@ -362,7 +367,7 @@ var AIRTIME = (function(AIRTIME){
if ($lib.length > 0 && $lib.filter(":visible").length > 0) { if ($lib.length > 0 && $lib.filter(":visible").length > 0) {
//create cursor arrows. //create cursor arrows.
tableDiv.find("tr.sb-now-playing, tr:not(:first, .sb-footer, .sb-empty, .sb-not-allowed)").each(function(i, el) { $sbTable.find("tr.sb-now-playing, tr:not(:first, .sb-footer, .sb-empty, .sb-not-allowed)").each(function(i, el) {
td = $(el).find("td:first"); td = $(el).find("td:first");
if (td.hasClass("dataTables_empty")) { if (td.hasClass("dataTables_empty")) {
return false; return false;
@ -383,19 +388,25 @@ var AIRTIME = (function(AIRTIME){
} }
//if the now playing song is visible set a timeout to redraw the table at the start of the next song. //if the now playing song is visible set a timeout to redraw the table at the start of the next song.
tr = tableDiv.find("tr.sb-now-playing"); tr = $sbTable.find("tr.sb-now-playing");
if (tr.length > 0) { if (tr.length > 0) {
//enable jump to current button.
AIRTIME.button.enableButton("sb-button-current");
aData = tr.data("aData"); aData = tr.data("aData");
setTimeout(function(){ setTimeout(function(){
AIRTIME.showbuilder.resetTimestamp(); AIRTIME.showbuilder.resetTimestamp();
oTable.fnDraw(); oTable.fnDraw();
}, aData.refresh * 1000); //need refresh in milliseconds }, aData.refresh * 1000); //need refresh in milliseconds
//scroll now playing item to top.
$sbContent.find(".sb-button-current").click();
} }
//current song is not set, set a timeout to refresh when the first item on the timeline starts. //current song is not set, set a timeout to refresh when the first item on the timeline starts.
else { else {
tr = tableDiv.find("tbody tr.sb-allowed.sb-header:first"); tr = $sbTable.find("tbody tr.sb-allowed.sb-header:first");
if (tr.length > 0) { if (tr.length > 0) {
aData = tr.data("aData"); aData = tr.data("aData");
@ -406,6 +417,14 @@ var AIRTIME = (function(AIRTIME){
}, aData.timeUntil * 1000); //need refresh in milliseconds }, aData.timeUntil * 1000); //need refresh in milliseconds
} }
} }
//check if there are any overbooked tracks on screen to enable the trim button.
tr = $sbTable.find("tr.sb-over");
if (tr.length > 0) {
//enable deleting of overbooked tracks.
AIRTIME.button.enableButton("sb-button-trim");
}
}, },
"fnHeaderCallback": function(nHead) { "fnHeaderCallback": function(nHead) {
$(nHead).find("input[type=checkbox]").attr("checked", false); $(nHead).find("input[type=checkbox]").attr("checked", false);
@ -416,6 +435,11 @@ var AIRTIME = (function(AIRTIME){
oTT = TableTools.fnGetInstance('show_builder_table'); oTT = TableTools.fnGetInstance('show_builder_table');
oTT.fnSelectNone(); oTT.fnSelectNone();
//disable jump to current button.
AIRTIME.button.disableButton("sb-button-current");
//disable deleting of overbooked tracks.
AIRTIME.button.disableButton("sb-button-trim");
}, },
"oColVis": { "oColVis": {
@ -451,30 +475,30 @@ var AIRTIME = (function(AIRTIME){
} }
//checking to enable buttons //checking to enable buttons
AIRTIME.button.enableButton("sb_delete"); AIRTIME.button.enableButton("sb-button-delete");
}, },
"fnRowDeselected": function ( node ) { "fnRowDeselected": function ( node ) {
var selected; var selected;
//seems to happen if everything is deselected //seems to happen if everything is deselected
if ( node === null) { if ( node === null) {
tableDiv.find("input[type=checkbox]").attr("checked", false); $sbTable.find("input[type=checkbox]").attr("checked", false);
selected = []; selected = [];
} }
else { else {
$(node).find("input[type=checkbox]").attr("checked", false); $(node).find("input[type=checkbox]").attr("checked", false);
selected = tableDiv.find("input[type=checkbox]").filter(":checked"); selected = $sbTable.find("input[type=checkbox]").filter(":checked");
} }
//checking to disable buttons //checking to disable buttons
if (selected.length === 0) { if (selected.length === 0) {
AIRTIME.button.disableButton("sb_delete"); AIRTIME.button.disableButton("sb-button-delete");
} }
} }
}, },
// R = ColReorderResize, C = ColVis, T = TableTools // R = ColReorderResize, C = ColVis, T = TableTools
"sDom": 'Rr<"sb-padded"<"H"CT>><"dataTables_scrolling sb-padded"t>', "sDom": 'R<"dt-process-rel"r><"sb-padded"<"H"CT>><"dataTables_scrolling sb-padded"t>',
"sAjaxDataProp": "schedule", "sAjaxDataProp": "schedule",
"sAjaxSource": "/showbuilder/builder-feed" "sAjaxSource": "/showbuilder/builder-feed"
@ -572,7 +596,7 @@ var AIRTIME = (function(AIRTIME){
//item was dragged in //item was dragged in
if (origTrs !== undefined) { if (origTrs !== undefined) {
tableDiv.find("tr.ui-draggable") $sbTable.find("tr.ui-draggable")
.empty() .empty()
.after(html); .after(html);
@ -593,12 +617,13 @@ var AIRTIME = (function(AIRTIME){
}; };
return { return {
placeholder: "placeholder show-builder-placeholder ui-state-highlight", placeholder: "sb-placeholder ui-state-highlight",
forcePlaceholderSize: true, forcePlaceholderSize: true,
distance: 10,
helper: function(event, item) { helper: function(event, item) {
var oTT = TableTools.fnGetInstance('show_builder_table'), var oTT = TableTools.fnGetInstance('show_builder_table'),
selected = oTT.fnGetSelectedData(), selected = oTT.fnGetSelectedData(),
elements = tableDiv.find('tr:not(:first) input:checked').parents('tr'), elements = $sbTable.find('tr:not(:first) input:checked').parents('tr'),
thead = $("#show_builder_table thead"), thead = $("#show_builder_table thead"),
colspan = thead.find("th").length, colspan = thead.find("th").length,
trfirst = thead.find("tr:first"), trfirst = thead.find("tr:first"),
@ -639,24 +664,78 @@ var AIRTIME = (function(AIRTIME){
receive: fnReceive, receive: fnReceive,
update: fnUpdate, update: fnUpdate,
start: function(event, ui) { start: function(event, ui) {
var elements = tableDiv.find('tr:not(:first) input:checked').parents('tr'); var elements = $sbTable.find('tr:not(:first) input:checked').parents('tr');
elements.hide(); elements.hide();
} }
}; };
}()); }());
tableDiv.sortable(sortableConf); $sbTable.sortable(sortableConf);
$("#show_builder .fg-toolbar") //start setup of the builder toolbar.
.append('<div class="ColVis TableTools sb_delete"><button class="ui-button ui-state-default ui-state-disabled"><span>Delete</span></button></div>') $toolbar = $(".sb-content .fg-toolbar");
.click(fnRemoveSelectedItems);
$toolbar
.append("<ul />")
.find('ul')
.append('<li class="ui-state-default ui-state-disabled sb-button-current" title="jump to current item"><span class="ui-icon ui-icon-arrowstop-1-s"></span></li>')
.append('<li class="ui-state-default ui-state-disabled sb-button-trim" title="delete all overbooked tracks"><span class="ui-icon ui-icon-scissors"></span></li>')
.append('<li class="ui-state-default ui-state-disabled sb-button-delete" title="delete selected items"><span class="ui-icon ui-icon-trash"></span></li>');
//jump to current
$toolbar.find('.sb-button-current')
.click(function() {
if (AIRTIME.button.isDisabled('sb-button-current') === true) {
return;
}
var $scroll = $sbContent.find(".dataTables_scrolling"),
scrolled = $scroll.scrollTop(),
scrollingTop = $scroll.offset().top,
current = $sbTable.find(".sb-now-playing"),
currentTop = current.offset().top;
$scroll.scrollTop(currentTop - scrollingTop + scrolled);
});
//delete overbooked tracks.
$toolbar.find('.sb-button-trim')
.click(function() {
if (AIRTIME.button.isDisabled('sb-button-trim') === true) {
return;
}
var temp,
aItems = [],
trs = $sbTable.find(".sb-over.sb-future");
trs.each(function(){
temp = $(this).data("aData");
aItems.push({"id": temp.id, "instance": temp.instance, "timestamp": temp.timestamp});
});
AIRTIME.showbuilder.fnRemove(aItems);
});
//delete selected tracks
$toolbar.find('.sb-button-delete')
.click(function() {
if (AIRTIME.button.isDisabled('sb-button-delete') === true) {
return;
}
fnRemoveSelectedItems();
});
//set things like a reference to the table. //set things like a reference to the table.
AIRTIME.showbuilder.init(oTable); AIRTIME.showbuilder.init(oTable);
//add event to cursors. //add event to cursors.
tableDiv.find("tbody").on("click", "div.marker", function(event){ $sbTable.find("tbody").on("click", "div.marker", function(event){
var tr = $(this).parents("tr"), var tr = $(this).parents("tr"),
cursorSelClass = "cursor-selected-row"; cursorSelClass = "cursor-selected-row";

View file

@ -4,7 +4,7 @@ $(document).ready(function(){
$lib = $("#library_content"), $lib = $("#library_content"),
$libWrapper, $libWrapper,
$builder = $("#show_builder"), $builder = $("#show_builder"),
widgetHeight = viewport.height - 185, widgetHeight = viewport.height - 180,
screenWidth = Math.floor(viewport.width - 120), screenWidth = Math.floor(viewport.width - 120),
oBaseDatePickerSettings, oBaseDatePickerSettings,
oBaseTimePickerSettings, oBaseTimePickerSettings,
@ -62,7 +62,7 @@ $(document).ready(function(){
$libWrapper = $lib.find("#library_display_wrapper"); $libWrapper = $lib.find("#library_display_wrapper");
$libWrapper.prepend($libClose); $libWrapper.prepend($libClose);
$builder.find('.dataTables_scrolling').css("max-height", widgetHeight - 110); $builder.find('.dataTables_scrolling').css("max-height", widgetHeight - 95);
$builder.on("click", "#sb_submit", function(ev){ $builder.on("click", "#sb_submit", function(ev){
var fn, var fn,