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() public function addItemsAction()
{ {
$ids = $this->_getParam('ids'); $ids = $this->_getParam('ids', array());
$ids = (!is_array($ids)) ? array($ids) : $ids; $ids = (!is_array($ids)) ? array($ids) : $ids;
$afterItem = $this->_getParam('afterItem', null); $afterItem = $this->_getParam('afterItem', null);
$addType = $this->_getParam('type', 'after'); $addType = $this->_getParam('type', 'after');

View file

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

View file

@ -506,18 +506,25 @@ var AIRTIME = (function(AIRTIME){
fnUpdate; fnUpdate;
fnReceive = function(event, ui) { fnReceive = function(event, ui) {
var selected = $('#library_display tr[id^="au"] input:checked').parents('tr'), var aItems = [],
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 nothing is checked select the dragged item.
if (selected.length === 0) { if (aSelected.length === 0) {
selected = ui.item; aSelected.push(ui.item.data("aData"));
} }
selected.each(function(i, el) { for (i = 0, length = aSelected.length; i < length; i++) {
aItems.push($(el).data("aData").id); if (aSelected[i].ftype === "audioclip") {
}); aItems.push(aSelected[i].id);
}
}
aReceiveItems = aItems; aReceiveItems = aItems;
html = ui.helper.html(); html = ui.helper.html();
}; };

View file

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