Exemplo n.º 1
0
function my_messageindex()
{
    global $context, $settings, $options, $scripturl, $modSettings, $txt;
    loadtemplate('Common');
    echo '
	<a id="top"></a>';
    if (!empty($context['boards']) && (!empty($options['show_children']) || $context['start'] == 0)) {
        echo '
	<div class="catbg">
		<span class="floatright circleborder" style="margin-top: 0rem;">', my_toggle('m' . $context['current_board'], 'mess_boards' . $context['current_board']), '</span>			
		<h3>', $txt['parent_boards'], '</h3>
	</div>
	<div id="mess_boards', $context['current_board'], '" class="', !empty($options['togglecatm' . $context['current_board']]) ? '' : 'no', 'togglecat">';
        $next = 1;
        template_board($context['boards']);
        echo '
	</div>';
    }
    echo '
	<div class="catbg">
		<h3>', $context['page_title'], '</h3>';
    if (!empty($options['show_board_desc']) && $context['description'] != '') {
        echo '
		<div class="subtitle">', $context['description'], '</div>';
    }
    echo '
	</div>';
    // Create the button set...
    $normal_buttons = array('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), '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'), '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']), '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']));
    // They can only mark read if they are logged in and it's enabled!
    if (!$context['user']['is_logged'] || !$settings['show_mark_read']) {
        unset($normal_buttons['markread']);
    }
    // Allow adding new buttons easily.
    call_integration_hook('integrate_messageindex_buttons', array(&$normal_buttons));
    if (!$context['no_topic_listing']) {
        echo '
	<div class="pagesection themepadding"><div class="bwgrid">
		<div class="pagelinks bwcell8"><br>', $txt['pages'], ': ', $context['page_index'], !empty($modSettings['topbottomEnable']) ? $context['menu_separator'] . '&nbsp;&nbsp;<a href="#bot"><strong>' . $txt['go_down'] . '</strong></a>' : '', '</div>
		<div class="bwcell8">', template_button_strip($normal_buttons, 'right'), '</div>
	</div></div>';
        // If Quick Moderation is enabled start the form.
        if (!empty($context['can_quick_mod']) && $options['display_quick_mod'] > 0 && !empty($context['topics'])) {
            echo '
	<form action="', $scripturl, '?action=quickmod;board=', $context['current_board'], '.', $context['start'], '" method="post" accept-charset="', $context['character_set'], '" class="clear" name="quickModForm" id="quickModForm">';
        }
        echo '
	<div class="tborder topic_table" id="messageindex">
		<table class="table_grid" cellspacing="0" style="width: 100%;">
			<thead class="whide">
				<tr class="catbg">';
        // Are there actually any topics to show?
        if (!empty($context['topics'])) {
            echo '<th></th>
					<th scope="col" class="lefttext"><a href="', $scripturl, '?board=', $context['current_board'], '.', $context['start'], ';sort=subject', $context['sort_by'] == 'subject' && $context['sort_direction'] == 'up' ? ';desc' : '', '">', $txt['subject'], $context['sort_by'] == 'subject' ? ' <img src="' . $settings['images_url'] . '/sort_' . $context['sort_direction'] . '.gif" alt="" />' : '', '</a> / <a href="', $scripturl, '?board=', $context['current_board'], '.', $context['start'], ';sort=starter', $context['sort_by'] == 'starter' && $context['sort_direction'] == 'up' ? ';desc' : '', '">', $txt['started_by'], $context['sort_by'] == 'starter' ? ' <img src="' . $settings['images_url'] . '/sort_' . $context['sort_direction'] . '.gif" alt="" />' : '', '</a></th>
					<th scope="col" class="rhide" width="14%"><a href="', $scripturl, '?board=', $context['current_board'], '.', $context['start'], ';sort=replies', $context['sort_by'] == 'replies' && $context['sort_direction'] == 'up' ? ';desc' : '', '">', $txt['replies'], $context['sort_by'] == 'replies' ? ' <img src="' . $settings['images_url'] . '/sort_' . $context['sort_direction'] . '.gif" alt="" />' : '', '</a> / <a href="', $scripturl, '?board=', $context['current_board'], '.', $context['start'], ';sort=views', $context['sort_by'] == 'views' && $context['sort_direction'] == 'up' ? ';desc' : '', '">', $txt['views'], $context['sort_by'] == 'views' ? ' <img src="' . $settings['images_url'] . '/sort_' . $context['sort_direction'] . '.gif" alt="" />' : '', '</a></th>';
            // Show a "select all" box for quick moderation?
            if (empty($context['can_quick_mod'])) {
                echo '
					<th scope="col" class="lefttext last_th" width="22%"><a href="', $scripturl, '?board=', $context['current_board'], '.', $context['start'], ';sort=last_post', $context['sort_by'] == 'last_post' && $context['sort_direction'] == 'up' ? ';desc' : '', '">', $txt['last_post'], $context['sort_by'] == 'last_post' ? ' <img src="' . $settings['images_url'] . '/sort_' . $context['sort_direction'] . '.gif" alt="" />' : '', '</a></th>';
            } else {
                echo '
					<th scope="col" class="lefttext rhide" 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>';
            }
            // Show a "select all" box for quick moderation?
            if (!empty($context['can_quick_mod']) && $options['display_quick_mod'] == 1) {
                echo '
					<th scope="col" class="last_th" width="4%"><input type="checkbox" onclick="invertAll(this, this.form, \'topics[]\');" class="input_check" /></th>';
            } elseif (!empty($context['can_quick_mod'])) {
                echo '
					<th class="last_th" width="4%">&nbsp;</th>';
            }
        } else {
            echo '
					<th scope="col" class="first_th" width="8%">&nbsp;</th>
					<th colspan="3"><strong>', $txt['msg_alert_none'], '</strong></th>
					<th scope="col" class="last_th" width="8%">&nbsp;</th>';
        }
        echo '
				</tr>
			</thead>
			<tbody>';
        if (!empty($settings['display_who_viewing'])) {
            echo '
				<tr class="windowbg2">
					<td colspan="', !empty($context['can_quick_mod']) ? '5' : '4', '">';
            if ($settings['display_who_viewing'] == 1) {
                echo count($context['view_members']), ' ', count($context['view_members']) === 1 ? $txt['who_member'] : $txt['members'];
            } else {
                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'] . ')');
            }
            echo $txt['who_and'], $context['view_num_guests'], ' ', $context['view_num_guests'] == 1 ? $txt['guest'] : $txt['guests'], $txt['who_viewing_board'], '
					</td>
				</tr>';
        }
        // If this person can approve items and we have some awaiting approval tell them.
        if (!empty($context['unapproved_posts_message'])) {
            echo '
				<tr class="windowbg2">
					<td colspan="', !empty($context['can_quick_mod']) ? '5' : '4', '">
						<span class="alert">!</span> ', $context['unapproved_posts_message'], '
					</td>
				</tr>';
        }
        template_topiclist($context['topics'], $ch = !empty($context['can_quick_mod']) ? true : false);
        if (!empty($context['can_quick_mod']) && $options['display_quick_mod'] == 1 && !empty($context['topics'])) {
            echo '
				<tr class="titlebg">
					<td colspan="5" align="right">
						<select class="qaction" name="qaction"', $context['can_move'] ? ' onchange="this.form.moveItTo.disabled = (this.options[this.selectedIndex].value != \'move\');"' : '', '>
							<option value="">--------</option>', $context['can_remove'] ? '
							<option value="remove">' . $txt['quick_mod_remove'] . '</option>' : '', $context['can_lock'] ? '
							<option value="lock">' . $txt['quick_mod_lock'] . '</option>' : '', $context['can_sticky'] ? '
							<option value="sticky">' . $txt['quick_mod_sticky'] . '</option>' : '', $context['can_move'] ? '
							<option value="move">' . $txt['quick_mod_move'] . ': </option>' : '', $context['can_merge'] ? '
							<option value="merge">' . $txt['quick_mod_merge'] . '</option>' : '', $context['can_restore'] ? '
							<option value="restore">' . $txt['quick_mod_restore'] . '</option>' : '', $context['can_approve'] ? '
							<option value="approve">' . $txt['quick_mod_approve'] . '</option>' : '', $context['user']['is_logged'] ? '
							<option value="markread">' . $txt['quick_mod_markread'] . '</option>' : '', '
						</select>';
            // Show a list of boards they can move the topic to.
            if ($context['can_move']) {
                echo '
						<select class="qaction" id="moveItTo" name="move_to" disabled="disabled">';
                foreach ($context['move_to_boards'] as $category) {
                    echo '
							<optgroup label="', $category['name'], '">';
                    foreach ($category['boards'] as $board) {
                        echo '
								<option value="', $board['id'], '"', $board['selected'] ? ' selected="selected"' : '', '>', $board['child_level'] > 0 ? str_repeat('==', $board['child_level'] - 1) . '=&gt;' : '', ' ', $board['name'], '</option>';
                    }
                    echo '
							</optgroup>';
                }
                echo '
						</select>';
            }
            echo '
						<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" />
					</td>
				</tr>';
        }
        echo '
			</tbody>
		</table>
	</div>
	<a id="bot"></a>';
        // Finish off the form - again.
        if (!empty($context['can_quick_mod']) && $options['display_quick_mod'] > 0 && !empty($context['topics'])) {
            echo '
	<input type="hidden" name="' . $context['session_var'] . '" value="' . $context['session_id'] . '" />
	</form>';
        }
        echo '
	<div class="pagesection themepadding"><div class="bwgrid">
		<div class="pagelinks bwcell8">', $txt['pages'], ': ', $context['page_index'], !empty($modSettings['topbottomEnable']) ? $context['menu_separator'] . '&nbsp;&nbsp;<a href="#top"><strong>' . $txt['go_up'] . '</strong></a>' : '', '</div>
		<div class="bwcell8">', template_button_strip($normal_buttons, 'right'), '</div>
	</div></div>';
    }
    echo '
	<div class="themepadding windowbg2" id="topic_icons">
		<div class="description">
			<p class="floatright" id="message_index_jump_to">&nbsp;</p>
			<script type="text/javascript"><!-- // --><![CDATA[
				if (typeof(window.XMLHttpRequest) != "undefined")
					aJumpTo[aJumpTo.length] = new JumpTo({
						sContainerId: "message_index_jump_to",
						sJumpToTemplate: "<label class=\\"smalltext\\" for=\\"%select_id%\\">', $context['jump_to']['label'], ':<" + "/label> %dropdown_list%",
						iCurBoardId: ', $context['current_board'], ',
						iCurBoardChildLevel: ', $context['jump_to']['child_level'], ',
						sCurBoardName: "', $context['jump_to']['board_name'], '",
						sBoardChildLevelIndicator: "==",
						sBoardPrefix: "=> ",
						sCatSeparator: "-----------------------------",
						sCatPrefix: "",
						sGoButtonLabel: "', $txt['quick_mod_go'], '"
					});
			// ]]></script>
			<br class="clear" />
		</div>
	</div>';
    // Javascript for inline editing.
    echo '
<script type="text/javascript" src="' . $settings['default_theme_url'] . '/scripts/topic.js"></script>
<script type="text/javascript"><!-- // --><![CDATA[

	// Hide certain bits during topic edit.
	hide_prefixes.push("lockicon", "stickyicon", "pages", "newicon");

	// Use it to detect when we\'ve stopped editing.
	document.onclick = modify_topic_click;

	var mouse_on_div;
	function modify_topic_click()
	{
		if (in_edit_mode == 1 && mouse_on_div == 0)
			modify_topic_save("', $context['session_id'], '", "', $context['session_var'], '");
	}

	function modify_topic_keypress(oEvent)
	{
		if (typeof(oEvent.keyCode) != "undefined" && oEvent.keyCode == 13)
		{
			modify_topic_save("', $context['session_id'], '", "', $context['session_var'], '");
			if (typeof(oEvent.preventDefault) == "undefined")
				oEvent.returnValue = false;
			else
				oEvent.preventDefault();
		}
	}

	// For templating, shown when an inline edit is made.
	function modify_topic_show_edit(subject)
	{
		// Just template the subject.
		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) + \'" />\');
	}

	// And the reverse for hiding it.
	function modify_topic_hide_edit(subject)
	{
		// Re-template the subject!
		setInnerHTML(cur_subject_div, \'<a href="', $scripturl, '?topic=\' + cur_topic_id + \'.0">\' + subject + \'<\' +\'/a>\');
	}

// ]]></script>';
}
Exemplo n.º 2
0
function my_boards()
{
    global $context, $settings, $options, $txt, $scripturl, $modSettings;
    loadtemplate('Common');
    // Show the news fader?  (assuming there are things to show...)
    if ($settings['show_newsfader'] && !empty($context['fader_news_lines'])) {
        echo '
	<div class="themepadding catbg">
		<h3>
			<img id="newsupshrink" src="', $settings['images_url'], '/collapse.gif" alt="*" title="', $txt['upshrink_description'], '" class="floatright" style="display: none;" />
			', $txt['news'], '
		</h3>
		<p class="subtitle">ttt</p>
	</div>
	<div id="newsfader"><div class="themepadding windowbg">
		<ul class="reset" id="smfFadeScroller"', empty($options['collapse_news_fader']) ? '' : ' style="display: none;"', '>';
        foreach ($context['news_lines'] as $news) {
            echo '
			<li>', $news, '</li>';
        }
        echo '
		</ul>
	</div></div>
	<script type="text/javascript" src="', $settings['default_theme_url'], '/scripts/fader.js"></script>
	<script type="text/javascript"><!-- // --><![CDATA[

		// Create a news fader object.
		var oNewsFader = new smf_NewsFader({
			sSelf: \'oNewsFader\',
			sFaderControlId: \'smfFadeScroller\',
			sItemTemplate: ', JavaScriptEscape('<strong>%1$s</strong>'), ',
			iFadeDelay: ', empty($settings['newsfader_time']) ? 5000 : $settings['newsfader_time'], '
		});

		// Create the news fader toggle.
		var smfNewsFadeToggle = new smc_Toggle({
			bToggleEnabled: true,
			bCurrentlyCollapsed: ', empty($options['collapse_news_fader']) ? 'false' : 'true', ',
			aSwappableContainers: [
				\'newsfader\'
			],
			aSwapImages: [
				{
					sId: \'newsupshrink\',
					srcExpanded: smf_images_url + \'/collapse.gif\',
					altExpanded: ', JavaScriptEscape($txt['upshrink_description']), ',
					srcCollapsed: smf_images_url + \'/expand.gif\',
					altCollapsed: ', JavaScriptEscape($txt['upshrink_description']), '
				}
			],
			oThemeOptions: {
				bUseThemeSettings: ', $context['user']['is_guest'] ? 'false' : 'true', ',
				sOptionName: \'collapse_news_fader\',
				sSessionVar: ', JavaScriptEscape($context['session_var']), ',
				sSessionId: ', JavaScriptEscape($context['session_id']), '
			},
			oCookieOptions: {
				bUseCookie: ', $context['user']['is_guest'] ? 'true' : 'false', ',
				sCookieName: \'newsupshrink\'
			}
		});
	// ]]></script>';
    }
    echo '
	<div id="boardindex_table">';
    $first = true;
    foreach ($context['categories'] as $category) {
        // If theres no parent boards we can see, avoid showing an empty category (unless its collapsed)
        if (empty($category['boards']) && !$category['is_collapsed']) {
            continue;
        }
        echo '
		<div class="catbg', !$first ? ' catbg2' : '', '">';
        if (!$category['is_collapsed']) {
            echo '
			<span class="floatright circleborder">', my_toggle($category['id'], 'category_boards_' . $category['id']), '</span>';
        }
        echo '
			<h3>', $category['link'], '</h3>
			<p class="subtitle">';
        if (!$context['user']['is_guest'] && !empty($category['show_unread'])) {
            echo '
				<a class="unreadlink" href="', $scripturl, '?action=unread;c=', $category['id'], '">', $txt['view_unread_category'], '</a>';
        }
        // If this category even can collapse, show a link to collapse it.
        if ($category['can_collapse']) {
            echo '
				<a href="', $category['collapse_href'], '"> | ', $category['is_collapsed'] ? $txt['o_toggle2'] : $txt['o_toggle'], '</a>';
        }
        echo '
			</p>
		</div>';
        $alt = true;
        // Assuming the category hasn't been collapsed...
        if (!$category['is_collapsed']) {
            echo '
		<div id="category_boards_', $category['id'], '" class="', !empty($options['togglecat' . $category['id']]) ? '' : 'no', 'togglecat">';
            template_board($category['boards']);
            echo '
		</div>';
        }
    }
    echo '
	</div>
	<div class="themepadding">';
    if ($context['user']['is_logged']) {
        // Mark read button.
        $mark_read_button = array('markread' => array('text' => 'mark_as_read', 'image' => 'markread.gif', 'lang' => true, 'url' => $scripturl . '?action=markasread;sa=all;' . $context['session_var'] . '=' . $context['session_id']));
        // Show the mark all as read button?
        if ($settings['show_mark_read'] && !empty($context['categories'])) {
            echo '<div class="mark_read">', template_button_strip($mark_read_button, 'right'), '</div>';
        }
    }
    echo '
	</div>';
    template_info_center();
}