--- loncom/automation/batchcreatecourse.pm 2006/08/11 19:30:52 1.17
+++ loncom/automation/batchcreatecourse.pm 2007/05/11 01:48:26 1.21
@@ -1,5 +1,5 @@
#
-# $Id: batchcreatecourse.pm,v 1.17 2006/08/11 19:30:52 albertel Exp $
+# $Id: batchcreatecourse.pm,v 1.21 2007/05/11 01:48:26 raeburn Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -31,9 +31,8 @@ use HTML::Parser;
use Time::Local;
use Apache::lonnet;
use Apache::loncommon;
-use Apache::loncreatecourse;
-use Apache::loncreateuser;
use Apache::lonlocal;
+use LONCAPA qw(:match);
use strict;
@@ -81,7 +80,7 @@ use strict;
# 1
# 1
# 0
-# keyadmin@msu
+# keyadmin:msu
# 1
# 1
#
@@ -220,7 +219,9 @@ sub create_courses {
&parse_coursereqs($newcoursedir.'/'.$request, \%details);
foreach my $num (sort keys %details) {
my $courseid = &build_course($dom,$num,$context,\%details,\%longroles,\$logmsg,\$newusermsg,\$addresult,\%enrollcount,\$output,\$keysmsg);
- $$courseids{$courseid} = $details{$num}{'class'};
+ if ($courseid =~ /^$match_courseid$/) {
+ $$courseids{$courseid} = $details{$num}{'class'};
+ }
}
}
}
@@ -491,13 +492,13 @@ sub build_course {
firstres => $firstres
};
- my %host_servers = &Apache::loncommon::get_library_servers($cdom);
+ my %host_servers = &Apache::lonnet::get_servers($cdom,'library');
if (! exists($host_servers{$$details{$num}{'coursehome'}})) {
$$logmsg .= &mt('Invalid home server for course').': '.$$details{$num}{'coursehome'};
return;
}
- &Apache::loncreatecourse::construct_course($courseargs,$logmsg,\$courseid,\$crsudom,\$crsunum,$udom,$uname);
+ &Apache::loncommon::construct_course($courseargs,$logmsg,\$courseid,\$crsudom,\$crsunum,$udom,$uname);
} else {
return;
}
@@ -555,7 +556,7 @@ sub build_course {
if ($usec ne '') {
$url .= '/'.$usec;
}
- $$output .= &Apache::loncreateuser::commit_standardrole($userdom,$username,$url,$curr_role,$start,$end,$crsudom,$crsunum,$usec);
+ $$output .= &Apache::loncommon::commit_standardrole($userdom,$username,$url,$curr_role,$start,$end,$crsudom,$crsunum,$usec);
}
}
if (@{$$details{$num}{'users'}{$userkey}{'roles'}} > 1) {
@@ -569,14 +570,14 @@ sub build_course {
if ($usec ne '') {
$url .= '/'.$usec;
}
- $$output .= &Apache::loncreateuser::commit_studentrole(\$stulogmsg,$userdom,$username,$url,$curr_role,$start,$end,$crsudom,$crsunum,$usec);
+ $$output .= &Apache::loncommon::commit_studentrole(\$stulogmsg,$userdom,$username,$url,$curr_role,$start,$end,$crsudom,$crsunum,$usec);
} else {
foreach my $usec (@{$$details{$num}{'users'}{$userkey}{$curr_role}{'usec'}}) {
$url = '/'.$crsudom.'/'.$crsunum;
if ($usec ne '') {
$url .= '/'.$usec;
}
- $$output .= &Apache::loncreateuser::commit_standardrole($userdom,$username,$url,$curr_role,$start,$end,$crsudom,$crsunum,$usec);
+ $$output .= &Apache::loncommon::commit_standardrole($userdom,$username,$url,$curr_role,$start,$end,$crsudom,$crsunum,$usec);
}
}
}
@@ -592,7 +593,7 @@ sub build_course {
if ($usec ne '') {
$url .= '/'.$usec;
}
- $$output .= &Apache::loncreateuser::commit_studentrole(\$stulogmsg,$userdom,$username,$url,$curr_role,$start,$end,$crsudom,$crsunum,$usec);
+ $$output .= &Apache::loncommon::commit_studentrole(\$stulogmsg,$userdom,$username,$url,$curr_role,$start,$end,$crsudom,$crsunum,$usec);
} else {
if (@{$$details{$num}{'users'}{$userkey}{$curr_role}{'usec'}} > 0) {
foreach my $usec (@{$$details{$num}{'users'}{$userkey}{$curr_role}{'usec'}}) {
@@ -600,12 +601,12 @@ sub build_course {
if ($usec ne '') {
$url .= '/'.$usec;
}
- my $stdresult = &Apache::loncreateuser::commit_standardrole($userdom,$username,$url,$curr_role,$start,$end,$crsudom,$crsunum,$usec);
+ my $stdresult = &Apache::loncommon::commit_standardrole($userdom,$username,$url,$curr_role,$start,$end,$crsudom,$crsunum,$usec);
$$output .= $stdresult;
}
} else {
$url = '/'.$crsudom.'/'.$crsunum;
- $$output .= &Apache::loncreateuser::commit_standardrole($userdom,$username,$url,$curr_role,$start,$end,$crsudom,$crsunum,'');
+ $$output .= &Apache::loncommon::commit_standardrole($userdom,$username,$url,$curr_role,$start,$end,$crsudom,$crsunum,'');
}
}
}