New group editors code cleanup
This commit is contained in:
parent
4b6cfc8b31
commit
391ac4bef0
|
@ -3873,3 +3873,5 @@
|
||||||
+ Added new ANSI file base editor into the System Configuration.
|
+ Added new ANSI file base editor into the System Configuration.
|
||||||
|
|
||||||
+ Added Copy/Paste functions into all new ANSI internal editors.
|
+ Added Copy/Paste functions into all new ANSI internal editors.
|
||||||
|
|
||||||
|
+ Added new ANSI message group and file group editors.
|
||||||
|
|
|
@ -97,7 +97,7 @@ Begin
|
||||||
WriteXY (15, 7, 112, 'Use Ext OSID Description');
|
WriteXY (15, 7, 112, 'Use Ext OSID Description');
|
||||||
WriteXY (15, 8, 112, strRep('Ä', 51));
|
WriteXY (15, 8, 112, strRep('Ä', 51));
|
||||||
WriteXY (15, 18, 112, strRep('Ä', 51));
|
WriteXY (15, 18, 112, strRep('Ä', 51));
|
||||||
WriteXY (29, 19, 112, 'Press / for command list');
|
WriteXY (29, 19, 112, cfgCommandList);
|
||||||
|
|
||||||
Repeat
|
Repeat
|
||||||
MakeList;
|
MakeList;
|
||||||
|
|
|
@ -4,6 +4,9 @@ Unit bbs_cfg_Common;
|
||||||
|
|
||||||
Interface
|
Interface
|
||||||
|
|
||||||
|
Const
|
||||||
|
cfgCommandList = 'Press / for command list';
|
||||||
|
|
||||||
Function GetCommandOption (StartY: Byte; CmdStr: String) : Char;
|
Function GetCommandOption (StartY: Byte; CmdStr: String) : Char;
|
||||||
|
|
||||||
Implementation
|
Implementation
|
||||||
|
|
|
@ -129,7 +129,7 @@ Begin
|
||||||
WriteXY (17, 6, 112, '##### File Base Description');
|
WriteXY (17, 6, 112, '##### File Base Description');
|
||||||
WriteXY (16, 7, 112, strRep(#196, 49));
|
WriteXY (16, 7, 112, strRep(#196, 49));
|
||||||
WriteXY (16, 19, 112, strRep(#196, 49));
|
WriteXY (16, 19, 112, strRep(#196, 49));
|
||||||
WriteXY (29, 20, 112, 'Press / for command list');
|
WriteXY (29, 20, 112, cfgCommandList);
|
||||||
|
|
||||||
Repeat
|
Repeat
|
||||||
MakeList;
|
MakeList;
|
||||||
|
|
|
@ -1,149 +1,166 @@
|
||||||
Unit bbs_cfg_Groups;
|
Unit bbs_Cfg_Groups;
|
||||||
|
|
||||||
{$I M_OPS.PAS}
|
|
||||||
|
|
||||||
Interface
|
Interface
|
||||||
|
|
||||||
Procedure Group_Editor;
|
Procedure Configuration_GroupEditor (Msg: Boolean);
|
||||||
|
|
||||||
Implementation
|
Implementation
|
||||||
|
|
||||||
Uses
|
Uses
|
||||||
|
m_FileIO,
|
||||||
m_Strings,
|
m_Strings,
|
||||||
bbs_Common,
|
bbs_Ansi_MenuBox,
|
||||||
bbs_Core;
|
bbs_Ansi_MenuForm,
|
||||||
|
bbs_cfg_Common,
|
||||||
|
bbs_Common;
|
||||||
|
|
||||||
Procedure File_Group;
|
Procedure EditGroup (Var Group: RecGroup);
|
||||||
var
|
Var
|
||||||
a : SmallInt;
|
Box : TAnsiMenuBox;
|
||||||
fgroup : recgroup;
|
Form : TAnsiMenuForm;
|
||||||
|
Topic : String;
|
||||||
Begin
|
Begin
|
||||||
Reset (Session.FileBase.FGroupFile);
|
Topic := '|03(|09Group Editor|03) |01-|09> |15';
|
||||||
Repeat
|
Box := TAnsiMenuBox.Create;
|
||||||
Session.io.OutFullLn ('|CL|14File Group Editor|CR|CR|09### Name|CR--- ------------------------------');
|
Form := TAnsiMenuForm.Create;
|
||||||
Reset (Session.FileBase.FGroupFile);
|
|
||||||
while not eof(Session.FileBase.FGroupFile) do begin
|
|
||||||
read (Session.FileBase.FGroupFile, FGroup);
|
|
||||||
Session.io.OutFullLn ('|15' + strPadR(strI2S(filepos(Session.FileBase.FGroupFile)), 5, ' ') + '|14' + FGroup.Name);
|
|
||||||
end;
|
|
||||||
Session.io.OutFull ('|CR|09(I)nsert, (D)elete, (E)dit, (Q)uit? ');
|
|
||||||
case Session.io.OneKey ('DIEQ', True) of
|
|
||||||
'D' : begin
|
|
||||||
Session.io.OutRaw ('Delete which? ');
|
|
||||||
a := strS2I(Session.io.GetInput(3, 3, 11, ''));
|
|
||||||
KillRecord (Session.FileBase.FGroupFile, A, SizeOf(RecGroup));
|
|
||||||
end;
|
|
||||||
'I' : begin
|
|
||||||
Session.io.OutRaw ('Insert before which? (1-' + strI2S(filesize(Session.FileBase.FGroupFile)+1) + '): ');
|
|
||||||
a := strS2I(Session.io.GetInput(3, 3, 11, ''));
|
|
||||||
if (a > 0) and (a <= filesize(Session.FileBase.FGroupFile)+1) then begin
|
|
||||||
AddRecord (Session.FileBase.FGroupFile, A, SizeOf(RecGroup));
|
|
||||||
FGroup.Name := '';
|
|
||||||
FGroup.ACS := 's255';
|
|
||||||
write (Session.FileBase.FGroupFile, FGroup);
|
|
||||||
end;
|
|
||||||
end;
|
|
||||||
'E' : begin
|
|
||||||
Session.io.OutRaw ('Edit which? ');
|
|
||||||
a := strS2I(Session.io.GetInput(3, 3, 11, ''));
|
|
||||||
if (a > 0) and (a <= filesize(Session.FileBase.FGroupFile)) then begin
|
|
||||||
seek (Session.FileBase.FGroupFile, a-1);
|
|
||||||
read (Session.FileBase.FGroupFile, FGroup);
|
|
||||||
repeat
|
|
||||||
Session.io.OutFullLn ('|CL|14File Group '+strI2S(FilePos(Session.FileBase.FGroupFile)) + ' of ' + strI2S(FileSize(Session.FileBase.FGroupFile))+'|CR|03');
|
|
||||||
Session.io.OutRawln ('A. Name : ' + FGroup.Name);
|
|
||||||
Session.io.OutRawln ('B. ACS : ' + FGroup.acs);
|
|
||||||
Session.io.OutRawLn ('C. Hidden : ' + Session.io.OutYN(FGroup.Hidden));
|
|
||||||
Session.io.OutFull ('|CR|09Command (Q/Quit): ');
|
|
||||||
case Session.io.OneKey('ABCQ', True) of
|
|
||||||
'A' : FGroup.name := Session.io.InXY(13, 3, 30, 30, 11, Fgroup.name);
|
|
||||||
'B' : FGroup.acs := Session.io.InXY(13, 4, 20, 20, 11, Fgroup.acs);
|
|
||||||
'C' : FGroup.Hidden := Not FGroup.Hidden;
|
|
||||||
'Q' : break;
|
|
||||||
end;
|
|
||||||
until false;
|
|
||||||
seek (Session.FileBase.FGroupFile, filepos(Session.FileBase.FGroupFile)-1);
|
|
||||||
write (Session.FileBase.FGroupFile, FGroup);
|
|
||||||
end;
|
|
||||||
end;
|
|
||||||
'Q' : break;
|
|
||||||
end;
|
|
||||||
|
|
||||||
until False;
|
Box.Header := ' Group Editor ';
|
||||||
close (Session.FileBase.FGroupFile);
|
|
||||||
|
|
||||||
|
Box.Open (14, 10, 67, 16);
|
||||||
|
|
||||||
|
VerticalLine (24, 12, 14);
|
||||||
|
|
||||||
|
Form.AddStr ('N', ' Name' , 18, 12, 26, 12, 6, 40, 40, @Group.Name, Topic + 'Description of group');
|
||||||
|
Form.AddStr ('A', ' Access', 16, 13, 26, 13, 8, 30, 30, @Group.ACS, Topic + 'Access level to access this group');
|
||||||
|
Form.AddBol ('H', ' Hidden', 16, 14, 26, 14, 8, 3, @Group.Hidden, Topic + 'Group is hidden from group listing?');
|
||||||
|
|
||||||
|
Form.Execute;
|
||||||
|
|
||||||
|
Box.Close;
|
||||||
|
Form.Free;
|
||||||
|
Box.Free;
|
||||||
End;
|
End;
|
||||||
|
|
||||||
Procedure Message_Group;
|
Procedure Configuration_GroupEditor (Msg: Boolean);
|
||||||
var
|
Var
|
||||||
a : SmallInt;
|
Box : TAnsiMenuBox;
|
||||||
group:Recgroup;
|
List : TAnsiMenuList;
|
||||||
Begin
|
GroupFile : TBufFile;
|
||||||
Reset (Session.Msgs.GroupFile);
|
Group : RecGroup;
|
||||||
Repeat
|
Copied : RecGroup;
|
||||||
Session.io.OutFullLn ('|CL|14Message Group Editor|CR|CR|09### Name|CR--- ------------------------------');
|
HasCopy : Boolean = False;
|
||||||
Reset (Session.Msgs.GroupFile);
|
|
||||||
while not Eof(Session.Msgs.GroupFile) do begin
|
|
||||||
read (Session.Msgs.GroupFile, Group);
|
|
||||||
Session.io.OutFullLn ('|15' + strPadR(strI2S(filepos(Session.Msgs.GroupFile)), 5, ' ') + '|14' + Group.Name);
|
|
||||||
end;
|
|
||||||
Session.io.OutFull ('|CR|09(I)nsert, (D)elete, (E)dit, (Q)uit? ');
|
|
||||||
case Session.io.OneKey ('DIEQ', True) of
|
|
||||||
'D' : begin
|
|
||||||
Session.io.OutRaw ('Delete which? ');
|
|
||||||
a := strS2I(Session.io.GetInput(3, 3, 11, ''));
|
|
||||||
KillRecord (Session.Msgs.GroupFile, A, SizeOf(RecGroup));
|
|
||||||
end;
|
|
||||||
'I' : begin
|
|
||||||
Session.io.OutRaw ('Insert before? (1-' + strI2S(filesize(Session.Msgs.GroupFile)+1) + '): ');
|
|
||||||
a := strS2I(Session.io.GetInput(3, 3, 11, ''));
|
|
||||||
if (a > 0) and (a <= filesize(Session.Msgs.GroupFile)+1) then begin
|
|
||||||
AddRecord (Session.Msgs.GroupFile, A, SizeOf(RecGroup));
|
|
||||||
Group.Name := '';
|
|
||||||
Group.ACS := 's255';
|
|
||||||
write (Session.Msgs.GroupFile, Group);
|
|
||||||
end;
|
|
||||||
end;
|
|
||||||
'E' : begin
|
|
||||||
Session.io.OutRaw ('Edit which? ');
|
|
||||||
a := strS2I(Session.io.GetInput(3, 3, 11, ''));
|
|
||||||
if (a > 0) and (a <= filesize(Session.Msgs.GroupFile)) then begin
|
|
||||||
seek (Session.Msgs.GroupFile, a-1);
|
|
||||||
read (Session.Msgs.GroupFile, Group);
|
|
||||||
repeat
|
|
||||||
Session.io.OutFullLn ('|CL|14Group ' + strI2S(FilePos(Session.Msgs.GroupFile)) + ' of ' + strI2S(FileSize(Session.Msgs.GroupFile)) + '|CR|03');
|
|
||||||
Session.io.OutRawln ('A. Name : ' + Group.Name);
|
|
||||||
Session.io.OutRawln ('B. ACS : ' + Group.acs);
|
|
||||||
Session.io.OutRawLn ('C. Hidden : ' + Session.io.OutYN(Group.Hidden));
|
|
||||||
|
|
||||||
Session.io.OutFull ('|CR|09Command (Q/Quit): ');
|
Procedure MakeList;
|
||||||
case Session.io.OneKey('ABCQ', True) of
|
Begin
|
||||||
'A' : Group.name := Session.io.InXY(13, 3, 30, 30, 11, group.name);
|
List.Clear;
|
||||||
'B' : Group.acs := Session.io.InXY(13, 4, 20, 20, 11, group.acs);
|
|
||||||
'C' : Group.Hidden := Not Group.Hidden;
|
|
||||||
'Q' : break;
|
|
||||||
end;
|
|
||||||
until false;
|
|
||||||
seek (Session.Msgs.GroupFile, filepos(Session.Msgs.GroupFile)-1);
|
|
||||||
write (Session.Msgs.GroupFile, Group);
|
|
||||||
end;
|
|
||||||
end;
|
|
||||||
'Q' : break;
|
|
||||||
end;
|
|
||||||
|
|
||||||
until False;
|
GroupFile.Reset;
|
||||||
close (Session.Msgs.GroupFile);
|
|
||||||
End;
|
|
||||||
|
|
||||||
Procedure Group_Editor;
|
While Not GroupFile.EOF Do Begin
|
||||||
Begin
|
GroupFile.Read (Group);
|
||||||
Session.SystemLog ('*GROUP EDITOR*');
|
|
||||||
|
|
||||||
Session.io.OutFull ('|CL|09Edit Groups: (M)essage, (F)ile, (Q)uit? ');
|
List.Add(strPadR(strI2S(GroupFile.FilePos), 3, ' ') + ' ' + strStripPipe(Group.Name), 0);
|
||||||
Case Session.io.OneKey('QMF', True) of
|
|
||||||
'M' : Message_Group;
|
|
||||||
'F' : File_Group;
|
|
||||||
End;
|
End;
|
||||||
|
|
||||||
|
List.Add('', 2);
|
||||||
|
End;
|
||||||
|
|
||||||
|
Begin
|
||||||
|
GroupFile := TBufFile.Create(2048);
|
||||||
|
|
||||||
|
If Msg Then Begin
|
||||||
|
If Not GroupFile.Open(Config.DataPath + 'groups_g.dat', fmOpenCreate, fmReadWrite + fmDenyNone, SizeOf(RecGroup)) Then Begin
|
||||||
|
GroupFile.Free;
|
||||||
|
Exit;
|
||||||
|
End;
|
||||||
|
End Else Begin
|
||||||
|
If Not GroupFile.Open(Config.DataPath + 'groups_f.dat', fmOpenCreate, fmReadWrite + fmDenyNone, SizeOf(RecGroup)) Then Begin
|
||||||
|
GroupFile.Free;
|
||||||
|
Exit;
|
||||||
|
End;
|
||||||
|
End;
|
||||||
|
|
||||||
|
Box := TAnsiMenuBox.Create;
|
||||||
|
List := TAnsiMenuList.Create;
|
||||||
|
|
||||||
|
List.NoWindow := True;
|
||||||
|
List.LoChars := #13#27#47;
|
||||||
|
|
||||||
|
If Msg Then
|
||||||
|
Box.Header := ' Message Group Editor '
|
||||||
|
Else
|
||||||
|
Box.Header := ' File Group Editor ';
|
||||||
|
|
||||||
|
Box.Open (21, 6, 59, 20);
|
||||||
|
|
||||||
|
If Msg Then
|
||||||
|
WriteXY (23, 8, 112, '### Message Group Name')
|
||||||
|
Else
|
||||||
|
WriteXY (23, 8, 112, '### File Group Name');
|
||||||
|
|
||||||
|
WriteXY (22, 9, 112, strRep(#196, 37));
|
||||||
|
WriteXY (22, 18, 112, strRep(#196, 37));
|
||||||
|
WriteXY (29, 19, 112, cfgCommandList);
|
||||||
|
|
||||||
|
Repeat
|
||||||
|
MakeList;
|
||||||
|
|
||||||
|
List.Open (21, 9, 59, 18);
|
||||||
|
List.Close;
|
||||||
|
|
||||||
|
Case List.ExitCode of
|
||||||
|
'/' : Case GetCommandOption(10, 'I-Insert|D-Delete|C-Copy|P-Paste|') of
|
||||||
|
'I' : If List.Picked > 1 Then Begin
|
||||||
|
GroupFile.RecordInsert (List.Picked);
|
||||||
|
|
||||||
|
Group.Name := 'New Group';
|
||||||
|
Group.ACS := '';
|
||||||
|
Group.Hidden := False;
|
||||||
|
|
||||||
|
GroupFile.Write (Group);
|
||||||
|
|
||||||
|
MakeList;
|
||||||
|
End;
|
||||||
|
'D' : If (List.Picked < List.ListMax) Then
|
||||||
|
If ShowMsgBox(1, 'Delete this entry?') Then Begin
|
||||||
|
GroupFile.Seek (List.Picked - 1);
|
||||||
|
GroupFile.Read (Group);
|
||||||
|
|
||||||
|
GroupFile.RecordDelete (List.Picked);
|
||||||
|
|
||||||
|
MakeList;
|
||||||
|
End;
|
||||||
|
'C' : If List.Picked <> List.ListMax Then Begin
|
||||||
|
GroupFile.Seek (List.Picked - 1);
|
||||||
|
GroupFile.Read (Copied);
|
||||||
|
|
||||||
|
HasCopy := True;
|
||||||
|
End;
|
||||||
|
'P' : If HasCopy Then Begin
|
||||||
|
GroupFile.RecordInsert (List.Picked);
|
||||||
|
GroupFile.Write (Copied);
|
||||||
|
|
||||||
|
MakeList;
|
||||||
|
End;
|
||||||
|
End;
|
||||||
|
#13 : If List.Picked <> List.ListMax Then Begin
|
||||||
|
GroupFile.Seek (List.Picked - 1);
|
||||||
|
GroupFile.Read (Group);
|
||||||
|
|
||||||
|
EditGroup(Group);
|
||||||
|
|
||||||
|
GroupFile.Seek (List.Picked - 1);
|
||||||
|
GroupFile.Write (Group);
|
||||||
|
End;
|
||||||
|
#27 : Break;
|
||||||
|
End;
|
||||||
|
Until False;
|
||||||
|
|
||||||
|
Box.Close;
|
||||||
|
|
||||||
|
GroupFile.Free;
|
||||||
|
List.Free;
|
||||||
|
Box.Free;
|
||||||
End;
|
End;
|
||||||
|
|
||||||
End.
|
End.
|
||||||
|
|
|
@ -122,7 +122,6 @@ Var
|
||||||
'T' : Lang_Editor;
|
'T' : Lang_Editor;
|
||||||
'B' : Message_Base_Editor;
|
'B' : Message_Base_Editor;
|
||||||
'G',
|
'G',
|
||||||
'R' : Group_Editor;
|
|
||||||
'S' : Levels_Editor;
|
'S' : Levels_Editor;
|
||||||
'E' : Event_Editor;
|
'E' : Event_Editor;
|
||||||
'V' : Vote_Editor;
|
'V' : Vote_Editor;
|
||||||
|
@ -279,13 +278,13 @@ Begin
|
||||||
Case Res of
|
Case Res of
|
||||||
'A' : Configuration_ArchiveEditor;
|
'A' : Configuration_ArchiveEditor;
|
||||||
'F' : Configuration_FileBaseEditor;
|
'F' : Configuration_FileBaseEditor;
|
||||||
|
'G' : Configuration_GroupEditor(True);
|
||||||
'P' : Configuration_ProtocolEditor;
|
'P' : Configuration_ProtocolEditor;
|
||||||
|
'R' : Configuration_GroupEditor(False);
|
||||||
'U',
|
'U',
|
||||||
'M',
|
'M',
|
||||||
'T',
|
'T',
|
||||||
'B',
|
'B',
|
||||||
'G',
|
|
||||||
'R',
|
|
||||||
'S',
|
'S',
|
||||||
'E',
|
'E',
|
||||||
'V' : ExecuteOldConfiguration(Res);
|
'V' : ExecuteOldConfiguration(Res);
|
||||||
|
|
|
@ -98,7 +98,7 @@ Begin
|
||||||
WriteXY (15, 7, 112, 'Active OSID Batch Key Description');
|
WriteXY (15, 7, 112, 'Active OSID Batch Key Description');
|
||||||
WriteXY (15, 8, 112, strRep('Ä', 51));
|
WriteXY (15, 8, 112, strRep('Ä', 51));
|
||||||
WriteXY (15, 18, 112, strRep('Ä', 51));
|
WriteXY (15, 18, 112, strRep('Ä', 51));
|
||||||
WriteXY (29, 19, 112, 'Press / for command list');
|
WriteXY (29, 19, 112, cfgCommandList);
|
||||||
|
|
||||||
Repeat
|
Repeat
|
||||||
MakeList;
|
MakeList;
|
||||||
|
|
|
@ -318,7 +318,7 @@ Begin
|
||||||
'A' : Configuration_ExecuteEditor('A');
|
'A' : Configuration_ExecuteEditor('A');
|
||||||
'E' : Event_Editor;
|
'E' : Event_Editor;
|
||||||
'F' : Configuration_ExecuteEditor('F');
|
'F' : Configuration_ExecuteEditor('F');
|
||||||
'G' : Group_Editor;
|
'G' : Configuration_ExecuteEditor('G');
|
||||||
'L' : Levels_Editor;
|
'L' : Levels_Editor;
|
||||||
'M' : Message_Base_Editor;
|
'M' : Message_Base_Editor;
|
||||||
'P' : Configuration_ExecuteEditor('P');
|
'P' : Configuration_ExecuteEditor('P');
|
||||||
|
|
Loading…
Reference in New Issue