Line | |
---|
1 | unit HistoryPage;
|
---|
2 |
|
---|
3 | interface
|
---|
4 |
|
---|
5 | uses
|
---|
6 | Classes, SysUtils, FileUtil, WebPage, HTTPServer, HtmlClasses, SqlDatabase,
|
---|
7 | ModuleUser;
|
---|
8 |
|
---|
9 | type
|
---|
10 |
|
---|
11 | { THistoryPage }
|
---|
12 |
|
---|
13 | THistoryPage = class(TWebPage)
|
---|
14 | procedure DataModuleProduce(HandlerData: THTTPHandlerData);
|
---|
15 | end;
|
---|
16 |
|
---|
17 | var
|
---|
18 | HistoryPage: THistoryPage;
|
---|
19 |
|
---|
20 |
|
---|
21 | implementation
|
---|
22 |
|
---|
23 | {$R *.lfm}
|
---|
24 |
|
---|
25 | uses
|
---|
26 | Core, Utils, WebSession;
|
---|
27 |
|
---|
28 | { THistoryPage }
|
---|
29 |
|
---|
30 | procedure THistoryPage.DataModuleProduce(HandlerData: THTTPHandlerData);
|
---|
31 | var
|
---|
32 | DbRows: TDbRows;
|
---|
33 | I: Integer;
|
---|
34 | ModuleUser: TModuleUser;
|
---|
35 | begin
|
---|
36 | with TWebSession(HandlerData) do begin
|
---|
37 | ModuleUser := TModuleUser(ModuleManager.FindModuleByName('User'));
|
---|
38 | if Request.Path.Count > 1 then begin
|
---|
39 | PageNotFound;
|
---|
40 | Exit;
|
---|
41 | end;
|
---|
42 |
|
---|
43 | ModuleUser.LoadUserInfo;
|
---|
44 | with HtmlDocument.Body, SubItems.AddString do begin
|
---|
45 | Text := '<table>';
|
---|
46 | try
|
---|
47 | DbRows := TDbRows.Create;
|
---|
48 | Database.Query(DbRows, 'SELECT * FROM History ORDER BY Date DESC');
|
---|
49 | for I := 0 to DbRows.Count - 1 do begin
|
---|
50 | Text := Text + '<tr><td style="text-align: right; vertical-align: top;">' +
|
---|
51 | HumanDate(SQLToDateTime(DbRows[I].Items['Date'])) + ' - </td><td>' +
|
---|
52 | DbRows[I].Items['Text'] + '</td></tr>';
|
---|
53 | end;
|
---|
54 | finally
|
---|
55 | DbRows.Free;
|
---|
56 | end;
|
---|
57 | Text := Text + '</table>';
|
---|
58 | end;
|
---|
59 | GeneratePage(Self);
|
---|
60 | end;
|
---|
61 | end;
|
---|
62 |
|
---|
63 | end.
|
---|
64 |
|
---|
Note:
See
TracBrowser
for help on using the repository browser.