MessageIndex.template.php 28 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511
  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"><span class="floatleft">', $txt['parent_boards'], '</span><img class="toggle" id="Child_swap" src="', $settings['images_url'], '/collapse.png" alt="*" title="', $txt['upshrink_description'], '" /></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"', !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="windowbg stats">
  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 ' . ($child['new'] ? 'class="new_posts" ' : '') . 'href="' . $scripturl . '?action=unread;board=' . $child['id'] . '" title="' . $txt['new_posts'] . ' (' . $txt['board_topics'] . ': ' . comma_format($child['topics']) . ', ' . $txt['posts'] . ': ' . comma_format($child['posts']) . ')"><span class="new_posts">' . $txt['new'] . '</span>' : '') . '</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.png', '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.png', '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.png', '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.png', '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" ', !empty($modSettings['enableParticipation'])?'colspan="2"':'colspan="1"', '>&nbsp;</th>
  146. <th scope="col" class="lefttext" style="padding-left: 32px;"><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'] . '.png" 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'] . '.png" alt="" />' : '', '</a></th>
  147. <th scope="col" class="righttext ', (empty($context['can_quick_mod'])) ? 'last_th' : '', '" style="padding-right: 36px;">
  148. <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'] . '.png" alt="" />' : '', '</a> /
  149. <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'] . '.png" alt="" />' : '', '</a> /
  150. <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'] . '.png" alt="" />' : '', '</a>
  151. </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 scope="col" class="last_th lefttext" width="24"><input type="checkbox" onclick="invertAll(this, this.form, \'topics[]\');" class="input_check" /></th>';
  156. // If it's on in "image" mode, don't show anything but the column.
  157. elseif (!empty($context['can_quick_mod']))
  158. echo '
  159. <th class="last_th" width="60">&nbsp;</th>';
  160. }
  161. // No topics.... just say, "sorry bub".
  162. else
  163. echo '
  164. <th scope="col" class="first_th" width="8%">&nbsp;</th>
  165. <th colspan="3"><strong>', $txt['msg_alert_none'], '</strong></th>
  166. <th scope="col" class="last_th" width="8%">&nbsp;</th>';
  167. echo '
  168. </tr>
  169. </thead>
  170. <tbody>';
  171. if (!empty($settings['display_who_viewing']))
  172. {
  173. echo '
  174. <tr class="windowbg2 whos_viewing">
  175. <td colspan="', !empty($context['can_quick_mod']) ? '6' : '5', '" class="smalltext stickybg2" style="font-size: 0.917em; border-bottom: 2px solid #ddd;">';
  176. if ($settings['display_who_viewing'] == 1)
  177. echo count($context['view_members']), ' ', count($context['view_members']) === 1 ? $txt['who_member'] : $txt['members'];
  178. else
  179. 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'] . ')');
  180. echo $txt['who_and'], $context['view_num_guests'], ' ', $context['view_num_guests'] == 1 ? $txt['guest'] : $txt['guests'], $txt['who_viewing_board'], '
  181. </td>
  182. </tr>';
  183. }
  184. // If this person can approve items and we have some awaiting approval tell them.
  185. if (!empty($context['unapproved_posts_message']))
  186. {
  187. echo '
  188. <tr class="windowbg2">
  189. <td class="stickybg2" colspan="', !empty($context['can_quick_mod']) ? '6' : '5', '">
  190. <span class="alert">!</span> ', $context['unapproved_posts_message'], '
  191. </td>
  192. </tr>';
  193. }
  194. $stickybar = false;
  195. $normalbar = false;
  196. foreach($context['topics'] as $topic)
  197. {
  198. if($topic['is_sticky'] && !$stickybar)
  199. {
  200. echo'
  201. <tr class="windowbg">
  202. <td class="sticky_bar" style="display: none; border-bottom: 1px solid #ddd; line-height: 1.7em; font-size: 1.083em; padding-left: 49px;" colspan="', empty($options['display_quick_mod']) ? '7' : '8', '">
  203. <img src="', $settings['images_url'], '/icons/quick_sticky.png" style="vertical-align: middle;" alt="" />&nbsp;Stickied Topics
  204. </td>
  205. </tr>';
  206. $stickybar = true;
  207. }
  208. else if(!$topic['is_sticky'] && $stickybar && !$normalbar)
  209. {
  210. //echo'
  211. // <tr class="windowbg">
  212. // <td class="normal_bar" style="border-bottom: 1px solid #ddd; line-height: 1.7em; font-size: 1.083em; padding-left: 70px;" colspan="', empty($options['display_quick_mod']) ? '7' : '8', '">Normal Topics</td>
  213. // </tr>';
  214. echo'
  215. <tr class="windowbg">
  216. <td class="normal_bar" style="border-bottom: 1px solid #ddd; height: 1.7em; padding-right: 14px;" colspan="3">
  217. <img class="icon floatright" id="Sticky_toggle" src="', $settings['images_url'], '/arrow.png" alt="*" title="', $txt['upshrink_description'], '" style="display: none;" />
  218. </td>
  219. ', !empty($options['display_quick_mod']) ? '<td class="normal_bar">&nbsp;</td>':'','
  220. </tr>';
  221. $normalbar = true;
  222. }
  223. // Is this topic pending approval, or does it have any posts pending approval?
  224. if ($context['can_approve_posts'] && $topic['unapproved_posts'])
  225. $color_class = !$topic['approved'] ? 'approvetbg' : 'approvebg';
  226. // We start with locked and sticky topics.
  227. elseif ($topic['is_sticky'] && $topic['is_locked'])
  228. $color_class = 'stickybg locked_sticky';
  229. // Sticky topics should get a different color, too.
  230. elseif ($topic['is_sticky'])
  231. $color_class = 'stickybg';
  232. // Locked topics get special treatment as well.
  233. elseif ($topic['is_locked'])
  234. $color_class = 'lockedbg';
  235. // Last, but not least: regular topics.
  236. else
  237. $color_class = 'windowbg';
  238. // Some columns require a different shade of the color class.
  239. $alternate_class = $color_class . '2';
  240. echo '
  241. <tr class="windowbg2">';
  242. if (!empty($modSettings['enableParticipation']))
  243. echo '
  244. <td class="', $color_class, ' icon1" style="padding: 0 0 0 0; background: none; width: 36px; text-align: right;">
  245. <img src="', $settings['images_url'], '/topic/', $topic['class'], '.png" alt="" />
  246. </td>';
  247. echo '
  248. <td class="', $color_class, ' icon2" style="padding: 0 0 0 0; width: 0px; text-align: right;"><div style="position: relative; height: 24px;">';
  249. echo '
  250. <img src="', $topic['is_poll'] ? $settings['images_url']. '/post/poll.png': $topic['first_post']['icon_url'], '" alt="" style="position: absolute; top: -2px; right: -2.7em; z-index: 5;" />
  251. ', ($topic['is_posted_in']) ? '<img src="'. $settings['images_url']. '/icons/user_sm.png" alt="" style="position: absolute; top: auto; bottom: -2px; right: -3.5em;" />' : '', '
  252. </div></td>
  253. <td width="60%" class="subject ', $alternate_class, '" ', (($topic['is_locked']) && (!$topic['is_sticky'])) ? 'style="opacity: 0.7;"' : '', '>
  254. <div style="margin-left: 3.7em;" ', (!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'] . '\');"' : ''), '>
  255. ', $topic['is_sticky'] ? '<strong>' : '', '<span id="msg_' . $topic['first_post']['id'] . '" class="thingy" style="line-height: 1.6em;"><a href="', ($topic['new'] && $context['user']['is_logged']) ? $topic['new_href']: $topic['first_post']['href'], '" style="display: block;" title="', ($topic['new'] && $context['user']['is_logged']) ? 'Go to first new post':'Go to first post', '">', ($topic['new'] && $context['user']['is_logged']) ? '<span class="new_posts">' . $txt['new'] . '</span>':'', '', $topic['first_post']['subject'], '', ($context['can_approve_posts'] && !$topic['approved']) ? '&nbsp;<em>(' . $txt['awaiting_approval'] . ')</em>' : '', '</a></span>', $topic['is_sticky'] ? '</strong>' : '';
  256. echo '
  257. <p style="line-height: 1.6em;"><a href="', $topic['first_post']['href'], '" style="font-weight: bold;">First post</a>&nbsp;by&nbsp;<span>', $topic['first_post']['member']['link'], '</span>';
  258. //echo '
  259. // ', $topic['first_post']['preview'];
  260. echo '
  261. <span style="font-size: 1em; padding: 0 10px;" id="pages' . $topic['first_post']['id'] . '">', $topic['pages'], '</span>';
  262. echo '
  263. </p>
  264. </div>
  265. </td>';
  266. //<td class="stats ', $color_class, '">
  267. // ', $topic['replies'], ' ', $txt['replies'], '
  268. // <br />
  269. // ', $topic['views'], ' ', $txt['views'], '
  270. //</td>
  271. echo ' <td width="40%" class="lastpost ', $alternate_class, ' righttext" ', (($topic['is_locked']) && (!$topic['is_sticky'])) ? 'style="opacity: 0.7;"' : '', '>
  272. <a href="', $topic['last_post']['href'], '" class="lastpost_icon"><img src="', $settings['images_url'], '/icons/', ($topic['is_sticky'] && $topic['is_locked'])? 'sticky_locked_last_post.png' : ($topic['is_locked'] ? 'locked_last_post.png': ($topic['is_sticky'] ? 'sticky_last_post.png' : 'last_post.png')), '" alt="', $txt['last_post'], '" title="', $txt['last_post'], '" /></a>
  273. <div class="lastpost_stuff">';
  274. echo '
  275. <span style="font-size: 1.083em; white-space: pre;">', $topic['replies'], ' ', $txt['replies'], '&nbsp;-&nbsp;', $topic['views'], ' ', $txt['views'], '</span><br />
  276. ', $topic['last_post']['time'], '&nbsp;', $txt['by'], '&nbsp;<span style="white-space: pre;"><strong>', $topic['last_post']['member']['link'], '</strong></span>
  277. </div>';
  278. //echo '
  279. // <div style="float: left; width: 100%; height: 0.6em; clear: both; margin: 0 0 0 0; padding: 2px 10px; overflow: visible;"><small style="font-weight: bold; display: block; margin: -8px 0 0 0; padding-right: 56px;" id="pages' . $topic['first_post']['id'] . '">', $topic['pages'], '</small></div>';
  280. echo '
  281. </td>';
  282. // Show the quick moderation options?
  283. if (!empty($context['can_quick_mod']))
  284. {
  285. echo '
  286. <td class="', $color_class, ' moderation ', $alternate_class, ' righttext" ', (($topic['is_locked']) && (!$topic['is_sticky'])) ? 'style="opacity: 0.7;"' : '', '>';
  287. if ($options['display_quick_mod'] == 1)
  288. echo '
  289. <input type="checkbox" name="topics[]" value="', $topic['id'], '" class="input_check" style="margin-left: -6px;" />';
  290. else
  291. {
  292. // Check permissions on each and show only the ones they are allowed to use.
  293. if ($topic['quick_mod']['remove'])
  294. echo '<a style="margin: 2px;" 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.png" width="16" alt="', $txt['remove_topic'], '" title="', $txt['remove_topic'], '" /></a>';
  295. if ($topic['quick_mod']['lock'])
  296. echo '<a style="margin: 2px;" 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.png" width="16" alt="', $txt['set_lock'], '" title="', $txt['set_lock'], '" /></a>';
  297. //if ($topic['quick_mod']['lock'] || $topic['quick_mod']['remove'])
  298. // echo '<br />';
  299. if ($topic['quick_mod']['sticky'])
  300. echo '<a style="margin: 2px;" 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.png" width="16" alt="', $txt['set_sticky'], '" title="', $txt['set_sticky'], '" /></a>';
  301. if ($topic['quick_mod']['move'])
  302. echo '<a style="margin: 2px;" href="', $scripturl, '?action=movetopic;board=', $context['current_board'], '.', $context['start'], ';topic=', $topic['id'], '.0"><img src="', $settings['images_url'], '/icons/quick_move.png" width="16" alt="', $txt['move_topic'], '" title="', $txt['move_topic'], '" /></a>';
  303. }
  304. echo '
  305. </td>';
  306. }
  307. echo '
  308. </tr>';
  309. }
  310. if (!empty($context['can_quick_mod']) && $options['display_quick_mod'] == 1 && !empty($context['topics']))
  311. {
  312. echo '
  313. <tr class="windowbg">
  314. <td class="normal_bar" colspan="6" align="right">
  315. <select class="qaction" name="qaction"', $context['can_move'] ? ' onchange="this.form.moveItTo.disabled = (this.options[this.selectedIndex].value != \'move\');"' : '', '>
  316. <option value="">--------</option>', $context['can_remove'] ? '
  317. <option value="remove">' . $txt['quick_mod_remove'] . '</option>' : '', $context['can_lock'] ? '
  318. <option value="lock">' . $txt['quick_mod_lock'] . '</option>' : '', $context['can_sticky'] ? '
  319. <option value="sticky">' . $txt['quick_mod_sticky'] . '</option>' : '', $context['can_move'] ? '
  320. <option value="move">' . $txt['quick_mod_move'] . ': </option>' : '', $context['can_merge'] ? '
  321. <option value="merge">' . $txt['quick_mod_merge'] . '</option>' : '', $context['can_restore'] ? '
  322. <option value="restore">' . $txt['quick_mod_restore'] . '</option>' : '', $context['can_approve'] ? '
  323. <option value="approve">' . $txt['quick_mod_approve'] . '</option>' : '', $context['user']['is_logged'] ? '
  324. <option value="markread">' . $txt['quick_mod_markread'] . '</option>' : '', '
  325. </select>';
  326. // Show a list of boards they can move the topic to.
  327. if ($context['can_move'])
  328. {
  329. echo '
  330. <select class="qaction" id="moveItTo" name="move_to" disabled="disabled">';
  331. foreach ($context['move_to_boards'] as $category)
  332. {
  333. echo '
  334. <optgroup label="', $category['name'], '">';
  335. foreach ($category['boards'] as $board)
  336. echo '
  337. <option value="', $board['id'], '"', $board['selected'] ? ' selected="selected"' : '', '>', $board['child_level'] > 0 ? str_repeat('==', $board['child_level'] - 1) . '=&gt;' : '', ' ', $board['name'], '</option>';
  338. echo '
  339. </optgroup>';
  340. }
  341. echo '
  342. </select>';
  343. }
  344. echo '
  345. <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" />
  346. </td>
  347. </tr>';
  348. }
  349. echo '
  350. </tbody>
  351. </table>
  352. </div>
  353. <a id="bot"></a>';
  354. // Finish off the form - again.
  355. if (!empty($context['can_quick_mod']) && $options['display_quick_mod'] > 0 && !empty($context['topics']))
  356. echo '
  357. <input type="hidden" name="' . $context['session_var'] . '" value="' . $context['session_id'] . '" />
  358. </form>';
  359. echo '
  360. <div class="pagesection">
  361. ', template_button_strip($normal_buttons, 'right'), '
  362. <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>
  363. </div>';
  364. }
  365. // Show breadcrumbs at the bottom too.
  366. theme_linktree();
  367. echo '
  368. <div class="tborder" id="topic_icons">
  369. <div class="description">
  370. <p class="floatright" id="message_index_jump_to">&nbsp;</p>';
  371. if (!$context['no_topic_listing'])
  372. echo '
  373. <p>
  374. <span>', $context['user']['is_logged'] ? '<img src="'. $settings['images_url']. '/icons/user_sm.png" alt="" class="centericon" /> '. $txt['participation_caption'] : '', '</span>
  375. <span><img src="' . $settings['images_url'] . '/icons/locked_last_post.png" alt="" class="centericon" /> ' . $txt['locked_topic'] . '</span>' . ($modSettings['enableStickyTopics'] == '1' ? '
  376. <span><img src="' . $settings['images_url'] . '/icons/sticky_last_post.png" alt="" class="centericon" /> ' . $txt['sticky_topic'] . '</span>' : '') . ($modSettings['pollMode'] == '1' ? '
  377. <span><img src="' . $settings['images_url'] . '/post/poll.png" alt="" class="centericon" /> ' . $txt['poll']. '</span>' : '') . '
  378. </p>';
  379. echo '
  380. <script type="text/javascript"><!-- // --><![CDATA[
  381. if (typeof(window.XMLHttpRequest) != "undefined")
  382. aJumpTo[aJumpTo.length] = new JumpTo({
  383. sContainerId: "message_index_jump_to",
  384. sJumpToTemplate: "<label for=\"%select_id%\">', $context['jump_to']['label'], ':<" + "/label> %dropdown_list%",
  385. iCurBoardId: ', $context['current_board'], ',
  386. iCurBoardChildLevel: ', $context['jump_to']['child_level'], ',
  387. sCurBoardName: "', $context['jump_to']['board_name'], '",
  388. sBoardChildLevelIndicator: "==",
  389. sBoardPrefix: "=> ",
  390. sCatSeparator: "-----------------------------",
  391. sCatPrefix: "",
  392. sGoButtonLabel: "', $txt['quick_mod_go'], '"
  393. });
  394. // ]]></script>
  395. </div>
  396. </div>';
  397. // Javascript for inline editing.
  398. // jQuery Beauty Tips override syntax: $("span.thingy").bt(jQuery.bt.options = {positions: "bottom"});
  399. echo '
  400. <script type="text/javascript" src="' . $settings['default_theme_url'] . '/scripts/topic.js"></script>
  401. <script type="text/javascript"><!-- // --><![CDATA[
  402. // Hide certain bits during topic edit.
  403. hide_prefixes.push("lockicon", "stickyicon", "pages", "newicon");
  404. // Use it to detect when we\'ve stopped editing.
  405. document.onclick = modify_topic_click;
  406. var mouse_on_div;
  407. $(document).ready(function(){
  408. $(".table_list tbody tr").show();
  409. $("#Child_swap").show();
  410. $("#Child_swap").click(function(){
  411. // toggle the div on / off
  412. $(".table_list tbody tr").toggle();
  413. // swap the collapse / expand images
  414. var sCurrent_image = $("#Child_swap").attr("src");
  415. if ($("#Child_swap").attr("class") == "toggle") {
  416. $("#Child_swap").attr("src", sCurrent_image.replace("collapse", "expand"));
  417. } else {
  418. $("#Child_swap").attr("src", sCurrent_image.replace("expand", "collapse"));
  419. }
  420. // add/remove a class element to keep track of the image status
  421. $("#Child_swap").toggleClass("on");
  422. });
  423. $("td.stickybg, td.stickybg2").show();
  424. $("#Sticky_toggle").show();
  425. $("#Sticky_toggle").click(function(){
  426. $("td.stickybg, td.stickybg2").toggle();
  427. // swap the arrow up / down images
  428. var sCurrent_image = $("#Sticky_toggle").attr("src");
  429. if ($("#Sticky_toggle").attr("class") == "icon floatright") {
  430. $("#Sticky_toggle").attr("src", sCurrent_image.replace("arrow", "arrow-down"));
  431. } else {
  432. $("#Sticky_toggle").attr("src", sCurrent_image.replace("arrow-down", "arrow"));
  433. }
  434. // add/remove a class element to keep track of the image status
  435. $("#Sticky_toggle").toggleClass("on");
  436. });
  437. });
  438. ';
  439. //$(document).ready(function() {
  440. // $("span.thingy").bt();
  441. //});
  442. echo '
  443. // ]]></script>';
  444. }
  445. ?>