[LON-CAPA-admin] auto create course

Stuart Peter Raeburn raeburn at msu.edu
Sun Oct 23 09:01:55 EDT 2005

Hi Hon Kie, 

Multiple course coordinators can be included by adding additional users 
within the XML describing the course to be created.  Just add an additional 
<user> inside the <users> block and set the role using <role id='cc'> 

In the example XML provided in 
the first <user></user> block contains an empty <roles></roles> entry 
because the user in this case is the course owner and the course owner is 
automatically given a Course Coordinator role, and no additional roles are 
required for this user. 

Users can be assigned multiple roles by including additional <role id="$id"> 
</role> entries inside the <roles></roles> block. The permissible values of 
$id are cc, in, ta, ep, st (corresponding to course coordinator, instructor, 
teaching assistant, exam proctor, student). 

The second <user></user> block contains user information for a different 
user and a single role for that user (in this case id="in" - instructor).    
If the assigned role had been id="cc" both the course owner and the second 
user would have received Course Coordinator roles in the new course. 

Some discussion of the significance of the course owner designation can be 
found in: 


The documentation within /home/httpd/lib/perl/LONCAPA/batchcreatecourse.pm 
states that XML file(s) describing courses that are to be created in domain 
$dom are stored in  /home/httpd/perl/tmp/addcourse/$dom. 

The documentation further states that the directory for retrieval of files 
listed in @$requests is 

/home/httpd/perl/tmp/addcourse/$dom/auto/pending if $context = auto 


/home/httpd/perl/tmp/addcourse/$dom/web/$udom_$uname if $context = web 

where @$requests is a reference to an array containing filenames of the 
courses to be created by &create_courses(). 

Currently, the first of these cases is the only one implemented.  The 
intention is that you will add XML files of courses to be created in domain 
$dom to /home/httpd/perl/tmp/addcourse/$dom/auto/pending on the domain's 
library server which will become the homeserver for the new courses. 

Then when /home/httpd/perl/Autocreate.pl is run it will read the contents of
home/httpd/perl/tmp/addcourse/$dom/auto/pending.  Filenames of files within 
this directory are put in @requests, and then 
&LONCAPA::batchcreatecourse::create_courses() is called with a reference to 
the @requests array passed as the first argument, and the context argument 
set to auto. After &create_courses() has run, files within 
/home/httpd/perl/tmp/addcourse/$dom/auto/pending are moved to 

In this case context is auto, because the intent is that Autocreate.pl would 
be run automatically by a cron job, although it can of course be run from 
the comaand line as www.  Note:  /home/httpd/perl/Autocreate.pl requires two 
arguments: coursedomain  username:domain
where coursedomain is the domain of the new courses, and username:domain is 
the username:domain of a Domain Coordinator in that domain. 

At MSU a cron job is run every 10 minutes to check for new online course 
requests submitted by faculty using an online form run on a separate server. 
If there are any requests then the corresponding XML file(s) are copied to 
/home/httpd/perl/tmp/addcourse/$dom/auto/pending on the MSU library server, 
and Autocreate.pl is run. 

The plan (for 2.1) is to modify loncreatecourse,pm (called by a DC via the 
CCRS button) to allow upload of an XML file via the web interface, followed 
by a call to &LONCAPA::batchcreatecourse::create_courses() with the context 
argument set to web. When this is implemented, XML course request files 
uploaded via CCRS will be stored in 


where $udom and $uname are the domain and username of the Domain Coordinator 
using CCRS. 

The original interactive single course creation functionality in CCRS will 
continue to be available as one of two options when a DC launches CCRS (the 
other option will be upload of an XML file for batch creation of one or more 


Stuart Raeburn
MSU LON-CAPA support/development 

H. K. Ng writes: 

> Hi, 
> I am working on implementing an automatic course creation and needs some 
> clarifications. 
> 1. Is it possible to assign more than one course coordinator? 
> 2. Under the <user> tag, the example gave the following:
>  <users>
>   <user>
>    <username>sparty</username>
>    <domain>msu</domain>
>    <email>sparty at msu.edu</email>
>    <authtype>krb4</authtype>
>    <autharg></autharg>
>    <firstname>MSU</firstname>
>    <generation></generation>
>    <lastname>Spartan</lastname>x
>    <middlename></middlename>
>    <studentID></studentID>
>    <roles></roles>
>   </user>
> Who are these users? There is a <roles> tag. Can it be used to assign an 
> additional course coordinator by putting <role id='cc'>? (in reference to 
> Q1 above?) I assume the <owner> is the course coordinator. 
> 3. In the batchcoursecreate file, at one point it states that the file be 
> save in
> # /home/httpd/perl/tmp/addcourse/$dom 
> but just before the create_course routine it has the following:
> #                    /home/httpd/perl/tmp/addcourse/$dom/auto/pending if 
> $context = auto
> #                    /home/httpd/perl/tmp/addcourse/$dom/web/$udom_$uname 
> if $context = web
> Under what conditions should one use each of the above? 
> Thanks,
> -hk 
> _______________________________________________
> LON-CAPA-admin mailing list
> LON-CAPA-admin at mail.lon-capa.org
> http://mail.lon-capa.org/mailman/listinfo/lon-capa-admin 

More information about the LON-CAPA-admin mailing list