X-Git-Url: http://git.rot13.org/?p=BackupPC.git;a=blobdiff_plain;f=lib%2FBackupPC%2FCGI%2FBrowse.pm;h=3eb7f30ec710eaf675f7c0553f4b4e3982496fc9;hp=aeb006b94d3889e13b252f69b113caa2cf91464c;hb=a7e968ce327855f2ba2624ca8517069a936c9b5b;hpb=5729095faa3ef12dc5d4f02538c3650ac81912ef diff --git a/lib/BackupPC/CGI/Browse.pm b/lib/BackupPC/CGI/Browse.pm index aeb006b..3eb7f30 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,49 @@ 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 +270,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"; @@ -273,14 +296,22 @@ EOF $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"); + push(@otherDirs, $i); } if ( @otherDirs ) { my $otherDirs = join(",\n", @otherDirs); + my $inc = 0; + foreach my $value (@otherDirs) { + my $selected = undef; + my $showDate = timeStamp2($Backups[$inc]{startTime}); + $selected = " selected" if ($value == $num); + $otherDirs .= "\n"; + $inc++; + } $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(); }