CC-1708 added x instead of input to remove items. Merging side playlist and playlist into one.

This commit is contained in:
naomiaro 2011-01-16 15:35:00 -05:00
parent da85a5ad26
commit 01df8d8d6b
15 changed files with 78 additions and 230 deletions

View file

@ -76,10 +76,6 @@
<controllerFile controllerName="SidePlaylist"> <controllerFile controllerName="SidePlaylist">
<actionMethod actionName="index"/> <actionMethod actionName="index"/>
</controllerFile> </controllerFile>
<controllerFile controllerName="Sideplaylist">
<actionMethod actionName="index"/>
<actionMethod actionName="addItem"/>
</controllerFile>
</controllersDirectory> </controllersDirectory>
<formsDirectory> <formsDirectory>
<formFile formName="Login"/> <formFile formName="Login"/>
@ -220,15 +216,6 @@
<viewControllerScriptsDirectory forControllerName="User"> <viewControllerScriptsDirectory forControllerName="User">
<viewScriptFile forActionName="addUser"/> <viewScriptFile forActionName="addUser"/>
</viewControllerScriptsDirectory> </viewControllerScriptsDirectory>
<viewControllerScriptsDirectory forControllerName="SidePlaylist">
<viewScriptFile forActionName="index"/>
</viewControllerScriptsDirectory>
<viewControllerScriptsDirectory forControllerName="Sideplaylist">
<viewScriptFile forActionName="index"/>
</viewControllerScriptsDirectory>
<viewControllerScriptsDirectory forControllerName="Sideplaylist">
<viewScriptFile forActionName="addItem"/>
</viewControllerScriptsDirectory>
<viewControllerScriptsDirectory forControllerName="Playlist"> <viewControllerScriptsDirectory forControllerName="Playlist">
<viewScriptFile forActionName="close"/> <viewScriptFile forActionName="close"/>
</viewControllerScriptsDirectory> </viewControllerScriptsDirectory>
@ -292,8 +279,6 @@
<testApplicationControllerFile filesystemName="ScheduleControllerTest.php"/> <testApplicationControllerFile filesystemName="ScheduleControllerTest.php"/>
<testApplicationControllerFile filesystemName="ApiControllerTest.php"/> <testApplicationControllerFile filesystemName="ApiControllerTest.php"/>
<testApplicationControllerFile filesystemName="UserControllerTest.php"/> <testApplicationControllerFile filesystemName="UserControllerTest.php"/>
<testApplicationControllerFile filesystemName="SidePlaylistControllerTest.php"/>
<testApplicationControllerFile filesystemName="SideplaylistControllerTest.php"/>
</testApplicationControllerDirectory> </testApplicationControllerDirectory>
</testApplicationDirectory> </testApplicationDirectory>
<testLibraryDirectory> <testLibraryDirectory>

View file

@ -22,31 +22,6 @@ $pages = array(
'action' => 'add-user', 'action' => 'add-user',
'resource' => 'user' 'resource' => 'user'
), ),
array(
'label' => 'Playlists',
'module' => 'default',
'controller' => 'Playlist',
'action' => 'index',
'resource' => 'playlist',
'pages' => array(
array(
'label' => 'New',
'module' => 'default',
'controller' => 'Playlist',
'action' => 'new',
'resource' => 'playlist',
'visible' => false
),
array(
'label' => 'Edit',
'module' => 'default',
'controller' => 'Playlist',
'action' => 'edit',
'resource' => 'playlist',
'visible' => false
)
)
),
array( array(
'label' => 'Media Library', 'label' => 'Media Library',
'module' => 'default', 'module' => 'default',

View file

@ -32,6 +32,7 @@ class LibraryController extends Zend_Controller_Action
$this->view->headScript()->appendFile('/js/airtime/onready/library.js','text/javascript'); $this->view->headScript()->appendFile('/js/airtime/onready/library.js','text/javascript');
$this->view->headScript()->appendFile('/js/contextmenu/jjmenu.js','text/javascript'); $this->view->headScript()->appendFile('/js/contextmenu/jjmenu.js','text/javascript');
$this->view->headLink()->appendStylesheet('/css/contextmenu.css'); $this->view->headLink()->appendStylesheet('/css/contextmenu.css');
$this->view->headLink()->appendStylesheet('/css/media_library.css');
$this->_helper->layout->setLayout('library'); $this->_helper->layout->setLayout('library');
@ -40,7 +41,7 @@ class LibraryController extends Zend_Controller_Action
$this->_helper->actionStack('contents', 'library'); $this->_helper->actionStack('contents', 'library');
$this->_helper->actionStack('quick-search', 'library'); $this->_helper->actionStack('quick-search', 'library');
$this->_helper->actionStack('index', 'sideplaylist'); $this->_helper->actionStack('index', 'playlist');
} }
public function contextMenuAction() public function contextMenuAction()

View file

@ -80,7 +80,19 @@ class PlaylistController extends Zend_Controller_Action
public function indexAction() public function indexAction()
{ {
$this->view->headScript()->appendFile('/js/airtime/library/spl.js','text/javascript');
$this->view->headLink()->appendStylesheet('/css/playlist_builder.css');
$this->_helper->viewRenderer->setResponseSegment('spl');
$pl_sess = $this->pl_sess;
if(isset($pl_sess->id)) {
$pl = $this->getPlaylist();
$this->view->pl = $pl;
}
} }
public function newAction() public function newAction()
@ -139,7 +151,7 @@ class PlaylistController extends Zend_Controller_Action
$this->view->headScript()->appendFile('/js/airtime/playlist/playlist.js','text/javascript'); $this->view->headScript()->appendFile('/js/airtime/playlist/playlist.js','text/javascript');
$pl_id = $this->_getParam('id', null); $pl_id = $this->_getParam('id', null);
$display = $this->_getParam('view', null);
if(!is_null($pl_id)) { if(!is_null($pl_id)) {
$this->changePlaylist($pl_id); $this->changePlaylist($pl_id);
} }
@ -147,12 +159,9 @@ class PlaylistController extends Zend_Controller_Action
$pl = $this->getPlaylist(); $pl = $this->getPlaylist();
$this->view->pl = $pl; $this->view->pl = $pl;
$this->view->html = $this->view->render('playlist/index.phtml');
if($display === 'spl') {
$this->view->html = $this->view->render('sideplaylist/index.phtml');
unset($this->view->pl); unset($this->view->pl);
} }
}
public function addItemAction() public function addItemAction()
{ {
@ -168,7 +177,7 @@ class PlaylistController extends Zend_Controller_Action
} }
$this->view->pl = $pl; $this->view->pl = $pl;
$this->view->html = $this->view->render('sideplaylist/update.phtml'); $this->view->html = $this->view->render('playlist/update.phtml');
$this->view->name = $pl->getName(); $this->view->name = $pl->getName();
$this->view->length = $pl->getLength(); $this->view->length = $pl->getLength();
@ -182,20 +191,13 @@ class PlaylistController extends Zend_Controller_Action
{ {
$oldPos = $this->_getParam('oldPos'); $oldPos = $this->_getParam('oldPos');
$newPos = $this->_getParam('newPos'); $newPos = $this->_getParam('newPos');
$display = $this->_getParam('view');
$pl = $this->getPlaylist(); $pl = $this->getPlaylist();
$pl->moveAudioClip($oldPos, $newPos); $pl->moveAudioClip($oldPos, $newPos);
$this->view->pl = $pl; $this->view->pl = $pl;
if($display === 'pl') {
$this->view->html = $this->view->render('playlist/update.phtml'); $this->view->html = $this->view->render('playlist/update.phtml');
}
else {
$this->view->html = $this->view->render('sideplaylist/update.phtml');
}
$this->view->name = $pl->getName(); $this->view->name = $pl->getName();
$this->view->length = $pl->getLength(); $this->view->length = $pl->getLength();
@ -205,7 +207,6 @@ class PlaylistController extends Zend_Controller_Action
public function deleteItemAction() public function deleteItemAction()
{ {
$positions = $this->_getParam('pos', array()); $positions = $this->_getParam('pos', array());
$display = $this->_getParam('view');
if (!is_array($positions)) if (!is_array($positions))
$positions = array($positions); $positions = array($positions);
@ -221,13 +222,7 @@ class PlaylistController extends Zend_Controller_Action
} }
$this->view->pl = $pl; $this->view->pl = $pl;
if($display === 'pl') {
$this->view->html = $this->view->render('playlist/update.phtml'); $this->view->html = $this->view->render('playlist/update.phtml');
}
else {
$this->view->html = $this->view->render('sideplaylist/update.phtml');
}
$this->view->name = $pl->getName(); $this->view->name = $pl->getName();
$this->view->length = $pl->getLength(); $this->view->length = $pl->getLength();
@ -280,35 +275,21 @@ class PlaylistController extends Zend_Controller_Action
public function deleteActiveAction() public function deleteActiveAction()
{ {
$display = $this->_getParam('view');
$pl = $this->getPlaylist(); $pl = $this->getPlaylist();
Playlist::Delete($pl->getId()); Playlist::Delete($pl->getId());
$pl_sess = $this->pl_sess; $pl_sess = $this->pl_sess;
unset($pl_sess->id); unset($pl_sess->id);
if($display === 'spl') { $this->view->html = $this->view->render('playlist/index.phtml');
$this->view->html = $this->view->render('sideplaylist/index.phtml');
return;
}
$this->_helper->redirector('index');
} }
public function closeAction() public function closeAction()
{ {
$display = $this->_getParam('view');
$pl = $this->getPlaylist(); $pl = $this->getPlaylist();
$this->closePlaylist($pl); $this->closePlaylist($pl);
if($display === 'spl') { $this->view->html = $this->view->render('playlist/index.phtml');
$this->view->html = $this->view->render('sideplaylist/index.phtml');
return;
}
$this->_helper->redirector('index');
} }
} }

View file

@ -51,7 +51,7 @@ class SearchController extends Zend_Controller_Action
$this->_helper->actionStack('contents', 'library'); $this->_helper->actionStack('contents', 'library');
$this->_helper->actionStack('display', 'search'); $this->_helper->actionStack('display', 'search');
$this->_helper->actionStack('index', 'sideplaylist'); $this->_helper->actionStack('index', 'playlist');
} }
public function displayAction() public function displayAction()

View file

@ -1,40 +0,0 @@
<?php
class SideplaylistController extends Zend_Controller_Action
{
protected $pl_sess = null;
public function init()
{
if(!Zend_Auth::getInstance()->hasIdentity())
{
$this->_redirect('login/index');
}
$this->pl_sess = new Zend_Session_Namespace(UI_PLAYLIST_SESSNAME);
}
public function indexAction()
{
$this->view->headScript()->appendFile('/js/airtime/library/spl.js','text/javascript');
$this->_helper->viewRenderer->setResponseSegment('spl');
$pl_sess = $this->pl_sess;
if(isset($pl_sess->id)) {
$pl = Playlist::Recall($pl_sess->id);
if($pl === FALSE) {
unset($pl_sess->id);
return;
}
$this->view->pl = $pl;
}
}
}

View file

@ -1,19 +1,22 @@
<div><a href="<?php echo $this->url( <span id="spl_new">New</span>
array( <?php if (isset($this->pl)) : ?>
'controller' => 'Playlist', <span id="spl_delete">Delete</span>
'action' => 'new' <span id="spl_close">Close</span>
), <?php endif; ?>
'default',
true) ?>"> New Playlist</a></div>
<div><a href="<?php echo $this->url( <?php if (isset($this->pl)) : ?>
array(
'controller' => 'Playlist',
'action' => 'edit'
),
'default',
true) ?>"> Edit Playlist</a></div>
<?php <div id="spl_name"><?php echo $this->pl->getName(); ?></div>
<div id="spl_length"><?php echo $this->pl->getLength(); ?></div>
echo $this->form; <ul id="spl_sortable">
<?php if (count($this->pl->getContents())) : ?>
<?php echo $this->partialLoop('sideplaylist/sidebarcontent.phtml', $this->pl->getContents()); ?>
<?php else : ?>
<li class="spl_empty">Empty playlist</li>
<?php endif; ?>
</ul>
<?php else : ?>
<div>No open playlist</div>
<?php endif; ?>

View file

@ -0,0 +1,6 @@
<li class="spl_row" id="spl_<?php echo $this->partialCounter-1 ?>">
<span class="spl_title"><?php echo $this->CcFiles['track_title'] ?></span>
<span class="spl_playlength"><?php echo $this->cliplength ?></span>
<span class="ui-icon ui-icon-close"></span>
<span class="spl_artist"><?php echo $this->CcFiles['artist_name'] ?></span>
</li>

View file

@ -1,8 +1,7 @@
<?php <?php
if (count($this->pl->getContents())) { if (count($this->pl->getContents())) {
echo $this->partialLoop('playlist/playlistEditorTable.phtml', $this->pl->getContents()); echo $this->partialLoop('sideplaylist/sidebarcontent.phtml', $this->pl->getContents());
} }
else { else {
echo '<div class="pl_empty">Empty playlist</div>'; echo '<li class="pl_empty">Empty playlist</li>';
} }
?>

View file

@ -1,46 +0,0 @@
<form name="SPL">
<div>
<span id="spl_new">
<a href="<?php echo $this->url(
array(
'controller' => 'Playlist',
'action' => 'new'
),
'default',
true) ?>">New</a>
</span>
<?php if (isset($this->pl)) { echo '<span id="spl_delete">Delete</span>';} ?>
<?php if (isset($this->pl)) { echo '<span id="spl_close">Close</span>';} ?>
<div>
<div id="spl_name"><?php if (isset($this->pl)) { echo $this->pl->getName(); } ?></div>
<div id="spl_length"><?php if (isset($this->pl)) { echo $this->pl->getLength(); } ?></div>
<div class="spl_main">
<?php
if (isset($this->pl)) {
echo '<div class="spl_head">';
echo '<span class="spl_input"><input type="checkbox" name="all"></span>';
echo '<span class="spl_title">Title</span>';
echo '<span class="spl_artist">Creator</span>';
echo '<span class="spl_playlength">Playlength</span>';
echo '</div>';
echo '<ul id="spl_sortable">';
if (count($this->pl->getContents())) {
echo $this->partialLoop('sideplaylist/sidebarcontent.phtml', $this->pl->getContents());
}
else {
echo '<li class="spl_empty">Empty playlist</li>';
}
echo '</ul></div>';
}
else {
echo '<div>No open playlist</div>';
}
?>
</form>
<div class="spl_footer">
<?php if (isset($this->pl)) { echo '<span id="spl_remove_selected">Remove</span>';} ?>
</div>

View file

@ -1,14 +0,0 @@
<li class="spl_row" id="spl_<?php echo $this->partialCounter-1 ?>">
<span class="spl_input">
<input type="checkbox" class="checkbox" name="<?php echo $this->partialCounter-1 ?>"/>
</span>
<span class="spl_title">
<?php echo $this->CcFiles['track_title'] ?>
</span>
<span class="spl_artist">
<?php echo $this->CcFiles['artist_name'] ?>
</span>
<span class="spl_playlength">
<?php echo $this->cliplength ?>
</span>
</li>

View file

@ -1,7 +0,0 @@
<?php
if (count($this->pl->getContents())) {
echo $this->partialLoop('sideplaylist/sidebarcontent.phtml', $this->pl->getContents());
}
else {
echo '<li class="pl_empty">Empty playlist</li>';
}

View file

View file

@ -0,0 +1,8 @@
#side_playlist div, #side_playlist span, #side_playlist ul, #side_playlist li {
float: left;
}
#spl_sortable, #spl_sortable > li, .spl_artist, #side_playlist > div{
clear: left;
}

View file

@ -9,14 +9,14 @@ function setSPLContent(json) {
return; return;
} }
$('input[name="all"]').attr("checked", false);
$('#spl_name').empty() $('#spl_name').empty()
.append(json.name); .append(json.name);
$('#spl_length').empty() $('#spl_length').empty()
.append(json.length); .append(json.length);
$('#spl_sortable').empty() $('#spl_sortable').empty()
.append(json.html); .append(json.html);
$(".ui-icon-close").click(deleteSPLItem);
} }
function addSPLItem(event, ui){ function addSPLItem(event, ui){
@ -37,16 +37,12 @@ function addSPLItem(event, ui){
} }
function deleteSPLItem(){ function deleteSPLItem(){
var url, pos; var url, pos;
url = '/Playlist/delete-item/format/json/view/spl'; pos = $(this).parent().attr("id").split("_").pop();
pos = $('form[name="SPL"]').find(':checked').not('input[name="all"]').map(function() { url = '/Playlist/delete-item/format/json';
return "/pos/" + $(this).attr('name'); url = url + '/pos/' + pos;
}).get().join("");
url = url + pos;
$.post(url, setSPLContent); $.post(url, setSPLContent);
} }
@ -61,7 +57,6 @@ function moveSPLItem(event, ui) {
url = '/Playlist/move-item' url = '/Playlist/move-item'
url = url + '/format/json'; url = url + '/format/json';
url = url + '/view/spl';
url = url + '/oldPos/' + oldPos; url = url + '/oldPos/' + oldPos;
url = url + '/newPos/' + newPos; url = url + '/newPos/' + newPos;
@ -77,15 +72,19 @@ function noOpenPL(json) {
function closeSPL() { function closeSPL() {
var url; var url;
url = '/Playlist/close/format/json/view/spl'; url = '/Playlist/close/format/json';
$.post(url, noOpenPL); $.post(url, noOpenPL);
} }
function newSPL() {
}
function deleteSPL() { function deleteSPL() {
var url; var url;
url = '/Playlist/delete-active/format/json/view/spl'; url = '/Playlist/delete-active/format/json';
$.post(url, noOpenPL); $.post(url, noOpenPL);
} }
@ -106,12 +105,10 @@ function setUpSPL() {
$("#spl_remove_selected").click(deleteSPLItem); $("#spl_remove_selected").click(deleteSPLItem);
$("#spl_close").click(closeSPL); $("#spl_close").click(closeSPL);
$("#spl_delete").click(deleteSPL); $("#spl_delete").click(deleteSPL);
$(".ui-icon-close").click(deleteSPLItem);
$("#spl_sortable").droppable(); $("#spl_sortable").droppable();
$("#spl_sortable" ).bind( "drop", addSPLItem); $("#spl_sortable" ).bind( "drop", addSPLItem);
$('input[name="all"]').click(function(){
$('form[name="SPL"]').find('input').attr("checked", $(this).attr("checked"));
});
} }