Merge branch 'devel' of dev.sourcefabric.org:airtime into devel
This commit is contained in:
commit
39903be69a
|
@ -90,9 +90,9 @@ class LibraryController extends Zend_Controller_Action
|
||||||
|
|
||||||
protected function playlistNotFound($p_type)
|
protected function playlistNotFound($p_type)
|
||||||
{
|
{
|
||||||
$this->view->error = "{$p_type} not found";
|
$this->view->error = "$p_type not found";
|
||||||
|
|
||||||
Logging::info("{$p_type} not found");
|
Logging::info("$p_type not found");
|
||||||
Application_Model_Library::changePlaylist(null, $p_type);
|
Application_Model_Library::changePlaylist(null, $p_type);
|
||||||
$this->createFullResponse(null);
|
$this->createFullResponse(null);
|
||||||
}
|
}
|
||||||
|
|
|
@ -109,7 +109,7 @@ class UserController extends Zend_Controller_Action
|
||||||
# TODO : remove this. we only use default for now not to break the UI.
|
# TODO : remove this. we only use default for now not to break the UI.
|
||||||
if (!$files_action) { # set default action
|
if (!$files_action) { # set default action
|
||||||
$files_action = "reassign_to";
|
$files_action = "reassign_to";
|
||||||
$valid_actions =
|
$delId = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
# only delete when valid action is selected for the owned files
|
# only delete when valid action is selected for the owned files
|
||||||
|
|
|
@ -17,8 +17,9 @@ class WebstreamController extends Zend_Controller_Action
|
||||||
|
|
||||||
$userInfo = Zend_Auth::getInstance()->getStorage()->read();
|
$userInfo = Zend_Auth::getInstance()->getStorage()->read();
|
||||||
if (!$this->isAuthorized(-1)) {
|
if (!$this->isAuthorized(-1)) {
|
||||||
|
// TODO: this header call does not actually print any error message
|
||||||
header("Status: 401 Not Authorized");
|
header("Status: 401 Not Authorized");
|
||||||
|
Logging::info("Ain't not Authorized");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -94,30 +95,35 @@ class WebstreamController extends Zend_Controller_Action
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*TODO : make a user object be passed a parameter into this function so
|
||||||
|
that it does not have to be fetched multiple times.*/
|
||||||
public function isAuthorized($webstream_id)
|
public function isAuthorized($webstream_id)
|
||||||
{
|
{
|
||||||
$hasPermission = false;
|
|
||||||
$user = Application_Model_User::getCurrentUser();
|
$user = Application_Model_User::getCurrentUser();
|
||||||
if ($user->isUserType(array(UTYPE_ADMIN, UTYPE_PROGRAM_MANAGER))) {
|
if ($user->isUserType(array(UTYPE_ADMIN, UTYPE_PROGRAM_MANAGER))) {
|
||||||
$hasPermission = true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!$hasPermission && $user->isHost()) {
|
if ($user->isHost()) {
|
||||||
|
// not creating a webstream
|
||||||
if ($webstream_id != -1) {
|
if ($webstream_id != -1) {
|
||||||
$webstream = CcWebstreamQuery::create()->findPK($webstream_id);
|
$webstream = CcWebstreamQuery::create()->findPK($webstream_id);
|
||||||
//we are updating a playlist. Ensure that if the user is a host/dj, that he has the correct permission.
|
/*we are updating a playlist. Ensure that if the user is a
|
||||||
|
host/dj, that he has the correct permission.*/
|
||||||
$user = Application_Model_User::getCurrentUser();
|
$user = Application_Model_User::getCurrentUser();
|
||||||
|
//only allow when webstream belongs to the DJ
|
||||||
if ($webstream->getDbCreatorId() == $user->getId()) {
|
Logging::info("Webstream id:".$webstream->getDbCreatorId());
|
||||||
$hasPermission = true;
|
Logging::info("User id:".$user->getId());
|
||||||
}
|
return $webstream->getDbCreatorId() == $user->getId();
|
||||||
} else {
|
|
||||||
//we are creating a new stream. Don't need to check whether the DJ/Host owns the stream
|
|
||||||
$hasPermission = true;
|
|
||||||
}
|
}
|
||||||
|
/*we are creating a new stream. Don't need to check whether the
|
||||||
|
DJ/Host owns the stream*/
|
||||||
|
return true;
|
||||||
|
} else {
|
||||||
|
Logging::info( $user );
|
||||||
}
|
}
|
||||||
|
Logging::info("what the fuck");
|
||||||
return $hasPermission;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function saveAction()
|
public function saveAction()
|
||||||
|
|
|
@ -70,36 +70,15 @@ class Application_Model_User
|
||||||
return $result;
|
return $result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// TODO : refactor code to only accept arrays for isUserType and
|
||||||
|
// simplify code even further
|
||||||
public function isUserType($type)
|
public function isUserType($type)
|
||||||
{
|
{
|
||||||
if (is_array($type)) {
|
if (!is_array($type)) {
|
||||||
$result = false;
|
$type = array($type);
|
||||||
foreach ($type as $t) {
|
|
||||||
switch ($t) {
|
|
||||||
case UTYPE_ADMIN:
|
|
||||||
$result = $this->_userInstance->getDbType() === 'A';
|
|
||||||
break;
|
|
||||||
case UTYPE_HOST:
|
|
||||||
$result = $this->_userInstance->getDbType() === 'H';
|
|
||||||
break;
|
|
||||||
case UTYPE_PROGRAM_MANAGER:
|
|
||||||
$result = $this->_userInstance->getDbType() === 'P';
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
if ($result) {
|
|
||||||
return $result;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
switch ($type) {
|
|
||||||
case UTYPE_ADMIN:
|
|
||||||
return $this->_userInstance->getDbType() === 'A';
|
|
||||||
case UTYPE_HOST:
|
|
||||||
return $this->_userInstance->getDbId() === 'H';
|
|
||||||
case UTYPE_PROGRAM_MANAGER:
|
|
||||||
return $this->_userInstance->getDbType() === 'P';
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
$real_type = $this->_userInstance->getDbType();
|
||||||
|
return in_array($real_type, $type);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function setLogin($login)
|
public function setLogin($login)
|
||||||
|
|
|
@ -78,11 +78,11 @@ class Application_Model_Webstream implements Application_Model_LibraryEditable
|
||||||
$username = $subjs->getDbLogin();
|
$username = $subjs->getDbLogin();
|
||||||
|
|
||||||
return array(
|
return array(
|
||||||
"name" => $this->webstream->getDbName(),
|
"name" => $this->webstream->getDbName(),
|
||||||
"length" => $this->webstream->getDbLength(),
|
"length" => $this->webstream->getDbLength(),
|
||||||
"description" => $this->webstream->getDbDescription(),
|
"description" => $this->webstream->getDbDescription(),
|
||||||
"login"=> $username,
|
"login" => $username,
|
||||||
"url" => $this->webstream->getDbUrl(),
|
"url" => $this->webstream->getDbUrl(),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
<?php echo $this->render('library/library.phtml') ?>
|
<?php echo $this->render('library/library.phtml') ?>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div id="side_playlist" class="pl-content ui-widget ui-widget-content block-shadow omega-block padded" style="height:697px; width:720px !important;">
|
<div id="side_playlist" class="pl-content ui-widget ui-widget-content block-shadow omega-block padded" style="height:697px; width:720px;">
|
||||||
<?php if ($this->type == 'block') {
|
<?php if ($this->type == 'block') {
|
||||||
echo $this->render('playlist/smart-block.phtml');
|
echo $this->render('playlist/smart-block.phtml');
|
||||||
} else if ($this->type == 'playlist') {
|
} else if ($this->type == 'playlist') {
|
||||||
|
|
|
@ -17,12 +17,12 @@ if ($item['type'] == 2) {
|
||||||
<span class="ui-icon ui-icon-play"></span>
|
<span class="ui-icon ui-icon-play"></span>
|
||||||
</div>
|
</div>
|
||||||
<?php elseif ($item['type'] == 1 && $item['exists']): ?>
|
<?php elseif ($item['type'] == 1 && $item['exists']): ?>
|
||||||
<div class="big_play">
|
<div class="big_play" data-mime-type="<?php echo $item["mime"]; ?>">
|
||||||
<span class="ui-icon ui-icon-play"></span>
|
<span class="ui-icon ui-icon-play"></span>
|
||||||
</div>
|
</div>
|
||||||
<?php elseif ($item['type'] == 2 && $item['exists']): ?>
|
<?php elseif ($item['type'] == 2 && $item['exists']): ?>
|
||||||
<div class="big_play ui-state-hover" blockId="<?php echo $item["item_id"]; ?>">
|
<div class="big_play" blockId="<?php echo $item["item_id"]; ?>">
|
||||||
<span class="ui-icon ui-icon-alert"></span>
|
<span class="ui-icon ui-icon-play"></span>
|
||||||
</div>
|
</div>
|
||||||
<?php else:?>
|
<?php else:?>
|
||||||
<div class="big_play ui-state-hover">
|
<div class="big_play ui-state-hover">
|
||||||
|
|
|
@ -367,30 +367,33 @@ var AIRTIME = (function(AIRTIME){
|
||||||
//then the playlist element is greyed out
|
//then the playlist element is greyed out
|
||||||
mod.validatePlaylistElements = function(){
|
mod.validatePlaylistElements = function(){
|
||||||
$.each($(".big_play"), function(index, value){
|
$.each($(".big_play"), function(index, value){
|
||||||
var mime = $(value).attr("data-mime-type");
|
if ($(value).attr('blockId') === undefined) {
|
||||||
if (isAudioSupported(mime)) {
|
var mime = $(value).attr("data-mime-type");
|
||||||
$(value).bind("click", openAudioPreview);
|
console.log($(value));
|
||||||
} else {
|
if (isAudioSupported(mime)) {
|
||||||
$(value).attr("class", "big_play_disabled dark_class");
|
$(value).bind("click", openAudioPreview);
|
||||||
$(value).qtip({
|
} else {
|
||||||
content: 'Your browser does not support playing this file type: "'+ mime +'"',
|
$(value).attr("class", "big_play_disabled dark_class");
|
||||||
show: 'mouseover',
|
$(value).qtip({
|
||||||
hide: {
|
content: 'Your browser does not support playing this file type: "'+ mime +'"',
|
||||||
delay: 500,
|
show: 'mouseover',
|
||||||
fixed: true
|
hide: {
|
||||||
},
|
delay: 500,
|
||||||
style: {
|
fixed: true
|
||||||
border: {
|
|
||||||
width: 0,
|
|
||||||
radius: 4
|
|
||||||
},
|
},
|
||||||
classes: "ui-tooltip-dark ui-tooltip-rounded"
|
style: {
|
||||||
},
|
border: {
|
||||||
position: {
|
width: 0,
|
||||||
my: "left bottom",
|
radius: 4
|
||||||
at: "right center"
|
},
|
||||||
},
|
classes: "ui-tooltip-dark ui-tooltip-rounded"
|
||||||
})
|
},
|
||||||
|
position: {
|
||||||
|
my: "left bottom",
|
||||||
|
at: "right center"
|
||||||
|
},
|
||||||
|
})
|
||||||
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
|
@ -51,7 +51,7 @@ class FakeMutagen(dict):
|
||||||
FakeInfo = namedtuple('FakeInfo','length bitrate')
|
FakeInfo = namedtuple('FakeInfo','length bitrate')
|
||||||
def __init__(self,path):
|
def __init__(self,path):
|
||||||
self.path = path
|
self.path = path
|
||||||
self.mime = []
|
self.mime = ['audio/wav']
|
||||||
self.info = FakeMutagen.FakeInfo(0.0, '')
|
self.info = FakeMutagen.FakeInfo(0.0, '')
|
||||||
dict.__init__(self)
|
dict.__init__(self)
|
||||||
def set_length(self,l):
|
def set_length(self,l):
|
||||||
|
|
Loading…
Reference in New Issue