Mercurial Hosting > nabble
comparison src/nabble/view/naml/manage_users_and_groups.naml @ 0:7ecd1a4ef557
add content
author | Franklin Schmidt <fschmidt@gmail.com> |
---|---|
date | Thu, 21 Mar 2019 19:15:52 -0600 |
parents | |
children |
comparison
equal
deleted
inserted
replaced
-1:000000000000 | 0:7ecd1a4ef557 |
---|---|
1 <macro name="manage_users_and_groups" requires="servlet"> | |
2 <n.if.not.visitor.can_manage_users_and_groups> | |
3 <then> | |
4 <n.login.><t>Only authorized users can proceed in this area.</t></n.login.> | |
5 </then> | |
6 </n.if.not.visitor.can_manage_users_and_groups> | |
7 | |
8 <n.if.is_submitted_form> | |
9 <then.save_users_and_group/> | |
10 </n.if.is_submitted_form> | |
11 | |
12 <n.html> | |
13 <head> | |
14 <META NAME="robots" CONTENT="noindex,nofollow"/> | |
15 <n.title.><t>Manage Users & Groups</t></n.title.> | |
16 <n.if.is_submitted_form> | |
17 <then> | |
18 <script type="text/javascript"> | |
19 $(document).ready(function() { | |
20 notice('<t>Data successfully saved</t>', 2000, 1000); | |
21 }); | |
22 </script> | |
23 </then> | |
24 </n.if.is_submitted_form> | |
25 </head> | |
26 <body> | |
27 <n.edit_header first_text="[t]Manage Users & Groups[/t]" second_text="[n.root_node.subject/]" /> | |
28 | |
29 <div class="weak-color" style="margin-top:1em"> | |
30 <t>Below you can manage groups and users. You can copy and paste users in order | |
31 to move them from one group to another.</t> | |
32 </div> | |
33 | |
34 <div class="weak-color" style="margin:.5em 0 1em"> | |
35 <t>You can also <n.root_node.change_permissions_link.>change the permissions</n.root_node.change_permissions_link.> of the groups below.</t> | |
36 </div> | |
37 | |
38 <n.user_groups.> | |
39 <n.add.members_group/> | |
40 <n.add.administrators_group/> | |
41 <n.sort/> | |
42 <n.vertical_tab_control.> | |
43 <n.add_new_group_vertical_tab/> | |
44 <n.add_all_users_vertical_tab/> | |
45 <n.add_registered_vertical_tab/> | |
46 <n.loop.> | |
47 <n.add_group_vertical_tab group="[n.current_group/]"/> | |
48 </n.loop.> | |
49 <n.reset_list_index/> | |
50 </n.vertical_tab_control.> | |
51 </n.user_groups.> | |
52 </body> | |
53 </n.html> | |
54 </macro> | |
55 | |
56 <macro name="add_new_group_vertical_tab"> | |
57 <n.add_vertical_tab> | |
58 <icon><img src="/images/add.png" width="12" height="12" style="vertical-align:-10%"/></icon> | |
59 <text><t>Add New Group</t></text> | |
60 <url><n.manage_users_and_groups_path/></url> | |
61 <selected><n.is_null.selected_group/></selected> | |
62 <details><n.new_group_panel/></details> | |
63 </n.add_vertical_tab> | |
64 </macro> | |
65 | |
66 <macro name="add_all_users_vertical_tab"> | |
67 <n.add_vertical_tab> | |
68 <text><t>All Users</t></text> | |
69 <style>padding-left:20px</style> | |
70 <url><n.manage_users_and_groups_path group="All_Users"/></url> | |
71 <selected><n.equal value1="[n.selected_group/]" value2="All_Users"/></selected> | |
72 <details><n.all_users_panel/></details> | |
73 </n.add_vertical_tab> | |
74 </macro> | |
75 | |
76 <macro name="add_registered_vertical_tab"> | |
77 <n.add_vertical_tab> | |
78 <text><t>Registered Users</t></text> | |
79 <style>padding-left:20px</style> | |
80 <url><n.manage_users_and_groups_path group="Registered"/></url> | |
81 <selected><n.equal value1="[n.selected_group/]" value2="Registered"/></selected> | |
82 <details><n.registered_users_panel/></details> | |
83 </n.add_vertical_tab> | |
84 </macro> | |
85 | |
86 <macro name="add_group_vertical_tab" parameters="group"> | |
87 <n.add_vertical_tab> | |
88 <text><n.group/></text> | |
89 <style>padding-left:20px</style> | |
90 <url><n.manage_users_and_groups_path group="[n.group/]"/></url> | |
91 <selected><n.equal value1="[n.selected_group/]" value2="[n.group/]"/></selected> | |
92 <details><n.group_editor_panel group="[n.group/]"/></details> | |
93 </n.add_vertical_tab> | |
94 </macro> | |
95 | |
96 <macro name="save_users_and_group"> | |
97 <n.string_list. values="[n.users_field.value/]" separator="\n"> | |
98 <n.filter_by.not.is_empty.current_string/> | |
99 <n.remove_group group="[n.selected_group/]"/> | |
100 <n.loop.> | |
101 <n.set_var. name='email'> | |
102 <n.get_email_address_from.current_string/> | |
103 </n.set_var.> | |
104 <n.if.not.is_empty.var name='email'> | |
105 <then> | |
106 <n.get_or_create_user. email="[n.var name='email'/]"> | |
107 <n.as_user_page.edit_page_user.> | |
108 <n.add_to_group.selected_group/> | |
109 </n.as_user_page.edit_page_user.> | |
110 </n.get_or_create_user.> | |
111 </then> | |
112 </n.if.not.is_empty.var> | |
113 </n.loop.> | |
114 | |
115 <n.if.list_is_empty> | |
116 <then.redirect_to.manage_users_and_groups_path/> | |
117 </n.if.list_is_empty> | |
118 </n.string_list.> | |
119 </macro> | |
120 | |
121 <macro name="manage_users_and_groups_path" parameters="group"> | |
122 <n.encode_url.remove_spaces.> | |
123 /template/NamlServlet.jtp?macro=manage_users_and_groups | |
124 <n.add_to_path name="group" value="[n.group/]"/> | |
125 </n.encode_url.remove_spaces.> | |
126 </macro> | |
127 | |
128 <macro name="selected_group"> | |
129 <n.get_parameter name='group'/> | |
130 </macro> | |
131 | |
132 <macro name="group_editor_panel" parameters="group"> | |
133 <div class="second-font field-title nowrap" style="margin-top:0"> | |
134 <n.group/> | |
135 </div> | |
136 <n.short_description/> | |
137 <n.users_field.set_value.> | |
138 <n.users_in_group. group="[n.group/]"> | |
139 <n.loop.> | |
140 <n.current_user.name/> <n.lt/><n.current_user.user_email/><n.gt/><n.crlf/> | |
141 </n.loop.> | |
142 </n.users_in_group.> | |
143 </n.users_field.set_value.> | |
144 <n.form.> | |
145 <input type="hidden" name="group" value="[n.selected_group/]"/> | |
146 <n.users_field.textarea wrap="SOFT" style="width:100%;height:25em;margin:.3em 0" /> | |
147 <input type="submit" value="[t]Save Changes[/t]"/> | |
148 </n.form.> | |
149 </macro> | |
150 | |
151 <macro name="short_description"> | |
152 <div class="weak-color nowrap"> | |
153 <t>Enter one user per row</t> (<a href="javascript: void(0)" onclick="$('#help').slideToggle()"><t>more help</t></a>) | |
154 <div id="help" style="display:none"> | |
155 <b><t>Examples:</t></b> | |
156 <div style="margin-left:1em"> | |
157 john_smith@example.com<br/> | |
158 John Smith <john_smith@example.com> | |
159 </div> | |
160 <div> | |
161 <t>To remove a group, empty the text area below and save the changes.</t> | |
162 </div> | |
163 </div> | |
164 </div> | |
165 </macro> | |
166 | |
167 <macro name="all_users_panel"> | |
168 <div class="second-font field-title nowrap" style="margin:0"><t>All Users</t></div> | |
169 <div class="weak-color" style="margin-bottom:.8em"> | |
170 <t>Read-only list with all users with an email under <t.location.root_node.subject/>.</t> | |
171 <t>This list shows registered, unregistered and banned users. Anonymous users are not listed because they don't have an email and thus cannot be part of a group.</t> | |
172 </div> | |
173 | |
174 <div style="height:25em;overflow:auto"> | |
175 <n.site_users. length="99999"> | |
176 <n.loop.> | |
177 <n.current_user.name/> <<n.current_user.user_email/>><br/> | |
178 </n.loop.> | |
179 </n.site_users.> | |
180 </div> | |
181 </macro> | |
182 | |
183 <macro name="registered_users_panel"> | |
184 <div class="second-font field-title nowrap" style="margin:0"><t>Registered Users</t></div> | |
185 <div class="weak-color" style="margin-bottom:.8em"> | |
186 <t>All users that have registered to <t.location.root_node.subject/>. | |
187 These users have confirmed their email addresses and are able to login to the system.</t> | |
188 </div> | |
189 | |
190 <div style="height:25em;overflow:auto"> | |
191 <n.site_users. length="99999"> | |
192 <n.filter_by.both condition1="[n.current_user.is_registered/]" condition2="[n.current_user.not.is_banned/]"/> | |
193 <n.loop.> | |
194 <n.current_user.name/> <<n.current_user.user_email/>><br/> | |
195 </n.loop.> | |
196 </n.site_users.> | |
197 </div> | |
198 </macro> | |
199 | |
200 <macro name="new_group_panel"> | |
201 <n.put_in_head.> | |
202 <script type="text/javascript"> | |
203 function checkGroupName() { | |
204 var name = $('#group-name').val(); | |
205 var isValidName = name && Nabble.trim(name).length > 0 && name != 'Authors' && name != 'authors'; | |
206 if (!isValidName) { | |
207 alert('<t>The name of the group is not valid.</t>'); | |
208 return false; | |
209 } | |
210 return true; | |
211 } | |
212 </script> | |
213 </n.put_in_head.> | |
214 <n.form. onsubmit="return checkGroupName()"> | |
215 <div class="second-font field-title nowrap" style="margin:0"> | |
216 <t>Group Name:</t> | |
217 <input id="group-name" type="text" name="group"/> | |
218 </div> | |
219 <n.short_description/> | |
220 <input type="hidden" name="group" value="[n.selected_group/]"/> | |
221 <n.users_field.textarea wrap="SOFT" style="width:100%;height:25em;margin:.3em 0" /> | |
222 <input type="submit" value="[t]Save Changes[/t]"/> | |
223 </n.form.> | |
224 </macro> | |
225 | |
226 <macro name="users_field" dot_parameter="do"> | |
227 <n.field. name="users"><n.do/></n.field.> | |
228 </macro> | |
229 | |
230 <macro name="get_email_address_from" dot_parameter="text"> | |
231 <n.if.not.is_null.extract_email_address_from.text> | |
232 <then.extract_email_address_from.text/> | |
233 <else> | |
234 <n.if.has_authenticated_user_with_name name="[n.text/]"> | |
235 <then> | |
236 <n.get_authenticated_user_with_name. name="[n.text/]"> | |
237 <n.user_email/> | |
238 </n.get_authenticated_user_with_name.> | |
239 </then> | |
240 </n.if.has_authenticated_user_with_name> | |
241 </else> | |
242 </n.if.not.is_null.extract_email_address_from.text> | |
243 </macro> |