view src/nabble/view/naml/mailing_list_settings.naml @ 0:7ecd1a4ef557

add content
author Franklin Schmidt <fschmidt@gmail.com>
date Thu, 21 Mar 2019 19:15:52 -0600
parents
children
line wrap: on
line source

<macro name="mailing_list_archive_settings" requires="servlet">
	<n.node_page.>
		<n.if.not.visitor.can_edit.page_node>
			<then>
				<n.login.><t>Only authorized users can proceed in this area.</t></n.login.>
			</then>
		</n.if.not.visitor.can_edit.page_node>

		<n.page_node.get_this_mailing_list_archive.>
			<n.if.not.is_submitted_form>
				<then.fill_in_mailing_list_archive_fields/>
				<else>
					<n.if.is_remove_mailing_list_archive_settings>
						<then.remove_mailing_list_archive_settings_and_redirect/>
						<else.save_mailing_list_archive_settings_and_redirect/>
					</n.if.is_remove_mailing_list_archive_settings>
				</else>
			</n.if.not.is_submitted_form>

			<n.html>
				<head>
					<META NAME="robots" CONTENT="noindex,nofollow"/>
					<n.title.><t>Mailing List Archive Settings</t></n.title.>
					<n.mailing_list_address_field.focus/>
					<style type="text/css">
						div.field-title { margin-top: 0; }
						div.tip { font-size:80%; margin-top:.4em; }
					</style>
					<script type="text/javascript">
						$(document).ready(function() {
							$('form').submit(function() {
								var action = $('#action').val();
								if (action == 'remove')
									return confirm('<t>Do you really want to remove the mailing list archive settings?</t>');
								return true;
							});
						});
					</script>
				</head>
				<body>
					<n.edit_header first_text="[n.page_node.get_app_node.subject/]" second_text="[t]Mailing List Archive Settings[/t]" />

					<n.if.is_submitted_form>
						<then.show_mailing_list_error/>
					</n.if.is_submitted_form>

					<n.form.>
						<input id="action" type="hidden" name="action" value="save"/>
						<n.mailing_list_address_group/>
						<n.mailing_list_website_group/>
						<n.mailing_list_server_group/>
						<n.mailing_list_subject_prefix_group/>
						<n.mailing_list_other_settings_group/>

						<input type="submit" class="toolbar action-button" value="[t]Save Settings[/t]" onclick="$('#action').val('save')"/>
						<input type="submit" class="toolbar action-button" value="[t]Remove Settings[/t]" onclick="$('#action').val('remove')"/>
						<t>or</t> <a href="[n.page_node.url /]"><t>Cancel</t></a>
					</n.form.>
				</body>
			</n.html>
		</n.page_node.get_this_mailing_list_archive.>
	</n.node_page.>
</macro>

<macro name="fill_in_mailing_list_archive_fields" requires="mailing_list">
	<n.if.page_node.is_a_mailing_list_archive>
		<then>
			<n.mailing_list_address_field.set_value value="[n.mailing_list_address/]" />
			<n.mailing_list_url_field.set_value value="[n.mailing_list_url/]" />
			<n.mailing_list_server_field.set_value value="[n.mailing_list_server/]" />
			<n.mailing_list_prefix_field.set_value value="[n.mailing_list_prefix/]" />
			<n.plain_text_only_field.set_value value="[n.plain_text_only/]" />
			<n.ignore_xnoarchive_field.set_value value="[n.ignore_xnoarchive/]" />
		</then>
		<else>
			<n.mailing_list_server_field.set_value value="unknown" />
		</else>
	</n.if.page_node.is_a_mailing_list_archive>
</macro>

<macro name="remove_mailing_list_archive_settings_and_redirect" requires="mailing_list, node_page">
	<n.catch_exception. id="save-block">
		<n.remove/>
		<n.redirect_to.page_node.url/>
	</n.catch_exception.>
</macro>

<macro name="save_mailing_list_archive_settings_and_redirect" requires="mailing_list, node_page">
	<n.catch_exception. id="save-block">
		<n.set_var. name="is-new">
			<n.if.page_node.is_a_mailing_list_archive>
				<then>no</then>
				<else>yes</else>
			</n.if.page_node.is_a_mailing_list_archive>
		</n.set_var.>
		<n.save>
			<address><n.mailing_list_address_field.value/></address>
			<url><n.mailing_list_url_field.value/></url>
			<server><n.mailing_list_server_field.value/></server>
			<prefix><n.mailing_list_prefix_field.value/></prefix>
			<plain_text_only><n.plain_text_only_field.value/></plain_text_only>
			<ignore_xnoarchive><n.ignore_xnoarchive_field.value/></ignore_xnoarchive>
			<do>
			</do>
		</n.save>
		<n.if.equal value1="[n.var name='is-new'/]" value2="yes">
			<then.redirect_to.page_node.subscription_instructions_path/>
			<else.redirect_to.page_node.url/>
		</n.if.equal>
	</n.catch_exception.>
</macro>

<macro name="mailing_list_address_group" requires="mailing_list">
	<div class="field-box light-border-color">
		<div class="second-font field-title"><t>Mailing List Address</t> <span class="important">*</span></div>
		<div class="weak-color">
			<n.mailing_list_address_field.input size="40" />
		</div>
		<div class="weak-color tip">
			<t>Example: listname@listdomain.com</t>
		</div>

		<n.if.page_node.is_a_mailing_list_archive>
			<then>
				<div class="shaded-bg-color rounded" style="padding: .6em .5em;margin:.4em 0 0">
					<div style="float:left;height:2em;margin-right:.5em">
						<img src="/images/tool_big.png" width="27" height="27"/>
					</div>
					<div style="margin-left:.5em">
						<t><b>IMPORTANT</b>: You must subscribe this archive to the mailing list in order to make it work.</t><br/>
						<div style="margin-top:.3em">
							<t>Please follow the <n.subscribe_instructions_link.>subscription instructions</n.subscribe_instructions_link.> for this archive.</t>
						</div>
					</div>
				</div>
			</then>
		</n.if.page_node.is_a_mailing_list_archive>
	</div>
</macro>

<macro name="mailing_list_website_group" requires="mailing_list">
	<div class="field-box light-border-color">
		<div class="second-font field-title"><t>Mailing List Website</t> <span class="important">*</span></div>
		<div class="weak-color">
			<t>Enter the homepage of this mailing list, where users can find more information.</t><br/>
			<n.mailing_list_url_field.input size="72" />
		</div>
	</div>
</macro>

<macro name="mailing_list_server_group" requires="mailing_list">
	<div class="field-box light-border-color">
		<div class="second-font field-title"><t>List Server</t></div>
		<div class="weak-color">
			<t>If you know, please select the mailing list server application and its version.</t><br/>
			<n.mailing_list_server_field.select.>
				<n.available_servers.loop.>
					<n.set_var. name='server_name'>
						<n.if.equal value1="[n.current_server_name/]" value2="Unknown or Other">
							<then><t>Unknown or Other</t></then>
							<else><n.current_server_name/></else>
						</n.if.equal>
					</n.set_var.>
					<n.select_option value="[n.current_server/]" selectedValue="[n.mailing_list_server_field.value/]" text="[n.var name='server_name'/]"/>
				</n.available_servers.loop.>
			</n.mailing_list_server_field.select.>
		</div>
	</div>
</macro>

<macro name="mailing_list_subject_prefix_group" requires="mailing_list">
	<div class="field-box light-border-color">
		<div class="second-font field-title"><t>Subject Prefix</t></div>
		<div class="weak-color">
			<t>Enter the prefix that this mailing list uses before the subject.
			The prefix will be automatically removed from the imported emails.</t>
			<br/>
			<n.mailing_list_prefix_field.input size="25" />
			<div class="weak-color tip">
				<t>Examples: '[the-list]', 'Abc:', etc.</t>
			</div>
		</div>
	</div>
</macro>

<macro name="mailing_list_other_settings_group" requires="mailing_list">
	<div class="field-box light-border-color">
		<div class="second-font field-title"><t>Other Settings</t></div>
		<table>
			<tr>
				<td><n.plain_text_only_field.checkbox /></td>
				<td><label for="[n.plain_text_only_field.name/]"><t>This list accepts only plain-text emails</t></label></td>
			</tr>
			<tr style="vertical-align:top">
				<td><n.ignore_xnoarchive_field.checkbox /></td>
				<td style="padding-top:.2em">
					<label for="[n.ignore_xnoarchive_field.name/]"><t>Ignore X-No-Archive header</t></label>
					<div class="weak-color tip"><t>TIP: If your archive is subscribed to the mailing list and it is still not working, you may try ignoring the X-No-Archive header.</t></div>
				</td>
			</tr>
		</table>
	</div>
</macro>

<macro name="subscribe_instructions_link" dot_parameter="text" requires="node_page">
	<a href="[n.page_node.subscription_instructions_path/]"><n.text/></a>
</macro>

<macro name="mailing_list_address_field" dot_parameter="do">
	<n.field. name="mailing_list_address"><n.do/></n.field.>
</macro>

<macro name="mailing_list_url_field" dot_parameter="do">
	<n.field. name="mailing_list_url"><n.do/></n.field.>
</macro>

<macro name="mailing_list_server_field" dot_parameter="do">
	<n.field. name="mailing_list_server"><n.do/></n.field.>
</macro>

<macro name="mailing_list_prefix_field" dot_parameter="do">
	<n.field. name="mailing_list_prefix"><n.do/></n.field.>
</macro>

<macro name="plain_text_only_field" dot_parameter="do">
	<n.field. name="plain_text_only"><n.do/></n.field.>
</macro>

<macro name="ignore_xnoarchive_field" dot_parameter="do">
	<n.field. name="ignore_xnoarchive"><n.do/></n.field.>
</macro>

<macro name="show_mailing_list_error">
	<n.format_error.handle_exception. for="save-block">
		<n.exception. name="invalid_list_address">
			<t>You must enter a valid email address for this mailing list.</t>
		</n.exception.>
		<n.exception. name="invalid_list_url">
			<t>You must enter a valid website URL for this mailing list.</t>
		</n.exception.>
	</n.format_error.handle_exception.>
</macro>

<macro name="is_remove_mailing_list_archive_settings">
	<n.equal value1="[n.get_parameter name='action'/]" value2="remove"/>
</macro>