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

Conflicts:
	airtime_mvc/application/models/Block.php
This commit is contained in:
James 2012-08-02 16:37:12 -04:00
commit 028e089c82
9 changed files with 193 additions and 55 deletions

View file

@ -126,7 +126,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);
}
@ -151,6 +151,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()
{
@ -306,9 +311,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);
}
@ -318,11 +329,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);
}
}
}

View file

@ -33,9 +33,14 @@ class WebstreamController extends Zend_Controller_Action
{
$request = $this->getRequest();
Application_Model_Webstream::save($request);
$analysis = Application_Model_Webstream::analyzeFormData($request);
$this->view->statusMessage = "<div class='success'>Webstream saved.</div>";
if (Application_Model_Webstream::isValid($analysis)) {
Application_Model_Webstream::save($request);
$this->view->statusMessage = "<div class='success'>Webstream saved.</div>";
} else {
$this->view->statusMessage = "<div class='errors'>Invalid form values.</div>";
$this->view->analysis = $analysis;
}
}
}