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

This commit is contained in:
Rudi Grinberg 2012-08-21 10:43:04 -04:00
commit 6d0d0eada9
6 changed files with 72 additions and 42 deletions

View File

@ -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()) {

View File

@ -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();

View File

@ -13,7 +13,7 @@ if (isset($this->obj)) {
<?php endif; ?>
<?php if (isset($this->obj)) : ?>
<button class="ui-button ui-state-default sp-save" type="button" id="save_button">Save</button>
<button class="ui-button ui-state-default sp-save" title='Save playlist' type="button" id="save_button">Save</button>
<input id="obj_id" type="hidden" value="<?php echo $this->obj->getId(); ?>"></input>
<input id="obj_lastMod" type="hidden" value="<?php echo $this->obj->getLastModified('U'); ?>"></input>
<input id='obj_type' type='hidden' value='playlist'></input>

View File

@ -10,7 +10,7 @@ if (isset($this->obj)) {
<a href="#" id="spl_crossfade" class="ui-button ui-button-icon-only ui-widget ui-state-default crossfade-main-button" style="display:<?php echo ($this->obj->isStatic() && $count > 0) ?"block;":"none;"?>">
<span class="ui-icon crossfade-main-icon"></span><span class="ui-button-text">Playlist crossfade</span>
</a>
<button class="ui-button ui-state-default sp-save" type="button" id="save_button">Save</button>
<button class="ui-button ui-state-default sp-save" title='Save smart block&#39s title, description, and criteria' type="button" id="save_button">Save</button>
<?php endif; ?>
<?php if (isset($this->obj)) : ?>

View File

@ -4,9 +4,11 @@
<?php endif; ?>
<?php if (isset($this->ws)) : ?>
<input id="ws_id" type="hidden" value="<?php echo $this->ws->getId(); ?>"></input>
<input id="pl_lastMod" type="hidden" value="<?php echo $this->ws->getLastModified('U'); ?>"></input>
<input id="obj_id" type="hidden" value="<?php echo $this->ws->getId(); ?>"></input>
<input id="obj_lastMod" type="hidden" value="<?php echo "1";//$this->ws->getLastModified('U'); ?>"></input>
<input id="obj_type" type="hidden" value="webstream"></input>
<div class="status" style="display:none;"></div>
<div class="playlist_title">
<div id="name-error" class="errors" style="display:none;"></div>
<h3 id="ws_name">

View File

@ -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();