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

This commit is contained in:
Rudi Grinberg 2012-08-22 16:09:14 -04:00
commit a3b6d0259c
3 changed files with 16 additions and 8 deletions

View File

@ -55,11 +55,10 @@ class LibraryController extends Zend_Controller_Action
try { try {
$obj_sess = new Zend_Session_Namespace(UI_PLAYLISTCONTROLLER_OBJ_SESSNAME); $obj_sess = new Zend_Session_Namespace(UI_PLAYLISTCONTROLLER_OBJ_SESSNAME);
//Application_Model_Library::changePlaylist(null, null);
if (isset($obj_sess->id)) { if (isset($obj_sess->id)) {
Logging::info($obj_sess->type);
$objInfo = Application_Model_Library::getObjInfo($this->obj_sess->type);
Logging::info($obj_sess->id); Logging::info($obj_sess->id);
Logging::info($obj_sess->type);
$objInfo = Application_Model_Library::getObjInfo($obj_sess->type);
$obj = new $objInfo['className']($obj_sess->id); $obj = new $objInfo['className']($obj_sess->id);
$userInfo = Zend_Auth::getInstance()->getStorage()->read(); $userInfo = Zend_Auth::getInstance()->getStorage()->read();
$user = new Application_Model_User($userInfo->id); $user = new Application_Model_User($userInfo->id);
@ -82,6 +81,7 @@ class LibraryController extends Zend_Controller_Action
$this->playlistNotFound($obj_sess->type); $this->playlistNotFound($obj_sess->type);
} catch (Exception $e) { } catch (Exception $e) {
$this->playlistNotFound($obj_sess->type); $this->playlistNotFound($obj_sess->type);
Logging::info($e->getMessage());
//$this->playlistUnknownError($e); //$this->playlistUnknownError($e);
} }
} }
@ -160,16 +160,17 @@ class LibraryController extends Zend_Controller_Action
$isAdminOrPM = $user->isUserType(array(UTYPE_ADMIN, UTYPE_PROGRAM_MANAGER)); $isAdminOrPM = $user->isUserType(array(UTYPE_ADMIN, UTYPE_PROGRAM_MANAGER));
$obj_sess = new Zend_Session_Namespace(UI_PLAYLISTCONTROLLER_OBJ_SESSNAME);
if ($type === "audioclip") { if ($type === "audioclip") {
$file = Application_Model_StoredFile::Recall($id); $file = Application_Model_StoredFile::Recall($id);
$obj_sess = new Zend_Session_Namespace(UI_PLAYLISTCONTROLLER_OBJ_SESSNAME);
if (isset($obj_sess->id) && $screen == "playlist") { if (isset($obj_sess->id) && $screen == "playlist") {
// if the user is not admin or pm, check the creator and see if this person owns the playlist or Block // if the user is not admin or pm, check the creator and see if this person owns the playlist or Block
if ($obj_sess->type == 'playlist') { if ($obj_sess->type == 'playlist') {
$obj = new Application_Model_Playlist($obj_sess->id); $obj = new Application_Model_Playlist($obj_sess->id);
} else { } else if ($obj_sess->type == 'block') {
$obj = new Application_Model_Block($obj_sess->id); $obj = new Application_Model_Block($obj_sess->id);
} }
if ($isAdminOrPM || $obj->getCreatorId() == $user->getId()) { if ($isAdminOrPM || $obj->getCreatorId() == $user->getId()) {
@ -187,10 +188,10 @@ class LibraryController extends Zend_Controller_Action
$url = $file->getRelativeFileUrl($baseUrl).'/download/true'; $url = $file->getRelativeFileUrl($baseUrl).'/download/true';
$menu["download"] = array("name" => "Download", "icon" => "download", "url" => $url); $menu["download"] = array("name" => "Download", "icon" => "download", "url" => $url);
} elseif ($type === "playlist" || $type === "block") { } else if ($type === "playlist" || $type === "block") {
if ($type === 'playlist') { if ($type === 'playlist') {
$obj = new Application_Model_Playlist($id); $obj = new Application_Model_Playlist($id);
} else { } else if ($type === 'block') {
$obj = new Application_Model_Block($id); $obj = new Application_Model_Block($id);
if (!$obj->isStatic()) { if (!$obj->isStatic()) {
unset($menu["play"]); unset($menu["play"]);

View File

@ -46,6 +46,8 @@ class WebstreamController extends Zend_Controller_Action
$type = "stream"; $type = "stream";
Application_Model_Library::changePlaylist($obj->getId(), $type); Application_Model_Library::changePlaylist($obj->getId(), $type);
*/ */
//clear the session in case an old playlist was open: CC-4196
Application_Model_Library::changePlaylist(null, null);
$this->view->obj = new Application_Model_Webstream($webstream); $this->view->obj = new Application_Model_Webstream($webstream);
$this->view->action = "new"; $this->view->action = "new";
@ -61,7 +63,11 @@ class WebstreamController extends Zend_Controller_Action
throw new Exception("Missing parameter 'id'"); throw new Exception("Missing parameter 'id'");
} }
$webstream = CcWebstreamQuery::create()->findPK($id); $webstream = CcWebstreamQuery::create()->findPK($id);
if ($webstream) {
Application_Model_Library::changePlaylist($id, "stream");
}
$this->view->obj = new Application_Model_Webstream($webstream); $this->view->obj = new Application_Model_Webstream($webstream);
$this->view->action = "edit"; $this->view->action = "edit";
$this->view->html = $this->view->render('webstream/webstream.phtml'); $this->view->html = $this->view->render('webstream/webstream.phtml');

View File

@ -13,6 +13,8 @@ class Application_Model_Library
$info['className'] = 'Application_Model_Block'; $info['className'] = 'Application_Model_Block';
} else if (strcmp($p_type, 'stream')==0) { } else if (strcmp($p_type, 'stream')==0) {
$info['className'] = 'Application_Model_Webstream'; $info['className'] = 'Application_Model_Webstream';
} else {
throw new Exception("Unknown object type: '$p_type'");
} }
return $info; return $info;
@ -21,7 +23,6 @@ class Application_Model_Library
public static function changePlaylist($p_id, $p_type) public static function changePlaylist($p_id, $p_type)
{ {
$obj_sess = new Zend_Session_Namespace(UI_PLAYLISTCONTROLLER_OBJ_SESSNAME); $obj_sess = new Zend_Session_Namespace(UI_PLAYLISTCONTROLLER_OBJ_SESSNAME);
Logging::info($obj_sess);
if (is_null($p_id) || is_null($p_type)) { if (is_null($p_id) || is_null($p_type)) {
unset($obj_sess->id); unset($obj_sess->id);