Line | |
---|
1 | unit ModuleBase;
|
---|
2 |
|
---|
3 | interface
|
---|
4 |
|
---|
5 | uses
|
---|
6 | Classes, SysUtils, ModularSystem, Generics, WebPage, WebApp,
|
---|
7 | WebSession, HTTPServer;
|
---|
8 |
|
---|
9 | type
|
---|
10 | TGeneratePageEvent = procedure (Session: TWebSession; Page: TWebPage) of object;
|
---|
11 |
|
---|
12 | { TModuleBase }
|
---|
13 |
|
---|
14 | TModuleBase = class(TModule)
|
---|
15 | private
|
---|
16 | PageAdmin: TWebPage;
|
---|
17 | FOnGeneratePage: TGeneratePageEvent;
|
---|
18 | public
|
---|
19 | Session: TWebSession;
|
---|
20 | Pages: TPageList;
|
---|
21 | HandlerData: THTTPHandlerData;
|
---|
22 | constructor Create(Owner: TComponent); override;
|
---|
23 | procedure Start; override;
|
---|
24 | procedure Stop; override;
|
---|
25 | property OnGeneratePage: TGeneratePageEvent read FOnGeneratePage write FOnGeneratePage;
|
---|
26 | end;
|
---|
27 |
|
---|
28 |
|
---|
29 | implementation
|
---|
30 |
|
---|
31 | uses
|
---|
32 | PageAdmin;
|
---|
33 |
|
---|
34 | { TModuleBase }
|
---|
35 |
|
---|
36 | constructor TModuleBase.Create(Owner: TComponent);
|
---|
37 | begin
|
---|
38 | inherited Create(Owner);
|
---|
39 | Identification := 'Base';
|
---|
40 | Title := 'Base application module';
|
---|
41 | Version := '1.0';
|
---|
42 | License := 'GNU/LGPL v3';
|
---|
43 | Author := 'Chronosoft';
|
---|
44 | Dependencies.Add('System');
|
---|
45 | end;
|
---|
46 |
|
---|
47 | procedure TModuleBase.Start;
|
---|
48 | begin
|
---|
49 | BeforeStart;
|
---|
50 | Pages := TPageList.Create;
|
---|
51 | with Pages do begin
|
---|
52 | PageAdmin := TPageAdmin.Create(nil);
|
---|
53 | RegisterPage(PageAdmin, 'administration');
|
---|
54 | end;
|
---|
55 | AfterStart;
|
---|
56 | end;
|
---|
57 |
|
---|
58 | procedure TModuleBase.Stop;
|
---|
59 | begin
|
---|
60 | BeforeStop;
|
---|
61 | with Pages do begin
|
---|
62 | UnregisterPage(PageAdmin);
|
---|
63 | FreeAndNil(PageAdmin);
|
---|
64 | end;
|
---|
65 | FreeAndNil(Pages);
|
---|
66 | AfterStop;
|
---|
67 | end;
|
---|
68 |
|
---|
69 | end.
|
---|
70 |
|
---|
Note:
See
TracBrowser
for help on using the repository browser.