Merge branch 'devel' of dev.sourcefabric.org:airtime into devel
This commit is contained in:
commit
1e1398739f
10 changed files with 111 additions and 23 deletions
|
@ -51,6 +51,12 @@ class WebstreamController extends Zend_Controller_Action
|
|||
|
||||
$user = Application_Model_User::getCurrentUser();
|
||||
$hasPermission = $user->isUserType(array(UTYPE_ADMIN, UTYPE_PROGRAM_MANAGER, UTYPE_HOST));
|
||||
|
||||
if (!$hasPermission) {
|
||||
header("Status: 401 Not Authorized");
|
||||
return;
|
||||
}
|
||||
|
||||
$id = $request->getParam("id");
|
||||
|
||||
$parameters = array();
|
||||
|
@ -70,21 +76,19 @@ class WebstreamController extends Zend_Controller_Action
|
|||
}
|
||||
}
|
||||
|
||||
if (!$hasPermission) {
|
||||
header("Status: 401 Not Authorized");
|
||||
return;
|
||||
}
|
||||
|
||||
list($analysis, $mime, $di) = Application_Model_Webstream::analyzeFormData($parameters);
|
||||
try {
|
||||
if (Application_Model_Webstream::isValid($analysis)) {
|
||||
Application_Model_Webstream::save($parameters, $mime, $di);
|
||||
$streamId = Application_Model_Webstream::save($parameters, $mime, $di);
|
||||
$this->view->statusMessage = "<div class='success'>Webstream saved.</div>";
|
||||
$this->view->streamId = $streamId;
|
||||
} else {
|
||||
throw new Exception("isValid returned false");
|
||||
}
|
||||
} catch (Exception $e) {
|
||||
$this->view->statusMessage = "<div class='errors'>Invalid form values.</div>";
|
||||
$this->view->streamId = -1;
|
||||
$this->view->analysis = $analysis;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -199,7 +199,13 @@ class Application_Model_Webstream{
|
|||
{
|
||||
$userInfo = Zend_Auth::getInstance()->getStorage()->read();
|
||||
|
||||
$webstream = new CcWebstream();
|
||||
$id = $parameters['id'];
|
||||
if ($id != -1) {
|
||||
$webstream = CcWebstreamQuery::create()->findPK($id);
|
||||
} else {
|
||||
$webstream = new CcWebstream();
|
||||
}
|
||||
|
||||
$webstream->setDbName($parameters["name"]);
|
||||
$webstream->setDbDescription($parameters["description"]);
|
||||
$webstream->setDbUrl($parameters["url"]);
|
||||
|
@ -214,5 +220,7 @@ class Application_Model_Webstream{
|
|||
|
||||
$webstream->setDbMime($mime);
|
||||
$webstream->save();
|
||||
|
||||
return $webstream->getDbId();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -641,7 +641,7 @@ var AIRTIME = (function(AIRTIME) {
|
|||
if (data.ftype === 'playlist' && data.length !== '0.0'){
|
||||
playlistIndex = $(this).parent().attr('id').substring(3); //remove the pl_
|
||||
open_playlist_preview(playlistIndex, 0);
|
||||
} else if (data.ftype === 'audioclip') {
|
||||
} else if (data.ftype === 'audioclip' || data.ftype === 'stream') {
|
||||
open_audio_preview(data.ftype, data.audioFile, data.track_title, data.artist_name);
|
||||
} else if (data.ftype === 'block') {
|
||||
blockIndex = $(this).parent().attr('id').substring(3); //remove the pl_
|
||||
|
|
|
@ -580,6 +580,10 @@ var AIRTIME = (function(AIRTIME){
|
|||
$status.html(json.statusMessage);
|
||||
$status.show();
|
||||
setTimeout(function(){$status.fadeOut("slow", function(){$status.empty()})}, 5000);
|
||||
|
||||
var $ws_id = $("#ws_id");
|
||||
$ws_id.attr("value", json.streamId);
|
||||
|
||||
//redraw the library to show the new webstream
|
||||
redrawLib();
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue