version 1.20, 2007/03/03 01:40:38
|
version 1.30, 2009/08/15 00:25:34
|
Line 32 use Time::Local;
|
Line 32 use Time::Local;
|
use Apache::lonnet; |
use Apache::lonnet; |
use Apache::loncommon; |
use Apache::loncommon; |
use Apache::lonlocal; |
use Apache::lonlocal; |
|
use LONCAPA qw(:match); |
|
|
use strict; |
use strict; |
|
|
Line 75 use strict;
|
Line 76 use strict;
|
# <crsquota>20</crsquota> |
# <crsquota>20</crsquota> |
# <clonecrs>466011437c34194msul1</clonecrs> |
# <clonecrs>466011437c34194msul1</clonecrs> |
# <clonedom>msu</clonedom> |
# <clonedom>msu</clonedom> |
|
# <datemode>shift</datemode> |
|
# <dateshift>365</dateshift> |
# <showphotos></showphotos> |
# <showphotos></showphotos> |
# <setpolicy>1</setpolicy> |
# <setpolicy>1</setpolicy> |
# <setcontent>1</setcontent> |
# <setcontent>1</setcontent> |
Line 216 sub create_courses {
|
Line 219 sub create_courses {
|
my %details = (); |
my %details = (); |
if (-e $newcoursedir.'/'.$request) { |
if (-e $newcoursedir.'/'.$request) { |
&parse_coursereqs($newcoursedir.'/'.$request, \%details); |
&parse_coursereqs($newcoursedir.'/'.$request, \%details); |
foreach my $num (sort keys %details) { |
foreach my $num (sort(keys(%details))) { |
my $courseid = &build_course($dom,$num,$context,\%details,\%longroles,\$logmsg,\$newusermsg,\$addresult,\%enrollcount,\$output,\$keysmsg); |
my $reqdetails = $details{$num}; |
$$courseids{$courseid} = $details{$num}{'class'}; |
my $courseid = &build_course($dom,$num,$context,$reqdetails,\%longroles,\$logmsg,\$newusermsg,\$addresult,\%enrollcount,\$output,\$keysmsg); |
|
if ($courseid =~m{^/$match_domain/$match_courseid}) { |
|
$$courseids{$courseid} = $details{$num}{'class'}; |
|
} |
} |
} |
} |
} |
} |
} |
Line 246 sub parse_coursereqs {
|
Line 252 sub parse_coursereqs {
|
my $xlist = 0; |
my $xlist = 0; |
my $userkey = ''; |
my $userkey = ''; |
my $role = ''; |
my $role = ''; |
my @items = ('title','optional_id','coursecode','coursehome','reshome','nonstandard','adds','drops','topmap','firstres','clonecrs','clonedom','showphotos','setpolicy','setcontent','setkeys','keyauth','disresdis','disablechat','openall','notify_owner','notify_dc','crstype','crsquota'); |
my @items = ('title','optional_id','coursecode','coursehome','reshome','nonstandard','adds','drops','topmap','firstres','clonecrs','clonedom','datemode','dateshift','showphotos','setpolicy','setcontent','setkeys','keyauth','disresdis','disablechat','openall','notify_owner','notify_dc','crstype','crsquota'); |
my @dateitems = ('enrollstart','enrollend','accessstart','accessend'); |
my @dateitems = ('enrollstart','enrollend','accessstart','accessend'); |
my @useritems = ('autharg','authtype','firstname','generation','lastname','middlename','studentID'); |
my @useritems = ('autharg','authtype','firstname','generation','lastname','middlename','studentID'); |
my $p = HTML::Parser->new |
my $p = HTML::Parser->new |
Line 365 sub parse_coursereqs {
|
Line 371 sub parse_coursereqs {
|
# build_course() |
# build_course() |
# |
# |
# inputs |
# inputs |
# domain |
# course domain |
# course request number |
# course request number |
# context - auto if called from command line, web if called from DC web interface |
# context - auto if called from command line, web if called from DC web interface |
# ref to hash of course creation information |
# ref to hash of course creation information |
Line 374 sub parse_coursereqs {
|
Line 380 sub parse_coursereqs {
|
# ref to scalar used to accumulate messages sent to new users |
# ref to scalar used to accumulate messages sent to new users |
# ref to scalar used to accumulate results of new user additions |
# ref to scalar used to accumulate results of new user additions |
# ref to hash of enrollment counts for different roles |
# ref to hash of enrollment counts for different roles |
# ref to scalar used to accumulate iformation about added roles |
# ref to scalar used to accumulate information about added roles |
# ref to scalar used to accumulate |
# ref to scalar used to accumulate |
|
# ref to scalar used to accumulate information about access keys |
|
# domain of DC creating course |
|
# username of DC creating course |
|
# optional course number, if unique course number already obtained (e.g., for |
|
# course requests submitted via course request form. |
# |
# |
# outputs |
# outputs |
# LON-CAPA courseID for new (created) course |
# LON-CAPA courseID for new (created) course |
Line 383 sub parse_coursereqs {
|
Line 394 sub parse_coursereqs {
|
######################################################### |
######################################################### |
|
|
sub build_course { |
sub build_course { |
my ($cdom,$num,$context,$details,$longroles,$logmsg,$newusermsg,$addresult,$enrollcount,$output,$keysmsg,$udom,$uname) = @_; |
my ($cdom,$num,$context,$details,$longroles,$logmsg,$newusermsg,$addresult,$enrollcount,$output,$keysmsg,$udom,$uname,$cnum,$category) = @_; |
my $owner_uname = $$details{$num}{'owner'}; |
return unless (ref($details) eq 'HASH'); |
my $owner_domain = $$details{$num}{'domain'}; |
my $owner_uname = $details->{'owner'}; |
|
my $owner_domain = $details->{'domain'}; |
my $owner = $owner_uname.':'.$owner_domain; |
my $owner = $owner_uname.':'.$owner_domain; |
my $sectionstr = ''; |
my $sectionstr = ''; |
my $xliststr = ''; |
my $xliststr = ''; |
Line 398 sub build_course {
|
Line 410 sub build_course {
|
} else { |
} else { |
$linefeed = "<br />\n"; |
$linefeed = "<br />\n"; |
} |
} |
if ($$details{$num}{'accessend'} eq '') { |
if ($details->{'accessend'} eq '') { |
$noenddate = 1; |
$noenddate = 1; |
} |
} |
my $reshome = $$details{$num}{'reshome'}; |
my $reshome = $details->{'reshome'}; |
if ($reshome eq '') { |
if ($reshome eq '') { |
$reshome = '/res/'.$cdom; |
$reshome = '/res/'.$cdom; |
} |
} |
my $firstres = $$details{$num}{'firstres'}; |
my $firstres = $details->{'firstres'}; |
if ($firstres eq '') { |
if ($firstres eq '') { |
$firstres = 'syl'; |
$firstres = 'syl'; |
} |
} |
foreach my $secid (sort keys %{$$details{$num}{'sections'}}) { |
foreach my $secid (sort(keys(%{$details->{'sections'}}))) { |
$sectionstr .= $$details{$num}{'sections'}{$secid}{'inst'}.':'.$$details{$num}{'sections'}{$secid}{'loncapa'}.','; |
$sectionstr .= $details->{'sections'}{$secid}{'inst'}.':'.$details->{'sections'}{$secid}{'loncapa'}.','; |
} |
} |
$sectionstr =~ s/,$//; |
$sectionstr =~ s/,$//; |
|
|
foreach my $xlist (sort keys %{$$details{$num}{'crosslists'}}) { |
foreach my $xlist (sort(keys(%{$details->{'crosslists'}}))) { |
$xliststr .= $$details{$num}{'crosslists'}{$xlist}{'inst'}.':'.$$details{$num}{'crosslists'}{$xlist}{'loncapa'}.','; |
$xliststr .= $details->{'crosslists'}{$xlist}{'inst'}.':'.$details->{'crosslists'}{$xlist}{'loncapa'}.','; |
} |
} |
$xliststr =~ s/,$//; |
$xliststr =~ s/,$//; |
|
|
my %courseinfo = ( |
my %courseinfo = ( |
inst_code => $$details{$num}{'coursecode'}, |
inst_code => $details->{'coursecode'}, |
description => $$details{$num}{'title'} |
description => $details->{'title'} |
); |
); |
if (&Apache::lonnet::homeserver($$details{$num}{'owner'},$$details{$num}{'domain'}) eq 'no_host') { # Add user if no account |
if (&Apache::lonnet::homeserver($details->{'owner'},$details->{'domain'}) eq 'no_host') { # Add user if no account |
my $ownerargs = {'auth' => $$details{$num}{'ownerauthtype'}, |
my $ownerargs = {'auth' => $details->{'ownerauthtype'}, |
'authparam' => $$details{$num}{'ownerauthparam'}, |
'authparam' => $details->{'ownerauthparam'}, |
'emailenc' => $$details{$num}{'emailenc'}, |
'emailenc' => $details->{'emailenc'}, |
'udom' => $$details{$num}{'domain'}, |
'udom' => $details->{'domain'}, |
'uname' => $$details{$num}{'owner'}, |
'uname' => $details->{'owner'}, |
'pid' => $$details{$num}{'users'}{$owner}{'studentID'}, |
'pid' => $details->{'users'}{$owner}{'studentID'}, |
'first' => $$details{$num}{'users'}{$owner}{'firstname'}, |
'first' => $details->{'users'}{$owner}{'firstname'}, |
'middle' => $$details{$num}{'users'}{$owner}{'middlename'}, |
'middle' => $details->{'users'}{$owner}{'middlename'}, |
'last' => $$details{$num}{'users'}{$owner}{'lastname'}, |
'last' => $details->{'users'}{$owner}{'lastname'}, |
'gene' => $$details{$num}{'users'}{$owner}{'generation'}, |
'gene' => $details->{'users'}{$owner}{'generation'}, |
'usec' => '', |
'usec' => '', |
'end' => '', |
'end' => '', |
'start' => '', |
'start' => '', |
'emailaddr' => $$details{$num}{'users'}{$owner}{'email'}, |
'emailaddr' => $details->{'users'}{$owner}{'email'}, |
'cid' => '', |
'cid' => '', |
'context' => 'createowner', |
'context' => 'createowner', |
'linefeed' => $linefeed, |
'linefeed' => $linefeed, |
'role' => 'cc', |
'role' => 'cc', |
}; |
}; |
$outcome = &LONCAPA::Enrollment::create_newuser($ownerargs,$logmsg,$newusermsg,$enrollcount,$addresult,$longroles,\%courseinfo); |
$outcome = &LONCAPA::Enrollment::create_newuser($ownerargs,$logmsg,$newusermsg,$enrollcount,$addresult,$longroles,\%courseinfo,$context); |
} else { |
} else { |
$outcome = 'ok'; |
$outcome = 'ok'; |
} |
} |
|
|
if ($outcome eq 'ok') { |
if ($outcome eq 'ok') { |
|
if ($details->{'datemode'} !~ /^(preserve|shift|delete)$/) { |
|
$details->{'datemode'} = 'shift'; |
|
$details->{'dateshift'} = 365; |
|
} |
my $courseargs = { |
my $courseargs = { |
ccuname => $$details{$num}{'owner'}, |
ccuname => $details->{'owner'}, |
ccdomain => $$details{$num}{'domain'}, |
ccdomain => $details->{'domain'}, |
cdescr => $$details{$num}{'title'}, |
cdescr => $details->{'title'}, |
crstype => $$details{$num}{'crstype'}, |
crstype => $details->{'crstype'}, |
curl => $$details{$num}{'topmap'}, |
curl => $details->{'topmap'}, |
course_domain => $cdom, |
course_domain => $cdom, |
course_home => $$details{$num}{'coursehome'}, |
course_home => $details->{'coursehome'}, |
nonstandard => $$details{$num}{'nonstandard'}, |
nonstandard => $details->{'nonstandard'}, |
crscode => $$details{$num}{'coursecode'}, |
crscode => $details->{'coursecode'}, |
crsquota => $$details{$num}{'crsquota'}, |
crsquota => $details->{'crsquota'}, |
clonecourse => $$details{$num}{'clonecrs'}, |
clonecourse => $details->{'clonecrs'}, |
clonedomain => $$details{$num}{'clonedom'}, |
clonedomain => $details->{'clonedom'}, |
crsid => $$details{$num}{'optional_id'}, |
datemode => $details->{'datemode'}, |
curruser => $$details{$num}{'owner'}, |
dateshift => $details->{'dateshift'}, |
|
crsid => $details->{'optional_id'}, |
|
curruser => $details->{'owner'}, |
crssections => $sectionstr, |
crssections => $sectionstr, |
crsxlist => $xliststr, |
crsxlist => $xliststr, |
autoadds => $$details{$num}{'adds'}, |
autoadds => $details->{'adds'}, |
autodrops => $$details{$num}{'drops'}, |
autodrops => $details->{'drops'}, |
notify => $$details{$num}{'notify_owner'}, |
notify => $details->{'notify_owner'}, |
notify_dc => $$details{$num}{'notify_dc'}, |
notify_dc => $details->{'notify_dc'}, |
no_end_date => $noenddate, |
no_end_date => $noenddate, |
showphotos => $$details{$num}{'showphotos'}, |
showphotos => $details->{'showphotos'}, |
authtype => $$details{$num}{'authtype'}, |
authtype => $details->{'authtype'}, |
autharg => $$details{$num}{'authparam'}, |
autharg => $details->{'authparam'}, |
enrollstart => $$details{$num}{'enrollstart'}, |
enrollstart => $details->{'enrollstart'}, |
enrollend => $$details{$num}{'enrollend'}, |
enrollend => $details->{'enrollend'}, |
startaccess => $$details{$num}{'accessstart'}, |
startaccess => $details->{'accessstart'}, |
endaccess => $$details{$num}{'accessend'}, |
endaccess => $details->{'accessend'}, |
setpolicy => $$details{$num}{'setpolicy'}, |
setpolicy => $details->{'setpolicy'}, |
setcontent => $$details{$num}{'setcontent'}, |
setcontent => $details->{'setcontent'}, |
reshome => $reshome, |
reshome => $reshome, |
setkeys => $$details{$num}{'setkeys'}, |
setkeys => $details->{'setkeys'}, |
keyauth => $$details{$num}{'keyauth'}, |
keyauth => $details->{'keyauth'}, |
disresdis => $$details{$num}{'disresdis'}, |
disresdis => $details->{'disresdis'}, |
disablechat => $$details{$num}{'disablechat'}, |
disablechat => $details->{'disablechat'}, |
openall => $$details{$num}{'openall'}, |
openall => $details->{'openall'}, |
firstres => $firstres |
firstres => $firstres |
}; |
}; |
|
|
my %host_servers = &Apache::lonnet::get_servers($cdom,'library'); |
my %host_servers = &Apache::lonnet::get_servers($cdom,'library'); |
if (! exists($host_servers{$$details{$num}{'coursehome'}})) { |
if (! exists($host_servers{$details->{'coursehome'}})) { |
$$logmsg .= &mt('Invalid home server for course').': '.$$details{$num}{'coursehome'}; |
$$logmsg .= &mt('Invalid home server for course').': '.$details->{'coursehome'}; |
|
return; |
|
} |
|
my ($success, $msg) = &Apache::loncommon::construct_course($courseargs,$logmsg,\$courseid,\$crsudom,\$crsunum,$udom,$uname,$context,$cnum,$category); |
|
$$logmsg .= $msg; |
|
if (!$success) { |
return; |
return; |
} |
} |
|
|
&Apache::loncommon::construct_course($courseargs,$logmsg,\$courseid,\$crsudom,\$crsunum,$udom,$uname); |
|
} else { |
} else { |
return; |
return; |
} |
} |
Line 504 sub build_course {
|
Line 524 sub build_course {
|
# Make owner a course coordinator |
# Make owner a course coordinator |
# |
# |
if (($owner_domain) && ($owner_uname)) { |
if (($owner_domain) && ($owner_uname)) { |
&Apache::lonnet::assignrole($owner_domain,$owner_uname,$courseid,'cc'); |
&Apache::lonnet::assignrole($owner_domain,$owner_uname,$courseid,'cc','','','','',$context); |
} |
} |
|
|
# |
# |
# Process other reqested users |
# Process other reqested users |
# |
# |
my $stulogmsg = ''; |
my $stulogmsg = ''; |
foreach my $userkey (sort keys %{$$details{$num}{'users'}}) { |
foreach my $userkey (sort(keys(%{$details->{'users'}}))) { |
my $url = '/'.$crsudom.'/'.$crsunum; |
my $url = '/'.$crsudom.'/'.$crsunum; |
if (@{$$details{$num}{'users'}{$userkey}{'roles'}} > 0) { |
next if (ref($details->{'users'}{$userkey}{'roles'}) ne 'ARRAY'); |
|
if (@{$details->{'users'}{$userkey}{'roles'}} > 0) { |
my ($username,$userdom) = split/:/,$userkey; |
my ($username,$userdom) = split/:/,$userkey; |
if (&Apache::lonnet::homeserver($username,$userdom) eq 'no_host') { # Add user if no account |
if (&Apache::lonnet::homeserver($username,$userdom) eq 'no_host') { # Add user if no account |
my $firstrole = $$details{$num}{'users'}{$userkey}{'roles'}[0]; |
my $firstrole = $details->{'users'}{$userkey}{'roles'}[0]; |
my $firstsec = $$details{$num}{'users'}{$userkey}{$firstrole}{'usec'}[0]; |
my $firstsec = $details->{'users'}{$userkey}{$firstrole}{'usec'}[0]; |
my $userargs = { |
my $userargs = { |
'auth' => $$details{$num}{'users'}{$userkey}{'authtype'}, |
'auth' => $details->{'users'}{$userkey}{'authtype'}, |
'authparam' => $$details{$num}{'users'}{$userkey}{'autharg'}, |
'authparam' => $details->{'users'}{$userkey}{'autharg'}, |
'emailenc' => $$details{$num}{'users'}{$userkey}{'emailenc'}, |
'emailenc' => $details->{'users'}{$userkey}{'emailenc'}, |
'udom' => $userdom, |
'udom' => $userdom, |
'uname' => $username, |
'uname' => $username, |
'pid' => $$details{$num}{'users'}{$userkey}{'studentID'}, |
'pid' => $details->{'users'}{$userkey}{'studentID'}, |
'first' => $$details{$num}{'users'}{$userkey}{'firstname'}, |
'first' => $details->{'users'}{$userkey}{'firstname'}, |
'middle' => $$details{$num}{'users'}{$userkey}{'middlename'}, |
'middle' => $details->{'users'}{$userkey}{'middlename'}, |
'last' => $$details{$num}{'users'}{$userkey}{'lastname'}, |
'last' => $details->{'users'}{$userkey}{'lastname'}, |
'gene' => $$details{$num}{'users'}{$userkey}{'generation'}, |
'gene' => $details->{'users'}{$userkey}{'generation'}, |
'usec' => $firstsec, |
'usec' => $firstsec, |
'end' => $$details{$num}{'users'}{$userkey}{'end'}, |
'end' => $details->{'users'}{$userkey}{'end'}, |
'start' => $$details{$num}{'users'}{$userkey}{'start'}, |
'start' => $details->{'users'}{$userkey}{'start'}, |
'emailaddr' => $$details{$num}{'users'}{$userkey}{'emailaddr'}, |
'emailaddr' => $details->{'users'}{$userkey}{'emailaddr'}, |
'cid' => $courseid, |
'cid' => $courseid, |
'crs' => $crsunum, |
'crs' => $crsunum, |
'cdom' => $crsudom, |
'cdom' => $crsudom, |
'context' => 'createcourse', |
'context' => 'createcourse', |
'linefeed' => $linefeed, |
'linefeed' => $linefeed, |
'role' => $$details{$num}{'users'}{$userkey}{'roles'}[0], |
'role' => $details->{'users'}{$userkey}{'roles'}[0], |
}; |
}; |
$outcome = &LONCAPA::Enrollment::create_newuser($userargs,$logmsg,$newusermsg,$enrollcount,$addresult,$longroles,\%courseinfo); |
$outcome = &LONCAPA::Enrollment::create_newuser($userargs,$logmsg,$newusermsg,$enrollcount,$addresult,$longroles,\%courseinfo,$context); |
# now add other roles and other sections. |
# now add other roles and other sections. |
if ($outcome eq 'ok') { |
if ($outcome eq 'ok') { |
if (($firstrole ne 'st') && (@{$$details{$num}{'users'}{$userkey}{$firstrole}{'usec'}} > 1)) { |
if (($firstrole ne 'st') && (@{$details->{'users'}{$userkey}{$firstrole}{'usec'}} > 1)) { |
for (my $i=1; $i<@{$$details{$num}{'users'}{$userkey}{$firstrole}{'usec'}}; $i++) { |
for (my $i=1; $i<@{$details->{'users'}{$userkey}{$firstrole}{'usec'}}; $i++) { |
my $curr_role = $firstrole; |
my $curr_role = $firstrole; |
my $start = $$details{$num}{'users'}{$userkey}{$curr_role}{'start'}; |
my $start = $details->{'users'}{$userkey}{$curr_role}{'start'}; |
my $end = $$details{$num}{'users'}{$userkey}{$curr_role}{'end'}; |
my $end = $details->{'users'}{$userkey}{$curr_role}{'end'}; |
my $usec = $$details{$num}{'users'}{$userkey}{$firstrole}{'usec'}[$i]; |
my $usec = $details->{'users'}{$userkey}{$firstrole}{'usec'}[$i]; |
$url = '/'.$crsudom.'/'.$crsunum; |
$url = '/'.$crsudom.'/'.$crsunum; |
if ($usec ne '') { |
if ($usec ne '') { |
$url .= '/'.$usec; |
$url .= '/'.$usec; |
} |
} |
$$output .= &Apache::loncommon::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,$context); |
} |
} |
} |
} |
if (@{$$details{$num}{'users'}{$userkey}{'roles'}} > 1) { |
if (@{$details->{'users'}{$userkey}{'roles'}} > 1) { |
for (my $j=1; $j<@{$$details{$num}{'users'}{$userkey}{'roles'}}; $j++) { |
for (my $j=1; $j<@{$details->{'users'}{$userkey}{'roles'}}; $j++) { |
my $curr_role = $$details{$num}{'users'}{$userkey}{'roles'}[$j]; |
my $curr_role = $details->{'users'}{$userkey}{'roles'}[$j]; |
my $start = $$details{$num}{'users'}{$userkey}{$curr_role}{'start'}; |
my $start = $details->{'users'}{$userkey}{$curr_role}{'start'}; |
my $end = $$details{$num}{'users'}{$userkey}{$curr_role}{'end'}; |
my $end = $details->{'users'}{$userkey}{$curr_role}{'end'}; |
if ($curr_role eq 'st') { |
if ($curr_role eq 'st') { |
my $usec = $$details{$num}{'users'}{$userkey}{$curr_role}{'usec'}[0]; |
my $usec = $details->{'users'}{$userkey}{$curr_role}{'usec'}[0]; |
$url = '/'.$crsudom.'/'.$crsunum; |
$url = '/'.$crsudom.'/'.$crsunum; |
if ($usec ne '') { |
if ($usec ne '') { |
$url .= '/'.$usec; |
$url .= '/'.$usec; |
} |
} |
$$output .= &Apache::loncommon::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,$context); |
} else { |
} else { |
foreach my $usec (@{$$details{$num}{'users'}{$userkey}{$curr_role}{'usec'}}) { |
foreach my $usec (@{$details->{'users'}{$userkey}{$curr_role}{'usec'}}) { |
$url = '/'.$crsudom.'/'.$crsunum; |
$url = '/'.$crsudom.'/'.$crsunum; |
if ($usec ne '') { |
if ($usec ne '') { |
$url .= '/'.$usec; |
$url .= '/'.$usec; |
} |
} |
$$output .= &Apache::loncommon::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,$context); |
} |
} |
} |
} |
} |
} |
} |
} |
} |
} |
} else { |
} else { |
foreach my $curr_role (@{$$details{$num}{'users'}{$userkey}{'roles'}}) { |
foreach my $curr_role (@{$details->{'users'}{$userkey}{'roles'}}) { |
my $start = $$details{$num}{'users'}{$userkey}{$curr_role}{'start'}; |
my $start = $details->{'users'}{$userkey}{$curr_role}{'start'}; |
my $end = $$details{$num}{'users'}{$userkey}{$curr_role}{'end'}; |
my $end = $details->{'users'}{$userkey}{$curr_role}{'end'}; |
if ($curr_role eq 'st') { |
if ($curr_role eq 'st') { |
my $usec = $$details{$num}{'users'}{$userkey}{$curr_role}{'usec'}[0]; |
my $usec = $details->{'users'}{$userkey}{$curr_role}{'usec'}[0]; |
$url = '/'.$crsudom.'/'.$crsunum; |
$url = '/'.$crsudom.'/'.$crsunum; |
if ($usec ne '') { |
if ($usec ne '') { |
$url .= '/'.$usec; |
$url .= '/'.$usec; |
} |
} |
$$output .= &Apache::loncommon::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,$context); |
} else { |
} else { |
if (@{$$details{$num}{'users'}{$userkey}{$curr_role}{'usec'}} > 0) { |
if (@{$details->{'users'}{$userkey}{$curr_role}{'usec'}} > 0) { |
foreach my $usec (@{$$details{$num}{'users'}{$userkey}{$curr_role}{'usec'}}) { |
foreach my $usec (@{$details->{'users'}{$userkey}{$curr_role}{'usec'}}) { |
$url = '/'.$crsudom.'/'.$crsunum; |
$url = '/'.$crsudom.'/'.$crsunum; |
if ($usec ne '') { |
if ($usec ne '') { |
$url .= '/'.$usec; |
$url .= '/'.$usec; |
} |
} |
my $stdresult = &Apache::loncommon::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,$context); |
$$output .= $stdresult; |
$$output .= $stdresult; |
} |
} |
} else { |
} else { |
$url = '/'.$crsudom.'/'.$crsunum; |
$url = '/'.$crsudom.'/'.$crsunum; |
$$output .= &Apache::loncommon::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,'',$context); |
} |
} |
} |
} |
} |
} |
Line 612 sub build_course {
|
Line 633 sub build_course {
|
} |
} |
|
|
# Information about keys. |
# Information about keys. |
if ($$details{$num}{'setkeys'}) { |
if ($details->{'setkeys'}) { |
$$keysmsg .= |
$$keysmsg .= |
'<a href="/adm/managekeys?cid='.$crsudom.'_'.$crsunum.'">'.&mt('Manage Access Keys').'</a> for '.$$details{$num}{'title'}.$linefeed; |
'<a href="/adm/managekeys?cid='.$crsudom.'_'.$crsunum.'">'.&mt('Manage Access Keys').'</a> for '.$details->{'title'}.$linefeed; |
} |
} |
# Flush the course logs so reverse user roles immediately updated |
# Flush the course logs so reverse user roles immediately updated |
&Apache::lonnet::flushcourselogs(); |
&Apache::lonnet::flushcourselogs(); |