[% USE CPScalar -%]
[% USE JSON -%]
[% USE Encoder -%]
[% USE Whostmgr -%]
[% WRAPPER 'master_templates/master.tmpl' theme="yui"
inside_frame_or_tab_or_popup = in_tab
skipheader = in_tab
breadcrumburl = '/scripts2/displayeximconfforedit'
extrastyle = '
html[dir="rtl"] .sortable .cell,
html[dir="rtl"] .fixedtable .cell,
html[dir="rtl"] .datatable .cell {
border-left: 1px solid #ccc;
}
html[dir="rtl"] .yui-panel .container-close {
left: 4px;
right: auto;
}
'
-%]
[% IF run %]
[% SET tabid = "backup" %]
[% PROCESS notify_displayeximconfforedit.tmpl %]
[% IF backup.status %]
<div class="okmsg">[% Encoder.safe_html_encode_str(backup.statusmsg) %]</div>
[% ELSE %]
<div class="errormsg">[% Encoder.safe_html_encode_str(backup.statusmsg) %]</div>
[% END %]
[% IF backup.status == 1 %]
[% IF backup.type == "download" %]
<script>
var Event = YAHOO.util.Event;
function download_backup() {
if (YAHOO.env.ua.ie > 0) {
var download_box = document.createElement('iframe');
download_box.name = "download_box_" + Math.random();
download_box.style.display = 'none';
download_box.src = "[% cp_security_token %]/file-download/[% backup.fileid %]";
document.body.appendChild(download_box);
var interval_id = setInterval( function() {
document.body.removeChild(download_box);
clearInterval(interval_id);
}, 300000 ); // remove after 5 minutes so they can still click ok in firefox
} else {
window.location.href = '[% cp_security_token %]/file-download/[% backup.fileid %]';
}
}
Event.on(window, "load", download_backup);
</script>
[% ELSE %]
The Exim Configuration Backup has been saved on the server as [% backup.file %]. If you want to restore this backup in the future, you can do so in the Restore Tab.
<script src="[% MagicRevision('/js/exim_tabs_optimized.js') %]"></script>
<script>
var Event = YAHOO.util.Event;
[% IF in_tab %]
Event.on(window, "load", function() {
console.log(parent);
console.log(parent.reload_tab);
parent.reload_tab('restore');
});
[% END %]
</script>
[% END %]
[% END %]
[% ELSE %]
[% WRAPPER '_brick.tmpl' bricktitle='Backup the Exim configuration' brickpercent='auto' -%]
<p>You can save a backup file of the currently installed configuration for Exim. You can upload and restore the configuration later using the <em>Restore</em> tab.</p>
<form id="backup_form" [% IF in_tab %]target="tabaction"[% END %] action="exim_config_backup" method="POST" onSubmit="notify_parent_submit();">
<input type="hidden" name="run" value="1">
<input type="hidden" name="in_tab" value="[% in_tab %]">
<div>
<div>
<input checked="checked" type="radio" name="backuptype" value="download" id="backuptype_download"><label for="backuptype_download"><strong>Download</strong></label> — This option saves the backup file on your local computer, which may offer greater security. Later, when you click the <em>Restore</em> tab, you will need to find and upload the file.
</div>
<div>
<input type="radio" name="backuptype" value="server" id="backuptype_server"><label for="backuptype_server"><strong>Save on Server</strong></label> — When you click <em>Restore</em>, the backup file appears in a table. This option requires fewer steps.</div>
</div>
<input type="submit" value="Run Backup" class="btn-primary" />
</form>
[% END #brick %]
<script>
function notify_parent_submit() {
if (parent && parent.notify_submit) {
parent.notify_submit('backup','Backing up Configuration...');
}
}
</script>
[% END %]
[% END #wrapper -%]