--- loncom/interface/lonpopulate.pm 2005/04/07 06:56:23 1.23 +++ loncom/interface/lonpopulate.pm 2006/02/09 00:40:19 1.38 @@ -1,5 +1,5 @@ # automated enrollment configuration handler -# $Id: lonpopulate.pm,v 1.23 2005/04/07 06:56:23 albertel Exp $ +# $Id: lonpopulate.pm,v 1.38 2006/02/09 00:40:19 raeburn Exp $ # # Copyright Michigan State University Board of Trustees # @@ -151,27 +151,8 @@ function process(calling,numauto,nummanu } |; if ($action eq 'viewclass') { + $scripttag .= &Apache::loncommon::check_uncheck_jscript(); $scripttag .= qq| -function checkAll(field) { - if (field.length > 0) { - for (i = 0; i < field.length; i++) { - field[i].checked = true ; - } - } else { - field.checked = true - } -} - -function uncheckAll(field) { - if (field.length > 0) { - for (i = 0; i < field.length; i++) { - field[i].checked = false ; - } - } else { - field.checked = false ; - } -} - function countChecked(field) { var count = 0; if (field.length > 0) { @@ -331,7 +312,7 @@ sub print_main_frame { Use "Section settings" to make changes to the choice of sections included for enrollment in your LON-CAPA course.   - Use "Student photos" to enable or disable automatic upload of student photos to your course. + Use "Student photos settings" to enable or disable automatic import of photos for registered students in your course.   @@ -339,6 +320,10 @@ sub print_main_frame {   + Use "Update student photos" to import your institution's most current digital photos for registered students in your course. + + +   Use "View students and change type" to display the current course roster, and (optionally) change enrollment type for selected students from 'auto' to 'manual' and vice versa. @@ -504,15 +489,10 @@ ENDTWO ENDTWO } elsif ($action eq "notify") { - my @notified = (); - if ($enrollvar{notifylist} =~ m/,/) { - @notified = split/,/,$enrollvar{notifylist}; - } else { - @notified = $enrollvar{notifylist}; - } my $notifycount = 0; + my @notified = split(/,/,$enrollvar{notifylist}); foreach (@notified) { - unless ($_ eq '') { $notifycount ++; } + unless ($_ eq '') { $notifycount ++; } } my $noteset = ''; if ($notifycount) { @@ -559,8 +539,8 @@ ENDTWO my @roleinfo = split/:/,$_; if ($roleinfo[0] eq 'cc') { unless (grep/^$roleinfo[1]\@$roleinfo[2]/,@ccs) { - my $active_cc = &LONCAPA::Enrollment::check_user_status($roleinfo[2],$roleinfo[1],$dom,$crs,'cc'); - if ($active_cc eq 'ok') { + my $active_cc = &Apache::loncommon::check_user_status($roleinfo[2],$roleinfo[1],$dom,$crs,'cc'); + if ($active_cc eq 'active') { push @ccs, "$roleinfo[1]\@$roleinfo[2]"; $pname{"$roleinfo[1]\@$roleinfo[2]"} = &Apache::loncommon::plainname($roleinfo[1],$roleinfo[2]); if (grep/^$roleinfo[1]\@$roleinfo[2]$/,@notified) { @@ -657,11 +637,9 @@ ENDTWO "); } elsif ($action eq "crosslist") { - my @xlists = (); - if ($enrollvar{crosslistings} =~ m/,/) { - @xlists = split/,/,$enrollvar{crosslistings}; - } elsif ($enrollvar{crosslistings} ne '') { - $xlists[0] = $enrollvar{crosslistings}; + my @xlists; + if ($enrollvar{crosslistings} ne '') { + @xlists = split(/,/,$enrollvar{crosslistings}); } my $cross_str = @xlists; $r->print(" @@ -690,7 +668,7 @@ ENDTWO for (my $i=0; $i<@xlists; $i++) { my $xl = ' '; my $gp = ' '; - if ($xlists[$i] =~ /(\w+):?(.*)$/) { + if ($xlists[$i] =~ /^([^:]+):?(.*)$/) { $xl = $1; $gp = $2; } @@ -742,14 +720,9 @@ ENDTWO } elsif ($action eq "sections") { my @sections = (); @sections = &Apache::lonnet::auto_get_sections($crs,$dom,$enrollvar{coursecode}); - my @storedsections = (); + my @storedsections = split(/,/,$enrollvar{sectionnums}); my @currsections = (); my %sec_id = (); - if ($enrollvar{sectionnums} =~ m/,/) { - @storedsections = split/,/,$enrollvar{sectionnums}; - } else { - $storedsections[0] = $enrollvar{sectionnums}; - } foreach (@storedsections) { if ($_ =~ m/^(\w+):(\w*)$/) { push @currsections, $1; @@ -893,7 +866,7 @@ your changes.
$$tasktitleref{$action}
- Currently: Student photo import: $photosets[$enrollvar{showphotos}] + Currently: Student photo import: $photosets[$enrollvar{showphoto}]
@@ -903,7 +876,7 @@ your changes. Automatic import of student photos from institutional data repository:   "); - if ($enrollvar{showphotos}) { + if ($enrollvar{showphoto}) { $r->print("  Yes     No @@ -914,29 +887,91 @@ your changes.  No "); } - $r->print(" + $r->print(' + '); + my ($result,$perm_reqd)=&Apache::lonnet::auto_photo_permission($crs,$dom); + my $can_enable = 1; + my $institution = $Apache::lonnet::domaindescription{$dom}; + if ($result eq 'ok') { + if ($perm_reqd eq 'yes') { + if (!($enrollvar{'photopermission'} eq 'yes')) { + $can_enable = 0; + } else { + if ($env{'user.name'} eq $enrollvar{'courseowner'}) { + $r->print(' + + '. +&mt('Previously the owner of this course agreed to the conditions of use of digital student photos required by [_1].', $institution).'
'.&mt('As a result Course Coordinators can choose to automatically import student photos into this course.').'
+ + + '); + } + } + } + } else { + $r->print(' + + '. +&mt('There was a problem determining whether course owner permission is required in order for a course coordinator to have access to student photos in this domain.').' '.&mt('As a result you will not be able to configure access to student photos at this time').'

+ + + + '); + return; + } + if ($can_enable) { + $r->print(' - -Note: if you enable automatic import of student photos, your course will automatically have access to photos stored by your institution for all 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 stored by your institution for officially registered students, via a conduit established by your LON-CAPA domain coordinator.').' +'); + } else { + if ($env{'user.name'} eq $enrollvar{'courseowner'}) { + $r->print(' + + '. +&mt('[_1] requires a course owner to indicate acceptance of conditions of use of digital student photos before enabling automatic import into a course. If you choose to enable import of photos you will be prompted for your agreement on the next page.',$institution).' + + + '); + } else { + my ($ownername,$owneremail) = &get_ownerinfo($dom, + $enrollvar{'courseowner'}); + my $emailstr; + if ($owneremail) { + $emailstr = "(e-mail: $owneremail)"; + } + $r->print(' + + '. +&mt('The policies of your institution [_1] require that the course owner [_2] must indicate acceptance of the conditions of use of digital photos of registered students, before they may be made available for use in a course.',$institution,$ownername).'

'.&mt('Please direct the course owner [_1] to visit the "Student photos" page in the Automated Enrollment Manager to indicate acceptance of these conditions of use.',$emailstr).'

+ + + + '); + return; + } + } + $r->print('   - - + + - - + + - "); + '); } elsif ($action eq "updatenow") { $r->print("

@@ -983,6 +1018,29 @@ Note: Any students previously added manu
"); + } elsif ($action eq 'updatephotos') { + $r->print(" + + + + + +
$$tasktitleref{$action} +
"); + if ($enrollvar{'showphoto'}) { + my ($update,$commentary) = &Apache::lonnet::auto_photochoice($crs, + $dom); + $r->print('
'.$commentary.'

+
+ + + +
'); + } else { + $r->print('Update of photos is unavailable, as import of student photos is currently disabled.
Enable this first via: '.$$tasktitleref{'photos'}.''); + } + $r->print('
 
'); } elsif ($action eq 'viewclass') { $r->print("

@@ -1507,18 +1565,13 @@ sub print_notify_response { my %settings = &Apache::lonnet::get('environment',['internal.notifylist','internal.coursecode'],$dom,$crs); my $notifylist = $settings{'internal.notifylist'}; my $coursecode = $settings{'internal.coursecode'}; - my @currpeople = (); + my @currpeople = split(/,/,$notifylist); my $notify = 0; my @people = (); my $peoplestr = ""; my $response = ""; my $noprocess = 0; - if ($notifylist =~ m/,/) { - @currpeople = split/,/,$notifylist; - } else { - $currpeople[0] = $notifylist; - } my $currcount = 0; foreach (@currpeople) { unless ($_ eq '') { $currcount ++; } @@ -1593,10 +1646,8 @@ sub print_crosslistings_menu () { my $xliststr = ''; my $response = ''; my $coursecode = $settings{'internal.coursecode'}; - if ($settings{'internal.crosslistings'} =~ m/,/) { - @currxlists = split/,/,$settings{'internal.crosslistings'}; - } elsif ($settings{'internal.crosslistings'} ne '') { - $currxlists[0] = $settings{'internal.crosslistings'}; + if ($settings{'internal.crosslistings'} ne '') { + @currxlists = split(/,/,$settings{'internal.crosslistings'}); } if (@currxlists > 0) { @@ -1619,11 +1670,8 @@ sub print_crosslistings_menu () { } } - if ($crosscount > 1) { - $xliststr = join(",",@xlists); - } else { - $xliststr = $xlists[0]; - } + $xliststr = join(",",@xlists); + my %cenv = ('internal.crosslistings' => $xliststr); my $reply = &Apache::lonnet::put('environment',\%cenv,$dom,$crs); if ($reply !~ /^ok$/) { @@ -1701,10 +1749,8 @@ sub print_crosslistings_response () { my $warning = ''; my $warn_prefix = ''; - if ($xliststr =~ m/,/) { - @allxlists = split/,/,$xliststr; - } else { - unless ($xliststr eq '') { $allxlists[0] = $xliststr; } + if ($xliststr ne '') { + @allxlists = split(/,/,$xliststr); } if ( exists($env{'form.numcross'}) ) { @@ -1736,11 +1782,8 @@ sub print_crosslistings_response () { if (@xlists > 0 ) { unless ($xliststr eq '') { $xliststr .= ","; } - if (@xlists > 1) { - $xliststr .= join(",",@xlists); - } else { - $xliststr .= $xlists[0]; - } + $xliststr .= join(",",@xlists); + my %cenv = ('internal.crosslistings' => $xliststr); my $reply = &Apache::lonnet::put('environment',\%cenv,$dom,$crs); if ($reply !~ /^ok$/) { @@ -1755,12 +1798,7 @@ sub print_crosslistings_response () { } } else { if ($xliststr =~ m/:/) { - my @oldxlists = (); - if ($xliststr =~ m/,/) { - @oldxlists = split/,/,$xliststr; - } else { - $oldxlists[0] = $xliststr; - } + my @oldxlists = (split/,/,$xliststr); $response .= "Although no new crosslistings were added, the courses listed below continue to be crosslisted with your LON-CAPA course.