CC-4786: Refresh page when language setting changes
-done
This commit is contained in:
parent
c20ed7ebad
commit
2797809c74
6 changed files with 15 additions and 21 deletions
|
@ -13,7 +13,7 @@ class LoginController extends Zend_Controller_Action
|
||||||
|
|
||||||
$request = $this->getRequest();
|
$request = $this->getRequest();
|
||||||
|
|
||||||
Application_Model_Locale::configureLocalization($request->getcookie('airtime_locale'));
|
Application_Model_Locale::configureLocalization($request->getcookie('airtime_locale', 'en_CA'));
|
||||||
if (Zend_Auth::getInstance()->hasIdentity())
|
if (Zend_Auth::getInstance()->hasIdentity())
|
||||||
{
|
{
|
||||||
|
|
||||||
|
|
|
@ -129,12 +129,7 @@ class UserController extends Zend_Controller_Action
|
||||||
$request = $this->getRequest();
|
$request = $this->getRequest();
|
||||||
$form = new Application_Form_EditUser();
|
$form = new Application_Form_EditUser();
|
||||||
if ($request->isPost()) {
|
if ($request->isPost()) {
|
||||||
$params = $request->getPost();
|
$formData = $request->getPost();
|
||||||
$postData = explode('&', $params['data']);
|
|
||||||
foreach($postData as $k=>$v) {
|
|
||||||
$v = explode('=', $v);
|
|
||||||
$formData[$v[0]] = urldecode($v[1]);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (isset($CC_CONFIG['demo']) && $CC_CONFIG['demo'] == 1
|
if (isset($CC_CONFIG['demo']) && $CC_CONFIG['demo'] == 1
|
||||||
&& $formData['cu_login'] == 'admin') {
|
&& $formData['cu_login'] == 'admin') {
|
||||||
|
@ -157,12 +152,18 @@ class UserController extends Zend_Controller_Action
|
||||||
$user->setSkype($formData['cu_skype']);
|
$user->setSkype($formData['cu_skype']);
|
||||||
$user->setJabber($formData['cu_jabber']);
|
$user->setJabber($formData['cu_jabber']);
|
||||||
$user->save();
|
$user->save();
|
||||||
|
|
||||||
|
//configure localization with new locale setting
|
||||||
|
Application_Model_Locale::configureLocalization($formData['cu_locale']);
|
||||||
|
//reinitialize form so language gets translated
|
||||||
|
$form = new Application_Form_EditUser();
|
||||||
|
|
||||||
Application_Model_Preference::SetUserLocale($user->getId(), $formData['cu_locale']);
|
Application_Model_Preference::SetUserLocale($user->getId(), $formData['cu_locale']);
|
||||||
Application_Model_Preference::SetUserTimezone($user->getId(), $formData['cu_timezone']);
|
Application_Model_Preference::SetUserTimezone($user->getId(), $formData['cu_timezone']);
|
||||||
$this->view->successMessage = "<div class='success'>"._("User updated successfully!")."</div>";
|
$this->view->successMessage = "<div class='success'>"._("Settings updated successfully!")."</div>";
|
||||||
}
|
}
|
||||||
$this->view->form = $form;
|
$this->view->form = $form;
|
||||||
die(json_encode(array("locale"=>$formData['cu_locale'], "html"=>$this->view->render('user/edit-user.phtml'))));
|
$this->view->html = $this->view->render('user/edit-user.phtml');
|
||||||
}
|
}
|
||||||
$this->view->form = $form;
|
$this->view->form = $form;
|
||||||
$this->view->html = $this->view->render('user/edit-user.phtml');
|
$this->view->html = $this->view->render('user/edit-user.phtml');
|
||||||
|
|
|
@ -18,7 +18,7 @@ class Application_Form_EditUser extends Zend_Form
|
||||||
$emailValidator = Application_Form_Helper_ValidationTypes::overrideEmailAddressValidator();
|
$emailValidator = Application_Form_Helper_ValidationTypes::overrideEmailAddressValidator();
|
||||||
|
|
||||||
$this->setDecorators(array(
|
$this->setDecorators(array(
|
||||||
array('ViewScript', array('viewScript' => 'form/edit-user.phtml'))));
|
array('ViewScript', array('viewScript' => 'form/edit-user.phtml', "currentUser" => $currentUser->getLogin()))));
|
||||||
$this->setAttrib('id', 'current-user-form');
|
$this->setAttrib('id', 'current-user-form');
|
||||||
|
|
||||||
$hidden = new Zend_Form_Element_Hidden('cu_user_id');
|
$hidden = new Zend_Form_Element_Hidden('cu_user_id');
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
|
<h2><? echo sprintf(_("%s's Settings"), $this->currentUser) ?></h2>
|
||||||
<div id="current-user-container">
|
<div id="current-user-container">
|
||||||
<form id="current-user-form" class="edit-user-global" enctype="application/x-www-form-urlencoded">
|
<form id="current-user-form" class="edit-user-global" method="post" enctype="application/x-www-form-urlencoded">
|
||||||
<dl class="zend_form">
|
<dl class="zend_form">
|
||||||
<?php echo $this->element->getElement('cu_user_id') ?>
|
<?php echo $this->element->getElement('cu_user_id') ?>
|
||||||
<dt id="cu-username-label">
|
<dt id="cu-username-label">
|
||||||
|
@ -142,7 +143,7 @@
|
||||||
</ul>
|
</ul>
|
||||||
<?php endif; ?>
|
<?php endif; ?>
|
||||||
</dd>
|
</dd>
|
||||||
<button id="cu_save_user" type="button" class="btn btn-small right-floated">Save</button>
|
<button type="submit" id="cu_save_user" class="btn btn-small right-floated">Save</button>
|
||||||
</dl>
|
</dl>
|
||||||
</form>
|
</form>
|
||||||
</div>
|
</div>
|
|
@ -1,5 +1,4 @@
|
||||||
<div class="ui-widget ui-widget-content block-shadow clearfix padded-strong edit-current-user">
|
<div class="ui-widget ui-widget-content block-shadow clearfix padded-strong edit-current-user">
|
||||||
<h2><? echo _("Edit User") ?></h2>
|
|
||||||
<?php echo $this->successMessage ?>
|
<?php echo $this->successMessage ?>
|
||||||
<?php echo $this->form?>
|
<?php echo $this->form?>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -462,14 +462,7 @@ $(document).ready(function() {
|
||||||
});
|
});
|
||||||
|
|
||||||
$('#cu_save_user').live('click', function() {
|
$('#cu_save_user').live('click', function() {
|
||||||
var data = $('#current-user-form').serialize();
|
$.cookie("airtime_locale", $('#cu_locale').val(), {path: '/'});
|
||||||
$.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);
|
|
||||||
});
|
|
||||||
});
|
});
|
||||||
|
|
||||||
// When the 'Listen' button is clicked we set the width
|
// When the 'Listen' button is clicked we set the width
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue