CC-3174: showbuilder/library refactoring

adding new context menu files, playlist is working except for editing fades.
This commit is contained in:
Naomi Aro 2012-02-04 19:27:26 +01:00
parent 46fdf56b70
commit 38f3d6bfb0
14 changed files with 2124 additions and 538 deletions

View File

@ -165,15 +165,18 @@ class PlaylistController extends Zend_Controller_Action
$ids = $this->_getParam('ids');
$ids = (!is_array($ids)) ? array($ids) : $ids;
$afterItem = $this->_getParam('afterItem', null);
//$afterItem = (!is_numeric($afterItem)) ? null : intval($afterItem);
$addType = $this->_getParam('type', 'after');
Logging::log("type is ".$addType);
try {
$pl = $this->getPlaylist();
$pl->addAudioClips($ids, $afterItem);
$pl->addAudioClips($ids, $afterItem, $addType);
}
catch (PlaylistNotFoundException $e) {
Logging::log("Playlist {$pl_id} not found");
Logging::log("Playlist not found");
$this->changePlaylist(null);
$this->createFullResponse(null);
}
catch (Exception $e) {
Logging::log("{$e->getFile()}");
@ -189,15 +192,15 @@ class PlaylistController extends Zend_Controller_Action
$ids = $this->_getParam('ids');
$ids = (!is_array($ids)) ? array($ids) : $ids;
$afterItem = $this->_getParam('afterItem', null);
//$afterItem = (!is_numeric($afterItem)) ? null : intval($afterItem);
try {
$pl = $this->getPlaylist();
$pl->moveAudioClips($ids, $afterItem);
}
catch (PlaylistNotFoundException $e) {
Logging::log("Playlist {$pl_id} not found");
Logging::log("Playlist not found");
$this->changePlaylist(null);
$this->createFullResponse(null);
}
catch (Exception $e) {
Logging::log("{$e->getFile()}");
@ -218,8 +221,9 @@ class PlaylistController extends Zend_Controller_Action
$pl->delAudioClips($ids);
}
catch (PlaylistNotFoundException $e) {
Logging::log("Playlist {$pl_id} not found");
Logging::log("Playlist not found");
$this->changePlaylist(null);
$this->createFullResponse(null);
}
catch (Exception $e) {
Logging::log("{$e->getFile()}");
@ -232,23 +236,30 @@ class PlaylistController extends Zend_Controller_Action
public function setCueAction()
{
$pos = $this->_getParam('pos');
$pl = $this->getPlaylist();
if ($pl === false){
$this->view->playlist_error = true;
return false;
}
$id = $this->_getParam('id');
$cueIn = $this->_getParam('cueIn', null);
$cueOut = $this->_getParam('cueOut', null);
$response = $pl->changeClipLength($pos, $cueIn, $cueOut);
try {
$pl = $this->getPlaylist();
$response = $pl->changeClipLength($id, $cueIn, $cueOut);
$this->view->response = $response;
$this->view->response = $response;
if(!isset($response["error"])) {
$this->createUpdateResponse($pl);
}
if(!isset($response["error"])) {
$this->createUpdateResponse($pl);
}
}
catch (PlaylistNotFoundException $e) {
Logging::log("Playlist not found");
$this->changePlaylist(null);
$this->createFullResponse(null);
}
catch (Exception $e) {
Logging::log("{$e->getFile()}");
Logging::log("{$e->getLine()}");
Logging::log("{$e->getMessage()}");
}
}
public function setFadeAction()

View File

@ -209,8 +209,10 @@ class Application_Model_Playlist {
* an array of audioclips to add to the playlist
* @param int|null $p_afterItem
* item which to add the new items after in the playlist, null if added to the end.
* @param string (before|after) $addAfter
* whether to add the clips before or after the selected item.
*/
public function addAudioClips($p_items, $p_afterItem=NULL)
public function addAudioClips($p_items, $p_afterItem=NULL, $addType = 'after')
{
$this->con->beginTransaction();
$contentsToUpdate = array();
@ -221,11 +223,14 @@ class Application_Model_Playlist {
Logging::log("Finding playlist content item {$p_afterItem}");
$afterItem = CcPlaylistcontentsQuery::create()->findPK($p_afterItem);
$pos = $afterItem->getDbPosition() + 1;
$index = $afterItem->getDbPosition();
Logging::log("index is {$index}");
$pos = ($addType == 'after') ? $index + 1 : $index;
$contentsToUpdate = CcPlaylistcontentsQuery::create()
->filterByDbPlaylistId($this->id)
->filterByDbPosition($pos-1, Criteria::GREATER_THAN)
->filterByDbPosition($pos, Criteria::GREATER_EQUAL)
->orderByDbPosition()
->find($this->con);
@ -234,8 +239,9 @@ class Application_Model_Playlist {
}
else {
$pos = $this->getSize();
Logging::log("Adding to end of playlist");
$pos = ($addType == 'after') ? $this->getSize() : 0;
Logging::log("Adding to playlist");
Logging::log("at position {$pos}");
}
@ -449,22 +455,6 @@ class Application_Model_Playlist {
return array("fadeIn"=>$fadeIn, "fadeOut"=>$fadeOut);
}
public function getCueInfo($pos) {
$row = CcPlaylistcontentsQuery::create()
->joinWith(CcFilesPeer::OM_CLASS)
->filterByDbPlaylistId($this->id)
->filterByDbPosition($pos)
->findOne();
$file = $row->getCcFiles();
$origLength = $file->getDbLength();
$cueIn = $row->getDBCuein();
$cueOut = $row->getDbCueout();
return array($cueIn, $cueOut, $origLength);
}
/**
* Change cueIn/cueOut values for playlist element
*
@ -476,27 +466,26 @@ class Application_Model_Playlist {
* new value in ss.ssssss or extent format
* @return boolean or pear error object
*/
public function changeClipLength($pos, $cueIn, $cueOut)
public function changeClipLength($id, $cueIn, $cueOut)
{
$errArray= array();
$con = Propel::getConnection(CcPlaylistPeer::DATABASE_NAME);
if(is_null($cueIn) && is_null($cueOut)) {
if (is_null($cueIn) && is_null($cueOut)) {
$errArray["error"]="Cue in and cue out are null.";
return $errArray;
}
if(is_null($pos) || $pos < 0 || $pos >= $this->getNextPos()) {
$errArray["error"]="Invalid position.";
return $errArray;
}
$row = CcPlaylistcontentsQuery::create()
->joinWith(CcFilesPeer::OM_CLASS)
->filterByDbPlaylistId($this->id)
->filterByDbPosition($pos)
->filterByPrimaryKey($id)
->findOne();
if (is_null($row)) {
$errArray["error"]="Playlist item does not exist!.";
return $errArray;
}
$oldCueIn = $row->getDBCuein();
$oldCueOut = $row->getDbCueout();
$fadeIn = $row->getDbFadein();

View File

@ -1,11 +1,11 @@
<dl id="spl_cue_editor" class="inline-list">
<dt>Cue In:</dt>
<dd id="spl_cue_in_<?php echo $this->pos; ?>" class="spl_cue_in">
<dd id="spl_cue_in_<?php echo $this->id; ?>" class="spl_cue_in">
<span contenteditable="true" class="spl_text_input"><?php echo $this->cueIn; ?></span>
</dd>
<dd class="edit-error"></dd>
<dt>Cue Out:</dt>
<dd id="spl_cue_out_<?php echo $this->pos; ?>" class="spl_cue_out">
<dd id="spl_cue_out_<?php echo $this->id; ?>" class="spl_cue_out">
<span contenteditable="true" class="spl_text_input"><?php echo $this->cueOut; ?></span>
</dd>
<dd class="edit-error"></dd>

View File

@ -30,7 +30,7 @@ if (count($items)) : ?>
<div id="cues_<?php echo $i ?>" class="cue-edit clearfix" style="display: none">
<?php echo $this->partial('playlist/set-cue.phtml', array(
'pos' => $i,
'id' => $item["id"],
'cueIn' => $item['cuein'],
'cueOut' => $item['cueout'],
'origLength' => $item["CcFiles"]['length'])); ?>

Binary file not shown.

After

Width:  |  Height:  |  Size: 648 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 412 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 309 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 536 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 618 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 620 B

View File

@ -0,0 +1,134 @@
/*
* jQuery contextMenu - Plugin for simple contextMenu handling
*
* Version: 1.5.2
*
* Authors: Rodney Rehm, Addy Osmani (patches for FF)
* Web: http://medialize.github.com/jQuery-contextMenu/
*
* Licensed under
* MIT License http://www.opensource.org/licenses/mit-license
* GPL v3 http://opensource.org/licenses/GPL-3.0
*
*/
.context-menu-list {
margin:0;
padding:0;
min-width: 120px;
max-width: 250px;
display: inline-block;
position: absolute;
list-style-type: none;
border: 1px solid #DDD;
background: #EEE;
-webkit-box-shadow: 0 2px 5px rgba(0, 0, 0, 0.5);
-moz-box-shadow: 0 2px 5px rgba(0, 0, 0, 0.5);
-ms-box-shadow: 0 2px 5px rgba(0, 0, 0, 0.5);
-o-box-shadow: 0 2px 5px rgba(0, 0, 0, 0.5);
box-shadow: 0 2px 5px rgba(0, 0, 0, 0.5);
font-family: Verdana, Arial, Helvetica, sans-serif;
font-size: 11px;
}
.context-menu-item {
padding: 2px 2px 2px 24px;
background-color: #EEE;
position: relative;
-moz-user-select: -moz-none;
}
.context-menu-separator {
padding-bottom:0;
border-bottom: 1px solid #DDD;
}
.context-menu-item > label {
-moz-user-select: text;
}
.context-menu-item.hover {
cursor: pointer;
background-color: #39F;
}
.context-menu-item.disabled {
color: #666;
}
.context-menu-input.hover,
.context-menu-item.disabled.hover {
cursor: default;
background-color: #EEE;
}
.context-menu-submenu:after {
content: ">";
color: #666;
position: absolute;
top: 0;
right: 3px;
z-index: 1;
}
/* icons
#protip:
In case you want to use sprites for icons (which I would suggest you do) have a look at
http://css-tricks.com/13224-pseudo-spriting/ to get an idea of how to implement
.context-menu-item.icon:before {}
*/
.context-menu-item.icon { min-height: 18px; background-repeat: no-repeat; background-position: 4px 2px; }
.context-menu-item.icon-edit { background-image: url(images/page_white_edit.png); }
.context-menu-item.icon-cut { background-image: url(images/cut.png); }
.context-menu-item.icon-copy { background-image: url(images/page_white_copy.png); }
.context-menu-item.icon-paste { background-image: url(images/page_white_paste.png); }
.context-menu-item.icon-delete { background-image: url(images/page_white_delete.png); }
.context-menu-item.icon-quit { background-image: url(images/door.png); }
/* vertically align inside labels */
.context-menu-input > label > * { vertical-align: top; }
/* position checkboxes and radios as icons */
.context-menu-input > label > input[type="checkbox"],
.context-menu-input > label > input[type="radio"] {
margin-left: -17px;
}
.context-menu-input > label > span {
margin-left: 5px;
}
.context-menu-input > label,
.context-menu-input > label > input[type="text"],
.context-menu-input > label > textarea,
.context-menu-input > label > select {
display: block;
width: 100%;
-webkit-box-sizing: border-box;
-moz-box-sizing: border-box;
-ms-box-sizing: border-box;
-o-box-sizing: border-box;
box-sizing: border-box;
}
.context-menu-input > label > textarea {
height: 100px;
}
.context-menu-item > .context-menu-list {
display: none;
/* re-positioned by js */
right: -5px;
top: 5px;
}
.context-menu-item.hover > .context-menu-list {
display: block;
}
.context-menu-accesskey {
text-decoration: underline;
}

View File

@ -27,7 +27,7 @@ function fnLibraryTableDrawCallback() {
},
*/
cursor: 'pointer',
connectToSortable: '#side_playlist'
connectToSortable: '#spl_sortable'
});
}

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff