--- loncom/interface/lonpopulate.pm 2007/03/08 01:58:45 1.49 +++ loncom/interface/lonpopulate.pm 2007/12/14 00:20:53 1.51 @@ -1,5 +1,5 @@ # automated enrollment configuration handler -# $Id: lonpopulate.pm,v 1.49 2007/03/08 01:58:45 albertel Exp $ +# $Id: lonpopulate.pm,v 1.51 2007/12/14 00:20:53 raeburn Exp $ # # Copyright Michigan State University Board of Trustees # @@ -33,6 +33,7 @@ use Apache::lonhtmlcommon; use Apache::lonlocal; use Apache::loncoursedata; use Apache::longroup; +use Apache::lonuserutils; use Apache::Constants qw(:common :http REDIRECT); use Time::Local; use LONCAPA::Enrollment; @@ -225,7 +226,7 @@ sub print_mainbox { - +
- $realm -> Enrollment Manager -> $page
+ $realm -> User Management -> $page
Automated Enrollment Manager  @@ -673,7 +674,7 @@ ENDTWO if ((@ccs + @showdom) > $notifycount) { $r->print(&mt("Check the checkbox(es) to initiate notification for people not currently informed of roster changes from the nightly enrollment update.
")); } - $r->print(&mt("Click 'Go' to store your changes.")." + $r->print(&mt("Click 'Go' to save your changes.")."
@@ -707,7 +708,7 @@ ENDTWO "); if ($cross_str > 0) { $r->print(" - Currently, this LON-CAPA course is crosslisted with $cross_str course section(s). 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. For each crosslisting, leave the checkbox checked if you want registered students in that course to be included in the student roster for LON-CAPA course: $realm ($enrollvar{coursecode}); otherwise uncheck it. If you wish to change the section ID assigned in your LON-CAPA course for a crosslisted course, enter the new section ID in the appropriate textbox. The LON-CAPA section ID can be left (or set to) empty, if you do not wish to tie a section ID to this crosslisting. If you wish to add new crosslisted courses, enter the number of new courses to add in the textbox at the bottom of the page. You will provide information about each of the new crosslistings on a subsequent page. Click 'Go' to store your changes. + Currently, this LON-CAPA course is crosslisted with $cross_str course section(s). 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. For each crosslisting, leave the checkbox checked if you want registered students in that course to be included in the student roster for LON-CAPA course: $realm ($enrollvar{coursecode}); otherwise uncheck it. If you wish to change the section ID assigned in your LON-CAPA course for a crosslisted course, enter the new section ID in the appropriate textbox. The LON-CAPA section ID can be left (or set to) empty, if you do not wish to tie a section ID to this crosslisting. If you wish to add new crosslisted courses, enter the number of new courses to add in the textbox at the bottom of the page. You will provide information about each of the new crosslistings on a subsequent page. Click 'Go' to save your changes.
@@ -793,8 +794,7 @@ ENDTWO
For each section, check the checkbox if you want registered students in that section to be included in the student roster for LON-CAPA course: $realm ($enrollvar{coursecode}); otherwise uncheck it. If you want to change the section ID designation used for this section in LON-CAPA, delete the current value in the LON-CAPA section ID textbox and enter the new value. The LON-CAPA section ID can be left (or set to) empty, if you do not wish to tie a section ID to this section. To add a new section, check the 'Enrollment in this course?' checkbox, and enter the desired LON-CAPA section ID in the appropriate textbox. Click 'Go' to store -your changes.For each section, check the checkbox if you want registered students in that section to be included in the student roster for LON-CAPA course: $realm ($enrollvar{coursecode}); otherwise uncheck it. If you want to change the section ID designation used for this section in LON-CAPA, delete the current value in the LON-CAPA section ID textbox and enter the new value. The LON-CAPA section ID can be left (or set to) empty, if you do not wish to tie a section ID to this section. To add a new section, check the 'Enrollment in this course?' checkbox, and enter the desired LON-CAPA section ID in the appropriate textbox. Click 'Go' to save your changes.

@@ -854,7 +854,7 @@ your changes. if (@currsections) { my $secshow = @currsections; $r->print(" - Currently, this LON-CAPA course incorporates enrollment from $secshow sections. Students enrolling in any of 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. For each section, uncheck the checkbox if you want registered students in that section to cease being included in the student roster for LON-CAPA course: $realm ($enrollvar{coursecode}); otherwise leave it checked. If you want to change the section ID designation used for this section in LON-CAPA, delete the current value in the LON-CAPA section ID textbox and enter the new value. If you wish to add new course section, enter the number of new sections to add in the textbox at the bottom of the page. You will provide information about each of the new sections on a subsequent page. Click 'Go' to store your changes. + Currently, this LON-CAPA course incorporates enrollment from $secshow sections. Students enrolling in any of 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. For each section, uncheck the checkbox if you want registered students in that section to cease being included in the student roster for LON-CAPA course: $realm ($enrollvar{coursecode}); otherwise leave it checked. If you want to change the section ID designation used for this section in LON-CAPA, delete the current value in the LON-CAPA section ID textbox and enter the new value. If you wish to add new course section, enter the number of new sections to add in the textbox at the bottom of the page. You will provide information about each of the new sections on a subsequent page. Click 'Go' to save your changes. @@ -977,7 +977,7 @@ your changes. '. -&mt('Note: if you enable automatic import of student photos, your course will automatically have access to photos stored by your institution for officially registered students, via a conduit established by your LON-CAPA domain coordinator.').' +&mt('Note: if you enable automatic import of student photos, your course will automatically have access to photos saved by your institution for officially registered students, via a conduit established by your LON-CAPA domain coordinator.').' @@ -1122,16 +1122,34 @@ onclick="javascript:document.photoupdate } my $status_select = &Apache::lonhtmlcommon::StatusOptions($env{'form.Status'}); # Get current classlist - my ($classlist,$keylist)=&Apache::loncoursedata::get_classlist(); + my %userlist; + my ($indexhash,$keylist) = &Apache::lonuserutils::make_keylist_array(); + my $classlist = &Apache::loncoursedata::get_classlist(); + my $secidx = &Apache::loncoursedata::CL_SECTION(); + my ($permission,$allowed) = &Apache::lonuserutils::get_permission(); + foreach my $student (keys(%{$classlist})) { + if (exists($permission->{'view_section'})) { + if ($classlist->{$student}[$secidx] ne $permission->{'view_section'}) { + next; + } else { + $userlist{$student} = $classlist->{$student}; + } + } else { + $userlist{$student} = $classlist->{$student}; + } + } + if (! defined($classlist)) { - $r->print(&mt('There are no students either currently or previously enrolled.'). - "\n"); + $r->print(&mt('There are no students either currently or previously enrolled.')." + + \n"); } else { $r->print(&mt('Student Status: [_1]',$status_select)."\n"); $r->print(''. "\n

\n"); - - my ($studentcount,$autocount,$manualcount,$lockcount,$unlockcount) = &Apache::londropadd::show_class_list($r,'autoenroll','nothing',$env{'form.Status'},$classlist,$keylist); + my $context = 'course'; + my $mode = 'autoenroll'; + my ($studentcount,$autocount,$manualcount,$lockcount,$unlockcount) = &Apache::lonuserutils::show_users_list($r,$context,$mode,$permission,$env{'form.Status'},\%userlist,$keylist); $r->print(" @@ -1186,6 +1204,14 @@ END "); + } else { + $r->print(' + +
+ '.&mt('There are no students with the selected status.').' + + + '); } $r->print(" @@ -2690,7 +2716,7 @@ sub print_viewclass_response { &Apache::loncommon::get_env_multiple('form.unlockchg')); foreach my $student (sort @typechglist) { - my ($uname,$udom) = split/:/,$student; + my ($uname,$udom) = split(/:/,$student); my $sdata = $classlist->{$student}; my $section = $sdata->[$secidx]; my $uid = $sdata->[$ididx]; @@ -2728,7 +2754,7 @@ sub print_viewclass_response { } } foreach my $student (@lockchglist) { - my ($uname,$udom) = split/:/,$student; + my ($uname,$udom) = split(/:/,$student); my $sdata = $classlist->{$student}; my $section = $sdata->[$secidx]; my $uid = $sdata->[$ididx]; @@ -2757,31 +2783,31 @@ sub print_viewclass_response { } } if ($chgtotal > 0) { - $response = "You requested a change in enrollment type for $chgtotal students.

\n"; + $response = &mt('You requested a change in enrollment type for [quant,_1,student].',$chgtotal).'

'."\n"; $classlist = &Apache::loncoursedata::get_classlist($dom,$crs); if ($chgok > 0) { - $response .= "The following $chgok changes were successful:
"; + $response .= &mt('The following [quant,_1,change was,changes were] successful;',$chgtotal).':

'; $response .= &enrolltype_result(\%chg,$classlist,$endidx,$startidx,$ididx,$secidx,$typeidx); } if ($chgfail > 0) { - $response .= "The following $chgfail students were not modified successfully: 
"; + $response .= &mt('The following [quant,_1,student was,students were] not modified successfully',$chgfail).': 
'; $response .= &enrolltype_result(\%nochg,$classlist,$endidx,$startidx,$ididx,$secidx,$typeidx); } if ($othdom > 0) { - $response .= "The following $othdom students were not modified because students must be in the same LON-CAPA domain as the course, in order to be set to an enrollment type of 'auto':
"; + $response .= &mt("The following [quant,_1,student was,students were] not modified because students must be in the same LON-CAPA domain as the course, in order to be set to an enrollment type of 'auto'",$othdom).':
'; $response .= &enrolltype_result(\%otherdom,$classlist,$endidx,$startidx,$ididx,$secidx,$typeidx); } $response .= "

"; } if ($locktotal > 0) { - $response .= "You requested locking/unlocking for $locktotal manually enrolled students.

\n"; + $response .= &mt('You requested locking/unlocking for [quant,_1,manually enrolled student]',$locktotal).'

'."\n"; $classlist = &Apache::loncoursedata::get_classlist($dom,$crs); if ($lockok > 0) { - $response .= "The following $lockok changes were successful:
"; + $response .= &mt('The following [quant,_1,change was,changes were] successful',$lockok).':

'; $response .= &enrolltype_result(\%lockchg,$classlist,$endidx,$startidx,$ididx,$secidx,$typeidx,$lockedidx); } if ($lockfail > 0) { - $response .= "The following $lockfail students were not modified successfully: 
"; + $response .= &mt('The following [quant,_1,student was,students were] not modified successfully',$lockfail).': 
'; $response .= &enrolltype_result(\%nolockchg,$classlist,$endidx,$startidx,$ididx,$secidx,$typeidx,$lockedidx); } } @@ -2791,9 +2817,8 @@ sub print_viewclass_response { sub enrolltype_result { my ($changes,$classlist,$endidx,$startidx,$ididx,$secidx,$typeidx,$lockedidx) = @_; - my $reply = " - - + my $reply = &Apache::loncommon::start_data_table(). + &Apache::loncommon::start_data_table_header_row().' @@ -2801,11 +2826,11 @@ sub enrolltype_result { - - "; - foreach (sort keys %{$changes}) { - my $sdata = $classlist->{$_}; - my ($uname,$udom) = split/:/,$_; + '."\n". + &Apache::loncommon::end_data_table_header_row(); + foreach my $chg (sort keys %{$changes}) { + my $sdata = $classlist->{$chg}; + my ($uname,$udom) = split(/:/,$chg); my $section = $sdata->[$secidx]; my $uid = $sdata->[$ididx]; my $start = $sdata->[$startidx]; @@ -2822,24 +2847,23 @@ sub enrolltype_result { $end = &Apache::lonlocal::locallocaltime($end); } if (!defined($section) || ($section eq '')) { - $section eq ' '; + $section = ' '; } if (!defined($uid) || ($uid eq '')) { - $uid = ' '; + $uid = ' '; } - $reply .= " - - - - - - - - - - "; + $reply .= &Apache::loncommon::start_data_table_row().' + + + + + + + + '."\n". + &Apache::loncommon::end_data_table_row(); } - $reply .= "
username domain IDsection start date end dateenrollment change
enrollment change
$uname$udom$uid".&Apache::loncommon::plainname($uname,$udom)."$section$start$end$$changes{$_}
'.$uname.''.$udom.''.$uid.''.&Apache::loncommon::plainname($uname,$udom).''.$section.''.$start.''.$end.''.$$changes{$chg}.'
"; + $reply .= &Apache::loncommon::end_data_table(); return $reply; }