Merge branch 'devel' of dev.sourcefabric.org:airtime into devel

This commit is contained in:
Martin Konecny 2012-05-10 11:14:57 -04:00
commit f9bbdb1f33
6 changed files with 39 additions and 30 deletions

View File

@ -633,7 +633,7 @@ Logging::log("getting media! - 2");
else if ($key === "year") {
$plSelect[] = "EXTRACT(YEAR FROM utime)::varchar AS ".$key;
$fileSelect[] = "EXTRACT(YEAR FROM to_date(year, 'YYYY-MM-DD'))::varchar AS ".$key;
$fileSelect[] = "year AS ".$key;
}
//need to cast certain data as ints for the union to search on.
else if (in_array($key, array("track_number", "bit_rate", "sample_rate"))){

View File

@ -48,7 +48,7 @@ var AIRTIME = (function(AIRTIME){
$('#library_display tr.lib-audio').draggable({
helper: function(){
mod.selectItem($(this));
mod.addToChosen($(this));
var selected = mod.getChosenAudioFilesLength(),
container,

View File

@ -48,7 +48,7 @@ var AIRTIME = (function(AIRTIME){
$('#library_display tr.lib-audio, tr.lib-pl').draggable({
helper: function(){
mod.selectItem($(this));
mod.addToChosen($(this));
var selected = mod.getChosenItemsLength(),
container,

View File

@ -98,6 +98,21 @@ var AIRTIME = (function(AIRTIME) {
}
};
mod.addToChosen = function($el) {
var id = $el.attr("id");
chosenItems[id] = $el.data('aData');
};
mod.removeFromChosen = function($el) {
var id = $el.attr("id");
//used to not keep dragged items selected.
if (!$el.hasClass(LIB_SELECTED_CLASS)) {
delete chosenItems[id];
}
};
mod.highlightItem = function($el) {
var $input = $el.find("input");
@ -105,26 +120,25 @@ var AIRTIME = (function(AIRTIME) {
$el.addClass(LIB_SELECTED_CLASS);
};
mod.unHighlightItem = function($el) {
var $input = $el.find("input");
$input.attr("checked", false);
$el.removeClass(LIB_SELECTED_CLASS);
};
mod.selectItem = function($el) {
var id;
mod.highlightItem($el);
id = $el.attr("id");
chosenItems[id] = $el.data('aData');
mod.addToChosen($el);
mod.checkToolBarIcons();
};
mod.deselectItem = function($el) {
var id,
$input = $el.find("input");
$input.attr("checked", false);
$el.removeClass(LIB_SELECTED_CLASS);
id = $el.attr("id");
delete chosenItems[id];
mod.unHighlightItem($el);
mod.removeFromChosen($el);
mod.checkToolBarIcons();
};

View File

@ -278,7 +278,8 @@ var AIRTIME = (function(AIRTIME){
function redrawLib() {
var dt = $lib.find("#library_display").dataTable();
dt.fnDraw();
dt.fnStandingRedraw();
AIRTIME.library.redrawChosen();
}
function setPlaylistContent(json) {
@ -523,10 +524,6 @@ var AIRTIME = (function(AIRTIME){
//filter out anything that isn't an audiofile.
aSelected = AIRTIME.library.getSelectedData();
//if nothing is checked select the dragged item.
if (aSelected.length === 0) {
aSelected.push(ui.item.data("aData"));
}
for (i = 0, length = aSelected.length; i < length; i++) {
if (aSelected[i].ftype === "audioclip") {
@ -536,6 +533,8 @@ var AIRTIME = (function(AIRTIME){
aReceiveItems = aItems;
html = ui.helper.html();
AIRTIME.library.removeFromChosen(ui.item);
};
fnUpdate = function(event, ui) {

View File

@ -699,14 +699,10 @@ var AIRTIME = (function(AIRTIME){
var aItems = [];
aItems = AIRTIME.library.getSelectedData();
//if nothing is checked select the dragged item.
if (aItems.length === 0) {
aItems.push(ui.item.data("aData"));
}
origTrs = aItems;
html = ui.helper.html();
AIRTIME.library.removeFromChosen(ui.item);
};
fnUpdate = function(event, ui) {
@ -764,11 +760,11 @@ var AIRTIME = (function(AIRTIME){
height = trfirst.height(),
message;
//if nothing is checked select the dragged item.
if (selected.length === 0) {
selected = [item.data("aData")];
}
//if nothing is checked select the dragged item.
if (selected.length === 0) {
selected = [item.data("aData")];
}
if (selected.length === 1) {
message = "Moving "+selected.length+" Item.";
}