Commit c9561facc1919805f8584cf00e83bbe2501bef5e

Authored by
1 parent ca5a7fa3
Exists in master

Correcao de bug quando fixava o campo description

Showing 43 changed files with 1347 additions and 2381 deletions   Show diff stats
Kernel/Config/Files/NewTicketWizard.xml 100644 → 100755
1 1 <?xml version="1.0" encoding="UTF-8" ?>
2 2 <otrs_config init="Application" version="1.0">
  3 +
  4 +
3 5 <ConfigItem Name="CustomerFrontend::Module###NewTicketWizard" Required="0" Valid="1">
4 6 <Description>Frontend module registration for the customer interface.</Description>
5 7 <Group>Ticket</Group>
... ... @@ -16,19 +18,29 @@
16 18 <Type>Menu</Type>
17 19 <Prio>8400</Prio>
18 20 </NavBar>
19   - <!-- AlpacaJS -->
20   - <Loader>
  21 + <Loader>
  22 + <JavaScript>thirdparty/jqueryfileupload/jquery.fileupload.js</JavaScript>
  23 + <JavaScript>thirdparty/jqueryfileupload/jquery.fileupload-process.js</JavaScript>
  24 + <JavaScript>thirdparty/jqueryfileupload/jquery.fileupload-ui.js</JavaScript>
  25 + <JavaScript>thirdparty/jqueryfileupload/jquery.iframe-transport.js</JavaScript>
  26 + <JavaScript>thirdparty/jqueryfileupload/jquery.ui.widget.js</JavaScript>
  27 + <JavaScript>thirdparty/bootstrap/bootstrap.min.js</JavaScript>
  28 + <JavaScript>thirdparty/bootstrap/bootstrap-select.min.js</JavaScript>
  29 + <JavaScript>thirdparty/alpaca/handlebars.js</JavaScript>
  30 + <JavaScript>thirdparty/alpaca/alpaca.min.js</JavaScript>
  31 +
  32 +
21 33 <JavaScript>NewTicketWizard.js</JavaScript>
22   - <JavaScript>thirdparty/handlebars/handlebars.js</JavaScript>
23   - <JavaScript>thirdparty/alpaca/alpaca-full.min.js</JavaScript>
24   - <JavaScript>thirdparty/alpaca/jquery.sumoselect.js</JavaScript>
25   - <JavaScript>thirdparty/alpaca/datatables.js</JavaScript>
26   - <JavaScript>thirdparty/maskedinput/jquery.maskedinput.min.js</JavaScript>
27   - <JavaScript>thirdparty/jquery-validate-1.13.0/jquery.validate.js</JavaScript>
28   - <CSS>alpaca/alpaca-newticketwizard.css</CSS>
29   - <CSS>alpaca/sumoselect.css</CSS>
30   - <CSS>alpaca/alpaca-jqueryui-newticketwizard.css</CSS>
31   - <CSS>alpaca/datatables.css</CSS>
  34 +
  35 + <CSS>alpaca/alpaca.min.css</CSS>
  36 +
  37 + <CSS>jqueryfileupload/jquery.fileupload.css</CSS>
  38 + <CSS>jqueryfileupload/jquery.fileupload-ui.css</CSS>
  39 +
  40 + <CSS>bootstrap/bootstrap-theme.min.css</CSS>
  41 + <CSS>bootstrap/bootstrap.min.css</CSS>
  42 + <CSS>bootstrap/bootstrap-select.min.css</CSS>
  43 +
32 44 </Loader>
33 45 </FrontendModuleReg>
34 46 </Setting>
... ... @@ -46,10 +58,10 @@
46 58 <NavBarName>Admin</NavBarName>
47 59 <Loader>
48 60 <CSS>jquery.jsonview.css</CSS>
49   - <JavaScript>jquery.jsonview.js</JavaScript>
50   - <JavaScript>jquery.chili.js</JavaScript>
51   - <JavaScript>jquery.chili.recipes.javascript.js</JavaScript>
52   - <JavaScript>jquery.chili.recipes.js</JavaScript>
  61 + <JavaScript>thirdparty/jqueryjsonview/jquery.jsonview.js</JavaScript>
  62 + <JavaScript>thirdparty/jquerychili/jquery.chili.js</JavaScript>
  63 + <JavaScript>thirdparty/jquerychili/jquery.chili.recipes.javascript.js</JavaScript>
  64 + <JavaScript>thirdparty/jquerychili/jquery.chili.recipes.js</JavaScript>
53 65 </Loader>
54 66 <NavBarModule>
55 67 <Module>Kernel::Output::HTML::NavBar::ModuleAdmin</Module>
... ... @@ -71,39 +83,39 @@
71 83 <TextArea Regex="">
72 84 "service": {
73 85 "type": "string",
74   - "required": "true"
  86 + "required": true
75 87 },
76 88 "DF_unidade": {
77 89 "type": "string",
78 90 "enum": [
79 91 DF_unidade_values
80 92 ],
81   - "required": "true"
  93 + "required": true
82 94 },
83 95 "DF_local": {
84 96 "type": "string",
85   - "required": "true"
  97 + "required": true
86 98 },
87 99 "DF_telefone": {
88 100 "type": "string",
89   - "required": "true"
  101 + "required": true
90 102 },
91 103 "type": {
92   - "type": "string",
  104 + "type": "number",
93 105 "enum": [
94 106 OTRS_type_values
95 107 ],
96   - "required": "true"
  108 + "required": true
97 109 }
98 110 CF_SCHEMA
99 111 ,
100 112 "subject": {
101 113 "type": "string",
102   - "required": "true"
  114 + "required": true
103 115 },
104 116 "description": {
105 117 "type": "string",
106   - "required": "true"
  118 + "required": true
107 119 },
108 120 "attachment": {
109 121 "type": "string",
... ... @@ -113,6 +125,9 @@
113 125 "type": "string",
114 126 "default": "NewTicketWizard"
115 127 },
  128 + "FormID": {
  129 + "type": "string"
  130 + },
116 131 "Subaction": {
117 132 "type": "string",
118 133 "default": "CreateTicket"
... ... @@ -128,17 +143,19 @@
128 143 <SubGroup>Frontend::Customer::NewTicketWizard</SubGroup>
129 144 <Setting>
130 145 <TextArea Regex="">
131   - "DF_unidade": {
  146 + "DF_unidade": {
132 147 "type": "select",
133 148 "label": "Unidade:",
  149 + "removeDefaultNone": false,
134 150 "optionLabels": [
135 151 DF_unidade_labels
136   - ]
  152 + ],
  153 + "helper": "Basta digitar a sigla da unidade que o sistema irá localizar"
137 154 },
138 155 "DF_local": {
139 156 "type": "text",
140 157 "label": "Local:"
141   - },
  158 + },
142 159 "DF_telefone": {
143 160 "type": "text",
144 161 "label": "Telefone:",
... ... @@ -146,6 +163,7 @@
146 163 },
147 164 "type": {
148 165 "type": "select",
  166 + "removeDefaultNone": false,
149 167 "label": "Motivo:",
150 168 "optionLabels": [
151 169 OTRS_type_labels
... ... @@ -161,22 +179,42 @@
161 179 "size": 80
162 180 },
163 181 "description": {
164   - "type": "textarea",
  182 + "type": "ckeditor",
165 183 "label": "Descrição:",
166   - "cols": 80
167   - },
168   - "attachment": {
169   - "type": "file",
170   - "label": "Anexo:",
171   - "helper": "Anexe um arquivo se necessário."
172   - },
  184 + "cols": 80,
  185 + "ckeditor": {
  186 + "toolbar": [
  187 + ["Font", "FontSize", "-", "Bold", "Italic", "Underline", "-", "NumberedList", "BulletedList", "-", "Paste"],
  188 + ["Image", "Table", "-", "Link"]
  189 + ],
  190 + "language": "pt-br"
  191 + },
  192 + "helper": "Para inserir imagens, basta arrastar a imagem do seu computador ou usar o botão de inserir imagem."
  193 + },
  194 + "attachment": {
  195 + "type": "upload",
  196 + "maxNumberOfFiles": 100,
  197 + "maxFileSize": 24000000,
  198 + "multiple": true,
  199 + "showUploadPreview": false,
  200 + "upload": {
  201 + "url": "/otrs/customer.pl?Action=NewTicketWizard;UploadFileCmd=UploadFile",
  202 + "autoUpload" : true,
  203 + "method": "post"
  204 + },
  205 + "label": "Anexo:",
  206 + "helper": "Anexe um arquivo se necessário."
  207 + },
173 208 "Action": {
174 209 "type": "hidden"
  210 + },
  211 + "FormID": {
  212 + "type": "hidden"
175 213 },
176 214 "Subaction": {
177 215 "type": "hidden"
178 216 }
179   - </TextArea>
  217 + </TextArea>
180 218 </Setting>
181 219 </ConfigItem>
182 220  
... ... @@ -219,8 +257,7 @@
219 257 <String Regex="">Escolha o serviço para o qual deseja suporte</String>
220 258 </Setting>
221 259 </ConfigItem>
222   -
223   -
  260 +
224 261 <ConfigItem Name="Ticket::Frontend::Customer::NewTicketWizard###DefaultCustomerID"
225 262 Required="1" Valid="1">
226 263 <Description>Customer ID to use when public ticket is created.</Description>
... ... @@ -267,19 +304,27 @@
267 304 <Type>Menu</Type>
268 305 <Prio>8400</Prio>
269 306 </NavBar>
270   - <!-- AlpacaJS -->
271 307 <Loader>
  308 + <JavaScript>thirdparty/jqueryfileupload/jquery.fileupload.js</JavaScript>
  309 + <JavaScript>thirdparty/jqueryfileupload/jquery.fileupload-process.js</JavaScript>
  310 + <JavaScript>thirdparty/jqueryfileupload/jquery.fileupload-ui.js</JavaScript>
  311 + <JavaScript>thirdparty/jqueryfileupload/jquery.iframe-transport.js</JavaScript>
  312 + <JavaScript>thirdparty/jqueryfileupload/jquery.ui.widget.js</JavaScript>
  313 + <JavaScript>thirdparty/bootstrap/bootstrap.min.js</JavaScript>
  314 + <JavaScript>thirdparty/bootstrap/bootstrap-select.min.js</JavaScript>
  315 + <JavaScript>thirdparty/alpaca/handlebars.js</JavaScript>
  316 + <JavaScript>thirdparty/alpaca/alpaca.min.js</JavaScript>
  317 +
272 318 <JavaScript>NewTicketWizard.js</JavaScript>
273   - <JavaScript>thirdparty/handlebars/handlebars.js</JavaScript>
274   - <JavaScript>thirdparty/alpaca/alpaca-full.min.js</JavaScript>
275   - <JavaScript>thirdparty/alpaca/jquery.sumoselect.js</JavaScript>
276   - <JavaScript>thirdparty/alpaca/datatables.js</JavaScript>
277   - <JavaScript>thirdparty/jquery-validate-1.13.0/jquery.validate.js</JavaScript>
278   - <JavaScript>thirdparty/maskedinput/jquery.maskedinput.min.js</JavaScript>
279   - <CSS>alpaca/alpaca-newticketwizard.css</CSS>
280   - <CSS>alpaca/sumoselect.css</CSS>
281   - <CSS>alpaca/alpaca-jqueryui-newticketwizard.css</CSS>
282   - <CSS>alpaca/datatables.css</CSS>
  319 +
  320 + <CSS>alpaca/alpaca.min.css</CSS>
  321 +
  322 + <CSS>jqueryfileupload/jquery.fileupload.css</CSS>
  323 + <CSS>jqueryfileupload/jquery.fileupload-ui.css</CSS>
  324 +
  325 + <CSS>bootstrap/bootstrap-theme.min.css</CSS>
  326 + <CSS>bootstrap/bootstrap.min.css</CSS>
  327 + <CSS>bootstrap/bootstrap-select.min.css</CSS>
283 328 </Loader>
284 329 </FrontendModuleReg>
285 330 </Setting>
... ... @@ -294,56 +339,58 @@
294 339 <TextArea Regex="">
295 340 "service": {
296 341 "type": "string",
297   - "required": "true"
  342 + "required": true
298 343 },
299 344 "DF_unidade": {
300 345 "type": "string",
301 346 "enum": [
302 347 DF_unidade_values
303 348 ],
304   - "required": "true"
  349 + "required": true
305 350 },
306 351 "name": {
307 352 "type": "string",
308   - "required": "true"
  353 + "required": true
309 354 },
310 355 "email": {
311 356 "type": "string",
312   - "required": "true"
  357 + "required": true
313 358 },
314 359 "DF_local": {
315 360 "type": "string",
316   - "required": "true"
  361 + "required": true
317 362 },
318 363 "DF_telefone": {
319 364 "type": "string",
320   - "required": "true"
  365 + "required": true
321 366 },
322 367 "type": {
323   - "type": "string",
  368 + "type": "number",
324 369 "enum": [
325 370 OTRS_type_values
326 371 ],
327   - "required": "true"
  372 + "required": true
328 373 }
329 374 CF_SCHEMA
330 375 ,
331 376 "subject": {
332 377 "type": "string",
333   - "required": "true"
  378 + "required": true
334 379 },
335 380 "description": {
336 381 "type": "string",
337   - "required": "true"
  382 + "required": true
338 383 },
339 384 "attachment": {
340   - "type": "string",
341   - "format": "uri"
  385 + "type": "array"
342 386 },
343 387 "Action": {
344 388 "type": "string",
345 389 "default": "NewTicketWizardPublic"
346 390 },
  391 + "FormID": {
  392 + "type": "string"
  393 + },
347 394 "Subaction": {
348 395 "type": "string",
349 396 "default": "CreateTicket"
... ... @@ -359,16 +406,18 @@
359 406 <SubGroup>Frontend::Customer::NewTicketWizard</SubGroup>
360 407 <Setting>
361 408 <TextArea Regex="">
362   - "DF_unidade": {
  409 + "DF_unidade": {
363 410 "type": "select",
364 411 "label": "Unidade:",
  412 + "removeDefaultNone": false,
365 413 "optionLabels": [
366 414 DF_unidade_labels
367   - ]
  415 + ],
  416 + "helper": "Basta digitar a sigla da unidade que o sistema irá localizar"
368 417 },
369 418 "DF_local": {
370 419 "type": "text",
371   - "label": "Local:"
  420 + "label": "Local:"
372 421 },
373 422 "name": {
374 423 "type": "text",
... ... @@ -376,7 +425,7 @@
376 425  
377 426 },
378 427 "email": {
379   - "type": "text",
  428 + "type": "email",
380 429 "label": "E-mail:",
381 430 "helper": "Abrindo com seu e-mail institucional, seu atendimento será mais rápido"
382 431  
... ... @@ -388,6 +437,7 @@
388 437 },
389 438 "type": {
390 439 "type": "select",
  440 + "removeDefaultNone": false,
391 441 "label": "Motivo:",
392 442 "optionLabels": [
393 443 OTRS_type_labels
... ... @@ -403,17 +453,37 @@
403 453 "size": 80
404 454 },
405 455 "description": {
406   - "type": "textarea",
  456 + "type": "ckeditor",
407 457 "label": "Descrição:",
408   - "cols": 80
409   - },
410   - "attachment": {
411   - "type": "file",
412   - "label": "Anexo:",
413   - "helper": "Anexe um arquivo se necessário."
414   - },
  458 + "cols": 80,
  459 + "ckeditor": {
  460 + "toolbar": [
  461 + ["Font", "FontSize", "-", "Bold", "Italic", "Underline", "-", "NumberedList", "BulletedList", "-", "Paste"],
  462 + ["Image", "Table", "-", "Link"]
  463 + ],
  464 + "language": "pt-br"
  465 + },
  466 + "helper": "Para inserir imagens, basta arrastar a imagem do seu computador ou usar o botão de inserir imagem."
  467 + },
  468 + "attachment": {
  469 + "type": "upload",
  470 + "maxNumberOfFiles": 100,
  471 + "maxFileSize": 24000000,
  472 + "multiple": true,
  473 + "showUploadPreview": false,
  474 + "upload": {
  475 + "url": "/otrs/public.pl?Action=NewTicketWizardPublic;UploadFileCmd=UploadFile",
  476 + "autoUpload" : true,
  477 + "method": "post"
  478 + },
  479 + "label": "Anexo:",
  480 + "helper": "Anexe um arquivo se necessário."
  481 + },
415 482 "Action": {
416 483 "type": "hidden"
  484 + },
  485 + "FormID": {
  486 + "type": "hidden"
417 487 },
418 488 "Subaction": {
419 489 "type": "hidden"
... ...
Kernel/Language/pt_BR_NewTicketWizard.pm 100644 → 100755
1 1 # --
2 2 # Kernel/Modules/pt_BR_NewTicketWizard.pm - translations for NewTicketWizardModule
3 3 #
4   -# Copyright (C) 2014 SeTIC - UFSC - http://setic.ufsc.br/
5   -# Version 01/08/2015 - Adjustments for OTRS 4
  4 +# Copyright (C) 2014-2017 SeTIC - UFSC - http://setic.ufsc.br/
  5 +# Version 2015-08-01 - Adjustments for OTRS 4
  6 +# Version 2017-06-16 - Support for bootstrap version
6 7 #
7 8 # --
8 9 # This software comes with ABSOLUTELY NO WARRANTY. For details, see
... ... @@ -18,25 +19,6 @@ use utf8;
18 19 sub Data {
19 20 my $Self = shift;
20 21  
21   - $Self->{Translation}->{'Frontend module registration for the customer interface.'} = 'Registro do módulo de abertura de chamados para usuários logados.';
22   - $Self->{Translation}->{'Frontend module registration for the agent interface.'} = 'Registro do módulo de gestão dos formulários de abertura de chamados.';
23   - $Self->{Translation}->{'Describe the form basic schema. See documentation for examples.'} = 'Descreve o esquema básico do formulário. Veja a documentação para exemplos.';
24   - $Self->{Translation}->{'Describe the form basic fields. See documentation for examples.'} = 'Descreve os campos básicos do formulário. Veja a documentação para exemplos.';
25   - $Self->{Translation}->{'When the queue comes from a field in the form, a prefix can be attached to the value while searching for the queue. A space is added between this and the queue name.'} =
26   - 'Quando a fila vem de um campo do formulário, um prefixo pode ser anexado ao valor do campo ao procurar pela fila. Um espaço é adiciona entre o prefixo e o nome da fila.';
27   - $Self->{Translation}->{'Name of the field in the form which indicates the queue to send the ticket.'} =
28   - 'Nome do campo no formulário que indica a fila para qual enviar o chamado';
29   - $Self->{Translation}->{'Message to let the user choose a service.'} = 'Mensagem para deixar o usuário escolher um serviço.';
30   - $Self->{Translation}->{'Customer ID to use when public ticket is created.'} = 'Customer ID para usar ao criar um chamado público (não autenticado)';
31   - $Self->{Translation}->{'Default agent for tickets.'} = 'Agente padrão para os tickets.';
32   - $Self->{Translation}->{'Default domain for user e-mails.'} = 'Domínio padrão para os e-mails dos usuários';
33   - $Self->{Translation}->{'FrontendModuleRegistration for NewTicketWizardPublic module.'} = 'FrontendModuleRegistration para o módulo NewTicketWizardPublic.';
34   - $Self->{Translation}->{'Module for creating custom new ticket interfaces without logging in'} = 'Módulo para criar novos tickets sem precisar estar logado no OTRS';
35   - $Self->{Translation}->{'New ticket wizard public'} = 'Assistente de novo chamado público';
36   - $Self->{Translation}->{'New ticket public'} = 'Novo chamado público';
37   - $Self->{Translation}->{'When false, forces the queue to be pre-selected.'} = 'Quando falso, força a fila a ser pré-selecionada.';
38   - $Self->{Translation}->{'FrontendModuleRegistration for QueuesPanel module.'} = 'FrontendModuleRegistration para o módulo QueuesPanel';
39   - $Self->{Translation}->{'Module for choosing main queues to open tickets'} = 'Módulo para escolher as principais filas para abrir chamados';
40 22 $Self->{Translation}->{'The following maintenances are in progress'} = 'As seguintes manutenções estão ocorrendo';
41 23 $Self->{Translation}->{'Started at: '} = 'Iniciada em:';
42 24 $Self->{Translation}->{'Queues panel'} = 'Novo chamado';
... ... @@ -51,6 +33,7 @@ sub Data {
51 33 $Self->{Translation}->{'Form'} = 'Formulário';
52 34 $Self->{Translation}->{'Choose the service to ask for support'} = 'Escolha o servi&ccedil;o para o qual deseja suporte';
53 35 $Self->{Translation}->{'Ticket created'} = 'Chamado criado com sucesso';
  36 + $Self->{Translation}->{'Please fill the following form to open your ticket'} = 'Por favor preencha o formulário para abrir seu chamado';
54 37 $Self->{Translation}->{'Click here to open another ticket'} = 'Clique aqui para abrir um outro chamado se desejar';
55 38 return 1;
56 39 }
... ...
Kernel/Language/pt_BR_NewTicketWizardPublic.pm 100644 → 100755
1 1 # --
2 2 # Kernel/Modules/pt_BR_NewTicketWizardPublic.pm - translations for NewTicketWizardModulePublic
3 3 #
4   -# Copyright (C) 2014 SeTIC - UFSC - http://setic.ufsc.br/
5   -# Version 01/08/2015 - Adjustments for OTRS 4
  4 +# Copyright (C) 2014-2017 SeTIC - UFSC - http://setic.ufsc.br/
  5 +# Version 2015-08-01 - Adjustments for OTRS 4
  6 +# Version 2017-06-16 - Support for bootstrap version
6 7 #
7 8 # --
8 9 # This software comes with ABSOLUTELY NO WARRANTY. For details, see
... ... @@ -32,7 +33,12 @@ sub Data {
32 33 $Self->{Translation}->{'Form'} = 'Formulário';
33 34 $Self->{Translation}->{'Choose the service to ask for support'} = 'Escolha o servi&ccedil;o para o qual deseja suporte';
34 35 $Self->{Translation}->{'Ticket created'} = 'Chamado criado com sucesso';
35   - $Self->{Translation}->{'Click here to open another ticket'} = 'Clique aqui para abrir um outro chamado se desejar';
  36 + $Self->{Translation}->{'Please fill the following form to open your ticket'} = 'Por favor preencha o formulário para abrir seu chamado';
  37 + $Self->{Translation}->{'Click here to open another ticket'} = 'Clique aqui para abrir um outro chamado se desejar';
  38 + $Self->{Translation}->{'Click here to authenticate'} = 'Clique aqui para autenticar-se';
  39 + $Self->{Translation}->{'Did you know that, if you have a login, you can authenticate first and do not have to provide your name and e-mail. Also, it will be possible to monitor your ticket later.'} =
  40 + 'Você sabia que, autenticando-se, você não precisa informar seu nome e e-mail na hora de abrir o chamado? Além disso, você pode também depois acompanhar o andamento do seu atendimento!';
  41 +
36 42 return 1;
37 43 }
38 44 1;
39 45 \ No newline at end of file
... ...
Kernel/Language/pt_BR_NewTicketWizardServiceForm.pm 100644 → 100755
1 1 # Kernel/Modules/pt_BR_NewTicketWizardServiceForm.pm - translations for NewTicketWizardModuleServiceForm
2 2 #
3   -# Copyright (C) 2014 SeTIC - UFSC - http://setic.ufsc.br/
4   -# Version 01/08/2015 - Adjustments for OTRS 4
  3 +# Copyright (C) 2014-2017 SeTIC - UFSC - http://setic.ufsc.br/
  4 +# Version 2015-08-01 - Adjustments for OTRS 4
  5 +# Version 2017-06-16 - Support for bootstrap version
5 6 #
6 7 # --
7 8 # This software comes with ABSOLUTELY NO WARRANTY. For details, see
... ... @@ -17,21 +18,11 @@ use utf8;
17 18 sub Data {
18 19 my $Self = shift;
19 20  
20   - $Self->{Translation}->{'The following maintenances are in progress'} = 'As seguintes manutenções estão ocorrendo';
21   - $Self->{Translation}->{'Started at: '} = 'Iniciada em:';
22   - $Self->{Translation}->{'Queues panel'} = 'Novo chamado';
23   - $Self->{Translation}->{'Your ticket has been registered with the number: '} = 'Seu chamado foi registrado com sucesso! O número é: ';
24   - $Self->{Translation}->{'New ticket wizard'} = 'Assistente de novo chamado';
25   - $Self->{Translation}->{'New ticket'} = 'Novo chamado';
26 21 $Self->{Translation}->{'Service forms'} = 'Formulários de serviços';
27   - $Self->{Translation}->{'Service form'} = 'Formulários de serviço';
28 22 $Self->{Translation}->{'Create and manage service forms.'} = 'Criar e gerenciar formulários de serviços';
29 23 $Self->{Translation}->{'Introduction'} = 'Introdução';
30 24 $Self->{Translation}->{'Service'} = 'Serviço';
31 25 $Self->{Translation}->{'Form'} = 'Formulário';
32   - $Self->{Translation}->{'Choose the service to ask for support'} = 'Escolha o servi&ccedil;o para o qual deseja suporte';
33   - $Self->{Translation}->{'Ticket created'} = 'Chamado criado com sucesso';
34   - $Self->{Translation}->{'Click here to open another ticket'} = 'Clique aqui para abrir um outro chamado se desejar';
35 26 return 1;
36 27 }
37 28 1;
38 29 \ No newline at end of file
... ...
Kernel/Modules/NewTicketWizard.pm 100644 → 100755
1 1 # --
2 2 # Kernel/Modules/NewTicketWizard.pm - frontend module for creating custom new ticket interfaces
3 3 #
4   -# Copyright (C) SeTIC - UFSC - http://setic.ufsc.br/
5   -# Version 01/08/2015 - Support for OTRS 4.0.3
6   -# Version 25/06/2015 - Support for HTML formatting of form fields
  4 +# Copyright (C) 2015-2017 SeTIC - UFSC - http://setic.ufsc.br/
  5 +# Version 2015-08-01 - Support for OTRS 4.0.3
  6 +# Version 2015-06-25 - Support for HTML formatting of form fields
  7 +# Version 2017-06-16 - Support for bootstrap and logged in user identification
  8 +# Version 2017-06-20 - Code refactoring
7 9 #
8 10 # --
9 11 # This software comes with ABSOLUTELY NO WARRANTY. For details, see
... ... @@ -19,24 +21,9 @@ use Kernel::System::VariableCheck qw(:all);
19 21 use Data::UUID;
20 22  
21 23 our @ObjectDependencies = (
22   -"Kernel::System::DateUtils",
23   -"Kernel::System::Maintenance",
24   -"Kernel::System::QueueService",
25   -"Kernel::System::Service",
26   -"Kernel::System::ServiceForm",
27 24 "Kernel::System::TicketWizard",
28   -"Kernel::System::Web::UploadCache",
29   -"Kernel::System::DynamicField",
30   -"Kernel::System::DynamicField::Backend",
31   -"Kernel::System::State",
32   -"Kernel::System::SystemAddress",
33   -"Kernel::System::CustomerUser",
34 25 "Kernel::System::Web::Request",
35   -"Kernel::System::DB",
36   -"Kernel::System::Ticket",
37 26 "Kernel::Output::HTML::Layout",
38   -"KerneL::System::Log",
39   -"Kernel::System::Queue",
40 27 "Kernel::Config"
41 28 );
42 29  
... ... @@ -50,555 +37,45 @@ sub new {
50 37 return $Self;
51 38 }
52 39  
53   -sub BuildServices {
54   - my ( $Self, %Param ) = @_;
55   - my %Data = ();
56   - my $ParamObject = $Kernel::OM->Get("Kernel::System::Web::Request");
57   - my $QueueServiceObject = $Kernel::OM->Get("Kernel::System::QueueService");
58   - my $ConfigObject = $Kernel::OM->Get("Kernel::Config");
59   - my $LayoutObject = $Kernel::OM->Get("Kernel::Output::HTML::Layout");
60   - my $ServiceObject = $Kernel::OM->Get("Kernel::System::Service");
61   -
62   - # Build service chooser
63   - my %Services = ();
64   -
65   - if ( !$ParamObject->GetParam( Param => "QueueID" ) ) {
66   - %Services = $ServiceObject->ServiceList( UserID => $ConfigObject->Get('CustomerPanelUserID'), );
67   - }
68   - else {
69   - %Services =
70   - $QueueServiceObject->GetServiceList( QueueID => $ParamObject->GetParam( Param => "QueueID" ), );
71   - }
72   - my @ServicesCombo = ();
73   -
74   - for my $serviceID ( keys %Services ) {
75   - if ( grep { index( $Services{$_}, $Services{$serviceID} . "::" ) >= 0 } ( keys %Services ) ) {
76   - my %serv = ();
77   - $serv{Value} = $Services{$serviceID};
78   - $serv{Key} = $serviceID;
79   - $serv{Disabled} = 1;
80   - push @ServicesCombo, \%serv;
81   - }
82   - else {
83   - my %serv = ();
84   - $serv{Value} = $Services{$serviceID};
85   - $serv{Key} = $serviceID;
86   - push @ServicesCombo, \%serv;
87   - }
88   - }
89   -
90   - @ServicesCombo = sort { $a->{Value} . "::" cmp $b->{Value} . "::" } @ServicesCombo;
91   -
92   - my $retorno = $LayoutObject->BuildSelection(
93   - Data => \@ServicesCombo,
94   - Name => 'ServiceID',
95   - SelectedID => $Param{ServiceID},
96   - Class => "Validate_Required " . ( $Param{Errors}->{ServiceIDInvalid} || '' ),
97   - PossibleNone => 1,
98   - TreeView => 1,
99   - Sort => 'TreeView',
100   - Translation => 0,
101   - Max => 200
102   - );
103   -
104   - return $retorno;
105   -}
106   -
107 40 sub Run {
108 41 my ( $Self, %Param ) = @_;
109   - my $ParamObject = $Kernel::OM->Get("Kernel::System::Web::Request");
110   - my $QueueObject = $Kernel::OM->Get("Kernel::System::Queue");
111   - my $ConfigObject = $Kernel::OM->Get("Kernel::Config");
112   - my $LayoutObject = $Kernel::OM->Get("Kernel::Output::HTML::Layout");
113   - my $ServiceObject = $Kernel::OM->Get("Kernel::System::Service");
114   - my $MaintenanceObject = $Kernel::OM->Get("Kernel::System::Maintenance");
115   - my $DateUtilsObject = $Kernel::OM->Get("Kernel::System::DateUtils");
116 42  
117   - my %Data = ();
118   -
119   - if ( $ParamObject->GetParam( Param => "QueueID" ) ) {
120   - $Data{QueueID} = $ParamObject->GetParam( Param => "QueueID" );
121   - } else {
122   - # Check if must show queue
123   - my $_ConfigTicketWizard = $ConfigObject->Get("Ticket::Frontend::Customer::NewTicketWizard");
124   - my $_ShowQueue = $_ConfigTicketWizard->{"ShowQueue"};
125   - if ( !$_ShowQueue ) {
126   - return $LayoutObject->Redirect( OP => "Action=QueuesPanel" );
127   - }
128   - }
129   -
130   - if ( $ParamObject->GetParam( Param => "Subaction" ) && ($ParamObject->GetParam( Param => "Subaction" ) eq "GetServices") ) {
131   - my $content = $Self->BuildServices();
132   -
133   - return $LayoutObject->Attachment(
134   - ContentType => 'application/text; charset=' . $LayoutObject->{Charset},
135   - Content => $content,
136   - Type => 'inline',
137   - NoCache => 1,
138   - );
139   - }
140   -
141   - # Build service chooser
142   - $Data{ServiceStrg} = $Self->BuildServices(ServiceID => $ParamObject->GetParam( Param => "ServiceID" ));
143   -
144   - $Self->{Config} = $ConfigObject->Get("Ticket::Frontend::Customer::NewTicketWizard");
145   - my $msgChooseService = $Self->{Config}->{"MessageChooseService"};
146   - my $idCustomTemplate = $Self->{Config}->{"CustomTemplate"};
147   -
148   - if ( $ParamObject->GetParam( Param => "QueueID" ) ) {
149   - my %queueData = $QueueObject->QueueGet( ID => $ParamObject->GetParam( Param => "QueueID" ) );
150   - my $queueName = $queueData{Name};
151   - $msgChooseService =~ s/PLACE\_NAME/$queueName/g;
152   - }
153   -
154   - $Data{MsgChooseService} = $msgChooseService;
155   -
156   - if ( $ParamObject->GetParam( Param => "Subaction" ) ) {
157   - if ( $ParamObject->GetParam( Param => "Subaction" ) eq "CreateTicket" ) {
158   - return $Self->CreateTicket();
159   - }
160   - elsif ( $ParamObject->GetParam( Param => "Subaction" ) eq "GetFormJSON" ) {
161   - return $Self->GetFormJSON( ServiceID => $ParamObject->GetParam( Param => "ServiceID" ) );
162   - } elsif ( $ParamObject->GetParam( Param => "Subaction" ) eq "GetFormCustomProps" ) {
163   - return $Self->GetFormCustomProps( ServiceID => $ParamObject->GetParam( Param => "ServiceID" ) );
164   - }
165   - }
166   - else {
167   - my ( $schema, $fields ) = $Self->GetForm();
168   -
169   - $Data{SchemaForm} = $schema;
170   - $Data{FieldsForm} = $fields;
171   -
172   - # build output
173   - my $Output = $LayoutObject->CustomerHeader( Type => $idCustomTemplate, Title => $LayoutObject->{LanguageObject}->Translate("New ticket wizard") );
174   -
175   - # maintenances
176   - my @maintenances = $MaintenanceObject->ListCurrentMaintenances();
177   -
178   - if (@maintenances) {
179   - $LayoutObject->Block( Name => 'MaintenancesPanel', );
180   -
181   - for my $maintenanceHash (@maintenances) {
182   - my %maintenance = %{$maintenanceHash};
183   -
184   - $LayoutObject->Block(
185   - Name => 'MaintenanceLine',
186   - Data => {
187   - Message => $maintenance{'Description'},
188   - StartDate => $DateUtilsObject->BrazilianDate(
189   - Timestamp => $DateUtilsObject->FromSQL( StringDate => $maintenance{StartDate} )
190   - ),
191   - }
192   - );
193   - }
194   - }
195   -
196   - my $ug = Data::UUID->new;
197   - my $uuid = $ug->create();
198   - $Data{FormID} = $ug->to_string( $uuid );
199   -
200   -
201   - $Output .= $LayoutObject->CustomerNavigationBar();
202   - $Output .= $LayoutObject->Output(
203   - Data => \%Data,
204   - TemplateFile => 'NewTicketWizard',
205   - );
206   - $Output .= $LayoutObject->CustomerFooter(Type => $idCustomTemplate);
207   - return $Output;
208   - }
209   -}
210   -
211   -sub GetFormJSON {
212   - my ( $Self, %Param ) = @_;
213   - my %serviceForm;
214   -
215   - my $ServiceFormObject = $Kernel::OM->Get("Kernel::System::ServiceForm");
216   - my $LayoutObject = $Kernel::OM->Get("Kernel::Output::HTML::Layout");
217 43 my $ParamObject = $Kernel::OM->Get("Kernel::System::Web::Request");
218   -
219   - my $QueueID = $ParamObject->GetParam( Param => "QueueID" );
220   -
221   - if ( $Param{ServiceID} ) {
222   - %serviceForm = $ServiceFormObject->GetServiceFormForQueue( ServiceID => $Param{ServiceID}, QueueID => $QueueID );
223   - if (! $serviceForm{ServiceID}) {
224   - %serviceForm = $ServiceFormObject->GetServiceForm( ServiceID => $Param{ServiceID} );
225   - }
226   - }
227   -
228   - my ( $schema, $fields, $introduction ) = $Self->GetForm( ServiceForm => \%serviceForm, QueueID => $QueueID );
229   -
230   - return $LayoutObject->Attachment(
231   - ContentType => 'application/json; charset=' . $LayoutObject->{Charset},
232   - Content => "[{" . $schema . "}, {" . $fields . "}, \"" . $introduction . "\"]",
233   - Type => 'inline',
234   - NoCache => 1,
235   - );
236   -}
237   -
238   -sub GetFormCustomProps {
239   - my ( $Self, %Param ) = @_;
240   - my %serviceForm;
241   -
242   - my $ServiceFormObject = $Kernel::OM->Get("Kernel::System::ServiceForm");
243 44 my $LayoutObject = $Kernel::OM->Get("Kernel::Output::HTML::Layout");
244   - my $ParamObject = $Kernel::OM->Get("Kernel::System::Web::Request");
245   -
246   - my $QueueID = $ParamObject->GetParam( Param => "QueueID" );
247   -
248   - if ( $Param{ServiceID} ) {
249   - %serviceForm = $ServiceFormObject->GetServiceFormForQueue( ServiceID => $Param{ServiceID}, QueueID => $QueueID );
250   - if (! $serviceForm{ServiceID}) {
251   - %serviceForm = $ServiceFormObject->GetServiceForm( ServiceID => $Param{ServiceID} );
252   - }
253   - }
254   -
255   - return $LayoutObject->Attachment(
256   - ContentType => 'text/plain; charset=' . $LayoutObject->{Charset},
257   - Content => $serviceForm{CustomProps} || "/**/",
258   - Type => 'inline',
259   - NoCache => 1,
260   - );
261   -}
262   -
263   -sub GetForm {
264   - my ( $Self, %Param ) = @_;
265   -
266 45 my $TicketWizard = $Kernel::OM->Get("Kernel::System::TicketWizard");
267 46 my $ConfigObject = $Kernel::OM->Get("Kernel::Config");
268 47  
269   - my $schema = $TicketWizard->GetBasicFieldsSchema();
270   - my $fields = $TicketWizard->GetBasicFieldsOptions();
271   - my $introduction;
272   -
273   - ( $schema, $fields ) = $TicketWizard->ReplaceOTRSValues(
274   - Schema => $schema,
275   - Options => $fields,
276   - UserID => $ConfigObject->Get('CustomerPanelUserID')
277   - );
  48 + $Self->Debug("Authenticated ticket started");
  49 + $Self->Debug("Subaction => " . $ParamObject->GetParam( Param => "Subaction" ));
278 50  
279   - if ( !$Param{ServiceForm} ) {
280   - $schema =~ s/CF_SCHEMA//g;
281   - $fields =~ s/CF_FORM//g;
282   - $introduction = "";
283   - }
284   - else {
285   - my %serviceForm = %{ $Param{ServiceForm} };
286   - $introduction = $serviceForm{Introduction};
287   -
288   - if ( !$Param{ServiceForm}{Schema} ) {
289   - $schema =~ s/CF_SCHEMA//g;
290   - $fields =~ s/CF_FORM//g;
291   - }
292   - else {
293   - my $schemaForm = "," . $serviceForm{Schema};
294   - my $fieldsForm = "," . $serviceForm{Form};
295   - $schema =~ s/CF_SCHEMA/$schemaForm/g;
296   - $fields =~ s/CF_FORM/$fieldsForm/g;
297   - }
298   -
299   - # Ajusta campos fixos, se houver
300   - if ($serviceForm{FixedValues}) {
301   - ($schema, $fields) = $Self->AdjustFixedFields(Schema => $schema, Fields => $fields, FixedValues => $serviceForm{FixedValues});
302   - }
303   - }
304   -
305   - # Incluir campos dinâmicos no replace
306   - ( $schema, $fields ) = $TicketWizard->ReplaceOTRSDynamicFields( Schema => $schema, Options => $fields );
307   -
308   - if ( $Param{"QueueID"} ) {
309   - $schema = $schema . ",\n\"QueueID\": {\n\"type\": \"string\",\n\"default\": \"" . $Param{"QueueID"} . "\"}";
310   - $fields = $fields . ",\n\"QueueID\": {\n\"type\": \"hidden\"\n}";
311   - }
312   -
313   - return ( $schema, $fields, $introduction );
314   -}
315   -
316   -sub GetQueueID() {
317   - my ( $Self, %Param ) = @_;
318   -
319   - my $ParamObject = $Kernel::OM->Get("Kernel::System::Web::Request");
320   - my $QueueObject = $Kernel::OM->Get("Kernel::System::Queue");
321   - my $ConfigObject = $Kernel::OM->Get("Kernel::Config");
322   -
323   - # Check if queueID was sent
324   - my $QueueID = $ParamObject->GetParam( Param => "QueueID" );
325   -
326   - if ($QueueID) {
327   - my %Queue = $QueueObject->QueueGet( ID => $QueueID );
328   - return ( $Queue{"Name"}, $QueueID );
329   - }
330   -
331   - # Gets default Queue
332   - my $ConfigTicket = $ConfigObject->Get("Ticket::Frontend::CustomerTicketMessage");
333   - my $ConfigTicketWizard = $ConfigObject->Get("Ticket::Frontend::Customer::NewTicketWizard");
334   -
335   - my $QueueDefault = $ConfigTicket->{"QueueDefault"};
336   -
337   - # Checks if there is a field for the queue
338   - my $QueuePrefix = $ConfigTicketWizard->{"QueuePrefix"};
339   - my $QueueField = $ConfigTicketWizard->{"QueueField"};
340   -
341   - my %QueueListID = $QueueObject->QueueList( Valid => 1 );
342   - my %QueueList = reverse $QueueObject->QueueList( Valid => 1 );
343   - $QueueID = $QueueList{$QueueDefault};
344   - my $Queue = $QueueListID{$QueueID};
345   -
346   - if ( $QueuePrefix && $QueueField ) {
347   - my $QueueSelected = $ParamObject->GetParam( Param => $QueueField );
348   - my $QueueName = "$QueuePrefix $QueueSelected";
349   -
350   - if ( $QueueList{$QueueName} ) {
351   - $QueueID = $QueueList{$QueueName};
352   - $Queue = $QueueName;
353   - }
354   -
355   - }
356   -
357   - return ( $Queue, $QueueID );
358   -}
359   -
360   -sub CreateTicket {
361   - my ( $Self, %Param ) = @_;
362   - my %Data = ();
363   -
364   - my $TicketObject = $Kernel::OM->Get("Kernel::System::Ticket");
365   - my $ConfigObject = $Kernel::OM->Get("Kernel::Config");
366   - my $ParamObject = $Kernel::OM->Get("Kernel::System::Web::Request");
367   - my $BackendObject = $Kernel::OM->Get("Kernel::System::DynamicField::Backend");
368   - my $DynamicFieldObject = $Kernel::OM->Get("Kernel::System::DynamicField");
369   - my $CustomerUserObject = $Kernel::OM->Get("Kernel::System::CustomerUser");
370   - my $LayoutObject = $Kernel::OM->Get("Kernel::Output::HTML::Layout");
371   -
372   - # Queue
373   - my $queueFixed = 0;
374   - if ($Data{QueueID}) {
375   - $queueFixed = 1;
376   - }
377   - my ( $Queue, $QueueID ) = $Self->GetQueueID(%Param);
378   - $Data{QueueID} = $QueueID;
379   -
380   - $Self->{Config} = $ConfigObject->Get("Ticket::Frontend::CustomerTicketMessage");
381   -
382   - my $TicketID = $TicketObject->TicketCreate(
383   - Title => $ParamObject->GetParam( Param => "subject" ),
384   - QueueID => $QueueID,
385   - Priority => $Self->{Config}->{PriorityDefault},
386   - Lock => 'unlock',
387   - State => 'new',
388   - ServiceID => $ParamObject->GetParam( Param => "service" ),
389   - TypeID => $ParamObject->GetParam( Param => "type" ),
390   - CustomerID => $Self->{UserCustomerID},
391   - CustomerUser => $Self->{UserLogin},
392   - OwnerID => $ConfigObject->Get('CustomerPanelUserID'),
393   - UserID => $ConfigObject->Get('CustomerPanelUserID'),
394   - );
395   -
396   - my $MimeType = 'text/html';
397   - my %serviceFieldsValues = ();
398   - my $serviceFields = "";
399   - my @serviceFieldsKeys = ();
400   -
401   - # Service Fields
402   - for ( $ParamObject->GetParamNames() ) {
403   - if (( substr( $_, 0, 3 ) eq "SF_" ) && ( substr( $_, 0, 5 ) ne "SF_T_" )) {
404   - if ($ParamObject->GetArray( Param => $_ )) {
405   - my @paramVals = $ParamObject->GetArray( Param => $_ );
406   - for my $paramValue (@paramVals) {
407   - if (($paramValue) && (!($paramValue eq "-"))) {
408   - if (! $serviceFieldsValues{$_}) {
409   - $serviceFieldsValues{$_} = $paramValue;
410   - push @serviceFieldsKeys, $_;
411   - } else {
412   - $serviceFieldsValues{$_} .= ", " . $paramValue;
413   - }
414   - }
415   - }
416   -
417   - } else {
418   - my $paramValue = $ParamObject->GetParam( Param => $_ );
419   -
420   - if (($paramValue) && (!($paramValue eq "-"))) {
421   - if (! $serviceFieldsValues{$_}) {
422   - $serviceFieldsValues{$_} = $paramValue;
423   - push @serviceFieldsKeys, $_;
424   - } else {
425   - $serviceFieldsValues{$_} .= ", " . $paramValue;
426   - }
427   - }
428   - }
429   - }
430   - }
431   -
432   - for (@serviceFieldsKeys) {
433   - $serviceFields .= "<B>" . $Self->breakWords(Text => substr( $_, 3 )) . ": </B>" . $serviceFieldsValues{$_} . "<BR/>";
434   - }
435   -
436   - $serviceFields .= "<B>Login autenticado: </B>" . $Self->{UserLogin} . "<BR/>";
437   - $serviceFields .= "<B>IP: </B>" . $ENV{'REMOTE_ADDR'} . "<BR/>";
438   - $serviceFields .= "<BR/><BR/>";
439   -
440   - # Dynamic Fields
441   - for ( $ParamObject->GetParamNames() ) {
442   - if ( substr( $_, 0, 3 ) eq "DF_" ) {
443   - my $Success = $BackendObject->ValueSet(
444   - DynamicFieldConfig => $DynamicFieldObject->DynamicFieldGet( Name => substr( $_, 3 ) ),
445   - ObjectID => $TicketID,
446   - Value => $ParamObject->GetParam( Param => $_ ),
447   - UserID => $ConfigObject->Get('CustomerPanelUserID'),
448   - );
449   - }
450   - }
451   -
452   - # Service Fields - Table fields
453   - my $lastTab = "";
454   - my %keysFound = ();
455   - my $newTab = 1;
456   -
457   - for ( $ParamObject->GetParamNames() ) {
458   - if ( substr( $_, 0, 5 ) eq "SF_T_" ) {
459   - my $paramName = $_;
460   - my @parts = split('_', $_);
461   - my $currTab = $parts[2];
462   - my $currKey = $parts[4];
463   -
464   - if ($currTab ne $lastTab) {
465   - if ($lastTab ne "") {
466   - $serviceFields .= "</TABLE><BR/><BR/>";
467   - }
468   - $serviceFields .= "<TABLE style='border-collapse: collapse; width: 700px;' border='1px'>";
469   - $lastTab = $currTab;
470   - $newTab = 1;
471   - } else {
472   - $newTab = 0;
473   - }
474   -
475   - ## new line due to repetition or new table
476   - if ($keysFound{$currKey} || ($newTab) ) {
477   - %keysFound = ();
478   - $serviceFields .= "<TR><TD COLSPAN='2' style='text-align: center; font-size: large'><B>" . $Self->breakWords(Text => $currTab) . "</B></TD></TR>";
479   - }
480   - $keysFound{$currKey} = 1;
481   - $serviceFields .= "<TR><TD style='width: 100px;'><B>" . $Self->breakWords(Text => $currKey) . "</B></TD><TD>" . $ParamObject->GetParam( Param => $paramName ) . "</TD></TR>";
  51 + if ( $ParamObject->GetParam( Param => "UploadFileCmd" )) {
  52 + $Self->Debug("File upload instruction received");
  53 + return $TicketWizard->UploadFile();
  54 + } elsif ( $ParamObject->GetParam( Param => "Subaction" ) ) {
  55 + if ( $ParamObject->GetParam( Param => "Subaction" ) eq "CreateTicket" ) {
  56 + $Self->Debug("Create ticket action received");
  57 + return $TicketWizard->CreateTicket(CustomerID => $Self->{UserCustomerID},
  58 + CustomerUser => $Self->{UserLogin},
  59 + UserLogin => $Self->{UserLogin},
  60 + UserEmail => $Self->{UserEmail});
482 61 }
  62 + elsif ( $ParamObject->GetParam( Param => "Subaction" ) eq "GetFormJSON" ) {
  63 + $Self->Debug("Service form requested received");
  64 + return $TicketWizard->GetFormJSON( Public=> 0, ServiceID => $ParamObject->GetParam( Param => "ServiceID" ) );
  65 + } elsif ( $ParamObject->GetParam( Param => "Subaction" ) eq "GetFormCustomProps" ) {
  66 + $Self->Debug("Service form custom properties (script) requested");
  67 + return $TicketWizard->GetFormCustomProps( Public=> 0, ServiceID => $ParamObject->GetParam( Param => "ServiceID" ) );
  68 + }
  69 + } else {
  70 + $Self->Debug("Default action - open service choosing form");
  71 + return $TicketWizard->OpenForm(Public => 0);
483 72 }
484   -
485   - if ($lastTab ne "") {
486   - $serviceFields .= "</TABLE><BR/><BR/>";
487   - }
488   -
489   -
490   -
491   -
492   - # Create article
493   - my $FullName = $CustomerUserObject->CustomerName( UserLogin => $Self->{UserLogin}, );
494   - my $From = "\"$FullName\" <$Self->{UserEmail}>";
495   - my $ArticleID = $TicketObject->ArticleCreate(
496   - TicketID => $TicketID,
497   - ArticleType => $Self->{Config}->{ArticleType},
498   - SenderType => $Self->{Config}->{SenderType},
499   - From => $From,
500   - To => $Queue,
501   - Subject => $ParamObject->GetParam( Param => "subject" ),
502   - Body => $serviceFields . $ParamObject->GetParam( Param => "description" ),
503   - MimeType => $MimeType,
504   - Charset => $LayoutObject->{UserCharset},
505   - UserID => $ConfigObject->Get('CustomerPanelUserID'),
506   - HistoryType => $Self->{Config}->{HistoryType},
507   - HistoryComment => $Self->{Config}->{HistoryComment} || '%%',
508   - AutoResponseType => ( $ConfigObject->Get('AutoResponseForWebTickets') )
509   - ? 'auto reply'
510   - : '',
511   - OrigHeader => {
512   - From => $From,
513   - To => $Queue,
514   - Subject => $ParamObject->GetParam( Param => "subject" ),
515   - Body => $serviceFields . $Self->lineBreakToHTML(Text => $ParamObject->GetParam( Param => "description" )),
516   - },
517   - Queue => $Queue,
518   - );
519   -
520   - # Attachments
521   - my %UploadStuff = $ParamObject->GetUploadAll( Param => "attachment" );
522   -
523   - if (keys %UploadStuff) {
524   - $TicketObject->ArticleWriteAttachment(
525   - %UploadStuff,
526   - ArticleID => $ArticleID,
527   - UserID => $ConfigObject->Get('CustomerPanelUserID'),
528   - );
529   - }
530   -
531   - $Self->{ConfigNTW} = $ConfigObject->Get("Ticket::Frontend::Customer::NewTicketWizard");
532   - my $idCustomTemplate = $Self->{ConfigNTW}->{"CustomTemplate"};
533   -
534   - $Data{TicketNumber} = $TicketObject->TicketNumberLookup( TicketID => $TicketID );
535   -
536   - # build output
537   - if (! $queueFixed) {
538   - delete $Data{QueueID}
539   - }
540   - my $Output = $LayoutObject->CustomerHeader( Type => $idCustomTemplate, Title => "Ticket created" );
541   - $Output .= $LayoutObject->CustomerNavigationBar();
542   - $Output .= $LayoutObject->Output(
543   - Data => \%Data,
544   - TemplateFile => 'NewTicketWizardTicketCreated',
545   - );
546   - $Output .= $LayoutObject->CustomerFooter(Type => $idCustomTemplate );
547   - return $Output;
548   -
549   -}
550   -
551   -sub AdjustFixedFields {
552   - my ( $Self, %Param ) = @_;
553   - my $schema = $Param{Schema};
554   - my $form = $Param{Fields};
555   - my $fixedValues = $Param{FixedValues};
556   -
557   - my @values = split(/\n/, $fixedValues);
558   -
559   -
560   - for my $value (@values) {
561   - $value =~ s/\r//g;
562   - my @data = split('=', $value);
563   -
564   - my $fieldKey = $data[0];
565   - my $fixedValue = $data[1];
566   -
567   - my $key = '("' . $fieldKey . '"[\ ]?:[\ ]?{[^}]+})';
568   - my $replace = '"' . $fieldKey . '"' . ': {"type": "string", "default": "' . $fixedValue . '"}';
569   -
570   - $schema =~ s/$key/$replace/;
571   -
572   - $key = '("' . $fieldKey . '"[\ ]?:[\ ]?{[^}]+})';
573   - $replace = '"' . $fieldKey . '": {"type": "hidden"' . "\n}";
574   - $form =~ s/$key/$replace/;
575   - }
576   -
577   - return ($schema, $form);
578   -
579 73 }
580 74  
581   -sub lineBreakToHTML {
582   - my ( $Self, %Param ) = @_;
583   -
584   - my $return = $Param{Text};
585   - my $LINE_BREAK = "<BR/>";
586   -
587   - $return =~ s/\n/$LINE_BREAK/g;
588   -
589   - return $return;
590   -
591   -}
592   -
593   -sub breakWords {
594   - my ( $Self, %Param ) = @_;
595   -
596   - my $return = $Param{Text};
597   -
598   - $return =~ s/(.)([A-Z][^A-Z])/$1 $2/g;
599   - $return =~ s/([\w']+)/\u\L$1/g;
600   -
601   - return $return;
  75 +sub Debug {
  76 + my $Self = shift;
  77 + my $msg = shift;
  78 + $Kernel::OM->Get("Kernel::System::Log")->Log( Priority => 'debug', Message => $msg );
602 79 }
603 80  
604 81 1;
... ...
Kernel/Modules/NewTicketWizardPublic.pm 100644 → 100755
... ... @@ -2,8 +2,10 @@
2 2 # Kernel/Modules/NewTicketWizardPublic.pm - frontend module for creating custom new ticket interfaces without user login
3 3 #
4 4 # Copyright (C) SeTIC - UFSC - http://setic.ufsc.br/
5   -# Version 01/08/2015 - Support for OTRS 4.0.3
6   -# Version 25/06/2015 - Support for restricted services and HTML formatting of form fields
  5 +# Version 2015-08-01 - Support for OTRS 4.0.3
  6 +# Version 2015-06-25 - Support for restricted services and HTML formatting of form fields
  7 +# Version 2017-06-16 - Support for bootstrap and logged in user identification
  8 +# Version 2017-06-20 - Code refactoring
7 9 #
8 10 # --
9 11 # This software comes with ABSOLUTELY NO WARRANTY. For details, see
... ... @@ -16,28 +18,15 @@ use strict;
16 18 use warnings;
17 19 use Kernel::System::VariableCheck qw(:all);
18 20 use Data::UUID;
  21 +use Data::Dumper;
  22 +use URI::Escape;
  23 +use JSON;
19 24  
20 25 our @ObjectDependencies = (
21   -"Kernel::System::DateUtils",
22   -"Kernel::System::Maintenance",
23   -"Kernel::System::QueueService",
24   -"Kernel::System::Service",
25   -"Kernel::System::ServiceForm",
26 26 "Kernel::System::TicketWizard",
27   -"Kernel::System::Web::UploadCache",
28   -"Kernel::System::DynamicField",
29   -"Kernel::System::DynamicField::Backend",
30   -"Kernel::System::State",
31   -"Kernel::System::SystemAddress",
32   -"Kernel::System::CustomerUser",
33 27 "Kernel::System::Web::Request",
34   -"Kernel::System::DB",
35   -"Kernel::System::Ticket",
36 28 "Kernel::Output::HTML::Layout",
37   -"KerneL::System::Log",
38   -"Kernel::System::Queue",
39   -"Kernel::Config",
40   -"Kernel::System::RestrictedService"
  29 +"Kernel::Config"
41 30 );
42 31  
43 32 sub new {
... ... @@ -50,586 +39,68 @@ sub new {
50 39 return $Self;
51 40 }
52 41  
53   -sub BuildServices {
54   - my ( $Self, %Param ) = @_;
55   - my %Data = ();
56   - my $ParamObject = $Kernel::OM->Get("Kernel::System::Web::Request");
57   - my $QueueServiceObject = $Kernel::OM->Get("Kernel::System::QueueService");
58   - my $ConfigObject = $Kernel::OM->Get("Kernel::Config");
59   - my $LayoutObject = $Kernel::OM->Get("Kernel::Output::HTML::Layout");
60   - my $ServiceObject = $Kernel::OM->Get("Kernel::System::Service");
61   - my $RestrictedObject = $Kernel::OM->Get("Kernel::System::RestrictedService");
62   -
63   - # Build service chooser
64   - my %Services = ();
65   -
66   - if ( !$ParamObject->GetParam( Param => "QueueID" ) ) {
67   - %Services = $ServiceObject->ServiceList( UserID => $ConfigObject->Get('CustomerPanelUserID'), );
68   - }
69   - else {
70   - %Services =
71   - $QueueServiceObject->GetServiceList( QueueID => $ParamObject->GetParam( Param => "QueueID" ), );
72   - }
73   - my @ServicesCombo = ();
74   -
75   - my @restrictedServices = $RestrictedObject->GetRestrictedServices();
76   -
77   - for my $serviceID ( keys %Services ) {
78   - if ( grep { index( $Services{$_}, $Services{$serviceID} . "::" ) >= 0 } ( keys %Services ) ) {
79   -
80   - if (! ( $serviceID ~~ @restrictedServices ) ) {
81   - my %serv = ();
82   - $serv{Value} = $Services{$serviceID};
83   - $serv{Key} = $serviceID;
84   - $serv{Disabled} = 1;
85   - push @ServicesCombo, \%serv;
86   - }
87   - }
88   - else {
89   - if (! ( $serviceID ~~ @restrictedServices ) ) {
90   - my %serv = ();
91   - $serv{Value} = $Services{$serviceID};
92   - $serv{Key} = $serviceID;
93   - push @ServicesCombo, \%serv;
94   - }
95   - }
96   - }
97   -
98   - @ServicesCombo = sort { $a->{Value} . "::" cmp $b->{Value} . "::" } @ServicesCombo;
99   -
100   - my $retorno = $LayoutObject->BuildSelection(
101   - Data => \@ServicesCombo,
102   - Name => 'ServiceID',
103   - SelectedID => $Param{ServiceID},
104   - Class => "Validate_Required " . ( $Param{Errors}->{ServiceIDInvalid} || '' ),
105   - PossibleNone => 1,
106   - TreeView => 1,
107   - Sort => 'TreeView',
108   - Translation => 0,
109   - Max => 200
110   - );
111   -
112   - return $retorno;
113   -}
114 42  
115 43 sub Run {
116 44 my ( $Self, %Param ) = @_;
117   - my %Data = ();
118   - my $ParamObject = $Kernel::OM->Get("Kernel::System::Web::Request");
119   - my $QueueObject = $Kernel::OM->Get("Kernel::System::Queue");
120   - my $QueueServiceObject = $Kernel::OM->Get("Kernel::System::QueueService");
121   - my $ConfigObject = $Kernel::OM->Get("Kernel::Config");
122   - my $LayoutObject = $Kernel::OM->Get("Kernel::Output::HTML::Layout");
123   - my $ServiceObject = $Kernel::OM->Get("Kernel::System::Service");
124   - my $MaintenanceObject = $Kernel::OM->Get("Kernel::System::Maintenance");
125   - my $DateUtilsObject = $Kernel::OM->Get("Kernel::System::DateUtils");
126   -
127   - if ($ParamObject->GetParam(Param => "QueueID")) {
128   - $Data{QueueID} = $ParamObject->GetParam(Param => "QueueID");
129   - } else {
130   - # Check if must show queue
131   - my $_ConfigTicketWizard = $ConfigObject->Get("Ticket::Frontend::Customer::NewTicketWizard");
132   - my $_ShowQueue = $_ConfigTicketWizard->{"ShowQueue"};
133   - if (! $_ShowQueue) {
134   - return $LayoutObject->Redirect( OP => "Action=QueuesPanelPublic" );
135   - }
136   - }
137   -
138   - $Self->{Config} = $ConfigObject->Get("Ticket::Frontend::Customer::NewTicketWizard");
139   - $Self->{DefaultUserID} = $Self->{Config}->{"DefaultUserID"};
140   - $Self->{DefaultCustomerID} = $Self->{Config}->{"DefaultCustomerID"};
141   - $Self->{DefaultUserDomain} = $Self->{Config}->{"DefaultUserDomain"};
142   -
143   - if ($ParamObject->GetParam(Param => "QueueID")) {
144   - $Data{QueueID} = $ParamObject->GetParam(Param => "QueueID");
145   - }
146   -
147   - # Build service chooser
148   - $Data{ServiceStrg} = $Self->BuildServices(ServiceID => $ParamObject->GetParam( Param => "ServiceID" ));
149 45  
150   - my $msgChooseService = $Self->{Config}->{"MessageChooseServicePublic"};
151   - my $idCustomTemplate = $Self->{Config}->{"CustomTemplate"};
152   -
153   - if ($ParamObject->GetParam( Param => "QueueID" ) ) {
154   - my %queueData = $QueueObject->QueueGet(ID => $ParamObject->GetParam( Param => "QueueID" ));
155   - my $queueName = $queueData{Name};
156   - $msgChooseService =~ s/PLACE\_NAME/$queueName/g;
157   - }
158   -
159   - $Data{MsgChooseService} = $msgChooseService;
160   -
161   - if ( $ParamObject->GetParam( Param => "Subaction" ) ) {
162   - if ( $ParamObject->GetParam( Param => "Subaction" ) eq "CreateTicket" ) {
163   - return $Self->CreateTicket();
164   - }
165   - elsif ( $ParamObject->GetParam( Param => "Subaction" ) eq "GetFormJSON" ) {
166   - return $Self->GetFormJSON( ServiceID => $ParamObject->GetParam( Param => "ServiceID" ) );
167   - } elsif ( $ParamObject->GetParam( Param => "Subaction" ) eq "GetFormCustomProps" ) {
168   - return $Self->GetFormCustomProps( ServiceID => $ParamObject->GetParam( Param => "ServiceID" ) );
169   - }
170   - }
171   - else {
172   - my ( $schema, $fields ) = $Self->GetForm();
173   -
174   - $Data{SchemaForm} = $schema;
175   - $Data{FieldsForm} = $fields;
176   -
177   - # build output
178   - my $Output = $LayoutObject->CustomerHeader(Type => $idCustomTemplate, Title => $LayoutObject->{LanguageObject}->Translate("New ticket wizard") );
179   -
180   - # maintenances
181   - my @maintenances = $MaintenanceObject->ListCurrentMaintenances();
182   -
183   - if (@maintenances) {
184   - $LayoutObject->Block(
185   - Name => 'MaintenancesPanel',
186   - );
187   -
188   - for my $maintenanceHash (@maintenances) {
189   - my %maintenance = %{$maintenanceHash};
190   -
191   - $LayoutObject->Block(
192   - Name => 'MaintenanceLine',
193   - Data => {
194   - Message => $maintenance{'Description'},
195   - StartDate => $DateUtilsObject->BrazilianDate(Timestamp => $DateUtilsObject->FromSQL(StringDate => $maintenance{StartDate})),
196   - });
197   - }
198   - }
199   -
200   - my $ug = Data::UUID->new;
201   - my $uuid = $ug->create();
202   - $Data{FormID} = $ug->to_string( $uuid );
203   -
204   - $Output .= $LayoutObject->Output(
205   - Data => \%Data,
206   - TemplateFile => 'NewTicketWizardPublic',
207   - );
208   - $Output .= $LayoutObject->CustomerFooter(Type => $idCustomTemplate);
209   - return $Output;
210   - }
211   -}
212   -
213   -sub GetFormCustomProps {
214   - my ( $Self, %Param ) = @_;
215   - my %serviceForm;
216   -
217   - my $ServiceFormObject = $Kernel::OM->Get("Kernel::System::ServiceForm");
218   - my $LayoutObject = $Kernel::OM->Get("Kernel::Output::HTML::Layout");
219 46 my $ParamObject = $Kernel::OM->Get("Kernel::System::Web::Request");
220   -
221   - my $QueueID = $ParamObject->GetParam( Param => "QueueID" );
222   -
223   - if ( $Param{ServiceID} ) {
224   - %serviceForm = $ServiceFormObject->GetServiceFormForQueue( ServiceID => $Param{ServiceID}, QueueID => $QueueID );
225   - if (! $serviceForm{ServiceID}) {
226   - %serviceForm = $ServiceFormObject->GetServiceForm( ServiceID => $Param{ServiceID} );
227   - }
228   - }
229   -
230   - return $LayoutObject->Attachment(
231   - ContentType => 'text/plain; charset=' . $LayoutObject->{Charset},
232   - Content => $serviceForm{CustomProps} || "/**/",
233   - Type => 'inline',
234   - NoCache => 1,
235   - );
236   -}
237   -
238   -sub GetFormJSON {
239   - my ( $Self, %Param ) = @_;
240   - my %serviceForm;
241   -
242   - my $ServiceFormObject = $Kernel::OM->Get("Kernel::System::ServiceForm");
243 47 my $LayoutObject = $Kernel::OM->Get("Kernel::Output::HTML::Layout");
244   - my $ParamObject = $Kernel::OM->Get("Kernel::System::Web::Request");
245   -
246   - my $QueueID = $ParamObject->GetParam(Param => "QueueID");
247   -
248   - if ( $Param{ServiceID} ) {
249   - %serviceForm = $ServiceFormObject->GetServiceFormForQueue( ServiceID => $Param{ServiceID}, QueueID => $QueueID );
250   -
251   - if (! $serviceForm{ServiceID}) {
252   - %serviceForm = $ServiceFormObject->GetServiceForm( ServiceID => $Param{ServiceID} );
253   - }
254   - }
255   -
256   - my ( $schema, $fields, $introduction ) = $Self->GetForm( ServiceForm => \%serviceForm, QueueID => $QueueID );
257   -
258   - return $LayoutObject->Attachment(
259   - ContentType => 'application/json; charset=' . $LayoutObject->{Charset},
260   - Content => "[{" . $schema . "}, {" . $fields . "}, \"" . $introduction . "\"]",
261   - Type => 'inline',
262   - NoCache => 1,
263   - );
264   -}
265   -
266   -sub GetForm {
267   - my ( $Self, %Param ) = @_;
268   -
269   - my $TicketWizard = $Kernel::OM->Get("Kernel::System::TicketWizard");
270   - my $ConfigObject = $Kernel::OM->Get("Kernel::Config");
271   -
272   - my $schema = $TicketWizard->GetBasicFieldsSchemaPublic();
273   - my $fields = $TicketWizard->GetBasicFieldsOptionsPublic();
274   - my $introduction;
275   -
276   - ( $schema, $fields ) = $TicketWizard->ReplaceOTRSValues(
277   - Schema => $schema,
278   - Options => $fields,
279   - UserID => $Self->{DefaultUserID}
280   - );
281   -
282   - if ( !$Param{ServiceForm} ) {
283   - $schema =~ s/CF_SCHEMA//g;
284   - $fields =~ s/CF_FORM//g;
285   - $introduction = "";
286   - }
287   - else {
288   - my %serviceForm = %{ $Param{ServiceForm} };
289   - $introduction = $serviceForm{Introduction};
290   -
291   - if ( !$Param{ServiceForm}{Schema} ) {
292   - $schema =~ s/CF_SCHEMA//g;
293   - $fields =~ s/CF_FORM//g;
294   - }
295   - else {
296   - my $schemaForm = "," . $serviceForm{Schema};
297   - my $fieldsForm = "," . $serviceForm{Form};
298   - $schema =~ s/CF_SCHEMA/$schemaForm/g;
299   - $fields =~ s/CF_FORM/$fieldsForm/g;
300   - }
301   -
302   - # Ajusta campos fixos, se houver
303   - if ($serviceForm{FixedValues}) {
304   -
305   - ($schema, $fields) = $Self->AdjustFixedFields(Schema => $schema, Fields => $fields, FixedValues => $serviceForm{FixedValues});
306   - }
307   - }
308   -
309   - # Incluir campos dinâmicos no replace
310   - ( $schema, $fields ) = $TicketWizard->ReplaceOTRSDynamicFields( Schema => $schema, Options => $fields );
311   -
312   - if ($Param{"QueueID"}) {
313   - $schema = $schema . ",\n\"QueueID\": {\n\"type\": \"string\",\n\"default\": \"" . $Param{"QueueID"} . "\"}";
314   - $fields = $fields . ",\n\"QueueID\": {\n\"type\": \"hidden\"\n}";
315   - }
316   -
317   - return ( $schema, $fields, $introduction );
318   -}
319   -
320   -sub GetQueueID() {
321   - my ( $Self, %Param ) = @_;
322   -
323   - my $ParamObject = $Kernel::OM->Get("Kernel::System::Web::Request");
324   - my $QueueObject = $Kernel::OM->Get("Kernel::System::Queue");
325 48 my $ConfigObject = $Kernel::OM->Get("Kernel::Config");
326   -
327   - # Check if queueID was sent
328   - my $QueueID = $ParamObject->GetParam(Param => "QueueID");
329   -
330   - if ($QueueID) {
331   - my %Queue = $QueueObject->QueueGet(ID => $QueueID);
332   - return ($Queue{"Name"}, $QueueID);
333   - }
334   -
335   - # Gets default Queue
336   - my $ConfigTicket = $ConfigObject->Get("Ticket::Frontend::CustomerTicketMessage");
337   - my $ConfigTicketWizard = $ConfigObject->Get("Ticket::Frontend::Customer::NewTicketWizard");
338   -
339   - my $QueueDefault = $ConfigTicket->{"QueueDefault"};
340   -
341   - # Checks if there is a field for the queue
342   - my $QueuePrefix = $ConfigTicketWizard->{"QueuePrefix"};
343   - my $QueueField = $ConfigTicketWizard->{"QueueField"};
344   -
345   - my %QueueListID = $QueueObject->QueueList( Valid => 1 );
346   - my %QueueList = reverse $QueueObject->QueueList( Valid => 1 );
347   - $QueueID = $QueueList{$QueueDefault};
348   - my $Queue = $QueueListID{$QueueID};
349   -
350   - if ( $QueuePrefix && $QueueField ) {
351   - my $QueueSelected = $ParamObject->GetParam( Param => $QueueField );
352   - my $QueueName = "$QueuePrefix $QueueSelected";
353   -
354   - if ( $QueueList{$QueueName} ) {
355   - $QueueID = $QueueList{$QueueName};
356   - $Queue = $QueueName;
357   - }
358   - }
359   -
360   - return ( $Queue, $QueueID );
361   -}
  49 + my $TicketWizard = $Kernel::OM->Get("Kernel::System::TicketWizard");
362 50  
363   -sub GetUserIDFromEmail {
364   - my $Self = shift;
365   - my $email = shift;
366   - my $result = $Self->{DefaultCustomerID};
367   - my $domainList = $Self->{DefaultUserDomain};
368   -
369   - my $CustomerUserObject = $Kernel::OM->Get("Kernel::System::CustomerUser");
370 51  
371   - if ($domainList) {
372   - my @domains = split( ",", $domainList );
373   -
374   - for my $domain (@domains) {
375   - my @parts = split( "@", $email );
376   - if ( $parts[1] eq $domain ) {
377   - my $id = $parts[0];
378   - my %List = $CustomerUserObject->CustomerSearch(
379   - UserLogin => $id,
380   - Valid => 1, # not required, default 1
381   - );
382   - if ( keys %List ) {
383   - $result = $id;
384   - return $result;
385   - }
386   - }
387   - }
  52 + # If a ticket was received, it means the user is already authenticated
  53 + $Self->Debug("Checking if user was authenticated");
  54 + if ( $ParamObject->GetParam( Param => "ticket" ) ) {
  55 + my $retorno = $LayoutObject->Redirect( OP => "Action=NewTicketWizard", );
  56 + $retorno =~ s/public/customer/g;
  57 + return $retorno;
388 58 }
389 59  
390   - return $result;
391   -}
392   -
393   -sub CreateTicket {
394   - my ( $Self, %Param ) = @_;
395   - my %Data = ();
396   -
397   - my $TicketObject = $Kernel::OM->Get("Kernel::System::Ticket");
398   - my $ConfigObject = $Kernel::OM->Get("Kernel::Config");
399   - my $ParamObject = $Kernel::OM->Get("Kernel::System::Web::Request");
400   - my $BackendObject = $Kernel::OM->Get("Kernel::System::DynamicField::Backend");
401   - my $DynamicFieldObject = $Kernel::OM->Get("Kernel::System::DynamicField");
402   - my $CustomerUserObject = $Kernel::OM->Get("Kernel::System::CustomerUser");
403   - my $LayoutObject = $Kernel::OM->Get("Kernel::Output::HTML::Layout");
404   -
405   - # Queue
406   - my $queueFixed = 0;
407   - if ($Data{QueueID}) {
408   - $queueFixed = 1;
409   - }
410   - my ( $Queue, $QueueID ) = $Self->GetQueueID(%Param);
411   - $Data{QueueID} = $QueueID;
412   -
413   - $Self->{Config} = $ConfigObject->Get("Ticket::Frontend::CustomerTicketMessage");
414   -
415   - my $TicketID = $TicketObject->TicketCreate(
416   - Title => $ParamObject->GetParam( Param => "subject" ),
417   - QueueID => $QueueID,
418   - Priority => $Self->{Config}->{PriorityDefault},
419   - Lock => 'unlock',
420   - State => 'new',
421   - ServiceID => $ParamObject->GetParam( Param => "service" ),
422   - TypeID =>$ParamObject->GetParam( Param => "type" ),
423   - CustomerID => $Self->GetUserIDFromEmail( $ParamObject->GetParam( Param => "email" ) ),
424   - CustomerUser => $Self->GetUserIDFromEmail( $ParamObject->GetParam( Param => "email" ) ),
425   - OwnerID => $Self->{DefaultUserID},
426   - UserID => $Self->{DefaultUserID},
427   - );
428   -
429   - my $MimeType = 'text/html';
430   - my %serviceFieldsValues = ();
431   - my $serviceFields = "";
432   - my @serviceFieldsKeys = ();
433   -
434   - # Service Fields
435   - for ( $ParamObject->GetParamNames() ) {
436   - if (( substr( $_, 0, 3 ) eq "SF_" ) && ( substr( $_, 0, 5 ) ne "SF_T_" )) {
437   - if ($ParamObject->GetArray( Param => $_ )) {
438   - my @paramVals = $ParamObject->GetArray( Param => $_ );
439   - for my $paramValue (@paramVals) {
440   - if (($paramValue) && (!($paramValue eq "-"))) {
441   - if (! $serviceFieldsValues{$_}) {
442   - $serviceFieldsValues{$_} = $paramValue;
443   - push @serviceFieldsKeys, $_;
444   - } else {
445   - $serviceFieldsValues{$_} .= ", " . $paramValue;
446   - }
447   - }
448   - }
449   -
450   - } else {
451   - my $paramValue = $ParamObject->GetParam( Param => $_ );
452   -
453   - if (($paramValue) && (!($paramValue eq "-"))) {
454   - if (! $serviceFieldsValues{$_}) {
455   - $serviceFieldsValues{$_} = $paramValue;
456   - push @serviceFieldsKeys, $_;
457   - } else {
458   - $serviceFieldsValues{$_} .= ", " . $paramValue;
459   - }
460   - }
461   - }
462   - }
463   - }
464   -
465   - for (@serviceFieldsKeys) {
466   - $serviceFields .= "<B>" . $Self->breakWords(Text => substr( $_, 3 )) . ": </B>" . $serviceFieldsValues{$_} . "<BR/>";
467   - }
468   -
469   -
470   - $serviceFields .= "<B>IP: </B>" . $ENV{'REMOTE_ADDR'} . "<BR/>";
471   - $serviceFields .= "<BR/><BR/>";
472   -
473   - # Dynamic Fields
474   - for ( $ParamObject->GetParamNames() ) {
475   - if ( substr( $_, 0, 3 ) eq "DF_" ) {
476   - my $Success = $BackendObject->ValueSet(
477   - DynamicFieldConfig => $DynamicFieldObject->DynamicFieldGet( Name => substr( $_, 3 ) ),
478   - ObjectID => $TicketID,
479   - Value => $ParamObject->GetParam( Param => $_ ),
480   - UserID => $Self->{DefaultUserID},
481   - );
482   - }
  60 + # If an authenticate parameter was received, redirect to CAS gateway
  61 + $Self->Debug("Checking if authenticate parameter was received");
  62 + if ( $ParamObject->GetParam( Param => "authenticate" ) ) {
  63 + $Self->Debug("Authenticate parameter received");
  64 + my $url =
  65 + $ConfigObject->Get('Customer::AuthModule::CAS::CASUrl')
  66 + . "/login?gateway=true&service="
  67 + . "https://"
  68 + . $ENV{SERVER_NAME}
  69 + . $ENV{SCRIPT_NAME}
  70 + . "?Action=NewTicketWizardPublic";
  71 + return $LayoutObject->Redirect( ExtURL => $url, );
483 72 }
  73 +
  74 + # If no authentication was possible, proceed with public ticket opening
  75 + $Self->Debug("Public ticket started");
  76 + $Self->Debug("Subaction => " . $ParamObject->GetParam( Param => "Subaction" ));
484 77  
485   - # Service Fields - Table fields
486   - my $lastTab = "";
487   - my %keysFound = ();
488   - my $newTab = 1;
489 78  
490   - for ( $ParamObject->GetParamNames() ) {
491   - if ( substr( $_, 0, 5 ) eq "SF_T_" ) {
492   - my $paramName = $_;
493   - my @parts = split('_', $_);
494   - my $currTab = $parts[2];
495   - my $currKey = $parts[4];
496   -
497   - if ($currTab ne $lastTab) {
498   - if ($lastTab ne "") {
499   - $serviceFields .= "</TABLE><BR/><BR/>";
500   - }
501   - $serviceFields .= "<TABLE style='border-collapse: collapse; width: 700px;' border='1px'>";
502   - $lastTab = $currTab;
503   - $newTab = 1;
504   - } else {
505   - $newTab = 0;
506   - }
507   -
508   - ## new line due to repetition or new table
509   - if ($keysFound{$currKey} || ($newTab) ) {
510   - %keysFound = ();
511   - $serviceFields .= "<TR><TD COLSPAN='2' style='text-align: center; font-size: large'><B>" . $Self->breakWords(Text => $currTab) . "</B></TD></TR>";
512   - }
513   - $keysFound{$currKey} = 1;
514   - $serviceFields .= "<TR><TD style='width: 100px;'><B>" . $Self->breakWords(Text => $currKey) . "</B></TD><TD>" . $ParamObject->GetParam( Param => $paramName ) . "</TD></TR>";
  79 + if ( $ParamObject->GetParam( Param => "UploadFileCmd" )) {
  80 + $Self->Debug("File upload instruction received");
  81 + return $TicketWizard->UploadFile();
  82 + } elsif ( $ParamObject->GetParam( Param => "Subaction" ) ) {
  83 + if ( $ParamObject->GetParam( Param => "Subaction" ) eq "CreateTicket" ) {
  84 + $Self->Debug("Create ticket action received");
  85 + return $TicketWizard->CreateTicket(Public => 1);
515 86 }
  87 + elsif ( $ParamObject->GetParam( Param => "Subaction" ) eq "GetFormJSON" ) {
  88 + $Self->Debug("Service form requested received");
  89 + return $TicketWizard->GetFormJSON( Public=> 1, ServiceID => $ParamObject->GetParam( Param => "ServiceID" ) );
  90 + } elsif ( $ParamObject->GetParam( Param => "Subaction" ) eq "GetFormCustomProps" ) {
  91 + $Self->Debug("Service form custom properties (script) requested");
  92 + return $TicketWizard->GetFormCustomProps( Public=> 1, ServiceID => $ParamObject->GetParam( Param => "ServiceID" ) );
  93 + }
  94 + } else {
  95 + $Self->Debug("Default action - open service choosing form");
  96 + return $TicketWizard->OpenForm(Public => 1);
516 97 }
517   -
518   - if ($lastTab ne "") {
519   - $serviceFields .= "</TABLE><BR/><BR/>";
520   - }
521   -
522   -
523   - # Create article
524   - my $FullName = $ParamObject->GetParam( Param => "name" );
525   - my $Email = $ParamObject->GetParam( Param => "email" );
526   - my $From = "\"$FullName\" <$Email>";
527   - my $ArticleID = $TicketObject->ArticleCreate(
528   - TicketID => $TicketID,
529   - ArticleType => $Self->{Config}->{ArticleType},
530   - SenderType => $Self->{Config}->{SenderType},
531   - From => $From,
532   - To => $Queue,
533   - Subject => $ParamObject->GetParam( Param => "subject" ),
534   - Body => $serviceFields . $ParamObject->GetParam( Param => "description" ),
535   - MimeType => $MimeType,
536   - Charset => $LayoutObject->{UserCharset},
537   - UserID => $Self->{DefaultUserID},
538   - HistoryType => $Self->{Config}->{HistoryType},
539   - HistoryComment => $Self->{Config}->{HistoryComment} || '%%',
540   - AutoResponseType => ( $ConfigObject->Get('AutoResponseForWebTickets') )
541   - ? 'auto reply'
542   - : '',
543   - OrigHeader => {
544   - From => $From,
545   - To => $Queue,
546   - Subject => $ParamObject->GetParam( Param => "subject" ),
547   - Body => $serviceFields . $Self->lineBreakToHTML(Text => $ParamObject->GetParam( Param => "description" )),
548   - },
549   - Queue => $Queue,
550   - );
551   -
552   - # Attachments
553   - my %UploadStuff = $ParamObject->GetUploadAll( Param => "attachment" );
554   -
555   - if (keys %UploadStuff) {
556   - $TicketObject->ArticleWriteAttachment(
557   - %UploadStuff,
558   - ArticleID => $ArticleID,
559   - UserID => $Self->{DefaultUserID},
560   - );
561   - }
562   -
563   - $Data{TicketNumber} = $TicketObject->TicketNumberLookup( TicketID => $TicketID );
564   - $Self->{ConfigNTW} = $ConfigObject->Get("Ticket::Frontend::Customer::NewTicketWizard");
565   - my $idCustomTemplate = $Self->{ConfigNTW}->{"CustomTemplate"};
566   -
567   -
568   - # build output
569   - if (! $queueFixed) {
570   - delete $Data{QueueID}
571   - }
572   - my $Output = $LayoutObject->CustomerHeader(Type => $idCustomTemplate, Title => "Ticket created" );
573   - $Output .= $LayoutObject->Output(
574   - Data => \%Data,
575   - TemplateFile => 'NewTicketWizardTicketCreatedPublic',
576   - );
577   - $Output .= $LayoutObject->CustomerFooter(Type => $idCustomTemplate);
578   - return $Output;
579   -
580 98 }
581 99  
582   -sub AdjustFixedFields {
583   - my ( $Self, %Param ) = @_;
584   - my $schema = $Param{Schema};
585   - my $form = $Param{Fields};
586   - my $fixedValues = $Param{FixedValues};
587   -
588   - my @values = split(/\n/, $fixedValues);
589   -
590   - for my $value (@values) {
591   -
592   - $value =~ s/\r//g;
593   - my @data = split('=', $value);
594   -
595   - my $fieldKey = $data[0];
596   - my $fixedValue = $data[1];
597   -
598   - my $key = '("' . $fieldKey . '"[\ ]?:[\ ]?{[^}]+})';
599   - my $replace = '"' . $fieldKey . '"' . ': {"type": "string", "default": "' . $fixedValue . '"}';
600   -
601   - $schema =~ s/$key/$replace/;
602   -
603   - $key = '("' . $fieldKey . '"[\ ]?:[\ ]?{[^}]+})';
604   - $replace = '"' . $fieldKey . '": {"type": "hidden"' . "\n}";
605   - $form =~ s/$key/$replace/;
606   - }
607   -
608   - return ($schema, $form);
609   -
610   -}
611   -
612   -sub lineBreakToHTML {
613   - my ( $Self, %Param ) = @_;
614   -
615   - my $return = $Param{Text};
616   - my $LINE_BREAK = "<BR/>";
617   -
618   - $return =~ s/\n/$LINE_BREAK/g;
619   -
620   - return $return;
621   -
622   -}
623   -
624   -sub breakWords {
625   - my ( $Self, %Param ) = @_;
626   -
627   - my $return = $Param{Text};
628   -
629   - $return =~ s/(.)([A-Z][^A-Z])/$1 $2/g;
630   - $return =~ s/([\w']+)/\u\L$1/g;
631   -
632   - return $return;
  100 +sub Debug {
  101 + my $Self = shift;
  102 + my $msg = shift;
  103 + $Kernel::OM->Get("Kernel::System::Log")->Log( Priority => 'debug', Message => $msg );
633 104 }
634 105  
635 106 1;
... ...
Kernel/Modules/NewTicketWizardServiceForm.pm 100644 → 100755
Kernel/Output/HTML/Templates/Standard/CustomerFooterNTWSeTIC.tt
... ... @@ -7,24 +7,16 @@
7 7 # did not receive this file, see http://www.gnu.org/licenses/agpl.txt.
8 8 # --
9 9  
10   -<div id="footerF" align="center" style="bottom: 10px; width: 100%; margin-top: 18px; margin-bottom: 8px;" class="noPrint">
11   -
12   -<div style="font-size: 0px;">
13   -<div style="height: 2px; width: 100%; background-image: url('/otrs-web/skins/Customer/default/images/ufsc/separador.gif'); background-repeat: repeat-x; background-position: 0 50%;"></div>
14   -</div>
15   - <br><a href="http://www.setic.ufsc.br" target="_blank"><img src="/otrs-web/skins/Customer/default/images/ufsc/setic.png" style="border-style: none"></a>
16   - <br>
17   - <div style="margin-top: 4px;"><span style="color: #BBBBBB;">© SeTIC - Superintendência de Governança Eletrônica e Tecnologia da Informação e Comunicação</span>
18   - </div>
19   - <div id="Footer" class="ARIARoleContentinfo">
20   -[% RenderBlockStart("Banner") %]
21   - <a href="http://www.otrs.com/" title="[% Config("Product") %] [% Config("Version") %]" target="_blank">[% Translate("Powered by") | html %] [% Config("Product") %] [% Config("Version").remove('\.0\..*') %]</a>
22   -[% RenderBlockEnd("Banner") %]
23   - <div class="Clear"></div>
24   -</div>
25 10 </div>
26 11  
27   -
  12 +<div id="footerF" align="center" style="bottom: 10px; width: 100%; margin-top: 18px; margin-bottom: 8px;" class="noPrint">
  13 + <div style="font-size: 0px;">
  14 + <div style="height: 2px; width: 100%; background-image: url('/otrs-web/skins/Customer/default/images/ufsc/separador.gif'); background-repeat: repeat-x; background-position: 0 50%;"></div>
  15 + </div>
  16 + <br><a href="http://www.setic.ufsc.br" target="_blank"><img alt="Logo SeTIC" src="/otrs-web/skins/Customer/default/images/ufsc/setic.png" style="border-style: none"></a>
  17 + <br>
  18 + <div style="margin-top: 4px;"><span style="color: #BBBBBB;">© SeTIC - Superintendência de Governança Eletrônica e Tecnologia da Informação e Comunicação</span></div>
  19 +</div>
28 20  
29 21  
30 22 [% InsertTemplate("CustomerFooterJS.tt") %]
... ...
Kernel/Output/HTML/Templates/Standard/CustomerHTMLHeadNTWSeTIC.tt
... ... @@ -7,21 +7,7 @@
7 7 # --
8 8 <head>
9 9 <meta http-equiv="Content-type" content="text/html;charset=utf-8" />
10   - <meta id="viewport" name="viewport" content="">
11   -# set viewport for mobile mode, do not set viewport for DesktopMode
12   - <script>
13   - (function(doc, win) {
14   - var viewport = doc.getElementById('viewport'),
15   - isIFrame = (win.top.location.href !== win.location.href),
16   - isPopup = (win.name.search(/^OTRSPopup_/) != -1);
17   - try {
18   - if (((!isIFrame && !isPopup) || (isIFrame && isPopup)) && (!localStorage.getItem("DesktopMode") || parseInt(localStorage.getItem("DesktopMode"), 10) <= 0)) {
19   - viewport.setAttribute("content", "width=device-width, initial-scale=1.0, user-scalable=no");
20   - }
21   - }
22   - catch (Exception) {}
23   - }(document, window));
24   - </script>
  10 + <meta name="viewport" content="width=device-width, initial-scale=1">
25 11 [% RenderBlockStart("MetaHttpEquivRefresh") %]
26 12 [% INCLUDE "HTMLHeadRefresh.tt" %]
27 13 [% RenderBlockEnd("MetaHttpEquivRefresh") %]
... ... @@ -42,248 +28,30 @@
42 28 <link rel="stylesheet" type="text/css" href="[% Config("Frontend::WebPath") %]skins/Customer/default/css/thirdparty/ui-theme/jquery-ui.css" />
43 29 <link rel="stylesheet" type="text/css" href="[% Config("Frontend::WebPath") %]skins/Customer/default/css/thirdparty/jstree-theme/default/style.css" />
44 30  
45   -[% RenderBlockStart("HeaderLogoCSS") %]
46   - <style type="text/css">
47   - #Header #Logo {
48   - background-image: [% Data.URL | html %];
49   - top: [% Data.StyleTop | html %];
50   - right: [% Data.StyleRight | html %];
51   - width: [% Data.StyleWidth | html %];
52   - height: [% Data.StyleHeight | html %];
53   - }
54   - </style>
55   -[% RenderBlockEnd("HeaderLogoCSS") %]
56   -
57   - <style type="text/css">
58   - @font-face {
59   - font-family: 'FontAwesome';
60   - src: url('[% Config("Frontend::WebPath") %]skins/Customer/default/css/thirdparty/fontawesome/fontawesome-webfont.eot?v=4.3.0');
61   - src: url('[% Config("Frontend::WebPath") %]skins/Customer/default/css/thirdparty/fontawesome/fontawesome-webfont.eot?#iefix&v=4.3.0') format('embedded-opentype'),
62   - url('[% Config("Frontend::WebPath") %]skins/Customer/default/css/thirdparty/fontawesome/fontawesome-webfont.woff?v=4.3.0') format('woff'),
63   - url('[% Config("Frontend::WebPath") %]skins/Customer/default/css/thirdparty/fontawesome/fontawesome-webfont.ttf?v=4.3.0') format('truetype'),
64   - url('[% Config("Frontend::WebPath") %]skins/Customer/default/css/thirdparty/fontawesome/fontawesome-webfont.svg#fontawesomeregular?v=4.3.0') format('svg');
65   - font-weight: normal;
66   - font-style: normal;
67   - }
68   -
69   - /* Fix poor font rendering on chrome based browsers on windows */
70   - @media all and (-webkit-min-device-pixel-ratio:0) {
71   - @font-face {
72   - font-family: 'FontAwesome';
73   - src: url('[% Config("Frontend::WebPath") %]skins/Customer/default/css/thirdparty/fontawesome/fontawesome-webfont.svg#fontawesomeregular') format('svg'),
74   - url('[% Config("Frontend::WebPath") %]skins/Customer/default/css/thirdparty/fontawesome/fontawesome-webfont.eot?#iefix&v=4.3.0') format('embedded-opentype'),
75   - url('[% Config("Frontend::WebPath") %]skins/Customer/default/css/thirdparty/fontawesome/fontawesome-webfont.woff?v=4.3.0') format('woff'),
76   - url('[% Config("Frontend::WebPath") %]skins/Customer/default/css/thirdparty/fontawesome/fontawesome-webfont.ttf?v=4.3.0') format('truetype');
77   - font-weight: normal;
78   - font-style: normal;
79   - }
80   - }
81   - </style>
82   -
83   -# decide, if responsive CSS must be loaded
84   -# resposive CSS will not be loaded in "desktop mode" or if the document is within an iframe (customer overview in ticket phone overlay)
85   - <script>
86   - (function(doc, win) {
87   - var isIFrame = (win.top.location.href !== win.location.href),
88   - isPopup = (win.name.search(/^OTRSPopup_/) != -1);
89   - try {
90   - if (((!isIFrame && !isPopup) || (isIFrame && isPopup)) && (!localStorage.getItem("DesktopMode") || parseInt(localStorage.getItem("DesktopMode"), 10) <= 0)) {
91   - var ResponsiveCSS;
92   - [% RenderBlockStart("ResponsiveCSS") %]
93   - ResponsiveCSS = doc.createElement("link");
94   - ResponsiveCSS.setAttribute("rel", "stylesheet");
95   - ResponsiveCSS.setAttribute("type", "text/css");
96   - ResponsiveCSS.setAttribute("href", "[% Config("Frontend::WebPath") %]skins/Customer/[% Data.Skin | uri %]/[% Data.CSSDirectory %]/[% Data.Filename %]");
97   - doc.getElementsByTagName("head")[0].appendChild(ResponsiveCSS);
98   - [% RenderBlockEnd("ResponsiveCSS") %]
99   - }
100   - }
101   - catch (Exception) {}
102   - }(document, window));
103   - </script>
104   -
105 31 <title>[% Data.TitleArea | html %] [% Config("ProductName") %]</title>
106 32  
107 33 [% INCLUDE "HTMLHeadBlockEvents.tt" %]
108 34  
109   -<!-- Customizacoes SeTIC -->
  35 + <!-- Customizacoes SeTIC -->
110 36 <style type="text/css">
111   -
112   -
113 37 #header {
114   - height: 90px;
115 38 background-image: url("/otrs-web/skins/Customer/default/images/ufsc/cabecalhoUFSC.jpg");
116   - background-position: bottom left;
117   - padding-left: 30px;
118   - padding-top: 0px;
119   - font-family: Verdana, Arial, sans-serif;
120   - margin-bottom: 20px;
121   - }
122   -
123   - .tabstyles {
124   - border-collapse: separate;
125   - display: inline;
126   - font-family: Verdana, Arial, sans-serif;
127   - font-size: 11px;
128   - height: auto;
129   - margin-bottom: 0px;
130   - margin-left: 0px;
131   - margin-right: 0px;
132   - margin-top: 0px;
133   - padding-bottom: 0px;
134   - padding-left: 0px;
135   - padding-right: 0px;
136   - padding-top: 0px;
137   - width: auto;
138   -vertical-align: bottom;
  39 + display: block;
  40 + height: 90px;
139 41 }
140 42  
141   - .atalhoMenuLogo {
142   - text-align: right;
143   - vertical-align: bottom;
144   - color: #0000ee;
  43 + input[type=text], input[type=email], input[type=password] {
  44 + width: 100%;
145 45 }
146 46  
147   - .titleText {
148   - FONT-SIZE: 16px;
149   - FONT-WEIGHT: bold;
150   - FONT-FAMILY: Arial, Helvetica, sans-serif;
151   - text-align: left;
152   - margin-left: 10px;
153   -}
154   -
155   -body {
156   - background: white;
157   - FONT-FAMILY: Arial, Helvetica, sans-serif;
158   - text-align: left;
159   - font-size: 12px;
160   -}
161   -
162   -
163   - #Navigation {
164   - background-image: url('/otrs-web/skins/Customer/default/images/ufsc/panel_hd_bg_setic.png');
165   - background-repeat: repeat-x;
166   - background-position: 0 50%;
167   - border: 1px solid #9CABC1;
  47 + label {
  48 + font-size: 100%;
  49 + text-align: left;
  50 + display: inline-block;
  51 + float: none;
  52 + width: auto;
168 53 }
169 54  
170   - #Navigation ul.Expanded {
171   - background-color: rgb(249, 251, 254);
172   -background-image: none;
173   -background-origin: padding-box;
174   -background-size: auto;
175   -border-bottom-color: rgb(192, 192, 192);
176   -border-bottom-left-radius: 0px;
177   -border-bottom-right-radius: 0px;
178   -border-bottom-style: solid;
179   -border-bottom-width: 1px;
180   -border-image-outset: 0px;
181   -border-image-repeat: stretch;
182   -border-image-slice: 100%;
183   -border-image-source: none;
184   -border-image-width: 1;
185   -border-left-color: rgb(192, 192, 192);
186   -border-left-style: solid;
187   -border-left-width: 1px;
188   -border-right-color: rgb(192, 192, 192);
189   -border-right-style: solid;
190   -border-right-width: 1px;
191   -border-top-color: rgb(192, 192, 192);
192   -border-top-left-radius: 0px;
193   -border-top-right-radius: 0px;
194   -border-top-style: solid;
195   -border-top-width: 1px;
196   -box-shadow: rgba(0, 0, 0, 0.8) 0px 5px 10px 0px;
197   -color: rgb(0, 0, 0);
198   -display: block;
199   -}
200   -
201   - #Navigation > ul > li > ul {
202   - background-attachment: scroll;
203   - background-clip: border-box;
204   - background-color: rgb(249, 251, 254);
205   - background-image: none;
206   - background-origin: padding-box;
207   - border-bottom-color: rgb(192, 192, 192);
208   - border-bottom-left-radius: 0px;
209   - border-bottom-right-radius: 0px;
210   - border-bottom-style: solid;
211   - border-bottom-width: 1px;
212   - border-image-outset: 0px;
213   - border-image-repeat: stretch;
214   - border-image-slice: 100%;
215   - border-image-source: none;
216   - border-image-width: 1;
217   - border-left-color: rgb(192, 192, 192);
218   - border-left-style: solid;
219   - border-left-width: 1px;
220   - border-right-color: rgb(192, 192, 192);
221   - border-right-style: solid;
222   - border-right-width: 1px;
223   - border-top-color: rgb(192, 192, 192);
224   - border-top-left-radius: 0px;
225   - border-top-right-radius: 0px;
226   - border-top-style: solid;
227   - border-top-width: 1px;
228   - box-shadow: rgba(0, 0, 0, 0.8) 0px 5px 10px 0px;
229   - }
230   -
231   - #Navigation > ul > li > ul a {
232   - background-color: rgb(249, 251, 254);
233   - border-bottom-color: rgba(0, 0, 0, 0);
234   - border-bottom-left-radius: 0px;
235   - border-bottom-right-radius: 0px;
236   - border-bottom-style: solid;
237   - border-bottom-width: 1px;
238   - border-image-outset: 0px;
239   - border-image-repeat: stretch;
240   - border-image-slice: 100%;
241   - border-image-source: none;
242   - border-image-width: 1;
243   - border-left-color: rgba(0, 0, 0, 0);
244   - border-left-style: solid;
245   - border-left-width: 1px;
246   - border-right-color: rgba(0, 0, 0, 0);
247   - border-right-style: solid;
248   - border-right-width: 1px;
249   - border-top-color: rgba(0, 0, 0, 0);
250   - border-top-left-radius: 0px;
251   - border-top-right-radius: 0px;
252   - border-top-style: solid;
253   - border-top-width: 1px;
254   - color: rgb(0, 0, 0);
255   - cursor: pointer;
256   - display: block;
257   - float: left;
258   - font-family: Verdana, Arial, sans-serif;
259   - font-size: 11px;
260   - font-weight: normal;
261   - height: 16px;
262   - line-height: 16px;
263   - list-style-image: none;
264   - list-style-position: outside;
265   - list-style-type: none;
266   - margin-bottom: 0px;
267   - margin-left: 0px;
268   - margin-right: 0px;
269   - margin-top: 0px;
270   - outline-color: rgb(0, 0, 0);
271   - outline-style: none;
272   - outline-width: 0px;
273   - padding-bottom: 6px;
274   - padding-left: 0px;
275   - padding-right: 6px;
276   - padding-top: 1px;
277   - text-align: left;
278   - text-decoration: none;
279   - white-space: nowrap;
280   - width: 148.188px;
281   - }
282   -
283 55 </style>
284 56 <!-- Customizacoes SeTIC -->
285   -
286   -
287   -
288   -
289 57 </head>
... ...
Kernel/Output/HTML/Templates/Standard/CustomerHeaderNTWSeTIC.tt
1 1 # --
2 2 # CustomerHeaderQPUFSC.tt - provides global HTML header for UFSC
3   -# Copyright (C) 2015, SeTIC - UFSC - http://setic.ufsc.br/
  3 +# Copyright (C) 2015 - 2017 SeTIC - UFSC - http://setic.ufsc.br/
  4 +#
  5 +# Version 2017-06-16 - Support for bootstrap
  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
... ... @@ -8,34 +11,17 @@
8 11 # --
9 12 [%- INCLUDE "HTTPHeaders.tt" -%]
10 13  
11   -<!DOCTYPE html>
12   -<html>
  14 +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
  15 +<html lang="br">
13 16 [% InsertTemplate("Copyright.tt") %]
14 17 [% InsertTemplate("CustomerHTMLHeadNTWSeTIC.tt") %]
15 18  
16   -<body class="NoJavaScript" [% Data.BodyClass | html %]>
17   - <div id="header" class="noPrint">
18   - <table border="0" width="100%">
19   - <tbody>
20   - <tr style="height: 88px; vertical-align: bottom;">
21   - <td class="atalhoMenuLogo"><span class="tabstyles">
22   - <a href="http://servicosti.ufsc.br/">Catálogo de serviços</a></span>
23   - </td>
24   - </tr>
25   - </tbody>
26   - </table>
27   - </div>
28   - <table id="titulo" width="100%" cellpadding="0" cellspacing="0">
29   - <tbody>
30   - <tr>
31   - <td align="left" valign="top"><span class="titleText">SeTIC - Portal de Chamados</td>
32   - <td align="left" valign="top" width="1"></td>
33   - </tr>
34   - </tbody>
35   - </table>
36   - <div style="font-size: 0px;">
37   - <div style="height: 2px; width: 100%; background-image: url('/otrs-web/skins/Customer/default/images/ufsc/separador.gif'); background-repeat: repeat-x; background-position: 0 50%;"></div>
38   - </div>
39   -
  19 +<body lang="br" class="NoJavaScript" [% Data.BodyClass | html %]>
  20 +
  21 + <div class="panel"> <div class="panel-heading " id="header"/></div>
  22 +
  23 + <div class="container">
  24 +
  25 +
40 26  
41 27 <!-- end header -->
... ...
Kernel/Output/HTML/Templates/Standard/NewTicketWizard.tt 100644 → 100755
... ... @@ -10,63 +10,117 @@
10 10 # did not receive this file, see http://www.gnu.org/licenses/agpl.txt.
11 11 # --
12 12  
13   -<div style="margin: 5px; padding: 10px; width: 80%;">
14   -[% Data.MsgChooseService %]
15   -<div style="margin-top: 10px">
16   -<form class="Field">
17   -
18   -<span class="alpaca-controlfield-label">
19   - [% Translate("Service") | html %]:
20   - </span>
21   - <span id="serviceDIV" class="alpaca-field" >
22 13  
23   - [% Data.ServiceStrg %]
24   - </span>
25   -</form>
26   -<div id="serviceDescription" style="margin: 5px; padding: 10px; width: 80%; border-style:solid; border-width: 1px; display: none"></div>
27   -</div>
28   -</div>
29   -<div id="formTicket" style="padding-left: 15px; ">
  14 +
  15 + <div class="btn-group pull-right">
  16 +[% RenderBlockStart("ToolBarPublic") %]
  17 + <a target="_new" href="http://ti.ufsc.br/">
  18 + <button type="button" class="btn-lg btn-default">
  19 + <span class="glyphicon glyphicon-list-alt" aria-hidden="true"></span>
  20 + Catálogo de serviços</button>
  21 + </a>
  22 +[% RenderBlockEnd("ToolBarPublic") %]
  23 +
  24 +[% RenderBlockStart("ToolBarCustomer") %]
  25 + <a target="_new" href="http://ti.ufsc.br/">
  26 + <button type="button" class="btn-lg btn-default">
  27 + <span class="glyphicon glyphicon-list-alt" aria-hidden="true"></span>
  28 + Catálogo de serviços
  29 + </button>
  30 + </a>
  31 + <a target="_new" href="/otrs/customer.pl?Action=CustomerTicketOverview;Subaction=MyTickets">
  32 + <button type="button" class="btn-lg btn-default">
  33 + <span class="glyphicon glyphicon-th-list" aria-hidden="true"></span>
  34 + Chamados abertos
  35 + </button>
  36 + </a>
  37 +
  38 +[% RenderBlockEnd("ToolBarCustomer") %]
  39 + </div>
  40 + <div class="panel">
  41 + <div class="panel-heading ">
  42 + <h1>SeTIC - Portal de Chamados</h1>
  43 +
  44 +
  45 + </div>
  46 + </div>
30 47  
31 48 [% RenderBlockStart("MaintenancesPanel") %]
32   -<span style="font-weight: bold; color: red">[% Translate("The following maintenances are in progress") | html %]</span>
33   -<br/>
34   -<br/>
35   -<ol style="margin-left: 20px; padding: 10px; list-style-type:circle">
36   -[% RenderBlockStart("MaintenanceLine") %]
37   -<li>[% Data.Message %] ([% Translate("Started at: ") | html %] [% Data.StartDate %])</li>
38   -[% RenderBlockEnd("MaintenanceLine") %]
39   -</ol>
  49 +<div class="panel panel-warning">
  50 + <div class="panel-heading">
  51 + <span class="glyphicon glyphicon-warning-sign" aria-hidden="true"></span> <strong>[% Translate("The following maintenances are in progress") | html %]</strong>
  52 + </div>
  53 + <div class="panel-body">
  54 + <ol">
  55 + [% RenderBlockStart("MaintenanceLine") %]
  56 + <li>[% Data.Message %] ([% Translate("Started at: ") | html %] [% Data.StartDate %])</li>
  57 + [% RenderBlockEnd("MaintenanceLine") %]
  58 + </ol>
  59 + </div>
  60 +
  61 +</div>
40 62 [% RenderBlockEnd("MaintenancesPanel") %]
41 63  
  64 +<div class="panel panel-primary">
  65 + <div class="panel-heading">
  66 + <strong>[% Data.MsgChooseService %]</strong>
  67 + </div>
  68 +
  69 + <div class="panel-body">
  70 + <label for="ServiceID">[% Translate("Service") | html %]:</label>
  71 + <span id="serviceDIV">
  72 + [% Data.ServiceStrg %]
  73 + </span>
  74 + </div>
  75 +
  76 + <div class="panel-footer" id="serviceDescription">
  77 +[% RenderBlockStart("UnauthenticatedMessage") %]
  78 + [% Translate("Did you know that, if you have a login, you can authenticate first and do not have to provide your name and e-mail. Also, it will be possible to monitor your ticket later.") | html %]:
  79 + <A target="_new" HREF="/otrs/customer.pl?Action=NewTicketWizard">[% Translate("Click here to authenticate") | html %]</A>
  80 +[% RenderBlockEnd("UnauthenticatedMessage") %]
  81 + </div>
  82 +</div>
  83 +
  84 +<div class="panel panel-primary" style="display: none" id="formPanel">
  85 + <div class="panel-heading">
  86 + <strong>[% Translate("Please fill the following form to open your ticket") | html %]</strong>
  87 + </div>
  88 +
  89 + <div class="panel-body" id="formTicket">
  90 +
  91 + </div>
42 92 </div>
43 93  
44 94 <script src="[% Config("Frontend::RichTextPath") %]ckeditor.js" type="text/javascript"></script>
45 95  
46 96 [% WRAPPER JSOnDocumentComplete %]
47 97 <script type="text/javascript">
48   - // To turn on debugging, uncomment this line
49   - Alpaca.logLevel = Alpaca.DEBUG;
50   - Alpaca.uploadImageURL = "/otrs/customer.pl?Action=PictureUpload&responseType=json&FormID=[% Data.FormID %]";
51   - Alpaca.filebrowserImageUploadURL = "/otrs/customer.pl?Action=PictureUpload&FormID=[% Data.FormID %]";
  98 + CKEDITOR.config.filebrowserUploadUrl = "/otrs/public.pl?Action=PictureUpload&responseType=json&FormID=[% Data.FormID %]";
  99 +
  100 + $.alpaca.setDefaultLocale((navigator.languages ? navigator.languages[0] : (navigator.language || navigator.userLanguage)).replace("-","_"));
52 101  
53   - Alpaca.registerMessages({
  102 + $.alpaca.registerMessages({
54 103 "noneLabel": "-",
55   - "disallowValue": "{0} não é um valor válido.",
56   - "notOptional": "Este campo é obrigatório.",
57   - "invalidValueOfEnum": "",
58   - "addItemButtonLabel": "Incluir",
59   -
60 104 });
61 105  
62 106 $("#ServiceID").change(function() {
63   - carregaForm({"FormID": "[% Data.FormID %]"}, "[% Translate("Send") | html %]", "[% Env("CGIHandle") %]", ";QueueID=[% Data.QueueID %]");
  107 + if ($("#ServiceID").val() != "") {
  108 + carregaForm[% Data.PublicMode %]({"FormID": "[% Data.FormID %]"}, "[% Translate("Send") | html %]", "[% Env("CGIHandle") %]", ";QueueID=[% Data.QueueID %]", "[% Data.FormID %]");
  109 + $("#formPanel").show();
  110 + } else {
  111 + destruirForm();
  112 + $("#serviceDescription").html("");
  113 + $("#formPanel").hide();
  114 + }
64 115 });
65 116  
66 117 if ($("#ServiceID").has('[selected]')) {
67 118 if ($("#ServiceID").val() != "") {
68   - carregaForm({"FormID": "[% Data.FormID %]"}, "[% Translate("Send") | html %]", "[% Env("CGIHandle") %]", ";QueueID=[% Data.QueueID %]");
  119 + carregaForm[% Data.PublicMode %]({"FormID": "[% Data.FormID %]"}, "[% Translate("Send") | html %]", "[% Env("CGIHandle") %]", ";QueueID=[% Data.QueueID %]", "[% Data.FormID %]");
  120 + $("#formPanel").show();
69 121 }
70 122 }
  123 +
  124 + $("#ResponsiveFooter").remove();
71 125 </script>
72 126 [% END %]
73 127 \ No newline at end of file
... ...
Kernel/Output/HTML/Templates/Standard/NewTicketWizardServiceForm.tt 100644 → 100755
Kernel/Output/HTML/Templates/Standard/NewTicketWizardServiceFormEdit.tt 100644 → 100755
Kernel/Output/HTML/Templates/Standard/NewTicketWizardTicketCreated.tt 100644 → 100755
... ... @@ -9,13 +9,21 @@
9 9 # the enclosed file COPYING for license information (AGPL). If you
10 10 # did not receive this file, see http://www.gnu.org/licenses/agpl.txt.
11 11 # --
12   -<div style="margin: 5px; padding: 10px; width: 80%;">
13   - <h1>[% Translate("Your ticket has been registered with the number: ") | html %][% Data.TicketNumber %]</h1>
14   - </div>
15   -
16   - <div style="margin: 5px; padding: 10px; width: 80%;">
17   - <A HREF="/otrs/public.pl?Action=NewTicketWizardPublic">[% Translate("Click here to open another ticket") | html %]</A>
18   - </div>
19   -
  12 +
  13 +<div class="panel panel-primary">
  14 + <div class="panel-heading">
  15 + <strong>[% Translate("Ticket created") | html %]</strong>
  16 + </div>
  17 +
  18 + <div class="panel-body">
  19 + <h2>[% Translate("Your ticket has been registered with the number: ") | html %]<strong>[% Data.TicketNumber %]</strong></h2>
  20 + <div class="btn-group-vertical pull-right" style="margin-top: 50px">
  21 + <button type="button" class="btn btn-default">
  22 + <a href="/otrs/[% Data.Module %].pl?Action=NewTicketWizard[% Data.PublicMode %]">[% Translate("Click here to open another ticket") | html %]</a>
  23 + </button>
  24 + </div>
  25 + </div>
  26 +</div>
  27 +
20 28 [% WRAPPER JSOnDocumentComplete %]
21 29 [% END %]
22 30 \ No newline at end of file
... ...
Kernel/System/RestrictedService.pm 100644 → 100755
Kernel/System/ServiceForm.pm 100644 → 100755
Kernel/System/TicketWizard.pm 100644 → 100755
... ... @@ -3,6 +3,7 @@
3 3 #
4 4 # Copyright (C) SeTIC - UFSC - http://setic.ufsc.br/
5 5 # Version 01/12/2015 - Support for OTRS 4.0.3
  6 +# Version 2017-06-20 - Code refactoring
6 7 #
7 8 # --
8 9 # This software comes with ABSOLUTELY NO WARRANTY. For details, see
... ... @@ -14,11 +15,14 @@ package Kernel::System::TicketWizard;
14 15 use strict;
15 16 use warnings;
16 17 use utf8;
  18 +use Data::Dumper;
  19 +use URI::Escape;
  20 +use Encode qw( encode_utf8 decode_utf8 );
  21 +use JSON qw(encode_json decode_json);
17 22  
18 23 our @ObjectDependencies = (
19 24 "Kernel::System::Web::Request",
20 25 "Kernel::System::DB",
21   -"Kernel::Output::HTML::Layout",
22 26 "KerneL::System::Log",
23 27 "KerneL::System::Ticket",
24 28 "KerneL::System::Type",
... ... @@ -41,56 +45,40 @@ sub new {
41 45 }
42 46  
43 47 =head
44   -
45 48 Returns fields structure for new ticket form wizard public
46   -
47 49 =cut
48   -
49 50 sub GetBasicFieldsOptionsPublic {
50 51 my ( $Self, %Param ) = @_;
51 52 return $Kernel::OM->Get("Kernel::Config")->Get("Ticket::Frontend::Customer::NewTicketWizard")->{BasicFormPublic};
52 53 }
53 54  
54 55 =head
55   -
56 56 Returns fields schema for new ticket wizard public
57   -
58 57 =cut
59   -
60 58 sub GetBasicFieldsSchemaPublic {
61 59 my ( $Self, %Param ) = @_;
62 60 return $Kernel::OM->Get("Kernel::Config")->Get("Ticket::Frontend::Customer::NewTicketWizard")->{BasicSchemaPublic};
63 61 }
64 62  
65   -
66 63 =head
67   -
68 64 Returns fields structure for new ticket form wizard
69   -
70 65 =cut
71   -
72 66 sub GetBasicFieldsOptions {
73 67 my ( $Self, %Param ) = @_;
74 68 return $Kernel::OM->Get("Kernel::Config")->Get("Ticket::Frontend::Customer::NewTicketWizard")->{BasicForm};
75 69 }
76 70  
77 71 =head
78   -
79 72 Returns fields schema for new ticket wizard
80   -
81 73 =cut
82   -
83 74 sub GetBasicFieldsSchema {
84 75 my ( $Self, %Param ) = @_;
85 76 return $Kernel::OM->Get("Kernel::Config")->Get("Ticket::Frontend::Customer::NewTicketWizard")->{BasicSchema};
86 77 }
87 78  
88 79 =head
89   -
90 80 Replaces OTRS system field values (service and type)
91   -
92 81 =cut
93   -
94 82 sub ReplaceOTRSValues {
95 83 my ( $Self, %Param ) = @_;
96 84 my $schema = $Param{Schema};
... ... @@ -107,6 +95,9 @@ sub ReplaceOTRSValues {
107 95 return ( $schema, $options );
108 96 }
109 97  
  98 +=head
  99 +Get OTRS services info (service and type)
  100 +=cut
110 101 sub GetOTRSServicesData {
111 102 my ( $Self, %Param ) = @_;
112 103 my $services = $Kernel::OM->Get("Kernel::System::Service");
... ... @@ -124,6 +115,9 @@ sub GetOTRSServicesData {
124 115 return ( $serviceNames, $serviceIDs );
125 116 }
126 117  
  118 +=head
  119 +Get OTRS ticket types
  120 +=cut
127 121 sub GetOTRSTypesData {
128 122 my ( $Self, %Param ) = @_;
129 123 my $ticketObject = $Kernel::OM->Get("Kernel::System::Ticket");
... ... @@ -145,6 +139,9 @@ sub GetOTRSTypesData {
145 139 return ( $typeNames, $typeIDs );
146 140 }
147 141  
  142 +=head
  143 +Replaces OTRS dynamic fields
  144 +=cut
148 145 sub ReplaceOTRSDynamicFields {
149 146 my ( $Self, %Param ) = @_;
150 147 my $schema = $Param{Schema};
... ... @@ -171,6 +168,9 @@ sub ReplaceOTRSDynamicFields {
171 168 return ( $schema, $options );
172 169 }
173 170  
  171 +=head
  172 +Get OTRS dyanmic field values
  173 +=cut
174 174 sub GetDynamicFieldValues {
175 175 my ( $Self, %Param ) = @_;
176 176 my $config = $Param{ConfigDF};
... ... @@ -190,4 +190,925 @@ sub GetDynamicFieldValues {
190 190  
191 191 }
192 192  
  193 +=head
  194 +Builds service choosing combo
  195 +=cut
  196 +sub BuildServices {
  197 + my ( $Self, %Param ) = @_;
  198 + my %Data = ();
  199 + my $ParamObject = $Kernel::OM->Get("Kernel::System::Web::Request");
  200 + my $QueueServiceObject = $Kernel::OM->Get("Kernel::System::QueueService");
  201 + my $ConfigObject = $Kernel::OM->Get("Kernel::Config");
  202 + my $ServiceObject = $Kernel::OM->Get("Kernel::System::Service");
  203 + my $RestrictedObject = $Kernel::OM->Get("Kernel::System::RestrictedService");
  204 +
  205 + # Build service chooser
  206 + my %Services = ();
  207 +
  208 + if ( !$ParamObject->GetParam( Param => "QueueID" ) ) {
  209 + %Services = $ServiceObject->ServiceList( UserID => $ConfigObject->Get('CustomerPanelUserID'), );
  210 + }
  211 + else {
  212 + %Services =
  213 + $QueueServiceObject->GetServiceList( QueueID => $ParamObject->GetParam( Param => "QueueID" ), );
  214 + }
  215 + my @ServicesCombo = ();
  216 +
  217 + my @restrictedServices = $RestrictedObject->GetRestrictedServices();
  218 +
  219 + for my $serviceID ( keys %Services ) {
  220 + if ( grep { index( $Services{$_}, $Services{$serviceID} . "::" ) >= 0 } ( keys %Services ) ) {
  221 + if (! ( $serviceID ~~ @restrictedServices ) ) {
  222 + my %serv = ();
  223 + $serv{Value} = $Services{$serviceID};
  224 + $serv{Key} = $serviceID;
  225 + $serv{Disabled} = 1;
  226 + push @ServicesCombo, \%serv;
  227 + }
  228 + }
  229 + else {
  230 + if (! ( $serviceID ~~ @restrictedServices ) ) {
  231 + my %serv = ();
  232 + $serv{Value} = $Services{$serviceID};
  233 + $serv{Key} = $serviceID;
  234 + push @ServicesCombo, \%serv;
  235 + }
  236 + }
  237 + }
  238 +
  239 + @ServicesCombo = sort { $a->{Value} . "::" cmp $b->{Value} . "::" } @ServicesCombo;
  240 +
  241 + my $retorno = "<select id=\"ServiceID\" data-live-search-normalize=\"true\" class=\"selectpicker\" data-live-search=\"true\">\n<option value=\"\">-</option>";
  242 + my $inOpt = 0;
  243 +
  244 + for my $service (@ServicesCombo) {
  245 + if ($service->{Disabled}) {
  246 + if ($inOpt) {
  247 + $retorno = $retorno . "</optgroup>\n";
  248 + }
  249 + $inOpt = 1;
  250 + $retorno = $retorno . "<optgroup label='" . $service->{Value} . "'>\n";
  251 + } else {
  252 + $retorno = $retorno . "<option value='" . $service->{Key} . "'>" . $Self->LastPart($service->{Value}) . "</option>\n";
  253 + }
  254 + }
  255 +
  256 + if ($inOpt) {
  257 + $retorno = $retorno . "</optgroup>\n";
  258 + }
  259 +
  260 + $retorno = $retorno . "</select>\n";
  261 +
  262 + return $retorno;
  263 +}
  264 +
  265 +=head
  266 +Returns service name without the parent services names
  267 +=cut
  268 +sub LastPart {
  269 + my $Self = shift;
  270 + my $queue = shift;
  271 + my @parts = split( "::", $queue );
  272 + return $parts[-1];
  273 +}
  274 +
  275 +=head
  276 +Handles jQueryFileUpload component in AlpacaJS
  277 +=cut
  278 +sub UploadFile {
  279 + my ( $Self, %Param ) = @_;
  280 + my $ParamObject = $Kernel::OM->Get("Kernel::System::Web::Request");
  281 +
  282 + if ($ParamObject->GetParam(Param => "UploadFileCmd") eq "UploadFile") {
  283 + $Self->Debug("Upload file command received");
  284 + return $Self->UploadFileReceive();
  285 + } elsif ($ParamObject->GetParam(Param => "UploadFileCmd") eq "DeleteFile") {
  286 + $Self->Debug("Delete uploaded file command received");
  287 + return $Self->UploadFileDelete();
  288 + } else {
  289 + $Self->Debug("Unknown file command received");
  290 + return 1;
  291 + }
  292 +}
  293 +
  294 +=head
  295 +Handles jQueryFileUpload component in AlpacaJS
  296 +=cut
  297 +sub UploadFileDelete() {
  298 + my ( $Self, %Param ) = @_;
  299 + my %Data = ();
  300 +
  301 + my $ParamObject = $Kernel::OM->Get("Kernel::System::Web::Request");
  302 + my $WebUploadCacheObject = $Kernel::OM->Get('Kernel::System::Web::UploadCache');
  303 + my $LayoutObject = $Kernel::OM->Get("Kernel::Output::HTML::Layout");
  304 + my $fileName = $ParamObject->GetParam(Param => "Filename");
  305 + my $formId = $ParamObject->GetParam(Param => "FormID");
  306 +
  307 + $Self->Debug("FileUpload: Delete file $fileName from form $formId");
  308 +
  309 + my @filesUploaded = $WebUploadCacheObject->FormIDGetAllFilesData(FormID => $formId);
  310 +
  311 + my $fileDeleted = 0;
  312 +
  313 + for my $uploadedFile (@filesUploaded) {
  314 + if ($uploadedFile->{Filename} eq $fileName) {
  315 + $WebUploadCacheObject->FormIDRemoveFile(FormID => $formId, FileID => $uploadedFile->{FileID});
  316 + $Self->Debug("FileUpload: Deleted file " . $fileName);
  317 + $fileDeleted = 1;
  318 + }
  319 + }
  320 +
  321 + if ($fileDeleted) {
  322 + return $LayoutObject->Attachment(
  323 + ContentType => 'application/json; charset=' . $LayoutObject->{Charset},
  324 + Content => "{ $fileName: true}",
  325 + Type => 'inline',
  326 + NoCache => 1,
  327 + );
  328 + } else {
  329 + return 1;
  330 + }
  331 +}
  332 +
  333 +=head
  334 +Deletes all attachments from the form
  335 +=cut
  336 +sub ClearCache() {
  337 + my ( $Self, %Param ) = @_;
  338 + my %Data = ();
  339 +
  340 + my $ParamObject = $Kernel::OM->Get("Kernel::System::Web::Request");
  341 + my $WebUploadCacheObject = $Kernel::OM->Get('Kernel::System::Web::UploadCache');
  342 + my $LayoutObject = $Kernel::OM->Get("Kernel::Output::HTML::Layout");
  343 + my $formId = $Param{FormID};
  344 +
  345 + $Self->Debug("Clearing cache for form " . $formId);
  346 +
  347 + my @filesUploaded = $WebUploadCacheObject->FormIDGetAllFilesData(FormID => $formId);
  348 +
  349 + my $fileDeleted = 0;
  350 +
  351 + for my $uploadedFile (@filesUploaded) {
  352 + $WebUploadCacheObject->FormIDRemoveFile(FormID => $formId, FileID => 1);
  353 + $Self->Debug("FileUpload: Deleted file " . $uploadedFile->{Filename});
  354 + }
  355 +}
  356 +
  357 +=head
  358 +Handles jQueryFileUPload component in AlpacaJS
  359 +=cut
  360 +sub UploadFileReceive() {
  361 + my ( $Self, %Param ) = @_;
  362 + my %Data = ();
  363 +
  364 + my $ParamObject = $Kernel::OM->Get("Kernel::System::Web::Request");
  365 + my $WebUploadCacheObject = $Kernel::OM->Get('Kernel::System::Web::UploadCache');
  366 + my $LayoutObject = $Kernel::OM->Get("Kernel::Output::HTML::Layout");
  367 +
  368 + my %tmpFile = $ParamObject->GetUploadAll(Param => "attachment_files");
  369 + my $formId = $ParamObject->GetParam( Param => "FormID" );
  370 +
  371 + if (! $tmpFile{Filename} || ! $formId) {
  372 + my $msgError = $LayoutObject->{LanguageObject}->Translate("Invalid file!");
  373 + return $LayoutObject->Attachment(
  374 + ContentType => 'application/json; charset=' . $LayoutObject->{Charset},
  375 + Content => "{ \"error\": \"$msgError\", \"files\": [] }",
  376 + Type => 'inline',
  377 + NoCache => 1,
  378 + );
  379 + }
  380 +
  381 + $Self->Debug("FileUpload: Adding file to cache. FormID: " . $formId . " \t Filename: " . $tmpFile{Filename} . " \t ContentType: " . $tmpFile{ContentType} );
  382 +
  383 + $WebUploadCacheObject->FormIDAddFile(
  384 + FormID => $formId,
  385 + Filename => $tmpFile{Filename},
  386 + Content => $tmpFile{Content},
  387 + ContentType => $tmpFile{ContentType}
  388 + );
  389 +
  390 + my %retorno = ();
  391 + my @filesReturned = ();
  392 +
  393 + my %dados = ();
  394 + $dados{name} = $tmpFile{Filename};
  395 + $dados{size} = length($tmpFile{Content});
  396 +
  397 + $dados{deleteUrl} = "/otrs/public.pl?Action=NewTicketWizardPublic;UploadFileCmd=DeleteFile;Filename=" . uri_escape($tmpFile{Filename}) . ";FormID=" . $formId;
  398 + push @filesReturned, \%dados;
  399 + $retorno{"files"} = \@filesReturned;
  400 +
  401 + return $LayoutObject->Attachment(
  402 + ContentType => 'application/json; charset=' . $LayoutObject->{Charset},
  403 + Content => encode_json(\%retorno),
  404 + Type => 'inline',
  405 + NoCache => 1,
  406 + );
  407 +}
  408 +
  409 +=head
  410 +Returns the custom script defined for a service,
  411 + if it exists or just a comment-blank line if it doesn't
  412 +=cut
  413 +sub GetFormCustomProps {
  414 + my ( $Self, %Param ) = @_;
  415 + my %serviceForm;
  416 +
  417 + my $ServiceFormObject = $Kernel::OM->Get("Kernel::System::ServiceForm");
  418 + my $LayoutObject = $Kernel::OM->Get("Kernel::Output::HTML::Layout");
  419 + my $ParamObject = $Kernel::OM->Get("Kernel::System::Web::Request");
  420 +
  421 + my $QueueID = $ParamObject->GetParam( Param => "QueueID" );
  422 +
  423 + if ( $Param{ServiceID} ) {
  424 + %serviceForm = $ServiceFormObject->GetServiceFormForQueue( ServiceID => $Param{ServiceID}, QueueID => $QueueID );
  425 + if (! $serviceForm{ServiceID}) {
  426 + %serviceForm = $ServiceFormObject->GetServiceForm( ServiceID => $Param{ServiceID} );
  427 + }
  428 + }
  429 +
  430 + return $LayoutObject->Attachment(
  431 + ContentType => 'text/plain; charset=' . $LayoutObject->{Charset},
  432 + Content => $serviceForm{CustomProps} || "/**/",
  433 + Type => 'inline',
  434 + NoCache => 1,
  435 + );
  436 +}
  437 +
  438 +=head
  439 +Returns the JSON form structure for a given service, if one is defined
  440 +=cut
  441 +sub GetFormJSON {
  442 + my ( $Self, %Param ) = @_;
  443 + my %serviceForm;
  444 +
  445 + my $ServiceFormObject = $Kernel::OM->Get("Kernel::System::ServiceForm");
  446 + my $LayoutObject = $Kernel::OM->Get("Kernel::Output::HTML::Layout");
  447 + my $ParamObject = $Kernel::OM->Get("Kernel::System::Web::Request");
  448 +
  449 + my $QueueID = $ParamObject->GetParam(Param => "QueueID");
  450 + my $FormID = $ParamObject->GetParam(Param => "FormID");
  451 +
  452 + if ( $Param{ServiceID} ) {
  453 + %serviceForm = $ServiceFormObject->GetServiceFormForQueue( ServiceID => $Param{ServiceID}, QueueID => $QueueID );
  454 +
  455 + if (! $serviceForm{ServiceID}) {
  456 + %serviceForm = $ServiceFormObject->GetServiceForm( ServiceID => $Param{ServiceID} );
  457 + }
  458 + }
  459 +
  460 + $Self->ClearCache(FormID => $FormID);
  461 +
  462 + my ( $schema, $fields, $introduction ) = $Self->GetForm( Public => $Param{Public}, ServiceForm => \%serviceForm, QueueID => $QueueID );
  463 +
  464 + return $LayoutObject->Attachment(
  465 + ContentType => 'application/json; charset=' . $LayoutObject->{Charset},
  466 + Content => "[{" . $schema . "}, {" . $fields . "}, \"" . $introduction . "\"]",
  467 + Type => 'inline',
  468 + NoCache => 1,
  469 + );
  470 +}
  471 +
  472 +=head
  473 +Allows using a field in the form to select a target queue.
  474 +If a queue was defined in request parameter, uses it.
  475 +If there is a prefix defined for the queues to automatically forward tickets,
  476 +and also a field was defined as handling the target queue, try to locate one.
  477 +
  478 +If none is found, uses the default queue.
  479 +
  480 +For example:
  481 + QueueDefault = Primeiro Nivel
  482 + QueuePrefix = Primeiro Nivel
  483 + QueueField = Unidade
  484 +
  485 + AvailableQueues = Primeiro Nivel CCB, Primeiro Nivel CCE, Primeiro Nivel
  486 + QueueDefault = Primeiro Nivel
  487 +
  488 + if QueueField value is CCB, then selects queue Primeiro Nivel CCB
  489 + if QueueField value is CCJ (no queue by that suffix), then selects queue Primeiro Nivel
  490 + if QueueField value is CCE, then selects queue Primeiro Nivel CCE
  491 +=cut
  492 +sub GetQueueID() {
  493 + my ( $Self, %Param ) = @_;
  494 +
  495 + my $ParamObject = $Kernel::OM->Get("Kernel::System::Web::Request");
  496 + my $QueueObject = $Kernel::OM->Get("Kernel::System::Queue");
  497 + my $ConfigObject = $Kernel::OM->Get("Kernel::Config");
  498 +
  499 + # Check if queueID was sent
  500 + my $QueueID = $ParamObject->GetParam(Param => "QueueID");
  501 +
  502 + if ($QueueID) {
  503 + my %Queue = $QueueObject->QueueGet(ID => $QueueID);
  504 + return ($Queue{"Name"}, $QueueID);
  505 + }
  506 +
  507 + # Gets default Queue
  508 + my $ConfigTicket = $ConfigObject->Get("Ticket::Frontend::CustomerTicketMessage");
  509 + my $ConfigTicketWizard = $ConfigObject->Get("Ticket::Frontend::Customer::NewTicketWizard");
  510 +
  511 +
  512 + my $QueueDefault = $ConfigTicket->{"QueueDefault"};
  513 +
  514 + # Checks if there is a field for the queue
  515 + my $QueuePrefix = $ConfigTicketWizard->{"QueuePrefix"};
  516 + my $QueueField = $ConfigTicketWizard->{"QueueField"};
  517 +
  518 + my %QueueListID = $QueueObject->QueueList( Valid => 1 );
  519 + my %QueueList = reverse $QueueObject->QueueList( Valid => 1 );
  520 + $QueueID = $QueueList{$QueueDefault};
  521 + my $Queue = $QueueListID{$QueueID};
  522 +
  523 + if ( $QueuePrefix && $QueueField ) {
  524 + my $QueueSelected = $ParamObject->GetParam( Param => $QueueField );
  525 + my $QueueName = "$QueuePrefix $QueueSelected";
  526 +
  527 + if ( $QueueList{$QueueName} ) {
  528 + $QueueID = $QueueList{$QueueName};
  529 + $Queue = $QueueName;
  530 + }
  531 + }
  532 +
  533 + return ( $Queue, $QueueID );
  534 +}
  535 +
  536 +=head
  537 +Returns the form code for a given service, if one is defined
  538 +=cut
  539 +sub GetForm {
  540 + my ( $Self, %Param ) = @_;
  541 +
  542 + my $TicketWizard = $Kernel::OM->Get("Kernel::System::TicketWizard");
  543 + my $ConfigObject = $Kernel::OM->Get("Kernel::Config");
  544 + my $schema;
  545 + my $fields;
  546 +
  547 + $Self->{ConfigNTW} = $ConfigObject->Get("Ticket::Frontend::Customer::NewTicketWizard");
  548 + $Self->{DefaultUserID} = $Self->{ConfigNTW}->{"DefaultUserID"};
  549 + $Self->{DefaultCustomerID} = $Self->{ConfigNTW}->{"DefaultCustomerID"};
  550 + $Self->{DefaultUserDomain} = $Self->{ConfigNTW}->{"DefaultUserDomain"};
  551 +
  552 +
  553 + if ($Param{Public}) {
  554 + $Self->Debug("Getting public form schema");
  555 + $schema = $TicketWizard->GetBasicFieldsSchemaPublic();
  556 + $fields = $TicketWizard->GetBasicFieldsOptionsPublic();
  557 + } else {
  558 + $Self->Debug("Getting authenticated form schema");
  559 + $schema = $TicketWizard->GetBasicFieldsSchema();
  560 + $fields = $TicketWizard->GetBasicFieldsOptions();
  561 + }
  562 +
  563 + my $introduction;
  564 +
  565 + ( $schema, $fields ) = $TicketWizard->ReplaceOTRSValues(
  566 + Schema => $schema,
  567 + Options => $fields,
  568 + UserID => $Self->{DefaultUserID}
  569 + );
  570 +
  571 + if ( !$Param{ServiceForm} ) {
  572 + $schema =~ s/CF_SCHEMA//g;
  573 + $fields =~ s/CF_FORM//g;
  574 + $introduction = "";
  575 + # Include dynamic fields in replace command
  576 + ( $schema, $fields ) = $TicketWizard->ReplaceOTRSDynamicFields( Schema => $schema, Options => $fields );
  577 + }
  578 + else {
  579 + my %serviceForm = %{ $Param{ServiceForm} };
  580 + $introduction = $serviceForm{Introduction};
  581 +
  582 + if ( !$Param{ServiceForm}{Schema} ) {
  583 + $schema =~ s/CF_SCHEMA//g;
  584 + $fields =~ s/CF_FORM//g;
  585 + }
  586 + else {
  587 + my $schemaForm = "," . $serviceForm{Schema};
  588 + my $fieldsForm = "," . $serviceForm{Form};
  589 + $schema =~ s/CF_SCHEMA/$schemaForm/g;
  590 + $fields =~ s/CF_FORM/$fieldsForm/g;
  591 + }
  592 +
  593 + # Include dynamic fields in replace command
  594 + ( $schema, $fields ) = $TicketWizard->ReplaceOTRSDynamicFields( Schema => $schema, Options => $fields );
  595 +
  596 + # Set fixed field values, if defined
  597 + if ($serviceForm{FixedValues}) {
  598 + ($schema, $fields) = $Self->AdjustFixedFields(Schema => $schema, Fields => $fields, FixedValues => $serviceForm{FixedValues});
  599 + }
  600 + }
  601 +
  602 +
  603 + if ($Param{"QueueID"}) {
  604 + $schema = $schema . ",\n\"QueueID\": {\n\"type\": \"string\",\n\"default\": \"" . $Param{"QueueID"} . "\"}";
  605 + $fields = $fields . ",\n\"QueueID\": {\n\"type\": \"hidden\"\n}";
  606 + }
  607 +
  608 + return ( $schema, $fields, $introduction );
  609 +}
  610 +
  611 +=head
  612 +If some fields have fixed values in service definition, sets them
  613 +=cut
  614 +sub AdjustFixedFields {
  615 + my ( $Self, %Param ) = @_;
  616 + my $schema = $Param{Schema};
  617 + my $form = $Param{Fields};
  618 + my $fixedValues = $Param{FixedValues};
  619 +
  620 + my @values = split(/\n/, $fixedValues);
  621 +
  622 + for my $value (@values) {
  623 +
  624 + $value =~ s/\r//g;
  625 + my @data = split('=', $value);
  626 +
  627 + my $fieldKey = $data[0];
  628 + my $fixedValue = $data[1];
  629 +
  630 + my $key = '("' . $fieldKey . '"[\ ]?:[\ ]?{[^}]+})';
  631 + my $replace = '"' . $fieldKey . '"' . ': {"type": "string", "default": "' . $fixedValue . '"}';
  632 +
  633 + $schema =~ s/$key/$replace/;
  634 +
  635 + $form = "{" . $form . "}";
  636 + #print STDERR "\n\n" . $form . "\n\n";
  637 + my $formStruct = decode_json(encode_utf8($form));
  638 + my $hiddenStruct = {};
  639 + $hiddenStruct->{"type"} = "hidden";
  640 + $formStruct->{$fieldKey} = $hiddenStruct;
  641 +
  642 + #print STDERR "\n\n" . Dumper($formStruct) . "\n\n";
  643 +
  644 + $form = decode_utf8(encode_json($formStruct));
  645 + #print STDERR "\n\n" . $form . "\n\n";
  646 + substr($form, 0, 1, "");
  647 + substr($form, -1, 1, "");
  648 + print STDERR "\n\n" . $form . "\n\n";
  649 + #
  650 + #$key = '("' . $fieldKey . '"[\ ]?:[\ ]?{[^}]+})';
  651 + #$replace = '"' . $fieldKey . '": {"type": "hidden"' . "\n}";
  652 + #$form =~ s/$key/$replace/;
  653 + }
  654 +
  655 + #print STDERR "\n\n" . $form . "\n\n" . $schema . "\n\n";
  656 + return ($schema, $form);
  657 +}
  658 +
  659 +=head
  660 +Creates a new ticket, given the input data and sent attachments/images
  661 +=cut
  662 +sub CreateTicket {
  663 + my ( $Self, %Param ) = @_;
  664 + my %Data = ();
  665 +
  666 + my $TicketObject = $Kernel::OM->Get("Kernel::System::Ticket");
  667 + my $ConfigObject = $Kernel::OM->Get("Kernel::Config");
  668 + my $ParamObject = $Kernel::OM->Get("Kernel::System::Web::Request");
  669 + my $BackendObject = $Kernel::OM->Get("Kernel::System::DynamicField::Backend");
  670 + my $DynamicFieldObject = $Kernel::OM->Get("Kernel::System::DynamicField");
  671 + my $CustomerUserObject = $Kernel::OM->Get("Kernel::System::CustomerUser");
  672 +
  673 + my $LayoutObject = $Kernel::OM->Get('Kernel::Output::HTML::Layout');
  674 +
  675 + my $TicketWizard = $Kernel::OM->Get("Kernel::System::TicketWizard");
  676 +
  677 + $Self->{ConfigNTW} = $ConfigObject->Get("Ticket::Frontend::Customer::NewTicketWizard");
  678 + $Self->{DefaultUserID} = $Self->{ConfigNTW}->{"DefaultUserID"};
  679 + $Self->{DefaultCustomerID} = $Self->{ConfigNTW}->{"DefaultCustomerID"};
  680 + $Self->{DefaultUserDomain} = $Self->{ConfigNTW}->{"DefaultUserDomain"};
  681 +
  682 + # Check if queue was pre-defined
  683 + my $queueFixed = 0;
  684 + if ($Data{QueueID}) {
  685 + $queueFixed = 1;
  686 + }
  687 +
  688 + # Get queue name and id using rules, if no queue was predefined
  689 + my ( $Queue, $QueueID ) = $TicketWizard->GetQueueID(%Param);
  690 + $Data{QueueID} = $QueueID;
  691 +
  692 + # Module config
  693 + $Self->{Config} = $ConfigObject->Get("Ticket::Frontend::CustomerTicketMessage");
  694 +
  695 + # Ticket creation
  696 + my $customerID;
  697 + my $customerUser;
  698 +
  699 + if ($Param{Public}) {
  700 + $customerID = $Self->GetUserIDFromEmail( $ParamObject->GetParam( Param => "email" ) );
  701 + $customerUser = $Self->GetUserIDFromEmail( $ParamObject->GetParam( Param => "email" ) );
  702 + } else {
  703 + $customerID = $Param{CustomerID};
  704 + $customerUser = $Param{CustomerUser};
  705 + }
  706 +
  707 + $Self->Debug("Creating ticket");
  708 + my $TicketID = $TicketObject->TicketCreate(
  709 + Title => $ParamObject->GetParam( Param => "subject" ),
  710 + QueueID => $QueueID,
  711 + Priority => $Self->{Config}->{PriorityDefault},
  712 + Lock => 'unlock',
  713 + State => 'new',
  714 + ServiceID => $ParamObject->GetParam( Param => "service" ),
  715 + TypeID =>$ParamObject->GetParam( Param => "type" ),
  716 + CustomerID => $customerID,
  717 + CustomerUser => $customerUser,
  718 + OwnerID => $Self->{DefaultUserID},
  719 + UserID => $Self->{DefaultUserID},
  720 + );
  721 + $Self->Debug("Created ticket ID $TicketID");
  722 +
  723 + my $MimeType = 'text/html';
  724 + my %serviceFieldsValues = ();
  725 + my $serviceFields = "";
  726 + my @serviceFieldsKeys = ();
  727 +
  728 + # Service Fields
  729 + $Self->Debug("Retrieving service form values");
  730 + for ( $ParamObject->GetParamNames() ) {
  731 + if (( substr( $_, 0, 3 ) eq "SF_" ) && ( substr( $_, 0, 5 ) ne "SF_T_" )) {
  732 + if ($ParamObject->GetArray( Param => $_ )) {
  733 + my @paramVals = $ParamObject->GetArray( Param => $_ );
  734 + for my $paramValue (@paramVals) {
  735 + if (($paramValue) && (!($paramValue eq "-"))) {
  736 + if (! $serviceFieldsValues{$_}) {
  737 + $serviceFieldsValues{$_} = $paramValue;
  738 + push @serviceFieldsKeys, $_;
  739 + } else {
  740 + $serviceFieldsValues{$_} .= ", " . $paramValue;
  741 + }
  742 + }
  743 + }
  744 + } else {
  745 + my $paramValue = $ParamObject->GetParam( Param => $_ );
  746 +
  747 + if (($paramValue) && (!($paramValue eq "-"))) {
  748 + if (! $serviceFieldsValues{$_}) {
  749 + $serviceFieldsValues{$_} = $paramValue;
  750 + push @serviceFieldsKeys, $_;
  751 + } else {
  752 + $serviceFieldsValues{$_} .= ", " . $paramValue;
  753 + }
  754 + }
  755 + }
  756 + }
  757 + }
  758 +
  759 + for (@serviceFieldsKeys) {
  760 + $serviceFields .= "<B>" . $Self->breakWords(Text => substr( $_, 3 )) . ": </B>" . $serviceFieldsValues{$_} . "<BR/>";
  761 + }
  762 +
  763 + $serviceFields .= "<B>IP: </B>" . $ENV{'REMOTE_ADDR'} . "<BR/>";
  764 + $serviceFields .= "<BR/><BR/>";
  765 +
  766 + # Dynamic Fields
  767 + my $userIDDF;
  768 + if ($Param{Public}) {
  769 + $userIDDF = $Self->{DefaultUserID};
  770 + } else {
  771 + $userIDDF = $ConfigObject->Get('CustomerPanelUserID');
  772 + }
  773 + $Self->Debug("Retrieving dynamic fields values");
  774 + for ( $ParamObject->GetParamNames() ) {
  775 + if ( substr( $_, 0, 3 ) eq "DF_" ) {
  776 + my $Success = $BackendObject->ValueSet(
  777 + DynamicFieldConfig => $DynamicFieldObject->DynamicFieldGet( Name => substr( $_, 3 ) ),
  778 + ObjectID => $TicketID,
  779 + Value => $ParamObject->GetParam( Param => $_ ),
  780 + UserID => $userIDDF,
  781 + );
  782 + }
  783 + }
  784 +
  785 + # Service Fields - Table fields
  786 + $Self->Debug("Retrieving service fields - table fields");
  787 + my $lastTab = "";
  788 + my %keysFound = ();
  789 + my $newTab = 1;
  790 +
  791 + for ( $ParamObject->GetParamNames() ) {
  792 + if ( substr( $_, 0, 5 ) eq "SF_T_" ) {
  793 + my $paramName = $_;
  794 + my @parts = split('_', $_);
  795 + my $currTab = $parts[2];
  796 + my $currKey = $parts[4];
  797 +
  798 + if ($currTab ne $lastTab) {
  799 + if ($lastTab ne "") {
  800 + $serviceFields .= "</TABLE><BR/><BR/>";
  801 + }
  802 + $serviceFields .= "<TABLE style='border-collapse: collapse; width: 700px;' border='1px'>";
  803 + $lastTab = $currTab;
  804 + $newTab = 1;
  805 + } else {
  806 + $newTab = 0;
  807 + }
  808 +
  809 + ## new line due to repetition or new table
  810 + if ($keysFound{$currKey} || ($newTab) ) {
  811 + %keysFound = ();
  812 + $serviceFields .= "<TR><TD COLSPAN='2' style='text-align: center; font-size: large'><B>" . $Self->breakWords(Text => $currTab) . "</B></TD></TR>";
  813 + }
  814 + $keysFound{$currKey} = 1;
  815 + $serviceFields .= "<TR><TD style='width: 100px;'><B>" . $Self->breakWords(Text => $currKey) . "</B></TD><TD>" . $ParamObject->GetParam( Param => $paramName ) . "</TD></TR>";
  816 + }
  817 + }
  818 +
  819 + if ($lastTab ne "") {
  820 + $serviceFields .= "</TABLE><BR/><BR/>";
  821 + }
  822 +
  823 + my $body = $ParamObject->GetParam( Param => "description" );
  824 +
  825 + # Images
  826 + $Self->Debug("Loading images from cache");
  827 + my $WebUploadCacheObject = $Kernel::OM->Get('Kernel::System::Web::UploadCache');
  828 + my $formId = $ParamObject->GetParam(Param => "FormID");
  829 + my @filesUploaded = $WebUploadCacheObject->FormIDGetAllFilesData(FormID => $formId);
  830 +
  831 + for my $uploadedFile (@filesUploaded) {
  832 + my $ContentID = $uploadedFile->{ContentID};
  833 + if ($ContentID && ( $uploadedFile->{ContentType} =~ /image/i ) && ( $uploadedFile->{Disposition} eq 'inline' )) {
  834 + $Self->Debug("NewTicketWizard: replacing image URL in body with attachment");
  835 + $Self->Debug("NewTicketWizard: Body: $body");
  836 + my $ContentIDHTMLQuote = $LayoutObject->Ascii2Html(Text => $ContentID,);
  837 + # workaround for link encode of rich text editor, see bug#5053
  838 + my $ContentIDLinkEncode = $LayoutObject->LinkEncode($ContentID);
  839 + $body =~ s/(ContentID=)$ContentIDLinkEncode/$1$ContentID/g;
  840 + $Self->Debug("NewTicketWizard: new body: $body");
  841 + }
  842 + }
  843 +
  844 + # Create article
  845 + $Self->Debug("Creating article");
  846 + my $FullName;
  847 + my $Email;
  848 +
  849 + if ($Param{Public}) {
  850 + $FullName = $ParamObject->GetParam( Param => "name" );
  851 + $Email = $ParamObject->GetParam( Param => "email" );
  852 + } else {
  853 + $FullName = $CustomerUserObject->CustomerName( UserLogin => $Param{UserLogin});
  854 + $Email = $Param{UserEmail};
  855 + }
  856 +
  857 + my $From = "\"$FullName\" <$Email>";
  858 + my $ArticleID = $TicketObject->ArticleCreate(
  859 + TicketID => $TicketID,
  860 + ArticleType => $Self->{Config}->{ArticleType},
  861 + SenderType => $Self->{Config}->{SenderType},
  862 + From => $From,
  863 + To => $Queue,
  864 + Subject => $ParamObject->GetParam( Param => "subject" ),
  865 + Body => $LayoutObject->RichTextDocumentComplete(String => $serviceFields . $body),
  866 + MimeType => $MimeType,
  867 + Charset => $LayoutObject->{UserCharset},
  868 + UserID => $userIDDF,
  869 + HistoryType => $Self->{Config}->{HistoryType},
  870 + HistoryComment => $Self->{Config}->{HistoryComment} || '%%',
  871 + AutoResponseType => ( $ConfigObject->Get('AutoResponseForWebTickets') )
  872 + ? 'auto reply'
  873 + : '',
  874 + OrigHeader => {
  875 + From => $From,
  876 + To => $Queue,
  877 + Subject => $ParamObject->GetParam( Param => "subject" ),
  878 + Body => $LayoutObject->RichTextDocumentComplete(String => $serviceFields . $body),,
  879 + },
  880 + Queue => $Queue,
  881 + );
  882 +
  883 + # Attachments
  884 + $Self->Debug("Including attachments");
  885 + for my $uploadedFile (@filesUploaded) {
  886 + $TicketObject->ArticleWriteAttachment(
  887 + Filename => $uploadedFile->{Filename},
  888 + Content => $uploadedFile->{Content},
  889 + ContentType => $uploadedFile->{ContentType},
  890 + ArticleID => $ArticleID,
  891 + ContentID => $uploadedFile->{ContentID},
  892 + UserID => $userIDDF,
  893 + );
  894 + }
  895 +
  896 + $Data{TicketNumber} = $TicketObject->TicketNumberLookup( TicketID => $TicketID );
  897 + $Self->{ConfigNTW} = $ConfigObject->Get("Ticket::Frontend::Customer::NewTicketWizard");
  898 + my $idCustomTemplate = $Self->{ConfigNTW}->{"CustomTemplate"};
  899 +
  900 + # build output
  901 + if ($Param{Public}) {
  902 + $Data{PublicMode} = "Public";
  903 + $Data{Module} = "public";
  904 + } else {
  905 + $Data{Module} = "customer";
  906 + }
  907 + if (! $queueFixed) {
  908 + delete $Data{QueueID}
  909 + }
  910 + my $Output = $LayoutObject->CustomerHeader(Type => $idCustomTemplate, Title => "Ticket created" );
  911 + $Output .= $LayoutObject->Output(
  912 + Data => \%Data,
  913 + TemplateFile => 'NewTicketWizardTicketCreated',
  914 + );
  915 + $Output .= $LayoutObject->CustomerFooter(Type => $idCustomTemplate);
  916 + return $Output;
  917 +
  918 +}
  919 +
  920 +=head
  921 +If public interface was used, try to guess the user from the informed e-mail
  922 +=cut
  923 +sub GetUserIDFromEmail {
  924 + my $Self = shift;
  925 + my $email = shift;
  926 + my $result = $Self->{DefaultCustomerID};
  927 + my $domainList = $Self->{DefaultUserDomain};
  928 +
  929 + my $CustomerUserObject = $Kernel::OM->Get("Kernel::System::CustomerUser");
  930 +
  931 + if ($domainList) {
  932 + my @domains = split( ",", $domainList );
  933 +
  934 + for my $domain (@domains) {
  935 + my @parts = split( "@", $email );
  936 + if ( $parts[1] eq $domain ) {
  937 + my $id = $parts[0];
  938 + my %List = $CustomerUserObject->CustomerSearch(
  939 + UserLogin => $id,
  940 + Valid => 1, # not required, default 1
  941 + );
  942 + if ( keys %List ) {
  943 + $result = $id;
  944 + return $result;
  945 + }
  946 + }
  947 + }
  948 + }
  949 +
  950 + return $result;
  951 +}
  952 +
  953 +=head
  954 +Default action to open a new form (frontend method share by public and customer frontend modules)
  955 +=cut
  956 +sub OpenForm {
  957 + my ( $Self, %Param ) = @_;
  958 + my %Data = ();
  959 +
  960 + if ($Param{Public}) {
  961 + $Self->Debug("Opening public form");
  962 + } else {
  963 + $Self->Debug("Opening authenticated form");
  964 + }
  965 +
  966 + my $LayoutObject = $Kernel::OM->Get('Kernel::Output::HTML::Layout');
  967 +
  968 + my $TicketObject = $Kernel::OM->Get("Kernel::System::Ticket");
  969 + my $ConfigObject = $Kernel::OM->Get("Kernel::Config");
  970 + my $ParamObject = $Kernel::OM->Get("Kernel::System::Web::Request");
  971 + my $BackendObject = $Kernel::OM->Get("Kernel::System::DynamicField::Backend");
  972 + my $DynamicFieldObject = $Kernel::OM->Get("Kernel::System::DynamicField");
  973 + my $CustomerUserObject = $Kernel::OM->Get("Kernel::System::CustomerUser");
  974 + my $TicketWizard = $Kernel::OM->Get("Kernel::System::TicketWizard");
  975 +
  976 + my $QueueObject = $Kernel::OM->Get("Kernel::System::Queue");
  977 + my $QueueServiceObject = $Kernel::OM->Get("Kernel::System::QueueService");
  978 + my $ServiceObject = $Kernel::OM->Get("Kernel::System::Service");
  979 + my $MaintenanceObject = $Kernel::OM->Get("Kernel::System::Maintenance");
  980 + my $DateUtilsObject = $Kernel::OM->Get("Kernel::System::DateUtils");
  981 +
  982 + if ($Param{Public}) {
  983 + $Data{AuthenticateURL} = $ConfigObject->Get('Customer::AuthModule::CAS::CASUrl')
  984 + . "/login?service="
  985 + . "https://"
  986 + . $ENV{SERVER_NAME}
  987 + . $ENV{SCRIPT_NAME}
  988 + . "?Action=NewTicketWizard";
  989 + }
  990 +
  991 + # Check if queue parameter was received
  992 + if ($ParamObject->GetParam(Param => "QueueID")) {
  993 + $Data{QueueID} = $ParamObject->GetParam(Param => "QueueID");
  994 + $Self->Debug("Specific queue defined => " . $Data{QueueID});
  995 + } else {
  996 + # Check if must show queue - if so, redirect user
  997 + my $_ConfigTicketWizard = $ConfigObject->Get("Ticket::Frontend::Customer::NewTicketWizard");
  998 + my $_ShowQueue = $_ConfigTicketWizard->{"ShowQueue"};
  999 + if (! $_ShowQueue) {
  1000 + $Self->Debug("Queue selection must be shown - redirection to QueuePanelPublic action");
  1001 + return $LayoutObject->Redirect( OP => "Action=QueuesPanelPublic" );
  1002 + }
  1003 + }
  1004 +
  1005 + my ( $schema, $fields ) = $TicketWizard->GetForm(Public => $Param{Public});
  1006 +
  1007 + $Data{SchemaForm} = $schema;
  1008 + $Data{FieldsForm} = $fields;
  1009 +
  1010 + # Common info
  1011 + $Self->{ConfigNTW} = $ConfigObject->Get("Ticket::Frontend::Customer::NewTicketWizard");
  1012 + my $idCustomTemplate = $Self->{ConfigNTW}->{"CustomTemplate"};
  1013 +
  1014 + my $msgChooseService;
  1015 + if ($Param{Public}) {
  1016 + $msgChooseService = $Self->{ConfigNTW}->{"MessageChooseServicePublic"};
  1017 + } else {
  1018 + $msgChooseService = $Self->{ConfigNTW}->{"MessageChooseService"};
  1019 + }
  1020 + if ($ParamObject->GetParam( Param => "QueueID" ) ) {
  1021 + my %queueData = $QueueObject->QueueGet(ID => $ParamObject->GetParam( Param => "QueueID" ));
  1022 + my $queueName = $queueData{Name};
  1023 + $msgChooseService =~ s/PLACE\_NAME/$queueName/g;
  1024 + }
  1025 + $Data{MsgChooseService} = $msgChooseService;
  1026 +
  1027 + $Self->{DefaultUserID} = $Self->{ConfigNTW}->{"DefaultUserID"};
  1028 + $Self->{DefaultCustomerID} = $Self->{ConfigNTW}->{"DefaultCustomerID"};
  1029 + $Self->{DefaultUserDomain} = $Self->{ConfigNTW}->{"DefaultUserDomain"};
  1030 +
  1031 +
  1032 +
  1033 +
  1034 + # Build service chooser
  1035 + $Data{ServiceStrg} = $TicketWizard->BuildServices(ServiceID => $ParamObject->GetParam( Param => "ServiceID" ));
  1036 +
  1037 + # Build output
  1038 + my $Output = $LayoutObject->CustomerHeader(Type => $idCustomTemplate, Title => $LayoutObject->{LanguageObject}->Translate("New ticket wizard") );
  1039 +
  1040 + # Load current maintenances
  1041 + my @maintenances = $MaintenanceObject->ListCurrentMaintenances();
  1042 +
  1043 + if (@maintenances) {
  1044 + $LayoutObject->Block(
  1045 + Name => 'MaintenancesPanel',
  1046 + );
  1047 +
  1048 + for my $maintenanceHash (@maintenances) {
  1049 + my %maintenance = %{$maintenanceHash};
  1050 +
  1051 + $LayoutObject->Block(
  1052 + Name => 'MaintenanceLine',
  1053 + Data => {
  1054 + Message => $maintenance{'Description'},
  1055 + StartDate => $DateUtilsObject->BrazilianDate(Timestamp => $DateUtilsObject->FromSQL(StringDate => $maintenance{StartDate})),
  1056 + });
  1057 + }
  1058 + }
  1059 +
  1060 +
  1061 + if ($Param{Public}) {
  1062 + $Self->Debug("Public view - unauthenticated message enabled");
  1063 + $LayoutObject->Block(
  1064 + Name => 'UnauthenticatedMessage',
  1065 + );
  1066 + $Self->Debug("Public view - public toolbar enabled");
  1067 + $LayoutObject->Block(
  1068 + Name => 'ToolBarPublic',
  1069 + );
  1070 + } else {
  1071 + $Self->Debug("Customer view - customer toolbar enabled");
  1072 + $LayoutObject->Block(
  1073 + Name => 'ToolBarCustomer',
  1074 + );
  1075 + }
  1076 +
  1077 + # Prepare cache for imagens and attachments
  1078 + my $WebUploadCacheObject = $Kernel::OM->Get('Kernel::System::Web::UploadCache');
  1079 + $Data{FormID} = $WebUploadCacheObject->FormIDCreate();
  1080 + if ($Param{Public}) {
  1081 + $Data{PublicMode} = "Public";
  1082 + }
  1083 +
  1084 + $Output .= $LayoutObject->Output(
  1085 + Data => \%Data,
  1086 + TemplateFile => 'NewTicketWizard',
  1087 + );
  1088 +
  1089 + $Output .= $LayoutObject->CustomerFooter(Type => $idCustomTemplate);
  1090 + return $Output;
  1091 +}
  1092 +
  1093 +=head
  1094 +Separate service-field label names, to make it human-readable (CapitalLikeLabels -> Capital like labels)
  1095 +=cut
  1096 +sub breakWords {
  1097 + my ( $Self, %Param ) = @_;
  1098 +
  1099 + my $return = $Param{Text};
  1100 +
  1101 + $return =~ s/(.)([A-Z][^A-Z])/$1 $2/g;
  1102 + $return =~ s/([\w']+)/\u\L$1/g;
  1103 +
  1104 + return $return;
  1105 +}
  1106 +
  1107 +sub Debug {
  1108 + my $Self = shift;
  1109 + my $msg = shift;
  1110 + $Kernel::OM->Get("Kernel::System::Log")->Log( Priority => 'debug', Message => $msg );
  1111 +}
  1112 +
  1113 +
193 1114 1;
... ...
NewTicketWizard.sopm
1 1 <?xml version="1.0" encoding="utf-8" ?>
2 2 <otrs_package version="1.0">
3 3 <Name>NewTicketWizard</Name>
4   - <Version>2.2.0</Version>
  4 + <Version>3.0.10</Version>
5 5 <Framework>5.0.x</Framework>
6 6 <Vendor>SeTIC</Vendor>
7 7 <URL>http://www.setic.ufsc.br</URL>
... ... @@ -30,6 +30,8 @@
30 30 <ChangeLog version="2.0.3">Fix for invalid e-mail message</ChangeLog>
31 31 <ChangeLog version="2.1.8">Support for CKEditor</ChangeLog>
32 32 <ChangeLog version="2.2.0">Support for Image Upload direct on the CKEditor</ChangeLog>
  33 + <ChangeLog version="2.2.1">Fixes for AlpacaJS (dropdown)</ChangeLog>
  34 + <ChangeLog version="3.0.10">Conversion to Bootstrap, support for images and multiple file upload</ChangeLog>
33 35 <IntroInstall Type="post" Title="Thank you">New Ticket Wizard module installed successfully!</IntroInstall>
34 36 <BuildDate>?</BuildDate>
35 37 <BuildHost>?</BuildHost>
... ... @@ -43,29 +45,32 @@
43 45 <File Permission="644" Location="Kernel/Modules/NewTicketWizard.pm"></File>
44 46 <File Permission="644" Location="Kernel/Modules/NewTicketWizardPublic.pm"></File>
45 47 <File Permission="644" Location="Kernel/Modules/NewTicketWizardServiceForm.pm"></File>
46   - <File Permission="644" Location="Kernel/System/RestrictedService.pm"></File>
47 48  
48 49 <File Permission="644" Location="Kernel/Output/HTML/Templates/Standard/NewTicketWizard.tt"></File>
49   - <File Permission="644" Location="Kernel/Output/HTML/Templates/Standard/NewTicketWizardPublic.tt"></File>
50 50 <File Permission="644" Location="Kernel/Output/HTML/Templates/Standard/NewTicketWizardServiceForm.tt"></File>
51 51 <File Permission="644" Location="Kernel/Output/HTML/Templates/Standard/NewTicketWizardServiceFormEdit.tt"></File>
52 52 <File Permission="644" Location="Kernel/Output/HTML/Templates/Standard/NewTicketWizardTicketCreated.tt"></File>
53   - <File Permission="644" Location="Kernel/Output/HTML/Templates/Standard/NewTicketWizardTicketCreatedPublic.tt"></File>
54 53  
55 54 <File Permission="644" Location="Kernel/System/ServiceForm.pm"></File>
56 55 <File Permission="644" Location="Kernel/System/TicketWizard.pm"></File>
  56 + <File Permission="644" Location="Kernel/System/RestrictedService.pm"></File>
57 57  
58   - <File Permission="644" Location="var/httpd/htdocs/js/thirdparty/alpaca/alpaca-full.min.js"></File>
59   - <File Permission="644" Location="var/httpd/htdocs/js/thirdparty/alpaca/jquery.sumoselect.js"></File>
60   - <File Permission="644" Location="var/httpd/htdocs/js/thirdparty/alpaca/datatables.js"></File>
61   - <File Permission="644" Location="var/httpd/htdocs/js/thirdparty/handlebars/handlebars.js"></File>
62   - <File Permission="644" Location="var/httpd/htdocs/js/jquery.jsonview.js"></File>
63   - <File Permission="644" Location="var/httpd/htdocs/js/NewTicketWizard.js"></File>
64   -
65   - <File Permission="644" Location="var/httpd/htdocs/js/jquery.chili.js"></File>
66   - <File Permission="644" Location="var/httpd/htdocs/js/jquery.chili.recipes.javascript.js"></File>
67   - <File Permission="644" Location="var/httpd/htdocs/js/jquery.chili.recipes.js"></File>
  58 + <File Permission="644" Location="var/httpd/htdocs/js/thirdparty/alpaca/alpaca.min.js"></File>
  59 + <File Permission="644" Location="var/httpd/htdocs/js/thirdparty/alpaca/handlebars.js"></File>
  60 +
  61 + <File Permission="644" Location="var/httpd/htdocs/js/thirdparty/jquerychili/jquery.chili.js"></File>
  62 + <File Permission="644" Location="var/httpd/htdocs/js/thirdparty/jquerychili/jquery.chili.recipes.javascript.js"></File>
  63 + <File Permission="644" Location="var/httpd/htdocs/js/thirdparty/jquerychili/jquery.chili.recipes.js"></File>
  64 +
  65 + <File Permission="644" Location="var/httpd/htdocs/js/thirdparty/jqueryfileupload/jquery.fileupload-process.js"></File>
  66 + <File Permission="644" Location="var/httpd/htdocs/js/thirdparty/jqueryfileupload/jquery.fileupload-ui.js"></File>
  67 + <File Permission="644" Location="var/httpd/htdocs/js/thirdparty/jqueryfileupload/jquery.fileupload.js"></File>
  68 + <File Permission="644" Location="var/httpd/htdocs/js/thirdparty/jqueryfileupload/jquery.iframe-transport.js"></File>
  69 + <File Permission="644" Location="var/httpd/htdocs/js/thirdparty/jqueryfileupload/jquery.ui.widget.js"></File>
68 70  
  71 + <File Permission="644" Location="var/httpd/htdocs/js/thirdparty/jqueryjsonview/jquery.jsonview.js"></File>
  72 +
  73 + <File Permission="644" Location="var/httpd/htdocs/js/NewTicketWizard.js"></File>
69 74  
70 75 <File Permission="644" Location="var/httpd/htdocs/skins/Customer/default/css/alpaca/images/alpaca-icons.png"></File>
71 76 <File Permission="644" Location="var/httpd/htdocs/skins/Customer/default/css/alpaca/images/date.png"></File>
... ... @@ -75,16 +80,13 @@
75 80 <File Permission="644" Location="var/httpd/htdocs/skins/Customer/default/css/alpaca/images/phone.png"></File>
76 81 <File Permission="644" Location="var/httpd/htdocs/skins/Customer/default/css/alpaca/images/time.png"></File>
77 82  
78   -
79   - <File Permission="644" Location="var/httpd/htdocs/skins/Customer/default/css/alpaca/alpaca-jqueryui-newticketwizard.css"></File>
80   - <File Permission="644" Location="var/httpd/htdocs/skins/Customer/default/css/alpaca/alpaca-newticketwizard.css"></File>
81   - <File Permission="644" Location="var/httpd/htdocs/skins/Customer/default/css/alpaca/sumoselect.css"></File>
82   - <File Permission="644" Location="var/httpd/htdocs/skins/Customer/default/css/alpaca/datatables.css"></File>
  83 + <File Permission="644" Location="var/httpd/htdocs/skins/Customer/default/css/alpaca/alpaca.min.css"></File>
  84 +
  85 + <File Permission="644" Location="var/httpd/htdocs/skins/Customer/default/css/jqueryfileupload/jquery.fileupload-ui.css"></File>
  86 + <File Permission="644" Location="var/httpd/htdocs/skins/Customer/default/css/jqueryfileupload/jquery.fileupload.css"></File>
83 87  
84 88 <File Permission="644" Location="var/httpd/htdocs/skins/Agent/default/css/jquery.jsonview.css"></File>
85 89  
86   -
87   -
88 90 </Filelist>
89 91 <DatabaseInstall>
90 92 <TableCreate Name="service_form">
... ...
NewTicketWizardSeTIC.sopm
1 1 <?xml version="1.0" encoding="utf-8" ?>
2 2 <otrs_package version="1.0">
3 3 <Name>NewTicketWizardSeTIC</Name>
4   - <Version>1.0.1</Version>
  4 + <Version>3.0.8</Version>
5 5 <Framework>5.0.x</Framework>
6 6 <Vendor>SeTIC</Vendor>
7 7 <URL>http://www.setic.ufsc.br</URL>
... ... @@ -9,6 +9,7 @@
9 9 <Description>NewTicket Wizard Module Template for SeTIC</Description>
10 10 <ChangeLog version="1.0.0">First version</ChangeLog>
11 11 <ChangeLog version="1.0.1">Media separation</ChangeLog>
  12 + <ChangeLog version="3.0.8">Support for bootstrap</ChangeLog>
12 13 <IntroInstall Type="post" Title="Thank you">New Ticket Wizard SeTIC Template module installed successfully!</IntroInstall>
13 14 <BuildDate>?</BuildDate>
14 15 <BuildHost>?</BuildHost>
... ...
NewTicketWizardUFSC.sopm
1 1 <?xml version="1.0" encoding="utf-8" ?>
2 2 <otrs_package version="1.0">
3 3 <Name>NewTicketWizardUFSC</Name>
4   - <Version>1.1.1</Version>
  4 + <Version>1.2.0</Version>
5 5 <Framework>5.0.x</Framework>
6 6 <Vendor>SeTIC</Vendor>
7 7 <URL>http://www.setic.ufsc.br</URL>
... ... @@ -11,6 +11,7 @@
11 11 <ChangeLog version="1.0.1">Fix for footer</ChangeLog>
12 12 <ChangeLog version="1.1.0">Changes for OTRS 5.0.x</ChangeLog>
13 13 <ChangeLog version="1.1.1">Media separation</ChangeLog>
  14 + <ChangeLog version="1.2.0">Support for formatting and fixes for AlpacaJS</ChangeLog>
14 15 <IntroInstall Type="post" Title="Thank you">New Ticket Wizard UFSC Template module installed successfully!</IntroInstall>
15 16 <BuildDate>?</BuildDate>
16 17 <BuildHost>?</BuildHost>
... ...
atualizaAlpaca.sh
1 1 #!/bin/sh
  2 +
2 3 cp ../alpaca/build/alpaca/bootstrap/alpaca.js var/httpd/htdocs/js/thirdparty/alpaca/alpaca.min.js
3 4 cp ../alpaca/build/alpaca/bootstrap/alpaca.css var/httpd/htdocs/skins/Customer/default/css/alpaca/alpaca.min.css
4 5 cp ../alpaca/lib/handlebars/handlebars.js var/httpd/htdocs/js/thirdparty/alpaca/handlebars.js
... ...
scripts/test/SchemaTest.t 100644 → 100755
var/httpd/htdocs/js/NewTicketWizard.js 100644 → 100755
var/httpd/htdocs/js/thirdparty/alpaca/.alpaca-full.min.js.swp
No preview for this file type
var/httpd/htdocs/js/thirdparty/alpaca/alpaca.min.js 100644 → 100755
var/httpd/htdocs/js/thirdparty/alpaca/handlebars.js 100644 → 100755
var/httpd/htdocs/js/thirdparty/jquerychili/jquery.chili.js 100644 → 100755
var/httpd/htdocs/js/thirdparty/jquerychili/jquery.chili.recipes.javascript.js 100644 → 100755
var/httpd/htdocs/js/thirdparty/jquerychili/jquery.chili.recipes.js 100644 → 100755
var/httpd/htdocs/js/thirdparty/jqueryfileupload/jquery.fileupload-process.js 100644 → 100755
var/httpd/htdocs/js/thirdparty/jqueryfileupload/jquery.fileupload-ui.js 100644 → 100755
var/httpd/htdocs/skins/Customer/default/css/alpaca/alpaca-jqueryui-newticketwizard.css
... ... @@ -1,63 +0,0 @@
1   -/*!
2   -Alpaca Version 1.1.1
3   -
4   -Copyright 2013 Gitana Software, Inc.
5   -
6   -Licensed under the Apache License, Version 2.0 (the "License");
7   -you may not use this file except in compliance with the License.
8   -
9   -You may obtain a copy of the License at
10   - http://www.apache.org/licenses/LICENSE-2.0
11   -
12   -Unless required by applicable law or agreed to in writing, software
13   -distributed under the License is distributed on an "AS IS" BASIS,
14   -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15   -See the License for the specific language governing permissions and
16   -limitations under the License.
17   -
18   -For more information, please contact Gitana Software, Inc. at this
19   -address:
20   -
21   - info@gitanasoftware.com
22   -*/
23   -
24   -.yui3-cssreset html{color:#000;background:#FFF}.yui3-cssreset body,.yui3-cssreset div,.yui3-cssreset dl,.yui3-cssreset dt,.yui3-cssreset dd,.yui3-cssreset ul,.yui3-cssreset ol,.yui3-cssreset li,.yui3-cssreset h1,.yui3-cssreset h2,.yui3-cssreset h3,.yui3-cssreset h4,.yui3-cssreset h5,.yui3-cssreset h6,.yui3-cssreset pre,.yui3-cssreset code,.yui3-cssreset form,.yui3-cssreset fieldset,.yui3-cssreset legend,.yui3-cssreset input,.yui3-cssreset textarea,.yui3-cssreset p,.yui3-cssreset blockquote,.yui3-cssreset th,.yui3-cssreset td{margin:0;padding:0}.yui3-cssreset table{border-collapse:collapse;border-spacing:0}.yui3-cssreset fieldset,.yui3-cssreset img{border:0}.yui3-cssreset address,.yui3-cssreset caption,.yui3-cssreset cite,.yui3-cssreset code,.yui3-cssreset dfn,.yui3-cssreset em,.yui3-cssreset strong,.yui3-cssreset th,.yui3-cssreset var{font-style:normal;font-weight:normal}.yui3-cssreset ol,.yui3-cssreset ul{list-style:none}.yui3-cssreset caption,.yui3-cssreset th{text-align:left}.yui3-cssreset h1,.yui3-cssreset h2,.yui3-cssreset h3,.yui3-cssreset h4,.yui3-cssreset h5,.yui3-cssreset h6{font-size:100%;font-weight:normal}.yui3-cssreset q:before,.yui3-cssreset q:after{content:''}.yui3-cssreset abbr,.yui3-cssreset acronym{border:0;font-variant:normal}.yui3-cssreset sup{vertical-align:text-top}.yui3-cssreset sub{vertical-align:text-bottom}.yui3-cssreset input,.yui3-cssreset textarea,.yui3-cssreset select{font-family:inherit;font-size:inherit;font-weight:inherit}.yui3-cssreset input,.yui3-cssreset textarea,.yui3-cssreset select{*font-size:100%}.yui3-cssreset legend{color:#000}#yui3-css-stamp.cssreset-context{display:none}
25   -
26   -.alpaca-container-item { margin-bottom: 10px; }
27   -
28   -i.alpaca-icon-helper { display: inline-block !important; }
29   -
30   -span.alpaca-icon-required { display: inline-block !important; }
31   -
32   -.alpaca-control-label {width: 200px}
33   -
34   -.alpaca-container-item p { margin-left: 200px }
35   -
36   -.alpaca-readonly input:disabled { background-color: rgb(220, 220, 220); }
37   -
38   -.alpaca-float-right
39   -{
40   - float: none;
41   - margin-left: 300px;
42   -}
43   -
44   -legend.alpaca-container-label {
45   - width: 200px;
46   - margin-left: 200px;
47   - font-weight: bold;
48   -}
49   -
50   -/** Added to the dom element holding the toolbar for an array **/
51   -.alpaca-array-toolbar
52   -{
53   - margin-left: 200px;
54   -}
55   -
56   -.dataTables_wrapper {
57   - width: 60% !important;
58   -}
59   -
60   -
61   -.dataTables_wrapper input {
62   - width: 100%;
63   -}
var/httpd/htdocs/skins/Customer/default/css/alpaca/alpaca-newticketwizard.css
... ... @@ -1,703 +0,0 @@
1   -/** Added to outer field elements to hide them **/
2   -.alpaca-hidden
3   -{
4   - display: none;
5   -}
6   -
7   -/** Added to every field outer element **/
8   -.alpaca-field
9   -{
10   -
11   -}
12   -
13   -/** Added to every container outer field element **/
14   -.alpaca-container
15   -{
16   -
17   -}
18   -
19   -/** Added to the optional label (or legend) accompanying any container **/
20   -.alpaca-container-label
21   -{
22   -
23   -}
24   -
25   -/** Added to every container item field within a container **/
26   -.alpaca-container-item
27   -{
28   -
29   -}
30   -
31   -/** Added to the first container item field within a container **/
32   -.alpaca-container-item-first
33   -{
34   -
35   -}
36   -
37   -/** Added to the last container item field within a container **/
38   -.alpaca-container-item-last
39   -{
40   -
41   -}
42   -
43   -/** Added to a container to indicate it is empty **/
44   -.alpaca-container-empty
45   -{
46   -
47   -}
48   -
49   -/** Added to the dom element holding the toolbar for an array **/
50   -.alpaca-array-toolbar
51   -{
52   -
53   -}
54   -
55   -/** Added to a button in the array toolbar that triggers an action **/
56   -.alpaca-array-toolbar-action
57   -{
58   -
59   -}
60   -
61   -/** Added to the dom element holding the actionbar for each array item **/
62   -.alpaca-array-actionbar
63   -{
64   -
65   -}
66   -
67   -/** Added to a button in an array item actionbar that triggers an action **/
68   -.alpaca-array-actionbar-action
69   -{
70   -
71   -}
72   -
73   -/** Added to every control outer field element **/
74   -.alpaca-control
75   -{
76   -
77   -}
78   -
79   -/** Added to the optional label accompanying any control **/
80   -.alpaca-control-label
81   -{
82   -
83   -}
84   -
85   -/** ******************************************************** **/
86   -/** STATE LABELS **/
87   -/** ******************************************************** **/
88   -
89   -/** Added to top-most control when rendering in display mode **/
90   -.alpaca-display
91   -{
92   -
93   -}
94   -
95   -/** Added to top-most control when rendering in create mode **/
96   -.alpaca-create
97   -{
98   -
99   -}
100   -
101   -/** Added to top-most control when rendering in edit mode **/
102   -.alpaca-edit
103   -{
104   -
105   -}
106   -
107   -/** Added to any field that is optional **/
108   -.alpaca-required
109   -{
110   -
111   -}
112   -
113   -/** Added to any field that is required **/
114   -.alpaca-optional
115   -{
116   -
117   -}
118   -
119   -/** Added to any field that is readonly **/
120   -.alpaca-readonly
121   -{
122   -
123   -}
124   -
125   -/** Added to any field that is disabled **/
126   -.alpaca-disabled
127   -{
128   -
129   -}
130   -
131   -/** Added to the container that holds Alpaca field helper text **/
132   -.alpaca-helper
133   -{
134   -
135   -}
136   -
137   -/** Added to form containers that are rendering in horizontal mode **/
138   -.alpaca-horizontal
139   -{
140   -
141   -}
142   -
143   -/** Added to form containers that are rendering in vertical mode **/
144   -.alpaca-vertical
145   -{
146   -
147   -}
148   -
149   -/** Added to the top most container element **/
150   -.alpaca-top
151   -{
152   -
153   -}
154   -
155   -/** Added to fields that are valid **/
156   -.alpaca-valid
157   -{
158   -
159   -}
160   -
161   -/** Added to fields that have run through validation and are invalid **/
162   -.alpaca-invalid
163   -{
164   -
165   -}
166   -
167   -/** Added to fields that have run through validation and are invalid but are currently hiding invalidation errors **/
168   -.alpaca-invalid-hidden
169   -{
170   -
171   -}
172   -
173   -/* Added to additional DOM elements to mark validation messages */
174   -.alpaca-message
175   -{
176   -
177   -}
178   -
179   -/** Added to messages that are for invalidation states that are current hidden (hideInitValidationError) **/
180   -.alpaca-message-hidden
181   -{
182   -
183   -}
184   -
185   -/** Added to buttons that are marked disabled */
186   -.alpaca-button-disabled
187   -{
188   -
189   -}
190   -
191   -
192   -
193   -/** ******************************************************** **/
194   -/** ICONS **/
195   -/** ******************************************************** **/
196   -
197   -.alpaca-icon-helper
198   -{
199   -
200   -}
201   -
202   -.alpaca-icon-required
203   -{
204   -
205   -}
206   -
207   -
208   -/** ******************************************************** **/
209   -/** OTHER **/
210   -/** ******************************************************** **/
211   -
212   -.alpaca-autocomplete
213   -{
214   -}
215   -
216   -
217   -
218   -/** Added to indicate hover state **/
219   -.alpaca-hover
220   -{
221   -}
222   -
223   -/** General purpose HTML clear **/
224   -.alpaca-clear
225   -{
226   - clear: both;
227   -}
228   -
229   -.alpaca-float-right
230   -{
231   - float: right;
232   -}
233   -
234   -
235   -/** ************************************** **/
236   -/** TWITTER TYPEAHEAD **/
237   -/** ************************************** **/
238   -
239   -.twitter-typeahead .tt-dropdown-menu
240   -{
241   - background-color: white;
242   - border: 1px #ccc solid;
243   - padding: 10px;
244   - color: #999;
245   - width: 100%;
246   - padding-bottom: 0px;
247   -}
248   -
249   -.twitter-typeahead .tt-dropdown-menu P
250   -{
251   - font-size: 1em;
252   -}
253   -
254   -.tt-suggestion.tt-is-under-cursor
255   -{
256   - background-color: #ccc;
257   - color: #333;
258   -}
259   -
260   -.tt-dropdown-menu
261   -{
262   - background-color: white;
263   - border: 1px solid rgb(204, 204, 204);
264   - width: 100%;
265   -}
266   -
267   -
268   -
269   -
270   -/** ************************************** **/
271   -/** EDITOR FIELD **/
272   -/** ************************************** **/
273   -
274   -.alpaca-controlfield-editor
275   -{
276   - position: relative;
277   - width: 100%;
278   - height: 300px;
279   - border: 1px #ccc solid;
280   -}
281   -
282   -.alpaca-controlfield-editor .control-field-editor-el
283   -{
284   - position:absolute;
285   - top:0;
286   - bottom:0;
287   - left: 0;
288   - right:0
289   -}
290   -
291   -
292   -
293   -/** ************************************** **/
294   -/** DATEPICKER (jQueryUI) **/
295   -/** ************************************** **/
296   -
297   -#ui-datepicker-div
298   -{
299   - display: none;
300   - background-color:white;
301   - z-index: 9999999 !important;
302   - width: 22em !important;
303   -}
304   -
305   -/* Fix for Chrome issue with Button text */
306   -.ui-button .ui-button-text {
307   - white-space: nowrap;
308   -}
309   -
310   -.ui-datepicker
311   -{
312   - z-index: 100;
313   -}
314   -
315   -
316   -
317   -
318   -
319   -
320   -
321   -
322   -/** ************************************** **/
323   -/** FILE UPLOAD (jQueryUI) **/
324   -/** ************************************** **/
325   -
326   -.alpaca-fileupload-container
327   -{
328   - border: 1px #ccc solid;
329   - padding: 10px;
330   - border-radius: 5px;
331   -}
332   -
333   -.alpaca-fileupload-container .row
334   -{
335   - margin-bottom: 10px;
336   -}
337   -
338   -.alpaca-fileupload-well
339   -{
340   - /*border: 1px #ccc solid;*/
341   - padding: 10px;
342   - border-radius: 5px;
343   - min-height: 100px;
344   -}
345   -
346   -.alpaca-fileupload-container table
347   -{
348   - border: 1px #ccc solid;
349   - padding: 10px;
350   - border-radius: 5px;
351   -}
352   -
353   -.alpaca-fileupload-well p
354   -{
355   - padding-top: 20px;
356   - color: #888;
357   -}
358   -
359   -.alpaca-fileupload-well table tbody.files tr td.name
360   -{
361   - word-wrap: break-word;
362   -}
363   -
364   -
365   -
366   -
367   -
368   -
369   -
370   -/** ************************************** **/
371   -/** ACE EDITOR **/
372   -/** ************************************** **/
373   -
374   -.ace_editor
375   -{
376   - border: 1px solid rgb(204, 204, 204);
377   -}
378   -
379   -
380   -
381   -/** ************************************** **/
382   -/** CK EDITOR **/
383   -/** ************************************** **/
384   -
385   -.alpaca-field-ckeditor.alpaca-invalid > .cke
386   -{
387   - border-color: #f04124;
388   -}
389   -
390   -.has-error .multiselect
391   -{
392   - border-color: #a94442;
393   - -webkit-box-shadow: inset 0 1px 1px rgba(0,0,0,.075);
394   - box-shadow: inset 0 1px 1px rgba(0,0,0,.075);
395   -}
396   -
397   -
398   -/** ************************************** **/
399   -/** OPTIONTREE **/
400   -/** ************************************** **/
401   -
402   -.alpaca-field-optiontree {
403   -
404   -}
405   -
406   -.alpaca-field-optiontree .optiontree {
407   -
408   -}
409   -
410   -.alpaca-field-optiontree .optiontree .optiontree-selector {
411   -
412   -}
413   -
414   -.alpaca-field-optiontree.optiontree-horizontal {
415   -
416   -}
417   -
418   -.alpaca-field-optiontree.optiontree-horizontal .optiontree {
419   - display: inline-block;
420   -}
421   -
422   -.alpaca-field-optiontree.optiontree-horizontal .optiontree .optiontree-selector {
423   - display: inline-block;
424   - padding-left: 4px;
425   -}
426   -
427   -.alpaca-field-optiontree.optiontree-horizontal input {
428   - display: inline-block;
429   - width: auto;
430   -}
431   -
432   -.alpaca-field-optiontree.optiontree-horizontal label {
433   - display: block;
434   -}
435   -
436   -
437   -
438   -
439   -
440   -.alpaca-field-table .actionbar
441   -{
442   - white-space: nowrap;
443   - text-align: center;
444   -}
445   -
446   -.alpaca-field-table table tr td .alpaca-field
447   -{
448   - width: 100%;
449   -}
450   -
451   -.alpaca-field-table table tr td .alpaca-field .form-control
452   -{
453   - width: 100%;
454   -}
455   -
456   -.alpaca-field-table .form-group
457   -{
458   - margin-bottom: 0px;
459   -}
460   -
461   -.alpaca-field-table .form-group.alpaca-field-checkbox
462   -{
463   - text-align: center;
464   -}
465   -
466   -.alpaca-field-table .alpaca-control.checkbox
467   -{
468   - /*
469   - margin: 0px;
470   - padding: 0px;
471   - */
472   - padding-top: 6px;
473   -}
474   -
475   -/*
476   -.alpaca-field-table .alpaca-control.checkbox input[type='checkbox']
477   -{
478   - margin-left: -16px;
479   - margin-top: -3px;
480   -}
481   -*/
482   -
483   -.alpaca-field-table table tr td.actionbar .alpaca-array-actionbar
484   -{
485   - padding-bottom: 0px;
486   -}
487   -
488   -.alpaca-field-table .actionbar .alpaca-array-actionbar.btn-group
489   -{
490   - width: auto;
491   -}
492   -
493   -.alpaca-table-column-hidden
494   -{
495   - display: none;
496   -}
497   -
498   -.alpaca-field-radio.disabled .alpaca-control.radio
499   -{
500   - color: grey;
501   -}
502   -
503   -.alpaca-field-radio.disabled .alpaca-control.radio label
504   -{
505   - cursor: inherit;
506   -}
507   -.alpaca-icon-required
508   -{
509   - display: inline-block;
510   -}
511   -
512   -.alpaca-icon-helper
513   -{
514   - display: inline-block;
515   -}
516   -
517   -.alpaca-container.alpaca-vertical .alpaca-control-label
518   -{
519   - display: block;
520   -}
521   -
522   -.alpaca-container.alpaca-vertical .alpaca-control
523   -{
524   - display: block;
525   -}
526   -
527   -.alpaca-control-label
528   -{
529   - font-weight: 600;
530   -}
531   -
532   -.alpaca-field-tablerow label.alpaca-control-label
533   -{
534   - display: none !important;
535   -}
536   -
537   -/*!
538   - * Gridpak Beta CSS
539   - *
540   - * Generator - http://gridpak.com/
541   - * Created by @erskinedesign
542   - */
543   -
544   -/* Reusable column setup */
545   -.col {
546   - border:0px solid rgba(0,0,0,0);
547   - float:left;
548   - -webkit-box-sizing:border-box;
549   - -moz-box-sizing:border-box;
550   - box-sizing:border-box;
551   - -moz-background-clip:padding-box !important;
552   - -webkit-background-clip:padding-box !important;
553   - background-clip:padding-box !important;
554   -}
555   -
556   -/* 1. 12 Column Grid 0px - 959px
557   ------------------------------------------------------------------------------
558   -
559   -Span 1: 8.33333333333%
560   -Span 2: 16.6666666667%
561   -Span 3: 25.0%
562   -Span 4: 33.3333333333%
563   -Span 5: 41.6666666667%
564   -Span 6: 50.0%
565   -Span 7: 58.3333333333%
566   -Span 8: 66.6666666667%
567   -Span 9: 75.0%
568   -Span 10: 83.3333333333%
569   -Span 11: 91.6666666667%
570   -Span 12: 100%
571   -
572   ------------------------------------------------------------------------------ */
573   -
574   -@media screen and (min-width: 0px) and (max-width: 959px) {
575   -
576   - .col {
577   - margin-left:0%;
578   - padding:0 0%;
579   - }
580   -
581   - .row .col:first-child {
582   - margin-left:0;
583   - }
584   -
585   -
586   - /*
587   - Add your semantic classnames in alongside their corresponding spans here. e.g.
588   -
589   - .span_3,
590   - .my_semantic_class_name {
591   - ...
592   - }
593   - */
594   -
595   - .span_1 {
596   - width:8.33333333333%;
597   - }
598   - .span_2 {
599   - width:16.6666666667%;
600   - }
601   - .span_3 {
602   - width:25.0%;
603   - }
604   - .span_4 {
605   - width:33.3333333333%;
606   - }
607   - .span_5 {
608   - width:41.6666666667%;
609   - }
610   - .span_6 {
611   - width:50.0%;
612   - }
613   - .span_7 {
614   - width:58.3333333333%;
615   - }
616   - .span_8 {
617   - width:66.6666666667%;
618   - }
619   - .span_9 {
620   - width:75.0%;
621   - }
622   - .span_10 {
623   - width:83.3333333333%;
624   - }
625   - .span_11 {
626   - width:91.6666666667%;
627   - }
628   - .span_12 {
629   - margin-left:0;
630   - width:100%;
631   - }
632   -}
633   -
634   -/* 2. 12 Column Grid 960px - Infinity
635   ------------------------------------------------------------------------------
636   -
637   -Span 1: 8.33333333333%
638   -Span 2: 16.6666666667%
639   -Span 3: 25.0%
640   -Span 4: 33.3333333333%
641   -Span 5: 41.6666666667%
642   -Span 6: 50.0%
643   -Span 7: 58.3333333333%
644   -Span 8: 66.6666666667%
645   -Span 9: 75.0%
646   -Span 10: 83.3333333333%
647   -Span 11: 91.6666666667%
648   -Span 12: 100%
649   -
650   ------------------------------------------------------------------------------ */
651   -
652   -@media screen and (min-width: 960px) {
653   -
654   - .col {
655   - margin-left:0%;
656   - padding:0 0%;
657   - }
658   -
659   - .row .col:first-child {
660   - margin-left:0;
661   - }
662   -
663   -
664   -
665   - .span_1 {
666   - width:8.33333333333%;
667   - }
668   - .span_2 {
669   - width:16.6666666667%;
670   - }
671   - .span_3 {
672   - width:25.0%;
673   - }
674   - .span_4 {
675   - width:33.3333333333%;
676   - }
677   - .span_5 {
678   - width:41.6666666667%;
679   - }
680   - .span_6 {
681   - width:50.0%;
682   - }
683   - .span_7 {
684   - width:58.3333333333%;
685   - }
686   - .span_8 {
687   - width:66.6666666667%;
688   - }
689   - .span_9 {
690   - width:75.0%;
691   - }
692   - .span_10 {
693   - width:83.3333333333%;
694   - }
695   - .span_11 {
696   - width:91.6666666667%;
697   - }
698   - .span_12 {
699   - margin-left:0;
700   - width:100%;
701   - }
702   -}
703   -
var/httpd/htdocs/skins/Customer/default/css/alpaca/alpaca.min.css 100644 → 100755
var/httpd/htdocs/skins/Customer/default/css/alpaca/images/alpaca-icons.png 100644 → 100755

2.36 KB | W: | H:

2.36 KB | W: | H:

  • 2-up
  • Swipe
  • Onion skin
var/httpd/htdocs/skins/Customer/default/css/alpaca/images/date.png 100644 → 100755

3.42 KB | W: | H:

3.42 KB | W: | H:

  • 2-up
  • Swipe
  • Onion skin
var/httpd/htdocs/skins/Customer/default/css/alpaca/images/down.png 100644 → 100755

2.85 KB | W: | H:

2.85 KB | W: | H:

  • 2-up
  • Swipe
  • Onion skin
var/httpd/htdocs/skins/Customer/default/css/alpaca/images/email.png 100644 → 100755

3.24 KB | W: | H:

3.24 KB | W: | H:

  • 2-up
  • Swipe
  • Onion skin
var/httpd/htdocs/skins/Customer/default/css/alpaca/images/left.png 100644 → 100755

170 Bytes | W: | H:

170 Bytes | W: | H:

  • 2-up
  • Swipe
  • Onion skin
var/httpd/htdocs/skins/Customer/default/css/alpaca/images/phone.png 100644 → 100755

3.35 KB | W: | H:

3.35 KB | W: | H:

  • 2-up
  • Swipe
  • Onion skin
var/httpd/htdocs/skins/Customer/default/css/alpaca/images/time.png 100644 → 100755

963 Bytes | W: | H:

963 Bytes | W: | H:

  • 2-up
  • Swipe
  • Onion skin
var/httpd/htdocs/skins/Customer/default/css/jqueryfileupload/jquery.fileupload-ui.css 100644 → 100755
var/httpd/htdocs/skins/Customer/default/css/jqueryfileupload/jquery.fileupload.css 100644 → 100755