version 1.34, 2006/02/07 05:08:32
|
version 1.35, 2006/02/07 16:21:26
|
Line 1022 Note: Any students previously added manu
|
Line 1022 Note: Any students previously added manu
|
</td> |
</td> |
</tr><tr><td>"); |
</tr><tr><td>"); |
if ($enrollvar{'showphotos'}) { |
if ($enrollvar{'showphotos'}) { |
my ($update,$commentary) = &Apache::lonnet::auto_photochoice( |
my ($update,$commentary) = &Apache::lonnet::auto_photochoice($crs, |
$crs,$dom); |
$dom); |
$r->print('<br />'.$commentary.'<br /><br /> |
$r->print('<br />'.$commentary.'<br /><br /> |
<form name="photoupdate" method="post"> |
<form name="photoupdate" method="post"> |
<input type ="button" name="retrieve" value="'.&mt('Update photo repository').'" |
<input type ="button" name="retrieve" value="'.&mt('Update photo repository').'" |
Line 2111 sub print_sections_response () {
|
Line 2111 sub print_sections_response () {
|
|
|
sub photo_permission { |
sub photo_permission { |
my ($r,$realm,$dom,$crs,$action,$tasktitleref) = @_; |
my ($r,$realm,$dom,$crs,$action,$tasktitleref) = @_; |
my %settings = &Apache::lonnet::get('environment',['internal.courseowner', |
my %settings = &Apache::lonnet::get('environment', |
'internal.photopermission','internal.showphotos'],$dom,$crs); |
['internal.courseowner', |
|
'internal.photopermission', |
|
'internal.showphotos'], |
|
$dom,$crs); |
my ($showphotos,$response); |
my ($showphotos,$response); |
if (exists($env{'form.cancel_agreement'})) { |
if (exists($env{'form.cancel_agreement'})) { |
if ($env{'user.name'} eq $settings{'internal.courseowner'}) { |
if ($env{'user.name'} eq $settings{'internal.courseowner'}) { |
Line 2143 sub photo_permission {
|
Line 2146 sub photo_permission {
|
$response = &mt('There was a problem processing the record of your agreement to the conditions of use. Settings for this course have been left unchanged.').'<br/>'."\n"; |
$response = &mt('There was a problem processing the record of your agreement to the conditions of use. Settings for this course have been left unchanged.').'<br/>'."\n"; |
} else { |
} else { |
&print_photos_response($r,$realm,$dom,$crs,$action, |
&print_photos_response($r,$realm,$dom,$crs,$action, |
$tasktitleref,$showphotos,$env{'form.photopermission'},\%cenv); |
$tasktitleref,$showphotos, |
|
$env{'form.photopermission'},\%cenv); |
} |
} |
} else { |
} else { |
my ($result,$perm_reqd,$conditions) = |
my ($result,$perm_reqd,$conditions) = |
&Apache::lonnet::auto_photo_permission($crs,$dom); |
&Apache::lonnet::auto_photo_permission($crs,$dom); |
my $permcheck; |
my $permcheck; |
if ($result eq 'ok') { |
if ($result eq 'ok') { |
if ($perm_reqd eq 'yes') { |
if ($perm_reqd eq 'yes') { |
if ($settings{'internal.photopermission'} eq 'yes') { |
if ($settings{'internal.photopermission'} eq 'yes') { |
&print_photos_response($r,$realm,$dom,$crs,$action, |
&print_photos_response($r,$realm,$dom,$crs,$action, |
$tasktitleref,$showphotos); |
$tasktitleref,$showphotos); |
} else { |
} else { |
return(&print_photo_agreement($r,$realm,$dom,$crs, |
return(&print_photo_agreement($r,$realm,$dom,$crs, |
$action,$tasktitleref,$conditions, |
$action,$tasktitleref, |
$settings{'internal.courseowner'})); |
$conditions, |
|
$settings{'internal.courseowner'})); |
} |
} |
} elsif ($perm_reqd eq 'no') { |
} elsif ($perm_reqd eq 'no') { |
&print_photos_response($r,$realm,$dom,$crs,$action, |
&print_photos_response($r,$realm,$dom,$crs,$action, |
$tasktitleref,$showphotos); |
$tasktitleref,$showphotos); |
} else { |
} else { |
$permcheck = 'fail'; |
$permcheck = 'fail'; |
} |
} |
Line 2233 function agreement_result(caller) {
|
Line 2238 function agreement_result(caller) {
|
|
|
sub print_photos_response { |
sub print_photos_response { |
my ($r,$realm,$dom,$crs,$action,$tasktitleref,$showphotos,$photopermission, |
my ($r,$realm,$dom,$crs,$action,$tasktitleref,$showphotos,$photopermission, |
$permissionenv)=@_; |
$permissionenv)=@_; |
my %newenv; |
my %newenv; |
if (defined($permissionenv)) { |
if (defined($permissionenv)) { |
foreach my $key (keys(%{$permissionenv})) { |
foreach my $key (keys(%{$permissionenv})) { |
if (exists($env{'request.course.id'})) { |
if (exists($env{'request.course.id'})) { |
$newenv{$env{'request.course.id'}.'.'.$key} = |
$newenv{$env{'request.course.id'}.'.'.$key} = |
$$permissionenv{$key}; |
$$permissionenv{$key}; |
} |
} |
} |
} |
} |
} |
my %settings = &Apache::lonnet::get('environment',['internal.showphotos'], |
my %settings = &Apache::lonnet::get('environment',['internal.showphotos'], |
$dom,$crs); |
$dom,$crs); |
my $currphotos = $settings{'internal.showphotos'}; |
my $currphotos = $settings{'internal.showphotos'}; |
my $response = ""; |
my $response = ""; |
if (defined($photopermission)) { |
if (defined($photopermission)) { |
Line 2265 sub print_photos_response {
|
Line 2270 sub print_photos_response {
|
$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/>"; |
my ($update,$commentary) = &Apache::lonnet::auto_photochoice( |
my ($update,$commentary) = |
$crs,$dom); |
&Apache::lonnet::auto_photochoice($crs,$dom); |
if ($update) { |
if ($update) { |
$response .= '<br />'.$commentary.'<br /><br /> |
$response .= '<br />'.$commentary.'<br /><br /> |
<form name="photoupdate" method="post"> |
<form name="photoupdate" method="post"> |
Line 2287 onclick="javascript:document.photoupdate
|
Line 2292 onclick="javascript:document.photoupdate
|
foreach my $key (keys(%cenv)) { |
foreach my $key (keys(%cenv)) { |
if (exists($env{'request.course.id'})) { |
if (exists($env{'request.course.id'})) { |
$newenv{'course.'.$env{'request.course.id'}.'.'.$key} = |
$newenv{'course.'.$env{'request.course.id'}.'.'.$key} = |
$cenv{$key}; |
$cenv{$key}; |
} |
} |
} |
} |
} |
} |
Line 2303 sub print_photoupdate_response {
|
Line 2308 sub print_photoupdate_response {
|
my $response; |
my $response; |
my %changes; |
my %changes; |
my %lt = &LONCAPA::Enrollment::photo_response_types(); |
my %lt = &LONCAPA::Enrollment::photo_response_types(); |
my %settings = &Apache::lonnet::get('environment',['internal.coursecode', |
my %settings = &Apache::lonnet::get('environment', |
'internal.sectionnums','internal.crosslistings'],$dom,$crs); |
['internal.coursecode', |
|
'internal.sectionnums', |
|
'internal.crosslistings'], |
|
$dom,$crs); |
my @allcourses = (); |
my @allcourses = (); |
my %LC_code; |
my %LC_code; |
my %affiliates; |
my %affiliates; |
Line 2315 sub print_photoupdate_response {
|
Line 2323 sub print_photoupdate_response {
|
$outcome = &Apache::lonnet::auto_photoupdate(\%affiliates,$dom,$crs,\%changes); |
$outcome = &Apache::lonnet::auto_photoupdate(\%affiliates,$dom,$crs,\%changes); |
unless ($outcome eq 'ok') { |
unless ($outcome eq 'ok') { |
&Apache::lonnet::logthis("lonpopulate::print_photoupdate_response". |
&Apache::lonnet::logthis("lonpopulate::print_photoupdate_response". |
"failed to update student photos". |
"failed to update student photos". |
" for ".$crs."\@".$dom." by ". |
" for ".$crs."\@".$dom." by ". |
$env{'user.name'}." \@ ".$env{'user.domain'}. |
$env{'user.name'}." \@ ".$env{'user.domain'}. |
": ".$outcome); |
": ".$outcome); |
} |
} |
if ($outcome eq 'ok') { |
if ($outcome eq 'ok') { |
if (keys(%changes) > 0) { |
if (keys(%changes) > 0) { |
Line 2336 function photowindow(photolink) {
|
Line 2344 function photowindow(photolink) {
|
my @usernames = sort(split(/\&/,$changes{$type})); |
my @usernames = sort(split(/\&/,$changes{$type})); |
my $count = @usernames; |
my $count = @usernames; |
$response .= '<b>'.&mt('For [_1] students, photos ', |
$response .= '<b>'.&mt('For [_1] students, photos ', |
$count).$lt{$type}.'</b><ul>'; |
$count).$lt{$type}.'</b><ul>'; |
foreach my $username (@usernames) { |
foreach my $username (@usernames) { |
$response .= '<li>'.$username; |
$response .= '<li>'.$username; |
if (($type eq 'new') || ($type eq 'same') || ($type eq 'update')) { |
if (($type eq 'new') || ($type eq 'same') || ($type eq 'update')) { |
Line 2365 sub get_ownerinfo {
|
Line 2373 sub get_ownerinfo {
|
if ($owner) { |
if ($owner) { |
$ownername=&Apache::loncommon::plainname($owner,$dom,'firstname'); |
$ownername=&Apache::loncommon::plainname($owner,$dom,'firstname'); |
my %ownerinfo = &Apache::lonnet::get('environment','permanentemail', |
my %ownerinfo = &Apache::lonnet::get('environment','permanentemail', |
$dom,$owner); |
$dom,$owner); |
$owneremail = $ownerinfo{'permanentemail'}; |
$owneremail = $ownerinfo{'permanentemail'}; |
} |
} |
return ($ownername,$owneremail); |
return ($ownername,$owneremail); |