CC-1665: Scheduled stream rebroadcasting and recording
-fixed clicking save multiple times creates multiple smart playlists
This commit is contained in:
parent
12ddf30049
commit
e511f7cd37
|
@ -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();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -579,6 +579,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…
Reference in New Issue