2
0

MessageIndex.template.php 26 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506
  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. function template_main()
  13. {
  14. global $context, $settings, $options, $scripturl, $modSettings, $txt;
  15. echo '
  16. <a id="top"></a>';
  17. if (!empty($context['boards']) && (!empty($options['show_children']) || $context['start'] == 0))
  18. {
  19. echo '
  20. <div class="tborder marginbottom" id="childboards">
  21. <table cellspacing="1" class="bordercolor boardsframe">
  22. <tr>
  23. <td colspan="4" class="catbg headerpadding">', $txt['parent_boards'], '</td>
  24. </tr>';
  25. foreach ($context['boards'] as $board)
  26. {
  27. echo '
  28. <tr>
  29. <td', !empty($board['children']) ? ' rowspan="2"' : '', ' class="windowbg icon">
  30. <a href="', ($board['is_redirect'] || $context['user']['is_guest'] ? $board['href'] : $scripturl . '?action=unread;board=' . $board['id'] . '.0;children'), '">';
  31. // If the board or children is new, show an indicator.
  32. if ($board['new'] || $board['children_new'])
  33. echo '
  34. <img src="', $settings['images_url'], '/on', $board['new'] ? '' : '2', '.gif" alt="', $txt['new_posts'], '" title="', $txt['new_posts'], '" border="0" />';
  35. // Is it a redirection board?
  36. elseif ($board['is_redirect'])
  37. echo '
  38. <img src="', $settings['images_url'], '/redirect.gif" alt="*" title="*" border="0" />';
  39. // No new posts at all! The agony!!
  40. else
  41. echo '
  42. <img src="', $settings['images_url'], '/off.gif" alt="', $txt['old_posts'], '" title="', $txt['old_posts'], '" />';
  43. echo '
  44. </a>
  45. </td>
  46. <td class="windowbg2 info">
  47. <h4><a href="', $board['href'], '" name="b', $board['id'], '">', $board['name'], '</a>';
  48. // Has it outstanding posts for approval?
  49. if ($board['can_approve_posts'] && ($board['unapproved_posts'] || $board['unapproved_topics']))
  50. echo '
  51. <a href="', $scripturl, '?action=moderate;area=postmod;sa=', ($board['unapproved_topics'] > 0 ? 'topics' : 'posts'), ';brd=', $board['id'], ';', $context['session_var'], '=', $context['session_id'], '" title="', sprintf($txt['unapproved_posts'], $board['unapproved_topics'], $board['unapproved_posts']), '" class="moderation_link">(!)</a>';
  52. echo '
  53. </h4>
  54. <p>', $board['description'] , '</p>';
  55. // Show the "Moderators: ". Each has name, href, link, and id. (but we're gonna use link_moderators.)
  56. if (!empty($board['moderators']))
  57. echo '
  58. <p class="moderators">', count($board['moderators']) == 1 ? $txt['moderator'] : $txt['moderators'], ': ', implode(', ', $board['link_moderators']), '</p>';
  59. // Show some basic information about the number of posts, etc.
  60. echo '
  61. </td>
  62. <td', !empty($board['children']) ? ' rowspan="2"' : '', ' class="windowbg stats smalltext">
  63. ', comma_format($board['posts']), ' ', $board['is_redirect'] ? $txt['redirects'] : $txt['posts'], ' <br />
  64. ', $board['is_redirect'] ? '' : comma_format($board['topics']) . ' ' . $txt['board_topics'], '
  65. </td>
  66. <td', !empty($board['children']) ? ' rowspan="2"' : '', ' class="windowbg2 smalltext lastpost">';
  67. /* The board's and children's 'last_post's have:
  68. time, timestamp (a number that represents the time.), id (of the post), topic (topic id.),
  69. link, href, subject, start (where they should go for the first unread post.),
  70. and member. (which has id, name, link, href, username in it.) */
  71. if (!empty($board['last_post']['id']))
  72. echo '
  73. <strong>', $txt['last_post'], '</strong> ', $txt['by'], ' ', $board['last_post']['member']['link'] , '<br />
  74. ', $txt['in'], ' ', $board['last_post']['link'], '<br />
  75. ', $txt['on'], ' ', $board['last_post']['time'];
  76. echo '
  77. </td>
  78. </tr>';
  79. // Show the "Child Boards: ". (there's a link_children but we're going to bold the new ones...)
  80. if (!empty($board['children']))
  81. {
  82. // Sort the links into an array with new boards bold so it can be imploded.
  83. $children = array();
  84. /* Each child in each board's children has:
  85. id, name, description, new (is it new?), topics (#), posts (#), href, link, and last_post. */
  86. foreach ($board['children'] as $child)
  87. {
  88. if (!$child['is_redirect'])
  89. $child['link'] = '<a href="' . $child['href'] . '" title="' . ($child['new'] ? $txt['new_posts'] : $txt['old_posts']) . ' (' . $txt['board_topics'] . ': ' . comma_format($child['topics']) . ', ' . $txt['posts'] . ': ' . comma_format($child['posts']) . ')">' . $child['name'] . '</a>';
  90. else
  91. $child['link'] = '<a href="' . $child['href'] . '" title="' . comma_format($child['posts']) . ' ' . $txt['redirects'] . '">' . $child['name'] . '</a>';
  92. // Has it posts awaiting approval?
  93. if ($child['can_approve_posts'] && ($child['unapproved_posts'] || $child['unapproved_topics']))
  94. $child['link'] .= ' <a href="' . $scripturl . '?action=moderate;area=postmod;sa=' . ($child['unapproved_topics'] > 0 ? 'topics' : 'posts') . ';brd=' . $child['id'] . ';' . $context['session_var'] . '=' . $context['session_id'] . '" title="' . sprintf($txt['unapproved_posts'] . $child['unapproved_topics'] . $child['unapproved_posts']) . '" class="moderation_link">(!)</a>';
  95. $children[] = $child['new'] ? '<strong>' . $child['link'] . '</strong>' : $child['link'];
  96. }
  97. echo '
  98. <tr>
  99. <td class="windowbg3 smalltext largepadding"><strong>', $txt['parent_boards'], '</strong>: ', implode(', ', $children), '</td>
  100. </tr>';
  101. }
  102. }
  103. echo '
  104. </table>
  105. </div>';
  106. }
  107. if (!empty($options['show_board_desc']) && $context['description'] != '')
  108. {
  109. echo '
  110. <div id="description" class="tborder">
  111. <div class="titlebg2 largepadding smalltext">', $context['description'], '</div>
  112. </div>';
  113. }
  114. // Create the button set...
  115. $normal_buttons = array(
  116. 'new_topic' => array('test' => 'can_post_new', 'text' => 'new_topic', 'image' => 'new_topic.gif', 'lang' => true, 'url' => $scripturl . '?action=post;board=' . $context['current_board'] . '.0'),
  117. 'post_poll' => array('test' => 'can_post_poll', 'text' => 'new_poll', 'image' => 'new_poll.gif', 'lang' => true, 'url' => $scripturl . '?action=post;board=' . $context['current_board'] . '.0;poll'),
  118. 'notify' => array('test' => 'can_mark_notify', 'text' => $context['is_marked_notify'] ? 'unnotify' : 'notify', 'image' => ($context['is_marked_notify'] ? 'un' : '') . 'notify.gif', 'lang' => true, 'custom' => 'onclick="return confirm(\'' . ($context['is_marked_notify'] ? $txt['notification_disable_board'] : $txt['notification_enable_board']) . '\');"', 'url' => $scripturl . '?action=notifyboard;sa=' . ($context['is_marked_notify'] ? 'off' : 'on') . ';board=' . $context['current_board'] . '.' . $context['start'] . ';' . $context['session_var'] . '=' . $context['session_id']),
  119. 'markread' => array('text' => 'mark_read_short', 'image' => 'markread.gif', 'lang' => true, 'url' => $scripturl . '?action=markasread;sa=board;board=' . $context['current_board'] . '.0;' . $context['session_var'] . '=' . $context['session_id']),
  120. );
  121. // They can only mark read if they are logged in and it's enabled!
  122. if (!$context['user']['is_logged'] || !$settings['show_mark_read'])
  123. unset($normal_buttons['markread']);
  124. // Allow adding new buttons easily.
  125. call_integration_hook('integrate_messageindex_buttons', array(&$normal_buttons));
  126. if (!$context['no_topic_listing'])
  127. {
  128. echo '
  129. <div id="modbuttons_top" class="modbuttons clearfix margintop">
  130. <div class="floatleft middletext">', $txt['pages'], ': ', $context['page_index'], !empty($modSettings['topbottomEnable']) ? $context['menu_separator'] . '&nbsp;&nbsp;<a href="#bot"><strong>' . $txt['go_down'] . '</strong></a>' : '', '</div>
  131. ', template_button_strip($normal_buttons, 'bottom'), '
  132. </div>';
  133. // If Quick Moderation is enabled start the form.
  134. if (!empty($context['can_quick_mod']) && $options['display_quick_mod'] > 0 && !empty($context['topics']))
  135. echo '
  136. <form action="', $scripturl, '?action=quickmod;board=', $context['current_board'], '.', $context['start'], '" method="post" accept-charset="', $context['character_set'], '" name="quickModForm" id="quickModForm">';
  137. echo '
  138. <div class="tborder" id="messageindex">
  139. <table cellspacing="1" class="bordercolor boardsframe">';
  140. // Are there actually any topics to show?
  141. if (!empty($context['topics']))
  142. {
  143. echo '
  144. <thead>
  145. <tr>
  146. <th width="9%" colspan="2" class="catbg3 headerpadding">&nbsp;</th>
  147. <th class="catbg3 headerpadding"><a href="', $scripturl, '?board=', $context['current_board'], '.', $context['start'], ';sort=subject', $context['sort_by'] == 'subject' && $context['sort_direction'] == 'up' ? ';desc' : '', '">', $txt['subject'], $context['sort_by'] == 'subject' ? ' <img src="' . $settings['images_url'] . '/sort_' . $context['sort_direction'] . '.gif" alt="" />' : '', '</a></th>
  148. <th class="catbg3 headerpadding" width="11%"><a href="', $scripturl, '?board=', $context['current_board'], '.', $context['start'], ';sort=starter', $context['sort_by'] == 'starter' && $context['sort_direction'] == 'up' ? ';desc' : '', '">', $txt['started_by'], $context['sort_by'] == 'starter' ? ' <img src="' . $settings['images_url'] . '/sort_' . $context['sort_direction'] . '.gif" alt="" />' : '', '</a></th>
  149. <th class="catbg3 headerpadding" width="4%" align="center"><a href="', $scripturl, '?board=', $context['current_board'], '.', $context['start'], ';sort=replies', $context['sort_by'] == 'replies' && $context['sort_direction'] == 'up' ? ';desc' : '', '">', $txt['replies'], $context['sort_by'] == 'replies' ? ' <img src="' . $settings['images_url'] . '/sort_' . $context['sort_direction'] . '.gif" alt="" />' : '', '</a></th>
  150. <th class="catbg3 headerpadding" width="4%" align="center"><a href="', $scripturl, '?board=', $context['current_board'], '.', $context['start'], ';sort=views', $context['sort_by'] == 'views' && $context['sort_direction'] == 'up' ? ';desc' : '', '">', $txt['views'], $context['sort_by'] == 'views' ? ' <img src="' . $settings['images_url'] . '/sort_' . $context['sort_direction'] . '.gif" alt="" />' : '', '</a></th>
  151. <th class="catbg3 headerpadding" width="22%"><a href="', $scripturl, '?board=', $context['current_board'], '.', $context['start'], ';sort=last_post', $context['sort_by'] == 'last_post' && $context['sort_direction'] == 'up' ? ';desc' : '', '">', $txt['last_post'], $context['sort_by'] == 'last_post' ? ' <img src="' . $settings['images_url'] . '/sort_' . $context['sort_direction'] . '.gif" alt="" />' : '', '</a></th>';
  152. // Show a "select all" box for quick moderation?
  153. if (!empty($context['can_quick_mod']) && $options['display_quick_mod'] == 1)
  154. echo '
  155. <th class="catbg3 headerpadding" width="24">
  156. <input type="checkbox" onclick="invertAll(this, this.form, \'topics[]\');" class="input_check" />
  157. </th>';
  158. // If it's on in "image" mode, don't show anything but the column.
  159. elseif (!empty($context['can_quick_mod']))
  160. echo '
  161. <th class="catbg3 headerpadding" width="4%">&nbsp;</th>';
  162. echo '
  163. </tr>
  164. </thead>';
  165. }
  166. echo '
  167. <tbody>';
  168. if (!empty($settings['display_who_viewing']))
  169. {
  170. echo '
  171. <tr class="windowbg2">
  172. <td colspan="', !empty($context['can_quick_mod']) ? '8' : '7', '" class="headerpadding smalltext">';
  173. if ($settings['display_who_viewing'] == 1)
  174. echo count($context['view_members']), ' ', count($context['view_members']) == 1 ? $txt['who_member'] : $txt['members'];
  175. else
  176. echo empty($context['view_members_list']) ? '0 ' . $txt['members'] : implode(', ', $context['view_members_list']) . ((empty($context['view_num_hidden']) or $context['can_moderate_forum']) ? '' : ' (+ ' . $context['view_num_hidden'] . ' ' . $txt['hidden'] . ')');
  177. echo $txt['who_and'], $context['view_num_guests'], ' ', $context['view_num_guests'] == 1 ? $txt['guest'] : $txt['guests'], $txt['who_viewing_board'], '
  178. </td>
  179. </tr>';
  180. }
  181. // If this person can approve items and we have some awaiting approval tell them.
  182. if (!empty($context['unapproved_posts_message']))
  183. {
  184. echo '
  185. <tr class="windowbg2">
  186. <td colspan="', !empty($context['can_quick_mod']) ? '8' : '7', '" class="smalltext headerpadding">
  187. <span class="alert">!</span> ', $context['unapproved_posts_message'], '
  188. </td>
  189. </tr>';
  190. }
  191. // No topics.... just say, "sorry bub".
  192. if (empty($context['topics']))
  193. echo '
  194. <tr class="windowbg2">
  195. <td class="catbg3" colspan="', !empty($context['can_quick_mod']) ? '8' : '7', '"><strong>', $txt['msg_alert_none'], '</strong></td>
  196. </tr>';
  197. foreach ($context['topics'] as $topic)
  198. {
  199. // Do we want to separate the sticky and lock status out?
  200. if (!empty($settings['separate_sticky_lock']) && strpos($topic['class'], 'sticky') !== false)
  201. $topic['class'] = substr($topic['class'], 0, strrpos($topic['class'], '_sticky'));
  202. if (!empty($settings['separate_sticky_lock']) && strpos($topic['class'], 'locked') !== false)
  203. $topic['class'] = substr($topic['class'], 0, strrpos($topic['class'], '_locked'));
  204. // Is this topic pending approval, or does it have any posts pending approval?
  205. if ($context['can_approve_posts'] && $topic['unapproved_posts'])
  206. $color_class = !$topic['approved'] ? 'approvetbg' : 'approvebg';
  207. // Sticky topics should get a different color, too.
  208. elseif ($topic['is_sticky'] && !empty($settings['separate_sticky_lock']))
  209. $color_class = 'windowbg3';
  210. // Last, but not least: regular topics.
  211. else
  212. $color_class = 'windowbg';
  213. // Some columns require a different shade of the color class.
  214. $alternate_class = 'windowbg2';
  215. echo '
  216. <tr>
  217. <td class="', $alternate_class, ' icon1">
  218. <img src="', $settings['images_url'], '/topic/', $topic['class'], '.gif" alt="" />
  219. </td>
  220. <td class="', $alternate_class, ' icon2">
  221. <img src="', $topic['first_post']['icon_url'], '" alt="" />
  222. </td>
  223. <td class="subject ', $color_class, '" ', (!empty($topic['quick_mod']['modify']) ? 'id="topic_' . $topic['first_post']['id'] . '" onmouseout="mouse_on_div = 0;" onmouseover="mouse_on_div = 1;" ondblclick="modify_topic(\'' . $topic['id'] . '\', \'' . $topic['first_post']['id'] . '\');"' : ''), '>';
  224. if (!empty($settings['separate_sticky_lock']))
  225. echo '
  226. ', $topic['is_locked'] ? '<img src="' . $settings['images_url'] . '/icons/quick_lock.gif" class="floatright" alt="" id="lockicon' . $topic['first_post']['id'] . '" style="margin: 0;" />' : '', '
  227. ', $topic['is_sticky'] ? '<img src="' . $settings['images_url'] . '/icons/show_sticky.gif" class="floatright" alt="" id="stickyicon' . $topic['first_post']['id'] . '" style="margin: 0;" />' : '';
  228. echo '
  229. ', $topic['is_sticky'] ? '<strong>' : '', '<span id="msg_' . $topic['first_post']['id'] . '">', $topic['first_post']['link'], ($context['can_approve_posts'] && !$topic['approved'] ? '&nbsp;<em>(' . $txt['awaiting_approval'] . ')</em>' : ''), '</span>', $topic['is_sticky'] ? '</strong>' : '';
  230. // Is this topic new? (assuming they are logged in!)
  231. if ($topic['new'] && $context['user']['is_logged'])
  232. echo '
  233. <a href="', $topic['new_href'], '" id="newicon' . $topic['first_post']['id'] . '"><span class="new_posts">' . $txt['new'] . '</span></a>';
  234. echo '
  235. <small id="pages' . $topic['first_post']['id'] . '">', $topic['pages'], '</small>
  236. </td>
  237. <td class="', $alternate_class, ' starter">
  238. ', $topic['first_post']['member']['link'], '
  239. </td>
  240. <td class="', $color_class, ' replies">
  241. ', $topic['replies'], '
  242. </td>
  243. <td class="', $color_class, ' views">
  244. ', $topic['views'], '
  245. </td>
  246. <td class="', $alternate_class, ' lastpost">
  247. <a href="', $topic['last_post']['href'], '"><img src="', $settings['images_url'], '/icons/last_post.gif" alt="', $txt['last_post'], '" title="', $txt['last_post'], '" /></a>
  248. <span class="smalltext">
  249. ', $topic['last_post']['time'], '<br />
  250. ', $txt['by'], ' ', $topic['last_post']['member']['link'], '
  251. </span>
  252. </td>';
  253. // Show the quick moderation options?
  254. if (!empty($context['can_quick_mod']))
  255. {
  256. echo '
  257. <td class="', $color_class, ' moderation">';
  258. if ($options['display_quick_mod'] == 1)
  259. echo '
  260. <input type="checkbox" name="topics[]" value="', $topic['id'], '" class="input_check" />';
  261. else
  262. {
  263. // Check permissions on each and show only the ones they are allowed to use.
  264. if ($topic['quick_mod']['remove'])
  265. echo '<a href="', $scripturl, '?action=quickmod;board=', $context['current_board'], '.', $context['start'], ';actions[', $topic['id'], ']=remove;', $context['session_var'], '=', $context['session_id'], '" onclick="return confirm(\'', $txt['quickmod_confirm'], '\');"><img src="', $settings['images_url'], '/icons/quick_remove.gif" width="16" alt="', $txt['remove_topic'], '" title="', $txt['remove_topic'], '" /></a>';
  266. if ($topic['quick_mod']['lock'])
  267. echo '<a href="', $scripturl, '?action=quickmod;board=', $context['current_board'], '.', $context['start'], ';actions[', $topic['id'], ']=lock;', $context['session_var'], '=', $context['session_id'], '" onclick="return confirm(\'', $txt['quickmod_confirm'], '\');"><img src="', $settings['images_url'], '/icons/quick_lock.gif" width="16" alt="', $txt['set_lock'], '" title="', $txt['set_lock'], '" /></a>';
  268. if ($topic['quick_mod']['lock'] || $topic['quick_mod']['remove'])
  269. echo '<br />';
  270. if ($topic['quick_mod']['sticky'])
  271. echo '<a href="', $scripturl, '?action=quickmod;board=', $context['current_board'], '.', $context['start'], ';actions[', $topic['id'], ']=sticky;', $context['session_var'], '=', $context['session_id'], '" onclick="return confirm(\'', $txt['quickmod_confirm'], '\');"><img src="', $settings['images_url'], '/icons/quick_sticky.gif" width="16" alt="', $txt['set_sticky'], '" title="', $txt['set_sticky'], '" /></a>';
  272. if ($topic['quick_mod']['move'])
  273. echo '<a href="', $scripturl, '?action=movetopic;board=', $context['current_board'], '.', $context['start'], ';topic=', $topic['id'], '.0"><img src="', $settings['images_url'], '/icons/quick_move.gif" width="16" alt="', $txt['move_topic'], '" title="', $txt['move_topic'], '" /></a>';
  274. }
  275. echo '
  276. </td>';
  277. }
  278. echo '
  279. </tr>';
  280. }
  281. if (!empty($context['can_quick_mod']) && $options['display_quick_mod'] == 1 && !empty($context['topics']))
  282. {
  283. echo '
  284. <tr class="catbg headerpadding">
  285. <td colspan="8" align="right">
  286. <select name="qaction"', $context['can_move'] ? ' onchange="this.form.moveItTo.disabled = (this.options[this.selectedIndex].value != \'move\');"' : '', '>
  287. <option value="">--------</option>
  288. ', $context['can_remove'] ? '<option value="remove">' . $txt['quick_mod_remove'] . '</option>' : '', '
  289. ', $context['can_lock'] ? '<option value="lock">' . $txt['quick_mod_lock'] . '</option>' : '', '
  290. ', $context['can_sticky'] ? '<option value="sticky">' . $txt['quick_mod_sticky'] . '</option>' : '', '
  291. ', $context['can_move'] ? '<option value="move">' . $txt['quick_mod_move'] . ': </option>' : '', '
  292. ', $context['can_merge'] ? '<option value="merge">' . $txt['quick_mod_merge'] . '</option>' : '', '
  293. ', $context['can_restore'] ? '<option value="restore">' . $txt['quick_mod_restore'] . '</option>' : '', '
  294. ', $context['can_approve'] ? '<option value="approve">' . $txt['quick_mod_approve'] . '</option>' : '', '
  295. ', $context['user']['is_logged'] ? '<option value="markread">' . $txt['quick_mod_markread'] . '</option>' : '', '
  296. </select>';
  297. // Show a list of boards they can move the topic to.
  298. if ($context['can_move'])
  299. {
  300. echo '
  301. <select id="moveItTo" name="move_to" disabled="disabled">';
  302. foreach ($context['move_to_boards'] as $category)
  303. {
  304. echo '
  305. <optgroup label="', $category['name'], '">';
  306. foreach ($category['boards'] as $board)
  307. echo '
  308. <option value="', $board['id'], '"', $board['selected'] ? ' selected="selected"' : '', '>', $board['child_level'] > 0 ? str_repeat('==', $board['child_level'] - 1) . '=&gt;' : '', ' ', $board['name'], '</option>';
  309. echo '
  310. </optgroup>';
  311. }
  312. echo '
  313. </select>';
  314. }
  315. echo '
  316. <input type="submit" value="', $txt['quick_mod_go'], '" onclick="return document.forms.quickModForm.qaction.value != \'\' &amp;&amp; confirm(\'', $txt['quickmod_confirm'], '\');" class="button_submit" />
  317. </td>
  318. </tr>';
  319. }
  320. echo '
  321. </tbody>
  322. </table>
  323. </div>
  324. <a id="bot"></a>';
  325. // Finish off the form - again.
  326. if (!empty($context['can_quick_mod']) && $options['display_quick_mod'] > 0 && !empty($context['topics']))
  327. echo '
  328. <input type="hidden" name="' . $context['session_var'] . '" value="' . $context['session_id'] . '" />
  329. </form>';
  330. echo '
  331. <div id="modbuttons_bottom" class="modbuttons clearfix marginbottom">
  332. ', template_button_strip($normal_buttons, 'top'), '
  333. <div class="floatleft middletext">' . $txt['pages'] . ': ', $context['page_index'], !empty($modSettings['topbottomEnable']) ? $context['menu_separator'] . '&nbsp;&nbsp;<a href="#top"><strong>' . $txt['go_up'] . '</strong></a>' : '', '</div>
  334. </div>';
  335. }
  336. // Show breadcrumbs at the bottom too.
  337. echo '
  338. <div class="marginbottom">', theme_linktree(), '</div>';
  339. echo '
  340. <div class="tborder clearfix" id="topic_icons">
  341. <div class="titlebg2 clearfix">
  342. <p class="floatright" id="message_index_jump_to">&nbsp;</p>';
  343. if (!$context['no_topic_listing'])
  344. echo '
  345. <div class="floatleft smalltext">
  346. <ul class="reset">
  347. ', !empty($modSettings['enableParticipation']) && $context['user']['is_logged'] ? '
  348. <li><img src="' . $settings['images_url'] . '/topic/my_normal_post.gif" alt="" align="middle" /> ' . $txt['participation_caption'] . '</li>' : '', '
  349. <li><img src="' . $settings['images_url'] . '/topic/normal_post.gif" alt="" align="middle" /> ' . $txt['normal_topic'] . '</li>
  350. <li><img src="' . $settings['images_url'] . '/topic/hot_post.gif" alt="" align="middle" /> ' . sprintf($txt['hot_topics'], $modSettings['hotTopicPosts']) . '</li>
  351. <li><img src="' . $settings['images_url'] . '/topic/veryhot_post.gif" alt="" align="middle" /> ' . sprintf($txt['very_hot_topics'], $modSettings['hotTopicVeryPosts']) . '</li>
  352. </ul>
  353. </div>
  354. <div class="floatleft smalltext">
  355. <ul class="reset">
  356. <li><img src="' . $settings['images_url'] . '/icons/quick_lock.gif" alt="" align="middle" /> ' . $txt['locked_topic'] . '</li>' . ($modSettings['enableStickyTopics'] == '1' ? '
  357. <li><img src="' . $settings['images_url'] . '/icons/quick_sticky.gif" alt="" align="middle" /> ' . $txt['sticky_topic'] . '</li>' : '') . ($modSettings['pollMode'] == '1' ? '
  358. <li><img src="' . $settings['images_url'] . '/topic/normal_poll.gif" alt="" align="middle" /> ' . $txt['poll'] : '') . '</li>
  359. </ul>
  360. </div>';
  361. echo '
  362. <script type="text/javascript"><!-- // --><![CDATA[
  363. if (\'XMLHttpRequest\' in window)
  364. aJumpTo[aJumpTo.length] = new JumpTo({
  365. sContainerId: "message_index_jump_to",
  366. sJumpToTemplate: "<label class=\"smalltext\" for=\"%select_id%\">', $context['jump_to']['label'], ':<" + "/label> %dropdown_list%",
  367. iCurBoardId: ', $context['current_board'], ',
  368. iCurBoardChildLevel: ', $context['jump_to']['child_level'], ',
  369. sCurBoardName: "', $context['jump_to']['board_name'], '",
  370. sBoardChildLevelIndicator: "==",
  371. sBoardPrefix: "=> ",
  372. sCatSeparator: "-----------------------------",
  373. sCatPrefix: "",
  374. sGoButtonLabel: "', $txt['go'], '"
  375. });
  376. // ]]></script>
  377. </div>
  378. </div>';
  379. // Javascript for inline editing.
  380. echo '
  381. <script type="text/javascript" src="' . $settings['default_theme_url'] . '/scripts/topic.js"></script>
  382. <script type="text/javascript"><!-- // --><![CDATA[
  383. // Hide certain bits during topic edit.
  384. hide_prefixes.push("lockicon", "stickyicon", "pages", "newicon");
  385. // Use it to detect when we\'ve stopped editing.
  386. document.onclick = modify_topic_click;
  387. var mouse_on_div;
  388. function modify_topic_click()
  389. {
  390. if (in_edit_mode == 1 && mouse_on_div == 0)
  391. modify_topic_save("', $context['session_id'], '");
  392. }
  393. function modify_topic_keypress(oEvent)
  394. {
  395. if (\'keyCode\' in oEvent && oEvent.keyCode == 13)
  396. {
  397. modify_topic_save("', $context['session_id'], '");
  398. if (\'preventDefault\' in oEvent)
  399. oEvent.preventDefault();
  400. else
  401. oEvent.returnValue = false;
  402. }
  403. }
  404. // For templating, shown when an inline edit is made.
  405. function modify_topic_show_edit(subject)
  406. {
  407. // Just template the subject.
  408. setInnerHTML(cur_subject_div, \'<input type="text" name="subject" value="\' + subject + \'" size="60" style="width: 95%;" maxlength="80" onkeypress="modify_topic_keypress(event)" class="input_text" /><input type="hidden" name="topic" value="\' + cur_topic_id + \'" /><input type="hidden" name="msg" value="\' + cur_msg_id.substr(4) + \'" />\');
  409. }
  410. // And the reverse for hiding it.
  411. function modify_topic_hide_edit(subject)
  412. {
  413. // Re-template the subject!
  414. setInnerHTML(cur_subject_div, \'<a href="', $scripturl, '?topic=\' + cur_topic_id + \'.0">\' + subject + \'<\' +\'/a>\');
  415. }
  416. // ]]></script>';
  417. }
  418. function theme_show_buttons()
  419. {
  420. global $context, $settings, $options, $txt, $scripturl;
  421. $buttonArray = array();
  422. // If they are logged in, and the mark read buttons are enabled..
  423. if ($context['user']['is_logged'] && $settings['show_mark_read'])
  424. $buttonArray[] = '<a href="' . $scripturl . '?action=markasread;sa=board;board=' . $context['current_board'] . '.0;' . $context['session_var'] . '=' . $context['session_id'] . '">' . $txt['mark_read_short'] . '</a>';
  425. // If the user has permission to show the notification button... ask them if they're sure, though.
  426. if ($context['can_mark_notify'])
  427. $buttonArray[] = '<a href="' . $scripturl . '?action=notifyboard;sa=' . ($context['is_marked_notify'] ? 'off' : 'on') . ';board=' . $context['current_board'] . '.' . $context['start'] . ';' . $context['session_var'] . '=' . $context['session_id'] . '" onclick="return confirm(\'' . ($context['is_marked_notify'] ? $txt['notification_disable_board'] : $txt['notification_enable_board']) . '\');">' . $txt[$context['is_marked_notify'] ? 'unnotify' : 'notify'] . '</a>';
  428. // Are they allowed to post new topics?
  429. if ($context['can_post_new'])
  430. $buttonArray[] = '<a href="' . $scripturl . '?action=post;board=' . $context['current_board'] . '.0">' . $txt['new_topic'] . '</a>';
  431. // How about new polls, can the user post those?
  432. if ($context['can_post_poll'])
  433. $buttonArray[] = '<a href="' . $scripturl . '?action=post;board=' . $context['current_board'] . '.0;poll">' . $txt['new_poll'] . '</a>';
  434. // Right to left menu should be in reverse order.
  435. if ($context['right_to_left'])
  436. $buttonArray = array_reverse($buttonArray, true);
  437. return implode(' &nbsp;|&nbsp; ', $buttonArray);
  438. }
  439. ?>