CC-3174 : showbuilder

fixing order of scheduled/playlist data when added via group dragging.
This commit is contained in:
Naomi Aro 2012-02-28 23:52:20 +01:00
parent f39afe9503
commit 5257711866
4 changed files with 32 additions and 25 deletions

View File

@ -197,7 +197,7 @@ class PlaylistController extends Zend_Controller_Action
public function addItemsAction()
{
$ids = $this->_getParam('ids');
$ids = $this->_getParam('ids', array());
$ids = (!is_array($ids)) ? array($ids) : $ids;
$afterItem = $this->_getParam('afterItem', null);
$addType = $this->_getParam('type', 'after');

View File

@ -69,16 +69,17 @@ var AIRTIME = (function(AIRTIME){
fnAddSelectedItems = function() {
var oLibTT = TableTools.fnGetInstance('library_display'),
aData = oLibTT.fnGetSelectedData(),
item,
i,
temp,
length,
aMediaIds = [];
//process selected files/playlists.
for (item in aData) {
temp = aData[item];
if (temp !== null && temp.hasOwnProperty('id') && temp.ftype === "audioclip") {
for (i = 0, length = aData.length; i < length; i++) {
temp = aData[i];
if (temp.ftype === "audioclip") {
aMediaIds.push(temp.id);
}
}
}
AIRTIME.playlist.fnAddItems(aMediaIds, undefined, 'after');

View File

@ -506,18 +506,25 @@ var AIRTIME = (function(AIRTIME){
fnUpdate;
fnReceive = function(event, ui) {
var selected = $('#library_display tr[id^="au"] input:checked').parents('tr'),
aItems = [];
var aItems = [],
aSelected,
oLibTT = TableTools.fnGetInstance('library_display'),
i,
length;
//filter out anything that isn't an audiofile.
aSelected = oLibTT.fnGetSelectedData();
//if nothing is checked select the dragged item.
if (selected.length === 0) {
selected = ui.item;
if (aSelected.length === 0) {
aSelected.push(ui.item.data("aData"));
}
selected.each(function(i, el) {
aItems.push($(el).data("aData").id);
});
for (i = 0, length = aSelected.length; i < length; i++) {
if (aSelected[i].ftype === "audioclip") {
aItems.push(aSelected[i].id);
}
}
aReceiveItems = aItems;
html = ui.helper.html();
};

View File

@ -499,8 +499,7 @@ $(document).ready(function() {
fnAdd = function() {
var aMediaIds = [],
aSchedIds = [],
oLibTT = TableTools.fnGetInstance('library_display');
aSchedIds = [];
for(i=0; i < aItemData.length; i++) {
aMediaIds.push({"id": aItemData[i].id, "type": aItemData[i].ftype});
@ -521,18 +520,18 @@ $(document).ready(function() {
};
fnReceive = function(event, ui) {
var selected = $('#library_display tr:not(:first) input:checked').parents('tr'),
aItems = [];
var aItems = [],
oLibTT = TableTools.fnGetInstance('library_display'),
i,
length;
aItems = oLibTT.fnGetSelectedData();
//if nothing is checked select the dragged item.
if (selected.length === 0) {
selected = ui.item;
if (aItems.length === 0) {
aItems.push(ui.item.data("aData"));
}
selected.each(function(i, el) {
aItems.push($(el).data("aData"));
});
origTrs = aItems;
html = ui.helper.html();
};