version 1.11, 2004/07/15 18:58:20
|
version 1.15, 2005/02/17 08:29:43
|
Line 30 use Apache::lonlocal;
|
Line 30 use Apache::lonlocal;
|
use Apache::londropadd; |
use Apache::londropadd; |
use LONCAPA::Enrollment; |
use LONCAPA::Enrollment; |
use lib '/home/httpd/lib/perl'; |
use lib '/home/httpd/lib/perl'; |
use localenroll; |
|
|
|
sub print_course_selection_page { |
sub print_course_selection_page { |
my ($r,$tasklongref) = @_; |
my ($r,$tasklongref) = @_; |
my $dom = $ENV{'user.domain'}; |
my $dom = $ENV{'request.role.domain'}; |
my %lt=&Apache::lonlocal::texthash( |
my %lt=&Apache::lonlocal::texthash( |
'csae' => "Course settings for automated enrollment", |
'csae' => "Course settings for automated enrollment", |
'unst' => "Unlike standard LON-CAPA course parameters, such as course description, feedback addresses, and top level map, which are displayed and/or modified using the 'Course Environment Parameters' screen, settings that control automated enrollment based on classlist data available from your institution's student information system are handled differently. Automated enrollment settings fall into two groups: (a) settings that can be modified by a Course Coordinator using the Automated Enrollment Manager and (b) settings that may only be modified by a Domain Coordinator via the 'View/Modify Course settings' menu accessed from this page.", |
'unst' => "Unlike standard LON-CAPA course parameters, such as course description, feedback addresses, and top level map, which are displayed and/or modified using the 'Course Environment Parameters' screen, settings that control automated enrollment based on classlist data available from your institution's student information system are handled differently. Automated enrollment settings fall into two groups: (a) settings that can be modified by a Course Coordinator using the Automated Enrollment Manager and (b) settings that may only be modified by a Domain Coordinator via the 'View/Modify Course settings' menu accessed from this page.", |
Line 46 sub print_course_selection_page {
|
Line 45 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 66 ENDBLOCK
|
Line 65 ENDBLOCK
|
foreach my $key (sort keys %courseIDs) { |
foreach my $key (sort keys %courseIDs) { |
# Get current code |
# Get current code |
my $crs; |
my $crs; |
my $currcode; |
my ($description,$currcode,$owner); |
if ($key =~ m/^($dom)_(\w+)$/) { |
if ($courseIDs{$key} =~ m/^([^:]*):([^:]+)/ ) { |
|
$currcode = $2; |
|
} elsif ($key =~ m/^($dom)_(\w+)$/) { |
$crs = $2; |
$crs = $2; |
my %settings = &Apache::lonnet::get('environment',['internal.coursecode'],$dom,$crs); |
my %settings = &Apache::lonnet::get('environment',['internal.coursecode'],$dom,$crs); |
if (defined($settings{'internal.coursecode'}) ) { |
if (defined($settings{'internal.coursecode'}) ) { |
$currcode = $settings{'internal.coursecode'}; |
$currcode = $settings{'internal.coursecode'}; |
if ($currcode eq '') { |
|
$currcode = "___".$iter; |
|
$iter ++; |
|
} |
|
} else { |
|
$currcode = "___".$iter; |
|
$iter ++; |
|
} |
} |
} else { |
} |
|
if ($currcode eq '') { |
$currcode = "___".$iter; |
$currcode = "___".$iter; |
$iter ++; |
$iter ++; |
} |
} |
unless (grep/^$currcode$/,@codes) { |
unless (grep/^$currcode$/,@codes) { |
push @codes,$currcode; |
push @codes,$currcode; |
Line 100 ENDBLOCK
|
Line 95 ENDBLOCK
|
unless ($code =~m/^___\d+$/) { $showcode = $code; } |
unless ($code =~m/^___\d+$/) { $showcode = $code; } |
if ($item =~ m/^($dom)_(\w+)$/) { |
if ($item =~ m/^($dom)_(\w+)$/) { |
$crs = $2; |
$crs = $2; |
if ($courseIDs{$item} =~ /^([^:]*):/) { |
if ($courseIDs{$item} =~ /^([^:]*):([^:]*):([^:]*)/) { |
|
$description = &Apache::lonnet::unescape($1); |
|
$owner = &Apache::lonnet::unescape($3); |
|
} elsif ($courseIDs{$item} =~ /^([^:]*):([^:]*)$/) { |
$description = &Apache::lonnet::unescape($1); |
$description = &Apache::lonnet::unescape($1); |
} else { |
} else { |
$description = &Apache::lonnet::unescape($courseIDs{$item}); |
$description = &Apache::lonnet::unescape($courseIDs{$item}); |
} |
} |
# Get course owner |
# Get course owner |
my %settings = &Apache::lonnet::get('environment',['internal.courseowner'],$dom,$crs); |
if ($owner eq '') { |
if ( defined($settings{'internal.courseowner'}) ) { |
my %settings = &Apache::lonnet::get('environment',['internal.courseowner'],$dom,$crs); |
$owner = $settings{'internal.courseowner'}; |
if ( defined($settings{'internal.courseowner'}) ) { |
|
$owner = $settings{'internal.courseowner'}; |
|
} |
|
} |
|
unless ($owner eq '') { |
$ownername = &Apache::loncommon::plainname($owner,$dom); |
$ownername = &Apache::loncommon::plainname($owner,$dom); |
} |
} |
$r->print("<option value=\"$crs\">$showcode -- $description ---------- $ownername"); |
$r->print("<option value=\"$crs\">$showcode -- $description ---------- $ownername"); |
Line 130 sub print_course_modification_page {
|
Line 132 sub print_course_modification_page {
|
my %enrollvar = (); |
my %enrollvar = (); |
my $javascript_validations; |
my $javascript_validations; |
my $course = ''; |
my $course = ''; |
my $dom = $ENV{'user.domain'}; |
my $dom = $ENV{'request.role.domain'}; |
if ( defined($ENV{'form.course'}) ) { |
if ( defined($ENV{'form.course'}) ) { |
$course = $ENV{'form.course'}; |
$course = $ENV{'form.course'}; |
} |
} |
Line 140 sub print_course_modification_page {
|
Line 142 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 246 all settings except course code, course
|
Line 249 all settings except course code, course
|
my $numlocalcc = @local_ccs; |
my $numlocalcc = @local_ccs; |
my $bodytag=&Apache::loncommon::bodytag(&mt("Modify Course Settings")); |
my $bodytag=&Apache::loncommon::bodytag(&mt("Modify Course Settings")); |
my $helplink=&Apache::loncommon::help_open_topic('Modify_Course',&mt("Help on Modifying Courses")); |
my $helplink=&Apache::loncommon::help_open_topic('Modify_Course',&mt("Help on Modifying Courses")); |
my $defdom=$ENV{'request.role.domain'}; |
my ($krbdef,$krbdefdom)=&Apache::loncommon::get_kerberos_defaults($dom); |
my ($krbdef,$krbdefdom)=&Apache::loncommon::get_kerberos_defaults($defdom); |
|
my $curr_authtype = ''; |
my $curr_authtype = ''; |
my $curr_authfield = ''; |
my $curr_authfield = ''; |
if ($enrollvar{'authtype'} =~ /^krb/) { |
if ($enrollvar{'authtype'} =~ /^krb/) { |
Line 335 all settings except course code, course
|
Line 337 all settings except course code, course
|
my $colflag = $i%2; |
my $colflag = $i%2; |
$ownertable .= "<tr bgcolor=\"$bgcolors[$colflag]\" align=\"left\">"; |
$ownertable .= "<tr bgcolor=\"$bgcolors[$colflag]\" align=\"left\">"; |
if ($local_ccs[$i] eq $enrollvar{'courseowner'}) { |
if ($local_ccs[$i] eq $enrollvar{'courseowner'}) { |
$ownertable .= "<td><input type=\"radio\" name=\"courseowner\" value=\"$i\" checked=\"true\"/></td>"; |
$ownertable .= "<td><input type=\"radio\" name=\"courseowner\" value=\"$local_ccs[$i]\" checked=\"true\"/></td>"; |
} else { |
} else { |
$ownertable .= "<td><input type=\"radio\" name=\"courseowner\" value=\"$i\" /></td>"; |
$ownertable .= "<td><input type=\"radio\" name=\"courseowner\" value=\"$local_ccs[$i]\" /></td>"; |
} |
} |
$ownertable .= " |
$ownertable .= " |
<td>$pname{$local_ccs[$i]}</td> |
<td>$pname{$local_ccs[$i]}</td> |
<td><input type=\"hidden\" name=\"username_$i\" value=\"$local_ccs[$i]\" />$local_ccs[$i]</td> |
<td>$local_ccs[$i]</td> |
<td>$cc_status{$local_ccs[$i]} $lt{'ccor'}</td></tr>"; |
<td>$cc_status{$local_ccs[$i]} $lt{'ccor'}</td></tr>"; |
} |
} |
$ownertable .= "</table> |
$ownertable .= "</table> |
Line 507 sub modify_course {
|
Line 509 sub modify_course {
|
} |
} |
|
|
if ( exists($ENV{'form.courseowner'}) ) { |
if ( exists($ENV{'form.courseowner'}) ) { |
my $ownerparam = 'username_'.$ENV{'form.courseowner'}; |
$newattr{'courseowner'}=$ENV{'form.courseowner'}; |
if ( exists($ENV{"form.$ownerparam"}) ) { |
unless ( $newattr{'courseowner'} eq $currattr{'courseowner'} ) { |
$newattr{'courseowner'}=$ENV{"form.$ownerparam"}; |
$changeowner = 1; |
unless ( $newattr{'courseowner'} eq $currattr{'courseowner'} ) { |
|
$changeowner = 1; |
|
} |
|
} |
} |
} |
} |
|
|
Line 520 sub modify_course {
|
Line 519 sub modify_course {
|
$newattr{'coursecode'}=$ENV{'form.coursecode'}; |
$newattr{'coursecode'}=$ENV{'form.coursecode'}; |
unless ( $newattr{'coursecode'} eq $currattr{'coursecode'} ) { |
unless ( $newattr{'coursecode'} eq $currattr{'coursecode'} ) { |
$changecode = 1; |
$changecode = 1; |
my $courseid_entry = &Apache::lonnet::escape($dom.'_'.$crs).'='.&Apache::lonnet::escape($description).'='.&Apache::lonnet::escape($ENV{'form.coursecode'}); |
|
&Apache::lonnet::courseidput($dom,$courseid_entry,&Apache::lonnet::homeserver($crs,$dom)); |
|
} |
} |
} |
} |
|
if ($changeowner == 1 || $changecode == 1) { |
|
my $courseid_entry = &Apache::lonnet::escape($dom.'_'.$crs).'='.&Apache::lonnet::escape($description).':'.&Apache::lonnet::escape($ENV{'form.coursecode'}).':'.&Apache::lonnet::escape($ENV{'form.courseowner'}); |
|
&Apache::lonnet::courseidput($dom,$courseid_entry,&Apache::lonnet::homeserver($crs,$dom)); |
|
} |
|
|
foreach (@params) { |
foreach (@params) { |
if ($currattr{$_} eq $newattr{$_}) { |
if ($currattr{$_} eq $newattr{$_}) { |
Line 660 sub print_header {
|
Line 661 sub print_header {
|
$page .= " -> <b>".$$tasklongref{$action}."</b>"; |
$page .= " -> <b>".$$tasklongref{$action}."</b>"; |
} |
} |
} |
} |
|
my $html=&Apache::lonxml::xmlbegin(); |
$r->print(" |
$r->print(" |
<html> |
$html |
<head>"); |
<head> |
|
"); |
if ($action eq 'display') { |
if ($action eq 'display') { |
$r->print(" |
$r->print(" |
<script language=\"JavaScript\" type=\"text/javascript\"> |
<script language=\"JavaScript\" type=\"text/javascript\"> |
Line 699 ENDBASE
|
Line 702 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) { |