2012-03-17 11:11:50 -07:00
Unit bbs_Cfg_UserEdit;
2012-02-13 16:50:48 -08:00
Interface
Uses
2012-03-17 11:11:50 -07:00
bbs_Common;
2012-02-13 16:50:48 -08:00
2012-03-17 11:11:50 -07:00
Procedure Configuration_EditUser ( Var U: RecUser) ;
Procedure Configuration_UserEditor;
Procedure Configuration_LocalUserEdit;
2012-02-13 16:50:48 -08:00
Implementation
Uses
2012-03-17 11:11:50 -07:00
m_Types,
m_Strings,
m_DateTime,
m_FileIO,
bbs_Ansi_MenuBox,
bbs_Ansi_MenuForm,
bbs_io,
bbs_Core,
bbs_General,
bbs_Cfg_SecLevel;
Procedure Configuration_EditUser ( Var U: RecUser) ;
Var
Box : TAnsiMenuBox;
Form : TAnsiMenuForm;
BoxImage : TConsoleImageRec;
PagePos : Byte = 1 ;
Topic : String ;
Changed : Boolean = False ;
NeedForm : Boolean = False ;
Procedure UpdatePage ( Restore: Boolean ) ;
Begin
If Restore Then Session. io. RemoteRestore( BoxImage) ;
VerticalLine ( 2 1 , 6 , 2 0 ) ;
WriteXY ( 6 2 , 6 , 1 1 2 , 'Information' ) ;
WriteXY ( 6 3 , 7 , 1 1 2 , 'Settings 1' ) ;
WriteXY ( 6 3 , 8 , 1 1 2 , 'Settings 2' ) ;
WriteXY ( 6 3 , 9 , 1 1 2 , 'Statistics' ) ;
WriteXY ( 6 0 , 1 0 , 1 1 2 , 'Optional Data' ) ;
WriteXY ( 6 8 , 1 1 , 1 1 2 , 'Flags' ) ;
WriteXY ( 5 9 , 1 3 , 1 2 0 , 'CTRL-U/Upgrade' ) ;
WriteXY ( 6 5 , 2 0 , 1 1 2 , 'Page ' + strI2S( PagePos) + '/6' ) ;
Case PagePos of
1 : WriteXY ( 6 2 , 6 , 1 2 7 , 'INFORMATION' ) ;
2 : WriteXY ( 6 3 , 7 , 1 2 7 , 'SETTINGS 1' ) ;
3 : WriteXY ( 6 3 , 8 , 1 2 7 , 'SETTINGS 2' ) ;
4 : WriteXY ( 6 3 , 9 , 1 2 7 , 'STATISTICS' ) ;
5 : WriteXY ( 6 0 , 1 0 , 1 2 7 , 'OPTIONAL DATA' ) ;
6 : WriteXY ( 6 8 , 1 1 , 1 2 7 , 'FLAGS' ) ;
End ;
NeedForm : = True ;
End ;
2012-02-13 16:50:48 -08:00
Var
2012-03-17 11:11:50 -07:00
Birthdate : String [ 8 ] ;
FirstCall : String [ 8 ] ;
LastCall : String [ 8 ] ;
Temp : Integer ;
SavedUser : RecUser;
2012-02-13 16:50:48 -08:00
Begin
2012-03-17 11:11:50 -07:00
Topic : = '|03(|09User Editor|03) |01-|09> |15' ;
SavedUser : = U;
2012-02-13 16:50:48 -08:00
2012-03-17 11:11:50 -07:00
Box : = TAnsiMenuBox. Create;
Form : = TAnsiMenuForm. Create;
2012-02-13 16:50:48 -08:00
2012-03-17 11:11:50 -07:00
Box. Header : = ' ' + U. Handle + ' (ID ' + strI2S( U. PermIdx) + ') ' ;
Form. LoExitChars : = #21 ;
Form. HiExitChars : = #71 #73 #79 #81 ;
2012-02-13 16:50:48 -08:00
2012-03-17 11:11:50 -07:00
Box. Open ( 6 , 5 , 7 4 , 2 1 ) ;
2012-02-13 16:50:48 -08:00
2012-03-17 11:11:50 -07:00
Screen. GetScreenImage ( 6 , 5 , 7 4 , 2 1 , BoxImage) ;
2012-02-13 16:50:48 -08:00
2012-03-17 11:11:50 -07:00
Birthdate : = DateJulian2Str( U. Birthday, 1 ) ;
FirstCall : = DateDos2Str( U. FirstOn, 1 ) ;
LastCall : = DateDos2Str( U. LastOn, 1 ) ;
2012-02-13 16:50:48 -08:00
2012-03-17 11:11:50 -07:00
UpdatePage( False ) ;
2012-02-13 16:50:48 -08:00
Repeat
2012-03-17 11:11:50 -07:00
Form. ExitOnFirst : = True ;
Form. ExitOnLast : = True ;
Case PagePos of
1 : Form. ExitOnFirst : = False ;
6 : Form. ExitOnLast : = False ;
End ;
If NeedForm Then
Case PagePos of
1 : Begin
WriteXY ( 8 , 1 9 , 1 1 2 , 'Caller ID' ) ;
2012-03-17 14:16:00 -07:00
WriteXY ( 2 3 , 1 9 , 1 1 3 , U. PeerHost) ;
WriteXY ( 2 3 , 2 0 , 1 1 3 , U. PeerIP) ;
2012-03-17 11:11:50 -07:00
Form. Clear;
Form. AddStr ( 'H' , ' Handle' , 7 , 6 , 2 3 , 6 , 1 4 , 3 0 , 3 0 , @ U. Handle, Topic + 'User' 's account handle' ) ;
Form. AddStr ( 'R' , ' Real Name' , 7 , 7 , 2 3 , 7 , 1 4 , 3 0 , 3 0 , @ U. RealName, Topic + 'User' 's real name' ) ;
Form. AddPass ( 'W' , ' Password' , 7 , 8 , 2 3 , 8 , 1 4 , 2 0 , 2 0 , @ U. Password, Topic + 'User' 's password' ) ;
Form. AddStr ( 'A' , ' Address' , 7 , 9 , 2 3 , 9 , 1 4 , 3 0 , 3 0 , @ U. Address, Topic + 'User' 's street address' ) ;
Form. AddStr ( 'C' , ' City' , 7 , 1 0 , 2 3 , 1 0 , 1 4 , 2 5 , 2 5 , @ U. City, Topic + 'User' 's city and state' ) ;
Form. AddStr ( 'Z' , ' Zip Code' , 7 , 1 1 , 2 3 , 1 1 , 1 4 , 1 0 , 1 0 , @ U. ZipCode, Topic + 'User' 's postal code' ) ;
Form. AddStr ( 'P' , ' Home Phone' , 7 , 1 2 , 2 3 , 1 2 , 1 4 , 1 5 , 1 5 , @ U. HomePhone, Topic + 'User' 's home phone number' ) ;
Form. AddStr ( 'O' , ' Data Phone' , 7 , 1 3 , 2 3 , 1 3 , 1 4 , 1 5 , 1 5 , @ U. DataPhone, Topic + 'User' 's data phone number' ) ;
Form. AddStr ( 'E' , ' E-Mail' , 7 , 1 4 , 2 3 , 1 4 , 1 4 , 4 0 , 4 0 , @ U. Email, Topic + 'User' 's email address' ) ;
Form. AddStr ( 'U' , ' User Note' , 7 , 1 5 , 2 3 , 1 5 , 1 4 , 4 0 , 4 0 , @ U. UserInfo, Topic + 'User' 's user note' ) ;
Form. AddChar ( 'G' , ' Gender' , 7 , 1 6 , 2 3 , 1 6 , 1 4 , 3 2 , 2 5 4 , @ U. Gender, Topic + 'User' 's gender. M/Male, F/Female' ) ;
Form. AddDate ( 'B' , ' Birthdate' , 7 , 1 7 , 2 3 , 1 7 , 1 4 , @ Birthdate, Topic + 'User' 's birthdate (MM/DD/YY)' ) ;
End ;
2 : Begin
Form. Clear;
Form. AddByte ( 'S' , ' Security' , 7 , 6 , 2 3 , 6 , 1 4 , 3 , 0 , 2 5 5 , @ U. Security, Topic + 'User' 's security level' ) ;
Form. AddFlag ( '1' , ' Flags #1' , 7 , 7 , 2 3 , 7 , 1 4 , @ U. AF1, Topic + 'User' 's access flags: Set 1' ) ;
Form. AddFlag ( '2' , ' Flags #2' , 7 , 8 , 2 3 , 8 , 1 4 , @ U. AF2, Topic + 'User' 's access flags: Set 2' ) ;
Form. AddWord ( 'T' , ' Time Left' , 7 , 9 , 2 3 , 9 , 1 4 , 1 0 , 0 , 1 4 4 0 , @ U. TimeLeft, Topic + 'Total number of minutes left for today' ) ;
Form. AddWord ( 'I' , ' Time Bank' , 7 , 1 0 , 2 3 , 1 0 , 1 4 , 5 , 0 , 6 5 0 0 0 , @ U. TimeBank, Topic + 'Total minutes in time bank' ) ;
Form. AddDate ( 'X' , ' Expires' , 7 , 1 1 , 2 3 , 1 1 , 1 4 , @ U. Expires, Topic + 'User' 's account expiration date (00/00/00: Disabled)' ) ;
Form. AddByte ( 'O' , ' To' , 7 , 1 2 , 2 3 , 1 2 , 1 4 , 3 , 0 , 2 5 5 , @ U. ExpiresTo, Topic + 'Security profile to give user after expiration' ) ;
Form. AddStr ( 'T' , ' Theme' , 7 , 1 3 , 2 3 , 1 3 , 1 4 , 2 0 , 2 0 , @ U. Theme, Topic + 'Filename of user' 's theme' ) ;
Form. AddStr ( 'A' , ' Start Menu' , 7 , 1 4 , 2 3 , 1 4 , 1 4 , 2 0 , 2 0 , @ U. StartMenu, Topic + 'User is sent to this menu after logging in' ) ;
Form. AddStr ( 'V' , ' Archive' , 7 , 1 5 , 2 3 , 1 5 , 1 4 , 4 , 4 , @ U. Archive, Topic + 'User' 's archive type extension' ) ;
Form. AddChar ( 'P' , ' Protocol' , 7 , 1 6 , 2 3 , 1 6 , 1 4 , 3 2 , 2 5 4 , @ U. Protocol, Topic + 'Default protocol hotkey' ) ;
Form. AddByte ( 'C' , ' Screensize' , 7 , 1 7 , 2 3 , 1 7 , 1 4 , 2 , 0 , 5 0 , @ U. ScreenSize, Topic + 'User' 's terminal size in lines' ) ;
Form. AddBol ( 'K' , ' Hot Keys' , 7 , 1 8 , 2 3 , 1 8 , 1 4 , 3 , @ U. HotKeys, Topic + 'User' 's hotkey input status' ) ;
Form. AddBol ( 'U' , ' Auto-Sig' , 7 , 1 9 , 2 3 , 1 9 , 1 4 , 3 , @ U. SigUse, Topic + 'Use auto signature?' ) ;
Form. AddBol ( 'Q' , ' QWK Files' , 7 , 2 0 , 2 3 , 2 0 , 1 4 , 3 , @ U. QwkFiles, Topic + 'New files in QWK?' ) ;
End ;
3 : Begin
Form. Clear;
Form. AddTog ( 'D' , ' Date Format' , 7 , 6 , 2 3 , 6 , 1 4 , 8 , 1 , 3 , 'MM/DD/YY DD/MM/YY YY/MM/DD' , @ U. DateType, Topic + 'User' 's date format' ) ;
2012-06-30 14:48:37 -07:00
Form. AddTog ( 'E' , ' FS Editor' , 7 , 7 , 2 3 , 7 , 1 4 , 4 , 0 , 1 , 'Line Full' , @ U. EditType, Topic + 'User' 's full screen editor setting' ) ;
2012-03-17 11:11:50 -07:00
Form. AddBol ( 'Q' , ' Quote Window' , 7 , 8 , 2 3 , 8 , 1 4 , 3 , @ U. UseLBQuote, Topic + 'User' 's FS editor quote window status' ) ;
Form. AddTog ( 'F' , ' File Listing' , 7 , 9 , 2 3 , 9 , 1 4 , 8 , 0 , 1 , 'Standard Full' , @ U. FileList, Topic + 'User' 's file listing type' ) ;
Form. AddTog ( 'M' , ' Msg Reader' , 7 , 1 0 , 2 3 , 1 0 , 1 4 , 8 , 0 , 1 , 'Standard Full' , @ U. MReadType, Topic + 'Full screen message reader status' ) ;
Form. AddBol ( 'X' , ' Msg Index' , 7 , 1 1 , 2 3 , 1 1 , 1 4 , 3 , @ U. UseLBIndex, Topic + 'Start reading at message index' ) ;
Form. AddBol ( 'I' , ' Mail Index' , 7 , 1 2 , 2 3 , 1 2 , 1 4 , 3 , @ U. UseLBMIdx, Topic + 'Start reading email at message index' ) ;
Form. AddTog ( 'N' , ' Node Chat' , 7 , 1 3 , 2 3 , 1 3 , 1 4 , 8 , 0 , 1 , 'Standard Full' , @ U. UseFullChat, Topic + 'User' 's node chat type' ) ;
End ;
4 : Begin
Form. Clear;
Form. AddDate ( 'F' , ' First Call' , 7 , 6 , 2 3 , 6 , 1 4 , @ FirstCall, Topic + 'Date of first call (MM/DD/YY)' ) ;
Form. AddDate ( 'A' , ' Last Call' , 7 , 7 , 2 3 , 7 , 1 4 , @ LastCall, Topic + 'Date of last call (MM/DD/YY)' ) ;
Form. AddLong ( 'C' , ' Calls' , 7 , 8 , 2 3 , 8 , 1 4 , 7 , 0 , 9 9 9 9 9 9 9 , @ U. Calls, Topic + 'Total number of calls to the BBS' ) ;
Form. AddWord ( 'L' , ' Calls Today' , 7 , 9 , 2 3 , 9 , 1 4 , 5 , 0 , 6 5 0 0 0 , @ U. CallsToday, Topic + 'Total number of calls today' ) ;
Form. AddLong ( 'D' , ' Downloads' , 7 , 1 0 , 2 3 , 1 0 , 1 4 , 7 , 0 , 9 9 9 9 9 9 9 , @ U. DLs, Topic + 'Total number of downloads' ) ;
Form. AddWord ( 'T' , ' DLs Today' , 7 , 1 1 , 2 3 , 1 1 , 1 4 , 5 , 0 , 6 5 0 0 0 , @ U. DLsToday, Topic + 'Total downloads today' ) ;
Form. AddLong ( 'W' , ' DL KB' , 7 , 1 2 , 2 3 , 1 2 , 1 4 , 1 0 , 0 , 2 0 0 0 0 0 0 0 0 0 , @ U. DLk, Topic + 'Total downloads in kilobytes' ) ;
Form. AddLong ( 'K' , ' DL KB Today' , 7 , 1 3 , 2 3 , 1 3 , 1 4 , 1 0 , 0 , 2 0 0 0 0 0 0 0 0 0 , @ U. DLkToday, Topic + 'Downloads in kilobytes today' ) ;
Form. AddLong ( 'U' , ' Uploads' , 7 , 1 4 , 2 3 , 1 4 , 1 4 , 1 0 , 0 , 2 0 0 0 0 0 0 0 0 0 , @ U. ULs, Topic + 'Total number of uploads' ) ;
Form. AddLong ( 'B' , ' Upload KB' , 7 , 1 5 , 2 3 , 1 5 , 1 4 , 1 0 , 0 , 2 0 0 0 0 0 0 0 0 0 , @ U. ULk, Topic + 'Total uploads in kilobytes' ) ;
Form. AddLong ( 'M' , ' Msg Posts' , 7 , 1 6 , 2 3 , 1 6 , 1 4 , 1 0 , 0 , 2 0 0 0 0 0 0 0 0 0 , @ U. Posts, Topic + 'Total number of message posts' ) ;
Form. AddWord ( 'E' , ' E-Mails' , 7 , 1 7 , 2 3 , 1 7 , 1 4 , 5 , 0 , 6 5 0 0 0 , @ U. Emails, Topic + 'Number of e-mails sent' ) ;
Form. AddLong ( 'I' , ' File Ratings' , 7 , 1 8 , 2 3 , 1 8 , 1 4 , 1 0 , 0 , 2 0 0 0 0 0 0 0 0 0 , @ U. FileRatings, Topic + 'Total file ratings' ) ;
Form. AddLong ( 'N' , ' File Comments' , 7 , 1 9 , 2 3 , 1 9 , 1 4 , 1 0 , 0 , 2 0 0 0 0 0 0 0 0 0 , @ U. FileComment, Topic + 'Total file comments' ) ;
Form. AddDate ( 'P' , ' Last PW Date' , 7 , 2 0 , 2 3 , 2 0 , 1 4 , @ U. LastPWChange, Topic + 'Date of last password change' ) ;
End ;
5 : Begin
Form. Clear;
For Temp : = 1 to 9 Do
Form. AddStr ( strI2S( Temp) [ 1 ] , ' ' + Config. OptionalField[ Temp] . Desc, 7 , 5 + Temp, 2 3 , 5 + Temp, 1 4 , 3 3 , 6 0 , @ U. OptionData[ Temp] , Topic + 'User optional field #' + strI2S( Temp) ) ;
Form. AddStr ( '0' , ' ' + Config. OptionalField[ 1 0 ] . Desc, 7 , 1 5 , 2 3 , 1 5 , 1 4 , 3 3 , 6 0 , @ U. OptionData[ 1 0 ] , Topic + 'User optional field #10' ) ;
End ;
6 : Begin
Form. Clear;
Form. AddBits ( 'D' , ' Deleted' , 7 , 6 , 2 3 , 6 , 1 4 , UserDeleted, @ U. Flags, Topic + 'Is this account marked as deleted?' ) ;
Form. AddBits ( 'L' , ' Locked Out' , 7 , 7 , 2 3 , 7 , 1 4 , UserLockedOut, @ U. Flags, Topic + 'Is this account locked out of the system?' ) ;
Form. AddBits ( 'N' , ' No Ratios' , 7 , 8 , 2 3 , 8 , 1 4 , UserNoRatio, @ U. Flags, Topic + 'Ignore file ratios?' ) ;
End ;
End ;
NeedForm : = False ;
If Form. WasFirstExit Then Form. ItemPos : = Form. Items;
If Form. WasLastExit Then Form. ItemPos : = 1 ;
Case Form. Execute of
#21 : Begin
Temp : = Configuration_SecurityEditor( False ) ;
If Temp < > - 1 Then Begin
Changed : = True ;
Upgrade_User_Level( True , U, Temp) ;
2012-02-13 16:50:48 -08:00
End ;
2012-03-17 11:11:50 -07:00
End ;
#27 : Begin
Changed : = Changed or Form. Changed;
Break;
End ;
#71 : If PagePos < > 1 Then Begin
PagePos : = 1 ;
UpdatePage( True ) ;
End ;
#72 ,
#73 : If PagePos > 1 Then Begin
Dec( PagePos) ;
UpdatePage( True ) ;
End ;
#79 : If PagePos < > 6 Then Begin
PagePos : = 6 ;
UpdatePage( True ) ;
End ;
#80 ,
#81 : If PagePos < 6 Then Begin
Inc ( PagePos) ;
UpdatePage( True ) ;
2012-03-17 14:16:00 -07:00
End Else
Form. ItemPos : = Form. Items;
2012-03-17 11:11:50 -07:00
End ;
Changed : = Changed or Form. Changed;
Until False ;
2012-02-13 16:50:48 -08:00
2012-03-17 11:11:50 -07:00
U. Birthday : = DateStr2Julian( Birthdate) ;
U. FirstOn : = DateStr2Dos( FirstCall) ;
U. LastOn : = DateStr2Dos( LastCall) ;
Box. Close;
Box. Free;
Form. Free;
If Changed Then
If Not ShowMsgBox( 1 , 'Save changes?' ) Then
U : = SavedUser;
End ;
Procedure Configuration_UserEditor;
Var
Box : TAnsiMenuBox;
List : TAnsiMenuList;
UserFile : TBufFile;
User : RecUser;
2012-02-13 16:50:48 -08:00
2012-03-17 11:11:50 -07:00
Procedure MakeList;
Begin
List. Clear;
2012-02-13 16:50:48 -08:00
2012-03-17 11:11:50 -07:00
UserFile. Reset;
2012-02-13 16:50:48 -08:00
2012-03-17 11:11:50 -07:00
While Not UserFile. EOF Do Begin
UserFile. Read ( User) ;
2012-02-13 16:50:48 -08:00
2012-03-17 11:11:50 -07:00
If User. Flags AND UserDeleted < > 0 Then
List. Add ( strPadR( User. Handle, 3 7 , ' ' ) + 'DELETED' , 0 )
Else
List. Add ( strPadR( User. Handle, 3 2 , ' ' ) +
strPadL( strI2S( User. Security) , 5 , ' ' ) +
strPadL( strI2S( User. PermIdx) , 1 0 , ' ' ) , 0 ) ;
End ;
End ;
2012-02-13 16:50:48 -08:00
2012-03-17 11:11:50 -07:00
Begin
UserFile : = TBufFile. Create( 8 1 9 2 ) ;
If Not UserFile. Open( Config. DataPath + 'users.dat' , fmOpenCreate, fmRWDN, SizeOf( RecUser) ) Then Begin
UserFile. Free;
Exit;
End ;
Box : = TAnsiMenuBox. Create;
List : = TAnsiMenuList. Create;
List. NoWindow : = True ;
List. LoChars : = #13 #27 ;
Box. Header : = ' User Editor ' ;
Box. Open ( 1 5 , 5 , 6 5 , 2 1 ) ;
WriteXY ( 1 7 , 7 , 1 1 2 , 'User Name Level UserID' ) ;
WriteXY ( 1 6 , 8 , 1 1 2 , strRep( #196 , 4 9 ) ) ;
Repeat
MakeList;
List. Open ( 1 5 , 8 , 6 5 , 2 1 ) ;
List. Close;
Case List. ExitCode of
#13 : Begin
UserFile. Seek ( List. Picked - 1 ) ;
UserFile. Read ( User) ;
Configuration_EditUser( User) ;
UserFile. Seek ( List. Picked - 1 ) ;
UserFile. Write ( User) ;
2012-02-13 16:50:48 -08:00
End ;
2012-03-17 11:11:50 -07:00
#27 : Break;
End ;
Until False ;
Box. Close;
UserFile. Free;
List. Free;
Box. Free;
End ;
Procedure Configuration_LocalUserEdit;
Var
SavedLocal : Boolean ;
Begin
SavedLocal : = Session. LocalMode;
Session. InUserEdit : = True ;
Session. LocalMode : = True ;
2012-02-13 16:50:48 -08:00
2012-03-17 11:11:50 -07:00
Configuration_EditUser ( Session. User. ThisUser) ;
2012-02-13 16:50:48 -08:00
Session. InUserEdit : = False ;
2012-03-17 11:11:50 -07:00
Session. LocalMode : = SavedLocal;
2012-02-13 16:50:48 -08:00
End ;
End .