Commit 31a77bea4e5b2baf6158479ccd61a99b7fc4adfe

Authored by Rodrigo Gonçalves
1 parent 6bf50fa9
Exists in master

Ajustes para OTRS 4.0.3

Kernel/Config/Files/QueueService.xml
1 1 <?xml version="1.0" encoding="UTF-8" ?>
2 2 <otrs_config init="Application" version="1.0">
3   -
4 3 <ConfigItem Name="Frontend::Module###QueueService" Required="0" Valid="1">
5   - <Description Translatable="1">Frontend module registration for the service per queue</Description>
  4 + <Description Lang="en">Frontend module registration for the service per queue</Description>
  5 + <Description Lang="pt_BR">Registro do módulo de serviços por fila</Description>
6 6 <Group>Ticket</Group>
7 7 <SubGroup>Frontend::Admin::ModuleRegistration</SubGroup>
8 8 <Setting>
9 9 <FrontendModuleReg>
10 10 <Group>admin</Group>
11 11 <Description>Admin</Description>
12   - <Title Translatable="1">Services per queue</Title>
  12 + <Title Lang="en">Services per queue</Title>
  13 + <Title Lang="pt_BR">Serviços por fila</Title>
13 14 <NavBarName>Admin</NavBarName>
14 15 <NavBarModule>
15 16 <Module>Kernel::Output::HTML::NavBarModuleAdmin</Module>
16   - <Name Translatable="1">Service per queue</Name>
17   - <Description Translatable="1">Create and manage services per queue</Description>
  17 + <Name Lang="en">Services per queue</Name>
  18 + <Name Lang="pt_BR">Serviços por fila</Name>
  19 + <Description Lang="en">Create and manages services per queue</Description>
  20 + <Description Lang="pt_BR">Cria e gerencia serviços por fila</Description>
18 21 <Block>Ticket</Block>
19 22 <Prio>900</Prio>
20 23 </NavBarModule>
... ...
Kernel/Language/pt_BR_QueueService.pm
1 1 # --
2   -# Kernel/Modules/pt_BR_NewTicketWizard.pm - frontend module for creating custom new ticket interfaces
3   -# Translations
  2 +# Kernel/Modules/pt_BR_QueueService.pm - module to associate services per queue
  3 +#
  4 +# Copyright (C) 2014 - SeTIC - UFSC - http://setic.ufsc.br/
  5 +# Version 01/06/2015 - Adjusts for OTRS 4
4 6 #
5   -# Copyright (C) 2014 (Rodrigo Goncalves) (rodrigo.g@ufsc.br)
6 7 # --
7 8 # This software comes with ABSOLUTELY NO WARRANTY. For details, see
8 9 # the enclosed file COPYING for license information (AGPL). If you
... ... @@ -12,11 +13,14 @@ package Kernel::Language::pt_BR_QueueService;
12 13  
13 14 use strict;
14 15 use warnings;
  16 +use utf8;
15 17  
16 18 sub Data {
17 19 my $Self = shift;
18   -
19 20 $Self->{Translation}->{'Services per queue'} = 'Serviços por fila';
  21 + $Self->{Translation}->{'Create and manages services per queue'} = 'Cria e gerencia serviços por fila';
  22 +
20 23 return 1;
21 24 }
  25 +
22 26 1;
23 27 \ No newline at end of file
... ...
Kernel/Modules/QueueService.pm
1 1 # --
2 2 # Kernel/Modules/QueueService.pm - frontend module
3   -# Copyright (C) (2014) (Rodrigo Gonçalves) (rodrigo.g@ufsc.br)
4   -# --
5   -# $Id: writing-otrs-application.xml,v 1.1 2010/08/13 08:59:28 mg Exp $
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   -# Autor: Carlos Rebelato
  3 +#
  4 +# Copyright (C) 2014 - SeTIC - UFSC - http://setic.ufsc.br/
  5 +# Version 01/06/2015 - Adjusts for OTRS 4
  6 +#
  7 +# Autor: Carlos Rebelato, Rodrigo Gonçalves
12 8 # Data.: 19/02/2014 - Versão inicial
13 9 #
14 10 package Kernel::Modules::QueueService;
... ... @@ -20,6 +16,20 @@ require Kernel::System::QueueService;
20 16 require Kernel::System::Service;
21 17 require Kernel::System::Queue;
22 18  
  19 +our @ObjectDependencies = (
  20 + "Kernel::System::Web::Request", # Old ParamObject
  21 + "Kernel::System::DB",
  22 + "Kernel::System::Ticket",
  23 + "Kernel::Output::HTML::Layout", # Old LayoutObject
  24 + "Kernel::System::Log",
  25 + "Kernel::System::Queue",
  26 + "Kernel::Config",
  27 + "Kernel::System::Encode",
  28 + "Kernel::System::Main",
  29 + "Kernel::System::QueueService", # Ask direct to manager
  30 + "Kernel::System::Service" # Ask direct to manager
  31 +);
  32 +
23 33 sub new {
24 34 my ( $Type, %Param ) = @_;
25 35  
... ... @@ -27,33 +37,21 @@ sub new {
27 37 my $Self = {%Param};
28 38 bless( $Self, $Type );
29 39  
30   - # check needed objects
31   - for (
32   - qw(ParamObject DBObject TicketObject LayoutObject LogObject QueueObject ConfigObject EncodeObject MainObject)
33   - )
34   - {
35   - if ( !$Self->{$_} ) {
36   - $Self->{LayoutObject}->FatalError( Message => "Got no $_!" );
37   - }
38   - }
39   -
40   - # create needed objects
41   - $Self->{QueueServiceObject} = Kernel::System::QueueService->new(%Param);
42   - $Self->{ServiceObject} = Kernel::System::Service->new(%Param);
43   -
44 40 return $Self;
45 41 }
46 42  
47 43 sub Run {
48 44 my ( $Self, %Param ) = @_;
49 45  
50   - my $SubAction = $Self->{ParamObject}->GetParam( Param => "Subaction" );
  46 + my $ParamObject = $Kernel::OM->Get("Kernel::System::Web::Request");
  47 +
  48 + my $SubAction = $ParamObject->GetParam( Param => "Subaction" );
51 49  
52 50 if ( $SubAction eq "ServiceEdit" ) {
53   - return $Self->ShowChangeService( ID => $Self->{ParamObject}->GetParam( Param => "ID" ) );
  51 + return $Self->ShowChangeService( ID => $ParamObject->GetParam( Param => "ID" ) );
54 52 }
55 53 elsif ( $SubAction eq "QueueEdit" ) {
56   - return $Self->ShowChangeQueue( ID => $Self->{ParamObject}->GetParam( Param => "ID" ) );
  54 + return $Self->ShowChangeQueue( ID => $ParamObject->GetParam( Param => "ID" ) );
57 55 }
58 56 elsif ( $SubAction eq "ChangeService" ) {
59 57 $Self->ChangeService();
... ... @@ -72,11 +70,12 @@ sub ShowOverview() {
72 70 my ( $Self, %Param ) = @_;
73 71 my %Data = ();
74 72  
75   - my %Queues = $Self->{QueueObject}->QueueList( Valid => 1 );
76   - my %Services = $Self->{ServiceObject}->ServiceList( UserID => 1 );
  73 + my %Queues = $Kernel::OM->Get("Kernel::System::Queue")->QueueList( Valid => 1 );
  74 + my %Services = $Kernel::OM->Get("Kernel::System::Service")->ServiceList( UserID => 1 );
  75 + my $LayoutObject = $Kernel::OM->Get("Kernel::Output::HTML::Layout");
77 76  
78 77 foreach my $service ( sort { uc( $Services{$a} ) cmp uc( $Services{$b} ) } keys %Services ) {
79   - $Self->{LayoutObject}->Block(
  78 + $LayoutObject->Block(
80 79 Name => 'ListService',
81 80 Data => {
82 81 ServiceID => $service,
... ... @@ -86,7 +85,7 @@ sub ShowOverview() {
86 85 }
87 86  
88 87 foreach my $queue ( sort { uc( $Queues{$a} ) cmp uc( $Queues{$b} ) } keys %Queues ) {
89   - $Self->{LayoutObject}->Block(
  88 + $LayoutObject->Block(
90 89 Name => 'ListQueue',
91 90 Data => {
92 91 QueueID => $queue,
... ... @@ -95,24 +94,24 @@ sub ShowOverview() {
95 94 );
96 95 }
97 96  
98   - my $Output =
99   - $Self->{LayoutObject}->Header( Title => $Self->{LayoutObject}->{LanguageObject}->Get("Services per queue") );
100   - $Output .= $Self->{LayoutObject}->NavigationBar();
101   - $Output .= $Self->{LayoutObject}->Output(
  97 + my $Output = $LayoutObject->Header( Title => $LayoutObject->{LanguageObject}->Get("Services per queue") );
  98 + $Output .= $LayoutObject->NavigationBar();
  99 + $Output .= $LayoutObject->Output(
102 100 Data => \%Data,
103 101 TemplateFile => 'QueueService'
104 102 );
105 103  
106   - $Output .= $Self->{LayoutObject}->Footer();
  104 + $Output .= $LayoutObject->Footer();
107 105 return $Output;
108 106 }
109 107  
110 108 sub ShowChangeService() {
111 109 my ( $Self, %Param ) = @_;
112 110 my %Data = ();
113   - my %Service = $Self->{ServiceObject}->ServiceGet( ServiceID => $Param{ID}, UserID => 1 );
114   - my %QueuesService = $Self->{QueueServiceObject}->GetQueueList( ServiceID => $Param{ID} );
115   - my %Queues = $Self->{QueueObject}->QueueList( Valid => 1 );
  111 + my %Service = $Kernel::OM->Get("Kernel::System::Service")->ServiceGet( ServiceID => $Param{ID}, UserID => 1 );
  112 + my %QueuesService = $Kernel::OM->Get("Kernel::System::QueueService")->GetQueueList( ServiceID => $Param{ID} );
  113 + my %Queues = $Kernel::OM->Get("Kernel::System::Queue")->QueueList( Valid => 1 );
  114 + my $LayoutObject = $Kernel::OM->Get("Kernel::Output::HTML::Layout");
116 115  
117 116 $Data{Type} = "Queue";
118 117 $Data{Filter} = "Service";
... ... @@ -120,13 +119,13 @@ sub ShowChangeService() {
120 119 $Data{Name} = $Service{Name};
121 120 $Data{ID} = $Service{ServiceID};
122 121  
123   - $Self->{LayoutObject}->Block(
  122 + $LayoutObject->Block(
124 123 Name => 'ChangeHeader',
125 124 Data => \%Data
126 125 );
127 126  
128 127 foreach my $queue ( sort { uc( $Queues{$a} ) cmp uc( $Queues{$b} ) } keys %Queues ) {
129   - $Self->{LayoutObject}->Block(
  128 + $LayoutObject->Block(
130 129 Name => 'ChangeRow',
131 130 Data => {
132 131 Type => "Queue",
... ... @@ -138,23 +137,24 @@ sub ShowChangeService() {
138 137 }
139 138  
140 139 my $Output =
141   - $Self->{LayoutObject}->Header( Title => $Self->{LayoutObject}->{LanguageObject}->Get("Services per queue") );
142   - $Output .= $Self->{LayoutObject}->NavigationBar();
143   - $Output .= $Self->{LayoutObject}->Output(
  140 + $LayoutObject->Header( Title => $LayoutObject->{LanguageObject}->Get("Services per queue") );
  141 + $Output .= $LayoutObject->NavigationBar();
  142 + $Output .= $LayoutObject->Output(
144 143 Data => \%Data,
145 144 TemplateFile => 'QueueServiceChange'
146 145 );
147 146  
148   - $Output .= $Self->{LayoutObject}->Footer();
  147 + $Output .= $LayoutObject->Footer();
149 148 return $Output;
150 149 }
151 150  
152 151 sub ShowChangeQueue() {
153 152 my ( $Self, %Param ) = @_;
154   - my %Data = ();
155   - my %Queue = $Self->{QueueObject}->QueueGet( ID => $Param{ID} );
156   - my %ServicesQueue = $Self->{QueueServiceObject}->GetServiceList( QueueID => $Param{ID} );
157   - my %Services = $Self->{ServiceObject}->ServiceList( UserID => 1 );
  153 + my %Data = ();
  154 + my %Queue = $Kernel::OM->Get("Kernel::System::Queue")->QueueGet( ID => $Param{ID} );
  155 + my %ServicesQueue = $Kernel::OM->Get("Kernel::System::QueueService")->GetServiceList( QueueID => $Param{ID} );
  156 + my %Services = $Kernel::OM->Get("Kernel::System::Service")->ServiceList( UserID => 1 );
  157 + my $LayoutObject = $Kernel::OM->Get("Kernel::Output::HTML::Layout");
158 158  
159 159 $Data{Type} = "Service";
160 160 $Data{Filter} = "Queue";
... ... @@ -162,13 +162,13 @@ sub ShowChangeQueue() {
162 162 $Data{Name} = $Queue{Name};
163 163 $Data{ID} = $Queue{QueueID};
164 164  
165   - $Self->{LayoutObject}->Block(
  165 + $LayoutObject->Block(
166 166 Name => 'ChangeHeader',
167 167 Data => \%Data
168 168 );
169 169  
170 170 foreach my $service ( sort { uc( $Services{$a} ) cmp uc( $Services{$b} ) } keys %Services ) {
171   - $Self->{LayoutObject}->Block(
  171 + $LayoutObject->Block(
172 172 Name => 'ChangeRow',
173 173 Data => {
174 174 Type => "Service",
... ... @@ -180,30 +180,29 @@ sub ShowChangeQueue() {
180 180 }
181 181  
182 182 my $Output =
183   - $Self->{LayoutObject}->Header( Title => $Self->{LayoutObject}->{LanguageObject}->Get("Services per queue") );
184   - $Output .= $Self->{LayoutObject}->NavigationBar();
185   - $Output .= $Self->{LayoutObject}->Output(
  183 + $LayoutObject->Header( Title => $LayoutObject->{LanguageObject}->Get("Services per queue") );
  184 + $Output .= $LayoutObject->NavigationBar();
  185 + $Output .= $LayoutObject->Output(
186 186 Data => \%Data,
187 187 TemplateFile => 'QueueServiceChange'
188 188 );
189 189  
190   - $Output .= $Self->{LayoutObject}->Footer();
  190 + $Output .= $LayoutObject->Footer();
191 191 return $Output;
192 192  
193 193 }
194 194  
195 195 sub ChangeService() {
196 196 my ( $Self, %Param ) = @_;
197   - my @queueIDs = $Self->{ParamObject}->GetArray( Param => 'Queue' );
198   - my $id = $Self->{ParamObject}->GetParam( Param => 'ID' );
199   - $Self->{QueueServiceObject}->SetServiceQueues(ServiceID => $id, Queues => \@queueIDs);
  197 + my @queueIDs = $Kernel::OM->Get("Kernel::System::Web::Request")->GetArray( Param => 'Queue' );
  198 + my $id = $Kernel::OM->Get("Kernel::System::Web::Request")->GetParam( Param => 'ID' );
  199 + $Kernel::OM->Get("Kernel::System::QueueService")->SetServiceQueues(ServiceID => $id, Queues => \@queueIDs);
200 200 }
201 201  
202   -
203 202 sub ChangeQueue() {
204 203 my ( $Self, %Param ) = @_;
205   - my @serviceIDs = $Self->{ParamObject}->GetArray( Param => 'Service' );
206   - my $id = $Self->{ParamObject}->GetParam( Param => 'ID' );
207   - $Self->{QueueServiceObject}->SetQueueServices(QueueID => $id, Services => \@serviceIDs);
  204 + my @serviceIDs = $Kernel::OM->Get("Kernel::System::Web::Request")->GetArray( Param => 'Service' );
  205 + my $id = $Kernel::OM->Get("Kernel::System::Web::Request")->GetParam( Param => 'ID' );
  206 + $Kernel::OM->Get("Kernel::System::QueueService")->SetQueueServices(QueueID => $id, Services => \@serviceIDs);
208 207  
209 208 }
210 209 \ No newline at end of file
... ...
Kernel/Output/HTML/Standard/QueueService.dtl
... ... @@ -1,87 +0,0 @@
1   -# --
2   -# Kernel/Output/HTML/Standard/QueueService.dtl - overview
3   -# Copyright (C) (2014) (Rodrigo Gonçalves) (rodrigo.g@ufsc.br)
4   -# --
5   -# $Id: writing-otrs-application.xml,v 1.1 2010/08/13 08:59:28 mg Exp $
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   -<div class="MainBox ARIARoleMain LayoutFixedSidebar SidebarFirst">
12   - <h1>$Text{"Services per queue"}</h1>
13   -
14   - <div class="SidebarColumn">
15   -
16   - <div class="WidgetSimple">
17   - <div class="Header">
18   - <h2>$Text{"Actions"}</h2>
19   - </div>
20   - <div class="Content">
21   - <ul class="ActionList">
22   - <li>
23   - <a href="$Env{"Baselink"}Action=$Env{"Action"}" class="CallForAction"><span>$Text{"Go to overview"}</span></a>
24   - </li>
25   - </ul>
26   - </div>
27   - </div>
28   -
29   -<!-- dtl:block:serviceFilter -->
30   - <div class="WidgetSimple">
31   - <div class="Header">
32   - <h2><label for="FilterServices">$Text{"Services"}</label></h2>
33   - </div>
34   - <div class="Content">
35   - <input type="text" id="FilterUsers" class="W50pc" name="FilterUser" value="" title="$Text{"Service"}" />
36   - </div>
37   - </div>
38   -<!-- dtl:block:serviceFilter -->
39   -<!-- dtl:block:queueFilter -->
40   - <div class="WidgetSimple">
41   - <div class="Header">
42   - <h2><label for="FilterQueues">$Text{"Queues"}</label></h2>
43   - </div>
44   - <div class="Content">
45   - <input type="text" id="FilterGroups" class="W50pc" name="FilterGroups" value="" title="$Text{"Queue"}"/>
46   - </div>
47   - </div>
48   -<!-- dtl:block:queueFilter -->
49   - </div>
50   -
51   - <div class="ContentColumn">
52   - <div class="WidgetSimple">
53   -
54   - <div class="Header">
55   - <h2>$Text{"Overview"}</h2>
56   - </div>
57   - <div class="Content LayoutGrid ColumnsWithSpacing">
58   - <div class="Size1of2">
59   - <ul class="Tablelike" id="Services">
60   - <li class="Header">$Text{"Services"}</li>
61   - <li class="FilterMessage Hidden">$Text{"No matches found."}</li>
62   -<!-- dtl:block:ListService-->
63   - <li><a href="$Env{"Baselink"}Action=$Env{"Action"};Subaction=ServiceEdit;ID=$LQData{"ServiceID"}" class="AsBlock">$QData{"ServiceName"}</a></li>
64   -<!-- dtl:block:ListService-->
65   - </ul>
66   - </div>
67   - <div class="Size1of2">
68   - <ul class="Tablelike" id="Queues">
69   - <li class="Header">$Text{"Queues"}</li>
70   - <li class="FilterMessage Hidden">$Text{"No matches found."}</li>
71   -<!-- dtl:block:ListQueue-->
72   - <li><a href="$Env{"Baselink"}Action=$Env{"Action"};Subaction=QueueEdit;ID=$LQData{"QueueID"}" class="AsBlock">$QData{"QueueName"}</a></li>
73   -<!-- dtl:block:ListQueue-->
74   - </ul>
75   - </div>
76   - <div class="Clear"></div>
77   - </div>
78   -
79   -
80   -<!-- dtl:js_on_document_complete -->
81   -<script type="text/javascript">//<![CDATA[
82   - Core.UI.Table.InitTableFilter($('#FilterServices'), $('#Services'));
83   - Core.UI.Table.InitTableFilter($('#FilterQueues'), $('#Queues'));
84   -//]]></script>
85   -<!-- dtl:js_on_document_complete -->
86   -
87   -
88 0 \ No newline at end of file
Kernel/Output/HTML/Standard/QueueService.tt 0 → 100644
... ... @@ -0,0 +1,86 @@
  1 +# --
  2 +# Kernel/Output/HTML/Standard/QueueService.tt - overview
  3 +# Copyright (C) (2014) SeTIC - UFSC - http://setic.ufsc.br/
  4 +# Version 06/01/2015 - Adjusts for OTRS 4
  5 +#
  6 +# This software comes with ABSOLUTELY NO WARRANTY. For details, see
  7 +# the enclosed file COPYING for license information (AGPL). If you
  8 +# did not receive this file, see http://www.gnu.org/licenses/agpl.txt.
  9 +# --
  10 +<div class="MainBox ARIARoleMain LayoutFixedSidebar SidebarFirst">
  11 + <h1>[% Translate("Services per queue") | html %]</h1>
  12 +
  13 + <div class="SidebarColumn">
  14 +
  15 + <div class="WidgetSimple">
  16 + <div class="Header">
  17 + <h2>[% Translate("Actions") | html %]</h2>
  18 + </div>
  19 + <div class="Content">
  20 + <ul class="ActionList">
  21 + <li>
  22 + <a href="[% Env("Baselink") %]Action=[% Env("Action") %]" class="CallForAction"><span>[% Translate("Go to overview") | html %]</span></a>
  23 + </li>
  24 + </ul>
  25 + </div>
  26 + </div>
  27 +
  28 +[% RenderBlockStart("serviceFilter") %]
  29 + <div class="WidgetSimple">
  30 + <div class="Header">
  31 + <h2><label for="FilterServices">[% Translate("Services") | html %]</label></h2>
  32 + </div>
  33 + <div class="Content">
  34 + <input type="text" id="FilterUsers" class="W50pc" name="FilterUser" value="" title="[% Translate("Service") | html %]" />
  35 + </div>
  36 + </div>
  37 +[% RenderBlockEnd("serviceFilter") %]
  38 +[% RenderBlockStart("queueFilter") %]
  39 + <div class="WidgetSimple">
  40 + <div class="Header">
  41 + <h2><label for="FilterQueues">[% Translate("Queues") | html %]</label></h2>
  42 + </div>
  43 + <div class="Content">
  44 + <input type="text" id="FilterGroups" class="W50pc" name="FilterGroups" value="" title="[% Translate("Queue") | html %]"/>
  45 + </div>
  46 + </div>
  47 +[% RenderBlockEnd("queueFilter") %]
  48 + </div>
  49 +
  50 + <div class="ContentColumn">
  51 + <div class="WidgetSimple">
  52 +
  53 + <div class="Header">
  54 + <h2>[% Translate("Overview") | html %]</h2>
  55 + </div>
  56 + <div class="Content LayoutGrid ColumnsWithSpacing">
  57 + <div class="Size1of2">
  58 + <ul class="Tablelike" id="Services">
  59 + <li class="Header">[% Translate("Services") | html %]</li>
  60 + <li class="FilterMessage Hidden">[% Translate("No matches found.") | html %]</li>
  61 +[% RenderBlockStart("ListService") %]
  62 + <li><a href="[% Env("Baselink") %]Action=[% Env("Action") %];Subaction=ServiceEdit;ID=[% Data.ServiceID | uri %]" class="AsBlock">[% Data.ServiceName | html %]</a></li>
  63 +[% RenderBlockEnd("ListService") %]
  64 + </ul>
  65 + </div>
  66 + <div class="Size1of2">
  67 + <ul class="Tablelike" id="Queues">
  68 + <li class="Header">[% Translate("Queues") | html %]</li>
  69 + <li class="FilterMessage Hidden">[% Translate("No matches found.") | html %]</li>
  70 +[% RenderBlockStart("ListQueue") %]
  71 + <li><a href="[% Env("Baselink") %]Action=[% Env("Action") %];Subaction=QueueEdit;ID=[% Data.QueueID | uri %]" class="AsBlock">[% Data.QueueName | html %]</a></li>
  72 +[% RenderBlockEnd("ListQueue") %]
  73 + </ul>
  74 + </div>
  75 + <div class="Clear"></div>
  76 + </div>
  77 +
  78 +
  79 +[% WRAPPER JSOnDocumentComplete %]
  80 +<script type="text/javascript">//<![CDATA[
  81 + Core.UI.Table.InitTableFilter($('#FilterServices'), $('#Services'));
  82 + Core.UI.Table.InitTableFilter($('#FilterQueues'), $('#Queues'));
  83 +//]]></script>
  84 +[% END %]
  85 +
  86 +
0 87 \ No newline at end of file
... ...
Kernel/Output/HTML/Standard/QueueServiceChange.dtl
... ... @@ -1,95 +0,0 @@
1   -<div class="MainBox ARIARoleMain LayoutFixedSidebar SidebarFirst">
2   - <h1>$Text{"Services and queues"}</h1>
3   - <div class="SidebarColumn">
4   - <div class="WidgetSimple">
5   - <div class="Header">
6   - <h2>$Text{"Actions"}</h2>
7   - </div>
8   - <div class="Content">
9   - <ul class="ActionList">
10   - <li>
11   - <a href="$Env{"Baselink"}Action=$Env{"Action"}" class="CallForAction"><span>$Text{"Go to overview"}</span></a>
12   - </li>
13   - </ul>
14   - </div>
15   - </div>
16   - <div class="WidgetSimple">
17   - <div class="Header">
18   - <h2>
19   - <label for="Filter">$Text{"Filter"}</label>
20   - </h2>
21   - </div>
22   - <div class="Content">
23   - <input type="text" id="Filter" class="W50pc" name="Filter" value="" title="$Text{"Filter"}" />
24   - </div>
25   - </div>
26   - </div>
27   -
28   - <div class="ContentColumn">
29   - <div class="WidgetSimple">
30   - <div class="Header">
31   - <h2>
32   -<!-- dtl:block:ChangeHeaderService -->
33   - $Text{"Select queues for the service"}
34   -<!-- dtl:block:ChangeHeaderService -->
35   -<!-- dtl:block:ChangeHeaderQueue -->
36   - $Text{"Select services for the queue"}
37   -<!-- dtl:block:ChangeHeaderQueue -->
38   - $QData{"Name"}
39   - </h2>
40   - </div>
41   - <div class="Content ">
42   - <form action="$Env{"CGIHandle"}" method="post" name="matrix">
43   - <input type="hidden" name="Action" value="$Env{"Action"}"/>
44   - <input type="hidden" name="Subaction" value="Change$QData{"VisibleNeType"}"/>
45   - <input type="hidden" name="ID" value="$QData{"ID"}"/>
46   - <table class="DataTable VariableWidth" id="ServicesQueues">
47   - <thead>
48   - <tr>
49   - <th>$Text{"$Data{"VisibleNeType"}"}</th>
50   -<!-- dtl:block:ChangeHeader -->
51   - <th class="Center $QData{"Mark"}">
52   - <input type="checkbox" name="$QData{"Type"}" id="SelectAll$QData{"Type"}" title="$Text{"Toggle active state for all"}" value="" />
53   - $Text{"Active"}
54   - </th>
55   -<!-- dtl:js_on_document_complete -->
56   -<script type="text/javascript">//<![CDATA[
57   - Core.Form.InitSelectAllCheckboxes($('table td input:checkbox[name=$QData{"Type"}]'), $('#SelectAll$QData{"Type"}'));
58   - $('input:checkbox[name=$QData{"Type"}]').bind('click', function () {
59   - Core.Form.SelectAllCheckboxes($(this), $('#SelectAll$QData{"Type"}'));
60   - });
61   -//]]></script>
62   -<!-- dtl:js_on_document_complete -->
63   -<!-- dtl:block:ChangeHeader -->
64   - </tr>
65   - </thead>
66   - <tbody>
67   -<!-- dtl:block:ChangeRow -->
68   - <tr>
69   - <td>$QData{"Name"}</td>
70   - <td class="$QData{"Mark"}">
71   - <input type="checkbox" name="$QData{"Type"}" title="$Text{"Toggle active state for %s", "$QData{"Name"}"}" value="$QData{"ID"}" $Data{"Selected"}/>
72   - </td>
73   - </tr>
74   -<!-- dtl:block:ChangeRow -->
75   - </tbody>
76   - </table>
77   - <div class="Field SpacingTop">
78   - <button class="Primary" type="submit" value="$Text{"Submit"}">$Text{"Submit"}</button>
79   - $Text{"or"}
80   - <a href="$Env{"Baselink"}Action=$Env{"Action"}">$Text{"Cancel"}</a>
81   - </div>
82   - <div class="Clear"></div>
83   - </form>
84   - </div>
85   - </div>
86   - </div>
87   - <div class="Clear"></div>
88   -</div>
89   -
90   -<!-- dtl:js_on_document_complete -->
91   -<script type="text/javascript">//<![CDATA[
92   - Core.UI.Table.InitTableFilter($('#Filter'), $('#ServicesQueues'));
93   - Core.Form.HideSelectAllCheckboxes($('#ServicesQueues'), '#SelectAll$QData{"Type"}');
94   -//]]></script>
95   -<!-- dtl:js_on_document_complete -->
Kernel/Output/HTML/Standard/QueueServiceChange.tt 0 → 100644
... ... @@ -0,0 +1,103 @@
  1 +# --
  2 +# Kernel/Output/HTML/Standard/QueueServiceChange.tt - edit
  3 +# Copyright (C) (2014) SeTIC - UFSC - http://setic.ufsc.br/
  4 +# Version 06/01/2015 - Adjusts for OTRS 4
  5 +#
  6 +# This software comes with ABSOLUTELY NO WARRANTY. For details, see
  7 +# the enclosed file COPYING for license information (AGPL). If you
  8 +# did not receive this file, see http://www.gnu.org/licenses/agpl.txt.
  9 +# --
  10 +<div class="MainBox ARIARoleMain LayoutFixedSidebar SidebarFirst">
  11 + <h1>[% Translate("Services and queues") | html %]</h1>
  12 + <div class="SidebarColumn">
  13 + <div class="WidgetSimple">
  14 + <div class="Header">
  15 + <h2>[% Translate("Actions") | html %]</h2>
  16 + </div>
  17 + <div class="Content">
  18 + <ul class="ActionList">
  19 + <li>
  20 + <a href="[% Env("Baselink") %]Action=[% Env("Action") %]" class="CallForAction"><span>[% Translate("Go to overview") | html %]</span></a>
  21 + </li>
  22 + </ul>
  23 + </div>
  24 + </div>
  25 + <div class="WidgetSimple">
  26 + <div class="Header">
  27 + <h2>
  28 + <label for="Filter">[% Translate("Filter") | html %]</label>
  29 + </h2>
  30 + </div>
  31 + <div class="Content">
  32 + <input type="text" id="Filter" class="W50pc" name="Filter" value="" title="[% Translate("Filter") | html %]" />
  33 + </div>
  34 + </div>
  35 + </div>
  36 +
  37 + <div class="ContentColumn">
  38 + <div class="WidgetSimple">
  39 + <div class="Header">
  40 + <h2>
  41 +[% RenderBlockStart("ChangeHeaderService") %]
  42 + [% Translate("Select queues for the service") | html %]
  43 +[% RenderBlockEnd("ChangeHeaderService") %]
  44 +[% RenderBlockStart("ChangeHeaderQueue") %]
  45 + [% Translate("Select services for the queue") | html %]
  46 +[% RenderBlockEnd("ChangeHeaderQueue") %]
  47 + [% Data.Name | html %]
  48 + </h2>
  49 + </div>
  50 + <div class="Content ">
  51 + <form action="[% Env("CGIHandle") %]" method="post" name="matrix">
  52 + <input type="hidden" name="Action" value="[% Env("Action") %]"/>
  53 + <input type="hidden" name="Subaction" value="Change[% Data.VisibleNeType | html %]"/>
  54 + <input type="hidden" name="ID" value="[% Data.ID | html %]"/>
  55 + <table class="DataTable VariableWidth" id="ServicesQueues">
  56 + <thead>
  57 + <tr>
  58 + <th>[% Translate(Data.VisibleNeType) | html %]</th>
  59 +[% RenderBlockStart("ChangeHeader") %]
  60 + <th class="Center [% Data.Mark | html %]">
  61 + <input type="checkbox" name="[% Data.Type | html %]" id="SelectAll[% Data.Type | html %]" title="[% Translate("Toggle active state for all") | html %]" value="" />
  62 + [% Translate("Active") | html %]
  63 + </th>
  64 +[% WRAPPER JSOnDocumentComplete %]
  65 +<script type="text/javascript">//<![CDATA[
  66 + Core.Form.InitSelectAllCheckboxes($('table td input:checkbox[name=[% Data.Type | html %]]'), $('#SelectAll[% Data.Type | html %]'));
  67 + $('input:checkbox[name=[% Data.Type | html %]]').bind('click', function () {
  68 + Core.Form.SelectAllCheckboxes($(this), $('#SelectAll[% Data.Type | html %]'));
  69 + });
  70 +//]]></script>
  71 +[% END %]
  72 +[% RenderBlockEnd("ChangeHeader") %]
  73 + </tr>
  74 + </thead>
  75 + <tbody>
  76 +[% RenderBlockStart("ChangeRow") %]
  77 + <tr>
  78 + <td>[% Data.Name | html %]</td>
  79 + <td class="[% Data.Mark | html %]">
  80 + <input type="checkbox" name="[% Data.Type | html %]" title="[% Translate("Toggle active state for %s", Data.Name) | html %]" value="[% Data.ID | html %]" [% Data.Selected %]/>
  81 + </td>
  82 + </tr>
  83 +[% RenderBlockEnd("ChangeRow") %]
  84 + </tbody>
  85 + </table>
  86 + <div class="Field SpacingTop">
  87 + <button class="Primary" type="submit" value="[% Translate("Submit") | html %]">[% Translate("Submit") | html %]</button>
  88 + [% Translate("or") | html %]
  89 + <a href="[% Env("Baselink") %]Action=[% Env("Action") %]">[% Translate("Cancel") | html %]</a>
  90 + </div>
  91 + <div class="Clear"></div>
  92 + </form>
  93 + </div>
  94 + </div>
  95 + </div>
  96 + <div class="Clear"></div>
  97 +</div>
  98 +
  99 +[% WRAPPER JSOnDocumentComplete %]
  100 +<script type="text/javascript">//<![CDATA[
  101 + Core.UI.Table.InitTableFilter($('#Filter'), $('#ServicesQueues'));
  102 +//]]></script>
  103 +[% END %]
... ...
Kernel/System/QueueService.pm
1 1 # --
2 2 # Kernel/System/QueueService.pm - core module
3   -# Managers Queue Services
  3 +# Manages Queue Services
  4 +#
  5 +# Copyright (C) (2014) - SeTIC - UFSC - http://setic.ufsc.br/
  6 +# Version 06/01/2015 - Adjusts for OTRS 4
4 7 #
5   -# Copyright (C) (2014) (Carlos Rebelato, Rodrigo Gonçalves) (rodrigo.g@ufsc.br)
6   -# --
7   -# $Id: writing-otrs-application.xml,v 1.1 2010/08/13 08:59:28 mg Exp $
8   -# --
9 8 # This software comes with ABSOLUTELY NO WARRANTY. For details, see
10 9 # the enclosed file COPYING for license information (AGPL). If you
11 10 # did not receive this file, see http://www.gnu.org/licenses/agpl.txt.
12 11 # --
13   -# Author: Carlos Rebelato
14   -# Date..: 19/02/2014 - Versão inicial
15   -# Revision: 27/02/2014 - Module creation
16 12 #
17 13 package Kernel::System::QueueService;
18 14  
... ... @@ -20,6 +16,11 @@ use strict;
20 16 use warnings;
21 17 use Data::Dumper;
22 18  
  19 +our @ObjectDependencies = (
  20 + "Kernel::Output::HTML::Layout", # Old LayoutObject
  21 + "Kernel::System::DB"
  22 +);
  23 +
23 24 sub new {
24 25 my ( $Type, %Param ) = @_;
25 26  
... ... @@ -45,11 +46,11 @@ sub GetServiceList {
45 46  
46 47 for (qw(QueueID)) {
47 48 if ( !$Param{$_} ) {
48   - $Self->{LayoutObject}->FatalError( Message => Dumper( \%Param ) . "got no $_!" );
  49 + $Kernel::OM->Get("Kernel::Output::HTML::Layout")->FatalError( Message => Dumper( \%Param ) . "got no $_!" );
49 50 }
50 51 }
51 52  
52   - $Self->{DBObject}->Prepare(
  53 + $Kernel::OM->Get("Kernel::System::DB")->Prepare(
53 54 SQL => "
54 55 select
55 56 a.service_id id,
... ... @@ -62,7 +63,7 @@ sub GetServiceList {
62 63 Bind => [ \$Param{QueueID} ]
63 64 );
64 65  
65   - while ( my @row = $Self->{DBObject}->FetchrowArray() ) {
  66 + while ( my @row = $Kernel::OM->Get("Kernel::System::DB")->FetchrowArray() ) {
66 67 $result{ $row[0] } = $row[1];
67 68 }
68 69  
... ... @@ -84,11 +85,11 @@ sub GetQueueList {
84 85  
85 86 for (qw(ServiceID)) {
86 87 if ( !$Param{$_} ) {
87   - $Self->{LayoutObject}->FatalError( Message => Dumper( \%Param ) . "got no $_!" );
  88 + $Kernel::OM->Get("Kernel::Output::HTML::Layout")->FatalError( Message => Dumper( \%Param ) . "got no $_!" );
88 89 }
89 90 }
90 91  
91   - $Self->{DBObject}->Prepare(
  92 + $Kernel::OM->Get("Kernel::System::DB")->Prepare(
92 93 SQL => "
93 94 select
94 95 a.queue_id id,
... ... @@ -101,7 +102,7 @@ sub GetQueueList {
101 102 Bind => [ \$Param{ServiceID} ]
102 103 );
103 104  
104   - while ( my @row = $Self->{DBObject}->FetchrowArray() ) {
  105 + while ( my @row = $Kernel::OM->Get("Kernel::System::DB")->FetchrowArray() ) {
105 106 $result{ $row[0] } = $row[1];
106 107 }
107 108  
... ... @@ -125,20 +126,20 @@ sub SetQueueServices {
125 126  
126 127 for (qw(QueueID Services)) {
127 128 if ( !$Param{$_} ) {
128   - $Self->{LayoutObject}->FatalError( Message => Dumper( \%Param ) . "got no $_!" );
  129 + $Kernel::OM->Get("Kernel::Output::HTML::Layout")->FatalError( Message => Dumper( \%Param ) . "got no $_!" );
129 130 }
130 131 }
131 132  
132 133 my $QueueID = $Param{"QueueID"};
133 134 my @Services = @{$Param{"Services"}};
134 135  
135   - $Self->{DBObject}->Do(
  136 + $Kernel::OM->Get("Kernel::System::DB")->Do(
136 137 SQL => "delete from queue_service where queue_id = ?",
137 138 Bind => [ \$Param{QueueID} ]
138 139 );
139 140  
140 141 for my $service (@Services) {
141   - $Self->{DBObject}->Do(
  142 + $Kernel::OM->Get("Kernel::System::DB")->Do(
142 143 SQL => "insert into queue_service(queue_id,service_id) values (?,?)",
143 144 Bind => [\$Param{QueueID}, \$service]
144 145 );
... ... @@ -162,20 +163,20 @@ sub SetServiceQueues {
162 163  
163 164 for (qw(ServiceID Queues)) {
164 165 if ( !$Param{$_} ) {
165   - $Self->{LayoutObject}->FatalError( Message => Dumper( \%Param ) . "got no $_!" );
  166 + $Kernel::OM->Get("Kernel::Output::HTML::Layout")->FatalError( Message => Dumper( \%Param ) . "got no $_!" );
166 167 }
167 168 }
168 169  
169 170 my $ServiceID = $Param{"ServiceID"};
170 171 my @Queues = @{$Param{"Queues"}};
171 172  
172   - $Self->{DBObject}->Do(
  173 + $Kernel::OM->Get("Kernel::System::DB")->Do(
173 174 SQL => "delete from queue_service where service_id = ?",
174 175 Bind => [ \$Param{ServiceID} ]
175 176 );
176 177  
177 178 for my $queue (@Queues) {
178   - $Self->{DBObject}->Do(
  179 + $Kernel::OM->Get("Kernel::System::DB")->Do(
179 180 SQL => "insert into queue_service(queue_id,service_id) values (?,?)",
180 181 Bind => [\$queue, \$Param{ServiceID}]
181 182 );
... ...
QueueService.sopm
1 1 <?xml version="1.0" encoding="utf-8" ?>
2 2 <otrs_package version="1.0">
3 3 <Name>QueueService</Name>
4   - <Version>1.0.0</Version>
5   - <Framework>3.x.x</Framework>
  4 + <Version>1.1.0</Version>
  5 + <Framework>4.0.3</Framework>
6 6 <Vendor>SeTIC</Vendor>
7   - <URL>http://www.setic.ufsc.br</URL>
8   - <License>Free</License>
9   - <Description Lang="pt-br">Associação de serviços a filas
10   -
11   - Versão 1.0.0 - Inicial
12   -
13   - </Description>
14   - <IntroInstall Type="post" Lang="pt-br" Title="Obrigado">Módulo instalado com sucesso!</IntroInstall>
15   - <Description Lang="en">New Ticket Wizard</Description>
16   - <IntroInstall Type="post" Lang="en" Title="Thank you">Queue services module installed successfully!</IntroInstall>
  7 + <URL>http://setic.ufsc.br</URL>
  8 + <License>GPLv2</License>
  9 +
  10 + <ChangeLog Version="1.0.0" Date="2014-06-01">First Version</ChangeLog>
  11 + <ChangeLog Version="1.1.0" Date="2014-01-06">Support for OTRS 4</ChangeLog>
  12 +
  13 + <Description>Services per queue association</Description>
  14 +
17 15 <BuildDate>?</BuildDate>
18 16 <BuildHost>?</BuildHost>
  17 +
  18 + <IntroInstall Type="post" Title="Thank you"><![CDATA[
  19 + Module installed successfully!<BR/><BR/>
  20 + ]]></IntroInstall>
  21 +
19 22 <Filelist>
20 23 <File Permission="644" Location="Kernel/Config/Files/QueueService.xml"></File>
21 24 <File Permission="644" Location="Kernel/Language/pt_BR_QueueService.pm"></File>
22 25 <File Permission="644" Location="Kernel/Modules/QueueService.pm"></File>
23   - <File Permission="644" Location="Kernel/Output/HTML/Standard/QueueService.dtl"></File>
24   - <File Permission="644" Location="Kernel/Output/HTML/Standard/QueueServiceChange.dtl"></File>
  26 + <File Permission="644" Location="Kernel/Output/HTML/Standard/QueueService.tt"></File>
  27 + <File Permission="644" Location="Kernel/Output/HTML/Standard/QueueServiceChange.tt"></File>
25 28 <File Permission="644" Location="Kernel/System/QueueService.pm"></File>
26 29 </Filelist>
27 30 <DatabaseInstall>
... ...