Пример #1
0
/**
 * This is quick reply area below all the message body's
 */
function template_quickreply_below()
{
    global $context, $options, $settings, $txt, $modSettings, $scripturl;
    // Yeah, I know, though at the moment is the only way...
    global $removableMessageIDs, $ignoredMsgs;
    // Using the quick reply box below the messages and you can reply?
    if ($context['can_reply'] && !empty($options['display_quick_reply'])) {
        echo '
			<a id="quickreply"></a>
			<div class="forumposts" id="quickreplybox">
				<h2 class="category_header">
					<span id="category_toggle">&nbsp;
						<a href="javascript:oQuickReply.swap();">
							<span id="quickReplyExpand" class="', empty($context['minmax_preferences']['qreply']) ? 'collapse' : 'expand', '" title="', $txt['hide'], '"></span>
						</a>
					</span>
					<a href="javascript:oQuickReply.swap();">', $txt['quick_reply'], '</a>
				</h2>
				<div id="quickReplyOptions" class="windowbg"', empty($context['minmax_preferences']['qreply']) ? '' : ' style="display: none"', '>
					<div class="editor_wrapper">
						', $context['is_locked'] ? '<p class="alert smalltext">' . $txt['quick_reply_warning'] . '</p>' : '', $context['oldTopicError'] ? '<p class="alert smalltext">' . sprintf($txt['error_old_topic'], $modSettings['oldTopicDays']) . '</p>' : '', '
						', $context['can_reply_approved'] ? '' : '<em>' . $txt['wait_for_approval'] . '</em>', '
						', !$context['can_reply_approved'] && $context['require_verification'] ? '<br />' : '', '
						<form action="', $scripturl, '?board=', $context['current_board'], ';action=post2" method="post" accept-charset="UTF-8" name="postmodify" id="postmodify" onsubmit="submitonce(this);', !empty($modSettings['mentions_enabled']) ? 'revalidateMentions(\'postmodify\', \'' . (empty($options['use_editor_quick_reply']) ? 'message' : $context['post_box_name']) . '\');' : '', '">
							<input type="hidden" name="topic" value="', $context['current_topic'], '" />
							<input type="hidden" name="subject" value="', $context['response_prefix'], $context['subject'], '" />
							<input type="hidden" name="icon" value="xx" />
							<input type="hidden" name="from_qr" value="1" />
							<input type="hidden" name="notify" value="', $context['is_marked_notify'] || !empty($options['auto_notify']) ? '1' : '0', '" />
							<input type="hidden" name="not_approved" value="', !$context['can_reply_approved'], '" />
							<input type="hidden" name="goback" value="', empty($options['return_to_post']) ? '0' : '1', '" />
							<input type="hidden" name="last_msg" value="', $context['topic_last_message'], '" />
							<input type="hidden" name="', $context['session_var'], '" value="', $context['session_id'], '" />
							<input type="hidden" name="seqnum" value="', $context['form_sequence_number'], '" />';
        // Guests just need more.
        if ($context['user']['is_guest']) {
            echo '
							<dl>
								<dt>
									<strong><label for="guestname">', $txt['name'], '</label>:</strong> <input type="text" name="guestname" id="guestname" value="', $context['name'], '" size="25" class="input_text" tabindex="', $context['tabindex']++, '" />
								</dd>
								<dt>
									<strong><label for="email">', $txt['email'], '</label>:</strong> <input type="text" name="email" id="email" value="', $context['email'], '" size="25" class="input_text" tabindex="', $context['tabindex']++, '" />
								</dd>
							</dl>';
        }
        // Is visual verification enabled?
        if ($context['require_verification']) {
            template_verification_controls($context['visual_verification_id'], '
							<strong>' . $txt['verification'] . ':</strong>', '<br />');
        }
        // Using the full editor or a plain text box?
        if (empty($options['use_editor_quick_reply'])) {
            echo '
							<div class="quickReplyContent">
								<textarea cols="600" rows="7" class="quickreply" name="message" id="message" tabindex="', $context['tabindex']++, '"></textarea>
							</div>';
        } else {
            echo '
							', template_control_richedit($context['post_box_name'], 'smileyBox_message', 'bbcBox_message');
        }
        echo '
							<div id="post_confirm_buttons" class="submitbutton">
								<input type="submit" name="post" value="', $txt['post'], '" onclick="return submitThisOnce(this);" accesskey="s" tabindex="', $context['tabindex']++, '" class="button_submit" />
								<input type="submit" name="preview" value="', $txt['preview'], '" onclick="return submitThisOnce(this);" accesskey="p" tabindex="', $context['tabindex']++, '" class="button_submit" />';
        // Spellcheck button?
        if ($context['show_spellchecking']) {
            echo '
								<input type="button" value="', $txt['spell_check'], '" onclick="spellCheck(\'postmodify\', \'message\', ', empty($options['use_editor_quick_reply']) ? 'false' : 'true', ')" tabindex="', $context['tabindex']++, '" class="button_submit" />';
        }
        // Draft save button?
        if (!empty($context['drafts_save'])) {
            echo '
								<input type="submit" name="save_draft" value="', $txt['draft_save'], '" onclick="return confirm(' . JavaScriptEscape($txt['draft_save_note']) . ') && submitThisOnce(this);" accesskey="d" tabindex="', $context['tabindex']++, '" class="button_submit" />
								<input type="hidden" id="id_draft" name="id_draft" value="', empty($context['id_draft']) ? 0 : $context['id_draft'], '" />';
        }
        echo '
							</div>';
        // Show the draft last saved on area
        if (!empty($context['drafts_autosave']) && !empty($options['drafts_autosave_enabled'])) {
            echo '
							<div class="draftautosave">
								<span id="throbber" style="display:none"><i class="fa fa-spinner fa-spin"></i>&nbsp;</span>
								<span id="draft_lastautosave"></span>
							</div>';
        }
        echo '
						</form>
					</div>
				</div>
			</div>';
        // Using the plain text box we need to load in some additonal javascript
        if (empty($options['use_editor_quick_reply'])) {
            echo '
			<script><!-- // --><![CDATA[';
            // Draft autosave available and the user has it enabled?
            if (!empty($context['drafts_autosave']) && !empty($options['drafts_autosave_enabled'])) {
                echo '
				var oDraftAutoSave = new elk_DraftAutoSave({
					sSelf: \'oDraftAutoSave\',
					sLastNote: \'draft_lastautosave\',
					sLastID: \'id_draft\',
					iBoard: ', empty($context['current_board']) ? 0 : $context['current_board'], ',
					iFreq: ', isset($context['drafts_autosave_frequency']) ? $context['drafts_autosave_frequency'] : 30000, '
				});';
            }
            // Mentions enabled
            if (!empty($modSettings['mentions_enabled'])) {
                echo '
				add_elk_mention(\'#message\');';
            }
            echo '
			// ]]></script>';
        }
    }
    // Finally enable the quick reply quote function
    echo '
		<script><!-- // --><![CDATA[
			var oQuickReply = new QuickReply({
				bDefaultCollapsed: ', empty($context['minmax_preferences']['qreply']) ? 'false' : 'true', ',
				iTopicId: ', $context['current_topic'], ',
				iStart: ', $context['start'], ',
				sScriptUrl: elk_scripturl,
				sImagesUrl: elk_images_url,
				sContainerId: "quickReplyOptions",
				sClassId: "quickReplyExpand",
				sClassCollapsed: "collapse",
				sTitleCollapsed: ', JavaScriptEscape($txt['show']), ',
				sClassExpanded: "expand",
				sTitleExpanded: ', JavaScriptEscape($txt['hide']), ',
				sJumpAnchor: "quickreply",
				bIsFull: ', !empty($options['use_editor_quick_reply']) ? 'true,
				sEditorId: ' . $options['use_editor_quick_reply'] : 'false', ',
				oThemeOptions: {
					bUseThemeSettings: ', $context['user']['is_guest'] ? 'false' : 'true', ',
					sOptionName: \'minmax_preferences\',
					sSessionId: elk_session_id,
					sSessionVar: elk_session_var,
					sAdditionalVars: \';minmax_key=qreply\'
				},
				oCookieOptions: {
					bUseCookie: ', $context['user']['is_guest'] ? 'true' : 'false', ',
					sCookieName: \'elk_qreply\'
				}
			});
		// ]]></script>';
    // Spell check for quick modify and quick reply (w/o the editor)
    if ($context['show_spellchecking']) {
        echo '
			<form name="spell_form" id="spell_form" method="post" accept-charset="UTF-8" target="spellWindow" action="', $scripturl, '?action=spellcheck">
				<input type="hidden" id="spellstring" name="spellstring" value="" />
				<input type="hidden" id="fulleditor" name="fulleditor" value="" />
			</form>';
    }
    // Quick moderation options
    echo '
			<script><!-- // --><![CDATA[';
    if (!empty($options['display_quick_mod']) && $options['display_quick_mod'] == 1 && $context['can_remove_post']) {
        echo '
				var oInTopicModeration = new InTopicModeration({
					sSelf: \'oInTopicModeration\',
					sCheckboxContainerMask: \'in_topic_mod_check_\',
					aMessageIds: [\'', implode('\', \'', $removableMessageIDs), '\'],
					sSessionId: elk_session_id,
					sSessionVar: elk_session_var,
					sButtonStrip: \'moderationbuttons\',
					sButtonStripDisplay: \'moderationbuttons_strip\',
					sButtonStripClass: \'menuitem\',
					bUseImageButton: false,
					bCanRemove: ', $context['can_remove_post'] ? 'true' : 'false', ',
					sRemoveButtonLabel: \'', $txt['quickmod_delete_selected'], '\',
					sRemoveButtonImage: \'delete_selected.png\',
					sRemoveButtonConfirm: \'', $txt['quickmod_confirm'], '\',
					bCanRestore: ', $context['can_restore_msg'] ? 'true' : 'false', ',
					sRestoreButtonLabel: \'', $txt['quick_mod_restore'], '\',
					sRestoreButtonImage: \'restore_selected.png\',
					sRestoreButtonConfirm: \'', $txt['quickmod_confirm'], '\',
					bCanSplit: ', $context['can_split'] ? 'true' : 'false', ',
					sSplitButtonLabel: \'', $txt['quickmod_split_selected'], '\',
					sSplitButtonImage: \'split_selected.png\',
					sSplitButtonConfirm: \'', $txt['quickmod_confirm'], '\',
					sFormId: \'quickModForm\'
				});';
    }
    // Quick modify can be used
    echo '
				var oQuickModify = new QuickModify({
					sIconHide: \'xx.png\',
					sScriptUrl: elk_scripturl,
					sClassName: \'quick_edit\',
					sIDSubject: \'post_subject_\',
					sIDInfo: \'info_\',
					bShowModify: ', $settings['show_modify'] ? 'true' : 'false', ',
					iTopicId: ', $context['current_topic'], ',
					sTemplateBodyEdit: ', JavaScriptEscape('
						<div id="quick_edit_body_container" style="width: 90%;">
							<div id="error_box" class="errorbox" style="display:none;"></div>
							<textarea class="editor" name="message" rows="12" style="' . (isBrowser('is_ie8') ? 'width: 635px; max-width: 100%; min-width: 100%' : 'width: 100%') . '; margin-bottom: 10px;" tabindex="' . $context['tabindex']++ . '">%body%</textarea><br />
							<input type="hidden" name="\' + elk_session_var + \'" value="\' + elk_session_id + \'" />
							<input type="hidden" name="topic" value="' . $context['current_topic'] . '" />
							<input type="hidden" name="msg" value="%msg_id%" />
							<div class="righttext">
								<input type="submit" name="post" value="' . $txt['save'] . '" tabindex="' . $context['tabindex']++ . '" onclick="return oQuickModify.modifySave(\'' . $context['session_id'] . '\', \'' . $context['session_var'] . '\');" accesskey="s" class="button_submit" />&nbsp;&nbsp;' . ($context['show_spellchecking'] ? '<input type="button" value="' . $txt['spell_check'] . '" tabindex="' . $context['tabindex']++ . '" onclick="spellCheck(\'quickModForm\', \'message\', false);" class="button_submit" />&nbsp;&nbsp;' : '') . '<input type="submit" name="cancel" value="' . $txt['modify_cancel'] . '" tabindex="' . $context['tabindex']++ . '" onclick="return oQuickModify.modifyCancel();" class="button_submit" />
							</div>
						</div>'), ',
					sTemplateBodyNormal: ', JavaScriptEscape('%body%'), ',
					sTemplateSubjectEdit: ', JavaScriptEscape('<input type="text" style="width: 85%;" name="subject" value="%subject%" size="80" maxlength="80" tabindex="' . $context['tabindex']++ . '" class="input_text" />'), ',
					sTemplateSubjectNormal: ', JavaScriptEscape('%subject%'), ',
					sTemplateTopSubject: ', JavaScriptEscape($txt['topic'] . ': %subject% &nbsp;(' . $context['num_views_text'] . ')'), ',
					sTemplateInfoNormal: ', JavaScriptEscape('<a href="' . $scripturl . '?topic=' . $context['current_topic'] . '.msg%msg_id%#msg%msg_id%" rel="nofollow">%subject%</a><span class="smalltext modified" id="modified_%msg_id%"></span>'), $context['can_reply'] && !empty($options['display_quick_reply']) ? ',
					sFormRemoveAccessKeys: \'postmodify\'' : '', ',
					funcOnAfterCreate: function () {
						// Attach AtWho to the quick edit box
						add_elk_mention(\'#quick_edit_body_container textarea\');
						var i = all_elk_mentions.length - 1;
						all_elk_mentions[i].oMention = new elk_mentions(all_elk_mentions[i].oOptions);
					}
				});

				aIconLists[aIconLists.length] = new IconList({
					sBackReference: "aIconLists[" + aIconLists.length + "]",
					sIconIdPrefix: "msg_icon_",
					sScriptUrl: elk_scripturl,
					bShowModify: ', $settings['show_modify'] ? 'true' : 'false', ',
					iBoardId: ', $context['current_board'], ',
					iTopicId: ', $context['current_topic'], ',
					sSessionId: elk_session_id,
					sSessionVar: elk_session_var,
					sAction: "messageicons;board=', $context['current_board'], '" ,
					sLabelIconList: "', $txt['message_icon'], '",
					sBoxBackground: "transparent",
					sBoxBackgroundHover: "#ffffff",
					iBoxBorderWidthHover: 1,
					sBoxBorderColorHover: "#adadad" ,
					sContainerBackground: "#ffffff",
					sContainerBorder: "1px solid #adadad",
					sItemBorder: "1px solid #ffffff",
					sItemBorderHover: "1px dotted gray",
					sItemBackground: "transparent",
					sItemBackgroundHover: "#e0e0f0"
				});';
    if (!empty($ignoredMsgs)) {
        echo '
				ignore_toggles([', implode(', ', $ignoredMsgs), '], ', JavaScriptEscape($txt['show_ignore_user_post']), ');';
    }
    echo '
			// ]]></script>';
}
/**
 * Main search page. Allows the user to search the forum according to criteria.
 */
function template_searchform()
{
    global $context, $settings, $txt, $scripturl, $modSettings;
    echo '
				<form action="', $scripturl, '?action=search;sa=results" method="post" accept-charset="UTF-8" name="searchform" id="searchform" class="standard_category">
					<h2 class="category_header', !empty($settings['use_buttons']) ? ' hdicon cat_img_search' : '', '">
						', $txt['set_parameters'], '
					</h2>';
    // Any search errors to inform the user about
    if (!empty($context['search_errors'])) {
        echo '
					<p class="errorbox">', implode('<br />', $context['search_errors']['messages']), '</p>';
    }
    // Start off showing our basic search form
    echo '
					<fieldset id="simple_search" class="content">
						<div id="search_term_input">
							<label for="search">
								<strong>', $txt['search_for'], '</strong>
							</label>:
							<input type="search" id="search" class="input_text" name="search" value="', $context['search_params']['search'], '" maxlength="', $context['search_string_limit'], '" size="40" placeholder="' . $txt['search'] . '" required="required" autofocus="autofocus" />', '
							<input id="submit" type="submit" name="s_search" value="' . $txt['search'] . '" class="button_submit"/>
						</div>';
    if (empty($modSettings['search_simple_fulltext'])) {
        echo '
						<p class="smalltext">', $txt['search_example'], '</p>';
    }
    // Does the search require a visual verification screen to annoy them?
    if ($context['require_verification']) {
        template_verification_controls($context['visual_verification_id'], '
						<div class="verification">
							<strong>' . $txt['search_visual_verification_label'] . ':</strong>
							<br />', '
						</div>');
    }
    // All of the advanced options, this div is collapsed by the JS when available
    echo '
						<div id="advanced_search" class="content">
							<dl id="search_options">
								<dt class="righttext"><label for="searchtype">
									', $txt['search_match'], ':</label>
								</dt>
								<dd>
									<select name="searchtype" id="searchtype">
										<option value="1"', empty($context['search_params']['searchtype']) ? ' selected="selected"' : '', '>', $txt['all_words'], '</option>
										<option value="2"', !empty($context['search_params']['searchtype']) ? ' selected="selected"' : '', '>', $txt['any_words'], '</option>
									</select>
								</dd>
								<dt class="righttext">
									<label for="userspec">', $txt['by_user'], ':</label>
								</dt>
								<dd>
									<input id="userspec" type="text" name="userspec" value="', $context['search_params']['userspec'], '" size="40" class="input_text" />
								</dd>
								<dt class="righttext">
									<label for="sort">', $txt['search_order'], ':</label>
								</dt>
								<dd>
									<select id="sort" name="sort">
										<option value="relevance|desc">', $txt['search_orderby_relevant_first'], '</option>
										<option value="num_replies|desc">', $txt['search_orderby_large_first'], '</option>
										<option value="num_replies|asc">', $txt['search_orderby_small_first'], '</option>
										<option value="id_msg|desc">', $txt['search_orderby_recent_first'], '</option>
										<option value="id_msg|asc">', $txt['search_orderby_old_first'], '</option>
									</select>
								</dd>
								<dt class="righttext options">
									', $txt['search_options'], ':
								</dt>
								<dd class="options">
									<label for="show_complete">', $txt['search_show_complete_messages'], '
										<input type="checkbox" name="show_complete" id="show_complete" value="1"', !empty($context['search_params']['show_complete']) ? ' checked="checked"' : '', ' class="input_check" />
									</label><br />
									<label for="subject_only">', $txt['search_subject_only'], '
										<input type="checkbox" name="subject_only" id="subject_only" value="1"', !empty($context['search_params']['subject_only']) ? ' checked="checked"' : '', ' class="input_check" />
									</label>
								</dd>
								<dt class="righttext between">
									', $txt['search_post_age'], ':
								</dt>
								<dd><label for="minage">
									', $txt['search_between'], '</label><input type="text" name="minage" id="minage" value="', $context['search_params']['minage'], '" size="5" maxlength="4" class="input_text" />&nbsp;<label for="maxage">', $txt['search_and'], '&nbsp;</label><input type="text" name="maxage" id="maxage" value="', $context['search_params']['maxage'], '" size="5" maxlength="4" class="input_text" /> ', $txt['days_word'], '
								</dd>
							</dl>
						</div>
						<a id="upshrink_link" href="', $scripturl, '?action=search;advanced" class="linkbutton" style="display:none">', $txt['search_simple'], '</a>';
    // Set the initial search style for the form
    echo '
						<input id="advanced" type="hidden" name="advanced" value="1" />';
    // If $context['search_params']['topic'] is set, that means we're searching just one topic.
    if (!empty($context['search_params']['topic'])) {
        echo '
						<p>', $txt['search_specific_topic'], ' &quot;', $context['search_topic']['link'], '&quot;.</p>
						<input type="hidden" name="topic" value="', $context['search_topic']['id'], '" />';
    }
    echo '
					</fieldset>';
    // This starts our selection area to allow searching by specific boards
    if (empty($context['search_params']['topic'])) {
        echo '
					<fieldset id="pick_boards" class="content">';
        template_pick_boards('searchform');
        echo '
					</fieldset>';
    }
    echo '
				</form>';
    // And now all the JS to make this work
    addInlineJavascript('
		createEventListener(window);
		window.addEventListener("load", initSearch, false);

		var oAddMemberSuggest = new smc_AutoSuggest({
			sSelf: \'oAddMemberSuggest\',
			sSessionId: elk_session_id,
			sSessionVar: elk_session_var,
			sControlId: \'userspec\',
			sSearchType: \'member\',
			bItemList: false
		});

		// Set the search style
		document.getElementById(\'advanced\').value = "' . (empty($context['minmax_preferences']['asearch']) ? '1' : '0') . '";

		// And allow for the collapsing of the advanced search options
		var oSearchToggle = new elk_Toggle({
			bToggleEnabled: true,
			bCurrentlyCollapsed: ' . (empty($context['minmax_preferences']['asearch']) ? 'false' : 'true') . ',
			funcOnBeforeCollapse: function () {
				document.getElementById(\'advanced\').value = \'0\';
			},
			funcOnBeforeExpand: function () {
				document.getElementById(\'advanced\').value = \'1\';
			},
			aSwappableContainers: [
				\'advanced_search\'
			],
			aSwapLinks: [
				{
					sId: \'upshrink_link\',
					msgExpanded: ' . JavaScriptEscape($txt['search_simple']) . ',
					msgCollapsed: ' . JavaScriptEscape($txt['search_advanced']) . '
				}
			],
			oThemeOptions: {
				bUseThemeSettings: ' . ($context['user']['is_guest'] ? 'false' : 'true') . ',
				sOptionName: \'minmax_preferences\',
				sSessionId: elk_session_id,
				sSessionVar: elk_session_var,
				sAdditionalVars: \';minmax_key=asearch\'
			},
		});', true);
}
Пример #3
0
/**
 * The area below the postbox
 * Typically holds our action buttons, save, preivew, drafts, etc
 * Oh and lots of JS ;)
 */
function template_postarea_below()
{
    global $context, $txt, $counter, $settings;
    // Is visual verification enabled?
    if ($context['require_verification']) {
        template_verification_controls($context['visual_verification_id'], '
						<div class="post_verification">
							<span' . (!empty($context['post_error']['need_qr_verification']) ? ' class="error"' : '') . '>
								<strong>' . $txt['verification'] . ':</strong>
							</span>
							', '
						</div>');
    }
    echo '
					</div>
				</div>
			</div>';
    // Assuming this isn't a new topic pass across the last message id.
    if (isset($context['topic_last_message'])) {
        echo '
			<input type="hidden" name="last_msg" value="', $context['topic_last_message'], '" />';
    }
    // If we are starting a new topic starting from another one, here is the place to remember some details
    if (!empty($context['original_post'])) {
        echo '
			<input type="hidden" name="followup" value="' . $context['original_post'] . '" />';
    }
    echo '
			<input type="hidden" name="additional_options" id="additional_options" value="', $context['show_additional_options'] ? '1' : '0', '" />
			<input type="hidden" name="', $context['session_var'], '" value="', $context['session_id'], '" />
			<input type="hidden" name="seqnum" value="', $context['form_sequence_number'], '" />
		</form>';
    // The variables used to preview a post without loading a new page.
    echo '
		<script><!-- // --><![CDATA[
			var form_name = "postmodify",
				preview_area = "post",
				current_board = ', empty($context['current_board']) ? 'null' : $context['current_board'], ',
				txt_preview_title = "', $txt['preview_title'], '",
				txt_preview_fetch = "', $txt['preview_fetch'], '",
				make_poll = ', $context['make_poll'] ? 'true' : 'false', ',
				new_replies = new Array(),
				reply_counter = ', empty($counter) ? 0 : $counter, ',
				can_quote = ', $context['can_quote'] ? 'true' : 'false', ',
				show_ignore_user_post = "', $txt['show_ignore_user_post'], '",
				txt_bbc_quote = "', $txt['bbc_quote'], '",
				txt_ignoring_user = "******",
				txt_new = "', $txt['new'], '",
				txt_posted_by = "', $txt['posted_by'], '",
				txt_on = "', $txt['on'], '";';
    // Code for showing and hiding additional options.
    if (!empty($settings['additional_options_collapsible'])) {
        echo '
			var oSwapAdditionalOptions = new elk_Toggle({
				bToggleEnabled: true,
				bCurrentlyCollapsed: ', empty($context['minmax_preferences']['post']) ? 'false' : 'true', ',
				funcOnBeforeCollapse: function () {
					document.getElementById(\'additional_options\').value = \'0\';
				},
				funcOnBeforeExpand: function () {
					document.getElementById(\'additional_options\').value = \'1\';
				},
				aSwappableContainers: [
					\'postAdditionalOptions\',
				],
				aSwapClasses: [
					{
						sId: \'postMoreExpand\',
						classExpanded: \'collapse\',
						titleExpanded: ', JavaScriptEscape($txt['hide']), ',
						classCollapsed: \'expand\',
						titleCollapsed: ', JavaScriptEscape($txt['show']), '
					}
				],
				aSwapLinks: [
					{
						sId: \'postMoreExpandLink\',
						msgExpanded: ', JavaScriptEscape($context['attachments']['can']['post'] ? $txt['post_additionalopt_attach'] : $txt['post_additionalopt']), ',
						msgCollapsed: ', JavaScriptEscape($context['attachments']['can']['post'] ? $txt['post_additionalopt_attach'] : $txt['post_additionalopt']), '
					}
				],
				oThemeOptions: {
					bUseThemeSettings: ', $context['user']['is_guest'] ? 'false' : 'true', ',
					sOptionName: \'minmax_preferences\',
					sSessionId: elk_session_id,
					sSessionVar: elk_session_var,
					sAdditionalVars: \';minmax_key=post\'
				},
			});';
    }
    echo '
		// ]]></script>';
    template_topic_replies_below();
}
Пример #4
0
/**
 * Interface for contact form.
 */
function template_contact_form()
{
    global $context, $scripturl, $txt;
    echo '
		<h2 class="category_header">', $txt['admin_contact_form'], '</h2>
		<form id="contact_form" class="windowbg2" action="', $scripturl, '?action=contact" method="post" accept-charset="UTF-8">
			<div class="content">';
    if (!empty($context['errors'])) {
        echo '
				<div class="errorbox">', $txt['errors_contact_form'], ': <ul><li>', implode('</li><li>', $context['errors']), '</li></ul></div>';
    }
    echo '
				<dl class="settings">
					<dt>
						<label for="emailaddress">', $txt['admin_register_email'], '</label>
					</dt>
					<dd>
						<input type="email" name="emailaddress" id="emailaddress" value="', !empty($context['emailaddress']) ? $context['emailaddress'] : '', '" tabindex="', $context['tabindex']++, '" />
					</dd>
					<dt>
						<label for="contactmessage">', $txt['contact_your_message'], '</label>
					</dt>
					<dd>
						<textarea id="contactmessage" name="contactmessage" cols="50" rows="10" tabindex="', $context['tabindex']++, '">', !empty($context['contactmessage']) ? $context['contactmessage'] : '', '</textarea>
					</dd>';
    if ($context['require_verification']) {
        template_verification_controls($context['visual_verification_id'], '
					<dt>
							' . $txt['verification'] . ':
					</dt>
					<dd>
							', '
					</dd>');
    }
    echo '
				</dl>
				<hr />
				<div class="submitbutton" >
					<input type="submit" value="', $txt['sendtopic_send'], '" name="send" tabindex="', $context['tabindex']++, '" class="button_submit" />
					<input type="hidden" name="sa" value="reservednames" />
					<input type="hidden" name="', $context['session_var'], '" value="', $context['session_id'], '" />
					<input type="hidden" name="', $context['contact_token_var'], '" value="', $context['contact_token'], '" />
				</div>
			</div>
		</form>';
}
/**
 * Show the send a new pm form, including the editor, preview section and load
 * drafts if enabled.
 */
function template_send()
{
    global $context, $scripturl, $modSettings, $settings, $txt;
    // Show which messages were sent successfully and which failed.
    if (!empty($context['send_log'])) {
        echo '
			<div class="forumposts">
				<h3 class="category_header">', $txt['pm_send_report'], '</h3>
				<div class="windowbg">
					<div class="content">';
        if (!empty($context['send_log']['sent'])) {
            foreach ($context['send_log']['sent'] as $log_entry) {
                echo '<span class="error">', $log_entry, '</span><br />';
            }
        }
        if (!empty($context['send_log']['failed'])) {
            foreach ($context['send_log']['failed'] as $log_entry) {
                echo '<span class="error">', $log_entry, '</span><br />';
            }
        }
        echo '
					</div>
				</div>
			</div>';
    }
    // Show the preview of the personal message.
    echo '
		<div id="preview_section" class="forumposts"', isset($context['preview_message']) ? '' : ' style="display: none;"', '>
			<h3 class="category_header">
				<span id="preview_subject">', empty($context['preview_subject']) ? '' : $context['preview_subject'], '</span>
			</h3>
			<div class="post" id="preview_body">
				', empty($context['preview_message']) ? '<br />' : $context['preview_message'], '
			</div>
		</div>';
    // Main message editing box.
    echo '
	<form action="', $scripturl, '?action=pm;sa=send2" method="post" accept-charset="UTF-8" name="pmFolder" id="pmFolder" class="flow_hidden" onsubmit="submitonce(this);smc_saveEntities(\'pmFolder\', [\'subject\', \'message\']);">
		<div class="forumposts">
			<h3 class="category_header hdicon cat_img_write">
				', $txt['new_message'], '
			</h3>';
    echo '
			<div class="windowbg">
				<div class="editor_wrapper">';
    // If there were errors for sending the PM, show them.
    template_show_error('post_error');
    if (!empty($modSettings['drafts_pm_enabled'])) {
        echo '
					<div id="draft_section" class="successbox"', isset($context['draft_saved']) ? '' : ' style="display: none;"', '>', sprintf($txt['draft_pm_saved'], $scripturl . '?action=pm;sa=showpmdrafts'), '
					</div>';
    }
    echo '
					<dl id="post_header">';
    // To and bcc. Include a button to search for members.
    echo '
						<dt>
							<label for="to_control"', isset($context['post_error']['no_to']) || isset($context['post_error']['bad_to']) ? ' class="error"' : '', ' id="caption_to">', $txt['pm_to'], ':</label>
						</dt>';
    // Autosuggest will be added by the javascript later on.
    echo '
						<dd id="pm_to" class="clear_right">
							<input type="text" name="to" id="to_control" value="', $context['to_value'], '" tabindex="', $context['tabindex']++, '" size="40" style="width: 130px;" class="input_text" />';
    // A link to add BCC, only visible with javascript enabled.
    echo '
							<span class="smalltext" id="bcc_link_container" style="display: none;"></span>';
    // A div that'll contain the items found by the autosuggest.
    echo '
							<div id="to_item_list_container"></div>';
    echo '
						</dd>';
    // This BCC row will be hidden by default if javascript is enabled.
    echo '
						<dt  class="clear_left" id="bcc_div">
							<label for="bcc_control"', isset($context['post_error']['no_to']) || isset($context['post_error']['bad_bcc']) ? ' class="error"' : '', ' id="caption_bbc">', $txt['pm_bcc'], ':</label>
						</dt>
						<dd id="bcc_div2">
							<input type="text" name="bcc" id="bcc_control" value="', $context['bcc_value'], '" tabindex="', $context['tabindex']++, '" size="40" style="width: 130px;" class="input_text" />
							<div id="bcc_item_list_container"></div>
						</dd>';
    // The subject of the PM.
    echo '
						<dt class="clear_left">
							<label for="subject"', isset($context['post_error']['no_subject']) ? ' class="error"' : '', ' id="caption_subject">', $txt['subject'], ':</label>
						</dt>
						<dd id="pm_subject">
							<input type="text" id="subject" name="subject" value="', $context['subject'], '" tabindex="', $context['tabindex']++, '" size="80" maxlength="80"', isset($context['post_error']['no_subject']) ? ' class="error"' : ' class="input_text"', ' placeholder="', $txt['subject'], '" required="required" />
						</dd>
					</dl>';
    // Show BBC buttons, smileys and textbox.
    echo '
					', template_control_richedit($context['post_box_name'], 'smileyBox_message', 'bbcBox_message');
    // Require an image to be typed to save spamming?
    if ($context['require_verification']) {
        template_verification_controls($context['visual_verification_id'], '
					<div class="post_verification">
						<strong>' . $txt['pm_visual_verification_label'] . ':</strong>
						', '
					</div>');
    }
    // Send, Preview, spellchecker buttons.
    echo '
					<div id="post_confirm_buttons" class="submitbutton">
						', template_control_richedit_buttons($context['post_box_name']), '
					</div>
					<input type="hidden" name="', $context['session_var'], '" value="', $context['session_id'], '" />
					<input type="hidden" name="seqnum" value="', $context['form_sequence_number'], '" />
					<input type="hidden" name="replied_to" value="', !empty($context['quoted_message']['id']) ? $context['quoted_message']['id'] : 0, '" />
					<input type="hidden" name="pm_head" value="', !empty($context['quoted_message']['pm_head']) ? $context['quoted_message']['pm_head'] : 0, '" />
					<input type="hidden" name="f" value="', isset($context['folder']) ? $context['folder'] : '', '" />
					<input type="hidden" name="l" value="', isset($context['current_label_id']) ? $context['current_label_id'] : -1, '" />';
    // If the admin enabled the pm drafts feature, show a draft selection box
    if (!empty($modSettings['drafts_enabled']) && !empty($context['drafts_pm_save']) && !empty($context['drafts'])) {
        echo '
			<h3 id="postDraftOptionsHeader" class="category_header">
				<span id="category_toggle">&nbsp;
					<span id="postDraftExpand" class="', empty($context['minmax_preferences']['pmdraft']) ? 'collapse' : 'expand', '" style="display: none;" title="', $txt['hide'], '"></span>
				</span>
				<a href="#" id="postDraftExpandLink">', $txt['draft_load'], '</a>
			</h3>
			<div id="postDraftOptions" class="load_drafts padding"', empty($context['minmax_preferences']['pmdraft']) ? '' : ' style="display: none;"', '>
				<dl class="settings">
					<dt><strong>', $txt['subject'], '</strong></dt>
					<dd><strong>', $txt['draft_saved_on'], '</strong></dd>';
        foreach ($context['drafts'] as $draft) {
            echo '
					<dt>', $draft['link'], '</dt>
					<dd>', $draft['poster_time'], '</dd>';
        }
        echo '
				</dl>
			</div>';
    }
    echo '
				</div>
			</div>
		</div>
	</form>';
    // The vars used to preview a personal message without loading a new page.
    echo '
		<script><!-- // --><![CDATA[
			var form_name = "pmFolder",
				preview_area = "pm",
				txt_preview_title = "', $txt['preview_title'], '",
				txt_preview_fetch = "', $txt['preview_fetch'], '";';
    // Code for showing and hiding drafts
    if (!empty($context['drafts'])) {
        echo '
			var oSwapDraftOptions = new elk_Toggle({
				bToggleEnabled: true,
				bCurrentlyCollapsed: ', empty($context['minmax_preferences']['pmdraft']) ? 'false' : 'true', ',
				aSwappableContainers: [
					\'postDraftOptions\',
				],
				aSwapClasses: [
					{
						sId: \'postDraftExpand\',
						classExpanded: \'collapse\',
						titleExpanded: ', JavaScriptEscape($txt['hide']), ',
						classCollapsed: \'expand\',
						titleCollapsed: ', JavaScriptEscape($txt['show']), '
					}
				],
				aSwapLinks: [
					{
						sId: \'postDraftExpandLink\',
						msgExpanded: ', JavaScriptEscape($txt['draft_hide']), ',
						msgCollapsed: ', JavaScriptEscape($txt['draft_load']), '
					}
				],
				oThemeOptions: {
					bUseThemeSettings: ', $context['user']['is_guest'] ? 'false' : 'true', ',
					sOptionName: \'minmax_preferences\',
					sSessionId: elk_session_id,
					sSessionVar: elk_session_var,
					sAdditionalVars: \';minmax_key=pmdraft\'
				},
			});';
    }
    echo '
		// ]]></script>';
    // Show the message you're replying to.
    if ($context['reply']) {
        echo '

	<div class="forumposts">
		<h3 class="category_header">', $txt['subject'], ': ', $context['quoted_message']['subject'], '</h3>
		<div class="windowbg2">
			<div class="content">
				<div class="clear">
					<span class="smalltext floatright">', $txt['on'], ': ', $context['quoted_message']['time'], '</span>
					<strong>', $txt['from'], ': ', $context['quoted_message']['member']['name'], '</strong>
				</div>
				<hr />
				', $context['quoted_message']['body'], '
			</div>
		</div>
	</div>';
    }
    echo '
		<script><!-- // --><![CDATA[
			var oPersonalMessageSend = new elk_PersonalMessageSend({
				sSelf: \'oPersonalMessageSend\',
				sSessionId: elk_session_id,
				sSessionVar: elk_session_var,
				sTextDeleteItem: \'', $txt['autosuggest_delete_item'], '\',
				sToControlId: \'to_control\',
				aToRecipients: [';
    foreach ($context['recipients']['to'] as $i => $member) {
        echo '
					{
						sItemId: ', JavaScriptEscape($member['id']), ',
						sItemName: ', JavaScriptEscape($member['name']), '
					}', $i == count($context['recipients']['to']) - 1 ? '' : ',';
    }
    echo '
				],
				aBccRecipients: [';
    foreach ($context['recipients']['bcc'] as $i => $member) {
        echo '
					{
						sItemId: ', JavaScriptEscape($member['id']), ',
						sItemName: ', JavaScriptEscape($member['name']), '
					}', $i == count($context['recipients']['bcc']) - 1 ? '' : ',';
    }
    echo '
				],
				sBccControlId: \'bcc_control\',
				sBccDivId: \'bcc_div\',
				sBccDivId2: \'bcc_div2\',
				sBccLinkId: \'bcc_link\',
				sBccLinkContainerId: \'bcc_link_container\',
				bBccShowByDefault: ', empty($context['recipients']['bcc']) && empty($context['bcc_value']) ? 'false' : 'true', ',
				sShowBccLinkTemplate: ', JavaScriptEscape('
					<a href="#" id="bcc_link">' . $txt['make_bcc'] . '</a> <a href="' . $scripturl . '?action=quickhelp;help=pm_bcc" onclick="return reqOverlayDiv(this.href);"><img class="icon" src="' . $settings['images_url'] . '/helptopics.png" alt="(?)" /></a>'), '
			});
		// ]]></script>';
}
/**
 * The report sub template gets shown from:
 *  '?action=reporttm;topic=##.##;msg=##'
 * It should submit to:
 *  '?action=reporttm;topic=' . $context['current_topic'] . '.' . $context['start']
 *
 * It only needs to send the following fields:
 *  comment: an additional comment to give the moderator.
 *  sc: the session id, or $context['session_id'].
 */
function template_report()
{
    global $context, $txt, $scripturl;
    echo '
	<div id="report_topic">
		<form action="', $scripturl, '?action=reporttm;topic=', $context['current_topic'], '.', $context['start'], '" method="post" accept-charset="UTF-8">
			<input type="hidden" name="msg" value="' . $context['message_id'] . '" />
				<h2 class="category_header">', $txt['report_to_mod'], '</h2>
				<div class="windowbg">
					<div class="content">';
    template_show_error('report_error');
    echo '
						<p class="warningbox">', $txt['report_to_mod_func'], '</p>
						<br />
						<dl class="settings" id="report_post">';
    if ($context['user']['is_guest']) {
        echo '
							<dt>
								<label for="email_address">', $txt['email'], '</label>:
							</dt>
							<dd>
								<input type="text" id="email_address" name="email" value="', $context['email_address'], '" size="25" maxlength="255" />
							</dd>';
    }
    echo '
							<dt>
								<label for="report_comment">', $txt['enter_comment'], '</label>:
							</dt>
							<dd>
								<textarea id="report_comment" name="comment">', $context['comment_body'], '</textarea>
							</dd>';
    if ($context['require_verification']) {
        template_verification_controls($context['visual_verification_id'], '
							<dt>
								' . $txt['verification'] . ':
							</dt>
							<dd>
								', '
							</dd>');
    }
    echo '
						</dl>
						<div class="submitbutton">
							<input type="submit" name="save" value="', $txt['rtm10'], '" class="button_submit" />
							<input type="hidden" name="', $context['session_var'], '" value="', $context['session_id'], '" />
						</div>
					</div>
				</div>
		</form>
	</div>';
}