parent
7866b8a0cb
commit
1572955d07
|
@ -7,6 +7,7 @@ Propel::init(__DIR__."/configs/airtime-conf-production.php");
|
|||
|
||||
require_once __DIR__."/configs/constants.php";
|
||||
require_once 'Preference.php';
|
||||
require_once 'Locale.php';
|
||||
require_once "DateHelper.php";
|
||||
require_once "OsPath.php";
|
||||
require_once "Database.php";
|
||||
|
@ -34,18 +35,7 @@ $front = Zend_Controller_Front::getInstance();
|
|||
$front->registerPlugin(new RabbitMqPlugin());
|
||||
|
||||
//localization configuration
|
||||
$codeset = 'UTF-8';
|
||||
$lang = Application_Model_Preference::GetLocale().'.'.$codeset;
|
||||
|
||||
putenv("LC_ALL=$lang");
|
||||
putenv("LANG=$lang");
|
||||
$res = setlocale(LC_MESSAGES, $lang);
|
||||
|
||||
$domain = 'airtime';
|
||||
bindtextdomain($domain, '/usr/share/airtime/locale');
|
||||
textdomain($domain);
|
||||
bind_textdomain_codeset($domain, $codeset);
|
||||
|
||||
Application_Model_Locale::configureLocalization();
|
||||
|
||||
/* The bootstrap class should only be used to initialize actions that return a view.
|
||||
Actions that return JSON will not use the bootstrap class! */
|
||||
|
@ -107,6 +97,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/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/cookie/jquery.cookie.js?'.$CC_CONFIG['airtime_version'],'text/javascript');
|
||||
$view->headScript()->appendFile($baseUrl.'/js/i18n/jquery.i18n.js?'.$CC_CONFIG['airtime_version'],'text/javascript');
|
||||
$view->headScript()->appendFile($baseUrl.'/locale/general-translation-table?'.$CC_CONFIG['airtime_version'],'text/javascript');
|
||||
$view->headScript()->appendFile($baseUrl.'/locale/datatables-translation-table?'.$CC_CONFIG['airtime_version'],'text/javascript');
|
||||
|
|
|
@ -5,7 +5,6 @@ class LoginController extends Zend_Controller_Action
|
|||
|
||||
public function init()
|
||||
{
|
||||
/* Initialize action controller here */
|
||||
}
|
||||
|
||||
public function indexAction()
|
||||
|
@ -14,6 +13,7 @@ class LoginController extends Zend_Controller_Action
|
|||
|
||||
$request = $this->getRequest();
|
||||
|
||||
Application_Model_Locale::configureLocalization($request->getcookie('airtime_locale'));
|
||||
if (Zend_Auth::getInstance()->hasIdentity())
|
||||
{
|
||||
|
||||
|
@ -43,6 +43,7 @@ class LoginController extends Zend_Controller_Action
|
|||
//get the username and password from the form
|
||||
$username = $form->getValue('username');
|
||||
$password = $form->getValue('password');
|
||||
$locale = $form->getValue('locale');
|
||||
if (Application_Model_Subjects::getLoginAttempts($username) >= 3 && $form->getElement('captcha') == NULL) {
|
||||
$form->addRecaptcha();
|
||||
} else {
|
||||
|
@ -67,6 +68,9 @@ class LoginController extends Zend_Controller_Action
|
|||
|
||||
$tempSess = new Zend_Session_Namespace("referrer");
|
||||
$tempSess->referrer = 'login';
|
||||
|
||||
//set the user locale in case user changed it in when logging in
|
||||
Application_Model_Preference::SetUserLocale($auth->getIdentity()->id, $locale);
|
||||
|
||||
$this->_redirect('Showbuilder');
|
||||
} else {
|
||||
|
|
|
@ -162,7 +162,7 @@ class UserController extends Zend_Controller_Action
|
|||
$this->view->successMessage = "<div class='success'>"._("User updated successfully!")."</div>";
|
||||
}
|
||||
$this->view->form = $form;
|
||||
die(json_encode(array("html"=>$this->view->render('user/edit-user.phtml'))));
|
||||
die(json_encode(array("locale"=>$formData['cu_locale'], "html"=>$this->view->render('user/edit-user.phtml'))));
|
||||
}
|
||||
$this->view->form = $form;
|
||||
$this->view->html = $this->view->render('user/edit-user.phtml');
|
||||
|
|
|
@ -43,6 +43,12 @@ class Application_Form_Login extends Zend_Form
|
|||
'ViewHelper'
|
||||
)
|
||||
));
|
||||
|
||||
$locale = new Zend_Form_Element_Select("locale");
|
||||
$locale->setLabel(_("Language:"));
|
||||
$locale->setMultiOptions(Application_Model_Locale::getLocales());
|
||||
$locale->setDecorators(array('ViewHelper'));
|
||||
$this->addElement($locale);
|
||||
|
||||
$recaptchaNeeded = false;
|
||||
if (Application_Model_LoginAttempts::getAttempts($_SERVER['REMOTE_ADDR']) >= 3) {
|
||||
|
|
|
@ -14,4 +14,22 @@ class Application_Model_Locale
|
|||
|
||||
return $out;
|
||||
}
|
||||
}
|
||||
|
||||
public static function configureLocalization($locale = null)
|
||||
{
|
||||
$codeset = 'UTF-8';
|
||||
if (is_null($locale)) {
|
||||
$lang = Application_Model_Preference::GetLocale().'.'.$codeset;
|
||||
} else {
|
||||
$lang = $locale.'.'.$codeset;
|
||||
}
|
||||
putenv("LC_ALL=$lang");
|
||||
putenv("LANG=$lang");
|
||||
$res = setlocale(LC_MESSAGES, $lang);
|
||||
|
||||
$domain = 'airtime';
|
||||
bindtextdomain($domain, '/usr/share/airtime/locale');
|
||||
textdomain($domain);
|
||||
bind_textdomain_codeset($domain, $codeset);
|
||||
}
|
||||
}
|
|
@ -19,6 +19,15 @@
|
|||
<?php echo $this->element->getElement('password') ?>
|
||||
</dd>
|
||||
|
||||
<dt id="locale-label">
|
||||
<label for="locale" class="required">
|
||||
<?php echo $this->element->getElement('locale')->getLabel() ?>
|
||||
</label>
|
||||
</dt>
|
||||
<dd id="locale-element">
|
||||
<?php echo $this->element->getElement('locale') ?>
|
||||
</dd>
|
||||
|
||||
<?php if (Application_Model_Preference::GetEnableSystemEmail()): ?>
|
||||
<dt id="reset-label" class="hidden"> </dt>
|
||||
<dd id="reset-element" class="text-right">
|
||||
|
|
|
@ -1002,6 +1002,9 @@ dt.block-display, dd.block-display {
|
|||
font-size:14px;
|
||||
padding: 6px 0 6px 3px;
|
||||
}
|
||||
.login-content dd select {
|
||||
width: 100%;
|
||||
}
|
||||
.login-content dd input.ui-button, .login-content dd input.btn {
|
||||
width:100%;
|
||||
font-size:14px;
|
||||
|
|
|
@ -466,6 +466,7 @@ $(document).ready(function() {
|
|||
$.post(baseUrl+'/user/edit-user', {format: 'json', data: data}, function(data) {
|
||||
var json = $.parseJSON(data);
|
||||
$('.edit-current-user').parent().empty().append(json.html);
|
||||
$.cookie("airtime_locale", json.locale, {path: '/'});
|
||||
setCurrentUserPseudoPassword();
|
||||
setTimeout(removeSuccessMsg, 5000);
|
||||
});
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
$(window).load(function(){
|
||||
$("#username").focus();
|
||||
})
|
||||
$("#locale").val($.cookie("airtime_locale"));
|
||||
});
|
||||
|
|
Loading…
Reference in New Issue