Fix empty-name playlist bug

This commit is contained in:
Duncan Sommerville 2015-09-02 13:58:38 -04:00
parent 80d78e9fc5
commit 8d0cfdc202
2 changed files with 23 additions and 9 deletions

View File

@ -30,6 +30,7 @@ class PlaylistController extends Zend_Controller_Action
->addActionContext('get-block-info', 'json')
->addActionContext('shuffle', 'json')
->addActionContext('empty-content', 'json')
->addActionContext('change-playlist', 'json')
->initContext();
//This controller writes to the session all over the place, so we're going to reopen it for writing here.
@ -201,6 +202,16 @@ class PlaylistController extends Zend_Controller_Action
$this->createFullResponse($obj);
}
public function changePlaylistAction() {
$this->view->layout()->disableLayout(); // Don't inject the standard Now Playing header.
$this->_helper->viewRenderer->setNoRender(true); // Don't use (phtml) templates
$id = $this->_getParam('id', null);
$type = $this->_getParam('type');
Application_Model_Library::changePlaylist($id, $type);
}
public function editAction()
{
$id = $this->_getParam('id', null);
@ -241,7 +252,7 @@ class PlaylistController extends Zend_Controller_Action
Logging::info("Currently active {$type} {$obj_sess->id}");
if (in_array($obj_sess->id, $ids)) {
Logging::info("Deleting currently active {$type}");
Application_Model_Library::changePlaylist(null, $type);
// Application_Model_Library::changePlaylist(null, $type);
} else {
Logging::info("Not deleting currently active {$type}");
$obj = new $objInfo['className']($obj_sess->id);

View File

@ -421,17 +421,19 @@ var AIRTIME = (function(AIRTIME){
$('.zend_form + .spl-no-margin > div:has(*:visible):last').css('margin-left', 0);
}
function getId() {
return parseInt($pl.find(".obj_id").val(), 10);
function getId(pl) {
pl = (pl === undefined) ? $pl : pl;
return parseInt(pl.find(".obj_id").val(), 10);
}
mod.getModified = function() {
return parseInt($pl.find(".obj_lastMod").val(), 10);
}
mod.getModified = function(pl) {
pl = (pl === undefined) ? $pl : pl;
return parseInt(pl.find(".obj_lastMod").val(), 10);
};
mod.setModified = function(modified) {
$pl.find(".obj_lastMod").val(modified);
}
};
function setTitleLabel(title) {
$pl.find(".title_obj_name").text(title);
@ -1212,8 +1214,8 @@ var AIRTIME = (function(AIRTIME){
var url, id, lastMod, type, pl = (tabId === undefined) ? $pl : $('#pl-tab-content-' + tabId);
stopAudioPreview();
id = (plid === undefined) ? getId() : plid;
lastMod = mod.getModified();
id = (plid === undefined) ? getId(pl) : plid;
lastMod = mod.getModified(pl);
type = pl.find('.obj_type').val();
url = baseUrl+'playlist/delete';
@ -1562,6 +1564,7 @@ var AIRTIME = (function(AIRTIME){
mod.setAsActive = function() {
$pl = $(".active-tab");
$.post(baseUrl + "playlist/change-playlist", {"id": getId(), "type": $pl.find('.obj_type').val()});
};
mod.init = function() {