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

1.5       albertel    1: # functions to glue school database system into Lon-CAPA for 
                      2: # automated enrollment
1.7     ! matthew     3: # $Id: localenroll.pm,v 1.6 2003/12/11 15:45:25 albertel 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.4       raeburn    27: package localenroll;
                     28: 
                     29: use strict;
1.6       albertel   30: 
                     31: ################################
                     32: # sub run
                     33: # set this to return 1 if you want the auto enrollment to run
                     34: ################################
                     35: 
                     36: sub run { return 0; }
1.4       raeburn    37: 
                     38: ################################
                     39: # sub fetch_enrollment
1.3       albertel   40: #
1.4       raeburn    41: # connects to the institutional classlist data source,
                     42: # reads classlist data and stores in an XML file
                     43: # in /home/httpd/perl/tmp/
                     44: #
                     45: # classlist files are named as follows:
                     46: #
                     47: # DOMAIN_COURSE_INSTITUTIONALCODE_classlist.xml
                     48: #
                     49: # e.g., msu_43551dedcd43febmsul1_fs03nop590001_classlist.xml
                     50: # where DOMAIN = msu  COURSE = 43551dedcd43febmsul1 
                     51: # INSTITUTIONALCODE = fs03nop590001 
                     52: # (MSU's course naming scheme - fs03 = Fall semester 2003, nop =
                     53: # department name, 590 = course number, 001 = section number.
                     54: #
                     55: # fetch_enrollment requires three arguments -
                     56: # $dom - DOMAIN e.g., msu
                     57: # $affiliatesref - a reference to a hash of arrays that contains LON-CAPA 
                     58: # courses that are to be updated as keys, and institutional coursecodes 
                     59: # contributing enrollment to that LON-CAPA course as elements in each array.
                     60: # $replyref - a reference to a hash that contains LON-CAPA courses
                     61: # that are to be updated as keys, and the total enrollment count in all 
                     62: # affiliated sections, as determined from institutional data as hash elements. 
                     63: #
                     64: # As an example, if fetch_enrollment is called to retrieve institutional
                     65: # classlists for a single LON-CAPA course - 43551dedcd43febmsul1 which 
                     66: # corresponds to fs03nop590, sections 001, 601 and 602 , and the course
                     67: # also accommodates enrollment from a crosslisted course in the ost
                     68: # department - fs03ost580002:
                     69: #
                     70: # the affiliatesref would be a reference to %affiliates which would be:
                     71: #
                     72: # @{$affiliates{'43551dedcd43febmsul1'}} =
                     73: #   ("fs03nop590001","fs03nop590601","fs03nop590602","fs03ost580002");
                     74: #
                     75: # fetch_enrollment would create four files in /home/httpd/perl/tmp/.
                     76: # msu_43551dedcd43febmsul1_fs03nop590001_classlist.xml
                     77: # msu_43551dedcd43febmsul1_fs03nop590601_classlist.xml
                     78: # msu_43551dedcd43febmsul1_fs03nop590602_classlist.xml
                     79: # msu_43551dedcd43febmsul1_fs03ost580002_classlist.xml
                     80: #
                     81: # In each file, student data would be stored in the following format
                     82: # 
                     83: # <student username="smith">
                     84: #  <autharg>MSU.EDU</autharg>
                     85: #  <authtype>krb4</authtype>
                     86: #  <email>smith@msu.edu</email>
                     87: #  <enddate></enddate>
                     88: #  <firstname>John</firstname>
                     89: #  <generation>II</generation>
                     90: #  <groupID>fs03nop590001</groupID>
                     91: #  <lastname>Smith</lastname>
                     92: #  <middlename>D</middlename>
                     93: #  <startdate></startdate>
                     94: #  <studentID>A12345678</studentID>
                     95: # </student>
                     96: # 
                     97: # with the following at the top of the file
                     98: #<?xml version="1.0" encoding="UTF-8"?>
                     99: #<!DOCTYPE text>
                    100: #<students>
                    101: #
                    102: # (all comment - #s removed)
                    103: #
                    104: # and a closing:
                    105: #</students>
                    106: #
                    107: # The <startdate> and the <enddate> are the activation date and expiration date
                    108: # for this student's role. If they are absent, then the date set for
                    109: # first automated enrollment is used as the default activation date, and the
                    110: # date set for last automated enrollment is used as the default expiration date.
                    111: # If dates are to included in the XML file, they should be in the format
                    112: # YYYY:MM:DD:HH:MM:SS (: separators required).
                    113: #
                    114: # If there were 10 students in fs03nop590001, 5 students in fs03nop59o601, 
                    115: # 8 students in fs03nop590602, and 2 students in fs03ost580002,
                    116: # then $$reply{'43551dedcd43febmsul1'} = 25
                    117: #
                    118: # The purpose of the %reply hash is to detect cases where the institutional 
                    119: # enrollment is 0 (most likely due to a problem with the data source).
                    120: # In such a case, the LON-CAPA course roster is left unchanged (i.e., no
                    121: # students are expired, even if automated drops is enabled.
                    122: # 
                    123: # fetch_enrollment should return a 0 or 1, depending on whether a connection
                    124: # could be established to the institutional data source.
                    125: # 0 is returned if no connection could be made.
                    126: # 1 is returned if connection was successful
                    127: #
                    128: # A return of 1 is required for the calling modules to perform LON-CAPA
                    129: # roster changes based on the contents of the XML classlist file(s), e,g,,
                    130: # msu_43551dedcd43febmsul1_fs03nop590001_classlist.xml
1.3       albertel  131: #
1.4       raeburn   132: # XML classlist files are temporary. They are deleted after the enrollment 
                    133: # update process in the calling module is complete.
1.3       albertel  134: #
1.4       raeburn   135: ################################
1.1       raeburn   136: 
                    137: sub fetch_enrollment {
1.7     ! matthew   138:     my ($dom,$affiliatesref,$replyref) = @_;
        !           139:     foreach my $crs (sort keys %{$affiliatesref}) {
        !           140:         $$replyref{$crs} = 0;
        !           141:     }
        !           142:     my $okflag = 0;
        !           143:     return $okflag;
1.4       raeburn   144: }
                    145: 
                    146: ###############################
                    147: # sub get_sections
                    148: #
                    149: # This is called by the Automated Enrollment Manager interface
                    150: # (lonpopulate.pm) to create an array of valid sections for 
                    151: # a specific institutional coursecode.
                    152: # e.g., for MSU coursecode: fs03nop590
                    153: # ("001","601","602") would be returned
                    154: #
                    155: # If the array returned contains at least one element, then 
                    156: # the interface offerred to the course coordinator, lists
                    157: # official sections and provides a checkbox to use to
                    158: # select enrollment in the LON-CAPA course from each official section.  
                    159: #
                    160: # get_sections requires one argument - the instituional coursecode
                    161: # (in the MSU case this is a concatenation of semester code, department
                    162: # and course number). 
                    163: # 
                    164: # If there is no access to official course sections at your institution,
                    165: # then an empty array is returned, and the Automated Enrollment Manager
                    166: # interface will allow the course coordinator to enter section numbers
                    167: # in text boxes.
                    168: # 
                    169: ################################ 
                    170: 
                    171: sub get_sections {
                    172:     my $coursecode = shift;
                    173:     my @secs = ();
                    174:     return @secs;
1.1       raeburn   175: }
                    176: 
1.4       raeburn   177: ###############################
                    178: # sub new_course
                    179: #
                    180: # This is called by loncreatecourse.pm and 
                    181: # lonpopulate.pm to record that fact that a new course section
                    182: # has been added to LON-CAPA that requires access to institutional data
                    183: # At MSU, this is required, as institutional classlists can only made
                    184: # available to faculty who are officially assigned to a course
                    185: # 
                    186: # The new_course subroutine is used to check that the course owner
                    187: # of the LON-CAPA course is permitted to access the institutional
                    188: # classlist for any course sections and crosslisted classes that
                    189: # the course coordinator wishes to have affiliated with the course.
                    190: # 
                    191: # If access is permitted, then 'ok' is returned.
                    192: # The course section or crosslisted course will only be added to the list of
                    193: # affiliates if 'ok' is returned.
                    194: #
                    195: # new_course requires two arguments -
                    196: # the institutional courseID (in the MSU case this is a concatenation of 
                    197: # semester code, department code, course number, and section number
                    198: # e.g., fs03nop590001).
                    199: # the course owner. This is the LON-CAPA username of the course coordinator 
                    200: # assigned to the course when it is first created.
                    201: #
                    202: #################################
                    203: 
                    204: sub new_course  {
                    205:     my ($course_id,$owner) = @_;
                    206:     my $outcome = 'ok';
                    207:     return $outcome;
1.1       raeburn   208: }
                    209: 
1.4       raeburn   210: ###############################
                    211: # sub validate_courseID
                    212: #
                    213: # This is called whenever a new course section or crosslisted course
                    214: # is being affiliated with a LON-CAPA course (i.e., by loncreatecourse.pm
                    215: # and the Automated Enrollment Manager in lonpopulate.pm).
                    216: # A check is made that the courseID that the course coordinator wishes
                    217: # to affiliate with the course is valid according to the institutional
                    218: # schedule of official classes 
                    219: #
                    220: # A valid courseID is confirmed by returning 'ok'
                    221: #
                    222: # validate_courseID requires one argument -
                    223: # the institutional courseID (in the MSU case this is a concatenation of
                    224: # semester code, department code, course number, and section number
                    225: # e.g., fs03nop590001).
                    226: #
                    227: ###############################  
                    228: 
                    229: sub validate_courseID {
                    230:     my $course_id = shift;
                    231:     my $outcome = 'ok';
                    232:     return $outcome;   
                    233: }
1.1       raeburn   234: 
1.4       raeburn   235: ###############################
                    236: # sub create_password 
                    237: #
                    238: # This is called when the authentication method set for the automated 
                    239: # enrollment process when enrolling new users in the domain is "local".
                    240: # This could be signalled for the specific user by the value of local
                    241: # for the <authtype> tag from the classlist.xml files, or if this is blank,
                    242: # the default authtype, set by the domain coordinator when creating the course
                    243: # with loncreatecourse.pm.
                    244: # 
                    245: # create_password requires one argument -
                    246: # the value of <autharg> from the classlist.xml files, or if this is blank,
                    247: # the default autharg, set by the domain coordinator when creating the course
                    248: # with loncreatecourse.pm.  
                    249: #
                    250: # Three values are returned:
                    251: # (a) the value of $authparam - which might have been changed
                    252: # (b) a flag to indicate whether a password had been created
                    253: # 0 means no password created
                    254: # 1 means password created.  In this case the calling module - Enrollment.pm
                    255: # will send the LON-CAPA username and passwod to the new user's e-mail
                    256: # (if one was provided), or to the course owner (if one was not provided and
                    257: # the new user was created by the automated process), or to the active
                    258: # course coordinator (if the new user was created using the 'update roster
                    259: # now' interface included in the Automated Enrollment Manager.  
                    260: # (c) a flag to indicate that the authentication method is correct - 'ok'.
                    261: # If $authchk is not set to 'ok' then account creation and enrollment of the 
                    262: # new user will not occur.
                    263: #    
                    264: ###############################
                    265: 
                    266: sub create_password {
                    267:     my $authparam = shift;
                    268:     my $authchk = 'ok';
                    269:     my $create_passwd = 0;
                    270:     return ($authparam,$create_passwd,$authchk);
1.1       raeburn   271: }
                    272: 
                    273: 1;

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