X-Git-Url: http://git.rot13.org/?a=blobdiff_plain;f=lib%2FBackupPC%2FCGI%2FView.pm;h=46766849e48adcd76dc1ba0208adcb4125e9f1e8;hb=e6fc5dc667cbf97c374da04c55d24e4ea83ec865;hp=a17e240db56bc724fdc55a3c2fc33ef2b5609330;hpb=8c30bb82b66f26ccf7e261e2c42711251d0d6ccd;p=BackupPC.git diff --git a/lib/BackupPC/CGI/View.pm b/lib/BackupPC/CGI/View.pm index a17e240..4676684 100644 --- a/lib/BackupPC/CGI/View.pm +++ b/lib/BackupPC/CGI/View.pm @@ -28,7 +28,7 @@ # #======================================================================== # -# Version 2.1.0beta2, released 23 May 2004. +# Version 3.0.0beta0, released 11 Jul 2006. # # See http://backuppc.sourceforge.net. # @@ -78,23 +78,25 @@ sub action } elsif ( $type eq "ArchiveErr" ) { $file = "$TopDir/pc/$host/ArchiveLOG$ext"; $comment = $Lang->{Extracting_only_Errors}; - } elsif ( $host ne "" && $type eq "config" ) { - $file = "$TopDir/pc/$host/config.pl"; - $file = "$TopDir/conf/$host.pl" - if ( $host ne "config" && -f "$TopDir/conf/$host.pl" - && !-f $file ); - } elsif ( $type eq "docs" ) { - $file = "$BinDir/../doc/BackupPC.html"; } elsif ( $type eq "config" ) { - $file = "$TopDir/conf/config.pl"; + # Note: only works for Storage::Text + $file = $bpc->{storage}->ConfigPath($host); } elsif ( $type eq "hosts" ) { - $file = "$TopDir/conf/hosts"; + # Note: only works for Storage::Text + $file = $bpc->ConfDir() . "/hosts"; $linkHosts = 1; + } elsif ( $type eq "docs" ) { + $file = "$BinDir/../doc/BackupPC.html"; } elsif ( $host ne "" ) { - $file = "$TopDir/pc/$host/LOG$ext"; + if ( !defined($In{num}) ) { + # get the latest LOG file + $file = ($bpc->sortedPCLogFiles($host))[0]; + } else { + $file = "$TopDir/pc/$host/LOG$ext"; + } $linkHosts = 1; } else { - $file = "$TopDir/log/LOG$ext"; + $file = "$LogDir/LOG$ext"; $linkHosts = 1; } if ( $type ne "docs" && !$Privileged ) { @@ -106,7 +108,10 @@ sub action } my($contentPre, $contentSub, $contentPost); $contentPre .= eval("qq{$Lang->{Log_File__file__comment}}"); - if ( defined($fh = BackupPC::FileZIO->open($file, 0, $compress)) ) { + if ( $file ne "" + && defined($fh = BackupPC::FileZIO->open($file, 0, $compress)) ) { + + $fh->utf8(1); my $mtimeStr = $bpc->timeStamp((stat($file))[9], 1); $contentPre .= eval("qq{$Lang->{Contents_of_log_file}}");