version 1.10, 2004/06/29 14:56:32
|
version 1.27, 2006/07/18 21:52:01
|
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 30 use Apache::lonlocal;
|
Line 35 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; |
use LONCAPA; |
|
|
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 51 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,'.','.','.',undef,undef,'.'); |
&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 57 sub print_course_selection_page {
|
Line 62 sub print_course_selection_page {
|
</p><p> |
</p><p> |
<b>$lt{'ccrs'}:</b> |
<b>$lt{'ccrs'}:</b> |
<select name="course"> |
<select name="course"> |
<option value="0" />$lt{'psac'} |
<option value="0">$lt{'psac'}</option> |
<option value="-1" />--------------------------------------------------- |
<option value="-1">---------------------------------------------------</option> |
ENDBLOCK |
ENDBLOCK |
my $iter = 0; |
my $iter = 0; |
my @codes = (); |
my @codes = (); |
Line 66 ENDBLOCK
|
Line 71 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 101 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); |
$description = &unescape($1); |
|
$owner = &unescape($3); |
|
if (($owner ne '') && ($owner !~ /^([^:]+):([^:]+)$/)) { |
|
$owner = $owner.':'.$dom; |
|
} |
|
} elsif ($courseIDs{$item} =~ /^([^:]*):([^:]*)$/) { |
|
$description = &unescape($1); |
} else { |
} else { |
$description = &Apache::lonnet::unescape($courseIDs{$item}); |
$description = &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'}) ) { |
$ownername = &Apache::loncommon::plainname($owner,$dom); |
$owner = $settings{'internal.courseowner'}; |
|
} |
} |
} |
$r->print("<option value=\"$crs\">$showcode -- $description ---------- $ownername"); |
unless ($owner eq '') { |
|
my ($owneruname,$ownerdom); |
|
if ($owner =~ /^([^:]+):([^:]+)$/) { |
|
$owneruname = $1; |
|
$ownerdom = $2; |
|
} else { |
|
$owneruname = $owner; |
|
$ownerdom = $dom; |
|
} |
|
$ownername = &Apache::loncommon::plainname($owneruname, |
|
$ownerdom); |
|
} |
|
$r->print("<option value=\"$crs\">$showcode -- $description ---------- $ownername</option>"); |
} |
} |
} |
} |
} |
} |
Line 130 sub print_course_modification_page {
|
Line 150 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'}; |
} |
} |
my $ok_course = 'ok'; |
my $ok_course = 'ok'; |
if ( ($course == -1) || ($course == '-2') || ($course eq '') ) { |
if ( ($course == -1) || ($course == '-2') || ($course eq '') ) { |
Line 158 sub print_course_modification_page {
|
Line 178 sub print_course_modification_page {
|
'noen' => "No end date", |
'noen' => "No end date", |
'ownr' => "Owner", |
'ownr' => "Owner", |
'name' => "Name", |
'name' => "Name", |
'unme' => "Username", |
'unme' => "Username:Domain", |
'stus' => "Status", |
'stus' => "Status", |
'aecs' => "Automated Enrollment Course Settings", |
'aecs' => "Automated Enrollment Course Settings", |
'cose' => "Course settings for LON-CAPA courses that control automated student enrollment based on classlist data available from your institution's student information system fall into two groups: (a) settings that can be modified by a Course Coordinator using the ", |
'cose' => "Course settings for LON-CAPA courses that control automated student enrollment based on classlist data available from your institution's student information system fall into two groups: (a) settings that can be modified by a Course Coordinator using the ", |
Line 188 all settings except course code, course
|
Line 208 all settings except course code, course
|
$enrollvar{'autharg'} = ''; |
$enrollvar{'autharg'} = ''; |
$enrollvar{'authtype'} = ''; |
$enrollvar{'authtype'} = ''; |
foreach my $item (keys %settings) { |
foreach my $item (keys %settings) { |
if ($item =~ m/^internal\.(.+)$/) { |
if ($item =~ m/^internal\.(.+)$/) { |
if ( ($1 eq "autoadds") || ($1 eq "autodrops") ) { |
my $type = $1; |
|
|
|
if ( ($type eq "autoadds") || ($type eq "autodrops") ) { |
if ($settings{$item} == 1) { |
if ($settings{$item} == 1) { |
$enrollvar{$1} = "ON"; |
$enrollvar{$type} = "ON"; |
} else { |
} else { |
$enrollvar{$1} = "OFF"; |
$enrollvar{$type} = "OFF"; |
} |
} |
} elsif ( ($1 eq "autostart") || ($1 eq "autoend") ) { |
} elsif ( ($type eq "autostart") || ($type eq "autoend") ) { |
if ( ($1 eq "autoend") && ($settings{$item} == 0) ) { |
if ( ($type eq "autoend") && ($settings{$item} == 0) ) { |
$enrollvar{$1} = $lt{'noen'}; |
$enrollvar{$type} = $lt{'noen'}; |
} else { |
} else { |
$enrollvar{$1} = localtime($settings{$item}); |
$enrollvar{$type} = localtime($settings{$item}); |
} |
} |
} elsif ($1 eq "courseowner" || $1 eq "authtype" || $1 eq "autharg" || $1 eq "sectionnums" || $1 eq "coursecode" || $1 eq "crosslistings") { |
} elsif ($type eq "sectionums") { |
$enrollvar{$1} = $settings{$item}; |
$enrollvar{$type} = $settings{$item}; |
|
$enrollvar{$type} =~ s/,/, /g; |
|
} elsif ($type eq "authtype" |
|
|| $type eq "autharg" || $type eq "coursecode" |
|
|| $type eq "crosslistings") { |
|
$enrollvar{$type} = $settings{$item}; |
|
} elsif ($type eq 'courseowner') { |
|
if ($settings{$item} =~ /^[^:]+:[^:]+$/) { |
|
$enrollvar{$type} = $settings{$item}; |
|
} else { |
|
if ($settings{$item} ne '') { |
|
$enrollvar{$type} = $settings{$item}.':'.$dom; |
|
} |
|
} |
} |
} |
} elsif ($item =~ m/^default_enrollment_(start|end)_date$/) { |
} elsif ($item =~ m/^default_enrollment_(start|end)_date$/) { |
if ( ($1 eq 'end') && ($settings{$item} == 0) ) { |
my $type = $1; |
|
if ( ($type eq 'end') && ($settings{$item} == 0) ) { |
$enrollvar{$item} = $lt{'noen'}; |
$enrollvar{$item} = $lt{'noen'}; |
} elsif ( ($1 eq 'start') && ($settings{$item} eq '') ) { |
} elsif ( ($type eq 'start') && ($settings{$item} eq '') ) { |
$enrollvar{$item} = 'When enrolled'; |
$enrollvar{$item} = 'When enrolled'; |
} else { |
} else { |
$enrollvar{$item} = localtime($settings{$item}); |
$enrollvar{$item} = localtime($settings{$item}); |
Line 220 all settings except course code, course
|
Line 256 all settings except course code, course
|
my %cc_status = (); |
my %cc_status = (); |
my %pname = (); |
my %pname = (); |
my $active_cc; |
my $active_cc; |
foreach (@coursepersonnel) { |
foreach my $person (@coursepersonnel) { |
my @roleinfo = split/:/,$_; |
my ($role,$user) = split(/:/,$person,2); |
if ( ($roleinfo[0] eq 'cc') && ($roleinfo[2] eq $dom) ) { |
$user =~ s/:$//; |
unless (grep/^$roleinfo[1]$/,@local_ccs) { |
if (($role eq 'cc') && ($user ne '')) { |
$active_cc = &LONCAPA::Enrollment::check_user_status($roleinfo[2],$roleinfo[1],$dom,$course,'cc'); |
if (!grep(/^\Q$user\E$/,@local_ccs)) { |
if ($active_cc eq 'ok') { |
my ($ccname,$ccdom) = split(/:/,$user); |
push @local_ccs, $roleinfo[1]; |
$active_cc = |
$pname{$roleinfo[1]} = &Apache::loncommon::plainname($roleinfo[1],$roleinfo[2]); |
&Apache::loncommon::check_user_status($ccdom,$ccname,$dom, |
$cc_status{$roleinfo[1]} = $lt{'actv'}; |
$course,'cc'); |
|
if ($active_cc eq 'active') { |
|
push(@local_ccs,$user); |
|
$pname{$user} = &Apache::loncommon::plainname($ccname,$ccdom); |
|
$cc_status{$user} = $lt{'actv'}; |
} |
} |
} |
} |
} |
} |
} |
} |
unless ( (grep/^$enrollvar{'courseowner'}$/,@local_ccs) || ($enrollvar{'courseowner'} eq '') ) { |
if ( (!grep(/^$enrollvar{'courseowner'}$/,@local_ccs)) && |
push @local_ccs, $enrollvar{'courseowner'}; |
($enrollvar{'courseowner'} ne '') ) { |
$pname{$enrollvar{'courseowner'}} = &Apache::loncommon::plainname($enrollvar{'courseowner'},$dom); |
my ($owneruname,$ownerdom) = split(/:/,$enrollvar{'courseowner'}); |
$active_cc = &LONCAPA::Enrollment::check_user_status($dom,$enrollvar{'coursecode'},$dom,$course,'cc'); |
push(@local_ccs,$enrollvar{'courseowner'}); |
if ($active_cc eq 'ok') { |
$pname{$enrollvar{'courseowner'}} = |
|
&Apache::loncommon::plainname($owneruname,$ownerdom); |
|
$active_cc = &Apache::loncommon::check_user_status($ownerdom,$owneruname, |
|
$dom,$course,'cc'); |
|
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'}; |
} |
} |
} |
} |
my $numlocalcc = @local_ccs; |
my $numlocalcc = @local_ccs; |
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 378 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=\"checked\" /></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 435 ENDDOCUMENT
|
Line 478 ENDDOCUMENT
|
|
|
sub modify_course { |
sub modify_course { |
my ($r,$tasklongref,$typeref) = @_; |
my ($r,$tasklongref,$typeref) = @_; |
my $dom = $ENV{'user.domain'}; |
my $dom = $env{'user.domain'}; |
my $crs = $ENV{'form.course'}; |
my $crs = $env{'form.course'}; |
unless ( &check_course($dom,$crs) eq 'ok' ) { |
unless ( &check_course($dom,$crs) eq 'ok' ) { |
&print_header($r,$tasklongref); |
&print_header($r,$tasklongref); |
my $reply = "<br/>".&mt("The LON-CAPA course selected was not a valid course for this domain"); |
my $reply = "<br/>".&mt("The LON-CAPA course selected was not a valid course for this domain"); |
Line 484 sub modify_course {
|
Line 527 sub modify_course {
|
my $description = $settings{'description'}; |
my $description = $settings{'description'}; |
my %cenv = (); |
my %cenv = (); |
|
|
if ($ENV{'form.login'} eq 'krb') { |
if ($env{'form.login'} eq 'krb') { |
$newattr{'authtype'} = $ENV{'form.login'}; |
$newattr{'authtype'} = $env{'form.login'}; |
$newattr{'authtype'} .= $ENV{'form.krbver'}; |
$newattr{'authtype'} .= $env{'form.krbver'}; |
$newattr{'autharg'} = $ENV{'form.krbarg'}; |
$newattr{'autharg'} = $env{'form.krbarg'}; |
$newattr{'autharg'} =~ tr/a-z/A-Z/; |
} elsif ($env{'form.login'} eq 'int') { |
} elsif ($ENV{'form.login'} eq 'int') { |
|
$newattr{'authtype'} ='internal'; |
$newattr{'authtype'} ='internal'; |
if ((defined($ENV{'form.intarg'})) && ($ENV{'form.intarg'})) { |
if ((defined($env{'form.intarg'})) && ($env{'form.intarg'})) { |
$newattr{'autharg'} = $ENV{'form.intarg'}; |
$newattr{'autharg'} = $env{'form.intarg'}; |
} |
} |
} elsif ($ENV{'form.login'} eq 'loc') { |
} elsif ($env{'form.login'} eq 'loc') { |
$newattr{'authtype'} = 'localauth'; |
$newattr{'authtype'} = 'localauth'; |
if ((defined($ENV{'form.locarg'})) && ($ENV{'form.locarg'})) { |
if ((defined($env{'form.locarg'})) && ($env{'form.locarg'})) { |
$newattr{'autharg'} = $ENV{'form.locarg'}; |
$newattr{'autharg'} = $env{'form.locarg'}; |
} |
} |
} |
} |
if ( $newattr{'authtype'}=~ /^krb/) { |
if ( $newattr{'authtype'}=~ /^krb/) { |
Line 507 sub modify_course {
|
Line 549 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; |
|
} |
|
} |
} |
} |
} |
|
|
if ( exists($ENV{'form.coursecode'}) ) { |
if ( exists($env{'form.coursecode'}) ) { |
$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 = &escape($dom.'_'.$crs).'='.&escape($description).':'.&escape($env{'form.coursecode'}).':'.&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 636 sub modify_course {
|
Line 677 sub modify_course {
|
sub print_header { |
sub print_header { |
my ($r,$tasklongref,$description,$javascriptref) = @_; |
my ($r,$tasklongref,$description,$javascriptref) = @_; |
my %lt =&Apache::lonlocal::texthash( |
my %lt =&Apache::lonlocal::texthash( |
'vmcs' => 'View/Modify Course Settings', |
|
'chco' => 'Choose a course', |
'chco' => 'Choose a course', |
'main' => 'Main Menu', |
'main' => 'Main Menu', |
'comg' => 'Course Manager', |
'comg' => 'Course Manager', |
); |
); |
my $action = "start"; |
my $action = "start"; |
if ( exists($ENV{'form.action'}) ) { |
if ( exists($env{'form.action'}) ) { |
$action = $ENV{'form.action'}; |
$action = $env{'form.action'}; |
} |
} |
if ( ($description eq '') || (!defined($description)) ) { |
if ( ($description eq '') || (!defined($description)) ) { |
$description = $lt{'comg'}; |
$description = $lt{'comg'}; |
} |
} |
my $page = ''; |
my $page = ''; |
my $bodytag=&Apache::loncommon::bodytag($lt{'vmcs'}); |
|
if ($action eq 'start') { |
if ($action eq 'start') { |
$page = "<b>$lt{'chco'}</b>"; |
$page = "<b>$lt{'chco'}</b>"; |
} else { |
} else { |
$page = '<a href="/adm/modifycourse">'.$lt{'chco'}.'</a>'; |
$page = '<a href="/adm/modifycourse">'.$lt{'chco'}.'</a>'; |
if ( $action eq 'process' ) { |
if ( $action eq 'process' ) { |
my $course = $ENV{'form.course'}; |
my $course = $env{'form.course'}; |
$page .= "-> <a href=\"/adm/modifycourse?action=display&course=$course\">".$$tasklongref{'display'}."</a> -> <b>$$tasklongref{$action}</b> "; |
$page .= "-> <a href=\"/adm/modifycourse?action=display&course=$course\">".$$tasklongref{'display'}."</a> -> <b>$$tasklongref{$action}</b> "; |
} else { |
} else { |
$page .= " -> <b>".$$tasklongref{$action}."</b>"; |
$page .= " -> <b>".$$tasklongref{$action}."</b>"; |
} |
} |
} |
} |
$r->print(" |
|
<html> |
my $js; |
<head>"); |
|
if ($action eq 'display') { |
if ($action eq 'display') { |
$r->print(" |
$js = '<script type="text/javascript"> |
<script language=\"JavaScript\" type=\"text/javascript\"> |
'.$$javascriptref.' |
$$javascriptref |
</script>'; |
</script>"); |
|
} |
} |
|
$r->print(&Apache::loncommon::start_page('View/Modify Course Settings', |
|
$js)); |
$r->print(<<ENDTHIS); |
$r->print(<<ENDTHIS); |
<title>The LearningOnline Network with CAPA</title> |
|
</head> |
|
$bodytag |
|
<table width="100%" border="0" cellpadding="0" cellspacing="0"> |
<table width="100%" border="0" cellpadding="0" cellspacing="0"> |
<tr> |
<tr> |
<td bgcolor="#CCCC99"> |
<td bgcolor="#CCCC99"> |
Line 689 ENDTHIS
|
Line 726 ENDTHIS
|
} |
} |
|
|
sub print_footer { |
sub print_footer { |
my $r = shift; |
my ($r) = @_; |
$r->print(<<ENDBASE); |
$r->print('<br />'.&Apache::loncommon::end_page()); |
<br/> |
|
</body> |
|
</html> |
|
ENDBASE |
|
return; |
return; |
} |
} |
|
|
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,'.','.','.',undef,undef,'.'); |
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) { |
Line 720 sub handler {
|
Line 753 sub handler {
|
return OK; |
return OK; |
} |
} |
|
|
if (&Apache::lonnet::allowed('ccc',$ENV{'request.role.domain'})) { |
if (&Apache::lonnet::allowed('ccc',$env{'request.role.domain'})) { |
&Apache::loncommon::content_type($r,'text/html'); |
&Apache::loncommon::content_type($r,'text/html'); |
$r->send_http_header; |
$r->send_http_header; |
|
|
&Apache::loncommon::get_unprocessed_cgi($ENV{'QUERY_STRING'},['action','course']); |
&Apache::loncommon::get_unprocessed_cgi($ENV{'QUERY_STRING'},['action','course']); |
my $dom = $ENV{'user.domain'}; |
my $dom = $env{'user.domain'}; |
my %longtype=&Apache::lonlocal::texthash( |
my %longtype=&Apache::lonlocal::texthash( |
'authtype' => 'Default authentication method', |
'authtype' => 'Default authentication method', |
'autharg' => 'Default authentication parameter', |
'autharg' => 'Default authentication parameter', |
Line 736 sub handler {
|
Line 769 sub handler {
|
'default_enrollment_start_date' => 'Date of first student access', |
'default_enrollment_start_date' => 'Date of first student access', |
'default_enrollment_end_date' => 'Date of last student access', |
'default_enrollment_end_date' => 'Date of last student access', |
'coursecode' => 'Official course code', |
'coursecode' => 'Official course code', |
'courseowner' => "Username of course owner (\@$dom)", |
'courseowner' => "Username:domain of course owner", |
'notifylist' => 'Course Coordinators to be notified of enrollment changes', |
'notifylist' => 'Course Coordinators to be notified of enrollment changes', |
'sectionnums' => 'Course section number(:groupID)', |
'sectionnums' => 'Course section number(:groupID)', |
'crosslistings' => 'Crosslisted class(:groupID)', |
'crosslistings' => 'Crosslisted class(:groupID)', |
Line 747 sub handler {
|
Line 780 sub handler {
|
'process' => 'Results of changes', |
'process' => 'Results of changes', |
); |
); |
|
|
if ($ENV{'form.action'} eq 'process') { |
if ($env{'form.action'} eq 'process') { |
&modify_course($r,\%tasklong,\%longtype); |
&modify_course($r,\%tasklong,\%longtype); |
} elsif ($ENV{'form.action'} eq 'display') { |
} elsif ($env{'form.action'} eq 'display') { |
&print_course_modification_page($r,\%tasklong,\%longtype); |
&print_course_modification_page($r,\%tasklong,\%longtype); |
} else { |
} else { |
&print_course_selection_page($r,\%tasklong); |
&print_course_selection_page($r,\%tasklong); |
} |
} |
} else { |
} else { |
$ENV{'user.error.msg'}= |
$env{'user.error.msg'}= |
"/adm/modifycourse:ccc:0:0:Cannot modify course settings"; |
"/adm/modifycourse:ccc:0:0:Cannot modify course settings"; |
return HTTP_NOT_ACCEPTABLE; |
return HTTP_NOT_ACCEPTABLE; |
} |
} |