Mercurial > hg > vamp-website
comparison forum/Themes/Vamp/ManagePermissions.template.php @ 76:e3e11437ecea website
Add forum code
author | Chris Cannam |
---|---|
date | Sun, 07 Jul 2013 11:25:48 +0200 |
parents | |
children |
comparison
equal
deleted
inserted
replaced
75:72f59aa7e503 | 76:e3e11437ecea |
---|---|
1 <?php | |
2 /** | |
3 * Simple Machines Forum (SMF) | |
4 * | |
5 * @package SMF | |
6 * @author Simple Machines | |
7 * @copyright 2011 Simple Machines | |
8 * @license http://www.simplemachines.org/about/smf/license.php BSD | |
9 * | |
10 * @version 2.0 | |
11 */ | |
12 | |
13 function template_permission_index() | |
14 { | |
15 global $context, $settings, $options, $scripturl, $txt, $modSettings; | |
16 | |
17 // Not allowed to edit? | |
18 if (!$context['can_modify']) | |
19 echo ' | |
20 <div class="errorbox"> | |
21 ', sprintf($txt['permission_cannot_edit'], $scripturl . '?action=admin;area=permissions;sa=profiles'), ' | |
22 </div>'; | |
23 | |
24 echo ' | |
25 <div id="admincenter"> | |
26 <form action="', $scripturl, '?action=admin;area=permissions;sa=quick" method="post" accept-charset="', $context['character_set'], '" name="permissionForm" id="permissionForm">'; | |
27 | |
28 if (!empty($context['profile'])) | |
29 echo ' | |
30 <div class="title_bar"> | |
31 <h3 class="titlebg">', $txt['permissions_for_profile'], ': "', $context['profile']['name'], '"</h3> | |
32 </div>'; | |
33 | |
34 echo ' | |
35 <table width="100%" class="table_grid"> | |
36 <thead> | |
37 <tr class="catbg"> | |
38 <th class="first_th">', $txt['membergroups_name'], '</th> | |
39 <th width="10%" align="center" valign="middle">', $txt['membergroups_members_top'], '</th>'; | |
40 | |
41 if (empty($modSettings['permission_enable_deny'])) | |
42 echo ' | |
43 <th width="16%" align="center">', $txt['membergroups_permissions'], '</th>'; | |
44 else | |
45 echo ' | |
46 <th width="8%" align="center">', $txt['permissions_allowed'], '</th> | |
47 <th width="8%" align="center">', $txt['permissions_denied'], '</th>'; | |
48 | |
49 echo ' | |
50 <th width="10%" align="center" valign="middle">', $context['can_modify'] ? $txt['permissions_modify'] : $txt['permissions_view'], '</th> | |
51 <th class="last_th" width="4%" align="center" valign="middle"> | |
52 ', $context['can_modify'] ? '<input type="checkbox" class="input_check" onclick="invertAll(this, this.form, \'group\');" />' : '', ' | |
53 </th> | |
54 </tr> | |
55 </thead> | |
56 <tbody>'; | |
57 | |
58 $alternate = false; | |
59 foreach ($context['groups'] as $group) | |
60 { | |
61 $alternate = !$alternate; | |
62 echo ' | |
63 <tr class="windowbg', $alternate ? '2' : '', '"> | |
64 <td> | |
65 ', $group['name'], $group['id'] == -1 ? ' (<a href="' . $scripturl . '?action=helpadmin;help=membergroup_guests" onclick="return reqWin(this.href);">?</a>)' : ($group['id'] == 0 ? ' (<a href="' . $scripturl . '?action=helpadmin;help=membergroup_regular_members" onclick="return reqWin(this.href);">?</a>)' : ($group['id'] == 1 ? ' (<a href="' . $scripturl . '?action=helpadmin;help=membergroup_administrator" onclick="return reqWin(this.href);">?</a>)' : ($group['id'] == 3 ? ' (<a href="' . $scripturl . '?action=helpadmin;help=membergroup_moderator" onclick="return reqWin(this.href);">?</a>)' : ''))); | |
66 | |
67 if (!empty($group['children'])) | |
68 echo ' | |
69 <br /><span class="smalltext">', $txt['permissions_includes_inherited'], ': "', implode('", "', $group['children']), '"</span>'; | |
70 | |
71 echo ' | |
72 </td> | |
73 <td align="center">', $group['can_search'] ? $group['link'] : $group['num_members'], '</td>'; | |
74 | |
75 if (empty($modSettings['permission_enable_deny'])) | |
76 echo ' | |
77 <td width="16%" align="center">', $group['num_permissions']['allowed'], '</td>'; | |
78 else | |
79 echo ' | |
80 <td width="8%" align="center"', $group['id'] == 1 ? ' style="font-style: italic;"' : '', '>', $group['num_permissions']['allowed'], '</td> | |
81 <td width="8%" align="center"', $group['id'] == 1 || $group['id'] == -1 ? ' style="font-style: italic;"' : (!empty($group['num_permissions']['denied']) ? ' style="color: red;"' : ''), '>', $group['num_permissions']['denied'], '</td>'; | |
82 | |
83 echo ' | |
84 <td align="center">', $group['allow_modify'] ? '<a href="' . $scripturl . '?action=admin;area=permissions;sa=modify;group=' . $group['id'] . (empty($context['profile']) ? '' : ';pid=' . $context['profile']['id']) . '">' . ($context['can_modify'] ? $txt['permissions_modify'] : $txt['permissions_view']). '</a>' : '', '</td> | |
85 <td align="center">', $group['allow_modify'] && $context['can_modify'] ? '<input type="checkbox" name="group[]" value="' . $group['id'] . '" class="input_check" />' : '', '</td> | |
86 </tr>'; | |
87 } | |
88 | |
89 echo ' | |
90 </tbody> | |
91 </table> | |
92 <br />'; | |
93 | |
94 // Advanced stuff... | |
95 if ($context['can_modify']) | |
96 { | |
97 echo ' | |
98 <div class="cat_bar"> | |
99 <h3 class="catbg"> | |
100 <span class="ie6_header floatleft"> | |
101 <img src="', $settings['images_url'], '/', empty($context['show_advanced_options']) ? 'selected' : 'sort_down', '.gif" id="permissions_panel_toggle" alt="*" /> ', $txt['permissions_advanced_options'], ' | |
102 </span> | |
103 </h3> | |
104 </div> | |
105 <div id="permissions_panel_advanced" class="windowbg"> | |
106 <span class="topslice"><span></span></span> | |
107 <div class="content"> | |
108 <fieldset> | |
109 <legend>', $txt['permissions_with_selection'], '</legend> | |
110 <dl class="settings admin_permissions"> | |
111 <dt> | |
112 ', $txt['permissions_apply_pre_defined'], ' <a href="', $scripturl, '?action=helpadmin;help=permissions_quickgroups" onclick="return reqWin(this.href);">(?)</a>: | |
113 </dt> | |
114 <dd> | |
115 <select name="predefined"> | |
116 <option value="">(', $txt['permissions_select_pre_defined'], ')</option> | |
117 <option value="restrict">', $txt['permitgroups_restrict'], '</option> | |
118 <option value="standard">', $txt['permitgroups_standard'], '</option> | |
119 <option value="moderator">', $txt['permitgroups_moderator'], '</option> | |
120 <option value="maintenance">', $txt['permitgroups_maintenance'], '</option> | |
121 </select> | |
122 </dd> | |
123 <dt> | |
124 ', $txt['permissions_like_group'], ': | |
125 </dt> | |
126 <dd> | |
127 <select name="copy_from"> | |
128 <option value="empty">(', $txt['permissions_select_membergroup'], ')</option>'; | |
129 foreach ($context['groups'] as $group) | |
130 { | |
131 if ($group['id'] != 1) | |
132 echo ' | |
133 <option value="', $group['id'], '">', $group['name'], '</option>'; | |
134 } | |
135 | |
136 echo ' | |
137 </select> | |
138 </dd> | |
139 <dt> | |
140 <select name="add_remove"> | |
141 <option value="add">', $txt['permissions_add'], '...</option> | |
142 <option value="clear">', $txt['permissions_remove'], '...</option>'; | |
143 if (!empty($modSettings['permission_enable_deny'])) | |
144 echo ' | |
145 <option value="deny">', $txt['permissions_deny'], '...</option>'; | |
146 echo ' | |
147 </select> | |
148 </dt> | |
149 <dd style="overflow:auto;"> | |
150 <select name="permissions"> | |
151 <option value="">(', $txt['permissions_select_permission'], ')</option>'; | |
152 foreach ($context['permissions'] as $permissionType) | |
153 { | |
154 if ($permissionType['id'] == 'membergroup' && !empty($context['profile'])) | |
155 continue; | |
156 | |
157 foreach ($permissionType['columns'] as $column) | |
158 { | |
159 foreach ($column as $permissionGroup) | |
160 { | |
161 if ($permissionGroup['hidden']) | |
162 continue; | |
163 | |
164 echo ' | |
165 <option value="" disabled="disabled">[', $permissionGroup['name'], ']</option>'; | |
166 foreach ($permissionGroup['permissions'] as $perm) | |
167 { | |
168 if ($perm['hidden']) | |
169 continue; | |
170 | |
171 if ($perm['has_own_any']) | |
172 echo ' | |
173 <option value="', $permissionType['id'], '/', $perm['own']['id'], '"> ', $perm['name'], ' (', $perm['own']['name'], ')</option> | |
174 <option value="', $permissionType['id'], '/', $perm['any']['id'], '"> ', $perm['name'], ' (', $perm['any']['name'], ')</option>'; | |
175 else | |
176 echo ' | |
177 <option value="', $permissionType['id'], '/', $perm['id'], '"> ', $perm['name'], '</option>'; | |
178 } | |
179 } | |
180 } | |
181 } | |
182 echo ' | |
183 </select> | |
184 </dd> | |
185 </dl> | |
186 </fieldset> | |
187 <div class="righttext"> | |
188 <input type="submit" value="', $txt['permissions_set_permissions'], '" onclick="return checkSubmit();" class="button_submit" /> | |
189 </div> | |
190 </div> | |
191 <span class="botslice"><span></span></span> | |
192 </div>'; | |
193 | |
194 // Javascript for the advanced stuff. | |
195 echo ' | |
196 <script type="text/javascript"><!-- // --><![CDATA[ | |
197 var oPermissionsPanelToggle = new smc_Toggle({ | |
198 bToggleEnabled: true, | |
199 bCurrentlyCollapsed: ', empty($context['show_advanced_options']) ? 'true' : 'false', ', | |
200 aSwappableContainers: [ | |
201 \'permissions_panel_advanced\' | |
202 ], | |
203 aSwapImages: [ | |
204 { | |
205 sId: \'permissions_panel_toggle\', | |
206 srcExpanded: smf_images_url + \'/sort_down.gif\', | |
207 altExpanded: ', JavaScriptEscape($txt['upshrink_description']), ', | |
208 srcCollapsed: smf_images_url + \'/selected.gif\', | |
209 altCollapsed: ', JavaScriptEscape($txt['upshrink_description']), ' | |
210 } | |
211 ], | |
212 oThemeOptions: { | |
213 bUseThemeSettings: ', $context['user']['is_guest'] ? 'false' : 'true', ', | |
214 sOptionName: \'admin_preferences\', | |
215 sSessionVar: ', JavaScriptEscape($context['session_var']), ', | |
216 sSessionId: ', JavaScriptEscape($context['session_id']), ', | |
217 sThemeId: \'1\', | |
218 sAdditionalVars: \';admin_key=app\' | |
219 } | |
220 });'; | |
221 | |
222 echo ' | |
223 | |
224 function checkSubmit() | |
225 { | |
226 if ((document.forms.permissionForm.predefined.value != "" && (document.forms.permissionForm.copy_from.value != "empty" || document.forms.permissionForm.permissions.value != "")) || (document.forms.permissionForm.copy_from.value != "empty" && document.forms.permissionForm.permissions.value != "")) | |
227 { | |
228 alert("', $txt['permissions_only_one_option'], '"); | |
229 return false; | |
230 } | |
231 if (document.forms.permissionForm.predefined.value == "" && document.forms.permissionForm.copy_from.value == "" && document.forms.permissionForm.permissions.value == "") | |
232 { | |
233 alert("', $txt['permissions_no_action'], '"); | |
234 return false; | |
235 } | |
236 if (document.forms.permissionForm.permissions.value != "" && document.forms.permissionForm.add_remove.value == "deny") | |
237 return confirm("', $txt['permissions_deny_dangerous'], '"); | |
238 | |
239 return true; | |
240 } | |
241 // ]]></script>'; | |
242 | |
243 if (!empty($context['profile'])) | |
244 echo ' | |
245 <input type="hidden" name="pid" value="', $context['profile']['id'], '" />'; | |
246 | |
247 echo ' | |
248 <input type="hidden" name="', $context['session_var'], '" value="', $context['session_id'], '" />'; | |
249 } | |
250 else | |
251 echo ' | |
252 </table>'; | |
253 | |
254 echo ' | |
255 </form> | |
256 </div> | |
257 <br class="clear" />'; | |
258 } | |
259 | |
260 function template_by_board() | |
261 { | |
262 global $context, $settings, $options, $scripturl, $txt, $modSettings; | |
263 | |
264 echo ' | |
265 <form id="admincenter" action="', $scripturl, '?action=admin;area=permissions;sa=board" method="post" accept-charset="', $context['character_set'], '"> | |
266 <div class="cat_bar"> | |
267 <h3 class="catbg">', $txt['permissions_boards'], '</h3> | |
268 </div> | |
269 <div class="information"> | |
270 ', $txt['permissions_boards_desc'], ' | |
271 </div> | |
272 <div class="title_bar"> | |
273 <h3 id="board_permissions" class="titlebg flow_hidden"> | |
274 <span class="perm_name floatleft">', $txt['board_name'], '</span> | |
275 <span class="perm_profile floatleft">', $txt['permission_profile'], '</span> | |
276 </h3> | |
277 </div>'; | |
278 | |
279 if (!$context['edit_all']) | |
280 echo ' | |
281 <div class="righttext"> | |
282 <a href="', $scripturl, '?action=admin;area=permissions;sa=board;edit;', $context['session_var'], '=', $context['session_id'], '">[', $txt['permissions_board_all'], ']</a> | |
283 </div>'; | |
284 | |
285 foreach ($context['categories'] as $category) | |
286 { | |
287 echo ' | |
288 <div class="cat_bar"> | |
289 <h3 class="catbg"><strong>', $category['name'], '</strong></h3> | |
290 </div>'; | |
291 | |
292 if (!empty($category['boards'])) | |
293 echo ' | |
294 <div class="windowbg"> | |
295 <span class="topslice"><span></span></span> | |
296 <div class="content"> | |
297 <ul class="perm_boards flow_hidden">'; | |
298 | |
299 $alternate = false; | |
300 | |
301 foreach ($category['boards'] as $board) | |
302 { | |
303 $alternate = !$alternate; | |
304 | |
305 echo ' | |
306 | |
307 <li class="flow_hidden' ,' windowbg', $alternate ? '' : '2','"> | |
308 <span class="perm_board floatleft"> | |
309 <a href="', $scripturl, '?action=admin;area=manageboards;sa=board;boardid=', $board['id'], ';rid=permissions;', $context['session_var'], '=', $context['session_id'], '">', str_repeat('-', $board['child_level']), ' ', $board['name'], '</a> | |
310 </span> | |
311 <span class="perm_boardprofile floatleft">'; | |
312 if ($context['edit_all']) | |
313 { | |
314 echo ' | |
315 <select name="boardprofile[', $board['id'], ']">'; | |
316 | |
317 foreach ($context['profiles'] as $id => $profile) | |
318 echo ' | |
319 <option value="', $id, '" ', $id == $board['profile'] ? 'selected="selected"' : '', '>', $profile['name'], '</option>'; | |
320 | |
321 echo ' | |
322 </select>'; | |
323 } | |
324 else | |
325 echo ' | |
326 <a href="', $scripturl, '?action=admin;area=permissions;sa=index;pid=', $board['profile'], ';', $context['session_var'], '=', $context['session_id'], '"> [', $board['profile_name'], ']</a>'; | |
327 | |
328 echo ' | |
329 </span> | |
330 </li>'; | |
331 } | |
332 | |
333 if (!empty($category['boards'])) | |
334 echo ' | |
335 </ul> | |
336 </div> | |
337 <span class="botslice"><span></span></span> | |
338 </div>'; | |
339 } | |
340 | |
341 echo ' | |
342 <div class="righttext">'; | |
343 | |
344 if ($context['edit_all']) | |
345 echo ' | |
346 <input type="submit" name="save_changes" value="', $txt['save'], '" class="button_submit" />'; | |
347 else | |
348 echo ' | |
349 <a href="', $scripturl, '?action=admin;area=permissions;sa=board;edit;', $context['session_var'], '=', $context['session_id'], '">[', $txt['permissions_board_all'], ']</a>'; | |
350 | |
351 echo ' | |
352 <input type="hidden" name="', $context['session_var'], '" value="', $context['session_id'], '" /> | |
353 </div> | |
354 </form> | |
355 <br class="clear" />'; | |
356 } | |
357 | |
358 // Edit permission profiles (predefined). | |
359 function template_edit_profiles() | |
360 { | |
361 global $context, $settings, $options, $scripturl, $txt, $modSettings; | |
362 | |
363 echo ' | |
364 <div id="admincenter"> | |
365 <form action="', $scripturl, '?action=admin;area=permissions;sa=profiles" method="post" accept-charset="', $context['character_set'], '"> | |
366 <div class="title_bar"> | |
367 <h3 class="titlebg">', $txt['permissions_profile_edit'], '</h3> | |
368 </div> | |
369 | |
370 <table width="100%" class="table_grid"> | |
371 <thead> | |
372 <tr class="catbg"> | |
373 <th class="first_th">', $txt['permissions_profile_name'], '</th> | |
374 <th>', $txt['permissions_profile_used_by'], '</th> | |
375 <th class="last_th" width="5%">', $txt['delete'], '</th> | |
376 </tr> | |
377 </thead> | |
378 <tbody>'; | |
379 $alternate = false; | |
380 foreach ($context['profiles'] as $profile) | |
381 { | |
382 echo ' | |
383 <tr class="', $alternate ? 'windowbg' : 'windowbg2', '"> | |
384 <td>'; | |
385 | |
386 if (!empty($context['show_rename_boxes']) && $profile['can_edit']) | |
387 echo ' | |
388 <input type="text" name="rename_profile[', $profile['id'], ']" value="', $profile['name'], '" class="input_text" />'; | |
389 else | |
390 echo ' | |
391 <a href="', $scripturl, '?action=admin;area=permissions;sa=index;pid=', $profile['id'], ';', $context['session_var'], '=', $context['session_id'], '">', $profile['name'], '</a>'; | |
392 | |
393 echo ' | |
394 </td> | |
395 <td> | |
396 ', !empty($profile['boards_text']) ? $profile['boards_text'] : $txt['permissions_profile_used_by_none'], ' | |
397 </td> | |
398 <td align="center"> | |
399 <input type="checkbox" name="delete_profile[]" value="', $profile['id'], '" ', $profile['can_delete'] ? '' : 'disabled="disabled"', ' class="input_check" /> | |
400 </td> | |
401 </tr>'; | |
402 $alternate = !$alternate; | |
403 } | |
404 | |
405 echo ' | |
406 </tbody> | |
407 </table> | |
408 <div class="righttext padding"> | |
409 <input type="hidden" name="', $context['session_var'], '" value="', $context['session_id'], '" />'; | |
410 | |
411 if ($context['can_edit_something']) | |
412 echo ' | |
413 <input type="submit" name="rename" value="', empty($context['show_rename_boxes']) ? $txt['permissions_profile_rename'] : $txt['permissions_commit'], '" class="button_submit" />'; | |
414 | |
415 echo ' | |
416 <input type="submit" name="delete" value="', $txt['quickmod_delete_selected'], '" class="button_submit" /> | |
417 </div> | |
418 </form> | |
419 <br /> | |
420 <form action="', $scripturl, '?action=admin;area=permissions;sa=profiles" method="post" accept-charset="', $context['character_set'], '"> | |
421 <div class="cat_bar"> | |
422 <h3 class="catbg">', $txt['permissions_profile_new'], '</h3> | |
423 </div> | |
424 <div class="windowbg"> | |
425 <span class="topslice"><span></span></span> | |
426 <div class="content"> | |
427 <dl class="settings"> | |
428 <dt> | |
429 <strong>', $txt['permissions_profile_name'], ':</strong> | |
430 </dt> | |
431 <dd> | |
432 <input type="text" name="profile_name" value="" class="input_text" /> | |
433 </dd> | |
434 <dt> | |
435 <strong>', $txt['permissions_profile_copy_from'], ':</strong> | |
436 </dt> | |
437 <dd> | |
438 <select name="copy_from">'; | |
439 | |
440 foreach ($context['profiles'] as $id => $profile) | |
441 echo ' | |
442 <option value="', $id, '">', $profile['name'], '</option>'; | |
443 | |
444 echo ' | |
445 </select> | |
446 </dd> | |
447 </dl> | |
448 <div class="righttext"> | |
449 <input type="hidden" name="', $context['session_var'], '" value="', $context['session_id'], '" /> | |
450 <input type="submit" name="create" value="', $txt['permissions_profile_new_create'], '" class="button_submit" /> | |
451 </div> | |
452 </div> | |
453 <span class="botslice"><span></span></span> | |
454 </div> | |
455 </form> | |
456 </div> | |
457 <br class="clear" />'; | |
458 } | |
459 | |
460 function template_modify_group() | |
461 { | |
462 global $context, $settings, $options, $scripturl, $txt, $modSettings; | |
463 | |
464 // Cannot be edited? | |
465 if (!$context['profile']['can_modify']) | |
466 { | |
467 echo ' | |
468 <div class="errorbox"> | |
469 ', sprintf($txt['permission_cannot_edit'], $scripturl . '?action=admin;area=permissions;sa=profiles'), ' | |
470 </div>'; | |
471 } | |
472 else | |
473 { | |
474 echo ' | |
475 <script type="text/javascript"><!-- // --><![CDATA[ | |
476 window.smf_usedDeny = false; | |
477 | |
478 function warnAboutDeny() | |
479 { | |
480 if (window.smf_usedDeny) | |
481 return confirm("', $txt['permissions_deny_dangerous'], '"); | |
482 else | |
483 return true; | |
484 } | |
485 // ]]></script>'; | |
486 } | |
487 | |
488 echo ' | |
489 <div id="admincenter"> | |
490 <form action="', $scripturl, '?action=admin;area=permissions;sa=modify2;group=', $context['group']['id'], ';pid=', $context['profile']['id'], '" method="post" accept-charset="', $context['character_set'], '" name="permissionForm" id="permissionForm" onsubmit="return warnAboutDeny();">'; | |
491 | |
492 if (!empty($modSettings['permission_enable_deny']) && $context['group']['id'] != -1) | |
493 echo ' | |
494 <div class="information"> | |
495 ', $txt['permissions_option_desc'], ' | |
496 </div>'; | |
497 | |
498 echo ' | |
499 <div class="cat_bar"> | |
500 <h3 class="catbg">'; | |
501 if ($context['permission_type'] == 'board') | |
502 echo ' | |
503 ', $txt['permissions_local_for'], ' "', $context['group']['name'], '" ', $txt['permissions_on'], ' "', $context['profile']['name'], '"'; | |
504 else | |
505 echo ' | |
506 ', $context['permission_type'] == 'membergroup' ? $txt['permissions_general'] : $txt['permissions_board'], ' - "', $context['group']['name'], '"'; | |
507 echo ' | |
508 </h3> | |
509 </div> | |
510 <div class="windowbg"> | |
511 <span class="topslice"><span></span></span> | |
512 <div class="content"> | |
513 ', $txt['permissions_change_view'], ': ', ($context['view_type'] == 'simple' ? '<img src="' . $settings['images_url'] . '/selected.gif" alt="*" />' : ''), '<a href="', $scripturl, '?action=admin;area=permissions;sa=modify;group=', $context['group']['id'], ($context['permission_type'] == 'board' ? ';pid=' . $context['profile']['id'] : ''), ';view=simple">', $txt['permissions_view_simple'], '</a> | | |
514 ', ($context['view_type'] == 'classic' ? '<img src="' . $settings['images_url'] . '/selected.gif" alt="*" />' : ''), '<a href="', $scripturl, '?action=admin;area=permissions;sa=modify;group=', $context['group']['id'], ($context['permission_type'] == 'board' ? ';pid=' . $context['profile']['id'] : ''), ';view=classic">', $txt['permissions_view_classic'], '</a> | |
515 </div> | |
516 <span class="botslice"><span></span></span> | |
517 </div> | |
518 <div class="flow_hidden">'; | |
519 | |
520 // Draw out the main bits. | |
521 if ($context['view_type'] == 'simple') | |
522 template_modify_group_simple($context['permission_type']); | |
523 else | |
524 template_modify_group_classic($context['permission_type']); | |
525 | |
526 // If this is general permissions also show the default profile. | |
527 if ($context['permission_type'] == 'membergroup') | |
528 { | |
529 echo ' | |
530 </div> | |
531 <br /> | |
532 <div class="cat_bar"> | |
533 <h3 class="catbg">', $txt['permissions_board'], '</h3> | |
534 </div> | |
535 <div class="information"> | |
536 ', $txt['permissions_board_desc'], ' | |
537 </div> | |
538 <div class="flow_hidden">'; | |
539 | |
540 if ($context['view_type'] == 'simple') | |
541 template_modify_group_simple('board'); | |
542 else | |
543 template_modify_group_classic('board'); | |
544 | |
545 echo ' | |
546 </div>'; | |
547 } | |
548 | |
549 if ($context['profile']['can_modify']) | |
550 echo ' | |
551 <div class="righttext padding"> | |
552 <input type="submit" value="', $txt['permissions_commit'], '" class="button_submit" /> | |
553 </div>'; | |
554 | |
555 echo ' | |
556 <input type="hidden" name="', $context['session_var'], '" value="', $context['session_id'], '" /> | |
557 </form> | |
558 </div> | |
559 <br class="clear" />'; | |
560 | |
561 } | |
562 | |
563 // A javascript enabled clean permissions view. | |
564 function template_modify_group_simple($type) | |
565 { | |
566 global $context, $settings, $options, $scripturl, $txt, $modSettings; | |
567 | |
568 // Simple only has one column so we only need bother ourself with that one. | |
569 $permission_data = &$context['permissions'][$type]['columns'][0]; | |
570 | |
571 // Short cut for disabling fields we can't change. | |
572 $disable_field = $context['profile']['can_modify'] ? '' : 'disabled="disabled" '; | |
573 | |
574 echo ' | |
575 <table width="100%" class="table_grid"> | |
576 <thead> | |
577 <tr class="catbg"> | |
578 <th colspan="2" width="100%" align="left" class="first_th"></th>'; | |
579 if (empty($modSettings['permission_enable_deny']) || $context['group']['id'] == -1) | |
580 echo ' | |
581 <th colspan="3" width="9" class="last_th"> </th>'; | |
582 else | |
583 echo ' | |
584 <th>', $txt['permissions_option_on'], '</th> | |
585 <th>', $txt['permissions_option_off'], '</th> | |
586 <th class="last_th">', $txt['permissions_option_deny'], '</th>'; | |
587 echo ' | |
588 </tr> | |
589 </thead> | |
590 <tbody>'; | |
591 | |
592 foreach ($permission_data as $id_group => $permissionGroup) | |
593 { | |
594 if (empty($permissionGroup['permissions'])) | |
595 continue; | |
596 | |
597 // Are we likely to have something in this group to display or is it all hidden? | |
598 $has_display_content = false; | |
599 if (!$permissionGroup['hidden']) | |
600 { | |
601 // Before we go any further check we are going to have some data to print otherwise we just have a silly heading. | |
602 foreach ($permissionGroup['permissions'] as $permission) | |
603 if (!$permission['hidden']) | |
604 $has_display_content = true; | |
605 | |
606 if ($has_display_content) | |
607 { | |
608 echo ' | |
609 <tr class="windowbg"> | |
610 <td colspan="2" width="100%" align="left"> | |
611 <a href="#" onclick="return toggleBreakdown(\'', $id_group, '\');"> | |
612 <img src="', $settings['images_url'], '/sort_down.gif" id="group_toggle_img_', $id_group, '" alt="*" /> <strong>', $permissionGroup['name'], '</strong> | |
613 </a> | |
614 </td>'; | |
615 if (empty($modSettings['permission_enable_deny']) || $context['group']['id'] == -1) | |
616 echo ' | |
617 <td colspan="3" width="10"> | |
618 <div id="group_select_div_', $id_group, '"> | |
619 <input type="checkbox" id="group_select_', $id_group, '" name="group_select_', $id_group, '" class="input_check" onclick="determineGroupState(\'', $id_group, '\', this.checked ? \'on\' : \'off\');" style="display: none;" ', $disable_field, '/> | |
620 </div> | |
621 </td>'; | |
622 else | |
623 echo ' | |
624 <td align="center"> | |
625 <div id="group_select_div_on_', $id_group, '"> | |
626 <input type="radio" id="group_select_on_', $id_group, '" name="group_select_', $id_group, '" value="on" onclick="determineGroupState(\'', $id_group, '\', \'on\');" style="display: none;" ', $disable_field, ' class="input_radio" /> | |
627 </div> | |
628 </td> | |
629 <td align="center"> | |
630 <div id="group_select_div_off_', $id_group, '"> | |
631 <input type="radio" id="group_select_off_', $id_group, '" name="group_select_', $id_group, '" value="off" onclick="determineGroupState(\'', $id_group, '\', \'off\');" style="display: none;" ', $disable_field, ' class="input_radio" /> | |
632 </div> | |
633 </td> | |
634 <td align="center"> | |
635 <div id="group_select_div_deny_', $id_group, '"> | |
636 <input type="radio" id="group_select_deny_', $id_group, '" name="group_select_', $id_group, '" value="deny" onclick="determineGroupState(\'', $id_group, '\', \'deny\');" style="display: none;" ', $disable_field, ' class="input_radio" /> | |
637 </div> | |
638 </td>'; | |
639 echo ' | |
640 </tr>'; | |
641 } | |
642 } | |
643 | |
644 $alternate = false; | |
645 foreach ($permissionGroup['permissions'] as $permission) | |
646 { | |
647 // If it's hidden keep the last value. | |
648 if ($permission['hidden'] || $permissionGroup['hidden']) | |
649 { | |
650 echo ' | |
651 <tr style="display: none;"> | |
652 <td> | |
653 <input type="hidden" name="perm[', $type, '][', $permission['id'], ']" value="', $permission['select'] == 'denied' && !empty($modSettings['permission_enable_deny']) ? 'deny' : $permission['select'], '" /> | |
654 </td> | |
655 </tr>'; | |
656 } | |
657 else | |
658 { | |
659 echo ' | |
660 <tr id="perm_div_', $id_group, '_', $permission['id'], '" class="', $alternate ? 'windowbg' : 'windowbg2', '"> | |
661 <td valign="top" width="10" style="padding-right: 1ex;"> | |
662 ', $permission['help_index'] ? '<a href="' . $scripturl . '?action=helpadmin;help=' . $permission['help_index'] . '" onclick="return reqWin(this.href);" class="help"><img src="' . $settings['images_url'] . '/helptopics.gif" alt="' . $txt['help'] . '" /></a>' : '', ' | |
663 </td> | |
664 <td valign="top" width="100%" align="left" style="padding-bottom: 2px;">', $permission['name'], '</td>'; | |
665 | |
666 if (empty($modSettings['permission_enable_deny']) || $context['group']['id'] == -1) | |
667 echo ' | |
668 <td valign="top" style="padding-bottom: 2px;"><input type="checkbox" id="select_', $permission['id'], '" name="perm[', $type, '][', $permission['id'], ']"', $permission['select'] == 'on' ? ' checked="checked"' : '', ' onclick="determineGroupState(\'', $id_group, '\');" value="on" class="input_check" ', $disable_field, '/></td>'; | |
669 else | |
670 echo ' | |
671 <td valign="top" width="10" style="padding-bottom: 2px;"><input type="radio" id="select_on_', $permission['id'], '" name="perm[', $type, '][', $permission['id'], ']"', $permission['select'] == 'on' ? ' checked="checked"' : '', ' value="on" onclick="determineGroupState(\'', $id_group, '\');" class="input_radio" ', $disable_field, '/></td> | |
672 <td valign="top" width="10" style="padding-bottom: 2px;"><input type="radio" id="select_off_', $permission['id'], '" name="perm[', $type, '][', $permission['id'], ']"', $permission['select'] == 'off' ? ' checked="checked"' : '', ' value="off" onclick="determineGroupState(\'', $id_group, '\');" class="input_radio" ', $disable_field, '/></td> | |
673 <td valign="top" width="10" style="padding-bottom: 2px;"><input type="radio" id="select_deny_', $permission['id'], '" name="perm[', $type, '][', $permission['id'], ']"', $permission['select'] == 'denied' ? ' checked="checked"' : '', ' value="deny" onclick="window.smf_usedDeny = true; determineGroupState(\'', $id_group, '\');" class="input_radio" ', $disable_field, '/></td>'; | |
674 | |
675 echo ' | |
676 </tr>'; | |
677 } | |
678 $alternate = !$alternate; | |
679 } | |
680 | |
681 if (!$permissionGroup['hidden'] && $has_display_content) | |
682 echo ' | |
683 <tr id="group_hr_div_', $id_group, '" class="windowbg2 perm_groups"> | |
684 <td colspan="5" width="100%"></td> | |
685 </tr>'; | |
686 } | |
687 echo ' | |
688 </tbody> | |
689 </table> | |
690 <script type="text/javascript"><!-- // --><![CDATA['; | |
691 | |
692 if ($context['profile']['can_modify'] && empty($context['simple_javascript_displayed'])) | |
693 { | |
694 // Only show this once. | |
695 $context['simple_javascript_displayed'] = true; | |
696 | |
697 // Manually toggle the breakdown. | |
698 echo ' | |
699 function toggleBreakdown(id_group, forcedisplayType) | |
700 { | |
701 displayType = document.getElementById("group_hr_div_" + id_group).style.display == "none" ? "" : "none"; | |
702 if (typeof(forcedisplayType) != "undefined") | |
703 displayType = forcedisplayType; | |
704 | |
705 for (i = 0; i < groupPermissions[id_group].length; i++) | |
706 { | |
707 document.getElementById("perm_div_" + id_group + "_" + groupPermissions[id_group][i]).style.display = displayType | |
708 } | |
709 document.getElementById("group_hr_div_" + id_group).style.display = displayType | |
710 document.getElementById("group_toggle_img_" + id_group).src = "', $settings['images_url'], '/" + (displayType == "none" ? "selected" : "sort_down") + ".gif"; | |
711 | |
712 return false; | |
713 }'; | |
714 | |
715 // This function decides what to do when ANYTHING is touched! | |
716 echo ' | |
717 var groupPermissions = new Array(); | |
718 function determineGroupState(id_group, forceState) | |
719 { | |
720 if (typeof(forceState) != "undefined") | |
721 thisState = forceState; | |
722 | |
723 // Cycle through this groups elements. | |
724 var curState = false, thisState; | |
725 for (var i = 0; i < groupPermissions[id_group].length; i++) | |
726 {'; | |
727 | |
728 if (empty($modSettings['permission_enable_deny']) || $context['group']['id'] == -1) | |
729 echo ' | |
730 if (typeof(forceState) != "undefined") | |
731 { | |
732 document.getElementById(\'select_\' + groupPermissions[id_group][i]).checked = forceState == \'on\' ? 1 : 0; | |
733 } | |
734 | |
735 thisState = document.getElementById(\'select_\' + groupPermissions[id_group][i]).checked ? \'on\' : \'off\';'; | |
736 else | |
737 echo ' | |
738 if (typeof(forceState) != "undefined") | |
739 { | |
740 document.getElementById(\'select_on_\' + groupPermissions[id_group][i]).checked = forceState == \'on\' ? 1 : 0; | |
741 document.getElementById(\'select_off_\' + groupPermissions[id_group][i]).checked = forceState == \'off\' ? 1 : 0; | |
742 document.getElementById(\'select_deny_\' + groupPermissions[id_group][i]).checked = forceState == \'deny\' ? 1 : 0; | |
743 } | |
744 | |
745 if (document.getElementById(\'select_on_\' + groupPermissions[id_group][i]).checked) | |
746 thisState = \'on\'; | |
747 else if (document.getElementById(\'select_off_\' + groupPermissions[id_group][i]).checked) | |
748 thisState = \'off\'; | |
749 else | |
750 thisState = \'deny\';'; | |
751 | |
752 echo ' | |
753 // Unless this is the first element, or it\'s the same state as the last we\'re buggered. | |
754 if (curState == false || thisState == curState) | |
755 { | |
756 curState = thisState; | |
757 } | |
758 else | |
759 { | |
760 curState = \'fudged\'; | |
761 i = 999; | |
762 } | |
763 } | |
764 | |
765 // First check the right master is selected!'; | |
766 if (empty($modSettings['permission_enable_deny']) || $context['group']['id'] == -1) | |
767 echo ' | |
768 document.getElementById("group_select_" + id_group).checked = curState == \'on\' ? 1 : 0;'; | |
769 else | |
770 echo ' | |
771 document.getElementById("group_select_on_" + id_group).checked = curState == \'on\' ? 1 : 0; | |
772 document.getElementById("group_select_off_" + id_group).checked = curState == \'off\' ? 1 : 0; | |
773 document.getElementById("group_select_deny_" + id_group).checked = curState == \'deny\' ? 1 : 0;'; | |
774 | |
775 // Force the display? | |
776 echo ' | |
777 if (curState != \'fudged\') | |
778 toggleBreakdown(id_group, "none");'; | |
779 echo ' | |
780 }'; | |
781 } | |
782 | |
783 // Some more javascript to be displayed as long as we are editing. | |
784 if ($context['profile']['can_modify']) | |
785 { | |
786 foreach ($permission_data as $id_group => $permissionGroup) | |
787 { | |
788 if (empty($permissionGroup['permissions'])) | |
789 continue; | |
790 | |
791 // As before... | |
792 $has_display_content = false; | |
793 if (!$permissionGroup['hidden']) | |
794 { | |
795 // Make sure we can show it. | |
796 foreach ($permissionGroup['permissions'] as $permission) | |
797 if (!$permission['hidden']) | |
798 $has_display_content = true; | |
799 | |
800 // Make all the group indicators visible on JS only. | |
801 if ($has_display_content) | |
802 { | |
803 if (empty($modSettings['permission_enable_deny']) || $context['group']['id'] == -1) | |
804 echo ' | |
805 document.getElementById("group_select_div_', $id_group, '").parentNode.className = "lockedbg"; | |
806 document.getElementById("group_select_', $id_group, '").style.display = "";'; | |
807 else | |
808 echo ' | |
809 document.getElementById("group_select_div_on_', $id_group, '").parentNode.className = "lockedbg"; | |
810 document.getElementById("group_select_div_off_', $id_group, '").parentNode.className = "lockedbg"; | |
811 document.getElementById("group_select_div_deny_', $id_group, '").parentNode.className = "lockedbg"; | |
812 document.getElementById("group_select_on_', $id_group, '").style.display = ""; | |
813 document.getElementById("group_select_off_', $id_group, '").style.display = ""; | |
814 document.getElementById("group_select_deny_', $id_group, '").style.display = "";'; | |
815 } | |
816 | |
817 $perm_ids = array(); | |
818 $count = 0; | |
819 foreach ($permissionGroup['permissions'] as $permission) | |
820 { | |
821 if (!$permission['hidden']) | |
822 { | |
823 // Need this for knowing what can be tweaked. | |
824 $perm_ids[] = "'$permission[id]'"; | |
825 } | |
826 } | |
827 // Declare this groups permissions into an array. | |
828 if (!empty($perm_ids)) | |
829 echo ' | |
830 groupPermissions[\'', $id_group, '\'] = new Array(', count($perm_ids), ');'; | |
831 foreach ($perm_ids as $count => $id) | |
832 echo ' | |
833 groupPermissions[\'', $id_group, '\'][', $count, '] = ', $id, ';'; | |
834 | |
835 // Show the group as required. | |
836 if ($has_display_content) | |
837 echo ' | |
838 determineGroupState(\'', $id_group, '\');'; | |
839 } | |
840 } | |
841 } | |
842 | |
843 echo ' | |
844 // ]]></script>'; | |
845 } | |
846 | |
847 // The SMF 1.x way of looking at permissions. | |
848 function template_modify_group_classic($type) | |
849 { | |
850 global $context, $settings, $options, $scripturl, $txt, $modSettings; | |
851 | |
852 $permission_type = &$context['permissions'][$type]; | |
853 $disable_field = $context['profile']['can_modify'] ? '' : 'disabled="disabled" '; | |
854 | |
855 echo ' | |
856 <div class="windowbg2"> | |
857 <span class="topslice"><span></span></span> | |
858 <div class="content">'; | |
859 | |
860 foreach ($permission_type['columns'] as $column) | |
861 { | |
862 echo ' | |
863 <table width="49%" class="table_grid perm_classic floatleft">'; | |
864 | |
865 foreach ($column as $permissionGroup) | |
866 { | |
867 if (empty($permissionGroup['permissions'])) | |
868 continue; | |
869 | |
870 // Are we likely to have something in this group to display or is it all hidden? | |
871 $has_display_content = false; | |
872 if (!$permissionGroup['hidden']) | |
873 { | |
874 // Before we go any further check we are going to have some data to print otherwise we just have a silly heading. | |
875 foreach ($permissionGroup['permissions'] as $permission) | |
876 if (!$permission['hidden']) | |
877 $has_display_content = true; | |
878 | |
879 if ($has_display_content) | |
880 { | |
881 echo ' | |
882 <tr class="catbg"> | |
883 <th colspan="2" width="100%" align="left"><strong class="smalltext">', $permissionGroup['name'], '</strong></th>'; | |
884 if (empty($modSettings['permission_enable_deny']) || $context['group']['id'] == -1) | |
885 echo ' | |
886 <th colspan="3" width="10"></th>'; | |
887 else | |
888 echo ' | |
889 <th align="center"><div>', $txt['permissions_option_on'], '</div></th> | |
890 <th align="center"><div>', $txt['permissions_option_off'], '</div></th> | |
891 <th align="center"><div>', $txt['permissions_option_deny'], '</div></th>'; | |
892 echo ' | |
893 </tr>'; | |
894 } | |
895 } | |
896 | |
897 $alternate = false; | |
898 foreach ($permissionGroup['permissions'] as $permission) | |
899 { | |
900 // If it's hidden keep the last value. | |
901 if ($permission['hidden'] || $permissionGroup['hidden']) | |
902 { | |
903 echo ' | |
904 <tr style="display: none;"> | |
905 <td>'; | |
906 | |
907 if ($permission['has_own_any']) | |
908 { | |
909 // Guests can't have own permissions. | |
910 if ($context['group']['id'] != -1) | |
911 echo ' | |
912 <input type="hidden" name="perm[', $permission_type['id'], '][', $permission['own']['id'], ']" value="', $permission['own']['select'] == 'denied' && !empty($modSettings['permission_enable_deny']) ? 'deny' : $permission['own']['select'], '" />'; | |
913 | |
914 echo ' | |
915 <input type="hidden" name="perm[', $permission_type['id'], '][', $permission['any']['id'], ']" value="', $permission['any']['select'] == 'denied' && !empty($modSettings['permission_enable_deny']) ? 'deny' : $permission['any']['select'], '" />'; | |
916 } | |
917 else | |
918 echo ' | |
919 <input type="hidden" name="perm[', $permission_type['id'], '][', $permission['id'], ']" value="', $permission['select'] == 'denied' && !empty($modSettings['permission_enable_deny']) ? 'deny' : $permission['select'], '" />'; | |
920 echo ' | |
921 </td> | |
922 </tr>'; | |
923 } | |
924 else | |
925 { | |
926 echo ' | |
927 <tr class="', $alternate ? 'windowbg' : 'windowbg2', '"> | |
928 <td width="10"> | |
929 ', $permission['show_help'] ? '<a href="' . $scripturl . '?action=helpadmin;help=permissionhelp_' . $permission['id'] . '" onclick="return reqWin(this.href);" class="help"><img src="' . $settings['images_url'] . '/helptopics.gif" alt="' . $txt['help'] . '" /></a>' : '', ' | |
930 </td>'; | |
931 | |
932 if ($permission['has_own_any']) | |
933 { | |
934 echo ' | |
935 <td colspan="4" width="100%" align="left">', $permission['name'], '</td> | |
936 </tr><tr class="', $alternate ? 'windowbg' : 'windowbg2', '">'; | |
937 | |
938 // Guests can't do their own thing. | |
939 if ($context['group']['id'] != -1) | |
940 { | |
941 echo ' | |
942 <td></td> | |
943 <td width="100%" class="smalltext" align="right">', $permission['own']['name'], ':</td>'; | |
944 | |
945 if (empty($modSettings['permission_enable_deny'])) | |
946 echo ' | |
947 <td colspan="3"><input type="checkbox" name="perm[', $permission_type['id'], '][', $permission['own']['id'], ']"', $permission['own']['select'] == 'on' ? ' checked="checked"' : '', ' value="on" id="', $permission['own']['id'], '_on" class="input_check" ', $disable_field, '/></td>'; | |
948 else | |
949 echo ' | |
950 <td width="10"><input type="radio" name="perm[', $permission_type['id'], '][', $permission['own']['id'], ']"', $permission['own']['select'] == 'on' ? ' checked="checked"' : '', ' value="on" id="', $permission['own']['id'], '_on" class="input_radio" ', $disable_field, '/></td> | |
951 <td width="10"><input type="radio" name="perm[', $permission_type['id'], '][', $permission['own']['id'], ']"', $permission['own']['select'] == 'off' ? ' checked="checked"' : '', ' value="off" class="input_radio" ', $disable_field, '/></td> | |
952 <td width="10"><input type="radio" name="perm[', $permission_type['id'], '][', $permission['own']['id'], ']"', $permission['own']['select'] == 'denied' ? ' checked="checked"' : '', ' value="deny" class="input_radio" ', $disable_field, '/></td>'; | |
953 | |
954 echo ' | |
955 </tr><tr class="', $alternate ? 'windowbg' : 'windowbg2', '">'; | |
956 } | |
957 | |
958 echo ' | |
959 <td></td> | |
960 <td width="100%" class="smalltext" align="right">', $permission['any']['name'], ':</td>'; | |
961 | |
962 if (empty($modSettings['permission_enable_deny']) || $context['group']['id'] == -1) | |
963 echo ' | |
964 <td colspan="3"><input type="checkbox" name="perm[', $permission_type['id'], '][', $permission['any']['id'], ']"', $permission['any']['select'] == 'on' ? ' checked="checked"' : '', ' value="on" class="input_check" ', $disable_field, '/></td>'; | |
965 else | |
966 echo ' | |
967 <td><input type="radio" name="perm[', $permission_type['id'], '][', $permission['any']['id'], ']"', $permission['any']['select'] == 'on' ? ' checked="checked"' : '', ' value="on" onclick="document.forms.permissionForm.', $permission['own']['id'], '_on.checked = true;" class="input_radio" ', $disable_field, '/></td> | |
968 <td><input type="radio" name="perm[', $permission_type['id'], '][', $permission['any']['id'], ']"', $permission['any']['select'] == 'off' ? ' checked="checked"' : '', ' value="off" class="input_radio" ', $disable_field, '/></td> | |
969 <td><input type="radio" name="perm[', $permission_type['id'], '][', $permission['any']['id'], ']"', $permission['any']['select']== 'denied' ? ' checked="checked"' : '', ' value="deny" id="', $permission['any']['id'], '_deny" onclick="window.smf_usedDeny = true;" class="input_radio" ', $disable_field, '/></td>'; | |
970 | |
971 echo ' | |
972 </tr>'; | |
973 } | |
974 else | |
975 { | |
976 echo ' | |
977 <td width="100%" align="left">', $permission['name'], '</td>'; | |
978 | |
979 if (empty($modSettings['permission_enable_deny']) || $context['group']['id'] == -1) | |
980 echo ' | |
981 <td><input type="checkbox" name="perm[', $permission_type['id'], '][', $permission['id'], ']"', $permission['select'] == 'on' ? ' checked="checked"' : '', ' value="on" class="input_check" ', $disable_field, '/></td>'; | |
982 else | |
983 echo ' | |
984 <td><input type="radio" name="perm[', $permission_type['id'], '][', $permission['id'], ']"', $permission['select'] == 'on' ? ' checked="checked"' : '', ' value="on" class="input_radio" ', $disable_field, '/></td> | |
985 <td><input type="radio" name="perm[', $permission_type['id'], '][', $permission['id'], ']"', $permission['select'] == 'off' ? ' checked="checked"' : '', ' value="off" class="input_radio" ', $disable_field, '/></td> | |
986 <td><input type="radio" name="perm[', $permission_type['id'], '][', $permission['id'], ']"', $permission['select'] == 'denied' ? ' checked="checked"' : '', ' value="deny" onclick="window.smf_usedDeny = true;" class="input_radio" ', $disable_field, '/></td>'; | |
987 | |
988 echo ' | |
989 </tr>'; | |
990 } | |
991 } | |
992 $alternate = !$alternate; | |
993 } | |
994 | |
995 if (!$permissionGroup['hidden'] && $has_display_content) | |
996 echo ' | |
997 <tr class="windowbg2"> | |
998 <td colspan="5" width="100%"><!--separator--></td> | |
999 </tr>'; | |
1000 } | |
1001 echo ' | |
1002 </table>'; | |
1003 } | |
1004 echo ' | |
1005 <br class="clear" /> | |
1006 </div> | |
1007 <span class="botslice"><span></span></span> | |
1008 </div>'; | |
1009 } | |
1010 | |
1011 function template_inline_permissions() | |
1012 { | |
1013 global $context, $settings, $options, $txt, $modSettings; | |
1014 | |
1015 echo ' | |
1016 <fieldset id="', $context['current_permission'], '"> | |
1017 <legend><a href="javascript:void(0);" onclick="document.getElementById(\'', $context['current_permission'], '\').style.display = \'none\';document.getElementById(\'', $context['current_permission'], '_groups_link\').style.display = \'block\'; return false;">', $txt['avatar_select_permission'], '</a></legend>'; | |
1018 if (empty($modSettings['permission_enable_deny'])) | |
1019 echo ' | |
1020 <ul class="permission_groups">'; | |
1021 else | |
1022 echo ' | |
1023 <div class="information">', $txt['permissions_option_desc'], '</div> | |
1024 <dl class="settings"> | |
1025 <dt> | |
1026 <span class="perms"><strong>', $txt['permissions_option_on'], '</strong></span> | |
1027 <span class="perms"><strong>', $txt['permissions_option_off'], '</strong></span> | |
1028 <span class="perms" style="color: red;"><strong>', $txt['permissions_option_deny'], '</strong></span> | |
1029 </dt> | |
1030 <dd> | |
1031 </dd>'; | |
1032 foreach ($context['member_groups'] as $group) | |
1033 { | |
1034 if (!empty($modSettings['permission_enable_deny'])) | |
1035 echo ' | |
1036 <dt>'; | |
1037 else | |
1038 echo ' | |
1039 <li>'; | |
1040 | |
1041 if (empty($modSettings['permission_enable_deny'])) | |
1042 echo ' | |
1043 <input type="checkbox" name="', $context['current_permission'], '[', $group['id'], ']" value="on"', $group['status'] == 'on' ? ' checked="checked"' : '', ' class="input_check" />'; | |
1044 else | |
1045 echo ' | |
1046 <span class="perms"><input type="radio" name="', $context['current_permission'], '[', $group['id'], ']" value="on"', $group['status'] == 'on' ? ' checked="checked"' : '', ' class="input_radio" /></span> | |
1047 <span class="perms"><input type="radio" name="', $context['current_permission'], '[', $group['id'], ']" value="off"', $group['status'] == 'off' ? ' checked="checked"' : '', ' class="input_radio" /></span> | |
1048 <span class="perms"><input type="radio" name="', $context['current_permission'], '[', $group['id'], ']" value="deny"', $group['status'] == 'deny' ? ' checked="checked"' : '', ' class="input_radio" /></span>'; | |
1049 | |
1050 if (!empty($modSettings['permission_enable_deny'])) | |
1051 echo ' | |
1052 </dt> | |
1053 <dd> | |
1054 <span', $group['is_postgroup'] ? ' style="font-style: italic;"' : '', '>', $group['name'], '</span> | |
1055 </dd>'; | |
1056 else | |
1057 echo ' | |
1058 <span', $group['is_postgroup'] ? ' style="font-style: italic;"' : '', '>', $group['name'], '</span> | |
1059 </li>'; | |
1060 } | |
1061 | |
1062 if (empty($modSettings['permission_enable_deny'])) | |
1063 echo ' | |
1064 </ul>'; | |
1065 else | |
1066 echo ' | |
1067 </dl>'; | |
1068 | |
1069 echo ' | |
1070 </fieldset> | |
1071 | |
1072 <a href="javascript:void(0);" onclick="document.getElementById(\'', $context['current_permission'], '\').style.display = \'block\'; document.getElementById(\'', $context['current_permission'], '_groups_link\').style.display = \'none\'; return false;" id="', $context['current_permission'], '_groups_link" style="display: none;">[ ', $txt['avatar_select_permission'], ' ]</a> | |
1073 | |
1074 <script type="text/javascript"><!-- // --><![CDATA[ | |
1075 document.getElementById("', $context['current_permission'], '").style.display = "none"; | |
1076 document.getElementById("', $context['current_permission'], '_groups_link").style.display = ""; | |
1077 // ]]></script>'; | |
1078 } | |
1079 | |
1080 // Edit post moderation permissions. | |
1081 function template_postmod_permissions() | |
1082 { | |
1083 global $context, $settings, $options, $scripturl, $txt, $modSettings; | |
1084 | |
1085 echo ' | |
1086 <div id="admincenter"> | |
1087 <form action="', $scripturl, '?action=admin;area=permissions;sa=postmod;', $context['session_var'], '=', $context['session_id'], '" method="post" name="postmodForm" id="postmodForm" accept-charset="', $context['character_set'], '"> | |
1088 <div class="title_bar"> | |
1089 <h3 class="titlebg">', $txt['permissions_post_moderation'], '</h3> | |
1090 </div>'; | |
1091 | |
1092 // Got advanced permissions - if so warn! | |
1093 if (!empty($modSettings['permission_enable_deny'])) | |
1094 echo ' | |
1095 <div class="information">', $txt['permissions_post_moderation_deny_note'], '</div>'; | |
1096 | |
1097 echo ' | |
1098 <div class="righttext padding"> | |
1099 ', $txt['permissions_post_moderation_select'], ': | |
1100 <select name="pid" onchange="document.forms.postmodForm.submit();">'; | |
1101 | |
1102 foreach ($context['profiles'] as $profile) | |
1103 if ($profile['can_modify']) | |
1104 echo ' | |
1105 <option value="', $profile['id'], '" ', $profile['id'] == $context['current_profile'] ? 'selected="selected"' : '', '>', $profile['name'], '</option>'; | |
1106 | |
1107 echo ' | |
1108 </select> | |
1109 <input type="submit" value="', $txt['go'], '" class="button_submit" /> | |
1110 </div> | |
1111 <table width="100%" class="table_grid"> | |
1112 <thead> | |
1113 <tr class="catbg"> | |
1114 <th class="first_th"></th> | |
1115 <th align="center" colspan="3"> | |
1116 ', $txt['permissions_post_moderation_new_topics'], ' | |
1117 </th> | |
1118 <th align="center" colspan="3"> | |
1119 ', $txt['permissions_post_moderation_replies_own'], ' | |
1120 </th> | |
1121 <th align="center" colspan="3"> | |
1122 ', $txt['permissions_post_moderation_replies_any'], ' | |
1123 </th> | |
1124 <th class="last_th" align="center" colspan="3"> | |
1125 ', $txt['permissions_post_moderation_attachments'], ' | |
1126 </th> | |
1127 </tr> | |
1128 <tr class="titlebg"> | |
1129 <th width="30%"> | |
1130 ', $txt['permissions_post_moderation_group'], ' | |
1131 </th> | |
1132 <th align="center"><img src="', $settings['default_images_url'], '/admin/post_moderation_allow.gif" alt="', $txt['permissions_post_moderation_allow'], '" title="', $txt['permissions_post_moderation_allow'], '" /></th> | |
1133 <th align="center"><img src="', $settings['default_images_url'], '/admin/post_moderation_moderate.gif" alt="', $txt['permissions_post_moderation_moderate'], '" title="', $txt['permissions_post_moderation_moderate'], '" /></th> | |
1134 <th align="center"><img src="', $settings['default_images_url'], '/admin/post_moderation_deny.gif" alt="', $txt['permissions_post_moderation_disallow'], '" title="', $txt['permissions_post_moderation_disallow'], '" /></th> | |
1135 <th align="center"><img src="', $settings['default_images_url'], '/admin/post_moderation_allow.gif" alt="', $txt['permissions_post_moderation_allow'], '" title="', $txt['permissions_post_moderation_allow'], '" /></th> | |
1136 <th align="center"><img src="', $settings['default_images_url'], '/admin/post_moderation_moderate.gif" alt="', $txt['permissions_post_moderation_moderate'], '" title="', $txt['permissions_post_moderation_moderate'], '" /></th> | |
1137 <th align="center"><img src="', $settings['default_images_url'], '/admin/post_moderation_deny.gif" alt="', $txt['permissions_post_moderation_disallow'], '" title="', $txt['permissions_post_moderation_disallow'], '" /></th> | |
1138 <th align="center"><img src="', $settings['default_images_url'], '/admin/post_moderation_allow.gif" alt="', $txt['permissions_post_moderation_allow'], '" title="', $txt['permissions_post_moderation_allow'], '" /></th> | |
1139 <th align="center"><img src="', $settings['default_images_url'], '/admin/post_moderation_moderate.gif" alt="', $txt['permissions_post_moderation_moderate'], '" title="', $txt['permissions_post_moderation_moderate'], '" /></th> | |
1140 <th align="center"><img src="', $settings['default_images_url'], '/admin/post_moderation_deny.gif" alt="', $txt['permissions_post_moderation_disallow'], '" title="', $txt['permissions_post_moderation_disallow'], '" /></th> | |
1141 <th align="center"><img src="', $settings['default_images_url'], '/admin/post_moderation_allow.gif" alt="', $txt['permissions_post_moderation_allow'], '" title="', $txt['permissions_post_moderation_allow'], '" /></th> | |
1142 <th align="center"><img src="', $settings['default_images_url'], '/admin/post_moderation_moderate.gif" alt="', $txt['permissions_post_moderation_moderate'], '" title="', $txt['permissions_post_moderation_moderate'], '" /></th> | |
1143 <th align="center"><img src="', $settings['default_images_url'], '/admin/post_moderation_deny.gif" alt="', $txt['permissions_post_moderation_disallow'], '" title="', $txt['permissions_post_moderation_disallow'], '" /></th> | |
1144 </tr> | |
1145 </thead> | |
1146 <tbody>'; | |
1147 | |
1148 foreach ($context['profile_groups'] as $group) | |
1149 { | |
1150 echo ' | |
1151 <tr> | |
1152 <td width="40%" class="windowbg"> | |
1153 <span ', ($group['color'] ? 'style="color: ' . $group['color'] . '"' : ''), '>', $group['name'], '</span>'; | |
1154 if (!empty($group['children'])) | |
1155 echo ' | |
1156 <br /><span class="smalltext">', $txt['permissions_includes_inherited'], ': "', implode('", "', $group['children']), '"</span>'; | |
1157 | |
1158 echo ' | |
1159 </td> | |
1160 <td align="center" class="windowbg2"><input type="radio" name="new_topic[', $group['id'], ']" value="allow" ', $group['new_topic'] == 'allow' ? 'checked="checked"' : '', ' class="input_radio" /></td> | |
1161 <td align="center" class="windowbg2"><input type="radio" name="new_topic[', $group['id'], ']" value="moderate" ', $group['new_topic'] == 'moderate' ? 'checked="checked"' : '', ' class="input_radio" /></td> | |
1162 <td align="center" class="windowbg2"><input type="radio" name="new_topic[', $group['id'], ']" value="disallow" ', $group['new_topic'] == 'disallow' ? 'checked="checked"' : '', ' class="input_radio" /></td> | |
1163 <td align="center" class="windowbg"><input type="radio" name="replies_own[', $group['id'], ']" value="allow" ', $group['replies_own'] == 'allow' ? 'checked="checked"' : '', ' class="input_radio" /></td> | |
1164 <td align="center" class="windowbg"><input type="radio" name="replies_own[', $group['id'], ']" value="moderate" ', $group['replies_own'] == 'moderate' ? 'checked="checked"' : '', ' class="input_radio" /></td> | |
1165 <td align="center" class="windowbg"><input type="radio" name="replies_own[', $group['id'], ']" value="disallow" ', $group['replies_own'] == 'disallow' ? 'checked="checked"' : '', ' class="input_radio" /></td> | |
1166 <td align="center" class="windowbg2"><input type="radio" name="replies_any[', $group['id'], ']" value="allow" ', $group['replies_any'] == 'allow' ? 'checked="checked"' : '', ' class="input_radio" /></td> | |
1167 <td align="center" class="windowbg2"><input type="radio" name="replies_any[', $group['id'], ']" value="moderate" ', $group['replies_any'] == 'moderate' ? 'checked="checked"' : '', ' class="input_radio" /></td> | |
1168 <td align="center" class="windowbg2"><input type="radio" name="replies_any[', $group['id'], ']" value="disallow" ', $group['replies_any'] == 'disallow' ? 'checked="checked"' : '', ' class="input_radio" /></td> | |
1169 <td align="center" class="windowbg"><input type="radio" name="attachment[', $group['id'], ']" value="allow" ', $group['attachment'] == 'allow' ? 'checked="checked"' : '', ' class="input_radio" /></td> | |
1170 <td align="center" class="windowbg"><input type="radio" name="attachment[', $group['id'], ']" value="moderate" ', $group['attachment'] == 'moderate' ? 'checked="checked"' : '', ' class="input_radio" /></td> | |
1171 <td align="center" class="windowbg"><input type="radio" name="attachment[', $group['id'], ']" value="disallow" ', $group['attachment'] == 'disallow' ? 'checked="checked"' : '', ' class="input_radio" /></td> | |
1172 </tr>'; | |
1173 } | |
1174 | |
1175 echo ' | |
1176 </tbody> | |
1177 </table> | |
1178 <div class="righttext padding"> | |
1179 <input type="submit" name="save_changes" value="', $txt['permissions_commit'], '" class="button_submit" /> | |
1180 </div> | |
1181 </form> | |
1182 <p class="smalltext" style="padding-left: 10px;"> | |
1183 <strong>', $txt['permissions_post_moderation_legend'], ':</strong><br /> | |
1184 <img src="', $settings['default_images_url'], '/admin/post_moderation_allow.gif" alt="', $txt['permissions_post_moderation_allow'], '" /> - ', $txt['permissions_post_moderation_allow'], '<br /> | |
1185 <img src="', $settings['default_images_url'], '/admin/post_moderation_moderate.gif" alt="', $txt['permissions_post_moderation_moderate'], '" /> - ', $txt['permissions_post_moderation_moderate'], '<br /> | |
1186 <img src="', $settings['default_images_url'], '/admin/post_moderation_deny.gif" alt="', $txt['permissions_post_moderation_disallow'], '" /> - ', $txt['permissions_post_moderation_disallow'], ' | |
1187 </p> | |
1188 </div> | |
1189 <br class="clear" />'; | |
1190 } | |
1191 | |
1192 ?> |