X-Git-Url: http://git.rot13.org/?a=blobdiff_plain;f=lib%2FBackupPC%2FCGI%2FBrowse.pm;h=70dd4a1be6d3e12d3ef6eab1437cee1b847c1869;hb=a7690ea45972ea3db587bd94fa573edf20d75c91;hp=aeb006b94d3889e13b252f69b113caa2cf91464c;hpb=359a795122e5fd5888ad92731147dcd7c1d6db12;p=BackupPC.git diff --git a/lib/BackupPC/CGI/Browse.pm b/lib/BackupPC/CGI/Browse.pm index aeb006b..70dd4a1 100644 --- a/lib/BackupPC/CGI/Browse.pm +++ b/lib/BackupPC/CGI/Browse.pm @@ -60,6 +60,15 @@ sub action # Find the requested backup and the previous filled backup # my @Backups = $bpc->BackupInfoRead($host); + + # + # default to the newest backup + # + if ( !defined($In{num}) && defined(@Backups) ) { + $i = @Backups - 1; + $num = $Backups[$i]{num}; + } + for ( $i = 0 ; $i < @Backups ; $i++ ) { last if ( $Backups[$i]{num} == $num ); } @@ -129,28 +138,28 @@ sub action # Display directory if it exists in current backup. # First find out if there are subdirs # - my($bold, $unbold, $BGcolor); + my $tdStyle; + my $linkStyle = "fview"; $img |= 1 << 6; $img |= 1 << 5 if ( $attr->{$f}{nlink} > 2 ); if ( $dirOpen ) { - $bold = ""; - $unbold = ""; + $linkStyle = "fviewbold"; $img |= 1 << 2; $img |= 1 << 3 if ( $attr->{$f}{nlink} > 2 ); } my $imgFileName = sprintf("%07b.gif", $img); $imgStr = ""; if ( "$relDir/$f" eq $dir ) { - $BGcolor = " bgcolor=\"$Conf{CgiHeaderBgColor}\""; + $tdStyle = "fviewon"; } else { - $BGcolor = ""; + $tdStyle = "fviewoff"; } my $dirName = $f; $dirName =~ s/ / /g; push(@DirStr, {needTick => 1, - tdArgs => $BGcolor, + tdArgs => " class=\"$tdStyle\"", link => <$imgStr $bold$dirName$unbold +$imgStr $dirName EOF $fileCnt++; $gotDir = 1; @@ -184,34 +193,41 @@ EOF # # This is the selected directory, so display all the files # - my $attrStr; + my ($attrStr, $iconStr); if ( defined($a = $attr->{$f}) ) { my $mtimeStr = $bpc->timeStamp($a->{mtime}); # UGH -> fix this my $typeStr = BackupPC::Attrib::fileType2Text(undef, $a->{type}); my $modeStr = sprintf("0%o", $a->{mode} & 07777); + $iconStr = < +EOF $attrStr .= <$typeStr - $modeStr - $a->{backupNum} - $a->{size} - $mtimeStr + $typeStr + $modeStr + $a->{backupNum} + $a->{size} + $mtimeStr EOF } else { - $attrStr .= " \n"; + $attrStr .= " \n"; } (my $fDisp = "${EscHTML($f)}") =~ s/ / /g; if ( $gotDir ) { $fileStr .= < $fDisp + +  $iconStr $fDisp + $attrStr EOF } else { $fileStr .= < $fDisp + +  $iconStr $fDisp + $attrStr EOF @@ -246,7 +262,6 @@ EOF my $numF = join(", #", @mergeNums); $filledBackup = eval("qq{$Lang->{This_display_is_merged_with_backup}}"); } - Header(eval("qq{$Lang->{Browse_backup__num_for__host}}")); foreach my $d ( @DirStrPrev ) { $dirStr .= "{tdArgs}>$d->{link}\n"; @@ -267,20 +282,23 @@ EOF } else { $fileStr = eval("qq{$Lang->{The_directory_is_empty}}"); } - my @otherDirs; my $pathURI = $dir; my $shareURI = $share; $pathURI =~ s/([^\w.\/-])/uc sprintf("%%%02x", ord($1))/eg; $shareURI =~ s/([^\w.\/-])/uc sprintf("%%%02x", ord($1))/eg; - foreach my $i ( $view->backupList($share, $dir) ) { - push(@otherDirs, "$i"); - } - if ( @otherDirs ) { - my $otherDirs = join(",\n", @otherDirs); + if ( my @otherDirs = $view->backupList($share, $dir) ) { + my $otherDirs; + foreach my $i ( @otherDirs ) { + my $selected; + my $showDate = timeStamp2($Backups[$i]{startTime}); + my $backupNum = $Backups[$i]{num}; + $selected = " selected" if ( $backupNum == $num ); + $otherDirs .= "\n"; + } $filledBackup .= eval("qq{$Lang->{Visit_this_directory_in_backup}}"); } - print (eval("qq{$Lang->{Backup_browse_for__host}}")); + my $content = eval("qq{$Lang->{Backup_browse_for__host}}"); + Header(eval("qq{$Lang->{Browse_backup__num_for__host}}"), $content); Trailer(); }