Changeset 24 for trunk


Ignore:
Timestamp:
Oct 21, 2011, 11:12:09 PM (13 years ago)
Author:
george
Message:
  • Add: Support for storing module skeleton.
Location:
trunk
Files:
3 added
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/Forms/UMainForm.lfm

    r23 r24  
    66  ActiveControl = Panel1
    77  Caption = 'ChronIS'
    8   ClientHeight = 427
     8  ClientHeight = 422
    99  ClientWidth = 640
    1010  Menu = MainMenu1
     
    1616  object Panel1: TPanel
    1717    Left = 0
    18     Height = 427
     18    Height = 422
    1919    Top = 0
    2020    Width = 184
    2121    Align = alLeft
    2222    BevelOuter = bvNone
    23     ClientHeight = 427
     23    ClientHeight = 422
    2424    ClientWidth = 184
    2525    TabOrder = 0
    2626    object Label1: TLabel
    2727      Left = 7
    28       Height = 14
     28      Height = 18
    2929      Top = 4
    30       Width = 39
     30      Width = 51
    3131      Caption = 'Groups:'
    3232      ParentColor = False
     
    3434    object TreeView1: TTreeView
    3535      Left = 4
    36       Height = 403
     36      Height = 398
    3737      Top = 19
    3838      Width = 180
    3939      Anchors = [akTop, akLeft, akRight, akBottom]
    40       DefaultItemHeight = 16
    4140      Images = ImageListActions
    4241      ReadOnly = True
     
    4847  object Panel2: TPanel
    4948    Left = 189
    50     Height = 427
     49    Height = 422
    5150    Top = 0
    5251    Width = 451
    5352    Align = alClient
    5453    BevelOuter = bvNone
    55     ClientHeight = 427
     54    ClientHeight = 422
    5655    ClientWidth = 451
    5756    TabOrder = 1
    5857    object Label2: TLabel
    5958      Left = 2
    60       Height = 14
     59      Height = 18
    6160      Top = 4
    62       Width = 43
     61      Width = 54
    6362      Caption = 'Reports:'
    6463      ParentColor = False
     
    6665    object ListView1: TListView
    6766      Left = 2
    68       Height = 371
     67      Height = 366
    6968      Top = 19
    7069      Width = 447
     
    8685      Left = 3
    8786      Height = 25
    88       Top = 398
     87      Top = 393
    8988      Width = 75
    9089      Action = AItemAdd
     
    9594      Left = 83
    9695      Height = 25
    97       Top = 398
     96      Top = 393
    9897      Width = 75
    9998      Action = AItemDelete
     
    104103  object Splitter1: TSplitter
    105104    Left = 184
    106     Height = 427
     105    Height = 422
    107106    Top = 0
    108107    Width = 5
  • trunk/Forms/UMainForm.pas

    r21 r24  
    383383        ') ENGINE=InnoDB  DEFAULT CHARSET=utf8');
    384384    end;
     385
     386      if Tables.IndexOf(ModuleTable) = -1 then begin
     387      Database.Query(DbRows, 'CREATE TABLE IF NOT EXISTS `' + ModuleTable + '` ( ' +
     388        '`Id` int(11) NOT NULL AUTO_INCREMENT,' +
     389        '`Name` VARCHAR(255) NOT NULL,' +
     390        '`Author` VARCHAR(255) NOT NULL,' +
     391        '`Website` VARCHAR(255) NOT NULL,' +
     392        '`Version` VARCHAR(255) NOT NULL,' +
     393        '`License` VARCHAR(255) NOT NULL,' +
     394        '`Description` TEXT NOT NULL,' +
     395        'PRIMARY KEY (`Id`)' +
     396        ') ENGINE=InnoDB  DEFAULT CHARSET=utf8');
     397    end;
    385398  finally
    386399    Tables.Free;
     
    409422  GroupId: Integer;
    410423  EnumId: Integer;
     424  ModuleId: Integer;
     425  ModuleBaseId: Integer;
    411426begin
    412427  with Core.System do begin
     
    485500    AddPropertyRelationMany(ObjectPropertyGroupId, 'Properties', 'Properties', True, ObjectPropertyIdGroup);
    486501    AddPropertyRelationMany(PropertyTypeId, 'Custom types', 'CustomTypes', True, CustomTypeIdType);
     502  ModuleId := AddObject('Modules', 'Module', Core.System.Database.Database, GroupId);
     503    AddPropertyNumber(ModuleId, 'Id', 'Id', False);
     504    AddPropertyString(ModuleId, 'Name', 'Name', True);
     505    AddPropertyString(ModuleId, 'Author', 'Author', True);
     506    AddPropertyString(ModuleId, 'Website', 'Website', False);
     507    AddPropertyString(ModuleId, 'Version', 'Version', True);
     508    AddPropertyText(ModuleId, 'Description', 'Description', False);
     509    AddPropertyString(ModuleId, 'License', 'License', False);
     510
     511  ModuleBaseId := AddModule('Base', 'Chronos', '', '0.1', '', 'GNU/GPL');
    487512  end;
    488513end;
  • trunk/UCore.lfm

    r22 r24  
    44  OldCreateOrder = False
    55  Height = 340
    6   HorizontalOffset = 236
    7   VerticalOffset = 74
     6  HorizontalOffset = 320
     7  VerticalOffset = 114
    88  Width = 413
    99  object CoolTranslator1: TCoolTranslator
  • trunk/USystem.pas

    r22 r24  
    1616  PropertyTypeTable = 'Type';
    1717  PropertyGroupTable = 'PropertyGroup';
     18  ModuleTable = 'Module';
    1819  TypeEnumeration = 'TypeEnumeration';
    1920  TypeFile = 'TypeFile';
     
    119120    function AddPropertyString(ObjectId: Integer; Name, ColumnName: string;
    120121      Editable: Boolean; Default: string = ''; MaxLength: Integer = 255): Integer;
     122    function AddPropertyText(ObjectId: Integer; Name, ColumnName: string;
     123      Editable: Boolean; Default: string = ''): Integer;
    121124    function AddPropertyRelationOne(ObjectId: Integer; Name, ColumnName: string;
    122125      Editable: Boolean; ReferedObject: Integer): Integer;
     
    126129    function AddEnumeration(Name: string): Integer;
    127130    function AddEnumerationState(Enum: Integer; Name: string): Integer;
     131    function AddModule(Name, Author, Website, Version, Description, License: string): Integer;
    128132    procedure LoadTypes;
    129133    constructor Create;
     
    435439end;
    436440
     441function TChronisBase.AddPropertyText(ObjectId: Integer; Name,
     442  ColumnName: string; Editable: Boolean; Default: string): Integer;
     443var
     444  DbRows: TDbRows;
     445  Data: TDictionaryStringString;
     446  CustomTypeId: Integer;
     447begin
     448  try
     449    DbRows := TDbRows.Create;
     450    Data := TDictionaryStringString.Create;
     451
     452    Data.Clear;
     453    Data.Add('Type', IntToStr(Integer(vtText)));
     454    Database.Insert(CustomTypeTableName, Data);
     455    CustomTypeId := Database.LastInsertId;
     456
     457    Data.Clear;
     458    Data.Add('CustomType', IntToStr(CustomTypeId));
     459    Data.Add('Default', Default);
     460    Database.Insert(TypeString, Data);
     461    //CustomTypeId := Database.LastInsertId;
     462
     463    Result := AddProperty(ObjectId, Name, ColumnName, CustomTypeId, Editable);
     464  finally
     465    Data.Free;
     466    DbRows.Free;
     467  end;
     468end;
     469
    437470function TChronisBase.AddPropertyRelationOne(ObjectId: Integer; Name,
    438471  ColumnName: string; Editable: Boolean; ReferedObject: Integer): Integer;
     
    539572    Data.Add('Name', Name);
    540573    Database.Insert(EnumerationState, Data);
     574    Result := Database.LastInsertId;
     575  finally
     576    Data.Free;
     577    DbRows.Free;
     578  end;
     579end;
     580
     581function TChronisBase.AddModule(Name, Author, Website, Version, Description,
     582  License: string): Integer;
     583var
     584  DbRows: TDbRows;
     585  Data: TDictionaryStringString;
     586begin
     587  try
     588    DbRows := TDbRows.Create;
     589    Data := TDictionaryStringString.Create;
     590    Data.Add('Name', Name);
     591    Data.Add('Author', Author);
     592    Data.Add('Website', Website);
     593    Data.Add('Version', Version);
     594    Data.Add('Description', Description);
     595    Data.Add('License', License);
     596    Database.Insert(ModuleTable, Data);
    541597    Result := Database.LastInsertId;
    542598  finally
Note: See TracChangeset for help on using the changeset viewer.