Commit 0615c6a207daa2c171694686ea9c00989506a105

Authored by Rodrigo Gonçalves
1 parent 229c50a2
Exists in master

Ajustes para OTRS 4.0.4

AgentsPerQueue.sopm
1 1 <?xml version="1.0" encoding="utf-8" ?>
2 2 <otrs_package version="1.0">
3 3 <Name>AgentsPerQueue</Name>
4   - <Version>1.0.3</Version>
5   - <Framework>3.x.x</Framework>
6   - <Vendor>SeTIC</Vendor>
7   - <URL>http://www.setic.ufsc.br</URL>
8   - <License>Free</License>
9   - <Description Lang="pt-br">Agentes por fila
10   -
11   - Versão 1.0.0 - Versão inicial
12   - Versão 1.0.2 - Encaminhamentos
13   - Versão 1.0.3 - Ajustes de encaminhamento
14   -
15   - </Description>
16   - <IntroInstall Type="post" Lang="pt-br" Title="Thank you">Módulo de agentes por fila instalado com sucesso!</IntroInstall>
17   - <Description Lang="en">Agents per queue module</Description>
18   - <IntroInstall Type="post" Lang="en" Title="Thank you">Agents per queue module installed successfully!</IntroInstall>
  4 + <Version>1.1.0</Version>
  5 + <Framework>4.0.4</Framework>
  6 + <Vendor>SeTIC - UFSC</Vendor>
  7 + <URL>http://setic.ufsc.br</URL>
  8 + <License>GPLv2</License>
  9 + <Description>Agents per queue</Description>
  10 + <ChangeLog Version="1.1.0">Adjustments for OTRS 4.0.4</ChangeLog>
  11 + <Description>Agents per queue module</Description>
  12 + <IntroInstall Type="post" Title="Thank you">Agents per queue module installed successfully!</IntroInstall>
19 13 <BuildDate>?</BuildDate>
20 14 <BuildHost>?</BuildHost>
21 15 <Filelist>
22 16 <File Permission="644" Location="Kernel/Config/Files/AgentsPerQueue.xml"></File>
23 17 <File Permission="644" Location="Kernel/Language/pt_BR_AgentsPerQueue.pm"></File>
24 18 <File Permission="644" Location="Kernel/Modules/AgentsPerQueue.pm"></File>
25   - <File Permission="644" Location="Kernel/Output/HTML/Standard/AgentsPerQueue.dtl"></File>
  19 + <File Permission="644" Location="Kernel/Output/HTML/Standard/AgentsPerQueue.tt"></File>
26 20 </Filelist>
27 21 </otrs_package>
28 22 \ No newline at end of file
... ...
Kernel/Config/Files/AgentsPerQueue.xml
1 1 <?xml version="1.0" encoding="UTF-8" ?>
2 2 <otrs_config init="Application" version="1.0">
3   -
4   -
  3 +
5 4 <!-- Módulo Matriz -->
6 5 <ConfigItem Name="Frontend::Module###AgentsPerQueue" Required="0" Valid="1">
7 6 <Description Translatable="1">FrontendModuleRegistration for AgentsPerQueue module.</Description>
... ... @@ -12,8 +11,8 @@
12 11 <Description>Module for publishing agents per queue matrix</Description>
13 12 <NavBarName>Service</NavBarName>
14 13 <NavBar>
15   - <Description Translatable="1">Agents per queue matrix</Description>
16   - <Name Translatable="1">Agents per queue matrix</Name>
  14 + <Description>Agents per queue matrix</Description>
  15 + <Name>Agents per queue matrix</Name>
17 16 <Link>Action=AgentsPerQueue</Link>
18 17 <NavBar>Service</NavBar>
19 18 <Type></Type>
... ...
Kernel/Language/pt_BR_AgentsPerQueue.pm
... ... @@ -12,6 +12,7 @@ package Kernel::Language::pt_BR_AgentsPerQueue;
12 12  
13 13 use strict;
14 14 use warnings;
  15 +use utf8;
15 16  
16 17 sub Data {
17 18 my $Self = shift;
... ... @@ -20,10 +21,7 @@ sub Data {
20 21 $Self->{Translation}->{'Queues'} = 'Filas';
21 22 $Self->{Translation}->{'Paths'} = 'Encaminhamentos';
22 23 $Self->{Translation}->{'Agents per queue matrix'} = 'Agentes por fila';
23   -
24   -
25   -
26   -
  24 +
27 25 return 1;
28 26 }
29 27 1;
30 28 \ No newline at end of file
... ...
Kernel/Modules/AgentsPerQueue.pm
1 1 # --
2 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)
  3 +#
  4 +# Copyright (C) 2014 SeTIC - UFSC - http://setic.ufsc.br/
  5 +# Version 01/15/2015 - Adjustments for OTRS 4
  6 +#
4 7 # --
5 8 # This software comes with ABSOLUTELY NO WARRANTY. For details, see
6 9 # the enclosed file COPYING for license information (AGPL). If you
... ... @@ -12,7 +15,15 @@ use strict;
12 15 use warnings;
13 16  
14 17 use Kernel::System::VariableCheck qw(:all);
15   -use Data::Dumper;
  18 +
  19 +
  20 +our @ObjectDependencies = (
  21 +"Kernel::System::Web::Request", # OLD ParamObject
  22 +"Kernel::System::DB",
  23 +"Kernel::Output::HTML::Layout",
  24 +"Kernel::System::Log",
  25 +"Kernel::Config"
  26 +);
16 27  
17 28 sub new {
18 29 my ( $Type, %Param ) = @_;
... ... @@ -21,49 +32,38 @@ sub new {
21 32 my $Self = {%Param};
22 33 bless( $Self, $Type );
23 34  
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 35 return $Self;
37 36 }
38 37  
39 38 sub Run {
40 39 my ( $Self, %Param ) = @_;
41 40 my %Data = ();
  41 + my $layoutObject = $Kernel::OM->Get("Kernel::Output::HTML::Layout");
42 42  
43 43 # load data
44 44 my %matrix = $Self->GetQueuesPerAgent();
45 45  
46 46 # build output
47 47 my $Output =
48   - $Self->{LayoutObject}->Header( Title => $Self->{LayoutObject}->{LanguageObject}->Get("Queues per agent") );
49   - $Output .= $Self->{LayoutObject}->NavigationBar();
  48 + $layoutObject->Header( Title => $layoutObject->{LanguageObject}->Translate("Queues per agent") );
  49 + $Output .= $layoutObject->NavigationBar();
50 50  
51 51 my $id = 1;
52 52  
53 53 # include each agent
54 54 foreach my $agent ( sort keys %matrix ) {
55   - $Self->{LayoutObject}->Block(
  55 + $layoutObject->Block(
56 56 Name => 'QueuesPerAgent',
57 57 Data => { ID => $id, Agent => $agent, Queues => $matrix{$agent}{"Manage"}, Paths => $matrix{$agent}{"Path"} },
58 58 );
59 59 $id += 1;
60 60 }
61 61  
62   - $Output .= $Self->{LayoutObject}->Output(
  62 + $Output .= $layoutObject->Output(
63 63 Data => \%Data,
64 64 TemplateFile => 'AgentsPerQueue',
65 65 );
66   - $Output .= $Self->{LayoutObject}->Footer();
  66 + $Output .= $layoutObject->Footer();
67 67 return $Output;
68 68  
69 69 }
... ... @@ -71,11 +71,12 @@ sub Run {
71 71 sub GetQueuesPerAgent {
72 72 my ( $Self, %Param ) = @_;
73 73 my %result = ();
  74 + my $dbObject = $Kernel::OM->Get("Kernel::System::DB");
74 75  
75 76 my $SQL = "SELECT type, user, queue from vw_user_queues order by user,queue, type";
76 77  
77 78 # get queues
78   - $Self->{DBObject}->Prepare(
  79 + $dbObject->Prepare(
79 80 SQL => $SQL,
80 81 Bind => [ ]
81 82 );
... ... @@ -91,7 +92,7 @@ sub GetQueuesPerAgent {
91 92 my $agent = "";
92 93  
93 94 # for each user/queue
94   - while ( my @row = $Self->{DBObject}->FetchrowArray() ) {
  95 + while ( my @row = $dbObject->FetchrowArray() ) {
95 96  
96 97 # current line data
97 98 $type = $row[0];
... ... @@ -138,8 +139,6 @@ sub GetQueuesPerAgent {
138 139 $result{$agent}{"Path"} = $queuesPath;
139 140 }
140 141  
141   - print STDERR Dumper(%result);
142   -
143 142 return %result;
144 143 }
145 144  
... ...
Kernel/Output/HTML/Standard/AgentsPerQueue.dtl
... ... @@ -1,35 +0,0 @@
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>
36 0 \ No newline at end of file
Kernel/Output/HTML/Standard/AgentsPerQueue.tt 0 → 100644
... ... @@ -0,0 +1,36 @@
  1 +# --
  2 +# ResponsibilityMatrix.tt - provides HTML for ResponsibilityMatrix
  3 +#
  4 +# Copyright (C) 2014 SeTIC - UFSC - http://setic.ufsc.br/
  5 +# Version 01/15/2015 - Adjustments for OTRS 4
  6 +#
  7 +#
  8 +# This software comes with ABSOLUTELY NO WARRANTY. For details, see
  9 +# the enclosed file COPYING for license information (AGPL). If you
  10 +# did not receive this file, see http://www.gnu.org/licenses/agpl.txt.
  11 +# --
  12 +#
  13 +
  14 +<div class="MainBox ARIARoleMain LayoutFixedSidebar SidebarFirst"><h1>[% Translate("Queues per agent") | html %]</h1></div>
  15 +<table class="DataTable SpacingTop" style="width: 80%; margin-left: 10%; margin-bottom: 50px;">
  16 +<thead>
  17 +<tr>
  18 +<th ROWSPAN="1" style="text-align: center; vertical-align: middle">[% Translate("ID") | html %]</th>
  19 +<th ROWSPAN="1" style="text-align: center; vertical-align: middle">[% Translate("Agent") | html %]</th>
  20 +<th ROWSPAN="1" style="text-align: center; vertical-align: middle">[% Translate("Paths") | html %]</th>
  21 +<th ROWSPAN="1" style="text-align: center; vertical-align: middle">[% Translate("Queues") | html %]</th>
  22 +</tr>
  23 +</thead>
  24 +<tbody>
  25 +[% RenderBlockStart("QueuesPerAgent") %]
  26 +<tr><td>[% Data.ID %]</td><td>[% Data.Agent %]</td>
  27 +<td>
  28 +<div style="width:100%; max-height:200px; overflow:auto">[% Data.Paths %]</div>
  29 +</td>
  30 +<td>
  31 +<div style="width:100%; max-height:200px; overflow:auto">[% Data.Queues %]</div>
  32 +</td>
  33 +</tr>
  34 +[% RenderBlockEnd("QueuesPerAgent") %]
  35 +</tbody>
  36 +</table>
0 37 \ No newline at end of file
... ...