Changeset 105 for trunk/Modules


Ignore:
Timestamp:
Oct 9, 2012, 1:58:45 PM (12 years ago)
Author:
chronos
Message:
  • Přidáno: Hlavní modul Base, který slouží jako základní rozhraní k aplikaci pro ostatní moduly. Modul System zajistí udržování seznamu instalovaných modulů v perzistentním úložišti v databázi.
  • Upraveno: Správce modulů ModuleManager je nyní použit pro každé komunikační spojení zvlášť.
Location:
trunk/Modules
Files:
4 added
23 edited

Legend:

Unmodified
Added
Removed
  • trunk/Modules/Finance/UModuleFinance.pas

    r101 r105  
    66
    77uses
    8   Classes, SysUtils, UModularSystem, SpecializedDictionary;
     8  Classes, SysUtils, UModularSystem, SpecializedDictionary, UModuleBase,
     9  UWebPage;
    910
    1011type
     
    1314
    1415  TModuleFinance = class(TModule)
     16  private
     17    WebPageFinance: TWebPage;
    1518  public
     19    ModuleBase: TModuleBase;
    1620    constructor Create(Owner: TComponent); override;
    1721    destructor Destroy; override;
     
    3943  License := 'GNU/LGPL v3';
    4044  Author := 'Chronosoft';
     45  Dependencies.Add('Base');
    4146end;
    4247
     
    4853procedure TModuleFinance.Start;
    4954begin
    50   Core.Pages.RegisterPage(TWebPageFinance, WebPageFinance, 'finance');
     55  BeforeStart;
     56  ModuleBase := TModuleBase(Manager.FindModuleByName('Base'));
     57  WebPageFinance := TWebPageFinance.Create(nil);
     58  ModuleBase.Pages.RegisterPage(WebPageFinance, 'finance');
    5159  //RegisterPage(TUserControlPage, UserControlPage, '');
    52   inherited;
     60  AfterStart;
    5361end;
    5462
    5563procedure TModuleFinance.Stop;
    5664begin
    57   inherited;
    58   Core.Pages.UnregisterPage('finance');
     65  BeforeStop;
     66  ModuleBase.Pages.UnregisterPage(WebPageFinance);
     67  FreeAndNil(WebPageFinance);
     68  ModuleBase := nil;
     69  AfterStop;
    5970end;
    6071
  • trunk/Modules/IS/UModuleIS.pas

    r102 r105  
    66
    77uses
    8   Classes, SysUtils, UModularSystem, SpecializedDictionary, USqlDatabase;
     8  Classes, SysUtils, UModularSystem, SpecializedDictionary, USqlDatabase,
     9  UModuleBase;
    910
    1011type
     
    1516  private
    1617  public
     18    ModuleBase: TModuleBase;
    1719    constructor Create(Owner: TComponent); override;
    1820    destructor Destroy; override;
     
    4042  License := 'GNU/LGPL v3';
    4143  Author := 'Chronosoft';
     44  Dependencies.Add('Base');
    4245end;
    4346
     
    4952procedure TModuleIS.Start;
    5053begin
    51   Core.Pages.RegisterPage(TWebPagePortal, WebPagePortal, 'portal');
    52   inherited;
     54  BeforeStart;
     55  ModuleBase := TModuleBase(Manager.FindModuleByName('Base'));
     56  //ModuleBase.Pages.RegisterPage(TWebPagePortal, WebPagePortal, 'portal');
     57  AfterStart;
    5358end;
    5459
    5560procedure TModuleIS.Stop;
    5661begin
    57   inherited;
    58   Core.Pages.UnregisterPage('portal');
     62  BeforeStop;
     63  //ModuleBase.Pages.UnregisterPage('portal');
     64  ModuleBase := nil;
     65  AfterStop;
    5966end;
    6067
  • trunk/Modules/Network/UModuleNetwork.pas

    r102 r105  
    66
    77uses
    8   Classes, SysUtils, UModularSystem, SpecializedDictionary;
     8  Classes, SysUtils, UModularSystem, SpecializedDictionary, UModuleBase,
     9  UWebPage;
    910
    1011type
     
    1314
    1415  TModuleNetwork = class(TModule)
     16  private
     17    WebPageNetwork: TWebPage;
    1518  public
     19    ModuleBase: TModuleBase;
    1620    constructor Create(Owner: TComponent); override;
    1721    destructor Destroy; override;
     
    3943  License := 'GNU/LGPL v3';
    4044  Author := 'Chronosoft';
     45  Dependencies.Add('Base');
    4146end;
    4247
     
    4853procedure TModuleNetwork.Start;
    4954begin
    50   Core.Pages.RegisterPage(TWebPageNetwork, WebPageNetwork, 'sit');
     55  BeforeStart;
     56  ModuleBase := TModuleBase(Manager.FindModuleByName('Base'));
     57  WebPageNetwork := TWebPageNetwork.Create(nil);
     58  ModuleBase.Pages.RegisterPage(WebPageNetwork, 'sit');
    5159  //RegisterPage(TUserControlPage, UserControlPage, '');
    52   inherited;
     60  AfterStart;
    5361end;
    5462
    5563procedure TModuleNetwork.Stop;
    5664begin
    57   inherited;
    58   Core.Pages.UnregisterPage('sit');
     65  BeforeStop;
     66  ModuleBase.Pages.UnregisterPage(WebPageNetwork);
     67  FreeAndNil(WebPageNetwork);
     68  ModuleBase := nil;
     69  AfterStop;
    5970end;
    6071
  • trunk/Modules/Portal/UModulePortal.pas

    r104 r105  
    77uses
    88  Classes, SysUtils, UModularSystem, SpecializedDictionary, USqlDatabase,
    9   UUtils, UWebSession, SpecializedList, UUser, UWebPage, UHtmlClasses;
     9  UUtils, UWebSession, SpecializedList, UUser, UWebPage, UHtmlClasses,
     10  UModuleBase, UModuleUser;
    1011
    1112type
     
    1617  private
    1718    Time: TDateTime;
     19    WebPagePortal: TWebPage;
    1820    function ShowFooter(Session: TWebSession): string;
    1921    function ShowHeader(Session: TWebSession): string;
    2022    procedure GeneratePage(ASession: TWebSession; Page: TWebPage);
    2123  public
     24    ModuleBase: TModuleBase;
     25    ModuleUser: TModuleUser;
    2226    constructor Create(Owner: TComponent); override;
    2327    destructor Destroy; override;
     
    4650  Author := 'Chronosoft';
    4751  Dependencies.Add('User');
     52  Dependencies.Add('Finance');
     53  Dependencies.Add('News');
    4854end;
    4955
     
    5561procedure TModulePortal.Start;
    5662begin
    57   Core.GeneratePage := GeneratePage;
    58   Core.Pages.RegisterPage(TWebPagePortal, WebPagePortal, 'portal');
    59   inherited;
     63  BeforeStart;
     64  ModuleBase := TModuleBase(Manager.FindModuleByName('Base'));
     65  ModuleBase.GeneratePage := GeneratePage;
     66  WebPagePortal := TWebPagePortal.Create(nil);
     67  ModuleBase.Pages.RegisterPage(WebPagePortal, '');
     68  TWebPagePortal(WebPagePortal).ModuleUser := TModuleUser(Manager.FindModuleByName('User'));
     69  AfterStart;
    6070end;
    6171
    6272procedure TModulePortal.Stop;
    6373begin
    64   inherited;
    65   Core.Pages.UnregisterPage('portal');
     74  BeforeStop;
     75  ModuleBase.Pages.UnregisterPage(WebPagePortal);
     76  FreeAndNil(WebPagePortal);
     77  ModuleBase := nil;
     78  AfterStop;
    6679end;
    6780
     
    208221    '<div class="Navigation"><span class="MenuItem"><strong>Navigace :: </strong> ';
    209222    Output := Output + Navigation + '</span><div class="MenuItem2">';
    210     if Session.User.Id = UnknownUser then
     223    if ModuleUser.User.Id = UnknownUser then
    211224      Output := Output + '<a href="' + MakeLink('Přihlášení',
    212225        NavigationLink('/?Action=LoginForm')) + ' ' +
    213226        MakeLink('Registrace', NavigationLink('/?Action=UserRegister'))
    214       else Output := Output + Session.User.Name + ' ' + MakeLink('Odhlásit',
     227      else Output := Output + ModuleUser.User.Name + ' ' + MakeLink('Odhlásit',
    215228        NavigationLink('/?Action=Logout'));
    216229// <a href="'.$this->System->Config['Web']['RootFolder'].'/?Action=UserOptions">Nastavení</a>';
  • trunk/Modules/Portal/UPagePortal.pas

    r104 r105  
    88  Classes, SysUtils, FileUtil, UWebPage, UHTTPServer, USqlDatabase, UUtils,
    99  SpecializedDictionary, UWebSession, SpecializedList, UHtmlClasses,
    10   UModularSystem;
     10  UModularSystem, UModuleUser, UModuleNews;
    1111
    1212type
     
    2626    function WebcamPanel: string;
    2727  public
    28     { public declarations }
     28    ModuleUser: TModuleUser;
     29    ModuleNews: TModuleNews;
    2930  end;
    3031
     
    3738
    3839uses
    39   UCore, UModuleUser, UWebObjects, UUser;
     40  UCore, UWebObjects, UUser;
    4041
    4142function TWebPagePortal.SystemMessage(Title, Text: string): string;
     
    7677        if ((HyperLink.Values['PermissionModule'] = '') or
    7778        ((HyperLink.Values['PermissionModule'] <> '') and
    78         Session.User.CheckPermission(HyperLink.Values['PermissionModule'], HyperLink.Values['PermissionOperation']))) then
     79        ModuleUser.User.CheckPermission(HyperLink.Values['PermissionModule'], HyperLink.Values['PermissionOperation']))) then
    7980        Result := Result + '<img alt="' + HyperLink.Values['Name'] + '" src="images/favicons/' + HyperLink.Values['IconFile'] + '" width="16" height="16" /> <a href="' + HyperLink.Values['URL'] + '">' + HyperLink.Values['Name'] + '</a><br />';
    8081    end;
     
    118119      Form := TQueryForm.Create; // UserLogin
    119120      Form.Load(Session.Request.Post);
    120       Session.UserOnline.Login(
    121         Session.User.GetIdByNamePassword(
     121      ModuleUser.UserOnline.Login(
     122        ModuleUser.User.GetIdByNamePassword(
    122123      TQueryFormGroup(Form.Groups[0]).Rows.FindByName('Username').Value.Value,
    123124        TQueryFormGroup(Form.Groups[0]).Rows.FindByName('Password').Value.Value));
    124125      Output := Output + SystemMessage('Přihlášení', 'Přihlášení provedeno');
    125       if Session.User.Id <> UnknownUser then begin
     126      if ModuleUser.User.Id <> UnknownUser then begin
    126127        //Form.LoadValuesFromForm;
    127128        TQueryFormGroup(Form.Groups[0]).Rows.FindByName('Password').Value.Value := '';
     
    132133    end else
    133134    if Query.Values['Action'] = 'Logout' then begin
    134       Session.UserOnline.Logout;
     135      ModuleUser.UserOnline.Logout;
    135136      Output := Output + SystemMessage('Odhlášení', 'Uživatel odhlášen');
    136137    end else
     
    249250        else if Panel.Values['Module'] = 'UserOptions' then
    250251        begin
    251           if Session.User.Id <> UnknownUser then
     252          if ModuleUser.User.Id <> UnknownUser then
    252253            Output := Output + ShowPanel('Přihlášený uživatel', UserPanel);
    253254        end else
     
    255256          Output := Output + ShowPanel('Kamery', WebcamPanel)
    256257        else if Panel.Values['Module'] = 'NewsGroupList' then
    257 //          Output := Output + Panel('Aktuality', $this->System->Modules['News']->Show(), array('<a href="?Action=CustomizeNews">Upravit</a>'));
     258          //Output := Output + ShowPanel('Aktuality',
     259          //ModuleNews.Show,
     260          //['<a href="?Action=CustomizeNews">Upravit</a>']);
    258261      end;
    259262      Output := Output + '</td>';
  • trunk/Modules/System/UModuleSystem.pas

    r97 r105  
    7777    for I := 0 to DbRows.Count - 1 do
    7878    with DbRows[I] do begin
    79       Module := Core.ModuleManager.FindModuleByName(Values['Name']);
     79      Module := Manager.FindModuleByName(Values['Name']);
    8080      if Assigned(Module) then
    8181        if Values['Installed'] = '1' then Module.SetInstalledState(True)
     
    8585    DbRows.Free;
    8686  end;
    87   Core.ModuleManager.OnModuleChange := ModuleChange;
     87  Manager.OnModuleChange := ModuleChange;
    8888  inherited;
    8989end;
     
    9191procedure TModuleSystem.Stop;
    9292begin
    93   inherited Stop;
    94   Core.ModuleManager.OnModuleChange := nil;
     93  BeforeStop;
     94  Manager.OnModuleChange := nil;
     95  AfterStop;
    9596end;
    9697
     
    152153    Core.CommonDatabase.Select(DbRows, 'SystemModule', 'Name');
    153154
    154     for I := 0 to Core.ModuleManager.Modules.Count - 1 do
    155     with TModule(Core.ModuleManager.Modules[I]) do begin
     155    for I := 0 to Manager.Modules.Count - 1 do
     156    with TModule(Manager.Modules[I]) do begin
    156157      Data.Clear;
    157158      Data.Add('Name', Identification);
  • trunk/Modules/TV/UModuleTV.pas

    r99 r105  
    66
    77uses
    8   Classes, SysUtils, UModularSystem, SpecializedDictionary;
     8  Classes, SysUtils, UModularSystem, SpecializedDictionary, UModuleBase,
     9  UWebPage;
    910
    1011type
     
    1314
    1415  TModuleTV = class(TModule)
     16  private
     17    WebPageTV: TWebPage;
    1518  public
     19    ModuleBase: TModuleBase;
    1620    constructor Create(Owner: TComponent); override;
    1721    destructor Destroy; override;
     
    3943  License := 'GNU/LGPL v3';
    4044  Author := 'Chronosoft';
     45  Dependencies.Add('Base');
    4146end;
    4247
     
    4853procedure TModuleTV.Start;
    4954begin
    50   Core.Pages.RegisterPage(TWebPageTV, WebPageTV, 'tv');
    51   inherited;
     55  BeforeStart;
     56  ModuleBase := TModuleBase(Manager.FindModuleByName('Base'));
     57  WebPageTV := TWebPageTV.Create(nil);
     58  ModuleBase.Pages.RegisterPage(WebPageTV, 'tv');
     59  AfterStart;
    5260end;
    5361
    5462procedure TModuleTV.Stop;
    5563begin
    56   inherited;
    57   Core.Pages.UnregisterPage('tv');
     64  BeforeStop;
     65  ModuleBase.Pages.UnregisterPage(WebPageTV);
     66  FreeAndNil(WebPageTV);
     67  ModuleBase := nil;
     68  AfterStop;
    5869end;
    5970
  • trunk/Modules/TV/UPageTV.pas

    r103 r105  
    77uses
    88  Classes, SysUtils, FileUtil, UWebPage, UHTTPServer, USqlDatabase, UHtmlClasses,
    9   UUtils;
     9  UUtils, UModuleUser;
    1010
    1111type
     
    1919    procedure HandlePlaylist(HandlerData: THTTPHandlerData);
    2020  public
    21     { public declarations }
     21    ModuleUser: TModuleUser;
    2222  end;
    2323
     
    5656begin
    5757  with TWebSession(HandlerData) do begin
    58     LoadUserInfo;
     58    ModuleUser.LoadUserInfo;
    5959    with HtmlDocument.Body, THtmlString(SubItems.AddNew(THtmlString.Create)) do begin
    6060      Text := 'Stažení přehrávače: <a href="http://www.videolan.org/vlc/">VLC Media Player</a><br/>' +
  • trunk/Modules/User/UModuleUser.pas

    r103 r105  
    66
    77uses
    8   Classes, SysUtils, UModularSystem, SpecializedDictionary;
     8  Classes, SysUtils, UModularSystem, SpecializedDictionary, UUser,
     9  UModuleBase, UWebPage;
    910
    1011type
    11 
    1212  { TModuleUser }
    1313
    1414  TModuleUser = class(TModule)
     15  private
     16    UserControlPage: TWebPage; //TUserControlPage;
    1517  public
     18    User: TWebUser;
     19    UserOnline: TWebOnlineUser;
     20    ModuleBase: TModuleBase;
    1621    constructor Create(Owner: TComponent); override;
    1722    destructor Destroy; override;
     
    2126    procedure Uninstall; override;
    2227    procedure Upgrade; override;
     28    procedure LoadUserInfo;
    2329  end;
    2430
     
    2733
    2834uses
    29   UCore, UUserControlPage, USqlDatabase;
     35  UCore, USqlDatabase, UUserControlPage;
    3036
    3137{ TModuleUser }
     
    3945  License := 'GNU/LGPL v3';
    4046  Author := 'Chronosoft';
     47  Dependencies.Add('Base');
    4148end;
    4249
     
    4855procedure TModuleUser.Start;
    4956begin
    50   Core.Pages.RegisterPage(TUserControlPage, UserControlPage, 'uzivatel');
     57  BeforeStart;
     58  ModuleBase := TModuleBase(Manager.FindModuleByName('Base'));
     59  UserControlPage := TUserControlPage.Create(nil);
     60  ModuleBase.Pages.RegisterPage(UserControlPage, 'uzivatel');
    5161  //RegisterPage(TUserControlPage, UserControlPage, '');
    52   inherited;
     62  User := TWebUser.Create;
     63  //User.Database := Database;
     64  UserOnline := TWebOnlineUser.Create;
     65  //UserOnline.Database := Database;
     66  AfterStart;
    5367end;
    5468
    5569procedure TModuleUser.Stop;
    5670begin
    57   inherited;
    58   Core.Pages.UnregisterPage('uzivatel');
     71  BeforeStop;
     72  FreeAndNil(User);
     73  FreeAndNil(UserOnline);
     74  ModuleBase.Pages.UnregisterPage(UserControlPage);
     75  FreeAndNil(UserControlPage);
     76  ModuleBase := nil;
     77  AfterStop;
    5978end;
    6079
     
    183202end;
    184203
     204procedure TModuleUser.LoadUserInfo;
     205begin
     206  User.HandlerData := ModuleBase.HandlerData;
     207  UserOnline.HandlerData := ModuleBase.HandlerData;
     208  UserOnline.Update;
     209  User.Id := UserOnline.User;
     210  User.Load;
     211end;
     212
     213
     214
    185215end.
    186216
  • trunk/Modules/User/UUserControlPage.pas

    r103 r105  
    77uses
    88  Classes, SysUtils, FileUtil, UWebPage, UHTTPServer, UHtmlClasses, UXmlClasses,
    9   UWebObjects;
     9  UWebObjects, UModuleUser, UModuleBase;
    1010
    1111type
     
    2121    procedure HandleProfile(HandlerData: THTTPHandlerData);
    2222  public
    23     { public declarations }
    24   end;
     23    ModuleUser: TModuleUser;
     24    ModuleBase: TModuleBase;
     25  end;
    2526
    2627var
     
    4748      else PageName := '';
    4849    with HtmlDocument.Body do begin
    49       LoadUserInfo;
     50      ModuleUser.LoadUserInfo;
    5051      if PageName = '' then PageName := 'prihlaseni';
    5152      if PageName = 'prihlaseni' then HandleLogin(HandlerData)
     
    9192      with THtmlString(SubItems.AddNew(THtmlString.Create)) do
    9293        Text := 'Přihlášení uživatele: ' + TQueryFormGroup(Form.Groups[0]).Rows.FindByName('UserName').Value.Value;
    93       UserId := User.GetIdByNamePassword(TQueryFormGroup(Form.Groups[0]).Rows.FindByName('UserName').Value.Value,
     94      UserId := ModuleUser.User.GetIdByNamePassword(TQueryFormGroup(Form.Groups[0]).Rows.FindByName('UserName').Value.Value,
    9495        TQueryFormGroup(Form.Groups[0]).Rows.FindByName('Password').Value.Value);
    9596      if UserId = -1 then begin
    9697        with THtmlString(SubItems.AddNew(THtmlString.Create)) do
    9798          Text := '<br/>Chybné jméno nebo heslo';
    98       end else UserOnline.Login(UserId);
     99      end else ModuleUser.UserOnline.Login(UserId);
    99100      Form.Free;
    100101    end else
     
    149150      with THtmlString(SubItems.AddNew(THtmlString.Create)) do
    150151        Text := 'Registrace uživatele: ' + TQueryFormGroup(Form.Groups[0]).Rows.FindByName('UserName').Value.Value;
    151       User.Add(TQueryFormGroup(Form.Groups[0]).Rows.FindByName('UserName').Value.Value,
     152      ModuleUser.User.Add(TQueryFormGroup(Form.Groups[0]).Rows.FindByName('UserName').Value.Value,
    152153        TQueryFormGroup(Form.Groups[0]).Rows.FindByName('Password').Value.Value,
    153154        TQueryFormGroup(Form.Groups[0]).Rows.FindByName('Email').Value.Value);
    154       UserId := User.GetIdByNamePassword(TQueryFormGroup(Form.Groups[0]).Rows.FindByName('UserName').Value.Value,
     155      UserId := ModuleUser.User.GetIdByNamePassword(TQueryFormGroup(Form.Groups[0]).Rows.FindByName('UserName').Value.Value,
    155156        TQueryFormGroup(Form.Groups[0]).Rows.FindByName('Password').Value.Value);
    156       if UserId <> -1 then UserOnline.Login(UserId);
     157      if UserId <> -1 then ModuleUser.UserOnline.Login(UserId);
    157158      Form.Free;
    158159    end else SubItems.AddNew(Form);
     
    163164begin
    164165  with TWebSession(HandlerData), Core, HtmlDocument.Body do begin
    165     UserOnline.Logout;
     166    ModuleUser.UserOnline.Logout;
    166167    with THtmlString(SubItems.AddNew(THtmlString.Create)) do
    167168      Text := 'Uživatel odhlášen';
     
    185186          Hint := 'Zadejte vaše přihlašovací jméno';
    186187          Required := True;
    187           Value.Value := User.Name;
     188          Value.Value := ModuleUser.User.Name;
    188189        end;
    189190        with AddNewItem do begin
     
    200201          Required := True;
    201202          ItemType := fitText;
    202           Value.Value := User.Email;
     203          Value.Value := ModuleUser.User.Email;
    203204        end;
    204205        with AddNewItem do begin
     
    208209          Required := False;
    209210          ItemType := fitText;
    210           Value.Value := User.FullName;
     211          Value.Value := ModuleUser.User.FullName;
    211212        end;
    212213      end;
     
    218219      with THtmlString(SubItems.AddNew(THtmlString.Create)) do
    219220        Text := 'Profil uživatele: ' + TQueryFormGroup(Form.Groups[0]).Rows.FindByName('UserName').Value.Value + ' uložen';
    220       User.Name := TQueryFormGroup(Form.Groups[0]).Rows.FindByName('UserName').Value.Value;
    221       User.FullName := TQueryFormGroup(Form.Groups[0]).Rows.FindByName('FullName').Value.Value;
    222       User.Email := TQueryFormGroup(Form.Groups[0]).Rows.FindByName('Email').Value.Value;
    223       User.Save;
     221      ModuleUser.User.Name := TQueryFormGroup(Form.Groups[0]).Rows.FindByName('UserName').Value.Value;
     222      ModuleUser.User.FullName := TQueryFormGroup(Form.Groups[0]).Rows.FindByName('FullName').Value.Value;
     223      ModuleUser.User.Email := TQueryFormGroup(Form.Groups[0]).Rows.FindByName('Email').Value.Value;
     224      ModuleUser.User.Save;
    224225      Form.Free;
    225226    end else SubItems.AddNew(Form);
  • trunk/Modules/ZdechovNET/UAboutPage.pas

    r103 r105  
    66
    77uses
    8   Classes, SysUtils, FileUtil, UWebPage, UHTTPServer, UHtmlClasses;
     8  Classes, SysUtils, FileUtil, UWebPage, UHTTPServer, UHtmlClasses, UModuleUser;
    99
    1010type
     
    1717    { private declarations }
    1818  public
    19     { public declarations }
     19    ModuleUser: TModuleUser;
    2020  end;
    2121
     
    3737begin
    3838  with TWebSession(HandlerData) do begin
    39     LoadUserInfo;
     39    ModuleUser.LoadUserInfo;
    4040    with HtmlDocument.Body, THtmlString(SubItems.AddNew(THtmlString.Create)) do begin
    4141    Text := '<img align="left" src="' + NavigationLink('/images/umisteni.gif') + '" alt="Umístění obce"/>' +
  • trunk/Modules/ZdechovNET/UContactPage.pas

    r103 r105  
    66
    77uses
    8   Classes, SysUtils, FileUtil, UWebPage, UHTTPServer, UHtmlClasses;
     8  Classes, SysUtils, FileUtil, UWebPage, UHTTPServer, UHtmlClasses, UModuleUser;
    99
    1010type
     
    1717    { private declarations }
    1818  public
    19     { public declarations }
     19    ModuleUser: TModuleUser;
    2020  end;
    2121
     
    3333begin
    3434  with TWebSession(HandlerData), HtmlDocument.Body, THtmlString(SubItems.AddNew(THtmlString.Create)) do begin
    35     LoadUserInfo;
     35    ModuleUser.LoadUserInfo;
    3636    Text := '<strong>Kontaktní informace</strong><br/>' +
    3737    'Provozovatel: <strong>Ing. Jiří Hajda</strong><br/>' +
  • trunk/Modules/ZdechovNET/UDocumentsPage.pas

    r103 r105  
    66
    77uses
    8   Classes, SysUtils, FileUtil, UWebPage, UHTTPServer, UHtmlClasses;
     8  Classes, SysUtils, FileUtil, UWebPage, UHTTPServer, UHtmlClasses, UModuleUser;
    99
    1010type
     
    1717    { private declarations }
    1818  public
    19     { public declarations }
     19    ModuleUser: TModuleUser;
    2020  end;
    2121
     
    3535begin
    3636  with TWebSession(HandlerData) do begin
    37     LoadUserInfo;
     37    ModuleUser.LoadUserInfo;
    3838    with HtmlDocument.Body, THtmlString(SubItems.AddNew(THtmlString.Create)) do begin
    3939      Text := '<strong>O obci:</strong><br/>' +
  • trunk/Modules/ZdechovNET/UHistoryPage.pas

    r103 r105  
    66
    77uses
    8   Classes, SysUtils, FileUtil, UWebPage, UHTTPServer, UHtmlClasses, USqlDatabase;
     8  Classes, SysUtils, FileUtil, UWebPage, UHTTPServer, UHtmlClasses, USqlDatabase,
     9  UModuleUser;
    910
    1011type
     
    1718    { private declarations }
    1819  public
    19     { public declarations }
     20    ModuleUser: TModuleUser;
    2021  end;
    2122
     
    3839begin
    3940  with TWebSession(HandlerData) do begin
    40     LoadUserInfo;
     41    ModuleUser.LoadUserInfo;
    4142    with HtmlDocument.Body, THtmlString(SubItems.AddNew(THtmlString.Create)) do begin
    4243      Text := '<table>';
  • trunk/Modules/ZdechovNET/UHostingPage.pas

    r103 r105  
    66
    77uses
    8   Classes, SysUtils, FileUtil, UWebPage, UHTTPServer, USqlDatabase, UHtmlClasses;
     8  Classes, SysUtils, FileUtil, UWebPage, UHTTPServer, USqlDatabase, UHtmlClasses,
     9  UModuleUser;
    910
    1011type
     
    1718    { private declarations }
    1819  public
    19     { public declarations }
     20    ModuleUser: TModuleUser;
    2021  end;
    2122
     
    3940begin
    4041  with TWebSession(HandlerData) do begin
    41     LoadUserInfo;
     42    ModuleUser.LoadUserInfo;
    4243    with HtmlDocument.Body, THtmlString(SubItems.AddNew(THtmlString.Create)) do begin
    4344      Text := 'V nabídce je provoz virtualizovaných Linuxových serverů dle dohodnutých parameterů.<br/><br/>' +
  • trunk/Modules/ZdechovNET/UInternetPage.pas

    r102 r105  
    66
    77uses
    8   Classes, SysUtils, FileUtil, UWebPage, UHTTPServer;
     8  Classes, SysUtils, FileUtil, UWebPage, UHTTPServer, UModuleUser;
    99
    1010type
     
    1717    { private declarations }
    1818  public
    19     { public declarations }
     19    ModuleUser: TModuleUser;
    2020  end;
    2121
     
    3535begin
    3636  with TWebSession(HandlerData) do begin
    37     LoadUserInfo;
     37    ModuleUser.LoadUserInfo;
    3838    with HtmlDocument.Body, THtmlString(SubItems.AddNew(THtmlString.Create)) do begin
    3939      Text := Text + 'Hlavní náplní činnosti sítě je poskytovat výhodné připojení k internetu pro občany.<br/><br/>' +
  • trunk/Modules/ZdechovNET/ULinksPage.pas

    r103 r105  
    66
    77uses
    8   Classes, SysUtils, FileUtil, UWebPage, UHTTPServer, UHtmlClasses;
     8  Classes, SysUtils, FileUtil, UWebPage, UHTTPServer, UHtmlClasses, UModuleUser;
    99
    1010type
     
    1717    { private declarations }
    1818  public
    19     { public declarations }
     19    ModuleUser: TModuleUser;
    2020  end;
    2121
     
    3535begin
    3636  with TWebSession(HandlerData), HtmlDocument.Body, THtmlString(SubItems.AddNew(THtmlString.Create)) do begin
    37     LoadUserInfo;
     37    ModuleUser.LoadUserInfo;
    3838    Text := '<strong>Odkazy související s obcí:</strong><br/>' +
    3939
  • trunk/Modules/ZdechovNET/UModuleZdechovNET.pas

    r104 r105  
    77uses
    88  Classes, SysUtils, UModularSystem, SpecializedDictionary, UWebPage,
    9   UWebSession, DateUtils;
     9  UWebSession, DateUtils, UModuleBase, UModuleUser,
     10  UInternetPage, UHostingPage, UHistoryPage, UDocumentsPage, UVoIPPage,
     11  ULinksPage, UPlansPage, UServerInfoPage, UWebCamPage, UUser,
     12  UNetworkPage, UAboutPage, UContactPage, UProjectsPage;
    1013
    1114type
     
    1518  TModuleZdechovNET = class(TModule)
    1619  private
     20    InternetPage: TInternetPage;
     21    HostingPage: THostingPage;
     22    HistoryPage: THistoryPage;
     23    DocumentsPage: TDocumentsPage;
     24    VoIPPage: TVoIPPage;
     25    LinksPage: TLinksPage;
     26    ContactPage: TContactPage;
     27    ServerInfoPage: TServerInfoPage;
     28    WebCamPage: TWebCamPage;
     29    PlansPage: TPlansPage;
     30    NetworkPage: TNetworkPage;
     31    ProjectsPage: TProjectsPage;
     32    AboutPage: TAboutPage;
    1733    procedure Footer(Session: TWebSession);
    1834    procedure GeneratePage(ASession: TWebSession; Page: TWebPage);
    1935    procedure TopMenu(Session: TWebSession);
    2036  public
     37    ModuleBase: TModuleBase;
     38    ModuleUser: TModuleUser;
    2139    constructor Create(Owner: TComponent); override;
    2240    destructor Destroy; override;
     
    3250
    3351uses
    34   UCore, USqlDatabase, UXmlClasses, UHtmlClasses, UUtils,
    35   UInternetPage, UHostingPage, UHistoryPage, UDocumentsPage, UVoIPPage,
    36   ULinksPage, UPlansPage, UServerInfoPage, UWebCamPage, UUser,
    37   UNetworkPage, UAboutPage, UContactPage, UProjectsPage;
     52  UCore, USqlDatabase, UXmlClasses, UHtmlClasses, UUtils;
    3853
    3954{ TModuleZdechovNET }
     
    4863  Author := 'Chronosoft';
    4964  Dependencies.Add('User');
     65  Dependencies.Add('Base');
    5066end;
    5167
     
    5773procedure TModuleZdechovNET.Start;
    5874begin
    59   with Core.Pages do begin
    60     Core.GeneratePage := GeneratePage;
    61     RegisterPage(TInternetPage, InternetPage, 'internet');
    62     RegisterPage(THostingPage, HostingPage, 'hosting');
    63     RegisterPage(THistoryPage, HistoryPage, 'historie');
    64     RegisterPage(TDocumentsPage, DocumentsPage, 'dokumenty');
    65     RegisterPage(TVoIPPage, VoIPPage, 'voip');
    66     RegisterPage(TLinksPage, LinksPage, 'odkazy');
    67     RegisterPage(TContactPage, ContactPage, 'kontakt');
    68     RegisterPage(TServerInfoPage, ServerInfoPage, 'serverinfo');
    69     RegisterPage(TWebCamPage, WebCamPage, 'kamery');
    70     RegisterPage(TPlansPage, PlansPage, 'plany');
    71     RegisterPage(TNetworkPage, NetworkPage, 'sit');
    72     RegisterPage(TProjectsPage, ProjectsPage, 'projekty');
    73     RegisterPage(TAboutPage, AboutPage, '');
     75  ModuleBase := TModuleBase(Manager.FindModuleByName('Base'));
     76  ModuleUser := TModuleUser(Manager.FindModuleByName('User'));
     77  with ModuleBase, Pages do begin
     78    //GeneratePage := GeneratePage;
     79    InternetPage := TInternetPage.Create(nil);
     80    RegisterPage(InternetPage, 'internet');
     81    HostingPage := THostingPage.Create(nil);
     82    RegisterPage(HostingPage, 'hosting');
     83    HistoryPage := THistoryPage.Create(nil);
     84    RegisterPage(HistoryPage, 'historie');
     85    DocumentsPage := TDocumentsPage.Create(nil);
     86    RegisterPage(DocumentsPage, 'dokumenty');
     87    VoIPPage := TVoIPPage.Create(nil);
     88    RegisterPage(VoIPPage, 'voip');
     89    LinksPage := TLinksPage.Create(nil);
     90    RegisterPage(LinksPage, 'odkazy');
     91    ContactPage := TContactPage.Create(nil);
     92    RegisterPage(ContactPage, 'kontakt');
     93    ServerInfoPage := TServerInfoPage.Create(nil);
     94    RegisterPage(ServerInfoPage, 'serverinfo');
     95    WebCamPage := TWebCamPage.Create(nil);
     96    RegisterPage(WebCamPage, 'kamery');
     97    PlansPage := TPlansPage.Create(nil);
     98    RegisterPage(PlansPage, 'plany');
     99    NetworkPage := TNetworkPage.Create(nil);
     100    RegisterPage(NetworkPage, 'sit');
     101    ProjectsPage := TProjectsPage.Create(nil);
     102    RegisterPage(ProjectsPage, 'projekty');
     103    AboutPage := TAboutPage.Create(nil);
     104    RegisterPage(AboutPage, '');
    74105  end;
    75106  inherited;
     
    79110begin
    80111  inherited Stop;
    81   with Core.Pages do begin
    82     UnregisterPage('internet');
    83     UnregisterPage('hosting');
    84     UnregisterPage('historie');
    85     UnregisterPage('dokumenty');
    86     UnregisterPage('voip');
    87     UnregisterPage('odkazy');
    88     UnregisterPage('kontakt');
    89     UnregisterPage('serverinfo');
    90     UnregisterPage('kamery');
    91     UnregisterPage('plany');
    92     UnregisterPage('sit');
    93     UnregisterPage('projekty');
    94     UnregisterPage('');
    95   end;
     112  with ModuleBase, Pages do begin
     113    UnregisterPage(AboutPage);
     114    FreeAndNil(AboutPage);
     115    UnregisterPage(InternetPage);
     116    FreeAndNil(InternetPage);
     117    UnregisterPage(HostingPage);
     118    FreeAndNil(HostingPage);
     119    UnregisterPage(HistoryPage);
     120    FreeAndNil(HistoryPage);
     121    UnregisterPage(DocumentsPage);
     122    FreeAndNil(DocumentsPage);
     123    UnregisterPage(VoIPPage);
     124    FreeAndNil(VoIPPage);
     125    UnregisterPage(LinksPage);
     126    FreeAndNil(LinksPage);
     127    UnregisterPage(ContactPage);
     128    FreeAndNil(ContactPage);
     129    UnregisterPage(ServerInfoPage);
     130    FreeAndNil(ServerInfoPage);
     131    UnregisterPage(WebCamPage);
     132    FreeAndNil(WebCamPage);
     133    UnregisterPage(PlansPage);
     134    FreeAndNil(PlansPage);
     135    UnregisterPage(NetworkPage);
     136    FreeAndNil(NetworkPage);
     137    UnregisterPage(ProjectsPage);
     138    FreeAndNil(ProjectsPage);
     139  end;
     140  ModuleBase := nil;
     141  ModuleUser := nil;
    96142end;
    97143
     
    179225begin
    180226  inherited Uninstall;
    181   Core.GeneratePage := nil;
     227  ModuleBase.GeneratePage := nil;
    182228  try
    183229    DbRows := TDbRows.Create;
     
    257303      '<li><a href="http://wiki.zdechov.net/">Wiki</a></li>' +
    258304      '</ul><ul class="MenuItem2">'; //<li>&nbsp;</li>';
    259     if Assigned(TCore(MainModule).Pages.FindByName('uzivatel')) then begin
    260       if UserOnline.User = UnknownUser then begin
     305    if Assigned(ModuleBase.Pages.FindByName('uzivatel')) then begin
     306      if ModuleUser.UserOnline.User = UnknownUser then begin
    261307        Text := Text + '</ul>' +
    262308          '<ul class="MenuItem2">' +
     
    268314        Text := Text + '</ul>' +
    269315          '<ul class="MenuItem2">' +
    270           '<li>' + User.FullName + '</li>' +
     316          '<li>' + ModuleUser.User.FullName + '</li>' +
    271317          '<li>' + MakeLink('Odhlášení', NavigationLink('/uzivatel/odhlaseni/')) + '</li>' +
    272318          '<li>' + MakeLink('Profil', NavigationLink('/uzivatel/profil/')) + '</li>';
  • trunk/Modules/ZdechovNET/UNetworkPage.pas

    r103 r105  
    66
    77uses
    8   Classes, SysUtils, FileUtil, UWebPage, UHTTPServer, UHtmlClasses;
     8  Classes, SysUtils, FileUtil, UWebPage, UHTTPServer, UHtmlClasses, UModuleUser;
    99
    1010type
     
    1717    { private declarations }
    1818  public
    19     { public declarations }
     19    ModuleUser: TModuleUser;
    2020  end;
    2121
     
    3737begin
    3838  with TWebSession(HandlerData) do begin
    39     LoadUserInfo;
     39    ModuleUser.LoadUserInfo;
    4040    with HtmlDocument.Body, THtmlString(SubItems.AddNew(THtmlString.Create)) do begin
    4141      Text := MakeLink('Historie', NavigationLink('/historie/')) + '<br/>' +
  • trunk/Modules/ZdechovNET/UPlansPage.pas

    r103 r105  
    66
    77uses
    8   Classes, SysUtils, FileUtil, UWebPage, UHtmlClasses, UHTTPServer, USqlDatabase;
     8  Classes, SysUtils, FileUtil, UWebPage, UHtmlClasses, UHTTPServer, USqlDatabase,
     9  UModuleUser;
    910
    1011type
     
    1718    { private declarations }
    1819  public
    19     { public declarations }
     20    ModuleUser: TModuleUser;
    2021  end;
    2122
     
    3839begin
    3940  with TWebSession(HandlerData) do begin
    40     LoadUserInfo;
     41    ModuleUser.LoadUserInfo;
    4142    with HtmlDocument.Body, THtmlString(SubItems.AddNew(THtmlString.Create)) do begin
    4243      Text := '<table>';
  • trunk/Modules/ZdechovNET/UProjectsPage.pas

    r103 r105  
    66
    77uses
    8   Classes, SysUtils, FileUtil, UWebPage, UHtmlClasses, UHTTPServer, USqlDatabase;
     8  Classes, SysUtils, FileUtil, UWebPage, UHtmlClasses, UHTTPServer, USqlDatabase,
     9  UModuleUser;
    910
    1011type
     
    1718    { private declarations }
    1819  public
    19     { public declarations }
     20    ModuleUser: TModuleUser;
    2021  end;
    2122
     
    3839begin
    3940  with TWebSession(HandlerData) do begin
    40     LoadUserInfo;
     41    ModuleUser.LoadUserInfo;
    4142    with HtmlDocument.Body, THtmlString(SubItems.AddNew(THtmlString.Create)) do begin
    4243      try
  • trunk/Modules/ZdechovNET/UVoIPPage.pas

    r103 r105  
    66
    77uses
    8   Classes, SysUtils, FileUtil, UWebPage, UHtmlClasses, UHTTPServer;
     8  Classes, SysUtils, FileUtil, UWebPage, UHtmlClasses, UHTTPServer, UModuleUser;
    99
    1010type
     
    1717    { private declarations }
    1818  public
    19     { public declarations }
     19    ModuleUser: TModuleUser;
    2020  end;
    2121
     
    3535begin
    3636  with TWebSession(HandlerData) do begin
    37     LoadUserInfo;
     37    ModuleUser.LoadUserInfo;
    3838    with HtmlDocument.Body, THtmlString(SubItems.AddNew(THtmlString.Create)) do begin
    3939      Text := 'Volejte levněji do pevných a mobilních sítí s sekundovou tarifikací a bez měsíčního paušálu.' +
  • trunk/Modules/ZdechovNET/UWebCamPage.pas

    r103 r105  
    66
    77uses
    8   Classes, SysUtils, FileUtil, UWebPage, UHTTPServer, UHtmlClasses, USqlDatabase;
     8  Classes, SysUtils, FileUtil, UWebPage, UHTTPServer, UHtmlClasses, USqlDatabase,
     9  UModuleUser;
    910
    1011type
     
    1718    { private declarations }
    1819  public
    19     { public declarations }
     20    ModuleUser: TModuleUser;
    2021  end;
    2122
     
    4647begin
    4748  with TWebSession(HandlerData) do begin
    48     LoadUserInfo;
     49    ModuleUser.LoadUserInfo;
    4950    with HtmlDocument.Body, THtmlString(SubItems.AddNew(THtmlString.Create)) do begin
    5051      Text := '';
Note: See TracChangeset for help on using the changeset viewer.