ManageBoards.template.php 29 KB

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