home *** CD-ROM | disk | FTP | other *** search
/ Beijing Paradise BBS Backup / PARADISE.ISO / software / BBSDOORW / NEWS100.ZIP / NEWS.PPS < prev    next >
Encoding:
Text File  |  1993-08-19  |  4.9 KB  |  154 lines

  1. ;
  2. ; NEWS.PPS   Display news file, allow editing if conference Sysop and
  3. ;            conference NEWS file is not the same as the NEWS file in
  4. ;            the main conference.  "WizOp", sysops w/security of 110+,
  5. ;            may change any NEWS file, main or conference.
  6.  
  7. ; (C) Copyright 1993, Stan Spotts
  8. ;     Philadelphia Area Computer Society IBM SIG BBS
  9.  
  10. ; Version 1.0 - 93-08-16
  11.  
  12. ; This program may be modified and used by anyone as long as credit is given
  13. ; to the author and the PACS IBM SIG in the source code and documentation.
  14. ; No fee is required, but it would be appreciated by the author if major
  15. ; improvements be forwarded to him at the PACS IBM SIG BBS.
  16.  
  17. ;****************************************************************************
  18. ; Define variables                                                          *
  19. ;****************************************************************************
  20.  
  21. INTEGER last, ln, i
  22. STRING pmt, instr, news(17), confnews, confname, mainnews, cnames, prevoper
  23. STRING spaces, padding
  24. ;****************************************************************************
  25. ; Start of Main PPE program                                                 *
  26. ;****************************************************************************
  27.  
  28. If (CurSec() >= SysopSec()) Then
  29.   Gosub NewsFile
  30.   If (mainnews = confnews & CurSec() < 110 ) Then
  31.     ; Skip update ability if using main conference news file if not "WizOp"
  32.     KbdStuff "NEWS"+ Chr( 13)
  33.   ElseIf (confnews <> "") Then
  34.     ; If there is a news file specified for the conference,
  35.     ; allow sysop option to update or display
  36.     If (TokCount() > 0) Then
  37.       instr = Upper( GetToken())
  38.       If (instr <> "D" & instr <> "U") Then
  39.         KbdStuff TokenStr()
  40.         instr = ""
  41.       EndIf
  42.     Else
  43.       instr = ""
  44.     EndIf
  45.     If (instr = "") Then
  46.       pmt = "(@TIMELEFT@ min left), (U)pdate, (D)isplay (Enter=D)"
  47.       InputStr pmt, instr, @X0E, 1, "DdUu", LFBEFORE+NEWLINE
  48.       instr = Upper( instr)
  49.     EndIf
  50.     If (instr = "D"|instr = "") Then
  51.       KbdStuff "NEWS"+ Chr( 13)
  52.     ElseIf (instr = "U") Then
  53.       Gosub Update
  54.     Endif
  55.   EndIf
  56. Else
  57.   KbdStuff "NEWS"+ Chr( 13)
  58. EndIf
  59. End
  60.  
  61. :Update
  62.   RdUNet PCBNode()
  63.   prevoper = UN_Oper()
  64.   WrUNet PCBNode(), UN_Stat(), UN_Name(), UN_City(), "Editing Conference News", ""
  65.   PrintLn
  66.   PrintLn "@X0CNews files can be up to 18 lines of 72 characters each."
  67.   PrintLn "Enter /Q to finish entering news."
  68.   PrintLn
  69.   ln = 0
  70.   last = 18
  71.   Gosub Editor
  72.   instr = "L"
  73.   pmt = "(@TIMELEFT@ min left), (A)bort, (C)ontinue, (L)ist, (S)ave, (Enter=S)"
  74.   While (instr = "L") Do
  75.     InputStr pmt, instr, @X0E, 1, "AaCcLlSs", LFBEFORE+NEWLINE
  76.     instr = Upper( instr)
  77.     If (instr = "S"|instr = "") Then
  78.       Delete confnews
  79.       Fcreate 1, confnews, O_WR, S_DB
  80.       FputLn 1, "@X00@X0B▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄@X0F"
  81.       Fput 1, "@X03█@X3E"
  82.       ; fetch conference name
  83.       confname = ReadLine( cnames, 1 + (curconf() * 33))
  84.       If (curconf() = 0) Then
  85.         confname = confname + " News"
  86.       Else
  87.         confname = confname + " Conference News"
  88.       EndIf
  89.       spaces = (70 - len( confname)) / 2
  90.       padding = (70 - len( confname)) % 2
  91.       Fput 1, space( spaces), confname, space( spaces), space( padding)
  92.       FputLn 1, "@X03█@X0F"
  93.       FputLn 1, "@X01▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀@XFF"
  94.       dec last
  95.       For i = 0 to last
  96.         FputLn 1, news( i)
  97.       Next
  98.       ; Have news file reset to default color after last line
  99.       FputLn 1, news( last+1), "@X", Right( "00" + String( DefColor()), 2)
  100.       Fclose 1
  101.       PrintLn confname, " updated."
  102.     ElseIf (instr = "C") Then
  103.       ln = last
  104.       last = 18
  105.       Gosub Editor
  106.       instr = "L"
  107.     ElseIf (instr = "D") Then
  108.       news( ln) = ""
  109.     ElseIf (instr = "L") Then
  110.       ln = ""
  111.       For i = 0 to last
  112.         PrintLn Right( " "+ String( i+ 1), 2), ": ", news( i)
  113.       Next
  114.       PrintLn
  115.     EndIf
  116.   End While
  117.   WrUNet PCBNode(), UN_Stat(), UN_Name(), UN_City(), prevoper, ""
  118.  
  119. Return
  120.  
  121. :Editor
  122.  ; Line "editor"
  123.   While (ln < 18) Do
  124.     InputStr Left( "Ln #"+String( ln+1)+" ", 6) , news( ln), @X0E, 72, Mask_ASCII(),WORDWRAP+NEWLINE
  125.     If (Upper( news( ln)) = "/Q") Then
  126.       news( ln) = ""
  127.       last = ln - 1
  128.       ln = 18
  129.     ElseIf (Upper( news( ln)) = "/D") Then
  130.       news( ln) = ""
  131.       If (ln > 0) Then
  132.         Dec ln
  133.         news( ln) = ""
  134.       EndIf
  135.     Else
  136.       Inc ln
  137.     EndIf
  138.   End While
  139. Return
  140.  
  141. :NewsFile
  142.   ; fetch conference data file name
  143.   cnames = ReadLine( PcbDat(), 31)
  144.   ; fetch main news filename for comparison
  145.   mainnews = ReadLine( cnames, 13)
  146.   ; fetch conference news filename
  147.   i = curconf()
  148.   If ( i > 0) then
  149.     confnews = ReadLine( cnames, 13 + (i * 33))
  150.   Else
  151.     confnews = mainnews
  152.   EndIf
  153.   Return
  154.