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

This commit is contained in:
denise 2012-08-09 11:21:01 -04:00
commit bad418062e
3 changed files with 35 additions and 22 deletions

View File

@ -195,15 +195,16 @@ class PlaylistController extends Zend_Controller_Action
$userInfo = Zend_Auth::getInstance()->getStorage()->read();
$user = new Application_Model_User($userInfo->id);
$isAdminOrPM = $user->isUserType(array(UTYPE_ADMIN, UTYPE_PROGRAM_MANAGER));
$this->view->obj = $obj;
if($isAdminOrPM || $obj->getCreatorId() == $userInfo->id){
$this->view->obj = $obj;
if($this->obj_sess->type == "block"){
$form = new Application_Form_SmartBlockCriteria();
$form->startForm($this->obj_sess->id);
$this->view->form = $form;
}
}
$formatter = new LengthFormatter($obj->getLength());
$this->view->length = $formatter->format();
$this->view->type = $this->obj_sess->type;

View File

@ -172,19 +172,19 @@ class Application_Model_Playlist
*/
$sql = <<<"EOT"
(SELECT * FROM
((SELECT pc.id as id, pc.type, pc.position, pc.cliplength as length, pc.cuein, pc.cueout, pc.fadein, pc.fadeout,
f.id as item_id, f.track_title, f.artist_name as creator, f.file_exists as exists, f.filepath as path FROM cc_playlistcontents AS pc
((SELECT pc.id as id, pc.type, pc.position, pc.cliplength as length, pc.cuein, pc.cueout, pc.fadein, pc.fadeout,
f.id as item_id, f.track_title, f.artist_name as creator, f.file_exists as exists, f.filepath as path FROM cc_playlistcontents AS pc
JOIN cc_files AS f ON pc.file_id=f.id WHERE pc.playlist_id = {$this->id} AND type = 0)
UNION ALL
(SELECT pc.id as id, pc.type, pc.position, pc.cliplength as length, pc.cuein, pc.cueout, pc.fadein, pc.fadeout,
ws.id as item_id, (ws.name || ': ' || ws.url) as title, sub.login as creator, 't'::boolean as exists, ws.url as path FROM cc_playlistcontents AS pc
JOIN cc_webstream AS ws on pc.stream_id=ws.id
(SELECT pc.id as id, pc.type, pc.position, pc.cliplength as length, pc.cuein, pc.cueout, pc.fadein, pc.fadeout,
ws.id as item_id, (ws.name || ': ' || ws.url) as title, sub.login as creator, 't'::boolean as exists, ws.url as path FROM cc_playlistcontents AS pc
JOIN cc_webstream AS ws on pc.stream_id=ws.id
LEFT JOIN cc_subjs as sub on sub.id = ws.creator_id
WHERE pc.playlist_id = {$this->id} AND pc.type = 1)
UNION ALL
(SELECT pc.id as id, pc.type, pc.position, pc.cliplength as length, pc.cuein, pc.cueout, pc.fadein, pc.fadeout,
bl.id as item_id, bl.name as title, sbj.login as creator, 't'::boolean as exists, NULL::text as path FROM cc_playlistcontents AS pc
JOIN cc_block AS bl on pc.block_id=bl.id
(SELECT pc.id as id, pc.type, pc.position, pc.cliplength as length, pc.cuein, pc.cueout, pc.fadein, pc.fadeout,
bl.id as item_id, bl.name as title, sbj.login as creator, 't'::boolean as exists, NULL::text as path FROM cc_playlistcontents AS pc
JOIN cc_block AS bl on pc.block_id=bl.id
JOIN cc_subjs as sbj ON bl.creator_id=sbj.id WHERE pc.playlist_id = {$this->id} AND pc.type = 2)) as temp
ORDER BY temp.position);
EOT;
@ -343,7 +343,7 @@ EOT;
throw new Exception("Unknown file type");
}
if (isset($obj)) {
if (isset($obj)) {
if (($obj instanceof CcFiles && $obj->getDbFileExists()) || $obj instanceof CcWebstream || $obj instanceof CcBlock) {
$entry = $this->plItem;
$entry["id"] = $obj->getDbId();
@ -559,8 +559,9 @@ EOT;
->filterByDbPosition($pos)
->findOne();
if (!$row) {
return NULL;
}
#Propel returns values in form 00.000000 format which is for only seconds.
$fadeIn = $row->getDbFadein();
$fadeOut = $row->getDbFadeout();
@ -864,7 +865,7 @@ EOT;
}
}
// This function returns that are not owen by $p_user_id among $p_ids
// This function returns that are not owen by $p_user_id among $p_ids
private static function playlistsNotOwnedByUser($p_ids, $p_userId){
$ownedByUser = CcPlaylistQuery::create()->filterByDbCreatorId($p_userId)->find()->getData();
$selectedPls = $p_ids;

View File

@ -379,7 +379,6 @@ var AIRTIME = (function(AIRTIME){
var isStatic = data.isStatic;
delete data.type;
if (isStatic) {
console.log(data);
$.each(data, function(index, ele){
if (ele.track_title !== undefined) {
$html += "<div>"+ele.track_title+" "+ele.creator+" "+ele.length+"</div>";
@ -452,14 +451,26 @@ var AIRTIME = (function(AIRTIME){
playlistError(json);
}
else {
$pl.find("span.spl_main_fade_in")
.empty()
.append(json.fadeIn);
$pl.find("span.spl_main_fade_out")
.empty()
.append(json.fadeOut);
var fadeIn = $pl.find("span.spl_main_fade_in");
var fadeOut = $pl.find("span.spl_main_fade_out");
console.log(json);
if (json.fadeIn == null) {
console.log("fadein is null");
fadeIn.parent().prev().hide();
fadeIn.hide();
} else {
fadeIn.parent().prev().show();
fadeIn.show();
fadeIn.empty().append(json.fadeIn);
}
if (json.fadeOut == null) {
fadeOut.parent().prev().hide();
fadeOut.hide();
} else {
fadeOut.parent().prev().show();
fadeOut.show();
fadeOut.empty().append(json.fadeOut);
}
$pl.find("#crossfade_main").show();
}
});