version 1.14, 2004/06/17 18:31:24
|
version 1.15, 2004/06/28 15:41:20
|
Line 1046 ENDTWO
|
Line 1046 ENDTWO
|
</tr> |
</tr> |
<tr> |
<tr> |
<td align="left" colspan="2"> |
<td align="left" colspan="2"> |
<table border="0' cellspacing="0" cellpadding="2"> |
<table border="0" cellspacing="0" cellpadding="2"> |
<tr> |
<tr> |
<td colspan="3"> |
<td colspan="3"> |
ENDTHREE |
ENDTHREE |
Line 1083 ENDFOUR
|
Line 1083 ENDFOUR
|
|
|
############################################################### |
############################################################### |
sub print_doc_base { |
sub print_doc_base { |
my $r = shift; |
my $r = shift; |
$r->print(<<ENDBASE); |
$r->print(<<ENDBASE); |
</td> |
</td> |
</tr> |
</tr> |
</table> |
</table> |
Line 1096 ENDBASE
|
Line 1096 ENDBASE
|
|
|
################################################################### |
################################################################### |
sub print_chgsettings_response { |
sub print_chgsettings_response { |
my ($r,$realm,$dom,$crs,$action,$tasktitleref) = @_; |
my ($r,$realm,$dom,$crs,$action,$tasktitleref) = @_; |
my %settings = &Apache::lonnet::get('environment',['internal.sectionnums','internal.crosslistings','internal.autostart','internal.autoend','internal.autoadds','internal.autodrops'],$dom,$crs); |
my %settings = &Apache::lonnet::get('environment',['internal.sectionnums','internal.crosslistings','internal.autostart','internal.autoend','internal.autoadds','internal.autodrops'],$dom,$crs); |
my $currend = ''; |
my $currend = ''; |
my $currstart = ''; |
my $currstart = ''; |
my $currsecs = ''; |
my $currsecs = ''; |
my $currxlists = ''; |
my $currxlists = ''; |
my $curradds = ''; |
my $curradds = ''; |
my $currdrops = ''; |
my $currdrops = ''; |
if ( defined($settings{'internal.autoadds'}) ) { |
if ( defined($settings{'internal.autoadds'}) ) { |
$curradds = $settings{'internal.autoadds'}; |
$curradds = $settings{'internal.autoadds'}; |
} |
} |
if ( defined($settings{'internal.autodrops'}) ) { |
if ( defined($settings{'internal.autodrops'}) ) { |
$currdrops = $settings{'internal.autodrops'}; |
$currdrops = $settings{'internal.autodrops'}; |
} |
} |
if ( defined($settings{'internal.autostart'}) ) { |
if ( defined($settings{'internal.autostart'}) ) { |
$currstart = $settings{'internal.autostart'}; |
$currstart = $settings{'internal.autostart'}; |
} |
} |
if ( defined($settings{'internal.autoend'}) ) { |
if ( defined($settings{'internal.autoend'}) ) { |
$currend = $settings{'internal.autoend'}; |
$currend = $settings{'internal.autoend'}; |
} |
} |
if ( defined($settings{'internal.sectionnums'}) ) { |
if ( defined($settings{'internal.sectionnums'}) ) { |
$currsecs = $settings{'internal.sectionnums'}; |
$currsecs = $settings{'internal.sectionnums'}; |
} |
} |
if ( defined($settings{'internal.crosslistings'}) ) { |
if ( defined($settings{'internal.crosslistings'}) ) { |
$currxlists = $settings{'internal.crosslistings'} |
$currxlists = $settings{'internal.crosslistings'} |
} |
} |
my $autoadds = ''; |
my $autoadds = ''; |
my $autodrops = ''; |
my $autodrops = ''; |
|
|
if ( exists($ENV{'form.autoadds'}) ) { |
if ( exists($ENV{'form.autoadds'}) ) { |
$autoadds=$ENV{'form.autoadds'}; |
$autoadds=$ENV{'form.autoadds'}; |
} |
} |
if ( exists($ENV{'form.autodrops'}) ) { |
if ( exists($ENV{'form.autodrops'}) ) { |
$autodrops=$ENV{'form.autodrops'}; |
$autodrops=$ENV{'form.autodrops'}; |
} |
} |
|
|
my $response = ""; |
my $response = ""; |
my $warning = ""; |
my $warning = ""; |
my $warn_prefix = ""; |
my $warn_prefix = ""; |
my $warn_suffix = ""; |
my $warn_suffix = ""; |
my $warnfiller = ""; |
my $warnfiller = ""; |
my %cenv = ('internal.autoadds' => $autoadds, |
my %cenv = ('internal.autoadds' => $autoadds, |
'internal.autodrops' => $autodrops); |
'internal.autodrops' => $autodrops); |
my $reply = &Apache::lonnet::put('environment',\%cenv,$dom,$crs); |
my $reply = &Apache::lonnet::put('environment',\%cenv,$dom,$crs); |
if ($reply !~ /^ok$/) { |
if ($reply !~ /^ok$/) { |
$response = "There was a problem processing your requested changes. The automated enrollment settings for this course have been left unchanged.<br/>"; |
$response = "There was a problem processing your requested changes. The automated enrollment settings for this course have been left unchanged.<br/>"; |
} else { |
} else { |
if ($autoadds) { |
if ($autoadds) { |
if ($curradds) { |
if ($curradds) { |
$response = "Nightly additions based on classlist changes still <b>enabled</b><br/>"; |
$response = "Nightly additions based on classlist changes still <b>enabled</b><br/>"; |
} else { |
} else { |
$response = "Nightly additions based on classlist changes now <b>enabled</b><br/>"; |
$response = "Nightly additions based on classlist changes now <b>enabled</b><br/>"; |
} |
} |
} else { |
} else { |
if ($curradds) { |
if ($curradds) { |
$response = "Nightly additions based on classlist changes now <b>disabled</b><br/>"; |
$response = "Nightly additions based on classlist changes now <b>disabled</b><br/>"; |
} else { |
} else { |
$response = "Nightly additions based on classlist changes still <b>disabled</b><br/>"; |
$response = "Nightly additions based on classlist changes still <b>disabled</b><br/>"; |
} |
} |
} |
} |
if ($autodrops) { |
if ($autodrops) { |
if ($currdrops) { |
if ($currdrops) { |
$response .= "Nightly removals based on classlist changes still <b>enabled</b><br>"; |
$response .= "Nightly removals based on classlist changes still <b>enabled</b><br>"; |
} else { |
} else { |
$response .= "Nightly removals based on classlist changes now <b>enabled</b><br/>"; |
$response .= "Nightly removals based on classlist changes now <b>enabled</b><br/>"; |
} |
} |
} else { |
} else { |
if ($currdrops) { |
if ($currdrops) { |
$response .= "Nightly removals based on classlist changes now <b>disabled</b><br>"; |
$response .= "Nightly removals based on classlist changes now <b>disabled</b><br>"; |
} else { |
} else { |
$response .= "Nightly removals based on classlist changes still <b>disabled</b>"; |
$response .= "Nightly removals based on classlist changes still <b>disabled</b>"; |
} |
} |
} |
} |
if ($autoadds || $autodrops) { |
if ($autoadds || $autodrops) { |
$warning = &warning_message($dom,$crs,$action); |
$warning = &warning_message($dom,$crs,$action); |
$warn_prefix = "<br/><font size ='+1'><b>Warning</b></font>. Although you indicated that nightly "; |
$warn_prefix = "<br/><font size ='+1'><b>Warning</b></font>. Although you indicated that nightly "; |
$warn_suffix = " should be enabled, additional action is required.<br/>"; |
$warn_suffix = " should be enabled, additional action is required.<br/>"; |
} |
} |
if ($autoadds) { |
if ($autoadds) { |
if ($autodrops) { |
if ($autodrops) { |
$warnfiller = "adds and drops"; |
$warnfiller = "adds and drops"; |
} else { |
} else { |
$warnfiller = "adds"; |
$warnfiller = "adds"; |
} |
} |
} else { |
} else { |
if ($autodrops) { |
if ($autodrops) { |
$warnfiller = "drops"; |
$warnfiller = "drops"; |
} |
} |
} |
} |
unless ($warning eq '') { |
unless ($warning eq '') { |
$response = $warn_prefix.$warnfiller.$warn_suffix.$warning; |
$response = $warn_prefix.$warnfiller.$warn_suffix.$warning; |
} |
} |
} |
} |
&print_reply($r,$response,$$tasktitleref{$action}); |
&print_reply($r,$response,$$tasktitleref{$action}); |
return; |
return; |
} |
} |
|
|
sub print_setdates_response { |
sub print_setdates_response { |
my ($r,$realm,$dom,$crs,$action,$tasktitleref) = @_; |
my ($r,$realm,$dom,$crs,$action,$tasktitleref) = @_; |
my %settings = &Apache::lonnet::get('environment',['internal.autostart','internal.autoend'],$dom,$crs); |
my %settings = &Apache::lonnet::get('environment',['internal.autostart','internal.autoend'],$dom,$crs); |
my $currstart = $settings{'internal.autostart'}; |
my $currstart = $settings{'internal.autostart'}; |
my $currend = $settings{'internal.autoend'}; |
my $currend = $settings{'internal.autoend'}; |
my $response = ''; |
my $response = ''; |
my ($autostart,$autoend) = &get_dates_from_form(); |
my ($autostart,$autoend) = &get_dates_from_form(); |
my $showstart = &Apache::lonlocal::locallocaltime($autostart); |
my $showstart = &Apache::lonlocal::locallocaltime($autostart); |
my $showend = ''; |
my $showend = ''; |
my $warning = ''; |
my $warning = ''; |
my $warn_prefix = ''; |
my $warn_prefix = ''; |
if ($autoend) { |
if ($autoend) { |
$showend = &Apache::lonlocal::locallocaltime($autoend); |
$showend = &Apache::lonlocal::locallocaltime($autoend); |
} else { |
} else { |
$showend = "'No end date'"; |
$showend = "'No end date'"; |
} |
} |
|
|
my %cenv = ('internal.autostart' => $autostart, |
my %cenv = ('internal.autostart' => $autostart, |
'internal.autoend' => $autoend); |
'internal.autoend' => $autoend); |
my $reply = &Apache::lonnet::put('environment',\%cenv,$dom,$crs); |
my $reply = &Apache::lonnet::put('environment',\%cenv,$dom,$crs); |
if ($reply !~ /^ok$/) { |
if ($reply !~ /^ok$/) { |
$response = "There was a problem processing your requested changes. The automated enrollment settings for this course have been left unchanged.<br/>"; |
$response = "There was a problem processing your requested changes. The automated enrollment settings for this course have been left unchanged.<br/>"; |
} else { |
} else { |
if ($currstart == $autostart) { |
if ($currstart == $autostart) { |
$response = "The first date for automated enrollment has been left unchanged as $showstart.<br/>"; |
$response = "The first date for automated enrollment has been left unchanged as $showstart.<br/>"; |
} else { |
} else { |
$response = "The first date for automated enrollment has been changed to $showstart.<br/>"; |
$response = "The first date for automated enrollment has been changed to $showstart.<br/>"; |
} |
} |
if ($currend == $autoend) { |
if ($currend == $autoend) { |
$response .= "The last date for automated enrollment has been left unchanged as $showend.<br/>"; |
$response .= "The last date for automated enrollment has been left unchanged as $showend.<br/>"; |
} else { |
} else { |
$response .= "The last date for automated enrollment has been changed to $showend.<br/>"; |
$response .= "The last date for automated enrollment has been changed to $showend.<br/>"; |
} |
} |
|
|
# Generate message in case where old first enrollment date was later than today, but new first enrollment date is now today or earlier. |
# Generate message in case where old first enrollment date was later than today, but new first enrollment date is now today or earlier. |
|
|
my $rosterupdated = 0; |
my $rosterupdated = 0; |
my $firstaccess = ""; |
my $firstaccess = ""; |
my $nextupdate = ""; |
my $nextupdate = ""; |
my $lastupdate = ""; |
my $lastupdate = ""; |
|
|
my $nowstamp = time; |
my $nowstamp = time; |
my @date_list=localtime(time); |
my @date_list=localtime(time); |
my $cur_year = $date_list[5]; |
my $cur_year = $date_list[5]; |
my $curday = $date_list[3]; |
my $curday = $date_list[3]; |
my $curmonth = $date_list[4]; |
my $curmonth = $date_list[4]; |
my $lastmidnt = timelocal(0,0,0,$date_list[3],$date_list[4],$date_list[5]); |
my $lastmidnt = timelocal(0,0,0,$date_list[3],$date_list[4],$date_list[5]); |
my $nextmidnt = 86400 + $lastmidnt; |
my $nextmidnt = 86400 + $lastmidnt; |
|
|
my $todayupdate = timelocal(0,30,1,$date_list[3],$date_list[4],$date_list[5]); |
my $todayupdate = timelocal(0,30,1,$date_list[3],$date_list[4],$date_list[5]); |
my $lastupdate = $todayupdate - 86400; |
my $lastupdate = $todayupdate - 86400; |
if ($nowstamp < $todayupdate) { |
if ($nowstamp < $todayupdate) { |
$nextupdate = "today"; |
$nextupdate = "today"; |
} else { |
} else { |
$nextupdate = "tomorrow"; |
$nextupdate = "tomorrow"; |
} |
} |
if ($currstart < $lastupdate) { |
if ($currstart < $lastupdate) { |
$rosterupdated = 1; |
$rosterupdated = 1; |
} |
} |
if ($autostart < $nextmidnt ) { |
if ($autostart < $nextmidnt ) { |
if ( $autostart >= $lastmidnt) { |
if ( $autostart >= $lastmidnt) { |
$firstaccess = "today"; |
$firstaccess = "today"; |
} else { |
} else { |
$firstaccess = "a date prior to today"; |
$firstaccess = "a date prior to today"; |
} |
} |
if (($nowstamp >= $autostart) && ($rosterupdated == 0)) { |
if (($nowstamp >= $autostart) && ($rosterupdated == 0)) { |
$response .= qq|<br>Although you have now set the first enrollment date to $firstaccess, automatic enrollment will <b>not</b> occur until the next automatic enrollment update occurs for all LON-CAPA courses at 1.30 am $nextupdate. If you wish to immediately enroll registered students included in the institutional classlist for this class, please visit the <a href="/adm/populate?action=updatenow">roster update page</a>.<br>|; |
$response .= qq|<br>Although you have now set the first enrollment date to $firstaccess, automatic enrollment will <b>not</b> occur until the next automatic enrollment update occurs for all LON-CAPA courses at 1.30 am $nextupdate. If you wish to immediately enroll registered students included in the institutional classlist for this class, please visit the <a href="/adm/populate?action=updatenow">roster update page</a>.<br>|; |
} |
} |
} |
} |
$warning = &warning_message($dom,$crs,$action); |
$warning = &warning_message($dom,$crs,$action); |
$warn_prefix = "<br/><font size ='+1'><b>Warning</b></font>. Although you set a start and end date for auto-enrollment, additional action is required.<br/>"; |
$warn_prefix = "<br/><font size ='+1'><b>Warning</b></font>. Although you set a start and end date for auto-enrollment, additional action is required.<br/>"; |
unless ($warning eq '') { |
unless ($warning eq '') { |
$response .= $warn_prefix.$warning; |
$response .= $warn_prefix.$warning; |
} |
} |
} |
} |
&print_reply($r,$response,$$tasktitleref{$action}); |
&print_reply($r,$response,$$tasktitleref{$action}); |
return; |
return; |
} |
} |
|
|
sub print_setaccess_response { |
sub print_setaccess_response { |
my ($r,$realm,$dom,$crs,$action,$tasktitleref) = @_; |
my ($r,$realm,$dom,$crs,$action,$tasktitleref) = @_; |
my %settings = &Apache::lonnet::get('environment',['default_enrollment_start_date','default_enrollment_end_date','internal.autostart'],$dom,$crs); |
my %settings = &Apache::lonnet::get('environment',['default_enrollment_start_date','default_enrollment_end_date','internal.autostart'],$dom,$crs); |
my $currstart = $settings{'default_enrollment_start_date'}; |
my $currstart = $settings{'default_enrollment_start_date'}; |
my $currend = $settings{'default_enrollment_end_date'}; |
my $currend = $settings{'default_enrollment_end_date'}; |
my $autostart = $settings{'internal.autostart'}; |
my $autostart = $settings{'internal.autostart'}; |
my $response = ''; |
my $response = ''; |
my ($startaccess,$endaccess) = &get_dates_from_form(); |
my ($startaccess,$endaccess) = &get_dates_from_form(); |
my $showstart = &Apache::lonlocal::locallocaltime($startaccess); |
my $showstart = &Apache::lonlocal::locallocaltime($startaccess); |
my $showend = ''; |
my $showend = ''; |
my $warning = ''; |
my $warning = ''; |
my $warn_prefix = ''; |
my $warn_prefix = ''; |
if ($endaccess) { |
if ($endaccess) { |
$showend = &Apache::lonlocal::locallocaltime($endaccess); |
$showend = &Apache::lonlocal::locallocaltime($endaccess); |
} else { |
} else { |
$showend = "'No end date'"; |
$showend = "'No end date'"; |
} |
} |
|
|
my %cenv = ('default_enrollment_start_date' => $startaccess, |
my %cenv = ('default_enrollment_start_date' => $startaccess, |
'default_enrollment_end_date' => $endaccess); |
'default_enrollment_end_date' => $endaccess); |
my $reply = &Apache::lonnet::put('environment',\%cenv,$dom,$crs); |
my $reply = &Apache::lonnet::put('environment',\%cenv,$dom,$crs); |
if ($reply !~ /^ok$/) { |
if ($reply !~ /^ok$/) { |
$response = "There was a problem processing your requested changes. The automated enrollment settings for this course have been left unchanged.<br/>"; |
$response = "There was a problem processing your requested changes. The automated enrollment settings for this course have been left unchanged.<br/>"; |
} else { |
} else { |
if ($currstart == $startaccess) { |
if ($currstart == $startaccess) { |
$response = "The first access date for students added via automated enrollment has been left unchanged as $showstart.<br/>"; |
$response = "The first access date for students added via automated enrollment has been left unchanged as $showstart.<br/>"; |
} else { |
} else { |
$response = "The first access date for students added via automated enrollment has been changed to |
$response = "The first access date for students added via automated enrollment has been changed to |
$showstart.<br/>"; |
$showstart.<br/>"; |
} |
} |
if ($currend == $endaccess) { |
if ($currend == $endaccess) { |
$response .= "The last access date for students added via automated enrollment has been left unchanged as $showend.<br/>"; |
$response .= "The last access date for students added via automated enrollment has been left unchanged as $showend.<br/>"; |
} else { |
} else { |
$response .= "The last access date for students automated enrollment has been changed to |
$response .= "The last access date for students automated enrollment has been changed to |
$showend.<br/>"; |
$showend.<br/>"; |
} |
} |
|
|
# Generate message in case where old first access date was later than today, but new first access date is now today or earlier. |
# Generate message in case where old first access date was later than today, but new first access date is now today or earlier. |
|
|
my $accessgiven= 0; |
my $accessgiven= 0; |
my $firstaccess = ""; |
my $firstaccess = ""; |
my $nextupdate = ""; |
my $nextupdate = ""; |
my $lastupdate = ""; |
my $lastupdate = ""; |
|
|
my $nowstamp = time; |
my $nowstamp = time; |
my @date_list=localtime(time); |
my @date_list=localtime(time); |
my $cur_year = $date_list[5]; |
my $cur_year = $date_list[5]; |
my $curday = $date_list[3]; |
my $curday = $date_list[3]; |
my $curmonth = $date_list[4]; |
my $curmonth = $date_list[4]; |
my $lastmidnt = timelocal(0,0,0,$date_list[3],$date_list[4],$date_list[5]); |
my $lastmidnt = timelocal(0,0,0,$date_list[3],$date_list[4],$date_list[5]); |
my $nextmidnt = 86400 + $lastmidnt; |
my $nextmidnt = 86400 + $lastmidnt; |
|
|
my $todayupdate = timelocal(0,30,1,$date_list[3],$date_list[4],$date_list[5]); |
my $todayupdate = timelocal(0,30,1,$date_list[3],$date_list[4],$date_list[5]); |
my $tomorrowupdate = $todayupdate + 86400; |
my $tomorrowupdate = $todayupdate + 86400; |
my $lastupdate = $todayupdate - 86400; |
my $lastupdate = $todayupdate - 86400; |
|
|
if ($autostart < $nextmidnt) { |
if ($autostart < $nextmidnt) { |
if ($nowstamp < $todayupdate) { |
if ($nowstamp < $todayupdate) { |
$nextupdate = "at 1.30 am today"; |
$nextupdate = "at 1.30 am today"; |
} else { |
} else { |
$nextupdate = "at 1.30 am tomorrow"; |
$nextupdate = "at 1.30 am tomorrow"; |
} |
} |
} else { |
} else { |
my @enrollstart = &Apache::lonlocal::locallocaltime($autostart); |
my @enrollstart = &Apache::lonlocal::locallocaltime($autostart); |
$nextupdate = timelocal(0,30,1,$enrollstart[3],$enrollstart[4],$enrollstart[5]); |
$nextupdate = timelocal(0,30,1,$enrollstart[3],$enrollstart[4],$enrollstart[5]); |
unless (($enrollstart[2] < 1) || ($enrollstart[2] == 1 && $enrollstart[1] <=30)) { |
unless (($enrollstart[2] < 1) || ($enrollstart[2] == 1 && $enrollstart[1] <=30)) { |
$nextupdate += 86400; |
$nextupdate += 86400; |
} |
} |
$nextupdate = &Apache::lonlocal::locallocaltime($nextupdate); |
$nextupdate = &Apache::lonlocal::locallocaltime($nextupdate); |
} |
} |
if (($currstart < $lastupdate) && ($autostart < $lastupdate)) { |
if (($currstart < $lastupdate) && ($autostart < $lastupdate)) { |
$accessgiven = 1; |
$accessgiven = 1; |
} |
} |
if ($startaccess < $nextmidnt ) { |
if ($startaccess < $nextmidnt ) { |
if ( $startaccess >= $lastmidnt) { |
if ( $startaccess >= $lastmidnt) { |
$firstaccess = "today"; |
$firstaccess = "today"; |
} else { |
} else { |
$firstaccess = "a date prior to today"; |
$firstaccess = "a date prior to today"; |
} |
} |
if (($nowstamp >= $startaccess) && ($accessgiven == 0)) { |
if (($nowstamp >= $startaccess) && ($accessgiven == 0)) { |
$response .= qq|<br>Although you have now set the first access date to $firstaccess, automatic enrollment will <b>not</b> occur until the next automatic enrollment update occurs for all LON-CAPA courses $nextupdate. If you wish to grant immediate course access for registered students included in the institutional classlist for this class, please visit the <a href="/adm/populate?action=updatenow">roster update page</a>.<br>|; |
$response .= qq|<br>Although you have now set the first access date to $firstaccess, automatic enrollment will <b>not</b> occur until the next automatic enrollment update occurs for all LON-CAPA courses $nextupdate. If you wish to grant immediate course access for registered students included in the institutional classlist for this class, please visit the <a href="/adm/populate?action=updatenow">roster update page</a>.<br>|; |
} |
} |
} |
} |
$warning = &warning_message($dom,$crs,$action); |
$warning = &warning_message($dom,$crs,$action); |
$warn_prefix = "<br/><font size ='+1'><b>Warning</b></font>. Although you have set default first and last access dates for students who are added via automatic enrollment, additional action is required.<br/>"; |
$warn_prefix = "<br/><font size ='+1'><b>Warning</b></font>. Although you have set default first and last access dates for students who are added via automatic enrollment, additional action is required.<br/>"; |
unless ($warning eq '') { |
unless ($warning eq '') { |
$response .= $warn_prefix.$warning; |
$response .= $warn_prefix.$warning; |
} |
} |
} |
} |
&print_reply($r,$response,$$tasktitleref{$action}); |
&print_reply($r,$response,$$tasktitleref{$action}); |
return; |
return; |
} |
} |
|
|
sub print_notify_response { |
sub print_notify_response { |
my ($r,$realm,$dom,$crs,$action,$tasktitleref) = @_; |
my ($r,$realm,$dom,$crs,$action,$tasktitleref) = @_; |
|
|
# Get current settings |
# Get current settings |
my %settings = &Apache::lonnet::get('environment',['internal.notifylist','internal.coursecode'],$dom,$crs); |
my %settings = &Apache::lonnet::get('environment',['internal.notifylist','internal.coursecode'],$dom,$crs); |
my $notifylist = $settings{'internal.notifylist'}; |
my $notifylist = $settings{'internal.notifylist'}; |
my $coursecode = $settings{'internal.coursecode'}; |
my $coursecode = $settings{'internal.coursecode'}; |
my @currpeople = (); |
my @currpeople = (); |
my $notify = 0; |
my $notify = 0; |
my @people = (); |
my @people = (); |
my $peoplestr = ""; |
my $peoplestr = ""; |
my $response = ""; |
my $response = ""; |
my $noprocess = 0; |
my $noprocess = 0; |
|
|
if ($notifylist =~ m/,/) { |
if ($notifylist =~ m/,/) { |
@currpeople = split/,/,$notifylist; |
@currpeople = split/,/,$notifylist; |
} else { |
} else { |
$currpeople[0] = $notifylist; |
$currpeople[0] = $notifylist; |
} |
} |
my $currcount = 0; |
my $currcount = 0; |
foreach (@currpeople) { |
foreach (@currpeople) { |
unless ($_ eq '') { $currcount ++; } |
unless ($_ eq '') { $currcount ++; } |
} |
} |
|
|
if ( exists($ENV{'form.notify'}) ) { |
if ( exists($ENV{'form.notify'}) ) { |
$notify=$ENV{'form.notify'}; |
$notify=$ENV{'form.notify'}; |
} |
} |
if ( exists($ENV{'form.notifyshow'}) ) { |
if ( exists($ENV{'form.notifyshow'}) ) { |
my $notifyshow = $ENV{'form.notifyshow'}; |
my $notifyshow = $ENV{'form.notifyshow'}; |
for (my $i=0; $i<$notifyshow; $i++) { |
for (my $i=0; $i<$notifyshow; $i++) { |
if ( exists($ENV{"form.note_$i"}) ) { |
if ( exists($ENV{"form.note_$i"}) ) { |
if ( exists($ENV{"form.notifyname_$i"}) ) { |
if ( exists($ENV{"form.notifyname_$i"}) ) { |
unless ( $ENV{"form.notifyname_$i"} eq '' ) { |
unless ( $ENV{"form.notifyname_$i"} eq '' ) { |
push @people, $ENV{"form.notifyname_$i"}; |
push @people, $ENV{"form.notifyname_$i"}; |
} |
} |
} |
} |
} |
} |
} |
} |
if ($notify) { $peoplestr = join(",",@people); } |
if ($notify) { $peoplestr = join(",",@people); } |
} else { |
} else { |
if ($notify) { |
if ($notify) { |
if ($currcount) { |
if ($currcount) { |
$response = "There was a problem retrieving the updated list of recipients of notification messages. The notification settings for this course have been left unchanged.<br/>."; |
$response = "There was a problem retrieving the updated list of recipients of notification messages. The notification settings for this course have been left unchanged.<br/>."; |
$peoplestr = $notifylist; |
$peoplestr = $notifylist; |
@people = @currpeople; |
@people = @currpeople; |
$noprocess = 1; |
$noprocess = 1; |
} |
} |
} |
} |
} |
} |
unless ($noprocess == 1) { |
unless ($noprocess == 1) { |
my %cenv = ('internal.notifylist' => $peoplestr); |
my %cenv = ('internal.notifylist' => $peoplestr); |
my $reply = &Apache::lonnet::put('environment',\%cenv,$dom,$crs); |
my $reply = &Apache::lonnet::put('environment',\%cenv,$dom,$crs); |
if ($reply !~ /^ok$/) { |
if ($reply !~ /^ok$/) { |
$response = "There was a problem processing your requested changes. The notification settings for this course have been left unchanged.<br/>"; |
$response = "There was a problem processing your requested changes. The notification settings for this course have been left unchanged.<br/>"; |
} else { |
} else { |
if ($notify) { |
if ($notify) { |
if (@people) { |
if (@people) { |
if ($currcount) { |
if ($currcount) { |
$response .= "Notification of enrollment changes still <b>enabled</b><br/>"; |
$response .= "Notification of enrollment changes still <b>enabled</b><br/>"; |
} else { |
} else { |
$response .= "Notification of enrollment changes now <b>enabled</b><br/>"; |
$response .= "Notification of enrollment changes now <b>enabled</b><br/>"; |
} |
} |
$response .= "<br/>The following will receive notification if there are any changes in enrollment in LON-CAPA course: $realm ($coursecode) as a result of the nightly enrollment check: <br/><ul>\n"; |
$response .= "<br/>The following will receive notification if there are any changes in enrollment in LON-CAPA course: $realm ($coursecode) as a result of the nightly enrollment check: <br/><ul>\n"; |
foreach my $person (@people) { |
foreach my $person (@people) { |
$response .= "<li>$person</li>\n"; |
$response .= "<li>$person</li>\n"; |
} |
} |
$response .= "</ul>\n"; |
$response .= "</ul>\n"; |
} else { |
} else { |
$response = "Notification of enrollment changes was <b> not enabled</b> as no course coordinators were selected as recipients.<br/>"; |
$response = "Notification of enrollment changes was <b> not enabled</b> as no course coordinators were selected as recipients.<br/>"; |
} |
} |
} else { |
} else { |
if ($currcount) { |
if ($currcount) { |
$response = "Notification of enrollment changes now <b>disabled</b><br/>"; |
$response = "Notification of enrollment changes now <b>disabled</b><br/>"; |
} else { |
} else { |
$response = "Notification of enrollment changes still <b>disabled</b><br/>"; |
$response = "Notification of enrollment changes still <b>disabled</b><br/>"; |
} |
} |
} |
} |
} |
} |
} |
} |
&print_reply($r,$response,$$tasktitleref{$action}); |
&print_reply($r,$response,$$tasktitleref{$action}); |
return; |
return; |
} |
} |
|
|
sub print_crosslistings_menu () { |
sub print_crosslistings_menu () { |
my ($r,$realm,$dom,$crs,$action,$tasktitleref) = @_; |
my ($r,$realm,$dom,$crs,$action,$tasktitleref) = @_; |
my %settings = &Apache::lonnet::get('environment',['internal.crosslistings','internal.coursecode'],$dom,$crs); |
my %settings = &Apache::lonnet::get('environment',['internal.crosslistings','internal.coursecode'],$dom,$crs); |
my @currxlists = (); |
my @currxlists = (); |
my @xlists = (); |
my @xlists = (); |
my $crosscount = 0; |
my $crosscount = 0; |
my $removecount = 0; |
my $removecount = 0; |
my $xliststr = ''; |
my $xliststr = ''; |
my $response = ''; |
my $response = ''; |
my $coursecode = $settings{'internal.coursecode'}; |
my $coursecode = $settings{'internal.coursecode'}; |
if ($settings{'internal.crosslistings'} =~ m/,/) { |
if ($settings{'internal.crosslistings'} =~ m/,/) { |
@currxlists = split/,/,$settings{'internal.crosslistings'}; |
@currxlists = split/,/,$settings{'internal.crosslistings'}; |
} elsif ($settings{'internal.crosslistings'} ne '') { |
} elsif ($settings{'internal.crosslistings'} ne '') { |
$currxlists[0] = $settings{'internal.crosslistings'}; |
$currxlists[0] = $settings{'internal.crosslistings'}; |
} |
} |
|
|
if (@currxlists > 0) { |
if (@currxlists > 0) { |
for (my $i=0; $i<@currxlists; $i++) { |
for (my $i=0; $i<@currxlists; $i++) { |
my $xlist = "cross_".$i; |
my $xlist = "cross_".$i; |
my $gp = "gp_".$i; |
my $gp = "gp_".$i; |
if ( exists($ENV{"form.$xlist"}) ) { |
if ( exists($ENV{"form.$xlist"}) ) { |
my $xlistentry = ''; |
my $xlistentry = ''; |
if ($currxlists[$i] =~ m/^([^:]+)/) { |
if ($currxlists[$i] =~ m/^([^:]+)/) { |
$xlistentry = $1.':'; |
$xlistentry = $1.':'; |
} |
} |
if ( exists($ENV{"form.$gp"}) ) { |
if ( exists($ENV{"form.$gp"}) ) { |
$xlistentry .= $ENV{"form.$gp"}; |
$xlistentry .= $ENV{"form.$gp"}; |
} |
} |
push @xlists,$xlistentry; |
push @xlists,$xlistentry; |
$crosscount ++; |
$crosscount ++; |
} else { |
} else { |
$removecount ++; |
$removecount ++; |
} |
} |
} |
} |
} |
} |
|
|
if ($crosscount > 1) { |
if ($crosscount > 1) { |
$xliststr = join(",",@xlists); |
$xliststr = join(",",@xlists); |
} else { |
} else { |
$xliststr = $xlists[0]; |
$xliststr = $xlists[0]; |
} |
} |
my %cenv = ('internal.crosslistings' => $xliststr); |
my %cenv = ('internal.crosslistings' => $xliststr); |
my $reply = &Apache::lonnet::put('environment',\%cenv,$dom,$crs); |
my $reply = &Apache::lonnet::put('environment',\%cenv,$dom,$crs); |
if ($reply !~ /^ok$/) { |
if ($reply !~ /^ok$/) { |
$response = "There was a problem processing your requested changes. The automated enrollment settings for this course have been left unchanged.<br/>"; |
$response = "There was a problem processing your requested changes. The automated enrollment settings for this course have been left unchanged.<br/>"; |
} else { |
} else { |
if ($removecount > 0) { |
if ($removecount > 0) { |
$response = "A total of $removecount courses are no longer crosslisted with LON-CAPA course: $realm ($coursecode).<br/><br/>"; |
$response = "A total of $removecount courses are no longer crosslisted with LON-CAPA course: $realm ($coursecode).<br/><br/>"; |
} |
} |
if ($crosscount > 0) { |
if ($crosscount > 0) { |
$response .= "The $crosscount courses listed below remain crosslisted with this LON-CAPA course, and students enrolling in these course sections will be automatically added to the class roster for the course, if you have chosen to enable a nightly automated enrollment update.<br/><ul>\n"; |
$response .= "The $crosscount courses listed below remain crosslisted with this LON-CAPA course, and students enrolling in these course sections will be automatically added to the class roster for the course, if you have chosen to enable a nightly automated enrollment update.<br/><ul>\n"; |
foreach (@xlists) { |
foreach (@xlists) { |
my ($xlist,$gp) = split/:/,$_; |
my ($xlist,$gp) = split/:/,$_; |
$response .= "<li>$xlist - ID: $gp</li>\n"; |
$response .= "<li>$xlist - ID: $gp</li>\n"; |
} |
} |
$response .= "</ul><br/>\n"; |
$response .= "</ul><br/>\n"; |
} |
} |
} |
} |
if ( exists($ENV{'form.numcross'}) ) { |
if ( exists($ENV{'form.numcross'}) ) { |
my $numcross = $ENV{'form.numcross'}; |
my $numcross = $ENV{'form.numcross'}; |
if ($numcross > 0) { |
if ($numcross > 0) { |
my @bgcolors=("#eeeeee","#cccccc"); |
my @bgcolors=("#eeeeee","#cccccc"); |
$response .= qq( |
$response .= qq(You indicated that you wish to add an additional $numcross crosslisting(s). For each new crosslisting enter the insititutional course section code (e.g., fs03zol101001, for section 001 of zol101 for fs03 semester), and the LON-CAPA section/group ID you wish to assign to students who will be enrolled in your LON-CAPA class as a result of their registration in the crosslisted course section. The LON-CAPA section/group ID can be left blank, if you do not wish to tie a section/group ID to this crosslisting. The institutional course section code should only contain letters and/or numbers, and must be consistent with the scheme adopted by your Domain Coordinator to map course codes (and section numbers) to your institution\'s student information system.<br/><br/> |
You indicated that you wish to add an additional $numcross crosslisting(s). For each new crosslisting enter the insititutional course section code (e.g., fs03zol101001, for section 001 of zol101 for fs03 semester), and the LON-CAPA section/group ID you wish to assign to students who will be enrolled in your LON-CAPA class as a result of their registration in the crosslisted course section. The LON-CAPA section/group ID can be left blank, if you do not wish to tie a section/group ID to this crosslisting. The institutional course section code should only contain letters and/or numbers, and must be consistent with the scheme adopted by your Domain Coordinator to map course codes (and section numbers) to your institution's student information system.<br/><br/> |
|
<form name="enter" method="post"> |
<form name="enter" method="post"> |
<table border="0" cellpadding="2" cellspacing="2" width="100%"> |
<table border="0" cellpadding="2" cellspacing="2" width="100%"> |
<tr> |
<tr> |
Line 1521 sub print_crosslistings_menu () {
|
Line 1520 sub print_crosslistings_menu () {
|
<td><b>Crosslisting</b></td> |
<td><b>Crosslisting</b></td> |
<td><b>LON-CAPA section/groupID</b></td> |
<td><b>LON-CAPA section/groupID</b></td> |
</tr> |
</tr> |
); |
); |
for (my $i=0; $i<$numcross; $i++) { |
for (my $i=0; $i<$numcross; $i++) { |
my $colflag = $i%2; |
my $colflag = $i%2; |
$response .= qq( |
$response .= qq( |
<tr bgcolor="$bgcolors[$colflag]" align="left"> |
<tr bgcolor="$bgcolors[$colflag]" align="left"> |
<td><input type="text" size="15" name="newcross_$i" /></td> |
<td><input type="text" size="15" name="newcross_$i" /></td> |
<td><input type="text" size="10" name="newgroupid_$i" /></td> |
<td><input type="text" size="10" name="newgroupid_$i" /></td> |
</tr> |
</tr> |
); |
); |
} |
} |
$response .= qq( </table> |
$response .= qq( </table> |
</td> |
</td> |
</tr> |
</tr> |
<tr> |
<tr> |
Line 1544 sub print_crosslistings_menu () {
|
Line 1543 sub print_crosslistings_menu () {
|
<input type=\"hidden\" name=\"action\" value=\"newcross\"> |
<input type=\"hidden\" name=\"action\" value=\"newcross\"> |
<input type=\"hidden\" name=\"state\" value=\"process\"> |
<input type=\"hidden\" name=\"state\" value=\"process\"> |
</form> |
</form> |
); |
); |
} |
} |
} |
} |
&print_reply($r,$response,$$tasktitleref{$action}); |
&print_reply($r,$response,$$tasktitleref{$action}); |
return; |
return; |
} |
} |
|
|
sub print_crosslistings_response () { |
sub print_crosslistings_response () { |
my ($r,$realm,$dom,$crs,$action,$tasktitleref) = @_; |
my ($r,$realm,$dom,$crs,$action,$tasktitleref) = @_; |
my %settings = &Apache::lonnet::get('environment',['internal.crosslistings','internal.coursecode','internal.courseowner'],$dom,$crs); |
my %settings = &Apache::lonnet::get('environment',['internal.crosslistings','internal.coursecode','internal.courseowner'],$dom,$crs); |
my @currxlists = (); |
my @currxlists = (); |
my @xlists = (); |
my @xlists = (); |
my @allxlists = (); |
my @allxlists = (); |
my @badxlists = (); |
my @badxlists = (); |
my @badowner = (); |
my @badowner = (); |
my $numcross = 0; |
my $numcross = 0; |
my $xliststr = $settings{'internal.crosslistings'}; |
my $xliststr = $settings{'internal.crosslistings'}; |
my $coursecode = $settings{'internal.coursecode'}; |
my $coursecode = $settings{'internal.coursecode'}; |
my $owner = $settings{'internal.courseowner'}; |
my $owner = $settings{'internal.courseowner'}; |
my $response = ''; |
my $response = ''; |
my $warning = ''; |
my $warning = ''; |
my $warn_prefix = ''; |
my $warn_prefix = ''; |
|
|
if ($xliststr =~ m/,/) { |
if ($xliststr =~ m/,/) { |
@allxlists = split/,/,$xliststr; |
@allxlists = split/,/,$xliststr; |
} else { |
} else { |
unless ($xliststr eq '') { $allxlists[0] = $xliststr; } |
unless ($xliststr eq '') { $allxlists[0] = $xliststr; } |
} |
} |
|
|
if ( exists($ENV{'form.numcross'}) ) { |
if ( exists($ENV{'form.numcross'}) ) { |
$numcross = $ENV{'form.numcross'}; |
$numcross = $ENV{'form.numcross'}; |
} |
} |
|
|
if ($numcross > 0) { |
if ($numcross > 0) { |
for (my $i=0; $i<$numcross; $i++) { |
for (my $i=0; $i<$numcross; $i++) { |
my $xl = "newcross_".$i; |
my $xl = "newcross_".$i; |
my $gp = "newgroupid_".$i; |
my $gp = "newgroupid_".$i; |
if ( exists($ENV{"form.$xl"}) ) { |
if ( exists($ENV{"form.$xl"}) ) { |
my $coursecheck = ''; |
my $coursecheck = ''; |
$coursecheck = &Apache::lonnet::auto_validate_courseID($crs,$dom,$ENV{"form.$xl"}); |
$coursecheck = &Apache::lonnet::auto_validate_courseID($crs,$dom,$ENV{"form.$xl"}); |
if ($coursecheck eq 'ok') { |
if ($coursecheck eq 'ok') { |
my $addcheck = ''; |
my $addcheck = ''; |
$addcheck = &Apache::lonnet::auto_new_course($crs,$dom,$ENV{"form.$xl"},$owner); |
$addcheck = &Apache::lonnet::auto_new_course($crs,$dom,$ENV{"form.$xl"},$owner); |
if ($addcheck eq 'ok') { |
if ($addcheck eq 'ok') { |
push @xlists,$ENV{"form.$xl"}.":".$ENV{"form.$gp"}; |
push @xlists,$ENV{"form.$xl"}.":".$ENV{"form.$gp"}; |
} else { |
} else { |
push @badowner,$ENV{"form.$xl"}.":".$ENV{"form.$gp"}; |
push @badowner,$ENV{"form.$xl"}.":".$ENV{"form.$gp"}; |
} |
} |
} else { |
} else { |
push @badxlists, $ENV{"form.$xl"}.":".$ENV{"form.$gp"}.":".$coursecheck; |
push @badxlists, $ENV{"form.$xl"}.":".$ENV{"form.$gp"}.":".$coursecheck; |
} |
} |
} |
} |
} |
} |
push @allxlists, @xlists; |
push @allxlists, @xlists; |
} |
} |
|
|
if (@xlists > 0 ) { |
if (@xlists > 0 ) { |
unless ($xliststr eq '') { $xliststr .= ","; } |
unless ($xliststr eq '') { $xliststr .= ","; } |
if (@xlists > 1) { |
if (@xlists > 1) { |
$xliststr .= join(",",@xlists); |
$xliststr .= join(",",@xlists); |
} else { |
} else { |
$xliststr .= $xlists[0]; |
$xliststr .= $xlists[0]; |
} |
} |
my %cenv = ('internal.crosslistings' => $xliststr); |
my %cenv = ('internal.crosslistings' => $xliststr); |
my $reply = &Apache::lonnet::put('environment',\%cenv,$dom,$crs); |
my $reply = &Apache::lonnet::put('environment',\%cenv,$dom,$crs); |
if ($reply !~ /^ok$/) { |
if ($reply !~ /^ok$/) { |
$response = "There was a problem processing your requested changes. The automated enrollment settings for this course have been left unchanged.<br/><br/>"; |
$response = "There was a problem processing your requested changes. The automated enrollment settings for this course have been left unchanged.<br/><br/>"; |
} else { |
} else { |
$response = "The courses listed below are now crosslisted with this LON-CAPA course, and students enrolling in these course sections will be automatically added to the class roster for the course, if you have chosen to enable a nightly automated enrollment update.<br/><ul>\n"; |
$response = "The courses listed below are now crosslisted with this LON-CAPA course, and students enrolling in these course sections will be automatically added to the class roster for the course, if you have chosen to enable a nightly automated enrollment update.<br/><ul>\n"; |
foreach (@allxlists) { |
foreach (@allxlists) { |
my ($xlist,$gp) = split/:/,$_; |
my ($xlist,$gp) = split/:/,$_; |
$response .= "<li>$xlist - ID: $gp</li>\n"; |
$response .= "<li>$xlist - ID: $gp</li>\n"; |
} |
} |
$response .= "</ul><br/><br/>\n"; |
$response .= "</ul><br/><br/>\n"; |
} |
} |
} else { |
} else { |
if ($xliststr =~ m/:/) { |
if ($xliststr =~ m/:/) { |
my @oldxlists = (); |
my @oldxlists = (); |
if ($xliststr =~ m/,/) { |
if ($xliststr =~ m/,/) { |
@oldxlists = split/,/,$xliststr; |
@oldxlists = split/,/,$xliststr; |
} else { |
} else { |
$oldxlists[0] = $xliststr; |
$oldxlists[0] = $xliststr; |
} |
} |
$response .= "Although no new crosslistings were added, the courses listed below continue to be crosslisted with your LON-CAPA course.<br/><ul>\n"; |
$response .= "Although no new crosslistings were added, the courses listed below continue to be crosslisted with your LON-CAPA course.<br/><ul>\n"; |
foreach (@oldxlists) { |
foreach (@oldxlists) { |
my ($xlist,$gp) = split/:/,$_; |
my ($xlist,$gp) = split/:/,$_; |
$response .= "<li>$xlist - ID: $gp</li>\n"; |
$response .= "<li>$xlist - ID: $gp</li>\n"; |
} |
} |
$response .= "</ul><br/><br/>\n"; |
$response .= "</ul><br/><br/>\n"; |
} |
} |
} |
} |
if (@badxlists > 0) { |
if (@badxlists > 0) { |
$response .= "The courses listed below could not be included in the crosslistings for this LON-CAPA course, because they are not valid courses according to your institution's official schedule of classes and sections.<br/><ul>\n"; |
$response .= "The courses listed below could not be included in the crosslistings for this LON-CAPA course, because they are not valid courses according to your institution's official schedule of classes and sections.<br/><ul>\n"; |
foreach (@badxlists) { |
foreach (@badxlists) { |
my ($xlist,$gp,$prob) = split/:/,$_; |
my ($xlist,$gp,$prob) = split/:/,$_; |
$response .= "<li>$xlist - ID: $gp - Error: $prob</li>\n"; |
$response .= "<li>$xlist - ID: $gp - Error: $prob</li>\n"; |
} |
} |
$response .= "</ul><br/><br/>\n"; |
$response .= "</ul><br/><br/>\n"; |
} |
} |
|
|
if (@badowner > 0) { |
if (@badowner > 0) { |
$response .= "The courses listed below could not be included in the crosslistings for this LON-CAPA course, because the owner of this course - $owner - does not have rights to view enrollment in those classes as determined by your instititution's policies on access to official classlists.<br/><ul>\n"; |
$response .= "The courses listed below could not be included in the crosslistings for this LON-CAPA course, because the owner of this course - $owner - does not have rights to view enrollment in those classes as determined by your instititution's policies on access to official classlists.<br/><ul>\n"; |
foreach (@badowner) { |
foreach (@badowner) { |
my ($xlist,$gp) = split/:/,$_; |
my ($xlist,$gp) = split/:/,$_; |
$response .= "<li>$xlist - ID: $gp</li>\n"; |
$response .= "<li>$xlist - ID: $gp</li>\n"; |
} |
} |
$response .= "</ul><br/><br/>\n"; |
$response .= "</ul><br/><br/>\n"; |
} |
} |
|
|
if (@allxlists > 0) { |
if (@allxlists > 0) { |
$warning = &warning_message($dom,$crs,$action); |
$warning = &warning_message($dom,$crs,$action); |
$warn_prefix = "<br/><font size ='+1'><b>Warning</b></font>. Although you have selected crosslisted courses to contribute enrollment to this course, additional action is required.<br/>"; |
$warn_prefix = "<br/><font size ='+1'><b>Warning</b></font>. Although you have selected crosslisted courses to contribute enrollment to this course, additional action is required.<br/>"; |
unless ($warning eq '') { |
unless ($warning eq '') { |
$response .= $warn_prefix.$warning; |
$response .= $warn_prefix.$warning; |
} |
} |
} |
} |
|
|
&print_reply($r,$response,$$tasktitleref{$action}); |
&print_reply($r,$response,$$tasktitleref{$action}); |
return; |
return; |
} |
} |
|
|
sub print_sections_menu () { |
sub print_sections_menu () { |
my ($r,$realm,$dom,$crs,$action,$tasktitleref) = @_; |
my ($r,$realm,$dom,$crs,$action,$tasktitleref) = @_; |
my %settings = &Apache::lonnet::get('environment',['internal.sectionnums','internal.coursecode','internal.courseowner'],$dom,$crs); |
my %settings = &Apache::lonnet::get('environment',['internal.sectionnums','internal.coursecode','internal.courseowner'],$dom,$crs); |
my @currsections = (); |
my @currsections = (); |
my @sections = (); |
my @sections = (); |
my @badowner = (); |
my @badowner = (); |
my @badsections = (); |
my @badsections = (); |
my $seccount = 0; |
my $seccount = 0; |
my $removecount = 0; |
my $removecount = 0; |
my $addcount = 0; |
my $addcount = 0; |
my $secstr = ''; |
my $secstr = ''; |
my $response = ''; |
my $response = ''; |
my $warning = ""; |
my $warning = ""; |
my $warn_prefix = ""; |
my $warn_prefix = ""; |
my $coursecode = $settings{'internal.coursecode'}; |
my $coursecode = $settings{'internal.coursecode'}; |
my $owner = $settings{'internal.courseowner'}; |
my $owner = $settings{'internal.courseowner'}; |
if ($settings{'internal.sectionnums'} =~ m/,/) { |
if ($settings{'internal.sectionnums'} =~ m/,/) { |
@currsections = split/,/,$settings{'internal.sectionnums'}; |
@currsections = split/,/,$settings{'internal.sectionnums'}; |
} elsif ($settings{'internal.sectionnums'} ne '') { |
} elsif ($settings{'internal.sectionnums'} ne '') { |
$currsections[0] = $settings{'internal.sectionnums'}; |
$currsections[0] = $settings{'internal.sectionnums'}; |
} |
} |
|
|
if ( exists($ENV{'form.secshow'}) ) { |
if ( exists($ENV{'form.secshow'}) ) { |
for (my $i=0; $i<$ENV{'form.secshow'}; $i++) { |
for (my $i=0; $i<$ENV{'form.secshow'}; $i++) { |
my $gp = "loncapasec_".$i; |
my $gp = "loncapasec_".$i; |
my $secnum = "secnum_".$i; |
my $secnum = "secnum_".$i; |
my $sec = "sec_".$i; |
my $sec = "sec_".$i; |
if ( exists( $ENV{"form.$sec"} ) ) { |
if ( exists( $ENV{"form.$sec"} ) ) { |
my $secentry; |
my $secentry; |
if ( exists( $ENV{"form.$secnum"} ) ) { |
if ( exists( $ENV{"form.$secnum"} ) ) { |
$secentry = $ENV{"form.$secnum"}.':'; |
$secentry = $ENV{"form.$secnum"}.':'; |
} |
} |
if ( exists( $ENV{"form.$gp"} ) ) { |
if ( exists( $ENV{"form.$gp"} ) ) { |
$secentry .= $ENV{"form.$gp"}; |
$secentry .= $ENV{"form.$gp"}; |
} |
} |
if ( grep/^$ENV{"form.$secnum"}:/,@currsections) { |
if ( grep/^$ENV{"form.$secnum"}:/,@currsections) { |
push @sections, $secentry; |
push @sections, $secentry; |
$seccount ++; |
$seccount ++; |
} else { |
} else { |
my $newsec = $coursecode.$ENV{"form.$secnum"}; |
my $newsec = $coursecode.$ENV{"form.$secnum"}; |
my $coursecheck = &Apache::lonnet::auto_validate_courseID($crs,$dom,$newsec); |
my $coursecheck = &Apache::lonnet::auto_validate_courseID($crs,$dom,$newsec); |
if ($coursecheck eq 'ok') { |
if ($coursecheck eq 'ok') { |
my $addcheck = &Apache::lonnet::auto_new_course($crs,$dom,$newsec,$owner); |
my $addcheck = &Apache::lonnet::auto_new_course($crs,$dom,$newsec,$owner); |
if ($addcheck eq 'ok') { |
if ($addcheck eq 'ok') { |
push @sections,$ENV{"form.$secnum"}.":".$ENV{"form.$gp"}; |
push @sections,$ENV{"form.$secnum"}.":".$ENV{"form.$gp"}; |
$seccount ++; |
$seccount ++; |
$addcount ++; |
$addcount ++; |
} else { |
} else { |
push @badowner,$ENV{"form.$secnum"}.":".$ENV{"form.$gp"}; |
push @badowner,$ENV{"form.$secnum"}.":".$ENV{"form.$gp"}; |
} |
} |
} else { |
} else { |
push @badsections, $ENV{"form.$secnum"}.":".$ENV{"form.$gp"}.":".$coursecheck; |
push @badsections, $ENV{"form.$secnum"}.":".$ENV{"form.$gp"}.":".$coursecheck; |
} |
} |
} |
} |
} |
} |
} |
} |
if (@currsections > 0) { |
if (@currsections > 0) { |
for (my $i=0; $i<@currsections; $i++) { |
for (my $i=0; $i<@currsections; $i++) { |
if ($currsections[$i] =~ m/^(\w+:)/ ) { |
if ($currsections[$i] =~ m/^(\w+:)/ ) { |
my $oldsec = $1; |
my $oldsec = $1; |
unless (grep/^$oldsec/,@sections) { |
unless (grep/^$oldsec/,@sections) { |
$removecount ++; |
$removecount ++; |
} |
} |
} |
} |
} |
} |
} |
} |
} elsif (@currsections > 0) { |
} elsif (@currsections > 0) { |
for (my $i=0; $i<@currsections; $i++) { |
for (my $i=0; $i<@currsections; $i++) { |
my $sec = "sec_".$i; |
my $sec = "sec_".$i; |
my $gp = "secgp_".$i; |
my $gp = "secgp_".$i; |
if ( exists($ENV{"form.$sec"}) ) { |
if ( exists($ENV{"form.$sec"}) ) { |
my $secentry = ''; |
my $secentry = ''; |
if ($currsections[$i] =~ m/^(\w+:)/ ) { |
if ($currsections[$i] =~ m/^(\w+:)/ ) { |
$secentry = $1; |
$secentry = $1; |
} |
} |
if ( exists($ENV{"form.$gp"}) ) { |
if ( exists($ENV{"form.$gp"}) ) { |
$secentry .= $ENV{"form.$gp"}; |
$secentry .= $ENV{"form.$gp"}; |
} |
} |
push @sections,$secentry; |
push @sections,$secentry; |
$seccount ++; |
$seccount ++; |
} else { |
} else { |
$removecount ++; |
$removecount ++; |
} |
} |
} |
} |
} |
} |
|
|
if ($seccount > 1) { |
if ($seccount > 1) { |
$secstr = join(",",@sections); |
$secstr = join(",",@sections); |
} else { |
} else { |
$secstr = $sections[0]; |
$secstr = $sections[0]; |
} |
} |
my %cenv = ('internal.sectionnums' => $secstr); |
my %cenv = ('internal.sectionnums' => $secstr); |
my $reply = &Apache::lonnet::put('environment',\%cenv,$dom,$crs); |
my $reply = &Apache::lonnet::put('environment',\%cenv,$dom,$crs); |
if ($reply !~ /^ok$/) { |
if ($reply !~ /^ok$/) { |
$response = "There was a problem processing your requested changes. The automated enrollment settings for this course have been left unchanged.<br/>"; |
$response = "There was a problem processing your requested changes. The automated enrollment settings for this course have been left unchanged.<br/>"; |
} else { |
} else { |
if ($removecount > 0) { |
if ($removecount > 0) { |
$response = "A total of $removecount sections have been removed from the list of sections which contribute to enrollment in LON-CAPA course: $realm ($coursecode).<br/><br/>"; |
$response = "A total of $removecount sections have been removed from the list of sections which contribute to enrollment in LON-CAPA course: $realm ($coursecode).<br/><br/>"; |
} |
} |
if ($addcount > 0) { |
if ($addcount > 0) { |
$response .= "A total of $addcount sections have been added to the list of |
$response .= "A total of $addcount sections have been added to the list of |
sections which contribute to enrollment in LON-CAPA course: $realm ($coursecode).<br/><br/>"; |
sections which contribute to enrollment in LON-CAPA course: $realm ($coursecode).<br/><br/>"; |
} |
} |
if ($seccount > 0) { |
if ($seccount > 0) { |
$response .= "Students enrolling in the $seccount section(s) listed below will be automatically added to the class roster for the course, if you have chosen to enable a nightly automated enrollment update.<br/><ul>\n"; |
$response .= "Students enrolling in the $seccount section(s) listed below will be automatically added to the class roster for the course, if you have chosen to enable a nightly automated enrollment update.<br/><ul>\n"; |
foreach (@sections) { |
foreach (@sections) { |
my ($sec,$gp) = split/:/,$_; |
my ($sec,$gp) = split/:/,$_; |
$response .= "<li>$sec - ID: $gp</li>\n"; |
$response .= "<li>$sec - ID: $gp</li>\n"; |
} |
} |
$response .= "</ul><br/>\n"; |
$response .= "</ul><br/>\n"; |
} |
} |
} |
} |
|
|
if (@badsections > 0) { |
if (@badsections > 0) { |
$response .= "The sections listed below could not be included in the sections for this LON-CAPA course, because they are not valid section numbers according to your institution's official schedule of classes and sections.<br/><ul>\n"; |
$response .= "The sections listed below could not be included in the sections for this LON-CAPA course, because they are not valid section numbers according to your institution's official schedule of classes and sections.<br/><ul>\n"; |
foreach (@badsections) { |
foreach (@badsections) { |
my ($secnum,$gp,$prob) = split/:/,$_; |
my ($secnum,$gp,$prob) = split/:/,$_; |
$response .= "<li>$secnum - ID: $gp - Error: $prob</li>\n"; |
$response .= "<li>$secnum - ID: $gp - Error: $prob</li>\n"; |
} |
} |
$response .= "</ul><br/><br/>\n"; |
$response .= "</ul><br/><br/>\n"; |
} |
} |
|
|
if (@badowner > 0) { |
if (@badowner > 0) { |
$response .= "The sections listed below could not be included in the sections for this LON-CAPA course, because the owner of this course - $owner - does not have rights to view enrollment in those classes as determined by your instititution's policies on access to official classlists.<br/><ul>\n"; |
$response .= "The sections listed below could not be included in the sections for this LON-CAPA course, because the owner of this course - $owner - does not have rights to view enrollment in those classes as determined by your instititution's policies on access to official classlists.<br/><ul>\n"; |
foreach (@badowner) { |
foreach (@badowner) { |
my ($secnum,$gp) = split/:/,$_; |
my ($secnum,$gp) = split/:/,$_; |
$response .= "<li>$secnum - ID: $gp</li>\n"; |
$response .= "<li>$secnum - ID: $gp</li>\n"; |
} |
} |
$response .= "</ul><br/><br/>\n"; |
$response .= "</ul><br/><br/>\n"; |
} |
} |
|
|
if ($seccount > 0) { |
if ($seccount > 0) { |
$warning = &warning_message($dom,$crs,$action); |
$warning = &warning_message($dom,$crs,$action); |
$warn_prefix = "<br/><font size ='+1'><b>Warning</b></font>. Although you have selected sections to contribute enrollment to this course, additional action is required.<br/>"; |
$warn_prefix = "<br/><font size ='+1'><b>Warning</b></font>. Although you have selected sections to contribute enrollment to this course, additional action is required.<br/>"; |
unless ($warning eq '') { |
unless ($warning eq '') { |
$response .= $warn_prefix.$warning; |
$response .= $warn_prefix.$warning; |
} |
} |
} |
} |
|
|
if ( exists($ENV{'form.numsec'}) ) { |
if ( exists($ENV{'form.numsec'}) ) { |
my $numsec = $ENV{'form.numsec'}; |
my $numsec = $ENV{'form.numsec'}; |
if ($numsec > 0) { |
if ($numsec > 0) { |
my @bgcolors=("#eeeeee","#cccccc"); |
my @bgcolors=("#eeeeee","#cccccc"); |
$response .= qq( |
$response .= qq( |
You indicated that you wish to incorporate student enrollment in your LON-CAPA course from an additional $numsec section(s). For each new section enter the insititutional section code (e.g., 004), and the LON-CAPA section/group ID you wish to assign to students who will be enrolled in your LON-CAPA class as a result of their registration in this particular section. The LON-CAPA section/group ID can be left blank, if you do not wish to designate a section/group ID for this course section. The institutional section code should only contain letters and/or numbers, and must be consistent with the scheme adopted by your Domain Coordinator to map course section numbers to your institution's student information system.<br/><br/> |
You indicated that you wish to incorporate student enrollment in your LON-CAPA course from an additional $numsec section(s). For each new section enter the insititutional section code (e.g., 004), and the LON-CAPA section/group ID you wish to assign to students who will be enrolled in your LON-CAPA class as a result of their registration in this particular section. The LON-CAPA section/group ID can be left blank, if you do not wish to designate a section/group ID for this course section. The institutional section code should only contain letters and/or numbers, and must be consistent with the scheme adopted by your Domain Coordinator to map course section numbers to your institution\'s student information system.<br/><br/> |
<form name="enter" method="post"> |
<form name="enter" method="post"> |
<table border="0" cellpadding="2" cellspacing="2" width="100%"> |
<table border="0" cellpadding="2" cellspacing="2" width="100%"> |
<tr> |
<tr> |
Line 1819 sections which contribute to enrollment
|
Line 1818 sections which contribute to enrollment
|
<td><b>Section number</b></td> |
<td><b>Section number</b></td> |
<td><b>LON-CAPA section/groupID</b></td> |
<td><b>LON-CAPA section/groupID</b></td> |
</tr> |
</tr> |
); |
); |
for (my $i=0; $i<$numsec; $i++) { |
for (my $i=0; $i<$numsec; $i++) { |
my $colflag = $i%2; |
my $colflag = $i%2; |
$response .= qq( |
$response .= qq( |
<tr bgcolor="$bgcolors[$colflag]" align="left"> |
<tr bgcolor="$bgcolors[$colflag]" align="left"> |
<td><input type="text" size="15" name="newsec_$i" /></td> |
<td><input type="text" size="15" name="newsec_$i" /></td> |
<td><input type="text" size="10" name="newsecgp_$i" /></td> |
<td><input type="text" size="10" name="newsecgp_$i" /></td> |
</tr> |
</tr> |
); |
); |
} |
} |
$response .= qq( </table> |
$response .= qq( </table> |
</td> |
</td> |
</tr> |
</tr> |
<tr> |
<tr> |
Line 1842 sections which contribute to enrollment
|
Line 1841 sections which contribute to enrollment
|
<input type=\"hidden\" name=\"action\" value=\"newsections\"> |
<input type=\"hidden\" name=\"action\" value=\"newsections\"> |
<input type=\"hidden\" name=\"state\" value=\"process\"> |
<input type=\"hidden\" name=\"state\" value=\"process\"> |
</form> |
</form> |
); |
); |
} |
} |
} |
} |
&print_reply($r,$response,$$tasktitleref{$action}); |
&print_reply($r,$response,$$tasktitleref{$action}); |
return; |
return; |
} |
} |
|
|
sub print_sections_response () { |
sub print_sections_response () { |
my ($r,$realm,$dom,$crs,$action,$tasktitleref) = @_; |
my ($r,$realm,$dom,$crs,$action,$tasktitleref) = @_; |
my %settings = &Apache::lonnet::get('environment',['internal.sectionnums','internal.coursecode','internal.courseowner'],$dom,$crs); |
my %settings = &Apache::lonnet::get('environment',['internal.sectionnums','internal.coursecode','internal.courseowner'],$dom,$crs); |
my @currsections = (); |
my @currsections = (); |
my @sections = (); |
my @sections = (); |
my @allsections = (); |
my @allsections = (); |
my @badowner = (); |
my @badowner = (); |
my @badsections = (); |
my @badsections = (); |
my $numsec = 0; |
my $numsec = 0; |
my $secstr = $settings{'internal.sectionnums'}; |
my $secstr = $settings{'internal.sectionnums'}; |
my $coursecode = $settings{'internal.coursecode'}; |
my $coursecode = $settings{'internal.coursecode'}; |
my $owner = $settings{'internal.courseowner'}; |
my $owner = $settings{'internal.courseowner'}; |
my $response = ''; |
my $response = ''; |
my $putreply = ''; |
my $putreply = ''; |
my $warning = ''; |
my $warning = ''; |
my $warn_prefix = ''; |
my $warn_prefix = ''; |
if ($secstr =~ m/,/) { |
if ($secstr =~ m/,/) { |
@allsections = split/,/,$secstr; |
@allsections = split/,/,$secstr; |
} else { |
} else { |
unless ($secstr eq '') { $allsections[0] = $secstr; } |
unless ($secstr eq '') { $allsections[0] = $secstr; } |
} |
} |
|
|
if ( exists($ENV{'form.numsec'}) ) { |
if ( exists($ENV{'form.numsec'}) ) { |
$numsec = $ENV{'form.numsec'}; |
$numsec = $ENV{'form.numsec'}; |
} |
} |
|
|
if ($numsec > 0) { |
if ($numsec > 0) { |
for (my $i=0; $i<$numsec; $i++) { |
for (my $i=0; $i<$numsec; $i++) { |
my $sec = "newsec_".$i; |
my $sec = "newsec_".$i; |
my $gp = "newsecgp_".$i; |
my $gp = "newsecgp_".$i; |
if ( exists($ENV{"form.$sec"}) ) { |
if ( exists($ENV{"form.$sec"}) ) { |
unless ( (grep/^$ENV{"form.$sec"}:/,@allsections) || (grep/^$ENV{"form.$sec"}:/,@sections) ) { |
unless ( (grep/^$ENV{"form.$sec"}:/,@allsections) || (grep/^$ENV{"form.$sec"}:/,@sections) ) { |
my $newsec = $coursecode.$ENV{"form.$sec"}; |
my $newsec = $coursecode.$ENV{"form.$sec"}; |
my $coursecheck = &Apache::lonnet::auto_validate_courseID($crs,$dom,$newsec); |
my $coursecheck = &Apache::lonnet::auto_validate_courseID($crs,$dom,$newsec); |
if ($coursecheck eq 'ok') { |
if ($coursecheck eq 'ok') { |
my $addcheck = &Apache::lonnet::auto_new_course($crs,$dom,$newsec,$owner); |
my $addcheck = &Apache::lonnet::auto_new_course($crs,$dom,$newsec,$owner); |
if ($addcheck eq 'ok') { |
if ($addcheck eq 'ok') { |
push @sections,$ENV{"form.$sec"}.":".$ENV{"form.$gp"}; |
push @sections,$ENV{"form.$sec"}.":".$ENV{"form.$gp"}; |
} else { |
} else { |
push @badowner,$ENV{"form.$sec"}.":".$ENV{"form.$gp"}; |
push @badowner,$ENV{"form.$sec"}.":".$ENV{"form.$gp"}; |
} |
} |
} else { |
} else { |
push @badsections, $ENV{"form.$sec"}.":".$ENV{"form.$gp"}.":".$coursecheck; |
push @badsections, $ENV{"form.$sec"}.":".$ENV{"form.$gp"}.":".$coursecheck; |
} |
} |
} |
} |
} |
} |
} |
} |
push @allsections, @sections; |
push @allsections, @sections; |
} |
} |
|
|
if (@sections > 0 ) { |
if (@sections > 0 ) { |
unless ($secstr eq '') { $secstr .= ","; } |
unless ($secstr eq '') { $secstr .= ","; } |
if (@sections > 1) { |
if (@sections > 1) { |
$secstr .= join(",",@sections); |
$secstr .= join(",",@sections); |
} else { |
} else { |
$secstr .= $sections[0]; |
$secstr .= $sections[0]; |
} |
} |
my %cenv = ('internal.sectionnums' => $secstr); |
my %cenv = ('internal.sectionnums' => $secstr); |
$putreply = &Apache::lonnet::put('environment',\%cenv,$dom,$crs); |
$putreply = &Apache::lonnet::put('environment',\%cenv,$dom,$crs); |
if ($putreply !~ /^ok$/) { |
if ($putreply !~ /^ok$/) { |
$response = "There was a problem processing your requested changes. The automated enrollment settings for this course have been left unchanged.<br/><br/>"; |
$response = "There was a problem processing your requested changes. The automated enrollment settings for this course have been left unchanged.<br/><br/>"; |
} |
} |
} |
} |
|
|
if ($putreply =~ /^ok/) { |
|
$response = "Students enrolling in the sections listed below will be automatically added to the class roster for LON-CAPA course $realm ($coursecode), if you have chosen to enable a nightly automated enrollment update.<br/><ul>\n"; |
|
foreach (@allsections) { |
|
my ($sec,$gp) = split/:/,$_; |
|
$response .= "<li>$sec - ID: $gp</li>\n"; |
|
} |
|
$response .= "</ul><br/><br/>\n"; |
|
} |
|
|
|
if (@badsections > 0) { |
|
$response .= "The sections listed below could not be included in the sections for this LON-CAPA course, because they are not valid section numbers according to your institution's official schedule of classes and sections.<br/><ul>\n"; |
|
foreach (@badsections) { |
|
my ($secnum,$gp,$prob) = split/:/,$_; |
|
$response .= "<li>$secnum - ID: $gp - Error: $prob</li>\n"; |
|
} |
|
$response .= "</ul><br/><br/>\n"; |
|
} |
|
|
|
if (@badowner > 0) { |
|
$response .= "The sections listed below could not be included in the sections for this LON-CAPA course, because the owner of this course - $owner - does not have rights to view enrollment in those classes as determined by your instititution's policies on access to official classlists.<br/><ul>\n"; |
|
foreach (@badowner) { |
|
my ($secnum,$gp) = split/:/,$_; |
|
$response .= "<li>$secnum - ID: $gp</li>\n"; |
|
} |
|
$response .= "</ul><br/><br/>\n"; |
|
} |
|
|
|
if (@allsections > 0) { |
|
$warning = &warning_message($dom,$crs,$action); |
|
$warn_prefix = "<br/><font size ='+1'><b>Warning</b></font>. Although you have selected sections to contribute enrollment to this course, additional action is required.<br/>"; |
|
unless ($warning eq '') { |
|
$response .= $warn_prefix.$warning; |
|
} |
|
} |
|
|
|
&print_reply($r,$response,$$tasktitleref{$action}); |
if ($putreply =~ /^ok/) { |
return; |
$response = "Students enrolling in the sections listed below will be automatically added to the class roster for LON-CAPA course $realm ($coursecode), if you have chosen to enable a nightly automated enrollment update.<br/><ul>\n"; |
|
foreach (@allsections) { |
|
my ($sec,$gp) = split/:/,$_; |
|
$response .= "<li>$sec - ID: $gp</li>\n"; |
|
} |
|
$response .= "</ul><br/><br/>\n"; |
|
} |
|
|
|
if (@badsections > 0) { |
|
$response .= "The sections listed below could not be included in the sections for this LON-CAPA course, because they are not valid section numbers according to your institution's official schedule of classes and sections.<br/><ul>\n"; |
|
foreach (@badsections) { |
|
my ($secnum,$gp,$prob) = split/:/,$_; |
|
$response .= "<li>$secnum - ID: $gp - Error: $prob</li>\n"; |
|
} |
|
$response .= "</ul><br/><br/>\n"; |
|
} |
|
|
|
if (@badowner > 0) { |
|
$response .= "The sections listed below could not be included in the sections for this LON-CAPA course, because the owner of this course - $owner - does not have rights to view enrollment in those classes as determined by your instititution's policies on access to official classlists.<br/><ul>\n"; |
|
foreach (@badowner) { |
|
my ($secnum,$gp) = split/:/,$_; |
|
$response .= "<li>$secnum - ID: $gp</li>\n"; |
|
} |
|
$response .= "</ul><br/><br/>\n"; |
|
} |
|
|
|
if (@allsections > 0) { |
|
$warning = &warning_message($dom,$crs,$action); |
|
$warn_prefix = "<br/><font size ='+1'><b>Warning</b></font>. Although you have selected sections to contribute enrollment to this course, additional action is required.<br/>"; |
|
unless ($warning eq '') { |
|
$response .= $warn_prefix.$warning; |
|
} |
|
} |
|
|
|
&print_reply($r,$response,$$tasktitleref{$action}); |
|
return; |
} |
} |
|
|
sub print_photos_response () { |
sub print_photos_response () { |
my ($r,$realm,$dom,$crs,$action,$tasktitleref) = @_; |
my ($r,$realm,$dom,$crs,$action,$tasktitleref) = @_; |
my %settings = &Apache::lonnet::get('environment',['internal.showphotos'],$dom,$crs); |
my %settings = &Apache::lonnet::get('environment',['internal.showphotos'],$dom,$crs); |
my $currphotos = $settings{'internal.showphotos'}; |
my $currphotos = $settings{'internal.showphotos'}; |
my $showphotos = ''; |
my $showphotos = ''; |
if ( exists($ENV{'form.showphotos'}) ) { |
if ( exists($ENV{'form.showphotos'}) ) { |
$showphotos=$ENV{'form.showphotos'}; |
$showphotos=$ENV{'form.showphotos'}; |
} |
} |
|
|
my $response = ""; |
my $response = ""; |
my %cenv = ('internal.showphotos' => $showphotos); |
my %cenv = ('internal.showphotos' => $showphotos); |
my $reply = &Apache::lonnet::put('environment',\%cenv,$dom,$crs); |
my $reply = &Apache::lonnet::put('environment',\%cenv,$dom,$crs); |
if ($reply !~ /^ok$/) { |
if ($reply !~ /^ok$/) { |
$response = "There was a problem processing your requested change. The student photo import setting for this course has been left unchanged.<br/>"; |
$response = "There was a problem processing your requested change. The student photo import setting for this course has been left unchanged.<br/>"; |
} else { |
} else { |
if ($showphotos) { |
if ($showphotos) { |
if ($currphotos) { |
if ($currphotos) { |
$response = "Retrieval of student photos is still <b>enabled</b><br/>"; |
$response = "Retrieval of student photos is still <b>enabled</b><br/>"; |
} else { |
} else { |
$response = "Retrieval of student photos in now <b>enabled</b><br/>"; |
$response = "Retrieval of student photos in now <b>enabled</b><br/>"; |
} |
} |
} else { |
} else { |
if ($currphotos) { |
if ($currphotos) { |
$response = "Retrieval of student photos is now <b>disabled</b><br/>"; |
$response = "Retrieval of student photos is now <b>disabled</b><br/>"; |
} else { |
} else { |
$response = "Retrieval of student photos is still <b>disabled</b><br/>"; |
$response = "Retrieval of student photos is still <b>disabled</b><br/>"; |
} |
} |
} |
} |
} |
} |
&print_reply($r,$response,$$tasktitleref{$action}); |
&print_reply($r,$response,$$tasktitleref{$action}); |
return; |
return; |
} |
} |
|
|
sub print_update_result () { |
sub print_update_result () { |
my ($r,$realm,$dom,$crs,$action,$tasktitleref) = @_; |
my ($r,$realm,$dom,$crs,$action,$tasktitleref) = @_; |
my $response = ''; |
my $response = ''; |
my $updateadds = 0; |
my $updateadds = 0; |
my $updatedrops = 0; |
my $updatedrops = 0; |
my $changecount = 0; |
my $changecount = 0; |
my %affiliates = (); |
my %affiliates = (); |
my %reply = (); |
my %reply = (); |
my @allcourses = (); |
my @allcourses = (); |
my %LC_code = (); |
my %LC_code = (); |
my $logmsg = ''; |
my $logmsg = ''; |
my $newusermsg = ''; |
my $newusermsg = ''; |
|
|
my %settings = &Apache::lonnet::get('environment',['internal.coursecode','internal.sectionnums','internal.crosslistings','internal.authtype','internal.autharg'],$dom,$crs); |
my %settings = &Apache::lonnet::get('environment',['internal.coursecode','internal.sectionnums','internal.crosslistings','internal.authtype','internal.autharg'],$dom,$crs); |
my $coursecode = $settings{'internal.coursecode'}; |
my $coursecode = $settings{'internal.coursecode'}; |
my $authtype = $settings{'internal.authtype'}; |
my $authtype = $settings{'internal.authtype'}; |
my $autharg = $settings{'internal.autharg'}; |
my $autharg = $settings{'internal.autharg'}; |
my ($startaccess,$endaccess) = &get_dates_from_form(); |
my ($startaccess,$endaccess) = &get_dates_from_form(); |
|
|
if ( exists($ENV{'form.updateadds'}) ) { |
if ( exists($ENV{'form.updateadds'}) ) { |
$updateadds = $ENV{'form.updateadds'}; |
$updateadds = $ENV{'form.updateadds'}; |
} |
} |
if ( exists($ENV{'form.updatedrops'}) ) { |
if ( exists($ENV{'form.updatedrops'}) ) { |
$updatedrops = $ENV{'form.updatedrops'}; |
$updatedrops = $ENV{'form.updatedrops'}; |
} |
} |
if (!$updateadds && !$updatedrops) { |
if (!$updateadds && !$updatedrops) { |
$response = "An update of the class roster has not been carried out because you indicated that you wanted to neither add new students, nor expire dropped students based on a comparison between the institutional class lists for the course sections and crosslisted courses that contribure enrollment to this LON-CAPA course."; |
$response = "An update of the class roster has not been carried out because you indicated that you wanted to neither add new students, nor expire dropped students based on a comparison between the institutional class lists for the course sections and crosslisted courses that contribure enrollment to this LON-CAPA course."; |
} elsif ($coursecode eq '') { |
} elsif ($coursecode eq '') { |
$response = "There was a problem retrieving the course code for this LON-CAPA course. An update of the class roster has not been carried out, and enrollment remains unchanged"; |
$response = "There was a problem retrieving the course code for this LON-CAPA course. An update of the class roster has not been carried out, and enrollment remains unchanged"; |
} else { |
} else { |
# Get complete list of course sections to update |
# Get complete list of course sections to update |
my @currsections = (); |
my @currsections = (); |
my @currxlists = (); |
my @currxlists = (); |
|
|
if ($settings{'internal.sectionnums'} =~ m/,/) { |
if ($settings{'internal.sectionnums'} =~ m/,/) { |
@currsections = split/,/,$settings{'internal.sectionnums'}; |
@currsections = split/,/,$settings{'internal.sectionnums'}; |
} elsif ($settings{'internal.sectionnums'} ne '') { |
} elsif ($settings{'internal.sectionnums'} ne '') { |
$currsections[0] = $settings{'internal.sectionnums'}; |
$currsections[0] = $settings{'internal.sectionnums'}; |
} |
} |
|
|
if ($settings{'internal.crosslistings'} =~ m/,/) { |
if ($settings{'internal.crosslistings'} =~ m/,/) { |
@currxlists = split/,/,$settings{'internal.crosslistings'}; |
@currxlists = split/,/,$settings{'internal.crosslistings'}; |
} elsif ($settings{'internal.crosslistings'} ne '') { |
} elsif ($settings{'internal.crosslistings'} ne '') { |
$currxlists[0] = $settings{'internal.crosslistings'}; |
$currxlists[0] = $settings{'internal.crosslistings'}; |
} |
} |
|
|
if (@currxlists > 0) { |
if (@currxlists > 0) { |
foreach (@currxlists) { |
foreach (@currxlists) { |
if (m/^(\w+):(\w*)$/) { |
if (m/^(\w+):(\w*)$/) { |
unless (grep/^$1$/,@allcourses) { |
unless (grep/^$1$/,@allcourses) { |
push @allcourses,$1; |
push @allcourses,$1; |
$LC_code{$1} = $2; |
$LC_code{$1} = $2; |
} |
} |
} |
} |
} |
} |
} |
} |
|
|
if (@currsections > 0) { |
if (@currsections > 0) { |
foreach (@currsections) { |
foreach (@currsections) { |
if (m/^(\w+):(\w*)$/) { |
if (m/^(\w+):(\w*)$/) { |
my $sec = $coursecode.$1; |
my $sec = $coursecode.$1; |
my $gp = $2; |
my $gp = $2; |
unless (grep/^$sec$/,@allcourses) { |
unless (grep/^$sec$/,@allcourses) { |
push @allcourses,$sec; |
push @allcourses,$sec; |
$LC_code{$sec} = $gp; |
$LC_code{$sec} = $gp; |
} |
} |
} |
} |
} |
} |
} |
} |
|
|
if (@allcourses > 0) { |
if (@allcourses > 0) { |
@{$affiliates{$crs}} = @allcourses; |
@{$affiliates{$crs}} = @allcourses; |
my $outcome = &Apache::lonnet::fetch_enrollment_query('updatenow',\%affiliates,\%reply,$dom,$crs); |
my $outcome = &Apache::lonnet::fetch_enrollment_query('updatenow',\%affiliates,\%reply,$dom,$crs); |
if ($reply{$crs} > 0) { |
if ($reply{$crs} > 0) { |
($changecount,$response) = &LONCAPA::Enrollment::update_LC($dom,$crs,$updateadds,$updatedrops,$startaccess,$endaccess,$authtype,$autharg,\@allcourses,\%LC_code,\$logmsg,\$newusermsg,"updatenow"); |
($changecount,$response) = &LONCAPA::Enrollment::update_LC($dom,$crs,$updateadds,$updatedrops,$startaccess,$endaccess,$authtype,$autharg,\@allcourses,\%LC_code,\$logmsg,\$newusermsg,"updatenow"); |
} else { |
} else { |
$response = "There was a problem retrieving institutional class list data for the course sections and crosslisted courses which contribute enrollment to this course. No updates have been carried out, and the roster remains unchanged."; |
$response = "There was a problem retrieving institutional class list data for the course sections and crosslisted courses which contribute enrollment to this course. No updates have been carried out, and the roster remains unchanged."; |
} |
} |
} else { |
} else { |
$response = "There are currently no course sections or crosslisted courses designated as contributors to enrollment in this LON-CAPA course. As a result a student roster update has not been carried out for $realm ($coursecode)"; |
$response = "There are currently no course sections or crosslisted courses designated as contributors to enrollment in this LON-CAPA course. As a result a student roster update has not been carried out for $realm ($coursecode)"; |
} |
} |
} |
} |
unless ($logmsg eq '') { |
unless ($logmsg eq '') { |
my $loglength = length($logmsg); |
my $loglength = length($logmsg); |
$logmsg = substr($logmsg,0,$loglength-4); |
$logmsg = substr($logmsg,0,$loglength-4); |
$logmsg = "<br/><br/>The following messages were generated by the roster update process: <br/><ul><li>".$logmsg."</ul><br/>"; |
$logmsg = "<br/><br/>The following messages were generated by the roster update process: <br/><ul><li>".$logmsg."</ul><br/>"; |
} |
} |
unless ($newusermsg eq '') { |
unless ($newusermsg eq '') { |
$newusermsg = substr( $newusermsg,0,rindex($newusermsg,'<li>') ); |
$newusermsg = substr( $newusermsg,0,rindex($newusermsg,'<li>') ); |
$newusermsg = "<br/><br/>The following new system user(s) who was/were created will be using internal authentication with an initial randomly generated password. A valid e-mail address was not available for this/these user(s) so LON-CAPA account credentials could not be sent via e-mail.<br/><ul><li>".$newusermsg."</ul><br/>"; |
$newusermsg = "<br/><br/>The following new system user(s) who was/were created will be using internal authentication with an initial randomly generated password. A valid e-mail address was not available for this/these user(s) so LON-CAPA account credentials could not be sent via e-mail.<br/><ul><li>".$newusermsg."</ul><br/>"; |
} |
} |
$response .= $logmsg.$newusermsg; |
$response .= $logmsg.$newusermsg; |
&print_reply($r,$response,$$tasktitleref{$action}); |
&print_reply($r,$response,$$tasktitleref{$action}); |
return; |
return; |
} |
} |
|
|
sub print_viewclass_response { |
sub print_viewclass_response { |