home *** CD-ROM | disk | FTP | other *** search
/ Just Call Me Internet / Just Call Me Internet.iso / com / bbs / server / octps074 / script / pd_main.scr < prev    next >
Encoding:
Text File  |  1996-10-13  |  16.1 KB  |  610 lines

  1. /*
  2.  * PULL-DOWN menu setup demo for the Octopus Bulletin Board System
  3.  * written by Koos Kuil on 18 May 1996
  4.  * -------------------------------------------------------------------
  5.  * Modified to make it more clear for novice sysops on 06 Oct 1996
  6.  * -------------------------------------------------------------------
  7.  * Run this script using:    OCTOPUS -sPD_MAIN.SCR local
  8.  *
  9.  * This example is written in ONE .SCR file so please split it into
  10.  * several parts if you want to make use of it.
  11.  *
  12.  * IMPORTANT:    In Octopus v0.72alpha-6 it's required that the menu
  13.  *              library (beginning with #menulib) is put at the begin
  14.  *              of the script file.  This will be more flexible later.
  15.  *
  16.  * -------------------------------------------------------------------
  17.  * HINTS:      - The menu title bar is like a chain, you must tell
  18.  *                this script what he must do if you press the left
  19.  *                or right cursor key.  In this example the QWK menu
  20.  *                is the first menu right from the MAIN menu. You'll
  21.  *                see that the IfChoice CursRight command does jump
  22.  *                from the MAIN menu to the QWK menu, the same for the
  23.  *                left cursor keys.  If you add or remove menus you
  24.  *                have to modify this chain.
  25.  *
  26.  *               - When you use SubMenus (see the FILEBASE example for
  27.  *                 1 and 2 submenus and how to handle it).  Then it can
  28.  *                 be needed when your SubMenu if LARGER (in lines) then
  29.  *                the 'Head' menu that you have to comment out the 
  30.  *                following code (or add) at the end of a subroutine:
  31.  *
  32.  *                        IfChoice CursRight
  33.  *                            RemoveMenu ... (your submenu)
  34.  *                        Endif
  35.  *
  36.  *                 If you press the right cursor key then Octopus will
  37.  *                restore the screen used by that menu, if your 'Head'
  38.  *                menu is larger then this isn't needed (it only takes
  39.  *                un-needed redraw time!).
  40.  *
  41.  *            - In this example not all options are working, please
  42.  *                change this to your own setup because this script is
  43.  *                written to give you an idea how you can get working
  44.  *                these complex features from Octopus.
  45.  *
  46.  */
  47. #define NESTMAIL        /* NeST region 90: English Atari network */
  48. #define FAN10MAIL        /* FAN region 10: Dutch Atari network */
  49. #define ATARINETMAIL     /* AtariNet region 51: English Atari net */
  50.  
  51. #define MORE_OS         /* Different OS-es for filegroups */
  52. #define FANFILES        /* FAN Atari ST filenetwork */
  53.  
  54. /* #define AREALIST */  /* Undefine when all the groups are correct */
  55.  
  56. /* -------------------------------------------------------------------
  57.  * Begin of the include section
  58.  */
  59. #include "pd_mlib.scr"    /* This is our menu library */
  60. #include "pd_local.scr" /* LOCAL message areas script */
  61.  
  62. #ifdef MORE_OS
  63. #include "pd_os.scr"    /* Different OS-es handling script */
  64. #endif
  65.  
  66. #ifdef FANFILES
  67. #include "pd_fanfi.scr"    /* FAN filenetwork script */
  68. #endif
  69.  
  70. #ifdef NESTMAIL
  71. #include "pd_nest.scr"    /* NEST message areas script */
  72. #endif
  73.  
  74. #ifdef FAN10MAIL
  75. #include "pd_fan10.scr"    /* FAN.10 message areas script */
  76. #endif
  77.  
  78. #ifdef ATARINETMAIL
  79. #include "pd_atnet.scr"    /* ATARINET message areas script */
  80. #endif 
  81.  
  82. /* -------------------------------------------------------------------
  83.  * MAIN startup function, the normal script file begins here...
  84.  * a little bit stripped but usable enough.
  85.  */
  86. Main
  87. SenseTerminal       /* Detect if remote supports ANSI */
  88.  
  89. Send "\fWelcome to this example PULL-DOWN DEMO setup\r\n"
  90.  
  91. Login                /* Login, no luxe or other things */
  92. IfNoAccess            /* Drop the user if no access     */
  93.   Logout
  94. Endif
  95. DoMailScan Full        /* Do a little mailscan :-))      */
  96.  
  97. /* This is needed because we want a full screen redraw */
  98. Gosub draw_bbsinfo
  99.  
  100. /* -------------------------------------------------------------------
  101.  * Begin of the "MAIN MENU" 
  102.  */
  103. :mainmenu
  104. Do
  105.    DrawMenu Main  Gosub draw_ascii_msg
  106.    DoMenu Main
  107.      Selectchoice
  108.          Case A   Convert InfoTxt
  109.          Case I   Convert Timedemo
  110.          Case 'R /Sysop' Shell
  111.          Case Y   PageSysop
  112.          Case L   UserList        GetKey
  113.          Case U   UploadToUser
  114.          Case !   Gosub logoff
  115.  
  116.          /* The Common statement does clear the screen when we
  117.           * are NOT in ascii mode and rebuild the information on
  118.           * it.  It's like default but only activated when a choice
  119.           * is done in one if above Case statements.
  120.           */
  121.          Common   Gosub draw_bbsinfo
  122.      EndSelect
  123.    Enddochoice MenuBarKeys
  124.    RemoveMenu Main   
  125. Enddo MenuBarKeys
  126.  
  127. /* Check to what menu we should go */
  128. IfChoice CursLeft
  129.   Goto msgbase
  130. Else IfChoice CursRight
  131.        Goto qwkreader
  132.      Else
  133.        Goto choice_action
  134.   Endif
  135. Endif
  136. End  /* End Octopus */
  137.  
  138. /* -------------------------------------------------------------------
  139.  * Begin of the "STATISTICS MENU" 
  140.  */
  141. :statistics
  142. Do
  143.    DrawMenu Statistics   Gosub draw_ascii_msg
  144.    DoMenu Statistics
  145.       SelectChoice
  146.          Case 1   ListLastCallers
  147.          Case 2   Convert 15_dnlds
  148.          Case 3   Convert 10_email
  149.          Case 4   Convert Birthday
  150.          Case 5   Convert Status
  151.          Case 6   Convert 10_nmail
  152.          Case 7   FileBaseStatistics
  153.          Case 8   Convert 15_calls
  154.          Case 9   Convert 15_uplds
  155.          Case !   Gosub logoff
  156.          Common   Gosub draw_bbsinfo
  157.       EndSelect
  158.    EnddoChoice MenuBarKeys
  159.    RemoveMenu Statistics
  160. Enddo MenuBarKeys
  161.  
  162. IfChoice CursLeft
  163.   Goto filebase
  164. Else IfChoice CursRight
  165.        Goto settings
  166.      Else
  167.        Goto choice_action
  168.   Endif
  169. Endif
  170. End   /* End Octopus */
  171.  
  172. /* -------------------------------------------------------------------
  173.  * Begin of the "USER SETTINGS" 
  174.  */
  175. :settings
  176. Do
  177.    DrawMenu Settings  Gosub draw_ascii_msg
  178.    DoMenu Settings
  179.       Selectchoice
  180.          Case E   ChangeEmulation
  181.          Case H   Gosub toggle_hotkeys
  182.          case I      Gosub toggle_highascii
  183.          Case O   Gosub toggle_moreprompt
  184.          Case P   ChangePassword
  185.          Case L   ChangeScreenLength
  186.          Case W   ChangeScreenWidth
  187.          Case F      Gosub toggle_dateformat
  188.          Case U   GetDefaultUp N
  189.          Case D   GetDefaultDown N
  190.          Case A   GetDefaultArchiver N
  191.          Case !   Gosub logoff
  192.          Common   Gosub draw_bbsinfo
  193.      EndSelect
  194.    EnddoChoice MenuBarKeys
  195.    RemoveMenu Settings
  196. Enddo MenuBarKeys
  197.  
  198. IfChoice CursLeft
  199.   Goto statistics
  200. Else IfChoice CursRight
  201.        Goto bulletin
  202.      Else
  203.        Goto choice_action
  204.   Endif
  205. Endif
  206. End   /* End Octopus */
  207.  
  208. /* -------------------------------------------------------------------
  209.  * Begin of the "BULLETIN MENU"
  210.  */
  211. :bulletin
  212. Do
  213.    DrawMenu Bulletins  Gosub draw_ascii_msg
  214.    DoMenu Bulletins
  215.       Selectchoice
  216.          Case 1   Bulletin 'aeo_????.txt'
  217.          Case 2   Bulletin 'aeop????.???'
  218.          Case 3   Bulletin 'slmp???.asc'
  219.          Case 4   Bulletin 'stgd*.txt'
  220.          Case 5   Bulletin 'str???.txt'
  221.          Case 6   Bulletin 'znet*.*'
  222.          Case !   Gosub logoff
  223.          Common   Gosub draw_bbsinfo
  224.      EndSelect
  225.    EnddoChoice MenuBarKeys
  226.    RemoveMenu Bulletins
  227. Enddo MenuBarKeys
  228.  
  229. IfChoice CursLeft
  230.   Goto settings
  231. Else IfChoice CursRight
  232.        Goto msgbase
  233.      Else
  234.        Goto choice_action
  235.   Endif
  236. Endif
  237. End   /* End Octopus */
  238.  
  239. /* -------------------------------------------------------------------
  240.  * Begin of the "MSGBASE MENU", this menu does also have a small
  241.  * SUB-MENU, take a very closed look at it how you can handle this
  242.  * with less full screen redraws and to get the highest speed.
  243.  */
  244. :msgbase
  245. Do
  246.    DrawMenu Msgbase  Gosub draw_ascii_msg
  247.    DoMenu Msgbase
  248.       Selectchoice  
  249.          Case G   Gosub MSG_groups        Break
  250.          Case N   Cls   DoMailScan Full
  251.          Case R   Bulletin echorule.txt
  252.          Case !   Gosub logoff
  253.          Common   Gosub draw_bbsinfo
  254.       Endselect
  255.    EnddoChoice MenuBarKeys
  256.    RemoveMenu MsgBase
  257. Enddo MenuBarKeys
  258.  
  259. IfChoice CursLeft
  260.   Goto bulletin
  261. Else IfChoice CursRight
  262.        Goto mainmenu
  263.      Else
  264.        Goto choice_action
  265.   Endif
  266. Endif
  267. End       /* End Octopus */
  268.  
  269. /* -------------------------------------------------------------------
  270.  * Msgbase groups
  271.  */
  272. :MSG_groups
  273. DrawMenu MsgGroups   Gosub draw_ascii_msg
  274. DoMenu MsgGroups
  275.   Selectchoice
  276.     Case 1     Gosub MSG_local    Break 
  277. #ifdef NESTMAIL
  278.     Case 2   Gosub MSG_nest        Break
  279. #endif
  280. #ifdef ATARINETMAIL
  281.     Case 3     Gosub MSG_atarinet    Break
  282. #endif
  283. #ifdef FAN10MAIL
  284.     Case 4     Gosub MSG_fan10net Break
  285. #endif
  286.  
  287. #ifdef AREALIST
  288.     Case 5   Do  Getmsgarealist LOCAL         ReadMessages EnddoNoArea
  289. #ifdef NESTMAIL
  290.     Case 6   Do  Getmsgarealist NEST        ReadMessages EnddoNoArea
  291. #endif
  292. #ifdef ATARINETMAIL
  293.     Case 7   Do  Getmsgarealist ATARINET    ReadMessages EnddoNoArea
  294. #endif
  295. #ifdef FAN10MAIL    
  296.     Case 8   Do  Getmsgarealist FANET10        ReadMessages EnddoNoArea
  297. #endif
  298. #endif
  299.  
  300.     Case X   Do  GetMsgAreaList FULL
  301.              ReadMessages           EnddoNoarea
  302.  
  303.     Common   Gosub draw_bbsinfo
  304.              DrawMenu Msgbase
  305.   EndSelect
  306. EnddoChoice MenuBarKeys
  307.  
  308. /* Remove the submenu */
  309. IfChoice CursLeft
  310.   RemoveMenu MsgGroups
  311.   ClrChoice               
  312. Endif
  313. Return
  314.  
  315. /* -------------------------------------------------------------------
  316.  * Begin of the "QWKREADER MENU"
  317.  */
  318. :qwkreader
  319. Do
  320.     DrawMenu QWK   Gosub draw_ascii_msg
  321.     DoMenu QWK
  322.       SelectChoice
  323.         Case 1  ChangeQwkNdx
  324.         Case 2  ChangeQwkBulletins
  325.         Case 3  ResetLastread
  326.         Case 4  UnmarkQwkAreas
  327.         Case 5  SetQwkMaxMsgs
  328.  
  329.         Case 6  GetMsgAreaList FULL     WriteQwkOneAll
  330.         Case 7  WriteQwkMarkedAll
  331.         Case 8  GetMsgAreaList FULL  WriteQwkOneNew
  332.         Case 9  WriteQwkMarkedNew
  333.         Case 0  WriteQwkMarkedDays
  334.  
  335.         Case A  MarkQwkAreas FULL
  336.         Case U  UploadQwkReplys       GetKey
  337.         Case H  Bulletin qwkhelp
  338.         Case !  Gosub 'logoff'
  339.         Common  Gosub draw_bbsinfo
  340.      Endselect
  341.    EnddoChoice MenuBarKeys
  342.    RemoveMenu QWK
  343. Enddo MenuBarKeys
  344.  
  345. IfChoice CursLeft
  346.   Goto mainmenu
  347. Else IfChoice CursRight
  348.        Goto filebase
  349.      Else
  350.        Goto choice_action
  351.   Endif
  352. Endif
  353. End    /* End Octopus */
  354.  
  355. /* -------------------------------------------------------------------
  356.  * A simply menu for use with allfiles listings
  357.  */
  358. :FB_allfiles
  359. IfAscii  EchoKey  Endif
  360. DrawMenu Allfiles     Gosub draw_ascii_msg           
  361. DoMenu Allfiles
  362.  Selectchoice
  363.      Case 1   DownloadFile ALLFILES.LZH
  364.      Case 2   DownloadFile ATARI.LZH
  365.      Case 3   DownloadFile MSDOS.LZH
  366.      Case 4   DownloadFile OS2.LZH
  367.      Case 5   DownloadFile NEWFILES.LZH
  368.  
  369.      Common   Gosub draw_bbsinfo
  370.               DrawMenu File
  371.  EndSelect
  372. EnddoChoice MenuBarKeys
  373.  
  374. /* Remove the submenu */
  375. IfChoice CursLeft
  376.   RemoveMenu Allfiles
  377.   ClrChoice               
  378. Endif
  379. Return
  380.  
  381. :FB_filegroups
  382. DrawMenu FileGroups     Gosub draw_ascii_msg           
  383. DoMenu FileGroups
  384.  Selectchoice
  385.      Case 1   /* File group ATARI */
  386.      Case 2      /* File group GENERAL */
  387. #ifdef FANFILES
  388.      Case 3   Gosub FB_os_atari_fanfiles    Break
  389. #endif
  390.      Case 4   /* File group NESTFILE */
  391.  
  392.      /* Detailed (normal) listing of fileareas */     
  393. #ifdef AREALIST
  394.      Case 5   /* Filegroup ATARI */
  395.      Case 6   /* Filegroup GENERAL */
  396. #ifdef FANFILES
  397.      Case 7   SetFileGroup FANFILES        /* File group FANFILES */
  398.                SetMainArea  FANFILES
  399.                Getfilearealist   FANFILES
  400. #endif
  401. #endif
  402.      Case X   SetFileGroup FULL       /* Set Full group */
  403.                FileListing
  404.  
  405.      Common   Gosub draw_bbsinfo
  406.               DrawMenu File
  407.  EndSelect
  408. EnddoChoice MenuBarKeys
  409.  
  410. /* Remove the submenu */
  411. IfChoice CursLeft
  412.   RemoveMenu Filegroups
  413.   ClrChoice               
  414. Endif
  415. Return
  416.  
  417. /* -------------------------------------------------------------------
  418.  * Begin of the "FILEBASE MENU", this menu does also have a small
  419.  * SUB-MENU, take a very closed look at it how you can handle this
  420.  * with less full screen redraws and to get the highest speed.
  421.  */
  422. :filebase
  423. SetFileGroup FULL      /* Set file group ATARI as default */
  424. SetMainArea  FULL
  425. Do
  426.    DrawMenu File   Gosub draw_ascii_msg
  427.    DoMenu File
  428.  
  429.       Selectchoice                                         
  430. #ifdef MORE_OS
  431.          Case O   Gosub FB_os            Break
  432. #endif
  433.          Case G   Gosub FB_filegroups    Break
  434.          Case A      Gosub FB_allfiles        Break
  435.  
  436.          Case F   FileListing   
  437.          Case L   FileListing   
  438.          Case N   Newfiles      
  439.          Case K   KeywordSearch
  440.          Case D   Download
  441.          Case V   ShowFileInfo
  442.          Case U   Convert rules.upl    UploadtoArea
  443.          Case I   FileBaseStatistics
  444.          Case P   Convert private.upl  UploadPrivate
  445.          Case !   Gosub logoff
  446.          Case 1   convert `Fp.TOP
  447.          Common   Gosub draw_bbsinfo         
  448.       Endselect
  449.     EnddoChoice MenuBarKeys    
  450.    RemoveMenu File
  451. Enddo MenuBarKeys
  452.  
  453. IfChoice CursLeft
  454.   Goto qwkreader
  455. Else IfChoice CursRight
  456.        Goto statistics
  457.      Else
  458.        Goto choice_action
  459.   Endif
  460. Endif
  461. End    /* End Octopus */
  462.  
  463. /* -------------------------------------------------------------------
  464.  * Some USER-functions (normal in USERBASE.SCR)
  465.  */
  466. :change_password
  467. ChangePassword
  468. Return
  469.  
  470. :change_emulation
  471. ChangeEmulation
  472. Return
  473.  
  474. :change_screenlength
  475. ChangeScreenLength
  476. Return
  477.  
  478. :change_screenwidth
  479. ChangeScreenWidth
  480. Return
  481.  
  482. :toggle_fullscred
  483. Send "\f***  Full Screen Message Editor ?  ***\r\n\n"
  484.      "@Y  Yes, use the full screen edit (not in ascii mode).\r\n"
  485.      "@N  No, use the internal message line-orientated editor.\r\n\n"
  486.      "Select: "
  487.  
  488. AskYesNo
  489. IfAskTrue
  490.     SetFullScrEd On
  491. Else
  492.     SetFullScrEd Off
  493. Endif
  494. Return
  495.  
  496. :toggle_moreprompt
  497. Alert "[YN]`T Do you want a more prompt (y,n) ? "
  498. IFChoice N
  499.     SetMorePrompt Off
  500. Else
  501.     SetMorePrompt On
  502. Endif
  503. Return
  504.  
  505. :toggle_hotkeys
  506. Alert "[YN]Do you want fast menu hotkeys (y,n) ? "
  507. IfChoice N
  508.     SetHotkeys Off
  509. Else
  510.     SetHotkeys On
  511. Endif
  512. Return
  513.  
  514. :toggle_dateformat
  515. Do
  516.   Send "\r\n\nSelect your favourite date format.\r\n\n"
  517.        "1. DD-MM-YYYY  (26 September 1995)\r\n"
  518.        "2. MM-DD-YYYY  (September 26th 1995)\r\n\n"
  519.   Send "Make your choice: "
  520.   DoChoice
  521.     Selectchoice
  522.       Case 1  SetAltDateFormat Off
  523.       Case 2  SetAltDateFormat  On
  524.     EndSelect
  525.   EnddoChoice 12
  526.   EchoKey
  527. Enddo 12
  528. Return
  529.  
  530. :toggle_highascii
  531. Alert "[YN]Do you want to use high ascii (IBM graphics) (y,n) ? "
  532. IfChoice N
  533.     SetHighAscii Off
  534. Else
  535.     SetHighAscii On
  536. Endif
  537. Return
  538.  
  539. /* -------------------------------------------------------------------
  540.  * Begin of the "LOGOFF normal menu"
  541.  */
  542. :logoff
  543. Logout
  544. End
  545.  
  546. /* When you see this piece of script, you'll think
  547.  * why not using Select...EndSelect?   No, this
  548.  * will result in a nested loop and Octopus will
  549.  * exit after this.
  550.  *
  551.  * Because we are directly jumping from one function
  552.  * in another one, a Return command is not usable (this
  553.  * will result in a "Return without gosub").  We use
  554.  * the Goto command for this.
  555.  */
  556. :choice_action   /* Check choices */
  557. IfAscii
  558.    IfChoice MenuBarKeys
  559.       EchoKey
  560.    Endif
  561. Endif
  562.  
  563. IfChoice B   Goto bulletin   Endif
  564. IfChoice *   Goto mainmenu   Endif
  565. IfChoice F   Goto filebase   Endif
  566. IfChoice M   Goto msgbase    Endif
  567. IfChoice Q   Goto qwkreader  Endif
  568. IfChoice S   Goto statistics Endif
  569. IfChoice T   Goto settings   Endif
  570.  
  571. End
  572.  
  573. /* This subroutine shows us how we can put a little
  574.  * note at the end of our screen, be sure that you
  575.  * don't have pulldown menus that does override this
  576.  * text (on 14 May 1996 the screen rebuild is not 
  577.  * complete working).
  578.  *
  579.  * If you don't want it, put the "Cls" command after
  580.  * the "Common" statements, this will give (as in this
  581.  * function) only a clear-screen when required (when a
  582.  * menu option was selected).
  583.  *
  584.  * For ascii mode this function is useless because it's
  585.  * not possible in ascii to put text on the screen before
  586.  * menu redraw is done.
  587.  */
  588. :draw_bbsinfo
  589. IfNoAscii
  590.   Cls
  591.   Gotoxy 0,21
  592.   Send "   ----- You can put your own message text here for example on the -----\r\n"
  593.        "  ----- bottom of the screen, this text is not drawed in ascii mode -----"
  594.   
  595.   Gotoxy 0,19
  596.   Send "/// You can use your cursor keys or menu title/entry keys to make a choice. ///"
  597. Endif
  598. Return
  599.  
  600. /* Draw a little message when a menu is drawed on screen in
  601.  * ascii mode, this subroutine should called AFTER a "DrawMenu"
  602.  * command.
  603.  */
  604. :draw_ascii_msg
  605. IfAscii
  606.   Send "\r\n\nMake your choice `UF : "
  607. Endif
  608. Return
  609.  
  610. /* End PULLDEMO.SCR */