MessageIndex.template.php 25 KB

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