show all increments without archived copy
authorDobrica Pavlinusic <dpavlin@rot13.org>
Fri, 28 Jan 2011 20:50:54 +0000 (21:50 +0100)
committerDobrica Pavlinusic <dpavlin@rot13.org>
Fri, 28 Jan 2011 20:50:54 +0000 (21:50 +0100)
This is mid-size change but it brings web interface in-sync with
default operation of BackupPC_ASA_ArchiveStart

lib/BackupPC/CGI/Archive.pm

index f20bed3..cbf5f63 100644 (file)
@@ -39,6 +39,7 @@ package BackupPC::CGI::Archive;
 use strict;
 use BackupPC::CGI::Lib qw(:all);
 use Data::Dumper;
 use strict;
 use BackupPC::CGI::Lib qw(:all);
 use Data::Dumper;
+use DBI;
 
 sub action
 {
 
 sub action
 {
@@ -71,6 +72,29 @@ sub action
             }
             $fullSizeTot += $fullSize + $incrSizeTot;
             $fullSize = sprintf("%.2f", ($fullSize + $incrSizeTot) / 1000);
             }
             $fullSizeTot += $fullSize + $incrSizeTot;
             $fullSize = sprintf("%.2f", ($fullSize + $incrSizeTot) / 1000);
+
+               $bpc->ConfigRead($archHost);
+               %Conf = $bpc->Conf();
+
+               my $dbh = DBI->connect($Conf{SearchDSN}, $Conf{SearchUser}, "", { RaiseError => 1, AutoCommit => 0 });
+               my $backup_nums = $dbh->selectcol_arrayref(qq{
+                       select
+                               backups.num as num
+                       from backups
+                       join hosts on hosts.id = hostid
+                       where hosts.name = ? and inc_size < 0 and size > 0 and not inc_deleted
+               }, {}, $host);
+
+               my $checkboxes;
+               foreach my $backupnumber ( sort @$backup_nums ) {
+                       $checkboxes .= qq|
+<input type="hidden" name="fcb$checkBoxCnt" value="$host">
+<input type="checkbox" name="backup$checkBoxCnt" value="$backupnumber">$backupnumber
+                       |;
+                       $checkBoxCnt++;
+               }
+
+=for ASA extension removed this
             $str = <<EOF;
 <tr>
 <td class="border"><input type="hidden" name="backup$checkBoxCnt" value="$backupnumber"><input type="checkbox" name="fcb$checkBoxCnt" value="$host">&nbsp;${HostLink($host)} </td>
             $str = <<EOF;
 <tr>
 <td class="border"><input type="hidden" name="backup$checkBoxCnt" value="$backupnumber"><input type="checkbox" name="fcb$checkBoxCnt" value="$host">&nbsp;${HostLink($host)} </td>
@@ -78,6 +102,20 @@ sub action
 <td align="center" class="border"> $fullSize </td>
 EOF
             $checkBoxCnt++;
 <td align="center" class="border"> $fullSize </td>
 EOF
             $checkBoxCnt++;
+=cut
+
+            $str = <<EOF;
+<tr>
+<td class="border">
+${HostLink($host)}
+$checkboxes
+</td>
+<td align="center" class="border">
+${UserLink($Hosts->{$host}{user})}
+</td>
+<td align="center" class="border"> $fullSize </td>
+EOF
+
             if ( @Backups == 0 ) {
                 $hostCntNone++;
                 $strNone .= $str;
             if ( @Backups == 0 ) {
                 $hostCntNone++;
                 $strNone .= $str;
@@ -131,7 +169,7 @@ EOF
 <input type="hidden" name="backup$i" value="$In{'backup' . $i}">
 EOF
             $HostListStr .= <<EOF;
 <input type="hidden" name="backup$i" value="$In{'backup' . $i}">
 EOF
             $HostListStr .= <<EOF;
-<li> ${EscHTML($name)}
+<li> ${EscHTML($name)} $i
 EOF
         }
         $hiddenStr .= <<EOF;
 EOF
         }
         $hiddenStr .= <<EOF;