--- loncom/enrollment/localenroll.pm 2003/12/11 00:39:54 1.4 +++ loncom/enrollment/localenroll.pm 2004/07/03 18:37:20 1.10 @@ -1,8 +1,44 @@ +# functions to glue school database system into Lon-CAPA for +# automated enrollment +# $Id: localenroll.pm,v 1.10 2004/07/03 18:37:20 raeburn Exp $ +# +# Copyright Michigan State University Board of Trustees +# +# This file is part of the LearningOnline Network with CAPA (LON-CAPA). +# +# LON-CAPA is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# LON-CAPA is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with LON-CAPA; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +# +# /home/httpd/html/adm/gpl.txt +# +# http://www.lon-capa.org/ +# package localenroll; use strict; ################################ +# sub run +# set this to return 1 if you want the auto enrollment to run +################################ + +sub run() { + my $dom = shift; + return 0; +} + +################################ # sub fetch_enrollment # # connects to the institutional classlist data source, @@ -17,7 +53,7 @@ use strict; # where DOMAIN = msu COURSE = 43551dedcd43febmsul1 # INSTITUTIONALCODE = fs03nop590001 # (MSU's course naming scheme - fs03 = Fall semester 2003, nop = -# department name, 590 = course number, 001 = section number. +# department name, 590 = course number, 001 = section number.) # # fetch_enrollment requires three arguments - # $dom - DOMAIN e.g., msu @@ -72,9 +108,14 @@ use strict; # # # The and the are the activation date and expiration date -# for this student's role. If they are absent, then the date set for -# first automated enrollment is used as the default activation date, and the -# date set for last automated enrollment is used as the default expiration date. +# for this student's role. If they are absent, then the default access start and +# default access end dates are used. The default access dates can be set when +# the course is created, and can be modified using the Automated Enrollment +# Manager, or via the 'Upload a class list','Enroll a single student' or +# 'Modify student data' utilities in the Enrollment Manager, by checking the +# 'make these dates the default for future enrollment' checkbox. If no default +# dates have been set, then the tudent role will be active immediately, and will +# remain active until the role is explicitly expired using ENRL -> Drop students. # If dates are to included in the XML file, they should be in the format # YYYY:MM:DD:HH:MM:SS (: separators required). # @@ -102,13 +143,12 @@ use strict; ################################ sub fetch_enrollment { - my ($dom,$affiliatesref,$replyref) = @_; - foreach my $crs (sort keys %{$affiliatesref}) { - $$replyref{$crs} = 0; - } - } - my $okflag = 0; - return $okflag; + my ($dom,$affiliatesref,$replyref) = @_; + foreach my $crs (sort keys %{$affiliatesref}) { + $$replyref{$crs} = 0; + } + my $okflag = 0; + return $okflag; } ############################### @@ -125,7 +165,7 @@ sub fetch_enrollment { # official sections and provides a checkbox to use to # select enrollment in the LON-CAPA course from each official section. # -# get_sections requires one argument - the instituional coursecode +# get_sections requires one argument - the institutional coursecode # (in the MSU case this is a concatenation of semester code, department # and course number). # @@ -134,10 +174,10 @@ sub fetch_enrollment { # interface will allow the course coordinator to enter section numbers # in text boxes. # -################################ +############################### sub get_sections { - my $coursecode = shift; + my ($coursecode,$dom) = @_; my @secs = (); return @secs; } @@ -149,7 +189,7 @@ sub get_sections { # lonpopulate.pm to record that fact that a new course section # has been added to LON-CAPA that requires access to institutional data # At MSU, this is required, as institutional classlists can only made -# available to faculty who are officially assigned to a course +# available to faculty who are officially assigned to a course. # # The new_course subroutine is used to check that the course owner # of the LON-CAPA course is permitted to access the institutional @@ -170,7 +210,7 @@ sub get_sections { ################################# sub new_course { - my ($course_id,$owner) = @_; + my ($course_id,$owner,$dom) = @_; my $outcome = 'ok'; return $outcome; } @@ -195,7 +235,7 @@ sub new_course { ############################### sub validate_courseID { - my $course_id = shift; + my ($course_id,$dom) = @_; my $outcome = 'ok'; return $outcome; } @@ -204,8 +244,8 @@ sub validate_courseID { # sub create_password # # This is called when the authentication method set for the automated -# enrollment process when enrolling new users in the domain is "local". -# This could be signalled for the specific user by the value of local +# enrollment process when enrolling new users in the domain is "localauth". +# This could be signalled for the specific user by the value of localauth # for the tag from the classlist.xml files, or if this is blank, # the default authtype, set by the domain coordinator when creating the course # with loncreatecourse.pm. @@ -220,11 +260,11 @@ sub validate_courseID { # (b) a flag to indicate whether a password had been created # 0 means no password created # 1 means password created. In this case the calling module - Enrollment.pm -# will send the LON-CAPA username and passwod to the new user's e-mail +# will send the LON-CAPA username and password to the new user's e-mail # (if one was provided), or to the course owner (if one was not provided and # the new user was created by the automated process), or to the active # course coordinator (if the new user was created using the 'update roster -# now' interface included in the Automated Enrollment Manager. +# now' interface included in the Automated Enrollment Manager). # (c) a flag to indicate that the authentication method is correct - 'ok'. # If $authchk is not set to 'ok' then account creation and enrollment of the # new user will not occur. @@ -232,10 +272,52 @@ sub validate_courseID { ############################### sub create_password { - my $authparam = shift; + my ($authparam,$dom) = @_; my $authchk = 'ok'; my $create_passwd = 0; return ($authparam,$create_passwd,$authchk); } +############################### +# sub instcode_format +# +# Split coursecodes into constituent parts. +# e.g., INSTITUTIONALCODE = fs03nop590, LON-CAPA COURSEID: 43551dedcd43febmsul1 +# (MSU's course naming scheme - fs03 = Fall semester 2003, nop = +# department name, 590 = course number) +# +# Incoming data: +# $dom (domain) +# $$courseIDs{'43551dedcd43febmsul1'} = 'Title of course' (hash of courseIDs) +# +# fs03nop590 would be split as follows +# @{$codetitles} = ("year","semester","department","number") +# $$codes{{'year'} = '2003' +# $$codes{'semester'} = 'Fall' +# $$codes{'department'} = 'nop' +# $$codes{'number'} = '590' +# +# requires five arguments: +# domain ($dom) +# reference to hash of institutional course IDs ($instcodes) +# reference to hash of codes ($codes) +# reference to array of titles ($codetitles) +# reference to hash of abbreviations used in categories +# reference to hash of arrays specifying sort order used in category titles +# +# e.g., %{$$cat_titles{'Semester'}} = ( +# fs => 'Fall', +# ss => 'Spring', +# us => 'Summer'); +# +# e.g., @{$$cat_order{'Semester'}} = ('ss','us','fs'); +# returns 1 parameter: 'ok' if no processing errors. +############################### + +sub instcode_format () { + my ($dom,$instcodes,$codes,$codetitles,$cat_titles,$cat_order) = @_; + my $outcome = 'ok'; + return $outcome; +} + 1;