File:  [LON-CAPA] / loncom / enrollment / localenroll.pm
Revision 1.5: download - view: text, annotated - select for diffs
Thu Dec 11 15:43:29 2003 UTC (20 years, 6 months ago) by albertel
Branches: MAIN
CVS tags: HEAD
- putting GPL header back in

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

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