CC-4166: Playlist Builder -> Regular Playlist : clicking Fade in/out button for a empty playlist will cause PHP Fatal Error

- fixed. Not displaying fade setting button if the playst/smartplaylist
is empty.
This commit is contained in:
James 2012-08-08 15:29:09 -04:00
parent 83917ed894
commit d1e6f8178b
6 changed files with 40 additions and 9 deletions

View File

@ -55,7 +55,7 @@ class PlaylistController extends Zend_Controller_Action
}
private function changePlaylist($p_id, $p_type)
{
{
if (is_null($p_id) || is_null($p_type)) {
unset($this->obj_sess->id);
unset($this->obj_sess->type);
@ -71,6 +71,7 @@ class PlaylistController extends Zend_Controller_Action
$this->view->length = $formatter->format();
$this->view->obj = $obj;
$this->view->contents = $obj->getContents();
$this->view->html = $this->view->render('playlist/update.phtml');
$this->view->name = $obj->getName();
$this->view->description = $obj->getDescription();
@ -215,7 +216,7 @@ class PlaylistController extends Zend_Controller_Action
}
public function newAction()
{
{
//$pl_sess = $this->pl_sess;
$userInfo = Zend_Auth::getInstance()->getStorage()->read();
$type = $this->_getParam('type');
@ -335,7 +336,7 @@ class PlaylistController extends Zend_Controller_Action
} else if ($e->getMessage() == 'track to dynamic') {
$this->blockDynamic($obj);
} else {
$this->playlistUnknownError($e);
$this->playlistUnknownError($e);
}
}
}

View File

@ -1,7 +1,11 @@
<?php
$contents = $this->obj->getContents();
$count = count($contents);
?>
<button id="spl_new" class="ui-button ui-widget ui-state-default" role="button" aria-disabled="false">New</button>
<?php if (isset($this->obj)) : ?>
<button id="spl_delete" class="ui-button ui-widget ui-state-default" role="button" aria-disabled="false">Delete</button>
<a href="#" id="spl_crossfade" class="ui-button ui-button-icon-only ui-widget ui-state-default crossfade-main-button">
<a href="#" id="spl_crossfade" class="ui-button ui-button-icon-only ui-widget ui-state-default crossfade-main-button" style="display:<?php echo $count > 0 ?"block;":"none;"?>">
<span class="ui-icon crossfade-main-icon"></span><span class="ui-button-text">Playlist crossfade</span>
</a>
<?php endif; ?>
@ -49,7 +53,8 @@
<div class="clear"></div>
<div class="" style="clear:both; float:none; width:100%;">
<ul id="spl_sortable">
<?php echo $this->render('playlist/update.phtml') ?>
<?php $this->contents = $contents;
echo $this->render('playlist/update.phtml') ?>
</ul>
</div>

View File

@ -1,7 +1,11 @@
<?php
$contents = $this->obj->getContents();
$count = count($contents);
?>
<button id="spl_new" class="ui-button ui-widget ui-state-default" role="button" aria-disabled="false">New</button>
<?php if (isset($this->obj)) : ?>
<button id="spl_delete" class="ui-button ui-widget ui-state-default" role="button" aria-disabled="false">Delete</button>
<a href="#" id="spl_crossfade" class="ui-button ui-button-icon-only ui-widget ui-state-default crossfade-main-button">
<a href="#" id="spl_crossfade" class="ui-button ui-button-icon-only ui-widget ui-state-default crossfade-main-button" style="display:<?php echo ($this->obj->isStatic() && $count > 0) ?"block;":"none;"?>">
<span class="ui-icon crossfade-main-icon"></span><span class="ui-button-text">Playlist crossfade</span>
</a>
<?php endif; ?>
@ -49,7 +53,8 @@
<div class="clear"></div>
<div class="" style="clear:both; float:none; width:100%;">
<ul id="spl_sortable">
<?php echo $this->render('playlist/update.phtml') ?>
<?php $this->contents = $contents;
echo $this->render('playlist/update.phtml') ?>
</ul>
</div>

View File

@ -1,5 +1,5 @@
<?php
$items = $this->obj->getContents();
$items = $this->contents;
if (count($items)) : ?>
<?php $i = 0; ?>
<?php foreach($items as $item) :

View File

@ -305,11 +305,19 @@ var AIRTIME = (function(AIRTIME){
$('#spl_sortable')
.empty()
.append(json.html);
setModified(json.modified);
redrawLib();
}
function setFadeIcon(){
var empty = $(".spl_empty");
if (empty.length > 0) {
$("#spl_crossfade").hide();
} else {
$("#spl_crossfade").show();
}
}
function getId() {
return parseInt($("#obj_id").val(), 10);
}
@ -803,6 +811,7 @@ var AIRTIME = (function(AIRTIME){
}
else {
setPlaylistContent(json);
setFadeIcon();
}
mod.enableUI();

View File

@ -181,6 +181,7 @@ function setSmartPlaylistEvents() {
enableLoadingIcon();
$.post(save_action, {format: "json", data: data, obj_id: obj_id}, function(data){
callback(data, "save");
setFadeIcon();
disableLoadingIcon();
});
});
@ -254,6 +255,16 @@ function setStaticLengthHolder(lenVal) {
}
*/
function setFadeIcon(){
var contents = $("#spl_sortable");
var show = contents.is(":visible");
if (show) {
$("#spl_crossfade").show();
} else {
$("#spl_crossfade").hide();
}
}
/* This function appends a '+' button for the last
* modifier row of each criteria.
* If there are no modifier rows, the '+' button