Commit 61f0e50c351b56256f8ef671d148856d92d3fde4

Authored by anderson.peterle@previdencia.gov.br
1 parent 873da8f1
Exists in master

Melhorias em MapaCacic e Vacon.

git-svn-id: http://svn.softwarepublico.gov.br/svn/cacic/cacic/trunk/agente-windows@103 fecfc0c7-e812-0410-ae72-849f08638ee7
mapa/acesso.dcu
No preview for this file type
mapa/acesso.dfm
1 1 object frmAcesso: TfrmAcesso
2   - Left = 355
  2 + Left = 301
3 3 Top = 147
4 4 BorderIcons = []
5 5 BorderStyle = bsSingle
6 6 Caption =
7 7 'MapaCacic - M'#243'dulo Avulso para Coleta de Informa'#231#245'es Patrimoniai' +
8 8 's'
9   - ClientHeight = 158
10   - ClientWidth = 516
  9 + ClientHeight = 284
  10 + ClientWidth = 605
11 11 Color = clBtnFace
12 12 Font.Charset = DEFAULT_CHARSET
13 13 Font.Color = clWindowText
... ... @@ -145,50 +145,53 @@ object frmAcesso: TfrmAcesso
145 145 0000000FC000FC000000000FC000FDAD8035B5BFC000}
146 146 OldCreateOrder = False
147 147 Position = poDesktopCenter
  148 + OnActivate = FormActivate
148 149 OnCreate = FormCreate
149 150 OnShow = FormShow
150 151 PixelsPerInch = 96
151 152 TextHeight = 13
152 153 object btAcesso: TButton
153   - Left = 132
154   - Top = 120
  154 + Left = 174
  155 + Top = 241
155 156 Width = 100
156   - Height = 25
  157 + Height = 30
157 158 Caption = 'Acessar'
158 159 Enabled = False
159 160 Font.Charset = DEFAULT_CHARSET
160 161 Font.Color = clWindowText
161 162 Font.Height = -13
162   - Font.Name = 'MS Sans Serif'
  163 + Font.Name = 'Arial'
163 164 Font.Style = [fsBold]
164 165 ParentFont = False
165 166 TabOrder = 0
166 167 OnClick = btAcessoClick
167 168 end
168 169 object btCancela: TButton
169   - Left = 282
170   - Top = 120
  170 + Left = 324
  171 + Top = 241
171 172 Width = 100
172   - Height = 25
  173 + Height = 30
173 174 Caption = 'Cancelar'
174 175 Font.Charset = DEFAULT_CHARSET
175 176 Font.Color = clWindowText
176 177 Font.Height = -13
177   - Font.Name = 'MS Sans Serif'
  178 + Font.Name = 'Arial'
178 179 Font.Style = [fsBold]
179 180 ParentFont = False
180 181 TabOrder = 1
181 182 OnClick = btCancelaClick
182 183 end
183 184 object pnAcesso: TPanel
184   - Left = 15
185   - Top = 13
186   - Width = 485
187   - Height = 72
  185 + Left = 5
  186 + Top = 10
  187 + Width = 596
  188 + Height = 196
  189 + BevelInner = bvRaised
  190 + BevelOuter = bvLowered
188 191 TabOrder = 2
189 192 object lbNomeUsuarioAcesso: TLabel
190   - Left = 27
191   - Top = 9
  193 + Left = 56
  194 + Top = 39
192 195 Width = 109
193 196 Height = 16
194 197 Caption = 'Nome de Usu'#225'rio:'
... ... @@ -200,8 +203,8 @@ object frmAcesso: TfrmAcesso
200 203 ParentFont = False
201 204 end
202 205 object lbSenhaAcesso: TLabel
203   - Left = 306
204   - Top = 9
  206 + Left = 389
  207 + Top = 39
205 208 Width = 110
206 209 Height = 16
207 210 Caption = 'Senha de Acesso:'
... ... @@ -214,14 +217,14 @@ object frmAcesso: TfrmAcesso
214 217 end
215 218 object lbAviso: TLabel
216 219 Left = 4
217   - Top = 53
218   - Width = 477
  220 + Top = 121
  221 + Width = 587
219 222 Height = 13
220 223 Alignment = taCenter
221 224 AutoSize = False
222 225 Caption =
223   - 'ATEN'#199#195'O: O usu'#225'rio deve estar cadastrado no Gerente WEB CACIC co' +
224   - 'm n'#237'vel "T'#233'cnico"'
  226 + 'ATEN'#199#195'O: O usu'#225'rio deve estar cadastrado no Gerente WEB com n'#237've' +
  227 + 'l "T'#233'cnico"'
225 228 Font.Charset = DEFAULT_CHARSET
226 229 Font.Color = clNavy
227 230 Font.Height = -11
... ... @@ -230,8 +233,8 @@ object frmAcesso: TfrmAcesso
230 233 ParentFont = False
231 234 end
232 235 object edNomeUsuarioAcesso: TEdit
233   - Left = 27
234   - Top = 25
  236 + Left = 56
  237 + Top = 55
235 238 Width = 150
236 239 Height = 21
237 240 MaxLength = 20
... ... @@ -239,8 +242,8 @@ object frmAcesso: TfrmAcesso
239 242 OnKeyUp = edNomeUsuarioAcessoKeyUp
240 243 end
241 244 object edSenhaAcesso: TEdit
242   - Left = 306
243   - Top = 25
  245 + Left = 389
  246 + Top = 55
244 247 Width = 150
245 248 Height = 21
246 249 PasswordChar = #1
... ... @@ -249,32 +252,35 @@ object frmAcesso: TfrmAcesso
249 252 end
250 253 end
251 254 object pnMensagens: TPanel
252   - Left = 15
253   - Top = 85
254   - Width = 485
255   - Height = 23
  255 + Left = 4
  256 + Top = 205
  257 + Width = 596
  258 + Height = 24
  259 + BevelInner = bvLowered
256 260 TabOrder = 3
257 261 object lbMsg_Erro_Senha: TLabel
258 262 Left = 3
259 263 Top = 4
260   - Width = 479
261   - Height = 15
  264 + Width = 589
  265 + Height = 17
262 266 Alignment = taCenter
263 267 AutoSize = False
264 268 end
265 269 end
266 270 object pnVersao: TPanel
267   - Left = 458
268   - Top = 142
269   - Width = 56
  271 + Left = 513
  272 + Top = 267
  273 + Width = 90
270 274 Height = 14
271 275 BevelOuter = bvLowered
272 276 TabOrder = 4
273 277 object lbVersao: TLabel
274   - Left = 7
  278 + Left = 4
275 279 Top = 1
276   - Width = 41
  280 + Width = 85
277 281 Height = 12
  282 + Alignment = taCenter
  283 + AutoSize = False
278 284 Caption = 'v: X.X.X.X'
279 285 Font.Charset = DEFAULT_CHARSET
280 286 Font.Color = clWindowText
... ... @@ -284,11 +290,33 @@ object frmAcesso: TfrmAcesso
284 290 ParentFont = False
285 291 end
286 292 end
  293 + object pnNomeServidorWEB: TPanel
  294 + Left = 1
  295 + Top = 267
  296 + Width = 90
  297 + Height = 14
  298 + BevelOuter = bvLowered
  299 + TabOrder = 5
  300 + object lbNomeServidorWEB: TLabel
  301 + Left = 3
  302 + Top = 1
  303 + Width = 83
  304 + Height = 12
  305 + Alignment = taCenter
  306 + AutoSize = False
  307 + Font.Charset = DEFAULT_CHARSET
  308 + Font.Color = clWindowText
  309 + Font.Height = -9
  310 + Font.Name = 'Arial'
  311 + Font.Style = [fsBold]
  312 + ParentFont = False
  313 + end
  314 + end
287 315 object tm_Mensagem: TTimer
288 316 Enabled = False
289 317 Interval = 5000
290 318 OnTimer = tm_MensagemTimer
291   - Left = 240
292   - Top = 120
  319 + Left = 282
  320 + Top = 241
293 321 end
294 322 end
... ...
mapa/acesso.pas
  1 +(**
  2 +---------------------------------------------------------------------------------------------------------------------------------------------------------------
  3 +Copyright 2000, 2001, 2002, 2003, 2004, 2005 Dataprev - Empresa de Tecnologia e Informações da Previdência Social, Brasil
  4 +
  5 +Este arquivo é parte do programa CACIC - Configurador Automático e Coletor de Informações Computacionais
  6 +
  7 +O CACIC é um software livre; você pode redistribui-lo e/ou modifica-lo dentro dos termos da Licença Pública Geral GNU como
  8 +publicada pela Fundação do Software Livre (FSF); na versão 2 da Licença, ou (na sua opinião) qualquer versão.
  9 +
  10 +Este programa é distribuido na esperança que possa ser util, mas SEM NENHUMA GARANTIA; sem uma garantia implicita de ADEQUAÇÂO a qualquer
  11 +MERCADO ou APLICAÇÃO EM PARTICULAR. Veja a Licença Pública Geral GNU para maiores detalhes.
  12 +
  13 +Você deve ter recebido uma cópia da Licença Pública Geral GNU, sob o título "LICENCA.txt", junto com este programa, se não, escreva para a Fundação do Software
  14 +Livre(FSF) Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
  15 +---------------------------------------------------------------------------------------------------------------------------------------------------------------
  16 +*)
  17 +
1 18 unit acesso;
2 19  
3 20 interface
... ... @@ -21,6 +38,8 @@ type
21 38 pnVersao: TPanel;
22 39 lbVersao: TLabel;
23 40 tm_Mensagem: TTimer;
  41 + pnNomeServidorWEB: TPanel;
  42 + lbNomeServidorWEB: TLabel;
24 43 procedure btAcessoClick(Sender: TObject);
25 44 procedure btCancelaClick(Sender: TObject);
26 45 procedure FormCreate(Sender: TObject);
... ... @@ -30,6 +49,7 @@ type
30 49 procedure edSenhaAcessoKeyUp(Sender: TObject; var Key: Word;
31 50 Shift: TShiftState);
32 51 procedure tm_MensagemTimer(Sender: TObject);
  52 + procedure FormActivate(Sender: TObject);
33 53 private
34 54 { Private declarations }
35 55 public
... ... @@ -120,7 +140,17 @@ procedure TfrmAcesso.FormCreate(Sender: TObject);
120 140 begin
121 141 frmAcesso.lbVersao.Caption := 'v: ' + frmMapaCacic.GetVersionInfo(ParamStr(0));
122 142 frmMapaCacic.tStringsCipherOpened := frmMapaCacic.CipherOpen(frmMapaCacic.strDatFileName);
  143 + frmMapaCacic.lbNomeServidorWEB.Caption := frmMapaCacic.GetValorDatMemoria('Configs.EnderecoServidor', frmMapaCacic.tStringsCipherOpened);
123 144 frmMapaCacic.lbMensagens.Caption := 'Entrada de Dados para Autenticação no Módulo Gerente WEB Cacic';
  145 + if (frmMapaCacic.GetValorDatMemoria('TcpIp.TE_NODE_ADDRESS' , frmMapaCacic.tStringsCipherOpened)='') then
  146 + Begin
  147 + frmMapaCacic.boolAcessoOK := false;
  148 + MessageDLG(#13#10+'Atenção! É necessário executar as coletas do Sistema Cacic.' + #13#10 + #13#10 +
  149 + 'Caso o Sistema Cacic já esteja instalado, clique com botão direito' + #13#10 +
  150 + 'sobre o ícone da bandeja, escolha a opção "Executar Agora" e aguarde' + #13#10 +
  151 + 'o fim do processo.',mtError,[mbOK],0);
  152 + frmMapaCacic.Finalizar(false);
  153 + End;
124 154 end;
125 155  
126 156 procedure TfrmAcesso.edNomeUsuarioAcessoKeyUp(Sender: TObject;
... ... @@ -155,4 +185,19 @@ begin
155 185 lbMsg_Erro_Senha.Font.Color := clBlack;
156 186 end;
157 187  
  188 +procedure TfrmAcesso.FormActivate(Sender: TObject);
  189 +var strAux : String;
  190 +begin
  191 + strAux := frmMapaCacic.GetValorDatMemoria('Configs.EnderecoServidor', frmMapaCacic.tStringsCipherOpened);
  192 + if not (strAux = '') then
  193 + Begin
  194 + frmAcesso.lbNomeServidorWEB.Caption := strAux;
  195 + End
  196 + else
  197 + Begin
  198 + frmMapaCacic.Mensagem('Favor verificar a instalação do Cacic.' +#13#10 + 'Não Existe Servidor de Aplicação configurado!',true);
  199 + frmMapaCacic.Finalizar(true);
  200 + End;
  201 +end;
  202 +
158 203 end.
... ...
mapa/main_mapa.dcu
No preview for this file type
mapa/main_mapa.dfm
... ... @@ -477,15 +477,15 @@ object frmMapaCacic: TfrmMapaCacic
477 477 end
478 478 end
479 479 object btGravarInformacoes: TButton
480   - Left = 166
  480 + Left = 164
481 481 Top = 240
482 482 Width = 275
483 483 Height = 30
484 484 Caption = 'Grava e Envia Informa'#231#245'es Patrimoniais'
485 485 Font.Charset = DEFAULT_CHARSET
486 486 Font.Color = clWindowText
487   - Font.Height = -11
488   - Font.Name = 'MS Sans Serif'
  487 + Font.Height = -13
  488 + Font.Name = 'Arial'
489 489 Font.Style = [fsBold]
490 490 ParentFont = False
491 491 TabOrder = 2
... ... @@ -493,17 +493,19 @@ object frmMapaCacic: TfrmMapaCacic
493 493 OnClick = AtualizaPatrimonio
494 494 end
495 495 object pnVersao: TPanel
496   - Left = 547
  496 + Left = 513
497 497 Top = 267
498   - Width = 56
  498 + Width = 90
499 499 Height = 14
500 500 BevelOuter = bvLowered
501 501 TabOrder = 3
502 502 object lbVersao: TLabel
503   - Left = 7
  503 + Left = 4
504 504 Top = 1
505   - Width = 41
  505 + Width = 82
506 506 Height = 12
  507 + Alignment = taCenter
  508 + AutoSize = False
507 509 Caption = 'v: X.X.X.X'
508 510 Font.Charset = DEFAULT_CHARSET
509 511 Font.Color = clWindowText
... ... @@ -514,16 +516,17 @@ object frmMapaCacic: TfrmMapaCacic
514 516 end
515 517 end
516 518 object pnMensagens: TPanel
517   - Left = 5
518   - Top = 205
519   - Width = 595
  519 + Left = 4
  520 + Top = 204
  521 + Width = 596
520 522 Height = 22
  523 + BevelInner = bvLowered
521 524 TabOrder = 4
522 525 object lbMensagens: TLabel
523   - Left = 1
524   - Top = 1
525   - Width = 593
526   - Height = 20
  526 + Left = 2
  527 + Top = 2
  528 + Width = 592
  529 + Height = 18
527 530 Align = alClient
528 531 Alignment = taCenter
529 532 AutoSize = False
... ... @@ -535,4 +538,26 @@ object frmMapaCacic: TfrmMapaCacic
535 538 ParentFont = False
536 539 end
537 540 end
  541 + object pnNomeServidorWEB: TPanel
  542 + Left = 1
  543 + Top = 267
  544 + Width = 90
  545 + Height = 14
  546 + BevelOuter = bvLowered
  547 + TabOrder = 5
  548 + object lbNomeServidorWEB: TLabel
  549 + Left = 3
  550 + Top = 1
  551 + Width = 83
  552 + Height = 12
  553 + Alignment = taCenter
  554 + AutoSize = False
  555 + Font.Charset = DEFAULT_CHARSET
  556 + Font.Color = clWindowText
  557 + Font.Height = -9
  558 + Font.Name = 'Arial'
  559 + Font.Style = [fsBold]
  560 + ParentFont = False
  561 + end
  562 + end
538 563 end
... ...
mapa/main_mapa.pas
... ... @@ -38,18 +38,19 @@ uses IniFiles,
38 38 Classes,
39 39 Forms,
40 40 PJVersionInfo,
41   - DIALOGS,
42 41 DCPcrypt2,
43 42 DCPrijndael,
44 43 DCPbase64,
45 44 ExtCtrls,
46   - Graphics;
  45 + Graphics,
  46 + dialogs;
47 47  
48 48 var strCipherClosed,
49 49 strCipherOpened,
50 50 strPathCacic : string;
51 51  
52   -var boolDebugs : boolean;
  52 +var boolDebugs,
  53 + boolUON2 : boolean;
53 54  
54 55  
55 56 // Some constants that are dependant on the cipher being used
... ... @@ -95,6 +96,8 @@ type
95 96 lbVersao: TLabel;
96 97 pnMensagens: TPanel;
97 98 lbMensagens: TLabel;
  99 + pnNomeServidorWEB: TPanel;
  100 + lbNomeServidorWEB: TLabel;
98 101  
99 102 procedure mapa;
100 103 procedure Grava_Debugs(strMsg : String);
... ... @@ -575,7 +578,7 @@ Begin
575 578 idHTTP1.Free;
576 579 log_DEBUG('Retorno: "'+Response_CS.DataString+'"');
577 580 Except
578   - Mensagem('ERRO! Comunicação impossível com o endereço ' + strEndereco + Response_CS.DataString,true);
  581 + Mensagem('ERRO! Comunicação impossível com o endereço ' + strEndereco + ': '+Response_CS.DataString,true);
579 582 result := '0';
580 583 Exit;
581 584 end;
... ... @@ -687,29 +690,29 @@ var
687 690 l_Data, l_Key, l_IV : string;
688 691 begin
689 692 Try
690   - // Pad Key, IV and Data with zeros as appropriate
691   - l_Key := PadWithZeros(constCipherKey,constKeySize);
692   - l_IV := PadWithZeros(constIV,constBlockSize);
693   - l_Data := PadWithZeros(p_Data,constBlockSize);
694   -
695   - // Create the cipher and initialise according to the key length
696   - l_Cipher := TDCP_rijndael.Create(nil);
697   - if Length(constCipherKey) <= 16 then
698   - l_Cipher.Init(l_Key[1],128,@l_IV[1])
699   - else if Length(constCipherKey) <= 24 then
700   - l_Cipher.Init(l_Key[1],192,@l_IV[1])
701   - else
702   - l_Cipher.Init(l_Key[1],256,@l_IV[1]);
703   -
704   - // Encrypt the data
705   - l_Cipher.EncryptCBC(l_Data[1],l_Data[1],Length(l_Data));
706   -
707   - // Free the cipher and clear sensitive information
708   - l_Cipher.Free;
709   - FillChar(l_Key[1],Length(l_Key),0);
710   -
711   - // Return the Base64 encoded result
712   - Result := Base64EncodeStr(l_Data);
  693 + // Pad Key, IV and Data with zeros as appropriate
  694 + l_Key := PadWithZeros(constCipherKey,constKeySize);
  695 + l_IV := PadWithZeros(constIV,constBlockSize);
  696 + l_Data := PadWithZeros(p_Data,constBlockSize);
  697 +
  698 + // Create the cipher and initialise according to the key length
  699 + l_Cipher := TDCP_rijndael.Create(nil);
  700 + if Length(constCipherKey) <= 16 then
  701 + l_Cipher.Init(l_Key[1],128,@l_IV[1])
  702 + else if Length(constCipherKey) <= 24 then
  703 + l_Cipher.Init(l_Key[1],192,@l_IV[1])
  704 + else
  705 + l_Cipher.Init(l_Key[1],256,@l_IV[1]);
  706 +
  707 + // Encrypt the data
  708 + l_Cipher.EncryptCBC(l_Data[1],l_Data[1],Length(l_Data));
  709 +
  710 + // Free the cipher and clear sensitive information
  711 + l_Cipher.Free;
  712 + FillChar(l_Key[1],Length(l_Key),0);
  713 +
  714 + // Return the Base64 encoded result
  715 + Result := Base64EncodeStr(l_Data);
713 716 Except
714 717 log_diario('Erro no Processo de Criptografia');
715 718 End;
... ... @@ -721,31 +724,31 @@ var
721 724 l_Data, l_Key, l_IV : string;
722 725 begin
723 726 Try
724   - // Pad Key and IV with zeros as appropriate
725   - l_Key := PadWithZeros(constCipherKey,constKeySize);
726   - l_IV := PadWithZeros(constIV,constBlockSize);
727   -
728   - // Decode the Base64 encoded string
729   - l_Data := Base64DecodeStr(p_Data);
730   -
731   - // Create the cipher and initialise according to the key length
732   - l_Cipher := TDCP_rijndael.Create(nil);
733   - if Length(constCipherKey) <= 16 then
734   - l_Cipher.Init(l_Key[1],128,@l_IV[1])
735   - else if Length(constCipherKey) <= 24 then
736   - l_Cipher.Init(l_Key[1],192,@l_IV[1])
737   - else
738   - l_Cipher.Init(l_Key[1],256,@l_IV[1]);
739   -
740   - // Decrypt the data
741   - l_Cipher.DecryptCBC(l_Data[1],l_Data[1],Length(l_Data));
742   -
743   - // Free the cipher and clear sensitive information
744   - l_Cipher.Free;
745   - FillChar(l_Key[1],Length(l_Key),0);
746   - log_DEBUG('DeCriptografia(ATIVADA) de "'+p_Data+'" => "'+l_Data+'"');
747   - // Return the result
748   - Result := trim(l_Data);
  727 + // Pad Key and IV with zeros as appropriate
  728 + l_Key := PadWithZeros(constCipherKey,constKeySize);
  729 + l_IV := PadWithZeros(constIV,constBlockSize);
  730 +
  731 + // Decode the Base64 encoded string
  732 + l_Data := Base64DecodeStr(p_Data);
  733 +
  734 + // Create the cipher and initialise according to the key length
  735 + l_Cipher := TDCP_rijndael.Create(nil);
  736 + if Length(constCipherKey) <= 16 then
  737 + l_Cipher.Init(l_Key[1],128,@l_IV[1])
  738 + else if Length(constCipherKey) <= 24 then
  739 + l_Cipher.Init(l_Key[1],192,@l_IV[1])
  740 + else
  741 + l_Cipher.Init(l_Key[1],256,@l_IV[1]);
  742 +
  743 + // Decrypt the data
  744 + l_Cipher.DecryptCBC(l_Data[1],l_Data[1],Length(l_Data));
  745 +
  746 + // Free the cipher and clear sensitive information
  747 + l_Cipher.Free;
  748 + FillChar(l_Key[1],Length(l_Key),0);
  749 + log_DEBUG('DeCriptografia(ATIVADA) de "'+p_Data+'" => "'+l_Data+'"');
  750 + // Return the result
  751 + Result := trim(l_Data);
749 752 Except
750 753 log_diario('Erro no Processo de Decriptografia');
751 754 End;
... ... @@ -755,45 +758,45 @@ function TfrmMapaCacic.HomeDrive : string;
755 758 var
756 759 WinDir : array [0..144] of char;
757 760 begin
758   -GetWindowsDirectory (WinDir, 144);
759   -Result := StrPas (WinDir);
  761 + GetWindowsDirectory (WinDir, 144);
  762 + Result := StrPas (WinDir);
760 763 end;
761 764  
762 765 Function TfrmMapaCacic.Implode(p_Array : TStrings ; p_Separador : String) : String;
763 766 var intAux : integer;
764 767 strAux : string;
765 768 Begin
766   - strAux := '';
767   - For intAux := 0 To p_Array.Count -1 do
768   - Begin
769   - if (strAux<>'') then strAux := strAux + p_Separador;
770   - strAux := strAux + p_Array[intAux];
771   - End;
772   - Implode := strAux;
  769 + strAux := '';
  770 + For intAux := 0 To p_Array.Count -1 do
  771 + Begin
  772 + if (strAux<>'') then strAux := strAux + p_Separador;
  773 + strAux := strAux + p_Array[intAux];
  774 + End;
  775 + Implode := strAux;
773 776 end;
774 777  
775 778 Function TfrmMapaCacic.CipherClose(p_DatFileName : string; p_tstrCipherOpened : TStrings) : String;
776 779 var strCipherOpenImploded : string;
777 780 txtFileDatFile : TextFile;
778 781 begin
779   - try
780   - FileSetAttr (p_DatFileName,0); // Retira os atributos do arquivo para evitar o erro FILE ACCESS DENIED em máquinas 2000
781   - AssignFile(txtFileDatFile,p_DatFileName); {Associa o arquivo a uma variável do tipo TextFile}
  782 + try
  783 + FileSetAttr (p_DatFileName,0); // Retira os atributos do arquivo para evitar o erro FILE ACCESS DENIED em máquinas 2000
  784 + AssignFile(txtFileDatFile,p_DatFileName); {Associa o arquivo a uma variável do tipo TextFile}
782 785  
783   - // Criação do arquivo .DAT
784   - Rewrite (txtFileDatFile);
785   - Append(txtFileDatFile);
  786 + // Criação do arquivo .DAT
  787 + Rewrite (txtFileDatFile);
  788 + Append(txtFileDatFile);
786 789  
787   - strCipherOpenImploded := Implode(p_tstrCipherOpened,'=CacicIsFree=');
788   - log_DEBUG('Rotina de Fechamento do cacic2.dat ATIVANDO criptografia.');
789   - strCipherClosed := EnCrypt(strCipherOpenImploded);
790   - log_DEBUG('Rotina de Fechamento do cacic2.dat RESTAURANDO estado da criptografia.');
  790 + strCipherOpenImploded := Implode(p_tstrCipherOpened,'=CacicIsFree=');
  791 + log_DEBUG('Rotina de Fechamento do cacic2.dat ATIVANDO criptografia.');
  792 + strCipherClosed := EnCrypt(strCipherOpenImploded);
  793 + log_DEBUG('Rotina de Fechamento do cacic2.dat RESTAURANDO estado da criptografia.');
791 794  
792   - Writeln(txtFileDatFile,strCipherClosed); {Grava a string Texto no arquivo texto}
  795 + Writeln(txtFileDatFile,strCipherClosed); {Grava a string Texto no arquivo texto}
793 796  
794   - CloseFile(txtFileDatFile);
795   - except
796   - end;
  797 + CloseFile(txtFileDatFile);
  798 + except
  799 + end;
797 800 end;
798 801 function TfrmMapaCacic.GetWinVer: Integer;
799 802 const
... ... @@ -1067,7 +1070,6 @@ begin
1067 1070  
1068 1071 // Código para montar o combo 2
1069 1072 Parser.StartScan;
1070   -
1071 1073 v_Tag := false;
1072 1074 i := -1;
1073 1075 While Parser.Scan DO
... ... @@ -1079,9 +1081,15 @@ begin
1079 1081 SetLength(VetorUON2, i + 1); // Aumento o tamanho da matriz dinamicamente de acordo com o número de itens recebidos.
1080 1082 end
1081 1083 else if (Parser.CurPartType in [ptContent, ptCData]) and v_Tag Then
1082   - if (UpperCase(Parser.CurName) = 'ID1') then VetorUON2[i].id1 := DeCrypt(Parser.CurContent)
1083   - else if (UpperCase(Parser.CurName) = 'ID2') then VetorUON2[i].id2 := DeCrypt(Parser.CurContent)
1084   - else if (UpperCase(Parser.CurName) = 'NM2') then VetorUON2[i].nm2 := DeCrypt(Parser.CurContent);
  1084 + Begin
  1085 + boolUON2 := true;
  1086 + if (UpperCase(Parser.CurName) = 'ID1') then
  1087 + VetorUON2[i].id1 := DeCrypt(Parser.CurContent)
  1088 + else if (UpperCase(Parser.CurName) = 'ID2') then
  1089 + VetorUON2[i].id2 := DeCrypt(Parser.CurContent)
  1090 + else if (UpperCase(Parser.CurName) = 'NM2') then
  1091 + VetorUON2[i].nm2 := DeCrypt(Parser.CurContent);
  1092 + End;
1085 1093 end;
1086 1094 Parser.Free;
1087 1095 // Como os itens do combo1 nunca mudam durante a execução do programa (ao contrario do combo2), posso colocar o seu preenchimento aqui mesmo.
... ... @@ -1095,21 +1103,29 @@ procedure TfrmMapaCacic.cb_id_unid_organizacional_nivel1Change(Sender: TObject);
1095 1103 var i, j: Word;
1096 1104 strAux : String;
1097 1105 begin
1098   - // Filtro os itens do combo2, de acordo com o item selecionado no combo1
1099   - strAux := VetorUON1[cb_id_unid_organizacional_nivel1.ItemIndex].id1;
  1106 + if boolUON2 then
  1107 + Begin
  1108 + // Filtro os itens do combo2, de acordo com o item selecionado no combo1
  1109 + strAux := VetorUON1[cb_id_unid_organizacional_nivel1.ItemIndex].id1;
  1110 + cb_id_unid_organizacional_nivel2.Items.Clear;
  1111 + SetLength(VetorUON2Filtrado, 0);
1100 1112  
1101   - cb_id_unid_organizacional_nivel2.Items.Clear;
1102   - SetLength(VetorUON2Filtrado, 0);
1103   - For i := 0 to Length(VetorUON2) - 1 Do
1104   - Begin
1105   - if VetorUON2[i].id1 = strAux then
1106   - Begin
1107   - cb_id_unid_organizacional_nivel2.Items.Add(VetorUON2[i].nm2);
1108   - j := Length(VetorUON2Filtrado);
1109   - SetLength(VetorUON2Filtrado, j + 1);
1110   - VetorUON2Filtrado[j] := VetorUON2[i].id2;
1111   - end;
1112   - end;
  1113 + For i := 0 to Length(VetorUON2) - 1 Do
  1114 + Begin
  1115 + Try
  1116 + if VetorUON2[i].id1 = strAux then
  1117 + Begin
  1118 + cb_id_unid_organizacional_nivel2.Items.Add(VetorUON2[i].nm2);
  1119 + j := Length(VetorUON2Filtrado);
  1120 + SetLength(VetorUON2Filtrado, j + 1);
  1121 + VetorUON2Filtrado[j] := VetorUON2[i].id2;
  1122 + end;
  1123 + Except
  1124 + End;
  1125 + end;
  1126 + End
  1127 + else
  1128 + Mensagem('ATENÇÃO! Não Existe '+frmMapaCacic.lbEtiqueta2.Caption+' Associado a '+VetorUON1[cb_id_unid_organizacional_nivel1.ItemIndex].nm1+'. Procure um supervisor do sistema.',true);
1113 1129 end;
1114 1130  
1115 1131  
... ... @@ -1263,7 +1279,7 @@ end;
1263 1279  
1264 1280 procedure TfrmMapaCacic.FormClose(Sender: TObject; var Action: TCloseAction);
1265 1281 begin
1266   -Sair;
  1282 + Finalizar(true);
1267 1283 end;
1268 1284 // Função adaptada de http://www.latiumsoftware.com/en/delphi/00004.php
1269 1285 //Para buscar do RegEdit...
... ... @@ -1450,6 +1466,7 @@ begin
1450 1466 strConfigs := GetValorDatMemoria('Patrimonio.Configs', frmMapaCacic.tStringsCipherOpened);
1451 1467 gbLeiaComAtencao.Visible := true;
1452 1468 gbInformacoesSobreComputador.Visible := true;
  1469 + boolUON2 := false; // Inicializo com false e torno true quando da montagem da combo de UON2...
1453 1470 MontaCombos(strConfigs);
1454 1471 RecuperaValoresAnteriores(strConfigs);
1455 1472 MontaInterface(strConfigs);
... ... @@ -1464,7 +1481,7 @@ var intAux : integer;
1464 1481 strRetorno : String;
1465 1482 Request_mapa : TStringList;
1466 1483 begin
1467   - frmMapaCacic.lbVersao.Caption := 'v: ' + frmMapaCacic.GetVersionInfo(ParamStr(0));
  1484 + frmMapaCacic.lbVersao.Caption := 'v: ' + frmMapaCacic.GetVersionInfo(ParamStr(0));
1468 1485 if (GetWinVer > 5) and not IsAdmin then
1469 1486 Begin
1470 1487 MessageDLG(#13#10+'ATENÇÃO! Essa aplicação requer execução com nível administrativo.',mtError,[mbOK],0);
... ... @@ -1477,7 +1494,7 @@ begin
1477 1494 strPathCacic := '';
1478 1495 for intAux := 1 to length(strLetrasDrives) do
1479 1496 Begin
1480   - lbMensagens.Caption := 'Procurando Estrutura CACIC em "'+strLetrasDrives[intAux] + ':\"';
  1497 + lbMensagens.Caption := 'Procurando Estrutura do Sistema CACIC em "'+strLetrasDrives[intAux] + ':\"';
1481 1498  
1482 1499 Log_Debug('Testando "'+strLetrasDrives[intAux] + ':\Cacic\cacic2.dat'+'"');
1483 1500 if (strPathCacic='') and (SearchFile(strLetrasDrives[intAux] + ':','\Cacic\cacic2.dat')) then
... ... @@ -1514,7 +1531,7 @@ begin
1514 1531 else
1515 1532 Begin
1516 1533 pnMensagens.Visible := true;
1517   - Mensagem('Efetuando Comunicação com o Módulo Gerente WEB...',false);
  1534 + Mensagem('Efetuando Comunicação com o Módulo Gerente WEB em "'+GetValorDatMemoria('Configs.EnderecoServidor', tStringsCipherOpened)+'"...',false);
1518 1535 frmAcesso.Free;
1519 1536  
1520 1537 // Povoamento com dados de configurações da interface patrimonial
... ... @@ -1528,9 +1545,10 @@ begin
1528 1545 Request_mapa.Values['te_workgroup'] := frmMapaCacic.EnCrypt(frmMapaCacic.GetValorDatMemoria('TcpIp.TE_WORKGROUP' , frmMapaCacic.tStringsCipherOpened));
1529 1546  
1530 1547 strRetorno := frmMapaCacic.ComunicaServidor('mapa_get_patrimonio.php', Request_mapa, '.');
  1548 +
1531 1549 if (frmMapaCacic.XML_RetornaValor('STATUS', strRetorno)='OK') then
1532 1550 Begin
1533   - Mensagem('Comunicação Efetuada com Sucesso! Salvando Configurações Obtidas...',true);
  1551 + Mensagem('Comunicação Efetuada com Sucesso! Salvando Configurações Obtidas...',false);
1534 1552 frmMapaCacic.SetValorDatMemoria('Patrimonio.Configs', strRetorno, frmMapaCacic.tStringsCipherOpened)
1535 1553 End
1536 1554 else
... ... @@ -1548,8 +1566,8 @@ begin
1548 1566 else
1549 1567 Begin
1550 1568 lbMensagens.Caption := 'Estrutura CACIC não Encontrada!';
1551   - application.ProcessMessages;
1552   - MessageDLG(#13#10+'Não Encontrei a Estrutura do Sistema CACIC!'+#13#10+
  1569 + application.ProcessMessages;
  1570 + MessageDLG(#13#10+'Não Encontrei a Estrutura do Sistema CACIC!'+#13#10#13#10+
1553 1571 'Operação Abortada!',mtError,[mbOK],0);
1554 1572 Sair;
1555 1573 End;
... ...
mapa/mapacacic.dof
... ... @@ -115,7 +115,7 @@ AutoIncBuild=0
115 115 MajorVer=1
116 116 MinorVer=0
117 117 Release=0
118   -Build=1
  118 +Build=3
119 119 Debug=0
120 120 PreRelease=0
121 121 Special=0
... ... @@ -126,7 +126,7 @@ CodePage=1252
126 126 [Version Info Keys]
127 127 CompanyName=Dataprev-ES
128 128 FileDescription=MapaCacic - Módulo Avulso para Coleta de Informações Patrimoniais para o Sistema CACIC
129   -FileVersion=1.0.0.1
  129 +FileVersion=1.0.0.3
130 130 InternalName=
131 131 LegalCopyright=
132 132 LegalTrademarks=
... ...
mapa/mapacacic.res
No preview for this file type
vacon/main_VACON.dcu
No preview for this file type
vacon/main_VACON.dfm
1 1 object FormVACON: TFormVACON
2   - Left = 6
3   - Top = 5
4   - Width = 772
5   - Height = 543
  2 + Left = 135
  3 + Top = 8
  4 + Width = 767
  5 + Height = 652
6 6 Caption = 'VACON - Visualizador de Arquivo de Configura'#231#227'o CACIC2.DAT'
7 7 Color = clBtnFace
8 8 Font.Charset = DEFAULT_CHARSET
... ... @@ -12,14 +12,14 @@ object FormVACON: TFormVACON
12 12 Font.Style = []
13 13 FormStyle = fsStayOnTop
14 14 OldCreateOrder = False
  15 + Position = poDesktopCenter
15 16 Visible = True
16   - WindowState = wsMaximized
17 17 OnCreate = FormCreate
18 18 PixelsPerInch = 96
19 19 TextHeight = 13
20 20 object Label1: TLabel
21   - Left = 24
22   - Top = 57
  21 + Left = 19
  22 + Top = 48
23 23 Width = 5
24 24 Height = 13
25 25 Font.Charset = DEFAULT_CHARSET
... ... @@ -30,18 +30,18 @@ object FormVACON: TFormVACON
30 30 ParentFont = False
31 31 end
32 32 object Memo1: TMemo
33   - Left = 6
34   - Top = 72
  33 + Left = 0
  34 + Top = 46
35 35 Width = 754
36   - Height = 437
  36 + Height = 549
37 37 Lines.Strings = (
38 38 '')
39 39 ScrollBars = ssBoth
40 40 TabOrder = 0
41 41 end
42 42 object Bt_Sair: TButton
43   - Left = 649
44   - Top = 20
  43 + Left = 644
  44 + Top = 6
45 45 Width = 110
46 46 Height = 35
47 47 Caption = 'Sair'
... ... @@ -55,9 +55,9 @@ object FormVACON: TFormVACON
55 55 OnClick = Bt_SairClick
56 56 end
57 57 object Bt_Abrir_Outro: TButton
58   - Left = 476
59   - Top = 20
60   - Width = 159
  58 + Left = 467
  59 + Top = 6
  60 + Width = 163
61 61 Height = 35
62 62 Caption = 'Abrir Outro Arquivo...'
63 63 Font.Charset = DEFAULT_CHARSET
... ... @@ -71,10 +71,10 @@ object FormVACON: TFormVACON
71 71 OnClick = Bt_Abrir_OutroClick
72 72 end
73 73 object GB_Chave: TGroupBox
74   - Left = 259
75   - Top = 174
76   - Width = 265
77   - Height = 163
  74 + Left = 254
  75 + Top = 165
  76 + Width = 264
  77 + Height = 220
78 78 Color = clActiveBorder
79 79 ParentColor = False
80 80 TabOrder = 3
... ... @@ -94,7 +94,7 @@ object FormVACON: TFormVACON
94 94 end
95 95 object Lb_Chave_Separadora: TLabel
96 96 Left = 8
97   - Top = 62
  97 + Top = 77
98 98 Width = 173
99 99 Height = 16
100 100 Caption = 'Informe a Chave Separadora'
... ... @@ -105,6 +105,32 @@ object FormVACON: TFormVACON
105 105 Font.Style = []
106 106 ParentFont = False
107 107 end
  108 + object lbDefaultChaveLeArq: TLabel
  109 + Left = 9
  110 + Top = 51
  111 + Width = 95
  112 + Height = 12
  113 + Caption = '(Default="CacicBrasil")'
  114 + Font.Charset = DEFAULT_CHARSET
  115 + Font.Color = clNavy
  116 + Font.Height = -9
  117 + Font.Name = 'Arial'
  118 + Font.Style = []
  119 + ParentFont = False
  120 + end
  121 + object lbChaveSeparadora: TLabel
  122 + Left = 9
  123 + Top = 118
  124 + Width = 99
  125 + Height = 12
  126 + Caption = '(Default="CacicIsFree")'
  127 + Font.Charset = DEFAULT_CHARSET
  128 + Font.Color = clNavy
  129 + Font.Height = -9
  130 + Font.Name = 'Arial'
  131 + Font.Style = []
  132 + ParentFont = False
  133 + end
108 134 object Ed_Chave: TEdit
109 135 Left = 8
110 136 Top = 28
... ... @@ -112,11 +138,12 @@ object FormVACON: TFormVACON
112 138 Height = 21
113 139 BevelInner = bvNone
114 140 TabOrder = 0
  141 + Text = 'CacicBrasil'
115 142 OnKeyPress = Ed_ChaveKeyPress
116 143 end
117 144 object Bt_OK_Chave: TButton
118 145 Left = 95
119   - Top = 121
  146 + Top = 165
120 147 Width = 75
121 148 Height = 25
122 149 Caption = 'OK'
... ... @@ -131,19 +158,34 @@ object FormVACON: TFormVACON
131 158 end
132 159 object Ed_Chave_Separadora: TEdit
133 160 Left = 8
134   - Top = 79
  161 + Top = 94
135 162 Width = 249
136 163 Height = 21
137 164 BevelInner = bvNone
138 165 TabOrder = 1
139   - OnEnter = Ed_Chave_SeparadoraEnter
  166 + Text = 'CacicIsFree'
140 167 OnKeyPress = Ed_Chave_SeparadoraKeyPress
141 168 end
  169 + object chkboxExibeChaves: TCheckBox
  170 + Left = 3
  171 + Top = 201
  172 + Width = 97
  173 + Height = 17
  174 + Caption = 'Exibe Chaves'
  175 + Font.Charset = DEFAULT_CHARSET
  176 + Font.Color = clWindowText
  177 + Font.Height = -9
  178 + Font.Name = 'Arial'
  179 + Font.Style = []
  180 + ParentFont = False
  181 + TabOrder = 3
  182 + OnClick = chkboxExibeChavesClick
  183 + end
142 184 end
143 185 object Bt_Trocar_Chave: TButton
144   - Left = 256
145   - Top = 20
146   - Width = 216
  186 + Left = 237
  187 + Top = 6
  188 + Width = 227
147 189 Height = 35
148 190 Caption = 'Trocar Chaves de Criptografia'
149 191 Font.Charset = DEFAULT_CHARSET
... ... @@ -156,8 +198,22 @@ object FormVACON: TFormVACON
156 198 Visible = False
157 199 OnClick = PegaChave
158 200 end
  201 + object Panel1: TPanel
  202 + Left = 695
  203 + Top = 597
  204 + Width = 59
  205 + Height = 17
  206 + BevelInner = bvLowered
  207 + BevelOuter = bvLowered
  208 + Caption = 'v:2.0.0.0'
  209 + TabOrder = 5
  210 + end
159 211 object OpenDialog1: TOpenDialog
160 212 Left = 16
161 213 Top = 16
162 214 end
  215 + object PJVersionInfo1: TPJVersionInfo
  216 + Left = 120
  217 + Top = 16
  218 + end
163 219 end
... ...
vacon/main_VACON.pas
... ... @@ -10,7 +10,7 @@ uses
10 10 DCPrijndael,
11 11 DCPbase64,
12 12 StdCtrls,
13   - Controls, Classes, Dialogs;
  13 + Controls, Classes, Dialogs, ExtCtrls, PJVersionInfo;
14 14  
15 15 type
16 16 TFormVACON = class(TForm)
... ... @@ -26,6 +26,11 @@ type
26 26 Bt_Trocar_Chave: TButton;
27 27 Lb_Chave_Separadora: TLabel;
28 28 Ed_Chave_Separadora: TEdit;
  29 + lbDefaultChaveLeArq: TLabel;
  30 + lbChaveSeparadora: TLabel;
  31 + chkboxExibeChaves: TCheckBox;
  32 + Panel1: TPanel;
  33 + PJVersionInfo1: TPJVersionInfo;
29 34 procedure FormCreate(Sender: TObject);
30 35 procedure Bt_SairClick(Sender: TObject);
31 36 function DeCrypt(p_Data : String) : String;
... ... @@ -39,7 +44,9 @@ type
39 44 procedure PegaChave(Sender: TObject);
40 45 procedure Ed_ChaveKeyPress(Sender: TObject; var Key: Char);
41 46 procedure Ed_Chave_SeparadoraKeyPress(Sender: TObject; var Key: Char);
42   - procedure Ed_Chave_SeparadoraEnter(Sender: TObject);
  47 + procedure chkboxExibeChavesClick(Sender: TObject);
  48 + function GetVersionInfo(p_File: string):string;
  49 + function VerFmt(const MS, LS: DWORD): string;
43 50 private
44 51 { Private declarations }
45 52 public
... ... @@ -159,6 +166,7 @@ end;
159 166 procedure TFormVACON.FormCreate(Sender: TObject);
160 167 begin
161 168 FormVACON.Visible := true;
  169 + FormVACON.Panel1.Caption := GetVersionInfo(ParamStr(0));
162 170 Abrir;
163 171 end;
164 172  
... ... @@ -180,10 +188,23 @@ procedure TFormVACON.PegaChave(Sender: TObject);
180 188 begin
181 189 GB_Chave.Visible := true;
182 190 Ed_Chave.SetFocus;
183   - Ed_Chave.PasswordChar := #42;
184   - Ed_Chave_Separadora.PasswordChar := #42;
  191 + chkboxExibeChavesClick(nil);
  192 +end;
  193 +function TFormVACON.VerFmt(const MS, LS: DWORD): string;
  194 + // Format the version number from the given DWORDs containing the info
  195 +begin
  196 + Result := Format('%d.%d.%d.%d',
  197 + [HiWord(MS), LoWord(MS), HiWord(LS), LoWord(LS)])
185 198 end;
186 199  
  200 +function TFormVACON.GetVersionInfo(p_File: string):string;
  201 +var PJVersionInfo1: TPJVersionInfo;
  202 +begin
  203 + PJVersionInfo1 := TPJVersionInfo.Create(nil);
  204 + PJVersionInfo1.FileName := PChar(p_File);
  205 + Result := VerFmt(PJVersionInfo1.FixedFileInfo.dwFileVersionMS, PJVersionInfo1.FixedFileInfo.dwFileVersionLS);
  206 + PJVersionInfo1.Free;
  207 +end;
187 208  
188 209 procedure TFormVACON.Bt_SairClick(Sender: TObject);
189 210 begin
... ... @@ -250,9 +271,18 @@ begin
250 271 if Key = #13 then Bt_OK_ChaveClick(nil);
251 272 end;
252 273  
253   -procedure TFormVACON.Ed_Chave_SeparadoraEnter(Sender: TObject);
  274 +procedure TFormVACON.chkboxExibeChavesClick(Sender: TObject);
254 275 begin
255   - Ed_Chave_Separadora.Text := Ed_Chave.Text;
  276 + if chkboxExibeChaves.Checked then
  277 + Begin
  278 + Ed_Chave.PasswordChar := #0;
  279 + Ed_Chave_Separadora.PasswordChar := #0;
  280 + End
  281 + else
  282 + Begin
  283 + Ed_Chave.PasswordChar := #42;
  284 + Ed_Chave_Separadora.PasswordChar := #42;
  285 + End;
256 286 end;
257 287  
258 288 end.
... ...
vacon/vacon.dof
... ... @@ -115,7 +115,7 @@ AutoIncBuild=0
115 115 MajorVer=2
116 116 MinorVer=2
117 117 Release=0
118   -Build=0
  118 +Build=1
119 119 Debug=0
120 120 PreRelease=0
121 121 Special=0
... ... @@ -126,7 +126,7 @@ CodePage=1252
126 126 [Version Info Keys]
127 127 CompanyName=
128 128 FileDescription=
129   -FileVersion=2.2.0.0
  129 +FileVersion=2.2.0.1
130 130 InternalName=
131 131 LegalCopyright=
132 132 LegalTrademarks=
... ...
vacon/vacon.res
No preview for this file type