Fix empty-name playlist bug
This commit is contained in:
parent
80d78e9fc5
commit
8d0cfdc202
|
@ -30,6 +30,7 @@ class PlaylistController extends Zend_Controller_Action
|
||||||
->addActionContext('get-block-info', 'json')
|
->addActionContext('get-block-info', 'json')
|
||||||
->addActionContext('shuffle', 'json')
|
->addActionContext('shuffle', 'json')
|
||||||
->addActionContext('empty-content', 'json')
|
->addActionContext('empty-content', 'json')
|
||||||
|
->addActionContext('change-playlist', 'json')
|
||||||
->initContext();
|
->initContext();
|
||||||
|
|
||||||
//This controller writes to the session all over the place, so we're going to reopen it for writing here.
|
//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);
|
$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()
|
public function editAction()
|
||||||
{
|
{
|
||||||
$id = $this->_getParam('id', null);
|
$id = $this->_getParam('id', null);
|
||||||
|
@ -241,7 +252,7 @@ class PlaylistController extends Zend_Controller_Action
|
||||||
Logging::info("Currently active {$type} {$obj_sess->id}");
|
Logging::info("Currently active {$type} {$obj_sess->id}");
|
||||||
if (in_array($obj_sess->id, $ids)) {
|
if (in_array($obj_sess->id, $ids)) {
|
||||||
Logging::info("Deleting currently active {$type}");
|
Logging::info("Deleting currently active {$type}");
|
||||||
Application_Model_Library::changePlaylist(null, $type);
|
// Application_Model_Library::changePlaylist(null, $type);
|
||||||
} else {
|
} else {
|
||||||
Logging::info("Not deleting currently active {$type}");
|
Logging::info("Not deleting currently active {$type}");
|
||||||
$obj = new $objInfo['className']($obj_sess->id);
|
$obj = new $objInfo['className']($obj_sess->id);
|
||||||
|
|
|
@ -421,17 +421,19 @@ var AIRTIME = (function(AIRTIME){
|
||||||
$('.zend_form + .spl-no-margin > div:has(*:visible):last').css('margin-left', 0);
|
$('.zend_form + .spl-no-margin > div:has(*:visible):last').css('margin-left', 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
function getId() {
|
function getId(pl) {
|
||||||
return parseInt($pl.find(".obj_id").val(), 10);
|
pl = (pl === undefined) ? $pl : pl;
|
||||||
|
return parseInt(pl.find(".obj_id").val(), 10);
|
||||||
}
|
}
|
||||||
|
|
||||||
mod.getModified = function() {
|
mod.getModified = function(pl) {
|
||||||
return parseInt($pl.find(".obj_lastMod").val(), 10);
|
pl = (pl === undefined) ? $pl : pl;
|
||||||
}
|
return parseInt(pl.find(".obj_lastMod").val(), 10);
|
||||||
|
};
|
||||||
|
|
||||||
mod.setModified = function(modified) {
|
mod.setModified = function(modified) {
|
||||||
$pl.find(".obj_lastMod").val(modified);
|
$pl.find(".obj_lastMod").val(modified);
|
||||||
}
|
};
|
||||||
|
|
||||||
function setTitleLabel(title) {
|
function setTitleLabel(title) {
|
||||||
$pl.find(".title_obj_name").text(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);
|
var url, id, lastMod, type, pl = (tabId === undefined) ? $pl : $('#pl-tab-content-' + tabId);
|
||||||
|
|
||||||
stopAudioPreview();
|
stopAudioPreview();
|
||||||
id = (plid === undefined) ? getId() : plid;
|
id = (plid === undefined) ? getId(pl) : plid;
|
||||||
lastMod = mod.getModified();
|
lastMod = mod.getModified(pl);
|
||||||
type = pl.find('.obj_type').val();
|
type = pl.find('.obj_type').val();
|
||||||
url = baseUrl+'playlist/delete';
|
url = baseUrl+'playlist/delete';
|
||||||
|
|
||||||
|
@ -1562,6 +1564,7 @@ var AIRTIME = (function(AIRTIME){
|
||||||
|
|
||||||
mod.setAsActive = function() {
|
mod.setAsActive = function() {
|
||||||
$pl = $(".active-tab");
|
$pl = $(".active-tab");
|
||||||
|
$.post(baseUrl + "playlist/change-playlist", {"id": getId(), "type": $pl.find('.obj_type').val()});
|
||||||
};
|
};
|
||||||
|
|
||||||
mod.init = function() {
|
mod.init = function() {
|
||||||
|
|
Loading…
Reference in New Issue