Changeset 55 for trunk/Modules
- Timestamp:
- Jul 23, 2011, 11:23:39 PM (13 years ago)
- Location:
- trunk/Modules
- Files:
-
- 3 deleted
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Modules/UMainModule.pas
r54 r55 7 7 uses 8 8 Classes, SysUtils, FileUtil, LResources, UHTTPServerCGI, UHTTPSessionMySQL, 9 UHTTPServer, USqlDatabase, U Config, DateUtils, UWebPage, UWebApp,9 UHTTPServer, USqlDatabase, URegistry, DateUtils, UWebPage, UWebApp, 10 10 UXmlClasses, UHtmlClasses, UCore, UHTTPServerTCP, 11 UHTTPSessionFile, UUser, SpecializedList; 11 UHTTPSessionFile, UUser, SpecializedList, Registry; 12 13 const 14 RegistryKey = '\Software\Chronosoft\ZdechovNET'; 12 15 13 16 type … … 39 42 User: TWebUser; 40 43 UserOnline: TWebOnlineUser; 44 FormatHTML: Boolean; 45 procedure LoadFromRegistry; 46 procedure SaveToRegistry; 41 47 procedure GeneratePage(HandlerData: THTTPHandlerData; Page: TWebPage); 42 48 procedure Run; … … 62 68 UserOnline.Update; 63 69 with HandlerData do begin 64 Style := Config.Style;65 BaseURL := Config.BaseURL;66 67 70 HtmlDocument.ContentLanguage := 'cs'; 68 71 GlobalTitle := 'ZděchovNET'; … … 81 84 with HtmlDocument.AsXmlDocument do 82 85 try 83 Formated := Config.FormatHTML;86 Formated := FormatHTML; 84 87 Response.Stream.WriteString(AsString); 85 88 finally … … 94 97 begin 95 98 with Database do begin 96 Hostname := Config.DatabaseHostName;97 Database := Config.DatabaseDatabase;98 UserName := Config.DatabaseUserName;99 Password := Config.DatabasePassword;100 99 Connect; 101 100 end; … … 229 228 end; 230 229 230 procedure TMainModule.LoadFromRegistry; 231 begin 232 with TRegistryEx.Create do 233 try 234 RootKey := HKEY_CURRENT_USER; 235 OpenKey(RegistryKey, True); 236 Style := ReadStringWithDefault('Style', 'Basic'); 237 BaseURL := ReadStringWithDefault('BaseURL', 'http://localhost'); 238 Database.Hostname := ReadStringWithDefault('DatabaseHostName', 'localhost'); 239 Database.Database := ReadStringWithDefault('DatabaseDatabase', 'web'); 240 Database.UserName := ReadStringWithDefault('DatabaseUserName', 'user'); 241 Database.Password := ReadStringWithDefault('DatabasePassword', 'password'); 242 FormatHTML := ReadBoolWithDefault('FormatHTML', False); 243 Application.HTTPServer.ShowExceptions := ReadBoolWithDefault('ShowException', False); 244 245 finally 246 Free; 247 end; 248 end; 249 250 procedure TMainModule.SaveToRegistry; 251 begin 252 253 end; 254 231 255 procedure TMainModule.Run; 232 256 begin 257 LoadFromRegistry; 258 //Application.HTTPServer.ShowExceptions := True; 233 259 InitDatabase; 234 Application.HTTPServer.ShowExceptions := Config.ShowException;235 260 //Database.Query('SELECT * FROM ssss'); 236 261 end;
Note:
See TracChangeset
for help on using the changeset viewer.