CC-3137 : Cleaning Up Old Playlist Stuff

when a user clicks new the intermediate playlist metadata screen in gone now, just can edit title/desciption inline on the main editor.
This commit is contained in:
Naomi Aro 2011-11-29 16:20:09 +01:00
parent c17be6d938
commit 01576b33c8
3 changed files with 15 additions and 111 deletions

View File

@ -36,7 +36,7 @@ class LibraryController extends Zend_Controller_Action
$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');
@ -90,7 +90,7 @@ class LibraryController extends Zend_Controller_Action
$url = $file->getRelativeFileUrl($baseUrl).'/download/true';
$menu[] = array('action' => array('type' => 'gourl', 'url' => $url),
'title' => 'Download');
if (Application_Model_Preference::GetUploadToSoundcloudOption()) {
$text = "Upload to SoundCloud";
if(!is_null($file->getSoundCloudId())){
@ -98,12 +98,12 @@ class LibraryController extends Zend_Controller_Action
}
$menu[] = array('action' => array('type' => 'ajax', 'url' => '/Library/upload-file-soundcloud/id/#id#',
'callback'=>"window['addProgressIcon']('$file_id')"),'title' => $text);
$scid = $file->getSoundCloudId();
if($scid > 0){
$link_to_file = $file->getSoundCloudLinkToFile();
$menu[] = array('action' => array('type' => 'fn',
$menu[] = array('action' => array('type' => 'fn',
'callback' => "window['openFileOnSoundCloud']('$link_to_file')"),
'title' => 'View on SoundCloud');
}
@ -132,8 +132,6 @@ class LibraryController extends Zend_Controller_Action
'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' => 'fn',
'callback' => "window['confirmDeletePlaylist']('$paramsPop')"),
'title' => 'Delete');
@ -210,7 +208,7 @@ class LibraryController extends Zend_Controller_Action
{
$request = $this->getRequest();
$form = new Application_Form_EditAudioMD();
$file_id = $this->_getParam('id', null);
$file = Application_Model_StoredFile::Recall($file_id);
$form->populate($file->getDbColMetadata());
@ -222,7 +220,7 @@ class LibraryController extends Zend_Controller_Action
$file->setDbColMetadata($formdata);
$data = $file->getMetadata();
// set MDATA_KEY_FILEPATH
$data['MDATA_KEY_FILEPATH'] = $file->getFilePath();
Logging::log($data['MDATA_KEY_FILEPATH']);
@ -254,14 +252,14 @@ class LibraryController extends Zend_Controller_Action
}
}
public function uploadFileSoundcloudAction(){
$id = $this->_getParam('id');
$res = exec("/usr/lib/airtime/utils/soundcloud-uploader $id > /dev/null &");
// we should die with ui info
die();
}
public function getUploadToSoundcloudStatusAction(){
$id = $this->_getParam('id');
$type = $this->_getParam('type');
@ -278,7 +276,7 @@ class LibraryController extends Zend_Controller_Action
$this->view->error_msg = $file->getSoundCloudErrorMsg();
}
}
/**
* Stores the number of entries user chose to show in the Library
* to the pref db

View File

@ -2,7 +2,6 @@
class PlaylistController extends Zend_Controller_Action
{
protected $pl_sess = null;
public function init()
@ -15,7 +14,6 @@ class PlaylistController extends Zend_Controller_Action
->addActionContext('move-item', 'json')
->addActionContext('close', 'json')
->addActionContext('new', 'json')
->addActionContext('metadata', 'json')
->addActionContext('edit', 'json')
->addActionContext('delete-active', 'json')
->addActionContext('delete', 'json')
@ -102,58 +100,11 @@ class PlaylistController extends Zend_Controller_Action
$pl->setPLMetaData('dc:creator', $userInfo->login);
$this->changePlaylist($pl->getId());
$form = new Application_Form_PlaylistMetadata();
$this->view->fieldset = $form;
$this->view->form = $this->view->render('playlist/new.phtml');
}
public function metadataAction()
{
$request = $this->getRequest();
$form = new Application_Form_PlaylistMetadata();
$pl_id = $this->_getParam('id', null);
//not a new playlist
if(!is_null($pl_id)) {
$this->changePlaylist($pl_id);
$pl = $this->getPlaylist();
if($pl === false){
$this->view->playlist_error = true;
return false;
}
$title = $pl->getPLMetaData("dc:title");
$desc = $pl->getPLMetaData("dc:description");
$data = array( 'title' => $title, 'description' => $desc);
$form->populate($data);
}
if ($request->isPost()) {
$title = $this->_getParam('title', null);
$description = $this->_getParam('description', null);
$pl = $this->getPlaylist();
if($pl === false){
$this->view->playlist_error = true;
return false;
}
if($title)
$pl->setName($title);
if(isset($description)) {
$pl->setPLMetaData("dc:description", $description);
}
$this->view->pl = $pl;
$this->view->html = $this->view->render('playlist/index.phtml');
unset($this->view->pl);
}
$this->view->pl_id = $pl_id;
$this->view->fieldset = $form;
$this->view->form = $this->view->render('playlist/new.phtml');
$this->view->pl = $pl;
$this->view->pl_id = $pl->getId();
$this->view->html = $this->view->render('playlist/index.phtml');
unset($this->view->pl);
}
public function editAction()
@ -423,7 +374,5 @@ class PlaylistController extends Zend_Controller_Action
$this->view->playlistDescription = $description;
}
}

View File

@ -313,56 +313,13 @@ function noOpenPL(json) {
.click(newSPL);
}
function createPlaylistMetaForm(json) {
var submit, form;
form = $(json.form);
form.find("fieldset").addClass("simple-formblock metadata");
form.find("input, textarea")
.keydown(function(event){
//enter was pressed
if(event.keyCode === 13) {
event.preventDefault();
$("#new_playlist_submit").click();
}
});
form.find("#new_playlist_submit")
.button()
.click(function(event){
event.preventDefault();
var url, data;
url = '/Playlist/metadata/format/json';
data = $("#side_playlist form").serialize();
$.post(url, data, function(json){
if(json.playlist_error == true){
alertPlaylistErrorAndReload();
}
openDiffSPL(json);
//redraw the library list
redrawDataTablePage();
});
});
$("#side_playlist")
.empty()
.append(form);
currentlyOpenedSplId = json.pl_id;
}
function newSPL() {
var url;
stopAudioPreview();
url = '/Playlist/new/format/json';
$.post(url, createPlaylistMetaForm);
$.post(url, openDiffSPL);
}
function deleteSPL() {