# 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
#
#========================================================================
#
-# Version 3.0.0beta2, released 11 Nov 2006.
+# Version 3.2.0, released 31 Jul 2010.
#
# See http://backuppc.sourceforge.net.
#
package BackupPC::CGI::Browse;
use strict;
-use Encode;
+use Encode qw/decode_utf8/;
use BackupPC::CGI::Lib qw(:all);
use BackupPC::View;
use BackupPC::Attrib qw(:all);
#
# default to the newest backup
#
- if ( !defined($In{num}) && defined(@Backups) ) {
+ if ( !defined($In{num}) && defined(@Backups) && @Backups > 0 ) {
$i = @Backups - 1;
$num = $Backups[$i]{num};
}
my $backupTime = timeStamp2($Backups[$i]{startTime});
my $backupAge = sprintf("%.1f", (time - $Backups[$i]{startTime})
/ (24 * 3600));
- my $view = BackupPC::View->new($bpc, $host, \@Backups);
+ my $view = BackupPC::View->new($bpc, $host, \@Backups, {nlink => 1, only_increment => $In{only_increment}});
if ( $dir eq "" || $dir eq "." || $dir eq ".." ) {
$attr = $view->dirAttrib($num, "", "");
push(@DirStr, {needTick => 1,
tdArgs => " class=\"$tdStyle\"",
link => <<EOF});
-<a href="$MyURL?action=browse&host=${EscURI($host)}&num=$num&share=$shareURI&dir=$path">$imgStr</a><a href="$MyURL?action=browse&host=${EscURI($host)}&num=$num&share=$shareURI&dir=$path" class="$linkStyle"> $dirName</a></td></tr>
+<a href="$MyURL?action=browse&host=${EscURI($host)}&num=$num&share=$shareURI&dir=$path">$imgStr</a><a href="$MyURL?action=browse&host=${EscURI($host)}&num=$num&share=$shareURI&dir=$path&only_increment=$In{only_increment}" class="$linkStyle"> $dirName</a></td></tr>
EOF
$fileCnt++;
$gotDir = 1;
my $showDate = timeStamp2($Backups[$i]{startTime});
my $backupNum = $Backups[$i]{num};
$selected = " selected" if ( $backupNum == $num );
- $otherDirs .= "<option value=\"$MyURL?action=browse&host=${EscURI($host)}&num=$backupNum&share=$shareURI&dir=$pathURI\"$selected>#$backupNum - ($showDate)</option>\n";
+ $otherDirs .= "<option value=\"$MyURL?action=browse&host=${EscURI($host)}&num=$backupNum&share=$shareURI&dir=$pathURI&only_increment=$In{only_increment}\"$selected>#$backupNum - ($showDate)</option>\n";
}
$filledBackup .= eval("qq{$Lang->{Visit_this_directory_in_backup}}");
}
- $dir = decode_utf8($dir);
+
+ # XXX ASA
+ my $checked = $In{only_increment} ? ' checked' : '';
+ $filledBackup .= "<li><input type=checkbox name=only_increment$checked> show only this increment";
+
+ $dir = decode_utf8($dir);
+ $share = decode_utf8($share);
my $content = eval("qq{$Lang->{Backup_browse_for__host}}");
Header(eval("qq{$Lang->{Browse_backup__num_for__host}}"), $content);
Trailer();