-
@@ -10,8 +10,12 @@
-",
- "") ?>
diff --git a/airtime_mvc/application/Bootstrap.php b/airtime_mvc/application/Bootstrap.php index 582bb2a07..455b64c6a 100644 --- a/airtime_mvc/application/Bootstrap.php +++ b/airtime_mvc/application/Bootstrap.php @@ -11,6 +11,7 @@ require_once __DIR__."/configs/constants.php"; require_once 'Preference.php'; require_once 'Locale.php'; require_once "DateHelper.php"; +require_once "LocaleHelper.php"; require_once "OsPath.php"; require_once "Database.php"; require_once "Timezone.php"; @@ -53,8 +54,9 @@ class Bootstrap extends Zend_Application_Bootstrap_Bootstrap $view = $this->getResource('view'); $baseUrl = Application_Common_OsPath::getBaseDir(); - $view->headScript()->appendScript("var baseUrl = '$baseUrl'"); - + $view->headScript()->appendScript("var baseUrl = '$baseUrl';"); + $this->_initTranslationGlobals($view); + $user = Application_Model_User::GetCurrentUser(); if (!is_null($user)){ $userType = $user->getType(); @@ -62,7 +64,17 @@ class Bootstrap extends Zend_Application_Bootstrap_Bootstrap $userType = ""; } $view->headScript()->appendScript("var userType = '$userType';"); - + } + + /** + * Ideally, globals should be written to a single js file once + * from a php init function. This will save us from having to + * reinitialize them every request + */ + private function _initTranslationGlobals($view) { + $view->headScript()->appendScript("var PRODUCT_NAME = '" . PRODUCT_NAME . "';"); + $view->headScript()->appendScript("var USER_MANUAL_URL = '" . USER_MANUAL_URL . "';"); + $view->headScript()->appendScript("var COMPANY_NAME = '" . COMPANY_NAME . "';"); } protected function _initHeadLink() diff --git a/airtime_mvc/application/common/LocaleHelper.php b/airtime_mvc/application/common/LocaleHelper.php new file mode 100644 index 000000000..96ac1f28b --- /dev/null +++ b/airtime_mvc/application/common/LocaleHelper.php @@ -0,0 +1,7 @@ +view->layout()->disableLayout(); diff --git a/airtime_mvc/application/controllers/LoginController.php b/airtime_mvc/application/controllers/LoginController.php index fa6ea36bb..1de9e106e 100644 --- a/airtime_mvc/application/controllers/LoginController.php +++ b/airtime_mvc/application/controllers/LoginController.php @@ -16,15 +16,16 @@ class LoginController extends Zend_Controller_Action $request = $this->getRequest(); $response = $this->getResponse(); + $stationLocale = Application_Model_Preference::GetDefaultLocale(); //Enable AJAX requests from www.airtime.pro for the sign-in process. CORSHelper::enableATProCrossOriginRequests($request, $response); - Application_Model_Locale::configureLocalization($request->getcookie('airtime_locale', 'en_CA')); + + Application_Model_Locale::configureLocalization($request->getcookie('airtime_locale', $stationLocale)); $auth = Zend_Auth::getInstance(); - if ($auth->hasIdentity()) - { + if ($auth->hasIdentity()) { $this->_redirect('Showbuilder'); } @@ -130,7 +131,9 @@ class LoginController extends Zend_Controller_Action $this->view->headScript()->appendFile($baseUrl.'js/airtime/login/password-restore.js?'.$CC_CONFIG['airtime_version'],'text/javascript'); $request = $this->getRequest(); - Application_Model_Locale::configureLocalization($request->getcookie('airtime_locale', 'en_CA')); + $stationLocale = Application_Model_Preference::GetDefaultLocale(); + + Application_Model_Locale::configureLocalization($request->getcookie('airtime_locale', $stationLocale)); if (!Application_Model_Preference::GetEnableSystemEmail()) { $this->_redirect('login'); @@ -174,7 +177,9 @@ class LoginController extends Zend_Controller_Action public function passwordRestoreAfterAction() { $request = $this->getRequest(); - Application_Model_Locale::configureLocalization($request->getcookie('airtime_locale', 'en_CA')); + $stationLocale = Application_Model_Preference::GetDefaultLocale(); + + Application_Model_Locale::configureLocalization($request->getcookie('airtime_locale', $stationLocale)); //uses separate layout without a navigation. $this->_helper->layout->setLayout('login'); @@ -192,8 +197,10 @@ class LoginController extends Zend_Controller_Action $form = new Application_Form_PasswordChange(); $auth = new Application_Model_Auth(); $user = CcSubjsQuery::create()->findPK($user_id); + + $stationLocale = Application_Model_Preference::GetDefaultLocale(); - Application_Model_Locale::configureLocalization($request->getcookie('airtime_locale', 'en_CA')); + Application_Model_Locale::configureLocalization($request->getcookie('airtime_locale', $stationLocale)); //check validity of token if (!$auth->checkToken($user_id, $token, 'password.restore')) { diff --git a/airtime_mvc/application/controllers/PlaylistController.php b/airtime_mvc/application/controllers/PlaylistController.php index 1826bde3b..4f511f4b5 100644 --- a/airtime_mvc/application/controllers/PlaylistController.php +++ b/airtime_mvc/application/controllers/PlaylistController.php @@ -38,7 +38,7 @@ class PlaylistController extends Zend_Controller_Action $obj = null; $objInfo = Application_Model_Library::getObjInfo($p_type); - $obj_sess = new Zend_Session_Namespace( UI_PLAYLISTCONTROLLER_OBJ_SESSNAME); + $obj_sess = new Zend_Session_Namespace(UI_PLAYLISTCONTROLLER_OBJ_SESSNAME); if (isset($obj_sess->id)) { $obj = new $objInfo['className']($obj_sess->id); @@ -422,29 +422,29 @@ class PlaylistController extends Zend_Controller_Action public function setCrossfadeAction() { - $id1 = $this->_getParam('id1', null); - $id2 = $this->_getParam('id2', null); - $type = $this->_getParam('type'); - $fadeIn = $this->_getParam('fadeIn', 0); - $fadeOut = $this->_getParam('fadeOut', 0); - $offset = $this->_getParam('offset', 0); + $id1 = $this->_getParam('id1', null); + $id2 = $this->_getParam('id2', null); + $type = $this->_getParam('type'); + $fadeIn = $this->_getParam('fadeIn', 0); + $fadeOut = $this->_getParam('fadeOut', 0); + $offset = $this->_getParam('offset', 0); - try { - $obj = $this->getPlaylist($type); - $response = $obj->createCrossfade($id1, $fadeOut, $id2, $fadeIn, $offset); + try { + $obj = $this->getPlaylist($type); + $response = $obj->createCrossfade($id1, $fadeOut, $id2, $fadeIn, $offset); - if (!isset($response["error"])) { - $this->createUpdateResponse($obj); - } else { - $this->view->error = $response["error"]; - } - } catch (PlaylistOutDatedException $e) { - $this->playlistOutdated($e); - } catch (PlaylistNotFoundException $e) { - $this->playlistNotFound($type); - } catch (Exception $e) { - $this->playlistUnknownError($e); - } + if (!isset($response["error"])) { + $this->createUpdateResponse($obj); + } else { + $this->view->error = $response["error"]; + } + } catch (PlaylistOutDatedException $e) { + $this->playlistOutdated($e); + } catch (PlaylistNotFoundException $e) { + $this->playlistNotFound($type); + } catch (Exception $e) { + $this->playlistUnknownError($e); + } } public function getPlaylistFadesAction() diff --git a/airtime_mvc/application/controllers/UserController.php b/airtime_mvc/application/controllers/UserController.php index e1f2846ca..51ac869e7 100644 --- a/airtime_mvc/application/controllers/UserController.php +++ b/airtime_mvc/application/controllers/UserController.php @@ -73,12 +73,6 @@ class UserController extends Zend_Controller_Action $user->setJabber($formData['jabber']); $user->save(); - // Language and timezone settings are saved on a per-user basis - // By default, the default language, and timezone setting on - // preferences page is what gets assigned. - Application_Model_Preference::SetUserLocale(); - Application_Model_Preference::SetUserTimezone(); - $form->reset(); $this->view->form = $form; @@ -87,7 +81,7 @@ class UserController extends Zend_Controller_Action } else { $this->view->successMessage = "
",
- "",
- $this->airtime_version,
- "
")
+
+$productSiteAnchor = ""
+ . PRODUCT_NAME
+ . "";
+echo sprintf(_('%1$s %2$s, the open radio software for scheduling and remote station management.'),
+ $productSiteAnchor,
+ $this->airtime_version)
?>
-
© 2013
+
+
© 2013
",
- "",
- "",
- "")
+$companySiteAnchor = ""
+ . COMPANY_NAME . " " . COMPANY_SUFFIX
+ . "";
+$licenseAnchor = ""
+ . LICENSE_VERSION
+ . "";
+echo sprintf(_('%1$s %2$s is distributed under the %3$s'),
+ $companySiteAnchor, PRODUCT_NAME, $licenseAnchor)
?>
-",
- "") ?>