/[BackupPC]/upstream/2.1.0/lib/BackupPC/CGI/ArchiveInfo.pm
This is repository of my old source code which isn't updated any more. Go to git.rot13.org for current projects!
ViewVC logotype

Contents of /upstream/2.1.0/lib/BackupPC/CGI/ArchiveInfo.pm

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1 - (show annotations)
Wed Jun 22 19:12:04 2005 UTC (18 years, 10 months ago) by dpavlin
File size: 2740 byte(s)
import of version 2.1.0

1 #============================================================= -*-perl-*-
2 #
3 # BackupPC::CGI::ArchiveInfo package
4 #
5 # DESCRIPTION
6 #
7 # This module implements the ArchiveInfo action for the CGI interface.
8 #
9 # AUTHOR
10 # Craig Barratt <cbarratt@users.sourceforge.net>
11 #
12 # COPYRIGHT
13 # Copyright (C) 2003 Craig Barratt
14 #
15 # This program is free software; you can redistribute it and/or modify
16 # it under the terms of the GNU General Public License as published by
17 # the Free Software Foundation; either version 2 of the License, or
18 # (at your option) any later version.
19 #
20 # This program is distributed in the hope that it will be useful,
21 # but WITHOUT ANY WARRANTY; without even the implied warranty of
22 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
23 # GNU General Public License for more details.
24 #
25 # You should have received a copy of the GNU General Public License
26 # along with this program; if not, write to the Free Software
27 # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
28 #
29 #========================================================================
30 #
31 # Version 2.1.0, released 20 Jun 2004.
32 #
33 # See http://backuppc.sourceforge.net.
34 #
35 #========================================================================
36
37 package BackupPC::CGI::ArchiveInfo;
38
39 use strict;
40 use BackupPC::CGI::Lib qw(:all);
41
42 sub action
43 {
44 my $Privileged = CheckPermission($In{host});
45 my $host = $1 if ( $In{host} =~ /(.*)/ );
46 my $num = $In{num};
47 my $i;
48
49 if ( !$Privileged ) {
50 ErrorExit($Lang->{Only_privileged_users_can_view_archive_information});
51 }
52 #
53 # Find the requested archive
54 #
55 my @Archives = $bpc->ArchiveInfoRead($host);
56 for ( $i = 0 ; $i < @Archives ; $i++ ) {
57 last if ( $Archives[$i]{num} == $num );
58 }
59 if ( $i >= @Archives ) {
60 ErrorExit(eval("qq{$Lang->{Archive_number__num_for_host__does_not_exist}}"));
61 }
62
63 %ArchiveReq = ();
64 do "$TopDir/pc/$host/ArchiveInfo.$Archives[$i]{num}"
65 if ( -f "$TopDir/pc/$host/ArchiveInfo.$Archives[$i]{num}" );
66
67 my $startTime = timeStamp2($Archives[$i]{startTime});
68 my $reqTime = timeStamp2($ArchiveReq{reqTime});
69 my $dur = $Archives[$i]{endTime} - $Archives[$i]{startTime};
70 $dur = 1 if ( $dur <= 0 );
71 my $duration = sprintf("%.1f", $dur / 60);
72
73 my $HostListStr = "";
74 my $counter=0;
75 foreach my $f ( @{$ArchiveReq{HostList}} ) {
76 $HostListStr .= <<EOF;
77 <tr><td>$f</td><td>@{$ArchiveReq{BackupList}}[$counter]</td></tr>
78 EOF
79 $counter++;
80 }
81
82 my $content = eval("qq{$Lang->{Archive___num_details_for__host2 }}");
83 Header(eval("qq{$Lang->{Archive___num_details_for__host}}"), $content, 1);
84 Trailer();
85 }
86
87 1;

  ViewVC Help
Powered by ViewVC 1.1.26