CC-2184: Hardcoded CSS path should be relative path instead

This commit is contained in:
denise 2012-10-19 11:09:34 -04:00
parent 7165d1fa2e
commit d32495d100
47 changed files with 366 additions and 340 deletions

View file

@ -43,12 +43,32 @@ class Bootstrap extends Zend_Application_Bootstrap_Bootstrap
$view->doctype('XHTML1_STRICT'); $view->doctype('XHTML1_STRICT');
} }
protected function _initGlobals()
{
$view = $this->getResource('view');
$baseUrl = Application_Common_OsPath::getBaseDir();
$view->headScript()->appendScript("var baseUrl = '$baseUrl'");
$user = Application_Model_User::GetCurrentUser();
if (!is_null($user)){
$userType = $user->getType();
} else {
$userType = "";
}
$view->headScript()->appendScript("var userType = '$userType';");
}
protected function _initHeadLink() protected function _initHeadLink()
{ {
global $CC_CONFIG; global $CC_CONFIG;
$view = $this->getResource('view'); $view = $this->getResource('view');
$baseUrl = Zend_Controller_Front::getInstance()->getBaseUrl();
$baseUrl = Application_Common_OsPath::getBaseDir();
$CC_CONFIG['base_dir'] = $baseUrl;
$view->headLink()->appendStylesheet($baseUrl.'/css/redmond/jquery-ui-1.8.8.custom.css?'.$CC_CONFIG['airtime_version']); $view->headLink()->appendStylesheet($baseUrl.'/css/redmond/jquery-ui-1.8.8.custom.css?'.$CC_CONFIG['airtime_version']);
$view->headLink()->appendStylesheet($baseUrl.'/css/pro_dropdown_3.css?'.$CC_CONFIG['airtime_version']); $view->headLink()->appendStylesheet($baseUrl.'/css/pro_dropdown_3.css?'.$CC_CONFIG['airtime_version']);
@ -63,7 +83,8 @@ class Bootstrap extends Zend_Application_Bootstrap_Bootstrap
global $CC_CONFIG; global $CC_CONFIG;
$view = $this->getResource('view'); $view = $this->getResource('view');
$baseUrl = Zend_Controller_Front::getInstance()->getBaseUrl();
$baseUrl = Application_Common_OsPath::getBaseDir();
$view->headScript()->appendFile($baseUrl.'/js/libs/jquery-1.7.2.min.js?'.$CC_CONFIG['airtime_version'],'text/javascript'); $view->headScript()->appendFile($baseUrl.'/js/libs/jquery-1.7.2.min.js?'.$CC_CONFIG['airtime_version'],'text/javascript');
$view->headScript()->appendFile($baseUrl.'/js/libs/jquery-ui-1.8.18.custom.min.js?'.$CC_CONFIG['airtime_version'],'text/javascript'); $view->headScript()->appendFile($baseUrl.'/js/libs/jquery-ui-1.8.18.custom.min.js?'.$CC_CONFIG['airtime_version'],'text/javascript');
@ -72,7 +93,7 @@ class Bootstrap extends Zend_Application_Bootstrap_Bootstrap
$view->headScript()->appendFile($baseUrl.'/js/jplayer/jquery.jplayer.min.js?'.$CC_CONFIG['airtime_version'], 'text/javascript'); $view->headScript()->appendFile($baseUrl.'/js/jplayer/jquery.jplayer.min.js?'.$CC_CONFIG['airtime_version'], 'text/javascript');
$view->headScript()->appendFile($baseUrl.'/js/sprintf/sprintf-0.7-beta1.js?'.$CC_CONFIG['airtime_version'],'text/javascript'); $view->headScript()->appendFile($baseUrl.'/js/sprintf/sprintf-0.7-beta1.js?'.$CC_CONFIG['airtime_version'],'text/javascript');
$view->headScript()->appendFile($baseUrl.'/js/bootstrap/bootstrap.js?'.$CC_CONFIG['airtime_version'],'text/javascript'); $view->headScript()->appendFile($baseUrl.'/js/bootstrap/bootstrap.js?'.$CC_CONFIG['airtime_version'],'text/javascript');
$view->headScript()->appendScript("var baseUrl='$baseUrl/'"); $view->headScript()->appendScript("var baseUrl='$baseUrl'");
//scripts for now playing bar //scripts for now playing bar
$view->headScript()->appendFile($baseUrl.'/js/airtime/dashboard/helperfunctions.js?'.$CC_CONFIG['airtime_version'],'text/javascript'); $view->headScript()->appendFile($baseUrl.'/js/airtime/dashboard/helperfunctions.js?'.$CC_CONFIG['airtime_version'],'text/javascript');
@ -96,6 +117,15 @@ class Bootstrap extends Zend_Application_Bootstrap_Bootstrap
if (isset($CC_CONFIG['demo']) && $CC_CONFIG['demo'] == 1) { if (isset($CC_CONFIG['demo']) && $CC_CONFIG['demo'] == 1) {
$view->headScript()->appendFile($baseUrl.'/js/libs/google-analytics.js?'.$CC_CONFIG['airtime_version'],'text/javascript'); $view->headScript()->appendFile($baseUrl.'/js/libs/google-analytics.js?'.$CC_CONFIG['airtime_version'],'text/javascript');
} }
if (Application_Model_Preference::GetPlanLevel() != "disabled"
&& !($_SERVER['REQUEST_URI'] == $baseUrl.'/Dashboard/stream-player' ||
strncmp($_SERVER['REQUEST_URI'], $baseUrl.'/audiopreview/audio-preview', strlen($baseUrl.'/audiopreview/audio-preview'))==0)) {
$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');
}
} }
protected function _initViewHelpers() protected function _initViewHelpers()

View file

@ -63,4 +63,11 @@ class Application_Common_OsPath{
return join(DIRECTORY_SEPARATOR, $paths); return join(DIRECTORY_SEPARATOR, $paths);
} }
public static function getBaseDir() {
$baseUrl = dirname($_SERVER['SCRIPT_NAME']);
if (strcmp($baseUrl, '/') ==0) $baseUrl = "";
return $baseUrl;
}
} }

View file

@ -26,8 +26,7 @@ class AudiopreviewController extends Zend_Controller_Action
$audioFileTitle = $this->_getParam('audioFileTitle'); $audioFileTitle = $this->_getParam('audioFileTitle');
$type = $this->_getParam('type'); $type = $this->_getParam('type');
$request = $this->getRequest(); $baseUrl = Application_Common_OsPath::getBaseDir();
$baseUrl = $request->getBaseUrl();
$this->view->headScript()->appendFile( $this->view->headScript()->appendFile(
$baseUrl.'/js/airtime/audiopreview/preview_jplayer.js?'.$CC_CONFIG['airtime_version'], $baseUrl.'/js/airtime/audiopreview/preview_jplayer.js?'.$CC_CONFIG['airtime_version'],
@ -79,8 +78,7 @@ class AudiopreviewController extends Zend_Controller_Action
$playlistIndex = $this->_getParam('playlistIndex'); $playlistIndex = $this->_getParam('playlistIndex');
$playlistID = $this->_getParam('playlistID'); $playlistID = $this->_getParam('playlistID');
$request = $this->getRequest(); $baseUrl = Application_Common_OsPath::getBaseDir();
$baseUrl = $request->getBaseUrl();
$this->view->headScript()->appendFile($baseUrl.'/js/airtime/audiopreview/preview_jplayer.js?'.$CC_CONFIG['airtime_version'],'text/javascript'); $this->view->headScript()->appendFile($baseUrl.'/js/airtime/audiopreview/preview_jplayer.js?'.$CC_CONFIG['airtime_version'],'text/javascript');
$this->view->headScript()->appendFile($baseUrl.'/js/jplayer/jplayer.playlist.min.js?'.$CC_CONFIG['airtime_version'],'text/javascript'); $this->view->headScript()->appendFile($baseUrl.'/js/jplayer/jplayer.playlist.min.js?'.$CC_CONFIG['airtime_version'],'text/javascript');
@ -106,8 +104,7 @@ class AudiopreviewController extends Zend_Controller_Action
$blockIndex = $this->_getParam('blockIndex'); $blockIndex = $this->_getParam('blockIndex');
$blockId = $this->_getParam('blockId'); $blockId = $this->_getParam('blockId');
$request = $this->getRequest(); $baseUrl = Application_Common_OsPath::getBaseDir();
$baseUrl = $request->getBaseUrl();
$this->view->headScript()->appendFile($baseUrl.'/js/airtime/audiopreview/preview_jplayer.js?'.$CC_CONFIG['airtime_version'],'text/javascript'); $this->view->headScript()->appendFile($baseUrl.'/js/airtime/audiopreview/preview_jplayer.js?'.$CC_CONFIG['airtime_version'],'text/javascript');
$this->view->headScript()->appendFile($baseUrl.'/js/jplayer/jplayer.playlist.min.js?'.$CC_CONFIG['airtime_version'],'text/javascript'); $this->view->headScript()->appendFile($baseUrl.'/js/jplayer/jplayer.playlist.min.js?'.$CC_CONFIG['airtime_version'],'text/javascript');
@ -232,8 +229,8 @@ class AudiopreviewController extends Zend_Controller_Action
$showID = $this->_getParam('showID'); $showID = $this->_getParam('showID');
$showIndex = $this->_getParam('showIndex'); $showIndex = $this->_getParam('showIndex');
$request = $this->getRequest(); $baseUrl = dirname($_SERVER['SCRIPT_NAME']);
$baseUrl = $request->getBaseUrl(); if (strcmp($baseUrl, '/') ==0) $baseUrl = "";
$this->view->headScript()->appendFile($baseUrl.'/js/airtime/audiopreview/preview_jplayer.js?'.$CC_CONFIG['airtime_version'],'text/javascript'); $this->view->headScript()->appendFile($baseUrl.'/js/airtime/audiopreview/preview_jplayer.js?'.$CC_CONFIG['airtime_version'],'text/javascript');
$this->view->headScript()->appendFile($baseUrl.'/js/jplayer/jplayer.playlist.min.js?'.$CC_CONFIG['airtime_version'],'text/javascript'); $this->view->headScript()->appendFile($baseUrl.'/js/jplayer/jplayer.playlist.min.js?'.$CC_CONFIG['airtime_version'],'text/javascript');
@ -258,6 +255,7 @@ class AudiopreviewController extends Zend_Controller_Action
*/ */
public function getShowAction() public function getShowAction()
{ {
global $CC_CONFIG;
// disable the view and the layout // disable the view and the layout
$this->view->layout()->disableLayout(); $this->view->layout()->disableLayout();
$this->_helper->viewRenderer->setNoRender(true); $this->_helper->viewRenderer->setNoRender(true);
@ -297,7 +295,7 @@ class AudiopreviewController extends Zend_Controller_Action
throw new Exception("Unknown file type: $mime"); throw new Exception("Unknown file type: $mime");
} }
$elementMap['uri'] = "/api/get-media/file/".$track['item_id']; $elementMap['uri'] = $CC_CONFIG["base_dir"]."/api/get-media/file/".$track['item_id'];
} else { } else {
$elementMap['uri'] = $track['filepath']; $elementMap['uri'] = $track['filepath'];
} }

View file

@ -98,8 +98,7 @@ class DashboardController extends Zend_Controller_Action
{ {
global $CC_CONFIG; global $CC_CONFIG;
$request = $this->getRequest(); $baseUrl = Application_Common_OsPath::getBaseDir();
$baseUrl = $request->getBaseUrl();
$this->view->headLink()->appendStylesheet($baseUrl.'/js/jplayer/skin/jplayer.blue.monday.css?'.$CC_CONFIG['airtime_version']); $this->view->headLink()->appendStylesheet($baseUrl.'/js/jplayer/skin/jplayer.blue.monday.css?'.$CC_CONFIG['airtime_version']);
$this->_helper->layout->setLayout('bare'); $this->_helper->layout->setLayout('bare');
@ -108,7 +107,7 @@ class DashboardController extends Zend_Controller_Action
if ($logo) { if ($logo) {
$this->view->logo = "data:image/png;base64,$logo"; $this->view->logo = "data:image/png;base64,$logo";
} else { } else {
$this->view->logo = "$baseUrl/css/images/airtime_logo_jp.png"; $this->view->logo = $baseUrl."/css/images/airtime_logo_jp.png";
} }
} }

View file

@ -26,7 +26,7 @@ class LibraryController extends Zend_Controller_Action
global $CC_CONFIG; global $CC_CONFIG;
$request = $this->getRequest(); $request = $this->getRequest();
$baseUrl = $request->getBaseUrl(); $baseUrl = Application_Common_OsPath::getBaseDir();
$this->view->headScript()->appendFile($baseUrl.'/js/blockui/jquery.blockUI.js?'.$CC_CONFIG['airtime_version'], 'text/javascript'); $this->view->headScript()->appendFile($baseUrl.'/js/blockui/jquery.blockUI.js?'.$CC_CONFIG['airtime_version'], 'text/javascript');
$this->view->headScript()->appendFile($baseUrl.'/js/contextmenu/jquery.contextMenu.js?'.$CC_CONFIG['airtime_version'], 'text/javascript'); $this->view->headScript()->appendFile($baseUrl.'/js/contextmenu/jquery.contextMenu.js?'.$CC_CONFIG['airtime_version'], 'text/javascript');
@ -142,12 +142,14 @@ class LibraryController extends Zend_Controller_Action
public function contextMenuAction() public function contextMenuAction()
{ {
global $CC_CONFIG;
$id = $this->_getParam('id'); $id = $this->_getParam('id');
$type = $this->_getParam('type'); $type = $this->_getParam('type');
//playlist||timeline //playlist||timeline
$screen = $this->_getParam('screen'); $screen = $this->_getParam('screen');
$request = $this->getRequest();
$baseUrl = $request->getBaseUrl(); $baseUrl = Application_Common_OsPath::getBaseDir();
$menu = array(); $menu = array();
$userInfo = Zend_Auth::getInstance()->getStorage()->read(); $userInfo = Zend_Auth::getInstance()->getStorage()->read();
@ -182,8 +184,8 @@ class LibraryController extends Zend_Controller_Action
} }
} }
if ($isAdminOrPM) { if ($isAdminOrPM) {
$menu["del"] = array("name"=> "Delete", "icon" => "delete", "url" => "/library/delete"); $menu["del"] = array("name"=> "Delete", "icon" => "delete", "url" => $CC_CONFIG['base_dir']."/library/delete");
$menu["edit"] = array("name"=> "Edit Metadata", "icon" => "edit", "url" => "/library/edit-file-md/id/{$id}"); $menu["edit"] = array("name"=> "Edit Metadata", "icon" => "edit", "url" => $CC_CONFIG['base_dir']."/library/edit-file-md/id/{$id}");
} }
$url = $file->getRelativeFileUrl($baseUrl).'/download/true'; $url = $file->getRelativeFileUrl($baseUrl).'/download/true';
@ -208,8 +210,9 @@ class LibraryController extends Zend_Controller_Action
$menu["edit"] = array("name"=> "Edit", "icon" => "edit"); $menu["edit"] = array("name"=> "Edit", "icon" => "edit");
} }
} }
if ($isAdminOrPM || $obj->getCreatorId() == $user->getId()) { if ($isAdminOrPM || $obj->getCreatorId() == $user->getId()) {
$menu["del"] = array("name"=> "Delete", "icon" => "delete", "url" => "/library/delete"); $menu["del"] = array("name"=> "Delete", "icon" => "delete", "url" => $CC_CONFIG['base_dir']."/library/delete");
} }
} elseif ($type == "stream") { } elseif ($type == "stream") {
@ -224,9 +227,9 @@ class LibraryController extends Zend_Controller_Action
} }
if ($isAdminOrPM || $obj->getCreatorId() == $user->getId()) { if ($isAdminOrPM || $obj->getCreatorId() == $user->getId()) {
if ($screen == "playlist") { if ($screen == "playlist") {
$menu["edit"] = array("name"=> "Edit", "icon" => "edit", "url" => "/library/edit-file-md/id/{$id}"); $menu["edit"] = array("name"=> "Edit", "icon" => "edit", "url" => $CC_CONFIG['base_dir']."/library/edit-file-md/id/{$id}");
} }
$menu["del"] = array("name"=> "Delete", "icon" => "delete", "url" => "/library/delete"); $menu["del"] = array("name"=> "Delete", "icon" => "delete", "url" => $CC_CONFIG['base_dir']."/library/delete");
} }
} }
@ -252,7 +255,7 @@ class LibraryController extends Zend_Controller_Action
$text = "Upload to SoundCloud"; $text = "Upload to SoundCloud";
} }
$menu["soundcloud"]["items"]["upload"] = array("name" => $text, "icon" => "soundcloud", "url" => "/library/upload-file-soundcloud/id/{$id}"); $menu["soundcloud"]["items"]["upload"] = array("name" => $text, "icon" => "soundcloud", "url" => $CC_CONFIG['base_dir']."/library/upload-file-soundcloud/id/{$id}");
} }
if (empty($menu)) { if (empty($menu)) {

View file

@ -12,7 +12,11 @@ class LoginController extends Zend_Controller_Action
{ {
global $CC_CONFIG; global $CC_CONFIG;
if (Zend_Auth::getInstance()->hasIdentity()) { $request = $this->getRequest();
if (Zend_Auth::getInstance()->hasIdentity())
{
$this->_redirect('Showbuilder'); $this->_redirect('Showbuilder');
} }
@ -20,8 +24,8 @@ class LoginController extends Zend_Controller_Action
$this->_helper->layout->setLayout('login'); $this->_helper->layout->setLayout('login');
$error = false; $error = false;
$request = $this->getRequest();
$baseUrl = $request->getBaseUrl(); $baseUrl = Application_Common_OsPath::getBaseDir();
$this->view->headScript()->appendFile($baseUrl.'/js/airtime/login/login.js?'.$CC_CONFIG['airtime_version'],'text/javascript'); $this->view->headScript()->appendFile($baseUrl.'/js/airtime/login/login.js?'.$CC_CONFIG['airtime_version'],'text/javascript');
@ -96,8 +100,8 @@ class LoginController extends Zend_Controller_Action
{ {
global $CC_CONFIG; global $CC_CONFIG;
$request = $this->getRequest(); $baseUrl = Application_Common_OsPath::getBaseDir();
$baseUrl = $request->getBaseUrl();
$this->view->headScript()->appendFile($baseUrl.'/js/airtime/login/password-restore.js?'.$CC_CONFIG['airtime_version'],'text/javascript'); $this->view->headScript()->appendFile($baseUrl.'/js/airtime/login/password-restore.js?'.$CC_CONFIG['airtime_version'],'text/javascript');
if (!Application_Model_Preference::GetEnableSystemEmail()) { if (!Application_Model_Preference::GetEnableSystemEmail()) {

View file

@ -15,7 +15,8 @@ class PlayouthistoryController extends Zend_Controller_Action
global $CC_CONFIG; global $CC_CONFIG;
$request = $this->getRequest(); $request = $this->getRequest();
$baseUrl = $request->getBaseUrl();
$baseUrl = Application_Common_OsPath::getBaseDir();
//default time is the last 24 hours. //default time is the last 24 hours.
$now = time(); $now = time();
@ -81,4 +82,5 @@ class PlayouthistoryController extends Zend_Controller_Action
$this->view->iTotalRecords = $r["iTotalRecords"]; $this->view->iTotalRecords = $r["iTotalRecords"];
$this->view->history = $r["history"]; $this->view->history = $r["history"];
} }
} }

View file

@ -15,8 +15,7 @@ class PluploadController extends Zend_Controller_Action
{ {
global $CC_CONFIG; global $CC_CONFIG;
$request = $this->getRequest(); $baseUrl = Application_Common_OsPath::getBaseDir();
$baseUrl = $request->getBaseUrl();
$this->view->headScript()->appendFile($baseUrl.'/js/plupload/plupload.full.min.js?'.$CC_CONFIG['airtime_version'],'text/javascript'); $this->view->headScript()->appendFile($baseUrl.'/js/plupload/plupload.full.min.js?'.$CC_CONFIG['airtime_version'],'text/javascript');
$this->view->headScript()->appendFile($baseUrl.'/js/plupload/jquery.plupload.queue.min.js?'.$CC_CONFIG['airtime_version'],'text/javascript'); $this->view->headScript()->appendFile($baseUrl.'/js/plupload/jquery.plupload.queue.min.js?'.$CC_CONFIG['airtime_version'],'text/javascript');

View file

@ -22,10 +22,11 @@ class PreferenceController extends Zend_Controller_Action
{ {
global $CC_CONFIG; global $CC_CONFIG;
$request = $this->getRequest();
$isSaas = Application_Model_Preference::GetPlanLevel() == 'disabled'?false:true; $isSaas = Application_Model_Preference::GetPlanLevel() == 'disabled'?false:true;
$request = $this->getRequest(); $baseUrl = Application_Common_OsPath::getBaseDir();
$baseUrl = $request->getBaseUrl();
$this->view->headScript()->appendFile($baseUrl.'/js/airtime/preferences/preferences.js?'.$CC_CONFIG['airtime_version'],'text/javascript'); $this->view->headScript()->appendFile($baseUrl.'/js/airtime/preferences/preferences.js?'.$CC_CONFIG['airtime_version'],'text/javascript');
$this->view->statusMsg = ""; $this->view->statusMsg = "";
@ -74,7 +75,9 @@ class PreferenceController extends Zend_Controller_Action
global $CC_CONFIG; global $CC_CONFIG;
$request = $this->getRequest(); $request = $this->getRequest();
$baseUrl = $request->getBaseUrl();
$baseUrl = Application_Common_OsPath::getBaseDir();
Logging::info($baseUrl);
$this->view->headScript()->appendFile($baseUrl.'/js/airtime/preferences/support-setting.js?'.$CC_CONFIG['airtime_version'],'text/javascript'); $this->view->headScript()->appendFile($baseUrl.'/js/airtime/preferences/support-setting.js?'.$CC_CONFIG['airtime_version'],'text/javascript');
$this->view->statusMsg = ""; $this->view->statusMsg = "";
@ -134,8 +137,8 @@ class PreferenceController extends Zend_Controller_Action
global $CC_CONFIG; global $CC_CONFIG;
if(Application_Model_Preference::GetPlanLevel() == 'disabled'){ if(Application_Model_Preference::GetPlanLevel() == 'disabled'){
$request = $this->getRequest();
$baseUrl = $request->getBaseUrl(); $baseUrl = Application_Common_OsPath::getBaseDir();
$this->view->headScript()->appendFile($baseUrl.'/js/serverbrowse/serverbrowser.js?'.$CC_CONFIG['airtime_version'],'text/javascript'); $this->view->headScript()->appendFile($baseUrl.'/js/serverbrowse/serverbrowser.js?'.$CC_CONFIG['airtime_version'],'text/javascript');
$this->view->headScript()->appendFile($baseUrl.'/js/airtime/preferences/musicdirs.js?'.$CC_CONFIG['airtime_version'],'text/javascript'); $this->view->headScript()->appendFile($baseUrl.'/js/airtime/preferences/musicdirs.js?'.$CC_CONFIG['airtime_version'],'text/javascript');
@ -151,7 +154,8 @@ class PreferenceController extends Zend_Controller_Action
global $CC_CONFIG; global $CC_CONFIG;
$request = $this->getRequest(); $request = $this->getRequest();
$baseUrl = $request->getBaseUrl();
$baseUrl = Application_Common_OsPath::getBaseDir();
$this->view->headScript()->appendFile($baseUrl.'/js/airtime/preferences/streamsetting.js?'.$CC_CONFIG['airtime_version'],'text/javascript'); $this->view->headScript()->appendFile($baseUrl.'/js/airtime/preferences/streamsetting.js?'.$CC_CONFIG['airtime_version'],'text/javascript');

View file

@ -784,7 +784,10 @@ class ScheduleController extends Zend_Controller_Action
if ($success) { if ($success) {
$scheduler = new Application_Model_Scheduler(); $scheduler = new Application_Model_Scheduler();
$scheduler->removeGaps($data['add_show_instance_id']); $showInstances = CcShowInstancesQuery::create()->filterByDbShowId($data['add_show_id'])->find();
foreach ($showInstances as $si) {
$scheduler->removeGaps($si->getDbId());
}
$this->view->addNewShow = true; $this->view->addNewShow = true;
$this->view->newForm = $this->view->render('schedule/add-show-form.phtml'); $this->view->newForm = $this->view->render('schedule/add-show-form.phtml');
} else { } else {

View file

@ -18,12 +18,14 @@ class ShowbuilderController extends Zend_Controller_Action
public function indexAction() public function indexAction()
{ {
global $CC_CONFIG; global $CC_CONFIG;
$request = $this->getRequest(); $request = $this->getRequest();
$baseUrl = $request->getBaseUrl();
$user = Application_Model_User::getCurrentUser();
$baseUrl = Application_Common_OsPath::getBaseDir();
$user = Application_Model_User::GetCurrentUser();
$userType = $user->getType(); $userType = $user->getType();
$this->view->headScript()->appendScript("localStorage.setItem( 'user-type', '$userType' );"); $this->view->headScript()->appendScript("localStorage.setItem( 'user-type', '$userType' );");
@ -62,8 +64,7 @@ class ShowbuilderController extends Zend_Controller_Action
$this->view->headLink()->appendStylesheet($baseUrl.'/css/datatables/css/ColVis.css?'.$CC_CONFIG['airtime_version']); $this->view->headLink()->appendStylesheet($baseUrl.'/css/datatables/css/ColVis.css?'.$CC_CONFIG['airtime_version']);
$this->view->headLink()->appendStylesheet($baseUrl.'/css/datatables/css/ColReorder.css?'.$CC_CONFIG['airtime_version']); $this->view->headLink()->appendStylesheet($baseUrl.'/css/datatables/css/ColReorder.css?'.$CC_CONFIG['airtime_version']);
$this->view->headScript()->appendFile($this->view->baseUrl('/js/airtime/library/events/library_showbuilder.js?'.$CC_CONFIG['airtime_version']),'text/javascript'); $this->view->headScript()->appendFile($baseUrl.'/js/airtime/library/events/library_showbuilder.js?'.$CC_CONFIG['airtime_version'],'text/javascript');
$refer_sses = new Zend_Session_Namespace('referrer'); $refer_sses = new Zend_Session_Namespace('referrer');
if ($request->isPost()) { if ($request->isPost()) {
@ -173,6 +174,8 @@ class ShowbuilderController extends Zend_Controller_Action
public function contextMenuAction() public function contextMenuAction()
{ {
global $CC_CONFIG;
$id = $this->_getParam('id'); $id = $this->_getParam('id');
$now = floatval(microtime(true)); $now = floatval(microtime(true));
@ -192,7 +195,7 @@ class ShowbuilderController extends Zend_Controller_Action
if ($now < floatval($item->getDbEnds("U.u")) && $user->canSchedule($instance->getDbShowId())) { if ($now < floatval($item->getDbEnds("U.u")) && $user->canSchedule($instance->getDbShowId())) {
//remove/truncate the item from the schedule //remove/truncate the item from the schedule
$menu["del"] = array("name"=> "Delete", "icon" => "delete", "url" => "/showbuilder/schedule-remove"); $menu["del"] = array("name"=> "Delete", "icon" => "delete", "url" => $CC_CONFIG['base_dir']."/showbuilder/schedule-remove");
} }
$this->view->items = $menu; $this->view->items = $menu;

View file

@ -6,8 +6,7 @@ class SystemstatusController extends Zend_Controller_Action
{ {
global $CC_CONFIG; global $CC_CONFIG;
$request = $this->getRequest(); $baseUrl = Application_Common_OsPath::getBaseDir();
$baseUrl = $request->getBaseUrl();
$this->view->headScript()->appendFile($baseUrl.'/js/airtime/status/status.js?'.$CC_CONFIG['airtime_version'],'text/javascript'); $this->view->headScript()->appendFile($baseUrl.'/js/airtime/status/status.js?'.$CC_CONFIG['airtime_version'],'text/javascript');
} }

View file

@ -18,7 +18,7 @@ class UserController extends Zend_Controller_Action
global $CC_CONFIG; global $CC_CONFIG;
$request = $this->getRequest(); $request = $this->getRequest();
$baseUrl = $request->getBaseUrl(); $baseUrl = Application_Common_OsPath::getBaseDir();
$js_files = array( $js_files = array(
'/js/datatables/js/jquery.dataTables.js?', '/js/datatables/js/jquery.dataTables.js?',

View file

@ -4,6 +4,7 @@ class Application_Form_EditAudioMD extends Zend_Form
{ {
public function init() public function init()
{ {
global $CC_CONFIG;
// Set the method for the display form to POST // Set the method for the display form to POST
$this->setMethod('post'); $this->setMethod('post');
@ -137,7 +138,7 @@ class Application_Form_EditAudioMD extends Zend_Form
'ignore' => true, 'ignore' => true,
'class' => 'btn md-cancel', 'class' => 'btn md-cancel',
'label' => 'Cancel', 'label' => 'Cancel',
'onclick' => 'javascript:document.location.href = "/Library"', 'onclick' => 'javascript:document.location.href="'.$CC_CONFIG['base_dir'].'/Library"',
'decorators' => array( 'decorators' => array(
'ViewHelper' 'ViewHelper'
) )

View file

@ -6,7 +6,9 @@ class Application_Form_Preferences extends Zend_Form
public function init() public function init()
{ {
$this->setAction('/Preference'); global $CC_CONFIG;
$this->setAction($CC_CONFIG['base_dir'] . '/Preference');
$this->setMethod('post'); $this->setMethod('post');
$isSaas = Application_Model_Preference::GetPlanLevel() == 'disabled'?false:true; $isSaas = Application_Model_Preference::GetPlanLevel() == 'disabled'?false:true;

View file

@ -6,6 +6,7 @@
<?php echo $this->headScript() ?> <?php echo $this->headScript() ?>
<?php echo $this->headLink() ?> <?php echo $this->headLink() ?>
<?php echo isset($this->google_analytics)?$this->google_analytics:"" ?> <?php echo isset($this->google_analytics)?$this->google_analytics:"" ?>
<?php global $CC_CONFIG; ?>
</head> </head>
<body> <body>
@ -22,7 +23,7 @@
$this->navigation()->menu()->setPartial($partial); ?> $this->navigation()->menu()->setPartial($partial); ?>
<div class="personal-block solo"> <div class="personal-block solo">
<ul> <ul>
<li><span class="name"><?php echo $this->loggedInAs()?></span> | <a href="/Login/logout">Logout</a></li> <li><span class="name"><?php echo $this->loggedInAs()?></span> | <a href=<?php echo $CC_CONFIG['base_dir'] . "/Login/logout"?>>Logout</a></li>
</ul> </ul>
</div> </div>

View file

@ -500,6 +500,7 @@ class Application_Model_Preference
} else { } else {
$outputArray['NUM_SOUNDCLOUD_TRACKS_UPLOADED'] = NULL; $outputArray['NUM_SOUNDCLOUD_TRACKS_UPLOADED'] = NULL;
} }
$outputArray['STATION_NAME'] = self::GetStationName(); $outputArray['STATION_NAME'] = self::GetStationName();
$outputArray['PHONE'] = self::GetPhone(); $outputArray['PHONE'] = self::GetPhone();
$outputArray['EMAIL'] = self::GetEmail(); $outputArray['EMAIL'] = self::GetEmail();

View file

@ -599,6 +599,7 @@ SQL;
return $res; return $res;
} }
public static function getLibraryColumns() public static function getLibraryColumns()
{ {
return array("id", "track_title", "artist_name", "album_title", return array("id", "track_title", "artist_name", "album_title",
@ -609,9 +610,10 @@ SQL;
"conductor", "replay_gain", "lptime" ); "conductor", "replay_gain", "lptime" );
} }
public static function searchLibraryFiles($datatables) public static function searchLibraryFiles($datatables)
{ {
global $CC_CONFIG;
$con = Propel::getConnection(CcFilesPeer::DATABASE_NAME); $con = Propel::getConnection(CcFilesPeer::DATABASE_NAME);
$displayColumns = self::getLibraryColumns(); $displayColumns = self::getLibraryColumns();
@ -766,14 +768,14 @@ SQL;
// ugly // ugly
if ($type == "au") { if ($type == "au") {
$row['audioFile'] = $row['id'].".".pathinfo($row['filepath'], PATHINFO_EXTENSION); $row['audioFile'] = $row['id'].".".pathinfo($row['filepath'], PATHINFO_EXTENSION);
$row['image'] = '<img title="Track preview" src="/css/images/icon_audioclip.png">'; $row['image'] = '<img title="Track preview" src="'.$CC_CONFIG['base_dir'].'/css/images/icon_audioclip.png">';
} elseif ($type == "pl") { } elseif ($type == "pl") {
$row['image'] = '<img title="Playlist preview" src="/css/images/icon_playlist.png">'; $row['image'] = '<img title="Playlist preview" src="'.$CC_CONFIG['base_dir'].'/css/images/icon_playlist.png">';
} elseif ($type == "st") { } elseif ($type == "st") {
$row['audioFile'] = $row['id']; $row['audioFile'] = $row['id'];
$row['image'] = '<img title="Webstream preview" src="/css/images/icon_webstream.png">'; $row['image'] = '<img title="Webstream preview" src="'.$CC_CONFIG['base_dir'].'/css/images/icon_webstream.png">';
} elseif ($type == "bl") { } elseif ($type == "bl") {
$row['image'] = '<img title="Smart Block" src="/css/images/icon_smart-block.png">'; $row['image'] = '<img title="Smart Block" src="'.$CC_CONFIG['base_dir'].'/css/images/icon_smart-block.png">';
} }
} }

View file

@ -1,4 +1,4 @@
<img src="/css/images/big_gray_logo.png" width="287" height="109" alt="Airtime" class="gray-logo" /> <div class="gray-logo"></div>
<div class="text-content"> <div class="text-content">
<h2>Welcome to Airtime!</h2> <h2>Welcome to Airtime!</h2>
<p>Here's how you can get started using Airtime to automate your broadcasts: </p> <p>Here's how you can get started using Airtime to automate your broadcasts: </p>

View file

@ -46,7 +46,7 @@
</dt> </dt>
<dd id="add_show_duration-element"> <dd id="add_show_duration-element">
<?php echo $this->element->getElement('add_show_duration') ?> <?php echo $this->element->getElement('add_show_duration') ?>
<img id="icon-loader-small" src="/css/images/loader-small.gif" style="vertical-align:middle; display:none;"/> <img id="icon-loader-small"/>
</dd> </dd>
<?php if($this->element->getElement('add_show_duration')->hasErrors()){ ?> <?php if($this->element->getElement('add_show_duration')->hasErrors()){ ?>
<ul class='errors'> <ul class='errors'>

View file

@ -1,4 +1,5 @@
<div id="import_status" class="library_import" style="display:none">File import in progress... <img src="/css/images/file_import_loader.gif"></img></div> <?php global $CC_CONFIG; ?>
<div id="import_status" class="library_import" style="display:none">File import in progress...<img src=<?php echo $CC_CONFIG['base_dir'] . "/css/images/file_import_loader.gif"?>></img></div>
<fieldset class="toggle" id="filter_options"> <fieldset class="toggle" id="filter_options">
<legend style="cursor: pointer;"><span class="ui-icon ui-icon-triangle-2-n-s"></span>Advanced Search Options</legend> <legend style="cursor: pointer;"><span class="ui-icon ui-icon-triangle-2-n-s"></span>Advanced Search Options</legend>
<div id="advanced_search" class="advanced_search form-horizontal"></div> <div id="advanced_search" class="advanced_search form-horizontal"></div>

View file

@ -1,6 +1,7 @@
<div class="ui-widget ui-widget-content block-shadow simple-formblock clearfix padded-strong preferences"> <div class="ui-widget ui-widget-content block-shadow simple-formblock clearfix padded-strong preferences">
<h2 style="float:left">Preferences</h2> <h2 style="float:left">Preferences</h2>
<form method="post" action="/Preference/index" enctype="application/x-www-form-urlencoded"> <?php global $CC_CONFIG; ?>
<form method="post" action=<?php echo $CC_CONFIG['base_dir'] . "/Preference/index"?> enctype="application/x-www-form-urlencoded">
<div class="button-bar bottom" id="submit-element" style="float:right"> <div class="button-bar bottom" id="submit-element" style="float:right">
<input type="submit" class="ui-button ui-state-default right-floated" value="Save" id="Save" name="Save" /> <input type="submit" class="ui-button ui-state-default right-floated" value="Save" id="Save" name="Save" />

View file

@ -1,7 +1,8 @@
<div class="ui-widget ui-widget-content block-shadow simple-formblock clearfix padded-strong stream-config"> <div class="ui-widget ui-widget-content block-shadow simple-formblock clearfix padded-strong stream-config">
<h2 <?php if($this->enable_stream_conf == "true"){?>style="float:left"<?php }?>>Stream Settings</h2> <h2 <?php if($this->enable_stream_conf == "true"){?>style="float:left"<?php }?>>Stream Settings</h2>
<?php global $CC_CONFIG; ?>
<?php if($this->enable_stream_conf == "true"){?> <?php if($this->enable_stream_conf == "true"){?>
<form method="post" action="/Preference/stream-setting" enctype="application/x-www-form-urlencoded" onsubmit="return confirm('<?php echo $this->confirm_pypo_restart_text ?>');"> <form method="post" action=<?php echo $CC_CONFIG['base_dir'] . "/Preference/stream-setting"?> enctype="application/x-www-form-urlencoded" onsubmit="return confirm('<?php echo $this->confirm_pypo_restart_text ?>');">
<div class="button-bar bottom" id="submit-element" style="float:right"> <div class="button-bar bottom" id="submit-element" style="float:right">
<input type="submit" class="ui-button ui-state-default right-floated" value="Save" id="Save" name="Save" /> <input type="submit" class="ui-button ui-state-default right-floated" value="Save" id="Save" name="Save" />
</div> </div>

View file

@ -1,6 +1,7 @@
<div class="ui-widget ui-widget-content block-shadow simple-formblock clearfix padded-strong preferences"> <div class="ui-widget ui-widget-content block-shadow simple-formblock clearfix padded-strong preferences">
<h2><?php echo $this->section_title?></h2> <h2><?php echo $this->section_title?></h2>
<form method="post" action="/Preference/support-setting" enctype="multipart/form-data"> <?php global $CC_CONFIG; ?>
<form method="post" action=<?php echo $CC_CONFIG['base_dir'] . "/Preference/support-setting"?> enctype="multipart/form-data">
<div id="support-settings"> <div id="support-settings">
<?php echo $this->statusMsg ?> <?php echo $this->statusMsg ?>
<?php echo $this->form ?> <?php echo $this->form ?>

View file

@ -17,6 +17,7 @@ web_server_user = www-data
airtime_dir = x airtime_dir = x
base_url = localhost base_url = localhost
base_port = 80 base_port = 80
base_dir = ''
;How many hours ahead of time should Airtime playout engine (PYPO) ;How many hours ahead of time should Airtime playout engine (PYPO)
;cache scheduled media files. ;cache scheduled media files.

View file

@ -10,7 +10,8 @@ RewriteCond %{REQUEST_FILENAME} -l [OR]
RewriteCond %{REQUEST_FILENAME} -d RewriteCond %{REQUEST_FILENAME} -d
RewriteRule ^.*$ - [NC,L] RewriteRule ^.*$ - [NC,L]
RewriteRule ^.*$ index.php [NC,L] RewriteRule ^.*$ index.php [NC,L]
RewriteBase / #RewriteBase /
AddOutputFilterByType DEFLATE text/plain AddOutputFilterByType DEFLATE text/plain
AddOutputFilterByType DEFLATE text/html AddOutputFilterByType DEFLATE text/html

View file

@ -71,16 +71,16 @@ select {
background-position:center; background-position:center;
} }
#version-icon.outdated { #version-icon.outdated {
background-image:url(/css/images/icon_outdated.png); background-image:url(images/icon_outdated.png);
} }
#version-icon.update2 { #version-icon.update2 {
background-image:url(/css/images/icon_update2.png); background-image:url(images/icon_update2.png);
} }
#version-icon.update { #version-icon.update {
background-image:url(/css/images/icon_update.png); background-image:url(images/icon_update.png);
} }
#version-icon.uptodate { #version-icon.uptodate {
background-image:url(/css/images/icon_uptodate.png); background-image:url(images/icon_uptodate.png);
} }
#ui-tooltip-version a { #ui-tooltip-version a {
@ -99,7 +99,7 @@ select {
display:inline-block; zoom:1; display:inline; display:inline-block; zoom:1; display:inline;
width:14px; height:14px; width:14px; height:14px;
background:url(/css/images/icon_info.png) 0 0 no-repeat; background:url(images/icon_info.png) 0 0 no-repeat;
float:right; position:relative; top:2px; right:7px; float:right; position:relative; top:2px; right:7px;
line-height:16px !important; line-height:16px !important;
} }
@ -109,7 +109,7 @@ select {
position: relative; position: relative;
display:inline-block; zoom:1; display:inline-block; zoom:1;
width:14px; height:14px; width:14px; height:14px;
background:url(/css/images/icon_info.png) 0 0 no-repeat; background:url(images/icon_info.png) 0 0 no-repeat;
top:2px; right:7px; left: 3px; top:2px; right:7px; left: 3px;
line-height:16px !important; line-height:16px !important;
} }

View file

@ -76,7 +76,7 @@ function playAllPlaylist(p_playlistID, p_playlistIndex) {
if ( _idToPostionLookUp !== undefined && viewsPlaylistID == p_playlistID ) { if ( _idToPostionLookUp !== undefined && viewsPlaylistID == p_playlistID ) {
play(p_playlistIndex); play(p_playlistIndex);
}else { }else {
buildplaylist("/audiopreview/get-playlist/playlistID/"+p_playlistID, p_playlistIndex); buildplaylist(baseUrl+"/audiopreview/get-playlist/playlistID/"+p_playlistID, p_playlistIndex);
} }
} }
@ -87,7 +87,7 @@ function playBlock(p_blockId, p_blockIndex)
if ( _idToPostionLookUp !== undefined && viewsBlockId == p_blockId ) { if ( _idToPostionLookUp !== undefined && viewsBlockId == p_blockId ) {
play(p_blockIndex); play(p_blockIndex);
} else { } else {
buildplaylist("/audiopreview/get-block/blockId/"+p_blockId, p_blockIndex); buildplaylist(baseUrl+"/audiopreview/get-block/blockId/"+p_blockId, p_blockIndex);
} }
} }
@ -105,7 +105,7 @@ function playAllShow(p_showID, p_index) {
if ( _idToPostionLookUp !== undefined && viewsShowID == p_showID ) { if ( _idToPostionLookUp !== undefined && viewsShowID == p_showID ) {
play(p_index); play(p_index);
}else { }else {
buildplaylist("/audiopreview/get-show/showID/"+p_showID, p_index); buildplaylist(baseUrl+"/audiopreview/get-show/showID/"+p_showID, p_index);
} }
} }
@ -123,6 +123,7 @@ function buildplaylist(p_url, p_playIndex) {
var media; var media;
var index; var index;
var total = 0; var total = 0;
for(index in data) { for(index in data) {
if (data[index]['type'] == 0) { if (data[index]['type'] == 0) {
if (data[index]['element_mp3'] != undefined){ if (data[index]['element_mp3'] != undefined){

View file

@ -53,9 +53,7 @@ function open_audio_preview(type, id, audioFileTitle, audioFileArtist) {
if(index != -1){ if(index != -1){
audioFileTitle = audioFileTitle.substring(0,index); audioFileTitle = audioFileTitle.substring(0,index);
} }
openPreviewWindow(baseUrl+'/audiopreview/audio-preview/audioFileID/'+id+'/audioFileArtist/'+audioFileArtist+'/audioFileTitle/'+audioFileTitle+'/type/'+type);
openPreviewWindow('audiopreview/audio-preview/audioFileID/'+id+'/audioFileArtist/'+audioFileArtist+'/audioFileTitle/'+audioFileTitle+'/type/'+type);
_preview_window.focus(); _preview_window.focus();
} }
@ -73,7 +71,7 @@ function open_playlist_preview(p_playlistID, p_playlistIndex) {
if (_preview_window != null && !_preview_window.closed) if (_preview_window != null && !_preview_window.closed)
_preview_window.playAllPlaylist(p_playlistID, p_playlistIndex); _preview_window.playAllPlaylist(p_playlistID, p_playlistIndex);
else else
openPreviewWindow('audiopreview/playlist-preview/playlistIndex/'+p_playlistIndex+'/playlistID/'+p_playlistID); openPreviewWindow(baseUrl+'/audiopreview/playlist-preview/playlistIndex/'+p_playlistIndex+'/playlistID/'+p_playlistID);
_preview_window.focus(); _preview_window.focus();
} }
@ -84,7 +82,7 @@ function open_block_preview(p_blockId, p_blockIndex) {
if (_preview_window != null && !_preview_window.closed) if (_preview_window != null && !_preview_window.closed)
_preview_window.playBlock(p_blockId, p_blockIndex); _preview_window.playBlock(p_blockId, p_blockIndex);
else else
openPreviewWindow('audiopreview/block-preview/blockIndex/'+p_blockIndex+'/blockId/'+p_blockId); openPreviewWindow(baseUrl+'/audiopreview/block-preview/blockIndex/'+p_blockIndex+'/blockId/'+p_blockId);
_preview_window.focus(); _preview_window.focus();
} }
@ -98,7 +96,7 @@ function open_show_preview(p_showID, p_showIndex) {
if (_preview_window != null && !_preview_window.closed) if (_preview_window != null && !_preview_window.closed)
_preview_window.playAllShow(p_showID, p_showIndex); _preview_window.playAllShow(p_showID, p_showIndex);
else else
openPreviewWindow('audiopreview/show-preview/showID/'+p_showID+'/showIndex/'+p_showIndex); openPreviewWindow(baseUrl+'/audiopreview/show-preview/showID/'+p_showID+'/showIndex/'+p_showIndex);
_preview_window.focus(); _preview_window.focus();
} }

View file

@ -360,7 +360,7 @@ function controlSwitchLight(){
} }
function getScheduleFromServer(){ function getScheduleFromServer(){
$.ajax({ url: "/Schedule/get-current-playlist/format/json", dataType:"json", success:function(data){ $.ajax({ url: baseUrl+"/Schedule/get-current-playlist/format/json", dataType:"json", success:function(data){
parseItems(data.entries); parseItems(data.entries);
parseSourceStatus(data.source_status); parseSourceStatus(data.source_status);
parseSwitchStatus(data.switch_status); parseSwitchStatus(data.switch_status);
@ -398,7 +398,7 @@ function setSwitchListener(ele){
var sourcename = $(ele).attr('id'); var sourcename = $(ele).attr('id');
var status_span = $(ele).find("span"); var status_span = $(ele).find("span");
var status = status_span.html(); var status = status_span.html();
$.get("/Dashboard/switch-source/format/json/sourcename/"+sourcename+"/status/"+status, function(data){ $.get(baseUrl+"/Dashboard/switch-source/format/json/sourcename/"+sourcename+"/status/"+status, function(data){
if(data.error){ if(data.error){
alert(data.error); alert(data.error);
}else{ }else{
@ -415,7 +415,7 @@ function setSwitchListener(ele){
function kickSource(ele){ function kickSource(ele){
var sourcename = $(ele).attr('id'); var sourcename = $(ele).attr('id');
$.get("/Dashboard/disconnect-source/format/json/sourcename/"+sourcename, function(data){ $.get(baseUrl+"/Dashboard/disconnect-source/format/json/sourcename/"+sourcename, function(data){
if(data.error){ if(data.error){
alert(data.error); alert(data.error);
} }
@ -435,7 +435,7 @@ function init() {
$('.listen-control-button').click(function() { $('.listen-control-button').click(function() {
if (stream_window == null || stream_window.closed) if (stream_window == null || stream_window.closed)
stream_window=window.open(baseUrl+"Dashboard/stream-player", 'name', 'width=400,height=158'); stream_window=window.open(baseUrl+"/Dashboard/stream-player", 'name', 'width=400,height=158');
stream_window.focus(); stream_window.focus();
return false; return false;
}); });

View file

@ -310,7 +310,7 @@ var AIRTIME = (function(AIRTIME) {
mod.fnDeleteItems = function(aMedia) { mod.fnDeleteItems = function(aMedia) {
$.post("/library/delete", $.post(baseUrl+"/library/delete",
{"format": "json", "media": aMedia}, {"format": "json", "media": aMedia},
function(json){ function(json){
if (json.message !== undefined) { if (json.message !== undefined) {
@ -479,7 +479,7 @@ var AIRTIME = (function(AIRTIME) {
"fnStateSave": function (oSettings, oData) { "fnStateSave": function (oSettings, oData) {
localStorage.setItem('datatables-library', JSON.stringify(oData)); localStorage.setItem('datatables-library', JSON.stringify(oData));
$.ajax({ $.ajax({
url: "/usersettings/set-library-datatable", url: baseUrl+"/usersettings/set-library-datatable",
type: "POST", type: "POST",
data: {settings : oData, format: "json"}, data: {settings : oData, format: "json"},
dataType: "json" dataType: "json"
@ -520,7 +520,7 @@ var AIRTIME = (function(AIRTIME) {
oData.iCreate = parseInt(oData.iCreate, 10); oData.iCreate = parseInt(oData.iCreate, 10);
}, },
"sAjaxSource": "/Library/contents-feed", "sAjaxSource": baseUrl+"/Library/contents-feed",
"sAjaxDataProp": "files", "sAjaxDataProp": "files",
"fnServerData": function ( sSource, aoData, fnCallback ) { "fnServerData": function ( sSource, aoData, fnCallback ) {
@ -604,7 +604,7 @@ var AIRTIME = (function(AIRTIME) {
text: aData.track_title text: aData.track_title
}, },
ajax: { ajax: {
url: "/Library/get-file-metadata", url: baseUrl+"/Library/get-file-meta-data",
type: "get", type: "get",
data: ({format: "html", id : aData.id, type: aData.ftype}), data: ({format: "html", id : aData.id, type: aData.ftype}),
success: function(data, status) { success: function(data, status) {
@ -770,13 +770,13 @@ var AIRTIME = (function(AIRTIME) {
}; };
} else if (data.ftype === "playlist" || data.ftype === "block") { } else if (data.ftype === "playlist" || data.ftype === "block") {
callback = function() { callback = function() {
var url = '/Playlist/edit'; var url = baseUrl+'/Playlist/edit';
AIRTIME.playlist.fnEdit(data.id, data.ftype, url); AIRTIME.playlist.fnEdit(data.id, data.ftype, url);
AIRTIME.playlist.validatePlaylistElements(); AIRTIME.playlist.validatePlaylistElements();
}; };
} else if (data.ftype === "stream") { } else if (data.ftype === "stream") {
callback = function() { callback = function() {
var url = '/Webstream/edit'; var url = baseUrl+'/Webstream/edit';
AIRTIME.playlist.fnEdit(data.id, data.ftype, url); AIRTIME.playlist.fnEdit(data.id, data.ftype, url);
} }
} else { } else {
@ -882,7 +882,7 @@ var AIRTIME = (function(AIRTIME) {
} }
request = $.ajax({ request = $.ajax({
url: "/library/context-menu", url: baseUrl+"/library/context-menu",
type: "GET", type: "GET",
data: {id : data.id, type: data.ftype, format: "json", "screen": screen}, data: {id : data.id, type: data.ftype, format: "json", "screen": screen},
dataType: "json", dataType: "json",
@ -905,7 +905,7 @@ var AIRTIME = (function(AIRTIME) {
}(AIRTIME || {})); }(AIRTIME || {}));
function checkImportStatus() { function checkImportStatus() {
$.getJSON('/Preference/is-import-in-progress', function(data){ $.getJSON(baseUrl+'/Preference/is-import-in-progress', function(data){
var div = $('#import_status'); var div = $('#import_status');
var table = $('#library_display').dataTable(); var table = $('#library_display').dataTable();
if (data == true){ if (data == true){
@ -938,7 +938,7 @@ function addProgressIcon(id) {
function checkLibrarySCUploadStatus(){ function checkLibrarySCUploadStatus(){
var url = '/Library/get-upload-to-soundcloud-status', var url = baseUrl+'/Library/get-upload-to-soundcloud-status',
span, span,
id; id;
@ -993,7 +993,7 @@ function addQtipToSCIcons(){
content: { content: {
text: "Retrieving data from the server...", text: "Retrieving data from the server...",
ajax: { ajax: {
url: "/Library/get-upload-to-soundcloud-status", url: baseUrl+"/Library/get-upload-to-soundcloud-status",
type: "post", type: "post",
data: ({format: "json", id : id, type: "file"}), data: ({format: "json", id : id, type: "file"}),
success: function(json, status){ success: function(json, status){
@ -1019,7 +1019,7 @@ function addQtipToSCIcons(){
content: { content: {
text: "Retreiving data from the server...", text: "Retreiving data from the server...",
ajax: { ajax: {
url: "/Library/get-upload-to-soundcloud-status", url: baseUrl+"/Library/get-upload-to-soundcloud-status",
type: "post", type: "post",
data: ({format: "json", id : id, type: "file"}), data: ({format: "json", id : id, type: "file"}),
success: function(json, status){ success: function(json, status){

View file

@ -1,10 +1,11 @@
$(document).ready(function() { $(document).ready(function() {
var uploader; var uploader;
$("#plupload_files").pluploadQueue({ $("#plupload_files").pluploadQueue({
// General settings // General settings
runtimes : 'gears, html5, html4', runtimes : 'gears, html5, html4',
url : '/Plupload/upload/format/json', url : baseUrl+'/Plupload/upload/format/json',
chunk_size : '5mb', chunk_size : '5mb',
unique_names : 'true', unique_names : 'true',
multiple_queues : 'true', multiple_queues : 'true',
@ -27,7 +28,7 @@ $(document).ready(function() {
$("#plupload_error table").css("display", "inline-table"); $("#plupload_error table").css("display", "inline-table");
}else{ }else{
var tempFileName = j.tempfilepath; var tempFileName = j.tempfilepath;
$.get('/Plupload/copyfile/format/json/name/' + $.get(baseUrl+'/Plupload/copyfile/format/json/name/'+
encodeURIComponent(file.name)+'/tempname/' + encodeURIComponent(file.name)+'/tempname/' +
encodeURIComponent(tempFileName), function(json){ encodeURIComponent(tempFileName), function(json){
var jr = jQuery.parseJSON(json); var jr = jQuery.parseJSON(json);

View file

@ -66,7 +66,7 @@ var AIRTIME = (function(AIRTIME){
event.stopPropagation(); event.stopPropagation();
var span = $(this), var span = $(this),
id = span.parent().attr("id").split("_").pop(), id = span.parent().attr("id").split("_").pop(),
url = "/Playlist/set-cue", url = baseUrl+"/Playlist/set-cue",
cueIn = $.trim(span.text()), cueIn = $.trim(span.text()),
li = span.parents("li"), li = span.parents("li"),
unqid = li.attr("unqid"), unqid = li.attr("unqid"),
@ -103,7 +103,7 @@ var AIRTIME = (function(AIRTIME){
event.stopPropagation(); event.stopPropagation();
var span = $(this), var span = $(this),
id = span.parent().attr("id").split("_").pop(), id = span.parent().attr("id").split("_").pop(),
url = "/Playlist/set-cue", url = baseUrl+"/Playlist/set-cue",
cueOut = $.trim(span.text()), cueOut = $.trim(span.text()),
li = span.parents("li"), li = span.parents("li"),
unqid = li.attr("unqid"), unqid = li.attr("unqid"),
@ -142,7 +142,7 @@ var AIRTIME = (function(AIRTIME){
var span = $(this), var span = $(this),
id = span.parent().attr("id").split("_").pop(), id = span.parent().attr("id").split("_").pop(),
url = "/Playlist/set-fade", url = baseUrl+"/Playlist/set-fade",
fadeIn = $.trim(span.text()), fadeIn = $.trim(span.text()),
li = span.parents("li"), li = span.parents("li"),
unqid = li.attr("unqid"), unqid = li.attr("unqid"),
@ -180,7 +180,7 @@ var AIRTIME = (function(AIRTIME){
var span = $(this), var span = $(this),
id = span.parent().attr("id").split("_").pop(), id = span.parent().attr("id").split("_").pop(),
url = "/Playlist/set-fade", url = baseUrl+"/Playlist/set-fade",
fadeOut = $.trim(span.text()), fadeOut = $.trim(span.text()),
li = span.parents("li"), li = span.parents("li"),
unqid = li.attr("unqid"), unqid = li.attr("unqid"),
@ -264,7 +264,8 @@ var AIRTIME = (function(AIRTIME){
nameElement.text(nameElement.text().replace("\n", "")); nameElement.text(nameElement.text().replace("\n", ""));
/* --until we decide whether Playlist name should autosave or not /* --until we decide whether Playlist name should autosave or not
url = '/Playlist/set-playlist-name';
url = baseUrl+'/Playlist/set-playlist-name';
$.post(url, $.post(url,
{format: "json", name: nameElement.text(), modified: lastMod, type: type}, {format: "json", name: nameElement.text(), modified: lastMod, type: type},
@ -501,7 +502,7 @@ var AIRTIME = (function(AIRTIME){
else { else {
$(this).addClass("ui-state-active"); $(this).addClass("ui-state-active");
var url = '/Playlist/get-playlist-fades'; var url = baseUrl+'/Playlist/get-playlist-fades';
$.post(url, $.post(url,
{format: "json", modified: lastMod, type: type}, {format: "json", modified: lastMod, type: type},
function(json){ function(json){
@ -538,7 +539,7 @@ var AIRTIME = (function(AIRTIME){
$pl.on("blur", "span.spl_main_fade_in", function(event){ $pl.on("blur", "span.spl_main_fade_in", function(event){
event.stopPropagation(); event.stopPropagation();
var url = "/Playlist/set-playlist-fades", var url = baseUrl+"/Playlist/set-playlist-fades",
span = $(this), span = $(this),
fadeIn = $.trim(span.text()), fadeIn = $.trim(span.text()),
lastMod = getModified(), lastMod = getModified(),
@ -562,7 +563,7 @@ var AIRTIME = (function(AIRTIME){
$pl.on("blur", "span.spl_main_fade_out", function(event){ $pl.on("blur", "span.spl_main_fade_out", function(event){
event.stopPropagation(); event.stopPropagation();
var url = "/Playlist/set-playlist-fades", var url = baseUrl+"/Playlist/set-playlist-fades",
span = $(this), span = $(this),
fadeOut = $.trim(span.text()), fadeOut = $.trim(span.text()),
lastMod = getModified(), lastMod = getModified(),
@ -623,7 +624,7 @@ var AIRTIME = (function(AIRTIME){
//hide any previous errors (if any) //hide any previous errors (if any)
$("#side_playlist .errors").empty().hide(); $("#side_playlist .errors").empty().hide();
var url = 'Webstream/save'; var url = baseUrl+'/Webstream/save';
$.post(url, $.post(url,
{format: "json", id:id, description: description, url:streamurl, length: length, name: name}, {format: "json", id:id, description: description, url:streamurl, length: length, name: name},
function(json){ function(json){
@ -668,7 +669,7 @@ var AIRTIME = (function(AIRTIME){
var criteria = $('form').serializeArray(), var criteria = $('form').serializeArray(),
block_name = $('#playlist_name_display').text(), block_name = $('#playlist_name_display').text(),
block_desc = $('textarea[name="description"]').val(), block_desc = $('textarea[name="description"]').val(),
save_action = 'Playlist/save', save_action = baseUrl+'/Playlist/save',
obj_id = $('input[id="obj_id"]').val(), obj_id = $('input[id="obj_id"]').val(),
obj_type = $('#obj_type').val(), obj_type = $('#obj_type').val(),
lastMod = getModified(), lastMod = getModified(),
@ -793,7 +794,7 @@ var AIRTIME = (function(AIRTIME){
} }
mod.fnNew = function() { mod.fnNew = function() {
var url = '/Playlist/new'; var url = baseUrl+'/Playlist/new';
stopAudioPreview(); stopAudioPreview();
@ -806,7 +807,7 @@ var AIRTIME = (function(AIRTIME){
}; };
mod.fnWsNew = function() { mod.fnWsNew = function() {
var url = '/Webstream/new'; var url = baseUrl+'/Webstream/new';
stopAudioPreview(); stopAudioPreview();
@ -818,8 +819,9 @@ var AIRTIME = (function(AIRTIME){
}); });
}; };
mod.fnNewBlock = function() { mod.fnNewBlock = function() {
var url = '/Playlist/new'; var url = baseUrl+'/Playlist/new';
stopAudioPreview(); stopAudioPreview();
@ -850,7 +852,7 @@ var AIRTIME = (function(AIRTIME){
id = (plid === undefined) ? getId() : plid; id = (plid === undefined) ? getId() : plid;
lastMod = getModified(); lastMod = getModified();
type = $('#obj_type').val(); type = $('#obj_type').val();
url = '/Playlist/delete'; url = baseUrl+'/Playlist/delete';
$.post(url, $.post(url,
{format: "json", ids: id, modified: lastMod, type: type}, {format: "json", ids: id, modified: lastMod, type: type},
@ -867,7 +869,7 @@ var AIRTIME = (function(AIRTIME){
id = (wsid === undefined) ? getId() : wsid; id = (wsid === undefined) ? getId() : wsid;
lastMod = getModified(); lastMod = getModified();
type = $('#obj_type').val(); type = $('#obj_type').val();
url = '/Webstream/delete'; url = baseUrl+'/Webstream/delete';
$.post(url, $.post(url,
{format: "json", ids: id, modified: lastMod, type: type}, {format: "json", ids: id, modified: lastMod, type: type},
@ -940,20 +942,20 @@ var AIRTIME = (function(AIRTIME){
} }
mod.fnAddItems = function(aItems, iAfter, sAddType) { mod.fnAddItems = function(aItems, iAfter, sAddType) {
var sUrl = "/playlist/add-items"; var sUrl = baseUrl+"/playlist/add-items";
oData = {"aItems": aItems, "afterItem": iAfter, "type": sAddType}; oData = {"aItems": aItems, "afterItem": iAfter, "type": sAddType};
playlistRequest(sUrl, oData); playlistRequest(sUrl, oData);
}; };
mod.fnMoveItems = function(aIds, iAfter) { mod.fnMoveItems = function(aIds, iAfter) {
var sUrl = "/playlist/move-items", var sUrl = baseUrl+"/playlist/move-items",
oData = {"ids": aIds, "afterItem": iAfter}; oData = {"ids": aIds, "afterItem": iAfter};
playlistRequest(sUrl, oData); playlistRequest(sUrl, oData);
}; };
mod.fnDeleteItems = function(aItems) { mod.fnDeleteItems = function(aItems) {
var sUrl = "/playlist/delete-items", var sUrl = baseUrl+"/playlist/delete-items",
oData = {"ids": aItems}; oData = {"ids": aItems};
playlistRequest(sUrl, oData); playlistRequest(sUrl, oData);

View file

@ -1,7 +1,7 @@
$(document).ready(function(){ $(document).ready(function(){
function doNotShowPopup(){ function doNotShowPopup(){
$.get("/Usersettings/donotshowregistrationpopup", {format:"json"}); $.get(baseUrl+"/Usersettings/donotshowregistrationpopup", {format:"json"});
} }
var dialog = $("#register_popup"); var dialog = $("#register_popup");
@ -19,7 +19,7 @@ $(document).ready(function(){
text: "Remind me in 1 week", text: "Remind me in 1 week",
"class": "btn", "class": "btn",
click: function() { click: function() {
var url = '/Usersettings/remindme'; var url = baseUrl+'/Usersettings/remindme';
$.ajax({ $.ajax({
url: url, url: url,
data: {format:"json"} data: {format:"json"}
@ -32,7 +32,7 @@ $(document).ready(function(){
text: "Remind me never", text: "Remind me never",
"class": "btn", "class": "btn",
click: function() { click: function() {
var url ='/Usersettings/remindme-never'; var url =baseUrl+'/Usersettings/remindme-never';
$.ajax({ $.ajax({
url: url, url: url,
data: {format:"json"} data: {format:"json"}

View file

@ -75,7 +75,7 @@ var AIRTIME = (function(AIRTIME) {
"bProcessing": true, "bProcessing": true,
"bServerSide": true, "bServerSide": true,
"sAjaxSource": "/Playouthistory/playout-history-feed", "sAjaxSource": baseUrl+"/Playouthistory/playout-history-feed",
"sAjaxDataProp": "history", "sAjaxDataProp": "history",
"fnServerData": fnServerData, "fnServerData": fnServerData,
@ -94,7 +94,7 @@ var AIRTIME = (function(AIRTIME) {
"sDom": 'lf<"dt-process-rel"r><"H"T><"dataTables_scrolling"t><"F"ip>', "sDom": 'lf<"dt-process-rel"r><"H"T><"dataTables_scrolling"t><"F"ip>',
"oTableTools": { "oTableTools": {
"sSwfPath": "/js/datatables/plugin/TableTools/swf/copy_cvs_xls_pdf.swf", "sSwfPath": baseUrl+"/js/datatables/plugin/TableTools/swf/copy_cvs_xls_pdf.swf",
"aButtons": [ "aButtons": [
"copy", "copy",
{ {

View file

@ -13,8 +13,8 @@ function setWatchedDirEvents() {
//knownPaths: [{text:'Desktop', image:'desktop.png', path:'/home'}], //knownPaths: [{text:'Desktop', image:'desktop.png', path:'/home'}],
knownPaths: [], knownPaths: [],
imageUrl: 'img/icons/', imageUrl: 'img/icons/',
systemImageUrl: '/css/img/', systemImageUrl: baseUrl+'/css/img/',
handlerUrl: '/Preference/server-browse/format/json', handlerUrl: baseUrl+'/Preference/server-browse/format/json',
title: 'Choose Storage Folder', title: 'Choose Storage Folder',
basePath: '', basePath: '',
requestMethod: 'POST', requestMethod: 'POST',
@ -33,8 +33,8 @@ function setWatchedDirEvents() {
//knownPaths: [{text:'Desktop', image:'desktop.png', path:'/home'}], //knownPaths: [{text:'Desktop', image:'desktop.png', path:'/home'}],
knownPaths: [], knownPaths: [],
imageUrl: 'img/icons/', imageUrl: 'img/icons/',
systemImageUrl: '/css/img/', systemImageUrl: baseUrl+'/css/img/',
handlerUrl: '/Preference/server-browse/format/json', handlerUrl: baseUrl+'/Preference/server-browse/format/json',
title: 'Choose Folder to Watch', title: 'Choose Folder to Watch',
basePath: '', basePath: '',
requestMethod: 'POST', requestMethod: 'POST',
@ -44,7 +44,7 @@ function setWatchedDirEvents() {
var url, chosen; var url, chosen;
if(confirm("Are you sure you want to change the storage folder?\nThis will remove the files from your Airtime library!")){ if(confirm("Are you sure you want to change the storage folder?\nThis will remove the files from your Airtime library!")){
url = "/Preference/change-stor-directory"; url = baseUrl+"/Preference/change-stor-directory";
chosen = $('#storageFolder').val(); chosen = $('#storageFolder').val();
$.post(url, $.post(url,
@ -64,7 +64,7 @@ function setWatchedDirEvents() {
$('#watchedFolder-ok').click(function(){ $('#watchedFolder-ok').click(function(){
var url, chosen; var url, chosen;
url = "/Preference/reload-watch-directory"; url = baseUrl+"/Preference/reload-watch-directory";
chosen = $('#watchedFolder').val(); chosen = $('#watchedFolder').val();
$.post(url, $.post(url,
@ -80,7 +80,7 @@ function setWatchedDirEvents() {
$('.selected-item').find('.ui-icon-refresh').click(function(){ $('.selected-item').find('.ui-icon-refresh').click(function(){
var folder = $(this).prev().text(); var folder = $(this).prev().text();
$.get("/Preference/rescan-watch-directory", {format: "json", dir: folder}); $.get(baseUrl+"/Preference/rescan-watch-directory", {format: "json", dir: folder});
}); });
$('.selected-item').find('.ui-icon-close').click(function(){ $('.selected-item').find('.ui-icon-close').click(function(){
@ -88,7 +88,7 @@ function setWatchedDirEvents() {
var row = $(this).parent(); var row = $(this).parent();
var folder = row.find('#folderPath').text(); var folder = row.find('#folderPath').text();
url = "/Preference/remove-watch-directory"; url = baseUrl+"/Preference/remove-watch-directory";
$.post(url, $.post(url,
{format: "json", dir: folder}, {format: "json", dir: folder},

View file

@ -75,7 +75,7 @@ function showForIcecast(ele){
} }
function checkLiquidsoapStatus(){ function checkLiquidsoapStatus(){
var url = '/Preference/get-liquidsoap-status/format/json'; var url = baseUrl+'/Preference/get-liquidsoap-status/format/json';
var id = $(this).attr("id"); var id = $(this).attr("id");
$.post(url, function(json){ $.post(url, function(json){
var json_obj = jQuery.parseJSON(json); var json_obj = jQuery.parseJSON(json);
@ -127,7 +127,7 @@ function setLiveSourceConnectionOverrideListener(){
live_dj_input.val(url) live_dj_input.val(url)
live_dj_input.attr("readonly", "readonly") live_dj_input.attr("readonly", "readonly")
live_dj_actions.hide() live_dj_actions.hide()
$.get("/Preference/set-source-connection-url/", {format: "json", type: "livedj", url:encodeURIComponent(url), override: 1}); $.get(baseUrl+"/Preference/set-source-connection-url/", {format: "json", type: "livedj", url:encodeURIComponent(url), override: 1});
event.preventDefault() event.preventDefault()
}) })
@ -142,7 +142,7 @@ function setLiveSourceConnectionOverrideListener(){
live_dj_input.val(url) live_dj_input.val(url)
live_dj_input.attr("readonly", "readonly") live_dj_input.attr("readonly", "readonly")
live_dj_actions.hide() live_dj_actions.hide()
$.get("/Preference/set-source-connection-url", {format: "json", type: "livedj", url:encodeURIComponent(url), override: 0}); $.get(baseUrl+"/Preference/set-source-connection-url", {format: "json", type: "livedj", url:encodeURIComponent(url), override: 0});
event.preventDefault() event.preventDefault()
}) })
@ -151,7 +151,7 @@ function setLiveSourceConnectionOverrideListener(){
master_dj_input.val(url) master_dj_input.val(url)
master_dj_input.attr("readonly", "readonly") master_dj_input.attr("readonly", "readonly")
master_dj_actions.hide() master_dj_actions.hide()
$.get("/Preference/set-source-connection-url", {format: "json", type: "masterdj", url:encodeURIComponent(url), override: 1}) $.get(baseUrl+"/Preference/set-source-connection-url", {format: "json", type: "masterdj", url:encodeURIComponent(url), override: 1})
event.preventDefault() event.preventDefault()
}) })
@ -165,7 +165,7 @@ function setLiveSourceConnectionOverrideListener(){
master_dj_input.val(url) master_dj_input.val(url)
master_dj_input.attr("readonly", "readonly") master_dj_input.attr("readonly", "readonly")
master_dj_actions.hide() master_dj_actions.hide()
$.get("/Preference/set-source-connection-url", {format: "json", type: "masterdj", url:encodeURIComponent(url), override: 0}) $.get(baseUrl+"/Preference/set-source-connection-url", {format: "json", type: "masterdj", url:encodeURIComponent(url), override: 0})
event.preventDefault() event.preventDefault()
}) })
} }

View file

@ -47,7 +47,7 @@ function autoSelect(event, ui) {
function findHosts(request, callback) { function findHosts(request, callback) {
var search, url; var search, url;
url = "/User/get-hosts"; url = baseUrl+"/User/get-hosts";
search = request.term; search = request.term;
var noResult = new Array(); var noResult = new Array();
@ -397,7 +397,7 @@ function setAddShowEvents() {
.fullCalendar('render'); .fullCalendar('render');
$("#add-show-form").hide(); $("#add-show-form").hide();
$.get("/Schedule/get-form", {format:"json"}, function(json){ $.get(baseUrl+"/Schedule/get-form", {format:"json"}, function(json){
$("#add-show-form") $("#add-show-form")
.empty() .empty()
.append(json.form); .append(json.form);
@ -443,7 +443,7 @@ function setAddShowEvents() {
applyPlatformOpacityRules: false applyPlatformOpacityRules: false
}); });
var action = "/Schedule/"+String(addShowButton.attr("data-action")); var action = baseUrl+"/Schedule/"+String(addShowButton.attr("data-action"));
$.post(action, {format: "json", data: data, hosts: hosts, days: days}, function(json){ $.post(action, {format: "json", data: data, hosts: hosts, days: days}, function(json){
//addShowButton.removeClass("disabled"); //addShowButton.removeClass("disabled");
@ -463,7 +463,7 @@ function setAddShowEvents() {
.fullCalendar('render'); .fullCalendar('render');
$("#add-show-form").hide(); $("#add-show-form").hide();
$.get("/Schedule/get-form", {format:"json"}, function(json){ $.get(baseUrl+"/Schedule/get-form", {format:"json"}, function(json){
$("#add-show-form") $("#add-show-form")
.empty() .empty()
.append(json.form); .append(json.form);
@ -579,7 +579,7 @@ function setAddShowEvents() {
var loadingIcon = $('#icon-loader-small'); var loadingIcon = $('#icon-loader-small');
loadingIcon.show(); loadingIcon.show();
$.post("/Schedule/calculate-duration", {startTime: startDateTime, endTime: endDateTime}, function(data){ $.post(baseUrl+"/Schedule/calculate-duration", {startTime: startDateTime, endTime: endDateTime}, function(data){
$('#add_show_duration').val(JSON.parse(data)); $('#add_show_duration').val(JSON.parse(data));
loadingIcon.hide(); loadingIcon.hide();
}); });

View file

@ -176,7 +176,7 @@ function viewDisplay( view ) {
.fullCalendar( 'gotoDate', date ); .fullCalendar( 'gotoDate', date );
//save slotMin value to db //save slotMin value to db
var url = '/Schedule/set-time-interval/format/json'; var url = baseUrl+'/Schedule/set-time-interval/format/json';
$.post(url, {timeInterval: slotMin}); $.post(url, {timeInterval: slotMin});
}); });
@ -201,7 +201,7 @@ function viewDisplay( view ) {
} }
//save view name to db //save view name to db
var url = '/Schedule/set-time-scale/format/json'; var url = baseUrl+'/Schedule/set-time-scale/format/json';
$.post(url, {timeScale: view.name}); $.post(url, {timeScale: view.name});
} }
@ -306,9 +306,7 @@ function eventAfterRender( event, element, view ) {
} }
function eventDrop(event, dayDelta, minuteDelta, allDay, revertFunc, jsEvent, ui, view) { function eventDrop(event, dayDelta, minuteDelta, allDay, revertFunc, jsEvent, ui, view) {
var url; var url = baseUrl+'/Schedule/move-show/format/json';
url = '/Schedule/move-show/format/json';
$.post(url, $.post(url,
{day: dayDelta, min: minuteDelta, showInstanceId: event.id}, {day: dayDelta, min: minuteDelta, showInstanceId: event.id},
@ -324,9 +322,7 @@ function eventDrop(event, dayDelta, minuteDelta, allDay, revertFunc, jsEvent, ui
} }
function eventResize( event, dayDelta, minuteDelta, revertFunc, jsEvent, ui, view ) { function eventResize( event, dayDelta, minuteDelta, revertFunc, jsEvent, ui, view ) {
var url; var url = baseUrl+'/Schedule/resize-show/format/json';
url = '/Schedule/resize-show/format/json';
$.post(url, $.post(url,
{day: dayDelta, min: minuteDelta, showId: event.showId}, {day: dayDelta, min: minuteDelta, showId: event.showId},
@ -349,7 +345,7 @@ function getFullCalendarEvents(start, end, callback) {
start_date = makeTimeStamp(start); start_date = makeTimeStamp(start);
end_date = makeTimeStamp(end); end_date = makeTimeStamp(end);
url = '/Schedule/event-feed'; url = baseUrl+'/Schedule/event-feed';
var d = new Date(); var d = new Date();
@ -359,7 +355,7 @@ function getFullCalendarEvents(start, end, callback) {
} }
function checkSCUploadStatus(){ function checkSCUploadStatus(){
var url = '/Library/get-upload-to-soundcloud-status/format/json'; var url = baseUrl+'/Library/get-upload-to-soundcloud-status/format/json';
$("span[class*=progress]").each(function(){ $("span[class*=progress]").each(function(){
var id = $(this).attr("id"); var id = $(this).attr("id");
$.post(url, {format: "json", id: id, type:"show"}, function(json){ $.post(url, {format: "json", id: id, type:"show"}, function(json){
@ -373,7 +369,7 @@ function checkSCUploadStatus(){
} }
function getCurrentShow(){ function getCurrentShow(){
var url = '/Schedule/get-current-show/format/json', var url = baseUrl+'/Schedule/get-current-show/format/json',
id, id,
$el; $el;
$.post(url, {format: "json"}, function(json) { $.post(url, {format: "json"}, function(json) {
@ -447,7 +443,7 @@ function addQtipToSCIcons(ele){
content: { content: {
text: "Retreiving data from the server...", text: "Retreiving data from the server...",
ajax: { ajax: {
url: "/Library/get-upload-to-soundcloud-status", url: baseUrl+"/Library/get-upload-to-soundcloud-status",
type: "post", type: "post",
data: ({format: "json", id : id, type: "file"}), data: ({format: "json", id : id, type: "file"}),
success: function(json, status){ success: function(json, status){
@ -473,7 +469,7 @@ function addQtipToSCIcons(ele){
content: { content: {
text: "Retreiving data from the server...", text: "Retreiving data from the server...",
ajax: { ajax: {
url: "/Library/get-upload-to-soundcloud-status", url: baseUrl+"/Library/get-upload-to-soundcloud-status",
type: "post", type: "post",
data: ({format: "json", id : id, type: "show"}), data: ({format: "json", id : id, type: "show"}),
success: function(json, status){ success: function(json, status){

View file

@ -34,7 +34,7 @@ function checkShowLength(json) {
function confirmCancelShow(show_instance_id){ function confirmCancelShow(show_instance_id){
if (confirm('Cancel Current Show?')) { if (confirm('Cancel Current Show?')) {
var url = "/Schedule/cancel-current-show"; var url = baseUrl+"/Schedule/cancel-current-show";
$.ajax({ $.ajax({
url: url, url: url,
data: {format: "json", id: show_instance_id}, data: {format: "json", id: show_instance_id},
@ -47,7 +47,7 @@ function confirmCancelShow(show_instance_id){
function confirmCancelRecordedShow(show_instance_id){ function confirmCancelRecordedShow(show_instance_id){
if (confirm('Stop recording current show?')) { if (confirm('Stop recording current show?')) {
var url = "/Schedule/cancel-current-show"; var url = baseUrl+"/Schedule/cancel-current-show";
$.ajax({ $.ajax({
url: url, url: url,
data: {format: "json", id: show_instance_id}, data: {format: "json", id: show_instance_id},
@ -60,7 +60,7 @@ function confirmCancelRecordedShow(show_instance_id){
function uploadToSoundCloud(show_instance_id){ function uploadToSoundCloud(show_instance_id){
var url = "/Schedule/upload-to-sound-cloud"; var url = baseUrl+"/Schedule/upload-to-sound-cloud";
var span = $(window.triggerElement).find(".recording"); var span = $(window.triggerElement).find(".recording");
$.post(url, $.post(url,
@ -80,8 +80,7 @@ function uploadToSoundCloud(show_instance_id){
} }
function checkCalendarSCUploadStatus(){ function checkCalendarSCUploadStatus(){
var url = baseUrl+'/Library/get-upload-to-soundcloud-status',
var url = '/Library/get-upload-to-soundcloud-status',
span, span,
id; id;
@ -289,7 +288,7 @@ function alertShowErrorAndReload(){
} }
$(document).ready(function() { $(document).ready(function() {
$.ajax({ url: "/Api/calendar-init/format/json", dataType:"json", success:createFullCalendar $.ajax({ url: baseUrl+"/Api/calendar-init/format/json", dataType:"json", success:createFullCalendar
, error:function(jqXHR, textStatus, errorThrown){}}); , error:function(jqXHR, textStatus, errorThrown){}});
setInterval(checkCalendarSCUploadStatus, 5000); setInterval(checkCalendarSCUploadStatus, 5000);
@ -459,7 +458,7 @@ $(document).ready(function() {
} }
$.ajax({ $.ajax({
url: "/schedule/make-context-menu", url: baseUrl+"/schedule/make-context-menu",
type: "GET", type: "GET",
data: {id : data.id, format: "json"}, data: {id : data.id, format: "json"},
dataType: "json", dataType: "json",

View file

@ -264,7 +264,7 @@ var AIRTIME = (function(AIRTIME){
mod.disableUI(); mod.disableUI();
$.post("/showbuilder/schedule-add", $.post(baseUrl+"/showbuilder/schedule-add",
{"format": "json", "mediaIds": aMediaIds, "schedIds": aSchedIds}, {"format": "json", "mediaIds": aMediaIds, "schedIds": aSchedIds},
mod.fnItemCallback mod.fnItemCallback
); );
@ -274,7 +274,7 @@ var AIRTIME = (function(AIRTIME){
mod.disableUI(); mod.disableUI();
$.post("/showbuilder/schedule-move", $.post(baseUrl+"/showbuilder/schedule-move",
{"format": "json", "selectedItem": aSelect, "afterItem": aAfter}, {"format": "json", "selectedItem": aSelect, "afterItem": aAfter},
mod.fnItemCallback mod.fnItemCallback
); );
@ -284,7 +284,7 @@ var AIRTIME = (function(AIRTIME){
mod.disableUI(); mod.disableUI();
if (confirm("Delete selected item(s)?")) { if (confirm("Delete selected item(s)?")) {
$.post( "/showbuilder/schedule-remove", $.post( baseUrl+"/showbuilder/schedule-remove",
{"items": aItems, "format": "json"}, {"items": aItems, "format": "json"},
mod.fnItemCallback mod.fnItemCallback
); );
@ -379,7 +379,7 @@ var AIRTIME = (function(AIRTIME){
localStorage.setItem('datatables-timeline', JSON.stringify(oData)); localStorage.setItem('datatables-timeline', JSON.stringify(oData));
$.ajax({ $.ajax({
url: "/usersettings/set-timeline-datatable", url: baseUrl+"/usersettings/set-timeline-datatable",
type: "POST", type: "POST",
data: {settings : oData, format: "json"}, data: {settings : oData, format: "json"},
dataType: "json" dataType: "json"
@ -537,7 +537,7 @@ var AIRTIME = (function(AIRTIME){
$image = $nRow.find('td.sb-image'); $image = $nRow.find('td.sb-image');
//check if the file exists. //check if the file exists.
if (aData.image === true) { if (aData.image === true) {
$image.html('<img title="Track preview" src="/css/images/icon_audioclip.png"></img>') $image.html('<img title="Track preview" src="'+baseUrl+'/css/images/icon_audioclip.png"></img>')
.click(function() { .click(function() {
open_show_preview(aData.instance, aData.pos); open_show_preview(aData.instance, aData.pos);
return false; return false;
@ -762,7 +762,7 @@ var AIRTIME = (function(AIRTIME){
"sDom": 'R<"dt-process-rel"r><"sb-padded"<"H"C>><"dataTables_scrolling sb-padded"t>', "sDom": 'R<"dt-process-rel"r><"sb-padded"<"H"C>><"dataTables_scrolling sb-padded"t>',
"sAjaxDataProp": "schedule", "sAjaxDataProp": "schedule",
"sAjaxSource": "/showbuilder/builder-feed" "sAjaxSource": baseUrl+"/showbuilder/builder-feed"
}); });
$sbTable.find("tbody").on("click", "input:checkbox", function(ev) { $sbTable.find("tbody").on("click", "input:checkbox", function(ev) {
@ -1001,7 +1001,7 @@ var AIRTIME = (function(AIRTIME){
} }
if (confirm(msg)) { if (confirm(msg)) {
var url = "/Schedule/cancel-current-show"; var url = baseUrl+"/Schedule/cancel-current-show";
$.ajax({ $.ajax({
url: url, url: url,
data: {format: "json", id: data.instance}, data: {format: "json", id: data.instance},
@ -1181,7 +1181,7 @@ var AIRTIME = (function(AIRTIME){
} }
request = $.ajax({ request = $.ajax({
url: "/showbuilder/context-menu", url: baseUrl+"/showbuilder/context-menu",
type: "GET", type: "GET",
data: {id : data.id, format: "json"}, data: {id : data.id, format: "json"},
dataType: "json", dataType: "json",

View file

@ -168,7 +168,7 @@ AIRTIME = (function(AIRTIME) {
schedTable.fnDraw(); schedTable.fnDraw();
$.ajax({ $.ajax({
url: "/usersettings/set-now-playing-screen-settings", url: baseUrl+"/usersettings/set-now-playing-screen-settings",
type: "POST", type: "POST",
data: {settings : {library : true}, format: "json"}, data: {settings : {library : true}, format: "json"},
dataType: "json", dataType: "json",
@ -192,7 +192,7 @@ AIRTIME = (function(AIRTIME) {
schedTable.fnDraw(); schedTable.fnDraw();
$.ajax({ $.ajax({
url: "/usersettings/set-now-playing-screen-settings", url: baseUrl+"/usersettings/set-now-playing-screen-settings",
type: "POST", type: "POST",
data: {settings : {library : false}, format: "json"}, data: {settings : {library : false}, format: "json"},
dataType: "json", dataType: "json",
@ -259,7 +259,7 @@ AIRTIME = (function(AIRTIME) {
$.ajax( { $.ajax( {
"dataType": "json", "dataType": "json",
"type": "GET", "type": "GET",
"url": "/showbuilder/check-builder-feed", "url": baseUrl+"/showbuilder/check-builder-feed",
"data": data, "data": data,
"success": function(json) { "success": function(json) {
if (json.update === true) { if (json.update === true) {

View file

@ -69,7 +69,7 @@ function success(data, textStatus, jqXHR){
} }
function updateStatus(getDiskInfo){ function updateStatus(getDiskInfo){
$.getJSON( "api/status/format/json/diskinfo/"+getDiskInfo, null, success); $.getJSON( baseUrl+"/api/status/format/json/diskinfo/"+getDiskInfo, null, success);
} }

View file

@ -24,13 +24,13 @@ function populateForm(entries){
} }
function rowClickCallback(row_id){ function rowClickCallback(row_id){
$.ajax({ url: '/User/get-user-data/id/'+ row_id +'/format/json', dataType:"json", success:function(data){ $.ajax({ url: baseUrl+'/User/get-user-data/id/'+ row_id +'/format/json', dataType:"json", success:function(data){
populateForm(data.entries); populateForm(data.entries);
}}); }});
} }
function removeUserCallback(row_id, nRow){ function removeUserCallback(row_id, nRow){
$.ajax({ url: '/User/remove-user/id/'+ row_id +'/format/json', dataType:"text", success:function(data){ $.ajax({ url: baseUrl+'/User/remove-user/id/'+ row_id +'/format/json', dataType:"text", success:function(data){
var o = $('#users_datatable').dataTable().fnDeleteRow(nRow); var o = $('#users_datatable').dataTable().fnDeleteRow(nRow);
}}); }});
} }
@ -64,7 +64,7 @@ $(document).ready(function() {
$('#users_datatable').dataTable( { $('#users_datatable').dataTable( {
"bProcessing": true, "bProcessing": true,
"bServerSide": true, "bServerSide": true,
"sAjaxSource": "/User/get-user-data-table-info/format/json", "sAjaxSource": baseUrl+"/User/get-user-data-table-info/format/json",
"fnServerData": function ( sSource, aoData, fnCallback ) { "fnServerData": function ( sSource, aoData, fnCallback ) {
$.ajax( { $.ajax( {
"dataType": 'json', "dataType": 'json',

View file

@ -17,8 +17,9 @@ version_url = 'version/api_key/%%api_key%%'
register_component = 'register-component/format/json/api_key/%%api_key%%/component/%%component%%' register_component = 'register-component/format/json/api_key/%%api_key%%/component/%%component%%'
# Hostname # Hostname
base_url = 'localhost' host = 'localhost'
base_port = 80 base_port = 80
base_dir = ''
############################# #############################
## Config for Media Monitor ## Config for Media Monitor

View file

@ -80,7 +80,7 @@ class AirtimeApiClient():
response = urllib2.urlopen(url).read() response = urllib2.urlopen(url).read()
successful_response = True successful_response = True
except IOError, e: except IOError, e:
logger.error('Error Authenticating with remote server: %s', e) logger.error('Error Authenticating with remote server: %s %s', e, url)
if isinstance(url, urllib2.Request): if isinstance(url, urllib2.Request):
logger.debug(url.get_full_url()) logger.debug(url.get_full_url())
else: else:
@ -148,11 +148,9 @@ class AirtimeApiClient():
def __get_airtime_version(self): def __get_airtime_version(self):
logger = self.logger logger = self.logger
url = "http://%s:%s/%s/%s" % (self.config["base_url"], url= self.construct_url("version_url")
str(self.config["base_port"]), self.config["api_base"],
self.config["version_url"])
logger.debug("Trying to contact %s", url) logger.debug("Trying to contact %s", url)
url = url.replace("%%api_key%%", self.config["api_key"])
version = -1 version = -1
try: try:
@ -207,10 +205,8 @@ class AirtimeApiClient():
logger = self.logger logger = self.logger
# Construct the URL # Construct the URL
export_url = "http://%s:%s/%s/%s" % (self.config["base_url"], str(self.config["base_port"]), self.config["api_base"], self.config["export_url"]) export_url = self.construct_url("export_url")
logger.info("Fetching schedule from %s", export_url) logger.info("Fetching schedule from %s", export_url)
export_url = export_url.replace('%%api_key%%', self.config["api_key"])
response = "" response = ""
try: try:
@ -241,12 +237,7 @@ class AirtimeApiClient():
logger = self.logger logger = self.logger
try: try:
url = "http://%s:%s/%s/%s" % (self.config["base_url"], \ url = self.construct_url("notify_liquidsoap_started")
str(self.config["base_port"]), \
self.config["api_base"], \
self.config["notify_liquidsoap_started"])
url = url.replace("%%api_key%%", self.config["api_key"])
self.get_response_from_server(url, attempts=5) self.get_response_from_server(url, attempts=5)
except Exception, e: except Exception, e:
@ -262,10 +253,10 @@ class AirtimeApiClient():
logger = self.logger logger = self.logger
response = '' response = ''
try: try:
url = "http://%s:%s/%s/%s" % (self.config["base_url"], str(self.config["base_port"]), self.config["api_base"], self.config["update_start_playing_url"]) schedule_id = data
url = self.construct_url("update_start_playing_url")
url = url.replace("%%media_id%%", str(media_id)) url = url.replace("%%media_id%%", str(media_id))
logger.debug(url) logger.debug(url)
url = url.replace("%%api_key%%", self.config["api_key"])
response = self.get_response_from_server(url, attempts = 5) response = self.get_response_from_server(url, attempts = 5)
response = json.loads(response) response = json.loads(response)
@ -290,9 +281,8 @@ class AirtimeApiClient():
logger = self.logger logger = self.logger
response = None response = None
try: try:
url = "http://%s:%s/%s/%s" % (self.config["base_url"], str(self.config["base_port"]), self.config["api_base"], self.config["show_schedule_url"]) url = self.construct_url("show_schedule_url")
logger.debug(url) logger.debug(url)
url = url.replace("%%api_key%%", self.config["api_key"])
response = self.get_response_from_server(url) response = self.get_response_from_server(url)
response = json.loads(response) response = json.loads(response)
@ -311,10 +301,9 @@ class AirtimeApiClient():
retries = int(self.config["upload_retries"]) retries = int(self.config["upload_retries"])
retries_wait = int(self.config["upload_wait"]) retries_wait = int(self.config["upload_wait"])
url = "http://%s:%s/%s/%s" % (self.config["base_url"], str(self.config["base_port"]), self.config["api_base"], self.config["upload_file_url"]) url = self.construct_url("upload_file_url")
logger.debug(url) logger.debug(url)
url = url.replace("%%api_key%%", self.config["api_key"])
for i in range(0, retries): for i in range(0, retries):
logger.debug("Upload attempt: %s", i + 1) logger.debug("Upload attempt: %s", i + 1)
@ -346,9 +335,7 @@ class AirtimeApiClient():
response = '' response = ''
try: try:
url = "http://%s:%s/%s/%s" % (self.config["base_url"], str(self.config["base_port"]), self.config["api_base"], self.config["check_live_stream_auth"]) url = self.construct_url("check_live_stream_auth")
url = url.replace("%%api_key%%", self.config["api_key"])
url = url.replace("%%username%%", username) url = url.replace("%%username%%", username)
url = url.replace("%%djtype%%", dj_type) url = url.replace("%%djtype%%", dj_type)
url = url.replace("%%password%%", password) url = url.replace("%%password%%", password)
@ -365,7 +352,7 @@ class AirtimeApiClient():
def construct_url(self,config_action_key): def construct_url(self,config_action_key):
"""Constructs the base url for every request""" """Constructs the base url for every request"""
# TODO : Make other methods in this class use this this method. # TODO : Make other methods in this class use this this method.
url = "http://%s:%s/%s/%s" % (self.config["base_url"], str(self.config["base_port"]), self.config["api_base"], self.config[config_action_key]) url = "http://%s:%s/%s/%s/%s" % (self.config["host"], str(self.config["base_port"]), self.config["base_dir"], self.config["api_base"], self.config[config_action_key])
url = url.replace("%%api_key%%", self.config["api_key"]) url = url.replace("%%api_key%%", self.config["api_key"])
return url return url
@ -405,10 +392,9 @@ class AirtimeApiClient():
logger.info("Could not parse json from response: '%s'" % response) logger.info("Could not parse json from response: '%s'" % response)
if("error" not in response and is_record): if("error" not in response and is_record):
url = "http://%s:%s/%s/%s" % (self.config["base_url"], str(self.config["base_port"]), self.config["api_base"], self.config["upload_recorded"]) url = self.construct_url("upload_recorded")
url = url.replace("%%fileid%%", str(response[u'id'])) url = url.replace("%%fileid%%", str(response[u'id']))
url = url.replace("%%showinstanceid%%", str(md['MDATA_KEY_TRACKNUMBER'])) url = url.replace("%%showinstanceid%%", str(md['MDATA_KEY_TRACKNUMBER']))
url = url.replace("%%api_key%%", self.config["api_key"])
response = self.get_response_from_server(url) response = self.get_response_from_server(url)
response = json.loads(response) response = json.loads(response)
@ -498,9 +484,7 @@ class AirtimeApiClient():
# Does this include the stor directory as well? # Does this include the stor directory as well?
logger = self.logger logger = self.logger
try: try:
url = "http://%s:%s/%s/%s" % (self.config["base_url"], str(self.config["base_port"]), self.config["api_base"], self.config["list_all_watched_dirs"]) url = self.construct_url("list_all_watched_dirs")
url = url.replace("%%api_key%%", self.config["api_key"])
response = self.get_response_from_server(url) response = self.get_response_from_server(url)
response = json.loads(response) response = json.loads(response)
@ -514,9 +498,7 @@ class AirtimeApiClient():
def add_watched_dir(self, path): def add_watched_dir(self, path):
logger = self.logger logger = self.logger
try: try:
url = "http://%s:%s/%s/%s" % (self.config["base_url"], str(self.config["base_port"]), self.config["api_base"], self.config["add_watched_dir"]) url = self.construct_url("add_watched_dir")
url = url.replace("%%api_key%%", self.config["api_key"])
url = url.replace("%%path%%", base64.b64encode(path)) url = url.replace("%%path%%", base64.b64encode(path))
response = self.get_response_from_server(url) response = self.get_response_from_server(url)
@ -530,9 +512,7 @@ class AirtimeApiClient():
def remove_watched_dir(self, path): def remove_watched_dir(self, path):
logger = self.logger logger = self.logger
try: try:
url = "http://%s:%s/%s/%s" % (self.config["base_url"], str(self.config["base_port"]), self.config["api_base"], self.config["remove_watched_dir"]) url = self.construct_url("remove_watched_dir")
url = url.replace("%%api_key%%", self.config["api_key"])
url = url.replace("%%path%%", base64.b64encode(path)) url = url.replace("%%path%%", base64.b64encode(path))
response = self.get_response_from_server(url) response = self.get_response_from_server(url)
@ -546,9 +526,7 @@ class AirtimeApiClient():
def set_storage_dir(self, path): def set_storage_dir(self, path):
logger = self.logger logger = self.logger
try: try:
url = "http://%s:%s/%s/%s" % (self.config["base_url"], str(self.config["base_port"]), self.config["api_base"], self.config["set_storage_dir"]) url = self.construct_url("set_storage_dir")
url = url.replace("%%api_key%%", self.config["api_key"])
url = url.replace("%%path%%", base64.b64encode(path)) url = url.replace("%%path%%", base64.b64encode(path))
response = self.get_response_from_server(url) response = self.get_response_from_server(url)
@ -562,9 +540,7 @@ class AirtimeApiClient():
def get_stream_setting(self): def get_stream_setting(self):
logger = self.logger logger = self.logger
try: try:
url = "http://%s:%s/%s/%s" % (self.config["base_url"], str(self.config["base_port"]), self.config["api_base"], self.config["get_stream_setting"]) url = self.construct_url("get_stream_setting")
url = url.replace("%%api_key%%", self.config["api_key"])
response = self.get_response_from_server(url) response = self.get_response_from_server(url)
response = json.loads(response) response = json.loads(response)
except Exception, e: except Exception, e:
@ -582,9 +558,7 @@ class AirtimeApiClient():
def register_component(self, component): def register_component(self, component):
logger = self.logger logger = self.logger
try: try:
url = "http://%s:%s/%s/%s" % (self.config["base_url"], str(self.config["base_port"]), self.config["api_base"], self.config["register_component"]) url = self.construct_url("register_component")
url = url.replace("%%api_key%%", self.config["api_key"])
url = url.replace("%%component%%", component) url = url.replace("%%component%%", component)
self.get_response_from_server(url) self.get_response_from_server(url)
except Exception, e: except Exception, e:
@ -593,9 +567,7 @@ class AirtimeApiClient():
def notify_liquidsoap_status(self, msg, stream_id, time): def notify_liquidsoap_status(self, msg, stream_id, time):
logger = self.logger logger = self.logger
try: try:
url = "http://%s:%s/%s/%s" % (self.config["base_url"], str(self.config["base_port"]), self.config["api_base"], self.config["update_liquidsoap_status"]) url = self.construct_url("update_liquidsoap_status")
url = url.replace("%%api_key%%", self.config["api_key"])
msg = msg.replace('/', ' ') msg = msg.replace('/', ' ')
encoded_msg = urllib.quote(msg, '') encoded_msg = urllib.quote(msg, '')
url = url.replace("%%msg%%", encoded_msg) url = url.replace("%%msg%%", encoded_msg)
@ -609,9 +581,7 @@ class AirtimeApiClient():
def notify_source_status(self, sourcename, status): def notify_source_status(self, sourcename, status):
logger = self.logger logger = self.logger
try: try:
url = "http://%s:%s/%s/%s" % (self.config["base_url"], str(self.config["base_port"]), self.config["api_base"], self.config["update_source_status"]) url = self.construct_url("update_source_status")
url = url.replace("%%api_key%%", self.config["api_key"])
url = url.replace("%%sourcename%%", sourcename) url = url.replace("%%sourcename%%", sourcename)
url = url.replace("%%status%%", status) url = url.replace("%%status%%", status)
@ -625,9 +595,7 @@ class AirtimeApiClient():
def update_file_system_mount(self, added_dir, removed_dir): def update_file_system_mount(self, added_dir, removed_dir):
logger = self.logger logger = self.logger
try: try:
url = "http://%s:%s/%s/%s" % (self.config["base_url"], str(self.config["base_port"]), self.config["api_base"], self.config["update_fs_mount"]) url = self.construct_url("update_fs_mount")
url = url.replace("%%api_key%%", self.config["api_key"])
added_data_string = string.join(added_dir, ',') added_data_string = string.join(added_dir, ',')
removed_data_string = string.join(removed_dir, ',') removed_data_string = string.join(removed_dir, ',')
@ -651,9 +619,7 @@ class AirtimeApiClient():
def handle_watched_dir_missing(self, dir): def handle_watched_dir_missing(self, dir):
logger = self.logger logger = self.logger
try: try:
url = "http://%s:%s/%s/%s" % (self.config["base_url"], str(self.config["base_port"]), self.config["api_base"], self.config["handle_watched_dir_missing"]) url = self.construct_url("handle_watched_dir_missing")
url = url.replace("%%api_key%%", self.config["api_key"])
url = url.replace("%%dir%%", base64.b64encode(dir)) url = url.replace("%%dir%%", base64.b64encode(dir))
response = self.get_response_from_server(url) response = self.get_response_from_server(url)
@ -689,8 +655,7 @@ class AirtimeApiClient():
logger = self.logger logger = self.logger
try: try:
url = "http://%(base_url)s:%(base_port)s/%(api_base)s/%(get_files_without_replay_gain)s/" % (self.config) url = self.construct_url("get_files_without_replay_gain")
url = url.replace("%%api_key%%", self.config["api_key"])
url = url.replace("%%dir_id%%", dir_id) url = url.replace("%%dir_id%%", dir_id)
response = self.get_response_from_server(url) response = self.get_response_from_server(url)
@ -712,8 +677,7 @@ class AirtimeApiClient():
#http://localhost/api/update-replay-gain-value/ #http://localhost/api/update-replay-gain-value/
try: try:
url = "http://%(base_url)s:%(base_port)s/%(api_base)s/%(update_replay_gain_value)s/" % (self.config) url = self.construct_url("update_replay_gain_value")
url = url.replace("%%api_key%%", self.config["api_key"])
data = urllib.urlencode({'data': json.dumps(pairs)}) data = urllib.urlencode({'data': json.dumps(pairs)})
request = urllib2.Request(url, data) request = urllib2.Request(url, data)
@ -729,9 +693,8 @@ class AirtimeApiClient():
external webstream external webstream
""" """
try: try:
url = "http://%(base_url)s:%(base_port)s/%(api_base)s/%(notify_webstream_data)s/" % (self.config) url = self.construct_url("notify_webstream_data")
url = url.replace("%%media_id%%", str(media_id)) url = url.replace("%%media_id%%", str(media_id))
url = url.replace("%%api_key%%", self.config["api_key"])
data = urllib.urlencode({'data': data}) data = urllib.urlencode({'data': data})
self.logger.debug(url) self.logger.debug(url)
request = urllib2.Request(url, data) request = urllib2.Request(url, data)

View file

@ -14,10 +14,11 @@ if (substr($sapi_type, 0, 3) == 'cli') {
$apiKey = $airtimeIni['general']['api_key']; $apiKey = $airtimeIni['general']['api_key'];
$baseUrl = $airtimeIni['general']['base_url']; $baseUrl = $airtimeIni['general']['base_url'];
$base_port = $airtimeIni['general']['base_port']; $base_port = $airtimeIni['general']['base_port'];
$base_dir = $airtimeIni['general']['base_dir'];
$status = AirtimeCheck::GetStatus($baseUrl, $base_port, $base_dir, $apiKey);
$status = AirtimeCheck::GetStatus($baseUrl, $base_port, $apiKey);
AirtimeCheck::PrintStatus($baseUrl, $base_port, $status); AirtimeCheck::PrintStatus($baseUrl, $base_port, $status);
//AirtimeCheck::PrintStatus($baseUrl, $status);
} }
class AirtimeCheck { class AirtimeCheck {
@ -102,9 +103,9 @@ class AirtimeCheck {
return $headerInfo['Server'][0]; return $headerInfo['Server'][0];
} }
public static function GetStatus($p_baseUrl, $p_basePort, $p_apiKey){ public static function GetStatus($p_baseUrl, $p_basePort, $p_baseDir, $p_apiKey){
$url = "http://$p_baseUrl:$p_basePort/api/status/format/json/api_key/%%api_key%%"; $url = "http://$p_baseUrl:$p_basePort/$p_baseDir/api/status/format/json/api_key/%%api_key%%";
self::output_status("AIRTIME_STATUS_URL", $url); self::output_status("AIRTIME_STATUS_URL", $url);
$url = str_replace("%%api_key%%", $p_apiKey, $url); $url = str_replace("%%api_key%%", $p_apiKey, $url);