annotate forum/Themes/core/MessageIndex.template.php @ 94:e43e2f72254a rdfquery

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