Localized the status and reason fields.
authorgfk <gfk>
Mon, 30 Dec 2002 20:29:05 +0000 (20:29 +0000)
committergfk <gfk>
Mon, 30 Dec 2002 20:29:05 +0000 (20:29 +0000)
bin/BackupPC
cgi-bin/BackupPC_Admin
lib/BackupPC/Lang/en.pm
lib/BackupPC/Lang/fr.pm

index f8ca366..ab70f88 100755 (executable)
@@ -307,16 +307,16 @@ sub Main_Initialize
     # Requeue any pending links.
     #
     foreach my $host ( sort(keys(%$Hosts)) ) {
     # Requeue any pending links.
     #
     foreach my $host ( sort(keys(%$Hosts)) ) {
-        if ( $Status{$host}{state} eq "backup in progress" ) {
+        if ( $Status{$host}{state} eq "Status_backup_in_progress" ) {
             #
             # should we restart it?  skip it for now.
             #
             #
             # should we restart it?  skip it for now.
             #
-            $Status{$host}{state} = "idle";
-        } elsif ( $Status{$host}{state} eq "link pending"
-                || $Status{$host}{state} eq "link running" ) {
+            $Status{$host}{state} = "Status_idle";
+        } elsif ( $Status{$host}{state} eq "Status_link_pending"
+                || $Status{$host}{state} eq "Status_link_running" ) {
             QueueLink($host);
         } else {
             QueueLink($host);
         } else {
-            $Status{$host}{state} = "idle";
+            $Status{$host}{state} = "Status_idle";
         }
         $Status{$host}{activeJob} = 0;
     }
         }
         $Status{$host}{activeJob} = 0;
     }
@@ -432,7 +432,7 @@ sub Main_TryToRun_CmdQueue
         $Jobs{$host}{reqTime}   = $req->{reqTime};
         $Jobs{$host}{cmd}       = $cmd;
         $Jobs{$host}{type}      = $Status{$host}{type};
         $Jobs{$host}{reqTime}   = $req->{reqTime};
         $Jobs{$host}{cmd}       = $cmd;
         $Jobs{$host}{type}      = $Status{$host}{type};
-        $Status{$host}{state}   = "link running";
+        $Status{$host}{state}   = "Status_link_running";
         $Status{$host}{activeJob} = 1;
         $Status{$host}{endTime} = time;
         $CmdJob = $host if ( $host ne $bpc->trashJob );
         $Status{$host}{activeJob} = 1;
         $Status{$host}{endTime} = time;
         $CmdJob = $host if ( $host ne $bpc->trashJob );
@@ -564,7 +564,7 @@ sub Main_TryToRun_Bg_or_User_Queue
         $Jobs{$host}{user}       = $user;
         $Jobs{$host}{type}       = $type;
         if ( !$req->{dhcp} ) {
         $Jobs{$host}{user}       = $user;
         $Jobs{$host}{type}       = $type;
         if ( !$req->{dhcp} ) {
-            $Status{$host}{state}     = "$type starting";
+            $Status{$host}{state}     = "Status_".$type."_starting";
             $Status{$host}{activeJob} = 1;
             $Status{$host}{startTime} = time;
             $Status{$host}{endTime}   = "";
             $Status{$host}{activeJob} = 1;
             $Status{$host}{startTime} = time;
             $Status{$host}{endTime}   = "";
@@ -788,7 +788,7 @@ sub Main_Check_Job_Messages
                     $Jobs{$newHost} = $Jobs{$host};
                     delete($Jobs{$host});
                     $host = $newHost;
                     $Jobs{$newHost} = $Jobs{$host};
                     delete($Jobs{$host});
                     $host = $newHost;
-                    $Status{$host}{state}      = "backup starting";
+                    $Status{$host}{state}      = "Status_backup_starting";
                     $Status{$host}{activeJob}  = 1;
                     $Status{$host}{startTime}  = $Jobs{$host}{startTime};
                     $Status{$host}{endTime}    = "";
                     $Status{$host}{activeJob}  = 1;
                     $Status{$host}{startTime}  = $Jobs{$host}{startTime};
                     $Status{$host}{endTime}    = "";
@@ -809,7 +809,7 @@ sub Main_Check_Job_Messages
                           $Jobs{$host}{dhcpHostIP}
                                 ? ", dhcp=$Jobs{$host}{dhcpHostIP}" : "",
                           ", share=$Jobs{$host}{shareName})\n");
                           $Jobs{$host}{dhcpHostIP}
                                 ? ", dhcp=$Jobs{$host}{dhcpHostIP}" : "",
                           ", share=$Jobs{$host}{shareName})\n");
-                $Status{$host}{state}     = "backup in progress";
+                $Status{$host}{state}     = "Status_backup_in_progress";
                 $Status{$host}{reason}    = "";
                 $Status{$host}{type}      = $1;
                 $Status{$host}{startTime} = time;
                 $Status{$host}{reason}    = "";
                 $Status{$host}{type}      = $1;
                 $Status{$host}{startTime} = time;
@@ -827,7 +827,7 @@ sub Main_Check_Job_Messages
                           $Jobs{$host}{tarPid} > 0
                                 ? ", tarPid=$Jobs{$host}{tarPid}" : "",
                           ")\n");
                           $Jobs{$host}{tarPid} > 0
                                 ? ", tarPid=$Jobs{$host}{tarPid}" : "",
                           ")\n");
-                $Status{$host}{state}     = "restore in progress";
+                $Status{$host}{state}     = "Status_restore_in_progress";
                 $Status{$host}{reason}    = "";
                 $Status{$host}{type}      = "restore";
                 $Status{$host}{startTime} = time;
                 $Status{$host}{reason}    = "";
                 $Status{$host}{type}      = "restore";
                 $Status{$host}{startTime} = time;
@@ -835,27 +835,27 @@ sub Main_Check_Job_Messages
                 $Status{$host}{aliveCnt}++;
             } elsif ( $mesg =~ /^(full|incr) backup complete/ ) {
                 print(LOG $bpc->timeStamp, "Finished $1 backup on $host\n");
                 $Status{$host}{aliveCnt}++;
             } elsif ( $mesg =~ /^(full|incr) backup complete/ ) {
                 print(LOG $bpc->timeStamp, "Finished $1 backup on $host\n");
-                $Status{$host}{reason}    = "backup done";
+                $Status{$host}{reason}    = "Reason_backup_done";
                 delete($Status{$host}{error});
                 delete($Status{$host}{errorTime});
                 $Status{$host}{endTime}   = time;
             } elsif ( $mesg =~ /^restore complete/ ) {
                 print(LOG $bpc->timeStamp, "Finished restore on $host\n");
                 delete($Status{$host}{error});
                 delete($Status{$host}{errorTime});
                 $Status{$host}{endTime}   = time;
             } elsif ( $mesg =~ /^restore complete/ ) {
                 print(LOG $bpc->timeStamp, "Finished restore on $host\n");
-                $Status{$host}{reason}    = "restore done";
+                $Status{$host}{reason}    = "Reason_restore_done";
                 delete($Status{$host}{error});
                 delete($Status{$host}{errorTime});
                 $Status{$host}{endTime}   = time;
             } elsif ( $mesg =~ /^nothing to do/ ) {
                 delete($Status{$host}{error});
                 delete($Status{$host}{errorTime});
                 $Status{$host}{endTime}   = time;
             } elsif ( $mesg =~ /^nothing to do/ ) {
-                $Status{$host}{state}     = "idle";
-                $Status{$host}{reason}    = "nothing to do";
+                $Status{$host}{state}     = "Status_idle";
+                $Status{$host}{reason}    = "Reason_nothing_to_do";
                 $Status{$host}{startTime} = time;
                 $Status{$host}{dhcpCheckCnt}--
                                 if ( $Status{$host}{dhcpCheckCnt} > 0 );
             } elsif ( $mesg =~ /^no ping response/
                             || $mesg =~ /^ping too slow/ ) {
                 $Status{$host}{startTime} = time;
                 $Status{$host}{dhcpCheckCnt}--
                                 if ( $Status{$host}{dhcpCheckCnt} > 0 );
             } elsif ( $mesg =~ /^no ping response/
                             || $mesg =~ /^ping too slow/ ) {
-                $Status{$host}{state}     = "idle";
-                if ( $Status{$host}{reason} ne "backup failed" ) {
-                    $Status{$host}{reason}    = "no ping";
+                $Status{$host}{state}     = "Status_idle";
+                if ( $Status{$host}{reason} ne "Reason_backup_failed" ) {
+                    $Status{$host}{reason}    = "Reason_no_ping";
                     $Status{$host}{startTime} = time;
                 }
                 $Status{$host}{deadCnt}++;
                     $Status{$host}{startTime} = time;
                 }
                 $Status{$host}{deadCnt}++;
@@ -863,8 +863,8 @@ sub Main_Check_Job_Messages
                    $Status{$host}{aliveCnt} = 0;
                }
             } elsif ( $mesg =~ /^dump failed: (.*)/ ) {
                    $Status{$host}{aliveCnt} = 0;
                }
             } elsif ( $mesg =~ /^dump failed: (.*)/ ) {
-                $Status{$host}{state}     = "idle";
-                $Status{$host}{reason}    = "backup failed";
+                $Status{$host}{state}     = "Status_idle";
+                $Status{$host}{reason}    = "Reason_backup_failed";
                 $Status{$host}{error}     = $1;
                 $Status{$host}{errorTime} = time;
                 $Status{$host}{endTime}   = time;
                 $Status{$host}{error}     = $1;
                 $Status{$host}{errorTime} = time;
                 $Status{$host}{endTime}   = time;
@@ -915,7 +915,7 @@ sub Main_Check_Job_Messages
                 my $cmd = $Jobs{$host}{cmd};
                 $cmd =~ s/$BinDir\///g;
                 print(LOG $bpc->timeStamp, "Finished $host ($cmd)\n");
                 my $cmd = $Jobs{$host}{cmd};
                 $cmd =~ s/$BinDir\///g;
                 print(LOG $bpc->timeStamp, "Finished $host ($cmd)\n");
-                $Status{$host}{state}    = "idle";
+                $Status{$host}{state}    = "Status_idle";
                 $Status{$host}{endTime}  = time;
                 $CmdJob = "";
                 $RunNightlyWhenIdle = 0 if ( $cmd eq "BackupPC_nightly"
                 $Status{$host}{endTime}  = time;
                 $CmdJob = "";
                 $RunNightlyWhenIdle = 0 if ( $cmd eq "BackupPC_nightly"
@@ -926,11 +926,11 @@ sub Main_Check_Job_Messages
                 # processing for this host.
                 #
                 if ( defined($Status{$host})
                 # processing for this host.
                 #
                 if ( defined($Status{$host})
-                            && ($Status{$host}{reason} eq "backup done"
+                            && ($Status{$host}{reason} eq "Reason_backup_done"
                                 || $Status{$host}{needLink}) ) {
                     QueueLink($host);
                 } elsif ( defined($Status{$host}) ) {
                                 || $Status{$host}{needLink}) ) {
                     QueueLink($host);
                 } elsif ( defined($Status{$host}) ) {
-                    $Status{$host}{state} = "idle";
+                    $Status{$host}{state} = "Status_idle";
                 }
             }
             delete($Jobs{$host});
                 }
             }
             delete($Jobs{$host});
@@ -1021,8 +1021,8 @@ sub Main_Check_Client_Messages
                     vec($FDread, $Jobs{$host}{fn}, 1) = 0;
                     close($Jobs{$host}{fh});
                     delete($Jobs{$host});
                     vec($FDread, $Jobs{$host}{fn}, 1) = 0;
                     close($Jobs{$host}{fh});
                     delete($Jobs{$host});
-                    $Status{$host}{state}     = "idle";
-                    $Status{$host}{reason}    = "backup canceled by $user";
+                    $Status{$host}{state}     = "Status_idle";
+                    $Status{$host}{reason}    = "Reason_backup_canceled_by_user"; #FIXME: user should be $user (we need to substitute the variable in the l10n stuff)
                     $Status{$host}{activeJob} = 0;
                     $Status{$host}{startTime} = time;
                     $reply = "ok: backup of $host cancelled";
                     $Status{$host}{activeJob} = 0;
                     $Status{$host}{startTime} = time;
                     $reply = "ok: backup of $host cancelled";
@@ -1327,7 +1327,7 @@ sub QueueLink
     my($host) = @_;
 
     return if ( $CmdQueueOn{$host} );
     my($host) = @_;
 
     return if ( $CmdQueueOn{$host} );
-    $Status{$host}{state}    = "link pending";
+    $Status{$host}{state}    = "Status_link_pending";
     $Status{$host}{needLink} = 0;
     unshift(@CmdQueue, {
             host    => $host,
     $Status{$host}{needLink} = 0;
     unshift(@CmdQueue, {
             host    => $host,
@@ -1367,7 +1367,7 @@ sub HostsUpdate
     #
     foreach my $host ( sort(keys(%$Hosts)) ) {
         next if ( defined($Status{$host}) );
     #
     foreach my $host ( sort(keys(%$Hosts)) ) {
         next if ( defined($Status{$host}) );
-        $Status{$host}{state} = "idle";
+        $Status{$host}{state} = "Status_idle";
         print(LOG $bpc->timeStamp, "Added host $host to backup list\n");
     }
     foreach my $host ( sort(keys(%Status)) ) {
         print(LOG $bpc->timeStamp, "Added host $host to backup list\n");
     }
     foreach my $host ( sort(keys(%Status)) ) {
index 8cca256..cac9707 100755 (executable)
@@ -203,8 +203,8 @@ sub Action_Summary
     <td align="center"> $fullRate </td>
     <td align="center"> $incrCnt </td>
     <td align="center"> $incrAge </td>
     <td align="center"> $fullRate </td>
     <td align="center"> $incrCnt </td>
     <td align="center"> $incrAge </td>
-    <td align="center"> $Status{$host}{state} </td>
-    <td> $Status{$host}{reason} </td></tr>
+    <td align="center"> $Lang->{$Status{$host}{state}} </td>
+    <td> $Lang->{$Status{$host}{reason}} </td></tr>
 EOF
         if ( @Backups == 0 ) {
             $hostCntNone++;
 EOF
         if ( @Backups == 0 ) {
             $hostCntNone++;
@@ -1332,7 +1332,7 @@ EOF
                 $StatusHost{startTime} : $StatusHost{endTime});
     my $reason = "";
     if ( $StatusHost{reason} ne "" ) {
                 $StatusHost{startTime} : $StatusHost{endTime});
     my $reason = "";
     if ( $StatusHost{reason} ne "" ) {
-        $reason = " ($StatusHost{reason})";
+        $reason = " ($Lang->{$StatusHost{reason}})";
     }
     $statusStr .= eval("qq{$Lang->{Last_status_is_state_StatusHost_state_reason_as_of_startTime}}");
 
     }
     $statusStr .= eval("qq{$Lang->{Last_status_is_state_StatusHost_state_reason_as_of_startTime}}");
 
@@ -1409,7 +1409,7 @@ EOF
         $jobStr .= "</tr>\n";
     }
     foreach my $host ( sort(keys(%Status)) ) {
         $jobStr .= "</tr>\n";
     }
     foreach my $host ( sort(keys(%Status)) ) {
-        next if ( $Status{$host}{reason} ne "backup failed" );
+        next if ( $Status{$host}{reason} ne "Reason_backup_failed" );
         my $startTime = timeStamp2($Status{$host}{startTime});
         my($errorTime, $XferViewStr);
         if ( $Status{$host}{errorTime} > 0 ) {
         my $startTime = timeStamp2($Status{$host}{startTime});
         my($errorTime, $XferViewStr);
         if ( $Status{$host}{errorTime} > 0 ) {
index 9170405..8a57a1f 100644 (file)
@@ -784,8 +784,7 @@ EOF
 
 # --------
 $Lang{Last_status_is_state_StatusHost_state_reason_as_of_startTime} = <<EOF;
 
 # --------
 $Lang{Last_status_is_state_StatusHost_state_reason_as_of_startTime} = <<EOF;
-<li>Last status is state \"\$StatusHost{state}\"\$reason
-    as of \$startTime.
+<li>Last status is state \"\$Lang->{\$StatusHost{state}}\"\$reason as of \$startTime.
 EOF
 
 # --------
 EOF
 
 # --------
@@ -890,4 +889,21 @@ $Lang{failed} = "failed";
 $Lang{success} = "success";
 $Lang{and} = "and";
 
 $Lang{success} = "success";
 $Lang{and} = "and";
 
+# ------
+# Hosts states and reasons
+$Lang{Status_idle} = "idle";
+$Lang{Status_backup_starting} = "backup starting";
+$Lang{Status_backup_in_progress} = "backup in progress";
+$Lang{Status_restore_starting} = "restore starting";
+$Lang{Status_restore_in_progress} = "restore in progress";
+$Lang{Status_link_pending} = "link pending";
+$Lang{Status_link_running} = "link running";
+
+$Lang{Reason_backup_done} = "backup done";
+$Lang{Reason_restore_done} = "restore done";
+$Lang{Reason_nothing_to_do} = "nothing to do";
+$Lang{Reason_backup_failed} = "backup failed";
+$Lang{Reason_no_ping} = "no ping";
+$Lang{Reason_backup_canceled_by_user} = "backup canceled by user";
+
 #end of lang_en.pm
 #end of lang_en.pm
index 7e9b8f2..fa62a54 100644 (file)
@@ -793,7 +793,7 @@ EOF
 
 # --------
 $Lang{Last_status_is_state_StatusHost_state_reason_as_of_startTime} = <<EOF;
 
 # --------
 $Lang{Last_status_is_state_StatusHost_state_reason_as_of_startTime} = <<EOF;
-<li>L\'état courant est \"\$StatusHost{state}\"\$reason depuis \$startTime.
+<li>L\'état courant est \"\$Lang->{\$StatusHost{state}}\"\$reason depuis \$startTime.
 EOF
 
 # --------
 EOF
 
 # --------
@@ -898,4 +898,22 @@ $Lang{failed} = "
 $Lang{success} = "succès";
 $Lang{and} = "et";
 
 $Lang{success} = "succès";
 $Lang{and} = "et";
 
+# ------
+# Hosts states and reasons
+$Lang{Status_idle} = "inactif";
+$Lang{Status_backup_starting} = "début de la sauvegarde";
+$Lang{Status_backup_in_progress} = "sauvegarde en cours";
+$Lang{Status_restore_starting} = "début de la restoration";
+$Lang{Status_restore_in_progress} = "restoration en cours";
+$Lang{Status_link_pending} = "en attente de l'édition de liens";
+$Lang{Status_link_running} = "édition de liens en cours";
+
+$Lang{Reason_backup_done} = "sauvegarde terminée";
+$Lang{Reason_restore_done} = "restauration terminée";
+$Lang{Reason_nothing_to_do} = "rien à faire";
+$Lang{Reason_backup_failed} = "la sauvegarde a échouée";
+$Lang{Reason_no_ping} = "pas de ping";
+$Lang{Reason_backup_canceled_by_user} = "sauvegarde annulée par l'utilisateur";
+
+
 #end of lang_fr.pm
 #end of lang_fr.pm