CC-1939 Ability to edit name & description of a playlist, display the description somewhere
now can edit title/description of a playlist without leaving the main playlist builder screen
This commit is contained in:
parent
a48f467de7
commit
d4a4c4be2a
7 changed files with 344 additions and 96 deletions
|
@ -31,9 +31,9 @@ class LibraryController extends Zend_Controller_Action
|
|||
$this->view->headScript()->appendFile($baseUrl.'/js/airtime/library/library.js','text/javascript');
|
||||
$this->view->headScript()->appendFile($baseUrl.'/js/airtime/library/advancedsearch.js','text/javascript');
|
||||
|
||||
$this->view->headLink()->appendStylesheet($baseUrl.'/css/media_library.css');
|
||||
$this->view->headLink()->appendStylesheet($baseUrl.'/css/media_library.css');
|
||||
$this->view->headLink()->appendStylesheet($baseUrl.'/css/contextmenu.css');
|
||||
|
||||
|
||||
$this->_helper->layout->setLayout('library');
|
||||
$this->_helper->viewRenderer->setResponseSegment('library');
|
||||
|
||||
|
@ -44,14 +44,14 @@ class LibraryController extends Zend_Controller_Action
|
|||
$this->search_sess->next_row[1] = 2;
|
||||
$this->view->form = $form;
|
||||
$this->view->md = $this->search_sess->md;
|
||||
|
||||
|
||||
$this->_helper->actionStack('index', 'playlist');
|
||||
}
|
||||
|
||||
public function contextMenuAction()
|
||||
{
|
||||
global $CC_CONFIG;
|
||||
|
||||
|
||||
$id = $this->_getParam('id');
|
||||
$type = $this->_getParam('type');
|
||||
|
||||
|
@ -63,54 +63,50 @@ class LibraryController extends Zend_Controller_Action
|
|||
$pl_sess = $this->pl_sess;
|
||||
|
||||
if($type === "au") {
|
||||
|
||||
|
||||
if(isset($pl_sess->id)) {
|
||||
$menu[] = array('action' => array('type' => 'ajax', 'url' => '/Playlist/add-item'.$params, 'callback' => 'window["setSPLContent"]'),
|
||||
$menu[] = array('action' => array('type' => 'ajax', 'url' => '/Playlist/add-item'.$params, 'callback' => 'window["setSPLContent"]'),
|
||||
'title' => 'Add to Playlist');
|
||||
}
|
||||
|
||||
$menu[] = array('action' => array('type' => 'gourl', 'url' => '/Library/edit-file-md/id/#id#'),
|
||||
$menu[] = array('action' => array('type' => 'gourl', 'url' => '/Library/edit-file-md/id/#id#'),
|
||||
'title' => 'Edit Metadata');
|
||||
|
||||
// added for downlaod
|
||||
$id = $this->_getParam('id');
|
||||
|
||||
|
||||
$file_id = $this->_getParam('id', null);
|
||||
$file = StoredFile::Recall($file_id);
|
||||
|
||||
|
||||
$url = $file->getFileURL().'/api_key/'.$CC_CONFIG["apiKey"][0].'/download/true';
|
||||
$menu[] = array('action' => array('type' => 'gourl', 'url' => $url),
|
||||
'title' => 'Download');
|
||||
|
||||
$menu[] = array('action' => array('type' => 'fn',
|
||||
'callback' => "window['confirmDeleteAudioClip']('$paramsPop')"),
|
||||
'callback' => "window['confirmDeleteAudioClip']('$paramsPop')"),
|
||||
'title' => 'Delete');
|
||||
}
|
||||
else if($type === "pl") {
|
||||
|
||||
if(!isset($pl_sess->id) || $pl_sess->id !== $id) {
|
||||
$menu[] = array('action' =>
|
||||
array('type' => 'ajax',
|
||||
'url' => '/Playlist/edit'.$params,
|
||||
'callback' => 'window["openDiffSPL"]'),
|
||||
$menu[] = array('action' =>
|
||||
array('type' => 'ajax',
|
||||
'url' => '/Playlist/edit'.$params,
|
||||
'callback' => 'window["openDiffSPL"]'),
|
||||
'title' => 'Edit');
|
||||
}
|
||||
else if(isset($pl_sess->id) && $pl_sess->id === $id) {
|
||||
$menu[] = array('action' =>
|
||||
array('type' => 'ajax',
|
||||
'url' => '/Playlist/close'.$params,
|
||||
'callback' => 'window["noOpenPL"]'),
|
||||
$menu[] = array('action' =>
|
||||
array('type' => 'ajax',
|
||||
'url' => '/Playlist/close'.$params,
|
||||
'callback' => 'window["noOpenPL"]'),
|
||||
'title' => 'Close');
|
||||
}
|
||||
|
||||
$menu[] = array('action' => array('type' => 'ajax', 'url' => '/Playlist/metadata/format/json/id/#id#', 'callback' => 'window["createPlaylistMetaForm"]'),
|
||||
'title' => 'Edit Metadata');
|
||||
|
||||
//$menu[] = array('action' => array('type' => 'ajax', 'url' => '/Playlist/delete'.$params, 'callback' => 'window["deletePlaylist"]'),
|
||||
// 'title' => 'Delete');
|
||||
//$menu[] = array('action' => array('type' => 'ajax', 'url' => '/Playlist/metadata/format/json/id/#id#', 'callback' => 'window["createPlaylistMetaForm"]'), 'title' => 'Edit Metadata');
|
||||
|
||||
$menu[] = array('action' => array('type' => 'fn',
|
||||
'callback' => "window['confirmDeletePlaylist']('$paramsPop')"),
|
||||
'callback' => "window['confirmDeletePlaylist']('$paramsPop')"),
|
||||
'title' => 'Delete');
|
||||
|
||||
}
|
||||
|
@ -122,10 +118,10 @@ class LibraryController extends Zend_Controller_Action
|
|||
public function deleteAction()
|
||||
{
|
||||
$id = $this->_getParam('id');
|
||||
|
||||
|
||||
if (!is_null($id)) {
|
||||
$file = StoredFile::Recall($id);
|
||||
|
||||
|
||||
if (PEAR::isError($file)) {
|
||||
$this->view->message = $file->getMessage();
|
||||
return;
|
||||
|
@ -133,22 +129,22 @@ class LibraryController extends Zend_Controller_Action
|
|||
else if(is_null($file)) {
|
||||
$this->view->message = "file doesn't exist";
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
$res = $file->delete();
|
||||
|
||||
|
||||
if (PEAR::isError($res)) {
|
||||
$this->view->message = $res->getMessage();
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
$this->view->id = $id;
|
||||
}
|
||||
|
||||
public function contentsAction()
|
||||
{
|
||||
$post = $this->getRequest()->getPost();
|
||||
$post = $this->getRequest()->getPost();
|
||||
$datatables = StoredFile::searchFilesForPlaylistBuilder($post);
|
||||
|
||||
die(json_encode($datatables));
|
||||
|
@ -157,14 +153,14 @@ class LibraryController extends Zend_Controller_Action
|
|||
public function editFileMdAction()
|
||||
{
|
||||
$request = $this->getRequest();
|
||||
$form = new Application_Form_EditAudioMD();
|
||||
$form = new Application_Form_EditAudioMD();
|
||||
|
||||
$file_id = $this->_getParam('id', null);
|
||||
$file = StoredFile::Recall($file_id);
|
||||
|
||||
|
||||
if ($request->isPost()) {
|
||||
if ($form->isValid($request->getPost())) {
|
||||
|
||||
if ($form->isValid($request->getPost())) {
|
||||
|
||||
$formdata = $form->getValues();
|
||||
$file->replaceDbMetadata($formdata);
|
||||
|
||||
|
@ -176,7 +172,7 @@ class LibraryController extends Zend_Controller_Action
|
|||
}
|
||||
}
|
||||
|
||||
$form->populate($file->md);
|
||||
$form->populate($file->md);
|
||||
$this->view->form = $form;
|
||||
}
|
||||
|
||||
|
@ -196,7 +192,7 @@ class LibraryController extends Zend_Controller_Action
|
|||
$this->view->md = $file->getAllPLMetaData();
|
||||
$this->view->contents = $file->getContents();
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -20,6 +20,8 @@ class PlaylistController extends Zend_Controller_Action
|
|||
->addActionContext('delete-active', 'json')
|
||||
->addActionContext('delete', 'json')
|
||||
->addActionContext('set-playlist-fades', 'json')
|
||||
->addActionContext('set-playlist-name', 'json')
|
||||
->addActionContext('set-playlist-description', 'json')
|
||||
->initContext();
|
||||
|
||||
$this->pl_sess = new Zend_Session_Namespace(UI_PLAYLIST_SESSNAME);
|
||||
|
@ -175,6 +177,7 @@ class PlaylistController extends Zend_Controller_Action
|
|||
$this->view->html = $this->view->render('playlist/update.phtml');
|
||||
$this->view->name = $pl->getName();
|
||||
$this->view->length = $pl->getLength();
|
||||
$this->view->description = $pl->getDescription();
|
||||
|
||||
unset($this->view->pl);
|
||||
return;
|
||||
|
@ -195,6 +198,7 @@ class PlaylistController extends Zend_Controller_Action
|
|||
$this->view->html = $this->view->render('playlist/update.phtml');
|
||||
$this->view->name = $pl->getName();
|
||||
$this->view->length = $pl->getLength();
|
||||
$this->view->description = $pl->getDescription();
|
||||
|
||||
unset($this->view->pl);
|
||||
}
|
||||
|
@ -220,9 +224,10 @@ class PlaylistController extends Zend_Controller_Action
|
|||
$this->view->html = $this->view->render('playlist/update.phtml');
|
||||
$this->view->name = $pl->getName();
|
||||
$this->view->length = $pl->getLength();
|
||||
$this->view->description = $pl->getDescription();
|
||||
|
||||
unset($this->view->pl);
|
||||
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -341,6 +346,31 @@ class PlaylistController extends Zend_Controller_Action
|
|||
$this->view->fadeOut = $fades[1];
|
||||
}
|
||||
|
||||
public function setPlaylistNameAction()
|
||||
{
|
||||
$name = $this->_getParam('name', 'Unknown Playlist');
|
||||
|
||||
$pl = $this->getPlaylist();
|
||||
$pl->setName($name);
|
||||
|
||||
$this->view->playlistName = $name;
|
||||
}
|
||||
|
||||
public function setPlaylistDescriptionAction()
|
||||
{
|
||||
$description = $this->_getParam('description', false);
|
||||
$pl = $this->getPlaylist();
|
||||
|
||||
if($description != false) {
|
||||
$pl->setDescription($description);
|
||||
}
|
||||
else {
|
||||
$description = $pl->getDescription();
|
||||
}
|
||||
|
||||
$this->view->playlistDescription = $description;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
|
|
@ -201,6 +201,30 @@ class Playlist {
|
|||
return $pl->getDbName();
|
||||
}
|
||||
|
||||
public function setDescription($p_description)
|
||||
{
|
||||
$pl = CcPlaylistQuery::create()->findPK($this->id);
|
||||
|
||||
if($pl === NULL)
|
||||
return FALSE;
|
||||
|
||||
$pl->setDbDescription($p_description);
|
||||
$pl->setDbMtime(new DateTime("now"));
|
||||
$pl->save();
|
||||
|
||||
//$this->name = $p_newname;
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
public function getDescription()
|
||||
{
|
||||
$pl = CcPlaylistQuery::create()->findPK($this->id);
|
||||
if ($pl === NULL)
|
||||
return FALSE;
|
||||
|
||||
return $pl->getDbDescription();
|
||||
}
|
||||
|
||||
/**
|
||||
* Set state of virtual playlist
|
||||
*
|
||||
|
|
|
@ -1,35 +1,55 @@
|
|||
<button id="spl_new" class="ui-button" role="button" aria-disabled="false">New</button>
|
||||
<?php if (isset($this->pl)) : ?>
|
||||
<button id="spl_delete" class="ui-button" 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">
|
||||
<span class="ui-icon crossfade-main-icon"></span><span class="ui-button-text">Playlist crossfade</span>
|
||||
</a>
|
||||
<button id="spl_close" class="ui-button right-floated" role="button" aria-disabled="false">Done Editing</button>
|
||||
<button id="spl_delete" class="ui-button" 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">
|
||||
<span class="ui-icon crossfade-main-icon"></span><span class="ui-button-text">Playlist crossfade</span>
|
||||
</a>
|
||||
<button id="spl_close" class="ui-button right-floated" role="button" aria-disabled="false">Done Editing</button>
|
||||
<?php endif; ?>
|
||||
|
||||
<?php if (isset($this->pl)) : ?>
|
||||
<h3 id="spl_name"><?php echo $this->pl->getName(); ?></h3>
|
||||
<h4 id="spl_length"><?php echo $this->pl->getLength(); ?></h4>
|
||||
<div class="playlist_title">
|
||||
<h3 id="spl_name">
|
||||
<a id="playlist_name_display"><?php echo $this->pl->getName(); ?></a>
|
||||
<input type="text" maxlength="255" size="40" class="element_hidden" id="playlist_name_input" />
|
||||
</h3>
|
||||
<h4 id="spl_length"><?php echo $this->pl->getLength(); ?></h4>
|
||||
</div>
|
||||
|
||||
<div id="crossfade_main" class="crossfade-main clearfix" style="display:none;">
|
||||
<span class="ui-icon ui-icon-closethick"></span>
|
||||
<dl id="spl_editor-main" class="inline-list">
|
||||
<dt>Fade in:</dt>
|
||||
<dd id="spl_fade_in_main"><span contenteditable="true" class="spl_text_input">00:00:00</span></dd>
|
||||
<dd class="edit-error"></dd>
|
||||
<dt>Fade out:</dt>
|
||||
<dd id="spl_fade_out_main"><span contenteditable="true" class="spl_text_input">00:00:00</span></dd>
|
||||
<dd class="edit-error"></dd>
|
||||
</dl>
|
||||
</div>
|
||||
<fieldset class="toggle closed" id="fieldset-metadate_change">
|
||||
<legend style="cursor: pointer;"><span class="ui-icon ui-icon-triangle-2-n-s"></span>View / edit description</legend>
|
||||
<dl class="zend_form">
|
||||
<dt id="description-label"><label for="description">Description</label></dt>
|
||||
<dd id="description-element">
|
||||
<textarea cols="80" rows="24" id="description" name="description"><?php echo $this->pl->getDescription(); ?></textarea>
|
||||
</dd>
|
||||
<dt id="submit-label" style="display: none;"> </dt>
|
||||
<dd id="submit-element" class="buttons">
|
||||
<input class="ui-button ui-state-default" type="submit" value="Cancel" id="description_cancel" name="cancel">
|
||||
<input class="ui-button ui-state-default" type="submit" value="Save" id="description_save" name="submit">
|
||||
</dd>
|
||||
</dl>
|
||||
</fieldset>
|
||||
|
||||
<div class="clear"></div>
|
||||
<div class="" style="clear:both; float:none; width:100%;">
|
||||
<ul id="spl_sortable">
|
||||
<?php echo $this->render('playlist/update.phtml') ?>
|
||||
</ul>
|
||||
</div>
|
||||
<div id="crossfade_main" class="crossfade-main clearfix" style="display:none;">
|
||||
<span class="ui-icon ui-icon-closethick"></span>
|
||||
<dl id="spl_editor-main" class="inline-list">
|
||||
<dt>Fade in:</dt>
|
||||
<dd id="spl_fade_in_main"><span contenteditable="true" class="spl_text_input">00:00:00</span></dd>
|
||||
<dd class="edit-error"></dd>
|
||||
<dt>Fade out:</dt>
|
||||
<dd id="spl_fade_out_main"><span contenteditable="true" class="spl_text_input">00:00:00</span></dd>
|
||||
<dd class="edit-error"></dd>
|
||||
</dl>
|
||||
</div>
|
||||
|
||||
<div class="clear"></div>
|
||||
<div class="" style="clear:both; float:none; width:100%;">
|
||||
<ul id="spl_sortable">
|
||||
<?php echo $this->render('playlist/update.phtml') ?>
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
<?php else : ?>
|
||||
<div>No open playlist</div>
|
||||
<div>No open playlist</div>
|
||||
<?php endif; ?>
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue