CC-1862 playlist builder playlist fadein/out
This commit is contained in:
parent
424c6f0193
commit
bdad3b34e0
5 changed files with 165 additions and 40 deletions
|
@ -28,6 +28,7 @@
|
|||
<actionMethod actionName="delete"/>
|
||||
<actionMethod actionName="deleteActive"/>
|
||||
<actionMethod actionName="close"/>
|
||||
<actionMethod actionName="setPlaylistFades"/>
|
||||
</controllerFile>
|
||||
<controllerFile controllerName="Library">
|
||||
<actionMethod actionName="index"/>
|
||||
|
@ -287,6 +288,9 @@
|
|||
<viewControllerScriptsDirectory forControllerName="Library">
|
||||
<viewScriptFile forActionName="getFileMetaData"/>
|
||||
</viewControllerScriptsDirectory>
|
||||
<viewControllerScriptsDirectory forControllerName="Playlist">
|
||||
<viewScriptFile forActionName="setPlaylistFades"/>
|
||||
</viewControllerScriptsDirectory>
|
||||
</viewScriptsDirectory>
|
||||
<viewHelpersDirectory/>
|
||||
<viewFiltersDirectory enabled="false"/>
|
||||
|
|
|
@ -19,6 +19,7 @@ class PlaylistController extends Zend_Controller_Action
|
|||
->addActionContext('edit', 'json')
|
||||
->addActionContext('delete-active', 'json')
|
||||
->addActionContext('delete', 'json')
|
||||
->addActionContext('set-playlist-fades', 'json')
|
||||
->initContext();
|
||||
|
||||
$this->pl_sess = new Zend_Session_Namespace(UI_PLAYLIST_SESSNAME);
|
||||
|
@ -39,8 +40,8 @@ class PlaylistController extends Zend_Controller_Action
|
|||
}
|
||||
}
|
||||
|
||||
private function changePlaylist($pl_id){
|
||||
|
||||
private function changePlaylist($pl_id)
|
||||
{
|
||||
$pl_sess = $this->pl_sess;
|
||||
|
||||
if(isset($pl_sess->id)) {
|
||||
|
@ -78,9 +79,6 @@ class PlaylistController extends Zend_Controller_Action
|
|||
$this->view->headLink()->appendStylesheet('/css/playlist_builder.css');
|
||||
|
||||
$this->_helper->viewRenderer->setResponseSegment('spl');
|
||||
|
||||
$pl_sess = $this->pl_sess;
|
||||
|
||||
$this->view->pl = $this->getPlaylist();
|
||||
}
|
||||
|
||||
|
@ -94,9 +92,7 @@ class PlaylistController extends Zend_Controller_Action
|
|||
$pl->setPLMetaData('dc:creator', $userInfo->login);
|
||||
|
||||
$this->changePlaylist($pl_id);
|
||||
|
||||
$form = new Application_Form_PlaylistMetadata();
|
||||
|
||||
$this->view->form = $form->__toString();
|
||||
}
|
||||
|
||||
|
@ -310,6 +306,32 @@ class PlaylistController extends Zend_Controller_Action
|
|||
$this->view->html = $this->view->render('playlist/index.phtml');
|
||||
}
|
||||
|
||||
public function setPlaylistFadesAction()
|
||||
{
|
||||
$request = $this->getRequest();
|
||||
$pl = $this->getPlaylist();
|
||||
|
||||
if($request->isPost()) {
|
||||
$fadeIn = $this->_getParam('fadeIn', null);
|
||||
$fadeOut = $this->_getParam('fadeOut', null);
|
||||
|
||||
if($fadeIn)
|
||||
$response = $pl->changeFadeInfo(0, $fadeIn, $fadeOut);
|
||||
else if($fadeOut)
|
||||
$response = $pl->changeFadeInfo($pl->getSize(), $fadeIn, $fadeOut);
|
||||
|
||||
$this->view->response = $response;
|
||||
return;
|
||||
}
|
||||
|
||||
$fades = $pl->getFadeInfo(0);
|
||||
$this->view->fadeIn = $fades[0];
|
||||
|
||||
$fades = $pl->getFadeInfo($pl->getSize());
|
||||
$this->view->fadeOut = $fades[1];
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
@ -331,6 +353,8 @@ class PlaylistController extends Zend_Controller_Action
|
|||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
|
|
@ -355,6 +355,18 @@ class Playlist {
|
|||
return $res + 1;
|
||||
}
|
||||
|
||||
public function getSize() {
|
||||
|
||||
$res = CcPlaylistQuery::create()
|
||||
->findPK($this->id)
|
||||
->computeLastPosition();
|
||||
|
||||
if(is_null($res))
|
||||
return 0;
|
||||
|
||||
return $res;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the entire playlist as a two dimentional array, sorted in order of play.
|
||||
* @return array
|
||||
|
|
|
@ -1,6 +1,9 @@
|
|||
<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>
|
||||
<?php endif; ?>
|
||||
|
||||
|
@ -8,6 +11,18 @@
|
|||
<h3 id="spl_name"><?php echo $this->pl->getName(); ?></h3>
|
||||
<h4 id="spl_length"><?php echo $this->pl->getLength(); ?></h4>
|
||||
|
||||
<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">
|
||||
|
|
|
@ -392,12 +392,82 @@ function setUpSPL() {
|
|||
.button()
|
||||
.click(closeSPL);
|
||||
|
||||
$("#spl_main_crossfade")
|
||||
.button({
|
||||
icons: {
|
||||
primary: "crossfade-main-icon"
|
||||
},
|
||||
text: false
|
||||
$("#spl_crossfade").click(function(){
|
||||
|
||||
if($(this).hasClass("ui-state-active")) {
|
||||
$(this).removeClass("ui-state-active");
|
||||
$("#crossfade_main").hide();
|
||||
}
|
||||
else {
|
||||
$(this).addClass("ui-state-active");
|
||||
|
||||
var url = '/Playlist/set-playlist-fades';
|
||||
|
||||
$.get(url, {format: "json"}, function(json){
|
||||
$("#spl_fade_in_main").find("span")
|
||||
.empty()
|
||||
.append(json.fadeIn);
|
||||
$("#spl_fade_out_main").find("span")
|
||||
.empty()
|
||||
.append(json.fadeOut);
|
||||
|
||||
$("#crossfade_main").show();
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
$("#spl_fade_in_main span:first").blur(function(event){
|
||||
event.stopPropagation();
|
||||
|
||||
var url, fadeIn, span;
|
||||
|
||||
span = $(this);
|
||||
url = "/Playlist/set-playlist-fades";
|
||||
fadeIn = span.text().trim();
|
||||
|
||||
if(!isTimeValid(fadeIn)){
|
||||
showError(span, "please put in a time '00:00:00 (.000000)'");
|
||||
return;
|
||||
}
|
||||
|
||||
$.post(url, {format: "json", fadeIn: fadeIn}, function(json){
|
||||
if(json.response.error) {
|
||||
return;
|
||||
}
|
||||
|
||||
hideError(span);
|
||||
});
|
||||
});
|
||||
|
||||
$("#spl_fade_out_main span:first").blur(function(event){
|
||||
event.stopPropagation();
|
||||
|
||||
var url, fadeIn, span;
|
||||
|
||||
span = $(this);
|
||||
url = "/Playlist/set-playlist-fades";
|
||||
fadeOut = span.text().trim();
|
||||
|
||||
if(!isTimeValid(fadeOut)){
|
||||
showError(span, "please put in a time '00:00:00 (.000000)'");
|
||||
return;
|
||||
}
|
||||
|
||||
$.post(url, {format: "json", fadeOut: fadeOut}, function(json){
|
||||
if(json.response.error) {
|
||||
return;
|
||||
}
|
||||
|
||||
hideError(span);
|
||||
});
|
||||
});
|
||||
|
||||
$("#spl_fade_in_main span:first, #spl_fade_out_main span:first")
|
||||
.keydown(submitOnEnter);
|
||||
|
||||
$("#crossfade_main > .ui-icon-closethick").click(function(){
|
||||
$("#spl_crossfade").removeClass("ui-state-active");
|
||||
$("#crossfade_main").hide();
|
||||
});
|
||||
|
||||
$("#spl_delete")
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue