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
7 changed files with 42 additions and 2 deletions
|
@ -26,6 +26,7 @@ class PlaylistController extends Zend_Controller_Action
|
|||
->addActionContext('smart-block-shuffle', 'json')
|
||||
->addActionContext('get-block-info', 'json')
|
||||
->addActionContext('shuffle', 'json')
|
||||
->addActionContext('empty-content', 'json')
|
||||
->initContext();
|
||||
|
||||
}
|
||||
|
@ -336,6 +337,26 @@ class PlaylistController extends Zend_Controller_Action
|
|||
$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()
|
||||
{
|
||||
|
|
|
@ -1001,7 +1001,10 @@ SQL;
|
|||
public function deleteAllFilesFromBlock()
|
||||
{
|
||||
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
|
||||
|
|
|
@ -930,6 +930,10 @@ SQL;
|
|||
public function deleteAllFilesFromPlaylist()
|
||||
{
|
||||
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()
|
||||
|
|
|
@ -16,6 +16,9 @@ if (isset($this->obj)) {
|
|||
</ul>
|
||||
</div>
|
||||
<?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'>
|
||||
<button class="btn btn-inverse" title='<?php echo _("Shuffle playlist") ?>' type="button" id="playlist_shuffle_button"><? echo _("Shuffle") ?></button>
|
||||
</div>
|
||||
|
|
|
@ -16,6 +16,9 @@ if (isset($this->obj)) {
|
|||
</ul>
|
||||
</div>
|
||||
<?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'>
|
||||
<button class="btn btn-inverse" title='Save smart block's title, description, and criteria' type="button" id="save_button"><? echo _("Save") ?></button>
|
||||
</div>
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue