Updates in preparation for 3.0.0beta2:
[BackupPC.git] / lib / BackupPC / CGI / GeneralInfo.pm
index bb71e51..044d1f5 100644 (file)
@@ -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.
 #
@@ -49,19 +49,20 @@ sub action
         my $startTime = timeStamp2($Jobs{$host}{startTime});
         next if ( $host eq $bpc->trashJob
                     && $Jobs{$host}{processState} ne "running" );
+        next if ( !$Privileged && !CheckPermission($host) );
         $Jobs{$host}{type} = $Status{$host}{type}
                     if ( $Jobs{$host}{type} eq "" && defined($Status{$host}));
         (my $cmd = $Jobs{$host}{cmd}) =~ s/$BinDir\///g;
         (my $xferPid = $Jobs{$host}{xferPid}) =~ s/,/, /g;
         $jobStr .= <<EOF;
-<tr><td> ${HostLink($host)} </td>
-    <td align="center"> $Jobs{$host}{type} </td>
-    <td align="center"> ${UserLink(defined($Hosts->{$host})
+<tr><td class="border"> ${HostLink($host)} </td>
+    <td align="center" class="border"> $Jobs{$host}{type} </td>
+    <td align="center" class="border"> ${UserLink(defined($Hosts->{$host})
                                        ? $Hosts->{$host}{user} : "")} </td>
-    <td> $startTime </td>
-    <td> $cmd </td>
-    <td align="center"> $Jobs{$host}{pid} </td>
-    <td align="center"> $xferPid </td>
+    <td class="border"> $startTime </td>
+    <td class="border"> $cmd </td>
+    <td align="center" class="border"> $Jobs{$host}{pid} </td>
+    <td align="center" class="border"> $xferPid </td>
 EOF
         $jobStr .= "</tr>\n";
     }
@@ -70,6 +71,7 @@ EOF
                    && $Status{$host}{reason} ne "Reason_restore_failed"
                    && (!$Status{$host}{userReq}
                        || $Status{$host}{reason} ne "Reason_no_ping") );
+        next if ( !$Privileged && !CheckPermission($host) );
         my $startTime = timeStamp2($Status{$host}{startTime});
         my($errorTime, $XferViewStr);
         if ( $Status{$host}{errorTime} > 0 ) {
@@ -89,14 +91,14 @@ EOF
         }
         (my $shortErr = $Status{$host}{error}) =~ s/(.{48}).*/$1.../;   
         $statusStr .= <<EOF;
-<tr><td> ${HostLink($host)} </td>
-    <td align="center"> $Status{$host}{type} </td>
-    <td align="center"> ${UserLink(defined($Hosts->{$host})
+<tr><td class="border"> ${HostLink($host)} </td>
+    <td align="center" class="border"> $Status{$host}{type} </td>
+    <td align="center" class="border"> ${UserLink(defined($Hosts->{$host})
                                        ? $Hosts->{$host}{user} : "")} </td>
-    <td align="right"> $startTime </td>
-    <td> $XferViewStr </td>
-    <td align="right"> $errorTime </td>
-    <td> ${EscHTML($shortErr)} </td></tr>
+    <td align="right" class="border"> $startTime </td>
+    <td class="border"> $XferViewStr </td>
+    <td align="right" class="border"> $errorTime </td>
+    <td class="border"> ${EscHTML($shortErr)} </td></tr>
 EOF
     }
     my $now          = timeStamp2(time);
@@ -107,6 +109,7 @@ EOF
     my $numUserQueue = $QueueLen{UserQueue};
     my $numCmdQueue  = $QueueLen{CmdQueue};
     my $serverStartTime = timeStamp2($Info{startTime});
+    my $configLoadTime  = timeStamp2($Info{ConfigLTime});
     my $poolInfo     = genPoolInfo("pool", \%Info);
     my $cpoolInfo    = genPoolInfo("cpool", \%Info);
     if ( $Info{poolFileCnt} > 0 && $Info{cpoolFileCnt} > 0 ) {
@@ -123,9 +126,10 @@ EOF
     } elsif ( $Info{cpoolFileCnt} > 0 ) {
         $poolInfo = $cpoolInfo;
     }
-
-    Header($Lang->{H_BackupPC_Server_Status});
-    print (eval ("qq{$Lang->{BackupPC_Server_Status}}"));
+    my $generalInfo = eval("qq{$Lang->{BackupPC_Server_Status_General_Info}}")
+                                if ( $Privileged );
+    my $content = eval("qq{$Lang->{BackupPC_Server_Status}}");
+    Header($Lang->{H_BackupPC_Server_Status}, $content);
     Trailer();
 }