discourse-legacysite-perl/site/forum/include_message_write.html

180 lines
6.6 KiB
HTML
Raw Normal View History

2024-06-17 12:24:05 +00:00
<%~if ie_version >= 5.5 or mozilla_version >= 1.4 or webkit_version >= 312.1%>
<%~if advanced_editor%>
<%~set ADVANCEDEDITOR = 1%>
<%~elsif current.user_advanced_editor and not basic_editor%>
<%~set ADVANCEDEDITOR = 1%>
<%~else%>
<%~set ADVANCEDEDITOR = 0%>
<%~endif%>
<%~else%>
<%~set ADVANCEDEDITOR = 0%>
<%~endif%>
<%~if ADVANCEDEDITOR and not config.message_style % 2%>
<%~set ADVANCEDEDITOR = 0%>
<%~endif%>
<script type="text/javascript" src="<%static_url%>/js/jquery.min.js"></script>
<script type="text/javascript">
//<![CDATA[
<%~if ADVANCEDEDITOR%>
var ae, sc;
<%~else%>
var sc;
function addTag(tag) {
var textarea = document.getElementById('msg_body');
insertText(textarea, '[' + tag + ']');
}
function wrapTag(tag) {
var textarea = document.getElementById('msg_body');
wrapText(textarea, '[' + tag + ']', '[/' + tag + ']');
}
<%~endif%>
registerEvent(window, 'load', function () {
/* Cancel any "enter" key presses on non-button input elements as they would submit the form */
var inputs = document.getElementsByTagName('input');
for (var i = 0; i < inputs.length; i++) {
if (inputs[i].type != 'hidden' && inputs[i].type != 'button' && inputs[i].type != 'submit')
registerEvent(inputs[i], 'keypress', function (evt) { if (evt.keyCode == 13) { cancelEvent(evt); return false } });
}
/* Create and configure the spellcheck object */
sc = new spellCheck('sc');
sc.id.checkContent = 'msg_body';
sc.id.htmlCompose = 'advanced_editor';
sc.id.extra = ['msg_style', 'temp_id'];
sc.lang.resume = 'Resume Message';
sc.config.disableElements = ['editor_switch', 'button_attachment', 'button_post', 'button_preview'];
<%~if ADVANCEDEDITOR%>
sc.config.editorObj = ae;
<%~endif%>
sc.load();
<%~unless user_username%>
GForum.helpText="<%GForum::language('HELP_TEXT_ENTER_USERNAME')%>";
<%~endunless%>
});
//]]>
</script>
<input type="hidden" id="temp_id" name="temp_id" value="<%temp_id%>" />
<div class="post-header-group">
<div id="row_message_subject" class="row">
<label for="msg_subject" class="name">Subject</label>
<div class="value">
<input type="text" id="msg_subject" name="msg_subject" value="<%msg_subject%>" class="txt midtext" tabindex="1" />
</div>
</div>
<div id="row_user_username" class="row">
<label<%if ask_username%> for="autocomplete"<%endif%> class="name">Recipient</label>
<div class="value">
<%~if ask_username%>
<input type="text" id="autocomplete" name="user_username" value="<%user_username || ''%>" placeholder="<%GForum::language('HELP_TEXT_ENTER_USERNAME')%>" class="txt midtext" tabindex="1" />
<span>&mdash; <a href="<%GForum::SEO::url(params => "do=user_list")%>">View Member Directory</a></span>
<%~else%>
<input type="hidden" name="user" value="<%user_id%>" />
<input type="hidden" name="user_username" value="<%user_username || ''%>" />
<p><%include include_username.html%></p>
<%~endif%>
</div>
</div>
</div>
<div id="row_msg_body" class="row post-message">
<label class="name"<%unless ADVANCEDEDITOR%> for="msg_body"<%endunless%>>Post</label>
<div class="value">
<script type="text/javascript" src="<%static_url%>/js/spellcheck.js"></script>
<%if ADVANCEDEDITOR%>
<input type="hidden" id="msg_body" name="msg_body" value="<%msg_body%>" />
<script type="text/javascript" src="<%static_url%>/editor/editor.js"></script>
<script type="text/javascript">
//<![CDATA[
<%include editor_gforum.js%>
//]]>
</script>
<script type="text/javascript">
//<![CDATA[
var ae = new advancedEditor();
ae.config.imageDialogURL = '<%cgi_root_url%><%GForum::SEO::url(params => "do=editor_image;editor_type=message")%>';
var $subject = $('#msg_subject');
var $user = $('#user_username');
if ($subject.val().length == 0) {
$subject.focus();
}
else if ($user.length && $user.val().length == 0) {
$user.focus();
}
else {
ae.config.focusOnload = true;
}
ae.load('<%compose_form_id%>', 'msg_body');
//]]>
</script>
<iframe id="editor_iframe" src="<%static_url%>/editor/editor_iframe.html" frameborder="0" scrolling="no"></iframe>
<%else%>
<input type="hidden" name="basic_editor" value="1" />
<textarea id="msg_body" name="msg_body" tabindex="6" class="txt lngtext"><%msg_body%></textarea>
<script type="text/javascript">
//<![CDATA[
var $subject = $('#msg_subject');
var $user = $('#user_username');
if ($subject.val().length == 0) {
$subject.focus();
}
else if ($user.length && $user.val().length == 0) {
$user.focus();
}
else {
$('#msg_body').focus();
}
//]]>
</script>
<%endif%>
</div>
</div>
<%if not ADVANCEDEDITOR%>
<%include include_markup_tags.html%>
<%endif%>
<div class="row post-link-actions">
<%if ADVANCEDEDITOR%><%-- The advanced editor only works for markup posts --%>
<input type="hidden" id="post_style" name="post_style" value="1" />
<input type="hidden" id="advanced_editor" name="advanced_editor" value="1" />
<a id="editor_switch" href="#" onclick="return submitForm(document.getElementById('<%compose_form_id%>'), ['do','<%this_do%>', 'basic_editor','1', 'basic_editor_switch','1'])" class="hide">Switch to Basic Editor</a> |
<script type="text/javascript">
document.getElementById('editor_switch').className = '';
</script>
<%~elsif ie_version >= 5.5 or mozilla_version >= 1.4 or webkit_version >= 312.1%>
<a id="editor_switch" href="#" onclick="return submitForm(document.getElementById('<%compose_form_id%>'), ['do','<%this_do%>', 'advanced_editor','1', 'advanced_editor_switch','1'])">Switch to Advanced Editor</a> |
<%endif%>
<a id="button_spellcheck" href="#" title="Spell Check">Check Spelling</a> |
<a id="button_preview" href="#" onclick="return submitForm(document.getElementById('<%compose_form_id%>'), ['do', 'message_preview', 'redo', '<%this_do%>'])" title="Spell Check">Preview Post</a>
</div>
<%~if can_attach or attachments.length%>
<div id="row_attachments" class="row post-attachments">
<label class="name sprite-attachment">Attachments</label>
<div id="attachment_list" class="value clearfix">
<%~set attach_mode = 'message'%>
<%include include_attachments.html%>
</div>
</div>
<%~endif%>
<hr class="line" />
<div id="row_message_options" class="row post-options">
<div class="option">
<input type="checkbox" id="msg_append_signature" name="msg_append_signature" value="1"<%if msg_append_signature%> checked="checked"<%endif%> class="checkbox" tabindex="8" />
<label for="msg_append_signature">Append signature to message</label>
</div>
</div>