[LON-CAPA-cvs] cvs: loncom /html/adm/help/tex Institutional_Integration_Course_Requests.tex

raeburn raeburn@source.lon-capa.org
Mon, 23 May 2011 20:34:21 -0000

raeburn		Mon May 23 20:34:21 2011 EDT

  Added files:                 
  - Document routines in localenroll.pm which support validation of instructor
    of record status for requestors of official courses, and support immediate
    processing for validated requests, and queuing for unvalidated ones.  

Index: loncom/html/adm/help/tex/Institutional_Integration_Course_Requests.tex
+++ loncom/html/adm/help/tex/Institutional_Integration_Course_Requests.tex
Course requests for official courses, i.e., courses with a valid
institutional code, can be set to be processed automatically, on submission,
if the requestor has been validated as the instructor of record for the
course (based on institutional code).

In order to provide this functionality the following routines in /home/httpd/lib/pel/localenroll.pm will need to be customized.

\emph{validate\_instcode()}, \emph{validate\_crsreq()}, \emph{crsreq_checks()}.

validate\_instcode() is called when a request is being made for an official course.
A check is made that the institutional code for which a course is being 
requested is valid according to the institutional schedule of official classes.
validate\_crsreq() is used to check whether a course request should be 
processed automatically, or held in a queue pending administrative
action at the institution.

Course requests will trigger this check if the process type has been set
to ``validate'' for the course type (official, unofficial or community) and
the requestor's affiliation.  Whether ``validate'' is an available option
in the Domain Configuration menu is controlled by crsreq\_checks().
One scenario is where the request is for an official course, in which case
a check could be made that the requestor is listed as instructor of
record for the course in the institution's course schedule/database.
This also involves validate\_instcode(), but in this case the username 
of the course owner is also included, and a more restrictive
test is used, namely that the requestor is listed as instructor of
record for the course in the institution's course schedule/database.

Other scenarios are possible, and the routine can be customized according
to whatever rules a domain wishes to implement to run validations against
given the data passed in to the routine.
Customization of \emph{possible\_instcodes()} is also needed to support creation
of dropdown lists used by the requestor when selecting the institutional code
for the course to be created.

\textbf{\large validate\_instcode}

Two arguments are always required, and a third is needed if instructor of
record status is being checked.
\item LON-CAPA domain that will contain the course
\item institutional code (in the MSU case this is a concatenation of
 semester code, department code, and course number, e.g., fs03nop590).
\item optional institutional username for the course owner.

An array is returned containing:
\item the result of the check for a valid instcode.
\item (optional) course description.

A valid instcode is confirmed by returning 'valid'. 
Otherwise a description of why the validation check failed can be returned
for display to the course requestor.
If no course description is available, '' should be set as
the value of the second item in the returned array.

\textbf{\large validate\_crsreq}

Six arguments are required:

\item domain (\$dom)
\item username:domain for the course owner (\$owner)
\item course type -- official, unofficial or community (\$crstype) 
\item comma-separated list of owner's institutional groups (\$inststatuslist)
\item institutional code (\$instcode)
\item comma-separated list of requested institutional sections (\$instseclist)

A valid courserequest is confirmed by returning 'process'.
The following can be returned: process, rejected, pending, approval or error 
(with error condition - no :), followed by a : and then an optional message.

\item process  - the requestor is the recorded instructor - create the course
\item rejected - the requestor should never be requesting this course, reject the
                 request permanently
\item pending - the requestor is not the recorded instructor, but could
      become so after administrative action at the institution. Put the
      request in a queue and check localenroll:validate\_instcode()
      periodically until the status changes to "valid".
\item approval - the request will be held pending review by a Domain Coordinator.
\item error (followed by the error condition).

If the response is pending then the course request is stored in a queue. 
If your domain is configured to process pending requests for official courses,
once validated (see: \ref{Domain_Configuration_Auto_Creation} Auto-course creation settings), then the nightly run of Autocreate.pl will test each currently
pending course request, to determine if the owner can now be validated, 
and if so, will create the course.
If the owner remains unvalidated the request will remain in the queue. Domain Coordinators can display a list of requests for official courses, queued pending validation, via the ``Course and community creation'' page (see: \ref{Create_Course} Creation Options). 

\textbf{\large crsreq\_checks}

Three arguments are required:
\item domain for which validation options are needed. (\$dom)
\item ref to array of course types -- official, unofficial,community. (\$reqtypes)
\item ref to a hash of a hash which will determine whether ``validate''
will be one of the possible choices for each course type - outer hash key,
and institutional type - inner hash key (\$validations).

For example to allow validate to be a choice for official classes for Faculty,
crsreq\_checks would include:

\$validations\{'official'\}\{'Faculty'\} = 1;

The institutional types are those defined in inst\_usertypes(), and described
in the \ref{Domain_Configuration_Auto_Enrollment} Auto-Enrollment help page.

A value of 'ok' should be returned if no errors occurred.
The routine used at MSU is as follows:

\texttt{sub crsreq\_checks \{}
\texttt{my (\$dom,\$reqtypes,\$validations) = @\_;}

\texttt{if ((ref(\$reqtypes) eq 'ARRAY') \&\& (ref(\$validations) eq 'HASH')) \{}
\texttt{my (\%usertypes,@order);}

\texttt{if (\&inst\_usertypes(\$dom,\textbackslash{}\%usertypes,\textbackslash{}@order) eq 'ok') \{}
\texttt{foreach my \$type (@\{\$reqtypes\}) \{}
\texttt{foreach my \$inst\_type (@order) \{}
\texttt{if ((\$type eq 'official') \&\& (\$inst\_type eq 'Faculty')) \{}
\texttt{\$validations->\{\$type\}\{\$inst\_type\} = 1;}
\texttt{\} else \{}
\texttt{\$validations->\{\$type\}{\$inst\_type} = '';}

\texttt{return 'ok';}

\textbf{\large possible\_instcodes}

The routine gathers acceptable values for institutional categories to use 
in the course creation request form for official courses.

Five arguments are required:
\item domain (\$dom)
\item reference to array of titles (\$codetitles), e.g., 
@\{\$codetitles\} = ('Year','Semester',"Department','Number');
\item reference to hash of abbreviations used in categories (\$cat\_titles), e.g.,
\%\{\$\$cat\_titles\{'Semester'\}\} = (
fs => 'Fall',

ss => 'Spring',

us => 'Summer'

\item reference to hash of arrays specifying sort order used in category titles
(\$cat\_order), e.g., 
@\{\$\$cat\_order\{'Semester'\}\} = ('ss','us','fs');
\item reference to array which will contain order of component parts used
in institutional code (\$code\_order), e.g.,
@\{\$code\_order\} = ('Semester','Year','Department','Number');

A value of 'ok' should be returned if no errors occurred.