ManageBoards.template.php 29 KB

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