home *** CD-ROM | disk | FTP | other *** search
/ Knowledge Land / KNOWLEDGELA.ISO / pc / support / macsetup / v01 / login.ace < prev    next >
Encoding:
Text File  |  1996-08-29  |  8.6 KB  |  255 lines

  1. [==========================================================================
  2.     login.ACE
  3.     ----------
  4.  
  5.     The Knowledge Land main navigation interface.
  6.  
  7.     Requires:
  8.         FRAMEWRK.ACE.
  9.  
  10. ==========================================================================]
  11.  
  12. To activate login interface,
  13.     If login does not exist in mainScreen,
  14.         In mainScreen,
  15.             Make login.
  16.     Set mainScreen's login to a loginModule from 0,0 to 640,480.
  17.     Log in to mainScreen's login.
  18.     Fade in.
  19.     If system is loggedIn,
  20.         If system is firstTime,
  21.             Play voice over "NARRATE\\SIWEL1.SND".
  22.             Wait until mediaPlayer is not running.
  23.         Play voice over "NARRATE\\SISIGM2.SND".
  24.     Otherwise,
  25.         If system is firstTime,
  26.             Play voice over "NARRATE\\SIWEL5.SND".
  27.             Wait until mediaPlayer is not running.
  28.         Play voice over "NARRATE\\SISIGS1.SND".
  29.         Wait until mediaPlayer is not running.
  30.  
  31. A loginModule is a kind of module which has:
  32.  
  33.     A way for anyone to get
  34.         a loginModule from an xynumber 'a' to an xynumber 'b',
  35.  
  36.         Make new.  Set it to a module from a to b.
  37.         Make it into a loginModule.
  38.         In new,
  39.             Make loginData.  Set it to an array of the data "LOGIN\\LOGIN.DAT".
  40.             Make entryPic.  Set it to a control of loginData's entryPicData.
  41.             Make selectedUser.  Set it to 0.
  42.         Detach it.  Return it.
  43.  
  44.     A way to handle an upclickevent 'e' in a buttoncontrol 'c' in a loginModule 'm',
  45.  
  46.         If c's id is "loginbutton",
  47.             Hide cursor in m's entryDialog's nameEntry.
  48.             Make n.  Set it to m's entryDialog's nameEntry's buffer.
  49.             Make p.  Set it to m's entryDialog's passwordEntry's password.
  50.             If system is not loggedIn,
  51.                 Check name n in m.
  52.             Otherwise,
  53.                 Check name n in m.
  54.                 Check password p of name n in m.
  55.         Otherwise if c's id is "dlg_ok",
  56.             if mdialog exists in m,
  57.                 Set m's mdialog's answer to "dlg_ok".
  58.                 Clear modal dialog in m.
  59.         Otherwise if c's id is "exitbutton",
  60.             Exit this program.
  61.  
  62.     A way to handle a keyevent 'e' in an editcontrol 'c' in a loginModule 'm',
  63.  
  64.         If e's key is the enter key,
  65.             Hide cursor in c.
  66.             Make str.  Set it to c's buffer.
  67.             Check name str in m.
  68.             Give m's entryDialog's passwordEntry keyboard focus.
  69.         If e's key is the delete key,
  70.             Delete selected user in m.
  71.  
  72.     A way to handle a keyevent 'e' in a passwordcontrol 'c' in a loginModule 'm',
  73.  
  74.         If e's key is the enter key,
  75.             Make str.  Set it to c's password.
  76.             Hide cursor in m's entryDialog's nameEntry.
  77.             Make n.  Set it to m's entryDialog's nameEntry's buffer.
  78.             Check name n in m.
  79.             Check password str of name n in m.
  80.         If e's key is the delete key,
  81.             Delete selected user in m.
  82.  
  83.     A way to delete selected user in a loginModule 'm',
  84.         If m's selectedUser > 0,
  85.             Detach m's UserList's users_'s string # (m's selectedUser).
  86.             Save m's UserList to the data "USER.DAT".
  87.             Detach m's users's userData # (m's selectedUser).
  88.             Remove string (m's selectedUser) from m's entryDialog's namelist.
  89.             Set m's selectedUser to 0.
  90.  
  91.     A way to receive an event 'e' in a control 'c' in a loginModule 'm',
  92.  
  93.         If e's originLink's target is a listbox,
  94.             Set m's selectedUser to e's index.
  95.         If str exists in e,
  96.             If c is a listbox,
  97.                 Add e's str into c.
  98.             If c is an editcontrol,
  99.                 Change the text of c to e's str.
  100.                 Give m's entryDialog's passwordEntry keyboard focus.
  101.  
  102. To log in to a loginModule 'm',
  103.     In m,
  104.         Make entryDialog.   Set it to a control of loginData's entryDialogPicture.
  105.         In it,
  106.             Make nameEntry.  Set it to a control of loginData's nameEntryData.
  107.             Make nameList.  Set it to a control of loginData's nameListData.
  108.             Subscribe nameList to nameEntry.
  109.             Subscribe nameEntry to nameList.
  110.             Give nameEntry keyboard focus.
  111.             Make passwordEntry.  Set it to a control of loginData's PasswordEntryData.
  112.             Make loginButton.  Set it to a control of loginData's loginButtonData.
  113.             Make exitButton.  Set it to a control of loginData's exitButtonData.
  114.  
  115.         Make userList. Set it to an array.
  116.         Set userList to an array of the data "USER.DAT".
  117.         Make users.  Set it to an array.
  118.         For each string 's' in userList's users_,
  119.             In users,
  120.                 Make an array of the data s.
  121.                 Make it into a userData.
  122.  
  123.         For each userData 'a' in users,
  124.             Add a's id into m's entryDialog's nameList.
  125.         Detach loginData.
  126.  
  127. To check name a string 'n' in a loginModule 'm',
  128.  
  129.     Call m's entryDialog's nameList l.
  130.     Make match.  Set it to 0.
  131.     Make data.
  132.  
  133.     Make j.  Set it to 0.
  134.     For each string 's' in l's slist,
  135.         j += 1.
  136.         If n is s,
  137.             // Name is already in the list
  138.             match = 1.
  139.             If j > the number of userDatas in m's users,
  140.                 match = 0.
  141.             Otherwise,
  142.                 Set data to m's users's userData # j.
  143.  
  144.     If match = 0,
  145.         Add n into l.
  146.         Make ns.
  147.         Make fn.  Set it to "USER".
  148.         Make pn.  Set it to "PROF".
  149.         Make nz.
  150.         Make ulink.
  151.         In m's users,
  152.             Make a userData.
  153.             //Call it u.
  154.             Set ulink to a link to it.
  155.             Set its id to n.
  156.         m's userList's count_ += 1.
  157.  
  158.         //
  159.         // Generate unique filename for user data
  160.         //
  161.         Set ns to "".  Print m's userList's count_ to ns.
  162.  
  163.         Set nz to 4 - the number of characters in ns.
  164.         while nz > 0,
  165.             Add "0" to fn.
  166.             Add "0" to pn.
  167.             nz -= 1.
  168.         Add ns to fn.
  169.         Add ns to pn.
  170.         Add ".DAT" to fn.
  171.         Add ".DAT" to pn.
  172.         call ulink's target u.
  173.         Set u's filename to fn.
  174.  
  175.         Save u.
  176.         In m's userList's users_,
  177.             Add fn.
  178.  
  179.         Save m's userList to the data "USER.DAT".
  180.         Make a.  Set it to an array.  Save it to the data pn.
  181.         Set data to u.
  182.  
  183.     If system is not loggedIn,
  184.         Log in data.
  185.  
  186.  
  187. To check password a string 'p' of name a string 'n' in a loginModule 'm',
  188.  
  189.     Call m's users u.
  190.     Make match.  Set it to 0.
  191.     For each userData 'a' in u,
  192.         If a's id is n,
  193.             If the number of characters in a's password > 0,
  194.                 If a's password is p,
  195.                     Log in a.
  196.                 Otherwise,
  197.                     Display message "Wrong Password!" in m.
  198.                     Play voice over "NARRATE\\SIPAS2.SND".
  199.             Otherwise,
  200.                 //
  201.                 // New password. Store it with user's data
  202.                 //
  203.                 Set a's password to p.
  204.                 Save a.
  205.                 Log in a.
  206.  
  207. To log in a userData 'd',
  208.  
  209.     //
  210.     // Logging in a user.
  211.     // If this is the first login of the day, distribute kCards into
  212.     // the environment.
  213.     //
  214.     Set TheUser to d.
  215.     // Print theUser.
  216.  
  217.     Make thisDate. Set it to
  218.             (today's year mod 100 * 10000) +
  219.             (today's monthNumber * 100) +
  220.             today's dayOfMonth.
  221.  
  222.     If TheUser's lastLogin != thisDate,
  223.         //
  224.         // Sprinkle kCards, etc. around in the environment for TheUser to find
  225.         //
  226.         Initialize environment for TheUser.
  227.         Set TheUser's lastLogin to thisDate.
  228.         Save TheUser.
  229.  
  230.     // Record that system is loggedin.
  231.     //
  232.     // Go to avatar selection screen
  233.     //
  234.     If system is firstTime,
  235.         Enter module "avatar" from module "profile".
  236.     Otherwise,
  237.         Enter module "profile".
  238.  
  239. // $Log: LOGIN.ACE $
  240. // Revision 1.11  1996/08/25 20:14:09  Quoc
  241. // Revision 1.10  1996/08/20 22:37:25  Quoc
  242. // Revision 1.9  1996/08/15 15:31:04  Quoc
  243. // Revision 1.8  1996/08/12 13:57:24  Quoc
  244. // Revision 1.7  1996/08/05 18:12:16  Quoc
  245. // Revision 1.6  1996/07/11 02:34:00  Quoc
  246. // Trade interface and profile screens working.
  247. // Revision 1.5  1996/07/08 10:16:07  Quoc
  248. // Profile sent to server
  249. // Revision 1.4  1996/06/30 19:12:35  SCOTTR
  250. // Another Alpha.
  251. // Set up user environment on login. Fix various bugs exposed by that.
  252. // Revision 1.3  1996/06/22 04:42:34  Quoc
  253. // Revision 1.2  1996/06/19 23:18:09  Quoc
  254. // Revision 1.1  1996/06/14 00:03:32  Quoc
  255.