Changeset 92 for trunk/UCore.pas


Ignore:
Timestamp:
Sep 7, 2012, 9:52:38 PM (12 years ago)
Author:
chronos
Message:
  • Přidáno: Administrační stránka pro instalaci a odinstalaci modulů.
  • Přidáno: Modul System je zodpovědný za udržování seznamu všech modulů.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/UCore.pas

    r91 r92  
    99  UHTTPServer, USqlDatabase, INIFiles, DateUtils, UWebPage, UWebApp,
    1010  UXmlClasses, UHtmlClasses, UUtils, UApplicationInfo, UHTTPServerTCP,
    11   UModuleUser, UHTTPSessionFile, UUser, SpecializedList, Registry,
     11  UHTTPSessionFile, UUser, SpecializedList, Registry,
    1212  UModularSystem;
    1313
     
    5050    procedure Show(Content: string);
    5151    procedure RegisterModules;
     52    procedure CheckModules;
    5253  public
    5354    CommonDatabase: TSqlDatabase;
     
    8586
    8687uses
    87   UInternetPage, UHostingPage, UHistoryPage, UDocumentsPage, UVoIPPage,
    88   ULinksPage, UPlansPage, UServerInfoPage, UWebCamPage, UUserControlPage,
    89   UNetworkPage, UAboutPage, UContactPage, UProjectsPage;
     88  UModuleSystem, UModuleZdechovNET, UModuleUser, UPageAdmin;
    9089
    9190{ TWebSession }
     
    178177  LoadFromRegistry;
    179178  with Pages do begin
    180     RegisterPage(TInternetPage, InternetPage, 'internet');
    181     RegisterPage(THostingPage, HostingPage, 'hosting');
    182     RegisterPage(THistoryPage, HistoryPage, 'historie');
    183     RegisterPage(TDocumentsPage, DocumentsPage, 'dokumenty');
    184     RegisterPage(TVoIPPage, VoIPPage, 'voip');
    185     RegisterPage(TLinksPage, LinksPage, 'odkazy');
    186     RegisterPage(TContactPage, ContactPage, 'kontakt');
    187     RegisterPage(TServerInfoPage, ServerInfoPage, 'serverinfo');
    188     RegisterPage(TWebCamPage, WebCamPage, 'kamery');
    189     RegisterPage(TPlansPage, PlansPage, 'plany');
    190     RegisterPage(TNetworkPage, NetworkPage, 'sit');
    191     RegisterPage(TProjectsPage, ProjectsPage, 'projekty');
    192     RegisterPage(TAboutPage, AboutPage, '');
     179    RegisterPage(TPageAdmin, PageAdmin, 'administration');
    193180  end;
    194181  with WebApp1 do begin
     
    282269begin
    283270  with ModuleManager do begin
     271    RegisterModule(TModuleSystem.Create(nil), True);
    284272    RegisterModule(TModuleUser.Create(nil), True);
     273    RegisterModule(TModuleZdechovNET.Create(nil), True);
     274  end;
     275end;
     276
     277procedure TCore.CheckModules;
     278var
     279  DbRows: TDbRows;
     280  Module: TModule;
     281begin
     282  try
     283    DbRows := TDbRows.Create;
     284    CommonDatabase.Query(DbRows, 'SELECT * FROM INFORMATION_SCHEMA.TABLES ' +
     285      'WHERE TABLE_SCHEMA = "' + CommonDatabase.Database + '" AND TABLE_NAME = "SystemModule"');
     286    Module := ModuleManager.FindModuleByName('System');
     287    if DbRows.Count > 0 then Module.SetInstalledState(True)
     288      else Module.SetInstalledState(False);
     289  finally
     290    DbRows.Free;
    285291  end;
    286292end;
     
    425431
    426432  RegisterModules;
     433  CheckModules;
    427434  ModuleManager.StartInstalled;
    428435
Note: See TracChangeset for help on using the changeset viewer.