diff --git a/airtime_mvc/application/controllers/PlaylistController.php b/airtime_mvc/application/controllers/PlaylistController.php index c3d2bfa6e..91ad684d7 100644 --- a/airtime_mvc/application/controllers/PlaylistController.php +++ b/airtime_mvc/application/controllers/PlaylistController.php @@ -270,12 +270,11 @@ class PlaylistController extends Zend_Controller_Action $obj = null; $objInfo = $this->getObjInfo($type); - - $userInfo = Zend_Auth::getInstance()->getStorage()->read(); + + $userInfo = Zend_Auth::getInstance()->getStorage()->read(); $user = new Application_Model_User($userInfo->id); try { - Logging::log("Currently active {$type} {$this->obj_sess->id}"); if (in_array($this->obj_sess->id, $ids)) { Logging::log("Deleting currently active {$type}"); @@ -290,11 +289,9 @@ class PlaylistController extends Zend_Controller_Action Application_Model_Block::deleteBlocks($ids, $userInfo->id); } $this->createFullResponse($obj); - } - catch (PlaylistNoPermissionException $e) { + } catch (PlaylistNoPermissionException $e) { $this->playlistNoPermission($type); - } - catch (PlaylistNotFoundException $e) { + } catch (PlaylistNotFoundException $e) { $this->playlistNotFound($type); } catch (Exception $e) { $this->playlistUnknownError($e); @@ -524,18 +521,18 @@ class PlaylistController extends Zend_Controller_Action $this->setPlaylistNameDescAction(); if ($params['type'] == 'block') { - $form = new Application_Form_SmartBlockCriteria(); + $form = new Application_Form_SmartBlockCriteria(); $form->startForm($params['obj_id']); - $bl = new Application_Model_Block($params['obj_id']); + $bl = new Application_Model_Block($params['obj_id']); if ($form->isValid($params)) { $bl->saveSmartBlockCriteria($params['data']); $result['html'] = $this->createFullResponse($bl, true); $result['result'] = 0; } else { - $this->view->obj = $bl; + $this->view->obj = $bl; $this->view->id = $bl->getId(); $this->view->form = $form; - $viewPath = 'playlist/smart-block.phtml'; + $viewPath = 'playlist/smart-block.phtml'; $result['html'] = $this->view->render($viewPath); $result['result'] = 1; } @@ -545,11 +542,11 @@ class PlaylistController extends Zend_Controller_Action die(json_encode($result)); } - public function smartBlockGenerateAction() - { - $request = $this->getRequest(); + public function smartBlockGenerateAction() + { + $request = $this->getRequest(); $params = $request->getPost(); - $form = new Application_Form_SmartBlockCriteria(); + $form = new Application_Form_SmartBlockCriteria(); $form->startForm($params['obj_id']); $bl = new Application_Model_Block($params['obj_id']); if ($form->isValid($params)) { @@ -564,35 +561,35 @@ class PlaylistController extends Zend_Controller_Action $this->playlistUnknownError($e); } }else{ - $this->view->obj = $bl; - $this->view->id = $bl->getId(); - $this->view->form = $form; - $viewPath = 'playlist/smart-block.phtml'; + $this->view->obj = $bl; + $this->view->id = $bl->getId(); + $this->view->form = $form; + $viewPath = 'playlist/smart-block.phtml'; $result['html'] = $this->view->render($viewPath); $result['result'] = 1; die(json_encode($result)); - } + } } public function smartBlockShuffleAction() { - $request = $this->getRequest(); + $request = $this->getRequest(); $params = $request->getPost(); $bl = new Application_Model_Block($params['obj_id']); $result = $bl->shuffleSmartBlock(); - - if ($result['result'] == 0) { - try { - die(json_encode(array("result"=>0, "html"=>$this->createFullResponse($bl, true)))); - } - catch (PlaylistNotFoundException $e) { - $this->playlistNotFound('block'); - } - catch (Exception $e) { - $this->playlistUnknownError($e); - } - }else{ - die(json_encode($result)); + + if ($result['result'] == 0) { + try { + die(json_encode(array("result"=>0, "html"=>$this->createFullResponse($bl, true)))); + } + catch (PlaylistNotFoundException $e) { + $this->playlistNotFound('block'); + } + catch (Exception $e) { + $this->playlistUnknownError($e); + } + }else{ + die(json_encode($result)); } } @@ -610,7 +607,7 @@ class PlaylistController extends Zend_Controller_Action } public function getBlockInfoAction(){ - $request = $this->getRequest(); + $request = $this->getRequest(); $params = $request->getPost(); $bl = new Application_Model_Block($params['id']); if ($bl->isStatic()) { diff --git a/airtime_mvc/application/controllers/WebstreamController.php b/airtime_mvc/application/controllers/WebstreamController.php index 73ad7fc59..bf67e13bd 100644 --- a/airtime_mvc/application/controllers/WebstreamController.php +++ b/airtime_mvc/application/controllers/WebstreamController.php @@ -8,6 +8,7 @@ class WebstreamController extends Zend_Controller_Action $ajaxContext->addActionContext('new', 'json') ->addActionContext('save', 'json') ->addActionContext('edit', 'json') + ->addActionContext('delete', 'json') ->initContext(); //TODO //$this->pl_sess = new Zend_Session_Namespace(UI_PLAYLIST_SESSNAME); @@ -46,6 +47,15 @@ class WebstreamController extends Zend_Controller_Action $this->view->html = $this->view->render('webstream/webstream.phtml'); } + public function deleteAction() + { + $request = $this->getRequest(); + $id = $request->getParam("ids"); + + $webstream = CcWebstreamQuery::create()->findPK($id)->delete(); + + } + public function saveAction() { $request = $this->getRequest(); diff --git a/airtime_mvc/application/views/scripts/playlist/playlist.phtml b/airtime_mvc/application/views/scripts/playlist/playlist.phtml index 70ce2faea..8ca2af991 100644 --- a/airtime_mvc/application/views/scripts/playlist/playlist.phtml +++ b/airtime_mvc/application/views/scripts/playlist/playlist.phtml @@ -13,7 +13,7 @@ if (isset($this->obj)) { obj)) : ?> - + diff --git a/airtime_mvc/application/views/scripts/playlist/smart-block.phtml b/airtime_mvc/application/views/scripts/playlist/smart-block.phtml index d3874d5fd..9b43655f6 100644 --- a/airtime_mvc/application/views/scripts/playlist/smart-block.phtml +++ b/airtime_mvc/application/views/scripts/playlist/smart-block.phtml @@ -10,7 +10,7 @@ if (isset($this->obj)) { "> Playlist crossfade - + obj)) : ?> diff --git a/airtime_mvc/application/views/scripts/webstream/webstream.phtml b/airtime_mvc/application/views/scripts/webstream/webstream.phtml index d3660bfc4..939cfffde 100644 --- a/airtime_mvc/application/views/scripts/webstream/webstream.phtml +++ b/airtime_mvc/application/views/scripts/webstream/webstream.phtml @@ -4,9 +4,11 @@ ws)) : ?> - - + + ws->getLastModified('U'); ?>"> + +

diff --git a/airtime_mvc/public/js/airtime/library/spl.js b/airtime_mvc/public/js/airtime/library/spl.js index 73190a1f5..7074b07b7 100644 --- a/airtime_mvc/public/js/airtime/library/spl.js +++ b/airtime_mvc/public/js/airtime/library/spl.js @@ -6,7 +6,7 @@ var AIRTIME = (function(AIRTIME){ if (AIRTIME.playlist === undefined) { AIRTIME.playlist = {}; - } + } var mod = AIRTIME.playlist, viewport, @@ -568,7 +568,7 @@ var AIRTIME = (function(AIRTIME){ //stream url //default_length //playlist name - var id = $pl.find("#ws_id").attr("value"); + var id = $pl.find("#obj_id").attr("value"); var description = $pl.find("#description").val(); var streamurl = $pl.find("#streamurl-element input").val(); var length = $pl.find("#streamlength-element input").val(); @@ -596,7 +596,7 @@ var AIRTIME = (function(AIRTIME){ $status.show(); setTimeout(function(){$status.fadeOut("slow", function(){$status.empty()})}, 5000); - var $ws_id = $("#ws_id"); + var $ws_id = $("#obj_id"); $ws_id.attr("value", json.streamId); var $ws_id = $("#ws_delete"); @@ -802,6 +802,23 @@ var AIRTIME = (function(AIRTIME){ redrawLib(); }); }; + + mod.fnWsDelete = function(wsid) { + var url, id, lastMod; + + stopAudioPreview(); + id = (wsid === undefined) ? getId() : wsid; + lastMod = getModified(); + type = $('#obj_type').val(); + url = '/Webstream/delete'; + + $.post(url, + {format: "json", ids: id, modified: lastMod, type: type}, + function(json){ + openPlaylist(json); + redrawLib(); + }); + }; mod.disableUI = function() { @@ -903,6 +920,10 @@ var AIRTIME = (function(AIRTIME){ $pl.delegate("#spl_delete", {"click": function(ev){ AIRTIME.playlist.fnDelete(); }}); + + $pl.delegate("#ws_delete", {"click": function(ev){ + AIRTIME.playlist.fnWsDelete(); + }}); setPlaylistEntryEvents(); setCueEvents();