2
0

ManageMembergroups.template.php 33 KB

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