version 1.12.2.5, 2010/01/15 05:26:51
|
version 1.12.2.10, 2010/12/05 21:57:33
|
Line 67 described at http://www.lon-capa.org.
|
Line 67 described at http://www.lon-capa.org.
|
package Apache::loncoursequeueadmin; |
package Apache::loncoursequeueadmin; |
|
|
use strict; |
use strict; |
use Apache::Constants qw(:common :http); |
|
use Apache::lonnet; |
use Apache::lonnet; |
use Apache::loncommon; |
use Apache::loncommon; |
use Apache::lonmsg; |
use Apache::lonmsg; |
Line 460 sub update_request_queue {
|
Line 459 sub update_request_queue {
|
} |
} |
|
|
} |
} |
|
my %allnums = &Apache::loncommon::get_faculty_cnums(); |
foreach my $item (sort {$a <=> $b} @approvals) { |
foreach my $item (sort {$a <=> $b} @approvals) { |
if ($context eq 'course') { |
if ($context eq 'course') { |
my ($num,$uname,$udom,$usec) = split(/:/,$item); |
my ($num,$uname,$udom,$usec) = split(/:/,$item); |
my $uhome = &Apache::lonnet::homeserver($uname,$udom); |
my $uhome = &Apache::lonnet::homeserver($uname,$udom); |
if ($uhome ne 'no_host') { |
if ($uhome ne 'no_host') { |
if (exists($requesthash{$uname.':'.$udom})) { |
if (exists($requesthash{$uname.':'.$udom})) { |
if ($cdom eq 'gci' && $cnum eq '9615072b469884921gcil1') { |
if ($cdom ne '' && ref($allnums{$cdom} eq 'HASH') { |
my $enresult = &enable_gci_submission($udom,$uname, |
my ($addothers,@others); |
$access_end,$access_start); |
foreach my $key (%{$allnums{$cdom}}) { |
|
if ($key eq $cnum) { |
|
$addothers = 1; |
|
} else { |
|
push(@others,$key); |
|
} |
|
} |
|
if ($addothers) { |
|
foreach my $crs (@others) { |
|
my $enresult = |
|
&enable_additional_roles($cdom,$crs,$udom,$uname, |
|
$access_end,$access_start); |
|
} |
|
} |
} |
} |
if (exists($classlist->{$uname.':'.$udom})) { |
if (exists($classlist->{$uname.':'.$udom})) { |
if (ref($classlist->{$uname.':'.$udom}) eq 'ARRAY') { |
if (ref($classlist->{$uname.':'.$udom}) eq 'ARRAY') { |
Line 515 sub update_request_queue {
|
Line 528 sub update_request_queue {
|
&Apache::lonnet::put($namespace,\%userrequest,$udom,$uname); |
&Apache::lonnet::put($namespace,\%userrequest,$udom,$uname); |
if ($userresult ne 'ok') { |
if ($userresult ne 'ok') { |
push(@warn_approves,$uname.':'.$udom); |
push(@warn_approves,$uname.':'.$udom); |
} elsif ($udom eq 'gci') { |
} elsif (ref($allnums{$udom}) eq 'HASH') { |
my %changehash = ( |
my %changehash = ( |
'reqcrsotherdom.unofficial' => 'gcitest:autolimit=', |
'reqcrsotherdom.unofficial' => $udom.'test:autolimit=', |
); |
); |
my $reqresult = &Apache::lonnet::put('environment',\%changehash, |
my $reqresult = &Apache::lonnet::put('environment',\%changehash, |
$udom,$uname); |
$udom,$uname); |
Line 918 sub update_request_queue {
|
Line 931 sub update_request_queue {
|
return $output; |
return $output; |
} |
} |
|
|
sub enable_gci_submission { |
sub enable_additional_roles { |
my ($udom,$uname,$access_end,$access_start) = @_; |
my ($cdom,$cnum,$udom,$uname,$access_end,$access_start) = @_; |
my $cdom = 'gci'; |
|
my $cnum = '1H96711d710194bfegcil1'; |
|
my ($stucounts,$idx,$classlist) = &get_student_counts($cdom,$cnum); |
my ($stucounts,$idx,$classlist) = &get_student_counts($cdom,$cnum); |
if (exists($classlist->{$uname.':'.$udom})) { |
if (exists($classlist->{$uname.':'.$udom})) { |
if (ref($classlist->{$uname.':'.$udom}) eq 'ARRAY') { |
if (ref($classlist->{$uname.':'.$udom}) eq 'ARRAY') { |
Line 977 sub course_creation {
|
Line 988 sub course_creation {
|
} |
} |
my %reqdetails = &build_batchcreatehash($dom,$context,$details,$owneremail,$domdefs); |
my %reqdetails = &build_batchcreatehash($dom,$context,$details,$owneremail,$domdefs); |
my $cid = &LONCAPA::batchcreatecourse::build_course($dom,$cnum,'requestcourses', |
my $cid = &LONCAPA::batchcreatecourse::build_course($dom,$cnum,'requestcourses', |
\%reqdetails,$longroles,\$logmsg,\$newusermsg,\$addresult, |
\%reqdetails,$longroles,$logmsg,$newusermsg,$addresult, |
\$enrollcount,\$output,\$keysmsg,$ownerdom,$ownername,$cnum,$crstype); |
$enrollcount,$output,$keysmsg,$ownerdom,$ownername,$cnum,$crstype); |
if ($cid eq "/$dom/$cnum") { |
if ($cid eq "/$dom/$cnum") { |
$result = 'created'; |
$result = 'created'; |
} else { |
} else { |
Line 990 sub course_creation {
|
Line 1001 sub course_creation {
|
sub build_batchcreatehash { |
sub build_batchcreatehash { |
my ($dom,$context,$details,$owneremail,$domdefs) = @_; |
my ($dom,$context,$details,$owneremail,$domdefs) = @_; |
my %batchhash; |
my %batchhash; |
my @items = qw{owner domain coursehome clonecrs clonedom datemode dateshift enrollstart enrollend accessstart accessend sections crosslists users}; |
my @items = qw{owner domain coursehome clonecrs clonedom cloneroster datemode dateshift enrollstart enrollend accessstart accessend sections crosslists users}; |
if ($dom eq 'gcitest') { |
if ($dom =~ /^\w+citest$/) { |
push(@items,'firstres'); |
push(@items,'firstres'); |
} |
} |
if ((ref($details) eq 'HASH') && (ref($domdefs) eq 'HASH')) { |
if ((ref($details) eq 'HASH') && (ref($domdefs) eq 'HASH')) { |
my $emailenc = &Apache::lonnet::escape($owneremail); |
my $emailenc = &escape($owneremail); |
my $owner = $details->{'owner'}.':'.$details->{'domain'}; |
my $owner = $details->{'owner'}.':'.$details->{'domain'}; |
foreach my $item (@items) { |
foreach my $item (@items) { |
$batchhash{$item} = $details->{$item}; |
$batchhash{$item} = $details->{$item}; |
Line 1078 sub can_clone_course {
|
Line 1089 sub can_clone_course {
|
$canclone = 1; |
$canclone = 1; |
} |
} |
} |
} |
|
unless ($canclone) { |
|
if (&Apache::lonnet::is_course_owner($clonedom,$clonecrs,$uname,$udom)) { |
|
$canclone = 1; |
|
} |
|
} |
} |
} |
return $canclone; |
return $canclone; |
} |
} |
Line 1097 sub queued_selfenrollment {
|
Line 1113 sub queued_selfenrollment {
|
} |
} |
} |
} |
if (keys(%reqs_by_date)) { |
if (keys(%reqs_by_date)) { |
my $rolename = &Apache::lonnet::plaintext('st'); |
|
unless ($notitle) { |
unless ($notitle) { |
$output .= '<b>'.&mt('Enrollment requests pending Course Coordinator approval').'</b><br />'; |
$output .= '<b>'.&mt('Enrollment requests pending Course Coordinator approval').'</b><br />'; |
} |
} |
Line 1112 sub queued_selfenrollment {
|
Line 1127 sub queued_selfenrollment {
|
foreach my $crs (@{$reqs_by_date{$item}}) { |
foreach my $crs (@{$reqs_by_date{$item}}) { |
my %courseinfo = &Apache::lonnet::coursedescription($crs); |
my %courseinfo = &Apache::lonnet::coursedescription($crs); |
my $usec = $selfenrollrequests{$crs}{'section'}; |
my $usec = $selfenrollrequests{$crs}{'section'}; |
|
my $rolename = &Apache::lonnet::plaintext('st',$courseinfo{'type'},$crs); |
if ($usec eq '') { |
if ($usec eq '') { |
$usec = &mt('No section'); |
$usec = &mt('No section'); |
} |
} |