MentaTutorials

Rev

Rev 53 | Go to most recent revision | Details | Last modification | View Log | RSS feed

Rev Author Line No. Line
16 soliveira 1
<%@ page contentType="text/html; charset=UTF-8" %>
2
<%@taglib prefix="mtw" uri="http://www.mentaframework.org/tags-mtw/" %>
3
 
4
<mtw:useI18N prefix="user.edit" />
5
 
6
<mtw:requiresAuthentication />
7
 
8
<html>
9
	<head>
10
 
11
		<title><mtw:i18n key="title" noPrefix="true" /></title>
12
 
13
		<script type="text/javascript" src="<mtw:contextPath />/jquery/jquery-1.4.4.min.js"></script>
14
 
15
		<script type="text/javascript">
16
 
17
		$(document).ready(function() {
18
 
19
			$('#usernameLoading').hide();
20
 
21
			$('#username').blur(function() {
22
 
23
				  $('#usernameMessage').hide();
24
 
25
				  if ($('#username').val().trim() != '') {
26
 
27
					  $('#usernameLoading').show();
28
 
29
					  if ($('#username').val() == '<mtw:out value="user.username" />') {
30
						    $('#usernameMessage').fadeOut();
31
				       	    setTimeout("usernameResult('same')", 400);
32
				       	    return false;
33
					  }
34
 
35
				      $.post("<mtw:contextPath />/User.check.mtw", { username: $('#username').val() }, function(response) {
36
				        	$('#usernameMessage').fadeOut();
37
				        	setTimeout("usernameResult('" + escape(response) + "')", 400);
38
				      });
39
 
40
				  }
41
 
42
				  return false;
43
			});
44
		});
45
 
46
		function usernameResult(response) {
47
 
48
			$('#usernameLoading').hide();
49
 
50
			var res = unescape(response);
51
 
52
			if (res == "error") {
53
 
54
				$('#usernameMessage').html('<font color="red"><b><mtw:i18n key="username_error" /></b></font>');
55
				$('#usernameMessage').fadeIn();
56
 
57
			} else if (res == "same") {
58
 
59
				$('#usernameMessage').html('');
60
				$('#usernameMessage').fadeIn();
61
 
62
 
63
			} else if (res == "success") {
64
 
65
				$('#usernameMessage').html('<img src="<mtw:contextPath />/images/chk.gif" />');
66
				$('#usernameMessage').fadeIn();
67
 
68
			} else if (res == "already") {
69
 
70
				$('#usernameMessage').html('<font color="red"><b><mtw:i18n key="username_already" /></b></font>');
71
				$('#usernameMessage').fadeIn();
72
			}
73
		}
74
 
75
		</script>
76
 
77
	</head>
78
 
79
	<body>
80
 
81
		<h3><mtw:i18n key="account" /></h3>
82
 
83
		<form action="<mtw:contextPath />/User.edit.mtw" method="post">
84
			<mtw:bean value="user">
85
				<table>
86
 
87
					<mtw:input type="hidden" name="id" />
88
					<tr>
89
						<td><mtw:i18n key="username" /></td>
90
						<td>
91
							<mtw:input name="username" size="30" maxlength="30" id="username" />
92
							<span id="usernameLoading">
93
								<img src="<mtw:contextPath />/images/loading.gif" />
94
							</span>
95
							<span id="usernameMessage">
96
								<mtw:outError field="username">
97
									<font color="red"><b><mtw:out /></b></font>
98
								</mtw:outError>
99
							</span>
100
						</td>
101
					</tr>
102
					<tr>
103
						<td><mtw:i18n key="email" /></td>
104
						<td><mtw:input name="email" size="30" maxlength="100" />
105
							<mtw:outError field="email">
106
								<font color="red"> <b><mtw:out /></b> </font>
107
							</mtw:outError>
108
						</td>
109
					</tr>
110
					<tr>
111
						<td><mtw:i18n key="group" /></td>
112
						<td>
113
							<mtw:select name="groupId" list="groups" />
114
							<mtw:outError field="groupId">
115
								<font color="red"> <b><mtw:out /></b> </font>
116
							</mtw:outError></td>
117
					</tr>
118
					<tr>
119
						<td><mtw:i18n key="language" /></td>
120
						<td><mtw:select name="languageId" list="languages" />
121
							<mtw:outError field="languageId">
122
								<font color="red"> <b><mtw:out /></b> </font>
123
							</mtw:outError>
124
						</td>
125
					</tr>
126
 
127
					<tr>
128
						<td colspan="2">
129
							<input type="submit" value="<mtw:i18n key="save" />" />
130
						</td>
131
					</tr>
132
				</table>
133
			</mtw:bean>
134
		</form>
135
 
136
		<p>
137
			<a href="<mtw:contextPath />/jsp/index.jsp"><mtw:i18n key="back" /></a>
138
		</p>
139
 
140
	</body>
141
</html>
142