source: cprs/branches/tmg-cprs/CPRS-Chart/TMG_Extra/fWebTab.pas@ 834

Last change on this file since 834 was 793, checked in by Kevin Toppenberg, 14 years ago

update

File size: 3.2 KB
RevLine 
[453]1unit fWebTab;
2//kt Added entire unit and form.
3
4interface
5
6uses
7 Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
8 Dialogs, OleCtrls, SHDocVw, StdCtrls,fPage;
9
10type
11 TfrmWebTab = class(TfrmPage)
12 WebBrowser: TWebBrowser;
13 private
14 { Private declarations }
15 public
16 { Public declarations }
17 Procedure RequestPrint; override;
18 Procedure NagivateTo(URL: Widestring);
19 end;
20
21function AskServerForURLs(URLList : TStringList) : string;
22
23var
24 frmWebTabs: TList;
25
26 TMG_URL_RPC_Available : boolean;
27 TMG_URL_RPC_Checked : boolean;
28
29implementation
30
31{$R *.dfm}
32uses ORNet,ORFn,Trpcb,uConst;
33
34
35Procedure TfrmWebTab.RequestPrint;
36begin
37 inherited;
38 MessageDlg('Finish code: request printing from web browser...',mtInformation,[mbOK],0);
39end;
40
41
42Procedure TfrmWebTab.NagivateTo(URL: WideString);
43begin
44 WebBrowser.Navigate(URL);
45end;
46
47//=================================================================
48//===== Globally available functions, not part of object ==========
49//=================================================================
50
51function AskServerForURLs(URLList : TStringList) : string;
52//Get URL list from server.
53//URLList is filled with RPCBroker.Results. Should have this format:
54// URLList(0)='1^Success' pr '0^Failure'
55// URLList(1)="URL#1" a URL to display in tab 1
56// URLList(2)="URL#2" a URL to display in tab 2
57// URLList(3)="URL#3" a URL to display in tab 3
58// Note: if URL='<!HIDE!>' then server is requesting tab to be hidden
59//Results of Fn: Returns '1^Success' if success, or '0^ErrorMessage'
60var
61 RPCResult : AnsiString;
62 i : integer;
63begin
64 if TMG_URL_RPC_Checked = false then begin
65 RPCBrokerV.remoteprocedure := 'XWB IS RPC AVAILABLE';
66 RPCBrokerV.Param[0].Value := 'TMG CPRS GET URL LIST';
67 RPCBrokerV.Param[0].ptype := literal;
68 RPCBrokerV.Param[1].Value := 'R';
69 RPCBrokerV.Param[1].ptype := literal;
[793]70 //RPCResult := RPCBrokerV.StrCall; {returns 1 if available, 0 if not available}
71 CallBroker;
72 if RPCBrokerV.Results.Count > 0 then begin
73 RPCResult := RPCBrokerV.Results.Strings[0];
74 end else begin
75 RPCResult := '';
76 end;
[453]77 TMG_URL_RPC_Checked := true;
78 TMG_URL_RPC_Available := (RPCResult='1');
79 end;
80
81 if TMG_URL_RPC_Available= true then begin
82 if (URLList <> nil) then begin
83 RPCBrokerV.remoteprocedure := 'TMG CPRS GET URL LIST';
[793]84 //RPCBrokerV.Call;
85 CallBroker;
[453]86 URLList.Assign(RPCBrokerV.Results);
87 if RPCBrokerV.Results.Count>0 then Result := RPCBrokerV.Results.Strings[0]
88 else Result := '-1^Error: No URL''s returned from server.';
89 end else begin
90 Result := '0^Invalid TStringList URLList passed';
91 end;
92 end else begin
93 Result := '-1^"TMG CPRS GET URL LIST" RPC Not available on server';
94 end;
95end;
96
97
98initialization
99 TMG_URL_RPC_Available := false; //default to not avail.
100 TMG_URL_RPC_Checked := false; //default to not checked.
101 frmWebTabs := TList.Create;
102 frmWebTabs.Count := CT_LAST_WEBTAB-CT_WEBTAB1+1; //fill up list with nil pointers
103finalization
104 frmWebTabs.Free;
105end.
106
Note: See TracBrowser for help on using the repository browser.