Changeset 94


Ignore:
Timestamp:
Sep 7, 2012, 10:43:02 PM (12 years ago)
Author:
chronos
Message:
  • Opraveno: Zobrazení stránek s a bez modulu User.
Location:
trunk
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/Modules/User/UModuleUser.pas

    r92 r94  
    66
    77uses
    8   Classes, SysUtils, UModularSystem;
     8  Classes, SysUtils, UModularSystem, SpecializedDictionary;
    99
    1010type
     
    6262var
    6363  DbRows: TDbRows;
     64  Data: TDictionaryStringString;
    6465begin
    6566  try
    6667    DbRows := TDbRows.Create;
     68    Data := TDictionaryStringString.Create;
     69
    6770    Core.CommonDatabase.Query(DbRows,
    6871    'CREATE TABLE IF NOT EXISTS `User` (' +
     
    7679    '  PRIMARY KEY (`Id`)' +
    7780    ') ENGINE=InnoDB  DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ;');
     81
     82    Data.Add('Id', '1');
     83    Data.Add('Name', 'anonymous');
     84    Data.Add('FullName', 'Anonymous');
     85    Data.Add('RegistrationTime', 'NOW()');
     86    Core.CommonDatabase.Insert('User', Data);
     87
    7888    Core.CommonDatabase.Query(DbRows,
    7989    'CREATE TABLE IF NOT EXISTS `UserOnline` (' +
     
    90100    ') ENGINE=MEMORY  DEFAULT CHARSET=utf8 COLLATE=utf8_czech_ci AUTO_INCREMENT=1 ;');
    91101  finally
     102    Data.Free;
    92103    DbRows.Free;
    93104  end;
  • trunk/Packages/ModularSystem/UModularSystem.pas

    r93 r94  
    4444    procedure EnumModulesUninstall(ModuleList: TStringList);
    4545    procedure SetInstalledState(Value: Boolean);
    46     constructor Create(Owner: TComponent); virtual;
     46    constructor Create(Owner: TComponent); override;
    4747    destructor Destroy; override;
    4848    property Running: Boolean read FRunning write SetRunning;
     
    7070    Modules: TObjectList; // TObjectList<TModule>
    7171    function FindModuleByName(Name: string): TModule;
     72    function ModuleRunning(Name: string): Boolean;
    7273    procedure StartDependencies(ModuleName: string; Dependencies: TStringList);
    7374    procedure StopDependencies(ModuleName: string);
     
    125126end;
    126127
     128function TModuleManager.ModuleRunning(Name: string): Boolean;
     129var
     130  Module: TModule;
     131begin
     132  Module := FindModuleByName(Name);
     133  if Assigned(Module) then begin
     134    Result := Module.Running;
     135  end else Result := False;
     136end;
     137
    127138procedure TModuleManager.StartDependencies(ModuleName: string; Dependencies: TStringList);
    128139var
  • trunk/UCore.pas

    r93 r94  
    130130procedure TWebSession.LoadUserInfo;
    131131begin
    132   User.HandlerData := Self;
    133   UserOnline.HandlerData := Self;
    134   UserOnline.Update;
    135   User.Id := UserOnline.User;
    136   User.Load;
     132  if Core.ModuleManager.ModuleRunning('User') then begin
     133    User.HandlerData := Self;
     134    UserOnline.HandlerData := Self;
     135    UserOnline.Update;
     136    User.Id := UserOnline.User;
     137    User.Load;
     138  end;
    137139end;
    138140
Note: See TracChangeset for help on using the changeset viewer.