Mercurial Hosting > nabble
view src/nabble/view/naml/move_node.naml @ 66:3fbe9cb2e325 default tip
security
author | Franklin Schmidt <fschmidt@gmail.com> |
---|---|
date | Wed, 18 Sep 2024 03:51:47 -0600 |
parents | 7ecd1a4ef557 |
children |
line wrap: on
line source
<macro name="move_node" requires="servlet"> <n.node_page.> <n.if.not.visitor.can_move.page_node> <then> <n.login.><t>Only authorized users can proceed in this area.</t></n.login.> </then> </n.if.not.visitor.can_move.page_node> <n.if.is_submitted_form> <then.save_parent_changes/> </n.if.is_submitted_form> <n.html> <head> <META NAME="robots" CONTENT="noindex,nofollow"/> <n.title.><t>Move Post</t></n.title.> <n.parent_url_field.focus/> </head> <body> <n.edit_header first_text="Move Post" second_text="[n.page_node.subject/]" /> <n.show_move_node_error/> <n.form.> <div class="weak-color" style="margin:1.5em 0 .5em"> <t>Enter permalink of the <b>post</b> or <b>forum</b> that will be the new parent, or leave blank to make this message an independent topic:</t> </div> <n.parent_url_field.input size="60" /> <div style="margin-top:1.4em"> <input type="submit" value="[t]Move Post[/t]" /> <t>or</t> <a href="[n.page_node.path/]"><t>Cancel</t></a> </div> </n.form.> </body> </n.html> </n.node_page.> </macro> <macro name="save_parent_changes"> <n.catch_exception. id="save-block"> <n.edit_page_node.> <!-- If the URL is empty, we use the current app --> <n.if.is_empty.trim.parent_url_field.value> <then.parent_url_field.set_value value="[n.page_node.get_app_node.url/]"/> </n.if.is_empty.trim.parent_url_field.value> <!-- If same site, just move. Otherwise, export it. --> <n.if.url_belongs_to_site url="[n.parent_url_field.value/]"> <then> <n.set_parent_url parent_url="[n.parent_url_field.value/]" /> <n.save_node/> </then> <else> <n.if.is_valid_export_permalink permalink="[n.parent_url_field.value/]"> <then> <!-- Hardcoded link until ExportConfirmation is templated --> <n.set_var. name='url'>/catalog/ExportConfirmation.jtp?node=<n.page_node.id/>&url=<n.parent_url_field.value/></n.set_var.> <n.redirect_to.var name='url'/> </then> <else> <n.throw_template_exception name="invalid_permalink"/> </else> </n.if.is_valid_export_permalink> </else> </n.if.url_belongs_to_site> </n.edit_page_node.> <n.redirect_to.page_node.path/> </n.catch_exception.> </macro> <macro name="parent_url_field" dot_parameter="do"> <n.field. name="parent_url"><n.do/></n.field.> </macro> <macro name="show_move_node_error"> <n.if.is_submitted_form> <then> <n.if.has_exception for="save-block"> <then> <n.format_error.handle_exception. for="save-block"> <n.exception. name="banned"> <t>Sorry, but the administrators have banned you.</t> <t>You can't move the post to anywhere.</t> </n.exception.> <n.exception. name="same_node_loop"> <t>The new parent cannot be the post itself.</t> </n.exception.> <n.exception. name="invalid_permalink"> <t>Please provide a valid permalink.</t> </n.exception.> <n.exception. name="no_anonymous"> <t>You cannot move this post to that destination because the new parent doesn't allow anonymous users.</t> </n.exception.> </n.format_error.handle_exception.> </then> </n.if.has_exception> </then> </n.if.is_submitted_form> </macro>