ManageMembergroups.template.php 33 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741
  1. <?php
  2. /**
  3. * Simple Machines Forum (SMF)
  4. *
  5. * @package SMF
  6. * @author Simple Machines http://www.simplemachines.org
  7. * @copyright 2014 Simple Machines and individual contributors
  8. * @license http://www.simplemachines.org/about/smf/license.php BSD
  9. *
  10. * @version 2.1 Alpha 1
  11. */
  12. function template_main()
  13. {
  14. template_show_list('regular_membergroups_list');
  15. echo '<br><br>';
  16. template_show_list('post_count_membergroups_list');
  17. }
  18. function template_new_group()
  19. {
  20. global $context, $scripturl, $txt, $modSettings;
  21. echo '
  22. <div id="admincenter">
  23. <form id="new_group" action="', $scripturl, '?action=admin;area=membergroups;sa=add" method="post" accept-charset="', $context['character_set'], '">
  24. <div class="cat_bar">
  25. <h3 class="catbg">', $txt['membergroups_new_group'], '</h3>
  26. </div>
  27. <div class="windowbg">
  28. <div class="content">
  29. <dl class="settings">
  30. <dt>
  31. <label for="group_name_input"><strong>', $txt['membergroups_group_name'], ':</strong></label>
  32. </dt>
  33. <dd>
  34. <input type="text" name="group_name" id="group_name_input" size="30" class="input_text">
  35. </dd>';
  36. if ($context['undefined_group'])
  37. {
  38. echo '
  39. <dt>
  40. <label for="group_type"><strong>', $txt['membergroups_edit_group_type'], '</strong>:</label>
  41. </dt>
  42. <dd>
  43. <fieldset id="group_type">
  44. <legend>', $txt['membergroups_edit_select_group_type'], '</legend>
  45. <label for="group_type_private"><input type="radio" name="group_type" id="group_type_private" value="0" checked class="input_radio" onclick="swapPostGroup(0);">', $txt['membergroups_group_type_private'], '</label><br>';
  46. if ($context['allow_protected'])
  47. echo '
  48. <label for="group_type_protected"><input type="radio" name="group_type" id="group_type_protected" value="1" class="input_radio" onclick="swapPostGroup(0);">', $txt['membergroups_group_type_protected'], '</label><br>';
  49. echo '
  50. <label for="group_type_request"><input type="radio" name="group_type" id="group_type_request" value="2" class="input_radio" onclick="swapPostGroup(0);">', $txt['membergroups_group_type_request'], '</label><br>
  51. <label for="group_type_free"><input type="radio" name="group_type" id="group_type_free" value="3" class="input_radio" onclick="swapPostGroup(0);">', $txt['membergroups_group_type_free'], '</label><br>
  52. <label for="group_type_post"><input type="radio" name="group_type" id="group_type_post" value="-1" class="input_radio" onclick="swapPostGroup(1);">', $txt['membergroups_group_type_post'], '</label><br>
  53. </fieldset>
  54. </dd>';
  55. }
  56. if ($context['post_group'] || $context['undefined_group'])
  57. echo '
  58. <dt id="min_posts_text">
  59. <strong>', $txt['membergroups_min_posts'], ':</strong>
  60. </dt>
  61. <dd>
  62. <input type="number" name="min_posts" id="min_posts_input" size="5" class="input_text">
  63. </dd>';
  64. if (!$context['post_group'] || !empty($modSettings['permission_enable_postgroups']))
  65. {
  66. echo '
  67. <dt>
  68. <label for="permission_base"><strong>', $txt['membergroups_permissions'], ':</strong></label><br>
  69. <span class="smalltext">', $txt['membergroups_can_edit_later'], '</span>
  70. </dt>
  71. <dd>
  72. <fieldset id="permission_base">
  73. <legend>', $txt['membergroups_select_permission_type'], '</legend>
  74. <input type="radio" name="perm_type" id="perm_type_inherit" value="inherit" checked class="input_radio">
  75. <label for="perm_type_inherit">', $txt['membergroups_new_as_inherit'], ':</label>
  76. <select name="inheritperm" id="inheritperm_select" onclick="document.getElementById(\'perm_type_inherit\').checked = true;">
  77. <option value="-1">', $txt['membergroups_guests'], '</option>
  78. <option value="0" selected>', $txt['membergroups_members'], '</option>';
  79. foreach ($context['groups'] as $group)
  80. echo '
  81. <option value="', $group['id'], '">', $group['name'], '</option>';
  82. echo '
  83. </select>
  84. <br>
  85. <input type="radio" name="perm_type" id="perm_type_copy" value="copy" class="input_radio">
  86. <label for="perm_type_copy">', $txt['membergroups_new_as_copy'], ':</label>
  87. <select name="copyperm" id="copyperm_select" onclick="document.getElementById(\'perm_type_copy\').checked = true;">
  88. <option value="-1">', $txt['membergroups_guests'], '</option>
  89. <option value="0" selected>', $txt['membergroups_members'], '</option>';
  90. foreach ($context['groups'] as $group)
  91. echo '
  92. <option value="', $group['id'], '">', $group['name'], '</option>';
  93. echo '
  94. </select>
  95. <br>
  96. <input type="radio" name="perm_type" id="perm_type_predefined" value="predefined" class="input_radio">
  97. <label for="perm_type_predefined">', $txt['membergroups_new_as_type'], ':</label>
  98. <select name="level" id="level_select" onclick="document.getElementById(\'perm_type_predefined\').checked = true;">
  99. <option value="restrict">', $txt['permitgroups_restrict'], '</option>
  100. <option value="standard" selected>', $txt['permitgroups_standard'], '</option>
  101. <option value="moderator">', $txt['permitgroups_moderator'], '</option>
  102. <option value="maintenance">', $txt['permitgroups_maintenance'], '</option>
  103. </select>
  104. </fieldset>
  105. </dd>';
  106. }
  107. echo '
  108. <dt>
  109. <strong>', $txt['membergroups_new_board'], ':</strong>', $context['post_group'] ? '<br>
  110. <span class="smalltext" style="font-weight: normal">' . $txt['membergroups_new_board_post_groups'] . '</span>' : '', '
  111. </dt>
  112. <dd>';
  113. template_add_edit_group_boards_list(false);
  114. echo '
  115. </dd>
  116. </dl>
  117. <input type="submit" value="', $txt['membergroups_add_group'], '" class="button_submit">
  118. </div>
  119. </div>';
  120. if ($context['undefined_group'])
  121. {
  122. echo '
  123. <script><!-- // --><![CDATA[
  124. function swapPostGroup(isChecked)
  125. {
  126. var min_posts_text = document.getElementById(\'min_posts_text\');
  127. document.getElementById(\'min_posts_input\').disabled = !isChecked;
  128. min_posts_text.style.color = isChecked ? "" : "#888888";
  129. }
  130. swapPostGroup(', $context['post_group'] ? 'true' : 'false', ');
  131. // ]]></script>';
  132. }
  133. echo '
  134. <input type="hidden" name="', $context['session_var'], '" value="', $context['session_id'], '">
  135. <input type="hidden" name="', $context['admin-mmg_token_var'], '" value="', $context['admin-mmg_token'], '">
  136. </form>
  137. </div>';
  138. }
  139. function template_edit_group()
  140. {
  141. global $context, $settings, $scripturl, $txt;
  142. echo '
  143. <div id="admincenter">
  144. <form action="', $scripturl, '?action=admin;area=membergroups;sa=edit;group=', $context['group']['id'], '" method="post" accept-charset="', $context['character_set'], '" name="groupForm" id="groupForm">
  145. <div class="cat_bar">
  146. <h3 class="catbg">', $txt['membergroups_edit_group'], ' - ', $context['group']['name'], '
  147. </h3>
  148. </div>
  149. <div class="windowbg2">
  150. <div class="content">
  151. <dl class="settings">
  152. <dt>
  153. <label for="group_name_input"><strong>', $txt['membergroups_edit_name'], ':</strong></label>
  154. </dt>
  155. <dd>
  156. <input type="text" name="group_name" id="group_name_input" value="', $context['group']['editable_name'], '" size="30" class="input_text">
  157. </dd>';
  158. if ($context['group']['id'] != 3 && $context['group']['id'] != 4)
  159. echo '
  160. <dt id="group_desc_text">
  161. <label for="group_desc_input"><strong>', $txt['membergroups_edit_desc'], ':</strong></label>
  162. </dt>
  163. <dd>
  164. <textarea name="group_desc" id="group_desc_input" rows="4" cols="40">', $context['group']['description'], '</textarea>
  165. </dd>';
  166. // Group type...
  167. if ($context['group']['allow_post_group'])
  168. {
  169. echo '
  170. <dt>
  171. <label for="group_type"><strong>', $txt['membergroups_edit_group_type'], ':</strong></label>
  172. </dt>
  173. <dd>
  174. <fieldset id="group_type">
  175. <legend>', $txt['membergroups_edit_select_group_type'], '</legend>
  176. <label for="group_type_private"><input type="radio" name="group_type" id="group_type_private" value="0"', !$context['group']['is_post_group'] && $context['group']['type'] == 0 ? ' checked' : '', ' class="input_radio" onclick="swapPostGroup(0);">', $txt['membergroups_group_type_private'], '</label><br>';
  177. if ($context['group']['allow_protected'])
  178. echo '
  179. <label for="group_type_protected"><input type="radio" name="group_type" id="group_type_protected" value="1"', $context['group']['type'] == 1 ? ' checked' : '', ' class="input_radio" onclick="swapPostGroup(0);">', $txt['membergroups_group_type_protected'], '</label><br>';
  180. echo '
  181. <label for="group_type_request"><input type="radio" name="group_type" id="group_type_request" value="2"', $context['group']['type'] == 2 ? ' checked' : '', ' class="input_radio" onclick="swapPostGroup(0);">', $txt['membergroups_group_type_request'], '</label><br>
  182. <label for="group_type_free"><input type="radio" name="group_type" id="group_type_free" value="3"', $context['group']['type'] == 3 ? ' checked' : '', ' class="input_radio" onclick="swapPostGroup(0);">', $txt['membergroups_group_type_free'], '</label><br>
  183. <label for="group_type_post"><input type="radio" name="group_type" id="group_type_post" value="-1"', $context['group']['is_post_group'] ? ' checked' : '', ' class="input_radio" onclick="swapPostGroup(1);">', $txt['membergroups_group_type_post'], '</label><br>
  184. </fieldset>
  185. </dd>';
  186. }
  187. if ($context['group']['id'] != 3 && $context['group']['id'] != 4)
  188. echo '
  189. <dt id="group_moderators_text">
  190. <label for="group_moderators"><strong>', $txt['moderators'], ':</strong></label>
  191. </dt>
  192. <dd>
  193. <input type="text" name="group_moderators" id="group_moderators" value="', $context['group']['moderator_list'], '" size="30" class="input_text">
  194. <div id="moderator_container"></div>
  195. </dd>
  196. <dt id="group_hidden_text">
  197. <label for="group_hidden_input"><strong>', $txt['membergroups_edit_hidden'], ':</strong></label>
  198. </dt>
  199. <dd>
  200. <select name="group_hidden" id="group_hidden_input" onchange="if (this.value == 2 &amp;&amp; !confirm(\'', $txt['membergroups_edit_hidden_warning'], '\')) this.value = 0;">
  201. <option value="0"', $context['group']['hidden'] ? '' : ' selected', '>', $txt['membergroups_edit_hidden_no'], '</option>
  202. <option value="1"', $context['group']['hidden'] == 1 ? ' selected' : '', '>', $txt['membergroups_edit_hidden_boardindex'], '</option>
  203. <option value="2"', $context['group']['hidden'] == 2 ? ' selected' : '', '>', $txt['membergroups_edit_hidden_all'], '</option>
  204. </select>
  205. </dd>';
  206. // Can they inherit permissions?
  207. if ($context['group']['id'] > 1 && $context['group']['id'] != 3)
  208. {
  209. echo '
  210. <dt id="group_inherit_text">
  211. <label for="group_inherit_input"><strong>', $txt['membergroups_edit_inherit_permissions'], '</strong></label>:<br>
  212. <span class="smalltext">', $txt['membergroups_edit_inherit_permissions_desc'], '</span>
  213. </dt>
  214. <dd>
  215. <select name="group_inherit" id="group_inherit_input">
  216. <option value="-2">', $txt['membergroups_edit_inherit_permissions_no'], '</option>
  217. <option value="-1"', $context['group']['inherited_from'] == -1 ? ' selected' : '', '>', $txt['membergroups_edit_inherit_permissions_from'], ': ', $txt['membergroups_guests'], '</option>
  218. <option value="0"', $context['group']['inherited_from'] == 0 ? ' selected' : '', '>', $txt['membergroups_edit_inherit_permissions_from'], ': ', $txt['membergroups_members'], '</option>';
  219. // For all the inheritable groups show an option.
  220. foreach ($context['inheritable_groups'] as $id => $group)
  221. echo '
  222. <option value="', $id, '"', $context['group']['inherited_from'] == $id ? ' selected' : '', '>', $txt['membergroups_edit_inherit_permissions_from'], ': ', $group, '</option>';
  223. echo '
  224. </select>
  225. <input type="hidden" name="old_inherit" value="', $context['group']['inherited_from'], '">
  226. </dd>';
  227. }
  228. if ($context['group']['allow_post_group'])
  229. echo '
  230. <dt id="min_posts_text">
  231. <label for="min_posts_input"><strong>', $txt['membergroups_min_posts'], ':</strong></label>
  232. </dt>
  233. <dd>
  234. <input type="number" name="min_posts" id="min_posts_input"', $context['group']['is_post_group'] ? ' value="' . $context['group']['min_posts'] . '"' : '', ' size="6" class="input_text">
  235. </dd>';
  236. echo '
  237. <dt>
  238. <label for="online_color_input"><strong>', $txt['membergroups_online_color'], ':</strong></label>
  239. </dt>
  240. <dd>
  241. <input type="text" name="online_color" id="online_color_input" value="', $context['group']['color'], '" size="20" class="input_text">
  242. </dd>
  243. <dt>
  244. <label for="icon_count_input"><strong>', $txt['membergroups_icon_count'], ':</strong></label>
  245. </dt>
  246. <dd>
  247. <input type="number" name="icon_count" id="icon_count_input" value="', $context['group']['icon_count'], '" size="4" class="input_text">
  248. </dd>';
  249. // Do we have any possible icons to select from?
  250. if (!empty($context['possible_icons']))
  251. {
  252. echo '
  253. <dt>
  254. <label for="icon_image_input"><strong>', $txt['membergroups_icon_image'], ':</strong></label><br>
  255. <span class="smalltext">', $txt['membergroups_icon_image_note'], '</span>
  256. </dt>
  257. <dd>
  258. ', $txt['membergroups_images_url'], '
  259. <select name="icon_image" id="icon_image_input">';
  260. // For every possible icon, create an option.
  261. foreach ($context['possible_icons'] as $icon)
  262. {
  263. echo '
  264. <option value="', $icon, '"', $context['group']['icon_image'] == $icon ? ' selected' : '', '>', $icon, '</option>';
  265. }
  266. echo '
  267. </select>
  268. <img id="icon_preview" src="" alt="*">
  269. </dd>';
  270. }
  271. // No? Hide the entire control.
  272. else
  273. echo '
  274. <input type="hidden" name="icon_image" value="">';
  275. echo '
  276. <dt>
  277. <label for="max_messages_input"><strong>', $txt['membergroups_max_messages'], ':</strong></label><br>
  278. <span class="smalltext">', $txt['membergroups_max_messages_note'], '</span>
  279. </dt>
  280. <dd>
  281. <input type="text" name="max_messages" id="max_messages_input" value="', $context['group']['id'] == 1 ? 0 : $context['group']['max_messages'], '" size="6"', $context['group']['id'] == 1 ? ' disabled' : '', ' class="input_text">
  282. </dd>';
  283. if (!empty($context['categories']))
  284. {
  285. echo '
  286. <dt>
  287. <strong>', $txt['membergroups_new_board'], ':</strong>', $context['group']['is_post_group'] ? '<br>
  288. <span class="smalltext">' . $txt['membergroups_new_board_post_groups'] . '</span>' : '', '
  289. </dt>
  290. <dd>';
  291. if (!empty($context['can_manage_boards']))
  292. echo $txt['membergroups_can_manage_access'];
  293. else
  294. template_add_edit_group_boards_list();
  295. echo '
  296. </dd>';
  297. }
  298. echo '
  299. </dl>
  300. <input type="submit" name="save" value="', $txt['membergroups_edit_save'], '" class="button_submit">', $context['group']['allow_delete'] ? '
  301. <input type="submit" name="delete" value="' . $txt['membergroups_delete'] . '" onclick="return confirm(\'' . ($context['is_moderator_group'] ? $txt['membergroups_confirm_delete_mod'] : $txt['membergroups_confirm_delete']) . '\');" class="button_submit">' : '', '
  302. </div>
  303. </div>
  304. <input type="hidden" name="', $context['session_var'], '" value="', $context['session_id'], '">
  305. <input type="hidden" name="', $context['admin-mmg_token_var'], '" value="', $context['admin-mmg_token'], '">
  306. </form>
  307. </div>
  308. <script src="', $settings['default_theme_url'], '/scripts/suggest.js?alp21"></script>
  309. <script><!-- // --><![CDATA[
  310. var oModeratorSuggest = new smc_AutoSuggest({
  311. sSelf: \'oModeratorSuggest\',
  312. sSessionId: smf_session_id,
  313. sSessionVar: smf_session_var,
  314. sSuggestId: \'group_moderators\',
  315. sControlId: \'group_moderators\',
  316. sSearchType: \'member\',
  317. bItemList: true,
  318. sPostName: \'moderator_list\',
  319. sURLMask: \'action=profile;u=%item_id%\',
  320. sTextDeleteItem: \'', $txt['autosuggest_delete_item'], '\',
  321. sItemListContainerId: \'moderator_container\',
  322. aListItems: [';
  323. foreach ($context['group']['moderators'] as $id_member => $member_name)
  324. echo '
  325. {
  326. sItemId: ', JavaScriptEscape($id_member), ',
  327. sItemName: ', JavaScriptEscape($member_name), '
  328. }', $id_member == $context['group']['last_moderator_id'] ? '' : ',';
  329. echo '
  330. ]
  331. });
  332. // ]]></script>';
  333. if ($context['group']['allow_post_group'])
  334. echo '
  335. <script><!-- // --><![CDATA[
  336. function swapPostGroup(isChecked)
  337. {
  338. var is_moderator_group = ', $context['is_moderator_group'], ';
  339. var group_type = ', $context['group']['type'], ';
  340. var min_posts_text = document.getElementById(\'min_posts_text\');
  341. var group_desc_text = document.getElementById(\'group_desc_text\');
  342. var group_hidden_text = document.getElementById(\'group_hidden_text\');
  343. var group_moderators_text = document.getElementById(\'group_moderators_text\');
  344. // If it\'s a moderator group, warn of possible problems... and remember the group type
  345. if (isChecked && is_moderator_group && !confirm(\'', $txt['membergroups_swap_mod'], '\'))
  346. {
  347. isChecked = false;
  348. switch(group_type)
  349. {
  350. case 0:
  351. document.getElementById(\'group_type_private\').checked = true;
  352. break;
  353. case 1:
  354. document.getElementById(\'group_type_protected\').checked = true;
  355. break;
  356. case 2:
  357. document.getElementById(\'group_type_request\').checked = true;
  358. break;
  359. case 3:
  360. document.getElementById(\'group_type_free\').checked = true;
  361. break;
  362. default:
  363. document.getElementById(\'group_type_private\').checked = true;
  364. break;
  365. }
  366. }
  367. document.forms.groupForm.min_posts.disabled = !isChecked;
  368. min_posts_text.style.color = isChecked ? "" : "#888888";
  369. document.forms.groupForm.group_desc_input.disabled = isChecked;
  370. group_desc_text.style.color = !isChecked ? "" : "#888888";
  371. document.forms.groupForm.group_hidden_input.disabled = isChecked;
  372. group_hidden_text.style.color = !isChecked ? "" : "#888888";
  373. document.forms.groupForm.group_moderators.disabled = isChecked;
  374. group_moderators_text.style.color = !isChecked ? "" : "#888888";
  375. }
  376. swapPostGroup(', $context['group']['is_post_group'] ? 'true' : 'false', ');
  377. // ]]></script>';
  378. }
  379. function template_add_edit_group_boards_list($collapse = true)
  380. {
  381. global $context, $txt, $modSettings;
  382. echo '
  383. <fieldset id="visible_boards">
  384. <legend>', $txt['membergroups_new_board_desc'], '</legend>
  385. <ul class="padding floatleft">';
  386. foreach ($context['categories'] as $category)
  387. {
  388. if (empty($modSettings['deny_boards_access']))
  389. echo '
  390. <li class="category">
  391. <a href="javascript:void(0);" onclick="selectBoards([', implode(', ', $category['child_ids']), '], \'new_group\'); return false;"><strong>', $category['name'], '</strong></a>
  392. <ul style="width:100%">';
  393. else
  394. echo '
  395. <li class="category">
  396. <strong>', $category['name'], '</strong>
  397. <span class="select_all_box">
  398. <em style="margin-left:5em;">', $txt['all_boards_in_cat'], ': </em>
  399. <select onchange="select_in_category(', $category['id'], ', this, [', implode(',', array_keys($category['boards'])), ']);">
  400. <option>---</option>
  401. <option value="allow">', $txt['board_perms_allow'], '</option>
  402. <option value="ignore">', $txt['board_perms_ignore'], '</option>
  403. <option value="deny">', $txt['board_perms_deny'], '</option>
  404. </select>
  405. </span>
  406. <ul style="width:100%" id="boards_list_', $category['id'], '">';
  407. foreach ($category['boards'] as $board)
  408. {
  409. if (empty($modSettings['deny_boards_access']))
  410. echo '
  411. <li class="board" style="margin-', $context['right_to_left'] ? 'right' : 'left', ': ', $board['child_level'], 'em;">
  412. <input type="checkbox" name="boardaccess[', $board['id'], ']" id="brd', $board['id'], '" value="allow"', $board['allow'] ? ' checked' : '', ' class="input_check"> <label for="brd', $board['id'], '">', $board['name'], '</label>
  413. </li>';
  414. else
  415. echo '
  416. <li class="board" style="width:100%">
  417. <span style="margin-', $context['right_to_left'] ? 'right' : 'left', ': ', $board['child_level'], 'em;">', $board['name'], ': </span>
  418. <span style="width:50%;float:right">
  419. <input type="radio" name="boardaccess[', $board['id'], ']" id="allow_brd', $board['id'], '" value="allow"', $board['allow'] ? ' checked' : '', ' class="input_check"> <label for="allow_brd', $board['id'], '">', $txt['permissions_option_on'], '</label>
  420. <input type="radio" name="boardaccess[', $board['id'], ']" id="ignore_brd', $board['id'], '" value="ignore"', !$board['allow'] && !$board['deny'] ? ' checked' : '', ' class="input_check"> <label for="ignore_brd', $board['id'], '">', $txt['permissions_option_off'], '</label>
  421. <input type="radio" name="boardaccess[', $board['id'], ']" id="deny_brd', $board['id'], '" value="deny"', $board['deny'] ? ' checked' : '', ' class="input_check"> <label for="deny_brd', $board['id'], '">', $txt['permissions_option_deny'], '</label>
  422. </span>
  423. </li>';
  424. }
  425. echo '
  426. </ul>
  427. </li>';
  428. }
  429. echo '
  430. </ul>';
  431. if (empty($modSettings['deny_boards_access']))
  432. echo '
  433. <br class="clear"><br>
  434. <input type="checkbox" id="checkall_check" class="input_check" onclick="invertAll(this, this.form, \'boardaccess\');"> <label for="checkall_check"><em>', $txt['check_all'], '</em></label>
  435. </fieldset>';
  436. else
  437. echo '
  438. <br class="clear">
  439. <span class="select_all_box">
  440. <em>', $txt['all'], ': </em>
  441. <input type="radio" name="select_all" id="allow_all" class="input_radio" onclick="selectAllRadio(this, this.form, \'boardaccess\', \'allow\');"> <label for="allow_all">', $txt['board_perms_allow'], '</label>
  442. <input type="radio" name="select_all" id="ignore_all" class="input_radio" onclick="selectAllRadio(this, this.form, \'boardaccess\', \'ignore\');"> <label for="ignore_all">', $txt['board_perms_ignore'], '</label>
  443. <input type="radio" name="select_all" id="deny_all" class="input_radio" onclick="selectAllRadio(this, this.form, \'boardaccess\', \'deny\');"> <label for="deny_all">', $txt['board_perms_deny'], '</label>
  444. </span>
  445. </fieldset>
  446. <script><!-- // --><![CDATA[
  447. $(document).ready(function () {
  448. $(".select_all_box").each(function () {
  449. $(this).removeClass(\'select_all_box\');
  450. });
  451. });
  452. // ]]></script>';
  453. if ($collapse)
  454. echo '
  455. <a href="javascript:void(0);" onclick="document.getElementById(\'visible_boards\').style.display = \'block\'; document.getElementById(\'visible_boards_link\').style.display = \'none\'; return false;" id="visible_boards_link" style="display: none;">[ ', $txt['membergroups_select_visible_boards'], ' ]</a>
  456. <script><!-- // --><![CDATA[
  457. document.getElementById("visible_boards_link").style.display = "";
  458. document.getElementById("visible_boards").style.display = "none";
  459. // ]]></script>';
  460. }
  461. // Templating for viewing the members of a group.
  462. function template_group_members()
  463. {
  464. global $context, $settings, $scripturl, $txt;
  465. echo '
  466. <div id="admincenter">
  467. <form action="', $scripturl, '?action=', $context['current_action'], (isset($context['admin_area']) ? ';area=' . $context['admin_area'] : '') , ';sa=members;group=', $context['group']['id'], '" method="post" accept-charset="', $context['character_set'], '" id="view_group">
  468. <div class="cat_bar">
  469. <h3 class="catbg">', $context['page_title'], '</h3>
  470. </div>
  471. <div class="windowbg">
  472. <div class="content">
  473. <dl class="settings">
  474. <dt>
  475. <strong>', $txt['name'], ':</strong>
  476. </dt>
  477. <dd>
  478. <span ', $context['group']['online_color'] ? 'style="color: ' . $context['group']['online_color'] . ';"' : '', '>', $context['group']['name'], '</span> ', $context['group']['icons'], '
  479. </dd>';
  480. //Any description to show?
  481. if (!empty($context['group']['description']))
  482. echo '
  483. <dt>
  484. <strong>' . $txt['membergroups_members_description'] . ':</strong>
  485. </dt>
  486. <dd>
  487. ', $context['group']['description'] ,'
  488. </dd>';
  489. echo '
  490. <dt>
  491. <strong>', $txt['membergroups_members_top'], ':</strong>
  492. </dt>
  493. <dd>
  494. ', $context['total_members'] ,'
  495. </dd>';
  496. // Any group moderators to show?
  497. if (!empty($context['group']['moderators']))
  498. {
  499. $moderators = array();
  500. foreach ($context['group']['moderators'] as $moderator)
  501. $moderators[] = '<a href="' . $scripturl . '?action=profile;u=' . $moderator['id'] . '">' . $moderator['name'] . '</a>';
  502. echo '
  503. <dt>
  504. <strong>', $txt['membergroups_members_group_moderators'], ':</strong>
  505. </dt>
  506. <dd>
  507. ', implode(', ', $moderators) ,'
  508. </dd>';
  509. }
  510. echo '
  511. </dl>
  512. </div>
  513. </div>
  514. <br>
  515. <div class="title_bar">
  516. <h4 class="titlebg">', $txt['membergroups_members_group_members'], '</h4>
  517. </div>
  518. <br>
  519. <div class="pagesection">', $context['page_index'], '</div>
  520. <table class="table_grid">
  521. <thead>
  522. <tr class="catbg">
  523. <th class="first_th"><a href="', $scripturl, '?action=', $context['current_action'], (isset($context['admin_area']) ? ';area=' . $context['admin_area'] : ''), ';sa=members;start=', $context['start'], ';sort=name', $context['sort_by'] == 'name' && $context['sort_direction'] == 'up' ? ';desc' : '', ';group=', $context['group']['id'], '">', $txt['name'], $context['sort_by'] == 'name' ? ' <span class="sort sort_' . $context['sort_direction'] . '"></span>' : '', '</a></th>';
  524. if ($context['can_send_email'])
  525. echo '
  526. <th><a href="', $scripturl, '?action=', $context['current_action'], (isset($context['admin_area']) ? ';area=' . $context['admin_area'] : ''), ';sa=members;start=', $context['start'], ';sort=email', $context['sort_by'] == 'email' && $context['sort_direction'] == 'up' ? ';desc' : '', ';group=', $context['group']['id'], '">', $txt['email'], $context['sort_by'] == 'email' ? ' <span class="sort sort_' . $context['sort_direction'] . '"></span>' : '', '</a></th>';
  527. echo '
  528. <th><a href="', $scripturl, '?action=', $context['current_action'], (isset($context['admin_area']) ? ';area=' . $context['admin_area'] : ''), ';sa=members;start=', $context['start'], ';sort=active', $context['sort_by'] == 'active' && $context['sort_direction'] == 'up' ? ';desc' : '', ';group=', $context['group']['id'], '">', $txt['membergroups_members_last_active'], $context['sort_by'] == 'active' ? '<span class="sort sort_' . $context['sort_direction'] . '"></span>' : '', '</a></th>
  529. <th><a href="', $scripturl, '?action=', $context['current_action'], (isset($context['admin_area']) ? ';area=' . $context['admin_area'] : ''), ';sa=members;start=', $context['start'], ';sort=registered', $context['sort_by'] == 'registered' && $context['sort_direction'] == 'up' ? ';desc' : '', ';group=', $context['group']['id'], '">', $txt['date_registered'], $context['sort_by'] == 'registered' ? '<span class="sort sort_' . $context['sort_direction'] . '"></span>' : '', '</a></th>
  530. <th ', empty($context['group']['assignable']) ? ' class="last_th" colspan="2"' : '', '><a href="', $scripturl, '?action=', $context['current_action'], (isset($context['admin_area']) ? ';area=' . $context['admin_area'] : ''), ';sa=members;start=', $context['start'], ';sort=posts', $context['sort_by'] == 'posts' && $context['sort_direction'] == 'up' ? ';desc' : '', ';group=', $context['group']['id'], '">', $txt['posts'], $context['sort_by'] == 'posts' ? ' <span class="sort sort_' . $context['sort_direction'] . '"></span>' : '','</a></th>';
  531. if (!empty($context['group']['assignable']))
  532. echo '
  533. <th class="last_th" style="width: 4%" align="center"><input type="checkbox" class="input_check" onclick="invertAll(this, this.form);"></th>';
  534. echo '
  535. </tr>
  536. </thead>
  537. <tbody>';
  538. if (empty($context['members']))
  539. echo '
  540. <tr class="windowbg2">
  541. <td colspan="6" align="center">', $txt['membergroups_members_no_members'], '</td>
  542. </tr>';
  543. $alternate = false;
  544. foreach ($context['members'] as $member)
  545. {
  546. $alternate = !$alternate;
  547. echo '
  548. <tr class="', $alternate === true ? 'windowbg' : 'windowbg2', '">
  549. <td>', $member['name'], '</td>';
  550. if ($context['can_send_email'])
  551. {
  552. echo '
  553. <td', $member['show_email'] == 'no_through_forum' && $settings['use_image_buttons'] ? ' class="centertext"' : '', '>';
  554. // Is it totally hidden?
  555. if ($member['show_email'] == 'no')
  556. echo '
  557. <em>', $txt['hidden'], '</em>';
  558. // ... otherwise they want it hidden but it's not to this person?
  559. elseif ($member['show_email'] == 'yes_permission_override')
  560. echo '
  561. <a href="mailto:', $member['email'], '"><em>', $member['email'], '</em></a>';
  562. // ... otherwise it's visible - but only via an image?
  563. elseif ($member['show_email'] == 'no_through_forum')
  564. echo '
  565. <a href="', $scripturl, '?action=emailuser;sa=email;uid=', $member['id'], '" rel="nofollow">', ($settings['use_image_buttons'] ? '<span class="generic_icons mail" title="' . $txt['email'] . '"></span>' : $txt['email']), '</a>';
  566. // ... otherwise it must be a 'yes', show it and show it fully.
  567. else
  568. echo '
  569. <a href="mailto:', $member['email'], '">', $member['email'], '</a>';
  570. echo '
  571. </td>';
  572. }
  573. echo '
  574. <td>', $member['last_online'], '</td>
  575. <td>', $member['registered'], '</td>
  576. <td', empty($context['group']['assignable']) ? ' colspan="2"' : '', '>', $member['posts'], '</td>';
  577. if (!empty($context['group']['assignable']))
  578. echo '
  579. <td align="center" style="width: 4%"><input type="checkbox" name="rem[]" value="', $member['id'], '" class="input_check" ', ($context['user']['id'] == $member['id'] && $context['group']['id'] == 1 ? 'onclick="if (this.checked) return confirm(\'' . $txt['membergroups_members_deadmin_confirm'] . '\')" ' : ''), '/></td>';
  580. echo '
  581. </tr>';
  582. }
  583. echo '
  584. </tbody>
  585. </table>';
  586. if (!empty($context['group']['assignable']))
  587. echo '
  588. <div class="floatright">
  589. <input type="submit" name="remove" value="', $txt['membergroups_members_remove'], '" class="button_submit ">
  590. </div>';
  591. echo '
  592. <div class="pagesection flow_hidden">
  593. <div class="floatleft">', $context['page_index'], '</div>
  594. </div>
  595. <br>';
  596. if (!empty($context['group']['assignable']))
  597. {
  598. echo '
  599. <div class="cat_bar cat_bar_odd">
  600. <h3 class="catbg catbg_odd">', $txt['membergroups_members_add_title'], '</h3>
  601. </div>
  602. <div class="windowbg">
  603. <div class="content">
  604. <dl class="settings">
  605. <dt>
  606. <strong><label for="toAdd">', $txt['membergroups_members_add_desc'], ':</label></strong>
  607. </dt>
  608. <dd>
  609. <input type="text" name="toAdd" id="toAdd" value="" class="input_text">
  610. <div id="toAddItemContainer"></div>
  611. </dd>
  612. </dl>
  613. <input type="submit" name="add" value="', $txt['membergroups_members_add'], '" class="button_submit">
  614. </div>
  615. </div>';
  616. }
  617. echo '
  618. <input type="hidden" name="', $context['session_var'], '" value="', $context['session_id'], '">
  619. <input type="hidden" name="', $context['mod-mgm_token_var'], '" value="', $context['mod-mgm_token'], '">
  620. </form>
  621. </div>';
  622. if (!empty($context['group']['assignable']))
  623. echo '
  624. <script src="', $settings['default_theme_url'], '/scripts/suggest.js?alp21"></script>
  625. <script><!-- // --><![CDATA[
  626. var oAddMemberSuggest = new smc_AutoSuggest({
  627. sSelf: \'oAddMemberSuggest\',
  628. sSessionId: \'', $context['session_id'], '\',
  629. sSessionVar: \'', $context['session_var'], '\',
  630. sSuggestId: \'to_suggest\',
  631. sControlId: \'toAdd\',
  632. sSearchType: \'member\',
  633. sPostName: \'member_add\',
  634. sURLMask: \'action=profile;u=%item_id%\',
  635. sTextDeleteItem: \'', $txt['autosuggest_delete_item'], '\',
  636. bItemList: true,
  637. sItemListContainerId: \'toAddItemContainer\'
  638. });
  639. // ]]></script>';
  640. }
  641. // Allow the moderator to enter a reason to each user being rejected.
  642. function template_group_request_reason()
  643. {
  644. global $context, $txt, $scripturl;
  645. // Show a welcome message to the user.
  646. echo '
  647. <div id="moderationcenter">
  648. <form action="', $scripturl, '?action=groups;sa=requests" method="post" accept-charset="', $context['character_set'], '">
  649. <div class="cat_bar">
  650. <h3 class="catbg">', $txt['mc_groups_reason_title'], '</h3>
  651. </div>
  652. <div class="windowbg">
  653. <div class="content">
  654. <dl class="settings">';
  655. // Loop through and print out a reason box for each...
  656. foreach ($context['group_requests'] as $request)
  657. echo '
  658. <dt>
  659. <strong>', sprintf($txt['mc_groupr_reason_desc'], $request['member_link'], $request['group_link']), ':</strong>
  660. </dt>
  661. <dd>
  662. <input type="hidden" name="groupr[]" value="', $request['id'], '">
  663. <textarea name="groupreason[', $request['id'], ']" rows="3" cols="40" style="' . (isBrowser('is_ie8') ? 'width: 635px; min-width: 96%; max-width: 96%' : 'min-width: 80%; max-width: 99%') . ';"></textarea>
  664. </dd>';
  665. echo '
  666. </dl>
  667. <input type="submit" name="go" value="', $txt['mc_groupr_submit'], '" class="button_submit">
  668. <input type="hidden" name="req_action" value="got_reason">
  669. <input type="hidden" name="', $context['session_var'], '" value="', $context['session_id'], '">
  670. <input type="hidden" name="', $context['mod-gr_token_var'], '" value="', $context['mod-gr_token'], '">
  671. </div>
  672. </div>
  673. </form>
  674. </div>';
  675. }
  676. ?>