Changeset 51 for trunk/Client
- Timestamp:
- Apr 2, 2012, 3:59:58 PM (13 years ago)
- Location:
- trunk/Client
- Files:
-
- 8 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Client/Application/Clients/UChronisClientMySQL.pas
r46 r51 175 175 176 176 procedure TChronisClientMySQL.TypeUndefine(AType: TChronisType); 177 begin 178 177 var 178 DbRows: TDbRows; 179 I: Integer; 180 Query: string; 181 RefType: TChronisType; 182 begin 183 try 184 DbRows := TDbRows.Create; 185 Query := 'DROP TABLE IF EXISTS `' + AType.Name + '`'; 186 Database.Query(DbRows, Query); 187 finally 188 DbRows.Free; 189 end; 179 190 end; 180 191 -
trunk/Client/Application/UApplicationInfo.pas
r49 r51 50 50 Name := 'ChronIS'; 51 51 Identification := 1; 52 ReleaseDate := EncodeDate(2012, 3, 21);52 ReleaseDate := EncodeDate(2012, 4, 2); 53 53 MajorVersion := 0; 54 54 MinorVersion := 1; -
trunk/Client/Application/UChronisModule.pas
r29 r51 6 6 7 7 uses 8 Classes, SysUtils ;8 Classes, SysUtils, SpecializedList, UChronisClient; 9 9 10 10 type … … 14 14 TChronisModule = class 15 15 System: TObject; // TChronisSystem; 16 SysName: string; 16 17 Name: string; 18 Version: string; 19 Creator: string; 20 License: string; 21 HomePage: string; 22 Dependencies: TStringList; 23 function IsInstalled: Boolean; 17 24 procedure Install; virtual; 18 25 procedure Uninstall; virtual; 19 26 constructor Create; virtual; 27 destructor Destroy; override; 20 28 end; 21 29 22 30 TChronisModuleClass = class of TChronisModule; 31 23 32 24 33 implementation … … 27 36 USystem; 28 37 38 29 39 { TChronisModule } 30 40 41 function TChronisModule.IsInstalled: Boolean; 42 var 43 List: TListProxy; 44 begin 45 List := TListProxy.Create; 46 List.Client := TChronisBase(System).Client; 47 List.SchemaName := TChronisBase(System).Client.Schema; 48 List.ObjectName := SystemModuleObject; 49 List.Condition := '(SysName="' + SysName + '") AND (Installed=1)'; 50 List.Load; 51 Result := List.Objects.Count > 0; 52 List.Free; 53 end; 54 31 55 procedure TChronisModule.Install; 56 var 57 NewObject: TObjectProxy; 58 List: TListProxy; 32 59 begin 33 60 List := TListProxy.Create; 61 List.Client := TChronisBase(System).Client; 62 List.SchemaName := TChronisBase(System).Client.Schema; 63 List.ObjectName := SystemModuleObject; 64 List.Condition := 'SysName="' + SysName + '"'; 65 List.Load; 66 if List.Objects.Count > 0 then begin 67 NewObject := TObjectProxy.Create; 68 NewObject.Id := StrToInt(TObjectProxy(List.Objects[0]).Properties.Values['Id']); 69 NewObject.Client := TChronisBase(System).Client; 70 NewObject.SchemaName := TChronisBase(System).Client.Schema; 71 NewObject.ObjectName := SystemModuleObject; 72 NewObject.Properties.Add('Installed', '1'); 73 NewObject.Save; 74 NewObject.Free; 75 end; 76 List.Free; 34 77 end; 35 78 36 79 procedure TChronisModule.Uninstall; 80 var 81 NewObject: TObjectProxy; 82 List: TListProxy; 37 83 begin 38 84 List := TListProxy.Create; 85 List.Client := TChronisBase(System).Client; 86 List.SchemaName := TChronisBase(System).Client.Schema; 87 List.ObjectName := SystemModuleObject; 88 List.Condition := 'SysName="' + SysName + '"'; 89 List.Load; 90 if List.Objects.Count > 0 then begin 91 NewObject := TObjectProxy.Create; 92 NewObject.Id := StrToInt(TObjectProxy(List.Objects[0]).Properties.Values['Id']); 93 NewObject.Client := TChronisBase(System).Client; 94 NewObject.SchemaName := TChronisBase(System).Client.Schema; 95 NewObject.ObjectName := SystemModuleObject; 96 NewObject.Properties.Add('Installed', '0'); 97 NewObject.Save; 98 NewObject.Free; 99 end; 100 List.Free; 39 101 end; 40 102 41 103 constructor TChronisModule.Create; 42 104 begin 105 Dependencies := TStringList.Create; 106 end; 43 107 108 destructor TChronisModule.Destroy; 109 begin 110 Dependencies.Free; 111 inherited Destroy; 44 112 end; 45 113 -
trunk/Client/Forms/UFormMenu.lfm
r49 r51 1 1 object FormMenu: TFormMenu 2 Left = 2692 Left = 333 3 3 Height = 487 4 Top = 7 24 Top = 70 5 5 Width = 262 6 6 Caption = 'Navigation' -
trunk/Client/Module/UModuleSystem.pas
r46 r51 22 22 destructor Destroy; override; 23 23 end; 24 24 25 25 26 implementation -
trunk/Client/Module/UModuleUser.pas
r46 r51 10 10 type 11 11 12 { TModule System}12 { TModuleUser } 13 13 14 TModule System= class(TChronisModule)14 TModuleUser = class(TChronisModule) 15 15 public 16 16 procedure Install; override; … … 23 23 implementation 24 24 25 { TModule System}25 { TModuleUser } 26 26 27 procedure TModule System.Install;27 procedure TModuleUser.Install; 28 28 begin 29 29 inherited Install; 30 30 end; 31 31 32 procedure TModule System.Uninstall;32 procedure TModuleUser.Uninstall; 33 33 begin 34 34 inherited Uninstall; 35 35 end; 36 36 37 constructor TModule System.Create;37 constructor TModuleUser.Create; 38 38 begin 39 39 Name := 'User'; … … 41 41 end; 42 42 43 destructor TModule System.Destroy;43 destructor TModuleUser.Destroy; 44 44 begin 45 45 inherited Destroy; -
trunk/Client/USystem.pas
r46 r51 11 11 12 12 const 13 SystemModuleObject = 'SystemModule'; 13 14 ObjectGroupTable = 'ObjectGroup'; 14 15 ObjectTable = 'Object'; … … 36 37 vtTime, vtDate, vtColor, vtHyperlink, vtRelationOne, vtRelationMany, vtPassword); 37 38 38 TChronisType = class;39 39 TChronisObject = class; 40 40 TChronisBase = class; … … 88 88 end; 89 89 90 TChronisType = class 91 private 92 ParentId: Integer; 93 public 94 Id: Integer; 95 DbType: string; 96 TypeIndex: Integer; 97 end; 98 99 { TChronisTypeList } 100 101 TChronisTypeList = class(TListObject) 102 function FindById(Id: Integer): TChronisType; 103 function FindByTypeIndex(Id: Integer): TChronisType; 90 { TChronisModuleList } 91 92 TChronisModuleList = class(TListObject) // TListObject<TChronisModule> 93 Base: TChronisBase; 94 procedure UpdateList; 95 procedure Install; 96 procedure Uninstall; 104 97 end; 105 98 … … 113 106 Types: TChronisTypeList; 114 107 Client: TChronisClient; 115 Modules: T ListObject; // TListObject<TChronisModule>108 Modules: TChronisModuleList; 116 109 ModuleSystem: TChronisModule; 117 110 procedure RegisterModule(ModuleClass: TChronisModuleClass); … … 168 161 end; 169 162 170 { TChronisTypeList }171 172 function TChronisTypeList.FindById(Id: Integer): TChronisType;173 var174 I: Integer;175 begin176 I := 0;177 while (I < Count) and (TChronisType(Items[I]).Id <> Id) do Inc(I);178 if I < Count then Result := TChronisType(Items[I])179 else Result := nil;180 end;181 182 function TChronisTypeList.FindByTypeIndex(Id: Integer): TChronisType;183 var184 I: Integer;185 begin186 I := 0;187 while (I < Count) and (TChronisType(Items[I]).TypeIndex <> Id) do Inc(I);188 if I < Count then Result := TChronisType(Items[I])189 else Result := nil;190 end;191 192 163 { TReportLine } 193 164 … … 277 248 Client.Connect; 278 249 if Client.Connected then begin 279 if IsDatabaseEmptythen ModuleSystem.Install;250 if not ModuleSystem.IsInstalled then ModuleSystem.Install; 280 251 LoadTypes; 281 252 end else FActive := False; … … 697 668 begin 698 669 Types := TChronisTypeList.Create; 699 Modules := TListObject.Create; 670 Modules := TChronisModuleList.Create; 671 Modules.Base := Self; 700 672 end; 701 673 … … 775 747 end; 776 748 749 { TChronisModuleList } 750 751 procedure TChronisModuleList.UpdateList; 752 var 753 I: Integer; 754 NewObject: TObjectProxy; 755 List: TListProxy; 756 begin 757 List := TListProxy.Create; 758 List.Client := Base.Client; 759 List.SchemaName := Base.Client.Schema; 760 NewObject := TObjectProxy.Create; 761 NewObject.Client := Base.Client; 762 for I := 0 to Count - 1 do 763 with TChronisModule(Items[I]) do begin 764 List.Condition := 'SysName="' + SysName + '"'; 765 List.Load; 766 if List.Objects.Count > 0 then 767 NewObject.Id := StrToInt(TObjectProxy(List.Objects[0]).Properties.Values['Id']) 768 else NewObject.Id := 0; 769 NewObject.SchemaName := Base.Client.Schema; 770 NewObject.ObjectName := SystemModuleObject; 771 NewObject.Properties.Add('SysName', SysName); 772 NewObject.Properties.Add('Name', Name); 773 NewObject.Properties.Add('Version', Version); 774 NewObject.Properties.Add('License', License); 775 NewObject.Properties.Add('Creator', Creator); 776 NewObject.Properties.Add('HomePage', HomePage); 777 NewObject.Save; 778 end; 779 NewObject.Free; 780 List.Free; 781 end; 782 783 procedure TChronisModuleList.Install; 784 var 785 NewType: TChronisType; 786 begin 787 NewType := TChronisType.Create; 788 NewType.Client := Base.Client; 789 NewType.Name := SystemModuleObject; 790 NewType.Properties.Add('SysName', 'String'); 791 NewType.Properties.Add('Name', 'String'); 792 NewType.Properties.Add('Version', 'String'); 793 NewType.Properties.Add('License', 'String'); 794 NewType.Properties.Add('Creator', 'String'); 795 NewType.Properties.Add('HomePage', 'String'); 796 NewType.Properties.Add('Installed', 'Boolean'); 797 NewType.Define; 798 end; 799 800 procedure TChronisModuleList.Uninstall; 801 var 802 NewType: TChronisType; 803 begin 804 NewType := TChronisType.Create; 805 NewType.Client := Base.Client; 806 NewType.Name := SystemModuleObject; 807 NewType.Undefine; 808 end; 809 810 777 811 end. 778 812 -
trunk/Client/chronis.lpi
r50 r51 30 30 <SearchPaths> 31 31 <IncludeFiles Value="$(ProjOutDir)"/> 32 <Libraries Value="/usr/lib/mysql /;/usr/lib64/mysql/"/>32 <Libraries Value="/usr/lib/mysql;/usr/lib64/mysql"/> 33 33 <OtherUnitFiles Value="Common;Forms"/> 34 34 <UnitOutputDirectory Value="lib/$(TargetCPU)-$(TargetOS)"/> … … 284 284 <SearchPaths> 285 285 <IncludeFiles Value="$(ProjOutDir)"/> 286 <Libraries Value="/usr/lib/mysql /;/usr/lib64/mysql/"/>286 <Libraries Value="/usr/lib/mysql;/usr/lib64/mysql"/> 287 287 <OtherUnitFiles Value="Common;Forms;Application;Module;Application/Clients"/> 288 288 <UnitOutputDirectory Value="lib/$(TargetCPU)-$(TargetOS)"/>
Note:
See TracChangeset
for help on using the changeset viewer.