reply.naml

<macro name="reply" requires="servlet">
	<n.new_post>
		<page_name>
			<t>Reply</t>
		</page_name>
		<focus>
			<n.message_field.focus/>
		</focus>
		<bottom>
			<n.in_reply_to/>
		</bottom>
	</n.new_post>
</macro>

<macro name="new_post" parameters="page_name,bottom,focus" requires="servlet">
	<n.node_page.>
		<n.handle_new_node_permission_error/>
		<n.if.not.is_submitted_form>
			<then>
				<n.subject_field.set_value value="[n.page_node.default_reply_subject/]" />
				<n.alert_field.set_value value="[n.page_node.alert_default_value/]" />
				<n.init_new_post_custom_fields/>
			</then>
			<else>
				<n.catch_exception. id="save-block">
					<n.check_antispam_submit bypass="preview"/>
					<n.check_recent_post_limit/>
					<n.create_child_of_page_node commit="[n.not.is_preview/]">
						<subject><n.subject_field.value/></subject>
						<message><n.message_field.value/></message>
						<is_html><n.html_format_field.value/></is_html>
						<type><n.type_field.value/></type>
						<kind>post</kind>
						<do>
							<n.remember_new_node/>
							<n.if.not.is_preview>
								<then>
									<n.save_post/>
									<n.save_new_post_custom_fields/>
									<n.new_node.send_node_as_email/>
								</then>
							</n.if.not.is_preview>
						</do>
					</n.create_child_of_page_node>
					<n.if.not.is_preview>
						<then>
							<n.new_node.save_alert_field/>
							<n.redirect_to.new_node.path/>
						</then>
					</n.if.not.is_preview>
				</n.catch_exception.>
			</else>
		</n.if.not.is_submitted_form>
		<n.html>
			<head>
				<META NAME="robots" CONTENT="noindex,nofollow"/>
				<n.title.><n.page_name/></n.title.>
				<n.focus/>
				<style type="text/css">
					.title-row {
						padding:.6em .8em;
						font-weight:bold;
					}
					div.field-title {
						margin-top: 0;
					}
				</style>
			</head>
			<body>
				<n.edit_header first_text="[n.page_name/]" second_text="[n.truncate. size='80'][n.page_node.subject/][/n.truncate.]" />

				<n.if.is_submitted_form>
					<then>
						<n.if.has_exception for="save-block">
							<then.show_new_node_error/>
							<else>
								<n.if.is_preview>
									<then.new_node.preview/>
								</n.if.is_preview>
							</else>
						</n.if.has_exception>
					</then>
				</n.if.is_submitted_form>

				<n.if.not.global_is_var_set name="sent">
					<then>
						<n.form. onsubmit="return singleSubmit(this)">
							<n.type_field.hidden/>
		
							<n.reply_form />
		
							<div style="margin-top:1em">
								<n.antispam_submit_button class="toolbar action-button" value="[t]Post Message[/t]"/>
								<input type="submit" class="toolbar action-button" name="preview" value="[t]Preview Message[/t]"/>
								<t>or</t>
								<a href="[n.page_node.path /]"><t>Cancel</t></a>
							</div>
						</n.form.>
		
						<n.hide_null.bottom/>
					</then>
				</n.if.not.global_is_var_set>
			</body>
		</n.html>
	</n.node_page.>
</macro>

<macro name="reply_form">
	<n.subject_control/>
	<n.message_control/>

	<n.if.visitor.has_too_many_posts>
		<then.captcha_control/>
	</n.if.visitor.has_too_many_posts>
</macro>

<macro name="remember_new_node" requires="node_editor">
	<n.global_set_var name="new_node" value="[n.edited_node/]" />
</macro>

<macro name="new_node" dot_parameter="do" requires="node_page">
	<n.get_node node="[n.global_var name='new_node'/]" do="[n.do/]" />
</macro>

<macro name="subject_control">
	<div class="field-box light-border-color">
		<div class="second-font field-title"><t>Subject</t></div>
		<div class="weak-color">
			<n.subject_field.input type="text" size="60" tabindex="1" />
		</div>
	</div>
</macro>

<macro name="message_control" requires="node_page">
	<div class="field-box light-border-color">
		<div class="second-font field-title"><t>Message</t></div>
		<div class="weak-color">
			<n.if.visitor.is_registered>
				<then>
					<n.html_format_field.checkbox />
					<label for="[n.html_format_field.name/]"><t>Message is in HTML Format</t></label><br/>
					<div style="margin:.1em 0">
						<n.editor_toolbar
							textarea_id="[n.message_field.name/]"
							original_text="[n.if.page_node.is_post][then.page_node.message_quoted/][/n.if.page_node.is_post]"
						/>
					</div>
				</then>
			</n.if.visitor.is_registered>
			<n.message_field.textarea wrap="SOFT" tabindex="2" style="min-width:30em;max-width:55em;width:100%;height:20em;" />
			<n.new_post_extra_fields/>
		</div>
	</div>
</macro>

<macro name="extra_fields" dot_parameter="fields" requires="node_page">
	<n.put_in_head.>
		<style type="text/css">
			div.extra-fields {
				margin-top:.5em;
			}
			div.extra-field {
				width:2em;
				float:left;
				text-align:center;
			}
			div.extra-field-details {
				border-left-width:2px;
				border-left-style:dotted;
				margin-left:2.5em;
				padding:0 0 1em 1em;
			}
		</style>
		<script type="text/javascript">
			$(document).ready(function(){
				$('div.extra-fields').each(function() {
					$(this).children().first().wrap('<div class="extra-field"></div>');
				});
			});
		</script>
	</n.put_in_head.>
	<n.fields/>
</macro>

<macro name="new_post_extra_fields" requires="node_page">
	<n.extra_fields.>
		<n.if.visitor.is_registered>
			<then>
				<div class="extra-fields">
					<n.alert_field.checkbox style="margin-top:.1em"/>
					<label for="[n.alert_field.name/]"><t>Alert me by email when someone posts to this thread</t></label>
				</div>

				<div class="extra-fields">
					<img src="/images/mail.png" width="18" height="13" style="margin-top:.2em"/>
					<n.send_node_as_email_input />
				</div>
			</then>
		</n.if.visitor.is_registered>
	</n.extra_fields.>
</macro>

<macro name="captcha_control">
	<n.captcha_div/>
</macro>

<macro name="save_alert_field" requires="node,servlet">
	<n.if.null_to_false.alert_field.value>
		<then.topic_node.subscribe_visitor/>
		<else.topic_node.unsubscribe_visitor/>
	</n.if.null_to_false.alert_field.value>
</macro>

<macro name="visitor_is_subscribed_to_topic" requires="node,servlet">
	<n.both condition1="[n.is_post/]" condition2="[n.topic_node.visitor_is_subscribed/]" />
</macro>

<macro name="type_field" dot_parameter="do">
	<n.field. name="type"><n.do/></n.field.>
</macro>

<macro name="show_new_node_error">
	<n.format_error.handle_exception. for="save-block">
		<n.field_errors/>
		<n.file_errors/>
		<n.permission_errors/>
		<n.spam_errors/>
		<n.custom_new_node_errors/>
	</n.format_error.handle_exception.>
</macro>

<macro name="permission_errors" requires="error">
	<n.exception. name="banned">
		<t>You can't post a message here, but you can post in other places.</t>
	</n.exception.>
	<n.exception. name="too_many_posts">
		<t>You have made too many posts in a short time. Please try again later.</t>
	</n.exception.>
</macro>

<macro name="field_errors" requires="error">
	<n.exception. name="invalid_recaptcha">
		<t>Please verify that you are not a robot.</t>
	</n.exception.>
	<n.exception. name="required_subject">
		<t>The subject is required.</t>
	</n.exception.>
	<n.exception. name="required_name">
		<t>You must provide a user name.</t>
	</n.exception.>
	<n.invalid_email_exception.>
		<t>Invalid email address: <n.email/></t>
	</n.invalid_email_exception.>
</macro>

<macro name="file_errors" requires="error">
	<n.invalid_file_exception.>
		<t>File was not uploaded: <t.file.filename/> (please upload again or remove the tag)</t>
	</n.invalid_file_exception.>
	<n.invalid_image_exception.>
		<t>Image was not uploaded: <t.image.filename/> (please upload again or remove the tag)</t>
	</n.invalid_image_exception.>
</macro>

<macro name="spam_errors" requires="error">
	<n.spam_exception. name="subject_contains_invalid_spam_word">
		<t>[Spam Detector] Message contains common spam words.</t>
	</n.spam_exception.>
	<n.spam_exception. name="message_contains_invalid_spam_word">
		<t>[Spam Detector] Message contains common spam words.</t>
	</n.spam_exception.>
	<n.spam_exception. name="message_contains_many_invalid_spam_words">
		<t>[Spam Detector] Message contains common spam words.</t>
	</n.spam_exception.>
	<n.exception. name="subject_contains_common_spam_words">
		<t>[Spam Detector] Message contains common spam words.</t>
	</n.exception.>
	<n.exception. name="message_contains_common_spam_words">
		<t>[Spam Detector] Message contains common spam words.</t>
	</n.exception.>
	<n.exception. name="suspicious_request">
		<t>Submit failed, please try again.</t>
	</n.exception.>
</macro>

<macro name="custom_new_node_errors">
	<n.comment.>To be overridden</n.comment.>
</macro>

<macro name="handle_new_node_permission_error">
	<n.catch_exception. id="check-permission">
		<n.visitor.check_posting_under.page_node/>
	</n.catch_exception.>
	<n.handle_exception. for="check-permission">
		<n.exception. name="no_create_topic_permission">
			<n.new_topic_forbidden_page/>
		</n.exception.>
		<n.exception. name="read_only">
			<n.new_topic_forbidden_page/>
		</n.exception.>
		<n.exception. name="no_reply_permission">
			<n.redirect_to.page_node.node_with_permission permission="[n.reply_permission/]" do="[n.unauthorized_path/]" />
		</n.exception.>
		<n.exception. name="banned">
			<n.ban_error_page/>
		</n.exception.>
		<n.exception. name="no_anonymous">
			<n.login.><t>You must login to your account.</t></n.login.>
		</n.exception.>
	</n.handle_exception.>
</macro>

<macro name="new_topic_forbidden_page">
	<n.set_var name="has_descendants_where_can_reply" value="[n.false/]" />
	<n.page_node.descendant_apps_list.loop.>
		<n.if.visitor.can_create_topic_in.current_node>
			<then>
				<n.set_var name="has_descendants_where_can_reply" value="[n.true/]" />
				<n.break/>
			</then>
		</n.if.visitor.can_create_topic_in.current_node>
	</n.page_node.descendant_apps_list.loop.>
	<n.html>
		<head>
			<META NAME="robots" CONTENT="noindex,nofollow"/>
			<n.title.>
				<n.if.var name="has_descendants_where_can_reply">
					<then><t>Choose a Subcategory</t></then>
					<else><t>Authorized Users Only</t></else>
				</n.if.var>
			</n.title.>
		</head>
		<body>
			<div style="font-size:140%;margin:.5em 0 1em">
				<n.if.var name="has_descendants_where_can_reply">
					<then><t>Choose a subcategory to post your message</t></then>
					<else><t>You Cannot Post Here</t></else>
				</n.if.var>
			</div>
			<n.if.var name="has_descendants_where_can_reply">
				<then>
					<n.page_node.descendant_apps_list.loop.>
						<n.if.visitor.can_create_topic_in.current_node>
							<then>
								<div style="margin:.3em"><n.current_node.new_topic_link text="[n.subject/]" /></div>
							</then>
						</n.if.visitor.can_create_topic_in.current_node>
					</n.page_node.descendant_apps_list.loop.>
				</then>
				<else>
					<t>Sorry, but you can't create new topics here.<br/>Note that you may still be able to reply to posts.</t>
					<br/><br/>
					<n.if.visitor.is_site_admin>
						<then><t><b>Note</b>: Since you are an administrator, you can <n.page_node.change_permissions_link.>change the permissions of <t.location.page_node.subject/></n.page_node.change_permissions_link.> and make sure you can create new topics here.</t></then>
						<else><t>You may <n.page_node.unauthorized_link.>request permission to post</n.page_node.unauthorized_link.> here or contact <n.root_node.owner.send_email_link.><n.root_node.owner.name/></n.root_node.owner.send_email_link.> if you have questions.</t></else>
					</n.if.visitor.is_site_admin>
				</else>
			</n.if.var>
		</body>
	</n.html>
	<n.exit/>
</macro>

<macro name="ban_error_page">
	<n.html>
		<head>
			<META NAME="robots" CONTENT="noindex,nofollow"/>
			<n.title.><t>Unable to Post</t></n.title.>
		</head>
		<body>
			<div style="font-size:140%;margin:.5em 0 1em">
				<t>Unable to Post</t>
			</div>
			<t>Sorry, but the administrators have banned you.</t>
			<t>You can't post a message here, but you can post in other places.</t>
			<br/><br/>
			<t>Please contact Nabble Support if you need help.</t>
		</body>
	</n.html>
	<n.exit/>
</macro>

<macro name="in_reply_to">
	<div class="title-row light-border-color shaded-bg-color" style="margin-top:2.5em"><t>In Reply To</t></div>
	<div style="margin-left:1.2em;padding-top:1em">
		<n.page_node.>
			<n.put_in_head.>
				<style type="text/css">
					div.in-reply-to {
						margin-bottom:1em;
						padding-bottom:.4em;
						border-bottom-width:1px;
						border-bottom-style:dotted;
					}
				</style>
			</n.put_in_head.>
			<div class="medium-border-color in-reply-to">
				<b><n.break_up.subject/></b>
				<div class="weak-color" style="padding:.2em 0">
					<span class="weak-color"><n.when_created.long_format/></span>
					&mdash;
					<t>by
						<t.author>
							<n.owner.avatar/>
							<span class="nowrap"><n.owner.user_link/></span>
						</t.author>
					</t>
				</div>
			</div>
			<n.message_with_signature/>
		</n.page_node.>
	</div>
</macro>

<macro name="new_post_path" requires="node">
	<n.encode_url.remove_spaces.>
		/template/NamlServlet.jtp?
		<n.if.is_app>
			<then>macro=new_topic</then>
			<else>macro=reply</else>
		</n.if.is_app>
		&node=<n.id/>
	</n.encode_url.remove_spaces.>
</macro>

<macro name="new_topic_path" requires="node" parameters="type">
	<n.encode_url.remove_spaces.>
		/template/NamlServlet.jtp?macro=new_topic&node=<n.id/>
		<n.add_to_path name="type" value="[n.type/]" />
	</n.encode_url.remove_spaces.>
</macro>

<macro name="alert_default_value" requires="node">
	<n.visitor_is_subscribed_to_topic/>
</macro>

<macro name="send_node_as_email_input">
	<script type="text/javascript">
		function addFirstAddress() {
			$('#add-another-address').show();
			addAddress();
		};
		function removeAddress(e) {
			$(e).parent().parent().remove();
			var s = $('#address-list table tr').size();
			if (s == 0)
				$('#add-another-address').hide();
			Nabble.resizeFrames();
		};
		function addAddress() {
			$('#address-list').append('<n.javascript_string_encode.remove_spaces_between_tags.send_node_as_email_input_row email=""/>');
			Nabble.resizeFrames();
		};
	</script>
	<a href="javascript: void(0)" onclick="addFirstAddress()"><t>Email this post to...</t></a>
	<div id="add-another-address" class="extra-field-details medium-border-color" style="[n.if.not.has_parameter name='email-to'][then]display:none[/then][/n.if.not.has_parameter]">
		<div id="address-list">
			<n.get_parameter_values. name="email-to">
				<n.loop.send_node_as_email_input_row.current_parameter_value/>
			</n.get_parameter_values.>
		</div>
		<a href="javascript: void addAddress()"><t>Add another address</t></a>
		&nbsp;
		<span class="weak-color">(<t>one email per input box</t>)</span>
	</div>
</macro>

<macro name="send_node_as_email_input_row" dot_parameter="email">
	<table>
		<tr>
			<td class="sendto"><img src="/images/people_sm.png" class="image16"/></td>
			<td class="sendto"><t>Send To:</t></td>
			<td><input type="text" class="email-to" name="email-to" size="40" maxlength="80" value="[n.email/]" /></td>
			<td><a class="removeAddress" href="javascript:void(0)" onclick="removeAddress(this)"><t>remove</t></a></td>
		</tr>
	</table>
</macro>

<macro name="send_node_as_email" requires="node">
	<n.set_local_node.this_node/>
	<n.block.>
		<n.if.visitor.is_registered>
			<then.get_parameter_values. name="email-to">
				<n.loop.>
					<n.set_var name="email" value="[n.parse_email.current_parameter_value/]" />
					<n.if.not.is_null.var name="email">
						<then.local_node.topic_or_app.subscription_for. email="[n.var name='email'/]">
							<n.send_node_as_email_to_user.local_node/>
						</then.local_node.topic_or_app.subscription_for.>
					</n.if.not.is_null.var>
				</n.loop.>
			</then.get_parameter_values.>
		</n.if.visitor.is_registered>
	</n.block.>
</macro>

<macro name="send_node_as_email_to_user" dot_parameter="node_attr" requires="subscription" unindent="true">
	<n.set_local_subscription.this_subscription/>
	<n.set_local_node.node_attr/>
	<n.send_subscription_email node_attr="[n.node_attr/]">
		<text_part>
			<n.local_node.text_email_message_with_signature/>

			______________________________________
			<t>If you reply to this email, your message will be added to the discussion below</t>:
			<n.local_node.url/>
			This email was sent by <n.visitor.name/> (via Nabble)
			<n.if.not.local_subscription.is_subscribed>
				<then>
					To receive all replies by email, subscribe to this discussion: <n.local_subscription.subscribe_by_code_url/>
				</then>
			</n.if.not.local_subscription.is_subscribed>
		</text_part>
		<html_part>
			<n.local_node.html_email_message_with_signature/>
			<br/><br/>
			<hr noshade="noshade" size="1" color="#cccccc" />
			<div style="color:#444; font: 12px tahoma,geneva,helvetica,arial,sans-serif;">
				<div style="font-weight:bold"><t>If you reply to this email, your message will be added to the discussion below</t>:</div>
				<a href="[n.local_node.url/]"><n.local_node.url/></a>
			</div>
			<div style="color:#666; font: 11px tahoma,geneva,helvetica,arial,sans-serif;margin-top:.4em">
				This email was sent by <a href="[n.visitor.url/]"><n.visitor.name/></a> (via Nabble)<br/>
				<n.if.not.local_subscription.is_subscribed>
					<then>
						To receive all replies by email, <a href="[n.local_subscription.subscribe_by_code_url/]">subscribe to this discussion</a><br/>
					</then>
				</n.if.not.local_subscription.is_subscribed>
			</div>
		</html_part>
	</n.send_subscription_email>
</macro>

<macro name="check_recent_post_limit" requires="node_page">
	<n.if.visitor.has_too_many_posts>
		<then.check_captcha/>
	</n.if.visitor.has_too_many_posts>
</macro>

<macro name="init_new_post_custom_fields">
	<n.comment.>To be overridden</n.comment.>
</macro>

<macro name="save_new_post_custom_fields">
	<n.comment.>To be overridden</n.comment.>
</macro>

<macro name="has_spambot_security">
	true
</macro>