const Copyright = "EvalFile v2.0 (C) 1995 David Wallace Croft" // Assumes no two users have same name (UserID_From_UserName) REM '$include "C:\App\Comm\WC\Code\WC_Subs.WCC" '$include "C:\App\Comm\WC\Code\Log_Scan\Log_Scan.WCC" REM ------------------------------------------------------------------ REM -- Does not notice download after activity log scanned until REM -- user logs out. REM -- Only scans node 1 activity log. REM ------------------------------------------------------------------ const Mail_Conference = 0 const Bias_Count = 30 const Initial_Cost = 1 const Days_Per_Cent = 30 const Max_Increase = 1 const Max_Decrease = 1 const EvalFile_Dir = "EVALFILE" const FileData_Dir = "FILEDATA" const Eval_Dir = TrdParty + "\" + EvalFile_Dir + "\" + FileData_Dir const AllFiles_Txt = "ALLFILES.TXT" const EvalFile_Tmp = "EVALFILE.TMP" const EvalFile_Tm1 = "EVALFILE.TM1" const Scanning_Flag = "EvalFile: activity log scanned" declare sub Costs_Update declare function Download_Get ( \ Paid as integer, \ FileRec as FileRecord, \ byval File_Name as string ) \ as boolean declare function Download_Strip ( \ byval File_Name as string ) \ as boolean declare function Eval_Rec_Get ( \ Rating as real, \ Count as long, \ byval File_Name as string, \ byval Bias as long ) \ as boolean declare sub Eval_Rec_Put ( \ byval File_Name as string, \ byval Eval as string ) declare sub Evaluate_Files ( \ Unevaluated as string ) declare sub Event_Mode declare function Find_Unevaluated as string declare sub Marked_Files_Ratings declare sub Menu_File_Records declare sub Menu_Maintenance declare sub Menu_SysOp declare sub Menu_Uploader declare sub Message_Send_Uploader ( \ User_Name as string, \ Cost as integer, \ File_Name as string ) rem declare sub Message_Send_Downloader ( \ rem User_Name as string, \ rem File_List_File as string ) declare function Reward_Evaluator \ as boolean declare function Reward_Uploader ( \ byval Uploader as string, \ byval Cost as integer, \ byval File_Name as string ) \ as boolean declare sub Sort_All_Files declare sub User_Mode sub Costs_Update REM ------------------------------------------------------------------ dim FileRec as FileRecord dim Days as long dim New_Cost as integer REM ------------------------------------------------------------------ ? "Updating file costs..." if GetFileInfo ( FileRec, "" ) then do ? Pad ( FileRec.Name, 12 ); " "; FileRec.Cost; " "; if not File_Is_Free ( FileRec ) then Days = Days_Since ( FileRec.FileTime ) if Days > 0 then New_Cost = Days_Per_Cent * FileRec.Downloads / Days if New_Cost > FileRec.Cost + Max_Increase then FileRec.Cost = FileRec.Cost + Max_Increase elseif New_Cost < FileRec.Cost - Max_Decrease then FileRec.Cost = FileRec.Cost - Max_Decrease else FileRec.Cost = New_Cost end if if UpdateFile ( FileRec ) then ? FileRec.Cost else ? "unchanged due to error in UpdateFile" end if else ? "unchanged since less than a day has passed" end if else ? "unchanged since marked as free file" end if if not GetNextFile ( FileRec ) then exit do end if loop end if end sub function Download_Get ( \ Paid as integer, \ FileRec as FileRecord, \ byval File_Name as string ) \ as boolean ////////////////////////////////////////////////////////////////////// dim File_Num as integer dim Line as string dim User_Data_File as string dim Paid_Real as real ////////////////////////////////////////////////////////////////////// File_Name = UCase ( Trim ( File_Name ) ) Download_Get = false if GetFileInfo ( FileRec, File_Name ) then User_Data_File = UserData_Dir ( User.UserID, User.Name ) \ + Download_Txt if Exists ( User_Data_File ) then File_Num = FreeFile open ( User_Data_File ) for input as File_Num do while not EOF ( File_Num ) input #File_Num, Line Line = UCase ( Line ) if Trim ( Left ( Line, 12 ) ) = File_Name then Download_Get = true if ( Len ( Line ) >= 20 ) \ and StrToReal ( Mid ( Line, 15, 6 ), Paid_Real ) then Paid = Paid_Real * 100 else Paid = 0 end if exit do end if loop close ( File_Num ) end if end if end function function Download_Strip ( \ byval File_Name as string ) \ as boolean ////////////////////////////////////////////////////////////////////// dim User_Data_File as string dim File_Num_Old, File_Num_New as integer dim Line as string ////////////////////////////////////////////////////////////////////// File_Name = UCase ( Trim ( File_Name ) ) User_Data_File = UserData_Dir ( User.UserID, User.Name ) \ + Download_Txt Download_Strip = false if not Exists ( User_Data_File ) then exit function end if File_Num_Old = FreeFile open User_Data_File for input as File_Num_Old File_Num_New = FreeFile open WorkFile_Tmp for output as File_Num_New do while not EOF ( File_Num_Old ) input #File_Num_Old, Line Line = UCase ( Line ) if Trim ( Left ( Line, 12 ) ) <> File_Name then print #File_Num_New, Line end if loop close ( File_Num_New ) close ( File_Num_Old ) CopyFile ( WorkFile_Tmp, User_Data_File ) Del ( WorkFile_Tmp ) Download_Strip = true end function function Eval_Rec_Get ( \ Rating as real, \ Count as long, \ byval File_Name as string, \ byval Bias as long ) \ as boolean ////////////////////////////////////////////////////////////////////// dim File_Num as integer dim Eval_ASC as byte dim Eval as string*1 dim Sum as long ////////////////////////////////////////////////////////////////////// Eval_Rec_Get = false Rating = 1.0 Count = 0 if not Exists ( Eval_Dir + "\" + File_Name ) then exit function end if Sum = 0 File_Num = FreeFile open Eval_Dir + "\" + File_Name for binary as File_Num do while not EOF ( File_Num ) get #File_Num, , Eval_ASC Eval = Chr ( Eval_ASC ) Eval = UCase ( Eval ) if Eval = "Y" then Sum = Sum + 1 Count = Count + 1 elseif Eval = "N" then Count = Count + 1 end if loop close ( File_Num ) if Count < Bias then Rating = ( Sum + Bias - Count ) / Bias elseif Count > 0 then Rating = Sum / Count else Rating = 1.0 end if Eval_Rec_Get = true end function sub Eval_Rec_Put ( \ byval File_Name as string, \ byval Eval as string ) ////////////////////////////////////////////////////////////////////// dim File_Num as integer dim Eval_ASC as byte ////////////////////////////////////////////////////////////////////// if not Dir_Exists ( Eval_Dir ) then if not Dir_Exists ( TrdParty ) then ? "Making subdirectory "; TrdParty; "..."; MkDir ( TrdParty ) ? "done." end if if not Dir_Exists ( TrdParty + "\" + EvalFile_Dir ) then ? "Making subdirectory "; TrdParty + "\" + EvalFile_Dir; "..."; MkDir ( TrdParty + "\" + EvalFile_Dir ) ? "done." end if if not Dir_Exists ( Eval_Dir ) then ? "Making subdirectory "; Eval_Dir; "..."; MkDir ( Eval_Dir ) ? "done." end if end if File_Num = FreeFile open Eval_Dir + "\" + File_Name for binary as File_Num Eval_ASC = ASC ( UCase ( Eval ) ) put #File_Num, LOF ( File_Num ) + 1, Eval_ASC close #File_Num end sub sub Evaluate_Files ( Unevaluated as string ) REM ------------------------------------------------------------------ dim File_Name as string dim FileRec as FileRecord dim Uploader as string dim Paid as integer dim Eval as string REM if Unevaluated = "" then ? "Please enter the name of the downloaded file [ENTER=Abort]: "; input File_Name if Trim ( File_Name ) = "" then exit sub end if else ? "Please enter the name of the downloaded file ["; ? Unevaluated; "]: "; input File_Name if File_Name = "" then File_Name = Unevaluated Unevaluated = "" end if end if File_Name = UCase ( File_Name ) if not Download_Get ( Paid, FileRec, File_Name ) then ? ? "Unable to find download record of "; File_Name; "." ? ? "Possible reasons include:" ? "(1) your download has not been recorded yet (try again tomorrow)," ? "(2) you have not downloaded that file," ? "(3) you already evaluated that file," ? "(4) the file has been deleted from the BBS," ? "(5) your download records have been deleted." WaitEnter exit sub end if ? ? FileRec.Name ? ? Mid ( FileRec.Description, 1, 70 ) ? if InputYesNo ( "Did you find this file worth downloading (y/N)? ", false ) then Eval = "Y" else Eval = "N" end if if not Download_Strip ( File_Name ) then ? "Error: unable to update personal download record." WaitEnter end if Eval_Rec_Put ( File_Name, Eval ) ? "Thank you for your evaluation, "; Trim ( User.Name ); "." if Reward_Evaluator then ? "Your download count has been reduced by one." end if if Eval = "Y" then ? "Our thanks to the uploader, "; Trim ( FileRec.Uploader ); "!" if Paid > 0 then Uploader = FileRec.Uploader if Reward_Uploader ( Uploader, Paid, File_Name ) then ? Trim ( FileRec.Uploader ); " has been awarded "; ? Paid; " credits." end if end if if UCase ( Mid ( FileRec.Description, 1, 14 ) ) = "NO DESCRIPTION" then ? ? "The uploader of this file did not give it a short description." ? "You may become the uploader of this file by giving it one." ? "You would then be entitled to any subsequent uploader credits." ? if InputYesNo ( \ "Would you like to give this file a short description (y/N)? ", \ false ) then do ? "Please enter a one-line description for this file [ENTER=Abort]." input FileRec.Description if FileRec.Description = "" then exit do end if FileRec.Description = Mid ( FileRec.Description, 1, 70 ) ? ? FileRec.Description loop until \ InputYesNo ( "Is this the way you want it to read (Y/n)? ", true ) if FileRec.Description <> "" then FileRec.Uploader = User.Name FileRec.UploaderID = User.UserID if not UpdateFile ( FileRec ) then Beep ? "Error: unable to update file description." WaitEnter end if end if end if end if end if WaitEnter end sub sub Event_Mode REM ------------------------------------------------------------------ MorePrompt Off Log_Scan.Start ( Registration, Copyright ) Costs_Update Sort_All_Files rem Assign_Ratings_To_Descriptions ? "Delaying 5 seconds before returning to the BBS..." delay 5 end sub function Find_Unevaluated as string REM ------------------------------------------------------------------ dim File_Found as boolean : File_Found = false dim Download_Usr as string dim File_Num_Download as integer dim File_Name as string*12 dim Line as string REM Find_Unevaluated = "" ? ? "Searching for your unevaluated downloaded files." ? "Press any key to stop searching." ? Download_Usr = UserData_Dir ( User.UserID, User.Name ) \ + Download_Txt if Exists ( Download_Usr ) then File_Num_Download = FreeFile open Download_Usr for input as File_Num_Download do while not EOF ( File_Num_Download ) input #File_Num_Download, Line if ( Len ( Line ) < 22 ) or ( Line ( 22 ) = " " ) then File_Name = UCase ( Trim ( Left ( Line, 12 ) ) ) Find_Unevaluated = File_Name File_Found = true ? ? File_Name ? if not InputYesNo ( "Continue search? (y/N): ", false ) then exit do end if else ? "."; end if if Inkey <> "" then ? if not InputYesNo ( "Continue search? (y/N): ", false ) then exit do end if ? end if loop close ( File_Num_Download ) end if ? ? ? "Search completed." if not File_Found then ? ? "No unevaluated downloaded files found." ? ? "Possible reasons: " ? "(1) the activity log has not been scanned for your downloads yet," ? "(2) the files have been deleted from the BBS," ? "(3) you have not downloaded any files yet," ? "(4) you have already evaluated your downloaded files." end if WaitEnter end function sub Marked_Files_Ratings ////////////////////////////////////////////////////////////////////// dim File_Index as integer dim File_Name as string*12 dim File_Area as integer dim FileRec as FileRecord dim Rating as real dim Count as long ////////////////////////////////////////////////////////////////////// if GetMarkedFiles = 0 then exit sub end if cls Color ( 2 ) ? Copyright ? Color ( 3 ) ? "You have marked the following files for download." Color ( 4 ) ? "You will have the opportunity to change this list before downloading." Color ( 5 ) ? "You will have $"; ? Trim ( FormatNumber ( User.SubscriptionBalance / 100, "###.##" ) ); ? " remaining in your account balance." ? Color ( 6 ) ? "File Name Rating Cost Count" ? "------------ ------- ------- -----" for File_Index = 1 to GetMarkedFiles File_Name = GetMarkFileName ( File_Index ) rem File_Area = GetMarkFileArea ( File_Area ) Color ( 9 ) Color ( 13 ) ? Pad ( File_Name, 14 ); if GetFileInfo ( FileRec, File_Name ) then Color ( 12 ) Eval_Rec_Get ( Rating, Count, File_Name, Bias_Count ) ? FormatNumber ( Rating, "#.#####" ); " "; if FileRec.Cost > 0 then Color ( 10 ) else Color ( 2 ) end if ? "$"; FormatNumber ( FileRec.Cost / 100, "@##.##" ); " "; Color ( 13 ) ? Count end if next File_Index WaitEnter end sub sub Message_Send_Uploader ( \ User_Name as string, Cost as integer, File_Name as string ) REM ------------------------------------------------------------------ dim MsgHeader as MessageHeader REM ------------------------------------------------------------------ MsgHeader.From = MakeWild.SysOpName MsgHeader.FromTitle = "EVALFILE" MsgHeader.To = User_Name MsgHeader.Subject = "EvalFile Uploader Reward" FlagSet ( MsgHeader.Flags, 1 ) if not AddMessage ( MsgHeader, \ "You received " + Dollars_Str ( Cost ) + \ " for the upload of " + File_Name + ".", \ "", Mail_Conference ) then Beep ? "Error in placing message in conference "; Mail_Conference; ? " for "; User_Name end if end sub sub Message_Send_Downloader ( \ User_Name as string, File_List_File as string ) REM ------------------------------------------------------------------ dim MsgHeader as MessageHeader REM ------------------------------------------------------------------ MsgHeader.From = MakeWild.SysOpName MsgHeader.FromTitle = "EVALFILE" MsgHeader.To = User_Name MsgHeader.Subject = "Please evaluate these files using File Menu option K" FlagSet ( MsgHeader.Flags, 1 ) if AddMessage ( MsgHeader, File_List_File, "", Mail_Conference ) then ? "Message placed in conference "; Mail_Conference; " for "; ? User_Name else Beep ? "Error in placing message in conference "; Mail_Conference; ? " for "; User_Name end if end sub sub Sort_All_Files REM ------------------------------------------------------------------ dim Counter as long const Total_Files = 1000 dim FileRec as FileRecord dim Rating as real dim Count as long type Rating_Rec_Type Name as string*12 Rating as string*7 Count as string*5 end type dim Rating_Rec as Rating_Rec_Type dim File_Name as string dim File_Area as long dim FileArea_Tmp as string dim FileArea_Txt as string dim Got_Next_File as boolean dim SrchRec as SearchRec dim FileAreaRec as FileAreaRecord dim AllFiles_Path as string dim AllFiles_Size as long dim Index as long dim FileRecNext as FileRecord dim AllFiles_DateTime as DateTime dim New_User_Sec_Profile as SecurityProfile dim NewUserSec_Found as boolean dim Sort_Str as string*15 REM if not GetSecProfile ( New_User_Sec_Profile, MakeWild.NewUserSec ) then ? "Warning: unable to fine security profile for "; ? MakeWild.NewUserSec; "!" ? "Delaying 10 seconds..." delay 10 NewUserSec_Found = false else NewUserSec_Found = true end if if GetFirstFile ( FileRecNext, 1 ) then open AllFiles_Txt for output as #3 ? #3, "" ? #3, "" ? #3, " "; AllFiles_Txt; " "; CurrentDateTime AllFiles_DateTime ? #3, FormatDate ( AllFiles_DateTime.D, "yyyy-mm-dd" ); " "; ? #3, FormatTime ( AllFiles_DateTime.T, "hh:mm" ); " "; ? #3, MakeWild.BBSName; " "; MakeWild.Phone ? #3, " Created by "; Copyright ? #3, "" ? #3, " Rating = user evaluation, 1.0 is great, 0.0 is poor." ? #3, " Count = number of user evaluations for this file." ? #3, " Cost = amount deducted from your account balance to download." ? #3, "" do Counter = 1 File_Area = FileRecNext.Area if GetFileArea ( FileAreaRec, File_Area ) then ? " ----------------------------------------------------------------------" ? " ----------------------------------------------------------------------" ? " "; FormatNumber ( File_Area, "@####" ); ": "; ? FileAreaRec.Name ? " ----------------------------------------------------------------------" ? " ----------------------------------------------------------------------" ? "" if New_User_Sec_Profile.AccessFileList ( File_Area ) or \ not NewUserSec_Found then ? #3, " ----------------------------------------------------------------------" ? #3, " ----------------------------------------------------------------------" ? #3, " "; FormatNumber ( File_Area, "@####" ); ": "; ? #3, FileAreaRec.Name ? #3, " ----------------------------------------------------------------------" ? #3, " ----------------------------------------------------------------------" ? #3, "" else ? "File Area "; File_Area; " not added to "; AllFiles_Txt; ? " since security profile" ? MakeWild.NewUserSec; " does not have file list access." end if else Beep ? "Error: unable to get file area name for"; File_Area; "!" end if SortStart FileArea_Tmp = "ALL" + \ FormatNumber ( File_Area, "@####" ) + ".TMP" ? "Creating temporary file "; FileArea_Tmp; "..." if Exists ( FileArea_Tmp ) then Del ( FileArea_Tmp ) end if Open FileArea_Tmp for random as #1 len = Len ( Rating_Rec_Type ) do Rating_Rec.Name = FileRecNext.Name Eval_Rec_Get ( Rating, Count, FileRecNext.Name, Bias_Count ) Rating_Rec.Rating = FormatNumber ( Rating, "#.#####" ) Rating_Rec.Count = FormatNumber ( Count, "@####" ) if Rating_Rec.Rating = "1.00000" then Sort_Str = "~~~~~" else Sort_Str = Right ( Rating_Rec.Rating, 5 ) end if Sort_Str = Sort_Str + Rating_Rec.Count \ + FormatNumber ( FileRec.Cost, "@####" ) ? Sort_Str SortAdd ( Sort_Str, Counter ) put #1, Counter, Rating_Rec Counter = Counter + 1 ? "."; Got_Next_File = GetNextFile ( FileRecNext, 1 ) if not Got_Next_File then exit do end if loop until FileRecNext.Area <> File_Area ? FileArea_Txt = "ALL" + \ FormatNumber ( File_Area, "@####" ) + ".TXT" ? "Creating file area sorted listing "; FileArea_Txt; "..." open FileArea_Txt for output as #2 do Counter = SortPrev if Counter > -1 then get #1, Counter, Rating_Rec ? #2, Rating_Rec.Name; " "; ? #2, Rating_Rec.Rating; " "; ? #2, Rating_Rec.Count; " " if New_User_Sec_Profile.AccessFileList ( File_Area ) or \ not NewUserSec_Found then if File_Record_Found ( FileRec, File_Area, Rating_Rec.Name ) then ? #3, " "; ? #3, Pad ( Rating_Rec.Name, 12 ); " "; ? #3, Rating_Rec.Rating; " "; ? #3, Rating_Rec.Count; " "; ? #3, LeftPad ( Dollars_Str ( FileRec.Cost ), 6 ); " "; ? #3, FileRec.Uploader ? #3, " "; Mid ( FileRec.Description, 1, 70 ) ? #3, "" else ? "Error: unable to get file info for "; Rating_Rec.Name; "!" end if end if end if loop until Counter < 0 Close ( 1 ) ? "Deleting temporary file "; FileArea_Tmp; "..." Del ( FileArea_Tmp ) Close ( 2 ) loop until not Got_Next_File Close ( 3 ) if FindFirst ( AllFiles_Txt, 0, SrchRec ) = 0 then AllFiles_Size = SrchRec.Size else ? "Error: unable to locate "; AllFiles_Txt; "!" AllFiles_Size = 0 end if if GetFileInfo ( FileRec, AllFiles_Txt ) then if File_Path_Found ( AllFiles_Path, FileRec ) then ? "Updating "; AllFiles_Txt; "..." if CopyFile ( AllFiles_Txt, AllFiles_Path + AllFiles_Txt ) then CurrentDateTime ( FileRec.FileTime ) FileRec.Size = AllFiles_Size if not UpdateFile ( FileRec ) then ? "Error: unable to update "; AllFiles_Txt; "!" end if else ? "Error: unable to copy "; AllFiles_Txt; " to "; \ AllFiles_Path + AllFiles_Txt + "!" end if else ? "Error: unable to find path for "; AllFiles_Txt; "." end if else ? "Adding "; AllFiles_Txt; " to File Area 1..." if GetFileArea ( FileAreaRec, 1 ) then if CopyFile ( AllFiles_Txt, FileAreaRec.Path + AllFiles_Txt ) then FileRec.Size = AllFiles_Size FileRec.Name = AllFiles_Txt FileRec.Password = "" CurrentDateTime ( FileRec.FileTime ) CurrentDateTime ( FileRec.LastAccess ) FileRec.Uploader = "EvalFile" FileRec.UploaderID = 0 FileRec.Description = "List of all files on this BBS sorted by EvalFile ratings" FileRec.Flags = 4 FileRec.Downloads = 0 FileRec.Cost = 0 FileRec.Area = 1 FileRec.KeyWords ( 1 ) = "LIST" FileRec.KeyWords ( 2 ) = "ALLFILES" FileRec.KeyWords ( 3 ) = "FILES" FileRec.KeyWords ( 4 ) = "BBS" FileRec.KeyWords ( 5 ) = "EVALFILE" FileRec.KeyWords ( 6 ) = "RATINGS" FileRec.StoredPath = "" FileRec.LongDesc ( 1 ) = "List of all files on this BBS sorting by EvalFile ratings" FileRec.LongDesc ( 2 ) = "" FileRec.LongDesc ( 3 ) = "Files are sorted by file area, rating, and evaluation count." for Index = 4 to 15 FileRec.LongDesc ( Index ) = "" next Index if not AddFile ( FileRec ) then ? "Error: unable to add "; AllFiles_Txt; "!" end if else ? "Error: unable to copy "; AllFiles_Txt; " to "; \ FileAreaRec.Path + AllFiles_Txt + "!" end if else ? "Error: unable to get info on File Area 1!" end if end if else Beep ? "Error: No files available on the BBS!" ? "Delaying 10 seconds..." Delay 10 end if end sub sub Menu_File_Records REM ------------------------------------------------------------------ dim Option as string*1 dim File_Name as string dim Index as long dim Rating as real dim Count as integer dim Paid as long REM do cls ? Copyright ? ? "EVALFILE FILE RECORDS MENU" ? ? "E -- Examine a file record" ? "S -- Statistics for a file record" ? "Q -- Quit" ? ? "Option: "; input Option Option = UCase ( Option ) select case Option case "Q" exit sub case else Beep end select loop end sub sub Menu_Maintenance REM ------------------------------------------------------------------ dim Option as string*1 REM do cls ? Copyright ? ? "EVALFILE MAINTENANCE MENU" ? ? "If EvalFile.WCX is installed as a nightly event," ? "it will perform maintenance unattended." ? ? "A -- All Maintenance" ? "1 -- Activity Log Scan" ? "2 -- Costs Update" ? "3 -- Sort All Files by File Area and Ratings" ? "Q -- Quit" ? ? "Option: "; input Option Option = UCase ( Option ) select case Option case "A" if InputYesNo ( "Automatically log off afterwards? (Y/n): ", true ) then Event_Mode Goodbye else Event_Mode MorePrompt On WaitEnter end if case "1" MorePrompt Off Log_Scan_Start ( Copyright ) MorePrompt On WaitEnter case "3" if InputYesNo ( "Automatically log off afterwards? (Y/n): ", true ) then MorePrompt Off Sort_All_Files Goodbye else MorePrompt Off Sort_All_Files MorePrompt On WaitEnter end if case "2" MorePrompt Off Costs_Update MorePrompt On WaitEnter case "Q" exit sub case else Beep end select loop end sub sub Menu_SysOp dim Option as string REM ------------------------------------------------------------------ if not User_Is_SysOp then ? Beep ? "You must have SysOp status to enter this menu." ? WaitEnter exit sub end if while Option <> "Q" cls ? Copyright ? ? "EVALFILE SYSOP MENU" ? ? "F -- File Records Menu" ? "M -- Maintenance Menu" ? "Q -- Quit" ? "T -- Transfer Entire File Areas" ? ? "Option: "; input Option Option = Ucase ( Option ) select case Option case "F" Menu_File_Records case "M" Menu_Maintenance case "Q" REM -- Quitting case "T" File_Area_Transfer_Ask case else Beep end select wend end sub sub Menu_Uploader REM ------------------------------------------------------------------ dim Option as string*1 dim File_Name as string dim Index as long dim Rating as real dim Count as long dim Paid as long dim FileRec as FileRecord dim Default as string*1 REM Default = "U" do cls Color ( 10 ) ? Copyright ? ? "EVALFILE UPLOADER MENU" ? ? "C -- Change the description of a file" ? "R -- Rating and count of evaluations for a file" ? "S -- Search files (for your username)" ? "Q -- Quit" Color ( 12 ) ? "U -- Upload files" Color ( 10 ) ? "X -- Transfer a file to another file area" ? ? "Option ["; Default; "]: "; input Option Option = UCase ( Option ) if Option = "" then Option = Default end if select case Option case "C" ? "File name: "; input File_Name File_Name = UCase ( File_Name ) ? if GetFileInfo ( FileRec, File_Name ) then if FileRec.UploaderID = User.UserID then do ? FileRec.Name ? FileRec.Description ? ? "Please enter a one-line description for this file [ENTER=Abort]." input FileRec.Description if FileRec.Description = "" then exit do end if FileRec.Description = Mid ( FileRec.Description, 1, 70 ) ? ? FileRec.Description loop until \ InputYesNo ( "Is this the way you want it to read (Y/n)? ", true ) if FileRec.Description <> "" then if not UpdateFile ( FileRec ) then Beep ? "Error: unable to update file description." WaitEnter end if end if else ? "You must be the uploader of the file to change its description." WaitEnter end if else ? "Unable to locate the file "; File_Name; "." ? "You may have mis-spelled it or it might have been deleted." WaitEnter end if case "Q" exit sub case "R" ? "File name: "; input File_Name File_Name = UCase ( File_Name ) ? if Eval_Rec_Get ( Rating, Count, File_Name, Bias_Count ) then ? "File Name Rating Count" ? Pad ( File_Name, 12 ); " "; ? FormatNumber ( Rating, "#.#####" ); " "; ? FormatNumber ( Count, "@####" ); " "; else ? "Evaluation record for """; File_Name; """ not found." ? ? "Possible reasons:" ? "1) the file has not yet been evaluated by a downloader, or" ? "2) the file name has been misspelled." end if WaitEnter case "S" SearchFiles case "U" Upload case "X" File_Transfer_Ask case else Beep end select loop end sub function Reward_Evaluator as boolean REM ------------------------------------------------------------------ REM Reward_Evaluator = false if User.Downloads > 0 then User.Downloads = User.Downloads - 1 if UpdateUser ( User ) then Reward_Evaluator = true end if end if end function function Reward_Uploader ( \ byval Uploader as string, \ byval Cost as integer, \ byval File_Name as string ) \ as boolean REM ------------------------------------------------------------------ dim Uploader_Rec as UserRecord dim Log_Str_Reward as string REM Reward_Uploader = false if GetUser ( Uploader_Rec, Uploader ) then Uploader_Rec.SubscriptionBalance = \ Uploader_Rec.SubscriptionBalance + Cost if UpdateUser ( Uploader_Rec ) then Reward_Uploader = true Message_Send_Uploader ( Uploader, Cost, File_Name ) Log_Str_Reward = "EvalFile: $" + \ FormatNumber ( Cost / 100, "@##.##" ) + " reward to " + \ Uploader + " for upload of " + File_Name ActivityLog ( Log_Str_Reward ) end if end if end function sub User_Mode REM ------------------------------------------------------------------ dim Option as string dim Unevaluated as string dim Default as string REM ------------------------------------------------------------------ Unevaluated = "" Default = "F" if User.TimesOn = 1 then Default = "A" end if while Option <> "Q" cls color 11 ? Copyright ? ? "EVALFILE MAIN MENU" ? ? "THIS IS NEW. LET ME KNOW OF THE BUGS! -- David Croft" ? if Default = "1" then Color ( 12 ) else Color ( 11 ) end if if User_Is_SysOp then ? "1 -- SysOp Menu" end if if Default = "A" then Color ( 12 ) else Color ( 11 ) end if ? "A -- download AllFiles.Txt, a list of all downloadable files" if Default = "C" then Color ( 12 ) else Color ( 11 ) end if ? "C -- leave a Comment to the SysOp" if Default = "D" then Color ( 12 ) else Color ( 11 ) end if ? "D -- Download marked files with cost and rating info first" if Default = "E" then Color ( 12 ) else Color ( 11 ) end if ? "E -- Edit list of files marked for download" if Default = "F" then Color ( 12 ) else Color ( 11 ) end if ? "F -- Find your unevaluated files" if Default = "G" then Color ( 12 ) else Color ( 11 ) end if ? "G -- Goodbye (log off the BBS)" if Default = "L" then Color ( 12 ) else Color ( 11 ) end if ? "L -- List files available for download" if Default = "N" then Color ( 12 ) else Color ( 11 ) end if ? "N -- New files available on the BBS" if Default = "P" then Color ( 12 ) else Color ( 11 ) end if ? "P -- Personal File Statistics" if Default = "Q" then Color ( 12 ) else Color ( 11 ) end if ? "Q -- Quit EvalFile" if Default = "R" then Color ( 12 ) else Color ( 11 ) end if ? "R -- Rate files downloaded on a previous day" if Default = "U" then Color ( 12 ) else Color ( 11 ) end if ? "U -- Uploader Menu" ? Color ( 10 ) ? "Account Balance: $"; ? Trim ( FormatNumber ( User.SubscriptionBalance / 100, "###.##" ) ); if User_Over_File_Ratio then Color ( 12 ) else Color ( 10 ) end if ? " File Ratio: "; ? Trim ( FormatNumber ( User_File_Ratio, "#####.#" ) ); ? " Max File Ratio: "; UserSec.MaxRatio Color ( 11 ) ? "Option [ENTER="; Color ( 12 ) ? Default; Color ( 11 ) ? "]: "; input Option Option = UCase ( Option ) if Option = "" then Option = Default end if select case Option case "1" Menu_SysOp case "A" Download ( "ALLFILES.TXT", 1 ) if User.TimesOn = 1 then Default = "N" elseif GetMarkedFiles > 0 then Default = "D" else Default = "U" end if case "C" Comment case "D" Marked_Files_Ratings Download if GetMarkedFiles > 0 then Default = "L" else Default = "U" end if case "E" Marked_Files_Ratings EditMarkList if GetMarkedFiles > 0 then Default = "D" else Default = "L" end if case "F" Unevaluated = Find_Unevaluated if Unevaluated <> "" then if User_Over_File_Ratio then Default = "U" else Default = "R" end if else Default = "N" end if case "G" Goodbye ( true ) case "L" ListFiles if GetMarkedFiles > 0 then Default = "D" else Default = "U" end if case "N" ListFilesDate if GetMarkedFiles > 0 then Default = "D" else Default = "L" end if case "P" FileStats if User_Over_File_Ratio then Default = "U" elseif GetMarkedFiles > 0 then Default = "D" else Default = "L" end if case "Q" ? Copyright case "R" Evaluate_Files ( Unevaluated ) Default = "F" case "U" Menu_Uploader Default = "L" case else Beep end select wend end sub