[LON-CAPA-cvs] cvs: loncom /automation batchcreatecourse.pm
raeburn
lon-capa-cvs@mail.lon-capa.org
Fri, 04 Mar 2005 14:07:15 -0000
raeburn Fri Mar 4 09:07:15 2005 EDT
Modified files:
/loncom/automation batchcreatecourse.pm
Log:
Pass along username and domain of Domain Coordinator creating course - used for DC notification of auto-enrollment changes. Also disposition of XML course description file after processing is now handled by the calling script.
Index: loncom/automation/batchcreatecourse.pm
diff -u loncom/automation/batchcreatecourse.pm:1.2 loncom/automation/batchcreatecourse.pm:1.3
--- loncom/automation/batchcreatecourse.pm:1.2 Wed Mar 2 14:50:52 2005
+++ loncom/automation/batchcreatecourse.pm Fri Mar 4 09:07:15 2005
@@ -16,8 +16,7 @@
# of a file containing an XML description of a course request (lonbatchccrs.pm).
#
# XML file(s) describing courses that are to be created in domain $dom are stored in
-# /home/httpd/perl/tmp/addcourse/$dom. Each XML file is deleted after it has been
-# parsed.
+# /home/httpd/perl/tmp/addcourse/$dom
#
# &create_courses() will create an account for the course owner
# (if one does not currently exist), will create the course (cloning if necessary),
@@ -137,15 +136,16 @@
# files listed in @$requests are deleted
# after the files have been parsed.
#
-# Directory searched for files listed in @$requests
-# is /home/httpd/perl/tmp/addcourse/$dom/auto if $context is auto
-# and /home/httpd/perl/tmp/addcourse/$dom/web/$uname if $context is web
+# 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
#
# inputs (five) - requests - ref to array of filename(s) containing course requests
# courseids - ref to hash to store LON-CAPA course ids of new courses
# context - auto if called from command line, web if called from browser
# dom - domain for which the course is being created
-# uname - username of DC who is requesting course creation from browser
+# uname - username of DC who is requesting course creation
+# udom - domain of DC who is requesting course creation
#
# outputs (three) - output - text recording user roles added etc.
# logmsg - text to be logged
@@ -153,7 +153,7 @@
#############################################################
sub create_courses {
- my ($requests,$courseids,$context,$dom,$uname) = @_;
+ my ($requests,$courseids,$context,$dom,$uname,$udom) = @_;
my $output;
my $perlvarref = LONCAPA::Configuration::read_conf('loncapa.conf');
# Get role names
@@ -169,9 +169,13 @@
my ($logmsg,$keysmsg,$newusermsg,$addresult);
my %enrollcount = ();
my $newcoursedir = $$perlvarref{'lonDaemons'}.'/tmp/addcourse/'.$dom.'/'.$context;
- if ($uname) {
- unless ($context eq 'auto') {
- $newcoursedir .= '/'.$uname;
+ if ($context eq 'auto') {
+ $newcoursedir .= '/pending';
+ } else {
+ if ($uname && $udom) {
+ $newcoursedir .= '/'.$udom.'_'.$uname;
+ } else {
+ $logmsg = "batchcreatecourse::create_courses() called without username and/or domain of requesting Domain Coordinator";
}
}
if (@{$requests} > 0) {
@@ -349,7 +353,7 @@
#########################################################
sub build_course {
- my ($cdom,$num,$context,$details,$longoles,$logmsg,$newusermsg,$addresult,$enrollcount,$output,$keysmsg) = @_;
+ my ($cdom,$num,$context,$details,$longoles,$logmsg,$newusermsg,$addresult,$enrollcount,$output,$keysmsg,$udom,$uname) = @_;
my $owner_uname = $$details{$num}{'owner'};
my $owner_domain = $$details{$num}{'domain'};
my $owner = $owner_uname.':'.$owner_domain;
@@ -457,7 +461,7 @@
return;
}
- &Apache::loncreatecourse::construct_course($courseargs,$logmsg,\$courseid,\$crsudom,\$crsunum);
+ &Apache::loncreatecourse::construct_course($courseargs,$logmsg,\$courseid,\$crsudom,\$crsunum,$udom,$uname);
} else {
return;
}