Advertisement
Guest User

MessageIndex.template.php

a guest
Jun 7th, 2016
211
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 28.58 KB | None | 0 0
  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.0
  11.  */
  12.  
  13. function template_main()
  14. {
  15.     global $context, $settings, $options, $scripturl, $modSettings, $txt;
  16.  
  17.     echo '
  18.     <a id="top"></a>';
  19.  
  20.     if (!empty($context['boards']) && (!empty($options['show_children']) || $context['start'] == 0))
  21.     {
  22.         echo '
  23.     <div class="tborder childboards" id="board_', $context['current_board'], '_childboards">
  24.         <div class="cat_bar">
  25.             <h3 class="catbg">', $txt['parent_boards'], '</h3>
  26.         </div>
  27.         <div class="table_frame">
  28.             <table class="table_list">
  29.                 <tbody id="board_', $context['current_board'], '_children" class="content">';
  30.  
  31.         foreach ($context['boards'] as $board)
  32.         {
  33.             echo '
  34.                 <tr id="board_', $board['id'], '" class="windowbg2">
  35.                     <td class="icon windowbg child-icon"', !empty($board['children']) ? ' rowspan="2"' : '', '>
  36.                         <a href="', ($board['is_redirect'] || $context['user']['is_guest'] ? $board['href'] : $scripturl . '?action=unread;board=' . $board['id'] . '.0;children'), '">';
  37.  
  38.             // If the board or children is new, show an indicator.
  39.             if ($board['new'] || $board['children_new'])
  40.                 echo '
  41.                             <svg class="star new-posts" viewBox="0 0 32 32" alt="New Posts" ><use xmlns:xlink="http://www.w3.org/1999/xlink" xlink:href="#FullStar"></use></svg>';
  42.             // Is it a redirection board?
  43.             elseif ($board['is_redirect'])
  44.                 echo '
  45.                             <img src="', $settings['images_url'], '/' .$context['theme_variant_url'], 'redirect.png" alt="*" title="*" />';
  46.             // No new posts at all! The agony!!
  47.             else
  48.                 echo '
  49.                             <svg class="star no-posts" viewBox="0 0 32 32" alt="No New Posts" ><use xmlns:xlink="http://www.w3.org/1999/xlink" xlink:href="#NoStar"></use></svg>';
  50.  
  51.             echo '
  52.                         </a>
  53.                     </td>
  54.                     <td class="info">
  55.                         <a class="subject" href="', $board['href'], '" name="b', $board['id'], '">', $board['name'], '</a>';
  56.  
  57.             // Has it outstanding posts for approval?
  58.             if ($board['can_approve_posts'] && ($board['unapproved_posts'] || $board['unapproved_topics']))
  59.                 echo '
  60.                         <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>';
  61.  
  62.             echo '
  63.  
  64.                         <p>', $board['description'] , '</p>';
  65.  
  66.             // Show the "Moderators: ". Each has name, href, link, and id. (but we're gonna use link_moderators.)
  67.             if (!empty($board['moderators']))
  68.                 echo '
  69.                         <p class="moderators">', count($board['moderators']) === 1 ? $txt['moderator'] : $txt['moderators'], ': ', implode(', ', $board['link_moderators']), '</p>';
  70.  
  71.             // Show some basic information about the number of posts, etc.
  72.             echo '
  73.                     </td>
  74.                     <td class="stats windowbg">
  75.                         <p>', comma_format($board['posts']), ' ', $board['is_redirect'] ? $txt['redirects'] : $txt['posts'], ' <br />
  76.                         ', $board['is_redirect'] ? '' : comma_format($board['topics']) . ' ' . $txt['board_topics'], '
  77.                         </p>
  78.                     </td>
  79.                     <td class="lastpost">';
  80.  
  81.             /* The board's and children's 'last_post's have:
  82.             time, timestamp (a number that represents the time.), id (of the post), topic (topic id.),
  83.             link, href, subject, start (where they should go for the first unread post.),
  84.             and member. (which has id, name, link, href, username in it.) */
  85.             if (!empty($board['last_post']['id']))
  86.                 echo '
  87.                         <p><strong>', $txt['last_post'], '</strong>  ', $txt['by'], ' ', $board['last_post']['member']['link'], '<br />
  88.                         ', $txt['in'], ' ', $board['last_post']['link'], '<br />
  89.                         ', $txt['on'], ' ', $board['last_post']['time'],'
  90.                         </p>';
  91.  
  92.             echo '
  93.                     </td>
  94.                 </tr>';
  95.  
  96.             // Show the "Child Boards: ". (there's a link_children but we're going to bold the new ones...)
  97.             if (!empty($board['children']))
  98.             {
  99.                 // Sort the links into an array with new boards bold so it can be imploded.
  100.                 $children = array();
  101.                 /* Each child in each board's children has:
  102.                         id, name, description, new (is it new?), topics (#), posts (#), href, link, and last_post. */
  103.                 foreach ($board['children'] as $child)
  104.                 {
  105.                     if (!$child['is_redirect'])
  106.                         $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['images_url'] . '/icons/16/newinthread.png" class="new_posts" alt="" />' : '') . '</a>';
  107.                     else
  108.                         $child['link'] = '<a href="' . $child['href'] . '" title="' . comma_format($child['posts']) . ' ' . $txt['redirects'] . '">' . $child['name'] . '</a>';
  109.  
  110.                     // Has it posts awaiting approval?
  111.                     if ($child['can_approve_posts'] && ($child['unapproved_posts'] | $child['unapproved_topics']))
  112.                         $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>';
  113.  
  114.                     $children[] = $child['new'] ? '<strong>' . $child['link'] . '</strong>' : $child['link'];
  115.                 }
  116.                 echo '
  117.                 <tr id="board_', $board['id'], '_children"><td colspan="3" class="children windowbg"><strong>', $txt['parent_boards'], '</strong>: ', implode(', ', $children), '</td></tr>';
  118.             }
  119.         }
  120.         echo '
  121.                 </tbody>
  122.             </table>
  123.         </div>
  124.     </div>';
  125.     }
  126.  
  127.     if (!empty($options['show_board_desc']) && $context['description'] != '')
  128.         echo '
  129.     <p class="description_board">', $context['description'], '</p>';
  130.  
  131.     // Create the button set...
  132.     $normal_buttons = array(
  133.         '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),
  134.         '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'),
  135.         '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']),
  136.         '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']),
  137.     );
  138.  
  139.     // They can only mark read if they are logged in and it's enabled!
  140.     if (!$context['user']['is_logged'] || !$settings['show_mark_read'])
  141.         unset($normal_buttons['markread']);
  142.  
  143.     // Allow adding new buttons easily.
  144.     call_integration_hook('integrate_messageindex_buttons', array(&$normal_buttons));
  145.  
  146.     if (!$context['no_topic_listing'])
  147.     {
  148.         echo '
  149.     <div class="pagesection">
  150.         <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>
  151.         ', template_button_strip($normal_buttons, 'right'), '
  152.     </div>';
  153.  
  154.         // If Quick Moderation is enabled start the form.
  155.         if (!empty($context['can_quick_mod']) && $options['display_quick_mod'] > 0 && !empty($context['topics']))
  156.             echo '
  157.     <form action="', $scripturl, '?action=quickmod;board=', $context['current_board'], '.', $context['start'], '" method="post" accept-charset="', $context['character_set'], '" class="clear" name="quickModForm" id="quickModForm">';
  158.  
  159.         echo '
  160.     <div class="tborder topic_table" id="messageindex">
  161.         <table class="table_grid" cellspacing="0">
  162.             <thead>
  163.                 <tr class="catbg">';
  164.  
  165.         // Are there actually any topics to show?
  166.         if (!empty($context['topics']))
  167.         {
  168.             echo '
  169.                     <th scope="col" class="first_th" width="5%">&nbsp;</th>
  170.                     <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' ? ' <svg viewBox="0 0 32 32"><use xmlns:xlink="http://www.w3.org/1999/xlink" xlink:href="#Sort'.$context['sort_direction'].'"></use></svg>' : '', '</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' ? '<svg viewBox="0 0 32 32"><use xmlns:xlink="http://www.w3.org/1999/xlink" xlink:href="#Sort'.$context['sort_direction'].'"></use></svg>' : '', '</a></th>
  171.                     <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' ? '<svg viewBox="0 0 32 32"><use xmlns:xlink="http://www.w3.org/1999/xlink" xlink:href="#Sort'.$context['sort_direction'].'"></use></svg>' : '', '</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' ? '<svg viewBox="0 0 32 32"><use xmlns:xlink="http://www.w3.org/1999/xlink" xlink:href="#Sort'.$context['sort_direction'].'"></use></svg>' : '', '</a></th>';
  172.             // Show a "select all" box for quick moderation?
  173.             if (empty($context['can_quick_mod']))
  174.                 echo '
  175.                    <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' : '', '">LAST POST', $context['sort_by'] == 'last_post' ? '<svg viewBox="0 0 32 32"><use xmlns:xlink="http://www.w3.org/1999/xlink" xlink:href="#Sort'.$context['sort_direction'].'"></use></svg>' : '', '</a></th>';
  176.                    
  177.             else
  178.                 echo '
  179.                     <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' ? '<svg viewBox="0 0 32 32"><use xmlns:xlink="http://www.w3.org/1999/xlink" xlink:href="#Sort'.$context['sort_direction'].'"></use></svg>' : '', '</a></th>';
  180.  
  181.             // Show a "select all" box for quick moderation?
  182.             if (!empty($context['can_quick_mod']) && $options['display_quick_mod'] == 1)
  183.                 echo '
  184.                     <th scope="col" class="last_th" width="24"><input type="checkbox" onclick="invertAll(this, this.form, \'topics[]\');" class="input_check" /></th>';
  185.  
  186.             // If it's on in "image" mode, don't show anything but the column.
  187.             elseif (!empty($context['can_quick_mod']))
  188.                 echo '
  189.                     <th class="last_th" width="4%">&nbsp;</th>';
  190.         }
  191.         // No topics.... just say, "sorry bub".
  192.         else
  193.             echo '
  194.                     <th scope="col" class="first_th" width="8%">&nbsp;</th>
  195.                     <th colspan="3"><strong>', $txt['msg_alert_none'], '</strong></th>
  196.                     <th scope="col" class="last_th" width="8%">&nbsp;</th>';
  197.  
  198.         echo '
  199.                 </tr>
  200.             </thead>
  201.             <tbody>';
  202.  
  203.         if (!empty($settings['display_who_viewing']))
  204.         {
  205.             echo '
  206.                 <tr class="windowbg2 whos_viewing">
  207.                     <td colspan="', !empty($context['can_quick_mod']) ? '6' : '5', '" class="smalltext">';
  208.             if ($settings['display_who_viewing'] == 1)
  209.                 echo count($context['view_members']), ' ', count($context['view_members']) === 1 ? $txt['who_member'] : $txt['members'];
  210.             else
  211.                 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'] . ')');
  212.             echo $txt['who_and'], $context['view_num_guests'], ' ', $context['view_num_guests'] == 1 ? $txt['guest'] : $txt['guests'], $txt['who_viewing_board'], '
  213.                     </td>
  214.                 </tr>';
  215.         }
  216.  
  217.         // If this person can approve items and we have some awaiting approval tell them.
  218.         if (!empty($context['unapproved_posts_message']))
  219.         {
  220.             echo '
  221.                 <tr class="windowbg2">
  222.                     <td colspan="', !empty($context['can_quick_mod']) ? '6' : '5', '">
  223.                         <span class="alert">!</span> ', $context['unapproved_posts_message'], '
  224.                     </td>
  225.                 </tr>';
  226.         }
  227.  
  228.         foreach ($context['topics'] as $topic)
  229.         {
  230.             // Is this topic pending approval, or does it have any posts pending approval?
  231.             if ($context['can_approve_posts'] && $topic['unapproved_posts'])
  232.                 $color_class = !$topic['approved'] ? 'approvetbg' : 'approvebg';
  233.             // We start with locked and 5c8cc topics.
  234.             elseif ($topic['is_sticky'] && $topic['is_locked'])
  235.                 $color_class = 'stickybg locked_sticky';
  236.             // Sticky topics should get a different color, too.
  237.             elseif ($topic['is_sticky'])
  238.                 $color_class = 'stickybg';
  239.             // Locked topics get special treatment as well.
  240.             elseif ($topic['is_locked'])
  241.                 $color_class = 'lockedbg';
  242.             // Last, but not least: regular topics.
  243.             else
  244.                 $color_class = 'windowbg';
  245.  
  246.             // Some columns require a different shade of the color class.
  247.             $alternate_class = $color_class . '2';
  248.  
  249.             echo '
  250.                 <tr>
  251.                     <td class="icon1 ', $color_class, '">
  252.                          <svg viewBox="0 0 32 32" >
  253.                            <use xmlns:xlink="http://www.w3.org/1999/xlink" xlink:href="#ThreadBubble"></use>';
  254.                             if ($topic['is_sticky'])
  255.                               echo '<use xmlns:xlink="http://www.w3.org/1999/xlink" xlink:href="#ThreadSticky"></use>';
  256.                             if ($topic['is_locked'])
  257.                               echo '<use xmlns:xlink="http://www.w3.org/1999/xlink" xlink:href="#ThreadLocked"></use>';
  258.                             if ($topic['is_poll'])
  259.                               echo '<use xmlns:xlink="http://www.w3.org/1999/xlink" xlink:href="#ThreadPoll"></use>';
  260.                             else if ($topic['is_very_hot'])
  261.                               echo '<use xmlns:xlink="http://www.w3.org/1999/xlink" xlink:href="#ThreadVeryHot"></use>';
  262.                             else if ($topic['is_hot'])
  263.                               echo '<use xmlns:xlink="http://www.w3.org/1999/xlink" xlink:href="#ThreadHot"></use>';
  264.                             if ($topic['is_posted_in'])
  265.                               echo '<use xmlns:xlink="http://www.w3.org/1999/xlink" xlink:href="#ThreadYouPosted"></use>';
  266.                           echo '</svg>
  267.                     </td>';
  268.  
  269. echo "<td class='subject {$alternate_class}'>
  270.    <div class='title' ", (!empty($topic["quick_mod"]["modify"])
  271.         ? "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"] . "\");'"
  272.         : ""),
  273.     ">";
  274.  
  275. // Is this topic new? (assuming they are logged in!)
  276. if ($topic["new"] && $context["user"]["is_logged"]) {
  277.     echo "
  278.        <a href='{$topic["new_href"]}' class='jump-to-new subject-level' id='newicon{$topic["first_post"]["id"]}'>
  279.            <svg viewBox='0 0 32 32' ><use xmlns:xlink='http://www.w3.org/1999/xlink' xlink:href='#PostNewOnes'></use></svg>
  280.        </a>";
  281. }
  282.  
  283. echo ($topic["is_sticky"]
  284.     ? "<strong>"
  285.         : ""),
  286.     "{$topic["first_post"]["link"]}",
  287.     (!$context["can_approve_posts"]
  288.         && !$topic["approved"]
  289.     ? "&nbsp;<em>({$txt["awaiting_approval"]})</em>"
  290.         : ""),
  291.     "",
  292.     ($topic["is_sticky"]
  293.     ? "</strong>"
  294.         : "");
  295.  
  296. echo "</div><div class='creator-and-pagination'>";
  297. echo "  <span class='creator'>
  298.            {$txt["started_by"]} {$topic["first_post"]["member"]["link"]}
  299.        </span>
  300.        <span class='pagination'>
  301.            {$topic["pages"]}
  302.        </span>
  303.    </div>
  304. </td>";
  305.  
  306.  
  307. echo '                  <td class="stats ', $color_class, '">
  308.                         ', $topic['replies'], ' ', $txt['replies'], '
  309.                         <br />
  310.                         ', $topic['views'], ' ', $txt['views'], '
  311.                     </td>
  312.                     <td class="lastpost ', $alternate_class, '">
  313.                          <a class="skip" href="', $topic['last_post']['href'], '" title="Skip to final post">
  314.                            <svg viewBox="0 0 32 32" ><use xmlns:xlink="http://www.w3.org/1999/xlink" xlink:href="#ThreadBubble" alt="skip"></use><use xmlns:xlink="http://www.w3.org/1999/xlink" xlink:href="#ThreadSkip" alt="skip"></use></svg>
  315.                          </a>
  316.                         ', $topic['last_post']['time'], '<br />
  317.                         ', $txt['by'], ' ', $topic['last_post']['member']['link'], '
  318.                     </td>';
  319.  
  320.             // Show the quick moderation options?
  321.             if (!empty($context['can_quick_mod']))
  322.             {
  323.                 echo '
  324.                     <td class="moderation ', $color_class, '" align="center">';
  325.                 if ($options['display_quick_mod'] == 1)
  326.                     echo '
  327.                         <input type="checkbox" name="topics[]" value="', $topic['id'], '" class="input_check" />';
  328.                 else
  329.                 {
  330.                     // Check permissions on each and show only the ones they are allowed to use.
  331.                     if ($topic['quick_mod']['remove'])
  332.                         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>';
  333.  
  334.                     if ($topic['quick_mod']['lock'])
  335.                         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>';
  336.  
  337.                     if ($topic['quick_mod']['lock'] || $topic['quick_mod']['remove'])
  338.                         echo '<br />';
  339.  
  340.                     if ($topic['quick_mod']['sticky'])
  341.                         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>';
  342.  
  343.                     if ($topic['quick_mod']['move'])
  344.                         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>';
  345.                 }
  346.                 echo '
  347.                     </td>';
  348.             }
  349.             echo '
  350.                 </tr>';
  351.         }
  352.  
  353.         if (!empty($context['can_quick_mod']) && $options['display_quick_mod'] == 1 && !empty($context['topics']))
  354.         {
  355.             echo '
  356.                 <tr class="titlebg">
  357.                     <td colspan="6" align="right">
  358.                         <select class="qaction" name="qaction"', $context['can_move'] ? ' onchange="this.form.moveItTo.disabled = (this.options[this.selectedIndex].value != \'move\');"' : '', '>
  359.                             <option value="">--------</option>', $context['can_remove'] ? '
  360.                             <option value="remove">' . $txt['quick_mod_remove'] . '</option>' : '', $context['can_lock'] ? '
  361.                             <option value="lock">' . $txt['quick_mod_lock'] . '</option>' : '', $context['can_sticky'] ? '
  362.                             <option value="sticky">' . $txt['quick_mod_sticky'] . '</option>' : '', $context['can_move'] ? '
  363.                             <option value="move">' . $txt['quick_mod_move'] . ': </option>' : '', $context['can_merge'] ? '
  364.                             <option value="merge">' . $txt['quick_mod_merge'] . '</option>' : '', $context['can_restore'] ? '
  365.                             <option value="restore">' . $txt['quick_mod_restore'] . '</option>' : '', $context['can_approve'] ? '
  366.                             <option value="approve">' . $txt['quick_mod_approve'] . '</option>' : '', $context['user']['is_logged'] ? '
  367.                             <option value="markread">' . $txt['quick_mod_markread'] . '</option>' : '', '
  368.                         </select>';
  369.  
  370.             // Show a list of boards they can move the topic to.
  371.             if ($context['can_move'])
  372.             {
  373.                     echo '
  374.                         <select class="qaction" id="moveItTo" name="move_to" disabled="disabled">';
  375.  
  376.                     foreach ($context['move_to_boards'] as $category)
  377.                     {
  378.                         echo '
  379.                             <optgroup label="', $category['name'], '">';
  380.                         foreach ($category['boards'] as $board)
  381.                                 echo '
  382.                                 <option value="', $board['id'], '"', $board['selected'] ? ' selected="selected"' : '', '>', $board['child_level'] > 0 ? str_repeat('==', $board['child_level'] - 1) . '=&gt;' : '', ' ', $board['name'], '</option>';
  383.                         echo '
  384.                             </optgroup>';
  385.                     }
  386.                     echo '
  387.                         </select>';
  388.             }
  389.  
  390.             echo '
  391.                         <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" />
  392.                     </td>
  393.                 </tr>';
  394.         }
  395.  
  396.         echo '
  397.             </tbody>
  398.         </table>
  399.     </div>
  400.     <a id="bot"></a>';
  401.  
  402.         // Finish off the form - again.
  403.         if (!empty($context['can_quick_mod']) && $options['display_quick_mod'] > 0 && !empty($context['topics']))
  404.             echo '
  405.     <input type="hidden" name="' . $context['session_var'] . '" value="' . $context['session_id'] . '" />
  406.     </form>';
  407.  
  408.         echo '
  409.     <div class="pagesection">
  410.         ', template_button_strip($normal_buttons, 'right'), '
  411.         <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>
  412.     </div>';
  413.     }
  414.  
  415.     // Show breadcrumbs at the bottom too.
  416.     theme_linktree();
  417.  
  418.     echo '
  419.     <div class="tborder" id="topic_icons">
  420.         <div class="description">
  421.             <p id="message_index_jump_to" style="text-align:right;">&nbsp;</p>';
  422.  
  423.     if (!$context['no_topic_listing'])
  424.         echo '
  425.  
  426.             <ul class="icon_glossary">', !empty($modSettings['enableParticipation']) && $context['user']['is_logged'] ? '
  427.                 ' : '', '
  428.                      <li>
  429.                        <svg viewBox="0 0 32 32" alt="normal topic"><use xmlns:xlink="http://www.w3.org/1999/xlink" xlink:href="#ThreadBubble"></use></svg>
  430.                        <span>Thread</span>
  431.                      </li>
  432.                      <li>
  433.                  <svg viewBox="0 0 32 32" alt="topic has a poll"><use xmlns:xlink="http://www.w3.org/1999/xlink" xlink:href="#ThreadBubble" alt="Normal Topic"></use><use xmlns:xlink="http://www.w3.org/1999/xlink" xlink:href="#ThreadPoll"></use></svg>
  434.                  <span>with Poll</span>
  435.                </li>
  436.                <li>
  437.                  <svg viewBox="0 0 32 32" alt="topic has a poll"><use xmlns:xlink="http://www.w3.org/1999/xlink" xlink:href="#ThreadBubble" alt="Normal Topic"></use><use xmlns:xlink="http://www.w3.org/1999/xlink" xlink:href="#ThreadSticky"></use></svg>
  438.                  <span>Sticky</span>
  439.                </li>
  440.                <li>
  441.                  <svg viewBox="0 0 32 32" alt="topic has a poll"><use xmlns:xlink="http://www.w3.org/1999/xlink" xlink:href="#ThreadBubble" alt="Normal Topic"></use><use xmlns:xlink="http://www.w3.org/1999/xlink" xlink:href="#ThreadLocked"></use></svg>
  442.                  <span>Locked</span>
  443.                </li>
  444.                <li>
  445.                  <svg viewBox="0 0 32 32" alt="topic has a poll"><use xmlns:xlink="http://www.w3.org/1999/xlink" xlink:href="#ThreadBubble" alt="Normal Topic"></use><use xmlns:xlink="http://www.w3.org/1999/xlink" xlink:href="#ThreadHot"></use></svg>
  446.                  <span>&gt; 20 replies</span>
  447.                </li>
  448.                <li>
  449.                  <svg viewBox="0 0 32 32" alt="topic has a poll"><use xmlns:xlink="http://www.w3.org/1999/xlink" xlink:href="#ThreadBubble" alt="Normal Topic"></use><use xmlns:xlink="http://www.w3.org/1999/xlink" xlink:href="#ThreadVeryHot"></use></svg>
  450.                  <span>&gt 40 replies</span>
  451.                </li>
  452.                <li>
  453.                  <svg viewBox="0 0 32 32" alt="topic has a poll"><use xmlns:xlink="http://www.w3.org/1999/xlink" xlink:href="#ThreadBubble" alt="Normal Topic"></use><use xmlns:xlink="http://www.w3.org/1999/xlink" xlink:href="#ThreadYouPosted"></use></svg>
  454.                  <span>You&apos;ve Posted</span>
  455.                </li>
  456.                <li>
  457.                  <svg viewBox="0 0 32 32" alt="topic has a poll"><use xmlns:xlink="http://www.w3.org/1999/xlink" xlink:href="#ThreadBubble" alt="Normal Topic"></use><use xmlns:xlink="http://www.w3.org/1999/xlink" xlink:href="#ThreadSkip"></use></svg>
  458.                  <span>Skip to End</span>
  459.                </li>
  460.                <li>
  461.                  <svg viewBox="0 0 32 32" alt="normal topic"><use xmlns:xlink="http://www.w3.org/1999/xlink" xlink:href="#PostNewOnes"></use></svg>
  462.                  <span>New Posts</span>
  463.                </li>
  464.              </ul>';
  465.  
  466.     echo '
  467.             <script type="text/javascript"><!-- // --><![CDATA[
  468.                 if (typeof(window.XMLHttpRequest) != "undefined")
  469.                     aJumpTo[aJumpTo.length] = new JumpTo({
  470.                         sContainerId: "message_index_jump_to",
  471.                         sJumpToTemplate: "<label class=\"smalltext\" for=\"%select_id%\">', $context['jump_to']['label'], ':<" + "/label> %dropdown_list%",
  472.                         iCurBoardId: ', $context['current_board'], ',
  473.                         iCurBoardChildLevel: ', $context['jump_to']['child_level'], ',
  474.                         sCurBoardName: "', $context['jump_to']['board_name'], '",
  475.                         sBoardChildLevelIndicator: "==",
  476.                         sBoardPrefix: "=> ",
  477.                         sCatSeparator: "-----------------------------",
  478.                         sCatPrefix: "",
  479.                         sGoButtonLabel: "', $txt['quick_mod_go'], '"
  480.                     });
  481.             // ]]></script>
  482.             <br class="clear" />
  483.         </div>
  484.     </div>';
  485.  
  486.     // Javascript for inline editing.
  487.     echo '
  488. <script type="text/javascript" src="' . $settings['default_theme_url'] . '/scripts/topic.js"></script>
  489. <script type="text/javascript"><!-- // --><![CDATA[
  490.  
  491.     // Hide certain bits during topic edit.
  492.     hide_prefixes.push("lockicon", "stickyicon", "pages", "newicon");
  493.  
  494.     // Use it to detect when we\'ve stopped editing.
  495.     document.onclick = modify_topic_click;
  496.  
  497.     var mouse_on_div;
  498.     function modify_topic_click()
  499.     {
  500.         if (in_edit_mode == 1 && mouse_on_div == 0)
  501.             modify_topic_save("', $context['session_id'], '", "', $context['session_var'], '");
  502.     }
  503.  
  504.     function modify_topic_keypress(oEvent)
  505.     {
  506.         if (typeof(oEvent.keyCode) != "undefined" && oEvent.keyCode == 13)
  507.         {
  508.             modify_topic_save("', $context['session_id'], '", "', $context['session_var'], '");
  509.             if (typeof(oEvent.preventDefault) == "undefined")
  510.                 oEvent.returnValue = false;
  511.             else
  512.                 oEvent.preventDefault();
  513.         }
  514.     }
  515.  
  516.     // For templating, shown when an inline edit is made.
  517.     function modify_topic_show_edit(subject)
  518.     {
  519.         // Just template the subject.
  520.         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) + \'" />\');
  521.     }
  522.  
  523.     // And the reverse for hiding it.
  524.     function modify_topic_hide_edit(subject)
  525.     {
  526.         // Re-template the subject!
  527.         setInnerHTML(cur_subject_div, \'<a href="', $scripturl, '?topic=\' + cur_topic_id + \'.0">\' + subject + \'<\' +\'/a>\');
  528.     }
  529.  
  530. // ]]></script>';
  531. }
  532.  
  533. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement