0
|
1 <macro name="move_node" requires="servlet">
|
|
2 <n.node_page.>
|
|
3 <n.if.not.visitor.can_move.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_move.page_node>
|
|
8
|
|
9 <n.if.is_submitted_form>
|
|
10 <then.save_parent_changes/>
|
|
11 </n.if.is_submitted_form>
|
|
12
|
|
13 <n.html>
|
|
14 <head>
|
|
15 <META NAME="robots" CONTENT="noindex,nofollow"/>
|
|
16 <n.title.><t>Move Post</t></n.title.>
|
|
17 <n.parent_url_field.focus/>
|
|
18 </head>
|
|
19 <body>
|
|
20 <n.edit_header first_text="Move Post" second_text="[n.page_node.subject/]" />
|
|
21 <n.show_move_node_error/>
|
|
22 <n.form.>
|
|
23 <div class="weak-color" style="margin:1.5em 0 .5em">
|
|
24 <t>Enter permalink of the <b>post</b> or <b>forum</b> that will be the new parent,
|
|
25 or leave blank to make this message an independent topic:</t>
|
|
26 </div>
|
|
27 <n.parent_url_field.input size="60" />
|
|
28 <div style="margin-top:1.4em">
|
|
29 <input type="submit" value="[t]Move Post[/t]" /> <t>or</t> <a href="[n.page_node.path/]"><t>Cancel</t></a>
|
|
30 </div>
|
|
31 </n.form.>
|
|
32 </body>
|
|
33 </n.html>
|
|
34 </n.node_page.>
|
|
35 </macro>
|
|
36
|
|
37 <macro name="save_parent_changes">
|
|
38 <n.catch_exception. id="save-block">
|
|
39 <n.edit_page_node.>
|
|
40 <!-- If the URL is empty, we use the current app -->
|
|
41 <n.if.is_empty.trim.parent_url_field.value>
|
|
42 <then.parent_url_field.set_value value="[n.page_node.get_app_node.url/]"/>
|
|
43 </n.if.is_empty.trim.parent_url_field.value>
|
|
44
|
|
45 <!-- If same site, just move. Otherwise, export it. -->
|
|
46 <n.if.url_belongs_to_site url="[n.parent_url_field.value/]">
|
|
47 <then>
|
|
48 <n.set_parent_url parent_url="[n.parent_url_field.value/]" />
|
|
49 <n.save_node/>
|
|
50 </then>
|
|
51 <else>
|
|
52 <n.if.is_valid_export_permalink permalink="[n.parent_url_field.value/]">
|
|
53 <then>
|
|
54 <!-- Hardcoded link until ExportConfirmation is templated -->
|
|
55 <n.set_var. name='url'>/catalog/ExportConfirmation.jtp?node=<n.page_node.id/>&url=<n.parent_url_field.value/></n.set_var.>
|
|
56 <n.redirect_to.var name='url'/>
|
|
57 </then>
|
|
58 <else>
|
|
59 <n.throw_template_exception name="invalid_permalink"/>
|
|
60 </else>
|
|
61 </n.if.is_valid_export_permalink>
|
|
62 </else>
|
|
63 </n.if.url_belongs_to_site>
|
|
64 </n.edit_page_node.>
|
|
65 <n.redirect_to.page_node.path/>
|
|
66 </n.catch_exception.>
|
|
67 </macro>
|
|
68
|
|
69 <macro name="parent_url_field" dot_parameter="do">
|
|
70 <n.field. name="parent_url"><n.do/></n.field.>
|
|
71 </macro>
|
|
72
|
|
73 <macro name="show_move_node_error">
|
|
74 <n.if.is_submitted_form>
|
|
75 <then>
|
|
76 <n.if.has_exception for="save-block">
|
|
77 <then>
|
|
78 <n.format_error.handle_exception. for="save-block">
|
|
79 <n.exception. name="banned">
|
|
80 <t>Sorry, but the administrators have banned you.</t>
|
|
81 <t>You can't move the post to anywhere.</t>
|
|
82 </n.exception.>
|
|
83 <n.exception. name="same_node_loop">
|
|
84 <t>The new parent cannot be the post itself.</t>
|
|
85 </n.exception.>
|
|
86 <n.exception. name="invalid_permalink">
|
|
87 <t>Please provide a valid permalink.</t>
|
|
88 </n.exception.>
|
|
89 <n.exception. name="no_anonymous">
|
|
90 <t>You cannot move this post to that destination because the new parent doesn't allow anonymous users.</t>
|
|
91 </n.exception.>
|
|
92 </n.format_error.handle_exception.>
|
|
93 </then>
|
|
94 </n.if.has_exception>
|
|
95 </then>
|
|
96 </n.if.is_submitted_form>
|
|
97 </macro>
|