- set $dirDisplay to "/" if it is empty during directory browse.
[BackupPC.git] / cgi-bin / BackupPC_Admin
index 7e0209c..a2eefad 100755 (executable)
@@ -39,7 +39,7 @@
 #
 #========================================================================
 #
-# Version 2.0.0_CVS, released 18 Jan 2003.
+# Version 2.0.0beta1, released 30 Mar 2003.
 #
 # See http://backuppc.sourceforge.net.
 #
@@ -579,6 +579,7 @@ sub Action_Browse
             ErrorExit(eval("qq{$Lang->{Directory___EscHTML}}"));
        }
     }
+    $dir = "/$dir" if ( $dir !~ /^\// );
     my $relDir  = $dir;
     my $currDir = undef;
 
@@ -601,12 +602,16 @@ sub Action_Browse
         # Loop over each of the files in this directory
         #
        foreach my $f ( sort(keys(%$attr)) ) {
-            my($dirOpen, $gotDir, $imgStr, $img);
+            my($dirOpen, $gotDir, $imgStr, $img, $path);
             my $fURI = $f;                             # URI escaped $f
             my $shareURI = $share;                     # URI escaped $share
-            (my $path = "$relDir/$f") =~ s{//+}{/}g;
+           if ( $relDir eq "" ) {
+               $path = "/$f";
+           } else {
+               ($path = "$relDir/$f") =~ s{//+}{/}g;
+           }
            if ( $shareURI eq "" ) {
-               $shareURI = $path;
+               $shareURI = $f;
                $path  = "/";
            }
             $path =~ s{^/+}{/};
@@ -715,12 +720,12 @@ EOF
         # Prune the last directory off $relDir, or at the very end
        # do the top-level directory.
         #
-       if ( $relDir eq "" || $relDir eq "/" ) {
+       if ( $relDir eq "" || $relDir eq "/" || $relDir !~ /(.*)\/(.*)/ ) {
            $currDir = $share;
            $share = "";
            $relDir = "";
        } else {
-           $relDir =~ s/(.*)\/(.*)/$1/;
+           $relDir  = $1;
            $currDir = $2;
        }
     }
@@ -728,6 +733,7 @@ EOF
     my $dirDisplay = "$share/$dir";
     $dirDisplay =~ s{//+}{/}g;
     $dirDisplay =~ s{/+$}{}g;
+    $dirDisplay = "/" if ( $dirDisplay eq "" );
     my $filledBackup;
 
     if ( (my @mergeNums = @{$view->mergeNums}) > 1 ) {
@@ -1413,7 +1419,8 @@ EOF
         $jobStr .= "</tr>\n";
     }
     foreach my $host ( sort(keys(%Status)) ) {
-        next if ( $Status{$host}{reason} ne "Reason_backup_failed" );
+        next if ( $Status{$host}{reason} ne "Reason_backup_failed"
+              || $Status{$host}{error} =~ /^Can't find host \Q$host/ );
         my $startTime = timeStamp2($Status{$host}{startTime});
         my($errorTime, $XferViewStr);
         if ( $Status{$host}{errorTime} > 0 ) {
@@ -1468,13 +1475,7 @@ EOF
     }
 
     Header($Lang->{H_BackupPC_Server_Status});
-       #Header("H_BackupPC_Server_Status");
     print (eval ("qq{$Lang->{BackupPC_Server_Status}}"));
-
-    #Header($Lang->{BackupPC_Server_Status});
-
-    #my $trans_text = $Lang->{BackupPC_Server_Status};
-    #print eval ("qq{$trans_text}");
     Trailer();
 }