comparison src/nabble/view/naml/edit_post.naml @ 0:7ecd1a4ef557

add content
author Franklin Schmidt <fschmidt@gmail.com>
date Thu, 21 Mar 2019 19:15:52 -0600
parents
children 72765b66e2c3
comparison
equal deleted inserted replaced
-1:000000000000 0:7ecd1a4ef557
1 <macro name="edit_post" requires="servlet">
2 <n.node_page.>
3 <n.if.not.visitor.can_edit.page_node>
4 <then>
5 <n.login.><t>Only authorized users can proceed in this area.</t></n.login.>
6 </then>
7 </n.if.not.visitor.can_edit.page_node>
8 <n.if.not.is_submitted_form>
9 <then>
10 <n.subject_field.set_value value="[n.page_node.raw_subject/]" />
11 <n.html_format_field.set_value value="[n.page_node.message.is_html_format/]" />
12 <n.message_field.set_value value="[n.page_node.message.as_editable/]" />
13 <n.alert_field.set_value value="[n.page_node.visitor_is_subscribed_to_topic/]" />
14 <n.page_node.init_edit_post_custom_fields/>
15 </then>
16 <else>
17 <n.catch_exception. id="save-block">
18 <n.edit_page_node. commit="[n.not.is_preview/]">
19 <n.set_subject subject="[n.subject_field.value/]" />
20 <n.set_message message="[n.message_field.value/]" is_html="[n.not.is_null.html_format_field.value/]" />
21 <n.if.not.is_preview>
22 <then.save_post />
23 </n.if.not.is_preview>
24 </n.edit_page_node.>
25 <n.if.not.is_preview>
26 <then>
27 <n.page_node.save_alert_field/>
28 <n.page_node.save_edit_post_custom_fields/>
29 <n.redirect_to.page_node.path/>
30 </then>
31 </n.if.not.is_preview>
32 </n.catch_exception.>
33 </else>
34 </n.if.not.is_submitted_form>
35 <n.html>
36 <head>
37 <META NAME="robots" CONTENT="noindex,nofollow"/>
38 <n.title.><t>Edit Post</t></n.title.>
39 <style type="text/css">
40 .title-row {
41 padding:.2em;
42 border-width:2px;
43 border-style:solid;
44 font-weight:bold;
45 }
46 div.field-title {
47 margin-top: 0;
48 }
49 </style>
50 </head>
51 <body>
52 <n.edit_header first_text="[t]Edit Post[/t]" second_text="[n.page_node.get_app_node.subject/]" />
53 <n.if.is_submitted_form>
54 <then>
55 <n.if.is_preview>
56 <then>
57 <n.page_node.preview/>
58 </then>
59 </n.if.is_preview>
60 <n.show_edit_post_error/>
61 </then>
62 </n.if.is_submitted_form>
63 <n.form.>
64 <n.edit_post_form />
65
66 <div style="margin-top:1em">
67 <input type="submit" class="toolbar action-button" value="[t]Post Message[/t]" />
68 <input type="submit" class="toolbar action-button" name="preview" value="[t]Preview Message[/t]" />
69 <t>or</t> <a href="[n.page_node.path/]"><t>Cancel</t></a>
70 </div>
71 </n.form.>
72 </body>
73 </n.html>
74 </n.node_page.>
75 </macro>
76
77 <macro name="save_post" requires="node_editor,servlet">
78 <n.save_node />
79 </macro>
80
81 <macro name="edit_post_form">
82 <n.if.page_node.is_mail_to_list>
83 <then>
84 <div class="title-row info-message" style="font-weight:normal;padding:.3em .5em">
85 <div class="important" style="font-weight:bold">
86 <t>Your changes will not be sent to the mailing list.</t>
87 </div>
88 <t>If you want others in the mailing list to know of your changes,
89 please compose a new message or reply to your original message.</t>
90 </div>
91 </then>
92 </n.if.page_node.is_mail_to_list>
93
94 <n.if.page_node.message.is_imported_mail>
95 <then>
96 <div class="info-message" style="font-weight:bold;padding:.3em .5em">
97 <t>The post you are editing was originally imported by email. If this post has attachments, those files will be lost after you save your changes. You may download the attachments and re-upload them to your edited post.</t>
98 </div>
99 </then>
100 </n.if.page_node.message.is_imported_mail>
101
102 <n.if.not.visitor.is_registered>
103 <then>
104 <div class="field-box light-border-color">
105 <div class="second-font field-title"><t>Your Name</t></div>
106 <div class="weak-color">
107 <n.page_node.owner.name/>
108 </div>
109 </div>
110 </then>
111 </n.if.not.visitor.is_registered>
112
113 <div class="field-box light-border-color">
114 <div class="second-font field-title"><t>Subject</t></div>
115 <div class="weak-color">
116 <n.subject_field.input size="60" tabindex="1" />
117 </div>
118 </div>
119
120 <div class="field-box light-border-color">
121 <div class="second-font field-title"><t>Message</t></div>
122 <div class="weak-color">
123 <n.if.visitor.is_registered>
124 <then>
125 <n.html_format_field.checkbox />
126 <label for="[n.html_format_field.name/]"><t>Message is in HTML Format</t></label><br/>
127 <div style="margin:.1em 0">
128 <n.editor_toolbar
129 textarea_id="[n.message_field.name/]"
130 original_text="[n.if.page_node.parent_node.is_post][then.page_node.parent_node.message_quoted/][/n.if.page_node.parent_node.is_post]"
131 node_id="[n.page_node.id/]"
132 />
133 </div>
134 </then>
135 </n.if.visitor.is_registered>
136 <n.message_field.textarea wrap="SOFT" tabindex="2" style="min-width:30em;max-width:55em;width:100%;height:20em;" />
137
138 <n.edit_post_extra_fields/>
139 </div>
140 </div>
141 </macro>
142
143 <macro name="edit_post_extra_fields" requires="node_page">
144 <n.extra_fields.>
145 <n.if.visitor.is_registered>
146 <then>
147 <div class="extra-fields">
148 <n.alert_field.checkbox style="margin-top:.1em"/>
149 <label for="[n.alert_field.name/]"><t>Alert me by email when someone posts to this thread</t></label>
150 </div>
151 </then>
152 </n.if.visitor.is_registered>
153 </n.extra_fields.>
154 </macro>
155
156 <macro name="is_preview">
157 <n.if.not.global_is_var_set name="is_preview">
158 <then>
159 <n.global_set_var. name="is_preview"><n.not.is_null.get_parameter name="preview" /></n.global_set_var.>
160 </then>
161 </n.if.not.global_is_var_set>
162 <n.global_var name="is_preview" />
163 </macro>
164
165 <macro name="subject_field" dot_parameter="do">
166 <n.field. name="subject"><n.do/></n.field.>
167 </macro>
168
169 <macro name="html_format_field" dot_parameter="do">
170 <n.field. name="html_format"><n.do/></n.field.>
171 </macro>
172
173 <macro name="message_field" dot_parameter="do">
174 <n.field. name="message"><n.do/></n.field.>
175 </macro>
176
177 <macro name="alert_field" dot_parameter="do">
178 <n.field. name="alert"><n.do/></n.field.>
179 </macro>
180
181 <macro name="show_edit_post_error">
182 <n.format_error.handle_exception. for="save-block">
183 <n.exception. name="required_subject">
184 <t>The subject is required.</t>
185 </n.exception.>
186 <n.spam_errors/>
187 <n.custom_edit_post_errors/>
188 </n.format_error.handle_exception.>
189 </macro>
190
191 <macro name="custom_edit_post_errors">
192 <n.comment.>To be overridden</n.comment.>
193 </macro>
194
195 <macro name="preview" requires="node">
196 <div class="title-row light-border-color shaded-bg-color" style="margin-top:.5em"><t>Message Preview</t></div>
197 <div class="light-border-color" style="padding-left:.7em;border-width:2px;border-style:solid">
198 <div class="field-box" style="width:100%;border:none">
199 <table style="border-collapse:collapse;margin-bottom:1em">
200 <tr>
201 <td><n.owner.avatar/></td>
202 <td>&nbsp;<a href="[n.owner.url/]"><n.owner.name/></a> &ndash; </td>
203 <td><b><n.subject/></b></td>
204 <td class="weak-color"><t>on <t.date.when_created.long_format/></t></td>
205 </tr>
206 </table>
207 <n.message_text/>
208 </div>
209 </div>
210 </macro>
211
212 <macro name="init_edit_post_custom_fields" requires="node_page">
213 <n.comment.>To be overridden</n.comment.>
214 </macro>
215
216 <macro name="save_edit_post_custom_fields" requires="node_page">
217 <n.comment.>To be overridden</n.comment.>
218 </macro>