added common BackupPC::Search::host_backup_nums
[BackupPC.git] / lib / BackupPC / CGI / Archive.pm
index d11b3f3..18f7ba4 100644 (file)
@@ -10,7 +10,7 @@
 #   Craig Barratt  <cbarratt@users.sourceforge.net>
 #
 # COPYRIGHT
-#   Copyright (C) 2003  Craig Barratt
+#   Copyright (C) 2003-2009  Craig Barratt
 #
 #   This program is free software; you can redistribute it and/or modify
 #   it under the terms of the GNU General Public License as published by
@@ -28,7 +28,7 @@
 #
 #========================================================================
 #
-# Version 3.0.0beta1, released 30 Jul 2006.
+# Version 3.2.0, released 31 Jul 2010.
 #
 # See http://backuppc.sourceforge.net.
 #
@@ -39,6 +39,7 @@ package BackupPC::CGI::Archive;
 use strict;
 use BackupPC::CGI::Lib qw(:all);
 use Data::Dumper;
+use BackupPC::Search;
 
 sub action
 {
@@ -60,6 +61,7 @@ sub action
             my($fullDur, $incrCnt, $fullSize, $fullRate);
             my @Backups = $bpc->BackupInfoRead($host);
             my $fullCnt = $incrCnt = 0;
+
             for ( my $i = 0 ; $i < @Backups ; $i++ ) {
                 if ( $Backups[$i]{type} eq "full" ) {
                     $fullSize = $Backups[$i]{size} / (1024 * 1024);
@@ -71,6 +73,20 @@ sub action
             }
             $fullSizeTot += $fullSize + $incrSizeTot;
             $fullSize = sprintf("%.2f", ($fullSize + $incrSizeTot) / 1000);
+
+               $bpc->ConfigRead($archHost);
+               %Conf = $bpc->Conf();
+
+               my $checkboxes;
+               foreach my $backupnumber ( BackupPC::Search::host_backup_nums($host) ) {
+                       $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>
@@ -78,6 +94,20 @@ sub action
 <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;
@@ -124,6 +154,7 @@ EOF
             next if ( !defined($In{"fcb$i"}) );
             my $name = $In{"fcb$i"};
             my $backupno = $In{"backup$i"};
+            next unless defined $backupno; # ASA - skip hosts without backups checked
             push(@HostList, $name);
             push(@BackupList, $backupno);
             $hiddenStr .= <<EOF;
@@ -131,7 +162,7 @@ EOF
 <input type="hidden" name="backup$i" value="$In{'backup' . $i}">
 EOF
             $HostListStr .= <<EOF;
-<li> ${EscHTML($name)}
+<li> ${EscHTML($name)} $i
 EOF
         }
         $hiddenStr .= <<EOF;
@@ -202,7 +233,7 @@ EOF
                 $compname = $Conf{CatPath};
                 $compext = '.raw';
             }
-            my $fullsplitsize = $In{splitsize} . '000000';
+            my $fullsplitsize = $In{splitsize} . '000000'; # mb -> bytes
             my %ArchiveReq = (
                 # parameters for the archive
                 archiveloc  => $In{archive_device},