ManageMembergroups.template.php 33 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739
  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><!-- // --><![CDATA[
  309. var oModeratorSuggest = new smc_AutoSuggest({
  310. sSelf: \'oModeratorSuggest\',
  311. sSessionId: smf_session_id,
  312. sSessionVar: smf_session_var,
  313. sSuggestId: \'group_moderators\',
  314. sControlId: \'group_moderators\',
  315. sSearchType: \'member\',
  316. bItemList: true,
  317. sPostName: \'moderator_list\',
  318. sURLMask: \'action=profile;u=%item_id%\',
  319. sTextDeleteItem: \'', $txt['autosuggest_delete_item'], '\',
  320. sItemListContainerId: \'moderator_container\',
  321. aListItems: [';
  322. foreach ($context['group']['moderators'] as $id_member => $member_name)
  323. echo '
  324. {
  325. sItemId: ', JavaScriptEscape($id_member), ',
  326. sItemName: ', JavaScriptEscape($member_name), '
  327. }', $id_member == $context['group']['last_moderator_id'] ? '' : ',';
  328. echo '
  329. ]
  330. });
  331. // ]]></script>';
  332. if ($context['group']['allow_post_group'])
  333. echo '
  334. <script><!-- // --><![CDATA[
  335. function swapPostGroup(isChecked)
  336. {
  337. var is_moderator_group = ', $context['is_moderator_group'], ';
  338. var group_type = ', $context['group']['type'], ';
  339. var min_posts_text = document.getElementById(\'min_posts_text\');
  340. var group_desc_text = document.getElementById(\'group_desc_text\');
  341. var group_hidden_text = document.getElementById(\'group_hidden_text\');
  342. var group_moderators_text = document.getElementById(\'group_moderators_text\');
  343. // If it\'s a moderator group, warn of possible problems... and remember the group type
  344. if (isChecked && is_moderator_group && !confirm(\'', $txt['membergroups_swap_mod'], '\'))
  345. {
  346. isChecked = false;
  347. switch(group_type)
  348. {
  349. case 0:
  350. document.getElementById(\'group_type_private\').checked = true;
  351. break;
  352. case 1:
  353. document.getElementById(\'group_type_protected\').checked = true;
  354. break;
  355. case 2:
  356. document.getElementById(\'group_type_request\').checked = true;
  357. break;
  358. case 3:
  359. document.getElementById(\'group_type_free\').checked = true;
  360. break;
  361. default:
  362. document.getElementById(\'group_type_private\').checked = true;
  363. break;
  364. }
  365. }
  366. document.forms.groupForm.min_posts.disabled = !isChecked;
  367. min_posts_text.style.color = isChecked ? "" : "#888888";
  368. document.forms.groupForm.group_desc_input.disabled = isChecked;
  369. group_desc_text.style.color = !isChecked ? "" : "#888888";
  370. document.forms.groupForm.group_hidden_input.disabled = isChecked;
  371. group_hidden_text.style.color = !isChecked ? "" : "#888888";
  372. document.forms.groupForm.group_moderators.disabled = isChecked;
  373. group_moderators_text.style.color = !isChecked ? "" : "#888888";
  374. }
  375. swapPostGroup(', $context['group']['is_post_group'] ? 'true' : 'false', ');
  376. // ]]></script>';
  377. }
  378. function template_add_edit_group_boards_list($collapse = true)
  379. {
  380. global $context, $txt, $modSettings;
  381. echo '
  382. <fieldset id="visible_boards">
  383. <legend>', $txt['membergroups_new_board_desc'], '</legend>
  384. <ul class="padding floatleft">';
  385. foreach ($context['categories'] as $category)
  386. {
  387. if (empty($modSettings['deny_boards_access']))
  388. echo '
  389. <li class="category">
  390. <a href="javascript:void(0);" onclick="selectBoards([', implode(', ', $category['child_ids']), '], \'new_group\'); return false;"><strong>', $category['name'], '</strong></a>
  391. <ul style="width:100%">';
  392. else
  393. echo '
  394. <li class="category">
  395. <strong>', $category['name'], '</strong>
  396. <span class="select_all_box">
  397. <em style="margin-left:5em;">', $txt['all_boards_in_cat'], ': </em>
  398. <select onchange="select_in_category(', $category['id'], ', this, [', implode(',', array_keys($category['boards'])), ']);">
  399. <option>---</option>
  400. <option value="allow">', $txt['board_perms_allow'], '</option>
  401. <option value="ignore">', $txt['board_perms_ignore'], '</option>
  402. <option value="deny">', $txt['board_perms_deny'], '</option>
  403. </select>
  404. </span>
  405. <ul style="width:100%" id="boards_list_', $category['id'], '">';
  406. foreach ($category['boards'] as $board)
  407. {
  408. if (empty($modSettings['deny_boards_access']))
  409. echo '
  410. <li class="board" style="margin-', $context['right_to_left'] ? 'right' : 'left', ': ', $board['child_level'], 'em;">
  411. <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>
  412. </li>';
  413. else
  414. echo '
  415. <li class="board" style="width:100%">
  416. <span style="margin-', $context['right_to_left'] ? 'right' : 'left', ': ', $board['child_level'], 'em;">', $board['name'], ': </span>
  417. <span style="width:50%;float:right">
  418. <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>
  419. <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>
  420. <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>
  421. </span>
  422. </li>';
  423. }
  424. echo '
  425. </ul>
  426. </li>';
  427. }
  428. echo '
  429. </ul>';
  430. if (empty($modSettings['deny_boards_access']))
  431. echo '
  432. <br class="clear"><br>
  433. <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>
  434. </fieldset>';
  435. else
  436. echo '
  437. <br class="clear">
  438. <span class="select_all_box">
  439. <em>', $txt['all'], ': </em>
  440. <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>
  441. <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>
  442. <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>
  443. </span>
  444. </fieldset>
  445. <script><!-- // --><![CDATA[
  446. $(document).ready(function () {
  447. $(".select_all_box").each(function () {
  448. $(this).removeClass(\'select_all_box\');
  449. });
  450. });
  451. // ]]></script>';
  452. if ($collapse)
  453. echo '
  454. <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>
  455. <script><!-- // --><![CDATA[
  456. document.getElementById("visible_boards_link").style.display = "";
  457. document.getElementById("visible_boards").style.display = "none";
  458. // ]]></script>';
  459. }
  460. // Templating for viewing the members of a group.
  461. function template_group_members()
  462. {
  463. global $context, $settings, $scripturl, $txt;
  464. echo '
  465. <div id="admincenter">
  466. <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">
  467. <div class="cat_bar">
  468. <h3 class="catbg">', $context['page_title'], '</h3>
  469. </div>
  470. <div class="windowbg">
  471. <div class="content">
  472. <dl class="settings">
  473. <dt>
  474. <strong>', $txt['name'], ':</strong>
  475. </dt>
  476. <dd>
  477. <span ', $context['group']['online_color'] ? 'style="color: ' . $context['group']['online_color'] . ';"' : '', '>', $context['group']['name'], '</span> ', $context['group']['icons'], '
  478. </dd>';
  479. //Any description to show?
  480. if (!empty($context['group']['description']))
  481. echo '
  482. <dt>
  483. <strong>' . $txt['membergroups_members_description'] . ':</strong>
  484. </dt>
  485. <dd>
  486. ', $context['group']['description'] ,'
  487. </dd>';
  488. echo '
  489. <dt>
  490. <strong>', $txt['membergroups_members_top'], ':</strong>
  491. </dt>
  492. <dd>
  493. ', $context['total_members'] ,'
  494. </dd>';
  495. // Any group moderators to show?
  496. if (!empty($context['group']['moderators']))
  497. {
  498. $moderators = array();
  499. foreach ($context['group']['moderators'] as $moderator)
  500. $moderators[] = '<a href="' . $scripturl . '?action=profile;u=' . $moderator['id'] . '">' . $moderator['name'] . '</a>';
  501. echo '
  502. <dt>
  503. <strong>', $txt['membergroups_members_group_moderators'], ':</strong>
  504. </dt>
  505. <dd>
  506. ', implode(', ', $moderators) ,'
  507. </dd>';
  508. }
  509. echo '
  510. </dl>
  511. </div>
  512. </div>
  513. <br>
  514. <div class="cat_bar">
  515. <h4 class="catbg">', $txt['membergroups_members_group_members'], '</h4>
  516. </div>
  517. <br>
  518. <div class="pagesection">', $context['page_index'], '</div>
  519. <table class="table_grid">
  520. <thead>
  521. <tr class="catbg">
  522. <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>';
  523. if ($context['can_send_email'])
  524. echo '
  525. <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>';
  526. echo '
  527. <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>
  528. <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>
  529. <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>';
  530. if (!empty($context['group']['assignable']))
  531. echo '
  532. <th class="last_th" style="width: 4%" align="center"><input type="checkbox" class="input_check" onclick="invertAll(this, this.form);"></th>';
  533. echo '
  534. </tr>
  535. </thead>
  536. <tbody>';
  537. if (empty($context['members']))
  538. echo '
  539. <tr class="windowbg2">
  540. <td colspan="6" align="center">', $txt['membergroups_members_no_members'], '</td>
  541. </tr>';
  542. $alternate = false;
  543. foreach ($context['members'] as $member)
  544. {
  545. $alternate = !$alternate;
  546. echo '
  547. <tr class="', $alternate === true ? 'windowbg' : 'windowbg2', '">
  548. <td>', $member['name'], '</td>';
  549. if ($context['can_send_email'])
  550. {
  551. echo '
  552. <td', $member['show_email'] == 'no_through_forum' && $settings['use_image_buttons'] ? ' class="centertext"' : '', '>';
  553. // Is it totally hidden?
  554. if ($member['show_email'] == 'no')
  555. echo '
  556. <em>', $txt['hidden'], '</em>';
  557. // ... otherwise they want it hidden but it's not to this person?
  558. elseif ($member['show_email'] == 'yes_permission_override')
  559. echo '
  560. <a href="mailto:', $member['email'], '"><em>', $member['email'], '</em></a>';
  561. // ... otherwise it's visible - but only via an image?
  562. elseif ($member['show_email'] == 'no_through_forum')
  563. echo '
  564. <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>';
  565. // ... otherwise it must be a 'yes', show it and show it fully.
  566. else
  567. echo '
  568. <a href="mailto:', $member['email'], '">', $member['email'], '</a>';
  569. echo '
  570. </td>';
  571. }
  572. echo '
  573. <td>', $member['last_online'], '</td>
  574. <td>', $member['registered'], '</td>
  575. <td', empty($context['group']['assignable']) ? ' colspan="2"' : '', '>', $member['posts'], '</td>';
  576. if (!empty($context['group']['assignable']))
  577. echo '
  578. <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>';
  579. echo '
  580. </tr>';
  581. }
  582. echo '
  583. </tbody>
  584. </table>';
  585. if (!empty($context['group']['assignable']))
  586. echo '
  587. <div class="floatright">
  588. <input type="submit" name="remove" value="', $txt['membergroups_members_remove'], '" class="button_submit ">
  589. </div>';
  590. echo '
  591. <div class="pagesection flow_hidden">
  592. <div class="floatleft">', $context['page_index'], '</div>
  593. </div>
  594. <br>';
  595. if (!empty($context['group']['assignable']))
  596. {
  597. echo '
  598. <div class="cat_bar">
  599. <h3 class="catbg">', $txt['membergroups_members_add_title'], '</h3>
  600. </div>
  601. <div class="windowbg">
  602. <div class="content">
  603. <dl class="settings">
  604. <dt>
  605. <strong><label for="toAdd">', $txt['membergroups_members_add_desc'], ':</label></strong>
  606. </dt>
  607. <dd>
  608. <input type="text" name="toAdd" id="toAdd" value="" class="input_text">
  609. <div id="toAddItemContainer"></div>
  610. </dd>
  611. </dl>
  612. <input type="submit" name="add" value="', $txt['membergroups_members_add'], '" class="button_submit">
  613. </div>
  614. </div>';
  615. }
  616. echo '
  617. <input type="hidden" name="', $context['session_var'], '" value="', $context['session_id'], '">
  618. <input type="hidden" name="', $context['mod-mgm_token_var'], '" value="', $context['mod-mgm_token'], '">
  619. </form>
  620. </div>';
  621. if (!empty($context['group']['assignable']))
  622. echo '
  623. <script><!-- // --><![CDATA[
  624. var oAddMemberSuggest = new smc_AutoSuggest({
  625. sSelf: \'oAddMemberSuggest\',
  626. sSessionId: \'', $context['session_id'], '\',
  627. sSessionVar: \'', $context['session_var'], '\',
  628. sSuggestId: \'to_suggest\',
  629. sControlId: \'toAdd\',
  630. sSearchType: \'member\',
  631. sPostName: \'member_add\',
  632. sURLMask: \'action=profile;u=%item_id%\',
  633. sTextDeleteItem: \'', $txt['autosuggest_delete_item'], '\',
  634. bItemList: true,
  635. sItemListContainerId: \'toAddItemContainer\'
  636. });
  637. // ]]></script>';
  638. }
  639. // Allow the moderator to enter a reason to each user being rejected.
  640. function template_group_request_reason()
  641. {
  642. global $context, $txt, $scripturl;
  643. // Show a welcome message to the user.
  644. echo '
  645. <div id="moderationcenter">
  646. <form action="', $scripturl, '?action=groups;sa=requests" method="post" accept-charset="', $context['character_set'], '">
  647. <div class="cat_bar">
  648. <h3 class="catbg">', $txt['mc_groups_reason_title'], '</h3>
  649. </div>
  650. <div class="windowbg">
  651. <div class="content">
  652. <dl class="settings">';
  653. // Loop through and print out a reason box for each...
  654. foreach ($context['group_requests'] as $request)
  655. echo '
  656. <dt>
  657. <strong>', sprintf($txt['mc_groupr_reason_desc'], $request['member_link'], $request['group_link']), ':</strong>
  658. </dt>
  659. <dd>
  660. <input type="hidden" name="groupr[]" value="', $request['id'], '">
  661. <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>
  662. </dd>';
  663. echo '
  664. </dl>
  665. <input type="submit" name="go" value="', $txt['mc_groupr_submit'], '" class="button_submit">
  666. <input type="hidden" name="req_action" value="got_reason">
  667. <input type="hidden" name="', $context['session_var'], '" value="', $context['session_id'], '">
  668. <input type="hidden" name="', $context['mod-gr_token_var'], '" value="', $context['mod-gr_token'], '">
  669. </div>
  670. </div>
  671. </form>
  672. </div>';
  673. }
  674. ?>