@@ -189,16 +189,12 @@ use strict;
# uname - username of DC who is requesting course creation
# udom - domain of DC who is requesting course creation
#
-# outputs (six) - output - text recording user roles added etc.
-# logmsg - text to be logged
-# cloneinfo - text output from cloning
-# keysmsg - text containing link(s) to manage keys page(s)
-# codehash - reference to hash containing courseID => unique code
-# where unique code is a 6 character code, to distribute
-# to students as a shortcut to the course.
-# instcodes - references to hash of an array, where keys are
-# institutional codes and values are an array of
-# courseIDs of courses with that code.
+# outputs (four) - output - text recording user roles added etc.
+# logmsg - text to be logged
+# keysmsg - text containing link(s) to manage keys page(s)
+# codehash - reference to hash containing courseID => unique code
+# where unique code is a 6 character code, to distribute
+# to students as a shortcut to the course.
#############################################################
sub create_courses {
@@ -216,12 +212,10 @@ sub create_courses {
$longroles{'Community'}{$1} = $3;
}
}
- my ($logmsg,$cloneinfo,$keysmsg,$newusermsg,$addresult,$user_lh,
- %codehash,%instcodes);
+ my ($logmsg,$keysmsg,$newusermsg,$addresult,%codehash,%instcodes);
my %enrollcount = ();
my $newcoursedir = LONCAPA::tempdir().'/addcourse/'.$dom.'/'.$context;
if ($context eq 'auto') {
- $user_lh = &Apache::loncommon::user_lang($uname,$udom);
$newcoursedir .= '/pending';
} else {
if ($uname && $udom) {
@@ -233,16 +227,14 @@ sub create_courses {
if (@{$requests} > 0) {
foreach my $request (@{$requests}) {
my %details = ();
- my $clonemsg = [];
if (-e $newcoursedir.'/'.$request) {
&parse_coursereqs($newcoursedir.'/'.$request, \%details);
foreach my $num (sort(keys(%details))) {
my $reqdetails = $details{$num};
my $code;
- my $courseid =
- &build_course($dom,$num,$context,$reqdetails,\%longroles,\$logmsg,
- $clonemsg,\$newusermsg,\$addresult,\%enrollcount,
- \$output,\$keysmsg,undef,undef,undef,undef,\$code);
+ my $courseid =
+ &build_course($dom,$num,$context,$reqdetails,\%longroles,\$logmsg,\$newusermsg,
+ \$addresult,\%enrollcount,\$output,\$keysmsg,undef,undef,undef,undef,\$code);
if ($courseid =~m{^/$match_domain/$match_courseid}) {
$$courseids{$courseid} = $details{$num}{'class'};
if ($code) {
@@ -252,33 +244,11 @@ sub create_courses {
push(@{$instcodes{$details{$num}{'coursecode'}}},$courseid);
}
}
- if (@{$clonemsg}) {
- if ($context eq 'web') {
- $cloneinfo .= '';
- }
- foreach my $item (@{$clonemsg}) {
- if (ref($item) eq 'HASH') {
- if ($context eq 'auto') {
- $cloneinfo .= &mt_user($user_lh,$item->{mt},
- @{$item->{args}});
- } else {
- $cloneinfo .= &mt($item->{mt},@{$item->{args}});
- }
- }
- if ($context eq 'web') {
- $cloneinfo .= '
';
- }
- $cloneinfo .= "\n";
- }
- if ($context eq 'web') {
- $cloneinfo .= '
';
- }
- }
}
}
}
}
- return ($output,$logmsg,$cloneinfo,$keysmsg,\%codehash,\%instcodes);
+ return ($output,$logmsg,$keysmsg,\%codehash,\%instcodes);
}
#############################################################
@@ -301,9 +271,9 @@ sub parse_coursereqs {
my $xlist = 0;
my $userkey = '';
my $role = '';
- my @items = ('title','optional_id','coursecode','defaultcredits','coursehome','reshome','nonstandard','adds','drops','topmap','firstres','clonecrs','clonedom','datemode','dateshift','tinyurls','showphotos','setpolicy','setcontent','setcomment','setkeys','keyauth','disresdis','disablechat','openall','notify_owner','notify_dc','crstype','crsquota','uniquecode');
+ my @items = ('title','optional_id','coursecode','defaultcredits','coursehome','reshome','nonstandard','adds','drops','topmap','firstres','clonecrs','clonedom','datemode','dateshift','showphotos','setpolicy','setcontent','setcomment','setkeys','keyauth','disresdis','disablechat','openall','notify_owner','notify_dc','crstype','crsquota','uniquecode');
my @possroles = qw(st ad ep ta in cc co);
- my @dateitems = ('enrollstart','enrollend','accessstart','accessend');
+ my @dateitems = ('enrollstart','enrollend','accessstart','accessend','openallfrom');
my @useritems = ('autharg','authtype','firstname','generation','lastname','middlename','studentID');
my $p = HTML::Parser->new
(
@@ -427,7 +397,6 @@ sub parse_coursereqs {
# ref to hash of course creation information
# ref to hash of role descriptions
# ref to scalar used to accumulate log messages
-# ref to array used to accumulate messages about cloning
# ref to scalar used to accumulate messages sent to new users
# ref to scalar used to accumulate results of new user additions
# ref to hash of enrollment counts for different roles
@@ -439,8 +408,6 @@ sub parse_coursereqs {
# course requests submitted via course request form.
# optional category
# optional ref to scalar for six character unique identifier
-# caller context (e.g., auto)
-# user language handle, if caller context is 'auto'
#
# outputs
# LON-CAPA courseID for new (created) course
@@ -448,9 +415,8 @@ sub parse_coursereqs {
#########################################################
sub build_course {
- my ($cdom,$num,$context,$details,$longroles,$logmsg,$clonemsg,$newusermsg,
- $addresult,$enrollcount,$output,$keysmsg,$udom,$uname,$cnum,$category,
- $coderef,$callercontext,$user_lh) = @_;
+ my ($cdom,$num,$context,$details,$longroles,$logmsg,$newusermsg,$addresult,
+ $enrollcount,$output,$keysmsg,$udom,$uname,$cnum,$category,$coderef) = @_;
return unless (ref($details) eq 'HASH');
my $owner_uname = $details->{'owner'};
my $owner_domain = $details->{'domain'};
@@ -538,9 +504,6 @@ sub build_course {
$details->{'datemode'} = 'shift';
$details->{'dateshift'} = 365;
}
- if ($details->{'tinyurls'} !~ /^(delete|transfer|create)$/) {
- $details->{'tinyurls'} = 'create';
- }
my $courseargs = {
ccuname => $details->{'owner'},
ccdomain => $details->{'domain'},
@@ -558,7 +521,6 @@ sub build_course {
clonedomain => $details->{'clonedom'},
datemode => $details->{'datemode'},
dateshift => $details->{'dateshift'},
- tinyurls => $details->{'tinyurls'},
crsid => $details->{'optional_id'},
curruser => $details->{'owner'},
crssections => $sectionstr,
@@ -584,6 +546,7 @@ sub build_course {
disresdis => $details->{'disresdis'},
disablechat => $details->{'disablechat'},
openall => $details->{'openall'},
+ openallfrom => $details->{'openallfrom'},
firstres => $firstres
};
if ($details->{'textbook'}) {
@@ -594,21 +557,17 @@ sub build_course {
$$logmsg .= &mt('Invalid home server for course').': '.$details->{'coursehome'};
return;
}
- my ($success,$msg,$cloneinfo) =
+ my ($success, $msg) =
&Apache::loncommon::construct_course($courseargs,$logmsg,\$courseid,\$crsudom,\$crsunum,
- $udom,$uname,$context,$cnum,$category,$coderef,
- $callercontext,$user_lh);
+ $udom,$uname,$context,$cnum,$category,$coderef);
$$logmsg .= $msg;
- if ((ref($clonemsg) eq 'ARRAY') && (ref($cloneinfo) eq 'ARRAY')) {
- push(@{$clonemsg},@{$cloneinfo});
- }
if (!$success) {
return;
}
} else {
return;
}
-
+
#
# Make owner a coordinator
#