version 1.16, 2005/04/07 06:56:23
|
version 1.20, 2005/09/29 20:17:06
|
Line 1
|
Line 1
|
|
# The LearningOnline Network with CAPA |
|
# automated enrollment course setup handler |
|
# |
|
# $Id$ |
|
# |
# Copyright Michigan State University Board of Trustees |
# Copyright Michigan State University Board of Trustees |
# |
# |
# This file is part of the LearningOnline Network with CAPA (LON-CAPA). |
# This file is part of the LearningOnline Network with CAPA (LON-CAPA). |
Line 45 sub print_course_selection_page {
|
Line 50 sub print_course_selection_page {
|
); |
); |
|
|
# Determine the courses |
# Determine the courses |
my %courseIDs = &Apache::lonnet::courseiddump($dom,'.',1,'.','.'); |
my %courseIDs = &Apache::lonnet::courseiddump($dom,'.',1,'.','.','.'); |
&print_header($r,$tasklongref); |
&print_header($r,$tasklongref); |
$r->print(<<ENDBLOCK); |
$r->print(<<ENDBLOCK); |
<form action="/adm/modifycourse" method="post" name="cmod"> |
<form action="/adm/modifycourse" method="post" name="cmod"> |
Line 142 sub print_course_modification_page {
|
Line 147 sub print_course_modification_page {
|
} else { |
} else { |
$ok_course = &check_course($dom,$course); |
$ok_course = &check_course($dom,$course); |
} |
} |
print STDERR "Response was $ok_course for $dom,$course\n"; |
|
|
|
unless ($ok_course eq 'ok') { |
unless ($ok_course eq 'ok') { |
&print_header($r,$tasklongref,'',\$javascript_validations); |
&print_header($r,$tasklongref,'',\$javascript_validations); |
Line 227 all settings except course code, course
|
Line 231 all settings except course code, course
|
my @roleinfo = split/:/,$_; |
my @roleinfo = split/:/,$_; |
if ( ($roleinfo[0] eq 'cc') && ($roleinfo[2] eq $dom) ) { |
if ( ($roleinfo[0] eq 'cc') && ($roleinfo[2] eq $dom) ) { |
unless (grep/^$roleinfo[1]$/,@local_ccs) { |
unless (grep/^$roleinfo[1]$/,@local_ccs) { |
$active_cc = &LONCAPA::Enrollment::check_user_status($roleinfo[2],$roleinfo[1],$dom,$course,'cc'); |
$active_cc = &Apache::loncommon::check_user_status($roleinfo[2],$roleinfo[1],$dom,$course,'cc'); |
if ($active_cc eq 'ok') { |
if ($active_cc eq 'active') { |
push @local_ccs, $roleinfo[1]; |
push @local_ccs, $roleinfo[1]; |
$pname{$roleinfo[1]} = &Apache::loncommon::plainname($roleinfo[1],$roleinfo[2]); |
$pname{$roleinfo[1]} = &Apache::loncommon::plainname($roleinfo[1],$roleinfo[2]); |
$cc_status{$roleinfo[1]} = $lt{'actv'}; |
$cc_status{$roleinfo[1]} = $lt{'actv'}; |
Line 239 all settings except course code, course
|
Line 243 all settings except course code, course
|
unless ( (grep/^$enrollvar{'courseowner'}$/,@local_ccs) || ($enrollvar{'courseowner'} eq '') ) { |
unless ( (grep/^$enrollvar{'courseowner'}$/,@local_ccs) || ($enrollvar{'courseowner'} eq '') ) { |
push @local_ccs, $enrollvar{'courseowner'}; |
push @local_ccs, $enrollvar{'courseowner'}; |
$pname{$enrollvar{'courseowner'}} = &Apache::loncommon::plainname($enrollvar{'courseowner'},$dom); |
$pname{$enrollvar{'courseowner'}} = &Apache::loncommon::plainname($enrollvar{'courseowner'},$dom); |
$active_cc = &LONCAPA::Enrollment::check_user_status($dom,$enrollvar{'coursecode'},$dom,$course,'cc'); |
$active_cc = &Apache::loncommon::check_user_status($dom,$enrollvar{'coursecode'},$dom,$course,'cc'); |
if ($active_cc eq 'ok') { |
if ($active_cc eq 'active') { |
$cc_status{$enrollvar{'courseowner'}} = $lt{'actv'}; |
$cc_status{$enrollvar{'courseowner'}} = $lt{'actv'}; |
} else { |
} else { |
$cc_status{$enrollvar{'courseowner'}} = $lt{'inac'}; |
$cc_status{$enrollvar{'courseowner'}} = $lt{'inac'}; |
Line 702 ENDBASE
|
Line 706 ENDBASE
|
|
|
sub check_course { |
sub check_course { |
my ($dom,$course) = @_; |
my ($dom,$course) = @_; |
my %courseIDs = &Apache::lonnet::courseiddump($dom,'.',1,'.','.'); |
my %courseIDs = &Apache::lonnet::courseiddump($dom,'.',1,'.','.','.'); |
foreach my $key (sort keys %courseIDs) { |
foreach my $key (sort keys %courseIDs) { |
if ($key =~ m/^($dom)_(\w+)$/) { |
if ($key =~ m/^($dom)_(\w+)$/) { |
if ($2 eq $course) { |
if ($2 eq $course) { |