QueuesPanelPublic.pm
3.32 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
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
# --
# Kernel/Modules/QueuesPanelPublic.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/12/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::QueuesPanelPublic;
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 $LayoutObject = $Kernel::OM->Get("Kernel::Output::HTML::Layout");
my $ConfigObject = $Kernel::OM->Get("Kernel::Config");
my $LanguageObject = $Kernel::OM->Get("Kernel::Language");
## If a ticket was received (CAS), meand the user is authenticated
if ( $ParamObject->GetParam( Param => "ticket" ) ) {
my $retorno = $LayoutObject->Redirect( OP => "Action=QueuesPanel", );
$retorno =~ s/public/customer/g;
return $retorno;
}
## If trying to authenticate, forwards to CAS gateway
if ( $ParamObject->GetParam( Param => "autenticar" ) ) {
my $url =
$ConfigObject->Get('Customer::AuthModule::CAS::CASUrl')
. "/login?gateway=true&service="
. "https://"
. $ENV{SERVER_NAME}
. $ENV{SCRIPT_NAME}
. "?Action=QueuesPanelPublic";
return $LayoutObject->Redirect( ExtURL => $url, );
}
$Self->{Config} = $ConfigObject->Get("Ticket::Frontend::Customer::QueuesPanel");
my $msgChooseService = $Self->{Config}->{"MessageChooseQueuePublic"};
my $ignoreQueuesIDs = $Self->{Config}->{"IgnoreQueuesIDs"};
my $customHeaderFooterID = "QP" . $Self->{Config}->{"CustomHeaderFooterID"};
my $extraQueues = $Self->{Config}->{"ExtraQueuesPublic"};
my $URL = $Self->{Config}->{"NewTicketURLPublic"};
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 => "Public",
);
$Data{MsgChooseQueue} = $msgChooseService;
# build output
my $Output = $LayoutObject->CustomerHeader(
Type => $customHeaderFooterID,
Title => $LanguageObject->Translate("New ticket")
);
$Output .= $LayoutObject->Output(
Data => \%Data,
TemplateFile => 'QueuesPanel',
);
$Output .=
$LayoutObject->CustomerFooter( Type => $customHeaderFooterID );
return $Output;
}
}
1;