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