Changeset 76


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.
Location:
trunk
Files:
9 edited

Legend:

Unmodified
Added
Removed
  • trunk/Modules/UMainModule.lfm

    r62 r76  
    1919    top = 86
    2020  end
     21  object WebApp1: TWebApp
     22    OnBeforePageProduce = DoBeforePageProduce
     23    ServerType = stCGI
     24    left = 160
     25    top = 88
     26  end
    2127end
  • trunk/Modules/UMainModule.lrs

    r62 r76  
    77  +'base'#7'Timeout'#3'0*'#19'SessionIdCookieName'#6#9'SessionId'#4'left'#3'0'#1
    88  +#3'top'#2' '#0#0#12'TSqlDatabase'#8'Database'#9'Connected'#8#4'Port'#3#234#12
    9   +#8'Encoding'#6#4'utf8'#4'left'#2'Q'#3'top'#2'V'#0#0#0
     9  +#8'Encoding'#6#4'utf8'#4'left'#2'Q'#3'top'#2'V'#0#0#7'TWebApp'#7'WebApp1'#19
     10  +'OnBeforePageProduce'#7#19'DoBeforePageProduce'#10'ServerType'#7#5'stCGI'#4
     11  +'left'#3#160#0#3'top'#2'X'#0#0#0
    1012]);
  • 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
  • trunk/Pages/UServerInfoPage.pas

    r56 r76  
    3535begin
    3636  HandlerData.Session.Values['Test'] := 'Tst';
    37   Application.HTTPServer.ServerInfo(HandlerData);
     37  MainModule.WebApp1.HTTPServer.ServerInfo(HandlerData);
    3838  MainModule.GeneratePage(HandlerData, Self);
    3939end;
  • trunk/ZdechovNET.lpi

    r72 r76  
    3939      </local>
    4040    </RunParams>
    41     <RequiredPackages Count="5">
     41    <RequiredPackages Count="6">
    4242      <Item1>
    43         <PackageName Value="LCL"/>
     43        <PackageName Value="PersistentData"/>
    4444      </Item1>
    4545      <Item2>
    46         <PackageName Value="synapse"/>
    47         <DefaultFilename Value="Components/synapse/synapse.lpk" Prefer="True"/>
     46        <PackageName Value="TemplateGenerics"/>
    4847      </Item2>
    4948      <Item3>
    50         <PackageName Value="Common"/>
    51         <DefaultFilename Value="Components/Common/Common.lpk" Prefer="True"/>
     49        <PackageName Value="CoolWeb"/>
    5250      </Item3>
    5351      <Item4>
    54         <PackageName Value="CoolWeb"/>
    55         <DefaultFilename Value="Components/CoolWeb/CoolWeb.lpk" Prefer="True"/>
     52        <PackageName Value="Common"/>
    5653      </Item4>
    5754      <Item5>
    58         <PackageName Value="TemplateGenerics"/>
    59         <DefaultFilename Value="Components/TemplateGenerics/TemplateGenerics.lpk" Prefer="True"/>
     55        <PackageName Value="synapse"/>
    6056      </Item5>
     57      <Item6>
     58        <PackageName Value="LCL"/>
     59      </Item6>
    6160    </RequiredPackages>
    6261    <Units Count="21">
     
    8887        <IsPartOfProject Value="True"/>
    8988        <ComponentName Value="MainModule"/>
     89        <HasResources Value="True"/>
    9090        <ResourceBaseClass Value="DataModule"/>
    9191        <UnitName Value="UMainModule"/>
     
    165165        <IsPartOfProject Value="True"/>
    166166        <ComponentName Value="UserControlPage"/>
     167        <HasResources Value="True"/>
    167168        <ResourceBaseClass Value="DataModule"/>
    168169        <UnitName Value="UUserControlPage"/>
  • trunk/ZdechovNET.lpr

    r71 r76  
    77  cthreads,
    88  {$ENDIF}
    9   UCore, USqlDatabase, SysUtils, Contnrs,
    10   UContactPage, UUser, UHTTPSessionMySQL, UHTTPSessionFile,
     9  UCore, USqlDatabase, SysUtils, Contnrs, Forms,
     10  UUser, UHTTPSessionMySQL, UHTTPSessionFile,
    1111  UCommon, UHTTPServer, UHTTPServerTCP, UHTTPServerCGI, UTCPServer, UPool,
    12   UMemoryStreamEx, UMIMEType, UPageList, Interfaces, UMainModule, UWebApp,
    13   UInternetPage, UHostingPage, UHistoryPage, UDocumentsPage, UVoIPPage,
    14   ULinksPage, UPlansPage, UServerInfoPage, UWebCamPage, UUserControlPage,
    15   UNetworkPage, UAboutPage;
     12  UMemoryStreamEx, UMIMEType, UPageList, Interfaces, UMainModule, UWebApp;
    1613
    1714begin
    18   with Application do
    19   try
     15  with Application do begin
    2016    Initialize;
    21     MainModule := TMainModule.Create(nil);
     17    MainModule := TMainModule.Create(Application);
    2218    MainModule.Run;
    23     RegisterPage(TInternetPage, InternetPage, 'internet');
    24     RegisterPage(THostingPage, HostingPage, 'hosting');
    25     RegisterPage(THistoryPage, HistoryPage, 'historie');
    26     RegisterPage(TDocumentsPage, DocumentsPage, 'dokumenty');
    27     RegisterPage(TVoIPPage, VoIPPage, 'voip');
    28     RegisterPage(TLinksPage, LinksPage, 'odkazy');
    29     RegisterPage(TContactPage, ContactPage, 'kontakt');
    30     RegisterPage(TServerInfoPage, ServerInfoPage, 'serverinfo');
    31     RegisterPage(TWebCamPage, WebCamPage, 'kamery');
    32     //RegisterPage(TUserControlPage, UserControlPage, 'uzivatel');
    33     RegisterPage(TPlansPage, PlansPage, 'plany');
    34     RegisterPage(TNetworkPage, NetworkPage, 'sit');
    35     RegisterPage(TAboutPage, AboutPage, '');
    36     //RegisterPage(TUserControlPage, UserControlPage, '');
    37     ServerType := stCGI;
    38     if ServerType = stTCP then begin
    39       THTTPServerTCP(HTTPServer).Socket.Address := MainModule.NetworkAddress;
    40       THTTPServerTCP(HTTPServer).Socket.Port := MainModule.NetworkPort;
    41       THTTPServerTCP(HTTPServer).MaxConnection := MainModule.MaxConnections;
    42     end;
    4319    Run;
    44   finally
    45     MainModule.Free;
    4620  end;
    4721end.
  • trunk/languages/index.cs.po

    r73 r76  
    99"MIME-Version: 1.0\n"
    1010"Content-Transfer-Encoding: 8bit\n"
     11
     12#: tformmain.caption
     13msgid "FormMain"
     14msgstr ""
     15
     16#: tformmain.editaddress.text
     17msgctxt "tformmain.editaddress.text"
     18msgid "EditAddress"
     19msgstr ""
     20
     21#: tformmain.toolbar1.caption
     22msgctxt "tformmain.toolbar1.caption"
     23msgid "ToolBar1"
     24msgstr ""
     25
     26#: tformmain.toolbutton1.caption
     27msgctxt "tformmain.toolbutton1.caption"
     28msgid "ToolButton1"
     29msgstr ""
     30
     31#: tformmain.toolbutton2.caption
     32msgctxt "tformmain.toolbutton2.caption"
     33msgid "ToolButton2"
     34msgstr ""
     35
     36#: tformname.caption
     37msgid "FormName"
     38msgstr ""
     39
     40#: tformname.editaddress.text
     41msgctxt "tformname.editaddress.text"
     42msgid "EditAddress"
     43msgstr ""
     44
     45#: tformname.toolbar1.caption
     46msgctxt "tformname.toolbar1.caption"
     47msgid "ToolBar1"
     48msgstr ""
     49
     50#: tformname.toolbutton1.caption
     51msgctxt "tformname.toolbutton1.caption"
     52msgid "ToolButton1"
     53msgstr ""
     54
     55#: tformname.toolbutton2.caption
     56msgctxt "tformname.toolbutton2.caption"
     57msgid "ToolButton2"
     58msgstr ""
    1159
    1260#: ucustomapplication.spagenotfound
  • trunk/languages/index.po

    r50 r76  
    11msgid ""
    22msgstr "Content-Type: text/plain; charset=UTF-8"
     3
     4#: tformmain.caption
     5msgid "FormMain"
     6msgstr ""
     7
     8#: tformmain.editaddress.text
     9msgctxt "TFORMMAIN.EDITADDRESS.TEXT"
     10msgid "EditAddress"
     11msgstr ""
     12
     13#: tformmain.toolbar1.caption
     14msgctxt "TFORMMAIN.TOOLBAR1.CAPTION"
     15msgid "ToolBar1"
     16msgstr ""
     17
     18#: tformmain.toolbutton1.caption
     19msgctxt "TFORMMAIN.TOOLBUTTON1.CAPTION"
     20msgid "ToolButton1"
     21msgstr ""
     22
     23#: tformmain.toolbutton2.caption
     24msgctxt "TFORMMAIN.TOOLBUTTON2.CAPTION"
     25msgid "ToolButton2"
     26msgstr ""
     27
     28#: tformname.caption
     29msgid "FormName"
     30msgstr ""
     31
     32#: tformname.editaddress.text
     33msgctxt "tformname.editaddress.text"
     34msgid "EditAddress"
     35msgstr ""
     36
     37#: tformname.toolbar1.caption
     38msgctxt "tformname.toolbar1.caption"
     39msgid "ToolBar1"
     40msgstr ""
     41
     42#: tformname.toolbutton1.caption
     43msgctxt "tformname.toolbutton1.caption"
     44msgid "ToolButton1"
     45msgstr ""
     46
     47#: tformname.toolbutton2.caption
     48msgctxt "tformname.toolbutton2.caption"
     49msgid "ToolButton2"
     50msgstr ""
    351
    452#: ucustomapplication.spagenotfound
Note: See TracChangeset for help on using the changeset viewer.