ManageMembergroups.template.php 34 KB

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