--- loncom/interface/lonpopulate.pm 2006/07/28 01:04:45 1.45 +++ 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.45 2006/07/28 01:04:45 raeburn 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; @@ -113,30 +114,28 @@ function process(calling,numauto,nummanu } if (calling == "notify") { var totalnote = 0; - if (formName.notify[1].checked = true) { - for (var i=0; i 0) { - if (formName.notify[1].checked = true) { - if (confirm("You have indicated that you do not want notification of roster changes messages to be sent, but "+totalnote+" have been checked as recipients.\\nClick 'OK' to erase all recipients, or 'Cancel'.")) { - checker = 1; - } else { - checker = 0; - } - } - } else { - if (formName.notify[0].checked = true) { - alert("You have indicated that you want notification of roster changes messages to be sent, but you have not selected any recipients."); - checker = 0; - } - } + for (var i=0; i 0) { + if (formName.notify[1].checked == true) { + if (confirm("You have indicated that you do not want notification of roster changes messages to be sent, but "+totalnote+" have been checked as recipients.\\nClick 'OK' to erase all recipients, or 'Cancel'.")) { + checker = 1; + } else { + checker = 0; + } + } + } else { + if (formName.notify[0].checked == true) { + alert("You have indicated that you want notification of roster changes messages to be sent, but you have not selected any recipients."); + checker = 0; + } } } if (calling == "viewclass") { @@ -227,7 +226,7 @@ sub print_mainbox { - +
- $realm -> Enrollment Manager -> $page
+ $realm -> User Management -> $page
Automated Enrollment Manager  @@ -675,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.")."
@@ -709,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.
@@ -795,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.

@@ -856,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. @@ -946,19 +944,13 @@ your changes. '); my ($result,$perm_reqd)=&Apache::lonnet::auto_photo_permission($crs,$dom); my $can_enable = 1; - my $institution = $Apache::lonnet::domaindescription{$dom}; - my $user; - if ($enrollvar{'courseowner'} =~ /^[^:]+:[^:]+$/) { - $user = $env{'user.name'}.':'.$env{'user.domain'}; - } else { - $user = $env{'user.name'}; - } + my $institution = &Apache::lonnet::domain($dom,'description'); if ($result eq 'ok') { if ($perm_reqd eq 'yes') { if (!($enrollvar{'photopermission'} eq 'yes')) { $can_enable = 0; } else { - if ($user eq $enrollvar{'courseowner'}) { + if (&user_is_courseowner($enrollvar{'courseowner'})) { $r->print(' '. @@ -985,13 +977,13 @@ 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.').' '); } else { - if ($user eq $enrollvar{'courseowner'}) { + if (&user_is_courseowner($enrollvar{'courseowner'})) { $r->print(' '. @@ -1125,21 +1117,39 @@ onclick="javascript:document.photoupdate if (! exists($env{'form.sortby'})) { $env{'form.sortby'} = 'username'; } - if ($env{'form.Status'} !~ /^(Any|Expired|Active)$/) { + if ($env{'form.Status'} !~ /^(Any|Expired|Active|Future)$/) { $env{'form.Status'} = 'Active'; } 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(" @@ -1194,6 +1204,14 @@ END "); + } else { + $r->print(' + +
+ '.&mt('There are no students with the selected status.').' + + + '); } $r->print(" @@ -1795,7 +1813,7 @@ sub print_crosslistings_menu () { if ($numcross > 0) { my @bgcolors=("#eeeeee","#cccccc"); $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 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 ID can be left blank, if you do not wish to tie a section 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.

-
); + ); #' stupid emacs $response .= &Apache::loncommon::start_data_table(); $response .= &Apache::loncommon::start_data_table_row(); $response .= qq( @@ -2285,7 +2303,7 @@ sub photo_permission { $dom,$crs); my ($showphotos,$response); if (exists($env{'form.cancel_agreement'})) { - if ($env{'user.name'} eq $settings{'internal.courseowner'}) { + if (&user_is_courseowner($settings{'internal.courseowner'})) { my %cenv = ( 'internal.photopermission' => 'no', ); @@ -2354,8 +2372,8 @@ sub photo_permission { sub print_photo_agreement { my ($r,$realm,$dom,$crs,$action,$tasktitleref,$conditions,$courseowner)=@_; my $response; - my $institution = $Apache::lonnet::domaindescription{$dom}; - if ($env{'user.name'} eq $courseowner) { + my $institution = &Apache::lonnet::domain($dom,'description'); + if (&user_is_courseowner($courseowner)) { $response = '