Skip to content

Commit

Permalink
FB:user editor
Browse files Browse the repository at this point in the history
  • Loading branch information
lalexs75 committed Nov 9, 2023
1 parent ebbfa7f commit 6f887ac
Show file tree
Hide file tree
Showing 5 changed files with 273 additions and 56 deletions.
2 changes: 1 addition & 1 deletion IBManager.lpi
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
<AutoIncrementBuild Value="True"/>
<MinorVersionNr Value="13"/>
<RevisionNr Value="3"/>
<BuildNr Value="5723"/>
<BuildNr Value="5724"/>
<Language Value="0419"/>
<Attributes pvaPreRelease="True"/>
<StringTable FileDescription="Tools for manage you databases" LegalCopyright="Lagunov A.A." ProductVersion="0.13"/>
Expand Down
Binary file modified IBManager.res
Binary file not shown.
240 changes: 212 additions & 28 deletions dbobjecteditors/dboRole/fbmfbusermaineditorunit.lfm
Original file line number Diff line number Diff line change
Expand Up @@ -179,32 +179,7 @@ inherited fbmFBUserMainEditorFrame: TfbmFBUserMainEditorFrame
BorderSpacing.Around = 6
Caption = 'Atributes'
end
object ValueListEditor1: TValueListEditor[15]
AnchorSideLeft.Control = Label8
AnchorSideTop.Control = Label8
AnchorSideTop.Side = asrBottom
AnchorSideRight.Control = Owner
AnchorSideRight.Side = asrBottom
AnchorSideBottom.Control = Owner
AnchorSideBottom.Side = asrBottom
Left = 12
Height = 133
Top = 261
Width = 634
Anchors = [akTop, akLeft, akRight, akBottom]
BorderSpacing.Around = 6
DefaultColWidth = 250
FixedCols = 0
RowCount = 2
TabOrder = 7
TitleStyle = tsNative
KeyOptions = [keyUnique]
ColWidths = (
250
382
)
end
object Panel1: TPanel[16]
object Panel1: TPanel[15]
AnchorSideTop.Control = Owner
AnchorSideRight.Control = Owner
AnchorSideRight.Side = asrBottom
Expand All @@ -217,7 +192,7 @@ inherited fbmFBUserMainEditorFrame: TfbmFBUserMainEditorFrame
BorderSpacing.Around = 6
ClientHeight = 66
ClientWidth = 106
TabOrder = 8
TabOrder = 7
object CheckBox1: TCheckBox
AnchorSideLeft.Control = Panel1
AnchorSideTop.Control = CheckBox2
Expand All @@ -242,7 +217,7 @@ inherited fbmFBUserMainEditorFrame: TfbmFBUserMainEditorFrame
TabOrder = 1
end
end
object CLabel: TLabel[17]
object CLabel: TLabel[16]
AnchorSideLeft.Control = Owner
AnchorSideLeft.Side = asrCenter
AnchorSideTop.Control = Owner
Expand All @@ -251,4 +226,213 @@ inherited fbmFBUserMainEditorFrame: TfbmFBUserMainEditorFrame
Top = 0
Width = 1
end
object RxDBGrid1: TRxDBGrid[17]
AnchorSideLeft.Control = Label8
AnchorSideTop.Control = Label8
AnchorSideTop.Side = asrBottom
AnchorSideRight.Control = Owner
AnchorSideRight.Side = asrBottom
AnchorSideBottom.Control = Owner
AnchorSideBottom.Side = asrBottom
Left = 6
Height = 139
Top = 261
Width = 646
ColumnDefValues.BlobText = '(данные)'
TitleButtons = False
AutoSort = True
Columns = <
item
SizePriority = 0
Title.Alignment = taCenter
Title.Orientation = toHorizontal
Title.Caption = 'ATTRIB_KEY'
Width = 250
FieldName = 'ATTRIB_KEY'
EditButtons = <>
Filter.DropDownRows = 0
Filter.EmptyValue = '(Пусто)'
Filter.NotEmptyValue = '(Не пусто)'
Filter.AllValue = '(Все значения)'
Filter.EmptyFont.Style = [fsItalic]
Filter.ItemIndex = -1
Footers = <>
end
item
Title.Alignment = taCenter
Title.Orientation = toHorizontal
Title.Caption = 'ATTRIB_VALUE'
Width = 369
FieldName = 'ATTRIB_VALUE'
EditButtons = <>
Filter.DropDownRows = 0
Filter.EmptyValue = '(Пусто)'
Filter.NotEmptyValue = '(Не пусто)'
Filter.AllValue = '(Все значения)'
Filter.EmptyFont.Style = [fsItalic]
Filter.ItemIndex = -1
Footers = <>
end>
KeyStrokes = <
item
Command = rxgcShowFindDlg
ShortCut = 16454
Enabled = True
end
item
Command = rxgcShowColumnsDlg
ShortCut = 16471
Enabled = True
end
item
Command = rxgcShowFilterDlg
ShortCut = 16468
Enabled = True
end
item
Command = rxgcShowSortDlg
ShortCut = 16467
Enabled = True
end
item
Command = rxgcShowQuickFilter
ShortCut = 16465
Enabled = True
end
item
Command = rxgcHideQuickFilter
ShortCut = 16456
Enabled = True
end
item
Command = rxgcSelectAll
ShortCut = 16449
Enabled = True
end
item
Command = rxgcDeSelectAll
ShortCut = 16429
Enabled = True
end
item
Command = rxgcInvertSelection
ShortCut = 16426
Enabled = True
end
item
Command = rxgcOptimizeColumnsWidth
ShortCut = 16427
Enabled = True
end
item
Command = rxgcCopyCellValue
ShortCut = 16451
Enabled = True
end>
FooterOptions.DrawFullLine = False
SearchOptions.QuickSearchOptions = [loCaseInsensitive, loPartialKey]
SearchOptions.FromStart = False
OptionsRx = [rdgAllowColumnsForm, rdgAllowDialogFind, rdgAllowQuickFilter]
Anchors = [akTop, akLeft, akRight, akBottom]
AutoFillColumns = True
Color = clWindow
DrawFullLine = False
FocusColor = clRed
SelectedColor = clHighlight
DataSource = dsUserAtribs
Options = [dgEditing, dgTitles, dgIndicator, dgColumnResize, dgColumnMove, dgColLines, dgRowLines, dgAlwaysShowSelection, dgConfirmDelete, dgCancelOnExit]
TabOrder = 8
TitleStyle = tsNative
end
object rxUserAtribs: TRxMemoryData[18]
FieldDefs = <
item
Name = 'ATTRIB_KEY'
DataType = ftString
Size = 150
end
item
Name = 'ATTRIB_VALUE'
DataType = ftString
Size = 600
end
item
Name = 'OLD_ATTRIB_VALUE'
DataType = ftString
Size = 600
end
item
Name = 'IS_EXISTS'
DataType = ftBoolean
end
item
Name = 'IS_DELETED'
DataType = ftBoolean
end>
AfterInsert = rxUserAtribsAfterInsert
OnFilterRecord = rxUserAtribsFilterRecord
PacketRecords = 0
Left = 391
Top = 312
object rxUserAtribsATTRIB_KEY: TStringField
FieldKind = fkData
FieldName = 'ATTRIB_KEY'
Index = 0
LookupCache = False
ProviderFlags = [pfInUpdate, pfInWhere]
ReadOnly = False
Required = False
Size = 150
end
object rxUserAtribsATTRIB_VALUE: TStringField
FieldKind = fkData
FieldName = 'ATTRIB_VALUE'
Index = 1
LookupCache = False
ProviderFlags = [pfInUpdate, pfInWhere]
ReadOnly = False
Required = False
Size = 600
end
object rxUserAtribsOLD_ATTRIB_VALUE: TStringField
FieldKind = fkData
FieldName = 'OLD_ATTRIB_VALUE'
Index = 2
LookupCache = False
ProviderFlags = [pfInUpdate, pfInWhere]
ReadOnly = False
Required = False
Size = 600
end
object rxUserAtribsIS_EXISTS: TBooleanField
FieldKind = fkData
FieldName = 'IS_EXISTS'
Index = 3
LookupCache = False
ProviderFlags = [pfInUpdate, pfInWhere]
ReadOnly = False
Required = False
DisplayValues = 'True;False'
end
object rxUserAtribsIS_DELETED: TBooleanField
FieldKind = fkData
FieldName = 'IS_DELETED'
Index = 4
LookupCache = False
ProviderFlags = [pfInUpdate, pfInWhere]
ReadOnly = False
Required = False
DisplayValues = 'True;False'
end
end
object dsUserAtribs: TDataSource[19]
DataSet = rxUserAtribs
Left = 352
Top = 312
end
object PopupMenu1: TPopupMenu[20]
Images = fbManagerMainForm.ImageListMain
Left = 312
Top = 312
end
end
55 changes: 46 additions & 9 deletions dbobjecteditors/dboRole/fbmfbusermaineditorunit.pas
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,9 @@ interface

uses
Classes, SysUtils, Forms, Controls, Graphics, Dialogs, StdCtrls, ValEdit,
ExtCtrls, fdmAbstractEditorUnit, SQLEngineAbstractUnit, fbmSqlParserUnit,
FBSQLEngineUnit, FBSQLEngineSecurityUnit;
ExtCtrls, Menus, DB, RxDBGrid, rxmemds, fdmAbstractEditorUnit,
SQLEngineAbstractUnit, fbmSqlParserUnit, FBSQLEngineUnit,
FBSQLEngineSecurityUnit;

type

Expand All @@ -36,6 +37,7 @@ interface
TfbmFBUserMainEditorFrame = class(TEditorPage)
CheckBox1: TCheckBox;
CheckBox2: TCheckBox;
dsUserAtribs: TDataSource;
Edit1: TEdit;
Edit2: TEdit;
Edit3: TEdit;
Expand All @@ -53,7 +55,16 @@ TfbmFBUserMainEditorFrame = class(TEditorPage)
Label8: TLabel;
CLabel: TLabel;
Panel1: TPanel;
ValueListEditor1: TValueListEditor;
PopupMenu1: TPopupMenu;
RxDBGrid1: TRxDBGrid;
rxUserAtribs: TRxMemoryData;
rxUserAtribsATTRIB_KEY: TStringField;
rxUserAtribsATTRIB_VALUE: TStringField;
rxUserAtribsIS_DELETED: TBooleanField;
rxUserAtribsIS_EXISTS: TBooleanField;
rxUserAtribsOLD_ATTRIB_VALUE: TStringField;
procedure rxUserAtribsAfterInsert(DataSet: TDataSet);
procedure rxUserAtribsFilterRecord(DataSet: TDataSet; var Accept: Boolean);
private
function DoMetod(PageAction:TEditorPageAction):boolean;override;
function ActionEnabled(PageAction:TEditorPageAction):boolean;override;
Expand All @@ -73,6 +84,18 @@ implementation

{ TfbmFBUserMainEditorFrame }

procedure TfbmFBUserMainEditorFrame.rxUserAtribsAfterInsert(DataSet: TDataSet);
begin
rxUserAtribsIS_EXISTS.AsBoolean:=false;
rxUserAtribsIS_DELETED.AsBoolean:=false;
end;

procedure TfbmFBUserMainEditorFrame.rxUserAtribsFilterRecord(DataSet: TDataSet;
var Accept: Boolean);
begin
Accept:=not rxUserAtribsIS_DELETED.AsBoolean;
end;

function TfbmFBUserMainEditorFrame.DoMetod(PageAction: TEditorPageAction
): boolean;
begin
Expand Down Expand Up @@ -108,9 +131,10 @@ procedure TfbmFBUserMainEditorFrame.LoadUserData;
F: TFireBirUser;
i: Integer;
begin

Edit2.Text:='';
Edit3.Text:='';
rxUserAtribs.CloseOpen;
rxUserAtribs.Filtered:=true;
if DBObject.State = sdboCreate then Exit;

Edit1.Text:=DBObject.Caption;
Expand All @@ -122,9 +146,16 @@ procedure TfbmFBUserMainEditorFrame.LoadUserData;
CheckBox2.Checked:=F.Active;
CheckBox1.Checked:=F.IsAdmin;

ValueListEditor1.Clear;
for i:=0 to F.Params.Count-1 do
ValueListEditor1.InsertRow(F.Params.Names[i], F.Params.ValueFromIndex[i], true);
begin
rxUserAtribs.Append;
rxUserAtribsATTRIB_KEY.AsString:=F.Params.Names[i];
rxUserAtribsATTRIB_VALUE.AsString:=F.Params.ValueFromIndex[i];
rxUserAtribsOLD_ATTRIB_VALUE.AsString:=F.Params.ValueFromIndex[i];
rxUserAtribsIS_EXISTS.AsBoolean:=true;
rxUserAtribs.Post;
end;
rxUserAtribs.First;
end;

procedure TfbmFBUserMainEditorFrame.Localize;
Expand Down Expand Up @@ -184,9 +215,15 @@ function TfbmFBUserMainEditorFrame.SetupSQLObject(ASQLObject: TSQLCommandDDL
else
FC.State:=trsInactive;

for i:=0 to ValueListEditor1.RowCount-1 do
FC.Params.AddParamEx(ValueListEditor1.Cells[0, i], ValueListEditor1.Cells[1, i]);

rxUserAtribs.Filtered:=false;
rxUserAtribs.First;
while not rxUserAtribs.EOF do
begin
FC.Params.AddParamEx(rxUserAtribsATTRIB_KEY.AsString, rxUserAtribsATTRIB_VALUE.AsString);
rxUserAtribs.Next;
end;
rxUserAtribs.First;
rxUserAtribs.Filtered:=true;
Result:=true;
end
else
Expand Down
Loading

0 comments on commit 6f887ac

Please sign in to comment.