CC-3885: Deleted open playlist is not closed until a new item is added to it

-fixed
This commit is contained in:
denise 2013-02-13 15:44:52 -05:00
parent 76cb04e296
commit 04ed640756
2 changed files with 42 additions and 16 deletions

View File

@ -14,6 +14,7 @@ class PlaylistController extends Zend_Controller_Action
->addActionContext('new', 'json')
->addActionContext('edit', 'json')
->addActionContext('delete', 'json')
->addActionContext('close-playlist', 'json')
->addActionContext('play', 'json')
->addActionContext('set-playlist-fades', 'json')
->addActionContext('get-playlist-fades', 'json')
@ -246,6 +247,13 @@ class PlaylistController extends Zend_Controller_Action
}
}
public function closePlaylistAction() {
$type = $this->_getParam('type');
$obj = null;
Application_Model_Library::changePlaylist($obj, $type);
$this->createFullResponse($obj);
}
public function addItemsAction()
{
$ids = $this->_getParam('aItems', array());

View File

@ -322,22 +322,40 @@ var AIRTIME = (function(AIRTIME) {
};
mod.fnDeleteSelectedItems = function() {
if (confirm($.i18n._('Are you sure you want to delete the selected item(s)?'))) {
var aData = AIRTIME.library.getSelectedData(),
item,
temp,
aMedia = [];
// process selected files/playlists.
for (item in aData) {
temp = aData[item];
if (temp !== null && temp.hasOwnProperty('id') ) {
aMedia.push({"id": temp.id, "type": temp.ftype});
}
}
AIRTIME.library.fnDeleteItems(aMedia);
}
if (confirm($.i18n._('Are you sure you want to delete the selected item(s)?'))) {
var aData = AIRTIME.library.getSelectedData(),
item,
temp,
aMedia = [],
currentObjId = $("#side_playlist").find("#obj_id").val(),
currentObjType = $("#side_playlist").find("#obj_type").val(),
closeObj = false;
// process selected files/playlists.
for (item in aData) {
temp = aData[item];
if (temp !== null && temp.hasOwnProperty('id') ) {
aMedia.push({"id": temp.id, "type": temp.ftype});
if ( (temp.id == currentObjId && temp.ftype === currentObjType) ||
temp.id == currentObjId && temp.ftype === "stream" && currentObjType === "webstream") {
closeObj = true;
}
}
}
AIRTIME.library.fnDeleteItems(aMedia);
// close the object (playlist/block/webstream)
// on the right side if it was just deleted
// from the library
if (closeObj) {
$.post(baseUrl+"playlist/close-playlist",
{"format": "json", "type": currentObjType},
function(json) {
$("#side_playlist").empty().append(json.html);
});
}
}
};
libraryInit = function() {