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

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

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