manage_subscribers.naml

<macro name="manage_subscribers" requires="servlet">
	<n.node_page.>
		<n.if.not.visitor.can_manage_subscribers_of.page_node>
			<then>
				<n.login.><t>Only authorized users can proceed in this area.</t></n.login.>
			</then>
		</n.if.not.visitor.can_manage_subscribers_of.page_node>
		<n.html>
			<head>
				<META NAME="robots" CONTENT="noindex,nofollow"/>
				<n.title.><t>Manage Subscribers</t></n.title.>
			</head>
			<body>
				<n.edit_header first_text="[t]Manage Subscribers[/t]" second_text="[n.page_node.get_app_node.subject/]" />
				<n.manage_subscribers_controls/>
			</body>
		</n.html>
	</n.node_page.>
</macro>

<macro name="manage_subscribers_controls" requires="node_page">
	<n.horizontal_tab_control.>
		<n.current_subscribers_horizontal_tab/>
		<n.add_subscribers_horizontal_tab/>
	</n.horizontal_tab_control.>
</macro>

<macro name="current_subscribers_horizontal_tab">
	<n.add_horizontal_tab
		url="[n.page_node.manage_subscribers_path/]"
		text="[t]Current Subscribers[/t]"
		selected="[n.is_subscriber_filter/]"
		details="[n.page_node.list_subscribers/]"
	/>
</macro>

<macro name="add_subscribers_horizontal_tab">
	<n.add_horizontal_tab
		url="[n.page_node.manage_subscribers_path filter='invite'/]"
		text="[t]Invite Subscribers[/t]"
		selected="[n.is_subscriber_filter value='invite'/]"
		details="[n.page_node.add_subscribers/]"
	/>
</macro>

<macro name="add_subscribers" requires="node">
	<t>If you want to invite subscribers, please request this feature in the <n.support_link/> forum.</t>
	<t>We can install this module for you, but the Nabble team must approve this request to prevent abuse and spam.</t>
</macro>

<macro name="if_is_tab" parameters="filter" dot_parameter="do">
	<n.if.is_subscriber_filter value="[n.filter/]">
		<then.do/>
	</n.if.is_subscriber_filter>
</macro>

<macro name="list_subscribers" requires="node">
	<n.if.is_submitted_form>
		<then.process_unsubscription/>
	</n.if.is_submitted_form>

	<n.put_in_head.>
		<style type="text/css">
			table.subscriptions {
				border-collapse:collapse;
				margin-top:1em;
				clear:both;
				width:100%
			}
			table.subscriptions th {
				padding: .3em .6em;
				text-align:left;
				border-bottom-style:solid;
				border-bottom-width:2px;
			}
			table.subscriptions td {
				padding: .5em;
			}
		</style>
	</n.put_in_head.>

	<n.zebra_table_javascript table_selector="table.subscriptions"/>

	<n.subscribers_pagination/>

	<div class="weak-color" style="float:left;margin:.5em 0">
		<n.one_or_many.page_node.subscription_count>
			<one_text><t>subscriber</t></one_text>
			<many_text><t>subscribers</t></many_text>
		</n.one_or_many.page_node.subscription_count>
	</div>

	<n.subscriptions. start="[n.subscriber_page_index_record/]" length="[n.subscriber_page_length/]">
		<n.if.has_more_elements>
			<then>
				<table class="subscriptions">
					<tr class="shaded-bg-color">
						<th class="medium-border-color"></th>
						<th class="medium-border-color"><t>Name</t></th>
						<th class="medium-border-color"><t>Email</t></th>
						<th class="medium-border-color"><t>Subscription Type</t></th>
						<th class="medium-border-color"></th>
					</tr>
					<n.loop.>
						<tr>
							<td style="width:30px;padding:0"><n.subscription.user.avatar/></td>
							<td class="nowrap"><n.subscription.user.user_link/></td>
							<td class="nowrap"><n.subscription.user.user_email/></td>
							<td class="nowrap"><n.subscription.type_label/></td>
							<td class="nowrap"><n.subscription.unsubscribe_button/></td>
						</tr>
					</n.loop.>
				</table>
			</then>
		</n.if.has_more_elements>
	</n.subscriptions.>

	<n.subscribers_pagination/>
</macro>

<macro name="process_unsubscription">
	<n.if.not.is_null.unsubscribe_email_parameter>
		<then>
			<n.set_local_subscription.page_node.subscription_for email="[n.unsubscribe_email_parameter/]" />
			<n.if.local_subscription.is_subscribed>
				<then>
					<n.local_subscription.remove/>
					<n.local_subscription.send_unsubscription_reminder/>
				</then>
			</n.if.local_subscription.is_subscribed>
		</then>
	</n.if.not.is_null.unsubscribe_email_parameter>
</macro>

<macro name="subscribers_pagination" requires="node_page">
	<n.paging.
		total_rows="[n.page_node.subscription_count/]"
		current_row="[n.subscriber_page_index_record/]"
		rows_per_page="[n.subscriber_page_length/]"
	>
		<n.generic_paging>
			<margin>.55em .2em</margin>
			<url><n.page_node.manage_subscribers_path index_record="[n.page_row/]"/></url>
		</n.generic_paging>
	</n.paging.>
</macro>

<macro name="type_label" requires="subscription">
	<n.if.equal value1="[n.to/]" value2="DESCENDANTS">
		<then><t>All posts</t></then>
		<else><t>New topics only</t></else>
	</n.if.equal>
</macro>

<macro name="unsubscribe_button" requires="subscription">
	<n.form.>
		<input type="hidden" name="unsubscribe-email" value="[n.user.user_email/]"/>
		<input type="submit" class="toolbar" value="[t]Unsubscribe[/t]"/>
	</n.form.>
</macro>

<macro name="unsubscribe_email_parameter" requires="servlet">
	<n.get_parameter name="unsubscribe-email"/>
</macro>


<macro name="manage_subscribers_path" parameters="filter,index_record" requires="node">
	<n.encode_url.remove_spaces.>
		/template/NamlServlet.jtp?macro=manage_subscribers&node=<n.id/>
		<n.add_to_path name="filter" value="[n.filter/]"/>
		<n.add_to_path name="i" value="[n.index_record/]" default_value="0"/>
	</n.encode_url.remove_spaces.>
</macro>

<macro name="subscriber_filter" requires="servlet">
	<n.get_parameter name="filter"/>
</macro>

<macro name="subscriber_page_index_record" requires="servlet">
	<n.get_parameter name="i"/>
</macro>

<macro name="subscriber_page_length" requires="servlet">
	25
</macro>

<macro name="is_subscriber_filter" parameters="value">
	<n.equal value1="[n.subscriber_filter/]" value2="[n.value/]" />
</macro>