SAAS-948 - Frontend tweaks and fixes

This commit is contained in:
Duncan Sommerville 2015-07-29 13:35:01 -04:00
parent fcbc37977f
commit 661a87dfbc
13 changed files with 806 additions and 711 deletions

View File

@ -29,25 +29,25 @@ 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/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/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/datatables/css/ColReorder.css?'.$CC_CONFIG['airtime_version']);
$this->view->headScript()->appendFile($baseUrl.'js/airtime/library/library-test.js?'.$CC_CONFIG['airtime_version'],'text/javascript'); $this->view->headScript()->appendFile($baseUrl.'js/airtime/library/_library.js?'.$CC_CONFIG['airtime_version'],'text/javascript');
$this->view->headScript()->appendFile($baseUrl.'js/airtime/library/events/library_showbuilder_test.js?'.$CC_CONFIG['airtime_version'],'text/javascript'); $this->view->headScript()->appendFile($baseUrl.'js/airtime/library/events/_library_showbuilder.js?'.$CC_CONFIG['airtime_version'],'text/javascript');
// PLUPLOAD // PLUPLOAD
$this->view->headScript()->appendFile($baseUrl.'js/libs/dropzone.min.js?'.$CC_CONFIG['airtime_version'],'text/javascript'); $this->view->headScript()->appendFile($baseUrl.'js/libs/dropzone.min.js?'.$CC_CONFIG['airtime_version'],'text/javascript');
$this->view->headLink()->appendStylesheet($baseUrl.'css/dropzone/dropzone.min.css?'.$CC_CONFIG['airtime_version']); $this->view->headLink()->appendStylesheet($baseUrl.'css/dropzone/dropzone.min.css?'.$CC_CONFIG['airtime_version']);
$this->view->headScript()->appendFile($baseUrl.'js/timepicker/jquery.ui.timepicker.js?'.$CC_CONFIG['airtime_version'],'text/javascript'); $this->view->headScript()->appendFile($baseUrl.'js/timepicker/jquery.ui.timepicker.js?'.$CC_CONFIG['airtime_version'],'text/javascript');
$this->view->headScript()->appendFile($baseUrl.'js/airtime/showbuilder/builder_test.js?'.$CC_CONFIG['airtime_version'],'text/javascript'); $this->view->headScript()->appendFile($baseUrl.'js/airtime/showbuilder/_builder.js?'.$CC_CONFIG['airtime_version'],'text/javascript');
$this->view->headScript()->appendFile($baseUrl.'js/airtime/showbuilder/main_builder_test.js?'.$CC_CONFIG['airtime_version'],'text/javascript'); $this->view->headScript()->appendFile($baseUrl.'js/airtime/showbuilder/_main_builder.js?'.$CC_CONFIG['airtime_version'],'text/javascript');
// MEDIA BUILDER // MEDIA BUILDER
$this->view->headScript()->appendFile($baseUrl.'js/airtime/library/spl-test.js?'.$CC_CONFIG['airtime_version'], 'text/javascript'); $this->view->headScript()->appendFile($baseUrl.'js/airtime/library/_spl.js?'.$CC_CONFIG['airtime_version'], 'text/javascript');
$this->view->headScript()->appendFile($baseUrl.'js/airtime/playlist/smart_blockbuilder.js?'.$CC_CONFIG['airtime_version'], 'text/javascript'); $this->view->headScript()->appendFile($baseUrl.'js/airtime/playlist/smart_blockbuilder.js?'.$CC_CONFIG['airtime_version'], 'text/javascript');
$this->view->headLink()->appendStylesheet($baseUrl.'css/playlist_builder.css?'.$CC_CONFIG['airtime_version']); $this->view->headLink()->appendStylesheet($baseUrl.'css/playlist_builder.css?'.$CC_CONFIG['airtime_version']);
$this->view->headLink()->appendStylesheet($baseUrl.'css/jquery.ui.timepicker.css?'.$CC_CONFIG['airtime_version']); $this->view->headLink()->appendStylesheet($baseUrl.'css/jquery.ui.timepicker.css?'.$CC_CONFIG['airtime_version']);
$this->view->headLink()->appendStylesheet($baseUrl.'css/showbuilder.css?'.$CC_CONFIG['airtime_version']); $this->view->headLink()->appendStylesheet($baseUrl.'css/showbuilder.css?'.$CC_CONFIG['airtime_version']);
$this->view->headLink()->appendStylesheet($baseUrl.'css/showbuilder-test.css?'.$CC_CONFIG['airtime_version']); $this->view->headLink()->appendStylesheet($baseUrl.'css/_showbuilder.css?'.$CC_CONFIG['airtime_version']);
$csrf_namespace = new Zend_Session_Namespace('csrf_namespace'); $csrf_namespace = new Zend_Session_Namespace('csrf_namespace');
$csrf_element = new Zend_Form_Element_Hidden('csrf'); $csrf_element = new Zend_Form_Element_Hidden('csrf');
@ -68,7 +68,7 @@ class ShowBuilderController extends Zend_Controller_Action {
$end = DateTime::createFromFormat("U", $to, $utcTimezone); $end = DateTime::createFromFormat("U", $to, $utcTimezone);
$end->setTimezone($displayTimeZone); $end->setTimezone($displayTimeZone);
$form = new Application_Form_ShowBuilderTest(); $form = new Application_Form_ShowBuilderNew();
$form->populate(array( $form->populate(array(
'sb_date_start' => $start->format("Y-m-d"), 'sb_date_start' => $start->format("Y-m-d"),
'sb_time_start' => $start->format("H:i"), 'sb_time_start' => $start->format("H:i"),

View File

@ -1,6 +1,6 @@
<?php <?php
class Application_Form_ShowBuilderTest extends Zend_Form_SubForm class Application_Form_ShowBuilderNew extends Zend_Form_SubForm
{ {
public function init() public function init()
@ -69,7 +69,7 @@ class Application_Form_ShowBuilderTest extends Zend_Form_SubForm
// add a select to choose a show. // add a select to choose a show.
$showSelect = new Zend_Form_Element_Select("sb_show_filter"); $showSelect = new Zend_Form_Element_Select("sb_show_filter");
$showSelect->setLabel(_("Show:")); $showSelect->setLabel(_("Filter by Show"));
$showSelect->setMultiOptions($this->getShowNames()); $showSelect->setMultiOptions($this->getShowNames());
$showSelect->setValue(null); $showSelect->setValue(null);
$showSelect->setDecorators(array('ViewHelper')); $showSelect->setDecorators(array('ViewHelper'));
@ -85,7 +85,7 @@ class Application_Form_ShowBuilderTest extends Zend_Form_SubForm
private function getShowNames() private function getShowNames()
{ {
$showNames = array("0" => "-------------------------"); $showNames = array("0" => "Filter by Show");
$shows = CcShowQuery::create() $shows = CcShowQuery::create()
->setFormatter(ModelCriteria::FORMAT_ON_DEMAND) ->setFormatter(ModelCriteria::FORMAT_ON_DEMAND)

View File

@ -1,8 +1,16 @@
<?php echo $this->element->getElement('sb_date_start'); ?> <div class="sb-options-form">
<?php echo $this->element->getElement('sb_time_start'); ?> <?php echo $this->element->getElement('sb_date_start'); ?>
<?php echo $this->element->getElement('sb_date_end'); ?> <?php echo $this->element->getElement('sb_time_start'); ?>
<?php echo $this->element->getElement('sb_time_end'); ?> <?php echo $this->element->getElement('sb_date_end'); ?>
<?php echo $this->element->getElement('sb_time_end'); ?>
<a id="sb_submit" class="btn btn-small" href="#" title="Display shows in the specified date and time range">
<i class="icon-white icon-search"></i><?php echo " "._("Find Shows") ?>
</a>
<a id="sb_submit" class="btn btn-small" href="#" title="Display shows in the specified date and time range"> <?php echo $this->element->getElement('sb_show_filter') ?>
<i class="icon-white icon-search"></i><?php echo " "._("Find Shows") ?>
</a> <?php if ($this->element->getElement('sb_my_shows')):?>
<label><?php echo $this->element->getElement('sb_my_shows')->getLabel(); ?></label>
<?php echo $this->element->getElement('sb_my_shows'); ?>
<?php endif;?>
</div>

View File

@ -10,11 +10,14 @@
.wrapper { .wrapper {
position: absolute; position: absolute;
background: #242424; background: #242424;
top: 138px;
left: 0; left: 0;
right: 0; right: 0;
/*padding: 0;*/ padding: 0 12em;
padding: 2em; height: calc(100% - 141px); /* Height of top panel + border */
}
.usability_hint {
margin-top: 1em;
} }
</style> </style>
<form action="/rest/media" method="post" id="upload_form" class="dropzone dz-clickable" <?php if ($this->quotaLimitReached) { ?> class="hidden" <?php } ?>> <form action="/rest/media" method="post" id="upload_form" class="dropzone dz-clickable" <?php if ($this->quotaLimitReached) { ?> class="hidden" <?php } ?>>

View File

@ -21,7 +21,7 @@
<?php endif; ?> <?php endif; ?>
</div> </div>
<?php if (isset($this->obj)) : ?> <?php if (isset($this->obj)) : ?>\
<input id="obj_id" type="hidden" value="<?php echo $this->obj->getId(); ?>"/> <input id="obj_id" type="hidden" value="<?php echo $this->obj->getId(); ?>"/>
<input id="obj_lastMod" type="hidden" value="<?php echo "1";//$this->obj->getLastModified('U'); ?>"/> <input id="obj_lastMod" type="hidden" value="<?php echo "1";//$this->obj->getLastModified('U'); ?>"/>
<input id="obj_type" type="hidden" value="webstream"/> <input id="obj_type" type="hidden" value="webstream"/>

View File

@ -1,7 +1,8 @@
/* Show Builder*/ /* Show Builder*/
@media screen and (max-width: 1175px) { @media screen and (max-width: 1475px) {
.lib-test, .sb-test, .media-builder-test, #media_type_nav { .lib-test, .sb-test, .media-builder-test, #media_type_nav {
height: auto !important;
width: 100% !important; width: 100% !important;
} }
.media-builder-test { .media-builder-test {
@ -28,6 +29,20 @@
width: calc(100% - 1em) !important; width: calc(100% - 1em) !important;
margin: 0 .5em .5em 0; margin: 0 .5em .5em 0;
} }
.wrapper {
padding: 1em !important;
}
}
@media screen and (max-width: 555px) {
#sb_show_filter {
float: none !important;
margin-top: 4px;
}
}
.btn {
color: #efefef;
} }
.lib-test .dataTables_filter { .lib-test .dataTables_filter {
@ -36,7 +51,7 @@
.lib-test .dataTables_filter input[type="text"], .lib-test .dataTables_filter select { .lib-test .dataTables_filter input[type="text"], .lib-test .dataTables_filter select {
margin-top: .5em; margin-top: .5em;
width: 30%; width: 20%;
float: right; float: right;
height: 26px; height: 26px;
} }
@ -63,26 +78,56 @@
overflow: hidden !important; overflow: hidden !important;
} }
.lib-test .dataTables_scrolling {
/* Subtract Advanced search (32) + header (38) + footer (38) */
height: calc(100% - 108px);
}
#library_display_wrapper, #show_builder_table_wrapper {
background-color: #474747;
}
.lib-test, .sb-test, .media-builder-test { .lib-test, .sb-test, .media-builder-test {
height: 70%;
/* 1em for the middle margin, 6 for half the width of the left pane */ /* 1em for the middle margin, 6 for half the width of the left pane */
width: calc(50% - 8em); width: calc(50% - 8em);
min-width: 470px; min-width: 470px;
} }
#library_display_wrapper, #show_builder_table_wrapper {
height: 100%;
}
/* Timeline */ /* Timeline */
.sb-test { .sb-test {
margin-top: 1.5em; margin-top: 2em;
} }
#sb_submit { #sb_submit {
text-decoration: none; text-decoration: none;
padding: .35em; padding: .35em;
color: #efefef; color: #efefef;
float: none;
} }
.sb-timerange { .sb-options-form {
margin-bottom: 5px; width: 100%;
float: left;
padding-bottom: 5px;
}
.sb-options-form label {
color: #efefef;
line-height: 26px;
}
#sb_show_filter {
float: right;
}
#show_builder_table_wrapper {
clear: both;
} }
/* Media builder */ /* Media builder */
@ -102,7 +147,7 @@
#media_type_nav { #media_type_nav {
float: left; float: left;
margin: 2em 0 0 0; margin: 5.2em 0 0 0;
width: 12em; width: 12em;
@ -159,4 +204,6 @@
font-size: 20px; font-size: 20px;
font-weight: 300; font-weight: 300;
line-height: 1.4rem; line-height: 1.4rem;
margin-top: 1em;
} }

View File

@ -166,7 +166,7 @@ td.library_bitrate {
} }
.lib-content fieldset.closed { .lib-content fieldset.closed {
border-width: 1px 0 0; border-width: 1px 0 0;
margin-bottom: -6px; margin-bottom: 0;
margin-left: 1px; margin-left: 1px;
} }
.dataTables_filter input[type="text"], .dataTables_filter select { .dataTables_filter input[type="text"], .dataTables_filter select {

View File

@ -550,7 +550,7 @@ input[type="text"]:focus, input[type="password"]:focus, textarea:focus, .input_t
border: 1px solid #5b5b5b; border: 1px solid #5b5b5b;
font-family: Arial,Helvetica,sans-serif; font-family: Arial,Helvetica,sans-serif;
font-size: 12px; font-size: 12px;
height: 25px; height: 26px;
margin: 0; margin: 0;
padding: 2px 2px 2px 0; padding: 2px 2px 2px 0;
vertical-align: top; vertical-align: top;

View File

@ -51,12 +51,12 @@ var AIRTIME = (function(AIRTIME) {
"info_url" : "s", "info_url" : "s",
"replay_gain" : "n" "replay_gain" : "n"
}; };
if (AIRTIME.library === undefined) { if (AIRTIME.library === undefined) {
AIRTIME.library = {}; AIRTIME.library = {};
} }
mod = AIRTIME.library; mod = AIRTIME.library;
mod.getChosenItemsLength = function(){ mod.getChosenItemsLength = function(){
var cItem, var cItem,
selected, selected,
@ -69,14 +69,14 @@ var AIRTIME = (function(AIRTIME) {
if (cItem === $(this).attr("id")) { if (cItem === $(this).attr("id")) {
visibleChosenItems[cItem] = $(this).data('aData'); visibleChosenItems[cItem] = $(this).data('aData');
} }
} }
}); });
selected = Object.keys(visibleChosenItems).length; selected = Object.keys(visibleChosenItems).length;
visibleChosenItems = {}; visibleChosenItems = {};
return selected; return selected;
}; };
mod.getChosenAudioFilesLength = function(){ mod.getChosenAudioFilesLength = function(){
// var files = Object.keys(chosenItems), // var files = Object.keys(chosenItems),
var files, var files,
@ -85,7 +85,7 @@ var AIRTIME = (function(AIRTIME) {
i, length, i, length,
count = 0, count = 0,
reAudio=/^(au|st|pl|bl)/ ; reAudio=/^(au|st|pl|bl)/ ;
// Get visible items and check if any chosenItems are visible // Get visible items and check if any chosenItems are visible
$trs = $libTable.find("tr"); $trs = $libTable.find("tr");
$trs.each(function(i){ $trs.each(function(i){
@ -93,13 +93,13 @@ var AIRTIME = (function(AIRTIME) {
if (cItem === $(this).attr("id")) { if (cItem === $(this).attr("id")) {
visibleChosenItems[cItem] = $(this).data('aData'); visibleChosenItems[cItem] = $(this).data('aData');
} }
} }
}); });
files = Object.keys(visibleChosenItems); files = Object.keys(visibleChosenItems);
for (i = 0, length = files.length; i < length; i++) { for (i = 0, length = files.length; i < length; i++) {
if (files[i].search(reAudio) !== -1) { if (files[i].search(reAudio) !== -1) {
count++; count++;
} }
@ -107,22 +107,22 @@ var AIRTIME = (function(AIRTIME) {
visibleChosenItems = {}; visibleChosenItems = {};
return count; return count;
}; };
mod.changeAddButtonText = function($button, btnText) { mod.changeAddButtonText = function($button, btnText) {
$button.text(btnText); $button.text(btnText);
}; };
mod.createToolbarButtons = function() { mod.createToolbarButtons = function () {
$menu = $("<div class='btn-toolbar' />"); $menu = $("<div class='btn-toolbar' />");
$menu $menu
.append("<div class='btn-group'>" + .append("<div class='btn-group'>" +
"<button class='btn btn-small dropdown-toggle' data-toggle='dropdown'>" + "<button class='btn btn-small dropdown-toggle' data-toggle='dropdown'>" +
$.i18n._("Select")+" <span class='caret'></span>" + $.i18n._("Select") + " <span class='caret'></span>" +
"</button>" + "</button>" +
"<ul class='dropdown-menu'>" + "<ul class='dropdown-menu'>" +
"<li id='sb-select-page'><a href='#'>"+$.i18n._("Select this page")+"</a></li>" + "<li id='sb-select-page'><a href='#'>" + $.i18n._("Select this page") + "</a></li>" +
"<li id='sb-dselect-page'><a href='#'>"+$.i18n._("Deselect this page")+"</a></li>" + "<li id='sb-dselect-page'><a href='#'>" + $.i18n._("Deselect this page") + "</a></li>" +
"<li id='sb-dselect-all'><a href='#'>"+$.i18n._("Deselect all")+"</a></li>" + "<li id='sb-dselect-all'><a href='#'>" + $.i18n._("Deselect all") + "</a></li>" +
"</ul>" + "</ul>" +
"</div>") "</div>")
.append("<div class='btn-group'>" + .append("<div class='btn-group'>" +
@ -147,7 +147,7 @@ var AIRTIME = (function(AIRTIME) {
"</button>" + "</button>" +
"</div>"); "</div>");
}; };
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();});
@ -208,15 +208,15 @@ var AIRTIME = (function(AIRTIME) {
AIRTIME.library.checkEditButton(); AIRTIME.library.checkEditButton();
AIRTIME.library.checkNewButton(); AIRTIME.library.checkNewButton();
}; };
mod.getSelectedData = function() { mod.getSelectedData = function() {
var id, var id,
data = [], data = [],
cItem, cItem,
$trs; $trs;
$.fn.reverse = [].reverse; $.fn.reverse = [].reverse;
// Get visible items and check if any chosenItems are visible // Get visible items and check if any chosenItems are visible
$trs = $libTable.find("tr").reverse(); $trs = $libTable.find("tr").reverse();
$trs.each(function(i){ $trs.each(function(i){
@ -224,9 +224,9 @@ var AIRTIME = (function(AIRTIME) {
if (cItem === $(this).attr("id")) { if (cItem === $(this).attr("id")) {
visibleChosenItems[cItem] = $(this).data('aData'); visibleChosenItems[cItem] = $(this).data('aData');
} }
} }
}); });
for (id in visibleChosenItems) { for (id in visibleChosenItems) {
if (visibleChosenItems.hasOwnProperty(id)) { if (visibleChosenItems.hasOwnProperty(id)) {
data.push(visibleChosenItems[id]); data.push(visibleChosenItems[id]);
@ -235,64 +235,64 @@ var AIRTIME = (function(AIRTIME) {
visibleChosenItems = {}; visibleChosenItems = {};
return data; return data;
}; };
mod.redrawChosen = function() { mod.redrawChosen = function() {
var ids = Object.keys(chosenItems), var ids = Object.keys(chosenItems),
i, length, i, length,
$el; $el;
for (i = 0, length = ids.length; i < length; i++) { for (i = 0, length = ids.length; i < length; i++) {
$el = $libTable.find("#"+ids[i]); $el = $libTable.find("#"+ids[i]);
if ($el.length !== 0) { if ($el.length !== 0) {
mod.highlightItem($el); mod.highlightItem($el);
} }
} }
}; };
mod.isChosenItem = function($el) { mod.isChosenItem = function($el) {
var id = $el.attr("id"), var id = $el.attr("id"),
item = chosenItems[id]; item = chosenItems[id];
return item !== undefined; return item !== undefined;
}; };
mod.addToChosen = function($el) { mod.addToChosen = function($el) {
var id = $el.attr("id"); var id = $el.attr("id");
chosenItems[id] = $el.data('aData'); chosenItems[id] = $el.data('aData');
}; };
mod.removeFromChosen = function($el) { mod.removeFromChosen = function($el) {
var id = $el.attr("id"); var id = $el.attr("id");
// used to not keep dragged items selected. // used to not keep dragged items selected.
if (!$el.hasClass(LIB_SELECTED_CLASS)) { if (!$el.hasClass(LIB_SELECTED_CLASS)) {
delete chosenItems[id]; delete chosenItems[id];
} }
}; };
mod.highlightItem = function($el) { mod.highlightItem = function($el) {
$el.addClass(LIB_SELECTED_CLASS); $el.addClass(LIB_SELECTED_CLASS);
}; };
mod.unHighlightItem = function($el) { mod.unHighlightItem = function($el) {
$el.removeClass(LIB_SELECTED_CLASS); $el.removeClass(LIB_SELECTED_CLASS);
}; };
mod.selectItem = function($el) { mod.selectItem = function($el) {
mod.highlightItem($el); mod.highlightItem($el);
mod.addToChosen($el); mod.addToChosen($el);
mod.checkToolBarIcons(); mod.checkToolBarIcons();
}; };
mod.deselectItem = function($el) { mod.deselectItem = function($el) {
mod.unHighlightItem($el); mod.unHighlightItem($el);
mod.removeFromChosen($el); mod.removeFromChosen($el);
mod.checkToolBarIcons(); mod.checkToolBarIcons();
}; };
/* /*
* selects all items which the user can currently see. (behaviour taken from * selects all items which the user can currently see. (behaviour taken from
* gmail) * gmail)
@ -311,9 +311,9 @@ var AIRTIME = (function(AIRTIME) {
}); });
mod.checkToolBarIcons(); mod.checkToolBarIcons();
}; };
/* /*
* deselects all items that the user can currently see. (behaviour taken * deselects all items that the user can currently see. (behaviour taken
* from gmail) * from gmail)
@ -321,32 +321,33 @@ var AIRTIME = (function(AIRTIME) {
mod.deselectCurrentPage = function() { mod.deselectCurrentPage = function() {
var $trs = $libTable.find("tr"), id; var $trs = $libTable.find("tr"), id;
$trs.removeClass(LIB_SELECTED_CLASS); $trs.removeClass(LIB_SELECTED_CLASS);
$trs.each(function(i, el){ $trs.each(function(i, el){
$el = $(this); $el = $(this);
id = $el.attr("id"); id = $el.attr("id");
delete chosenItems[id]; delete chosenItems[id];
}); });
mod.checkToolBarIcons(); mod.checkToolBarIcons();
}; };
mod.selectNone = function() { mod.selectNone = function() {
var $trs = $libTable.find("tr"); var $trs = $libTable.find("tr");
$trs.removeClass(LIB_SELECTED_CLASS); $trs.removeClass(LIB_SELECTED_CLASS);
$previouslySelected = undefined;
chosenItems = {}; chosenItems = {};
mod.checkToolBarIcons(); mod.checkToolBarIcons();
}; };
mod.fnDeleteItems = function(aMedia) { mod.fnDeleteItems = function(aMedia) {
//Prevent the user from spamming the delete button while the AJAX request is in progress //Prevent the user from spamming the delete button while the AJAX request is in progress
AIRTIME.button.disableButton("btn-group #sb-trash", false); AIRTIME.button.disableButton("btn-group #sb-trash", false);
$.post(baseUrl+"library/delete", $.post(baseUrl+"library/delete",
{"format": "json", "media": aMedia}, {"format": "json", "media": aMedia},
function(json){ function(json){
if (json.message !== undefined) { if (json.message !== undefined) {
alert(json.message); alert(json.message);
@ -359,7 +360,7 @@ var AIRTIME = (function(AIRTIME) {
AIRTIME.button.enableButton("btn-group #sb-trash", false); AIRTIME.button.enableButton("btn-group #sb-trash", false);
}); });
}; };
mod.fnDeleteSelectedItems = function() { mod.fnDeleteSelectedItems = function() {
if (confirm($.i18n._('Are you sure you want to delete the selected item(s)?'))) { if (confirm($.i18n._('Are you sure you want to delete the selected item(s)?'))) {
var aData = AIRTIME.library.getSelectedData(), var aData = AIRTIME.library.getSelectedData(),
@ -376,7 +377,7 @@ var AIRTIME = (function(AIRTIME) {
if (temp !== null && temp.hasOwnProperty('id') ) { if (temp !== null && temp.hasOwnProperty('id') ) {
aMedia.push({"id": temp.id, "type": temp.ftype}); aMedia.push({"id": temp.id, "type": temp.ftype});
if ( (temp.id == currentObjId && temp.ftype === currentObjType) || if ( (temp.id == currentObjId && temp.ftype === currentObjType) ||
temp.id == currentObjId && temp.ftype === "stream" && currentObjType === "webstream") { temp.id == currentObjId && temp.ftype === "stream" && currentObjType === "webstream") {
closeObj = true; closeObj = true;
} }
} }
@ -396,37 +397,37 @@ var AIRTIME = (function(AIRTIME) {
} }
} }
}; };
libraryInit = function() { libraryInit = function() {
$libContent = $("#library_content"); $libContent = $("#library_content");
/* /*
* Icon hover states in the toolbar. * Icon hover states in the toolbar.
*/ */
$libContent.on("mouseenter", ".fg-toolbar ul li", function(ev) { $libContent.on("mouseenter", ".fg-toolbar ul li", function(ev) {
$el = $(this); $el = $(this);
if (!$el.hasClass("ui-state-disabled")) { if (!$el.hasClass("ui-state-disabled")) {
$el.addClass("ui-state-hover"); $el.addClass("ui-state-hover");
} }
}); });
$libContent.on("mouseleave", ".fg-toolbar ul li", function(ev) { $libContent.on("mouseleave", ".fg-toolbar ul li", function(ev) {
$el = $(this); $el = $(this);
if (!$el.hasClass("ui-state-disabled")) { if (!$el.hasClass("ui-state-disabled")) {
$el.removeClass("ui-state-hover"); $el.removeClass("ui-state-hover");
} }
}); });
var colReorderMap = new Array(); var colReorderMap = new Array();
$libTable = $libContent.find("table"); $libTable = $libContent.find("table");
function getTableHeight() { function getTableHeight() {
return $libContent.height() - 175; return $libContent.height() - 175;
} }
function setColumnFilter(oTable){ function setColumnFilter(oTable){
// TODO : remove this dirty hack once js is refactored // TODO : remove this dirty hack once js is refactored
if (!oTable.fnSettings()) { return ; } if (!oTable.fnSettings()) { return ; }
@ -437,28 +438,28 @@ var AIRTIME = (function(AIRTIME) {
$.each(aoCols, function(i,ele){ $.each(aoCols, function(i,ele){
if (ele.bSearchable) { if (ele.bSearchable) {
var currentColId = ele._ColReorder_iOrigCol; var currentColId = ele._ColReorder_iOrigCol;
var inputClass = 'filter_column filter_number_text'; var inputClass = 'filter_column filter_number_text';
var labelStyle = "style='margin-right:35px;'"; var labelStyle = "style='margin-right:35px;'";
if (libraryColumnTypes[ele.mDataProp] != "s") { if (libraryColumnTypes[ele.mDataProp] != "s") {
inputClass = 'filterColumn filter_number_range'; inputClass = 'filterColumn filter_number_range';
labelStyle = ""; labelStyle = "";
} }
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 {
advanceSearchDiv.append( advanceSearchDiv.append(
"<div id='advanced_search_col_"+currentColId+"' class='control-group' style='display:none;'>" + "<div id='advanced_search_col_"+currentColId+"' class='control-group' style='display:none;'>" +
"<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>");
} }
if (libraryColumnTypes[ele.mDataProp] == "s") { if (libraryColumnTypes[ele.mDataProp] == "s") {
var obj = { sSelector: "#"+ele.mDataProp } var obj = { sSelector: "#"+ele.mDataProp }
} else { } else {
@ -469,80 +470,80 @@ var AIRTIME = (function(AIRTIME) {
colsForAdvancedSearch.push(null); colsForAdvancedSearch.push(null);
} }
}); });
oTable.columnFilter({ oTable.columnFilter({
aoColumns: colsForAdvancedSearch, aoColumns: colsForAdvancedSearch,
bUseColVis: true, bUseColVis: true,
sPlaceHolder: "head:before" sPlaceHolder: "head:before"
} }
); );
} }
function setFilterElement(iColumn, bVisible){ function setFilterElement(iColumn, bVisible){
var actualId = colReorderMap[iColumn]; var actualId = colReorderMap[iColumn];
var selector = "div#advanced_search_col_"+actualId; var selector = "div#advanced_search_col_"+actualId;
var $el = $(selector); var $el = $(selector);
if (bVisible) { if (bVisible) {
$el.show(); $el.show();
} else { } else {
$el.hide(); $el.hide();
} }
//resize to prevent double scroll bars. //resize to prevent double scroll bars.
var $fs = $el.parents("fieldset"), var $fs = $el.parents("fieldset"),
tableHeight = getTableHeight(), tableHeight = getTableHeight(),
searchHeight = $fs.height(); searchHeight = $fs.height();
$libContent.find(".dataTables_scrolling").css("max-height", tableHeight - searchHeight); $libContent.find(".dataTables_scrolling").css("max-height", tableHeight - searchHeight);
} }
oTable = $libTable.dataTable( { oTable = $libTable.dataTable( {
// put hidden columns at the top to insure they can never be visible // put hidden columns at the top to insure they can never be visible
// on the table through column reordering. // on the table through column reordering.
//IMPORTANT: WHEN ADDING A NEW COLUMN PLEASE CONSULT WITH THE WIKI //IMPORTANT: WHEN ADDING A NEW COLUMN PLEASE CONSULT WITH THE WIKI
// https://wiki.sourcefabric.org/display/CC/Adding+a+new+library+datatable+column // https://wiki.sourcefabric.org/display/CC/Adding+a+new+library+datatable+column
"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" } ,
/* Album */ { "sTitle" : $.i18n._("Album") , "mDataProp" : "album_title" , "sClass" : "library_album" , "sWidth" : "150px" } , /* Album */ { "sTitle" : $.i18n._("Album") , "mDataProp" : "album_title" , "sClass" : "library_album" , "sWidth" : "150px" } ,
/* Bit Rate */ { "sTitle" : $.i18n._("Bit Rate") , "mDataProp" : "bit_rate" , "bVisible" : false , "sClass" : "library_bitrate" , "sWidth" : "80px" }, /* Bit Rate */ { "sTitle" : $.i18n._("Bit Rate") , "mDataProp" : "bit_rate" , "bVisible" : false , "sClass" : "library_bitrate" , "sWidth" : "80px" },
/* BPM */ { "sTitle" : $.i18n._("BPM") , "mDataProp" : "bpm" , "bVisible" : false , "sClass" : "library_bpm" , "sWidth" : "50px" }, /* BPM */ { "sTitle" : $.i18n._("BPM") , "mDataProp" : "bpm" , "bVisible" : false , "sClass" : "library_bpm" , "sWidth" : "50px" },
/* Composer */ { "sTitle" : $.i18n._("Composer") , "mDataProp" : "composer" , "bVisible" : false , "sClass" : "library_composer" , "sWidth" : "150px" }, /* Composer */ { "sTitle" : $.i18n._("Composer") , "mDataProp" : "composer" , "bVisible" : false , "sClass" : "library_composer" , "sWidth" : "150px" },
/* Conductor */ { "sTitle" : $.i18n._("Conductor") , "mDataProp" : "conductor" , "bVisible" : false , "sClass" : "library_conductor" , "sWidth" : "125px" }, /* Conductor */ { "sTitle" : $.i18n._("Conductor") , "mDataProp" : "conductor" , "bVisible" : false , "sClass" : "library_conductor" , "sWidth" : "125px" },
/* Copyright */ { "sTitle" : $.i18n._("Copyright") , "mDataProp" : "copyright" , "bVisible" : false , "sClass" : "library_copyright" , "sWidth" : "125px" }, /* Copyright */ { "sTitle" : $.i18n._("Copyright") , "mDataProp" : "copyright" , "bVisible" : false , "sClass" : "library_copyright" , "sWidth" : "125px" },
/* Cue In */ { "sTitle" : $.i18n._("Cue In") , "mDataProp" : "cuein" , "bVisible" : false , "sClass" : "library_length" , "sWidth" : "80px" }, /* Cue In */ { "sTitle" : $.i18n._("Cue In") , "mDataProp" : "cuein" , "bVisible" : false , "sClass" : "library_length" , "sWidth" : "80px" },
/* Cue Out */ { "sTitle" : $.i18n._("Cue Out") , "mDataProp" : "cueout" , "bVisible" : false , "sClass" : "library_length" , "sWidth" : "80px" }, /* Cue Out */ { "sTitle" : $.i18n._("Cue Out") , "mDataProp" : "cueout" , "bVisible" : false , "sClass" : "library_length" , "sWidth" : "80px" },
/* Encoded */ { "sTitle" : $.i18n._("Encoded By") , "mDataProp" : "encoded_by" , "bVisible" : false , "sClass" : "library_encoded" , "sWidth" : "150px" }, /* Encoded */ { "sTitle" : $.i18n._("Encoded By") , "mDataProp" : "encoded_by" , "bVisible" : false , "sClass" : "library_encoded" , "sWidth" : "150px" },
/* Genre */ { "sTitle" : $.i18n._("Genre") , "mDataProp" : "genre" , "bVisible" : false , "sClass" : "library_genre" , "sWidth" : "100px" }, /* Genre */ { "sTitle" : $.i18n._("Genre") , "mDataProp" : "genre" , "bVisible" : false , "sClass" : "library_genre" , "sWidth" : "100px" },
/* ISRC Number */ { "sTitle" : $.i18n._("ISRC") , "mDataProp" : "isrc_number" , "bVisible" : false , "sClass" : "library_isrc" , "sWidth" : "150px" }, /* ISRC Number */ { "sTitle" : $.i18n._("ISRC") , "mDataProp" : "isrc_number" , "bVisible" : false , "sClass" : "library_isrc" , "sWidth" : "150px" },
/* Label */ { "sTitle" : $.i18n._("Label") , "mDataProp" : "label" , "bVisible" : false , "sClass" : "library_label" , "sWidth" : "125px" }, /* Label */ { "sTitle" : $.i18n._("Label") , "mDataProp" : "label" , "bVisible" : false , "sClass" : "library_label" , "sWidth" : "125px" },
/* Language */ { "sTitle" : $.i18n._("Language") , "mDataProp" : "language" , "bVisible" : false , "sClass" : "library_language" , "sWidth" : "125px" }, /* Language */ { "sTitle" : $.i18n._("Language") , "mDataProp" : "language" , "bVisible" : false , "sClass" : "library_language" , "sWidth" : "125px" },
/* Last Modified */ { "sTitle" : $.i18n._("Last Modified") , "mDataProp" : "mtime" , "bVisible" : false , "sClass" : "library_modified_time" , "sWidth" : "125px" }, /* Last Modified */ { "sTitle" : $.i18n._("Last Modified") , "mDataProp" : "mtime" , "bVisible" : false , "sClass" : "library_modified_time" , "sWidth" : "125px" },
/* Last Played */ { "sTitle" : $.i18n._("Last Played") , "mDataProp" : "lptime" , "bVisible" : false , "sClass" : "library_modified_time" , "sWidth" : "125px" }, /* Last Played */ { "sTitle" : $.i18n._("Last Played") , "mDataProp" : "lptime" , "bVisible" : false , "sClass" : "library_modified_time" , "sWidth" : "125px" },
/* Length */ { "sTitle" : $.i18n._("Length") , "mDataProp" : "length" , "sClass" : "library_length" , "sWidth" : "80px" } , /* Length */ { "sTitle" : $.i18n._("Length") , "mDataProp" : "length" , "sClass" : "library_length" , "sWidth" : "80px" } ,
/* Mime */ { "sTitle" : $.i18n._("Mime") , "mDataProp" : "mime" , "bVisible" : false , "sClass" : "library_mime" , "sWidth" : "80px" }, /* Mime */ { "sTitle" : $.i18n._("Mime") , "mDataProp" : "mime" , "bVisible" : false , "sClass" : "library_mime" , "sWidth" : "80px" },
/* Mood */ { "sTitle" : $.i18n._("Mood") , "mDataProp" : "mood" , "bVisible" : false , "sClass" : "library_mood" , "sWidth" : "70px" }, /* Mood */ { "sTitle" : $.i18n._("Mood") , "mDataProp" : "mood" , "bVisible" : false , "sClass" : "library_mood" , "sWidth" : "70px" },
/* Owner */ { "sTitle" : $.i18n._("Owner") , "mDataProp" : "owner_id" , "bVisible" : false , "sClass" : "library_language" , "sWidth" : "125px" }, /* Owner */ { "sTitle" : $.i18n._("Owner") , "mDataProp" : "owner_id" , "bVisible" : false , "sClass" : "library_language" , "sWidth" : "125px" },
/* Replay Gain */ { "sTitle" : $.i18n._("Replay Gain") , "mDataProp" : "replay_gain" , "bVisible" : false , "sClass" : "library_replay_gain" , "sWidth" : "80px" }, /* Replay Gain */ { "sTitle" : $.i18n._("Replay Gain") , "mDataProp" : "replay_gain" , "bVisible" : false , "sClass" : "library_replay_gain" , "sWidth" : "80px" },
/* Sample Rate */ { "sTitle" : $.i18n._("Sample Rate") , "mDataProp" : "sample_rate" , "bVisible" : false , "sClass" : "library_sr" , "sWidth" : "80px" }, /* Sample Rate */ { "sTitle" : $.i18n._("Sample Rate") , "mDataProp" : "sample_rate" , "bVisible" : false , "sClass" : "library_sr" , "sWidth" : "80px" },
/* Track Number */ { "sTitle" : $.i18n._("Track Number") , "mDataProp" : "track_number" , "bVisible" : false , "sClass" : "library_track" , "sWidth" : "65px" }, /* Track Number */ { "sTitle" : $.i18n._("Track Number") , "mDataProp" : "track_number" , "bVisible" : false , "sClass" : "library_track" , "sWidth" : "65px" },
/* Upload Time */ { "sTitle" : $.i18n._("Uploaded") , "mDataProp" : "utime" , "bVisible" : false , "sClass" : "library_upload_time" , "sWidth" : "125px" } , /* Upload Time */ { "sTitle" : $.i18n._("Uploaded") , "mDataProp" : "utime" , "bVisible" : false , "sClass" : "library_upload_time" , "sWidth" : "125px" } ,
/* Website */ { "sTitle" : $.i18n._("Website") , "mDataProp" : "info_url" , "bVisible" : false , "sClass" : "library_url" , "sWidth" : "150px" }, /* Website */ { "sTitle" : $.i18n._("Website") , "mDataProp" : "info_url" , "bVisible" : false , "sClass" : "library_url" , "sWidth" : "150px" },
/* Year */ { "sTitle" : $.i18n._("Year") , "mDataProp" : "year" , "bVisible" : false , "sClass" : "library_year" , "sWidth" : "60px" } /* Year */ { "sTitle" : $.i18n._("Year") , "mDataProp" : "year" , "bVisible" : false , "sClass" : "library_year" , "sWidth" : "60px" }
], ],
"bProcessing": true, "bProcessing": true,
"bServerSide": true, "bServerSide": true,
"aLengthMenu": [[5, 10, 15, 20, 25, 50, 100], [5, 10, 15, 20, 25, 50, 100]], "aLengthMenu": [5, 10, 15, 20, 25, 50, 100],
"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.
@ -552,19 +553,19 @@ var AIRTIME = (function(AIRTIME) {
"fnStateSave": function (oSettings, oData) { "fnStateSave": function (oSettings, oData) {
localStorage.setItem('datatables-library', JSON.stringify(oData)); localStorage.setItem('datatables-library', JSON.stringify(oData));
/* /*
$.ajax({ $.ajax({
url: baseUrl+"usersettings/set-library-datatable", url: baseUrl+"usersettings/set-library-datatable",
type: "POST", type: "POST",
data: {settings : oData, format: "json"}, data: {settings : oData, format: "json"},
dataType: "json" dataType: "json"
}); });
*/ */
colReorderMap = oData.ColReorder; colReorderMap = oData.ColReorder;
}, },
"fnStateLoad": function fnLibStateLoad(oSettings) { "fnStateLoad": function fnLibStateLoad(oSettings) {
var settings = localStorage.getItem('datatables-library'); var settings = localStorage.getItem('datatables-library');
try { try {
return JSON.parse(settings); return JSON.parse(settings);
} catch (e) { } catch (e) {
@ -575,17 +576,17 @@ var AIRTIME = (function(AIRTIME) {
var i, var i,
length, length,
a = oData.abVisCols; a = oData.abVisCols;
if (a) { if (a) {
// 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;
} }
} }
} }
a = oData.ColReorder; a = oData.ColReorder;
if (a) { if (a) {
for (i = 0, length = a.length; i < length; i++) { for (i = 0, length = a.length; i < length; i++) {
@ -594,16 +595,16 @@ var AIRTIME = (function(AIRTIME) {
} }
} }
} }
oData.iEnd = parseInt(oData.iEnd, 10); oData.iEnd = parseInt(oData.iEnd, 10);
oData.iLength = parseInt(oData.iLength, 10); oData.iLength = parseInt(oData.iLength, 10);
oData.iStart = parseInt(oData.iStart, 10); oData.iStart = parseInt(oData.iStart, 10);
oData.iCreate = parseInt(oData.iCreate, 10); oData.iCreate = parseInt(oData.iCreate, 10);
}, },
"sAjaxSource": baseUrl+"Library/contents-feed", "sAjaxSource": baseUrl+"Library/contents-feed",
"sAjaxDataProp": "files", "sAjaxDataProp": "files",
"fnServerData": function ( sSource, aoData, fnCallback ) { "fnServerData": function ( sSource, aoData, fnCallback ) {
/* /*
* The real validation check is done in * The real validation check is done in
@ -623,6 +624,8 @@ var AIRTIME = (function(AIRTIME) {
type = (type === undefined) ? 1 : type; type = (type === undefined) ? 1 : type;
aoData.push( { name: "type", value: type} ); aoData.push( { name: "type", value: type} );
getUsabilityHint();
$.ajax( { $.ajax( {
"dataType": 'json', "dataType": 'json',
"type": "POST", "type": "POST",
@ -673,36 +676,38 @@ var AIRTIME = (function(AIRTIME) {
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 // make sure any dragging helpers are removed or else they'll be
// stranded on the screen. // stranded on the screen.
$("#draggingContainer").remove(); $("#draggingContainer").remove();
}, },
"fnDrawCallback": AIRTIME.library.fnDrawCallback, "fnDrawCallback": AIRTIME.library.fnDrawCallback,
"aaSorting": [[5, 'asc']], "aaSorting": [[5, 'asc']],
"sPaginationType": "full_numbers", "sPaginationType": "full_numbers",
"bJQueryUI": true, "bJQueryUI": true,
"bAutoWidth": false, "bAutoWidth": false,
"oLanguage": datatables_dict, "oLanguage": datatables_dict,
// R = ColReorder, C = ColVis // R = ColReorder, C = ColVis
"sDom": 'R<"#library_display_type"><"dt-process-rel"r><"H"<"library_toolbar"Cf>><"dataTables_scrolling"t><"F"ilp>>', "sDom": 'R<"#library_display_type"><"dt-process-rel"r><"H"<"library_toolbar"Cf>><"dataTables_scrolling"t><"F"ilp>>',
"oColVis": { "oColVis": {
"sAlign": "right", "sAlign": "right",
"aiExclude": [0, 1, 2], "aiExclude": [0, 1, 2],
"sSize": "css", "sSize": "css",
"fnStateChange": setFilterElement, "fnStateChange": setFilterElement,
"buttonText": $.i18n._("Show / hide columns") "buttonText": $.i18n._("Columns")
}, },
"oColReorder": { "oColReorder": {
"iFixedColumns": 3 "iFixedColumns": 3
} },
"bScrollCollapse": false
}); });
setColumnFilter(oTable); setColumnFilter(oTable);
@ -713,9 +718,9 @@ var AIRTIME = (function(AIRTIME) {
$libContent.on("click", "legend", function(){ $libContent.on("click", "legend", function(){
$simpleSearch = $libContent.find("#library_display_filter label"); $simpleSearch = $libContent.find("#library_display_filter label");
var $fs = $(this).parents("fieldset"), var $fs = $(this).parents("fieldset"),
searchHeight, searchHeight,
tableHeight = getTableHeight(), tableHeight = getTableHeight(),
height; height;
if ($fs.hasClass("closed")) { if ($fs.hasClass("closed")) {
$fs.removeClass("closed"); $fs.removeClass("closed");
@ -728,7 +733,7 @@ var AIRTIME = (function(AIRTIME) {
$(".dataTables_filter input").val("").keyup(); $(".dataTables_filter input").val("").keyup();
$simpleSearch.addClass("sp-invisible"); $simpleSearch.addClass("sp-invisible");
//resize the library table to avoid a double scroll bar. CC-4504 //resize the library table to avoid a double scroll bar. CC-4504
height = tableHeight - searchHeight; height = tableHeight - searchHeight;
$libContent.find(".dataTables_scrolling").css("max-height", height); $libContent.find(".dataTables_scrolling").css("max-height", height);
@ -747,21 +752,21 @@ var AIRTIME = (function(AIRTIME) {
} }
}); });
}); });
//reset datatable with previous simple search results (if any) //reset datatable with previous simple search results (if any)
$(".dataTables_filter input").val(simpleSearchText).keyup(); $(".dataTables_filter input").val(simpleSearchText).keyup();
$simpleSearch.removeClass("sp-invisible"); $simpleSearch.removeClass("sp-invisible");
$fs.addClass("closed"); $fs.addClass("closed");
//resize the library table to avoid a double scroll bar. CC-4504 //resize the library table to avoid a double scroll bar. CC-4504
$libContent.find(".dataTables_scrolling").css("max-height", tableHeight); $libContent.find(".dataTables_scrolling").css("max-height", tableHeight);
} }
}); });
var tableHeight = getTableHeight(); var tableHeight = getTableHeight();
$libContent.find(".dataTables_scrolling").css("max-height", tableHeight); $libContent.find(".dataTables_scrolling").css("max-height", tableHeight);
AIRTIME.library.setupLibraryToolbar(oTable); AIRTIME.library.setupLibraryToolbar(oTable);
$libTable.find("tbody").on("dblclick", "tr", function(ev) { $libTable.find("tbody").on("dblclick", "tr", function(ev) {
@ -770,7 +775,7 @@ var AIRTIME = (function(AIRTIME) {
AIRTIME.library.dblClickAdd(data, data.ftype); AIRTIME.library.dblClickAdd(data, data.ftype);
}); });
$libTable.find("tbody").on("click", "tr", function(ev) { $libTable.find("tbody").on("mousedown", "tr", function(ev) {
var $tr = $(this), var $tr = $(this),
// Get the ID of the selected row // Get the ID of the selected row
$rowId = $tr.attr("id"); $rowId = $tr.attr("id");
@ -793,28 +798,40 @@ var AIRTIME = (function(AIRTIME) {
} }
mod.selectItem($tr); mod.selectItem($tr);
} else if (ev.ctrlKey && $previouslySelected !== undefined) { } else if (ev.ctrlKey) {
mod.selectItem($tr); mod.selectItem($tr);
} else { } else {
$("."+LIB_SELECTED_CLASS).each(function(i, el) { if (!$tr.hasClass(LIB_SELECTED_CLASS)) {
mod.deselectItem($(el)) $("." + LIB_SELECTED_CLASS).each(function (i, el) {
}); mod.deselectItem($(el))
});
}
mod.selectItem($tr); mod.selectItem($tr);
} }
// Remember this row so we can properly multiselect // Remember this row so we can properly multiselect
$previouslySelected = $tr; $previouslySelected = $tr;
}); });
$libTable.find("tbody").on("click", "tr", function(ev) {
if (!ev.ctrlKey && !ev.shiftKey) {
$("." + LIB_SELECTED_CLASS).each(function (i, el) {
mod.deselectItem($(el))
});
mod.selectItem($(this));
}
});
}; };
mod.libraryInit = libraryInit; mod.libraryInit = libraryInit;
return AIRTIME; return AIRTIME;
}(AIRTIME || {})); }(AIRTIME || {}));
function buildEditMetadataDialog (json){ function buildEditMetadataDialog (json){
var dialog = $(json.dialog); var dialog = $(json.dialog);
dialog.dialog({ dialog.dialog({
autoOpen: false, autoOpen: false,
title: $.i18n._("Edit Metadata"), title: $.i18n._("Edit Metadata"),
@ -854,12 +871,12 @@ function validateAdvancedSearch(divs) {
fields = $(div).children().find('input'); fields = $(div).children().find('input');
searchTermType = validationTypes[fieldName]; searchTermType = validationTypes[fieldName];
valid = true; valid = true;
$.each(fields, function(i, field){ $.each(fields, function(i, field){
searchTerm[i] = $(field).val(); searchTerm[i] = $(field).val();
if (searchTerm[i] !== "") { if (searchTerm[i] !== "") {
if (searchTermType === "l") { if (searchTermType === "l") {
regExpr = new RegExp("^" +timeRegEx+ "$"); regExpr = new RegExp("^" +timeRegEx+ "$");
} else if (searchTermType === "t") { } else if (searchTermType === "t") {
@ -877,29 +894,29 @@ function validateAdvancedSearch(divs) {
searchTerm[i] = searchTerm[i].substr(1); searchTerm[i] = searchTerm[i].substr(1);
} }
} }
// string fields do not need validation // string fields do not need validation
if (searchTermType !== "s") { if (searchTermType !== "s") {
valid = regExpr.test(searchTerm[i]); valid = regExpr.test(searchTerm[i]);
if (!valid) allValid = false; if (!valid) allValid = false;
} }
addRemoveValidationIcons(valid, $(field), searchTermType); addRemoveValidationIcons(valid, $(field), searchTermType);
/* /*
* Empty fields should not have valid/invalid indicator Range values * Empty fields should not have valid/invalid indicator Range values
* are considered valid even if only the 'From' value is provided. * are considered valid even if only the 'From' value is provided.
* Therefore, if the 'To' value is empty but the 'From' value is not * Therefore, if the 'To' value is empty but the 'From' value is not
* empty we need to keep the validation icon on screen. * empty we need to keep the validation icon on screen.
*/ */
} 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').children(':last-child').hasClass('checked-icon') ||
$(field).closest('div').children(':last-child').hasClass('not-available-icon')) { $(field).closest('div').children(':last-child').hasClass('not-available-icon')) {
$(field).closest('div').children(':last-child').remove(); $(field).closest('div').children(':last-child').remove();
} }
} }
if (!valid) { if (!valid) {
return false; return false;
} }
@ -920,10 +937,10 @@ function addRemoveValidationIcons(valid, field, searchTermType) {
} else if (searchTermType === 'l') { } else if (searchTermType === 'l') {
title = $.i18n._('Input must be in the format: hh:mm:ss.t'); title = $.i18n._('Input must be in the format: hh:mm:ss.t');
} }
var validIndicator = " <span class='checked-icon sp-checked-icon'></span>", var validIndicator = " <span class='checked-icon sp-checked-icon'></span>",
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').children(':last-child').hasClass('checked-icon')) {
// remove invalid icon before adding valid icon // remove invalid icon before adding valid icon
@ -997,7 +1014,7 @@ $(document).ready(function() {
} }
}); });
}); });
$('#editmdcancel').live("click", function() { $('#editmdcancel').live("click", function() {
$("#edit-md-dialog").dialog().remove(); $("#edit-md-dialog").dialog().remove();
}); });

View File

@ -228,7 +228,7 @@ var AIRTIME = (function(AIRTIME) {
$toolbar.append($menu); $toolbar.append($menu);
// add to timeline button // add to timeline button
$toolbar $toolbar
.find('.icon-plus').parent() .find('#library-plus')
.click( .click(
function() { function() {
@ -286,7 +286,6 @@ var AIRTIME = (function(AIRTIME) {
} }
var selection = $(".media_type_selector.selected").attr("selection_id"); var selection = $(".media_type_selector.selected").attr("selection_id");
console.log(selection);
if (selection == 2) { if (selection == 2) {
AIRTIME.playlist.fnNew(); AIRTIME.playlist.fnNew();