edit_signature.naml

<macro name="edit_signature" requires="servlet">
	<n.visitor.as_user_page.>
		<n.if.not.page_user.is_registered>
			<then>
				<n.login.><t>You must login to view this page.</t></n.login.>
			</then>
		</n.if.not.page_user.is_registered>
		<n.if.is_submitted_form>
			<then>
				<n.catch_exception. id="save-signature">
					<n.edit_page_user.>
						<n.set_signature signature="[n.signature_field.value/]" is_html="[n.html_format_field.value/]"/>
						<n.save_user/>
					</n.edit_page_user.>
					<n.redirect_to.page_user.user_profile_path/>
				</n.catch_exception.>
			</then>
			<else.if.page_user.has_signature>
				<then>
					<n.html_format_field.set_value value="[n.page_user.signature.is_html_format/]" />
					<n.signature_field.set_value value="[n.page_user.signature.as_editable/]" />
				</then>
			</else.if.page_user.has_signature>
		</n.if.is_submitted_form>
		<n.html>
			<head>
				<META NAME="robots" CONTENT="noindex,nofollow"/>
				<n.title.><t>Edit Signature</t></n.title.>
			</head>
			<body>
				<h1><t>Edit Signature</t></h1>

				<n.show_edit_signature_error/>

				<n.if.page_user.has_signature>
					<then.show_current_signature/>
				</n.if.page_user.has_signature>

				<n.form.>
					<n.html_format_field.checkbox />
					<label for="[n.html_format_field.name/]"><t>Signature is in HTML format</t></label><br/>
					<n.signature_field.textarea wrap="SOFT" tabindex="2" style="width:35em;height:7em;" />

					<div style="margin-top:1.4em">
						<input type="submit" value="[t]Save Signature[/t]" />
						<t>or</t> <a href="[n.page_user.user_profile_path/]"><t>Cancel</t></a>
					</div>
				</n.form.>
			</body>
		</n.html>
	</n.visitor.as_user_page.>
</macro>

<macro name="show_current_signature">
	<div class="medium-border-color border1 rounded" style="width:34em;padding:.5em;margin:2em 0">
		<div class="second-font field-title" style="margin-top:0">
			<t>Current Signature</t>
		</div>
		<div class="weak-color" style="margin-left:1em">
			<n.page_user.signature_as_html/>
		</div>
	</div>
</macro>

<macro name="signature_field" dot_parameter="do">
	<n.field. name="signature"><n.do/></n.field.>
</macro>

<macro name="edit_signature_path">
	<n.encode_url.>
		/template/NamlServlet.jtp?macro=edit_signature
	</n.encode_url.>
</macro>


<macro name="signature_as_html" requires="user">
	<n.signature.message_as_html />
</macro>

<macro name="show_edit_signature_error">
	<n.if.is_submitted_form>
		<then.if.has_exception for="save-signature">
			<then.format_error.handle_exception. for="save-signature">
				<n.spam_errors/>
			</then.format_error.handle_exception.>
		</then.if.has_exception>
	</n.if.is_submitted_form>
</macro>