backup.naml
<macro name="download_backup_path">
<n.encode_url.>
/template/NamlServlet.jtp?macro=download_backup_page
</n.encode_url.>
</macro>
<macro name="download_backup_link" dot_parameter="text" parameters="title, class">
<a href="[n.download_backup_path/]" class="[n.class/]" rel="nofollow" title="[n.title/]"><n.default. to="[t]Download backup[/t]"><n.text/></n.default.></a>
</macro>
<macro name="download_backup_page" requires="servlet">
<n.if.not.visitor.is_site_admin>
<then>
<n.login.><t>Only authorized users can proceed in this area.</t></n.login.>
</then>
</n.if.not.visitor.is_site_admin>
<n.html>
<head>
<n.title.><t>Backup</t></n.title.>
</head>
<body>
<h1><t>Backup</t></h1>
<n.if.is_running_backup>
<then>
<p>
<t>The system is generating the backup now. When it is finished, a link to the backup file will be emailed to you.</t>
</p>
</then>
<else>
<p>
<t>Here you can download a backup of <t.location.root_node.subject/>.</t>
<t>When you press the button below, the system will start the generation of the backup file and
this may take some minutes to finish. You will receive an email with a link to download the file when it is ready.</t>
</p>
<p>
<n.form. macro="start_backup_process">
<input type="submit" class="toolbar action-button" value="[t]Generate backup file[/t]"/>
<t>or</t>
<a href="[n.root_node.url/]"><t>Cancel</t></a>
</n.form.>
</p>
<p class="light-bg-color rounded" style="padding:.5em 1em;margin-top:2em">
<t>The backup file is generated with the <a href="https://github.com/tig100/JdbcPgBackup">JdbcPgBackup</a> tool,
which is an open source project in Java. You should visit the project website if you want to restore your backup
into a Postgresql database.</t>
</p>
</else>
</n.if.is_running_backup>
</body>
</n.html>
</macro>
<macro name="start_backup_process" requires="servlet">
<n.if.visitor.is_site_admin>
<then>
<n.make_backup email="[n.visitor.user_email/]"/>
<n.redirect_to.download_backup_path/>
</then>
</n.if.visitor.is_site_admin>
</macro>
<macro name="backup email" parameters="email, file" unindent="true">
<n.new_email.>
<n.send>
<to><n.email/></to>
<subject><t>Backup of <t.location.root_node.subject/></t></subject>
<text_part>
<t>Dear user,</t>
<t>Here is your backup file:</t>
<n.server_url/>/backups/<n.encode_url.file/>
<t>Sincerely,</t>
<t>The Nabble team</t>
________________________________________
<t>Free Embeddable <t.app.root_node.view_name/></t> powered by Nabble
<n.nabble_homepage/>
</text_part>
</n.send>
</n.new_email.>
</macro>
<macro name="site deletion email" parameters="file" unindent="true">
<n.new_email.>
<n.send>
<to><n.root_node.owner.user_email/></to>
<subject><t><t.location.root_node.subject/> has been deleted</t></subject>
<text_part>
<t>Dear user,</t>
<t>Your Nabble site "<t.location.root_node.subject/>" has been deleted.</t>
<t>You can download a backup of this site from the link below.
Nabble will try to keep this backup available for a few months, but this is not guaranteed.
If this content is important to you, save this copy as soon as possible.</t>
<n.server_url/>/backups/<n.encode_url.file/>
<t>Sincerely,</t>
<t>The Nabble team</t>
________________________________________
<t>Free Embeddable <t.app.root_node.view_name/></t> powered by Nabble
<n.nabble_homepage/>
</text_part>
</n.send>
</n.new_email.>
</macro>