From 4ccad54a1f16abeffa0bf9a96df117d378eba9c1 Mon Sep 17 00:00:00 2001 From: cbarratt Date: Mon, 7 Jul 2003 03:09:23 +0000 Subject: [PATCH] * Updated CGI DirHistory: added colors, added explanatory text. --- ChangeLog | 3 +++ lib/BackupPC/CGI/DirHistory.pm | 30 +++++++++++++++++++++++------- lib/BackupPC/CGI/Restore.pm | 1 + lib/BackupPC/Lang/de.pm | 31 +++++++++++++++++++++++-------- lib/BackupPC/Lang/en.pm | 31 +++++++++++++++++++++++-------- lib/BackupPC/Lang/es.pm | 31 +++++++++++++++++++++++-------- lib/BackupPC/Lang/fr.pm | 31 +++++++++++++++++++++++-------- lib/BackupPC/View.pm | 2 +- 8 files changed, 120 insertions(+), 40 deletions(-) diff --git a/ChangeLog b/ChangeLog index ab0bfbf..86a98cb 100644 --- a/ChangeLog +++ b/ChangeLog @@ -27,6 +27,9 @@ * Added directory history display to BackupPC_Admin, allowing the user to quickly see which files changed between backups. +* Browsing and directory history now sort the files in a + case-insensitive manner. + * Swapped the Server and Hosts sections on the Nav bar. Moved the host search text box to the top of the hosts section. This was done to move the variable-length part of the Nav bar (when all diff --git a/lib/BackupPC/CGI/DirHistory.pm b/lib/BackupPC/CGI/DirHistory.pm index 45bb01d..a1b2d2d 100644 --- a/lib/BackupPC/CGI/DirHistory.pm +++ b/lib/BackupPC/CGI/DirHistory.pm @@ -85,7 +85,7 @@ sub action my $nameCnt = 0; (my $fDisp = "${EscHTML($f)}") =~ s/ / /g; $fileStr .= "$fDisp"; - my($colSpan, $url, $inode, $type); + my($colSpan, $url, $inode, $type, $tdColor); for ( $i = 0 ; $i < @Backups ; $i++ ) { my($path); if ( $colSpan > 0 ) { @@ -102,11 +102,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; + $tdColor = ""; } if ( !defined($hist->{$f}[$i]) ) { - $fileStr .= ""; + $colSpan = 1; + $url = " "; + $inode = -3; # special value for missing + $tdColor = ' bgcolor="#ffffaa"'; next; } if ( $dir eq "" ) { @@ -118,17 +130,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"; diff --git a/lib/BackupPC/CGI/Restore.pm b/lib/BackupPC/CGI/Restore.pm index 8e2022e..f236e1e 100644 --- a/lib/BackupPC/CGI/Restore.pm +++ b/lib/BackupPC/CGI/Restore.pm @@ -38,6 +38,7 @@ package BackupPC::CGI::Restore; use strict; use BackupPC::CGI::Lib qw(:all); +use Data::Dumper; sub action { diff --git a/lib/BackupPC/Lang/de.pm b/lib/BackupPC/Lang/de.pm index 23fc3a1..7136c52 100644 --- a/lib/BackupPC/Lang/de.pm +++ b/lib/BackupPC/Lang/de.pm @@ -1,4 +1,4 @@ -#!/bin/perl -T +#!/bin/perl # # by Manfred Herrmann (V1.1) (some typo errors + 3 new strings) # CVS-> Revision ??? @@ -618,24 +618,39 @@ EOF # ------------------------------ $Lang{DirHistory_backup_for__host} = "(ENGLISH) BackupPC: Directory backup history for \$host"; +# +# These two strings are used to build the links for directories and +# file versions. Files are appended with a version number. +# +$Lang{DirHistory_dirLink} = "(ENGLISH) dir"; +$Lang{DirHistory_fileLink} = "(ENGLISH) v"; + $Lang{DirHistory_for__host} = < This display shows each unique version of files across all the backups:
  • Click on a backup number to return to the backup browser, -
  • Click on a directory link to navigate into that directory, -
  • Click on a file version link to download that file. +
  • Click on a directory link (\$Lang->{DirHistory_dirLink}) to navigate + into that directory, +
  • Click on a file version link (\$Lang->{DirHistory_fileLink}0, + \$Lang->{DirHistory_fileLink}1, ...) to download that file, +
  • Files with the same contents between different backups have the same + version number, +
  • Files or directories not present in a particular backup have an + empty box. +
  • Files shown with the same version might have different attributes. + Select the backup number to see the file attributes.
\${h2("History of \${EscHTML(\$dirDisplay)}")}
- -\$backupNumStr -\$backupTimeStr +
Backup number
Backup time
+\$backupNumStr +\$backupTimeStr \$fileStr
Backup number
Backup time
EOF diff --git a/lib/BackupPC/Lang/en.pm b/lib/BackupPC/Lang/en.pm index 099bfab..a6b27d0 100644 --- a/lib/BackupPC/Lang/en.pm +++ b/lib/BackupPC/Lang/en.pm @@ -1,4 +1,4 @@ -#!/bin/perl -T +#!/bin/perl #my %lang; @@ -615,23 +615,38 @@ EOF # ------------------------------ $Lang{DirHistory_backup_for__host} = "BackupPC: Directory backup history for \$host"; -$Lang{DirHistory_for__host} = < This display shows each unique version of files across all the backups:
  • Click on a backup number to return to the backup browser, -
  • Click on a directory link to navigate into that directory, -
  • Click on a file version link to download that file. +
  • Click on a directory link (\$Lang->{DirHistory_dirLink}) to navigate + into that directory, +
  • Click on a file version link (\$Lang->{DirHistory_fileLink}0, + \$Lang->{DirHistory_fileLink}1, ...) to download that file, +
  • Files with the same contents between different backups have the same + version number, +
  • Files or directories not present in a particular backup have an + empty box. +
  • Files shown with the same version might have different attributes. + Select the backup number to see the file attributes.
\${h2("History of \${EscHTML(\$dirDisplay)}")}
- -\$backupNumStr -\$backupTimeStr +
Backup number
Backup time
+\$backupNumStr +\$backupTimeStr \$fileStr
Backup number
Backup time
EOF diff --git a/lib/BackupPC/Lang/es.pm b/lib/BackupPC/Lang/es.pm index 7454817..b5fd657 100644 --- a/lib/BackupPC/Lang/es.pm +++ b/lib/BackupPC/Lang/es.pm @@ -1,4 +1,4 @@ -#!/bin/perl -T +#!/bin/perl #my %lang; @@ -617,24 +617,39 @@ EOF # ------------------------------ $Lang{DirHistory_backup_for__host} = "(ENGLISH) BackupPC: Directory backup history for \$host"; +# +# These two strings are used to build the links for directories and +# file versions. Files are appended with a version number. +# +$Lang{DirHistory_dirLink} = "(ENGLISH) dir"; +$Lang{DirHistory_fileLink} = "(ENGLISH) v"; + $Lang{DirHistory_for__host} = < This display shows each unique version of files across all the backups:
  • Click on a backup number to return to the backup browser, -
  • Click on a directory link to navigate into that directory, -
  • Click on a file version link to download that file. +
  • Click on a directory link (\$Lang->{DirHistory_dirLink}) to navigate + into that directory, +
  • Click on a file version link (\$Lang->{DirHistory_fileLink}0, + \$Lang->{DirHistory_fileLink}1, ...) to download that file, +
  • Files with the same contents between different backups have the same + version number, +
  • Files or directories not present in a particular backup have an + empty box. +
  • Files shown with the same version might have different attributes. + Select the backup number to see the file attributes.
\${h2("History of \${EscHTML(\$dirDisplay)}")}
- -\$backupNumStr -\$backupTimeStr +
Backup number
Backup time
+\$backupNumStr +\$backupTimeStr \$fileStr
Backup number
Backup time
EOF diff --git a/lib/BackupPC/Lang/fr.pm b/lib/BackupPC/Lang/fr.pm index 70d0d6a..690c832 100644 --- a/lib/BackupPC/Lang/fr.pm +++ b/lib/BackupPC/Lang/fr.pm @@ -1,4 +1,4 @@ -#!/bin/perl -T +#!/bin/perl #my %lang; #use strict; @@ -614,22 +614,37 @@ EOF # ------------------------------ $Lang{DirHistory_backup_for__host} = "BackupPC: Historique de sauvegarde des répertoires de \$host"; -$Lang{DirHistory_for__host} = < Voici les versions des fichiers pour toutes les sauvegardes:
  • Cliquez sur un numéro de sauvegarde pour revenir à la navigation de sauvegarde, -
  • Cliquez sur un répertoire pour naviguer dans celui-ci, -
  • Cliquez sur une version d'un fichier pour la télécharger. +
  • Cliquez sur un répertoire (\$Lang->{DirHistory_dirLink}) pour naviguer + dans celui-ci, +
  • Cliquez sur une version d'un fichier (\$Lang->{DirHistory_fileLink}0, + \$Lang->{DirHistory_fileLink}1, ...) pour la télécharger. +
  • (ENGLISH) Files with the same contents between different backups have the same + version number, +
  • (ENGLISH) Files or directories not present in a particular backup have an + empty box. +
  • (ENGLISH) Files shown with the same version might have different attributes. + Select the backup number to see the file attributes.
\${h2("Historique de \${EscHTML(\$dirDisplay)}")}
- -\$backupNumStr -\$backupTimeStr +
No. de sauvegarde
Date
+\$backupNumStr +\$backupTimeStr \$fileStr
No. de sauvegarde
Date
EOF diff --git a/lib/BackupPC/View.pm b/lib/BackupPC/View.pm index 357c9e3..5974a8b 100644 --- a/lib/BackupPC/View.pm +++ b/lib/BackupPC/View.pm @@ -428,7 +428,7 @@ sub dirHistory my $a = $attr->get; foreach my $fileUM ( keys(%$a) ) { next if ( $a->{$fileUM}{type} != BPC_FTYPE_DELETED ); - $files->{$fileUM}[$i] = undef; + $files->{$fileUM}[$i] = undef if ( defined($files->{$fileUM}) ); } } } -- 2.20.1