home *** CD-ROM | disk | FTP | other *** search
/ Programmer 7500 / MAX_PROGRAMMERS.iso / CLIPPER / MISC / TM480.ZIP / TMISSUE.EXE / SMART.TSK < prev    next >
Encoding:
Text File  |  1991-09-10  |  13.3 KB  |  534 lines

  1. ; Title   : SMART.TSK                   Last Updated : July 24, 1991
  2. ; Author  : Steve Johnson - FmP.        Version      : 1.20
  3. ; Purpose : User oriented menu interfaced to EUC
  4. ; Notes   : Uses SAVE and RESTORE to file called SMART.TM
  5. ;           The task validates usernames and passwords against EUC
  6. ;           catalogue. Allows a "standard" list of applications to
  7. ;           be edited.
  8. ;           Task screen output is to screen 1, Application O/P to 0.
  9. ; Latest  : Support for networking revised.
  10.  
  11. int column
  12. int count
  13. int i
  14. int line
  15. int ug
  16.  
  17. logical auto
  18. logical forever
  19. logical save_reqd
  20.  
  21. vconst cls,11
  22. vconst cel,55
  23. vconst cep,56
  24.  
  25. var char,1
  26. var descriptions,15,occurs 7,
  27. 'On-line Manual '
  28. 'SCR manual     '
  29. 'Database       '
  30. 'File Transfer  '
  31. 'Leisure ware   '
  32. 'Development    '
  33. 'Wordprocessing '
  34.  
  35. var fmpdir,64,$fmpdir
  36. var fmpcat,64,$fmpcat
  37. var loginpath,64
  38. var login_error,32,'Invalid login - please retry...'
  39. var null,1
  40. var pass,16
  41. var screen_line,80
  42. var tme,4
  43. var uname,16
  44.  
  45. var path,20
  46. var paths,20,occurs 7,
  47. ".                   "
  48. ".                   "
  49. ".                   "
  50. ".                   "
  51. "\flsim              "
  52. ".                   "
  53. ".                   "
  54.  
  55.  
  56. èvar parameter,20
  57. var parameters,20,occurs 7,
  58. "TMMAN               "
  59. "SCRMAN              "
  60. "                    "
  61. "                    "
  62. "                    "
  63. "TMDEV               "
  64. "WORDPROC            "
  65.  
  66. var program,8,"   SMART"
  67. var programs,8,occurs 7,
  68. "TM      "
  69. "TM      "
  70. "PROTEAN "
  71. "XPORT   "
  72. "fs3     "
  73. "TM      "
  74. "TM      "
  75.  
  76.  
  77. end
  78. lookfor "smart.ovr"
  79. if not found
  80.   forms logon.ovr       ;in case /q and not registered
  81.   insert program program
  82.   put "NO_FORMS"
  83.   stop
  84. fi
  85. display cls
  86. screen 1
  87. display cls
  88. screen 0
  89. if colour
  90.   screen 1
  91.   switch 1
  92. fi
  93. forms smart.ovr
  94. user loginpath      ;Save initial directory
  95.  
  96. restore 'smart.tm' descriptions programs paths parameters
  97. if resp ne 0
  98.   if not colour
  99.     clear count
  100.     until count = 7
  101.       if entry count of programs = "TM      "
  102.     move "TM /m   " to entry count of programs
  103.       fi
  104.     fi count
  105.   fi
  106.   save 'smart.tm' descriptions programs paths parameters
  107.   if resp ne 0
  108.     wait 'SMART: Unable to save data to SMART.TM'
  109.     stop
  110.   fi
  111. è  save
  112. else
  113.   restore
  114. fi
  115. if fmpcat = null
  116.   if fmpdir = null
  117.     move '\fmp' to fmpdir
  118.   fi
  119. else
  120.   move fmpcat to fmpdir
  121. fi
  122. dir fmpdi≥ '\º catalog.euc
  123. if not found
  124.   put "NO_CATALOGUE"
  125.   screen 0
  126.   switch 0
  127.   stop
  128. fi
  129. catalog fmpdi≥ ;open the catalog ready for use
  130. if resp ne 0
  131.   displayln "Unable to opeε thσ cataloguσ iε directory: " fmpdir 
  132.   wait
  133.   stop
  134. fi
  135. until forever
  136.   display cls
  137.   move 1 to resp
  138.   until resp = 0 or auto
  139.     put 'LOG' noclear
  140.     CLEAR uname
  141.     get uname pass
  142.     if funkey = 10
  143.       put "EGRESS"
  144.       get forever
  145.       if forever
  146.     screen 0
  147.     switch 0
  148.     stop
  149.       fi
  150.       move 1 to resp
  151.     else
  152.       if fk1
  153.     put "DUMMY_CAT" wait 0 noclear
  154. è    move 1 to resp
  155.       else
  156.     login uname pass ug
  157.         if resp = 3
  158.           cursor 12 10 'User ' uname ' already logged-in'
  159.         else
  160.           if resp <> 0
  161.           put "DUMMY_CAT" wait 0 noclear
  162.         insert login_error
  163.         move 1 to resp
  164.         fi
  165.     fi
  166.       fi
  167.     fi
  168.   fi
  169.   move 0e040h to bbmask
  170.   display cls
  171.   userline 'Current user is ' uname
  172.   move 10 to timer
  173.   menu 1,'SERVICES',descriptions
  174.   option 1,1,7
  175.     if choice = 5
  176.       move time to tme
  177.       if tme > '12:0' and tme < '13:3' or tme > '17:3' or tme < '08:3'
  178.       else
  179.     cursor 18 0 "This is COMPANY TIME - games available "
  180.     display "noon > 1:30 and after 5:30 p.m."
  181.     cursor 19 0 "Please try later " UNAME 2
  182.     wait
  183.     cursor 18 0 cel
  184.     cursor 19 0 cel
  185.     if keyval = 'O'   ;Press O to override time check...
  186.     else
  187.       return
  188.     fi
  189.       fi
  190.     fi
  191.     move choice to i
  192.     decrement i
  193.     move entry i of programs to program
  194.     if program = spaces
  195.       display 5 "No details yet supplied"
  196.       move 8 to choice
  197.       return
  198.     else
  199.       move entry i of paths      to path
  200.       move entry i of parameters to parameter
  201.       if parameter ct '?'
  202.     insert program
  203.     fieldfill parameter
  204.     put "EDIT_PAR" noclear
  205.     get parameter
  206.       fi
  207.     fi
  208.     trim path
  209.     if path ne spaces and path ne '.'
  210.       if path sw '~:\'
  211.         select path
  212.       fi
  213.       user path
  214.       if resp ne 0
  215.     cursor 0 0 'Unable to select specified path - abandoned'
  216. è    return
  217.       fi
  218.     fi
  219.     if colour
  220.       screen 0
  221.       userline 'Attempting to run application in screen number zero..'
  222.       switch 0
  223.     fi
  224.     display cls
  225.     trim program parameter
  226.     run program 1 parameter
  227.     if colour
  228.       switch 1
  229.       screen 1
  230.     fi
  231.     select loginpath
  232.     display cls  ;in case app overwrote it!
  233.     userline 'Current user is ' uname
  234.     user loginpath
  235.     return
  236.  
  237.   option 1,8
  238.     if ug ne 99
  239.       cursor 17 0 "Please login as user in group 99 to amend list"
  240.       cursor 18 0
  241.       wait
  242.       cursor 17 0 cel
  243.       cursor 18 0 cel
  244.       move 10 to choice
  245.       return
  246.     fi
  247.     clear count save_reqd
  248.     until count = 7 or fk2
  249.       fieldfill entry count of descriptions
  250.       fieldfill entry count of programs
  251.       fieldfill entry count of paths
  252.       fieldfill entry count of parameters
  253.       put application_detail noclear
  254.       get entry count of descriptions
  255.       get entry count of programs
  256.       get entry count of paths
  257.       get entry count of parameters
  258.       if not anyfk
  259.     move true to save_reqd
  260.       fi
  261.     fi count
  262.     if save_reqd
  263.       user loginpath
  264.       save 'smart.tm' descriptions programs paths parameters
  265.       if resp ne 0
  266.         wait 'SMART: Unable to save data to SMART.TM'
  267.         stop
  268.       fi
  269.       save
  270.     fi
  271. è    cursor 17 0 cep
  272.     put "CLEAR" wait 0 noclear
  273.     return
  274.  
  275.   option 1,9
  276.     put 'NEWPASS' noclear ul ''
  277.     display cls
  278.     if funkey = 10
  279.       return
  280.     else
  281.       get pass
  282.       password pass
  283.     fi
  284.     return
  285.  
  286.   option 1,10
  287.   option 1,30
  288.     logout
  289.     clear auto
  290.     exitm
  291.   option 1,31
  292.     put 'HELPSCREEN'
  293.     move hilite to choice
  294.     return
  295.   option 1,32
  296.     put 'HELPSWITCH'
  297.     move hilite to choice
  298.     return
  299.   option 1,39
  300.     if colour
  301.       SCREEN 0
  302.       userline 'Contents of page 0...Press any key'
  303.       switch 0
  304.       inkey char
  305.       if colour
  306.     screen 1
  307.     switch 1
  308.       fi
  309.     else
  310.       userline "F9 key is not applicable on mono monitors"
  311.     fi
  312.     move hilite to choice
  313.     clear bbdisp
  314.     return
  315.   option 1,99
  316.     move hilite to choice
  317.     increment choice
  318.     move true to auto
  319.     exitm
  320.   endm 1
  321. fi
  322.  
  323. endtask
  324.  
  325. @VIDEO
  326. è@HEAD LEFT,'Taskmaster Example'
  327. @HEAD RIGHT,'EUC Controlled Access'
  328. @HEAD centre,'User Login'
  329. @NF LOG
  330. @acceptfk f1,f10
  331. @window line0,column0,depth1,width1
  332. @col char,cyan,blue
  333. @bright
  334. @banner
  335. @COL CHAR,YELLOW,BLACK
  336. @DRAW
  337. @STR MIN1
  338. @STR
  339. >Y<
  340.   Entry to this application is controlled by EUC,
  341.   the Taskmaster END USER COMPUTING Facility
  342.   F1 for Username list. Press F10 to quit.
  343.   >A<
  344.  
  345.            USERNAME [guest           ]
  346.            PASSWORD [!               ]
  347.         {                                }
  348.                                              >A<
  349.                                                 >Y<
  350. @COL CHAR,YELLOW,BLACK
  351. @END
  352. @NF SERVICES
  353. @acceptfk f1,f2,f9
  354. @window line0,column0,depth1,width1
  355. @HEAD centre,'Service Selection'
  356. @col char,cyan,blue
  357. @banner
  358. @BBMENU WHITE,BLUE
  359. @wINDOW LINE 2,COLUMN 30,DEPTH 14,WIDTH 18
  360. @GON
  361. 7----------------9
  362. 0APPLICATIONS:   0
  363. 0{Archives       }0
  364. 0{Comms          }0
  365. 0{Database       }0
  366. 0{File Transfer  }0
  367. 0{Leisure ware   }0
  368. 0{Spreadsheet    }0
  369. 0{Wordprocessor  }0
  370. 0FUNCTIONS:      0
  371. 0{Edit Apps List }0
  372. 0{Change Password}0
  373. 0{Logout (+Quit) }0
  374. 1----------------3
  375. @goff
  376. @colour char,cyan,BLUE
  377. @window line20,column18,depth2,width 42
  378.   F1 or F2 for Help.
  379.   F9 to view output from last application.
  380. @END
  381. è@NF clear
  382. @wINDOW LINE 2,COLUMN 50,DEPTH 14,WIDTH 25
  383. @end
  384.  
  385. @NF NEWPASS
  386. @acceptfk f10
  387. @window line0,column0,depth1,width1
  388. @bright
  389. @COL CHAR,YELLOW,BLUE
  390. @STR
  391. @WINDOW LINE 16,COLUMN 17,DEPTH 8,WIDTH 46,pattern 176
  392.  
  393.  
  394.      NEW PASSWORD ?  [                ]
  395.  
  396. @colour char,red,black
  397.  
  398.         Press F10 to Abandon change
  399. @END
  400. @nf APPLICATION_DETAIL
  401. @acceptfk f1,f2
  402. @STR MIN1
  403. @STR MIN1
  404. @path
  405. @STR
  406. @WINDOW LINE 17,COLUMN 0,DEPTH 5,WIDTH 80
  407. @dim
  408. @GON
  409. 7-Edit-and-press-<>-to-update-application-list:--(use--to-move)-------9
  410. 0 Description for menu    [               ]                                   0
  411. 0 Application name        [        ] Exclude .xxx (COM,EXE or BAT is implied) 0
  412. 0 Working Directory       [.                   ] Note: a FULL STOP = current  0
  413. 0 Command line Parameters [                    ] Optional: ? = prompt user    0
  414. 4-----------------------------------------------------------------------------6
  415. 1-----Press F1 to skip to next. Press F2 to skip remainder--------------------3
  416. @bright
  417. @END
  418. @nf helpscreen
  419. @head centre,"General help"
  420. @colour char,cyan,BLUE
  421. @banner
  422. @colour char,cyan,BLack
  423. @draw
  424. @colour char,cyan,black
  425.   >1<
  426.         This  application is user-configurable allowing the user to  fill
  427.         in details of a list of up to seven applications.
  428.  
  429.         The  task demonstrates the use of the SAVE and RESTORE  commands,
  430.         used here to remember details of the applications.
  431.  
  432.         The  task  also  makes  use of the  SWITCH  and  SCREEN  commands
  433.         allowing output from the applications to remain on the screen and
  434.         be  accessible  by use of the F9 key. THIS IS NOT  DONE  ON  MONO
  435.         VIDEOS.
  436. è
  437.         Please note that the leisureware option is only available between
  438.         certain specified times showing use of the TIME system variable.
  439.  
  440.         The menu has been made to TIME-OUT after 10 seconds automatically
  441.         selecting the next topic.
  442.                                                                            >1<
  443. @end
  444. @nf helpswitch
  445. @head centre,"Help on screen switching"
  446. @colour char,cyan,BLUE
  447. @banner
  448. @draw
  449. @colour char,cyan,black
  450. >1<
  451.    Typical  MS-DOS  CGA video adaptors maintain 4 separate pages  of  screen
  452.    memory and Taskmaster is able to switch between them.  This task  assumes
  453.    that if the video is not colour it has only one page.
  454.  
  455.    Many   applications  write  directly  to the  first  of   these   screens
  456.    (directly  to the hardware); because of this behaviour,  this  particular
  457.    task  arranges to use screen  1  (the  second screen) for all its  normal
  458.    output (if CGA or above).
  459.  
  460.    Having  adopted  this approach the F9 key has  been  utilised  to display
  461.    the   contents of screen 0 (which normally  contains  the output  of  the
  462.    last command issued).
  463.  
  464.    Incidentlly  using  Taskmaster  one  may write to   a   screen  which  is
  465.    currently not being displayed.
  466.                                                                              >1<
  467.  
  468.    In  a secure task, exit to the System prompt can be prevented.   To  exit
  469.    this task logout and press F10 at the login screen.  Note that Taskmaster
  470.    can disable Control/break and Control/C keys if required.
  471. @end
  472. @nf egress
  473. @acceptfk none
  474. @log
  475. @head centre,"Exit from SMART task"
  476. @colour char,cyan,BLUE
  477. @banner
  478. @draw
  479. @colour char,cyan,black
  480. >1<
  481.    To  maintain  a  secure installation the ability to exit  to  the  system
  482.    prompt  would  need  to be restricted to certain users,   or  members  of
  483.    specified  user  groups; but as this is just a demo you may leave.
  484.  
  485. @bright
  486.                  Do you want to exit SMART.TSK ? [Y]
  487.                                                                              >1<
  488. @end
  489. @nf NO_CATALOGUE
  490. @dim
  491. è   SMART.TSK error: Cannot locate/read the catalogue file maintained by EUC.
  492.  
  493.    If you have EUC (Not supplied with the Shareware version):  Please run it
  494.    to set up a catalogue in the current working directory.
  495.  
  496.    If  you  don't have EUC: A file named CALALOG.EUC is  supplied  with  all
  497.    Taskmaster  issues,  you will not be able to edit the  catalogue  without
  498.    EUC  but you will be able to use the dummy names catalogued within it  to
  499.    run those applications that are interfaced to EUC  (for example SMART.TSK
  500.    and CONFIG/STANDARD).
  501.  
  502.    During use the catalogue is updated by Taskmaster, recording  details  of
  503.    users, dates and times of login and logout, name of last  menu  used  the
  504.    option  selected  etc.  CATALOGV.EUC is an exact copy of  CATALOG.EUC  as
  505.    issued.
  506. @end
  507. @nf DUMMY_CAT
  508. @WINDOW LINE 2,COLUMN 51,DEPTH 1,WIDTH0
  509. @dim
  510. The dummy catalogue contains
  511. these  names, passwords  and
  512. group numbers:
  513. @gon
  514. 7-------8----------8-------9
  515. 0 Name  0 Password 0 group 0
  516. 4-------5----------5-------6
  517. 0 guest 0          0  10   0
  518. 0 Bill  0 Access   0  20   0
  519. 0 Phil  0 Secret   0  30   0
  520. 0 Joan  0 a1b2c3   0  99   0
  521. 0 ADMIN 0 FMP      0  99   0
  522. 1-------2----------2-------3
  523. "UPPER" and "lower" case are
  524. NOT  considered the same  in
  525. usernames and passwords.
  526.  
  527. Once   logged  in  you   may
  528. change the password.  If you
  529. do then only you and the EUC
  530. administrator will know it!
  531. You may copy CATALOGV.EUC to
  532. CATALOG.EUC to restore them.
  533. @end
  534. @nf edit_par
  535. @acceptfk none
  536. @str
  537. @window line20,column 10,depth3,width60
  538.  
  539.   Please edit parameters for {        } [                    ]
  540. @end
  541. @eof
  542.  
  543.