ManageBoards.template.php 28 KB

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