From 8887ce24d1183f88c2c648b066a8de752664e82e Mon Sep 17 00:00:00 2001 From: naomiaro Date: Sun, 16 Jan 2011 19:31:10 -0500 Subject: [PATCH] can get cues/fades to display in new playlist builder. cannot change them yet. --- .../controllers/PlaylistController.php | 42 ++++++++++++++----- application/models/Playlist.php | 27 ++++++++++++ .../views/scripts/playlist/index.phtml | 2 +- .../views/scripts/playlist/set-cue.phtml | 9 +++- .../views/scripts/playlist/set-fade.phtml | 9 +++- public/js/airtime/library/spl.js | 22 ++++++++++ 6 files changed, 97 insertions(+), 14 deletions(-) diff --git a/application/controllers/PlaylistController.php b/application/controllers/PlaylistController.php index 71ca5a255..52f05c085 100644 --- a/application/controllers/PlaylistController.php +++ b/application/controllers/PlaylistController.php @@ -229,27 +229,47 @@ class PlaylistController extends Zend_Controller_Action public function setCueAction() { + $request = $this->getRequest(); $pos = $this->_getParam('pos'); - $cueIn = $this->_getParam('cueIn', null); - $cueOut = $this->_getParam('cueOut', null); - $pl = $this->getPlaylist(); - $response = $pl->changeClipLength($pos, $cueIn, $cueOut); - die(json_encode($response)); + if($request->isPost()) { + $cueIn = $this->_getParam('cueIn', null); + $cueOut = $this->_getParam('cueOut', null); + + $response = $pl->changeClipLength($pos, $cueIn, $cueOut); + + die(json_encode($response)); + } + + $cues = $pl->getCueInfo($pos); + + $this->view->cueIn = $cues[0]; + $this->view->cueOut = $cues[1]; + $this->view->html = $this->view->render('playlist/set-cue.phtml'); } public function setFadeAction() { + $request = $this->getRequest(); $pos = $this->_getParam('pos'); - $fadeIn = $this->_getParam('fadeIn', null); - $fadeOut = $this->_getParam('fadeOut', null); - $pl = $this->getPlaylist(); - - $response = $pl->changeFadeInfo($pos, $fadeIn, $fadeOut); - die(json_encode($response)); + if($request->isPost()) { + $fadeIn = $this->_getParam('fadeIn', null); + $fadeOut = $this->_getParam('fadeOut', null); + + $response = $pl->changeFadeInfo($pos, $fadeIn, $fadeOut); + + die(json_encode($response)); + } + + $fades = $pl->getFadeInfo($pos); + $this->view->fadeIn = $fades[0]; + + $fades = $pl->getFadeInfo($pos-1); + $this->view->fadeOut = $fades[1]; + $this->view->html = $this->view->render('playlist/set-fade.phtml'); } public function deleteAction() diff --git a/application/models/Playlist.php b/application/models/Playlist.php index 18ba6d33b..f158056bc 100644 --- a/application/models/Playlist.php +++ b/application/models/Playlist.php @@ -600,6 +600,19 @@ class Playlist { return TRUE; } + public function getFadeInfo($pos) { + + $row = CcPlaylistcontentsQuery::create() + ->joinWith(CcFilesPeer::OM_CLASS) + ->filterByDbPlaylistId($this->id) + ->filterByDbPosition($pos) + ->findOne(); + + $fadeIn = $row->getDbFadein(); + $fadeOut = $row->getDbFadeout(); + + return array($fadeIn, $fadeOut); + } /** * Change fadeIn and fadeOut values for playlist Element @@ -657,6 +670,20 @@ class Playlist { return array("fadeIn"=>$fadeIn, "fadeOut"=>$fadeOut); } + public function getCueInfo($pos) { + + $row = CcPlaylistcontentsQuery::create() + ->joinWith(CcFilesPeer::OM_CLASS) + ->filterByDbPlaylistId($this->id) + ->filterByDbPosition($pos) + ->findOne(); + + $cueIn = $row->getDBCuein(); + $cueOut = $row->getDbCueout(); + + return array($cueIn, $cueOut); + } + /** * Change cueIn/cueOut values for playlist element * diff --git a/application/views/scripts/playlist/index.phtml b/application/views/scripts/playlist/index.phtml index 8320766de..f411cc58f 100644 --- a/application/views/scripts/playlist/index.phtml +++ b/application/views/scripts/playlist/index.phtml @@ -15,7 +15,7 @@
  • Empty playlist
  • -
    +
    No open playlist
    diff --git a/application/views/scripts/playlist/set-cue.phtml b/application/views/scripts/playlist/set-cue.phtml index 197caa1f4..f20a02761 100644 --- a/application/views/scripts/playlist/set-cue.phtml +++ b/application/views/scripts/playlist/set-cue.phtml @@ -1 +1,8 @@ -

    View script for controller Playlist and script/action name setCue
    \ No newline at end of file +
    + Cue In: + cueIn; ?> +
    +
    + Cue Out: + cueOut; ?> +
    diff --git a/application/views/scripts/playlist/set-fade.phtml b/application/views/scripts/playlist/set-fade.phtml index 379c433ff..924773f49 100644 --- a/application/views/scripts/playlist/set-fade.phtml +++ b/application/views/scripts/playlist/set-fade.phtml @@ -1 +1,8 @@ -

    View script for controller Playlist and script/action name setFade
    \ No newline at end of file +
    + Fade Out: + fadeOut; ?> +
    +
    + Fade In: + fadeIn; ?> +
    diff --git a/public/js/airtime/library/spl.js b/public/js/airtime/library/spl.js index 5cb474d70..7e51bf021 100644 --- a/public/js/airtime/library/spl.js +++ b/public/js/airtime/library/spl.js @@ -2,6 +2,12 @@ //Side Playlist Functions //-------------------------------------------------------------------------------------------------------------------------------- +function setEditorContent(json) { + $("#spl_editor") + .empty() + .append(json.html); +} + function highlightActive(el) { $("#spl_sortable") .find(".ui-state-active") @@ -13,13 +19,29 @@ function highlightActive(el) { function openFadeEditor(event) { event.stopPropagation(); + var pos, url; + + pos = $(this).attr("id").split("_").pop(); + url = '/Playlist/set-fade/format/json'; + url = url + '/pos/' + pos; + highlightActive(this); + + $.get(url, setEditorContent); } function openCueEditor(event) { event.stopPropagation(); + var pos, url; + + pos = $(this).attr("id").split("_").pop(); + url = '/Playlist/set-cue/format/json'; + url = url + '/pos/' + pos; + highlightActive(this); + + $.get(url, setEditorContent); } function setSPLContent(json) {