Changeset 55 for trunk/Modules


Ignore:
Timestamp:
Jul 23, 2011, 11:23:39 PM (13 years ago)
Author:
george
Message:
  • Upraveno: Stránky rozděleny do samostatných jednotek.
  • Upraveno: Konfigurace staticky přikompilovaná nahrazena načítanou z registrů (na linuxu xml soubor) .
Location:
trunk/Modules
Files:
3 deleted
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/Modules/UMainModule.pas

    r54 r55  
    77uses
    88  Classes, SysUtils, FileUtil, LResources, UHTTPServerCGI, UHTTPSessionMySQL,
    9   UHTTPServer, USqlDatabase, UConfig, DateUtils, UWebPage, UWebApp,
     9  UHTTPServer, USqlDatabase, URegistry, DateUtils, UWebPage, UWebApp,
    1010  UXmlClasses, UHtmlClasses, UCore, UHTTPServerTCP,
    11   UHTTPSessionFile, UUser, SpecializedList;
     11  UHTTPSessionFile, UUser, SpecializedList, Registry;
     12
     13const
     14  RegistryKey = '\Software\Chronosoft\ZdechovNET';
    1215
    1316type
     
    3942    User: TWebUser;
    4043    UserOnline: TWebOnlineUser;
     44    FormatHTML: Boolean;
     45    procedure LoadFromRegistry;
     46    procedure SaveToRegistry;
    4147    procedure GeneratePage(HandlerData: THTTPHandlerData; Page: TWebPage);
    4248    procedure Run;
     
    6268  UserOnline.Update;
    6369  with HandlerData do begin
    64     Style := Config.Style;
    65     BaseURL := Config.BaseURL;
    66 
    6770    HtmlDocument.ContentLanguage := 'cs';
    6871    GlobalTitle := 'ZděchovNET';
     
    8184      with HtmlDocument.AsXmlDocument do
    8285      try
    83         Formated := Config.FormatHTML;
     86        Formated := FormatHTML;
    8487        Response.Stream.WriteString(AsString);
    8588      finally
     
    9497begin
    9598  with Database do begin
    96     Hostname := Config.DatabaseHostName;
    97     Database := Config.DatabaseDatabase;
    98     UserName := Config.DatabaseUserName;
    99     Password := Config.DatabasePassword;
    10099    Connect;
    101100  end;
     
    229228end;
    230229
     230procedure TMainModule.LoadFromRegistry;
     231begin
     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;
     248end;
     249
     250procedure TMainModule.SaveToRegistry;
     251begin
     252
     253end;
     254
    231255procedure TMainModule.Run;
    232256begin
     257  LoadFromRegistry;
     258  //Application.HTTPServer.ShowExceptions := True;
    233259  InitDatabase;
    234   Application.HTTPServer.ShowExceptions := Config.ShowException;
    235260  //Database.Query('SELECT * FROM ssss');
    236261end;
Note: See TracChangeset for help on using the changeset viewer.