CC-4144: Playlist Builder: Adding smart playlist into regular playlist will reset the Fade in/out settings to default value

- fixed
This commit is contained in:
James 2012-08-09 11:03:57 -04:00
parent d959e4ff11
commit ae5b6e58d7
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(); $userInfo = Zend_Auth::getInstance()->getStorage()->read();
$user = new Application_Model_User($userInfo->id); $user = new Application_Model_User($userInfo->id);
$isAdminOrPM = $user->isUserType(array(UTYPE_ADMIN, UTYPE_PROGRAM_MANAGER)); $isAdminOrPM = $user->isUserType(array(UTYPE_ADMIN, UTYPE_PROGRAM_MANAGER));
$this->view->obj = $obj;
if($isAdminOrPM || $obj->getCreatorId() == $userInfo->id){ if($isAdminOrPM || $obj->getCreatorId() == $userInfo->id){
$this->view->obj = $obj;
if($this->obj_sess->type == "block"){ if($this->obj_sess->type == "block"){
$form = new Application_Form_SmartBlockCriteria(); $form = new Application_Form_SmartBlockCriteria();
$form->startForm($this->obj_sess->id); $form->startForm($this->obj_sess->id);
$this->view->form = $form; $this->view->form = $form;
} }
} }
$formatter = new LengthFormatter($obj->getLength()); $formatter = new LengthFormatter($obj->getLength());
$this->view->length = $formatter->format(); $this->view->length = $formatter->format();
$this->view->type = $this->obj_sess->type; $this->view->type = $this->obj_sess->type;

View File

@ -172,19 +172,19 @@ class Application_Model_Playlist
*/ */
$sql = <<<"EOT" $sql = <<<"EOT"
(SELECT * FROM (SELECT * FROM
((SELECT pc.id as id, pc.type, pc.position, pc.cliplength as length, pc.cuein, pc.cueout, pc.fadein, pc.fadeout, ((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 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) JOIN cc_files AS f ON pc.file_id=f.id WHERE pc.playlist_id = {$this->id} AND type = 0)
UNION ALL UNION ALL
(SELECT pc.id as id, pc.type, pc.position, pc.cliplength as length, pc.cuein, pc.cueout, pc.fadein, pc.fadeout, (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 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 JOIN cc_webstream AS ws on pc.stream_id=ws.id
LEFT JOIN cc_subjs as sub on sub.id = ws.creator_id LEFT JOIN cc_subjs as sub on sub.id = ws.creator_id
WHERE pc.playlist_id = {$this->id} AND pc.type = 1) WHERE pc.playlist_id = {$this->id} AND pc.type = 1)
UNION ALL UNION ALL
(SELECT pc.id as id, pc.type, pc.position, pc.cliplength as length, pc.cuein, pc.cueout, pc.fadein, pc.fadeout, (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 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_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 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); ORDER BY temp.position);
EOT; EOT;
@ -343,7 +343,7 @@ EOT;
throw new Exception("Unknown file type"); throw new Exception("Unknown file type");
} }
if (isset($obj)) { if (isset($obj)) {
if (($obj instanceof CcFiles && $obj->getDbFileExists()) || $obj instanceof CcWebstream || $obj instanceof CcBlock) { if (($obj instanceof CcFiles && $obj->getDbFileExists()) || $obj instanceof CcWebstream || $obj instanceof CcBlock) {
$entry = $this->plItem; $entry = $this->plItem;
$entry["id"] = $obj->getDbId(); $entry["id"] = $obj->getDbId();
@ -559,8 +559,9 @@ EOT;
->filterByDbPosition($pos) ->filterByDbPosition($pos)
->findOne(); ->findOne();
if (!$row) {
return NULL;
}
#Propel returns values in form 00.000000 format which is for only seconds. #Propel returns values in form 00.000000 format which is for only seconds.
$fadeIn = $row->getDbFadein(); $fadeIn = $row->getDbFadein();
$fadeOut = $row->getDbFadeout(); $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){ private static function playlistsNotOwnedByUser($p_ids, $p_userId){
$ownedByUser = CcPlaylistQuery::create()->filterByDbCreatorId($p_userId)->find()->getData(); $ownedByUser = CcPlaylistQuery::create()->filterByDbCreatorId($p_userId)->find()->getData();
$selectedPls = $p_ids; $selectedPls = $p_ids;

View File

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