X-Git-Url: http://git.rot13.org/?p=BackupPC.git;a=blobdiff_plain;f=lib%2FBackupPC%2FCGI%2FDirHistory.pm;h=acbe73ab895a6f99fb2da2d79734529fb6ee8fd5;hp=45bb01d34f431f9eb5239032c62fc6c604ac7418;hb=b81d2da5e16975674f011e4833337ac0fa24e0ea;hpb=329e870f56fb6572fa697998d33676588034c149 diff --git a/lib/BackupPC/CGI/DirHistory.pm b/lib/BackupPC/CGI/DirHistory.pm index 45bb01d..acbe73a 100644 --- a/lib/BackupPC/CGI/DirHistory.pm +++ b/lib/BackupPC/CGI/DirHistory.pm @@ -28,7 +28,7 @@ # #======================================================================== # -# Version 2.1.0_CVS, released 3 Jul 2003. +# Version 3.0.0beta2, released 11 Nov 2006. # # See http://backuppc.sourceforge.net. # @@ -40,6 +40,7 @@ use strict; use BackupPC::CGI::Lib qw(:all); use BackupPC::View; use BackupPC::Attrib qw(:all); +use Encode; sub action { @@ -71,7 +72,8 @@ sub action ErrorExit($Lang->{Nice_try__but_you_can_t_put}); } - for ( $i = 0 ; $i < @Backups ; $i++ ) { + my @backupList = $view->backupList($share, $dir); + foreach $i ( @backupList ) { my $backupTime = timeStamp2($Backups[$i]{startTime}); my $num = $Backups[$i]{num}; $backupNumStr .= "$fDisp"; my($colSpan, $url, $inode, $type); - for ( $i = 0 ; $i < @Backups ; $i++ ) { + my $tdClass = ' class="histView"'; + foreach $i ( @backupList ) { my($path); if ( $colSpan > 0 ) { # @@ -102,11 +106,23 @@ sub action $colSpan++; next; } - $fileStr .= "$url"; + # + # Also handle the case of a sequence of missing files + # + if ( !defined($hist->{$f}[$i]) && $inode == -3 ) { + $colSpan++; + next; + } + $fileStr .= "" + . "$url"; $colSpan = 0; + $tdClass = ' class="histView"'; } if ( !defined($hist->{$f}[$i]) ) { - $fileStr .= ""; + $colSpan = 1; + $url = " "; + $inode = -3; # special value for missing + $tdClass = ' class="histViewMis"'; next; } if ( $dir eq "" ) { @@ -118,17 +134,21 @@ sub action $path =~ s/([^\w.\/-])/uc sprintf("%%%02X", ord($1))/eg; my $num = $hist->{$f}[$i]{backupNum}; if ( $hist->{$f}[$i]{type} == BPC_FTYPE_DIR ) { - $inode = -2; + $inode = -2; # special value for dir $type = $hist->{$f}[$i]{type}; $url = <dir +$Lang->{DirHistory_dirLink} EOF } else { $inode = $hist->{$f}[$i]{inode}; $type = $hist->{$f}[$i]{type}; + # + # special value for empty file + # $inode = -1 if ( $hist->{$f}[$i]{size} == 0 ); if ( !defined($inode2name{$inode}) ) { - $inode2name{$inode} = "v$nameCnt"; + $inode2name{$inode} + = "$Lang->{DirHistory_fileLink}$nameCnt"; $nameCnt++; } $url = < 0 ) { - $fileStr .= "$url"; + $fileStr .= "$url"; $colSpan = 0; } $fileStr .= "\n"; } - my $dirDisplay = "$share/$dir"; + my $dirDisplay = decode_utf8("$share/$dir"); $dirDisplay =~ s{//+}{/}g; $dirDisplay =~ s{/+$}{}g; $dirDisplay = "/" if ( $dirDisplay eq "" ); - - Header(eval("qq{$Lang->{DirHistory_backup_for__host}}")); - - print (eval("qq{$Lang->{DirHistory_for__host}}")); - + my $content = eval("qq{$Lang->{DirHistory_for__host}}"); + Header(eval("qq{$Lang->{DirHistory_backup_for__host}}"), $content); Trailer(); }