liquid_feedback_frontend
view app/main/index/register.lua @ 743:7a452bd3d0df
Optical enhancements
| author | bsw |
|---|---|
| date | Thu Jun 28 22:27:05 2012 +0200 (2012-06-28) |
| parents | b8b205e65c6d |
| children | 782950d33f3d |
line source
1 execute.view{ module = "index", view = "_lang_chooser" }
3 local step = param.get("step", atom.integer)
4 local code = param.get("code")
5 local notify_email = param.get("notify_email")
6 local name = param.get("name")
7 local login = param.get("login")
9 ui.form{
10 attr = { class = "vertical" },
11 module = 'index',
12 action = 'register',
13 params = {
14 code = code,
15 notify_email = notify_email,
16 name = name,
17 login = login
18 },
19 content = function()
21 if not code then
22 ui.title(_"Registration (step 1 of 3: Invite code)")
23 ui.actions(function()
24 ui.link{
25 content = function()
26 slot.put(_"One step back")
27 end,
28 module = "index",
29 view = "register",
30 params = {
31 }
32 }
33 slot.put(" · ")
34 ui.link{
35 content = function()
36 slot.put(_"Cancel registration")
37 end,
38 module = "index",
39 view = "index"
40 }
41 end)
42 ui.field.hidden{ name = "step", value = 1 }
43 ui.tag{
44 tag = "p",
45 content = _"Please enter the invite code you've received."
46 }
47 ui.field.text{
48 label = _'Invite code',
49 name = 'code',
50 value = param.get("invite")
51 }
53 else
54 local member = Member:new_selector()
55 :add_where{ "invite_code = ?", code }
56 :add_where{ "activated ISNULL" }
57 :optional_object_mode()
58 :for_update()
59 :exec()
61 if not member.notify_email and not notify_email or not member.name and not name or not member.login and not login or step == 1 then
62 ui.title(_"Registration (step 2 of 3: Personal information)")
63 ui.field.hidden{ name = "step", value = 2 }
64 ui.actions(function()
65 ui.link{
66 content = function()
67 slot.put(_"One step back")
68 end,
69 module = "index",
70 view = "register",
71 params = {
72 }
73 }
74 slot.put(" · ")
75 ui.link{
76 content = function()
77 slot.put(_"Cancel registration")
78 end,
79 module = "index",
80 view = "index"
81 }
82 end)
84 ui.tag{
85 tag = "p",
86 content = _"This invite key is connected with the following information:"
87 }
89 execute.view{ module = "member", view = "_profile", params = { member = member, include_private_data = true } }
91 if not config.locked_profile_fields.notify_email then
92 ui.tag{
93 tag = "p",
94 content = _"Please enter your email address. This address will be used for automatic notifications (if you request them) and in case you've lost your password. This address will not be published. After registration you will receive an email with a confirmation link."
95 }
96 ui.field.text{
97 label = _'Email address',
98 name = 'notify_email',
99 value = param.get("notify_email") or member.notify_email
100 }
101 end
102 if not config.locked_profile_fields.name then
103 ui.tag{
104 tag = "p",
105 content = _"Please choose a name, i.e. your real name or your nick name. This name will be shown to others to identify you."
106 }
107 ui.field.text{
108 label = _'Screen name',
109 name = 'name',
110 value = param.get("name") or member.name
111 }
112 end
113 if not config.locked_profile_fields.login then
114 ui.tag{
115 tag = "p",
116 content = _"Please choose a login name. This name will not be shown to others and is used only by you to login into the system. The login name is case sensitive."
117 }
118 ui.field.text{
119 label = _'Login name',
120 name = 'login',
121 value = param.get("login") or member.login
122 }
123 end
124 else
126 ui.field.hidden{ name = "step", value = "3" }
127 ui.title(_"Registration (step 3 of 3: Terms of use and password)")
128 ui.actions(function()
129 ui.link{
130 content = function()
131 slot.put(_"One step back")
132 end,
133 module = "index",
134 view = "register",
135 params = {
136 code = code,
137 notify_email = notify_email,
138 name = name,
139 login = login,
140 step = 1
141 }
142 }
143 slot.put(" · ")
144 ui.link{
145 content = function()
146 slot.put(_"Cancel registration")
147 end,
148 module = "index",
149 view = "index"
150 }
151 end)
152 ui.container{
153 attr = { class = "wiki use_terms" },
154 content = function()
155 if config.use_terms_html then
156 slot.put(config.use_terms_html)
157 else
158 slot.put(format.wiki_text(config.use_terms))
159 end
160 end
161 }
163 member.notify_email = notify_email or member.notify_email
164 member.name = name or member.name
165 member.login = login or member.login
167 execute.view{ module = "member", view = "_profile", params = {
168 member = member, include_private_data = true
169 } }
171 for i, checkbox in ipairs(config.use_terms_checkboxes) do
172 slot.put("<br />")
173 ui.tag{
174 tag = "div",
175 content = function()
176 ui.tag{
177 tag = "input",
178 attr = {
179 type = "checkbox",
180 id = "use_terms_checkbox_" .. checkbox.name,
181 name = "use_terms_checkbox_" .. checkbox.name,
182 value = "1",
183 style = "float: left;",
184 checked = param.get("use_terms_checkbox_" .. checkbox.name, atom.boolean) and "checked" or nil
185 }
186 }
187 slot.put(" ")
188 ui.tag{
189 tag = "label",
190 attr = { ['for'] = "use_terms_checkbox_" .. checkbox.name },
191 content = function() slot.put(checkbox.html) end
192 }
193 end
194 }
195 end
197 slot.put("<br />")
199 ui.tag{
200 tag = "p",
201 content = _"Please choose a password and enter it twice. The password is case sensitive."
202 }
203 ui.field.password{
204 label = _'Password',
205 name = 'password1',
206 }
207 ui.field.password{
208 label = _'Password (repeat)',
209 name = 'password2',
210 }
212 end
213 end
215 ui.submit{
216 text = _'Create account'
217 }
218 end
219 }
