1 <?php
defined('SYSPATH') OR die('No direct access allowed.'); ?
>
3 <script type
="text/javascript">
5 $
('#backupstatus').css( "display", "block" ).load('<?php echo url::base() . 'index
.php
/backup
/backup
/'; ?>', function(){
6 if ($
(this
).find('span').hasClass('ok'))
8 var file
= $
('#backupfilename').text();
9 if ($
('#backups tbody tr:first a:first').text() != file
&& !$
('.download:contains('+file+
')').length
) {
10 $
('#backups tbody tr:nth-child(2)').before('<tr class="' +
($
('#backups tr:last').attr('class') == 'odd' ?
'even' : 'odd') +
'">'
11 +
'<td><a class="view" href="<?php echo url::base(); ?>index.php/backup/view/' + file
12 +
'" style="border: 0px"><?php echo html::image($this->add_path('/icons
/16x16
/backup
-view
.png
'),
13 array('alt
' => _('View
'), 'title
' => _('View
'))); ?></a>'
14 +
' <a class="restore" href="<?php echo url::base(); ?>index.php/backup/restore/' + file
15 +
'" style="border: 0px" title="index.php/backup/restore/'+file+
'"><?php echo html::image($this->add_path('/icons
/16x16
/backup
-restore
.png
'),
16 array('alt
' => _('Restore
'), 'title
' => _('Restore
'))); ?></a>'
17 +
' <a class="delete" href="<?php echo url::base(); ?>index.php/backup/delete/' + file
18 +
'" style="border: 0px"><?php echo html::image($this->add_path('/icons
/16x16
/backup
-delete
.png
'),
19 array('alt
' => _('Delete
'), 'title
' => _('Delete
'))); ?></a>'
20 +
'</td>' +
'<td><a class="download" href="<?php echo url::base(); ?>index.php/backup/download/' + file +
'">' + file +
'</a></td></tr>');
26 $
(document
).ready(function() {
27 $
('a.restore').fancybox({
28 'overlayOpacity': 0.7,
29 'overlayColor' : '#ffffff',
30 'hideOnContentClick': false,
31 'hideOnOverlayClick': false,
33 'showCloseButton': false,
34 'enableEscapeButton': false,
35 'autoDimensions': false,
38 'onStart': function(link
) {
40 if(l
.is('.restore') && !confirm('Do you really want to restore the backup ' + l
.closest('tr').find('.download').text() +
' ?')) {
41 l
.data('cancelled', true);
48 $
('#verify').live('click', function(){
50 alert("Already performing an action ("+status+
"), try again soon");
56 $
('#backupstatus').css( "display", "block" ).load($
(link
).attr('href'), function(){
58 if ($
(this
).find('span').hasClass('ok'))
59 setTimeout(backup
, 2000);
64 $
('a.restore').live('click', function(ev
){
66 alert("Already performing an action ("+status+
"), try again soon");
70 if(link
.data('cancelled')) {
71 link
.removeData('cancelled');
75 $
('#backupstatus').css( "display", "block" ).text('Restoring backup...');
77 $
('#fancybox-content').load(link
.attr('title'), function() {
78 $
('#fancybox-close').show();
80 $
('#backupstatus').text($
('#fancybox-content').text());
86 $
('a.delete').live('click', function(){
88 if (confirm('Do you really want to delete ' + $
(link
).closest('tr').find('.download').text() +
' ?'))
89 $
('#backupstatus').css( "display", "block" ).load($
(link
).attr('href'), function(){
90 if ($
(this
).find('span').hasClass('ok'))
91 $
(link
).closest('tr').remove();
96 window
.onbeforeunload
= function(event
){
97 event
= event || window
.event
;
99 if(status
== 'restoring'){
100 message
= "Your configuration is being restored from a backup, do you really want to abort?";
101 } else if(status
== 'saving') {
102 message
= "Your configuration is being saved, do you really want to abort?";
105 event
.returnValue
= message
;
114 <div
class="alert warning" style
="display: none" id
="backupstatus"> 
;</div
>
116 <div style
="display: none">
117 <div id
="restore-status" class="alert warning"><img src
="/ninja/application/media/images/loading.gif" /></div
>
120 <table id
="backups" class="padd-table">
123 <th style
="width: 96px"><?php
echo _('Actions'); ?
></th
>
124 <th
><?php
echo _('Backups'); ?
></th
>
130 foreach ($files as $file): $i++
;
132 <tr
class="<?php echo ($i%2 == 0) ? 'odd' : 'even'; ?>">
134 <a
class="view" href
="<?php echo url::base() . 'index.php/backup/view/' . $file; ?>" style
="border: 0px"><?php
echo html
::image($this->add_path('/icons/16x16/backup-view.png'), array('alt' => _('View'), 'title' => _('View'))); ?
></a
>
135 <a
class="restore" href
="#restore-status" title
="<?php echo url::base() . 'index.php/backup/restore/' . $file; ?>" style
="border: 0px"><?php
echo html
::image($this->add_path('/icons/16x16/backup-restore.png'), array('alt' => _('Restore'), 'title' => _('Restore'))); ?
></a
>
136 <a
class="delete" href
="<?php echo url::base() . 'index.php/backup/delete/' . $file; ?>" style
="border: 0px"><?php
echo html
::image($this->add_path('/icons/16x16/backup-delete.png'), array('alt' => _('Delete'), 'title' => _('Delete'))); ?
></a
>
138 <td
><a
class="download" href
="<?php echo url::base() . 'index.php/backup/download/' . $file; ?>" target
="_blank"><?php
echo $file; ?
></a
></td
>