Merge branch 'devel' of dev.sourcefabric.org:airtime into devel

This commit is contained in:
Martin Konecny 2012-08-02 16:27:00 -04:00
commit a146fdcd37
45 changed files with 1725 additions and 58 deletions

View file

@ -127,7 +127,7 @@ class PlaylistController extends Zend_Controller_Action
private function blockDynamic($obj)
{
$this->view->error = "You cannot add tracks to dynamic block.";
$this->view->error = "You cannot add tracks to dynamic blocks.";
$this->createFullResponse($obj);
}
@ -152,6 +152,11 @@ class PlaylistController extends Zend_Controller_Action
Logging::log("{$e->getLine()}");
Logging::log("{$e->getMessage()}");
}
private function playlistDenied($obj) {
$this->view->error = "You cannot add playlists to smart playlists.";
$this->createFullResponse($obj);
}
public function indexAction()
{
@ -307,9 +312,15 @@ class PlaylistController extends Zend_Controller_Action
$obj->addAudioClips($ids, $afterItem, $addType);
} else if ($obj->isStatic()) {
// if the dest is a block object
//check if any items are playlists
foreach($ids as $id) {
if (is_array($id) && isset($id[1]) && $id[1] == 'playlist') {
throw new Exception('playlist to block');
}
}
$obj->addAudioClips($ids, $afterItem, $addType);
} else {
throw new BlockDynamicException;
throw new Exception('track to dynamic');
}
$this->createUpdateResponse($obj);
}
@ -319,11 +330,14 @@ class PlaylistController extends Zend_Controller_Action
catch (PlaylistNotFoundException $e) {
$this->playlistNotFound($obj_type);
}
catch (BlockDynamicException $e) {
$this->blockDynamic($obj);
}
catch (Exception $e) {
$this->playlistUnknownError($e);
if ($e->getMessage() == 'playlist to block') {
$this->playlistDenied($obj);
} else if ($e->getMessage() == 'track to dynamic') {
$this->blockDynamic($obj);
} else {
$this->playlistUnknownError($e);
}
}
}