# -- # 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;