Ignore:
Timestamp:
Apr 29, 2012, 9:44:14 PM (13 years ago)
Author:
chronos
Message:
  • Upraveno: Třída WebApp typu TCustomApplication je nyní použita jako komponenta namísto aplikační třídy.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/Modules/UMainModule.pas

    r71 r76  
    2020    HTTPSessionStorageMySQL1: THTTPSessionStorageMySQL;
    2121    Database: TSqlDatabase;
     22    WebApp1: TWebApp;
     23    procedure DoBeforePageProduce(HandlerData: THTTPHandlerData);
    2224  private
    2325    procedure Footer;
     
    2527    procedure Show(Content: string);
    2628    procedure TopMenu;
    27     procedure DoBeforePageProduce(HandlerData: THTTPHandlerData);
    2829  public
    2930    TimeStart: TDateTime;
     
    6061
    6162uses
    62   UApplicationInfo;
     63  UApplicationInfo, UInternetPage, UHostingPage, UHistoryPage, UDocumentsPage, UVoIPPage,
     64  ULinksPage, UPlansPage, UServerInfoPage, UWebCamPage, UUserControlPage,
     65  UNetworkPage, UAboutPage, UContactPage;
    6366
    6467{ TMainModule }
     
    112115begin
    113116  inherited;
     117  with WebApp1 do begin
     118    RegisterPage(TInternetPage, InternetPage, 'internet');
     119    RegisterPage(THostingPage, HostingPage, 'hosting');
     120    RegisterPage(THistoryPage, HistoryPage, 'historie');
     121    RegisterPage(TDocumentsPage, DocumentsPage, 'dokumenty');
     122    RegisterPage(TVoIPPage, VoIPPage, 'voip');
     123    RegisterPage(TLinksPage, LinksPage, 'odkazy');
     124    RegisterPage(TContactPage, ContactPage, 'kontakt');
     125    RegisterPage(TServerInfoPage, ServerInfoPage, 'serverinfo');
     126    RegisterPage(TWebCamPage, WebCamPage, 'kamery');
     127    RegisterPage(TUserControlPage, UserControlPage, 'uzivatel');
     128    RegisterPage(TPlansPage, PlansPage, 'plany');
     129    RegisterPage(TNetworkPage, NetworkPage, 'sit');
     130    RegisterPage(TAboutPage, AboutPage, '');
     131    //RegisterPage(TUserControlPage, UserControlPage, '');
     132    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
    114139  HtmlDocument := THtmlDocument.Create;
    115140  User := TWebUser.Create;
     
    122147destructor TMainModule.Destroy;
    123148begin
    124   SaveToRegistry;
     149  //SaveToRegistry;
    125150  HtmlDocument.Free;
    126151  User.Free;
     
    215240      '<li><a href="http://wiki.zdechov.net/">Wiki</a></li>' +
    216241      '</ul><ul class="MenuItem2">'; //<li>&nbsp;</li>';
    217     if Assigned(Application.Pages.FindByName('uzivatel')) then begin
     242    if Assigned(MainModule.WebApp1.Pages.FindByName('uzivatel')) then begin
    218243      if UserOnline.User = AnonymousUserId then begin
    219244        Text := Text + '</ul>' +
     
    261286    Database.Password := ReadString(SectionDatabase, 'DatabasePassword', 'password');
    262287    FormatHTML := ReadBool(SectionGeneral, 'FormatHTML', False);
    263     Application.LogException := not ReadBool(SectionGeneral, 'ShowException', False);
     288    //MainModule.WebApp1.LogException := not ReadBool(SectionGeneral, 'ShowException', False);
    264289    NetworkAddress := ReadString(SectionHTTPServer, 'NetworkAddress', 'localhost');
    265290    NetworkPort := ReadInteger(SectionHTTPServer, 'NetworkPort', 80);
     
    287312    WriteString(SectionDatabase, 'DatabasePassword', Database.Password);
    288313    WriteBool(SectionGeneral, 'FormatHTML', FormatHTML);
    289     WriteBool(SectionGeneral, 'ShowException', not Application.LogException);
     314    //WriteBool(SectionGeneral, 'ShowException', not MainModule.WebApp1.LogException);
    290315    WriteString(SectionHTTPServer, 'NetworkAddress', NetworkAddress);
    291316    WriteInteger(SectionHTTPServer, 'NetworkPort', NetworkPort);
     
    300325  InitDatabase;
    301326  //Database.Query('SELECT * FROM ssss');
    302   Application.OnBeforePageProduce := DoBeforePageProduce;
     327  WebApp1.Run;
    303328end;
    304329
Note: See TracChangeset for help on using the changeset viewer.