liquid_feedback_frontend
view app/main/index/register.lua @ 960:aa91b62e3be8
Suggestions without harmonic weight sorted last
| author | bsw |
|---|---|
| date | Sat Feb 02 22:20:54 2013 +0100 (2013-02-02) |
| parents | ff4ee93abdb8 |
| children | 03b0ac783fe0 |
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(_"Cancel registration")
27 end,
28 module = "index",
29 view = "index"
30 }
31 end)
32 ui.field.hidden{ name = "step", value = 1 }
33 ui.tag{
34 tag = "p",
35 content = _"Please enter the invite code you've received."
36 }
37 ui.field.text{
38 label = _'Invite code',
39 name = 'code',
40 value = param.get("invite")
41 }
42 ui.submit{
43 text = _'Proceed with registration'
44 }
46 else
47 local member = Member:new_selector()
48 :add_where{ "invite_code = ?", code }
49 :add_where{ "activated ISNULL" }
50 :optional_object_mode()
51 :for_update()
52 :exec()
54 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
55 ui.title(_"Registration (step 2 of 3: Personal information)")
56 ui.field.hidden{ name = "step", value = 2 }
57 ui.actions(function()
58 ui.link{
59 content = function()
60 slot.put(_"One step back")
61 end,
62 module = "index",
63 view = "register",
64 params = {
65 invite = code
66 }
67 }
68 slot.put(" · ")
69 ui.link{
70 content = function()
71 slot.put(_"Cancel registration")
72 end,
73 module = "index",
74 view = "index"
75 }
76 end)
78 ui.tag{
79 tag = "p",
80 content = _"This invite key is connected with the following information:"
81 }
83 execute.view{ module = "member", view = "_profile", params = { member = member, include_private_data = true } }
85 if not config.locked_profile_fields.notify_email then
86 ui.tag{
87 tag = "p",
88 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."
89 }
90 ui.field.text{
91 label = _'Email address',
92 name = 'notify_email',
93 value = param.get("notify_email") or member.notify_email
94 }
95 end
96 if not config.locked_profile_fields.name then
97 ui.tag{
98 tag = "p",
99 content = _"Please choose a name, i.e. your real name or your nick name. This name will be shown to others to identify you."
100 }
101 ui.field.text{
102 label = _'Screen name',
103 name = 'name',
104 value = param.get("name") or member.name
105 }
106 end
107 if not config.locked_profile_fields.login then
108 ui.tag{
109 tag = "p",
110 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."
111 }
112 ui.field.text{
113 label = _'Login name',
114 name = 'login',
115 value = param.get("login") or member.login
116 }
117 end
118 ui.submit{
119 text = _'Proceed with registration'
120 }
121 else
123 ui.field.hidden{ name = "step", value = "3" }
124 ui.title(_"Registration (step 3 of 3: Terms of use and password)")
125 ui.actions(function()
126 ui.link{
127 content = function()
128 slot.put(_"One step back")
129 end,
130 module = "index",
131 view = "register",
132 params = {
133 code = code,
134 notify_email = notify_email,
135 name = name,
136 login = login,
137 step = 1
138 }
139 }
140 slot.put(" · ")
141 ui.link{
142 content = function()
143 slot.put(_"Cancel registration")
144 end,
145 module = "index",
146 view = "index"
147 }
148 end)
149 ui.container{
150 attr = { class = "wiki use_terms" },
151 content = function()
152 if config.use_terms_html then
153 slot.put(config.use_terms_html)
154 else
155 slot.put(format.wiki_text(config.use_terms))
156 end
157 end
158 }
160 member.notify_email = notify_email or member.notify_email
161 member.name = name or member.name
162 member.login = login or member.login
164 execute.view{ module = "member", view = "_profile", params = {
165 member = member, include_private_data = true
166 } }
168 for i, checkbox in ipairs(config.use_terms_checkboxes) do
169 slot.put("<br />")
170 ui.tag{
171 tag = "div",
172 content = function()
173 ui.tag{
174 tag = "input",
175 attr = {
176 type = "checkbox",
177 id = "use_terms_checkbox_" .. checkbox.name,
178 name = "use_terms_checkbox_" .. checkbox.name,
179 value = "1",
180 style = "float: left;",
181 checked = param.get("use_terms_checkbox_" .. checkbox.name, atom.boolean) and "checked" or nil
182 }
183 }
184 slot.put(" ")
185 ui.tag{
186 tag = "label",
187 attr = { ['for'] = "use_terms_checkbox_" .. checkbox.name },
188 content = function() slot.put(checkbox.html) end
189 }
190 end
191 }
192 end
194 slot.put("<br />")
196 ui.tag{
197 tag = "p",
198 content = _"Please choose a password and enter it twice. The password is case sensitive."
199 }
200 ui.field.text{
201 readonly = true,
202 label = _'Login name',
203 name = 'login',
204 value = member.login
205 }
206 ui.field.password{
207 label = _'Password',
208 name = 'password1',
209 }
210 ui.field.password{
211 label = _'Password (repeat)',
212 name = 'password2',
213 }
214 ui.submit{
215 text = _'Activate account'
216 }
217 end
218 end
219 end
220 }
