SAAS-999 - Change Advanced Search Options to dropdown

This commit is contained in:
Duncan Sommerville 2015-08-04 15:38:48 -04:00
parent f138dc6b47
commit 4200f56265
6 changed files with 191 additions and 106 deletions

View File

@ -18,6 +18,7 @@ class ShowBuilderController extends Zend_Controller_Action {
$this->view->headScript()->appendFile($baseUrl.'js/datatables/plugin/dataTables.pluginAPI.js?'.$CC_CONFIG['airtime_version'],'text/javascript'); $this->view->headScript()->appendFile($baseUrl.'js/datatables/plugin/dataTables.pluginAPI.js?'.$CC_CONFIG['airtime_version'],'text/javascript');
$this->view->headScript()->appendFile($baseUrl.'js/datatables/plugin/dataTables.fnSetFilteringDelay.js?'.$CC_CONFIG['airtime_version'],'text/javascript'); $this->view->headScript()->appendFile($baseUrl.'js/datatables/plugin/dataTables.fnSetFilteringDelay.js?'.$CC_CONFIG['airtime_version'],'text/javascript');
$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.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.FixedColumns.js?'.$CC_CONFIG['airtime_version'],'text/javascript');
$this->view->headScript()->appendFile($baseUrl.'js/datatables/plugin/dataTables.columnFilter.js?'.$CC_CONFIG['airtime_version'], 'text/javascript'); $this->view->headScript()->appendFile($baseUrl.'js/datatables/plugin/dataTables.columnFilter.js?'.$CC_CONFIG['airtime_version'], 'text/javascript');

View File

@ -30,13 +30,18 @@
<div id="library_content" class="lib-content tabs content-pane wide-panel"> <div id="library_content" class="lib-content tabs content-pane wide-panel">
<div class="panel-header"> <div class="panel-header">
<fieldset class="toggle closed" id="filter_options"> <!-- <fieldset class="toggle closed" id="filter_options">-->
<legend style="cursor: pointer;"> <!-- <legend style="cursor: pointer;">-->
<span class="ui-icon ui-icon-triangle-2-n-s"></span> <!-- <span class="ui-icon ui-icon-triangle-2-n-s"></span>-->
<?php echo _("Advanced Search Options") ?> <!-- --><?php //echo _("Advanced Search Options") ?>
</legend> <!-- </legend>-->
<div id="advanced_search" class="advanced_search form-horizontal"></div> <!-- </fieldset>-->
</fieldset> <div id="advanced-options" class="btn-group">
<button class="btn btn-small dropdown-toggle" data-toggle="dropdown">
<span class="caret"></span>
</button>
<div id="advanced_search" class="advanced_search form-horizontal dropdown-menu"></div>
</div>
</div> </div>
<div class="outer-datatable-wrapper"> <div class="outer-datatable-wrapper">
<table id="library_display" cellpadding="0" cellspacing="0" class="datatable"></table> <table id="library_display" cellpadding="0" cellspacing="0" class="datatable"></table>

View File

@ -43,15 +43,19 @@ div.ColVis_collectionBackground {
::-webkit-scrollbar-track { ::-webkit-scrollbar-track {
-webkit-box-shadow: inset 0 0 6px rgba(0,0,0,0.3); -webkit-box-shadow: inset 0 0 6px rgba(0,0,0,0.3);
border-radius: 10px; /*border-radius: 10px;*/
} }
::-webkit-scrollbar-thumb { ::-webkit-scrollbar-thumb {
background-color: #ff5d1a; background-color: #ff5d1a;
border-radius: 10px; /*border-radius: 10px;*/
-webkit-box-shadow: inset 0 0 4px rgba(0,0,0,0.75); -webkit-box-shadow: inset 0 0 4px rgba(0,0,0,0.75);
} }
::-webkit-scrollbar-corner {
-webkit-box-shadow: inset 0 0 0 rgba(0,0,0,0.75);
}
/* Show Builder*/ /* Show Builder*/
.content-pane { .content-pane {
@ -91,15 +95,6 @@ div.ColVis_collectionBackground {
flex: 1; flex: 1;
} }
@media screen and (max-height: 650px) {
#master-panel {
display: none;
}
.wrapper {
top: 40px !important;
}
}
@media screen and (max-width: 1475px) { @media screen and (max-width: 1475px) {
.wrapper { .wrapper {
-webkit-flex-flow: column !important; -webkit-flex-flow: column !important;
@ -168,10 +163,13 @@ div.ColVis_collectionBackground {
} }
#library_content .dataTables_filter input[type="text"], #library_content .dataTables_filter select { #library_content .dataTables_filter input[type="text"], #library_content .dataTables_filter select {
margin-top: 6px;
width: 20%;
float: right;
height: 26px; height: 26px;
margin: 0;
border: 0;
float: left;
position: absolute;
width: 100%;
} }
#library_content label { #library_content label {
@ -194,7 +192,7 @@ div.ColVis_collectionBackground {
font-size: 14px; font-size: 14px;
} }
#library_content legend, #library_content span, #library_content label { #library_content legend, #library_content span {
font-weight: normal; font-weight: normal;
color: #efefef; color: #efefef;
} }
@ -206,9 +204,13 @@ div.ColVis_collectionBackground {
bottom: 0; bottom: 0;
} }
#library_display_processing {
z-index: 1;
}
#library_display_wrapper, #show_builder_table_wrapper { #library_display_wrapper, #show_builder_table_wrapper {
position: absolute; position: absolute;
top: 4px; top: 34px;
bottom: 4px; bottom: 4px;
right: 4px; right: 4px;
left: 4px; left: 4px;
@ -216,12 +218,18 @@ div.ColVis_collectionBackground {
.dataTables_scrolling { .dataTables_scrolling {
position: absolute; position: absolute;
bottom: 38px; /* 38 px is the size of the header/footer */ bottom: 39px; /* 38 px is the size of the header/footer + 1px because there's no internal border */
top: 38px; top: 39px;
left: 1px; /* Border */ left: 1px; /* Border */
right: 0; right: 0;
} }
#library_display {
border: none;
}
/* Library Search */
#filter_options { #filter_options {
text-align: center; text-align: center;
padding: 15px 0 15px 15px; padding: 15px 0 15px 15px;
@ -230,12 +238,60 @@ div.ColVis_collectionBackground {
} }
#advanced_search { #advanced_search {
margin-top: 15px; position: absolute;
left: -500px;
padding: 5px;
margin-top: -2px;
}
#advanced_search label, #advanced_search span {
font-weight: normal;
font-size: 14px;
line-height: 24px;
color: #242424;
}
#advanced_search .controls {
text-align: right;
}
#advanced_search .control-group {
padding: 5px;
margin-bottom: 0;
}
#advanced_search .sp-checked-icon {
position: absolute;
margin-top: 4px;
}
#advanced-options {
float: right;
z-index: 1;
}
#advanced-options > button {
background: transparent none;
color: transparent;
border: none;
padding: 4px 8px 4px 4px;
box-shadow: none;
}
#advanced-options > button:focus {
outline-width: 0;
}
#advanced-options > button > span {
border-top: 4px solid #242424;
} }
.panel-header { .panel-header {
position: relative; position: absolute;
top: 4px; top: 4px;
right: 4px;
left: 4px;
z-index: 1; /* Display above the content wrapper */
} }
/* Timeline */ /* Timeline */
@ -281,7 +337,7 @@ div.ColVis_collectionBackground {
font-family: Arial, Helvetica, sans-serif; font-family: Arial, Helvetica, sans-serif;
font-size: 12px; font-size: 12px;
padding: 0; padding: 0;
margin: 0 4px 0; margin: 0;
} }
.nav-tabs a { .nav-tabs a {
@ -313,6 +369,7 @@ div.ColVis_collectionBackground {
/* Media editors */ /* Media editors */
#side_playlist { #side_playlist {
margin-top: 34px;
width: 100%; /* Override because we're using flexbox */ width: 100%; /* Override because we're using flexbox */
overflow-x: hidden; overflow-x: hidden;

View File

@ -148,6 +148,13 @@ var AIRTIME = (function(AIRTIME) {
"</div>"); "</div>");
}; };
mod.moveSearchBarToHeader = function() {
$("#library_display_filter").appendTo("#library_content > .panel-header");
$("#advanced_search").click(function(e) {
e.stopPropagation();
});
};
mod.createToolbarDropDown = function() { mod.createToolbarDropDown = function() {
$('#sb-select-page').click(function(){mod.selectCurrentPage();}); $('#sb-select-page').click(function(){mod.selectCurrentPage();});
$('#sb-dselect-page').click(function(){mod.deselectCurrentPage();}); $('#sb-dselect-page').click(function(){mod.deselectCurrentPage();});
@ -449,7 +456,7 @@ var AIRTIME = (function(AIRTIME) {
if (ele.bVisible) { if (ele.bVisible) {
advanceSearchDiv.append( advanceSearchDiv.append(
"<div id='advanced_search_col_"+currentColId+"' class='control-group'>" + "<div id='advanced_search_col_"+currentColId+"' class='control-group'>" +
"<label class='control-label'"+labelStyle+">"+ele.sTitle+" : </label>" + "<label class='control-label'"+labelStyle+">"+ele.sTitle+"</label>" +
"<div id='"+ele.mDataProp+"' class='controls "+inputClass+"'></div>" + "<div id='"+ele.mDataProp+"' class='controls "+inputClass+"'></div>" +
"</div>"); "</div>");
} else { } else {
@ -501,7 +508,7 @@ var AIRTIME = (function(AIRTIME) {
"aoColumns": [ "aoColumns": [
/* ftype */ { "sTitle" : "" , "mDataProp" : "ftype" , "bSearchable" : false , "bVisible" : false } , /* ftype */ { "sTitle" : "" , "mDataProp" : "ftype" , "bSearchable" : false , "bVisible" : false } ,
/* Type */ { "sTitle" : "" , "mDataProp" : "image" , "bSearchable" : false , "sWidth" : "16px" , "sClass" : "library_type" , "iDataSort" : 0 } , /* Type */ { "sTitle" : "" , "mDataProp" : "image" , "bSearchable" : false , "sWidth" : "16px" , "sClass" : "library_type" , "iDataSort" : 0 } ,
///* Is Scheduled */ { "sTitle" : $.i18n._("Scheduled") , "mDataProp" : "is_scheduled" , "bVisible" : false , "bSearchable" : false , "sWidth" : "90px" , "sClass" : "library_is_scheduled"} , /* Is Scheduled */ { "sTitle" : $.i18n._("Scheduled") , "mDataProp" : "is_scheduled" , "bVisible" : false , "bSearchable" : false , "sWidth" : "90px" , "sClass" : "library_is_scheduled"} ,
/* Is Playlist */ { "sTitle" : $.i18n._("Playlist / Block") , "mDataProp" : "is_playlist" , "bSearchable" : false , "sWidth" : "110px" , "sClass" : "library_is_playlist"} , /* Is Playlist */ { "sTitle" : $.i18n._("Playlist / Block") , "mDataProp" : "is_playlist" , "bSearchable" : false , "sWidth" : "110px" , "sClass" : "library_is_playlist"} ,
/* Title */ { "sTitle" : $.i18n._("Title") , "mDataProp" : "track_title" , "sClass" : "library_title" , "sWidth" : "170px" } , /* Title */ { "sTitle" : $.i18n._("Title") , "mDataProp" : "track_title" , "sClass" : "library_title" , "sWidth" : "170px" } ,
/* Creator */ { "sTitle" : $.i18n._("Creator") , "mDataProp" : "artist_name" , "sClass" : "library_creator" , "sWidth" : "160px" } , /* Creator */ { "sTitle" : $.i18n._("Creator") , "mDataProp" : "artist_name" , "sClass" : "library_creator" , "sWidth" : "160px" } ,
@ -575,7 +582,7 @@ var AIRTIME = (function(AIRTIME) {
// sure everything works properly. // sure everything works properly.
for (i = 0, length = a.length; i < length; i++) { for (i = 0, length = a.length; i < length; i++) {
if (typeof(a[i]) === "string") { if (typeof(a[i]) === "string") {
a[i] = (a[i] === "true") ? true : false; a[i] = (a[i] === "true");
} }
} }
} }
@ -685,7 +692,7 @@ var AIRTIME = (function(AIRTIME) {
"oLanguage": datatables_dict, "oLanguage": datatables_dict,
// R = ColReorder, C = ColVis // R = ColReorder, C = ColVis
"sDom": 'R<"dt-process-rel"r><"H"<"library_toolbar"Cf>><"dataTables_scrolling"t><"F"ilp>>', "sDom": 'Rf<"dt-process-rel"r><"H"<"library_toolbar"C>><"dataTables_scrolling"t><"F"ilp>>',
"oColVis": { "oColVis": {
"sAlign": "right", "sAlign": "right",
@ -1044,7 +1051,7 @@ function validateAdvancedSearch(divs) {
searchTerm[0] = ""; searchTerm[0] = "";
searchTerm[1] = ""; searchTerm[1] = "";
$.each(divs, function(i, div){ $.each(divs, function(i, div){
fieldName = $(div).children(':nth-child(2)').attr('id'); fieldName = $(div).children('div').attr('id');
fields = $(div).children().find('input'); fields = $(div).children().find('input');
searchTermType = validationTypes[fieldName]; searchTermType = validationTypes[fieldName];
valid = true; valid = true;
@ -1088,9 +1095,9 @@ function validateAdvancedSearch(divs) {
*/ */
} else if (searchTerm[0] === "" && searchTerm[1] !== "" || } else if (searchTerm[0] === "" && searchTerm[1] !== "" ||
searchTerm[0] === "" && searchTerm[1] === ""){ searchTerm[0] === "" && searchTerm[1] === ""){
if ($(field).closest('div').children(':last-child').hasClass('checked-icon') || if ($(field).closest('div').prev().hasClass('checked-icon') ||
$(field).closest('div').children(':last-child').hasClass('not-available-icon')) { $(field).closest('div').prev().hasClass('not-available-icon')) {
$(field).closest('div').children(':last-child').remove(); $(field).closest('div').prev().remove();
} }
} }
@ -1119,24 +1126,30 @@ function addRemoveValidationIcons(valid, field, searchTermType) {
invalidIndicator = " <span title='"+title+"' class='not-available-icon sp-checked-icon'></span>"; invalidIndicator = " <span title='"+title+"' class='not-available-icon sp-checked-icon'></span>";
if (valid) { if (valid) {
if (!field.closest('div').children(':last-child').hasClass('checked-icon')) { if (!field.closest('div').prev().hasClass('checked-icon')) {
// remove invalid icon before adding valid icon // remove invalid icon before adding valid icon
if (field.closest('div').children(':last-child').hasClass('not-available-icon')) { if (field.closest('div').prev().hasClass('not-available-icon')) {
field.closest('div').children(':last-child').remove(); field.closest('div').prev().remove();
} }
field.closest('div').append(validIndicator); field.closest('div').before(validIndicator);
} }
} else { } else {
if (!field.closest('div').children(':last-child').hasClass('not-available-icon')) { if (!field.closest('div').prev().hasClass('not-available-icon')) {
// remove valid icon before adding invalid icon // remove valid icon before adding invalid icon
if (field.closest('div').children(':last-child').hasClass('checked-icon')) { if (field.closest('div').prev().hasClass('checked-icon')) {
field.closest('div').children(':last-child').remove(); field.closest('div').prev().remove();
} }
field.closest('div').append(invalidIndicator); field.closest('div').before(invalidIndicator);
} }
} }
} }
function resizeAdvancedSearch() {
var s = $("#advanced_search");
s.css("max-height", $(window).height() / 4);
s.css("overflow", "auto");
}
/* /*
* Validation types: s => string i => integer n => numeric (positive/negative, * Validation types: s => string i => integer n => numeric (positive/negative,
* whole/decimals) t => timestamp l => length * whole/decimals) t => timestamp l => length
@ -1212,5 +1225,13 @@ $(document).ready(function() {
oTable.fnDraw(); oTable.fnDraw();
} }
}); });
$("#advanced-options").on("click", function() {
resizeAdvancedSearch();
});
$(window).resize(function() {
resizeAdvancedSearch();
});
}); });

View File

@ -224,6 +224,7 @@ var AIRTIME = (function(AIRTIME) {
var $toolbar = $(".lib-content .fg-toolbar:first"); var $toolbar = $(".lib-content .fg-toolbar:first");
mod.createToolbarButtons(); mod.createToolbarButtons();
mod.moveSearchBarToHeader();
$toolbar.append($menu); $toolbar.append($menu);
// add to timeline button // add to timeline button

View File

@ -434,7 +434,7 @@ var AIRTIME = (function(AIRTIME){
/* fade out */ {"mDataProp": "fadeout", "sTitle": $.i18n._("Fade Out"), "bVisible": false, "sClass": "sb-fade-out"}, /* fade out */ {"mDataProp": "fadeout", "sTitle": $.i18n._("Fade Out"), "bVisible": false, "sClass": "sb-fade-out"},
/* Mime */ {"mDataProp" : "mime", "sTitle" : $.i18n._("Mime"), "bVisible": false, "sClass": "sb-mime"} /* Mime */ {"mDataProp" : "mime", "sTitle" : $.i18n._("Mime"), "bVisible": false, "sClass": "sb-mime"}
], ],
"bJQueryUI": true, "bJQueryUI": true,
"bSort": false, "bSort": false,
"bFilter": false, "bFilter": false,
@ -443,7 +443,7 @@ var AIRTIME = (function(AIRTIME){
"bInfo": false, "bInfo": false,
"bAutoWidth": false, "bAutoWidth": false,
"bDeferRender": true, "bDeferRender": true,
"bStateSave": true, "bStateSave": true,
"fnStateSaveParams": function (oSettings, oData) { "fnStateSaveParams": function (oSettings, oData) {
//remove oData components we don't want to save. //remove oData components we don't want to save.
@ -451,7 +451,7 @@ var AIRTIME = (function(AIRTIME){
delete oData.aoSearchCols; delete oData.aoSearchCols;
}, },
"fnStateSave": function fnStateSave(oSettings, oData) { "fnStateSave": function fnStateSave(oSettings, oData) {
localStorage.setItem('datatables-timeline', JSON.stringify(oData)); localStorage.setItem('datatables-timeline', JSON.stringify(oData));
/* /*
@ -464,19 +464,19 @@ var AIRTIME = (function(AIRTIME){
}, },
"fnStateLoad": function fnBuilderStateLoad(oSettings) { "fnStateLoad": function fnBuilderStateLoad(oSettings) {
var settings = localStorage.getItem('datatables-timeline'); var settings = localStorage.getItem('datatables-timeline');
if (settings !== "") { if (settings !== "") {
return JSON.parse(settings); return JSON.parse(settings);
} }
}, },
"fnStateLoadParams": function (oSettings, oData) { "fnStateLoadParams": function (oSettings, oData) {
var i, var i,
length, length,
a = oData.abVisCols; a = oData.abVisCols;
//putting serialized data back into the correct js type to make //putting serialized data back into the correct js type to make
//sure everything works properly. //sure everything works properly.
for (i = 0, length = a.length; i < length; i++) { for (i = 0, length = a.length; i < length; i++) {
if (typeof(a[i]) === "string") { if (typeof(a[i]) === "string") {
a[i] = (a[i] === "true") ? true : false; a[i] = (a[i] === "true") ? true : false;
} }
@ -491,10 +491,10 @@ var AIRTIME = (function(AIRTIME){
} }
} }
}*/ }*/
oData.iCreate = parseInt(oData.iCreate, 10); oData.iCreate = parseInt(oData.iCreate, 10);
}, },
"fnServerData": mod.fnServerData, "fnServerData": mod.fnServerData,
"fnRowCallback": function fnRowCallback( nRow, aData, iDisplayIndex, iDisplayIndexFull ) { "fnRowCallback": function fnRowCallback( nRow, aData, iDisplayIndex, iDisplayIndexFull ) {
var i, length, var i, length,
@ -523,19 +523,19 @@ var AIRTIME = (function(AIRTIME){
$node.html(""); $node.html("");
$node.attr("style", "display : none"); $node.attr("style", "display : none");
} }
$nRow.addClass(sClass); $nRow.addClass(sClass);
}; };
if (aData.header === true) { if (aData.header === true) {
//remove the column classes from all tds. //remove the column classes from all tds.
$nRow.find('td').removeClass(); $nRow.find('td').removeClass();
$node = $(nRow.children[0]); $node = $(nRow.children[0]);
$node.html(""); $node.html("");
cl = 'sb-header'; cl = 'sb-header';
if (aData.record === true) { if (aData.record === true) {
$div = $("<div/>", { $div = $("<div/>", {
"class": "small-icon " + headerIcon "class": "small-icon " + headerIcon
@ -548,15 +548,15 @@ var AIRTIME = (function(AIRTIME){
}); });
$node.append($div); $node.append($div);
} }
sSeparatorHTML = '<span class="show-title">'+aData.title+'</span>'; sSeparatorHTML = '<span class="show-title">'+aData.title+'</span>';
if (aData.rebroadcast === true) { if (aData.rebroadcast === true) {
sSeparatorHTML += '<span>'+aData.rebroadcast_title+'</span>'; sSeparatorHTML += '<span>'+aData.rebroadcast_title+'</span>';
} }
sSeparatorHTML += '<span class="push-right">'; sSeparatorHTML += '<span class="push-right">';
if (aData.startDate === aData.endDate) { if (aData.startDate === aData.endDate) {
sSeparatorHTML += '<span class="show-date">'+aData.startDate+'</span><span class="show-time">'+aData.startTime+'</span>'; sSeparatorHTML += '<span class="show-date">'+aData.startDate+'</span><span class="show-time">'+aData.startTime+'</span>';
sSeparatorHTML +='-<span class="show-time">'+aData.endTime+'</span>'; sSeparatorHTML +='-<span class="show-time">'+aData.endTime+'</span>';
@ -565,18 +565,18 @@ var AIRTIME = (function(AIRTIME){
sSeparatorHTML += '<span class="show-date">'+aData.startDate+'</span><span class="show-time">'+aData.startTime+'</span>'; sSeparatorHTML += '<span class="show-date">'+aData.startDate+'</span><span class="show-time">'+aData.startTime+'</span>';
sSeparatorHTML +='-<span class="show-date">'+aData.endDate+'</span><span class="show-time">'+aData.endTime+'</span>'; sSeparatorHTML +='-<span class="show-date">'+aData.endDate+'</span><span class="show-time">'+aData.endTime+'</span>';
} }
sSeparatorHTML += '</span>'; sSeparatorHTML += '</span>';
fnPrepareSeparatorRow(sSeparatorHTML, cl, 1); fnPrepareSeparatorRow(sSeparatorHTML, cl, 1);
} }
else if (aData.footer === true) { else if (aData.footer === true) {
//remove the column classes from all tds. //remove the column classes from all tds.
$nRow.find('td').removeClass(); $nRow.find('td').removeClass();
$node = $(nRow.children[0]); $node = $(nRow.children[0]);
cl = 'sb-footer'; cl = 'sb-footer';
//check the show's content status. //check the show's content status.
if (aData.runtime >= 0) { if (aData.runtime >= 0) {
$node.html('<span class="ui-icon ui-icon-check"></span>'); $node.html('<span class="ui-icon ui-icon-check"></span>');
@ -586,37 +586,37 @@ var AIRTIME = (function(AIRTIME){
$node.html('<span class="ui-icon ui-icon-notice"></span>'); $node.html('<span class="ui-icon ui-icon-notice"></span>');
cl = cl + ' ui-state-error'; cl = cl + ' ui-state-error';
} }
sSeparatorHTML = '<span>'+aData.fRuntime+'</span>'; sSeparatorHTML = '<span>'+aData.fRuntime+'</span>';
fnPrepareSeparatorRow(sSeparatorHTML, cl, 1); fnPrepareSeparatorRow(sSeparatorHTML, cl, 1);
} }
else if (aData.empty === true) { else if (aData.empty === true) {
//remove the column classes from all tds. //remove the column classes from all tds.
$nRow.find('td').removeClass(); $nRow.find('td').removeClass();
$node = $(nRow.children[0]); $node = $(nRow.children[0]);
if ($node) { if ($node) {
$node.empty(); $node.empty();
} }
sSeparatorHTML = '<span>'+$.i18n._("Show Empty")+'</span>'; sSeparatorHTML = '<span>'+$.i18n._("Show Empty")+'</span>';
cl = cl + " sb-empty odd"; cl = cl + " sb-empty odd";
fnPrepareSeparatorRow(sSeparatorHTML, cl, 1); fnPrepareSeparatorRow(sSeparatorHTML, cl, 1);
} }
else if (aData.record === true) { else if (aData.record === true) {
//remove the column classes from all tds. //remove the column classes from all tds.
$nRow.find('td').removeClass(); $nRow.find('td').removeClass();
$node = $(nRow.children[0]); $node = $(nRow.children[0]);
$node.html(''); $node.html('');
sSeparatorHTML = '<span>'+$.i18n._("Recording From Line In")+'</span>'; sSeparatorHTML = '<span>'+$.i18n._("Recording From Line In")+'</span>';
cl = cl + " sb-record odd"; cl = cl + " sb-record odd";
fnPrepareSeparatorRow(sSeparatorHTML, cl, 1); fnPrepareSeparatorRow(sSeparatorHTML, cl, 1);
} }
else { else {
//add the play function if the file exists on disk. //add the play function if the file exists on disk.
$image = $nRow.find('td.sb-image'); $image = $nRow.find('td.sb-image');
$image.empty(); $image.empty();
@ -663,10 +663,10 @@ var AIRTIME = (function(AIRTIME){
$node.empty(); $node.empty();
} }
} }
//add the show colour to the leftmost td //add the show colour to the leftmost td
if (aData.footer !== true) { if (aData.footer !== true) {
if ($nRow.hasClass('sb-header')) { if ($nRow.hasClass('sb-header')) {
a = 1; a = 1;
} }
@ -676,15 +676,15 @@ var AIRTIME = (function(AIRTIME){
else if ($nRow.hasClass('even')) { else if ($nRow.hasClass('even')) {
a = 0.4; a = 0.4;
} }
//convert from hex to rgb. //convert from hex to rgb.
r = parseInt((aData.backgroundColor).substring(0,2), 16); r = parseInt((aData.backgroundColor).substring(0,2), 16);
g = parseInt((aData.backgroundColor).substring(2,4), 16); g = parseInt((aData.backgroundColor).substring(2,4), 16);
b = parseInt((aData.backgroundColor).substring(4,6), 16); b = parseInt((aData.backgroundColor).substring(4,6), 16);
$nRow.find('td:first').css('background', 'rgba('+r+', '+g+', '+b+', '+a+')'); $nRow.find('td:first').css('background', 'rgba('+r+', '+g+', '+b+', '+a+')');
} }
//save some info for reordering purposes. //save some info for reordering purposes.
$nRow.data({"aData": aData}); $nRow.data({"aData": aData});
@ -697,7 +697,7 @@ var AIRTIME = (function(AIRTIME){
else { else {
$nRow.addClass("sb-future"); $nRow.addClass("sb-future");
} }
if (aData.allowed !== true || aData.linked_allowed === false) { if (aData.allowed !== true || aData.linked_allowed === false) {
$nRow.addClass("sb-not-allowed"); $nRow.addClass("sb-not-allowed");
} }
@ -706,7 +706,7 @@ var AIRTIME = (function(AIRTIME){
$nRow.attr("id", aData.id); $nRow.attr("id", aData.id);
$nRow.attr("si_id", aData.instance); $nRow.attr("si_id", aData.instance);
} }
//status used to colour tracks. //status used to colour tracks.
if (aData.status === 2) { if (aData.status === 2) {
$nRow.addClass("sb-boundry"); $nRow.addClass("sb-boundry");
@ -714,22 +714,22 @@ var AIRTIME = (function(AIRTIME){
else if (aData.status === 0) { else if (aData.status === 0) {
$nRow.addClass("sb-over"); $nRow.addClass("sb-over");
} }
if (aData.currentShow === true) { if (aData.currentShow === true) {
$nRow.addClass("sb-current-show"); $nRow.addClass("sb-current-show");
} }
//call the context menu so we can prevent the event from propagating. //call the context menu so we can prevent the event from propagating.
$nRow.find('td:gt(1)').click(function(e){ $nRow.find('td:gt(1)').click(function(e){
$(this).contextMenu({x: e.pageX, y: e.pageY}); $(this).contextMenu({x: e.pageX, y: e.pageY});
return false; return false;
}); });
}, },
//remove any selected nodes before the draw. //remove any selected nodes before the draw.
"fnPreDrawCallback": function( oSettings ) { "fnPreDrawCallback": function( oSettings ) {
//make sure any dragging helpers are removed or else they'll be stranded on the screen. //make sure any dragging helpers are removed or else they'll be stranded on the screen.
$("#draggingContainer").remove(); $("#draggingContainer").remove();
}, },
@ -756,7 +756,7 @@ var AIRTIME = (function(AIRTIME){
$tr, $tr,
//use this array to cache DOM heights then we can detach the table to manipulate it to increase speed. //use this array to cache DOM heights then we can detach the table to manipulate it to increase speed.
heights = []; heights = [];
clearTimeout(mod.timeout); clearTimeout(mod.timeout);
/* /*
@ -764,24 +764,24 @@ var AIRTIME = (function(AIRTIME){
if ($lib.length > 0 && $lib.filter(":visible").length > 0) { if ($lib.length > 0 && $lib.filter(":visible").length > 0) {
$cursorRows = $sbTable.find("tbody tr.sb-future.sb-allowed:not(.sb-header, .sb-empty)"); $cursorRows = $sbTable.find("tbody tr.sb-future.sb-allowed:not(.sb-header, .sb-empty)");
//need to get heights of tds while elements are still in the DOM. //need to get heights of tds while elements are still in the DOM.
for (i = 0, length = $cursorRows.length; i < length; i++) { for (i = 0, length = $cursorRows.length; i < length; i++) {
$td = $($cursorRows.get(i)).find("td:first"); $td = $($cursorRows.get(i)).find("td:first");
heights.push($td.height()); heights.push($td.height());
} }
//detach the table to increase speed. //detach the table to increase speed.
$table.detach(); $table.detach();
for (i = 0, length = $cursorRows.length; i < length; i++) { for (i = 0, length = $cursorRows.length; i < length; i++) {
$td = $($cursorRows.get(i)).find("td:first"); $td = $($cursorRows.get(i)).find("td:first");
if ($td.hasClass("dataTables_empty")) { if ($td.hasClass("dataTables_empty")) {
$parent.append($table); $parent.append($table);
return false; return false;
} }
wrapperDiv = $("<div />", { wrapperDiv = $("<div />", {
"class": "innerWrapper", "class": "innerWrapper",
"css": { "css": {
@ -791,11 +791,11 @@ var AIRTIME = (function(AIRTIME){
markerDiv = $("<div />", { markerDiv = $("<div />", {
"class": "marker" "class": "marker"
}); });
$td.append(markerDiv).wrapInner(wrapperDiv); $td.append(markerDiv).wrapInner(wrapperDiv);
} }
//re-highlight selected cursors before draw took place //re-highlight selected cursors before draw took place
for (i = 0; i < cursorIds.length; i++) { for (i = 0; i < cursorIds.length; i++) {
if (headerFooter[i] == "f") { if (headerFooter[i] == "f") {
@ -803,7 +803,7 @@ var AIRTIME = (function(AIRTIME){
} else { } else {
$tr = $table.find("tr[id="+cursorIds[i]+"][si_id="+showInstanceIds[i]+"]"); $tr = $table.find("tr[id="+cursorIds[i]+"][si_id="+showInstanceIds[i]+"]");
} }
//If the currently playing track's cursor is selected, //If the currently playing track's cursor is selected,
//and that track is deleted, the cursor position becomes //and that track is deleted, the cursor position becomes
//unavailble. We have to check the position is available //unavailble. We have to check the position is available
@ -811,16 +811,16 @@ var AIRTIME = (function(AIRTIME){
// //
if ($tr.find(".sb-checkbox").children().hasClass("innerWrapper")) { if ($tr.find(".sb-checkbox").children().hasClass("innerWrapper")) {
mod.selectCursor($tr); mod.selectCursor($tr);
// If the selected cursor is the footer row we need to // If the selected cursor is the footer row we need to
//explicitly select it because that row does not have //explicitly select it because that row does not have
// innerWrapper class // innerWrapper class
// //
} else if ($tr.hasClass("sb-footer")) { } else if ($tr.hasClass("sb-footer")) {
mod.selectCursor($tr); mod.selectCursor($tr);
} }
} }
//if there is only 1 cursor on the page highlight it by default. //if there is only 1 cursor on the page highlight it by default.
if ($cursorRows.length === 1) { if ($cursorRows.length === 1) {
$td = $cursorRows.find("td:first"); $td = $cursorRows.find("td:first");
@ -828,7 +828,7 @@ var AIRTIME = (function(AIRTIME){
$cursorRows.addClass("cursor-selected-row"); $cursorRows.addClass("cursor-selected-row");
} }
} }
$parent.append($table); $parent.append($table);
} }
@ -838,11 +838,11 @@ var AIRTIME = (function(AIRTIME){
$sbTable.find("tr."+NOW_PLAYING_CLASS), $sbTable.find("tr."+NOW_PLAYING_CLASS),
$sbTable.find("tbody").find("tr.sb-future.sb-footer, tr.sb-future.sb-header").filter(":first") $sbTable.find("tbody").find("tr.sb-future.sb-footer, tr.sb-future.sb-header").filter(":first")
]; ];
//check which element we should set a timeout relative to. //check which element we should set a timeout relative to.
for (i = 0, length = elements.length; i < length; i++) { for (i = 0, length = elements.length; i < length; i++) {
temp = elements[i]; temp = elements[i];
if (temp.length > 0) { if (temp.length > 0) {
aData = temp.data("aData"); aData = temp.data("aData");
// max time interval // max time interval
@ -857,25 +857,25 @@ var AIRTIME = (function(AIRTIME){
} }
} }
mod.checkToolBarIcons(); mod.checkToolBarIcons();
}, },
// R = ColReorder, C = ColVis // R = ColReorder, C = ColVis
"sDom": 'R<"dt-process-rel"r><"sb-padded"<"H"C>><"dataTables_scrolling sb-padded"t>', "sDom": 'R<"dt-process-rel"r><"sb-padded"<"H"C>><"dataTables_scrolling sb-padded"t>',
"oColVis": { "oColVis": {
"aiExclude": [ 0, 1 ], "aiExclude": [ 0, 1 ],
"buttonText": $.i18n._("Show / hide columns"), "buttonText": $.i18n._("Show / hide columns"),
}, },
"oColReorder": { "oColReorder": {
"iFixedColumns": 2 "iFixedColumns": 2
}, },
"sAjaxDataProp": "schedule", "sAjaxDataProp": "schedule",
"oLanguage": datatables_dict, "oLanguage": datatables_dict,
"sAjaxSource": baseUrl+"showbuilder/builder-feed" "sAjaxSource": baseUrl+"showbuilder/builder-feed"
}); });
$sbTable.find("tbody").on("click", "input:checkbox", function(ev) { $sbTable.find("tbody").on("click", "input:checkbox", function(ev) {