QueuesPanel.pm
2.76 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
# --
# Kernel/Modules/QueuesPanel.pm - frontend module for choosing top queues
#
# Copyright (C) 2014-2018 SeTIC - UFSC - http://setic.ufsc.br/
# Rodrigo Goncalves (rodrigo.g@ufsc.br)
#
# Version 01/08/2015 - Support for OTRS 4.0.3
# Version 2018-01-22 - Support for OTRS 6
#
# --
# This software comes with ABSOLUTELY NO WARRANTY. For details, see
# the enclosed file COPYING for license information (AGPL). If you
# did not receive this file, see http://www.gnu.org/licenses/agpl.txt.
# --
package Kernel::Modules::QueuesPanel;
use strict;
use warnings;
use Kernel::System::VariableCheck qw(:all);
our @ObjectDependencies = (
"Kernel::System::Web::Request", "Kernel::System::DB",
"Kernel::Output::HTML::Layout", "KerneL::System::Log",
"Kernel::Config", "Kernel::System::Queue",
"Kernel::System::QueuesPanel"
);
sub new {
my ( $Type, %Param ) = @_;
# allocate new hash for object
my $Self = {%Param};
bless( $Self, $Type );
return $Self;
}
sub Run {
my ( $Self, %Param ) = @_;
my %Data = ();
my $ParamObject = $Kernel::OM->Get("Kernel::System::Web::Request");
my $ConfigObject = $Kernel::OM->Get("Kernel::Config");
my $LayoutObject = $Kernel::OM->Get("Kernel::Output::HTML::Layout");
my $LanguageObject = $Kernel::OM->Get("Kernel::Language");
$Self->{Config} =
$ConfigObject->Get("Ticket::Frontend::Customer::QueuesPanel");
my $msgChooseService = $Self->{Config}->{"MessageChooseQueue"};
my $ignoreQueuesIDs = $Self->{Config}->{"IgnoreQueuesIDs"};
my $customHeaderFooterID = "QP" . $Self->{Config}->{"CustomHeaderFooterID"};
my $extraQueues = $Self->{Config}->{"ExtraQueues"};
my $URL = $Self->{Config}->{"NewTicketURL"};
if ( $ParamObject->GetParam( Param => "Subaction" ) eq "QueueData" ) {
my $queuesPanelBuilder =
$Kernel::OM->Get("Kernel::System::QueuesPanel");
my $queueData = $queuesPanelBuilder->BuildQueuesJS(
IgnoreQueuesIDs => $ignoreQueuesIDs,
ExtraQueues => $extraQueues,
URL => $URL
);
return $LayoutObject->Attachment(
ContentType => 'application/json; charset='
. $LayoutObject->{Charset},
Content => $queueData,
Type => 'inline',
NoCache => 1,
);
}
else {
$LayoutObject->AddJSData(
Key => 'QueuesPanel.Mode',
Value => "Authenticated",
);
my $queuesPanelBuilder =
$Kernel::OM->Get("Kernel::System::QueuesPanel");
$Data{MsgChooseQueue} = $msgChooseService;
# build output
my $Output = $LayoutObject->CustomerHeader(
Type => $customHeaderFooterID,
Title => $LanguageObject->Translate("Queues panel")
);
$Output .= $LayoutObject->Output(
Data => \%Data,
TemplateFile => 'QueuesPanel',
);
$Output .=
$LayoutObject->CustomerFooter( Type => $customHeaderFooterID );
return $Output;
}
}
1;