unauthorized.naml

<macro name="unauthorized" requires="servlet">
	<n.node_page.>
		<n.if.is_submitted_form>
			<then>
				<n.users_in_group. group="[n.administrators_group/]">
					<n.loop.>
						<n.current_user.send_request_email
							explanation="[n.message_field.value/]"
						/>
					</n.loop.>
				</n.users_in_group.>
			</then>
		</n.if.is_submitted_form>
		<n.html>
			<head>
				<META NAME="robots" CONTENT="noindex,nofollow"/>
				<n.title.><t>Unauthorized</t></n.title.>
			</head>
			<body>
				<div style="font-size:140%;margin:.5em 0 1em">
					<t>Authorized Users Only</t>
				</div>
				<t>Only authorized users can proceed in this area.</t>
				<t>You can use the form below to send a request to the administrators.</t>
				<div class="second-font big-title" style="margin:1.5em 0 .5em">
					<t>Access Request</t>
				</div>
				<n.if.not.is_submitted_form>
					<then>
						<div class="weak-color" style="margin:.3em 0">
							<t>Explain to the administrator(s) why you want to access this restricted area.</t>
						</div>
						<n.form.>
							<n.message_field.textarea wrap="SOFT" style="width:35em;height:5em;" />
							<n.message_field.focus/>
							<br/>
							<input type="submit" id="send-request" value="[t]Send Request[/t]"/>
							<t>or</t> <a href="[n.page_node.url/]"><t>Cancel</t></a>
						</n.form.>
					</then>
					<else>
						<img src="/images/success.png" class="image16"/>
						<t>Your request has been successfully sent.</t>
					</else>
				</n.if.not.is_submitted_form>
			</body>
		</n.html>
	</n.node_page.>
</macro>

<macro name="send_request_email" parameters="explanation" requires="user,node_page" unindent="true">
	<n.new_email.>
		<n.send>
			<to><n.user_email/></to>
			<subject><t>User requested authorization to join <t.location.page_node.subject/></t></subject>
			<text_part>
				<t>Dear <t.name.name/>,</t>

				<t><t.name.visitor.name/> requested authorization to join the <t.location.page_node.subject/>:</t>
				<n.page_node.url/>

				* <t>Explanation from this user:</t>
				<n.explanation/>

				* <t>User email:</t>
				<n.visitor.user_email/>

				<t>To accept this request, you should add this user to at least one group that has access to this area:</t>
				<n.base_url/><n.visitor.change_user_groups_path/>

				<t>Or you can ignore this email if it is better to keep this user away from that area.</t>
				________________________________________
				<t>Free Embeddable <t.app.page_node.view_name/></t> powered by Nabble
				<n.nabble_homepage/>
			</text_part>
			<html_part>
				<t>Dear <t.name.name/>,</t><br/>
				<br/>
				<t><t.name.visitor.name/> requested authorization to join the <t.location.page_node.subject/>:</t><br/>
				<a href="[n.page_node.url/]"><n.page_node.url/></a><br/>
				<br/>
				<b><t>Explanation from this user:</t></b><br/>
				<n.explanation/><br/>
				<br/>
				<b><t>User email:</t></b><br/>
				<n.visitor.user_email/><br/>
				<br/>
				<t>To accept this request, you should add this user to at least one group that has access to this area:</t>
				<div style="background-color:#FFFADB;border:#EDDD79 solid 1px;margin:1.2em 0;padding:.5em">
					<n.base_url/><n.visitor.change_user_groups_path/>
				</div>
				<t>Or you can ignore this email if it is better to keep this user away from that area.</t><br/>
				________________________________________<br/>
				<t>Free Embeddable <t.app.page_node.view_name/></t> powered by Nabble<br/>
				<n.nabble_homepage/><br/><br/>
			</html_part>
		</n.send>
	</n.new_email.>
</macro>

<macro name="unauthorized_path" requires="node">
	<n.encode_url.>
		/template/NamlServlet.jtp?macro=unauthorized&node=<n.id/>
	</n.encode_url.>
</macro>

<macro name="unauthorized_link" requires="node" dot_parameter="text" parameters="title, class">
	<a href="[n.unauthorized_path/]" title="[n.title/]" class="[n.class/]"><n.text/></a>
</macro>