version 1.147, 2006/08/08 19:02:04
|
version 1.152, 2006/12/21 19:41:03
|
Line 40 use Spreadsheet::WriteExcel;
|
Line 40 use Spreadsheet::WriteExcel;
|
use Apache::lonstathelpers(); |
use Apache::lonstathelpers(); |
use Apache::lonlocal; |
use Apache::lonlocal; |
use Apache::longroup; |
use Apache::longroup; |
|
use LONCAPA(); |
|
|
############################################################### |
############################################################### |
############################################################### |
############################################################### |
Line 60 sub modifystudent {
|
Line 61 sub modifystudent {
|
# if $csec is undefined, drop the student from all the courses matching |
# if $csec is undefined, drop the student from all the courses matching |
# this one. If $csec is defined, drop them from all other sections of |
# this one. If $csec is defined, drop them from all other sections of |
# this course and add them to section $csec |
# this course and add them to section $csec |
$courseid=~s/\_/\//g; |
my $cdom = $env{'course.'.$courseid.'.domain'}; |
$courseid=~s/^(\w)/\/$1/; |
my $cnum = $env{'course.'.$courseid.'.num'}; |
my %roles = &Apache::lonnet::dump('roles',$udom,$unam); |
my %roles = &Apache::lonnet::dump('roles',$udom,$unam); |
my ($tmp) = keys(%roles); |
my ($tmp) = keys(%roles); |
# Bail out if we were unable to get the students roles |
# Bail out if we were unable to get the students roles |
Line 69 sub modifystudent {
|
Line 70 sub modifystudent {
|
# Go through the roles looking for enrollment in this course |
# Go through the roles looking for enrollment in this course |
my $result = ''; |
my $result = ''; |
foreach my $course (keys(%roles)) { |
foreach my $course (keys(%roles)) { |
if ($course=~/^$courseid(?:\/)*(?:\s+)*(\w+)*\_st$/) { |
if ($course=~m{^/\Q$cdom\E/\Q$cnum\E(?:\/)*(?:\s+)*(\w+)*\_st$}) { |
# We are in this course |
# We are in this course |
my $section=$1; |
my $section=$1; |
$section='' if ($course eq $courseid.'_st'); |
$section='' if ($course eq "/$cdom/$cnum".'_st'); |
if (defined($csec) && $section eq $csec) { |
if (defined($csec) && $section eq $csec) { |
$result .= 'ok:'; |
$result .= 'ok:'; |
} elsif ( ((!$section) && (!$csec)) || ($section ne $csec) ) { |
} elsif ( ((!$section) && (!$csec)) || ($section ne $csec) ) { |
Line 135 sub print_main_menu {
|
Line 136 sub print_main_menu {
|
my ($r,$enrl_permission,$view_permission,$grp_manage_permission, |
my ($r,$enrl_permission,$view_permission,$grp_manage_permission, |
$grp_view_permission)=@_; |
$grp_view_permission)=@_; |
# |
# |
my ($cdom,$cnum) = split/_/,$env{'request.course.id'}; |
my $cid =$env{'request.course.id'}; |
|
my $cdom=$env{'course.'.$cid.'.domain'}; |
|
my $cnum=$env{'course.'.$cid.'.num'}; |
my @menu = |
my @menu = |
( |
( |
{ text => 'Upload a class list', |
{ text => 'Upload a class list', |
Line 250 sub print_upload_manager_header {
|
Line 253 sub print_upload_manager_header {
|
# |
# |
my $javascript_validations=&javascript_validations('auth',$krbdefdom, |
my $javascript_validations=&javascript_validations('auth',$krbdefdom, |
$password_choice); |
$password_choice); |
my $checked=(($env{'form.noFirstLine'})?' checked="1"':''); |
my $checked=(($env{'form.noFirstLine'})?' checked="checked" ':''); |
$r->print('<h3>'.&mt('Uploading Class List')."</h3>\n". |
$r->print('<h3>'.&mt('Uploading Class List')."</h3>\n". |
"<hr>\n". |
"<hr>\n". |
'<h3>'.&mt('Identify fields')."</h3>\n"); |
'<h3>'.&mt('Identify fields')."</h3>\n"); |
Line 269 sub print_upload_manager_header {
|
Line 272 sub print_upload_manager_header {
|
$r->print('<input type="button" value="Reverse Association" '. |
$r->print('<input type="button" value="Reverse Association" '. |
'name="'.&mt('Reverse Association').'" '. |
'name="'.&mt('Reverse Association').'" '. |
'onClick="javascript:this.form.associate.value=\'Reverse Association\';submit(this.form);" />'); |
'onClick="javascript:this.form.associate.value=\'Reverse Association\';submit(this.form);" />'); |
$r->print('<label><input type="checkbox" name="noFirstLine" $checked />'. |
$r->print('<label><input type="checkbox" name="noFirstLine"'.$checked.'/>'. |
&mt('Ignore First Line').'</label>'); |
&mt('Ignore First Line').'</label>'); |
$r->print("<hr />\n". |
$r->print("<hr />\n". |
'<script type="text/javascript" language="Javascript">'."\n". |
'<script type="text/javascript" language="Javascript">'."\n". |
Line 746 sub enroll_single_student {
|
Line 749 sub enroll_single_student {
|
$r->print('<h3>'.&mt('Enrolling Student').'</h3>'); |
$r->print('<h3>'.&mt('Enrolling Student').'</h3>'); |
$r->print('<p>'.&mt('Enrolling').' '.$env{'form.cuname'}." \@ ". |
$r->print('<p>'.&mt('Enrolling').' '.$env{'form.cuname'}." \@ ". |
$env{'form.lcdomain'}.'</p>'); |
$env{'form.lcdomain'}.'</p>'); |
if (($env{'form.cuname'})&&($env{'form.cuname'}!~/\W/)&& |
if (($env{'form.cuname'}) |
($env{'form.lcdomain'})&&($env{'form.lcdomain'}!~/\W/)) { |
&& ($env{'form.cuname'} |
|
eq &LONCAPA::clean_username($env{'form.cuname'})) |
|
&& ($env{'form.lcdomain'}) |
|
&& ($env{'form.lcdomain'} |
|
eq &LONCAPA::clean_domain($env{'form.lcdomain'}))) { |
# Deal with home server selection |
# Deal with home server selection |
my $domain=$env{'form.lcdomain'}; |
my $domain=$env{'form.lcdomain'}; |
my $desiredhost = $env{'form.lcserver'}; |
my $desiredhost = $env{'form.lcserver'}; |
Line 957 sub print_enroll_single_student_form {
|
Line 964 sub print_enroll_single_student_form {
|
my $r=shift; |
my $r=shift; |
$r->print("<h3>".&mt('Enroll One Student')."</h3>"); |
$r->print("<h3>".&mt('Enroll One Student')."</h3>"); |
# |
# |
my $username = $env{'form.cuname'}; |
my $username = &LONCAPA::clean_username($env{'form.cuname'}); |
my $domain = $env{'form.cudomain'}; |
my $domain = &LONCAPA::clean_domain($env{'form.cudomain'}); |
$username=~s/\W//gs; |
|
$domain=~s/\W//gs; |
|
my $home = &Apache::lonnet::homeserver($username,$domain); |
my $home = &Apache::lonnet::homeserver($username,$domain); |
# $new_user flags whether we are creating a new user or using an old one |
# $new_user flags whether we are creating a new user or using an old one |
my $new_user = 1; |
my $new_user = 1; |
Line 1177 sub print_html_classlist {
|
Line 1182 sub print_html_classlist {
|
} |
} |
my $status_select = &Apache::lonhtmlcommon::StatusOptions |
my $status_select = &Apache::lonhtmlcommon::StatusOptions |
($env{'form.Status'}); |
($env{'form.Status'}); |
my $cid=$env{'request.course.id'}; |
my $cid =$env{'request.course.id'}; |
my $cdom=$env{'course.'.$cid.'.domain'}; |
my $cdom=$env{'course.'.$cid.'.domain'}; |
my $cnum=$env{'course.'.$cid.'.num'}; |
my $cnum=$env{'course.'.$cid.'.num'}; |
# |
# |
Line 1870 END
|
Line 1875 END
|
sub get_enrollment_data { |
sub get_enrollment_data { |
my ($sname,$sdomain) = @_; |
my ($sname,$sdomain) = @_; |
my $courseid = $env{'request.course.id'}; |
my $courseid = $env{'request.course.id'}; |
$courseid =~ s:_:/:g; |
my $cdom = $env{'course.'.$courseid.'.domain'}; |
|
my $cnum = $env{'course.'.$courseid.'.num'}; |
my %roles = &Apache::lonnet::dump('roles',$sdomain,$sname); |
my %roles = &Apache::lonnet::dump('roles',$sdomain,$sname); |
my ($tmp) = keys(%roles); |
my ($tmp) = keys(%roles); |
# Bail out if we were unable to get the students roles |
# Bail out if we were unable to get the students roles |
Line 1880 sub get_enrollment_data {
|
Line 1886 sub get_enrollment_data {
|
my $section = ''; |
my $section = ''; |
my $count = scalar(keys(%roles)); |
my $count = scalar(keys(%roles)); |
while (my ($course,$role) = each(%roles)) { |
while (my ($course,$role) = each(%roles)) { |
if ($course=~ /^\/$courseid\/*\s*(\w+)*_st$/ ) { |
if ($course=~m{^/\Q$cdom\E/\Q$cnum\E/*\s*(\w+)*_st$} ) { |
# |
# |
# Get active role |
# Get active role |
$section=$1; |
$section=$1; |
Line 2193 sub upfile_drop_add {
|
Line 2199 sub upfile_drop_add {
|
$amode = ''; # This causes the loop below to be skipped |
$amode = ''; # This causes the loop below to be skipped |
} |
} |
} |
} |
unless (($domain=~/\W/) || ($amode eq '')) { |
if ( $domain eq &clean_domain($domain) |
|
&& ($amode ne '')) { |
####################################### |
####################################### |
## Enroll Students ## |
## Enroll Students ## |
####################################### |
####################################### |
Line 2227 sub upfile_drop_add {
|
Line 2234 sub upfile_drop_add {
|
$gen=$entries{$fields{'gen'}}; |
$gen=$entries{$fields{'gen'}}; |
} |
} |
} |
} |
if ($entries{$fields{'username'}}=~/\W/) { |
if ($entries{$fields{'username'}} |
|
ne &LONCAPA::clean_username($entries{$fields{'username'}})) { |
$r->print('<br />'. |
$r->print('<br />'. |
&mt('<b>[_1]</b>: Unacceptable username for user [_2] [_3] [_4] [_5]', |
&mt('<b>[_1]</b>: Unacceptable username for user [_2] [_3] [_4] [_5]', |
$entries{$fields{'username'}},$fname,$mname,$lname,$gen). |
$entries{$fields{'username'}},$fname,$mname,$lname,$gen). |