diff --git a/CreateOpmUFSC.sh b/CreateOpmUFSC.sh new file mode 100755 index 0000000..3dd99b6 --- /dev/null +++ b/CreateOpmUFSC.sh @@ -0,0 +1,5 @@ +#!/bin/bash +LOCAL="$PWD" +cd /opt/otrs/bin +./otrs.PackageManager.pl -a build -p "$LOCAL"/QueuePanelUFSC.sopm -o "$LOCAL"/ +cd $LOCAL diff --git a/Kernel/Config/Files/QueuesPanel.xml b/Kernel/Config/Files/QueuesPanel.xml index 463400d..3d69cc1 100644 --- a/Kernel/Config/Files/QueuesPanel.xml +++ b/Kernel/Config/Files/QueuesPanel.xml @@ -76,6 +76,79 @@ Escolha o local para o qual deseja atendimento + + + + Queues IDs to not show in panel (comma separated). + Ticket + Frontend::Customer::QueuesPanel + + + + + + + Customer footer/header suffix, if used. + Ticket + Frontend::Customer::QueuesPanel + + + + + + + Extra queues to show in panel. Format: One per Line, Name|URL + Ticket + Frontend::Customer::QueuesPanel + + + + + + + Extra queues to show in panel, for public access. Format: One per Line, Name|URL + Ticket + Frontend::Customer::QueuesPanel + + + + + + + Extra JS if necessary + Ticket + Frontend::Customer::QueuesPanel + + + + + + + + + Base URL to call to create ticket, queue ID added to the end + Ticket + Frontend::Customer::QueuesPanel + + /otrs/customer.pl?Action=NewTicketWizard;QueueID= + + + + + Base URL to call to create ticket, queue ID added to the end + Ticket + Frontend::Customer::QueuesPanel + + /otrs/public.pl?Action=NewTicketWizardPublic;QueueID= + - + + \ No newline at end of file diff --git a/Kernel/Language/pt_BR_QueuesPanel.pm b/Kernel/Language/pt_BR_QueuesPanel.pm index 670f660..dd19d66 100644 --- a/Kernel/Language/pt_BR_QueuesPanel.pm +++ b/Kernel/Language/pt_BR_QueuesPanel.pm @@ -8,7 +8,7 @@ # 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::Language::pt_BR_NewTicketWizard; +package Kernel::Language::pt_BR_QueuesPanel; use strict; use warnings; @@ -21,6 +21,18 @@ sub Data { $Self->{Translation}->{'Started at: '} = 'Iniciada em:'; $Self->{Translation}->{'Queues panel'} = 'Novo chamado'; $Self->{Translation}->{'Choose the service to ask for support'} = 'Escolha o serviço para o qual deseja suporte'; + $Self->{Translation}->{'Message to let the user choose a queue.'} = 'Mensagem para o usuário escolher a fila'; + $Self->{Translation}->{'Queues IDs to not show in panel (comma separated).'} = 'IDs das filas que não devem aparecer no painel (separados por vírgula)'; + $Self->{Translation}->{'Customer footer/header suffix, if used.'} = 'Sufixo personalizado de cabeçalho/rodapé, se usado'; + $Self->{Translation}->{'Base URL to call to create ticket, queue ID added to the end'} = 'URl para criar ticket - id da fila adicionado ao final'; + $Self->{Translation}->{'Extra queues to show in panel. Format: One per Line, Name|URL'} = 'Filas extra, com URLs especiais. Formato: Nome|URL'; + $Self->{Translation}->{'Extra queues to show in panel, for public access. Format: One per Line, Name|URL'} = 'Filas extra no modo público, com URLs especiais. Formato: Nome|URL'; + + + + + + return 1; } 1; \ No newline at end of file diff --git a/Kernel/Language/pt_BR_QueuesPanelPublic.pm b/Kernel/Language/pt_BR_QueuesPanelPublic.pm index 0b55537..3e6fc0f 100644 --- a/Kernel/Language/pt_BR_QueuesPanelPublic.pm +++ b/Kernel/Language/pt_BR_QueuesPanelPublic.pm @@ -9,7 +9,7 @@ # 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::Language::pt_BR_NewTicketWizard; +package Kernel::Language::pt_BR_QueuesPanelPublic; use strict; use warnings; diff --git a/Kernel/Modules/QueuesPanel.pm b/Kernel/Modules/QueuesPanel.pm index 742da8d..cdbbdcc 100644 --- a/Kernel/Modules/QueuesPanel.pm +++ b/Kernel/Modules/QueuesPanel.pm @@ -22,7 +22,8 @@ our @ObjectDependencies = ( "Kernel::Output::HTML::Layout", "KerneL::System::Log", "Kernel::Config", -"Kernel::System::Queue"); +"Kernel::System::Queue", +"Kernel::System::QueuesPanel"); sub new { my ( $Type, %Param ) = @_; @@ -41,147 +42,30 @@ sub Run { my $ConfigObject = $Kernel::OM->Get("Kernel::Config"); my $LayoutObject = $Kernel::OM->Get("Kernel::Output::HTML::Layout"); - $Self->{UrlAtendimento} = '/otrs/customer.pl?Action=NewTicketWizard;QueueID='; - - $Data{"QueueJS"} = $Self->BuildQueuesJS(); - $Self->{Config} = $ConfigObject->Get("Ticket::Frontend::Customer::QueuesPanel"); my $msgChooseService = $Self->{Config}->{"MessageChooseQueue"}; + my $ignoreQueuesIDs = $Self->{Config}->{"IgnoreQueuesIDs"}; + my $customHeaderFooterID = $Self->{Config}->{"CustomHeaderFooterID"}; + my $extraQueues = $Self->{Config}->{"ExtraQueues"}; + my $URL = $Self->{Config}->{"NewTicketURL"}; + my $customJS = $Self->{Config}->{"CustomJS"}; + + my $queuesPanelBuilder = $Kernel::OM->Get("Kernel::System::QueuesPanel"); + + $Data{"CustomJS"} = $customJS; + $Data{"QueueJS"} = $queuesPanelBuilder->BuildQueuesJS(IgnoreQueuesIDs => $ignoreQueuesIDs, ExtraQueues => $extraQueues, URL => $URL); + $Data{MsgChooseQueue} = $msgChooseService; # build output - my $Output = $LayoutObject->CustomerHeader( Title => $LayoutObject->{LanguageObject}->Translate("Queues panel") ); + my $Output = $LayoutObject->CustomerHeader( Type => $customHeaderFooterID, Title => $LayoutObject->{LanguageObject}->Translate("Queues panel") ); $Output .= $LayoutObject->Output( Data => \%Data, TemplateFile => 'QueuesPanel', ); - $Output .= $LayoutObject->CustomerFooter(); + $Output .= $LayoutObject->CustomerFooter(Type => $customHeaderFooterID); return $Output; } -sub BuildQueuesJS { - my ( $Self, %Param ) = @_; - - # Get queues - my %Queues = (); - - my $DBObject = $Kernel::OM->Get("Kernel::System::DB"); - - $DBObject->Prepare( SQL => "SELECT id, name FROM queue WHERE valid_id = 1 ORDER BY name ASC", ); - while ( my @Row = $DBObject->FetchrowArray() ) { - $Queues{ $Row[0] } = $Row[1]; - } - - my $result = - '$(document).ready(function() {' . "\n\t" - . ' $("#columns").hColumns({' - . "\n\t\t" - . ' nodeSource: function(node_id, callback) {' . "\n"; - - for my $queue ( keys %Queues ) { - $result = $result . $Self->BuildQueueJS( Queues => \%Queues, Queue => $Queues{$queue}, QueueID => $queue ); - } - - $result = $result . $Self->BuildTopQueuesJS( Queues => \%Queues ); - - $result = $result . "\n\t}});\n});"; - - return $result; -} - -use Data::Dumper; - -sub BuildTopQueuesJS { - my ( $Self, %Param ) = @_; - my %Queues = %{ $Param{"Queues"} }; - - my @topQueues = grep { index( $Queues{$_}, '::' ) == -1 } keys %Queues; - - my $result = "\t\tif (node_id === null) { \n\t\t\treturn callback(null, [\n"; - for my $queue (sort {$Queues{$a} cmp $Queues{$b}} @topQueues) { - - if ( grep { index( $Queues{$_}, $Queues{$queue} . "::" ) >= 0 } keys %Queues ) { - $result = $result - . "\t\t\t\t" - . '{ id: ' - . $queue - . ', label: "' - . $Self->LastQueue( $Queues{$queue} ) - . '", type: "folder" },' . "\n"; - } - else { - $result = $result - . "\t\t\t\t" - . '{ id: ' - . $queue - . ', label: "' - . $Self->LastQueue( $Queues{$queue} ) - . '", type: "link", url: "' - . $Self->{UrlAtendimento} - . $queue . '" },' . "\n"; - } - } - - $result = $result . "\t\t\t]);\n\t\t}\n"; - - return $result; -} - -sub BuildQueueJS { - my ( $Self, %Param ) = @_; - my %Queues = %{ $Param{"Queues"} }; - my $BaseQueue = $Param{"Queue"}; - my $BaseQueueID = $Param{"QueueID"}; - - # Get subqueues - my @subqueues = grep { index( $Queues{$_}, $BaseQueue . "::" ) >= 0 } keys %Queues; - my $level = () = $BaseQueue =~ /::/g; - $level = $level + 1; - - # Remove subsubqueues - @subqueues = grep { ( () = $Queues{$_} =~ /::/g ) == $level } @subqueues; - - # When there are no subqueues, there is no need to create a JS - if ( !@subqueues ) { - return; - } - - my $result = "\t\tif (node_id === " . $BaseQueueID . ") { \n\t\t\treturn callback(null, [\n"; - - for my $queue (@subqueues) { - if ( grep { index( $Queues{$_}, $Queues{$queue} . "::" ) >= 0 } keys %Queues ) { - $result = $result - . "\t\t\t\t" - . '{ id: ' - . $queue - . ', label: "' - . $Self->LastQueue( $Queues{$queue} ) - . '", type: "folder" }, ' . "\n"; - } - else { - $result = $result - . "\t\t\t\t" - . '{ id: ' - . $queue - . ', label: "' - . $Self->LastQueue( $Queues{$queue} ) - . '", type: "link", url: "' - . $Self->{UrlAtendimento} - . $queue . '" }, ' . "\n"; - } - } - - $result = $result . "\t\t\t]);\n\t\t}\n"; - - return $result; -} - -sub LastQueue { - my $Self = shift; - my $queue = shift; - my @parts = split( "::", $queue ); - return $parts[-1]; -} - 1; diff --git a/Kernel/Modules/QueuesPanelPublic.pm b/Kernel/Modules/QueuesPanelPublic.pm index 1c17df7..7cd6a09 100644 --- a/Kernel/Modules/QueuesPanelPublic.pm +++ b/Kernel/Modules/QueuesPanelPublic.pm @@ -22,7 +22,8 @@ our @ObjectDependencies = ( "Kernel::Output::HTML::Layout", "KerneL::System::Log", "Kernel::Config", -"Kernel::System::Queue"); +"Kernel::System::Queue", +"Kernel::System::QueuesPanel"); sub new { my ( $Type, %Param ) = @_; @@ -60,153 +61,31 @@ sub Run { . "?Action=QueuesPanelPublic"; return $LayoutObject->Redirect( ExtURL => $url, ); } - - $Self->{UrlAtendimento} = '/otrs/public.pl?Action=NewTicketWizardPublic;QueueID='; - $Data{"QueueJS"} = $Self->BuildQueuesJS(); - + $Self->{Config} = $Self->{ConfigObject}->Get("Ticket::Frontend::Customer::QueuesPanel"); my $msgChooseService = $Self->{Config}->{"MessageChooseQueuePublic"}; + my $ignoreQueuesIDs = $Self->{Config}->{"IgnoreQueuesIDs"}; + my $customHeaderFooterID = $Self->{Config}->{"CustomHeaderFooterID"}; + my $extraQueues = $Self->{Config}->{"ExtraQueuesPublic"}; + my $URL = $Self->{Config}->{"NewTicketURLPublic"}; + my $customJS = $Self->{Config}->{"CustomJS"}; + + my $queuesPanelBuilder = $Kernel::OM->Get("Kernel::System::QueuesPanel"); + + $Data{"CustomJS"} = $customJS; + $Data{"QueueJS"} = $queuesPanelBuilder->BuildQueuesJS(IgnoreQueuesIDs => $ignoreQueuesIDs, ExtraQueues => $extraQueues, URL => $URL); $Data{MsgChooseQueue} = $msgChooseService; # build output my $Output = - $LayoutObject->CustomerHeader( Title => $LayoutObject->{LanguageObject}->Translate("New ticket") ); + $LayoutObject->CustomerHeader( Type => $customHeaderFooterID, Title => $LayoutObject->{LanguageObject}->Translate("New ticket") ); $Output .= $LayoutObject->Output( Data => \%Data, TemplateFile => 'QueuesPanel', ); - $Output .= $LayoutObject->CustomerFooter(); + $Output .= $LayoutObject->CustomerFooter(Type => $customHeaderFooterID); return $Output; } -sub BuildQueuesJS { - my ( $Self, %Param ) = @_; - - # Get queues - my %Queues = (); - - my $DBObject = $Kernel::OM->Get("Kernel::System::DB"); - - $DBObject->Prepare( SQL => "SELECT id, name FROM queue WHERE valid_id = 1 ORDER BY name ASC", ); - while ( my @Row = $DBObject->FetchrowArray() ) { - $Queues{ $Row[0] } = $Row[1]; - } - - my $result = - '$(document).ready(function() {' . "\n\t" - . ' $("#columns").hColumns({' - . "\n\t\t" - . ' nodeSource: function(node_id, callback) {' . "\n"; - - for my $queue ( keys %Queues ) { - $result = $result . $Self->BuildQueueJS( Queues => \%Queues, Queue => $Queues{$queue}, QueueID => $queue ); - } - - $result = $result . $Self->BuildTopQueuesJS( Queues => \%Queues ); - - $result = $result . "\n\t}});\n});"; - - return $result; -} - -sub BuildTopQueuesJS { - my ( $Self, %Param ) = @_; - my %Queues = %{ $Param{"Queues"} }; - - my @topQueues = grep { index( $Queues{$_}, '::' ) == -1 } keys %Queues; - - my $result = "\t\tif (node_id === null) { \n\t\t\treturn callback(null, [\n"; - for my $queue (sort {$Queues{$a} cmp $Queues{$b}} @topQueues) { - - if ( grep { index( $Queues{$_}, $Queues{$queue} . "::" ) >= 0 } keys %Queues ) { - $result = $result - . "\t\t\t\t" - . '{ id: ' - . $queue - . ', label: "' - . $Self->LastQueue( $Queues{$queue} ) - . '", type: "folder" },' . "\n"; - } - else { - $result = $result - . "\t\t\t\t" - . '{ id: ' - . $queue - . ', label: "' - . $Self->LastQueue( $Queues{$queue} ) - . '", type: "link", url: "' - . $Self->{UrlAtendimento} - . $queue . '" },' . "\n"; - } - } - - $result = $result . "\t\t\t]);\n\t\t}\n"; - - return $result; -} - -sub BuildQueueJS { - my ( $Self, %Param ) = @_; - my %Queues = %{ $Param{"Queues"} }; - my $BaseQueue = $Param{"Queue"}; - my $BaseQueueID = $Param{"QueueID"}; - - # Get subqueues - my @subqueues = grep { index( $Queues{$_}, $BaseQueue . "::" ) >= 0 } keys %Queues; - my $level = () = $BaseQueue =~ /::/g; - $level = $level + 1; - - # Remove subsubqueues - @subqueues = grep { ( () = $Queues{$_} =~ /::/g ) == $level } @subqueues; - - # When there are no subqueues, there is no need to create a JS - if ( !@subqueues ) { - return ""; - } - - my $result = "\t\tif (node_id === " . $BaseQueueID . ") { \n\t\t\treturn callback(null, [\n"; - - for my $queue (sort {$Self->LastQueue($Queues{$a}) cmp $Self->LastQueue($Queues{$b})} @subqueues) { - if ( grep { index( $Queues{$_}, $Queues{$queue} . "::" ) >= 0 } keys %Queues ) { - $result = $result - . "\t\t\t\t" - . '{ id: ' - . $queue - . ', label: "' - . $Self->LastQueue( $Queues{$queue} ) - . '", type: "folder" }, ' . "\n"; - } - else { - $result = $result - . "\t\t\t\t" - . '{ id: ' - . $queue - . ', label: "' - . $Self->LastQueue( $Queues{$queue} ) - . '", type: "link", url: "' - . $Self->{UrlAtendimento} - . $queue . '" }, ' . "\n"; - } - } - - $result = $result . "\t\t\t]);\n\t\t}\n"; - - return $result; -} - -sub FirstQueue { - my $Self = shift; - my $queue = shift; - my @parts = split( "::", $queue ); - return $parts[0]; -} - -sub LastQueue { - my $Self = shift; - my $queue = shift; - my @parts = split( "::", $queue ); - return $parts[-1]; -} - 1; diff --git a/Kernel/Output/HTML/Standard/CustomerFooterQPUFSC.tt b/Kernel/Output/HTML/Standard/CustomerFooterQPUFSC.tt new file mode 100755 index 0000000..a8f3b62 --- /dev/null +++ b/Kernel/Output/HTML/Standard/CustomerFooterQPUFSC.tt @@ -0,0 +1,33 @@ +# -- +# CustomerFooterQPUFSC.tt - Footer para Queues Panel na UFSC +# Copyright (C) 2001-2014 OTRS AG, http://otrs.com/ +# -- +# 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. +# -- + +
+ +
+
+
+
+
+
© SeTIC - Superintendência de Governança Eletrônica e Tecnologia da Informação e Comunicação +
+ +
+ + + + +[% InsertTemplate("CustomerFooterJS.tt") %] + + + diff --git a/Kernel/Output/HTML/Standard/CustomerHTMLHeadQPUFSC.tt b/Kernel/Output/HTML/Standard/CustomerHTMLHeadQPUFSC.tt new file mode 100755 index 0000000..6fc4761 --- /dev/null +++ b/Kernel/Output/HTML/Standard/CustomerHTMLHeadQPUFSC.tt @@ -0,0 +1,159 @@ +# -- +# CustomerHTMLHeadUFSC.tt - provides FSC global HTML header +# Copyright (C) 2015, SeTIC - UFSC - http://setic.ufsc.br/ +# -- +# 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. +# -- + + +[% RenderBlockStart("MetaHttpEquivRefresh") %] +[% INCLUDE "HTMLHeadRefresh.tt" %] +[% RenderBlockEnd("MetaHttpEquivRefresh") %] +[% RenderBlockStart("MetaLink") %] + +[% RenderBlockEnd("MetaLink") %] + + +[% RenderBlockStart("CommonCSS") %] + +[% RenderBlockEnd("CommonCSS") %] + +[% RenderBlockStart("CommonCSS_IE8") %] + +[% RenderBlockEnd("CommonCSS_IE8") %] + +[% RenderBlockStart("ModuleCSS") %] + +[% RenderBlockEnd("ModuleCSS") %] + +[% RenderBlockStart("ModuleCSS_IE8") %] + +[% RenderBlockEnd("ModuleCSS_IE8") %] + + + + +[% RenderBlockStart("HeaderLogoCSS") %] + +[% RenderBlockEnd("HeaderLogoCSS") %] + + + + + + + + + [% Data.TitleArea | html %] [% Config("ProductName") %] + + + + +[% INCLUDE "HTMLHeadBlockEvents.tt" %] + + diff --git a/Kernel/Output/HTML/Standard/CustomerHeaderQPUFSC.tt b/Kernel/Output/HTML/Standard/CustomerHeaderQPUFSC.tt new file mode 100755 index 0000000..a3f3706 --- /dev/null +++ b/Kernel/Output/HTML/Standard/CustomerHeaderQPUFSC.tt @@ -0,0 +1,40 @@ +# -- +# CustomerHeaderQPUFSC.tt - provides global HTML header for UFSC +# Copyright (C) 2015, SeTIC - UFSC - http://setic.ufsc.br/ +# -- +# 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. +# -- +[%- INCLUDE "HTTPHeaders.tt" -%] + + + +[% InsertTemplate("Copyright.tt") %] +[% InsertTemplate("CustomerHTMLHeadQPUFSC.tt") %] + + + + + + + + + + +
PAI - Portal de Atendimento Institucional
+
+
+
+ + diff --git a/Kernel/Output/HTML/Standard/QueuesPanel.tt b/Kernel/Output/HTML/Standard/QueuesPanel.tt index b14d595..2f5c2c8 100644 --- a/Kernel/Output/HTML/Standard/QueuesPanel.tt +++ b/Kernel/Output/HTML/Standard/QueuesPanel.tt @@ -11,7 +11,7 @@ # the enclosed file COPYING for license information (AGPL). If you # did not receive this file, see http://www.gnu.org/licenses/agpl.txt. # -- -
+
[% Data.MsgChooseQueue %]
@@ -20,12 +20,19 @@
[% Data.QueueComments %]
-
+
+ [% RenderBlockEnd("ListQueue") %] +
+ [% WRAPPER JSOnDocumentComplete %] [% END %] diff --git a/Kernel/System/QueuesPanel.pm b/Kernel/System/QueuesPanel.pm new file mode 100644 index 0000000..33e011a --- /dev/null +++ b/Kernel/System/QueuesPanel.pm @@ -0,0 +1,212 @@ +# -- +# Kernel/System/QueuesPanel.pm - logic for queues panel module +# +# Copyright (C) SeTIC - UFSC - http://setic.ufsc.br/ +# Version 29/10/2015 - First version +# +# -- +# 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::System::QueuesPanel; + +use strict; +use warnings; + +use Kernel::System::VariableCheck qw(:all); +use Data::Dumper; + +our @ObjectDependencies = ( +"Kernel::System::DB", +"KerneL::System::Log", +"Kernel::System::Queue"); + +sub new { + my ( $Type, %Param ) = @_; + + # allocate new hash for object + my $Self = {%Param}; + bless( $Self, $Type ); + + return $Self; +} + + +=head + +Builds the JavaScript for the Queues Panel component (jQuery hColumns) + +Params: IgnoreQueuesID - comma-separated list of queues to ignore + ExtraQueues - line-break separated list of extra queues to include. Each line has a name for the queue and a link, separated by "||" - example: + SeTIC||http://setic.ufsc.br + +=cut +sub BuildQueuesJS { + my ( $Self, %Param ) = @_; + + # Get queues + my %Queues = (); + my %ExtraQueuesLinks = (); + + my $DBObject = $Kernel::OM->Get("Kernel::System::DB"); + + if ($Param{IgnoreQueuesIDs}) { + $DBObject->Prepare( SQL => "SELECT id, name FROM queue WHERE valid_id = 1 AND id NOT IN (" . $Param{IgnoreQueuesIDs} . ") ORDER BY name ASC", ); + } else { + $DBObject->Prepare( SQL => "SELECT id, name FROM queue WHERE valid_id = 1 ORDER BY name ASC", ); + } + + while ( my @Row = $DBObject->FetchrowArray() ) { + $Queues{ $Row[0] } = $Row[1]; + } + + + if ($Param{ExtraQueues}) { + my @extraQueues = split('\n', $Param{ExtraQueues}); + my $id = -1; + foreach my $extraQueue (@extraQueues) { + my @data = split('\|', $extraQueue); + $Queues{$id} = $data[0]; + $ExtraQueuesLinks{$id} = $data[1]; + $id = $id - 1; + } + } + + my $result = + '$(document).ready(function() {' . "\n\t" + . ' $("#columns").hColumns({' + . "\n\t\t" + . ' nodeSource: function(node_id, callback) {' . "\n"; + + for my $queue ( keys %Queues ) { + $result = $result . $Self->BuildQueueJS( Queues => \%Queues, Queue => $Queues{$queue}, QueueID => $queue, ExtraQueuesLinks => \%ExtraQueuesLinks, URL => + $Param{URL} ); + } + + $result = $result . $Self->BuildTopQueuesJS( Queues => \%Queues, ExtraQueuesLinks => \%ExtraQueuesLinks, URL => + $Param{URL} ); + + $result = $result . "\n\t}});\n});"; + + return $result; +} + +=head + +Builds the top level queues JavaScript + +Params: Queues - queues list + ExtraQueuesLinks - links for custom (id < 0) queues + +=cut +sub BuildTopQueuesJS { + my ( $Self, %Param ) = @_; + my %Queues = %{ $Param{"Queues"} }; + my %ExtraQueuesLinks = %{ $Param{"ExtraQueuesLinks"} }; + + my @topQueues = grep { index( $Queues{$_}, '::' ) == -1 } keys %Queues; + + my $result = "\t\tif (node_id === null) { \n\t\t\treturn callback(null, [\n"; + for my $queue (sort {$Queues{$a} cmp $Queues{$b}} @topQueues) { + + if ( grep { index( $Queues{$_}, $Queues{$queue} . "::" ) >= 0 } keys %Queues ) { + $result = $result + . "\t\t\t\t" + . '{ id: ' + . $queue + . ', label: "' + . $Self->LastQueue( $Queues{$queue} ) + . '", type: "folder" },' . "\n"; + } + else { + $result = $result + . "\t\t\t\t" + . '{ id: ' + . $queue + . ', label: "' + . $Self->LastQueue( $Queues{$queue} ) + . '", type: "link", url: "' + . ($queue < 0 ? $ExtraQueuesLinks{$queue} : $Param{"URL"} . $queue) + . '" },' . "\n"; + } + } + + $result = $result . "\t\t\t]);\n\t\t}\n"; + + return $result; +} + +=head + +Builds sub-queues JavaScript + +Params: Queues - queues list + ExtraQueuesLinks - links for custom (id < 0) queues + BaseQueue / BaseQueueID - which upper queue to generate subqueues + +=cut +sub BuildQueueJS { + my ( $Self, %Param ) = @_; + my %Queues = %{ $Param{"Queues"} }; + my $BaseQueue = $Param{"Queue"}; + my $BaseQueueID = $Param{"QueueID"}; + my %ExtraQueuesLinks = %{ $Param{"ExtraQueuesLinks"} }; + + # Get subqueues + my @subqueues = grep { index( $Queues{$_}, $BaseQueue . "::" ) >= 0 } keys %Queues; + my $level = () = $BaseQueue =~ /::/g; + $level = $level + 1; + + # Remove subsubqueues + @subqueues = grep { ( () = $Queues{$_} =~ /::/g ) == $level } @subqueues; + + # When there are no subqueues, there is no need to create a JS + if ( !@subqueues ) { + return ""; + } + + my $result = "\t\tif (node_id === " . $BaseQueueID . ") { \n\t\t\treturn callback(null, [\n"; + + for my $queue (@subqueues) { + if ( grep { index( $Queues{$_}, $Queues{$queue} . "::" ) >= 0 } keys %Queues ) { + $result = $result + . "\t\t\t\t" + . '{ id: ' + . $queue + . ', label: "' + . $Self->LastQueue( $Queues{$queue} ) + . '", type: "folder" }, ' . "\n"; + } + else { + $result = $result + . "\t\t\t\t" + . '{ id: ' + . $queue + . ', label: "' + . $Self->LastQueue( $Queues{$queue} ) + . '", type: "link", url: "' + . ($queue < 0 ? $ExtraQueuesLinks{$queue} : $Param{"URL"} . $queue) . '" }, ' . "\n"; + } + } + + $result = $result . "\t\t\t]);\n\t\t}\n"; + + return $result; +} + +=head + +Returns last part of the queue name (strips parent queues) + +Params: QueueName + +=cut +sub LastQueue { + my $Self = shift; + my $queue = shift; + my @parts = split( "::", $queue ); + return $parts[-1]; +} + +1; diff --git a/QueuePanelUFSC.sopm b/QueuePanelUFSC.sopm new file mode 100755 index 0000000..ae94fa3 --- /dev/null +++ b/QueuePanelUFSC.sopm @@ -0,0 +1,22 @@ + + + QueuesPanelUFSC + 1.0.0 + 4.0.4 + SeTIC + http://www.setic.ufsc.br + GPLv2 + Customer header/footer for QueuesPanel module for UFSC + Module installed successfully! + New Ticket Wizard + ? + ? + + + + + + + + + \ No newline at end of file diff --git a/QueuesPanel.sopm b/QueuesPanel.sopm index eb42479..036a10f 100755 --- a/QueuesPanel.sopm +++ b/QueuesPanel.sopm @@ -1,18 +1,19 @@ QueuesPanel - 1.0.0 - 4.0.3 + 1.1.0 + 4.0.4 SeTIC + Support for custom queues, layout fixes, support for custom layouts for header and footer http://www.setic.ufsc.br GPLv2 Queue choosing panel Module installed successfully! - New Ticket Wizard + Queues Panel ? ? - CASAuthentication - NewTicketWizard + CASAuthentication + NewTicketWizard @@ -22,15 +23,16 @@ + + - + - diff --git a/var/httpd/htdocs/skins/Customer/default/css/hColumns/hcolumns-intro.css b/var/httpd/htdocs/skins/Customer/default/css/hColumns/hcolumns-intro.css index 897cec4..cbb3ac3 100755 --- a/var/httpd/htdocs/skins/Customer/default/css/hColumns/hcolumns-intro.css +++ b/var/httpd/htdocs/skins/Customer/default/css/hColumns/hcolumns-intro.css @@ -80,6 +80,3 @@ ol li { line-height: 20px; } -.column-view-container { - margin: 1em; -} diff --git a/var/httpd/htdocs/skins/Customer/default/css/hColumns/hcolumns.css b/var/httpd/htdocs/skins/Customer/default/css/hColumns/hcolumns.css index ae215f3..841f007 100644 --- a/var/httpd/htdocs/skins/Customer/default/css/hColumns/hcolumns.css +++ b/var/httpd/htdocs/skins/Customer/default/css/hColumns/hcolumns.css @@ -1,16 +1,59 @@ -.ChooseQueue { - border-style: solid; +/*.ChooseQueue { + border-bottom-style: solid; border-width: 1px; padding: 5px; margin-top: 5px; margin-left: 10px; +}*/ + +.ChooseQueue { + background-color: rgb(198, 222, 255); +background-image: none; +background-position: 0px 0px; +background-repeat: repeat-x; +border-bottom-color: rgb(255, 255, 255); +border-bottom-style: solid; +border-bottom-width: 0px; +border-collapse: separate; +border-left-color: rgb(255, 255, 255); +border-left-style: solid; +border-left-width: 1px; +border-right-color: rgb(255, 255, 255); +border-right-style: solid; +border-right-width: 1px; +border-top-color: rgb(255, 255, 255); +border-top-style: solid; +border-top-width: 1px; +color: rgb(0, 0, 0); +cursor: default; +display: table-cell; +font-family: Arial, Verdana, sans-serif; +font-size: 14px; +font-weight: bold; +height: 12px; +margin-bottom: 0px; +margin-left: 0px; +margin-right: 0px; +margin-top: 0px; +padding-bottom: 5px; +padding-left: 15px; +padding-right: 15px; +padding-top: 5px; +text-align: center; +vertical-align: middle; +} + +.Queues { + width: 80%; + margin: 0 auto; + padding-top: 10px; } /* column view container */ .column-view-container { width: 100%; - height: 400px; - padding: 0; + margin: 0px; + padding: 0px; border: 1px solid #ccc; background: #FFF; display: block; diff --git a/var/httpd/htdocs/skins/Customer/default/images/queues-panel/cabecalhoUFSC.jpg b/var/httpd/htdocs/skins/Customer/default/images/queues-panel/cabecalhoUFSC.jpg new file mode 100644 index 0000000..daec578 Binary files /dev/null and b/var/httpd/htdocs/skins/Customer/default/images/queues-panel/cabecalhoUFSC.jpg differ diff --git a/var/httpd/htdocs/skins/Customer/default/images/queues-panel/separador.gif b/var/httpd/htdocs/skins/Customer/default/images/queues-panel/separador.gif new file mode 100644 index 0000000..e249fea Binary files /dev/null and b/var/httpd/htdocs/skins/Customer/default/images/queues-panel/separador.gif differ diff --git a/var/httpd/htdocs/skins/Customer/default/images/queues-panel/separador.gif.1 b/var/httpd/htdocs/skins/Customer/default/images/queues-panel/separador.gif.1 new file mode 100644 index 0000000..e249fea Binary files /dev/null and b/var/httpd/htdocs/skins/Customer/default/images/queues-panel/separador.gif.1 differ diff --git a/var/httpd/htdocs/skins/Customer/default/images/queues-panel/setic.png b/var/httpd/htdocs/skins/Customer/default/images/queues-panel/setic.png new file mode 100644 index 0000000..aac5373 Binary files /dev/null and b/var/httpd/htdocs/skins/Customer/default/images/queues-panel/setic.png differ -- libgit2 0.21.2