diff src/nabble/view/naml/create_sub_app.naml @ 0:7ecd1a4ef557

add content
author Franklin Schmidt <fschmidt@gmail.com>
date Thu, 21 Mar 2019 19:15:52 -0600
parents
children 18cf4872fd7f
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/nabble/view/naml/create_sub_app.naml	Thu Mar 21 19:15:52 2019 -0600
@@ -0,0 +1,147 @@
+<macro name="create_sub_app" requires="servlet">
+	<n.node_page.>
+		<n.if.not.visitor.can_create_sub_apps_under.page_node>
+			<then>
+				<n.login.><t>Only authorized users can proceed in this area.</t></n.login.>
+			</then>
+		</n.if.not.visitor.can_create_sub_apps_under.page_node>
+		<n.if.not.is_submitted_form>
+			<then>
+				<n.type_field.set_value value="[n.page_node.sub_app_type/]" />
+			</then>
+			<else>
+				<n.catch_exception. id="save-block">
+					<n.handle_anonymous_submit/>
+					<n.create_child_of_page_node>
+						<subject><n.subject_field.value/></subject>
+						<message><n.message_field.value/></message>
+						<is_html><n.html_format_field.value/></is_html>
+						<type><n.type_field.value/></type>
+						<kind>app</kind>
+						<do>
+							<n.remember_new_node/>
+							<n.save_node/>
+						</do>
+					</n.create_child_of_page_node>
+					<n.if.visitor.can_edit.page_node>
+						<then.new_node.pin/>
+					</n.if.visitor.can_edit.page_node>
+					<n.if.equal value1="[n.is_mailing_list_field.value/]" value2="[n.true/]">
+						<then><n.redirect_to.new_node.mailing_list_archive_settings_path/></then>
+						<else><n.redirect_to.new_node.path/></else>
+					</n.if.equal>
+				</n.catch_exception.>
+			</else>
+		</n.if.not.is_submitted_form>
+		<n.html>
+			<head>
+				<META NAME="robots" CONTENT="noindex,nofollow"/>
+				<n.title.><t>Create <t.element.page_node.child_name/></t></n.title.>
+				<n.subject_field.focus/>
+				<style type="text/css">
+					div.field-title {
+						margin-top: 0;
+					}
+				</style>
+			</head>
+			<body>
+				<n.edit_header first_text="[n.page_node.get_app_node.subject/]" second_text="[t]Create new [t.element.page_node.child_name/][/t]" />
+				<n.if.is_submitted_form>
+					<then>
+						<n.if.has_exception for="save-block">
+							<then.show_new_node_error/>
+						</n.if.has_exception>
+					</then>
+				</n.if.is_submitted_form>
+				<n.form.>
+					<n.type_field.hidden/>
+
+					<n.if.not.visitor.is_registered>
+						<then>
+							<div class="field-box light-border-color">
+								<div class="second-font field-title"><t>Your Name</t></div>
+								<div class="weak-color">
+									<n.if.is_null.visitor.name>
+										<then.anonymous_name_field.input size="30" />
+										<else.visitor.name/>
+									</n.if.is_null.visitor.name>
+								</div>
+							</div>
+						</then>
+					</n.if.not.visitor.is_registered>
+
+					<div class="field-box light-border-color">
+						<div class="second-font field-title"><t>Name</t></div>
+						<div class="weak-color">
+							<n.subject_field.input size="40" />
+							(<t>max. 80 characters</t>)
+						</div>
+					</div>
+
+					<div class="field-box light-border-color">
+						<div class="second-font field-title"><t>Description</t></div>
+						<div class="weak-color">
+							<n.if.visitor.is_registered>
+								<then>
+									<n.html_format_field.checkbox />
+									<label for="[n.html_format_field.name/]"><t>Description is in HTML Format</t></label><br/>
+									<div style="margin:.1em 0">
+										<n.editor_toolbar textarea_id="[n.message_field.name/]"/>
+									</div>
+								</then>
+							</n.if.visitor.is_registered>
+							<n.message_field.textarea wrap="SOFT" style="min-width:30em;max-width:55em;width:100%;height:12em;" />
+						</div>
+					</div>
+
+					<n.if.not.visitor.is_registered>
+						<then>
+							<div class="weak-color field-box light-border-color" style="padding-top:0">
+								<div>
+									<div style="padding-bottom:.4em">
+										<t>Since you are not a registered user, we must check that you are a human.</t>
+									</div>
+									<n.captcha_control/>
+								</div>
+							</div>
+						</then>
+						<else>
+							<n.if.not.page_node.is_associated_with_mailing_list_archive>
+								<then>
+									<div style="margin:.5em 0 1em">
+										<n.is_mailing_list_field.checkbox />
+										<label for="[n.is_mailing_list_field.name/]"><t>This is a mailing list archive</t></label>
+									</div>
+								</then>
+							</n.if.not.page_node.is_associated_with_mailing_list_archive>
+						</else>
+					</n.if.not.visitor.is_registered>
+
+					<input type="submit" class="toolbar action-button" value="[t]Create [t.element.page_node.child_name/][/t]"/>
+					<t>or</t> <a href="[n.page_node.path /]"><t>Cancel</t></a>
+				</n.form.>
+
+				<div class="light-bg-color" style="padding: .5em;margin:1.5em 0 0">
+					<div class="second-font field-title"><t>Related Help Article</t></div>
+					<n.help.cataloging.link/>
+				</div>
+			</body>
+		</n.html>
+	</n.node_page.>
+</macro>
+
+<macro name="is_mailing_list_field" dot_parameter="do">
+	<n.field. name="is_mailing_list"><n.do/></n.field.>
+</macro>
+
+<macro name="sub_app_type" requires="node">
+	<n.if.regex_matches text="[n.type/]" pattern="forum|category|mixed">
+		<then>forum</then>
+		<else>
+			<n.if.type equals="board">
+				<then>category</then>
+				<else><n.type/></else>
+			</n.if.type>
+		</else>
+	</n.if.regex_matches>
+</macro>
\ No newline at end of file