ManageBoards.template.php 28 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714
  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. // Template for listing all the current categories and boards.
  13. function template_main()
  14. {
  15. global $context, $settings, $scripturl, $txt, $modSettings;
  16. // Table header.
  17. echo '
  18. <div id="manage_boards">
  19. <div class="title_bar">
  20. <h3 class="titlebg">', $txt['boardsEdit'], '</h3>
  21. </div>';
  22. if (!empty($context['move_board']))
  23. echo '
  24. <div class="information">
  25. <p>', $context['move_title'], ' [<a href="', $scripturl, '?action=admin;area=manageboards">', $txt['mboards_cancel_moving'], '</a>]', '</p>
  26. </div>';
  27. // No categories so show a label.
  28. if (empty($context['categories']))
  29. echo '
  30. <div class="windowbg">
  31. <div class="content centertext">
  32. ', $txt['mboards_no_cats'], '
  33. </div>
  34. </div>';
  35. // Loop through every category, listing the boards in each as we go.
  36. foreach ($context['categories'] as $category)
  37. {
  38. // Link to modify the category.
  39. echo '
  40. <div class="cat_bar">
  41. <h3 class="catbg">
  42. <a href="', $scripturl, '?action=admin;area=manageboards;sa=cat;cat=', $category['id'], '">', $category['name'], '</a> <a href="', $scripturl, '?action=admin;area=manageboards;sa=cat;cat=', $category['id'], '">', $txt['catModify'], '</a>
  43. </h3>
  44. </div>';
  45. // Boards table header.
  46. echo '
  47. <form action="', $scripturl, '?action=admin;area=manageboards;sa=newboard;cat=', $category['id'], '" method="post" accept-charset="', $context['character_set'], '">
  48. <div class="windowbg">
  49. <div class="content">
  50. <ul id="category_', $category['id'], '" class="reset nolist">';
  51. if (!empty($category['move_link']))
  52. echo '
  53. <li><a href="', $category['move_link']['href'], '" title="', $category['move_link']['label'], '"><span class="select_spot above"></span></a></li>';
  54. $alternate = false;
  55. $recycle_board = '<a href="' . $scripturl . '?action=admin;area=manageboards;sa=settings"> <img src="' . $settings['images_url'] . '/post/recycled.png" alt="' . $txt['recycle_board'] . '" title="' . $txt['recycle_board'] . '"></a>';
  56. $redirect_board = '<img src="' . $settings['images_url'] . '/new_redirect.png" alt="' . $txt['redirect_board_desc'] . '" title="' . $txt['redirect_board_desc'] . '">';
  57. // List through every board in the category, printing its name and link to modify the board.
  58. foreach ($category['boards'] as $board)
  59. {
  60. echo '
  61. <li', !empty($modSettings['recycle_board']) && !empty($modSettings['recycle_enable']) && $modSettings['recycle_board'] == $board['id'] ? ' id="recycle_board"' : ' ', ' class="windowbg', $alternate ? '' : '2', $board['is_redirect'] ? ' redirect_board' : '', '" style="padding-' . ($context['right_to_left'] ? 'right' : 'left') . ': ', 5 + 30 * $board['child_level'], 'px;">
  62. <span class="floatleft"><a', $board['move'] ? ' style="color: red;"' : '', ' href="', $scripturl, '?board=', $board['id'], '.0">', $board['name'], '</a>', !empty($modSettings['recycle_board']) && !empty($modSettings['recycle_enable']) && $modSettings['recycle_board'] == $board['id'] ? $recycle_board : '', $board['is_redirect'] ? $redirect_board : '', '</span>
  63. <span class="floatright">', $context['can_manage_permissions'] ? '<span class="modify_boards"><a href="' . $scripturl . '?action=admin;area=permissions;sa=index;pid=' . $board['permission_profile'] . ';' . $context['session_var'] . '=' . $context['session_id'] . '">' . $txt['mboards_permissions'] . '</a></span>' : '', '
  64. <span class="modify_boards"><a href="', $scripturl, '?action=admin;area=manageboards;move=', $board['id'], '">', $txt['mboards_move'], '</a></span>
  65. <span class="modify_boards"><a href="', $scripturl, '?action=admin;area=manageboards;sa=board;boardid=', $board['id'], '">', $txt['mboards_modify'], '</a></span></span><br style="clear: right;">
  66. </li>';
  67. if (!empty($board['move_links']))
  68. {
  69. $alternate = !$alternate;
  70. echo '
  71. <li class="windowbg', $alternate ? '' : '2', '" style="padding-', $context['right_to_left'] ? 'right' : 'left', ': ', 5 + 30 * $board['move_links'][0]['child_level'], 'px;">';
  72. foreach ($board['move_links'] as $link)
  73. echo '
  74. <a href="', $link['href'], '" class="move_links" title="', $link['label'], '"><span class="select_spot ', $link['class'], '" title="', $link['label'], '" style="padding: 0px; margin: 0px;"></span></a>';
  75. echo '
  76. </li>';
  77. }
  78. $alternate = !$alternate;
  79. }
  80. // Button to add a new board.
  81. echo '
  82. </ul>
  83. <input type="submit" value="', $txt['mboards_new_board'], '" class="button_submit">
  84. <input type="hidden" name="', $context['session_var'], '" value="', $context['session_id'], '">
  85. </div>
  86. </div>
  87. </form>';
  88. }
  89. echo '
  90. </div>';
  91. }
  92. // Template for editing/adding a category on the forum.
  93. function template_modify_category()
  94. {
  95. global $context, $scripturl, $txt;
  96. // Print table header.
  97. echo '
  98. <div id="manage_boards">
  99. <form action="', $scripturl, '?action=admin;area=manageboards;sa=cat2" method="post" accept-charset="', $context['character_set'], '">
  100. <input type="hidden" name="cat" value="', $context['category']['id'], '">
  101. <div class="cat_bar">
  102. <h3 class="catbg">
  103. ', isset($context['category']['is_new']) ? $txt['mboards_new_cat_name'] : $txt['catEdit'], '
  104. </h3>
  105. </div>
  106. <div class="windowbg">
  107. <div class="content">
  108. <dl class="settings">';
  109. // If this isn't the only category, let the user choose where this category should be positioned down the board index.
  110. if (count($context['category_order']) > 1)
  111. {
  112. echo '
  113. <dt><strong>', $txt['order'], ':</strong></dt>
  114. <dd>
  115. <select name="cat_order">';
  116. // Print every existing category into a select box.
  117. foreach ($context['category_order'] as $order)
  118. echo '
  119. <option', $order['selected'] ? ' selected' : '', ' value="', $order['id'], '">', $order['name'], '</option>';
  120. echo '
  121. </select>
  122. </dd>';
  123. }
  124. // Allow the user to edit the category name and/or choose whether you can collapse the category.
  125. echo '
  126. <dt>
  127. <strong>', $txt['full_name'], ':</strong><br>
  128. <span class="smalltext">', $txt['name_on_display'], '</span>
  129. </dt>
  130. <dd>
  131. <input type="text" name="cat_name" value="', $context['category']['editable_name'], '" size="30" tabindex="', $context['tabindex']++, '" class="input_text">
  132. </dd>
  133. <dt>
  134. <strong>', $txt['mboards_description'], '</strong><br>
  135. <span class="smalltext">', $txt['mboards_cat_description_desc'], '</span>
  136. </dt>
  137. <dd>
  138. <textarea name="cat_desc" rows="3" cols="35" style="width: 99%;">', $context['category']['description'], '</textarea>
  139. </dd>
  140. <dt>
  141. <strong>', $txt['collapse_enable'], '</strong><br>
  142. <span class="smalltext">', $txt['collapse_desc'], '</span>
  143. </dt>
  144. <dd>
  145. <input type="checkbox" name="collapse"', $context['category']['can_collapse'] ? ' checked' : '', ' tabindex="', $context['tabindex']++, '" class="input_check">
  146. </dd>';
  147. // Table footer.
  148. echo '
  149. </dl>';
  150. if (isset($context['category']['is_new']))
  151. echo '
  152. <input type="submit" name="add" value="', $txt['mboards_add_cat_button'], '" onclick="return !isEmptyText(this.form.cat_name);" tabindex="', $context['tabindex']++, '" class="button_submit">';
  153. else
  154. echo '
  155. <input type="submit" name="edit" value="', $txt['modify'], '" onclick="return !isEmptyText(this.form.cat_name);" tabindex="', $context['tabindex']++, '" class="button_submit">
  156. <input type="submit" name="delete" value="', $txt['mboards_delete_cat'], '" onclick="return confirm(\'', $txt['catConfirm'], '\');" class="button_submit">';
  157. echo '
  158. <input type="hidden" name="', $context['session_var'], '" value="', $context['session_id'], '">';
  159. if (!empty($context['token_check']))
  160. echo '
  161. <input type="hidden" name="', $context[$context['token_check'] . '_token_var'], '" value="', $context[$context['token_check'] . '_token'], '">';
  162. // If this category is empty we don't bother with the next confirmation screen.
  163. if ($context['category']['is_empty'])
  164. echo '
  165. <input type="hidden" name="empty" value="1">';
  166. echo '
  167. </div>
  168. </div>
  169. </form>
  170. </div>';
  171. }
  172. // A template to confirm if a user wishes to delete a category - and whether they want to save the boards.
  173. function template_confirm_category_delete()
  174. {
  175. global $context, $scripturl, $txt;
  176. // Print table header.
  177. echo '
  178. <div id="manage_boards">
  179. <form action="', $scripturl, '?action=admin;area=manageboards;sa=cat2" method="post" accept-charset="', $context['character_set'], '">
  180. <input type="hidden" name="cat" value="', $context['category']['id'], '">
  181. <div class="cat_bar">
  182. <h3 class="catbg">', $txt['mboards_delete_cat'], '</h3>
  183. </div>
  184. <div class="windowbg">
  185. <div class="content">
  186. <p>', $txt['mboards_delete_cat_contains'], ':</p>
  187. <ul>';
  188. foreach ($context['category']['children'] as $child)
  189. echo '
  190. <li>', $child, '</li>';
  191. echo '
  192. </ul>
  193. </div>
  194. </div>
  195. <div class="cat_bar">
  196. <h3 class="catbg">', $txt['mboards_delete_what_do'], '</h3>
  197. </div>
  198. <div class="windowbg">
  199. <div class="content">
  200. <p>
  201. <label for="delete_action0"><input type="radio" id="delete_action0" name="delete_action" value="0" class="input_radio" checked>', $txt['mboards_delete_option1'], '</label><br>
  202. <label for="delete_action1"><input type="radio" id="delete_action1" name="delete_action" value="1" class="input_radio"', count($context['category_order']) == 1 ? ' disabled' : '', '>', $txt['mboards_delete_option2'], '</label>:
  203. <select name="cat_to"', count($context['category_order']) == 1 ? ' disabled' : '', '>';
  204. foreach ($context['category_order'] as $cat)
  205. if ($cat['id'] != 0)
  206. echo '
  207. <option value="', $cat['id'], '">', $cat['true_name'], '</option>';
  208. echo '
  209. </select>
  210. </p>
  211. <input type="submit" name="delete" value="', $txt['mboards_delete_confirm'], '" class="button_submit">
  212. <input type="submit" name="cancel" value="', $txt['mboards_delete_cancel'], '" class="button_submit">
  213. <input type="hidden" name="confirmation" value="1">
  214. <input type="hidden" name="', $context['session_var'], '" value="', $context['session_id'], '">
  215. </div>
  216. </div>
  217. </form>
  218. </div>';
  219. }
  220. // Below is the template for adding/editing an board on the forum.
  221. function template_modify_board()
  222. {
  223. global $context, $settings, $scripturl, $txt, $modSettings;
  224. // The main table header.
  225. echo '
  226. <div id="manage_boards">
  227. <form action="', $scripturl, '?action=admin;area=manageboards;sa=board2" method="post" accept-charset="', $context['character_set'], '">
  228. <input type="hidden" name="boardid" value="', $context['board']['id'], '">
  229. <div class="cat_bar">
  230. <h3 class="catbg">
  231. ', isset($context['board']['is_new']) ? $txt['mboards_new_board_name'] : $txt['boardsEdit'], '
  232. </h3>
  233. </div>
  234. <div class="windowbg">
  235. <div class="content">
  236. <dl class="settings">';
  237. // Option for choosing the category the board lives in.
  238. echo '
  239. <dt>
  240. <strong>', $txt['mboards_category'], ':</strong>
  241. </dt>
  242. <dd>
  243. <select name="new_cat" onchange="if (this.form.order) {this.form.order.disabled = this.options[this.selectedIndex].value != 0; this.form.board_order.disabled = this.options[this.selectedIndex].value != 0 || this.form.order.options[this.form.order.selectedIndex].value == \'\';}">';
  244. foreach ($context['categories'] as $category)
  245. echo '
  246. <option', $category['selected'] ? ' selected' : '', ' value="', $category['id'], '">', $category['name'], '</option>';
  247. echo '
  248. </select>
  249. </dd>';
  250. // If this isn't the only board in this category let the user choose where the board is to live.
  251. if ((isset($context['board']['is_new']) && count($context['board_order']) > 0) || count($context['board_order']) > 1)
  252. {
  253. echo '
  254. <dt>
  255. <strong>', $txt['order'], ':</strong>
  256. </dt>
  257. <dd>';
  258. // The first select box gives the user the option to position it before, after or as a child of another board.
  259. echo '
  260. <select id="order" name="placement" onchange="this.form.board_order.disabled = this.options[this.selectedIndex].value == \'\';">
  261. ', !isset($context['board']['is_new']) ? '<option value="">(' . $txt['mboards_unchanged'] . ')</option>' : '', '
  262. <option value="after">' . $txt['mboards_order_after'] . '...</option>
  263. <option value="child">' . $txt['mboards_order_child_of'] . '...</option>
  264. <option value="before">' . $txt['mboards_order_before'] . '...</option>
  265. </select>';
  266. // The second select box lists all the boards in the category.
  267. echo '
  268. <select id="board_order" name="board_order"', !isset($context['board']['is_new']) ? ' disabled' : '', '>
  269. ', !isset($context['board']['is_new']) ? '<option value="">(' . $txt['mboards_unchanged'] . ')</option>' : '';
  270. foreach ($context['board_order'] as $order)
  271. echo '
  272. <option', $order['selected'] ? ' selected' : '', ' value="', $order['id'], '">', $order['name'], '</option>';
  273. echo '
  274. </select>
  275. </dd>';
  276. }
  277. // Options for board name and description.
  278. echo '
  279. <dt>
  280. <strong>', $txt['full_name'], ':</strong><br>
  281. <span class="smalltext">', $txt['name_on_display'], '</span>
  282. </dt>
  283. <dd>
  284. <input type="text" name="board_name" value="', $context['board']['name'], '" size="30" class="input_text">
  285. </dd>
  286. <dt>
  287. <strong>', $txt['mboards_description'], ':</strong><br>
  288. <span class="smalltext">', $txt['mboards_description_desc'], '</span>
  289. </dt>
  290. <dd>
  291. <textarea name="desc" rows="3" cols="35" style="width: ', isBrowser('is_ie8') ? '635px; max-width: 99%; min-width: 99' : '99', '%;">', $context['board']['description'], '</textarea>
  292. </dd>
  293. <dt>
  294. <strong>', $txt['permission_profile'], ':</strong><br>
  295. <span class="smalltext">', $context['can_manage_permissions'] ? sprintf($txt['permission_profile_desc'], $scripturl . '?action=admin;area=permissions;sa=profiles;' . $context['session_var'] . '=' . $context['session_id']) : strip_tags($txt['permission_profile_desc']), '</span>
  296. </dt>
  297. <dd>
  298. <select name="profile">';
  299. if (isset($context['board']['is_new']))
  300. echo '
  301. <option value="-1">[', $txt['permission_profile_inherit'], ']</option>';
  302. foreach ($context['profiles'] as $id => $profile)
  303. echo '
  304. <option value="', $id, '"', $id == $context['board']['profile'] ? ' selected' : '', '>', $profile['name'], '</option>';
  305. echo '
  306. </select>
  307. </dd>
  308. <dt>
  309. <strong>', $txt['mboards_groups'], ':</strong><br>
  310. <span class="smalltext">', empty($modSettings['deny_boards_access']) ? $txt['mboards_groups_desc'] : $txt['boardsaccess_option_desc'], '</span>';
  311. echo '
  312. </dt>
  313. <dd>';
  314. if (!empty($modSettings['deny_boards_access']))
  315. echo '
  316. <table>
  317. <tr>
  318. <td></td>
  319. <th>', $txt['permissions_option_on'], '</th>
  320. <th>', $txt['permissions_option_off'], '</th>
  321. <th>', $txt['permissions_option_deny'], '</th>
  322. </tr>';
  323. // List all the membergroups so the user can choose who may access this board.
  324. foreach ($context['groups'] as $group)
  325. if (empty($modSettings['deny_boards_access']))
  326. echo '
  327. <label for="groups_', $group['id'], '">
  328. <input type="checkbox" name="groups[', $group['id'], ']" value="allow" id="groups_', $group['id'], '"', in_array($group['id'], $context['board_managers']) ? ' checked disabled' : ($group['allow'] ? ' checked' : ''), ' class="input_check">
  329. <span', $group['is_post_group'] ? ' class="post_group" title="' . $txt['mboards_groups_post_group'] . '"' : ($group['id'] == 0 ? ' class="regular_members" title="' . $txt['mboards_groups_regular_members'] . '"' : ''), '>
  330. ', $group['name'], '
  331. </span>
  332. </label><br>';
  333. else
  334. echo '
  335. <tr>
  336. <td>
  337. <label for="groups_', $group['id'], '_a">
  338. <span', $group['is_post_group'] ? ' class="post_group" title="' . $txt['mboards_groups_post_group'] . '"' : ($group['id'] == 0 ? ' class="regular_members" title="' . $txt['mboards_groups_regular_members'] . '"' : ''), '>
  339. ', $group['name'], '
  340. </span>
  341. </label>
  342. </td>
  343. <td>
  344. <input type="radio" name="groups[', $group['id'], ']" value="allow" id="groups_', $group['id'], '_a"', in_array($group['id'], $context['board_managers']) ? ' checked disabled' : ($group['allow'] ? ' checked' : ''), ' class="input_radio">
  345. </td>
  346. <td>
  347. <input type="radio" name="groups[', $group['id'], ']" value="ignore" id="groups_', $group['id'], '_x"', in_array($group['id'], $context['board_managers']) ? ' disabled' : (!$group['allow'] && !$group['deny'] ? ' checked' : ''), ' class="input_radio">
  348. </td>
  349. <td>
  350. <input type="radio" name="groups[', $group['id'], ']" value="deny" id="groups_', $group['id'], '_d"', in_array($group['id'], $context['board_managers']) ? ' disabled' : ($group['deny'] ? ' checked' : ''), ' class="input_radio">
  351. </td>
  352. <td></td>
  353. </tr>';
  354. if (empty($modSettings['deny_boards_access']))
  355. echo '
  356. <span class="select_all_box">
  357. <em>', $txt['check_all'], '</em> <input type="checkbox" class="input_check" onclick="invertAll(this, this.form, \'groups[\');">
  358. </span>
  359. <br>
  360. <br>
  361. </dd>';
  362. else
  363. echo '
  364. <tr class="select_all_box">
  365. <td>
  366. </td>
  367. <td>
  368. <input type="radio" name="select_all" class="input_radio" onclick="selectAllRadio(this, this.form, \'groups\', \'allow\');">
  369. </td>
  370. <td>
  371. <input type="radio" name="select_all" class="input_radio" onclick="selectAllRadio(this, this.form, \'groups\', \'ignore\');">
  372. </td>
  373. <td>
  374. <input type="radio" name="select_all" class="input_radio" onclick="selectAllRadio(this, this.form, \'groups\', \'deny\');">
  375. </td>
  376. <td>
  377. <em>', $txt['check_all'], '</em>
  378. </td>
  379. </tr>
  380. </table>
  381. </dd>';
  382. // Options to choose moderators, specifiy as announcement board and choose whether to count posts here.
  383. echo '
  384. <dt>
  385. <strong>', $txt['mboards_moderators'], ':</strong><br>
  386. <span class="smalltext">', $txt['mboards_moderators_desc'], '</span><br>
  387. </dt>
  388. <dd>
  389. <input type="text" name="moderators" id="moderators" value="', $context['board']['moderator_list'], '" size="30" class="input_text">
  390. <div id="moderator_container"></div>
  391. </dd>
  392. <dt>
  393. <strong>', $txt['mboards_moderator_groups'], ':</strong><br>
  394. <span class="smalltext">', $txt['mboards_moderator_groups_desc'], '</span><br>
  395. </dt>
  396. <dd>
  397. <input type="text" name="moderator_groups" id="moderator_groups" value="', $context['board']['moderator_groups_list'], '" size="30" class="input_text">
  398. <div id="moderator_group_container"></div>
  399. </dd>
  400. </dl>
  401. <script><!-- // --><![CDATA[
  402. $(document).ready(function () {
  403. $(".select_all_box").each(function () {
  404. $(this).removeClass(\'select_all_box\');
  405. });
  406. });
  407. // ]]></script>
  408. <hr class="hrcolor">';
  409. if (empty($context['board']['is_recycle']) && empty($context['board']['topics']))
  410. {
  411. echo '
  412. <dl class="settings">
  413. <dt>
  414. <strong', $context['board']['topics'] ? ' style="color: gray;"' : '', '>', $txt['mboards_redirect'], ':</strong><br>
  415. <span class="smalltext">', $txt['mboards_redirect_desc'], '</span><br>
  416. </dt>
  417. <dd>
  418. <input type="checkbox" id="redirect_enable" name="redirect_enable"', $context['board']['redirect'] != '' ? ' checked' : '', ' onclick="refreshOptions();" class="input_check">
  419. </dd>
  420. </dl>
  421. <div id="redirect_address_div">
  422. <dl class="settings">
  423. <dt>
  424. <strong>', $txt['mboards_redirect_url'], ':</strong><br>
  425. <span class="smalltext">', $txt['mboards_redirect_url_desc'], '</span><br>
  426. </dt>
  427. <dd>
  428. <input type="text" name="redirect_address" value="', $context['board']['redirect'], '" size="40" class="input_text">
  429. </dd>
  430. </dl>
  431. </div>';
  432. if ($context['board']['redirect'])
  433. echo '
  434. <div id="reset_redirect_div">
  435. <dl class="settings">
  436. <dt>
  437. <strong>', $txt['mboards_redirect_reset'], ':</strong><br>
  438. <span class="smalltext">', $txt['mboards_redirect_reset_desc'], '</span><br>
  439. </dt>
  440. <dd>
  441. <input type="checkbox" name="reset_redirect" class="input_check">
  442. <em>(', sprintf($txt['mboards_current_redirects'], $context['board']['posts']), ')</em>
  443. </dd>
  444. </dl>
  445. </div>';
  446. }
  447. echo '
  448. <div id="count_posts_div">
  449. <dl class="settings">
  450. <dt>
  451. <strong>', $txt['mboards_count_posts'], ':</strong><br>
  452. <span class="smalltext">', $txt['mboards_count_posts_desc'], '</span><br>
  453. </dt>
  454. <dd>
  455. <input type="checkbox" name="count"', $context['board']['count_posts'] ? ' checked' : '', ' class="input_check">
  456. </dd>
  457. </dl>
  458. </div>';
  459. // Here the user can choose to force this board to use a theme other than the default theme for the forum.
  460. echo '
  461. <div id="board_theme_div">
  462. <dl class="settings">
  463. <dt>
  464. <strong>', $txt['mboards_theme'], ':</strong><br>
  465. <span class="smalltext">', $txt['mboards_theme_desc'], '</span><br>
  466. </dt>
  467. <dd>
  468. <select name="boardtheme" id="boardtheme" onchange="refreshOptions();">
  469. <option value="0"', $context['board']['theme'] == 0 ? ' selected' : '', '>', $txt['mboards_theme_default'], '</option>';
  470. foreach ($context['themes'] as $theme)
  471. echo '
  472. <option value="', $theme['id'], '"', $context['board']['theme'] == $theme['id'] ? ' selected' : '', '>', $theme['name'], '</option>';
  473. echo '
  474. </select>
  475. </dd>
  476. </dl>
  477. </div>
  478. <div id="override_theme_div">
  479. <dl class="settings">
  480. <dt>
  481. <strong>', $txt['mboards_override_theme'], ':</strong><br>
  482. <span class="smalltext">', $txt['mboards_override_theme_desc'], '</span><br>
  483. </dt>
  484. <dd>
  485. <input type="checkbox" name="override_theme"', $context['board']['override_theme'] ? ' checked' : '', ' class="input_check">
  486. </dd>
  487. </dl>
  488. </div>';
  489. if (!empty($context['board']['is_recycle']))
  490. echo '
  491. <div class="noticebox">', $txt['mboards_recycle_disabled_delete'], '</div>';
  492. echo '
  493. <input type="hidden" name="rid" value="', $context['redirect_location'], '">
  494. <input type="hidden" name="', $context['session_var'], '" value="', $context['session_id'], '">
  495. <input type="hidden" name="', $context['admin-be-' . $context['board']['id'] . '_token_var'], '" value="', $context['admin-be-' . $context['board']['id'] . '_token'], '">';
  496. // If this board has no children don't bother with the next confirmation screen.
  497. if ($context['board']['no_children'])
  498. echo '
  499. <input type="hidden" name="no_children" value="1">';
  500. if (isset($context['board']['is_new']))
  501. echo '
  502. <input type="hidden" name="cur_cat" value="', $context['board']['category'], '">
  503. <input type="submit" name="add" value="', $txt['mboards_new_board'], '" onclick="return !isEmptyText(this.form.board_name);" class="button_submit">';
  504. else
  505. echo '
  506. <input type="submit" name="edit" value="', $txt['modify'], '" onclick="return !isEmptyText(this.form.board_name);" class="button_submit">';
  507. if (!isset($context['board']['is_new']) && empty($context['board']['is_recycle']))
  508. echo '
  509. <input type="submit" name="delete" value="', $txt['mboards_delete_board'], '" onclick="return confirm(\'', $txt['boardConfirm'], '\');"', ' class="button_submit">';
  510. echo '
  511. </div>
  512. </div>
  513. </form>
  514. </div>
  515. <script><!-- // --><![CDATA[
  516. var oModeratorSuggest = new smc_AutoSuggest({
  517. sSelf: \'oModeratorSuggest\',
  518. sSessionId: smf_session_id,
  519. sSessionVar: smf_session_var,
  520. sSuggestId: \'moderators\',
  521. sControlId: \'moderators\',
  522. sSearchType: \'member\',
  523. bItemList: true,
  524. sPostName: \'moderator_list\',
  525. sURLMask: \'action=profile;u=%item_id%\',
  526. sTextDeleteItem: \'', $txt['autosuggest_delete_item'], '\',
  527. sItemListContainerId: \'moderator_container\',
  528. aListItems: [';
  529. foreach ($context['board']['moderators'] as $id_member => $member_name)
  530. echo '
  531. {
  532. sItemId: ', JavaScriptEscape($id_member), ',
  533. sItemName: ', JavaScriptEscape($member_name), '
  534. }', $id_member == $context['board']['last_moderator_id'] ? '' : ',';
  535. echo '
  536. ]
  537. });
  538. var oModeratorGroupSuggest = new smc_AutoSuggest({
  539. sSelf: \'oModeratorGroupSuggest\',
  540. sSessionId: smf_session_id,
  541. sSessionVar: smf_session_var,
  542. sSuggestId: \'moderator_groups\',
  543. sControlId: \'moderator_groups\',
  544. sSearchType: \'membergroups\',
  545. bItemList: true,
  546. sPostName: \'moderator_group_list\',
  547. sURLMask: \'action=groups;sa=members;group=%item_id%\',
  548. sTextDeleteItem: \'', $txt['autosuggest_delete_item'], '\',
  549. sItemListContainerId: \'moderator_group_container\',
  550. aListItems: [';
  551. foreach ($context['board']['moderator_groups'] as $id_group => $group_name)
  552. echo '
  553. {
  554. sItemId: ', JavaScriptEscape($id_group), ',
  555. sItemName: ', JavaScriptEscape($group_name), '
  556. }', $id_group == $context['board']['last_moderator_group_id'] ? '' : ',';
  557. echo '
  558. ]
  559. });
  560. // ]]></script>';
  561. // Javascript for deciding what to show.
  562. echo '
  563. <script><!-- // --><![CDATA[
  564. function refreshOptions()
  565. {
  566. var redirect = document.getElementById("redirect_enable");
  567. var redirectEnabled = redirect ? redirect.checked : false;
  568. var nonDefaultTheme = document.getElementById("boardtheme").value == 0 ? false : true;
  569. // What to show?
  570. document.getElementById("override_theme_div").style.display = redirectEnabled || !nonDefaultTheme ? "none" : "";
  571. document.getElementById("board_theme_div").style.display = redirectEnabled ? "none" : "";
  572. document.getElementById("count_posts_div").style.display = redirectEnabled ? "none" : "";';
  573. if (!$context['board']['topics'] && empty($context['board']['is_recycle']))
  574. {
  575. echo '
  576. document.getElementById("redirect_address_div").style.display = redirectEnabled ? "" : "none";';
  577. if ($context['board']['redirect'])
  578. echo '
  579. document.getElementById("reset_redirect_div").style.display = redirectEnabled ? "" : "none";';
  580. }
  581. echo '
  582. }
  583. refreshOptions();
  584. // ]]></script>';
  585. }
  586. // A template used when a user is deleting a board with child boards in it - to see what they want to do with them.
  587. function template_confirm_board_delete()
  588. {
  589. global $context, $scripturl, $txt;
  590. // Print table header.
  591. echo '
  592. <div id="manage_boards">
  593. <form action="', $scripturl, '?action=admin;area=manageboards;sa=board2" method="post" accept-charset="', $context['character_set'], '">
  594. <input type="hidden" name="boardid" value="', $context['board']['id'], '">
  595. <div class="cat_bar">
  596. <h3 class="catbg">', $txt['mboards_delete_board'], '</h3>
  597. </div>
  598. <div class="windowbg">
  599. <div class="content">
  600. <p>', $txt['mboards_delete_board_contains'], '</p>
  601. <ul>';
  602. foreach ($context['children'] as $child)
  603. echo '
  604. <li>', $child['node']['name'], '</li>';
  605. echo '
  606. </ul>
  607. </div>
  608. </div>
  609. <div class="cat_bar">
  610. <h3 class="catbg">', $txt['mboards_delete_what_do'], '</h3>
  611. </div>
  612. <div class="windowbg">
  613. <div class="content">
  614. <p>
  615. <label for="delete_action0"><input type="radio" id="delete_action0" name="delete_action" value="0" class="input_radio" checked>', $txt['mboards_delete_board_option1'], '</label><br>
  616. <label for="delete_action1"><input type="radio" id="delete_action1" name="delete_action" value="1" class="input_radio"', empty($context['can_move_children']) ? ' disabled' : '', '>', $txt['mboards_delete_board_option2'], '</label>:
  617. <select name="board_to"', empty($context['can_move_children']) ? ' disabled' : '', '>';
  618. foreach ($context['board_order'] as $board)
  619. if ($board['id'] != $context['board']['id'] && empty($board['is_child']))
  620. echo '
  621. <option value="', $board['id'], '">', $board['name'], '</option>';
  622. echo '
  623. </select>
  624. </p>
  625. <input type="submit" name="delete" value="', $txt['mboards_delete_confirm'], '" class="button_submit">
  626. <input type="submit" name="cancel" value="', $txt['mboards_delete_cancel'], '" class="button_submit">
  627. <input type="hidden" name="confirmation" value="1">
  628. <input type="hidden" name="', $context['session_var'], '" value="', $context['session_id'], '">
  629. </div>
  630. </div>
  631. </form>
  632. </div>';
  633. }
  634. ?>