1 |
#============================================================= -*-perl-*- |
2 |
# |
3 |
# BackupPC::CGI::Queue package |
4 |
# |
5 |
# DESCRIPTION |
6 |
# |
7 |
# This module implements the Queue 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::Queue; |
38 |
|
39 |
use strict; |
40 |
use BackupPC::CGI::Lib qw(:all); |
41 |
|
42 |
sub action |
43 |
{ |
44 |
my($strBg, $strUser, $strCmd); |
45 |
|
46 |
GetStatusInfo("queues"); |
47 |
my $Privileged = CheckPermission(); |
48 |
|
49 |
if ( !$Privileged ) { |
50 |
ErrorExit($Lang->{Only_privileged_users_can_view_queues_}); |
51 |
} |
52 |
|
53 |
while ( @BgQueue ) { |
54 |
my $req = pop(@BgQueue); |
55 |
my($reqTime) = timeStamp2($req->{reqTime}); |
56 |
$strBg .= <<EOF; |
57 |
<tr><td> ${HostLink($req->{host})} </td> |
58 |
<td align="center"> $reqTime </td> |
59 |
<td align="center"> $req->{user} </td></tr> |
60 |
EOF |
61 |
} |
62 |
while ( @UserQueue ) { |
63 |
my $req = pop(@UserQueue); |
64 |
my $reqTime = timeStamp2($req->{reqTime}); |
65 |
$strUser .= <<EOF; |
66 |
<tr><td> ${HostLink($req->{host})} </td> |
67 |
<td align="center"> $reqTime </td> |
68 |
<td align="center"> $req->{user} </td></tr> |
69 |
EOF |
70 |
} |
71 |
while ( @CmdQueue ) { |
72 |
my $req = pop(@CmdQueue); |
73 |
my $reqTime = timeStamp2($req->{reqTime}); |
74 |
(my $cmd = $bpc->execCmd2ShellCmd(@{$req->{cmd}})) =~ s/$BinDir\///; |
75 |
$strCmd .= <<EOF; |
76 |
<tr><td> ${HostLink($req->{host})} </td> |
77 |
<td align="center"> $reqTime </td> |
78 |
<td align="center"> $req->{user} </td> |
79 |
<td> $cmd </td></tr> |
80 |
EOF |
81 |
} |
82 |
my $content = eval ( "qq{$Lang->{Backup_Queue_Summary}}"); |
83 |
Header($Lang->{BackupPC__Queue_Summary}, $content); |
84 |
Trailer(); |
85 |
} |
86 |
|
87 |
1; |