Annotation of loncom/enrollment/localenroll.pm, revision 1.60

1.5       albertel    1: # functions to glue school database system into Lon-CAPA for 
                      2: # automated enrollment
1.60    ! raeburn     3: # $Id: localenroll.pm,v 1.59 2018/06/14 04:11:49 raeburn Exp $
1.5       albertel    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: #
1.32      jms        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: =cut
                     43: 
1.4       raeburn    44: package localenroll;
                     45: 
                     46: use strict;
1.6       albertel   47: 
1.32      jms        48: =pod
1.58      raeburn    49: 
                     50: =over
1.32      jms        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
1.6       albertel   61: 
1.9       raeburn    62: sub run() {
                     63:     my $dom = shift;
                     64:     return 0;
                     65: }
1.4       raeburn    66: 
1.32      jms        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>
1.44      raeburn   126:   <credits></credits>
                    127:   <inststatus></inststatus>
1.32      jms       128:  </student>
                    129:  
                    130:  with the following at the top of the file
                    131: <?xml version="1.0" encoding="UTF-8"?>
                    132: <!DOCTYPE text>
                    133: <students>
                    134: 
                    135:  (all comment - s removed)
                    136: 
                    137:  and a closing:
                    138: </students>
                    139: 
                    140:  The <startdate> and the <enddate> are the activation date and expiration date
                    141:  for this student's role. If they are absent, then the default access start and
                    142:  default access end dates are used. The default access dates can be set when 
                    143:  the course is created, and can be modified using the Automated Enrollment
                    144:  Manager, or via the 'Upload a class list','Enroll a single student' or 
                    145:  'Modify student data' utilities in the Enrollment Manager, by checking the 
                    146:  'make these dates the default for future enrollment' checkbox. If no default 
1.60    ! raeburn   147:  dates have been set, then the student role will be active immediately, and will 
1.32      jms       148:  remain active until the role is explicitly expired using ENRL -> Drop students. 
                    149:  If dates are to included in the XML file, they should be in the format
                    150:  YYYY:MM:DD:HH:MM:SS (: separators required).
                    151: 
1.44      raeburn   152:  The <credits> tag need only be used if the credits earned by the students will 
                    153:  be different from the default for the course. The course default is set when the
                    154:  course is created and can be modifed by a Domain Coordinator via "View or
1.50      raeburn   155:  modify a course or community" on the DC's Main Menu screen.
1.44      raeburn   156: 
                    157:  A value for <inststatus> should be the institutional status used for students,
1.50      raeburn   158:  and should be one of the types defined in the "Institutional user types"
                    159:  section in the domain config screen for:
                    160:  "Default authentication/language/timezone/portal/types" 
                    161: 
                    162:  If no status types are defined for the domain this tag can be omitted.
                    163:  If Autoupdate.pl is enabled in your domain, updates to the institutional 
                    164:  status set here will be updated by Autoupdate.pl, should changes occur.
1.44      raeburn   165: 
1.32      jms       166:  If there were 10 students in fs03nop590001, 5 students in fs03nop59o601, 
                    167:  8 students in fs03nop590602, and 2 students in fs03ost580002,
                    168:  then $$reply{'43551dedcd43febmsul1'} = 25
                    169: 
                    170:  The purpose of the %reply hash is to detect cases where the institutional 
                    171:  enrollment is 0 (most likely due to a problem with the data source).
                    172:  In such a case, the LON-CAPA course roster is left unchanged (i.e., no
                    173:  students are expired, even if automated drops is enabled.
                    174:  
                    175:  fetch_enrollment should return a 0 or 1, depending on whether a connection
                    176:  could be established to the institutional data source.
                    177:  0 is returned if no connection could be made.
                    178:  1 is returned if connection was successful
                    179: 
                    180:  A return of 1 is required for the calling modules to perform LON-CAPA
                    181:  roster changes based on the contents of the XML classlist file(s), e,g,,
                    182:  msu_43551dedcd43febmsul1_fs03nop590001_classlist.xml
                    183: 
                    184:  XML classlist files are temporary. They are deleted after the enrollment 
                    185:  update process in the calling module is complete.
                    186: 
                    187: 
                    188: =cut
1.1       raeburn   189: 
                    190: sub fetch_enrollment {
1.7       matthew   191:     my ($dom,$affiliatesref,$replyref) = @_;
                    192:     foreach my $crs (sort keys %{$affiliatesref}) {
                    193:         $$replyref{$crs} = 0;
                    194:     }
                    195:     my $okflag = 0;
                    196:     return $okflag;
1.4       raeburn   197: }
                    198: 
1.32      jms       199: =pod
                    200: 
                    201: =item get_sections()
                    202: 
                    203:  This is called by the Automated Enrollment Manager interface
                    204:  (lonpopulate.pm) to create an array of valid sections for 
                    205:  a specific institutional coursecode.
                    206:  e.g., for MSU coursecode: fs03nop590
                    207:  ("001","601","602") would be returned
                    208: 
                    209:  If the array returned contains at least one element, then 
1.60    ! raeburn   210:  the interface offered to the course coordinator, lists
1.32      jms       211:  official sections and provides a checkbox to use to
                    212:  select enrollment in the LON-CAPA course from each official section.  
                    213: 
                    214:  get_sections takes two arguments - (a) the institutional coursecode
                    215:  (in the MSU case this is a concatenation of semester code, department
                    216:  and course number), and (b) the LON-CAPA domain that contains the course. 
                    217:  
                    218:  If there is no access to official course sections at your institution,
                    219:  then an empty array is returned, and the Automated Enrollment Manager
                    220:  interface will allow the course coordinator to enter section numbers
                    221:  in text boxes.
                    222:  
                    223: 
                    224: 
                    225: =cut
1.4       raeburn   226: 
                    227: sub get_sections {
1.9       raeburn   228:     my ($coursecode,$dom) = @_;
1.4       raeburn   229:     my @secs = ();
                    230:     return @secs;
1.1       raeburn   231: }
                    232: 
1.32      jms       233: =pod
                    234: 
                    235: =item new_course()
                    236: 
                    237:  This is called by loncreatecourse.pm and 
                    238:  lonpopulate.pm to record that fact that a new course section
                    239:  has been added to LON-CAPA that requires access to institutional data
                    240:  At MSU, this is required, as institutional classlists can only made
                    241:  available to faculty who are officially assigned to a course.
                    242:  
                    243:  The new_course subroutine is used to check that the course owner
                    244:  of the LON-CAPA course is permitted to access the institutional
                    245:  classlist for any course sections and crosslisted classes that
                    246:  the course coordinator wishes to have affiliated with the course.
                    247:  
                    248:  If access is permitted, then 'ok' is returned.
                    249:  The course section or crosslisted course will only be added to the list of
                    250:  affiliates if 'ok' is returned.
                    251: 
1.41      raeburn   252:  new_course takes three required arguments -
1.32      jms       253:  (a) the institutional courseID (in the MSU case this is a concatenation of 
                    254:  semester code, department code, course number, and section number
                    255:  e.g., fs03nop590001).
                    256:  (b) the course owner. This is the LON-CAPA username and domain of the course 
                    257:  coordinator assigned to the course when it is first created, in the form
                    258:  username:domain
                    259:  (c) the LON-CAPA domain that contains the course
                    260: 
1.58      raeburn   261:  new_course also takes optional fourth and fifth arguments -
1.41      raeburn   262:  (d) the course co-owners, as a comma-separated list of username:domain for
1.58      raeburn   263:  any co-owners.
                    264:  (e) database handle (might be set when new_course() is called by check_section
                    265:  routine within localenroll.pm).
1.41      raeburn   266: 
1.32      jms       267: =cut
1.4       raeburn   268: 
                    269: sub new_course  {
1.41      raeburn   270:     my ($course_id,$owner,$dom,$coowners) = @_;
1.4       raeburn   271:     my $outcome = 'ok';
                    272:     return $outcome;
1.1       raeburn   273: }
                    274: 
1.32      jms       275: =pod
                    276: 
                    277: =item validate_courseID()
                    278: 
                    279:  This is called whenever a new course section or crosslisted course
                    280:  is being affiliated with a LON-CAPA course (i.e., by loncreatecourse.pm
                    281:  and the Automated Enrollment Manager in lonpopulate.pm).
                    282:  A check is made that the courseID that the course coordinator wishes
                    283:  to affiliate with the course is valid according to the institutional
                    284:  schedule of official classes 
                    285: 
                    286:  A valid courseID is confirmed by returning 'ok'
                    287: 
                    288:  validate_courseID takes two arguments -
                    289:  (a) the institutional courseID (in the MSU case this is a concatenation of
                    290:  semester code, department code, course number, and section number
                    291:  e.g., fs03nop590001).
                    292:  (b) the LON-CAPA domain that contains the course
                    293: 
                    294: =cut  
1.4       raeburn   295: 
                    296: sub validate_courseID {
1.9       raeburn   297:     my ($course_id,$dom) = @_;
1.4       raeburn   298:     my $outcome = 'ok';
                    299:     return $outcome;   
                    300: }
1.1       raeburn   301: 
1.32      jms       302: =pod
                    303: 
1.36      raeburn   304: =item validate_instcode()
                    305: 
                    306: This is called when a request is being made for an official course.
                    307: A check is made that the institutional code for which a course is
                    308: is being requested is valid according to the institutional
                    309: schedule of official classes.
                    310: 
                    311: If the username of the course owner is provided, a more restrictive
                    312: test is used, namely that the requestor is listed as instructor of
                    313: record for the course in the institution's course schedule/database.
                    314: 
1.38      raeburn   315: validate_instcode takes three arguments -
1.36      raeburn   316:  (a) the LON-CAPA domain that will contain the course
                    317:  (b) the institutional code (in the MSU case this is a concatenation of
                    318:  semester code, department code, and course number, e.g., fs03nop590.
                    319:  (c) an optional institutional username for the course owner.
                    320: 
1.39      raeburn   321: An array is returned containing (a) the result of the check for a valid 
1.44      raeburn   322: instcode, (b) an (optional) course description, and (c) the default credits
                    323: earned by students when completing this course. If no institutional credits
                    324: value is available, the default credits for the course can be set via the
                    325: course request form, or via XML in a batch file, of via the web form used
                    326: by the Domain Coordinator to create new courses one at a time.
                    327: 
1.39      raeburn   328: A valid instcode is confirmed by returning 'valid'.
1.44      raeburn   329: 
1.39      raeburn   330: If no course description is available, '' should be set as
                    331: the value of the second item in the returned array.
                    332: 
1.36      raeburn   333: =cut
                    334: 
                    335: sub validate_instcode {
1.38      raeburn   336:     my ($dom,$instcode,$owner) = @_;
1.36      raeburn   337:     my $outcome = '';
1.39      raeburn   338:     my $description = '';
1.44      raeburn   339:     my $credits = '';
                    340:     return ($outcome,$description,$credits);
1.36      raeburn   341: }
                    342: 
                    343: =pod
                    344: 
1.60    ! raeburn   345: =item validate_crosslist_access()
        !           346: 
        !           347: This is called for an official course to check whether a course
        !           348: with the institutional code can have access to enrollment data
        !           349: from a cross-listed institutional section code, given a co-owner.
        !           350: 
        !           351: validate_crosslist_access() takes four arguments -
        !           352: (a) the course's LON-CAPA domain 
        !           353: (b) the institional course code assigned to the course
        !           354: (c) the institutional course section code for the crosslisting
        !           355: (d) the co-owner to check for affiliation with the crosslisting 
        !           356:     (username:domain).
        !           357: 
        !           358: A combination of (a), (b), (c) and (d) with access to enrollment 
        !           359: data, as per institutional policies, is confirmed by returning 'valid'.
        !           360: 
        !           361: =cut
        !           362: 
        !           363: sub validate_crosslist_access {
        !           364:     my ($dom,$instcode,$inst_xlist,$coowner) = @_;
        !           365:     my $outcome = '';
        !           366:     return $outcome;
        !           367: }
        !           368: 
        !           369: =pod
        !           370: 
1.38      raeburn   371: =item validate_crsreq()
                    372: 
                    373: This is used to check whether a course request should be processed
                    374: automatically, or held in a queue pending administrative action at
                    375: the institution.
                    376: 
                    377: Course requests will trigger this check if the process type has been set 
1.54      raeburn   378: to 'validate' for the course type (official, unofficial, textbook, 
                    379: placement or community) and the requestor's affiliation.  Whether
                    380: "validate" is an available option in the Domain Configuration menu 
                    381: is controlled by auto_courserequest_checks(). 
1.38      raeburn   382: One scenario is where the request is for an official course, in which case
                    383: a check could be made that the requestor is listed as instructor of 
                    384: record for the course in the institution's course schedule/database.
                    385: 
                    386: Other scenarios are possible, and the routine can be customized according
                    387: to whatever rules a domain wishes to implement to run validations against
                    388: given the data passed in to the routine.
                    389: 
1.51      raeburn   390: validate_crsreq takes seven arguments -
1.38      raeburn   391:  (a) the LON-CAPA domain that will contain the course.
                    392:  (b) the username:domain for the course owner.
1.54      raeburn   393:  (c) the course type (official, unofficial,textbook, placement or community)
1.38      raeburn   394:  (d) a comma-separated list of institutional affiliations of 
                    395:      the course owner.
                    396:  (e) the institutional code (in the MSU case this is a concatenation of
1.46      raeburn   397:  semester code, department code, and course number, e.g., fs03nop590).
1.38      raeburn   398:  (f) a comma-separated list of institutional sections included in
                    399:      the course request (only applicable to official courses).
1.46      raeburn   400:  (g) an optional reference to a hash of custom form data.
1.52      raeburn   401:      The custom form data will come from crsreq_updates(), with one
                    402:      additional item: $custominfo->{'_LC_clonefrom'}, provided internally
                    403:      (the courseID of the LON-CAPA course being cloned).
1.38      raeburn   404: 
                    405: A valid courserequest is confirmed by returning 'process'.
1.46      raeburn   406: The following can be returned: process, rejected, pending, approval or 
                    407: error (with error condition - no :), followed by a : and then an optional message. 
1.38      raeburn   408: 
                    409: (a) process  - the requestor is the recorded instructor - create the course
1.52      raeburn   410: 
1.40      raeburn   411: (b) rejected - the requestor should never be requesting this course, reject the
1.38      raeburn   412:     request permanently
1.52      raeburn   413: 
1.38      raeburn   414: (c) pending - the requestor is not the recorded instructor, but could
                    415:     become so after administrative action at the institution. Put the
1.46      raeburn   416:     request in a queue and, if an official course, check 
                    417:     localenroll:validate_instcode() periodically until the status changes to 
                    418:     "valid".
1.52      raeburn   419: 
1.38      raeburn   420: (d) approval - the request will be held pending review by a Domain Coordinator.
1.52      raeburn   421: 
1.38      raeburn   422: (e) error (followed by the error condition).
                    423: 
                    424: =cut
                    425: 
                    426: sub validate_crsreq {
1.46      raeburn   427:     my ($dom,$owner,$crstype,$inststatuslist,$instcode,$instseclist,$custominfo) = @_;
1.38      raeburn   428:     my $outcome = 'approval';
                    429:     return $outcome;
                    430: }
                    431: 
                    432: =pod 
                    433: 
                    434: =item crsreq_checks()
                    435: 
                    436: This is used to determine whether the "validate" option should appear in the
                    437: possible choices for course request processing in the Domain Configuration 
                    438: menu for Course Requests. Ultimately it is called by domainprefs.pm (via: 
                    439: lonnet -> lond -> localenroll.pm) The domain configuration menu includes 
1.54      raeburn   440: a table where columns are course type (official, unofficial, textbook,
                    441: placement or community) and rows are institutional affiliations 
                    442: (e.g., Faculty, Staff, Student etc.).
1.38      raeburn   443: 
1.42      raeburn   444: crsreq_checks() takes three arguments: $dom, $reqtypes, $validations.
1.38      raeburn   445: $dom - the domain for which validation options are needed.
                    446: $reqtypes - ref to an ARRAY of course types (i.e., official, unofficial and community.
                    447: $validations - ref to a hash of a hash which will determine whether "validate"
                    448: will be one of the possible choices for each course type (outer hash key),
                    449: and institutional type (inner hash key).
                    450: 
                    451: For example to allow validate to be a choice for official classes for Faculty,
                    452: req_checks would include:
                    453: 
                    454: $validations{'official'}{'Faculty'} = 1;
                    455: 
                    456: This routine is closely tied to validate_crsreq(). "Validate" should not be
                    457: a possible choice in the domain configuration menu for a particular course
                    458: type/institutional affiliation, unless a corresponding validation code has
                    459: been implemented in validate_crsreq().
                    460: 
                    461: For example at MSU, official courses requested by Faculty will be validated
                    462: against the official schedule of classes to check that the requestor is one
                    463: of the instructors of record for the course.  In this case validate_crsreq()
                    464: includes a call to validate_instcode().
                    465: 
                    466: =cut
                    467: 
                    468: sub crsreq_checks {
                    469:     my ($dom,$reqtypes,$validations) = @_;
                    470:     if ((ref($reqtypes) eq 'ARRAY') && (ref($validations) eq 'HASH')) {
                    471:         my (%usertypes,@order);
                    472:         if (&inst_usertypes($dom,\%usertypes,\@order) eq 'ok') {
                    473:             foreach my $type (@{$reqtypes}) {
                    474:                 foreach my $inst_type (@order) {
                    475:                     $validations->{$type}{$inst_type} = 0;
                    476:                 }
                    477:             }
                    478:         }
                    479:     }
                    480:     return 'ok';
                    481: }
                    482: 
1.52      raeburn   483: =pod
                    484: 
                    485: =item crsreq_updates()
                    486: 
                    487: This is used to customize the LON-CAPA course request process.
                    488: There are two hash references: $incoming, and $outgoing; $incoming can
                    489: contain additional information collected from the requester, whereas $outgoing
                    490: can contain custom items to send back to lonrequestcourse.pm, which creates the
                    491: HTML displayed to the user during a course request.
                    492: 
                    493: Different key-value pairs may be returned to lonrequestcourse.pm in the $outgoing
                    494: hashref depending on the current action.  The available actions are:
                    495: review, prevalidate, process, created and queued.
                    496: 
                    497: One scenario would be to return HTML markup in: $outgoing->{'reviewweb'},
                    498: i.e., where the action is 'review', to prompt the user to provide additional
                    499: information as part of the course request, at the request review stage, 
                    500: (i.e,, the page which contains the button used to submit a completed course request).
                    501: 
                    502: The HTML could contain form elements (e.g., radio buttons etc.). The value(s)
                    503: selected by the requester in those form elements will be available in the incoming
                    504: hashref, for a subsequent action, if the corresponding keys have been included
                    505: in $outgoing->{'formitems'}, i.e., $outgoing will be hash of a hash.  If a
                    506: particular form item will the single valued, the value set for the key in the 
                    507: inner hash in $outgoing should be 1, otherwise, if it will be multi-valued,
                    508: the value should be multiple.
                    509: 
                    510: The $outgoing hashref can contain a 'formitems' key for both the prevalidate
                    511: and process actions, as calls to localenroll::crsreq_update() can originate
                    512: in lonrequestcourse::process_request() for both of those actions.
                    513: 
                    514: The retrieved form values are passed to localenroll::validate_crsreq() as the
                    515: optional seventh arg (a hashref) -- $custominfo.
                    516: 
                    517: =cut
                    518: 
1.45      raeburn   519: sub crsreq_updates {
                    520:     my ($cdom,$cnum,$crstype,$action,$ownername,$ownerdomain,$fullname,$title,
1.47      raeburn   521:         $code,$accessstart,$accessend,$incoming,$outgoing) = @_;
1.45      raeburn   522:     unless (ref($outgoing) eq 'HASH') {
                    523:         return 'fail';
                    524:     }
                    525:     my %extrainfo;
                    526:     if (ref($incoming) eq 'HASH') {
                    527:         %extrainfo = %{$incoming};
                    528:     }
                    529:     if ($action eq 'review') {
                    530:         $outgoing->{'reviewweb'} = '';
1.46      raeburn   531:     } elsif ($action eq 'prevalidate') {
                    532:         $outgoing->{'formitems'} = {}; # key=>value, where key is form element name
                    533:                                        #             and value is multiple, if there
                    534:                                        #             are multiple form elements with
                    535:                                        #             the same name.
1.45      raeburn   536:     } elsif ($action eq 'process') {
                    537:         $outgoing->{'formitems'} = {}; # key=>value, where key is form element name
                    538:                                        #             and value is multiple, if there
                    539:                                        #             are multiple form elements with
1.46      raeburn   540:                                        #             the same name.
1.45      raeburn   541:     } elsif ($action eq 'created') {
                    542:         $outgoing->{'createdweb'} = '';
                    543:         $outgoing->{'createdmsg'} = [{
                    544:                                      mt => '',
                    545:                                      args => [],
                    546:                                     }];
1.48      raeburn   547:         $outgoing->{'createdactions'} = {
                    548:                                             environment => {},
                    549:                                         };
                    550:                                         # environment can contain key=>value for
                    551:                                         # items to set in the course environment.
                    552:                                         # These would be items which are NOT included
                    553:                                         # in the items set via options in the course
                    554:                                         # request form. Currently self-enrollment
                    555:                                         # settings are the only ones allowed, i.e.,
                    556:                                         # internal.selfenroll_types internal.selfenroll_registered
                    557:                                         # internal.selfenroll_section internal.selfenroll_start_access 
                    558:                                         # internal.selfenroll_end_access internal.selfenroll_limit
                    559:                                         # internal.selfenroll_cap internal.selfenroll_approval
                    560:                                         # internal.selfenroll_notifylist
1.45      raeburn   561:     } elsif ($action eq 'queued') {
1.46      raeburn   562:         $outgoing->{'queuedmsg'} = [{
                    563:                                      mt   => '',
1.45      raeburn   564:                                      args => [],
                    565:                                     }];
                    566:         $outgoing->{'queuedweb'} = '';
                    567:     }
                    568:     return 'ok'
                    569: }
                    570: 
1.38      raeburn   571: =pod
                    572: 
1.55      raeburn   573: =item export_grades()
                    574:  
                    575: This routine can be customized to push grade information to some other gradebook,
                    576: LCMS, or administrative system external to LON-CAPA.
                    577: 
                    578: export_grades() takes five arguments -
                    579: (a) the LON-CAPA course ID
                    580: (b) the LON-CAPA course domain
                    581: (c) a hash reference containing the following: 
                    582:     scope    => scope of the grades (e.g., course, map or resource).
                    583:     instcode => institutional course code (if an official course)
                    584:     crstype  => course type -- Course, Community or Placement
                    585:     context  => calling context, e.g., "completion" when a student completes a placement test.
                    586: (d) a perl data structure (hash of a hash) containing the grade data.
                    587:     in the outer hash, the keys are student's username:domain
                    588:     in the inner hash, keys are:  
                    589:     id        => student/employee ID
                    590:     lastname  => student's last name
                    591:     firstname => student's first name
                    592:     email     => student's "permannent" e-mail address
                    593:     section   => student's LON-CAPA course section
                    594:     total     => total points earned
                    595:     bytitle   => reference to a hash (keys are question titles, values are points
                    596:     bysymb    => reference to a hash (keys are symbs, i.e., unique resource identifiers).
                    597: (e) reference to a hash which will contain information to return.
                    598:     keys will be the student's username:domain. Value of 1 to show grades pushed 
                    599:     successfully. 
                    600: 
                    601: =cut
                    602: 
1.56      raeburn   603: sub export_grades {
1.55      raeburn   604:     my ($cnum,$cdom,$hashref,$dataref,$outgoing) = @_;
                    605:     my %info;
                    606:     if (ref($hashref) eq 'HASH') {
                    607:         %info = %{$hashref};
                    608:     }
                    609:     if ((ref($dataref) eq 'HASH') && (ref($outgoing) eq 'HASH')) {
                    610:         foreach my $key (keys(%{$dataref})) {
                    611:             $outgoing->{$key} = 1;
                    612:         }
                    613:         return 'ok';
                    614:     } else {
                    615:         return 'error';
                    616:     }
                    617: }
                    618: 
                    619: =pod
                    620: 
1.58      raeburn   621: =item check_instclasses()
                    622: 
                    623:  This is used to supply information about which instituional course sections
                    624:  and cross-listings are available to supply enrollment data, given the current
                    625:  list of owner and co-owners. The data are used to populate the column titled:
                    626:  "Auto-enrollment of registered students" when showing full detailed for a course
                    627:  in the course catalog.
                    628: 
                    629:  This subroutine takes four arguments -
                    630: 
                    631:  (a) $owners - comma-separated list of username:domain for course owner 
                    632:      and co-owners.
                    633:  (b) $dom - domain of course.
                    634:  (c) $classes - reference to hash of institutional course sections and
                    635:      crosslistings for which access to enrollment data is being checked.
                    636:  (d) $validated - reference to hash which will be populated with all
                    637:      keys from incoming $classes hashref, for which one or more of the
                    638:      owner/co-owners has rights to access enrollment data. For each
                    639:      key included in $validated hashref, corresponding value will be set to 1.
                    640:   
                    641:  The subroutine returns 'ok' if there is no processing error.
                    642: 
                    643: =cut
                    644: 
                    645: 
                    646: sub check_instclasses {
                    647:     my ($owners,$dom,$classes,$validated) = @_;
                    648:     if ((ref($classes) eq 'HASH') && (ref($validated) eq 'HASH')) {
                    649:         foreach my $class (keys(%{$classes})){
1.59      raeburn   650:             if (&check_section($class,$owners,$dom) eq 'ok') {
1.58      raeburn   651:                 $validated->{$class} = 1;
                    652:             }
                    653:         }
                    654:     }
                    655:     return 'ok';
                    656: }
                    657: 
                    658: 
                    659: =pod
                    660: 
1.32      jms       661: =item create_password()
                    662: 
                    663:  This is called when the authentication method set for the automated 
                    664:  enrollment process when enrolling new users in the domain is "localauth".
                    665:  This could be signalled for the specific user by the value of localauth
                    666:  for the <authtype> tag from the classlist.xml files, or if this is blank,
                    667:  the default authtype, set by the domain coordinator when creating the course
                    668:  with loncreatecourse.pm.
                    669:   
                    670:  create_password takes three arguments -
                    671:  (a) $authparam - the value of <autharg> from the classlist.xml files,
                    672:  or if this blank, the default autharg, set by the domain coordinator when 
                    673:  creating the course with loncreatecourse.pm
                    674:  (b) $dom - the domain of the new user.
                    675:  (c) $username - the username of the new user (currently not actually used)
                    676: 
                    677:  Four values are returned:
                    678:  (a) the value of $authparam - which might have been changed
                    679:  (b) a flag to indicate whether a password had been created
                    680:  0 means no password created
                    681:  1 means password created.  In this case the calling module - Enrollment.pm
                    682:  will send the LON-CAPA username and password to the new user's e-mail
                    683:  (if one was provided), or to the course owner (if one was not provided and
                    684:  the new user was created by the automated process), or to the active
                    685:  course coordinator (if the new user was created using the 'update roster
                    686:  now' interface included in the Automated Enrollment Manager).  
                    687:  (c) a flag to indicate that the authentication method is correct - 'ok'.
                    688:  If $authchk is not set to 'ok' then account creation and enrollment of the 
                    689:  new user will not occur.
                    690:  (d) if a password was created it can be sent along.  This is the password 
                    691:  which will be included in the e-mail sent to the new user, or made available    
                    692:  to the course owner/course coordinator if no e-mail address is provided. If
                    693:  you do not wish to send a password, but want to give instructions on obtaining
                    694:  one, you could set $newpasswd as those instructions. (e.g.,
                    695:  $newpasswd = '(Please visit room 212, ACNS Bldg. to obtain your password)';
                    696:  The value of $newpasswd is NOT written in the user's LON-CAPA passwd file in
                    697:  /home/httpd/lonUsers/$dom/a/b/c/abcuser/passwd, which in the case of a user
                    698:  employing localauth will contain 'localauth:$authparam'.  If you need to include
                    699:  a parameter in the user's passwd file, you should return it as $authparam,
                    700:  i.e., the first of the variables returned by create_password().             
                    701: 
                    702: 
                    703: =cut 
1.4       raeburn   704: 
                    705: sub create_password {
1.13      albertel  706:     my ($authparam,$dom,$username) = @_;
1.4       raeburn   707:     my $authchk = 'ok';
1.11      raeburn   708:     my $newpasswd = '';
1.4       raeburn   709:     my $create_passwd = 0;
1.11      raeburn   710:     return ($authparam,$create_passwd,$authchk,$newpasswd);
1.1       raeburn   711: }
                    712: 
1.32      jms       713: =pod
                    714: 
                    715: =item instcode_format()
                    716: 
                    717:  Split coursecodes into constituent parts.   
                    718:  e.g., INSTITUTIONALCODE = fs03nop590, LON-CAPA COURSEID: 43551dedcd43febmsul1
                    719:  (MSU's course naming scheme - fs03 = Fall semester 2003, nop =
                    720:  department name, 590 = course number)
                    721: 
                    722:  Incoming data:
                    723:  $dom (domain)
                    724:  $$instcodes{'43551dedcd43febmsul1'} = 'fs03nop590' (hash of courseIDs)
                    725:  
                    726:  fs03nop590 would be split as follows
                    727:  @{$codetitles} = ("year","semester","department","number")
1.33      bisitz    728:  $$codes{'year'} = '2003'
1.32      jms       729:  $$codes{'semester'} = 'Fall'
                    730:  $$codes{'department'} = 'nop'
                    731:  $$codes{'number'} = '590'
                    732: 
                    733:  requires six arguments:
                    734:  domain ($dom)
                    735:  reference to hash of institutional course IDs ($instcodes)  
                    736:  reference to hash of codes ($codes)
                    737:  reference to array of titles ($codetitles)
                    738:  reference to hash of abbreviations used in categories
                    739:  reference to hash of arrays specifying sort order used in category titles   
                    740: 
                    741:  e.g.,     %{$$cat_titles{'Semester'}} = (
                    742:                    fs => 'Fall',
                    743:                    ss => 'Spring',
                    744:                    us => 'Summer');
                    745: 
                    746:  e.g., @{$$cat_order{'Semester'}} = ('ss','us','fs'); 
                    747:  returns 1 parameter: 'ok' if no processing errors. 
1.33      bisitz    748: 
                    749:  Detailed help:
                    750:  http://yourloncapaserver/adm/help/Institutional_Integration_Course_Codes.hlp
                    751: 
1.32      jms       752: =cut
                    753: 
1.10      raeburn   754: 
                    755: sub instcode_format () {
                    756:     my ($dom,$instcodes,$codes,$codetitles,$cat_titles,$cat_order) = @_;
                    757:     my $outcome = 'ok';
                    758:     return $outcome;
                    759: }
                    760: 
1.35      raeburn   761: =pod
                    762: 
                    763: =item possible_instcodes()
                    764: 
                    765: Gather acceptable values for institutional categories to use in course creation request form for official courses.
                    766: 
1.40      raeburn   767:  requires five arguments:
                    768: 
1.35      raeburn   769:  domain ($dom)
                    770:  reference to array of titles ($codetitles)
                    771:  reference to hash of abbreviations used in categories ($cat_titles).
1.40      raeburn   772:  reference to hash of arrays specifying sort order used in 
                    773:            category titles ($cat_order).
                    774:  reference to array which will contain order of component parts used 
                    775:            in institutional code ($code_order).
1.35      raeburn   776: 
                    777:  e.g., 
1.40      raeburn   778:  @{$codetitles} = ('Year','Semester',"Department','Number');
1.35      raeburn   779: 
                    780:  %{$$cat_titles{'Semester'}} = (
                    781:                    fs => 'Fall',
                    782:                    ss => 'Spring',
                    783:                    us => 'Summer');
                    784: 
                    785:  @{$$cat_order{'Semester'}} = ('ss','us','fs');
1.40      raeburn   786:  @{$code_order} = ('Semester','Year','Department','Number');
1.35      raeburn   787: 
                    788:  returns 1 parameter: 'ok' if no processing errors.
                    789: 
                    790: =cut
                    791: 
                    792: sub possible_instcodes {
1.40      raeburn   793:     my ($dom,$codetitles,$cat_titles,$cat_order,$code_order) = @_;
1.35      raeburn   794:     @{$codetitles} = ();
                    795:     %{$$cat_titles{'Semester'}} = ();
                    796:     @{$$cat_order{'Semester'}} = ('ss','us','fs');
1.40      raeburn   797:     @{$code_order} = ();
1.35      raeburn   798:     return 'ok';
                    799: }
                    800: 
                    801: 
1.32      jms       802: =pod
                    803: 
                    804: =item institutional_photos()
                    805: 
                    806:  Called when automated enrollment manager is used to update student photos.
                    807: 
                    808:  Incoming data: six arguments
                    809:  (a) $dom (domain)
                    810:  (b) $crs (LONCAPA course number)
                    811:  (c) $affiliates: a reference to a hash with the keys set to the 
                    812:  institutional course IDs for the course.
                    813:  (d) $result: a reference to a hash which will return usernames  
                    814:      of students (& separated) in following categories (the keys):
                    815:      new, update, missing, same, deleted, noid, nouser. The list 
                    816:      includes those students for whom the result of the modification 
                    817:      process was either addition of a new photo. update of an
                    818:      existing photo, photo was found to be missing from institution's
                    819:      data store, photo used is same as before, or photo was 
                    820:      deleted from storage on LON-CAPA server housing student's
1.34      weissno   821:      information, no student/employee ID was available. 
1.12      raeburn   822:                
1.32      jms       823:  (e) $action: the type of action needed. (e.g., update, delete);
                    824:  (f) $students: a reference to a hash with the keys set to student 
                    825:  usernames and domains in the form username:domain, and values set
                    826:  to the studentID, if action is required for specific students.  
                    827: 
                    828:  returns 1 parameter: 'ok' if no processing errors.
                    829:  other course or student specific values can be stored as values
                    830:  in the appropriate referenced hashes. 
                    831: 
                    832: =cut
1.12      raeburn   833: 
                    834: sub institutional_photos {
                    835:     my ($dom,$crs,$affiliates,$result,$action,$students) = @_;
                    836:     my $outcome = 'ok';
                    837:     return $outcome;
                    838: }
                    839: 
1.32      jms       840: =pod
                    841: 
                    842: =item photo_permission()
                    843: 
                    844:  Incoming data: three arguments
                    845:  (a) $dom (domain)
                    846:  (b) $perm_reqd: a reference to a a scalar that is either 'yes'
                    847:  if a course owner must indicate acceptance of conditions of use,
                    848:  'no' otherwise.
                    849:  (c) $conditions: the text of the conditions of use.
                    850:     
                    851:  returns 1 parameter: 'ok' if no processing errors.
                    852:  $$perm_reqd is set to 'yes' or 'no'
                    853:  $$agreement is set to conditions of use - plain text string
                    854:              which will be displayed in a textarea in a web form.
                    855: 
                    856: 
                    857: =cut
                    858: 
1.12      raeburn   859: sub photo_permission {
                    860:    my ($dom,$perm_reqd,$conditions) = @_;
                    861:    $$perm_reqd = 'no';
                    862:    $$conditions = '';
                    863:    my $outcome = 'ok';
                    864:    return $outcome;
                    865: }
                    866: 
1.32      jms       867: =pod
                    868: 
                    869: =item manager_photo_update()
                    870: 
                    871:  Incoming data: one argument
                    872:  (a) $dom (domain)
                    873: 
                    874:  returns 2 parameters: update (0 or 1), and comment.
                    875:  Called by automated enrollment manager, to determine 
                    876:  whether "Update Student photos" button will be available,
                    877:  and if so, the message (plain text string) that will be displayed
                    878:  with the button. 
1.12      raeburn   879: 
1.32      jms       880: 
                    881: =cut
1.12      raeburn   882:                                                                                         
                    883: sub manager_photo_update {
                    884:     my ($dom) = @_;
                    885:     my $update = 0;
                    886:     my $comment = '';
                    887:     return ($update,$comment);
                    888: }
                    889: 
1.32      jms       890: =pod
                    891: 
                    892: 
                    893: =item check_section()
                    894: 
                    895:  Incoming data: three arguments (+ fourth optional argument)
                    896:  (a) $class - institutional class id (coursecode concatanated with section) 
                    897:  (b) $owner - course owner (2.2 and later username:domain; pre-2.2 username;
                    898:                             2.6 and later - comma-separated list of 
                    899:                             username:domain for course owner and co-owners.)
                    900:  (c) $dom - domain of course
                    901:  (d) $dbh - optional database handle
                    902: 
                    903:  returns 1 parameter - $sectioncheck ('ok' or other value). 
                    904:  Verifies that at least one of the course owner (or co-owners) have access 
                    905:  to classlist for specific class according to institution's SIS
                    906:  'ok' if access available  
                    907: 
                    908: 
                    909: =cut
1.16      raeburn   910: 
                    911: sub check_section {
                    912:     my ($class,$owner,$dom,$dbh) = @_;
                    913:     my $sectioncheck = 'ok';
                    914:     return $sectioncheck;
                    915: }
                    916: 
1.32      jms       917: =pod
                    918: 
                    919: =item instcode_defaults()
                    920: 
                    921:  Incoming data: three arguments
                    922:  (a) $dom - domain
                    923:  (b) $defaults - reference to hash which will contain default regular
                    924:                  expression matches for different components of an 
                    925:                  institutional course code 
                    926:  (c) $code_order - reference to array which will contain order of 
                    927:                    component parts used in institutional code.  
                    928: 
                    929:  returns 1 parameter - ('ok' or other value).
                    930:  Used to construct a regular expression to be used when searching for
                    931:  courses based on fragments of an institutional code.
                    932:  $defaults contains defaults to use for each component, and code_order
                    933:  contains keys of hash in order in which they are to be concatenated.
                    934: 
                    935:  e.g., INSTITUTIONALCODE = fs03nop590
                    936:  (MSU's course naming scheme - fs  = semester, 03 = year, nop =
                    937:  department name, 590 = course number)
                    938: 
                    939:      %{$defaults} = (
                    940:         'Year' => '\d{2}',
                    941:         'Semester' => '^[sfu]s', 
                    942:         'Department' => '\w{2,3}',
                    943:         'Number' => '\d{3,4}\w?',
                    944:      );
                    945: 
                    946:      @{$code_order} = ('Semester','Year','Department','Number');
                    947: 
1.33      bisitz    948:  Detailed help:
                    949:  http://yourloncapaserver/adm/help/Institutional_Integration_Course_Codes.hlp
                    950: 
1.32      jms       951: =cut
1.17      raeburn   952: 
                    953: sub instcode_defaults {
                    954:     my ($dom,$defaults,$code_order) = @_;
                    955:     return 'ok';
                    956: }
                    957: 
1.32      jms       958: 
                    959: =pod
                    960: 
                    961: =item allusers_info()
                    962: 
                    963:  Incoming data: three arguments
                    964:  (a) $dom - domain
                    965:  (b) $instusers - reference to hash which will contain hashes, 
                    966:                  where keys will be usernames and value will be a 
                    967:                  hash of user information. Keys in the inner hash 
                    968:                  will be some or all of: lastname,firstname,
                    969:                  middlename, generation, id, inststatus - 
                    970:                  institutional status (e.g., faculty,staff,student)
                    971:                  Values are all scalars except inststatus,
                    972:                  which is an array.
                    973:  (c) $instids - reference to hash which will contain ID numbers. 
                    974:                 keys will be unique IDs (student or faculty/staff ID)
                    975:                 values will be either: scalar (username) or an array 
                    976:                 if a single ID matches multiple usernames.
1.43      raeburn   977:  (d) $lc_users - reference to hash containing LON-CAPA usernames in 
                    978:                  in domain $dom, as keys. Needed if institutional
                    979:                  data source only allows query by username.
1.32      jms       980:  returns 1 parameter - 'ok' if no processing error, or other value 
                    981:                        if an error occurred.
                    982:  side effects - populates the $instusers and $instids refs to hashes.
                    983:                 with information for all users from all available 
                    984:                 institutional datafeeds.
                    985: 
                    986: 
                    987: =cut
1.18      raeburn   988: 
                    989: sub allusers_info {
1.43      raeburn   990:     my ($dom,$instusers,$instids,$lc_users) = @_;
1.18      raeburn   991:     my $outcome = 'ok';
                    992:     return $outcome; 
                    993: }
                    994: 
1.32      jms       995: =pod
                    996: 
                    997: =item get_userinfo()
                    998: 
                    999:  Incoming data: four required arguments and additional optional arguments
                   1000:  Two modes of operation:
                   1001:  (1) Retrieves institutional data for a single user either by username
                   1002:      if $uname is included as second argument, or by ID if $id is 
                   1003:      included as a third argument.  Either (b) or (c) must be provided.
                   1004:      (g), (h) and (i) will be undefined.
                   1005:  (2) Retrieves institutional user data from search of an institutional
                   1006:      directory based on a search. (g) and (h) are required.
                   1007:      (i) is optional. (b) and (c) will be undefined. 
                   1008: 
                   1009:  (a) $dom - domain
                   1010:  (b) $uname - username of user
                   1011:  (c) $id - student/faculty ID of user
                   1012:  (d) $instusers - reference to hash which will contain info for user
                   1013:                  as key = value; keys will be one or all of:
                   1014:                  lastname,firstname,middlename,generation,id,inststatus -
                   1015:                  institutional status (e.g., faculty,staff,student)
                   1016:                  Values are all scalars except inststatus,
                   1017:                  which is an array.
                   1018:  (e) $instids - reference to hash which will contain ID numbers - 
                   1019:                  keys will be unique IDs (student or faculty/staff ID)  
                   1020:                  values will be either: scalar (username) or an array
                   1021:                  if a single ID matches multiple usernames.
                   1022:  (f) $types - optional reference to array which contains 
                   1023:               institutional types to check.
                   1024:  (g) $srchby - optional if $uname or $id defined, otherwise required.
                   1025:                Allowed values include: 1. lastfirst, 2. last, 3. uname
1.57      raeburn  1026:                4. email, corresponding to searches by 1. lastname,firstname;
                   1027:                2. lastname; 3. username; 4. e-mail address
1.32      jms      1028:  (h) $srchterm - optional if $uname or $id defined, otherwise required
                   1029:                 String to search for.
                   1030:  (i) $srchtype - optional. Allowed values: contains, begins (defaults
                   1031:                 to exact match otherwise).
                   1032: 
                   1033:  returns 1 parameter - 'ok' if no processing error, or other value 
                   1034:                        if an error occurred.
                   1035:  side effects - populates the $instusers and $instids refs to hashes.
                   1036:                 with information for specified username, or specified
                   1037:                 id, if fifth argument provided, from all available, or 
                   1038:                 specified (e.g., faculty only) institutional datafeeds,
                   1039:                 if sixth argument provided.
                   1040: 
                   1041:  WARNING: You need to set $outcome to 'ok' once you have customized
                   1042:           this routine to communicate with an instititional 
                   1043:           directory data source, otherwise institutional directory 
                   1044:           searches will always be reported as being unavailable
                   1045:           in domain $dom.
                   1046: 
                   1047: =cut
1.18      raeburn  1048: 
                   1049: sub get_userinfo {
1.21      raeburn  1050:     my ($dom,$uname,$id,$instusers,$instids,$types,
                   1051:         $srchby,$srchterm,$srchtype) = @_;
1.24      raeburn  1052:     my $outcome = 'unavailable';
1.18      raeburn  1053:     return $outcome;
                   1054: }
                   1055: 
1.32      jms      1056: =pod
                   1057: 
1.53      raeburn  1058: =item get_multusersinfo
                   1059: 
                   1060:  (a) $dom - domain
                   1061:  (b) $type - username or id
                   1062:  (c) $unamenames - reference to hash containing usernames of users
                   1063:  (d) $instusers - reference to hash which will contain info for user
                   1064:                  as key = value; keys will be one or all of:
                   1065:                  lastname,firstname,middlename,generation,id,inststatus -
                   1066:                  institutional status (e.g., faculty,staff,student)
                   1067:                  Values are all scalars except inststatus,
                   1068:                  which is an array.
                   1069:  (e) $instids - reference to hash which will contain ID numbers -
                   1070:                  keys will be unique IDs (student or faculty/staff ID)
                   1071:                  values will be either: scalar (username) or an array
                   1072:                  if a single ID matches multiple usernames.
                   1073: 
                   1074:  returns 1 parameter - 'ok' if no processing error, or other value
                   1075:                        if an error occurred.
                   1076: 
                   1077:  side effects - populates the $instusers and $instids refs to hashes.
                   1078:                 with information for specified username, or specified
                   1079:                 id, if fifth argument provided, from all available, or
                   1080:                 specified (e.g., faculty only) institutional datafeeds,
                   1081:                 if sixth argument provided.
                   1082: 
                   1083:  WARNING: You need to set $outcome to 'ok' once you have customized
                   1084:           this routine to communicate with an instititional
                   1085:           directory data source, otherwise retrieval of institutional
                   1086:           user information will always be reported as being unavailable
                   1087:           in domain $dom.
                   1088: 
                   1089: =cut
                   1090: 
                   1091: sub get_multusersinfo {
                   1092:     my ($dom,$type,$usernames,$instusers,$instids) = @_;
                   1093:     my $outcome = 'unavailable'; 
                   1094:     return $outcome;
                   1095: }
                   1096: 
                   1097: =pod
                   1098: 
1.32      jms      1099: =item inst_usertypes() 
                   1100: 
1.49      raeburn  1101:  Starting with LON-CAPA 2.11.0 use of this subroutine
                   1102:  is deprecated. The domain configuration web GUI
                   1103:  accessible to Domain Coordinators will be used to
                   1104:  manage institutional types.  If you have previously
                   1105:  customized this routine, then values set there will
                   1106:  be used when displaying the "Institutional user types"
                   1107:  section in the domain config screen for:
                   1108:  "Default authentication/language/timezone/portal/types".
                   1109: 
                   1110:  Once you have visited that screen and saved the settings,
                   1111:  configuration thereafter will be via the web GUI of
                   1112:  values stored in the domain's configuration.db file on
                   1113:  the primary library server in the domain, and values in
                   1114:  inst_usertypes() will no longer be consulted.
                   1115:  
1.32      jms      1116:  Incoming data: three arguments
                   1117:  (a) $dom - domain
                   1118:  (b) $usertypes - reference to hash which will contain 
                   1119:                  key = value, where keys are institution 
                   1120:                  affiliation types (e.g., Faculty, Student etc.)
                   1121:                  and values are titles (e.g., Faculty/Academic Staff)
                   1122:  (c) $order - reference to array which will contain the order in
                   1123:               which institutional types should be shown
                   1124:               when displaying data tables (e.g., default quotas    
                   1125:               or updateable user fields (see domainprefs.pm) 
                   1126:  returns 1 parameter - 'ok' if no processing error, or other value 
                   1127:                         if an error occurred.
                   1128: 
                   1129: 
                   1130: =cut
1.18      raeburn  1131: 
                   1132: sub inst_usertypes {
                   1133:     my ($dom,$usertypes,$order) = @_;
1.20      raeburn  1134:     @{$order} = ();
                   1135:     %{$usertypes} = ();
1.18      raeburn  1136:     my $outcome = 'ok';
                   1137:     return $outcome;
                   1138: }
1.17      raeburn  1139: 
1.32      jms      1140: =pod
                   1141: 
                   1142: =item username_rules()
                   1143: 
                   1144:  Incoming data: three arguments 
                   1145:  (a) $dom - domain
                   1146:  (b) $ruleshash - reference to hash containing rules
                   1147:                   (a hash of a hash)
                   1148:                   keys of top level hash are short names  
                   1149:                    (e.g., netid, noncredit) 
                   1150:                   for each key, value is a hash
                   1151:                       desc => long name for rule  
                   1152:                       rule => description of rule
                   1153:                       authtype => (krb5,krb4,int, or loc)
                   1154:                                  authentication type for rule 
                   1155:                       authparm => authentication parameter for rule
                   1156:                       authparmfixed => 1 if authparm used when
                   1157:                           creating user for rule must be authparm  
                   1158:                       authmsg => Message to display describing 
                   1159:                                  authentication to use for this rule
                   1160: 
                   1161:  (c) $rulesorder - reference to array containing rule names 
                   1162:                    in order to be displayed
                   1163: 
                   1164: 
                   1165:   returns 'ok' if no processing error.
1.25      raeburn  1166: 
1.32      jms      1167: =cut
1.25      raeburn  1168: 
                   1169: sub username_rules {
                   1170:     my ($dom,$ruleshash,$rulesorder) = @_;
                   1171:     my $outcome;
                   1172:     return $outcome;
                   1173: }
                   1174: 
1.32      jms      1175: =pod
                   1176: 
                   1177: =item id_rules()
                   1178: 
                   1179:  Incoming data: three arguments
                   1180:  (a) $dom - domain
                   1181:  (b) $ruleshash - reference to hash containing rules
                   1182:                   (a hash of a hash)
                   1183:                   keys of top level hash are short names
                   1184:                    (e.g., netid, noncredit)
                   1185:                   for each key, value is a hash
                   1186:                       desc => long name for rule
                   1187:                       rule => description of rule
                   1188: 
                   1189:  (c) $rulesorder - reference to array containing rule names
                   1190:                    in order to be displayed
                   1191: 
                   1192:   returns 'ok' if no processing error.
                   1193: 
                   1194: =cut
1.27      raeburn  1195: 
1.30      raeburn  1196: sub id_rules {
                   1197:     my ($dom,$ruleshash,$rulesorder) = @_;
                   1198:     my $outcome;
                   1199:     return $outcome;
                   1200: }
                   1201: 
1.32      jms      1202: =pod
                   1203: 
                   1204: =item selfcreate_rules()
                   1205: 
                   1206:  Incoming data: three arguments
                   1207:  (a) $dom - domain
                   1208:  (b) $ruleshash - reference to hash containing rules
                   1209:                   (a hash of a hash)
                   1210:                   keys of top level hash are short names
                   1211:                    (e.g., netid)
                   1212:                   for each key, value is a hash
                   1213:                       desc => long name for rule
                   1214:                       rule => description of rule
                   1215: 
                   1216:  (c) $rulesorder - reference to array containing rule names
                   1217:                    in order to be displayed
                   1218: 
                   1219:   returns 'ok' if no processing error.
                   1220: 
1.27      raeburn  1221: 
1.32      jms      1222: =cut
1.30      raeburn  1223: 
1.31      raeburn  1224: sub selfcreate_rules {
1.27      raeburn  1225:     my ($dom,$ruleshash,$rulesorder) = @_;
                   1226:     my $outcome;
                   1227:     return $outcome;
                   1228: }
                   1229: 
1.32      jms      1230: =pod
                   1231: 
                   1232: =item username_check() 
                   1233: 
                   1234:  Incoming data: four arguments
                   1235:  (a) $dom - domain (scalar) 
                   1236:  (b) $uname - username to compare against rules (scalar)
                   1237:  (c) $to_check (reference to array of rule names to check)
                   1238:  (d) $resultshash (reference to hash of results)
                   1239:                     hash of results for rule checked
                   1240:                    - keys are rule names
                   1241:                    - values are: 1 or 0 (for matched or unmatched) 
                   1242: 
                   1243:  returns 'ok' if no processing error.
                   1244: 
                   1245: 
                   1246: =cut
1.25      raeburn  1247: 
                   1248: sub username_check {
                   1249:     my ($dom,$uname,$to_check,$resultshash) = @_;
                   1250:     my $outcome;
                   1251:     return $outcome; 
                   1252: }
                   1253: 
1.32      jms      1254: =pod
                   1255: 
                   1256: =item id_check()
                   1257: 
                   1258:  Incoming data: four arguments
                   1259:  (a) $dom - domain (scalar)
                   1260:  (b) $id - ID to compare against rules (scalar)
                   1261:  (c) $to_check (reference to array of rule names to check)
                   1262:  (d) $resultshash (reference to hash of results)
                   1263:                     hash of results for rule checked
                   1264:                    - keys are rule names
                   1265:                    - values are: 1 or 0 (for matched or unmatched)
                   1266: 
                   1267:  returns 'ok' if no processing error.
                   1268: 
                   1269: 
                   1270: =cut
1.27      raeburn  1271: 
                   1272: sub id_check {
                   1273:     my ($dom,$id,$to_check,$resultshash) = @_;
                   1274:     my $outcome;
                   1275:     return $outcome;
                   1276: }
                   1277: 
1.32      jms      1278: =pod
                   1279: 
                   1280: =item selfcreate_check()
                   1281: 
                   1282:  Incoming data: four arguments
                   1283:  (a) $dom - domain (scalar)
                   1284:  (b) $selfcreatename - e-mail proposed as username (compare against rules - scalar)
                   1285:  (c) $to_check (reference to array of rule names to check)
                   1286:  (d) $resultshash (reference to hash of results)
                   1287:                    hash of results for rule checked
                   1288:                    - keys are rule names
                   1289:                    - values are: 1 or 0 (for matched or unmatched)
                   1290: 
                   1291:  returns 'ok' if no processing error.
                   1292: 
                   1293: 
                   1294: =cut
1.30      raeburn  1295: 
1.31      raeburn  1296: sub selfcreate_check {
                   1297:     my ($dom,$selfcreatename,$to_check,$resultshash) = @_;
1.30      raeburn  1298:     my $outcome;
                   1299:     return $outcome;
                   1300: }
                   1301: 
1.32      jms      1302: =pod
                   1303: 
                   1304: =item AUTOLOAD()
                   1305: 
                   1306:  Incoming data: none
                   1307:  Returns ''
                   1308: 
                   1309:  Prevents errors when undefined subroutines are called in this package
                   1310:  Will allow new routines added in the future to be called from lond etc.
                   1311:  without the need for customized versions of local*.pm packages to be
                   1312:  modified to include the new subroutines immediately.
                   1313: 
                   1314:  See "Programming Perl" 3rd ed. pp 296-298.   
                   1315: 
                   1316: =back
                   1317: 
                   1318: =cut
1.14      raeburn  1319: 
                   1320: sub AUTOLOAD {
                   1321:     our $AUTOLOAD;
                   1322:     return '';
                   1323: }
                   1324: 
1.1       raeburn  1325: 1;

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