CC-4109: Playlist Builder: Add a button to remove all the items in the current editing playlist
This commit is contained in:
parent
d4e89df94e
commit
384298f680
|
@ -26,6 +26,7 @@ class PlaylistController extends Zend_Controller_Action
|
||||||
->addActionContext('smart-block-shuffle', 'json')
|
->addActionContext('smart-block-shuffle', 'json')
|
||||||
->addActionContext('get-block-info', 'json')
|
->addActionContext('get-block-info', 'json')
|
||||||
->addActionContext('shuffle', 'json')
|
->addActionContext('shuffle', 'json')
|
||||||
|
->addActionContext('empty-content', 'json')
|
||||||
->initContext();
|
->initContext();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -336,6 +337,26 @@ class PlaylistController extends Zend_Controller_Action
|
||||||
$this->playlistUnknownError($e);
|
$this->playlistUnknownError($e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function emptyContentAction()
|
||||||
|
{
|
||||||
|
$type = $this->_getParam('obj_type');
|
||||||
|
try {
|
||||||
|
$obj = $this->getPlaylist($type);
|
||||||
|
if ($type == 'playlist') {
|
||||||
|
$obj->deleteAllFilesFromPlaylist();
|
||||||
|
} else {
|
||||||
|
$obj->deleteAllFilesFromBlock();
|
||||||
|
}
|
||||||
|
$this->createUpdateResponse($obj);
|
||||||
|
} catch (PlaylistOutDatedException $e) {
|
||||||
|
$this->playlistOutdated($e);
|
||||||
|
} catch (PlaylistNotFoundException $e) {
|
||||||
|
$this->playlistNotFound($type);
|
||||||
|
} catch (Exception $e) {
|
||||||
|
$this->playlistUnknownError($e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public function setCueAction()
|
public function setCueAction()
|
||||||
{
|
{
|
||||||
|
|
|
@ -1001,7 +1001,10 @@ SQL;
|
||||||
public function deleteAllFilesFromBlock()
|
public function deleteAllFilesFromBlock()
|
||||||
{
|
{
|
||||||
CcBlockcontentsQuery::create()->findByDbBlockId($this->id)->delete();
|
CcBlockcontentsQuery::create()->findByDbBlockId($this->id)->delete();
|
||||||
$this->block->reload();
|
//$this->block->reload();
|
||||||
|
$this->block->setDbMtime(new DateTime("now", new DateTimeZone("UTC")));
|
||||||
|
$this->block->save($this->con);
|
||||||
|
$this->con->commit();
|
||||||
}
|
}
|
||||||
|
|
||||||
// smart block functions start
|
// smart block functions start
|
||||||
|
|
|
@ -930,6 +930,10 @@ SQL;
|
||||||
public function deleteAllFilesFromPlaylist()
|
public function deleteAllFilesFromPlaylist()
|
||||||
{
|
{
|
||||||
CcPlaylistcontentsQuery::create()->findByDbPlaylistId($this->id)->delete();
|
CcPlaylistcontentsQuery::create()->findByDbPlaylistId($this->id)->delete();
|
||||||
|
|
||||||
|
$this->pl->setDbMtime(new DateTime("now", new DateTimeZone("UTC")));
|
||||||
|
$this->pl->save($this->con);
|
||||||
|
$this->con->commit();
|
||||||
}
|
}
|
||||||
|
|
||||||
public function shuffle()
|
public function shuffle()
|
||||||
|
|
|
@ -16,6 +16,9 @@ if (isset($this->obj)) {
|
||||||
</ul>
|
</ul>
|
||||||
</div>
|
</div>
|
||||||
<?php if (isset($this->obj)) : ?>
|
<?php if (isset($this->obj)) : ?>
|
||||||
|
<div class='btn-group pull-right'>
|
||||||
|
<button class="btn btn-inverse" title='<?php echo _("Empty playlist content") ?>' type="button" id="pl-bl-clear-content"><? echo _("Clear") ?></button>
|
||||||
|
</div>
|
||||||
<div class='btn-group pull-right'>
|
<div class='btn-group pull-right'>
|
||||||
<button class="btn btn-inverse" title='<?php echo _("Shuffle playlist") ?>' type="button" id="playlist_shuffle_button"><? echo _("Shuffle") ?></button>
|
<button class="btn btn-inverse" title='<?php echo _("Shuffle playlist") ?>' type="button" id="playlist_shuffle_button"><? echo _("Shuffle") ?></button>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -16,6 +16,9 @@ if (isset($this->obj)) {
|
||||||
</ul>
|
</ul>
|
||||||
</div>
|
</div>
|
||||||
<?php if (isset($this->obj)) : ?>
|
<?php if (isset($this->obj)) : ?>
|
||||||
|
<div class='btn-group pull-right'>
|
||||||
|
<button class="btn btn-inverse" title='<?php echo _("Empty smart block content") ?>' type="button" id="pl-bl-clear-content"><? echo _("Clear") ?></button>
|
||||||
|
</div>
|
||||||
<div class='btn-group pull-right'>
|
<div class='btn-group pull-right'>
|
||||||
<button class="btn btn-inverse" title='Save smart block's title, description, and criteria' type="button" id="save_button"><? echo _("Save") ?></button>
|
<button class="btn btn-inverse" title='Save smart block's title, description, and criteria' type="button" id="save_button"><? echo _("Save") ?></button>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -749,6 +749,12 @@ var AIRTIME = (function(AIRTIME){
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
$("#pl-bl-clear-content").live("click", function(event) {
|
||||||
|
var sUrl = baseUrl+"playlist/empty-content",
|
||||||
|
oData = {};
|
||||||
|
playlistRequest(sUrl, oData);
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
function setUpPlaylist() {
|
function setUpPlaylist() {
|
||||||
|
|
|
@ -351,7 +351,7 @@ function setupUI() {
|
||||||
* It is only active if playlist is not empty
|
* It is only active if playlist is not empty
|
||||||
*/
|
*/
|
||||||
var plContents = $('#spl_sortable').children();
|
var plContents = $('#spl_sortable').children();
|
||||||
var shuffleButton = $('button[id="shuffle_button"], button[id="playlist_shuffle_button"]');
|
var shuffleButton = $('button[id="shuffle_button"], button[id="playlist_shuffle_button"], button[id="pl-bl-clear-content"]');
|
||||||
|
|
||||||
if (!plContents.hasClass('spl_empty')) {
|
if (!plContents.hasClass('spl_empty')) {
|
||||||
if (shuffleButton.hasClass('ui-state-disabled')) {
|
if (shuffleButton.hasClass('ui-state-disabled')) {
|
||||||
|
|
Loading…
Reference in New Issue