CC-3452: Live Stream: DJs assigned to the show and Program Managers should
be able to control switches and able to kick out connection - kickout buttons and switch buttons are now visible to everyone. - clicking buttons without correct permission will return proper error msg.
This commit is contained in:
parent
2beadc9301
commit
4595da9087
10 changed files with 98 additions and 62 deletions
|
@ -18,17 +18,44 @@ class DashboardController extends Zend_Controller_Action
|
||||||
|
|
||||||
public function disconnectSourceAction(){
|
public function disconnectSourceAction(){
|
||||||
$request = $this->getRequest();
|
$request = $this->getRequest();
|
||||||
|
|
||||||
$sourcename = $request->getParam('sourcename');
|
$sourcename = $request->getParam('sourcename');
|
||||||
|
|
||||||
|
$userInfo = Zend_Auth::getInstance()->getStorage()->read();
|
||||||
|
$user = new Application_Model_User($userInfo->id);
|
||||||
|
|
||||||
|
$show = Application_Model_Show::GetCurrentShow();
|
||||||
|
|
||||||
|
$show_id = isset($show['id'])?$show['id']:0;
|
||||||
|
|
||||||
|
$source_connected = Application_Model_Preference::GetSourceStatus($sourcename);
|
||||||
|
|
||||||
|
if($user->canSchedule($show_id) && $source_connected){
|
||||||
$data = array("sourcename"=>$sourcename);
|
$data = array("sourcename"=>$sourcename);
|
||||||
Application_Model_RabbitMq::SendMessageToPypo("disconnect_source", $data);
|
Application_Model_RabbitMq::SendMessageToPypo("disconnect_source", $data);
|
||||||
|
}else{
|
||||||
|
if($source_connected){
|
||||||
|
$this->view->error = "You don't have permission to disconnect source.";
|
||||||
|
}else{
|
||||||
|
$this->view->error = "There is no source connected to this input.";
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public function switchSourceAction(){
|
public function switchSourceAction(){
|
||||||
$request = $this->getRequest();
|
$request = $this->getRequest();
|
||||||
|
|
||||||
$sourcename = $this->_getParam('sourcename');
|
$sourcename = $this->_getParam('sourcename');
|
||||||
$current_status = $this->_getParam('status');
|
$current_status = $this->_getParam('status');
|
||||||
|
|
||||||
|
$userInfo = Zend_Auth::getInstance()->getStorage()->read();
|
||||||
|
$user = new Application_Model_User($userInfo->id);
|
||||||
|
|
||||||
|
$show = Application_Model_Show::GetCurrentShow();
|
||||||
|
$show_id = isset($show['id'])?$show['id']:0;
|
||||||
|
|
||||||
|
$source_connected = Application_Model_Preference::GetSourceStatus($sourcename);
|
||||||
|
|
||||||
|
if($user->canSchedule($show_id) && ($source_connected || $sourcename == 'scheduled_play')){
|
||||||
|
|
||||||
$change_status_to = "on";
|
$change_status_to = "on";
|
||||||
|
|
||||||
if(strtolower($current_status) == "on"){
|
if(strtolower($current_status) == "on"){
|
||||||
|
@ -45,6 +72,14 @@ class DashboardController extends Zend_Controller_Action
|
||||||
$this->view->status = "ON";
|
$this->view->status = "ON";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
else{
|
||||||
|
if($source_connected){
|
||||||
|
$this->view->error = "You don't have permission to switch source.";
|
||||||
|
}else{
|
||||||
|
$this->view->error = "There is no source connected to this input.";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public function switchOffSource(){
|
public function switchOffSource(){
|
||||||
|
|
||||||
|
|
|
@ -13,11 +13,11 @@
|
||||||
<?php echo $this->versionNotify();
|
<?php echo $this->versionNotify();
|
||||||
$sss = $this->SourceSwitchStatus();
|
$sss = $this->SourceSwitchStatus();
|
||||||
$scs = $this->SourceConnectionStatus();
|
$scs = $this->SourceConnectionStatus();
|
||||||
$isAdmin = $this->isAdmin();
|
$isPermissionAllowed = $this->IsPermissionAllowed();
|
||||||
?>
|
?>
|
||||||
<?php echo $this->partial('partialviews/header.phtml', array("user" => $this->loggedInAs(), "is_trial"=>$this->isTrial(), "trial_remain"=> $this->trialRemaining(),
|
<?php echo $this->partial('partialviews/header.phtml', array("user" => $this->loggedInAs(), "is_trial"=>$this->isTrial(), "trial_remain"=> $this->trialRemaining(),
|
||||||
"live_dj_switch"=>$sss['live_dj'], "live_dj_connection"=>$scs['live_dj'], "master_dj_switch"=>$sss['master_dj'], "master_dj_connection"=>$scs['master_dj'],
|
"live_dj_switch"=>$sss['live_dj'], "live_dj_connection"=>$scs['live_dj'], "master_dj_switch"=>$sss['master_dj'], "master_dj_connection"=>$scs['master_dj'],
|
||||||
"scheduled_play_switch"=>$sss['scheduled_play'], "isAdmin"=>$isAdmin)) ?>
|
"scheduled_play_switch"=>$sss['scheduled_play'], "isPermissionAllowed"=>$isPermissionAllowed)) ?>
|
||||||
|
|
||||||
<?php $partial = array('menu.phtml', 'default');
|
<?php $partial = array('menu.phtml', 'default');
|
||||||
$this->navigation()->menu()->setPartial($partial); ?>
|
$this->navigation()->menu()->setPartial($partial); ?>
|
||||||
|
|
|
@ -14,12 +14,11 @@
|
||||||
<?php echo $this->versionNotify();
|
<?php echo $this->versionNotify();
|
||||||
$sss = $this->SourceSwitchStatus();
|
$sss = $this->SourceSwitchStatus();
|
||||||
$scs = $this->SourceConnectionStatus();
|
$scs = $this->SourceConnectionStatus();
|
||||||
$isAdmin = $this->isAdmin();
|
$isPermissionAllowed = $this->IsPermissionAllowed();
|
||||||
?>
|
?>
|
||||||
<?php echo $this->partial('partialviews/header.phtml', array("user" => $this->loggedInAs(), "is_trial"=>$this->isTrial(), "trial_remain"=> $this->trialRemaining(),
|
<?php echo $this->partial('partialviews/header.phtml', array("user" => $this->loggedInAs(), "is_trial"=>$this->isTrial(), "trial_remain"=> $this->trialRemaining(),
|
||||||
"live_dj_switch"=>$sss['live_dj'], "live_dj_connection"=>$scs['live_dj'], "master_dj_switch"=>$sss['master_dj'], "master_dj_connection"=>$scs['master_dj'],
|
"live_dj_switch"=>$sss['live_dj'], "live_dj_connection"=>$scs['live_dj'], "master_dj_switch"=>$sss['master_dj'], "master_dj_connection"=>$scs['master_dj'],
|
||||||
"scheduled_play_switch"=>$sss['scheduled_play'], "isAdmin"=>$isAdmin)) ?>
|
"scheduled_play_switch"=>$sss['scheduled_play'], "isPermissionAllowed"=>$isPermissionAllowed)) ?>
|
||||||
|
|
||||||
<?php $partial = array('menu.phtml', 'default');
|
<?php $partial = array('menu.phtml', 'default');
|
||||||
$this->navigation()->menu()->setPartial($partial); ?>
|
$this->navigation()->menu()->setPartial($partial); ?>
|
||||||
|
|
||||||
|
|
|
@ -14,11 +14,11 @@
|
||||||
<?php echo $this->versionNotify();
|
<?php echo $this->versionNotify();
|
||||||
$sss = $this->SourceSwitchStatus();
|
$sss = $this->SourceSwitchStatus();
|
||||||
$scs = $this->SourceConnectionStatus();
|
$scs = $this->SourceConnectionStatus();
|
||||||
$isAdmin = $this->isAdmin();
|
$isPermissionAllowed = $this->IsPermissionAllowed();
|
||||||
?>
|
?>
|
||||||
<?php echo $this->partial('partialviews/header.phtml', array("user" => $this->loggedInAs(), "is_trial"=>$this->isTrial(), "trial_remain"=> $this->trialRemaining(),
|
<?php echo $this->partial('partialviews/header.phtml', array("user" => $this->loggedInAs(), "is_trial"=>$this->isTrial(), "trial_remain"=> $this->trialRemaining(),
|
||||||
"live_dj_switch"=>$sss['live_dj'], "live_dj_connection"=>$scs['live_dj'], "master_dj_switch"=>$sss['master_dj'], "master_dj_connection"=>$scs['master_dj'],
|
"live_dj_switch"=>$sss['live_dj'], "live_dj_connection"=>$scs['live_dj'], "master_dj_switch"=>$sss['master_dj'], "master_dj_connection"=>$scs['master_dj'],
|
||||||
"scheduled_play_switch"=>$sss['scheduled_play'], "isAdmin"=>$isAdmin)) ?>
|
"scheduled_play_switch"=>$sss['scheduled_play'], "isPermissionAllowed"=>$isPermissionAllowed)) ?>
|
||||||
|
|
||||||
<?php $partial = array('menu.phtml', 'default');
|
<?php $partial = array('menu.phtml', 'default');
|
||||||
$this->navigation()->menu()->setPartial($partial); ?>
|
$this->navigation()->menu()->setPartial($partial); ?>
|
||||||
|
|
|
@ -14,11 +14,11 @@
|
||||||
<?php echo $this->versionNotify();
|
<?php echo $this->versionNotify();
|
||||||
$sss = $this->SourceSwitchStatus();
|
$sss = $this->SourceSwitchStatus();
|
||||||
$scs = $this->SourceConnectionStatus();
|
$scs = $this->SourceConnectionStatus();
|
||||||
$isAdmin = $this->isAdmin();
|
$isPermissionAllowed = $this->IsPermissionAllowed();
|
||||||
?>
|
?>
|
||||||
<?php echo $this->partial('partialviews/header.phtml', array("user" => $this->loggedInAs(), "is_trial"=>$this->isTrial(), "trial_remain"=> $this->trialRemaining(),
|
<?php echo $this->partial('partialviews/header.phtml', array("user" => $this->loggedInAs(), "is_trial"=>$this->isTrial(), "trial_remain"=> $this->trialRemaining(),
|
||||||
"live_dj_switch"=>$sss['live_dj'], "live_dj_connection"=>$scs['live_dj'], "master_dj_switch"=>$sss['master_dj'], "master_dj_connection"=>$scs['master_dj'],
|
"live_dj_switch"=>$sss['live_dj'], "live_dj_connection"=>$scs['live_dj'], "master_dj_switch"=>$sss['master_dj'], "master_dj_connection"=>$scs['master_dj'],
|
||||||
"scheduled_play_switch"=>$sss['scheduled_play'], "isAdmin"=>$isAdmin)) ?>
|
"scheduled_play_switch"=>$sss['scheduled_play'], "isPermissionAllowed"=>$isPermissionAllowed)) ?>
|
||||||
|
|
||||||
<?php $partial = array('menu.phtml', 'default');
|
<?php $partial = array('menu.phtml', 'default');
|
||||||
$this->navigation()->menu()->setPartial($partial); ?>
|
$this->navigation()->menu()->setPartial($partial); ?>
|
||||||
|
|
|
@ -31,6 +31,10 @@ class Application_Model_User {
|
||||||
return $this->isUserType(UTYPE_HOST, $showId);
|
return $this->isUserType(UTYPE_HOST, $showId);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function isPM() {
|
||||||
|
return $this->isUserType(UTYPE_PROGRAM_MANAGER);
|
||||||
|
}
|
||||||
|
|
||||||
public function isAdmin() {
|
public function isAdmin() {
|
||||||
return $this->isUserType(UTYPE_ADMIN);
|
return $this->isUserType(UTYPE_ADMIN);
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,11 +0,0 @@
|
||||||
<?php
|
|
||||||
|
|
||||||
class Airtime_View_Helper_IsAdmin extends Zend_View_Helper_Abstract
|
|
||||||
{
|
|
||||||
public function isAdmin()
|
|
||||||
{
|
|
||||||
$userInfo = Zend_Auth::getInstance()->getStorage()->read();
|
|
||||||
$user = new Application_Model_User($userInfo->id);
|
|
||||||
return $user->isAdmin();
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -0,0 +1,18 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
class Airtime_View_Helper_IsPermissionAllowed extends Zend_View_Helper_Abstract
|
||||||
|
{
|
||||||
|
public function IsPermissionAllowed()
|
||||||
|
{
|
||||||
|
$userInfo = Zend_Auth::getInstance()->getStorage()->read();
|
||||||
|
$user = new Application_Model_User($userInfo->id);
|
||||||
|
|
||||||
|
$show = Application_Model_Show::GetCurrentShow();
|
||||||
|
$show_id = isset($show['id'])?$show['id']:0;
|
||||||
|
if($user->canSchedule($show_id)){
|
||||||
|
return true;
|
||||||
|
}else{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -27,25 +27,25 @@
|
||||||
<div id="scheduled_play_div">
|
<div id="scheduled_play_div">
|
||||||
Scheduled Play
|
Scheduled Play
|
||||||
<div class="line-to-on-air off"></div>
|
<div class="line-to-on-air off"></div>
|
||||||
<a href="#" id="scheduled_play" class="source-switch-button" onclick="<?php echo ($this->isAdmin)?"setSwitchListener(this);":"return false"?>"><span><?php echo $this->scheduled_play_switch?></span></a>
|
<a href="#" id="scheduled_play" class="source-switch-button" onclick="setSwitchListener(this);"><span><?php echo $this->scheduled_play_switch?></span></a>
|
||||||
<div class="line-to-switch off"></div>
|
<div class="line-to-switch off"></div>
|
||||||
</div>
|
</div>
|
||||||
</li>
|
</li>
|
||||||
<li>
|
<li>
|
||||||
<div id="live_dj_div">
|
<div id="live_dj_div">
|
||||||
<?php if($this->isAdmin){?><a id="live_dj" class="source-kick-button" onclick="kickSource(this)"></a><?php }?>
|
<a id="live_dj" class="source-kick-button" onclick="kickSource(this)"></a>
|
||||||
Live DJ
|
Live DJ
|
||||||
<div class="line-to-on-air off"></div>
|
<div class="line-to-on-air off"></div>
|
||||||
<a href="#" id="live_dj" class="source-switch-button" onclick="<?php echo ($this->isAdmin)?"setSwitchListener(this);":"return false"?>"><span><?php echo $this->live_dj_switch?></span></a>
|
<a href="#" id="live_dj" class="source-switch-button" onclick="setSwitchListener(this);"><span><?php echo $this->live_dj_switch?></span></a>
|
||||||
<div class="line-to-switch off"></div>
|
<div class="line-to-switch off"></div>
|
||||||
</div>
|
</div>
|
||||||
</li>
|
</li>
|
||||||
<li>
|
<li>
|
||||||
<div id="master_dj_div">
|
<div id="master_dj_div">
|
||||||
<?php if($this->isAdmin){?><a id="master_dj" class="source-kick-button" onclick="kickSource(this)"></a><?php }?>
|
<a id="master_dj" class="source-kick-button" onclick="kickSource(this)"></a>
|
||||||
Master DJ
|
Master DJ
|
||||||
<div class="line-to-on-air off"></div>
|
<div class="line-to-on-air off"></div>
|
||||||
<a href="#" id="master_dj" class="source-switch-button" onclick="<?php echo ($this->isAdmin)?"setSwitchListener(this);":"return false"?>"><span><?php echo $this->master_dj_switch?></span></a>
|
<a href="#" id="master_dj" class="source-switch-button" onclick="setSwitchListener(this);"><span><?php echo $this->master_dj_switch?></span></a>
|
||||||
<div class="line-to-switch off"></div>
|
<div class="line-to-switch off"></div>
|
||||||
</div>
|
</div>
|
||||||
</li>
|
</li>
|
||||||
|
|
|
@ -343,34 +343,25 @@ function setSwitchListener(ele){
|
||||||
var sourcename = $(ele).attr('id')
|
var sourcename = $(ele).attr('id')
|
||||||
var status_span = $(ele).find("span")
|
var status_span = $(ele).find("span")
|
||||||
var status = status_span.html()
|
var status = status_span.html()
|
||||||
var _class = $(ele).parent().find("div.line-to-switch").attr("class")
|
|
||||||
var source_connection_status = false
|
var source_connection_status = false
|
||||||
|
|
||||||
// user should be able to turn on/off scheduled_play switch anytime.
|
|
||||||
if(sourcename.indexOf("scheduled_play") > 0 && _class.indexOf("off") > 0){
|
|
||||||
source_connection_status = false
|
|
||||||
}else{
|
|
||||||
source_connection_status = true
|
|
||||||
}
|
|
||||||
|
|
||||||
if(source_connection_status){
|
|
||||||
$.get("/Dashboard/switch-source/format/json/sourcename/"+sourcename+"/status/"+status, function(data){
|
$.get("/Dashboard/switch-source/format/json/sourcename/"+sourcename+"/status/"+status, function(data){
|
||||||
status_span.html(data.status)
|
if(data.error){
|
||||||
});
|
alert(data.error);
|
||||||
}else{
|
}else{
|
||||||
alert("The source is not connected to Airtime!")
|
status_span.html(data.status)
|
||||||
}
|
}
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
function kickSource(ele){
|
function kickSource(ele){
|
||||||
var sourcename = $(ele).attr('id')
|
var sourcename = $(ele).attr('id')
|
||||||
var source_connection = $(ele).parent().find(".line-to-switch").attr("class")
|
|
||||||
if(source_connection.indexOf("off") > 0){
|
$.get("/Dashboard/disconnect-source/format/json/sourcename/"+sourcename, function(data){
|
||||||
alert("No source is connected to this input.")
|
if(data.error){
|
||||||
return false
|
alert(data.error);
|
||||||
}else{
|
|
||||||
$.get("/Dashboard/disconnect-source/format/json/sourcename/"+sourcename)
|
|
||||||
}
|
}
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
var stream_window = null;
|
var stream_window = null;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue