From 2de81c6027abd8f36f5fddd7f2a76707ea5cb944 Mon Sep 17 00:00:00 2001 From: Daniel Date: Thu, 1 Mar 2012 17:56:16 -0500 Subject: [PATCH] CC-2430: Preview tracks in the library + better preview (ability to jump around in clip) - updated logic removed when doing a rebase with devel --- .../controllers/PlaylistController.php | 2 +- .../controllers/ShowbuilderController.php | 3 ++- airtime_mvc/application/models/StoredFile.php | 18 +++++++++++++++++- 3 files changed, 20 insertions(+), 3 deletions(-) diff --git a/airtime_mvc/application/controllers/PlaylistController.php b/airtime_mvc/application/controllers/PlaylistController.php index b1b7292ce..ec514e2cd 100644 --- a/airtime_mvc/application/controllers/PlaylistController.php +++ b/airtime_mvc/application/controllers/PlaylistController.php @@ -112,7 +112,7 @@ class PlaylistController extends Zend_Controller_Action $baseUrl = $request->getBaseUrl(); $this->view->headScript()->appendFile($baseUrl.'/js/airtime/library/spl.js?'.$CC_CONFIG['airtime_version'],'text/javascript'); - $this->view->headScript()->appendFile($baseUrl.'/js/airtime/library/preview.js?'.filemtime($baseDir.'/js/airtime/library/preview.js'), 'text/javascript'); + $this->view->headScript()->appendFile($baseUrl.'/js/airtime/library/preview.js?'.$CC_CONFIG['airtime_version'], 'text/javascript'); $this->view->headLink()->appendStylesheet($baseUrl.'/css/playlist_builder.css?'.$CC_CONFIG['airtime_version']); $this->_helper->viewRenderer->setResponseSegment('spl'); diff --git a/airtime_mvc/application/controllers/ShowbuilderController.php b/airtime_mvc/application/controllers/ShowbuilderController.php index 1a9082988..b423243be 100644 --- a/airtime_mvc/application/controllers/ShowbuilderController.php +++ b/airtime_mvc/application/controllers/ShowbuilderController.php @@ -19,7 +19,8 @@ class ShowbuilderController extends Zend_Controller_Action $this->_helper->layout->setLayout('builder'); $this->view->headScript()->appendFile($this->view->baseUrl('/js/airtime/library/events/library_showbuilder.js'),'text/javascript'); - + $this->view->headScript()->appendFile($this->view->baseUrl('/js/airtime/library/preview.js'), 'text/javascript'); + $this->_helper->actionStack('library', 'library'); $this->_helper->actionStack('builder', 'showbuilder'); } diff --git a/airtime_mvc/application/models/StoredFile.php b/airtime_mvc/application/models/StoredFile.php index fe9515ed2..7c541a45c 100644 --- a/airtime_mvc/application/models/StoredFile.php +++ b/airtime_mvc/application/models/StoredFile.php @@ -631,6 +631,9 @@ Logging::log("getting media! - 2"); $results = Application_Model_StoredFile::searchFiles($displayColumns, $fromTable, $datatables); + //Used by the audio preview functionality in the library. + $audioResults = Application_Model_StoredFile::getAllAudioFilePaths(); + foreach ($results['aaData'] as &$row) { $row['id'] = intval($row['id']); @@ -656,7 +659,7 @@ Logging::log("getting media! - 2"); //datatable stuff really needs to be pulled out and generalized within the project //access to zend view methods to access url helpers is needed. - if($type == "au") { + if($type == "au" && isset( $audioResults )) { $audioFile = $audioResults[$row['id']-1]['gunid'].".".pathinfo($audioResults[$row['id']-1]['filepath'], PATHINFO_EXTENSION); $row['image'] = ''; @@ -669,6 +672,19 @@ Logging::log("getting media! - 2"); return $results; } + public static function getAllAudioFilePaths(){ + try { + $con = Propel::getConnection(CcFilesPeer::DATABASE_NAME); + $r = $con->query("SELECT id, gunid, filepath FROM cc_files"); + $r->setFetchMode(PDO::FETCH_ASSOC); + $results = $r->fetchAll(); + + return $results; + }catch (Exception $e) { + Logging::log($e->getMessage()); + } + } + public static function searchFiles($displayColumns, $fromTable, $data) { $con = Propel::getConnection(CcFilesPeer::DATABASE_NAME);