Changeset 77 for trunk/Modules/UMainModule.pas
- Timestamp:
- Jun 18, 2012, 8:48:28 PM (12 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Modules/UMainModule.pas
r76 r77 15 15 16 16 type 17 TSession = class 18 19 end; 20 17 21 { TMainModule } 18 22 … … 21 25 Database: TSqlDatabase; 22 26 WebApp1: TWebApp; 23 procedure DoBeforePageProduce(HandlerData: THTTPHandlerData);27 procedure WebApp1PageProduce(HandlerData: THTTPHandlerData); 24 28 private 25 29 procedure Footer; … … 46 50 NetworkPort: Integer; 47 51 MaxConnections: Integer; 52 Pages: TPageList; 53 procedure LoadUserInfo(HandlerData: THTTPHandlerData); 48 54 procedure LoadFromRegistry; 49 55 procedure SaveToRegistry; … … 115 121 begin 116 122 inherited; 117 with WebApp1 do begin 123 Pages := TPageList.Create; 124 HtmlDocument := THtmlDocument.Create; 125 User := TWebUser.Create; 126 User.Database := Database; 127 UserOnline := TWebOnlineUser.Create; 128 UserOnline.Database := Database; 129 LoadFromRegistry; 130 with Pages do begin 118 131 RegisterPage(TInternetPage, InternetPage, 'internet'); 119 132 RegisterPage(THostingPage, HostingPage, 'hosting'); … … 130 143 RegisterPage(TAboutPage, AboutPage, ''); 131 144 //RegisterPage(TUserControlPage, UserControlPage, ''); 145 end; 146 with WebApp1 do begin 132 147 if ServerType = stTCP then begin 133 THTTPServerTCP(HTTPServer).Socket.Address := MainModule.NetworkAddress; 134 THTTPServerTCP(HTTPServer).Socket.Port := MainModule.NetworkPort; 135 THTTPServerTCP(HTTPServer).MaxConnection := MainModule.MaxConnections; 136 end; 137 end; 138 139 HtmlDocument := THtmlDocument.Create; 140 User := TWebUser.Create; 141 User.Database := Database; 142 UserOnline := TWebOnlineUser.Create; 143 UserOnline.Database := Database; 144 LoadFromRegistry; 148 THTTPServerTCP(HTTPServer).Socket.Address := NetworkAddress; 149 THTTPServerTCP(HTTPServer).Socket.Port := NetworkPort; 150 THTTPServerTCP(HTTPServer).MaxConnection := MaxConnections; 151 end; 152 end; 145 153 end; 146 154 … … 151 159 User.Free; 152 160 UserOnline.Free; 161 Pages.Free; 153 162 inherited Destroy; 154 163 end; … … 240 249 '<li><a href="http://wiki.zdechov.net/">Wiki</a></li>' + 241 250 '</ul><ul class="MenuItem2">'; //<li> </li>'; 242 if Assigned(MainModule. WebApp1.Pages.FindByName('uzivatel')) then begin251 if Assigned(MainModule.Pages.FindByName('uzivatel')) then begin 243 252 if UserOnline.User = AnonymousUserId then begin 244 253 Text := Text + '</ul>' + … … 260 269 end; 261 270 262 procedure TMainModule. DoBeforePageProduce(HandlerData: THTTPHandlerData);271 procedure TMainModule.LoadUserInfo(HandlerData: THTTPHandlerData); 263 272 begin 264 273 User.HandlerData := HandlerData; … … 267 276 User.Id := UserOnline.User; 268 277 User.Load; 278 end; 279 280 procedure TMainModule.WebApp1PageProduce(HandlerData: THTTPHandlerData); 281 var 282 FileName: string; 283 begin 284 with HandlerData do begin 285 if not Pages.ProducePage(HandlerData) then begin 286 WebApp1.HTTPServer.FileResponse(HandlerData) 287 end; 288 end; 269 289 end; 270 290 … … 325 345 InitDatabase; 326 346 //Database.Query('SELECT * FROM ssss'); 347 327 348 WebApp1.Run; 328 349 end;
Note:
See TracChangeset
for help on using the changeset viewer.