wisemapping-open-source/wise-webapp/src/main/webapp/jsp/accountSettings.jsp

140 lines
6.7 KiB
Plaintext
Raw Normal View History

2012-06-30 07:26:21 +02:00
<%@page pageEncoding="UTF-8" %>
<%@include file="/jsp/init.jsp" %>
2012-06-20 18:28:45 +02:00
<div>
<ul class="nav nav-tabs">
<li class="active"><a href="#changeUserPanel" data-toggle="pill"><spring:message code="GENERAL"/></a></li>
<li><a href="#changePasswordPanel" data-toggle="pill"><spring:message code="SECURITY"/></a></li>
<li><a href="#languagePanel" data-toggle="pill"><spring:message code="LANGUAGE"/></a></li>
2012-06-20 18:28:45 +02:00
</ul>
<div class="tab-content">
<div class="tab-pane fade active in" id="changeUserPanel">
<div id="changeInfoMsg" class="alert">
</div>
<form action="#" method="POST" id="changeUserForm">
<fieldset>
<label for="email"><strong><spring:message code="EMAIL"/>:</strong></label>
<input type="text" name="password" id="email" required="required" readonly="readonly"
value="${user.email}"/>
<label for="firstname"><strong><spring:message code="FIRSTNAME"/>:</strong></label>
<input type="text" name="firstname" id="firstname" required="required" value="${user.firstname}"/>
<label for="lastname"><strong><spring:message code="LASTNAME"/>:</strong></label>
<input type="text" name="lastname" id="lastname" required="required" value="${user.lastname}"/>
<br/>
2012-07-15 07:04:53 +02:00
<input type="submit" id="changeUserInfoBtn" class="btn btn-primary"
value="<spring:message code="SAVE_CHANGES"/>"/>
2012-06-20 18:28:45 +02:00
</fieldset>
</form>
</div>
<div class="tab-pane fade" id="changePasswordPanel">
<div id="changePasswordMsg" class="alert">
</div>
<form action="#" method="POST" id="changePasswordForm">
<fieldset>
<label for="password"><strong><spring:message code="NEW_PASSWORD"/>:</strong></label>
<input type="password" name="password" id="password" required="required"/>
<label for="repassword"><strong><spring:message code="CONFIRM_NEW_PASSWORD"/>:</strong></label>
<input type="password" name="password" id="repassword" required="required"/>
<br/>
<input type="submit" id="changePasswordBtn" class="btn btn-primary"
value="<spring:message code="CHANGE_PASSWORD"/>"/>
</fieldset>
</form>
</div>
2012-06-30 07:26:21 +02:00
<div class="tab-pane fade" id="languagePanel">
<div id="languageMsg" class="alert">
</div>
<form action="#" method="POST" id="languageForm">
<fieldset>
<label for="language"><strong><spring:message code="LANGUAGE"/>:</strong></label>
<select name="language" id="language">
<option value="en">English</option>
2012-07-06 04:34:06 +02:00
<option value="es" <c:if test="${user.locale=='es'}">selected="selected" </c:if>>Spanish -
español
</option>
2012-08-22 04:34:12 +02:00
<option value="fr" <c:if test="${user.locale=='fr'}">selected="selected" </c:if>>French -
français
</option>
2012-09-01 01:21:21 +02:00
<option value="it" <c:if test="${user.locale=='it'}">selected="selected" </c:if>>Italian -
italiano
</option>
<option value="pt_BR" <c:if test="${user.locale=='pt_BR'}">selected="selected" </c:if>>
Portuguese
(Brazil) - português (Brasil)
</option>
2012-08-24 03:46:28 +02:00
<option value="zh_CN" <c:if test="${user.locale=='zh_CN'}">selected="selected" </c:if>>Chinese
2012-07-06 04:34:06 +02:00
(Simplified Han) - 中文(简体中文)
</option>
2012-08-24 03:46:28 +02:00
<option value="zh_TW" <c:if test="${user.locale=='zh_TW'}">selected="selected" </c:if>>Chinese
2012-07-06 04:34:06 +02:00
(Traditional Han) - 中文 (繁體中文)
2012-06-30 07:26:21 +02:00
</option>
</select>
<br/>
<input type="submit" id="changeLanguageBtn" class="btn btn-primary"
value="<spring:message code="CHANGE_LANGUAGE"/>"/>
</fieldset>
</form>
</div>
2012-06-20 18:28:45 +02:00
</div>
</div>
<script type="text/javascript">
$('#changePasswordMsg').hide();
2012-06-23 21:15:59 +02:00
$('#changeInfoMsg').hide();
2012-06-30 07:26:21 +02:00
$('#languageMsg').hide();
2012-06-23 21:15:59 +02:00
2012-06-20 18:28:45 +02:00
function postChange(url, postBody, msgContainerId, successMsg) {
// Change success message ...
jQuery.ajax(url, {
async:false,
2012-06-30 07:26:21 +02:00
dataType:'json',
data:postBody,
type:'PUT',
2012-06-20 18:28:45 +02:00
contentType:"text/plain; charset=utf-8",
2012-06-30 07:26:21 +02:00
success:function (data, textStatus, jqXHR) {
2012-06-20 18:28:45 +02:00
$('#' + msgContainerId).removeClass('alert-error').addClass('alert-info').show();
$('#' + msgContainerId).text(successMsg);
},
2012-06-30 07:26:21 +02:00
error:function (jqXHR, textStatus, errorThrown) {
2012-06-20 18:28:45 +02:00
$('#' + msgContainerId).removeClass('alert-info').addClass('alert-error').show();
$('#' + msgContainerId).text(textStatus);
}
});
}
2012-06-30 07:26:21 +02:00
$('#changePasswordForm').submit(function (event) {
2012-06-20 18:28:45 +02:00
var inputVal = $('#changePasswordForm #password').val();
var rinputVal = $('#changePasswordForm #repassword').val();
if (inputVal != rinputVal) {
// Password mismatch message ...
$('#changePasswordMsg').removeClass('alert-info').addClass('alert-error').show();
$('#changePasswordMsg').text('<spring:message code="PASSWORD_MISSMATCH"/>');
} else {
postChange("c/restful/account/password", inputVal, 'changePasswordMsg', '<spring:message code="CHANGE_PASSWORD_SUCCESS"/>');
2012-06-20 18:28:45 +02:00
}
event.preventDefault();
});
2012-06-30 07:26:21 +02:00
$('#changeUserForm').submit(function (event) {
2012-06-20 18:28:45 +02:00
var fistname = $('#changeUserForm #firstname').val();
var lastname = $('#changeUserForm #lastname').val();
postChange("c/restful/account/firstname", fistname, 'changeInfoMsg', '<spring:message code="INFO_UPDATE_SUCCESS"/>');
postChange("c/restful/account/lastname", lastname, 'changeInfoMsg', '<spring:message code="INFO_UPDATE_SUCCESS"/>');
2012-06-20 18:28:45 +02:00
event.preventDefault();
});
2012-06-30 07:26:21 +02:00
$('#languageForm').submit(function (event) {
var locale = $('#languageForm option:selected').val();
postChange("c/restful/account/locale", locale, 'languageMsg', '<spring:message code="INFO_UPDATE_SUCCESS"/>');
2012-06-30 07:26:21 +02:00
event.preventDefault();
});
2012-06-20 18:28:45 +02:00
</script>