Merge branch 'devel' of dev.sourcefabric.org:airtime into devel
This commit is contained in:
commit
335f3a9dfe
|
@ -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);
|
||||
|
||||
|
|
|
@ -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);
|
||||
|
||||
}
|
||||
}
|
|
@ -18,31 +18,66 @@ class DashboardController extends Zend_Controller_Action
|
|||
|
||||
public function disconnectSourceAction(){
|
||||
$request = $this->getRequest();
|
||||
|
||||
$sourcename = $request->getParam('sourcename');
|
||||
$data = array("sourcename"=>$sourcename);
|
||||
Application_Model_RabbitMq::SendMessageToPypo("disconnect_source", $data);
|
||||
|
||||
$userInfo = Zend_Auth::getInstance()->getStorage()->read();
|
||||
$user = new Application_Model_User($userInfo->id);
|
||||
|
||||
$show = Application_Model_Show::GetCurrentShow();
|
||||
|
||||
$show_id = isset($show['id'])?$show['id']:0;
|
||||
|
||||
$source_connected = Application_Model_Preference::GetSourceStatus($sourcename);
|
||||
|
||||
if($user->canSchedule($show_id) && $source_connected){
|
||||
$data = array("sourcename"=>$sourcename);
|
||||
Application_Model_RabbitMq::SendMessageToPypo("disconnect_source", $data);
|
||||
}else{
|
||||
if($source_connected){
|
||||
$this->view->error = "You don't have permission to disconnect source.";
|
||||
}else{
|
||||
$this->view->error = "There is no source connected to this input.";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public function switchSourceAction(){
|
||||
$request = $this->getRequest();
|
||||
|
||||
$sourcename = $this->_getParam('sourcename');
|
||||
$current_status = $this->_getParam('status');
|
||||
$change_status_to = "on";
|
||||
|
||||
if(strtolower($current_status) == "on"){
|
||||
$change_status_to = "off";
|
||||
$userInfo = Zend_Auth::getInstance()->getStorage()->read();
|
||||
$user = new Application_Model_User($userInfo->id);
|
||||
|
||||
$show = Application_Model_Show::GetCurrentShow();
|
||||
$show_id = isset($show['id'])?$show['id']:0;
|
||||
|
||||
$source_connected = Application_Model_Preference::GetSourceStatus($sourcename);
|
||||
|
||||
if($user->canSchedule($show_id) && ($source_connected || $sourcename == 'scheduled_play')){
|
||||
|
||||
$change_status_to = "on";
|
||||
|
||||
if(strtolower($current_status) == "on"){
|
||||
$change_status_to = "off";
|
||||
}
|
||||
|
||||
$data = array("sourcename"=>$sourcename, "status"=>$change_status_to);
|
||||
Application_Model_RabbitMq::SendMessageToPypo("switch_source", $data);
|
||||
if(strtolower($current_status) == "on"){
|
||||
Application_Model_Preference::SetSourceSwitchStatus($sourcename, "off");
|
||||
$this->view->status = "OFF";
|
||||
}else{
|
||||
Application_Model_Preference::SetSourceSwitchStatus($sourcename, "on");
|
||||
$this->view->status = "ON";
|
||||
}
|
||||
}
|
||||
|
||||
$data = array("sourcename"=>$sourcename, "status"=>$change_status_to);
|
||||
Application_Model_RabbitMq::SendMessageToPypo("switch_source", $data);
|
||||
if(strtolower($current_status) == "on"){
|
||||
Application_Model_Preference::SetSourceSwitchStatus($sourcename, "off");
|
||||
$this->view->status = "OFF";
|
||||
}else{
|
||||
Application_Model_Preference::SetSourceSwitchStatus($sourcename, "on");
|
||||
$this->view->status = "ON";
|
||||
else{
|
||||
if($source_connected){
|
||||
$this->view->error = "You don't have permission to switch source.";
|
||||
}else{
|
||||
$this->view->error = "There is no source connected to this input.";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -10,7 +10,7 @@ class IndexController extends Zend_Controller_Action
|
|||
|
||||
public function indexAction()
|
||||
{
|
||||
$this->_forward('index', 'login');
|
||||
$this->_forward('index', 'showbuilder');
|
||||
}
|
||||
|
||||
public function mainAction()
|
||||
|
|
|
@ -73,8 +73,6 @@ class LibraryController extends Zend_Controller_Action
|
|||
|
||||
public function contextMenuAction()
|
||||
{
|
||||
global $CC_CONFIG;
|
||||
|
||||
$id = $this->_getParam('id');
|
||||
$type = $this->_getParam('type');
|
||||
//playlist||timeline
|
||||
|
|
|
@ -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());
|
||||
|
|
|
@ -12,6 +12,7 @@ class ShowbuilderController extends Zend_Controller_Action
|
|||
->addActionContext('builder-dialog', 'json')
|
||||
->addActionContext('check-builder-feed', 'json')
|
||||
->addActionContext('builder-feed', 'json')
|
||||
->addActionContext('context-menu', 'json')
|
||||
->initContext();
|
||||
}
|
||||
|
||||
|
@ -94,6 +95,28 @@ class ShowbuilderController extends Zend_Controller_Action
|
|||
$this->_helper->actionStack('library', 'library');
|
||||
$this->_helper->actionStack('builder', 'showbuilder');
|
||||
}
|
||||
|
||||
public function contextMenuAction()
|
||||
{
|
||||
$id = $this->_getParam('id');
|
||||
$now = time();
|
||||
|
||||
$request = $this->getRequest();
|
||||
$baseUrl = $request->getBaseUrl();
|
||||
$menu = array();
|
||||
|
||||
$userInfo = Zend_Auth::getInstance()->getStorage()->read();
|
||||
$user = new Application_Model_User($userInfo->id);
|
||||
|
||||
$item = CcScheduleQuery::create()->findPK($id);
|
||||
$instance = $item->getCcShowInstances();
|
||||
|
||||
if ($now < intval($item->getDbStarts("U")) && $user->canSchedule($instance->getDbShowId())) {
|
||||
$menu["del"] = array("name"=> "Delete", "icon" => "delete", "url" => "/showbuilder/schedule-remove");
|
||||
}
|
||||
|
||||
$this->view->items = $menu;
|
||||
}
|
||||
|
||||
public function builderAction() {
|
||||
|
||||
|
|
|
@ -13,11 +13,10 @@
|
|||
<?php echo $this->versionNotify();
|
||||
$sss = $this->SourceSwitchStatus();
|
||||
$scs = $this->SourceConnectionStatus();
|
||||
$isAdmin = $this->isAdmin();
|
||||
?>
|
||||
<?php echo $this->partial('partialviews/header.phtml', array("user" => $this->loggedInAs(), "is_trial"=>$this->isTrial(), "trial_remain"=> $this->trialRemaining(),
|
||||
"live_dj_switch"=>$sss['live_dj'], "live_dj_connection"=>$scs['live_dj'], "master_dj_switch"=>$sss['master_dj'], "master_dj_connection"=>$scs['master_dj'],
|
||||
"scheduled_play_switch"=>$sss['scheduled_play'], "isAdmin"=>$isAdmin)) ?>
|
||||
"scheduled_play_switch"=>$sss['scheduled_play'])) ?>
|
||||
|
||||
<?php $partial = array('menu.phtml', 'default');
|
||||
$this->navigation()->menu()->setPartial($partial); ?>
|
||||
|
|
|
@ -14,12 +14,10 @@
|
|||
<?php echo $this->versionNotify();
|
||||
$sss = $this->SourceSwitchStatus();
|
||||
$scs = $this->SourceConnectionStatus();
|
||||
$isAdmin = $this->isAdmin();
|
||||
?>
|
||||
<?php echo $this->partial('partialviews/header.phtml', array("user" => $this->loggedInAs(), "is_trial"=>$this->isTrial(), "trial_remain"=> $this->trialRemaining(),
|
||||
"live_dj_switch"=>$sss['live_dj'], "live_dj_connection"=>$scs['live_dj'], "master_dj_switch"=>$sss['master_dj'], "master_dj_connection"=>$scs['master_dj'],
|
||||
"scheduled_play_switch"=>$sss['scheduled_play'], "isAdmin"=>$isAdmin)) ?>
|
||||
|
||||
"scheduled_play_switch"=>$sss['scheduled_play'])) ?>
|
||||
<?php $partial = array('menu.phtml', 'default');
|
||||
$this->navigation()->menu()->setPartial($partial); ?>
|
||||
|
||||
|
|
|
@ -14,11 +14,10 @@
|
|||
<?php echo $this->versionNotify();
|
||||
$sss = $this->SourceSwitchStatus();
|
||||
$scs = $this->SourceConnectionStatus();
|
||||
$isAdmin = $this->isAdmin();
|
||||
?>
|
||||
<?php echo $this->partial('partialviews/header.phtml', array("user" => $this->loggedInAs(), "is_trial"=>$this->isTrial(), "trial_remain"=> $this->trialRemaining(),
|
||||
"live_dj_switch"=>$sss['live_dj'], "live_dj_connection"=>$scs['live_dj'], "master_dj_switch"=>$sss['master_dj'], "master_dj_connection"=>$scs['master_dj'],
|
||||
"scheduled_play_switch"=>$sss['scheduled_play'], "isAdmin"=>$isAdmin)) ?>
|
||||
"scheduled_play_switch"=>$sss['scheduled_play'])) ?>
|
||||
|
||||
<?php $partial = array('menu.phtml', 'default');
|
||||
$this->navigation()->menu()->setPartial($partial); ?>
|
||||
|
|
|
@ -14,11 +14,10 @@
|
|||
<?php echo $this->versionNotify();
|
||||
$sss = $this->SourceSwitchStatus();
|
||||
$scs = $this->SourceConnectionStatus();
|
||||
$isAdmin = $this->isAdmin();
|
||||
?>
|
||||
<?php echo $this->partial('partialviews/header.phtml', array("user" => $this->loggedInAs(), "is_trial"=>$this->isTrial(), "trial_remain"=> $this->trialRemaining(),
|
||||
"live_dj_switch"=>$sss['live_dj'], "live_dj_connection"=>$scs['live_dj'], "master_dj_switch"=>$sss['master_dj'], "master_dj_connection"=>$scs['master_dj'],
|
||||
"scheduled_play_switch"=>$sss['scheduled_play'], "isAdmin"=>$isAdmin)) ?>
|
||||
"scheduled_play_switch"=>$sss['scheduled_play'])) ?>
|
||||
|
||||
<?php $partial = array('menu.phtml', 'default');
|
||||
$this->navigation()->menu()->setPartial($partial); ?>
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -30,6 +30,10 @@ class Application_Model_User {
|
|||
public function isHost($showId) {
|
||||
return $this->isUserType(UTYPE_HOST, $showId);
|
||||
}
|
||||
|
||||
public function isPM() {
|
||||
return $this->isUserType(UTYPE_PROGRAM_MANAGER);
|
||||
}
|
||||
|
||||
public function isAdmin() {
|
||||
return $this->isUserType(UTYPE_ADMIN);
|
||||
|
|
|
@ -1,11 +0,0 @@
|
|||
<?php
|
||||
|
||||
class Airtime_View_Helper_IsAdmin extends Zend_View_Helper_Abstract
|
||||
{
|
||||
public function isAdmin()
|
||||
{
|
||||
$userInfo = Zend_Auth::getInstance()->getStorage()->read();
|
||||
$user = new Application_Model_User($userInfo->id);
|
||||
return $user->isAdmin();
|
||||
}
|
||||
}
|
|
@ -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">
|
|
@ -1,3 +1,3 @@
|
|||
<div id="import_status" style="display:none">File import in progress...</div>
|
||||
<div id="import_status" class="library_import" style="display:none">File import in progress... <img src="/css/images/file_import_loader.gif"></img></div>
|
||||
<table id="library_display" cellpadding="0" cellspacing="0" class="datatable"></table>
|
||||
|
||||
|
|
|
@ -27,25 +27,25 @@
|
|||
<div id="scheduled_play_div">
|
||||
Scheduled Play
|
||||
<div class="line-to-on-air off"></div>
|
||||
<a href="#" id="scheduled_play" class="source-switch-button" onclick="<?php echo ($this->isAdmin)?"setSwitchListener(this);":"return false"?>"><span><?php echo $this->scheduled_play_switch?></span></a>
|
||||
<a href="#" id="scheduled_play" class="source-switch-button" onclick="setSwitchListener(this);"><span><?php echo $this->scheduled_play_switch?></span></a>
|
||||
<div class="line-to-switch off"></div>
|
||||
</div>
|
||||
</li>
|
||||
<li>
|
||||
<div id="live_dj_div">
|
||||
<?php if($this->isAdmin){?><a id="live_dj" class="source-kick-button" onclick="kickSource(this)"></a><?php }?>
|
||||
<a id="live_dj" class="source-kick-button" onclick="kickSource(this)"></a>
|
||||
Live DJ
|
||||
<div class="line-to-on-air off"></div>
|
||||
<a href="#" id="live_dj" class="source-switch-button" onclick="<?php echo ($this->isAdmin)?"setSwitchListener(this);":"return false"?>"><span><?php echo $this->live_dj_switch?></span></a>
|
||||
<a href="#" id="live_dj" class="source-switch-button" onclick="setSwitchListener(this);"><span><?php echo $this->live_dj_switch?></span></a>
|
||||
<div class="line-to-switch off"></div>
|
||||
</div>
|
||||
</li>
|
||||
<li>
|
||||
<div id="master_dj_div">
|
||||
<?php if($this->isAdmin){?><a id="master_dj" class="source-kick-button" onclick="kickSource(this)"></a><?php }?>
|
||||
<a id="master_dj" class="source-kick-button" onclick="kickSource(this)"></a>
|
||||
Master DJ
|
||||
<div class="line-to-on-air off"></div>
|
||||
<a href="#" id="master_dj" class="source-switch-button" onclick="<?php echo ($this->isAdmin)?"setSwitchListener(this);":"return false"?>"><span><?php echo $this->master_dj_switch?></span></a>
|
||||
<a href="#" id="master_dj" class="source-switch-button" onclick="setSwitchListener(this);"><span><?php echo $this->master_dj_switch?></span></a>
|
||||
<div class="line-to-switch off"></div>
|
||||
</div>
|
||||
</li>
|
||||
|
|
|
@ -4,18 +4,25 @@ if (count($items)) : ?>
|
|||
<?php $i = 0; ?>
|
||||
<?php foreach($items as $item) : ?>
|
||||
<li class="ui-state-default" id="spl_<?php echo $item["id"] ?>" unqid="<?php echo $item["CcFiles"]["gunid"]."_".$item["id"]; ?>">
|
||||
<div class="list-item-container">
|
||||
<div class="list-item-container">
|
||||
|
||||
<?php if ($item["CcFiles"]['file_exists']):?>
|
||||
<div class="big_play" audioFile="<?php echo $item["CcFiles"]["gunid"].".".pathinfo($item["CcFiles"]['filepath'], PATHINFO_EXTENSION); ?>">
|
||||
<span class="ui-icon ui-icon-play"></span>
|
||||
</div>
|
||||
<?php else: ?>
|
||||
<div class="big_play ui-state-hover">
|
||||
<span class="ui-icon ui-icon-alert"></span>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
|
||||
<div class="text-row top">
|
||||
<span class="spl_playlength"><?php echo $item["cliplength"] ?></span>
|
||||
<span class="spl_cue ui-state-default"></span>
|
||||
<span class="spl_title"><?php echo $item["CcFiles"]['track_title'] ?></span>
|
||||
</div>
|
||||
<div class="text-row">
|
||||
<span class="spl_artist"><?php echo $item["CcFiles"]['artist_name'] ?></span>
|
||||
<span class="spl_artist"><?php echo ($item["CcFiles"]['file_exists'])?"":"<img src='/css/images/warning-icon.png'>" ?></span>
|
||||
<span class="spl_artist"><?php echo $item["CcFiles"]['artist_name'] ?></span>
|
||||
<span class="spl_offset"><?php echo $item["offset"]?></span>
|
||||
</div>
|
||||
<?php //create the crossfade icon.
|
||||
|
|
Binary file not shown.
After Width: | Height: | Size: 2.2 KiB |
Binary file not shown.
Before Width: | Height: | Size: 11 KiB After Width: | Height: | Size: 6.2 KiB |
|
@ -80,4 +80,13 @@ td.library_track,
|
|||
td.library_sr,
|
||||
td.library_bitrate {
|
||||
text-align: right;
|
||||
}
|
||||
|
||||
.library_import {
|
||||
padding-bottom: 5px;
|
||||
}
|
||||
|
||||
.library_import img {
|
||||
vertical-align: middle;
|
||||
padding-left: 5px;
|
||||
}
|
|
@ -159,14 +159,10 @@
|
|||
background: -moz-linear-gradient(top, #3b3b3b 0, #292929 100%);
|
||||
background: -webkit-gradient(linear, left top, left bottom, color-stop(0, #3b3b3b), color-stop(100%, #292929));
|
||||
}
|
||||
#spl_sortable div.big_play .ui-icon-play {
|
||||
#spl_sortable div.big_play .ui-icon {
|
||||
margin: 17px 0 0 1px;
|
||||
}
|
||||
|
||||
#spl_sortable div.big_play .ui-icon-pause {
|
||||
margin: 17px 0 0 1px;
|
||||
}
|
||||
|
||||
#spl_sortable div.big_play:hover .ui-icon-play, #spl_sortable div.big_play:hover .ui-icon-pause {
|
||||
background-image:url(redmond/images/ui-icons_ff5d1a_256x240.png);
|
||||
}
|
||||
|
|
|
@ -16,6 +16,69 @@ function adjustDateToServerDate(date, serverTimezoneOffset){
|
|||
|
||||
/* date object has been shifted to artificial UTC time. Now let's
|
||||
* shift it to the server's timezone */
|
||||
|
||||
return date;
|
||||
}
|
||||
|
||||
/**
|
||||
*handle to the jplayer window
|
||||
*/
|
||||
var _preview_window = null;
|
||||
|
||||
/**
|
||||
*Gets the info from the view when menu action play choosen and opens the jplayer window.
|
||||
*/
|
||||
function openAudioPreview(p_event) {
|
||||
p_event.stopPropagation();
|
||||
|
||||
var audioFileID = $(this).attr('audioFile');
|
||||
var playlistID = $('#pl_id:first').attr('value');
|
||||
var playlistIndex = $(this).parent().parent().attr('id');
|
||||
playlistIndex = playlistIndex.substring(4); //remove the spl_
|
||||
|
||||
open_playlist_preview(playlistID, playlistIndex);
|
||||
}
|
||||
|
||||
function open_audio_preview(audioFileID, audioFileTitle, audioFileArtist) {
|
||||
openPreviewWindow('audiopreview/audio-preview/audioFileID/'+audioFileID+'/audioFileArtist/'+audioFileArtist+'/audioFileTitle/'+audioFileTitle);
|
||||
_preview_window.focus();
|
||||
}
|
||||
/**
|
||||
*Opens a jPlayer window for the specified info, for either an audio file or playlist.
|
||||
*If audioFile, audioFileTitle, audioFileArtist is supplied the jplayer opens for one file
|
||||
*Otherwise the playlistID and playlistIndex was supplied and a playlist is played starting with the
|
||||
*given index.
|
||||
*/
|
||||
function open_playlist_preview(p_playlistID, p_playlistIndex) {
|
||||
if (p_playlistIndex == undefined) //Use a resonable default.
|
||||
p_playlistIndex = 0;
|
||||
|
||||
|
||||
if (_preview_window != null && !_preview_window.closed)
|
||||
_preview_window.playAllPlaylist(p_playlistID, p_playlistIndex);
|
||||
else
|
||||
openPreviewWindow('audiopreview/playlist-preview/playlistIndex/'+p_playlistIndex+'/playlistID/'+p_playlistID);
|
||||
_preview_window.focus();
|
||||
}
|
||||
|
||||
/**
|
||||
*Opens a jPlayer window for the specified info, for either an audio file or playlist.
|
||||
*If audioFile, audioFileTitle, audioFileArtist is supplied the jplayer opens for one file
|
||||
*Otherwise the playlistID and playlistIndex was supplied and a playlist is played starting with the
|
||||
*given index.
|
||||
*/
|
||||
function open_show_preview(p_showID, p_showIndex) {
|
||||
if (_preview_window != null && !_preview_window.closed)
|
||||
_preview_window.playAllShow(p_showID, p_showIndex);
|
||||
else
|
||||
openPreviewWindow('audiopreview/show-preview/showID/'+p_showID+'/showIndex/'+p_showIndex);
|
||||
_preview_window.focus();
|
||||
}
|
||||
|
||||
function openPreviewWindow(url) {
|
||||
//$.post(baseUri+'Playlist/audio-preview-player', {fileName: fileName, cueIn: cueIn, cueOut: cueOut, fadeIn: fadeIn, fadeInFileName: fadeInFileName, fadeOut: fadeOut, fadeOutFileName: fadeOutFileName})
|
||||
_preview_window = window.open(url, 'Audio Player', 'width=450,height=800');
|
||||
//Set the play button to pause.
|
||||
//var elemID = "spl_"+elemIndexString;
|
||||
//$('#'+elemID+' div.list-item-container a span').attr("class", "ui-icon ui-icon-pause");
|
||||
return false;
|
||||
}
|
|
@ -343,34 +343,25 @@ function setSwitchListener(ele){
|
|||
var sourcename = $(ele).attr('id')
|
||||
var status_span = $(ele).find("span")
|
||||
var status = status_span.html()
|
||||
var _class = $(ele).parent().find("div.line-to-switch").attr("class")
|
||||
var source_connection_status = false
|
||||
|
||||
// user should be able to turn on/off scheduled_play switch anytime.
|
||||
if(sourcename.indexOf("scheduled_play") > 0 && _class.indexOf("off") > 0){
|
||||
source_connection_status = false
|
||||
}else{
|
||||
source_connection_status = true
|
||||
}
|
||||
|
||||
if(source_connection_status){
|
||||
$.get("/Dashboard/switch-source/format/json/sourcename/"+sourcename+"/status/"+status, function(data){
|
||||
$.get("/Dashboard/switch-source/format/json/sourcename/"+sourcename+"/status/"+status, function(data){
|
||||
if(data.error){
|
||||
alert(data.error);
|
||||
}else{
|
||||
status_span.html(data.status)
|
||||
});
|
||||
}else{
|
||||
alert("The source is not connected to Airtime!")
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
function kickSource(ele){
|
||||
var sourcename = $(ele).attr('id')
|
||||
var source_connection = $(ele).parent().find(".line-to-switch").attr("class")
|
||||
if(source_connection.indexOf("off") > 0){
|
||||
alert("No source is connected to this input.")
|
||||
return false
|
||||
}else{
|
||||
$.get("/Dashboard/disconnect-source/format/json/sourcename/"+sourcename)
|
||||
}
|
||||
|
||||
$.get("/Dashboard/disconnect-source/format/json/sourcename/"+sourcename, function(data){
|
||||
if(data.error){
|
||||
alert(data.error);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
var stream_window = null;
|
||||
|
|
|
@ -43,12 +43,12 @@ var AIRTIME = (function(AIRTIME) {
|
|||
|
||||
libraryInit = function() {
|
||||
var oTable,
|
||||
libContentDiv = $("#library_content");
|
||||
tableHeight = libContentDiv.height() - 140;
|
||||
libContentDiv = $("#library_content");
|
||||
tableHeight = libContentDiv.height() - 140;
|
||||
|
||||
oTable = $('#library_display').dataTable( {
|
||||
|
||||
//put hidden columns at the top to insure they can never be visible on the table through column reordering.
|
||||
//put hidden columns at the top to insure they can never be visible on the table through column reordering.
|
||||
"aoColumns": [
|
||||
/* ftype */ {"sTitle": "", "mDataProp": "ftype", "bSearchable": false, "bVisible": false},
|
||||
/* Checkbox */ {"sTitle": "<input type='checkbox' name='pl_cb_all'>", "mDataProp": "checkbox", "bSortable": false, "bSearchable": false, "sWidth": "25px", "sClass": "library_checkbox"},
|
||||
|
@ -62,7 +62,7 @@ var AIRTIME = (function(AIRTIME) {
|
|||
/* Upload Time */ {"sTitle": "Uploaded", "mDataProp": "utime", "sClass": "library_upload_time"},
|
||||
/* Last Modified */ {"sTitle": "Last Modified", "mDataProp": "mtime", "bVisible": false, "sClass": "library_modified_time"},
|
||||
/* Track Number */ {"sTitle": "Track", "mDataProp": "track_number", "bSearchable": false, "bVisible": false, "sClass": "library_track", "sWidth": "65px"},
|
||||
/* Mood */ {"sTitle": "Mood", "mDataProp": "mood", "bSearchable": false, "bVisible": false, "sClass": "library_mood"},
|
||||
/* Mood */ {"sTitle": "Mood", "mDataProp": "mood", "bSearchable": false, "bVisible": false, "sClass": "library_mood"},
|
||||
/* BPM */ {"sTitle": "BPM", "mDataProp": "bpm", "bSearchable": false, "bVisible": false, "sClass": "library_bpm"},
|
||||
/* Composer */ {"sTitle": "Composer", "mDataProp": "composer", "bSearchable": false, "bVisible": false, "sClass": "library_composer"},
|
||||
/* Website */ {"sTitle": "Website", "mDataProp": "info_url", "bSearchable": false, "bVisible": false, "sClass": "library_url"},
|
||||
|
@ -167,9 +167,9 @@ var AIRTIME = (function(AIRTIME) {
|
|||
$(nRow).find('td.library_type').click(function(){
|
||||
if (aData.ftype === 'playlist' && aData.length !== '0.0'){
|
||||
playlistIndex = $(this).parent().attr('id').substring(3); //remove the pl_
|
||||
open_playlist_preview(aData.audioFile, "", "", playlistIndex, 0);
|
||||
open_playlist_preview(playlistIndex, 0);
|
||||
} else if (aData.ftype === 'audioclip') {
|
||||
open_playlist_preview(aData.audioFile, aData.track_title, aData.artist_name);
|
||||
open_audio_preview(aData.audioFile, aData.track_title, aData.artist_name);
|
||||
}
|
||||
return false;
|
||||
});
|
||||
|
@ -329,6 +329,8 @@ var AIRTIME = (function(AIRTIME) {
|
|||
|
||||
addQtipToSCIcons();
|
||||
|
||||
|
||||
//begin context menu initialization.
|
||||
$.contextMenu({
|
||||
selector: '#library_display td:not(.library_checkbox)',
|
||||
trigger: "left",
|
||||
|
@ -374,9 +376,9 @@ var AIRTIME = (function(AIRTIME) {
|
|||
callback = function() {
|
||||
if (data.ftype === 'playlist' && data.length !== '0.0'){
|
||||
playlistIndex = $(this).parent().attr('id').substring(3); //remove the pl_
|
||||
open_playlist_preview(data.audioFile, "", "", playlistIndex, 0);
|
||||
open_playlist_preview(playlistIndex, 0);
|
||||
} else if (data.ftype === 'audioclip') {
|
||||
open_playlist_preview(data.audioFile, data.track_title, data.artist_name);
|
||||
open_audio_preview(data.audioFile, data.track_title, data.artist_name);
|
||||
}
|
||||
};
|
||||
oItems.play.callback = callback;
|
||||
|
@ -652,50 +654,3 @@ function addQtipToSCIcons(){
|
|||
}
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
*handle to the jplayer window
|
||||
*/
|
||||
var preview_window = null;
|
||||
|
||||
/**
|
||||
*Gets the info from the view when menu action play choosen and opens the jplayer window.
|
||||
*/
|
||||
function openAudioPreview(event) {
|
||||
event.stopPropagation();
|
||||
|
||||
var audioFileID = $(this).attr('audioFile');
|
||||
var playlistID = $('#pl_id:first').attr('value');
|
||||
var playlistIndex = $(this).parent().parent().attr('id');
|
||||
playlistIndex = playlistIndex.substring(4); //remove the spl_
|
||||
|
||||
open_playlist_preview(audioFileID, "", "", playlistID, playlistIndex);
|
||||
}
|
||||
|
||||
/**
|
||||
*Opens a jPlayer window for the specified info, for either an audio file or playlist.
|
||||
*If audioFile, audioFileTitle, audioFileArtist is supplied the jplayer opens for one file
|
||||
*Otherwise the playlistID and playlistIndex was supplied and a playlist is played starting with the
|
||||
*given index.
|
||||
*/
|
||||
function open_playlist_preview(audioFileID, audioFileTitle, audioFileArtist, playlistID, playlistIndex) {
|
||||
if (playlistIndex != undefined) {
|
||||
if (playlistIndex == undefined) //Use a resonable default.
|
||||
playlistIndex = 0;
|
||||
url = 'Playlist/playlist-preview/audioFileID/'+audioFileID+'/playlistIndex/'+playlistIndex+'/playlistID/'+playlistID;
|
||||
} else {
|
||||
url = 'Playlist/playlist-preview/audioFileID/'+audioFileID+'/audioFileArtist/'+audioFileArtist+'/audioFileTitle/'+audioFileTitle;
|
||||
}
|
||||
//$.post(baseUri+'Playlist/audio-preview-player', {fileName: fileName, cueIn: cueIn, cueOut: cueOut, fadeIn: fadeIn, fadeInFileName: fadeInFileName, fadeOut: fadeOut, fadeOutFileName: fadeOutFileName})
|
||||
if (preview_window == null || preview_window.closed || playlistIndex === undefined){
|
||||
preview_window = window.open(url, 'Audio Player', 'width=450,height=800');
|
||||
} else if (!preview_window.closed) {
|
||||
preview_window.playAll(playlistID, playlistIndex);
|
||||
}
|
||||
//Set the play button to pause.
|
||||
//var elemID = "spl_"+elemIndexString;
|
||||
//$('#'+elemID+' div.list-item-container a span').attr("class", "ui-icon ui-icon-pause");
|
||||
|
||||
preview_window.focus();
|
||||
return false;
|
||||
}
|
||||
|
|
|
@ -664,10 +664,10 @@ var AIRTIME = (function(AIRTIME){
|
|||
"class": "pl-loading",
|
||||
"css": {
|
||||
"position": "absolute",
|
||||
"top": offset.top + plHeight/2 - 120,
|
||||
"left": offset.left + plWidth/2 - 120,
|
||||
"height": 128,
|
||||
"width": 128
|
||||
"top": offset.top + plHeight/2 - 32 - 8,
|
||||
"left": offset.left + plWidth/2 - 32 -8,
|
||||
"height": 64,
|
||||
"width": 64
|
||||
}
|
||||
});
|
||||
|
||||
|
@ -752,4 +752,24 @@ $(document).ready(function() {
|
|||
|
||||
AIRTIME.library.libraryInit();
|
||||
AIRTIME.playlist.init();
|
||||
|
||||
pl.find(".ui-icon-alert").qtip({
|
||||
content: {
|
||||
text: "File does not exist on disk..."
|
||||
},
|
||||
position:{
|
||||
adjust: {
|
||||
resize: true,
|
||||
method: "flip flip"
|
||||
},
|
||||
at: "right center",
|
||||
my: "left top",
|
||||
viewport: $(window)
|
||||
},
|
||||
style: {
|
||||
classes: "ui-tooltip-dark"
|
||||
},
|
||||
show: 'mouseover',
|
||||
hide: 'mouseout'
|
||||
});
|
||||
});
|
||||
|
|
|
@ -128,7 +128,8 @@ var AIRTIME = (function(AIRTIME){
|
|||
|
||||
oTable = tableDiv.dataTable( {
|
||||
"aoColumns": [
|
||||
/* checkbox */ {"mDataProp": "allowed", "sTitle": "<input type='checkbox' name='sb_cb_all'>", "sWidth": "15px"},
|
||||
/* checkbox */ {"mDataProp": "allowed", "sTitle": "<input type='checkbox' name='sb_cb_all'>", "sWidth": "15px", "sClass": "sb_checkbox"},
|
||||
/* Type */ {"mDataProp": "image", "sTitle": "", "sClass": "library_image", "sWidth": "25px", "bVisible": true},
|
||||
/* starts */{"mDataProp": "starts", "sTitle": "Start"},
|
||||
/* ends */{"mDataProp": "ends", "sTitle": "End"},
|
||||
/* runtime */{"mDataProp": "runtime", "sTitle": "Duration", "sClass": "library_length"},
|
||||
|
@ -214,6 +215,14 @@ var AIRTIME = (function(AIRTIME){
|
|||
node,
|
||||
cl="";
|
||||
|
||||
//call the context menu so we can prevent the event from propagating.
|
||||
$(nRow).find('td:not(.sb_checkbox)').click(function(e){
|
||||
|
||||
$(this).contextMenu({x: e.pageX, y: e.pageY});
|
||||
|
||||
return false;
|
||||
});
|
||||
|
||||
//save some info for reordering purposes.
|
||||
$(nRow).data({"aData": aData});
|
||||
|
||||
|
@ -250,6 +259,12 @@ var AIRTIME = (function(AIRTIME){
|
|||
$(nRow).addClass(sClass);
|
||||
};
|
||||
|
||||
//add the play function to the library_type td or the speaker
|
||||
$(nRow).find('td.library_image').click(function(){
|
||||
open_show_preview(aData.instance, iDisplayIndex);
|
||||
return false;
|
||||
});
|
||||
|
||||
if (aData.header === true) {
|
||||
cl = 'sb-header';
|
||||
|
||||
|
@ -565,6 +580,53 @@ var AIRTIME = (function(AIRTIME){
|
|||
return false;
|
||||
});
|
||||
|
||||
//begin context menu initialization.
|
||||
$.contextMenu({
|
||||
selector: '#show_builder_table td:not(.sb_checkbox)',
|
||||
trigger: "left",
|
||||
ignoreRightClick: true,
|
||||
|
||||
build: function($el, e) {
|
||||
var data, items, callback, $tr;
|
||||
|
||||
$tr = $el.parent();
|
||||
data = $tr.data("aData");
|
||||
|
||||
function processMenuItems(oItems) {
|
||||
|
||||
//define a delete callback.
|
||||
if (oItems.del !== undefined) {
|
||||
|
||||
callback = function() {
|
||||
AIRTIME.showbuilder.fnRemove([{
|
||||
id: data.id,
|
||||
timestamp: data.timestamp,
|
||||
instance: data.instance
|
||||
}]);
|
||||
};
|
||||
|
||||
oItems.del.callback = callback;
|
||||
}
|
||||
|
||||
items = oItems;
|
||||
}
|
||||
|
||||
request = $.ajax({
|
||||
url: "/showbuilder/context-menu",
|
||||
type: "GET",
|
||||
data: {id : data.id, format: "json"},
|
||||
dataType: "json",
|
||||
async: false,
|
||||
success: function(json){
|
||||
processMenuItems(json.items);
|
||||
}
|
||||
});
|
||||
|
||||
return {
|
||||
items: items
|
||||
};
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
mod.init = function(oTable) {
|
||||
|
|
|
@ -1,27 +1,38 @@
|
|||
var playlist_jplayer;
|
||||
var idToPostionLookUp;
|
||||
var _playlist_jplayer;
|
||||
var _idToPostionLookUp;
|
||||
|
||||
/**
|
||||
*When the page loads the ready function will get all the data it can from the hidden span elements
|
||||
*and call one of three functions depending on weather the window was open to play an audio file,
|
||||
*or a playlist or a show.
|
||||
*/
|
||||
$(document).ready(function(){
|
||||
var audioFileID = $('.audioFileID').text();
|
||||
var playlistID = $('.playlistID').text();
|
||||
var playlistIndex = $('.playlistIndex').text();
|
||||
playlist_jplayer = new jPlayerPlaylist({
|
||||
|
||||
_playlist_jplayer = new jPlayerPlaylist({
|
||||
jPlayer: "#jquery_jplayer_1",
|
||||
cssSelectorAncestor: "#jp_container_1"
|
||||
},[], //array of songs will be filled with below's json call
|
||||
{
|
||||
swfPath: "/js/jplayer",
|
||||
supplied: "mp3, oga",
|
||||
//supplied: "mp3,oga",
|
||||
wmode: "window"
|
||||
});
|
||||
|
||||
$.jPlayer.timeFormat.showHour = true;
|
||||
|
||||
if (playlistID != undefined && playlistID !== "")
|
||||
playAll(playlistID, playlistIndex);
|
||||
else
|
||||
var audioFileID = $('.audioFileID').text();
|
||||
var playlistID = $('.playlistID').text();
|
||||
var playlistIndex = $('.playlistIndex').text();
|
||||
var showID = $('.showID').text();
|
||||
var showIndex = $('.showIndex').text();
|
||||
|
||||
if (playlistID != "" && playlistID !== ""){
|
||||
playAllPlaylist(playlistID, playlistIndex);
|
||||
}else if (audioFileID != "") {
|
||||
playOne(audioFileID);
|
||||
|
||||
}else if (showID != "") {
|
||||
playAllShow(showID, showIndex);
|
||||
}
|
||||
});
|
||||
|
||||
/**
|
||||
|
@ -30,67 +41,103 @@ $(document).ready(function(){
|
|||
* - Update the playlistIndex to the position in the pllist to start playing.
|
||||
* - Select the element played from and start playing. If playlist is null then start at index 0.
|
||||
**/
|
||||
function playAll(playlistID, playlistIndex) {
|
||||
function playAllPlaylist(p_playlistID, p_playlistIndex) {
|
||||
var viewsPlaylistID = $('.playlistID').text();
|
||||
|
||||
if ( idToPostionLookUp !== undefined && viewsPlaylistID == playlistID ) {
|
||||
play(playlistIndex);
|
||||
if ( _idToPostionLookUp !== undefined && viewsPlaylistID == p_playlistID ) {
|
||||
play(p_playlistIndex);
|
||||
}else {
|
||||
idToPostionLookUp = Array();
|
||||
$.getJSON("/playlist/get-playlist/playlistID/"+playlistID, function(data){ // get the JSON array produced by my PHP
|
||||
var myPlaylist = new Array();
|
||||
var media;
|
||||
var index;
|
||||
|
||||
for(index in data){
|
||||
console.log(data[index]);
|
||||
if (data[index]['mp3'] != undefined){
|
||||
media = {title: data[index]['title'],
|
||||
artist: data[index]['artist'],
|
||||
mp3:"/api/get-media/fileID/"+data[index]['mp3']
|
||||
};
|
||||
}else if (data[index]['oga'] != undefined) {
|
||||
media = {title: data[index]['title'],
|
||||
artist: data[index]['artist'],
|
||||
oga:"/api/get-media/fileID/"+data[index]['oga']
|
||||
};
|
||||
}
|
||||
console.log(media);
|
||||
myPlaylist[index] = media;
|
||||
|
||||
idToPostionLookUp[data[index]['id']] = data[index]['position'];
|
||||
}
|
||||
playlist_jplayer.setPlaylist(myPlaylist);
|
||||
playlist_jplayer.option("autoPlay", true);
|
||||
play(playlistIndex);
|
||||
});
|
||||
buildplaylist("/audiopreview/get-playlist/playlistID/"+p_playlistID, p_playlistIndex);
|
||||
}
|
||||
}
|
||||
|
||||
function play(playlistIndex){
|
||||
playlistIndex = idToPostionLookUp[playlistIndex];
|
||||
playlist_jplayer.play(playlistIndex);
|
||||
/**
|
||||
* Sets up the show to play.
|
||||
* checks with the show id given to the show id on the page/view
|
||||
* if the show id and the page or views show id are the same it means the user clicked another
|
||||
* file in the same show, so don't refresh the show content tust play the track from the preloaded show.
|
||||
* if the the ids are different they we'll need to get the show's context so create the uri
|
||||
* and call the controller.
|
||||
**/
|
||||
function playAllShow(p_showID, p_index) {
|
||||
|
||||
var viewsShowID = $('.showID').text();
|
||||
if ( _idToPostionLookUp !== undefined && viewsShowID == p_showID ) {
|
||||
play(p_index);
|
||||
}else {
|
||||
buildplaylist("/audiopreview/get-show/showID/"+p_showID, p_index);
|
||||
}
|
||||
}
|
||||
|
||||
function playOne(audioFileID) {
|
||||
/**
|
||||
* This function will call the AudiopreviewController to get the contents of either a show or playlist
|
||||
* Looping throught the returned contents and creating media for each track.
|
||||
*
|
||||
* Then trigger the jplayer to play the list.
|
||||
*/
|
||||
function buildplaylist(p_url, p_playIndex) {
|
||||
_idToPostionLookUp = Array();
|
||||
$.getJSON(p_url, function(data){ // get the JSON array produced by my PHP
|
||||
var myPlaylist = new Array();
|
||||
var media;
|
||||
var index;
|
||||
for(index in data){
|
||||
|
||||
if (data[index]['element_mp3'] != undefined){
|
||||
media = {title: data[index]['element_title'],
|
||||
artist: data[index]['element_artist'],
|
||||
mp3:"/api/get-media/fileID/"+data[index]['element_mp3']
|
||||
};
|
||||
}else if (data[index]['element_oga'] != undefined) {
|
||||
media = {title: data[index]['element_title'],
|
||||
artist: data[index]['element_artist'],
|
||||
oga:"/api/get-media/fileID/"+data[index]['element_oga']
|
||||
};
|
||||
}
|
||||
myPlaylist[index] = media;
|
||||
|
||||
_idToPostionLookUp[data[index]['element_id']] = data[index]['element_position'];
|
||||
}
|
||||
|
||||
_playlist_jplayer.setPlaylist(myPlaylist);
|
||||
_playlist_jplayer.option("autoPlay", true);
|
||||
play(p_playIndex);
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
*Function simply plays the given index, for playlists index can be different so need to look up the
|
||||
*right index.
|
||||
*/
|
||||
function play(p_playlistIndex){
|
||||
playlistIndex = _idToPostionLookUp[p_playlistIndex];
|
||||
//_playlist_jplayer.select(playlistIndex);
|
||||
_playlist_jplayer.play(playlistIndex);
|
||||
}
|
||||
|
||||
/**
|
||||
* Playing one audio track occurs from the library. This function will create the media, setup
|
||||
* jplayer and play the track.
|
||||
*/
|
||||
function playOne(p_audioFileID) {
|
||||
var playlist = new Array();
|
||||
var fileExtensioin = audioFileID.split('.').pop();
|
||||
var fileExtensioin = p_audioFileID.split('.').pop();
|
||||
|
||||
if (fileExtensioin === 'mp3') {
|
||||
media = {title: $('.audioFileTitle').text() !== 'null' ?$('.audioFileTitle').text():"",
|
||||
artist: $('.audioFileArtist').text() !== 'null' ?$('.audioFileArtist').text():"",
|
||||
mp3:"/api/get-media/fileID/"+audioFileID
|
||||
mp3:"/api/get-media/fileID/"+p_audioFileID
|
||||
};
|
||||
}else if (fileExtensioin === 'ogg' ) {
|
||||
media = {title: $('.audioFileTitle').text() != 'null' ?$('.audioFileTitle').text():"",
|
||||
artist: $('.audioFileArtist').text() != 'null' ?$('.audioFileArtist').text():"",
|
||||
oga:"/api/get-media/fileID/"+audioFileID
|
||||
oga:"/api/get-media/fileID/"+p_audioFileID
|
||||
};
|
||||
}
|
||||
playlist_jplayer.option("autoPlay", true);
|
||||
_playlist_jplayer.option("autoPlay", true);
|
||||
|
||||
playlist[0] = media;
|
||||
//playlist_jplayer.setPlaylist(playlist); --if I use this the player will call _init on the setPlaylist and on the ready
|
||||
playlist_jplayer._initPlaylist(playlist);
|
||||
playlist_jplayer.play(0);
|
||||
//_playlist_jplayer.setPlaylist(playlist); --if I use this the player will call _init on the setPlaylist and on the ready
|
||||
_playlist_jplayer._initPlaylist(playlist);
|
||||
_playlist_jplayer.play(0);
|
||||
}
|
|
@ -105,7 +105,12 @@ span.playlistID {
|
|||
span.playlistIndex {
|
||||
display:none;
|
||||
}
|
||||
|
||||
span.showID {
|
||||
display:none;
|
||||
}
|
||||
span.showIndex {
|
||||
display:none;
|
||||
}
|
||||
/* @group CONTROLS */
|
||||
|
||||
div.jp-controls-holder {
|
||||
|
|
Loading…
Reference in New Issue