discourse-legacysite-perl/site/forum/include_post_write.html
2024-06-17 22:24:05 +10:00

267 lines
12 KiB
HTML

<%~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 forum_style % 2%>
<%~set ADVANCEDEDITOR = 0%>
<%~endif%>
<script type="text/javascript">
//<![CDATA[
<%~if ADVANCEDEDITOR%>
var ae, sc;
<%~else%>
var sc;
function addTag(tag) {
var textarea = document.getElementById('post_message');
insertText(textarea, '[' + tag + ']');
}
function wrapTag(tag) {
var textarea = document.getElementById('post_message');
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 = 'post_message';
sc.id.htmlCompose = 'advanced_editor';
sc.id.extra = ['post_style', 'temp_id', 'post_id'];
sc.lang.resume = 'Resume Post';
sc.config.disableElements = ['editor_switch', 'button_attachment', 'button_post', 'button_preview'];
<%~if ADVANCEDEDITOR%>
sc.config.editorObj = ae;
<%~endif%>
sc.load();
});
//]]>
</script>
<input type="hidden" id="temp_id" name="temp_id" value="<%temp_id%>" />
<div class="post-header-group">
<div id="row_post_subject" class="row">
<label for="post_subject" class="name">Subject</label>
<div class="value"><input type="text" id="post_subject" name="post_subject" value="<%post_subject%>" class="txt midtext" tabindex="1" /></div>
</div>
<%~if this_do eq post_edit%>
<div id="row_edit_reason" class="row">
<label for="edit_reason" class="name">Reason for edit</label>
<div class="value"><input type="text" id="edit_reason" name="edit_reason" value="<%if edit_reason%><%edit_reason%><%endif%>" class="txt midtext" tabindex="2" /></div>
</div>
<%~endif%>
<%~if current.user_id and config.post_user_custom_username and this_do ne post_edit%>
<div id="row_alias_username" class="row">
<label for="alias_username" class="name">Alias</label>
<div class="value"><input type="text" id="alias_username" name="alias_username" value="<%if alias_username%><%alias_username%><%endif%>" class="txt" tabindex="2" /></div>
</div>
<%elsif not current.user_id%>
<%~if anonymous.length > 1 or config.post_guest_custom_username%>
<div id="row_guest_username" class="row">
<label for="<%if anonymous.length > 1%>anon_id<%else%>guest_username<%endif%>">Guest Username</label>
<div class="value">
<%~if anonymous.length > 1%>
<select id="anon_id" name="anon_id" tabindex="2">
<%~loop anonymous%>
<option value="<%user_id%>"<%if selected%> selected="selected"<%endif%>><%user_username%></option>
<%~endloop%>
</select>
<%~else%>
<input type="hidden" name="anon_id" value="<%anonymous.0.user_id%>" />
<%~endif%>
<%~if config.post_guest_custom_username%>
<input type="text" id="guest_username" name="guest_username" value="<%if guest_username%><%guest_username%><%endif%>" class="txt" tabindex="2" />
<%~endif%>
</div>
</div>
<%~endif%><%-- endif anonymous.length > 1 ... --%>
<div id="row_post_anonymous_email" class="row">
<label for="post_anonymous_email">E-mail address</label>
<div class="value"><input type="text" id="post_anonymous_email" name="post_anonymous_email" value="<%if post_anonymous_email%><%post_anonymous_email%><%endif%>" class="txt mid-text" tabindex="3" /></div>
</div>
<%endif%>
<div id="row_post_style" class="row">
<label class="name">Post Style</label>
<div class="value">
<%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" />
<p><%GForum::language('FORUM_STYLE_MARKUP')%></p>
<%elsif forum_style%><%-- forum_style is set, which means the user gets a choice --%>
<select id="post_style" name="post_style" tabindex="4" onchange="document.getElementById('ae_switch_span').className = this.value == 1 ? '' : 'hide'; document.getElementById('get_markup_help').className = this.value % 2 == 0 ? 'hide' : ''">
<%~if forum_style == 3%>
<option value="3"<%if forum_style_selected == 3%> selected="selected"<%set selected = 1%><%endif%>><%GForum::language('FORUM_STYLE_BOTH')%></option>
<%~endif%>
<%~if forum_style >= 2%>
<option value="2"<%if forum_style_selected == 2%> selected="selected"<%set selected = 1%><%endif%>><%GForum::language('FORUM_STYLE_HTML')%></option>
<%~endif%>
<%~if forum_style % 2%>
<option value="1"<%if forum_style_selected == 1%> selected="selected"<%set selected = 1%><%endif%>><%GForum::language('FORUM_STYLE_MARKUP')%></option>
<%~endif%>
<option value="0"<%if not selected%> selected="selected"<%endif%>><%GForum::language('FORUM_STYLE_PLAIN')%></option>
</select>
<%~if forum_style % 2%>
<span id="get_markup_help">
&mdash;
<a href="#" rel="markup-help" class="dialog-lnk">Get Markup Help</a>
</span>
<%~if not forum_style_selected % 2%>
<script type="text/javascript">
document.getElementById('get_markup_help').className = 'hide';
</script>
<%~endif%>
<%~endif%>
<%~else%><%-- plain text only --%>
<input type="hidden" name="post_style" value="0" />
<%GForum::language('FORUM_STYLE_PLAIN')%>
<%~endif%>
</div>
</div>
</div>
<div id="row_post_message" class="row post-message">
<label class="name">Post</label>
<div class="value">
<script type="text/javascript" src="<%static_url%>/js/spellcheck.js"></script>
<%if ADVANCEDEDITOR%>
<input type="hidden" id="post_message" name="post_message" value="<%post_message%>" />
<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%>' + '<%set url = GForum::SEO::url(params => "do=editor_image;editor_type=post")%><%escape_js url%>';
<%~if in.do ne 'post_preview'%>
ae.config.focusOnload = true;
<%~endif%>
ae.load('<%compose_form_id%>', 'post_message');
//]]>
</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="post_message" name="post_message" tabindex="6" class="txt lngtext" onload="this.focus()"><%post_message%></textarea>
<%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 forum_style % 2%>
<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', 'post_preview', 'redo', '<%this_do%>'])" title="Spell Check">Preview Post</a>
</div>
<%~if current.user_status == 3%>
<div class="row post-tags">
<label class="name">Tags</label>
<div class="value clearfix">
<div class="col-6">
<input type="text" id="autocomplete" name="autocomplete" value="<%preview_tags || $post_tags || ''%>" tabindex="7" class="txt" placeholder="Separate tags with commas" />
<input type="submit" id="autocomplete-submit" value="Add" class="btn" />
<input type="hidden" id="autocomplete-tags" name="tags" value="<%if orig.tags.length%><%loop orig.tags%><%tag_name%><%unless last%>,<%endunless%><%endloop%><%endif%>" />
</div>
<div class="col-6">
<div id="autocomplete-selected">
<div id="autocomplete-selected-items" class="clearfix">
<%~loop orig.tags%>
<div class="button-remove" title="<%tag_name%>"><span class="sprite-remove-tag"></span><%tag_name%></div>
<%~endloop%>
</div>
</div>
</div>
</div>
</div>
<%~endif%>
<%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">
<%include include_attachments.html%>
</div>
</div>
<%endif%>
<hr class="line" />
<%if current.user_id%>
<div id="row_post_options" class="row post-options">
<div class="option">
<input type="checkbox" id="post_append_signature" name="post_append_signature" value="1"<%if post_append_signature%> checked="checked"<%endif%> class="checkbox" tabindex="8" />
<label for="post_append_signature">Append signature to post</label>
</div>
<div class="option">
<input type="checkbox" id="post_reply_notify" name="post_reply_notify" value="1"<%if post_reply_notify%> checked="checked"<%endif%> class="checkbox" tabindex="8" />
<label for="post_reply_notify">Send e-mail notification on reply</label>
</div>
<%~if current.user_forum_permission >= $FORUM_PERM_MODERATOR%>
<%~if root.post_sticky%>
<div class="option" title="Thread is already sticky">
<input type="checkbox" id="post_sticky" checked="checked" disabled="disabled" class="checkbox" />
<label for="post_sticky">Make thread sticky</label>
</div>
<%~else%>
<div class="option">
<input type="checkbox" id="post_sticky" name="post_sticky" value="1"<%if post_sticky%> checked="checked"<%endif%> class="checkbox" tabindex="8" />
<label for="post_sticky">Make thread sticky</label>
</div>
<%~endif%>
<%~if root.post_locked%>
<div class="option already" title="Thread is already locked">
<input type="checkbox" id="post_locked" checked="checked" disabled="disabled" class="checkbox" />
<label for="post_locked">Lock thread</label>
</div>
<%~else%>
<div class="option">
<input type="checkbox" id="post_locked" name="post_locked" value="1"<%if post_locked%> checked="checked"<%endif%> class="checkbox" tabindex="8" />
<label for="post_locked">Lock thread</label>
</div>
<%~endif%>
<%~endif%>
</div>
<%endif%>
<div id="markup-help" title="Markup Help" class="hide">
<%include markup_help.html%>
</div>