ManageBoards.template.php 26 KB

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