CC-3174 : showbuilder/library
playlist fades are working again, still need more error checking to be done.
This commit is contained in:
parent
fbec92cb0d
commit
16863ee95e
|
@ -74,7 +74,7 @@ class Bootstrap extends Zend_Application_Bootstrap_Bootstrap
|
|||
|
||||
//scripts for now playing bar
|
||||
$view->headScript()->appendFile($baseUrl.'/js/airtime/dashboard/helperfunctions.js','text/javascript');
|
||||
//$view->headScript()->appendFile($baseUrl.'/js/airtime/dashboard/playlist.js','text/javascript');
|
||||
$view->headScript()->appendFile($baseUrl.'/js/airtime/dashboard/playlist.js','text/javascript');
|
||||
$view->headScript()->appendFile($baseUrl.'/js/airtime/dashboard/versiontooltip.js','text/javascript');
|
||||
|
||||
$view->headScript()->appendFile($baseUrl.'/js/airtime/common/common.js','text/javascript');
|
||||
|
|
|
@ -16,6 +16,7 @@ class PlaylistController extends Zend_Controller_Action
|
|||
->addActionContext('edit', 'json')
|
||||
->addActionContext('delete', 'json')
|
||||
->addActionContext('set-playlist-fades', 'json')
|
||||
->addActionContext('get-playlist-fades', 'json')
|
||||
->addActionContext('set-playlist-name', 'json')
|
||||
->addActionContext('set-playlist-description', 'json')
|
||||
->initContext();
|
||||
|
@ -265,52 +266,73 @@ class PlaylistController extends Zend_Controller_Action
|
|||
|
||||
public function setFadeAction()
|
||||
{
|
||||
$pos = $this->_getParam('pos');
|
||||
$pl = $this->getPlaylist();
|
||||
if($pl === false){
|
||||
$this->view->playlist_error = true;
|
||||
return false;
|
||||
}
|
||||
|
||||
$id = $this->_getParam('id');
|
||||
$fadeIn = $this->_getParam('fadeIn', null);
|
||||
$fadeOut = $this->_getParam('fadeOut', null);
|
||||
|
||||
$response = $pl->changeFadeInfo($pos, $fadeIn, $fadeOut);
|
||||
try {
|
||||
$pl = $this->getPlaylist();
|
||||
$response = $pl->changeFadeInfo($id, $fadeIn, $fadeOut);
|
||||
|
||||
$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 getPlaylistFadesAction()
|
||||
{
|
||||
try {
|
||||
$pl = $this->getPlaylist();
|
||||
$fades = $pl->getFadeInfo(0);
|
||||
$this->view->fadeIn = $fades[0];
|
||||
|
||||
$fades = $pl->getFadeInfo($pl->getSize()-1);
|
||||
$this->view->fadeOut = $fades[1];
|
||||
}
|
||||
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 setPlaylistFadesAction()
|
||||
{
|
||||
$request = $this->getRequest();
|
||||
$pl = $this->getPlaylist();
|
||||
if($pl === false){
|
||||
$this->view->playlist_error = true;
|
||||
return false;
|
||||
$fadeIn = $this->_getParam('fadeIn', null);
|
||||
$fadeOut = $this->_getParam('fadeOut', null);
|
||||
|
||||
try {
|
||||
$pl = $this->getPlaylist();
|
||||
$pl->setPlaylistfades($fadeIn, $fadeOut);
|
||||
}
|
||||
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()}");
|
||||
}
|
||||
|
||||
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];
|
||||
}
|
||||
|
||||
public function setPlaylistNameAction()
|
||||
|
|
|
@ -389,6 +389,8 @@ class Application_Model_Playlist {
|
|||
|
||||
public function getFadeInfo($pos) {
|
||||
|
||||
Logging::log("Getting fade info for pos {$pos}");
|
||||
|
||||
$row = CcPlaylistcontentsQuery::create()
|
||||
->joinWith(CcFilesPeer::OM_CLASS)
|
||||
->filterByDbPlaylistId($this->id)
|
||||
|
@ -412,21 +414,18 @@ class Application_Model_Playlist {
|
|||
* new value in ss.ssssss or extent format
|
||||
* @return boolean
|
||||
*/
|
||||
public function changeFadeInfo($pos, $fadeIn, $fadeOut)
|
||||
public function changeFadeInfo($id, $fadeIn, $fadeOut)
|
||||
{
|
||||
$errArray= array();
|
||||
$con = Propel::getConnection(CcPlaylistPeer::DATABASE_NAME);
|
||||
|
||||
if(is_null($pos) || $pos < 0 || $pos >= $this->getNextPos()) {
|
||||
$errArray["error"]="Invalid position.";
|
||||
$row = CcPlaylistcontentsQuery::create()->findPK($id);
|
||||
|
||||
if (is_null($row)) {
|
||||
$errArray["error"]="Playlist item does not exist.";
|
||||
return $errArray;
|
||||
}
|
||||
|
||||
$row = CcPlaylistcontentsQuery::create()
|
||||
->filterByDbPlaylistId($this->id)
|
||||
->filterByDbPosition($pos)
|
||||
->findOne();
|
||||
|
||||
$clipLength = $row->getDbCliplength();
|
||||
|
||||
if(!is_null($fadeIn)) {
|
||||
|
@ -457,6 +456,28 @@ class Application_Model_Playlist {
|
|||
return array("fadeIn"=>$fadeIn, "fadeOut"=>$fadeOut);
|
||||
}
|
||||
|
||||
public function setPlaylistfades($fadein, $fadeout) {
|
||||
|
||||
if (isset($fadein)) {
|
||||
Logging::log("Setting playlist fade in {$fadein}");
|
||||
$row = CcPlaylistcontentsQuery::create()
|
||||
->filterByDbPlaylistId($this->id)
|
||||
->filterByDbPosition(0)
|
||||
->findOne();
|
||||
|
||||
$this->changeFadeInfo($row->getDbId(), $fadein, null);
|
||||
}
|
||||
|
||||
if (isset($fadeout)) {
|
||||
$row = CcPlaylistcontentsQuery::create()
|
||||
->filterByDbPlaylistId($this->id)
|
||||
->filterByDbPosition($this->getSize()-1)
|
||||
->findOne();
|
||||
|
||||
$this->changeFadeInfo($row->getDbId(), null, $fadeout);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Change cueIn/cueOut values for playlist element
|
||||
*
|
||||
|
|
|
@ -1,11 +1,11 @@
|
|||
<dl id="spl_editor" class="inline-list">
|
||||
<dt>Fade out:</dt>
|
||||
<dd id="spl_fade_out_<?php echo $this->pos; ?>" class="spl_fade_out">
|
||||
<dd id="spl_fade_out_<?php echo $this->item1; ?>" class="spl_fade_out">
|
||||
<span contenteditable="true" class="spl_text_input"><?php echo $this->fadeOut; ?></span>
|
||||
</dd>
|
||||
<dd class="edit-error"></dd>
|
||||
<dt>Fade in:</dt>
|
||||
<dd id="spl_fade_in_<?php echo $this->pos + 1; ?>" class="spl_fade_in">
|
||||
<dd id="spl_fade_in_<?php echo $this->item2; ?>" class="spl_fade_in">
|
||||
<span contenteditable="true" class="spl_text_input"><?php echo $this->fadeIn; ?></span>
|
||||
</dd>
|
||||
<dd class="edit-error"></dd>
|
||||
|
|
|
@ -43,7 +43,8 @@ if (count($items)) : ?>
|
|||
?>
|
||||
<div id="crossfade_<?php echo $i ?>-<?php echo $i+1 ?>" class="crossfade clearfix" style="display: none">
|
||||
<?php echo $this->partial('playlist/set-fade.phtml', array(
|
||||
'pos' => $i,
|
||||
'item1' => $items[$i]['id'],
|
||||
'item2' => $items[$i+1]['id'],
|
||||
'fadeOut' => $items[$i]['fadeout'],
|
||||
'fadeIn' => $items[$i+1]['fadein'])); ?>
|
||||
</div>
|
||||
|
|
|
@ -215,7 +215,6 @@ function fnCreatedRow( nRow, aData, iDataIndex ) {
|
|||
|
||||
//call the context menu so we can prevent the event from propagating.
|
||||
$(nRow).find('td:not(.library_checkbox):not(.library_type)').click(function(e){
|
||||
var x;
|
||||
|
||||
$(this).contextMenu();
|
||||
|
||||
|
@ -390,7 +389,7 @@ $(document).ready(function() {
|
|||
setInterval( checkSCUploadStatus, 5000 );
|
||||
|
||||
addQtipToSCIcons();
|
||||
|
||||
|
||||
$.contextMenu({
|
||||
selector: '#library_display td:not(.library_checkbox):not(.library_type)',
|
||||
trigger: "left",
|
||||
|
|
|
@ -114,10 +114,10 @@ var AIRTIME = (function(AIRTIME){
|
|||
function changeFadeIn(event) {
|
||||
event.stopPropagation();
|
||||
|
||||
var pos, url, fadeIn, li, unqid;
|
||||
var id, url, fadeIn, li, unqid;
|
||||
|
||||
span = $(this);
|
||||
pos = span.parent().attr("id").split("_").pop();
|
||||
id = span.parent().attr("id").split("_").pop();
|
||||
url = "/Playlist/set-fade";
|
||||
fadeIn = $.trim(span.text());
|
||||
li = span.parent().parent().parent().parent();
|
||||
|
@ -128,7 +128,7 @@ var AIRTIME = (function(AIRTIME){
|
|||
return;
|
||||
}
|
||||
|
||||
$.post(url, {format: "json", fadeIn: fadeIn, pos: pos}, function(json){
|
||||
$.post(url, {format: "json", fadeIn: fadeIn, id: id}, function(json){
|
||||
|
||||
if(json.response !== undefined && json.response.error) {
|
||||
showError(span, json.response.error);
|
||||
|
@ -146,10 +146,10 @@ var AIRTIME = (function(AIRTIME){
|
|||
function changeFadeOut(event) {
|
||||
event.stopPropagation();
|
||||
|
||||
var pos, url, fadeOut, li, unqid;
|
||||
var id, url, fadeOut, li, unqid;
|
||||
|
||||
span = $(this);
|
||||
pos = span.parent().attr("id").split("_").pop();
|
||||
id = span.parent().attr("id").split("_").pop();
|
||||
url = "/Playlist/set-fade";
|
||||
fadeOut = $.trim(span.text());
|
||||
li = span.parent().parent().parent().parent();
|
||||
|
@ -160,7 +160,7 @@ var AIRTIME = (function(AIRTIME){
|
|||
return;
|
||||
}
|
||||
|
||||
$.post(url, {format: "json", fadeOut: fadeOut, pos: pos}, function(json){
|
||||
$.post(url, {format: "json", fadeOut: fadeOut, id: id}, function(json){
|
||||
if(json.response !== undefined && json.response.error) {
|
||||
showError(span, json.response.error);
|
||||
return;
|
||||
|
@ -341,7 +341,7 @@ var AIRTIME = (function(AIRTIME){
|
|||
else {
|
||||
$(this).addClass("ui-state-active");
|
||||
|
||||
var url = '/Playlist/set-playlist-fades';
|
||||
var url = '/Playlist/get-playlist-fades';
|
||||
|
||||
$.get(url, {format: "json"}, function(json){
|
||||
if(json.playlist_error == true){
|
||||
|
@ -425,21 +425,15 @@ var AIRTIME = (function(AIRTIME){
|
|||
}
|
||||
|
||||
$.post(url, {format: "json", fadeIn: fadeIn}, function(json){
|
||||
if(json.playlist_error == true){
|
||||
alertPlaylistErrorAndReload();
|
||||
}
|
||||
if(json.response.error) {
|
||||
return;
|
||||
}
|
||||
|
||||
hideError(span);
|
||||
|
||||
hideError(span);
|
||||
});
|
||||
});
|
||||
|
||||
playlist.find("#spl_fade_out_main span:first").on("blur", function(event){
|
||||
playlist.find("#spl_fade_out_main span:last").on("blur", function(event){
|
||||
event.stopPropagation();
|
||||
|
||||
var url, fadeIn, span;
|
||||
var url, fadeOut, span;
|
||||
|
||||
span = $(this);
|
||||
url = "/Playlist/set-playlist-fades";
|
||||
|
@ -451,14 +445,8 @@ var AIRTIME = (function(AIRTIME){
|
|||
}
|
||||
|
||||
$.post(url, {format: "json", fadeOut: fadeOut}, function(json){
|
||||
if(json.playlist_error == true){
|
||||
alertPlaylistErrorAndReload();
|
||||
}
|
||||
if(json.response.error) {
|
||||
return;
|
||||
}
|
||||
|
||||
hideError(span);
|
||||
|
||||
hideError(span);
|
||||
});
|
||||
});
|
||||
|
||||
|
|
Loading…
Reference in New Issue