Commit 229c50a291b9bc7149885cdcc9a06337d60c9fd9
1 parent
c97e028e
Exists in
master
Versao 1.0.3
Showing
7 changed files
with
263 additions
and
0 deletions
Show diff stats
... | ... | @@ -0,0 +1,18 @@ |
1 | +<?xml version="1.0" encoding="UTF-8"?> | |
2 | +<projectDescription> | |
3 | + <name>otrs-agents-per-queue</name> | |
4 | + <comment></comment> | |
5 | + <projects> | |
6 | + <project>otrs</project> | |
7 | + </projects> | |
8 | + <buildSpec> | |
9 | + <buildCommand> | |
10 | + <name>org.epic.perleditor.perlbuilder</name> | |
11 | + <arguments> | |
12 | + </arguments> | |
13 | + </buildCommand> | |
14 | + </buildSpec> | |
15 | + <natures> | |
16 | + <nature>org.epic.perleditor.perlnature</nature> | |
17 | + </natures> | |
18 | +</projectDescription> | ... | ... |
... | ... | @@ -0,0 +1,28 @@ |
1 | +<?xml version="1.0" encoding="UTF-8" ?> | |
2 | +<otrs_config init="Application" version="1.0"> | |
3 | + | |
4 | + | |
5 | + <!-- Módulo Matriz --> | |
6 | + <ConfigItem Name="Frontend::Module###AgentsPerQueue" Required="0" Valid="1"> | |
7 | + <Description Translatable="1">FrontendModuleRegistration for AgentsPerQueue module.</Description> | |
8 | + <Group>Framework</Group> | |
9 | + <SubGroup>Frontend::Agent::ModuleRegistration</SubGroup> | |
10 | + <Setting> | |
11 | + <FrontendModuleReg> | |
12 | + <Description>Module for publishing agents per queue matrix</Description> | |
13 | + <NavBarName>Service</NavBarName> | |
14 | + <NavBar> | |
15 | + <Description Translatable="1">Agents per queue matrix</Description> | |
16 | + <Name Translatable="1">Agents per queue matrix</Name> | |
17 | + <Link>Action=AgentsPerQueue</Link> | |
18 | + <NavBar>Service</NavBar> | |
19 | + <Type></Type> | |
20 | + <Prio>8200</Prio> | |
21 | + </NavBar> | |
22 | + <Loader> | |
23 | + </Loader> | |
24 | + </FrontendModuleReg> | |
25 | + </Setting> | |
26 | + </ConfigItem> | |
27 | + | |
28 | +</otrs_config> | ... | ... |
... | ... | @@ -0,0 +1,29 @@ |
1 | +# -- | |
2 | +# Kernel/Modules/pt_BR_AgentsPerQueue.pm - frontend module for showing agents per queue matrix | |
3 | +# Translations | |
4 | +# | |
5 | +# Copyright (C) 2014 (Rodrigo Goncalves) (rodrigo.g@ufsc.br) | |
6 | +# -- | |
7 | +# This software comes with ABSOLUTELY NO WARRANTY. For details, see | |
8 | +# the enclosed file COPYING for license information (AGPL). If you | |
9 | +# did not receive this file, see http://www.gnu.org/licenses/agpl.txt. | |
10 | +# -- | |
11 | +package Kernel::Language::pt_BR_AgentsPerQueue; | |
12 | + | |
13 | +use strict; | |
14 | +use warnings; | |
15 | + | |
16 | +sub Data { | |
17 | + my $Self = shift; | |
18 | + | |
19 | + $Self->{Translation}->{'Queues per agent'} = 'Filas por agente'; | |
20 | + $Self->{Translation}->{'Queues'} = 'Filas'; | |
21 | + $Self->{Translation}->{'Paths'} = 'Encaminhamentos'; | |
22 | + $Self->{Translation}->{'Agents per queue matrix'} = 'Agentes por fila'; | |
23 | + | |
24 | + | |
25 | + | |
26 | + | |
27 | + return 1; | |
28 | +} | |
29 | +1; | |
0 | 30 | \ No newline at end of file | ... | ... |
... | ... | @@ -0,0 +1,146 @@ |
1 | +# -- | |
2 | +# Kernel/Modules/AgentsPerQueue.pm - frontend module for displaying the agents per queue matrix panel | |
3 | +# Copyright (C) 2014 (Rodrigo Goncalves) (rodrigo.g@ufsc.br) | |
4 | +# -- | |
5 | +# This software comes with ABSOLUTELY NO WARRANTY. For details, see | |
6 | +# the enclosed file COPYING for license information (AGPL). If you | |
7 | +# did not receive this file, see http://www.gnu.org/licenses/agpl.txt. | |
8 | +# -- | |
9 | +package Kernel::Modules::AgentsPerQueue; | |
10 | + | |
11 | +use strict; | |
12 | +use warnings; | |
13 | + | |
14 | +use Kernel::System::VariableCheck qw(:all); | |
15 | +use Data::Dumper; | |
16 | + | |
17 | +sub new { | |
18 | + my ( $Type, %Param ) = @_; | |
19 | + | |
20 | + # allocate new hash for object | |
21 | + my $Self = {%Param}; | |
22 | + bless( $Self, $Type ); | |
23 | + | |
24 | + # check needed objects | |
25 | + for ( | |
26 | + qw(ParamObject DBObject LayoutObject LogObject ConfigObject) | |
27 | + ) | |
28 | + { | |
29 | + if ( !$Self->{$_} ) { | |
30 | + $Self->{LayoutObject}->FatalError( Message => "Got no $_!" ); | |
31 | + } | |
32 | + } | |
33 | + | |
34 | + # needed objects | |
35 | + | |
36 | + return $Self; | |
37 | +} | |
38 | + | |
39 | +sub Run { | |
40 | + my ( $Self, %Param ) = @_; | |
41 | + my %Data = (); | |
42 | + | |
43 | + # load data | |
44 | + my %matrix = $Self->GetQueuesPerAgent(); | |
45 | + | |
46 | + # build output | |
47 | + my $Output = | |
48 | + $Self->{LayoutObject}->Header( Title => $Self->{LayoutObject}->{LanguageObject}->Get("Queues per agent") ); | |
49 | + $Output .= $Self->{LayoutObject}->NavigationBar(); | |
50 | + | |
51 | + my $id = 1; | |
52 | + | |
53 | + # include each agent | |
54 | + foreach my $agent ( sort keys %matrix ) { | |
55 | + $Self->{LayoutObject}->Block( | |
56 | + Name => 'QueuesPerAgent', | |
57 | + Data => { ID => $id, Agent => $agent, Queues => $matrix{$agent}{"Manage"}, Paths => $matrix{$agent}{"Path"} }, | |
58 | + ); | |
59 | + $id += 1; | |
60 | + } | |
61 | + | |
62 | + $Output .= $Self->{LayoutObject}->Output( | |
63 | + Data => \%Data, | |
64 | + TemplateFile => 'AgentsPerQueue', | |
65 | + ); | |
66 | + $Output .= $Self->{LayoutObject}->Footer(); | |
67 | + return $Output; | |
68 | + | |
69 | +} | |
70 | + | |
71 | +sub GetQueuesPerAgent { | |
72 | + my ( $Self, %Param ) = @_; | |
73 | + my %result = (); | |
74 | + | |
75 | + my $SQL = "SELECT type, user, queue from vw_user_queues order by user,queue, type"; | |
76 | + | |
77 | + # get queues | |
78 | + $Self->{DBObject}->Prepare( | |
79 | + SQL => $SQL, | |
80 | + Bind => [ ] | |
81 | + ); | |
82 | + | |
83 | + my $queues = ""; | |
84 | + my $queuesPath = ""; | |
85 | + | |
86 | + my $lastAgent = ""; | |
87 | + my $lastQueue = ""; | |
88 | + my $lastType = ""; | |
89 | + my $queue = ""; | |
90 | + my $type = ""; | |
91 | + my $agent = ""; | |
92 | + | |
93 | + # for each user/queue | |
94 | + while ( my @row = $Self->{DBObject}->FetchrowArray() ) { | |
95 | + | |
96 | + # current line data | |
97 | + $type = $row[0]; | |
98 | + $agent = $row[1]; | |
99 | + $queue = $row[2]; | |
100 | + | |
101 | + # if agent changed from last row (or is first line) | |
102 | + if ($agent ne $lastAgent) { | |
103 | + if ($lastAgent ne "") { | |
104 | + # if agent changed, save the previous agent data and reset the variables | |
105 | + $result{$lastAgent}{"Manage"} = $queues; | |
106 | + $result{$lastAgent}{"Path"} = $queuesPath; | |
107 | + $queues = ""; | |
108 | + $queuesPath = ""; | |
109 | + $lastQueue = ""; | |
110 | + $lastType = ""; | |
111 | + } | |
112 | + } else { | |
113 | + # same agent, add line break to the last queue type | |
114 | + if ($lastType eq "Manage") { | |
115 | + $queues = $queues . "<BR/>" | |
116 | + } else { | |
117 | + $queuesPath = $queuesPath . "<BR/>" | |
118 | + } | |
119 | + } | |
120 | + | |
121 | + # if the same queue appears in manage and path, ignore the path clause | |
122 | + if (($type eq "Path") and ($lastQueue eq $queue)) { | |
123 | + | |
124 | + } elsif ($type eq "Manage") { | |
125 | + $queues = $queues . $queue; | |
126 | + } elsif ($type eq "Path") { | |
127 | + $queuesPath = $queuesPath . $queue; | |
128 | + } | |
129 | + | |
130 | + # data for next loop | |
131 | + $lastType = $type; | |
132 | + $lastQueue = $queue; | |
133 | + $lastAgent = $agent; | |
134 | + } | |
135 | + | |
136 | + if (($queues ne "") or ($queuesPath ne "")) { | |
137 | + $result{$agent}{"Manage"} = $queues; | |
138 | + $result{$agent}{"Path"} = $queuesPath; | |
139 | + } | |
140 | + | |
141 | + print STDERR Dumper(%result); | |
142 | + | |
143 | + return %result; | |
144 | +} | |
145 | + | |
146 | +1; | ... | ... |
... | ... | @@ -0,0 +1,35 @@ |
1 | +# -- | |
2 | +# ResponsibilityMatrix.dtl - provides HTML for ResponsibilityMatrix | |
3 | +# Copyright (C) 2014 Rodrigo Gonçalves (rodrigo.g@ufsc.br) | |
4 | +# | |
5 | +# This software comes with ABSOLUTELY NO WARRANTY. For details, see | |
6 | +# the enclosed file COPYING for license information (AGPL). If you | |
7 | +# did not receive this file, see http://www.gnu.org/licenses/agpl.txt. | |
8 | +# -- | |
9 | +# Autor: Rodrigo Gonçalves | |
10 | +# Data.: 04/08/2014 - versão inicial | |
11 | +# | |
12 | + | |
13 | +<div class="MainBox ARIARoleMain LayoutFixedSidebar SidebarFirst"><h1>$Text{"Queues per agent"}</h1></div> | |
14 | +<table class="DataTable SpacingTop" style="width: 80%; margin-left: 10%; margin-bottom: 50px;"> | |
15 | +<thead> | |
16 | +<tr> | |
17 | +<th ROWSPAN="1" style="text-align: center; vertical-align: middle">$Text{"ID"}</th> | |
18 | +<th ROWSPAN="1" style="text-align: center; vertical-align: middle">$Text{"Agent"}</th> | |
19 | +<th ROWSPAN="1" style="text-align: center; vertical-align: middle">$Text{"Paths"}</th> | |
20 | +<th ROWSPAN="1" style="text-align: center; vertical-align: middle">$Text{"Queues"}</th> | |
21 | +</tr> | |
22 | +</thead> | |
23 | +<tbody> | |
24 | +<!-- dtl:block:QueuesPerAgent --> | |
25 | +<tr><td>$Data{"ID"}</td><td>$Data{"Agent"}</td> | |
26 | +<td> | |
27 | +<div style="width:100%; max-height:200px; overflow:auto">$Data{"Paths"}</div> | |
28 | +</td> | |
29 | +<td> | |
30 | +<div style="width:100%; max-height:200px; overflow:auto">$Data{"Queues"}</div> | |
31 | +</td> | |
32 | +</tr> | |
33 | +<!-- dtl:block:QueuesPerAgent --> | |
34 | +</tbody> | |
35 | +</table> | |
0 | 36 | \ No newline at end of file | ... | ... |