Changeset 92


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ů.
Location:
trunk
Files:
6 added
5 edited

Legend:

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

    r91 r92  
    3636  Identification := 'User';
    3737  Title := 'User management';
    38   Version := '0.1';
     38  Version := '1.0';
    3939  License := 'GNU/LGPL v3';
    4040  Author := 'Chronosoft';
     
    6565  try
    6666    DbRows := TDbRows.Create;
    67     Core.CommonDatabase.Query(DbRows, 'CREATE TABLE IF NOT EXISTS `User` (' +
    68   '`Id` int(11) NOT NULL AUTO_INCREMENT,' +
    69   '`Name` varchar(255) NOT NULL,' +
    70   '`FullName` varchar(255) NOT NULL,' +
    71   '`Password` varchar(255) NOT NULL,' +
    72   '`Salt` varchar(255) NOT NULL,' +
    73   '`Email` varchar(255) NOT NULL,' +
    74   '`RegistrationTime` datetime NOT NULL,' +
    75   'PRIMARY KEY (`Id`)' +
    76   ') ENGINE=InnoDB  DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ;');
    77     Core.CommonDatabase.Query(DbRows, 'CREATE TABLE IF NOT EXISTS `UserOnline` (' +
    78   '`Id` int(11) NOT NULL AUTO_INCREMENT,' +
    79   '`User` int(11) NOT NULL DEFAULT ''0'',' +
    80   '`ActivityTime` datetime NOT NULL DEFAULT ''0000-00-00 00:00:00'',' +
    81   '`LoginTime` datetime NOT NULL DEFAULT ''0000-00-00 00:00:00'',' +
    82   '`SessionId` varchar(255) COLLATE utf8_czech_ci NOT NULL DEFAULT '''',' +
    83   '`IpAddress` varchar(16) COLLATE utf8_czech_ci NOT NULL DEFAULT '''',' +
    84   '`HostName` varchar(255) COLLATE utf8_czech_ci NOT NULL DEFAULT '''',' +
    85   '`ScriptName` varchar(255) COLLATE utf8_czech_ci NOT NULL,' +
    86   'PRIMARY KEY (`Id`),' +
    87   'KEY `User` (`User`)' +
    88   ') ENGINE=MEMORY  DEFAULT CHARSET=utf8 COLLATE=utf8_czech_ci AUTO_INCREMENT=2 ;');
     67    Core.CommonDatabase.Query(DbRows,
     68    'CREATE TABLE IF NOT EXISTS `User` (' +
     69    '  `Id` int(11) NOT NULL AUTO_INCREMENT,' +
     70    '  `Name` varchar(255) NOT NULL,' +
     71    '  `FullName` varchar(255) NOT NULL,' +
     72    '  `Password` varchar(255) NOT NULL,' +
     73    '  `Salt` varchar(255) NOT NULL,' +
     74    '  `Email` varchar(255) NOT NULL,' +
     75    '  `RegistrationTime` datetime NOT NULL,' +
     76    '  PRIMARY KEY (`Id`)' +
     77    ') ENGINE=InnoDB  DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ;');
     78    Core.CommonDatabase.Query(DbRows,
     79    'CREATE TABLE IF NOT EXISTS `UserOnline` (' +
     80    '  `Id` int(11) NOT NULL AUTO_INCREMENT,' +
     81    '  `User` int(11) NOT NULL DEFAULT ''0'',' +
     82    '  `ActivityTime` datetime NOT NULL DEFAULT ''0000-00-00 00:00:00'',' +
     83    '  `LoginTime` datetime NOT NULL DEFAULT ''0000-00-00 00:00:00'',' +
     84    '  `SessionId` varchar(255) COLLATE utf8_czech_ci NOT NULL DEFAULT '''',' +
     85    '  `IpAddress` varchar(16) COLLATE utf8_czech_ci NOT NULL DEFAULT '''',' +
     86    '  `HostName` varchar(255) COLLATE utf8_czech_ci NOT NULL DEFAULT '''',' +
     87    '  `ScriptName` varchar(255) COLLATE utf8_czech_ci NOT NULL,' +
     88    '  PRIMARY KEY (`Id`),' +
     89    '  KEY `User` (`User`)' +
     90    ') ENGINE=MEMORY  DEFAULT CHARSET=utf8 COLLATE=utf8_czech_ci AUTO_INCREMENT=1 ;');
    8991  finally
    9092    DbRows.Free;
  • trunk/Packages/ModularSystem/ModularSystem.lpk

    r89 r92  
    2020    <Description Value="Modular system"/>
    2121    <License Value="GNU/LGPLv3"/>
    22     <Version Minor="1"/>
     22    <Version Minor="2"/>
    2323    <Files Count="1">
    2424      <Item1>
  • trunk/Packages/ModularSystem/UModularSystem.pas

    r91 r92  
    4343    procedure EnumModulesInstall(ModuleList: TStringList);
    4444    procedure EnumModulesUninstall(ModuleList: TStringList);
     45    procedure SetInstalledState(Value: Boolean);
    4546    constructor Create(Owner: TComponent); virtual;
    4647    destructor Destroy; override;
     
    366367end;
    367368
     369procedure TModule.SetInstalledState(Value: Boolean);
     370begin
     371  FInstalled := Value;
     372end;
     373
    368374constructor TModule.Create(Owner: TComponent);
    369375begin
  • 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
  • trunk/ZdechovNET.lpi

    r91 r92  
    6868      </Item7>
    6969    </RequiredPackages>
    70     <Units Count="22">
     70    <Units Count="25">
    7171      <Unit0>
    7272        <Filename Value="ZdechovNET.lpr"/>
     
    212212        <UnitName Value="UUserControlPage"/>
    213213      </Unit21>
     214      <Unit22>
     215        <Filename Value="Modules/System/UModuleSystem.pas"/>
     216        <IsPartOfProject Value="True"/>
     217        <UnitName Value="UModuleSystem"/>
     218      </Unit22>
     219      <Unit23>
     220        <Filename Value="Pages/UPageAdmin.pas"/>
     221        <IsPartOfProject Value="True"/>
     222        <ComponentName Value="PageAdmin"/>
     223        <ResourceBaseClass Value="DataModule"/>
     224        <UnitName Value="UPageAdmin"/>
     225      </Unit23>
     226      <Unit24>
     227        <Filename Value="Modules/ZdechovNET/UModuleZdechovNET.pas"/>
     228        <IsPartOfProject Value="True"/>
     229        <UnitName Value="UModuleZdechovNET"/>
     230      </Unit24>
    214231    </Units>
    215232  </ProjectOptions>
     
    220237    </Target>
    221238    <SearchPaths>
    222       <OtherUnitFiles Value="/usr/lib/mysql/;/usr/lib64/mysql/;Application;WebServer;Network;Pages;Modules/User;Common"/>
     239      <OtherUnitFiles Value="/usr/lib/mysql/;/usr/lib64/mysql/;Application;WebServer;Network;Pages;Modules/User;Common;Modules/System;Modules/ZdechovNET"/>
    223240      <UnitOutputDirectory Value="lib/$(TargetCPU)-$(TargetOS)"/>
    224241    </SearchPaths>
Note: See TracChangeset for help on using the changeset viewer.