source: trunk/Modules/ZdechovNET/HistoryPage.pas

Last change on this file was 151, checked in by chronos, 9 months ago
File size: 1.3 KB
Line 
1unit HistoryPage;
2
3interface
4
5uses
6 Classes, SysUtils, FileUtil, WebPage, HTTPServer, HtmlClasses, SqlDatabase,
7 ModuleUser;
8
9type
10
11 { THistoryPage }
12
13 THistoryPage = class(TWebPage)
14 procedure DataModuleProduce(HandlerData: THTTPHandlerData);
15 end;
16
17var
18 HistoryPage: THistoryPage;
19
20
21implementation
22
23{$R *.lfm}
24
25uses
26 Core, Utils, WebSession;
27
28{ THistoryPage }
29
30procedure THistoryPage.DataModuleProduce(HandlerData: THTTPHandlerData);
31var
32 DbRows: TDbRows;
33 I: Integer;
34 ModuleUser: TModuleUser;
35begin
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'])) + '&nbsp;- </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;
61end;
62
63end.
64
Note: See TracBrowser for help on using the repository browser.