CC-4654: Library -> Simple search still has effects even if you are doing an advanced search
-fixed
This commit is contained in:
parent
cc40dfdf4e
commit
dfd52eedf1
|
@ -252,11 +252,11 @@ var AIRTIME = (function(AIRTIME) {
|
|||
};
|
||||
|
||||
/*
|
||||
* selects all items which the user can currently see.
|
||||
* (behaviour taken from gmail)
|
||||
* selects all items which the user can currently see. (behaviour taken from
|
||||
* gmail)
|
||||
*
|
||||
* by default the items are selected in reverse order
|
||||
* so we need to reverse it back
|
||||
* by default the items are selected in reverse order so we need to reverse
|
||||
* it back
|
||||
*/
|
||||
mod.selectCurrentPage = function() {
|
||||
$.fn.reverse = [].reverse;
|
||||
|
@ -276,8 +276,8 @@ var AIRTIME = (function(AIRTIME) {
|
|||
};
|
||||
|
||||
/*
|
||||
* deselects all items that the user can currently see.
|
||||
* (behaviour taken from gmail)
|
||||
* deselects all items that the user can currently see. (behaviour taken
|
||||
* from gmail)
|
||||
*/
|
||||
mod.deselectCurrentPage = function() {
|
||||
var $inputs = $libTable.find("tbody input:checkbox"),
|
||||
|
@ -433,7 +433,8 @@ var AIRTIME = (function(AIRTIME) {
|
|||
|
||||
oTable = $libTable.dataTable( {
|
||||
|
||||
//put hidden columns at the top to insure they can never be visible on the table through column reordering.
|
||||
// put hidden columns at the top to insure they can never be visible
|
||||
// on the table through column reordering.
|
||||
"aoColumns": [
|
||||
/* ftype */ { "sTitle" : "" , "mDataProp" : "ftype" , "bSearchable" : false , "bVisible" : false } ,
|
||||
/* Checkbox */ { "sTitle" : "" , "mDataProp" : "checkbox" , "bSortable" : false , "bSearchable" : false , "sWidth" : "25px" , "sClass" : "library_checkbox" } ,
|
||||
|
@ -524,11 +525,12 @@ var AIRTIME = (function(AIRTIME) {
|
|||
"sAjaxDataProp": "files",
|
||||
|
||||
"fnServerData": function ( sSource, aoData, fnCallback ) {
|
||||
/* The real validation check is done in dataTables.columnFilter.js
|
||||
* We also need to check it here because datatable is redrawn everytime
|
||||
* an action is performed in the Library page.
|
||||
* In order for datatable to redraw the advanced search fields
|
||||
* MUST all be valid.
|
||||
/*
|
||||
* The real validation check is done in
|
||||
* dataTables.columnFilter.js We also need to check it here
|
||||
* because datatable is redrawn everytime an action is performed
|
||||
* in the Library page. In order for datatable to redraw the
|
||||
* advanced search fields MUST all be valid.
|
||||
*/
|
||||
var advSearchFields = $("div#advanced_search").children(':visible');
|
||||
var advSearchValid = validateAdvancedSearch(advSearchFields);
|
||||
|
@ -555,27 +557,34 @@ var AIRTIME = (function(AIRTIME) {
|
|||
// add the play function to the library_type td
|
||||
$(nRow).find('td.library_type').click(function(){
|
||||
if (aData.ftype === 'playlist' && aData.length !== '0.0'){
|
||||
playlistIndex = $(this).parent().attr('id').substring(3); //remove the pl_
|
||||
playlistIndex = $(this).parent().attr('id').substring(3); // remove
|
||||
// the
|
||||
// pl_
|
||||
open_playlist_preview(playlistIndex, 0);
|
||||
} else if (aData.ftype === 'audioclip') {
|
||||
open_audio_preview(aData.ftype, aData.audioFile, aData.track_title, aData.artist_name);
|
||||
} else if (aData.ftype == 'stream') {
|
||||
open_audio_preview(aData.ftype, aData.audioFile, aData.track_title, aData.artist_name);
|
||||
} else if (aData.ftype == 'block' && aData.bl_type == 'static') {
|
||||
blockIndex = $(this).parent().attr('id').substring(3); //remove the bl_
|
||||
blockIndex = $(this).parent().attr('id').substring(3); // remove
|
||||
// the
|
||||
// bl_
|
||||
open_block_preview(blockIndex, 0);
|
||||
}
|
||||
return false;
|
||||
});
|
||||
|
||||
alreadyclicked=false;
|
||||
//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:not(.library_checkbox, .library_type)').click(function(e){
|
||||
var el=$(this);
|
||||
if (alreadyclicked)
|
||||
{
|
||||
alreadyclicked=false; // reset
|
||||
clearTimeout(alreadyclickedTimeout); // prevent this from happening
|
||||
clearTimeout(alreadyclickedTimeout); // prevent this
|
||||
// from
|
||||
// happening
|
||||
// do what needs to happen on double click.
|
||||
|
||||
$tr = $(el).parent();
|
||||
|
@ -596,7 +605,8 @@ var AIRTIME = (function(AIRTIME) {
|
|||
return false;
|
||||
});
|
||||
|
||||
//add a tool tip to appear when the user clicks on the type icon.
|
||||
// add a tool tip to appear when the user clicks on the type
|
||||
// icon.
|
||||
$(nRow).find("td:not(.library_checkbox, .library_type)").qtip({
|
||||
content: {
|
||||
text: "Loading...",
|
||||
|
@ -620,7 +630,8 @@ var AIRTIME = (function(AIRTIME) {
|
|||
},
|
||||
my: 'left center',
|
||||
at: 'right center',
|
||||
viewport: $(window), // Keep the tooltip on-screen at all times
|
||||
viewport: $(window), // Keep the tooltip on-screen at
|
||||
// all times
|
||||
effect: false // Disable positioning animation
|
||||
},
|
||||
style: {
|
||||
|
@ -641,7 +652,8 @@ var AIRTIME = (function(AIRTIME) {
|
|||
// remove any selected nodes before the draw.
|
||||
"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();
|
||||
},
|
||||
"fnDrawCallback": AIRTIME.library.fnDrawCallback,
|
||||
|
@ -674,17 +686,32 @@ var AIRTIME = (function(AIRTIME) {
|
|||
setColumnFilter(oTable);
|
||||
oTable.fnSetFilteringDelay(350);
|
||||
|
||||
var simpleSearchText;
|
||||
|
||||
$libContent.on("click", "legend", function(){
|
||||
$simpleSearch = $libContent.find("#library_display_filter label");
|
||||
var $fs = $(this).parents("fieldset");
|
||||
|
||||
if ($fs.hasClass("closed")) {
|
||||
$fs.removeClass("closed");
|
||||
|
||||
//keep value of simple search for when user switches back to it
|
||||
simpleSearchText = $simpleSearch.find('input').val();
|
||||
|
||||
// clear the simple search text field and reset datatable
|
||||
$(".dataTables_filter input").val("").keyup();
|
||||
|
||||
$simpleSearch.addClass("sp-invisible");
|
||||
}
|
||||
else {
|
||||
$fs.addClass("closed");
|
||||
//clear the advanced search fields and reset datatable
|
||||
$(".filter_column input").val("").keyup();
|
||||
|
||||
//reset datatable with previous simple search results (if any)
|
||||
$(".dataTables_filter input").val(simpleSearchText).keyup();
|
||||
|
||||
$simpleSearch.removeClass("sp-invisible");
|
||||
$fs.addClass("closed");
|
||||
}
|
||||
});
|
||||
|
||||
|
@ -799,12 +826,16 @@ var AIRTIME = (function(AIRTIME) {
|
|||
|
||||
callback = function() {
|
||||
if (data.ftype === 'playlist' && data.length !== '0.0'){
|
||||
playlistIndex = $(this).parent().attr('id').substring(3); //remove the pl_
|
||||
playlistIndex = $(this).parent().attr('id').substring(3); // remove
|
||||
// the
|
||||
// pl_
|
||||
open_playlist_preview(playlistIndex, 0);
|
||||
} else if (data.ftype === 'audioclip' || data.ftype === 'stream') {
|
||||
open_audio_preview(data.ftype, data.audioFile, data.track_title, data.artist_name);
|
||||
} else if (data.ftype === 'block') {
|
||||
blockIndex = $(this).parent().attr('id').substring(3); //remove the pl_
|
||||
blockIndex = $(this).parent().attr('id').substring(3); // remove
|
||||
// the
|
||||
// pl_
|
||||
open_block_preview(blockIndex, 0);
|
||||
}
|
||||
};
|
||||
|
@ -815,7 +846,8 @@ var AIRTIME = (function(AIRTIME) {
|
|||
if (oItems.del !== undefined) {
|
||||
|
||||
// delete through the playlist controller, will reset
|
||||
//playlist screen if this is the currently edited playlist.
|
||||
// playlist screen if this is the currently edited
|
||||
// playlist.
|
||||
if ((data.ftype === "playlist" || data.ftype === "block") && screen === "playlist") {
|
||||
callback = function() {
|
||||
aMedia = [];
|
||||
|
@ -988,7 +1020,8 @@ function addQtipToSCIcons(){
|
|||
viewport: $(window)
|
||||
},
|
||||
show: {
|
||||
ready: true // Needed to make it show on first mouseover event
|
||||
ready: true // Needed to make it show on first mouseover
|
||||
// event
|
||||
}
|
||||
});
|
||||
}
|
||||
|
@ -1015,7 +1048,8 @@ function addQtipToSCIcons(){
|
|||
viewport: $(window)
|
||||
},
|
||||
show: {
|
||||
ready: true // Needed to make it show on first mouseover event
|
||||
ready: true // Needed to make it show on first mouseover
|
||||
// event
|
||||
}
|
||||
});
|
||||
}else if($(this).hasClass("sc-error")){
|
||||
|
@ -1042,7 +1076,8 @@ function addQtipToSCIcons(){
|
|||
viewport: $(window)
|
||||
},
|
||||
show: {
|
||||
ready: true // Needed to make it show on first mouseover event
|
||||
ready: true // Needed to make it show on first mouseover
|
||||
// event
|
||||
}
|
||||
});
|
||||
}
|
||||
|
@ -1104,11 +1139,11 @@ function validateAdvancedSearch(divs) {
|
|||
|
||||
addRemoveValidationIcons(valid, $(field), searchTermType);
|
||||
|
||||
/* Empty fields should not have valid/invalid indicator
|
||||
* Range values are considered valid even if only the
|
||||
* 'From' value is provided. Therefore, if the 'To' value
|
||||
* is empty but the 'From' value is not empty we need to
|
||||
* keep the validation icon on screen.
|
||||
/*
|
||||
* Empty fields should not have valid/invalid indicator Range values
|
||||
* are considered valid even if only the 'From' value is provided.
|
||||
* Therefore, if the 'To' value is empty but the 'From' value is not
|
||||
* empty we need to keep the validation icon on screen.
|
||||
*/
|
||||
} else if (searchTerm[0] === "" && searchTerm[1] !== "" ||
|
||||
searchTerm[0] === "" && searchTerm[1] === ""){
|
||||
|
@ -1161,12 +1196,9 @@ function addRemoveValidationIcons(valid, field, searchTermType) {
|
|||
}
|
||||
}
|
||||
|
||||
/* Validation types:
|
||||
* s => string
|
||||
* i => integer
|
||||
* n => numeric (positive/negative, whole/decimals)
|
||||
* t => timestamp
|
||||
* l => length
|
||||
/*
|
||||
* Validation types: s => string i => integer n => numeric (positive/negative,
|
||||
* whole/decimals) t => timestamp l => length
|
||||
*/
|
||||
var validationTypes = {
|
||||
"album_title" : "s",
|
||||
|
|
Loading…
Reference in New Issue