File:  [LON-CAPA] / loncom / enrollment / localenroll.pm
Revision 1.42: download - view: text, annotated - select for diffs
Mon May 23 19:11:41 2011 UTC (12 years, 11 months ago) by raeburn
Branches: MAIN
CVS tags: version_2_10_X, version_2_10_1, version_2_10_0, loncapaMITrelate_1, HEAD
- Typo in documentation.

    1: # functions to glue school database system into Lon-CAPA for 
    2: # automated enrollment
    3: # $Id: localenroll.pm,v 1.42 2011/05/23 19:11:41 raeburn Exp $
    4: #
    5: # Copyright Michigan State University Board of Trustees
    6: #
    7: # This file is part of the LearningOnline Network with CAPA (LON-CAPA).
    8: #
    9: # LON-CAPA is free software; you can redistribute it and/or modify
   10: # it under the terms of the GNU General Public License as published by
   11: # the Free Software Foundation; either version 2 of the License, or
   12: # (at your option) any later version.
   13: #
   14: # LON-CAPA is distributed in the hope that it will be useful,
   15: # but WITHOUT ANY WARRANTY; without even the implied warranty of
   16: # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
   17: # GNU General Public License for more details.
   18: #
   19: # You should have received a copy of the GNU General Public License
   20: # along with LON-CAPA; if not, write to the Free Software
   21: # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
   22: #
   23: # /home/httpd/html/adm/gpl.txt
   24: #
   25: # http://www.lon-capa.org/
   26: #
   27: 
   28: =pod
   29: 
   30: =head1 NAME
   31: 
   32: localenroll
   33: 
   34: =head1 SYNOPSIS
   35: 
   36: This is part of the LearningOnline Network with CAPA project
   37: described at http://www.lon-capa.org.
   38: 
   39: 
   40: =head1 NOTABLE SUBROUTINES
   41: 
   42: =over
   43: 
   44: =cut
   45: 
   46: package localenroll;
   47: 
   48: use strict;
   49: 
   50: =pod
   51:  
   52: =item run()
   53:  set this to return 1 if you want the auto enrollment to run
   54: 
   55:  Beginning with LON-CAPA version 2.4, use of this routine is
   56:  deprecated.  Whether or not Autoenroll.pl should run is set
   57:  by the Domain Coordinator via "Set domain configuration",
   58:  provided in the Domain Management section of the Main menu. 
   59: 
   60: =cut
   61: 
   62: sub run() {
   63:     my $dom = shift;
   64:     return 0;
   65: }
   66: 
   67: 
   68: =pod
   69: 
   70: =item fetch_enrollment()
   71: 
   72:  connects to the institutional classlist data source,
   73:  reads classlist data and stores in an XML file
   74:  in /home/httpd/perl/tmp/
   75: 
   76:  classlist files are named as follows:
   77: 
   78:  DOMAIN_COURSE_INSTITUTIONALCODE_classlist.xml
   79: 
   80:  e.g., msu_43551dedcd43febmsul1_fs03nop590001_classlist.xml
   81:  where DOMAIN = msu  COURSE = 43551dedcd43febmsul1 
   82:  INSTITUTIONALCODE = fs03nop590001 
   83:  (MSU's course naming scheme - fs03 = Fall semester 2003, nop =
   84:  department name, 590 = course number, 001 = section number.)
   85: 
   86:  fetch_enrollment requires three arguments -
   87:  $dom - DOMAIN e.g., msu
   88:  $affiliatesref - a reference to a hash of arrays that contains LON-CAPA 
   89:  courses that are to be updated as keys, and institutional coursecodes 
   90:  contributing enrollment to that LON-CAPA course as elements in each array.
   91:  $replyref - a reference to a hash that contains LON-CAPA courses
   92:  that are to be updated as keys, and the total enrollment count in all 
   93:  affiliated sections, as determined from institutional data as hash elements. 
   94: 
   95:  As an example, if fetch_enrollment is called to retrieve institutional
   96:  classlists for a single LON-CAPA course - 43551dedcd43febmsul1 which 
   97:  corresponds to fs03nop590, sections 001, 601 and 602 , and the course
   98:  also accommodates enrollment from a crosslisted course in the ost
   99:  department - fs03ost580002:
  100: 
  101:  the affiliatesref would be a reference to %affiliates which would be:
  102: 
  103:  @{$affiliates{'43551dedcd43febmsul1'}} =
  104:    ("fs03nop590001","fs03nop590601","fs03nop590602","fs03ost580002");
  105: 
  106:  fetch_enrollment would create four files in /home/httpd/perl/tmp/.
  107:  msu_43551dedcd43febmsul1_fs03nop590001_classlist.xml
  108:  msu_43551dedcd43febmsul1_fs03nop590601_classlist.xml
  109:  msu_43551dedcd43febmsul1_fs03nop590602_classlist.xml
  110:  msu_43551dedcd43febmsul1_fs03ost580002_classlist.xml
  111: 
  112:  In each file, student data would be stored in the following format
  113:  
  114:  <student username="smith">
  115:   <autharg>MSU.EDU</autharg>
  116:   <authtype>krb4</authtype>
  117:   <email>smith@msu.edu</email>
  118:   <enddate></enddate>
  119:   <firstname>John</firstname>
  120:   <generation>II</generation>
  121:   <groupID>fs03nop590001</groupID>
  122:   <lastname>Smith</lastname>
  123:   <middlename>D</middlename>
  124:   <startdate></startdate>
  125:   <studentID>A12345678</studentID>
  126:  </student>
  127:  
  128:  with the following at the top of the file
  129: <?xml version="1.0" encoding="UTF-8"?>
  130: <!DOCTYPE text>
  131: <students>
  132: 
  133:  (all comment - s removed)
  134: 
  135:  and a closing:
  136: </students>
  137: 
  138:  The <startdate> and the <enddate> are the activation date and expiration date
  139:  for this student's role. If they are absent, then the default access start and
  140:  default access end dates are used. The default access dates can be set when 
  141:  the course is created, and can be modified using the Automated Enrollment
  142:  Manager, or via the 'Upload a class list','Enroll a single student' or 
  143:  'Modify student data' utilities in the Enrollment Manager, by checking the 
  144:  'make these dates the default for future enrollment' checkbox. If no default 
  145:  dates have been set, then the tudent role will be active immediately, and will 
  146:  remain active until the role is explicitly expired using ENRL -> Drop students. 
  147:  If dates are to included in the XML file, they should be in the format
  148:  YYYY:MM:DD:HH:MM:SS (: separators required).
  149: 
  150:  If there were 10 students in fs03nop590001, 5 students in fs03nop59o601, 
  151:  8 students in fs03nop590602, and 2 students in fs03ost580002,
  152:  then $$reply{'43551dedcd43febmsul1'} = 25
  153: 
  154:  The purpose of the %reply hash is to detect cases where the institutional 
  155:  enrollment is 0 (most likely due to a problem with the data source).
  156:  In such a case, the LON-CAPA course roster is left unchanged (i.e., no
  157:  students are expired, even if automated drops is enabled.
  158:  
  159:  fetch_enrollment should return a 0 or 1, depending on whether a connection
  160:  could be established to the institutional data source.
  161:  0 is returned if no connection could be made.
  162:  1 is returned if connection was successful
  163: 
  164:  A return of 1 is required for the calling modules to perform LON-CAPA
  165:  roster changes based on the contents of the XML classlist file(s), e,g,,
  166:  msu_43551dedcd43febmsul1_fs03nop590001_classlist.xml
  167: 
  168:  XML classlist files are temporary. They are deleted after the enrollment 
  169:  update process in the calling module is complete.
  170: 
  171: 
  172: =cut
  173: 
  174: sub fetch_enrollment {
  175:     my ($dom,$affiliatesref,$replyref) = @_;
  176:     foreach my $crs (sort keys %{$affiliatesref}) {
  177:         $$replyref{$crs} = 0;
  178:     }
  179:     my $okflag = 0;
  180:     return $okflag;
  181: }
  182: 
  183: =pod
  184: 
  185: =item get_sections()
  186: 
  187:  This is called by the Automated Enrollment Manager interface
  188:  (lonpopulate.pm) to create an array of valid sections for 
  189:  a specific institutional coursecode.
  190:  e.g., for MSU coursecode: fs03nop590
  191:  ("001","601","602") would be returned
  192: 
  193:  If the array returned contains at least one element, then 
  194:  the interface offerred to the course coordinator, lists
  195:  official sections and provides a checkbox to use to
  196:  select enrollment in the LON-CAPA course from each official section.  
  197: 
  198:  get_sections takes two arguments - (a) the institutional coursecode
  199:  (in the MSU case this is a concatenation of semester code, department
  200:  and course number), and (b) the LON-CAPA domain that contains the course. 
  201:  
  202:  If there is no access to official course sections at your institution,
  203:  then an empty array is returned, and the Automated Enrollment Manager
  204:  interface will allow the course coordinator to enter section numbers
  205:  in text boxes.
  206:  
  207: 
  208: 
  209: =cut
  210: 
  211: sub get_sections {
  212:     my ($coursecode,$dom) = @_;
  213:     my @secs = ();
  214:     return @secs;
  215: }
  216: 
  217: =pod
  218: 
  219: =item new_course()
  220: 
  221:  This is called by loncreatecourse.pm and 
  222:  lonpopulate.pm to record that fact that a new course section
  223:  has been added to LON-CAPA that requires access to institutional data
  224:  At MSU, this is required, as institutional classlists can only made
  225:  available to faculty who are officially assigned to a course.
  226:  
  227:  The new_course subroutine is used to check that the course owner
  228:  of the LON-CAPA course is permitted to access the institutional
  229:  classlist for any course sections and crosslisted classes that
  230:  the course coordinator wishes to have affiliated with the course.
  231:  
  232:  If access is permitted, then 'ok' is returned.
  233:  The course section or crosslisted course will only be added to the list of
  234:  affiliates if 'ok' is returned.
  235: 
  236:  new_course takes three required arguments -
  237:  (a) the institutional courseID (in the MSU case this is a concatenation of 
  238:  semester code, department code, course number, and section number
  239:  e.g., fs03nop590001).
  240:  (b) the course owner. This is the LON-CAPA username and domain of the course 
  241:  coordinator assigned to the course when it is first created, in the form
  242:  username:domain
  243:  (c) the LON-CAPA domain that contains the course
  244: 
  245:  new_course also takes a fourth (optional) argument -
  246:  (d) the course co-owners, as a comma-separated list of username:domain for
  247:  any co-owners. 
  248: 
  249: =cut
  250: 
  251: sub new_course  {
  252:     my ($course_id,$owner,$dom,$coowners) = @_;
  253:     my $outcome = 'ok';
  254:     return $outcome;
  255: }
  256: 
  257: =pod
  258: 
  259: =item validate_courseID()
  260: 
  261:  This is called whenever a new course section or crosslisted course
  262:  is being affiliated with a LON-CAPA course (i.e., by loncreatecourse.pm
  263:  and the Automated Enrollment Manager in lonpopulate.pm).
  264:  A check is made that the courseID that the course coordinator wishes
  265:  to affiliate with the course is valid according to the institutional
  266:  schedule of official classes 
  267: 
  268:  A valid courseID is confirmed by returning 'ok'
  269: 
  270:  validate_courseID takes two arguments -
  271:  (a) the institutional courseID (in the MSU case this is a concatenation of
  272:  semester code, department code, course number, and section number
  273:  e.g., fs03nop590001).
  274:  (b) the LON-CAPA domain that contains the course
  275: 
  276: =cut  
  277: 
  278: sub validate_courseID {
  279:     my ($course_id,$dom) = @_;
  280:     my $outcome = 'ok';
  281:     return $outcome;   
  282: }
  283: 
  284: =pod
  285: 
  286: =item validate_instcode()
  287: 
  288: This is called when a request is being made for an official course.
  289: A check is made that the institutional code for which a course is
  290: is being requested is valid according to the institutional
  291: schedule of official classes.
  292: 
  293: If the username of the course owner is provided, a more restrictive
  294: test is used, namely that the requestor is listed as instructor of
  295: record for the course in the institution's course schedule/database.
  296: 
  297: validate_instcode takes three arguments -
  298:  (a) the LON-CAPA domain that will contain the course
  299:  (b) the institutional code (in the MSU case this is a concatenation of
  300:  semester code, department code, and course number, e.g., fs03nop590.
  301:  (c) an optional institutional username for the course owner.
  302: 
  303: An array is returned containing (a) the result of the check for a valid 
  304: instcode, and (b) an (optional) course description.   
  305: A valid instcode is confirmed by returning 'valid'.
  306: If no course description is available, '' should be set as
  307: the value of the second item in the returned array.
  308: 
  309: =cut
  310: 
  311: sub validate_instcode {
  312:     my ($dom,$instcode,$owner) = @_;
  313:     my $outcome = '';
  314:     my $description = '';
  315:     return ($outcome,$description);
  316: }
  317: 
  318: =pod
  319: 
  320: =item validate_crsreq()
  321: 
  322: This is used to check whether a course request should be processed
  323: automatically, or held in a queue pending administrative action at
  324: the institution.
  325: 
  326: Course requests will trigger this check if the process type has been set 
  327: to 'validate' for the course type (official, unofficial or community) and
  328: the requestor's affiliation.  Whether "validate" is an available option
  329: in the Domain Configuration menu is controlled by auto_courserequest_checks(). 
  330: One scenario is where the request is for an official course, in which case
  331: a check could be made that the requestor is listed as instructor of 
  332: record for the course in the institution's course schedule/database.
  333: 
  334: Other scenarios are possible, and the routine can be customized according
  335: to whatever rules a domain wishes to implement to run validations against
  336: given the data passed in to the routine.
  337: 
  338: validate_crsreq takes six arguments -
  339:  (a) the LON-CAPA domain that will contain the course.
  340:  (b) the username:domain for the course owner.
  341:  (c) the course type (official, unofficial or community)
  342:  (d) a comma-separated list of institutional affiliations of 
  343:      the course owner.
  344:  (e) the institutional code (in the MSU case this is a concatenation of
  345:  semester code, department code, and course number, e.g., fs03nop590.
  346:  (f) a comma-separated list of institutional sections included in
  347:      the course request (only applicable to official courses).
  348: 
  349: A valid courserequest is confirmed by returning 'process'.
  350: The following can be returned: process, rejected, pending, approval or error (with error condition - no :), followed by a : and then an optional message. 
  351: 
  352: (a) process  - the requestor is the recorded instructor - create the course
  353: (b) rejected - the requestor should never be requesting this course, reject the
  354:     request permanently
  355: (c) pending - the requestor is not the recorded instructor, but could
  356:     become so after administrative action at the institution. Put the
  357:     request in a queue and check localenroll:validate_instcode()
  358:     periodically until the status changes to "valid".
  359: (d) approval - the request will be held pending review by a Domain Coordinator.
  360: (e) error (followed by the error condition).
  361: 
  362: =cut
  363: 
  364: sub validate_crsreq {
  365:     my ($dom,$owner,$crstype,$inststatuslist,$instcode,$instseclist) = @_;
  366:     my $outcome = 'approval';
  367:     return $outcome;
  368: }
  369: 
  370: =pod 
  371: 
  372: =item crsreq_checks()
  373: 
  374: This is used to determine whether the "validate" option should appear in the
  375: possible choices for course request processing in the Domain Configuration 
  376: menu for Course Requests. Ultimately it is called by domainprefs.pm (via: 
  377: lonnet -> lond -> localenroll.pm) The domain configuration menu includes 
  378: a table where columns are course type (official, unofficial or community) 
  379: and rows are institutional affiliations (e.g., Faculty, Staff, Student etc.).
  380: 
  381: crsreq_checks() takes three arguments: $dom, $reqtypes, $validations.
  382: $dom - the domain for which validation options are needed.
  383: $reqtypes - ref to an ARRAY of course types (i.e., official, unofficial and community.
  384: $validations - ref to a hash of a hash which will determine whether "validate"
  385: will be one of the possible choices for each course type (outer hash key),
  386: and institutional type (inner hash key).
  387: 
  388: For example to allow validate to be a choice for official classes for Faculty,
  389: req_checks would include:
  390: 
  391: $validations{'official'}{'Faculty'} = 1;
  392: 
  393: This routine is closely tied to validate_crsreq(). "Validate" should not be
  394: a possible choice in the domain configuration menu for a particular course
  395: type/institutional affiliation, unless a corresponding validation code has
  396: been implemented in validate_crsreq().
  397: 
  398: For example at MSU, official courses requested by Faculty will be validated
  399: against the official schedule of classes to check that the requestor is one
  400: of the instructors of record for the course.  In this case validate_crsreq()
  401: includes a call to validate_instcode().
  402: 
  403: =cut
  404: 
  405: sub crsreq_checks {
  406:     my ($dom,$reqtypes,$validations) = @_;
  407:     if ((ref($reqtypes) eq 'ARRAY') && (ref($validations) eq 'HASH')) {
  408:         my (%usertypes,@order);
  409:         if (&inst_usertypes($dom,\%usertypes,\@order) eq 'ok') {
  410:             foreach my $type (@{$reqtypes}) {
  411:                 foreach my $inst_type (@order) {
  412:                     $validations->{$type}{$inst_type} = 0;
  413:                 }
  414:             }
  415:         }
  416:     }
  417:     return 'ok';
  418: }
  419: 
  420: =pod
  421: 
  422: =item create_password()
  423: 
  424:  This is called when the authentication method set for the automated 
  425:  enrollment process when enrolling new users in the domain is "localauth".
  426:  This could be signalled for the specific user by the value of localauth
  427:  for the <authtype> tag from the classlist.xml files, or if this is blank,
  428:  the default authtype, set by the domain coordinator when creating the course
  429:  with loncreatecourse.pm.
  430:   
  431:  create_password takes three arguments -
  432:  (a) $authparam - the value of <autharg> from the classlist.xml files,
  433:  or if this blank, the default autharg, set by the domain coordinator when 
  434:  creating the course with loncreatecourse.pm
  435:  (b) $dom - the domain of the new user.
  436:  (c) $username - the username of the new user (currently not actually used)
  437: 
  438:  Four values are returned:
  439:  (a) the value of $authparam - which might have been changed
  440:  (b) a flag to indicate whether a password had been created
  441:  0 means no password created
  442:  1 means password created.  In this case the calling module - Enrollment.pm
  443:  will send the LON-CAPA username and password to the new user's e-mail
  444:  (if one was provided), or to the course owner (if one was not provided and
  445:  the new user was created by the automated process), or to the active
  446:  course coordinator (if the new user was created using the 'update roster
  447:  now' interface included in the Automated Enrollment Manager).  
  448:  (c) a flag to indicate that the authentication method is correct - 'ok'.
  449:  If $authchk is not set to 'ok' then account creation and enrollment of the 
  450:  new user will not occur.
  451:  (d) if a password was created it can be sent along.  This is the password 
  452:  which will be included in the e-mail sent to the new user, or made available    
  453:  to the course owner/course coordinator if no e-mail address is provided. If
  454:  you do not wish to send a password, but want to give instructions on obtaining
  455:  one, you could set $newpasswd as those instructions. (e.g.,
  456:  $newpasswd = '(Please visit room 212, ACNS Bldg. to obtain your password)';
  457:  The value of $newpasswd is NOT written in the user's LON-CAPA passwd file in
  458:  /home/httpd/lonUsers/$dom/a/b/c/abcuser/passwd, which in the case of a user
  459:  employing localauth will contain 'localauth:$authparam'.  If you need to include
  460:  a parameter in the user's passwd file, you should return it as $authparam,
  461:  i.e., the first of the variables returned by create_password().             
  462: 
  463: 
  464: =cut 
  465: 
  466: sub create_password {
  467:     my ($authparam,$dom,$username) = @_;
  468:     my $authchk = 'ok';
  469:     my $newpasswd = '';
  470:     my $create_passwd = 0;
  471:     return ($authparam,$create_passwd,$authchk,$newpasswd);
  472: }
  473: 
  474: =pod
  475: 
  476: =item instcode_format()
  477: 
  478:  Split coursecodes into constituent parts.   
  479:  e.g., INSTITUTIONALCODE = fs03nop590, LON-CAPA COURSEID: 43551dedcd43febmsul1
  480:  (MSU's course naming scheme - fs03 = Fall semester 2003, nop =
  481:  department name, 590 = course number)
  482: 
  483:  Incoming data:
  484:  $dom (domain)
  485:  $$instcodes{'43551dedcd43febmsul1'} = 'fs03nop590' (hash of courseIDs)
  486:  
  487:  fs03nop590 would be split as follows
  488:  @{$codetitles} = ("year","semester","department","number")
  489:  $$codes{'year'} = '2003'
  490:  $$codes{'semester'} = 'Fall'
  491:  $$codes{'department'} = 'nop'
  492:  $$codes{'number'} = '590'
  493: 
  494:  requires six arguments:
  495:  domain ($dom)
  496:  reference to hash of institutional course IDs ($instcodes)  
  497:  reference to hash of codes ($codes)
  498:  reference to array of titles ($codetitles)
  499:  reference to hash of abbreviations used in categories
  500:  reference to hash of arrays specifying sort order used in category titles   
  501: 
  502:  e.g.,     %{$$cat_titles{'Semester'}} = (
  503:                    fs => 'Fall',
  504:                    ss => 'Spring',
  505:                    us => 'Summer');
  506: 
  507:  e.g., @{$$cat_order{'Semester'}} = ('ss','us','fs'); 
  508:  returns 1 parameter: 'ok' if no processing errors. 
  509: 
  510:  Detailed help:
  511:  http://yourloncapaserver/adm/help/Institutional_Integration_Course_Codes.hlp
  512: 
  513: =cut
  514: 
  515: 
  516: sub instcode_format () {
  517:     my ($dom,$instcodes,$codes,$codetitles,$cat_titles,$cat_order) = @_;
  518:     my $outcome = 'ok';
  519:     return $outcome;
  520: }
  521: 
  522: =pod
  523: 
  524: =item possible_instcodes()
  525: 
  526: Gather acceptable values for institutional categories to use in course creation request form for official courses.
  527: 
  528:  requires five arguments:
  529: 
  530:  domain ($dom)
  531:  reference to array of titles ($codetitles)
  532:  reference to hash of abbreviations used in categories ($cat_titles).
  533:  reference to hash of arrays specifying sort order used in 
  534:            category titles ($cat_order).
  535:  reference to array which will contain order of component parts used 
  536:            in institutional code ($code_order).
  537: 
  538:  e.g., 
  539:  @{$codetitles} = ('Year','Semester',"Department','Number');
  540: 
  541:  %{$$cat_titles{'Semester'}} = (
  542:                    fs => 'Fall',
  543:                    ss => 'Spring',
  544:                    us => 'Summer');
  545: 
  546:  @{$$cat_order{'Semester'}} = ('ss','us','fs');
  547:  @{$code_order} = ('Semester','Year','Department','Number');
  548: 
  549:  returns 1 parameter: 'ok' if no processing errors.
  550: 
  551: =cut
  552: 
  553: sub possible_instcodes {
  554:     my ($dom,$codetitles,$cat_titles,$cat_order,$code_order) = @_;
  555:     @{$codetitles} = ();
  556:     %{$$cat_titles{'Semester'}} = ();
  557:     @{$$cat_order{'Semester'}} = ('ss','us','fs');
  558:     @{$code_order} = ();
  559:     return 'ok';
  560: }
  561: 
  562: 
  563: =pod
  564: 
  565: =item institutional_photos()
  566: 
  567:  Called when automated enrollment manager is used to update student photos.
  568: 
  569:  Incoming data: six arguments
  570:  (a) $dom (domain)
  571:  (b) $crs (LONCAPA course number)
  572:  (c) $affiliates: a reference to a hash with the keys set to the 
  573:  institutional course IDs for the course.
  574:  (d) $result: a reference to a hash which will return usernames  
  575:      of students (& separated) in following categories (the keys):
  576:      new, update, missing, same, deleted, noid, nouser. The list 
  577:      includes those students for whom the result of the modification 
  578:      process was either addition of a new photo. update of an
  579:      existing photo, photo was found to be missing from institution's
  580:      data store, photo used is same as before, or photo was 
  581:      deleted from storage on LON-CAPA server housing student's
  582:      information, no student/employee ID was available. 
  583:                
  584:  (e) $action: the type of action needed. (e.g., update, delete);
  585:  (f) $students: a reference to a hash with the keys set to student 
  586:  usernames and domains in the form username:domain, and values set
  587:  to the studentID, if action is required for specific students.  
  588: 
  589:  returns 1 parameter: 'ok' if no processing errors.
  590:  other course or student specific values can be stored as values
  591:  in the appropriate referenced hashes. 
  592: 
  593: =cut
  594: 
  595: sub institutional_photos {
  596:     my ($dom,$crs,$affiliates,$result,$action,$students) = @_;
  597:     my $outcome = 'ok';
  598:     return $outcome;
  599: }
  600: 
  601: =pod
  602: 
  603: =item photo_permission()
  604: 
  605:  Incoming data: three arguments
  606:  (a) $dom (domain)
  607:  (b) $perm_reqd: a reference to a a scalar that is either 'yes'
  608:  if a course owner must indicate acceptance of conditions of use,
  609:  'no' otherwise.
  610:  (c) $conditions: the text of the conditions of use.
  611:     
  612:  returns 1 parameter: 'ok' if no processing errors.
  613:  $$perm_reqd is set to 'yes' or 'no'
  614:  $$agreement is set to conditions of use - plain text string
  615:              which will be displayed in a textarea in a web form.
  616: 
  617: 
  618: =cut
  619: 
  620: sub photo_permission {
  621:    my ($dom,$perm_reqd,$conditions) = @_;
  622:    $$perm_reqd = 'no';
  623:    $$conditions = '';
  624:    my $outcome = 'ok';
  625:    return $outcome;
  626: }
  627: 
  628: =pod
  629: 
  630: =item manager_photo_update()
  631: 
  632:  Incoming data: one argument
  633:  (a) $dom (domain)
  634: 
  635:  returns 2 parameters: update (0 or 1), and comment.
  636:  Called by automated enrollment manager, to determine 
  637:  whether "Update Student photos" button will be available,
  638:  and if so, the message (plain text string) that will be displayed
  639:  with the button. 
  640: 
  641: 
  642: =cut
  643:                                                                                         
  644: sub manager_photo_update {
  645:     my ($dom) = @_;
  646:     my $update = 0;
  647:     my $comment = '';
  648:     return ($update,$comment);
  649: }
  650: 
  651: =pod
  652: 
  653: 
  654: =item check_section()
  655: 
  656:  Incoming data: three arguments (+ fourth optional argument)
  657:  (a) $class - institutional class id (coursecode concatanated with section) 
  658:  (b) $owner - course owner (2.2 and later username:domain; pre-2.2 username;
  659:                             2.6 and later - comma-separated list of 
  660:                             username:domain for course owner and co-owners.)
  661:  (c) $dom - domain of course
  662:  (d) $dbh - optional database handle
  663: 
  664:  returns 1 parameter - $sectioncheck ('ok' or other value). 
  665:  Verifies that at least one of the course owner (or co-owners) have access 
  666:  to classlist for specific class according to institution's SIS
  667:  'ok' if access available  
  668: 
  669: 
  670: =cut
  671: 
  672: sub check_section {
  673:     my ($class,$owner,$dom,$dbh) = @_;
  674:     my $sectioncheck = 'ok';
  675:     return $sectioncheck;
  676: }
  677: 
  678: =pod
  679: 
  680: =item instcode_defaults()
  681: 
  682:  Incoming data: three arguments
  683:  (a) $dom - domain
  684:  (b) $defaults - reference to hash which will contain default regular
  685:                  expression matches for different components of an 
  686:                  institutional course code 
  687:  (c) $code_order - reference to array which will contain order of 
  688:                    component parts used in institutional code.  
  689: 
  690:  returns 1 parameter - ('ok' or other value).
  691:  Used to construct a regular expression to be used when searching for
  692:  courses based on fragments of an institutional code.
  693:  $defaults contains defaults to use for each component, and code_order
  694:  contains keys of hash in order in which they are to be concatenated.
  695: 
  696:  e.g., INSTITUTIONALCODE = fs03nop590
  697:  (MSU's course naming scheme - fs  = semester, 03 = year, nop =
  698:  department name, 590 = course number)
  699: 
  700:      %{$defaults} = (
  701:         'Year' => '\d{2}',
  702:         'Semester' => '^[sfu]s', 
  703:         'Department' => '\w{2,3}',
  704:         'Number' => '\d{3,4}\w?',
  705:      );
  706: 
  707:      @{$code_order} = ('Semester','Year','Department','Number');
  708: 
  709:  Detailed help:
  710:  http://yourloncapaserver/adm/help/Institutional_Integration_Course_Codes.hlp
  711: 
  712: =cut
  713: 
  714: sub instcode_defaults {
  715:     my ($dom,$defaults,$code_order) = @_;
  716:     return 'ok';
  717: }
  718: 
  719: 
  720: =pod
  721: 
  722: =item allusers_info()
  723: 
  724:  Incoming data: three arguments
  725:  (a) $dom - domain
  726:  (b) $instusers - reference to hash which will contain hashes, 
  727:                  where keys will be usernames and value will be a 
  728:                  hash of user information. Keys in the inner hash 
  729:                  will be some or all of: lastname,firstname,
  730:                  middlename, generation, id, inststatus - 
  731:                  institutional status (e.g., faculty,staff,student)
  732:                  Values are all scalars except inststatus,
  733:                  which is an array.
  734:  (c) $instids - reference to hash which will contain ID numbers. 
  735:                 keys will be unique IDs (student or faculty/staff ID)
  736:                 values will be either: scalar (username) or an array 
  737:                 if a single ID matches multiple usernames.
  738:  returns 1 parameter - 'ok' if no processing error, or other value 
  739:                        if an error occurred.
  740:  side effects - populates the $instusers and $instids refs to hashes.
  741:                 with information for all users from all available 
  742:                 institutional datafeeds.
  743: 
  744: 
  745: =cut
  746: 
  747: sub allusers_info {
  748:     my ($dom,$instusers,$instids) = @_;
  749:     my $outcome = 'ok';
  750:     return $outcome; 
  751: }
  752: 
  753: =pod
  754: 
  755: =item get_userinfo()
  756: 
  757:  Incoming data: four required arguments and additional optional arguments
  758:  Two modes of operation:
  759:  (1) Retrieves institutional data for a single user either by username
  760:      if $uname is included as second argument, or by ID if $id is 
  761:      included as a third argument.  Either (b) or (c) must be provided.
  762:      (g), (h) and (i) will be undefined.
  763:  (2) Retrieves institutional user data from search of an institutional
  764:      directory based on a search. (g) and (h) are required.
  765:      (i) is optional. (b) and (c) will be undefined. 
  766: 
  767:  (a) $dom - domain
  768:  (b) $uname - username of user
  769:  (c) $id - student/faculty ID of user
  770:  (d) $instusers - reference to hash which will contain info for user
  771:                  as key = value; keys will be one or all of:
  772:                  lastname,firstname,middlename,generation,id,inststatus -
  773:                  institutional status (e.g., faculty,staff,student)
  774:                  Values are all scalars except inststatus,
  775:                  which is an array.
  776:  (e) $instids - reference to hash which will contain ID numbers - 
  777:                  keys will be unique IDs (student or faculty/staff ID)  
  778:                  values will be either: scalar (username) or an array
  779:                  if a single ID matches multiple usernames.
  780:  (f) $types - optional reference to array which contains 
  781:               institutional types to check.
  782:  (g) $srchby - optional if $uname or $id defined, otherwise required.
  783:                Allowed values include: 1. lastfirst, 2. last, 3. uname
  784:                corresponding to searches by 1. lastname,firstname;
  785:                2. lastname; 3. username
  786:  (h) $srchterm - optional if $uname or $id defined, otherwise required
  787:                 String to search for.
  788:  (i) $srchtype - optional. Allowed values: contains, begins (defaults
  789:                 to exact match otherwise).
  790: 
  791:  returns 1 parameter - 'ok' if no processing error, or other value 
  792:                        if an error occurred.
  793:  side effects - populates the $instusers and $instids refs to hashes.
  794:                 with information for specified username, or specified
  795:                 id, if fifth argument provided, from all available, or 
  796:                 specified (e.g., faculty only) institutional datafeeds,
  797:                 if sixth argument provided.
  798: 
  799:  WARNING: You need to set $outcome to 'ok' once you have customized
  800:           this routine to communicate with an instititional 
  801:           directory data source, otherwise institutional directory 
  802:           searches will always be reported as being unavailable
  803:           in domain $dom.
  804: 
  805: =cut
  806: 
  807: sub get_userinfo {
  808:     my ($dom,$uname,$id,$instusers,$instids,$types,
  809:         $srchby,$srchterm,$srchtype) = @_;
  810:     my $outcome = 'unavailable';
  811:     return $outcome;
  812: }
  813: 
  814: =pod
  815: 
  816: =item inst_usertypes() 
  817: 
  818:  Incoming data: three arguments
  819:  (a) $dom - domain
  820:  (b) $usertypes - reference to hash which will contain 
  821:                  key = value, where keys are institution 
  822:                  affiliation types (e.g., Faculty, Student etc.)
  823:                  and values are titles (e.g., Faculty/Academic Staff)
  824:  (c) $order - reference to array which will contain the order in
  825:               which institutional types should be shown
  826:               when displaying data tables (e.g., default quotas    
  827:               or updateable user fields (see domainprefs.pm) 
  828:  returns 1 parameter - 'ok' if no processing error, or other value 
  829:                         if an error occurred.
  830: 
  831: 
  832: =cut
  833: 
  834: sub inst_usertypes {
  835:     my ($dom,$usertypes,$order) = @_;
  836:     @{$order} = ();
  837:     %{$usertypes} = ();
  838:     my $outcome = 'ok';
  839:     return $outcome;
  840: }
  841: 
  842: =pod
  843: 
  844: =item username_rules()
  845: 
  846:  Incoming data: three arguments 
  847:  (a) $dom - domain
  848:  (b) $ruleshash - reference to hash containing rules
  849:                   (a hash of a hash)
  850:                   keys of top level hash are short names  
  851:                    (e.g., netid, noncredit) 
  852:                   for each key, value is a hash
  853:                       desc => long name for rule  
  854:                       rule => description of rule
  855:                       authtype => (krb5,krb4,int, or loc)
  856:                                  authentication type for rule 
  857:                       authparm => authentication parameter for rule
  858:                       authparmfixed => 1 if authparm used when
  859:                           creating user for rule must be authparm  
  860:                       authmsg => Message to display describing 
  861:                                  authentication to use for this rule
  862: 
  863:  (c) $rulesorder - reference to array containing rule names 
  864:                    in order to be displayed
  865: 
  866: 
  867:   returns 'ok' if no processing error.
  868: 
  869: =cut
  870: 
  871: sub username_rules {
  872:     my ($dom,$ruleshash,$rulesorder) = @_;
  873:     my $outcome;
  874:     return $outcome;
  875: }
  876: 
  877: =pod
  878: 
  879: =item id_rules()
  880: 
  881:  Incoming data: three arguments
  882:  (a) $dom - domain
  883:  (b) $ruleshash - reference to hash containing rules
  884:                   (a hash of a hash)
  885:                   keys of top level hash are short names
  886:                    (e.g., netid, noncredit)
  887:                   for each key, value is a hash
  888:                       desc => long name for rule
  889:                       rule => description of rule
  890: 
  891:  (c) $rulesorder - reference to array containing rule names
  892:                    in order to be displayed
  893: 
  894:   returns 'ok' if no processing error.
  895: 
  896: =cut
  897: 
  898: sub id_rules {
  899:     my ($dom,$ruleshash,$rulesorder) = @_;
  900:     my $outcome;
  901:     return $outcome;
  902: }
  903: 
  904: =pod
  905: 
  906: =item selfcreate_rules()
  907: 
  908:  Incoming data: three arguments
  909:  (a) $dom - domain
  910:  (b) $ruleshash - reference to hash containing rules
  911:                   (a hash of a hash)
  912:                   keys of top level hash are short names
  913:                    (e.g., netid)
  914:                   for each key, value is a hash
  915:                       desc => long name for rule
  916:                       rule => description of rule
  917: 
  918:  (c) $rulesorder - reference to array containing rule names
  919:                    in order to be displayed
  920: 
  921:   returns 'ok' if no processing error.
  922: 
  923: 
  924: =cut
  925: 
  926: sub selfcreate_rules {
  927:     my ($dom,$ruleshash,$rulesorder) = @_;
  928:     my $outcome;
  929:     return $outcome;
  930: }
  931: 
  932: =pod
  933: 
  934: =item username_check() 
  935: 
  936:  Incoming data: four arguments
  937:  (a) $dom - domain (scalar) 
  938:  (b) $uname - username to compare against rules (scalar)
  939:  (c) $to_check (reference to array of rule names to check)
  940:  (d) $resultshash (reference to hash of results)
  941:                     hash of results for rule checked
  942:                    - keys are rule names
  943:                    - values are: 1 or 0 (for matched or unmatched) 
  944: 
  945:  returns 'ok' if no processing error.
  946: 
  947: 
  948: =cut
  949: 
  950: sub username_check {
  951:     my ($dom,$uname,$to_check,$resultshash) = @_;
  952:     my $outcome;
  953:     return $outcome; 
  954: }
  955: 
  956: =pod
  957: 
  958: =item id_check()
  959: 
  960:  Incoming data: four arguments
  961:  (a) $dom - domain (scalar)
  962:  (b) $id - ID to compare against rules (scalar)
  963:  (c) $to_check (reference to array of rule names to check)
  964:  (d) $resultshash (reference to hash of results)
  965:                     hash of results for rule checked
  966:                    - keys are rule names
  967:                    - values are: 1 or 0 (for matched or unmatched)
  968: 
  969:  returns 'ok' if no processing error.
  970: 
  971: 
  972: =cut
  973: 
  974: sub id_check {
  975:     my ($dom,$id,$to_check,$resultshash) = @_;
  976:     my $outcome;
  977:     return $outcome;
  978: }
  979: 
  980: =pod
  981: 
  982: =item selfcreate_check()
  983: 
  984:  Incoming data: four arguments
  985:  (a) $dom - domain (scalar)
  986:  (b) $selfcreatename - e-mail proposed as username (compare against rules - scalar)
  987:  (c) $to_check (reference to array of rule names to check)
  988:  (d) $resultshash (reference to hash of results)
  989:                    hash of results for rule checked
  990:                    - keys are rule names
  991:                    - values are: 1 or 0 (for matched or unmatched)
  992: 
  993:  returns 'ok' if no processing error.
  994: 
  995: 
  996: =cut
  997: 
  998: sub selfcreate_check {
  999:     my ($dom,$selfcreatename,$to_check,$resultshash) = @_;
 1000:     my $outcome;
 1001:     return $outcome;
 1002: }
 1003: 
 1004: =pod
 1005: 
 1006: =item AUTOLOAD()
 1007: 
 1008:  Incoming data: none
 1009:  Returns ''
 1010: 
 1011:  Prevents errors when undefined subroutines are called in this package
 1012:  Will allow new routines added in the future to be called from lond etc.
 1013:  without the need for customized versions of local*.pm packages to be
 1014:  modified to include the new subroutines immediately.
 1015: 
 1016:  See "Programming Perl" 3rd ed. pp 296-298.   
 1017: 
 1018: =back
 1019: 
 1020: =cut
 1021: 
 1022: sub AUTOLOAD {
 1023:     our $AUTOLOAD;
 1024:     return '';
 1025: }
 1026: 
 1027: 1;

FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>