CC-3394: Add play button to timeline table.
- added image information to row in ShowBuilder.php to enable audio preview of shows. - moved around code so the audio preview functionaly is standalone - fixed the firefox bug for issue CC-3429
This commit is contained in:
parent
f399c7adab
commit
ae0d3c560c
11 changed files with 977 additions and 759 deletions
|
@ -88,7 +88,7 @@ class Bootstrap extends Zend_Application_Bootstrap_Bootstrap
|
|||
$view->headScript()->appendFile($baseUrl.'/js/airtime/common/common.js?'.$CC_CONFIG['airtime_version'],'text/javascript');
|
||||
|
||||
if (Application_Model_Preference::GetPlanLevel() != "disabled"
|
||||
&& ($_SERVER['REQUEST_URI'] != '/Dashboard/stream-player' || $_SERVER['REQUEST_URI'] != '/Playlist/audio-preview-player')) {
|
||||
&& ($_SERVER['REQUEST_URI'] != '/Dashboard/stream-player' || $_SERVER['REQUEST_URI'] != '/audiopreview/audio-preview-player')) {
|
||||
$client_id = Application_Model_Preference::GetClientId();
|
||||
$view->headScript()->appendScript("var livechat_client_id = '$client_id';");
|
||||
$view->headScript()->appendFile($baseUrl . '/js/airtime/common/livechat.js?'.$CC_CONFIG['airtime_version'], 'text/javascript');
|
||||
|
|
|
@ -27,7 +27,8 @@ $ccAcl->add(new Zend_Acl_Resource('library'))
|
|||
->add(new Zend_Acl_Resource('showbuilder'))
|
||||
->add(new Zend_Acl_Resource('auth'))
|
||||
->add(new Zend_Acl_Resource('playouthistory'))
|
||||
->add(new Zend_Acl_Resource('usersettings'));
|
||||
->add(new Zend_Acl_Resource('usersettings'))
|
||||
->add(new Zend_Acl_Resource('audiopreview'));
|
||||
|
||||
/** Creating permissions */
|
||||
$ccAcl->allow('G', 'index')
|
||||
|
@ -48,7 +49,8 @@ $ccAcl->allow('G', 'index')
|
|||
->allow('A', 'playouthistory')
|
||||
->allow('A', 'user')
|
||||
->allow('A', 'systemstatus')
|
||||
->allow('A', 'preference');
|
||||
->allow('A', 'preference')
|
||||
->allow('A', 'audiopreview');
|
||||
|
||||
$aclPlugin = new Zend_Controller_Plugin_Acl($ccAcl);
|
||||
|
||||
|
|
192
airtime_mvc/application/controllers/AudiopreviewController.php
Normal file
192
airtime_mvc/application/controllers/AudiopreviewController.php
Normal file
|
@ -0,0 +1,192 @@
|
|||
<?php
|
||||
|
||||
class AudiopreviewController extends Zend_Controller_Action
|
||||
{
|
||||
public function init()
|
||||
{
|
||||
$ajaxContext = $this->_helper->getHelper('AjaxContext');
|
||||
$ajaxContext->addActionContext('show-preview', 'json')
|
||||
->addActionContext('audio-preview', 'json')
|
||||
->addActionContext('get-show', 'json')
|
||||
->addActionContext('playlist-preview', 'json')
|
||||
->addActionContext('get-playlist', 'json')
|
||||
->initContext();
|
||||
}
|
||||
|
||||
/**
|
||||
* Simply sets up the view to play the required audio track.
|
||||
* Gets the parameters from the request and sets them to the view.
|
||||
*/
|
||||
public function audioPreviewAction()
|
||||
{
|
||||
$audioFileID = $this->_getParam('audioFileID');
|
||||
$audioFileArtist = $this->_getParam('audioFileArtist');
|
||||
$audioFileTitle = $this->_getParam('audioFileTitle');
|
||||
|
||||
$request = $this->getRequest();
|
||||
$baseUrl = $request->getBaseUrl();
|
||||
|
||||
$baseDir = dirname($_SERVER['SCRIPT_FILENAME']);
|
||||
|
||||
$this->view->headScript()->appendFile($baseUrl.'/js/jplayer/preview_jplayer.js?'.filemtime($baseDir.'/js/jplayer/preview_jplayer.js'),'text/javascript');
|
||||
$this->view->headScript()->appendFile($baseUrl.'/js/jplayer/jplayer.playlist.min.js?'.filemtime($baseDir.'/js/jplayer/jplayer.playlist.min.js'),'text/javascript');
|
||||
$this->view->headLink()->appendStylesheet($baseUrl.'/js/jplayer/skin/jplayer.audio-preview.blue.monday.css?'.filemtime($baseDir.'/js/jplayer/skin/jplayer.audio-preview.blue.monday.css'));
|
||||
$this->_helper->layout->setLayout('audioPlayer');
|
||||
|
||||
$logo = Application_Model_Preference::GetStationLogo();
|
||||
if($logo){
|
||||
$this->view->logo = "data:image/png;base64,$logo";
|
||||
} else {
|
||||
$this->view->logo = "$baseUrl/css/images/airtime_logo_jp.png";
|
||||
}
|
||||
$this->view->audioFileID = $audioFileID;
|
||||
$this->view->audioFileArtist = $audioFileArtist;
|
||||
$this->view->audioFileTitle = $audioFileTitle;
|
||||
|
||||
$this->_helper->viewRenderer->setRender('audio-preview');
|
||||
}
|
||||
|
||||
/**
|
||||
* Simply sets up the view to play the required playlist track.
|
||||
* Gets the parameters from the request and sets them to the view.
|
||||
*/
|
||||
public function playlistPreviewAction()
|
||||
{
|
||||
$playlistIndex = $this->_getParam('playlistIndex');
|
||||
$playlistID = $this->_getParam('playlistID');
|
||||
|
||||
$request = $this->getRequest();
|
||||
$baseUrl = $request->getBaseUrl();
|
||||
|
||||
$baseDir = dirname($_SERVER['SCRIPT_FILENAME']);
|
||||
|
||||
$this->view->headScript()->appendFile($baseUrl.'/js/jplayer/preview_jplayer.js?'.filemtime($baseDir.'/js/jplayer/preview_jplayer.js'),'text/javascript');
|
||||
$this->view->headScript()->appendFile($baseUrl.'/js/jplayer/jplayer.playlist.min.js?'.filemtime($baseDir.'/js/jplayer/jplayer.playlist.min.js'),'text/javascript');
|
||||
$this->view->headLink()->appendStylesheet($baseUrl.'/js/jplayer/skin/jplayer.audio-preview.blue.monday.css?'.filemtime($baseDir.'/js/jplayer/skin/jplayer.audio-preview.blue.monday.css'));
|
||||
$this->_helper->layout->setLayout('audioPlayer');
|
||||
|
||||
$logo = Application_Model_Preference::GetStationLogo();
|
||||
if($logo){
|
||||
$this->view->logo = "data:image/png;base64,$logo";
|
||||
} else {
|
||||
$this->view->logo = "$baseUrl/css/images/airtime_logo_jp.png";
|
||||
}
|
||||
$this->view->playlistIndex= $playlistIndex;
|
||||
$this->view->playlistID = $playlistID;
|
||||
|
||||
$this->_helper->viewRenderer->setRender('audio-preview');
|
||||
}
|
||||
|
||||
/**
|
||||
*Function will load and return the contents of the requested playlist.
|
||||
*/
|
||||
public function getPlaylistAction(){
|
||||
// disable the view and the layout
|
||||
$this->view->layout()->disableLayout();
|
||||
$this->_helper->viewRenderer->setNoRender(true);
|
||||
|
||||
$playlistID = $this->_getParam('playlistID');
|
||||
|
||||
if (!isset($playlistID)){
|
||||
return;
|
||||
}
|
||||
|
||||
$pl = new Application_Model_Playlist($playlistID);
|
||||
$result = Array();
|
||||
|
||||
foreach ( $pl->getContents() as $track ){
|
||||
|
||||
$elementMap = array( 'element_title' => isset($track['CcFiles']['track_title'])?$track['CcFiles']['track_title']:"",
|
||||
'element_artist' => isset($track['CcFiles']['artist_name'])?$track['CcFiles']['artist_name']:"",
|
||||
'element_id' => isset($track['id'])?$track['id']:"",
|
||||
'element_position' => isset($track['position'])?$track['position']:"",
|
||||
);
|
||||
$fileExtension = pathinfo($track['CcFiles']['filepath'], PATHINFO_EXTENSION);
|
||||
if ($fileExtension === 'mp3'){
|
||||
$elementMap['element_mp3'] = $track['CcFiles']['gunid'].'.'.$fileExtension;
|
||||
} else if( $fileExtension === 'ogg') {
|
||||
$elementMap['element_oga'] = $track['CcFiles']['gunid'].'.'.$fileExtension;
|
||||
} else {
|
||||
//the media was neither mp3 or ogg
|
||||
}
|
||||
$result[] = $elementMap;
|
||||
}
|
||||
|
||||
$this->_helper->json($result);
|
||||
}
|
||||
|
||||
/**
|
||||
* Simply sets up the view to play the required show track.
|
||||
* Gets the parameters from the request and sets them to the view.
|
||||
*/
|
||||
public function showPreviewAction()
|
||||
{
|
||||
$showID = $this->_getParam('showID');
|
||||
$showIndex = $this->_getParam('showIndex');
|
||||
|
||||
$request = $this->getRequest();
|
||||
$baseUrl = $request->getBaseUrl();
|
||||
|
||||
$baseDir = dirname($_SERVER['SCRIPT_FILENAME']);
|
||||
|
||||
$this->view->headScript()->appendFile($baseUrl.'/js/jplayer/preview_jplayer.js?'.filemtime($baseDir.'/js/jplayer/preview_jplayer.js'),'text/javascript');
|
||||
$this->view->headScript()->appendFile($baseUrl.'/js/jplayer/jplayer.playlist.min.js?'.filemtime($baseDir.'/js/jplayer/jplayer.playlist.min.js'),'text/javascript');
|
||||
$this->view->headLink()->appendStylesheet($baseUrl.'/js/jplayer/skin/jplayer.audio-preview.blue.monday.css?'.filemtime($baseDir.'/js/jplayer/skin/jplayer.audio-preview.blue.monday.css'));
|
||||
$this->_helper->layout->setLayout('audioPlayer');
|
||||
|
||||
$logo = Application_Model_Preference::GetStationLogo();
|
||||
if($logo){
|
||||
$this->view->logo = "data:image/png;base64,$logo";
|
||||
} else {
|
||||
$this->view->logo = "$baseUrl/css/images/airtime_logo_jp.png";
|
||||
}
|
||||
|
||||
$this->view->showID = $showID;
|
||||
$this->view->showIndex = $showIndex;
|
||||
|
||||
$this->_helper->viewRenderer->setRender('audio-preview');
|
||||
}
|
||||
|
||||
/**
|
||||
*Function will load and return the contents of the requested show.
|
||||
*/
|
||||
public function getShowAction()
|
||||
{
|
||||
Logging::log("in audio previews getShowAction");
|
||||
|
||||
// disable the view and the layout
|
||||
$this->view->layout()->disableLayout();
|
||||
$this->_helper->viewRenderer->setNoRender(true);
|
||||
|
||||
$showID = $this->_getParam('showID');
|
||||
|
||||
if (!isset($showID)){
|
||||
return;
|
||||
}
|
||||
|
||||
$showInstance = new Application_Model_ShowInstance($showID);
|
||||
$result = Array();
|
||||
$position = 0;
|
||||
foreach ( $showInstance->getShowListContent() as $track ){
|
||||
|
||||
$elementMap = array( 'element_title' => isset($track['track_title'])?$track['track_title']:"",
|
||||
'element_artist' => isset($track['artist_name'])?$track['artist_name']:"",
|
||||
'element_position' => $position,
|
||||
'element_id' => ++$position,
|
||||
);
|
||||
|
||||
$fileExtension = pathinfo($track['filepath'], PATHINFO_EXTENSION);
|
||||
if ($fileExtension === 'mp3'){
|
||||
$elementMap['element_mp3'] = $track['gunid'].'.'.$fileExtension;
|
||||
} else if( $fileExtension === 'ogg') {
|
||||
$elementMap['element_oga'] = $track['gunid'].'.'.$fileExtension;
|
||||
} else {
|
||||
//the media was neither mp3 or ogg
|
||||
}
|
||||
$result[] = $elementMap;
|
||||
}
|
||||
|
||||
$this->_helper->json($result);
|
||||
|
||||
}
|
||||
}
|
|
@ -198,75 +198,6 @@ class PlaylistController extends Zend_Controller_Action
|
|||
}
|
||||
}
|
||||
|
||||
public function playlistPreviewAction()
|
||||
{
|
||||
$audioFileID = $this->_getParam('audioFileID');
|
||||
$audioFileArtist = $this->_getParam('audioFileArtist');
|
||||
$audioFileTitle = $this->_getParam('audioFileTitle');
|
||||
$playlistIndex = $this->_getParam('playlistIndex');
|
||||
$playlistID = $this->_getParam('playlistID');
|
||||
|
||||
$request = $this->getRequest();
|
||||
$baseUrl = $request->getBaseUrl();
|
||||
|
||||
$baseDir = dirname($_SERVER['SCRIPT_FILENAME']);
|
||||
|
||||
$this->view->headScript()->appendFile($baseUrl.'/js/jplayer/preview_jplayer.js?'.filemtime($baseDir.'/js/jplayer/preview_jplayer.js'),'text/javascript');
|
||||
$this->view->headScript()->appendFile($baseUrl.'/js/jplayer/jplayer.playlist.min.js?'.filemtime($baseDir.'/js/jplayer/jplayer.playlist.min.js'),'text/javascript');
|
||||
$this->view->headLink()->appendStylesheet($baseUrl.'/js/jplayer/skin/jplayer.audio-preview.blue.monday.css?'.filemtime($baseDir.'/js/jplayer/skin/jplayer.audio-preview.blue.monday.css'));
|
||||
$this->_helper->layout->setLayout('audioPlayer');
|
||||
|
||||
$logo = Application_Model_Preference::GetStationLogo();
|
||||
if($logo){
|
||||
$this->view->logo = "data:image/png;base64,$logo";
|
||||
} else {
|
||||
$this->view->logo = "$baseUrl/css/images/airtime_logo_jp.png";
|
||||
}
|
||||
|
||||
$this->view->audioFileID = $audioFileID;
|
||||
$this->view->audioFileArtist = $audioFileArtist;
|
||||
$this->view->audioFileTitle = $audioFileTitle;
|
||||
$this->view->playlistIndex= $playlistIndex;
|
||||
$this->view->playlistID = $playlistID;
|
||||
|
||||
}
|
||||
|
||||
public function getPlaylistAction(){
|
||||
|
||||
// disable the view and the layout
|
||||
$this->view->layout()->disableLayout();
|
||||
$this->_helper->viewRenderer->setNoRender(true);
|
||||
|
||||
$playlistID = $this->_getParam('playlistID');
|
||||
|
||||
if (!isset($playlistID)){
|
||||
return;
|
||||
}
|
||||
|
||||
$pl = new Application_Model_Playlist($playlistID);
|
||||
$result = Array();
|
||||
|
||||
foreach ( $pl->getContents() as $track ){
|
||||
|
||||
$trackMap = array( 'title' => isset($track['CcFiles']['track_title'])?$track['CcFiles']['track_title']:"",
|
||||
'artist' => isset($track['CcFiles']['artist_name'])?$track['CcFiles']['artist_name']:"",
|
||||
'id' => isset($track['id'])?$track['id']:"",
|
||||
'position' => isset($track['position'])?$track['position']:"",
|
||||
);
|
||||
$fileExtension = pathinfo($track['CcFiles']['filepath'], PATHINFO_EXTENSION);
|
||||
if ($fileExtension === 'mp3'){
|
||||
$trackMap['mp3'] = $track['CcFiles']['gunid'].'.'.$fileExtension;
|
||||
} else if( $fileExtension === 'ogg') {
|
||||
$trackMap['oga'] = $track['CcFiles']['gunid'].'.'.$fileExtension;
|
||||
} else {
|
||||
//the media was neither mp3 or ogg
|
||||
}
|
||||
$result[] = $trackMap;
|
||||
}
|
||||
|
||||
$this->_helper->json($result);
|
||||
}
|
||||
|
||||
public function addItemsAction()
|
||||
{
|
||||
$ids = $this->_getParam('ids', array());
|
||||
|
|
|
@ -126,6 +126,7 @@ class Application_Model_ShowBuilder {
|
|||
$row["duration"] = $showEndDT->format("U") - $showStartDT->format("U");
|
||||
$row["title"] = $p_item["show_name"];
|
||||
$row["instance"] = intval($p_item["si_id"]);
|
||||
$row["image"] = '';
|
||||
|
||||
$this->contentDT = $showStartDT;
|
||||
|
||||
|
@ -156,10 +157,11 @@ class Application_Model_ShowBuilder {
|
|||
$this->isCurrent($startsEpoch, min($endsEpoch, $showEndEpoch), $row);
|
||||
|
||||
$row["id"] = intval($p_item["sched_id"]);
|
||||
$row["image"] = '<img src="/css/images/icon_audioclip.png">';
|
||||
$row["instance"] = intval($p_item["si_id"]);
|
||||
$row["starts"] = $schedStartDT->format("H:i:s");
|
||||
$row["ends"] = $schedEndDT->format("H:i:s");
|
||||
|
||||
|
||||
$formatter = new LengthFormatter($p_item['file_length']);
|
||||
$row['runtime'] = $formatter->format();
|
||||
|
||||
|
@ -177,12 +179,14 @@ class Application_Model_ShowBuilder {
|
|||
//show is empty or is a special kind of show (recording etc)
|
||||
else if (intval($p_item["si_record"]) === 1) {
|
||||
$row["record"] = true;
|
||||
$row["image"] = '';
|
||||
}
|
||||
else {
|
||||
|
||||
$row["empty"] = true;
|
||||
$row["id"] = 0 ;
|
||||
$row["instance"] = intval($p_item["si_id"]);
|
||||
$row["image"] = '';
|
||||
}
|
||||
|
||||
return $row;
|
||||
|
@ -201,7 +205,7 @@ class Application_Model_ShowBuilder {
|
|||
|
||||
$timeFilled = new TimeFilledFormatter($runtime);
|
||||
$row["fRuntime"] = $timeFilled->format();
|
||||
|
||||
$row["image"] = '';
|
||||
return $row;
|
||||
}
|
||||
|
||||
|
@ -293,7 +297,6 @@ class Application_Model_ShowBuilder {
|
|||
}
|
||||
|
||||
if (!$this->hasCurrent) {
|
||||
|
||||
}
|
||||
|
||||
return $display_items;
|
||||
|
|
|
@ -1,11 +1,17 @@
|
|||
<div id="jquery_jplayer_1" class="jp-jplayer"></div>
|
||||
<div id="jp_container_1" class="jp-audio">
|
||||
<span class='testing'></span>
|
||||
<?php if (isset($this->playlistID)) { ?>
|
||||
<span class='playlistID'><?php echo "$this->playlistID" ?></span>
|
||||
<span class='playlistIndex'><?php echo "$this->playlistIndex" ?></span>
|
||||
<?php } elseif (isset($this->audioFileID)) { ?>
|
||||
<span class='audioFileID'><?php echo "$this->audioFileID" ?></span>
|
||||
<span class='audioFileTitle'><?php echo "$this->audioFileTitle" ?></span>
|
||||
<span class='audioFileArtist'><?php echo "$this->audioFileArtist" ?></span>
|
||||
<span class='playlistID'><?php echo "$this->playlistID" ?></span>
|
||||
<span class='playlistIndex'><?php echo "$this->playlistIndex" ?></span>
|
||||
|
||||
<?php } elseif (isset($this->showID)) { ?>
|
||||
<span class='showID'><?php echo "$this->showID" ?></span>
|
||||
<span class='showIndex'><?php echo "$this->showIndex" ?></span>
|
||||
<?php } ?>
|
||||
<div class="jp-type-playlist">
|
||||
<div class="jp-gui jp-interface">
|
||||
<ul class="jp-controls">
|
Loading…
Add table
Add a link
Reference in a new issue