Changeset 793 for cprs/branches/tmg-cprs/CPRS-Chart/UploadImages.pas
- Timestamp:
- Jun 10, 2010, 3:13:12 PM (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
cprs/branches/tmg-cprs/CPRS-Chart/UploadImages.pas
r738 r793 57 57 destructor Destroy; override; 58 58 end; 59 60 61 62 63 59 64 60 type … … 103 99 Bitmap : TBitmap; 104 100 Picture : TPicture; 101 FUploadedImagesList : TStringList; //List of strings of images succesfully uploaded. 105 102 function MakeThumbNail(Info: TImageInfo): boolean; 106 103 … … 126 123 published 127 124 property ScanDir : String read FScanDir write SetScanDir; 125 property UploadedImages : TStringList read FUploadedImagesList; 128 126 end; 129 127 … … 143 141 ORNet, //for RPCBrokerV 144 142 rTIU, 143 rHTMLTools, 145 144 uTMGOptions 146 145 ; … … 281 280 RPCBrokerV.param[5].value := DOB; RPCBrokerV.Param[5].ptype := literal; 282 281 RPCBrokerV.param[6].value := Sex; RPCBrokerV.Param[6].ptype := literal; 283 RPCBrokerV.Call; 282 //RPCBrokerV.Call; 283 CallBroker; 284 284 RPCResult := RPCBrokerV.Results[0]; //returns: success: DFN; or error: -1^ErrMsg 285 285 if piece(RPCResult,'^',1) <> '-1' then begin … … 321 321 RPCBrokerV.ClearParameters := true; 322 322 RPCBrokerV.remoteprocedure := 'TMG GET BLANK TIU DOCUMENT'; 323 RPCBrokerV.param[0].value := DFN;RPCBrokerV.param[0].ptype := literal;323 RPCBrokerV.param[0].value := '`'+DFN; RPCBrokerV.param[0].ptype := literal; 324 324 RPCBrokerV.param[1].value := Provider; RPCBrokerV.Param[1].ptype := literal; 325 325 RPCBrokerV.param[2].value := Location; RPCBrokerV.Param[2].ptype := literal; 326 326 RPCBrokerV.param[3].value := DOS; RPCBrokerV.Param[3].ptype := literal; 327 327 RPCBrokerV.param[4].value := Title; RPCBrokerV.Param[4].ptype := literal; 328 RPCBrokerV.Call; 328 //RPCBrokerV.Call; 329 CallBroker; 329 330 RPCResult := RPCBrokerV.Results[0]; 330 331 try … … 436 437 ErrorMsg : AnsiString; 437 438 i : integer; 439 CacheFPathName, tempFName : string; 438 440 439 441 begin … … 464 466 RPCBrokerV.Param[0].Mult['"FileExt"'] := 'EXT^' + Info.Extension; 465 467 466 for i := 0 to Info.pLongDesc.Count - 1 do begin 467 index := IntToStr(i); 468 while length(index) < 3 do index := '0' + index; 469 index :='"LongDescr' + index + '"'; 470 RPCBrokerV.Param[0].Mult[index] := '11^' + Info.pLongDesc.Strings[i]; 471 end; 472 473 RPCResult := RPCBrokerV.STRcall; { returns ImageIEN^directory/filename } 468 if assigned(Info.pLongDesc) then begin 469 for i := 0 to Info.pLongDesc.Count - 1 do begin 470 index := IntToStr(i); 471 while length(index) < 3 do index := '0' + index; 472 index :='"LongDescr' + index + '"'; 473 RPCBrokerV.Param[0].Mult[index] := '11^' + Info.pLongDesc.Strings[i]; 474 end; 475 end; 476 477 //RPCResult := RPCBrokerV.STRcall; { returns ImageIEN^directory/filename } 478 CallBroker; 479 if RPCBrokerV.Results.Count>0 then RPCResult := RPCBrokerV.Results.Strings[0]; 474 480 475 481 ImageIEN := Piece(RPCResult,'^',1); 476 482 result := ((ImageIEN <> '0') and (ImageIEN <> '')); // function result. 477 483 if result=false then begin 478 // ErrorMsg :='Server Error -- Couldn''t store image information'; <-- original line. //kt 8/7/2007479 484 ErrorMsg :=DKLangConstW('UploadImages_Server_Error_xx_Couldnxxt_store_image_information'); //kt added 8/7/2007 480 485 MessageDlg(ErrorMsg,mtWarning,[mbOK],0); … … 485 490 result := frmImages.UploadFile(Info.ImageFPathName,Info.ServerPath,Info.ServerFName,1,1); 486 491 if result=false then begin 487 // ErrorMsg :='Error uploading image to server'; <-- original line. //kt 8/7/2007488 492 ErrorMsg :=DKLangConstW('UploadImages_Error_uploading_image_to_server'); //kt added 8/7/2007 489 //Application.MessageBox(@ErrorMsg,'Error Uploading Image');490 493 MessageDlg(ErrorMsg,mtWarning,[mbCancel],0); 491 494 end; 492 //Later, put code that also copies the file into the cache directory,493 //so that we don't have to turn around and download it again.494 495 if result then begin 495 496 RPCBrokerV.remoteprocedure := 'MAG3 TIU IMAGE'; … … 498 499 RPCBrokerV.Param[1].ptype := literal; 499 500 RPCBrokerV.param[1].value := IntToStr(Info.TIUIEN); 500 RPCBrokerV.Call; 501 //RPCBrokerV.Call; 502 CallBroker; 501 503 RPCResult := RPCBrokerV.Results[0]; 502 504 //returns: success: 1^message; or error: 0^error message … … 504 506 result := (MsgNum = '1'); 505 507 if result=false then begin 506 // ErrorMsg :='Error associating image with note:' + #13 + Piece(RPCResult,'^',2); <-- original line. //kt 8/7/2007507 508 ErrorMsg :=DKLangConstW('UploadImages_Error_associating_image_with_notex') + #13 + Piece(RPCResult,'^',2); //kt added 8/7/2007 508 509 MessageDlg(ErrorMsg,mtWarning,[mbCancel],0); 509 510 end; 510 511 end; 511 if (result=true) and (MoveCheckBox.Checked) then begin 512 if (result=false) then exit; 513 //Copy the file into the cache directory, so that we don't have to turn around and download it again. 514 CacheFPathName := rHTMLTools.CPRSDir + '\cache\' + ExtractFileName (Info.ServerFName); 515 if not FileExists(CacheFPathName) then begin 516 tempFName := Info.ImageFPathName; 517 CopyFile(PChar(tempFName),PChar(CacheFPathName),FALSE); 518 end; 519 if (MoveCheckBox.Checked) then begin 512 520 DeleteFile(Info.ImageFPathName); 513 521 end; 514 if result then begin 515 if MakeThumbNail(Info) then begin; 516 result := frmImages.UploadFile(Info.ThumbFPathName,Info.ServerPath,Info.ServerThumbFName,1,1); 517 if result=false then begin 518 // ErrorMsg :='Error sending thumbnail image to server.'; <-- original line. //kt 8/7/2007 519 ErrorMsg :=DKLangConstW('UploadImages_Error_sending_thumbnail_image_to_serverx'); //kt added 8/7/2007 520 MessageDlg(ErrorMsg,mtWarning,[mbOK],0); 521 end; 522 if MakeThumbNail(Info) then begin; 523 result := frmImages.UploadFile(Info.ThumbFPathName,Info.ServerPath,Info.ServerThumbFName,1,1); 524 if result=false then begin 525 ErrorMsg :=DKLangConstW('UploadImages_Error_sending_thumbnail_image_to_serverx'); //kt added 8/7/2007 526 MessageDlg(ErrorMsg,mtWarning,[mbOK],0); 527 end; 528 CacheFPathName := rHTMLTools.CPRSDir + '\cache\' + ExtractFileName (Info.ServerFName); 529 if not FileExists(CacheFPathName) then begin 530 CopyFile(PChar(Info.ImageFPathName),PChar(CacheFPathName),FALSE); 522 531 end; 523 532 if DelOrig=true then begin … … 559 568 Info.Extension := MidStr(Info.Extension,2,17); //remove '.' 560 569 561 if not UploadFile(Info,MoveCheckBox.Checked) then begin //Upload function passes back filename info in Info class 570 if UploadFile(Info,MoveCheckBox.Checked) then begin //Upload function passes back filename info in Info class 571 FUploadedImagesList.Add(Info.ServerFName); 572 end else begin 562 573 //Application.MessageBox('Error uploading image file!','Error'); 563 574 end; 564 565 575 end; 566 576 Info.Free; … … 616 626 end; 617 627 UploadChosenFiles(); 628 //note This UploadButton has .ModalResult = mrOK, so form is closed after this. 618 629 end; 619 630 … … 642 653 FormRefresh(self); 643 654 FilesToUploadList.Items.Clear; 655 FUploadedImagesList.Clear; 644 656 LoadNotesEdit(); 645 657 SetupVars; … … 666 678 Bitmap.Width := 64; 667 679 Picture := TPicture.Create; 680 681 FUploadedImagesList := TStringList.Create; 668 682 669 683 AutoUploadNote := TAutoUploadNote.Create; … … 692 706 Bitmap.Free; 693 707 Picture.Free; 708 FUploadedImagesList.Free; 694 709 end; 695 710 … … 822 837 Text.Add('</html>'); 823 838 Text.Add(' '); 824 rTIU.SetText(ErrMsg,Text,UploadNote.TIUIEN, 1);//1=commit data, do actual save.839 rTIU.SetText(ErrMsg,Text,UploadNote.TIUIEN,0); //elh changed from 1 to 0 //1=commit data, do actual save. 825 840 Text.Free; 826 841 //Here I autosign -- later make this optional? 827 842 RPCBrokerV.ClearParameters := true; 828 843 RPCBrokerV.remoteprocedure := 'TMG AUTOSIGN TIU DOCUMENT'; 829 RPCBrokerV.param[0].value := IntToStr(UploadNote.TIUIEN); 844 RPCBrokerV.param[0].value := IntToStr(UploadNote.TIUIEN); 830 845 RPCBrokerV.param[0].ptype := literal; 831 RPCBrokerV.Call; 832 RPCResult := RPCBrokerV.Results[0]; //returns: error: -1; success=1 846 //RPCBrokerV.Call; 847 CallBroker; 848 if RPCBrokerV.Results.Count > 0 then begin 849 RPCResult := RPCBrokerV.Results[0]; //returns: error: -1; success=1 850 end else begin 851 RPCResult := '-1'; 852 end; 833 853 if RPCResult='-1' then begin 834 854 MessageDlg('Unable to set status for scanned document to SIGNED',mtError,[mbOK],0); 835 end; 855 end; 836 856 UploadNote.TIUIEN := 0; 837 857 end;
Note:
See TracChangeset
for help on using the changeset viewer.