Changeset 77


Ignore:
Timestamp:
Jun 18, 2012, 8:48:28 PM (12 years ago)
Author:
chronos
Message:
  • Upraveno: Obsluhuj generování stránek dle vlastního seznamu stránek a pokud nenajdeš přímou obsluhu, tak zkus generovat ze souboru.
Location:
trunk
Files:
19 edited

Legend:

Unmodified
Added
Removed
  • trunk/Application/UApplicationInfo.pas

    r71 r77  
    5353  Name := 'ZděchovNET';
    5454  Identification := 1;
    55   ReleaseDate := EncodeDate(2012, 2, 11);
     55  ReleaseDate := EncodeDate(2012, 6, 18);
    5656  MajorVersion := 1;
    5757  MinorVersion := 0;
  • trunk/Modules/UMainModule.lfm

    r76 r77  
    2020  end
    2121  object WebApp1: TWebApp
    22     OnBeforePageProduce = DoBeforePageProduce
    23     ServerType = stCGI
     22    OnPageProduce = WebApp1PageProduce
     23    ServerType = stTCP
    2424    left = 160
    2525    top = 88
  • trunk/Modules/UMainModule.lrs

    r76 r77  
    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#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
     9  +#8'Encoding'#6#4'utf8'#4'left'#2'Q'#3'top'#2'V'#0#0#7'TWebApp'#7'WebApp1'#13
     10  +'OnPageProduce'#7#18'WebApp1PageProduce'#10'ServerType'#7#5'stTCP'#4'left'#3
     11  +#160#0#3'top'#2'X'#0#0#0
    1212]);
  • trunk/Modules/UMainModule.pas

    r76 r77  
    1515
    1616type
     17  TSession = class
     18
     19  end;
     20
    1721  { TMainModule }
    1822
     
    2125    Database: TSqlDatabase;
    2226    WebApp1: TWebApp;
    23     procedure DoBeforePageProduce(HandlerData: THTTPHandlerData);
     27    procedure WebApp1PageProduce(HandlerData: THTTPHandlerData);
    2428  private
    2529    procedure Footer;
     
    4650    NetworkPort: Integer;
    4751    MaxConnections: Integer;
     52    Pages: TPageList;
     53    procedure LoadUserInfo(HandlerData: THTTPHandlerData);
    4854    procedure LoadFromRegistry;
    4955    procedure SaveToRegistry;
     
    115121begin
    116122  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
    118131    RegisterPage(TInternetPage, InternetPage, 'internet');
    119132    RegisterPage(THostingPage, HostingPage, 'hosting');
     
    130143    RegisterPage(TAboutPage, AboutPage, '');
    131144    //RegisterPage(TUserControlPage, UserControlPage, '');
     145  end;
     146  with WebApp1 do begin
    132147    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;
    145153end;
    146154
     
    151159  User.Free;
    152160  UserOnline.Free;
     161  Pages.Free;
    153162  inherited Destroy;
    154163end;
     
    240249      '<li><a href="http://wiki.zdechov.net/">Wiki</a></li>' +
    241250      '</ul><ul class="MenuItem2">'; //<li>&nbsp;</li>';
    242     if Assigned(MainModule.WebApp1.Pages.FindByName('uzivatel')) then begin
     251    if Assigned(MainModule.Pages.FindByName('uzivatel')) then begin
    243252      if UserOnline.User = AnonymousUserId then begin
    244253        Text := Text + '</ul>' +
     
    260269end;
    261270
    262 procedure TMainModule.DoBeforePageProduce(HandlerData: THTTPHandlerData);
     271procedure TMainModule.LoadUserInfo(HandlerData: THTTPHandlerData);
    263272begin
    264273  User.HandlerData := HandlerData;
     
    267276  User.Id := UserOnline.User;
    268277  User.Load;
     278end;
     279
     280procedure TMainModule.WebApp1PageProduce(HandlerData: THTTPHandlerData);
     281var
     282  FileName: string;
     283begin
     284  with HandlerData do begin
     285    if not Pages.ProducePage(HandlerData) then begin
     286      WebApp1.HTTPServer.FileResponse(HandlerData)
     287    end;
     288  end;
    269289end;
    270290
     
    325345  InitDatabase;
    326346  //Database.Query('SELECT * FROM ssss');
     347
    327348  WebApp1.Run;
    328349end;
  • trunk/Pages/UAboutPage.pas

    r70 r77  
    3737begin
    3838  with MainModule do begin
     39    LoadUserInfo(HandlerData);
    3940    with HtmlDocument.Body, THtmlString(SubItems.AddNew(THtmlString.Create)) do begin
    4041    Text := '<img align="left" src="' + NavigationLink('/images/umisteni.gif') + '" alt="Umístění obce"/>' +
  • trunk/Pages/UContactPage.pas

    r56 r77  
    3232procedure TContactPage.DataModuleProduce(HandlerData: THTTPHandlerData);
    3333begin
    34   with MainModule.HtmlDocument.Body, THtmlString(SubItems.AddNew(THtmlString.Create)) do begin
     34  with MainModule, HtmlDocument.Body, THtmlString(SubItems.AddNew(THtmlString.Create)) do begin
     35    LoadUserInfo(HandlerData);
    3536    Text := '<strong>Kontaktní informace</strong><br/>' +
    3637    'Provozovatel: Ing. Jiří Hajda<br/>' +
     
    4243    'IČ: 75904535<br/>' +
    4344    'DIČ: CZ8303255884<br/>' +
    44     'Bankovní účet: 218098370 / 0300<br/>';
     45    'Bankovní spojení pro platby v CZK v ČR: 2600134781 / 2010' +
     46    'Bankovní spojení pro platby v EUR v SR: 2600134781 / 8330' +
     47    'Starý bankovní účet: 218098370 / 0300<br/>';
    4548  end;
    4649  MainModule.GeneratePage(HandlerData, Self);
  • trunk/Pages/UDocumentsPage.pas

    r56 r77  
    3535begin
    3636  with MainModule do begin
     37    LoadUserInfo(HandlerData);
    3738    with HtmlDocument.Body, THtmlString(SubItems.AddNew(THtmlString.Create)) do begin
    3839      Text := '<strong>O obci:</strong><br/>' +
  • trunk/Pages/UHistoryPage.pas

    r56 r77  
    3838begin
    3939  with MainModule do begin
     40    LoadUserInfo(HandlerData);
    4041    with HtmlDocument.Body, THtmlString(SubItems.AddNew(THtmlString.Create)) do begin
    4142      Text := '<table>';
  • trunk/Pages/UHostingPage.pas

    r56 r77  
    3939begin
    4040  with MainModule do begin
    41 
     41    LoadUserInfo(HandlerData);
    4242    with HtmlDocument.Body, THtmlString(SubItems.AddNew(THtmlString.Create)) do begin
    4343      Text := 'V nabídce je provoz virtualizovaných Linuxových serverů dle dohodnutých parameterů.<br/><br/>' +
  • trunk/Pages/UInternetPage.pas

    r70 r77  
    3535begin
    3636  with MainModule do begin
     37    LoadUserInfo(HandlerData);
    3738    with HtmlDocument.Body, THtmlString(SubItems.AddNew(THtmlString.Create)) do begin
    3839      Text := Text + 'Hlavní náplní činnosti sítě je poskytovat výhodné připojení k internetu pro občany.<br/><br/>' +
  • trunk/Pages/ULinksPage.pas

    r71 r77  
    3434procedure TLinksPage.DataModuleProduce(HandlerData: THTTPHandlerData);
    3535begin
    36   with MainModule.HtmlDocument.Body, THtmlString(SubItems.AddNew(THtmlString.Create)) do begin
     36  with MainModule, HtmlDocument.Body, THtmlString(SubItems.AddNew(THtmlString.Create)) do begin
     37    LoadUserInfo(HandlerData);
    3738    Text := '<strong>Odkazy související s obcí:</strong><br/>' +
    3839
  • trunk/Pages/UNetworkPage.pas

    r56 r77  
    3737begin
    3838  with MainModule do begin
     39    LoadUserInfo(HandlerData);
    3940    with HtmlDocument.Body, THtmlString(SubItems.AddNew(THtmlString.Create)) do begin
    4041      Text := MakeLink('Historie', NavigationLink('/historie/')) + '<br/>' +
  • trunk/Pages/UPlansPage.pas

    r56 r77  
    3838begin
    3939  with MainModule do begin
     40    LoadUserInfo(HandlerData);
    4041    with HtmlDocument.Body, THtmlString(SubItems.AddNew(THtmlString.Create)) do begin
    4142      Text := '<table>';
  • trunk/Pages/UServerInfoPage.pas

    r76 r77  
    3434procedure TServerInfoPage.DataModuleProduce(HandlerData: THTTPHandlerData);
    3535begin
    36   HandlerData.Session.Values['Test'] := 'Tst';
    37   MainModule.WebApp1.HTTPServer.ServerInfo(HandlerData);
    38   MainModule.GeneratePage(HandlerData, Self);
     36  with MainModule do begin
     37    LoadUserInfo(HandlerData);
     38    HandlerData.Session.Values['Test'] := 'Tst';
     39    WebApp1.HTTPServer.ServerInfo(HandlerData);
     40    GeneratePage(HandlerData, Self);
     41  end;
    3942end;
    4043
  • trunk/Pages/UUserControlPage.pas

    r71 r77  
    4646    else PageName := '';
    4747  with MainModule, HtmlDocument.Body do begin
     48    LoadUserInfo(HandlerData);
    4849    if PageName = '' then PageName := 'prihlaseni';
    4950    if PageName = 'prihlaseni' then HandleLogin(HandlerData)
  • trunk/Pages/UVoIPPage.pas

    r56 r77  
    3535begin
    3636  with MainModule do begin
     37    LoadUserInfo(HandlerData);
    3738    with HtmlDocument.Body, THtmlString(SubItems.AddNew(THtmlString.Create)) do begin
    3839      Text := 'Volejte levněji do pevných a mobilních sítí s sekundovou tarifikací a bez měsíčního paušálu.' +
  • trunk/Pages/UWebCamPage.pas

    r74 r77  
    4444begin
    4545  with MainModule do begin
     46    LoadUserInfo(HandlerData);
    4647    with HtmlDocument.Body, THtmlString(SubItems.AddNew(THtmlString.Create)) do begin
    4748      Text := '';
  • trunk/ZdechovNET.lpi

    r76 r77  
    173173        <IsPartOfProject Value="True"/>
    174174        <ComponentName Value="NetworkPage"/>
     175        <HasResources Value="True"/>
    175176        <ResourceBaseClass Value="DataModule"/>
    176177        <UnitName Value="UNetworkPage"/>
     
    231232      <CompilerPath Value="$(CompPath)"/>
    232233    </Other>
     234    <LCLWidgetType Value="nogui"/>
    233235  </CompilerOptions>
    234236</CONFIG>
Note: See TracChangeset for help on using the changeset viewer.