From d4a4c4be2a8a9c515bff9bf7c2a47aa8859070f7 Mon Sep 17 00:00:00 2001 From: Naomi Date: Tue, 17 May 2011 17:30:17 -0400 Subject: [PATCH] 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 --- .../controllers/LibraryController.php | 68 +++++----- .../controllers/PlaylistController.php | 32 ++++- airtime_mvc/application/models/Playlist.php | 24 ++++ .../views/scripts/playlist/index.phtml | 70 ++++++---- airtime_mvc/public/css/images/icon_edit_l.png | Bin 0 -> 2887 bytes airtime_mvc/public/css/playlist_builder.css | 124 +++++++++++++++++- airtime_mvc/public/js/airtime/library/spl.js | 122 ++++++++++++----- 7 files changed, 344 insertions(+), 96 deletions(-) create mode 100644 airtime_mvc/public/css/images/icon_edit_l.png diff --git a/airtime_mvc/application/controllers/LibraryController.php b/airtime_mvc/application/controllers/LibraryController.php index b7e15bd95..3ab1cbe8b 100644 --- a/airtime_mvc/application/controllers/LibraryController.php +++ b/airtime_mvc/application/controllers/LibraryController.php @@ -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(); } - + } diff --git a/airtime_mvc/application/controllers/PlaylistController.php b/airtime_mvc/application/controllers/PlaylistController.php index 89871f14f..a3ece83ab 100644 --- a/airtime_mvc/application/controllers/PlaylistController.php +++ b/airtime_mvc/application/controllers/PlaylistController.php @@ -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; + } + } diff --git a/airtime_mvc/application/models/Playlist.php b/airtime_mvc/application/models/Playlist.php index ea81a13da..c71958ab4 100644 --- a/airtime_mvc/application/models/Playlist.php +++ b/airtime_mvc/application/models/Playlist.php @@ -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 * diff --git a/airtime_mvc/application/views/scripts/playlist/index.phtml b/airtime_mvc/application/views/scripts/playlist/index.phtml index 194636a8c..7987202c1 100644 --- a/airtime_mvc/application/views/scripts/playlist/index.phtml +++ b/airtime_mvc/application/views/scripts/playlist/index.phtml @@ -1,35 +1,55 @@ pl)) : ?> - - - Playlist crossfade - - + + + Playlist crossfade + + pl)) : ?> -

pl->getName(); ?>

-

pl->getLength(); ?>

+
+

+ pl->getName(); ?> + +

+

pl->getLength(); ?>

+
- +
+ View / edit description +
+
+
+ +
+ +
+ + +
+
+
-
-
- -
+ + +
+
+ +
-
No open playlist
+
No open playlist
diff --git a/airtime_mvc/public/css/images/icon_edit_l.png b/airtime_mvc/public/css/images/icon_edit_l.png new file mode 100644 index 0000000000000000000000000000000000000000..ac6b8d477afd4f09cbcba5b9881f3c2de88e92db GIT binary patch literal 2887 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 literal 0 HcmV?d00001 diff --git a/airtime_mvc/public/css/playlist_builder.css b/airtime_mvc/public/css/playlist_builder.css index 4724055e9..d05a0a0d3 100644 --- a/airtime_mvc/public/css/playlist_builder.css +++ b/airtime_mvc/public/css/playlist_builder.css @@ -121,7 +121,7 @@ font-size:15px; margin:8px 0 10px 0; padding:0; - color:#6e6e6e; + color:#4f4f4f; font-weight:normal; clear:both; float:left; @@ -314,4 +314,124 @@ #spl_sortable li .spl_cue.ui-state-active, #spl_sortable li .spl_cue.ui-state-active:hover { background: transparent url(images/cue_playlist.png) no-repeat 0 -30px; border:none; -} \ No newline at end of file +} + +/*--/////////////// Changes 16.05.2011 ////////////--*/ + +.playlist_title { + margin: 16px 0 10px 0; + height:26px; + clear:both; +} +#side_playlist .playlist_title h3, #side_playlist .playlist_title h4 { + margin: 0; + padding: 0; +} +#side_playlist .playlist_title h3 { + float:left; + width:84%; +} +#side_playlist .playlist_title h4 { + float:right; + clear:none; + font-size: 16px; + padding-top:4px; +} + +#side_playlist .playlist_title h3 a { + padding: 0 22px 0 2px; + background:url(images/icon_edit_l.png) no-repeat right center; + text-decoration:none; + +} +#side_playlist .playlist_title h3 a:hover { + background-color:#D8D8D8; +} +.element_hidden { + display: none; +} +#side_playlist .playlist_title h3 input[type="text"] { + background-color: #dddddd; + border: 1px solid #8F8F8F; + font-family: Arial,Helvetica,sans-serif; + font-size: 12px; + height: 23px; + margin: 0; + padding: 0; + text-indent: 3px; + -moz-box-shadow: inset 0px 2px 2px rgba(0, 0, 0, 0.1); + -webkit-box-shadow: inset 0px 2px 2px rgba(0, 0, 0, 0.1); + box-shadow: inset 0px 2px 2px rgba(0, 0, 0, 0.1); + width:95%; +} + +#side_playlist .zend_form { + margin: 0; + padding: 0; +} +#side_playlist .zend_form dt, #side_playlist .zend_form dd { + display: block; + float: none; + margin: 4px 0 0; + padding: 0; + width:100%; +} +#side_playlist .zend_form dd.buttons { + margin-top: 8px; + text-align:right; +} +#side_playlist .zend_form dd.buttons .ui-button { + margin: 0 0 0 10px; +} + +#side_playlist .zend_form dt { + color:#5B5B5B; + font-weight: bold; + margin: 9px 0 0; + padding: 0 2px; +} + +#side_playlist .zend_form dt:first-child { + margin-top: 0; +} + +#side_playlist .zend_form dd textarea { + background-color: #dddddd; + border: 1px solid #5B5B5B; + font-family: Arial,Helvetica,sans-serif; + font-size: 12px; + margin: 0; + padding: 2px 0 0 0; + text-indent: 3px; + -moz-box-shadow: inset 0px 2px 2px rgba(0, 0, 0, 0.1); + -webkit-box-shadow: inset 0px 2px 2px rgba(0, 0, 0, 0.1); + box-shadow: inset 0px 2px 2px rgba(0, 0, 0, 0.1); + width:99.7%; +} + +#side_playlist fieldset { + border: 1px solid #9a9a9a; + margin: 0 0 8px 0; + padding: 8px; +} +#side_playlist fieldset.closed .zend_form{ + display:none; +} +#side_playlist fieldset.closed { + border-width: 1px 0 0; + margin-bottom: -6px; + margin-left:1px; +} +fieldset > legend { + color: #4f4f4f; + font-size: 12px; + line-height: 140%; +} +.ui-widget-content fieldset legend .ui-icon { + float: left; + background-image:url(redmond/images/ui-icons_454545_256x240.png); +} +#side_playlist .zend_form input, #side_playlist .zend_form textarea { + width: auto; +} + \ No newline at end of file diff --git a/airtime_mvc/public/js/airtime/library/spl.js b/airtime_mvc/public/js/airtime/library/spl.js index 44bde2327..10c8fa43b 100644 --- a/airtime_mvc/public/js/airtime/library/spl.js +++ b/airtime_mvc/public/js/airtime/library/spl.js @@ -133,7 +133,7 @@ function changeFadeOut(event) { if(json.response.error) { return; } - + hideError(span); }); } @@ -147,7 +147,7 @@ function submitOnEnter(event) { } function setCueEvents(el) { - + $(el).find(".spl_cue_in span:last").blur(changeCueIn); $(el).find(".spl_cue_out span:last").blur(changeCueOut); @@ -173,7 +173,7 @@ function openFadeEditor(event) { event.stopPropagation(); var pos, url, li; - + li = $(this).parent().parent(); pos = parseInt(li.attr("id").split("_").pop()); @@ -228,40 +228,47 @@ function openCueEditor(event) { highlightActive(li); $.get(url, {format: "json", pos: pos}, function(json){ - + $("#cues_"+pos) .empty() .append(json.html) .show(); setCueEvents(li); - }); + }); +} + +function redrawDataTablePage() { + var dt; + dt = $("#library_display").dataTable(); + dt.fnStandingRedraw(); } function setSPLContent(json) { - - if(json.message) { + + if(json.message) { alert(json.message); - return; + return; } - $('#spl_name').empty() + $('#spl_name > a').empty() .append(json.name); $('#spl_length').empty() - .append(json.length); + .append(json.length); + $('#fieldset-metadate_change textarea') + .empty() + .val(json.description); $('#spl_sortable').empty() - .append(json.html); + .append(json.html); $("#spl_editor") .empty(); $("#spl_sortable .ui-icon-closethick").click(deleteSPLItem); $(".spl_fade_control").click(openFadeEditor); - //$(".spl_playlength").click(openCueEditor); $(".spl_cue").click(openCueEditor); - + //redraw the library list - dt = $("#library_display").dataTable(); - dt.fnStandingRedraw(); + redrawDataTablePage(); return false; } @@ -269,8 +276,8 @@ function setSPLContent(json) { function addSPLItem(event, ui){ var url, tr, id, items, draggableOffset, elOffset, pos; - tr = ui.helper; - + tr = ui.helper; + if(tr.get(0).tagName === 'LI') return; @@ -286,7 +293,7 @@ function addSPLItem(event, ui){ return false; } }); - + id = tr.attr('id').split("_").pop(); url = '/Playlist/add-item'; @@ -305,13 +312,13 @@ function deleteSPLItem(event){ $.post(url, {format: "json", pos: pos}, setSPLContent); } -function moveSPLItem(event, ui) { +function moveSPLItem(event, ui) { var li, newPos, oldPos, url; li = ui.item; - + newPos = li.index(); - oldPos = li.attr('id').split("_").pop(); + oldPos = li.attr('id').split("_").pop(); url = '/Playlist/move-item'; @@ -359,21 +366,20 @@ function createPlaylistMetaForm(json) { var url, data; url = '/Playlist/metadata/format/json'; - data = $("#side_playlist form").serialize(); + data = $("#side_playlist form").serialize(); $.post(url, data, function(json){ openDiffSPL(json); //redraw the library list - dt = $("#library_display").dataTable(); - dt.fnStandingRedraw(); + redrawDataTablePage(); }) - + }); $("#side_playlist") .empty() .append(form); - + currentlyOpenedSplId = json.pl_id; } @@ -393,24 +399,44 @@ function deleteSPL() { $.post(url, function(){ noOpenPL; //redraw the library list - dt = $("#library_display").dataTable(); - dt.fnStandingRedraw(); + redrawDataTablePage(); }); } function openDiffSPL(json) { - + $("#side_playlist") .empty() .append(json.html); - + currentlyOpenedSplId = json.pl_id; setUpSPL(); } +function editName() { + var nameElement = $(this); + var playlistName = nameElement.text(); + + $("#playlist_name_input") + .removeClass('element_hidden') + .val(playlistName) + .blur(function(){ + var input = $(this); + var url; + url = '/Playlist/set-playlist-name'; + + $.post(url, {format: "json", name: input.val()}, function(json){ + input.addClass('element_hidden'); + nameElement.text(json.playlistName); + redrawDataTablePage(); + }); + }) + .keydown(submitOnEnter); +} + function setUpSPL() { - + $("#spl_sortable").sortable({ handle: 'div.list-item-container' }); @@ -448,6 +474,39 @@ function setUpSPL() { } }); + $("#playlist_name_display").click(editName); + $("#fieldset-metadate_change > legend").click(function(){ + var descriptionElement = $(this).parent(); + + if(descriptionElement.hasClass("closed")) { + descriptionElement.removeClass("closed"); + } + else { + descriptionElement.addClass("closed"); + } + }); + + $("#description_save").click(function(){ + var textarea = $("#fieldset-metadate_change textarea"); + var description = textarea.val(); + var url; + url = '/Playlist/set-playlist-description'; + + $.post(url, {format: "json", description: description}, function(json){ + textarea.val(json.playlistDescription); + }); + }); + + $("#description_cancel").click(function(){ + var textarea = $("#fieldset-metadate_change textarea"); + var url; + url = '/Playlist/set-playlist-description'; + + $.post(url, {format: "json"}, function(json){ + textarea.val(json.playlistDescription); + }); + }); + $("#spl_fade_in_main span:first").blur(function(event){ event.stopPropagation(); @@ -508,7 +567,6 @@ function setUpSPL() { $("#spl_sortable .ui-icon-closethick").click(deleteSPLItem); $(".spl_fade_control").click(openFadeEditor); - //$(".spl_playlength").click(openCueEditor); $(".spl_cue").click(openCueEditor); $("#spl_sortable").droppable();