diff src/nabble/modules/naml/ppc.naml @ 0:7ecd1a4ef557

add content
author Franklin Schmidt <fschmidt@gmail.com>
date Thu, 21 Mar 2019 19:15:52 -0600
parents
children 72765b66e2c3
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/nabble/modules/naml/ppc.naml	Thu Mar 21 19:15:52 2019 -0600
@@ -0,0 +1,153 @@
+<!--
+Used in
+http://work.ppcassociates.com/
+http://foreverarts.3255.n6.nabble.com/
+http://horse-barns.11180.n6.nabble.com/ (GregChapman)
+-->
+
+<override_macro name="manage_subscribers_controls" requires="node_page">
+	<n.horizontal_tab_control.>
+		<n.current_subscribers_horizontal_tab/>
+		<n.add_subscribers_horizontal_tab/>
+		<n.members_subscribers_horizontal_tab/>
+	</n.horizontal_tab_control.>
+</override_macro>
+
+<macro name="members_subscribers_horizontal_tab">
+	<n.add_horizontal_tab
+		url="[n.page_node.manage_subscribers_path filter='members'/]"
+		text="[t]Add Subscribers[/t]"
+		selected="[n.is_subscriber_filter value='members'/]"
+		details="[n.page_node.subscribe_members/]"
+	/>
+</macro>
+
+<macro name="subscribe_members" requires="node">
+	<n.if.is_submitted_form>
+		<then.process_member_subscriptions/>
+	</n.if.is_submitted_form>
+
+	<n.unsubscribed_members.>
+		<n.if.has_more_elements>
+			<then>
+				<div class="weak-color" style="margin:.5em 0 .5em">
+					Unsubscribed members are listed below.
+					Select who you would like to be subscribed:
+				</div>
+				<n.form.>
+					<input type="hidden" name="filter" value="members"/>
+					<div class="medium-border-color border1" style="padding:.5em;height:25em;overflow:auto">
+						<table>
+							<n.loop.>
+								<n.page_node.subscription_for. email="[n.current_user.user_email/]">
+									<n.if.not.is_subscribed>
+										<then>
+											<n.current_user.member_field.>
+												<tr>
+													<td><n.checkbox/></td>
+													<td><n.current_user.avatar/></td>
+													<td><label for="[n.name/]"><n.current_user.name/></label></td>
+												</tr>
+											</n.current_user.member_field.>
+										</then>
+									</n.if.not.is_subscribed>
+								</n.page_node.subscription_for.>
+							</n.loop.>
+						</table>
+					</div>
+					<div style="margin-top:1.4em">
+						<input type="submit" value="Add Subscribers" />
+					</div>
+				</n.form.>
+			</then>
+			<else>
+				<div class="weak-color" style="margin:.5em 0 .5em">
+					No unsubscribed members found.
+				</div>
+			</else>
+		</n.if.has_more_elements>
+	</n.unsubscribed_members.>
+</macro>
+
+<macro name="unsubscribed_members" dot_parameter="do">
+	<n.site_users. length="99999">
+		<n.filter_by.current_user.can_view.page_node/>
+		<n.filter_by.>
+			<n.page_node.subscription_for. email="[n.current_user.user_email/]">
+				<n.not.is_subscribed/>
+			</n.page_node.subscription_for.>
+		</n.filter_by.>
+		<n.do/>
+	</n.site_users.>
+</macro>
+
+<macro name="member_field" dot_parameter="do" requires="user">
+	<n.field. name="member-[n.id/]"><n.do/></n.field.>
+</macro>
+
+<macro name="process_member_subscriptions">
+	<n.unsubscribed_members.>
+		<n.loop.>
+			<n.page_node.subscription_for. email="[n.current_user.user_email/]">
+				<n.if.both
+						condition1="[n.not.is_subscribed/]"
+						condition2="[n.current_user.member_field.is_checked/]"
+				>
+					<then>
+						<n.save to="DESCENDANTS" type="INSTANT"/>
+						<n.send_subscription_notification/>
+					</then>
+				</n.if.both>
+			</n.page_node.subscription_for.>
+		</n.loop.>
+	</n.unsubscribed_members.>
+</macro>
+
+<macro name="send_subscription_notification" requires="subscription,node_page,servlet">
+	<n.set_local_subscription.this_subscription />
+	<n.new_email.>
+		<n.send>
+			<to><n.user.user_email/></to>
+			<subject>Nabble subscription to <n.page_node.subject/></subject>
+			<text_part>
+				Dear user,
+
+				<n.page_node.owner.name/> subscribed you to <n.page_node.subject/>:
+				<n.page_node.url/>
+
+				With your subscription, posts and replies will be sent directly to your email
+				and you can reply to them to participate. Your subscription works as a mailing list.
+
+				If you don't want to be a subscriber, please click on the link below:
+				<n.local_subscription.unsubscribe_by_code_url/>
+
+				Sincerely,
+				The Nabble team
+				________________________________________
+				Free <n.to_lower_case.page_node.view_name/> powered by Nabble
+				<n.nabble_homepage/>
+			</text_part>
+			<html_part>
+				Dear user,<br/>
+				<br/>
+				<n.page_node.owner.name/> subscribed you to <n.page_node.subject/>:<br/>
+				<n.page_node.url/><br/>
+				<br/>
+				With your subscription, posts and replies will be sent directly to your email
+				and you can reply to them to participate. Your subscription works as a mailing list.<br/>
+				<br/>
+				If you don't want to be a subscriber, please click on the link below:<br/>
+				<div style="background-color:#FFFADB;border:#EDDD79 solid 1px;margin:1.2em 0;padding:.5em">
+					<a href="[n.local_subscription.unsubscribe_by_code_url/]">
+						<n.local_subscription.unsubscribe_by_code_url/>
+					</a>
+				</div>
+				Sincerely,<br/>
+				The Nabble team<br/>
+				________________________________________<br/>
+				Free <n.to_lower_case.page_node.view_name/> powered by Nabble<br/>
+				<n.nabble_homepage/><br/><br/>
+			</html_part>
+		</n.send>
+	</n.new_email.>
+</macro>