version 1.25, 2005/09/14 21:25:52
|
version 1.38, 2006/02/09 00:40:19
|
Line 312 sub print_main_frame {
|
Line 312 sub print_main_frame {
|
<td>Use <i>"Section settings"</i> to make changes to the choice of sections included for enrollment in your LON-CAPA course.</td> |
<td>Use <i>"Section settings"</i> to make changes to the choice of sections included for enrollment in your LON-CAPA course.</td> |
</tr> |
</tr> |
<td> </td> |
<td> </td> |
<td>Use <i>"Student photos"</i> to enable or disable automatic upload of student photos to your course.</td> |
<td>Use <i>"Student photos settings"</i> to enable or disable automatic import of photos for registered students in your course.</td> |
</tr> |
</tr> |
<tr> |
<tr> |
<td> </td> |
<td> </td> |
Line 320 sub print_main_frame {
|
Line 320 sub print_main_frame {
|
</tr> |
</tr> |
<tr> |
<tr> |
<td> </td> |
<td> </td> |
|
<td>Use <i>"Update student photos"</i> to import your institution's <b>most current</b> digital photos for registered students in your course.</td> |
|
</tr> |
|
<tr> |
|
<td> </td> |
<td>Use <i>"View students and change type"</i> to display the current course roster, and (optionally) change enrollment type for selected students from 'auto' to 'manual' and vice versa.</td> |
<td>Use <i>"View students and change type"</i> to display the current course roster, and (optionally) change enrollment type for selected students from 'auto' to 'manual' and vice versa.</td> |
</tr> |
</tr> |
<tr> |
<tr> |
Line 485 ENDTWO
|
Line 489 ENDTWO
|
</form> |
</form> |
ENDTWO |
ENDTWO |
} elsif ($action eq "notify") { |
} elsif ($action eq "notify") { |
my @notified = (); |
|
if ($enrollvar{notifylist} =~ m/,/) { |
|
@notified = split/,/,$enrollvar{notifylist}; |
|
} else { |
|
@notified = $enrollvar{notifylist}; |
|
} |
|
my $notifycount = 0; |
my $notifycount = 0; |
|
my @notified = split(/,/,$enrollvar{notifylist}); |
foreach (@notified) { |
foreach (@notified) { |
unless ($_ eq '') { $notifycount ++; } |
unless ($_ eq '') { $notifycount ++; } |
} |
} |
my $noteset = ''; |
my $noteset = ''; |
if ($notifycount) { |
if ($notifycount) { |
Line 540 ENDTWO
|
Line 539 ENDTWO
|
my @roleinfo = split/:/,$_; |
my @roleinfo = split/:/,$_; |
if ($roleinfo[0] eq 'cc') { |
if ($roleinfo[0] eq 'cc') { |
unless (grep/^$roleinfo[1]\@$roleinfo[2]/,@ccs) { |
unless (grep/^$roleinfo[1]\@$roleinfo[2]/,@ccs) { |
my $active_cc = &LONCAPA::Enrollment::check_user_status($roleinfo[2],$roleinfo[1],$dom,$crs,'cc'); |
my $active_cc = &Apache::loncommon::check_user_status($roleinfo[2],$roleinfo[1],$dom,$crs,'cc'); |
if ($active_cc eq 'ok') { |
if ($active_cc eq 'active') { |
push @ccs, "$roleinfo[1]\@$roleinfo[2]"; |
push @ccs, "$roleinfo[1]\@$roleinfo[2]"; |
$pname{"$roleinfo[1]\@$roleinfo[2]"} = &Apache::loncommon::plainname($roleinfo[1],$roleinfo[2]); |
$pname{"$roleinfo[1]\@$roleinfo[2]"} = &Apache::loncommon::plainname($roleinfo[1],$roleinfo[2]); |
if (grep/^$roleinfo[1]\@$roleinfo[2]$/,@notified) { |
if (grep/^$roleinfo[1]\@$roleinfo[2]$/,@notified) { |
Line 638 ENDTWO
|
Line 637 ENDTWO
|
</form> |
</form> |
"); |
"); |
} elsif ($action eq "crosslist") { |
} elsif ($action eq "crosslist") { |
my @xlists = (); |
my @xlists; |
if ($enrollvar{crosslistings} =~ m/,/) { |
if ($enrollvar{crosslistings} ne '') { |
@xlists = split/,/,$enrollvar{crosslistings}; |
@xlists = split(/,/,$enrollvar{crosslistings}); |
} elsif ($enrollvar{crosslistings} ne '') { |
|
$xlists[0] = $enrollvar{crosslistings}; |
|
} |
} |
my $cross_str = @xlists; |
my $cross_str = @xlists; |
$r->print(" |
$r->print(" |
Line 671 ENDTWO
|
Line 668 ENDTWO
|
for (my $i=0; $i<@xlists; $i++) { |
for (my $i=0; $i<@xlists; $i++) { |
my $xl = ' '; |
my $xl = ' '; |
my $gp = ' '; |
my $gp = ' '; |
if ($xlists[$i] =~ /(\w+):?(.*)$/) { |
if ($xlists[$i] =~ /^([^:]+):?(.*)$/) { |
$xl = $1; |
$xl = $1; |
$gp = $2; |
$gp = $2; |
} |
} |
Line 723 ENDTWO
|
Line 720 ENDTWO
|
} elsif ($action eq "sections") { |
} elsif ($action eq "sections") { |
my @sections = (); |
my @sections = (); |
@sections = &Apache::lonnet::auto_get_sections($crs,$dom,$enrollvar{coursecode}); |
@sections = &Apache::lonnet::auto_get_sections($crs,$dom,$enrollvar{coursecode}); |
my @storedsections = (); |
my @storedsections = split(/,/,$enrollvar{sectionnums}); |
my @currsections = (); |
my @currsections = (); |
my %sec_id = (); |
my %sec_id = (); |
if ($enrollvar{sectionnums} =~ m/,/) { |
|
@storedsections = split/,/,$enrollvar{sectionnums}; |
|
} else { |
|
$storedsections[0] = $enrollvar{sectionnums}; |
|
} |
|
foreach (@storedsections) { |
foreach (@storedsections) { |
if ($_ =~ m/^(\w+):(\w*)$/) { |
if ($_ =~ m/^(\w+):(\w*)$/) { |
push @currsections, $1; |
push @currsections, $1; |
Line 874 your changes.</td>
|
Line 866 your changes.</td>
|
<table width=\"100%\" border=\"0\" cellpadding=\"2\" cellspacing=\"2\"> |
<table width=\"100%\" border=\"0\" cellpadding=\"2\" cellspacing=\"2\"> |
<tr> |
<tr> |
<td align=\"left\"><b>$$tasktitleref{$action}</b><br/> |
<td align=\"left\"><b>$$tasktitleref{$action}</b><br/> |
Currently: Student photo import: <i>$photosets[$enrollvar{showphotos}]</i> |
Currently: Student photo import: <i>$photosets[$enrollvar{showphoto}]</i> |
</td> |
</td> |
</tr> |
</tr> |
</table> |
</table> |
Line 884 your changes.</td>
|
Line 876 your changes.</td>
|
Automatic import of student photos from institutional data repository: |
Automatic import of student photos from institutional data repository: |
|
|
"); |
"); |
if ($enrollvar{showphotos}) { |
if ($enrollvar{showphoto}) { |
$r->print(" |
$r->print(" |
<input type=\"radio\" name=\"showphotos\" value=\"1\" checked=\"true\" /> Yes |
<input type=\"radio\" name=\"showphotos\" value=\"1\" checked=\"true\" /> Yes |
<input type=\"radio\" name=\"showphotos\" value=\"0\" /> No |
<input type=\"radio\" name=\"showphotos\" value=\"0\" /> No |
Line 895 your changes.</td>
|
Line 887 your changes.</td>
|
<input type=\"radio\" name=\"showphotos\" value=\"0\" checked=\"true\" /> No |
<input type=\"radio\" name=\"showphotos\" value=\"0\" checked=\"true\" /> No |
"); |
"); |
} |
} |
$r->print(" |
$r->print(' |
</td> |
</td> |
</tr> |
</tr> |
|
'); |
|
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(' |
|
<tr> |
|
<td>'. |
|
&mt('Previously the owner of this course agreed to the conditions of use of digital student photos required by [_1].', $institution).'<br />'.&mt('As a result Course Coordinators can choose to automatically import student photos into this course.').'<br /><nobr><label>'.&mt('[_1] owner acceptance of these conditions of use?','<b>Cancel</b>').' <input type="checkbox" name="cancel_agreement" value="1" /></label></nobr> |
|
</td> |
|
</tr> |
|
'); |
|
} |
|
} |
|
} |
|
} else { |
|
$r->print(' |
|
<tr> |
|
<td>'. |
|
&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').'<br /><br /><input type="button" name=mainmenu" value="Go back" onclick="javascript:history.go(-1);" /> |
|
</td> |
|
</tr> |
|
</form> |
|
'); |
|
return; |
|
} |
|
if ($can_enable) { |
|
$r->print(' |
<tr> |
<tr> |
<td> |
<td> |
<font color=\"#888888\"> |
<font color="#888888">'. |
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.').' |
</font> |
</font> |
</td> |
</td> |
</tr> |
</tr> |
|
'); |
|
} else { |
|
if ($env{'user.name'} eq $enrollvar{'courseowner'}) { |
|
$r->print(' |
|
<tr> |
|
<td>'. |
|
&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).' |
|
</td> |
|
</tr> |
|
'); |
|
} else { |
|
my ($ownername,$owneremail) = &get_ownerinfo($dom, |
|
$enrollvar{'courseowner'}); |
|
my $emailstr; |
|
if ($owneremail) { |
|
$emailstr = "(e-mail: $owneremail)"; |
|
} |
|
$r->print(' |
|
<tr> |
|
<td>'. |
|
&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).'<br /><br />'.&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).'<br /><br /><input type="button" name=mainmenu" value="Go back" onclick="javascript:history.go(-1);" /> |
|
</td> |
|
</tr> |
|
</form> |
|
'); |
|
return; |
|
} |
|
} |
|
$r->print(' |
<tr> |
<tr> |
</td> </td> |
</td> </td> |
</tr> |
</tr> |
<tr> |
<tr> |
<td align=\"right\"> |
<td align="right"> |
<input type=\"button\" name=\"showphotos\" value=\"Go\" onClick=\"process('photos')\"> |
<input type="button" name="showphotos" value="Go" onClick="process('."'photos'".')"> |
</td> |
</td> |
</tr> |
</tr> |
</table> |
</table> |
<input type=\"hidden\" name=\"action\" value=\"$action\"> |
<input type="hidden" name="action" value="'.$action.'"> |
<input type=\"hidden\" name=\"state\" value=\"process\"> |
<input type="hidden" name="state" value="process"> |
</form> |
</form> |
"); |
'); |
} elsif ($action eq "updatenow") { |
} elsif ($action eq "updatenow") { |
$r->print(" |
$r->print(" |
<form name=\"enter\" method=\"post\"><br/> |
<form name=\"enter\" method=\"post\"><br/> |
Line 964 Note: Any students previously added manu
|
Line 1018 Note: Any students previously added manu
|
<input type=\"hidden\" name=\"state\" value=\"process\" /> |
<input type=\"hidden\" name=\"state\" value=\"process\" /> |
</form> |
</form> |
"); |
"); |
|
} elsif ($action eq 'updatephotos') { |
|
$r->print(" |
|
<table width=\"100%\" border=\"0\" cellpadding=\"2\" cellspacing=\"2\"> |
|
<tr> |
|
<td align=\"left\"><b>$$tasktitleref{$action}</b> |
|
</td> |
|
</tr><tr><td>"); |
|
if ($enrollvar{'showphoto'}) { |
|
my ($update,$commentary) = &Apache::lonnet::auto_photochoice($crs, |
|
$dom); |
|
$r->print('<br />'.$commentary.'<br /><br /> |
|
<form name="photoupdate" method="post"> |
|
<input type ="button" name="retrieve" value="'.&mt('Update photo repository').'" |
|
onclick="javascript:document.photoupdate.submit()" /> |
|
<input type ="hidden" name="action" value="'.$action.'" /> |
|
<input type ="hidden" name="state" value="process" /> |
|
</form>'); |
|
} else { |
|
$r->print('Update of photos is unavailable, as import of student photos is currently disabled.<br />Enable this first via: <a href="/adm/populate?action=photos">'.$$tasktitleref{'photos'}.'</a>'); |
|
} |
|
$r->print('</td></tr> |
|
<tr><td> </td></tr> |
|
</table>'); |
} elsif ($action eq 'viewclass') { |
} elsif ($action eq 'viewclass') { |
$r->print(" |
$r->print(" |
<form name=\"studentform\" method=\"post\"><br/> |
<form name=\"studentform\" method=\"post\"><br/> |
Line 1488 sub print_notify_response {
|
Line 1565 sub print_notify_response {
|
my %settings = &Apache::lonnet::get('environment',['internal.notifylist','internal.coursecode'],$dom,$crs); |
my %settings = &Apache::lonnet::get('environment',['internal.notifylist','internal.coursecode'],$dom,$crs); |
my $notifylist = $settings{'internal.notifylist'}; |
my $notifylist = $settings{'internal.notifylist'}; |
my $coursecode = $settings{'internal.coursecode'}; |
my $coursecode = $settings{'internal.coursecode'}; |
my @currpeople = (); |
my @currpeople = split(/,/,$notifylist); |
my $notify = 0; |
my $notify = 0; |
my @people = (); |
my @people = (); |
my $peoplestr = ""; |
my $peoplestr = ""; |
my $response = ""; |
my $response = ""; |
my $noprocess = 0; |
my $noprocess = 0; |
|
|
if ($notifylist =~ m/,/) { |
|
@currpeople = split/,/,$notifylist; |
|
} else { |
|
$currpeople[0] = $notifylist; |
|
} |
|
my $currcount = 0; |
my $currcount = 0; |
foreach (@currpeople) { |
foreach (@currpeople) { |
unless ($_ eq '') { $currcount ++; } |
unless ($_ eq '') { $currcount ++; } |
Line 1574 sub print_crosslistings_menu () {
|
Line 1646 sub print_crosslistings_menu () {
|
my $xliststr = ''; |
my $xliststr = ''; |
my $response = ''; |
my $response = ''; |
my $coursecode = $settings{'internal.coursecode'}; |
my $coursecode = $settings{'internal.coursecode'}; |
if ($settings{'internal.crosslistings'} =~ m/,/) { |
if ($settings{'internal.crosslistings'} ne '') { |
@currxlists = split/,/,$settings{'internal.crosslistings'}; |
@currxlists = split(/,/,$settings{'internal.crosslistings'}); |
} elsif ($settings{'internal.crosslistings'} ne '') { |
|
$currxlists[0] = $settings{'internal.crosslistings'}; |
|
} |
} |
|
|
if (@currxlists > 0) { |
if (@currxlists > 0) { |
Line 1600 sub print_crosslistings_menu () {
|
Line 1670 sub print_crosslistings_menu () {
|
} |
} |
} |
} |
|
|
if ($crosscount > 1) { |
$xliststr = join(",",@xlists); |
$xliststr = join(",",@xlists); |
|
} else { |
|
$xliststr = $xlists[0]; |
|
} |
|
my %cenv = ('internal.crosslistings' => $xliststr); |
my %cenv = ('internal.crosslistings' => $xliststr); |
my $reply = &Apache::lonnet::put('environment',\%cenv,$dom,$crs); |
my $reply = &Apache::lonnet::put('environment',\%cenv,$dom,$crs); |
if ($reply !~ /^ok$/) { |
if ($reply !~ /^ok$/) { |
Line 1682 sub print_crosslistings_response () {
|
Line 1749 sub print_crosslistings_response () {
|
my $warning = ''; |
my $warning = ''; |
my $warn_prefix = ''; |
my $warn_prefix = ''; |
|
|
if ($xliststr =~ m/,/) { |
if ($xliststr ne '') { |
@allxlists = split/,/,$xliststr; |
@allxlists = split(/,/,$xliststr); |
} else { |
|
unless ($xliststr eq '') { $allxlists[0] = $xliststr; } |
|
} |
} |
|
|
if ( exists($env{'form.numcross'}) ) { |
if ( exists($env{'form.numcross'}) ) { |
Line 1717 sub print_crosslistings_response () {
|
Line 1782 sub print_crosslistings_response () {
|
|
|
if (@xlists > 0 ) { |
if (@xlists > 0 ) { |
unless ($xliststr eq '') { $xliststr .= ","; } |
unless ($xliststr eq '') { $xliststr .= ","; } |
if (@xlists > 1) { |
$xliststr .= join(",",@xlists); |
$xliststr .= join(",",@xlists); |
|
} else { |
|
$xliststr .= $xlists[0]; |
|
} |
|
my %cenv = ('internal.crosslistings' => $xliststr); |
my %cenv = ('internal.crosslistings' => $xliststr); |
my $reply = &Apache::lonnet::put('environment',\%cenv,$dom,$crs); |
my $reply = &Apache::lonnet::put('environment',\%cenv,$dom,$crs); |
if ($reply !~ /^ok$/) { |
if ($reply !~ /^ok$/) { |
Line 1736 sub print_crosslistings_response () {
|
Line 1798 sub print_crosslistings_response () {
|
} |
} |
} else { |
} else { |
if ($xliststr =~ m/:/) { |
if ($xliststr =~ m/:/) { |
my @oldxlists = (); |
my @oldxlists = (split/,/,$xliststr); |
if ($xliststr =~ m/,/) { |
|
@oldxlists = split/,/,$xliststr; |
|
} else { |
|
$oldxlists[0] = $xliststr; |
|
} |
|
$response .= "Although no new crosslistings were added, the courses listed below continue to be crosslisted with your LON-CAPA course.<br/><ul>\n"; |
$response .= "Although no new crosslistings were added, the courses listed below continue to be crosslisted with your LON-CAPA course.<br/><ul>\n"; |
foreach (@oldxlists) { |
foreach (@oldxlists) { |
my ($xlist,$gp) = split/:/,$_; |
my ($xlist,$gp) = split/:/,$_; |
Line 1796 sub print_sections_menu () {
|
Line 1853 sub print_sections_menu () {
|
my $warn_prefix = ""; |
my $warn_prefix = ""; |
my $coursecode = $settings{'internal.coursecode'}; |
my $coursecode = $settings{'internal.coursecode'}; |
my $owner = $settings{'internal.courseowner'}; |
my $owner = $settings{'internal.courseowner'}; |
if ($settings{'internal.sectionnums'} =~ m/,/) { |
if ($settings{'internal.sectionnums'} ne '') { |
@currsections = split/,/,$settings{'internal.sectionnums'}; |
@currsections = split(/,/,$settings{'internal.sectionnums'}); |
} elsif ($settings{'internal.sectionnums'} ne '') { |
|
$currsections[0] = $settings{'internal.sectionnums'}; |
|
} |
} |
|
|
if ( exists($env{'form.secshow'}) ) { |
if ( exists($env{'form.secshow'}) ) { |
Line 1866 sub print_sections_menu () {
|
Line 1921 sub print_sections_menu () {
|
} |
} |
} |
} |
|
|
if ($seccount > 1) { |
$secstr = join(",",@sections); |
$secstr = join(",",@sections); |
|
} else { |
|
$secstr = $sections[0]; |
|
} |
|
my %cenv = ('internal.sectionnums' => $secstr); |
my %cenv = ('internal.sectionnums' => $secstr); |
my $reply = &Apache::lonnet::put('environment',\%cenv,$dom,$crs); |
my $reply = &Apache::lonnet::put('environment',\%cenv,$dom,$crs); |
if ($reply !~ /^ok$/) { |
if ($reply !~ /^ok$/) { |
Line 1980 sub print_sections_response () {
|
Line 2032 sub print_sections_response () {
|
my $putreply = ''; |
my $putreply = ''; |
my $warning = ''; |
my $warning = ''; |
my $warn_prefix = ''; |
my $warn_prefix = ''; |
if ($secstr =~ m/,/) { |
if ($secstr ne '') { |
@allsections = split/,/,$secstr; |
@allsections = split(/,/,$secstr); |
} else { |
|
unless ($secstr eq '') { $allsections[0] = $secstr; } |
|
} |
} |
|
|
if ( exists($env{'form.numsec'}) ) { |
if ( exists($env{'form.numsec'}) ) { |
Line 2016 sub print_sections_response () {
|
Line 2066 sub print_sections_response () {
|
|
|
if (@sections > 0 ) { |
if (@sections > 0 ) { |
unless ($secstr eq '') { $secstr .= ","; } |
unless ($secstr eq '') { $secstr .= ","; } |
if (@sections > 1) { |
$secstr .= join(",",@sections); |
$secstr .= join(",",@sections); |
|
} else { |
|
$secstr .= $sections[0]; |
|
} |
|
my %cenv = ('internal.sectionnums' => $secstr); |
my %cenv = ('internal.sectionnums' => $secstr); |
$putreply = &Apache::lonnet::put('environment',\%cenv,$dom,$crs); |
$putreply = &Apache::lonnet::put('environment',\%cenv,$dom,$crs); |
if ($putreply !~ /^ok$/) { |
if ($putreply !~ /^ok$/) { |
Line 2067 sub print_sections_response () {
|
Line 2113 sub print_sections_response () {
|
return; |
return; |
} |
} |
|
|
sub print_photos_response () { |
sub photo_permission { |
my ($r,$realm,$dom,$crs,$action,$tasktitleref) = @_; |
my ($r,$realm,$dom,$crs,$action,$tasktitleref) = @_; |
my %settings = &Apache::lonnet::get('environment',['internal.showphotos'],$dom,$crs); |
my %settings = &Apache::lonnet::get('environment', |
my $currphotos = $settings{'internal.showphotos'}; |
['internal.courseowner', |
my $showphotos = ''; |
'internal.photopermission', |
if ( exists($env{'form.showphotos'}) ) { |
'internal.showphoto'], |
$showphotos=$env{'form.showphotos'}; |
$dom,$crs); |
|
my ($showphotos,$response); |
|
if (exists($env{'form.cancel_agreement'})) { |
|
if ($env{'user.name'} eq $settings{'internal.courseowner'}) { |
|
my %cenv = ( |
|
'internal.photopermission' => 'no', |
|
); |
|
my $reply = &Apache::lonnet::put('environment',\%cenv,$dom,$crs); |
|
if ($reply !~ /^ok$/) { |
|
$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"; |
|
&print_reply($r,$response,$$tasktitleref{$action}); |
|
} else { |
|
&print_photos_response($r,$realm,$dom,$crs,$action, |
|
$tasktitleref,$showphotos,'no',\%cenv); |
|
} |
|
return; |
|
} |
|
} |
|
if (exists($env{'form.showphotos'})) { |
|
$showphotos=$env{'form.showphotos'}; |
|
} |
|
if ($showphotos) { |
|
if ($env{'form.photopermission'}) { |
|
my %cenv = ( |
|
'internal.photopermission' => $env{'form.photopermission'}, |
|
); |
|
my $reply = &Apache::lonnet::put('environment',\%cenv,$dom,$crs); |
|
if ($reply !~ /^ok$/) { |
|
$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 { |
|
&print_photos_response($r,$realm,$dom,$crs,$action, |
|
$tasktitleref,$showphotos, |
|
$env{'form.photopermission'},\%cenv); |
|
} |
|
} else { |
|
my ($result,$perm_reqd,$conditions) = |
|
&Apache::lonnet::auto_photo_permission($crs,$dom); |
|
my $permcheck; |
|
if ($result eq 'ok') { |
|
if ($perm_reqd eq 'yes') { |
|
if ($settings{'internal.photopermission'} eq 'yes') { |
|
&print_photos_response($r,$realm,$dom,$crs,$action, |
|
$tasktitleref,$showphotos); |
|
} else { |
|
return(&print_photo_agreement($r,$realm,$dom,$crs, |
|
$action,$tasktitleref, |
|
$conditions, |
|
$settings{'internal.courseowner'})); |
|
} |
|
} elsif ($perm_reqd eq 'no') { |
|
&print_photos_response($r,$realm,$dom,$crs,$action, |
|
$tasktitleref,$showphotos); |
|
} else { |
|
$permcheck = 'fail'; |
|
} |
|
} else { |
|
$permcheck = 'fail'; |
|
} |
|
if ($permcheck eq 'fail') { |
|
my $response = &mt('There was a problem processing your requested change, because it could not be determined whether course owner permission is required in order for a course coordinator to have access to student photos in this domain.').' '.&mt('The student photo import setting for this course has been left unchanged.').'<br/>'; |
|
&print_reply($r,$response,$$tasktitleref{$action}); |
|
} |
|
} |
|
} else { |
|
&print_photos_response($r,$realm,$dom,$crs,$action,$tasktitleref); |
} |
} |
|
return; |
|
} |
|
|
|
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) { |
|
$response = ' |
|
<script type="text/javascript"> |
|
function agreement_result(caller) { |
|
document.permission.photopermission.value = caller; |
|
if (caller == 0) { |
|
document.location.href="/adm/populate"; |
|
} else { |
|
document.permission.submit(); |
|
} |
|
return; |
|
} |
|
</script> |
|
<form name="permission" method="post"> |
|
<table width="100%" border="0" cellpadding="2" cellspacing="2"> |
|
<tr> |
|
<td align="left"><b>Use of student photos</b><br/>'."\n". |
|
&mt('Acceptance by the course owner of the conditions of use of photos is currently [_1] set.','<b>not</b>').'<br />'.&mt('Please indicate your acceptance of the conditions of use of digital photos of registered students in courses at [_1].',$institution).' |
|
</td> |
|
</tr> |
|
</table> |
|
<table border="0" cellpadding="3" cellspacing="3"> |
|
<tr> |
|
<td colspan="2"> |
|
<textarea rows="20" cols="80">'.$conditions.'</textarea> |
|
</td> |
|
<tr> |
|
<td align="left"> |
|
<input type="button" name="disagree" value="I do not agree" onclick="javascript:agreement_result('."'no'".');" /> |
|
</td> |
|
<td align="right"> |
|
<input type="button" name="agree" value="I agree" onclick="javscript:agreement_result('."'yes'".');" /> |
|
</td> |
|
</tr> |
|
</table> |
|
<input type ="hidden" name="action" value="'.$action.'" /> |
|
<input type ="hidden" name="state" value="process" /> |
|
<input type ="hidden" name="showphotos" value="1" /> |
|
<input type= "hidden" name="photopermission" value="" /> |
|
</form> |
|
'; |
|
} else { |
|
my ($ownername,$owneremail) = &get_oenerinfo($dom,$courseowner); |
|
$response = &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).'<br /><br />'.&mt('Please direct the course owner (e-mail: [_1]) to visit the "Student photos" page in the Automated Enrollment Manager to indicate acceptance of these conditions of use',$owneremail); |
|
} |
|
&print_reply($r,$response,$$tasktitleref{$action}); |
|
} |
|
|
|
sub print_photos_response { |
|
my ($r,$realm,$dom,$crs,$action,$tasktitleref,$showphotos,$photopermission, |
|
$permissionenv)=@_; |
|
my %newenv; |
|
if (defined($permissionenv)) { |
|
foreach my $key (keys(%{$permissionenv})) { |
|
if (exists($env{'request.course.id'})) { |
|
$newenv{$env{'request.course.id'}.'.'.$key} = |
|
$$permissionenv{$key}; |
|
} |
|
} |
|
} |
|
my %settings = &Apache::lonnet::get('environment',['internal.showphoto'], |
|
$dom,$crs); |
|
my $currphotos = $settings{'internal.showphoto'}; |
my $response = ""; |
my $response = ""; |
my %cenv = ('internal.showphotos' => $showphotos); |
if (defined($photopermission)) { |
|
if ($photopermission eq 'yes') { |
|
$response = &mt('Acceptance of photo use policy recorded.').'<br />'."\n"; |
|
} else { |
|
$response = &mt('Non-acceptance of photo use policy recorded.').'<br />'."\n"; |
|
$showphotos = 0; |
|
} |
|
} |
|
my %cenv = ('internal.showphoto' => $showphotos); |
my $reply = &Apache::lonnet::put('environment',\%cenv,$dom,$crs); |
my $reply = &Apache::lonnet::put('environment',\%cenv,$dom,$crs); |
if ($reply !~ /^ok$/) { |
if ($reply !~ /^ok$/) { |
$response = "There was a problem processing your requested change. The student photo import setting for this course has been left unchanged.<br/>"; |
$response .= "There was a problem processing your requested change. The student photo retrieval setting for this course has been left unchanged.<br/>"; |
} else { |
} else { |
if ($showphotos) { |
if ($showphotos) { |
if ($currphotos) { |
if ($currphotos) { |
$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($crs,$dom); |
|
if ($update) { |
|
$response .= '<br />'.$commentary.'<br /><br /> |
|
<form name="photoupdate" method="post"> |
|
<input type ="button" name="retrieve" value="'.&mt('Update photo repository').'" |
|
onclick="javascript:document.photoupdate.submit()" /> |
|
<input type ="hidden" name="action" value="'.$action.'" /> |
|
<input type ="hidden" name="state" value="photoupdate" /> |
|
</form>'; |
|
} |
} |
} |
} else { |
} else { |
if ($currphotos) { |
if ($currphotos) { |
$response = "Retrieval of student photos is now <b>disabled</b><br/>"; |
$response .= "Retrieval of student photos is now <b>disabled</b>.<br/>"; |
} else { |
} else { |
$response = "Retrieval of student photos is still <b>disabled</b><br/>"; |
$response .= "Retrieval of student photos is still <b>disabled</b>.<br/>"; |
} |
} |
} |
} |
|
foreach my $key (keys(%cenv)) { |
|
if (exists($env{'request.course.id'})) { |
|
$newenv{'course.'.$env{'request.course.id'}.'.'.$key} = |
|
$cenv{$key}; |
|
} |
|
} |
|
} |
|
if (keys(%newenv) > 0) { |
|
&Apache::lonnet::appenv(%newenv); |
} |
} |
&print_reply($r,$response,$$tasktitleref{$action}); |
&print_reply($r,$response,$$tasktitleref{$action}); |
return; |
return; |
} |
} |
|
|
|
sub print_photoupdate_response { |
|
my ($r,$realm,$dom,$crs,$action,$tasktitleref) = @_; |
|
my $response; |
|
my %changes; |
|
my %lt = &LONCAPA::Enrollment::photo_response_types(); |
|
my %settings = &Apache::lonnet::get('environment', |
|
['internal.coursecode', |
|
'internal.sectionnums', |
|
'internal.crosslistings'], |
|
$dom,$crs); |
|
my @allcourses = (); |
|
my %LC_code; |
|
my %affiliates; |
|
my $outcome; |
|
&get_institutional_codes(\%settings,,\@allcourses,\%LC_code); |
|
if (@allcourses > 0) { |
|
@{$affiliates{$crs}} = @allcourses; |
|
$outcome = &Apache::lonnet::auto_photoupdate(\%affiliates,$dom,$crs,\%changes); |
|
unless ($outcome eq 'ok') { |
|
&Apache::lonnet::logthis("lonpopulate::print_photoupdate_response". |
|
"failed to update student photos". |
|
" for ".$crs."\@".$dom." by ". |
|
$env{'user.name'}." \@ ".$env{'user.domain'}. |
|
": ".$outcome); |
|
} |
|
if ($outcome eq 'ok') { |
|
if (keys(%changes) > 0) { |
|
$response = &mt('Update of photos for registered students resulted in the following ').': <br /><script type="text/javascript"> |
|
function photowindow(photolink) { |
|
var title = "Photo_Viewer"; |
|
var options = "scrollbars=1,resizable=1,menubar=0"; |
|
options += ",width=240,height=240"; |
|
stdeditbrowser = open(photolink,title,options,"1"); |
|
stdeditbrowser.focus(); |
|
} |
|
</script> |
|
'; |
|
foreach my $type (sort(keys(%changes))) { |
|
my @usernames = sort(split(/\&/,$changes{$type})); |
|
my $count = @usernames; |
|
$response .= '<b>'.&mt('For [_1] students, photos ', |
|
$count).$lt{$type}.'</b><ul>'; |
|
foreach my $username (@usernames) { |
|
$response .= '<li>'.$username; |
|
if (($type eq 'new') || ($type eq 'same') || ($type eq 'update')) { |
|
$response .= ' <a href="javascript:photowindow('."'".&Apache::lonnet::studentphoto($dom,$username,'jpg')."'".')">View</a></li>'; |
|
} |
|
} |
|
$response .= '</ul><br />'; |
|
} |
|
} else { |
|
$response = &mt('No updates of photos of registered students occurred'). |
|
'<br />'; |
|
} |
|
} else { |
|
$response = "There was a problem updating student photos for registered students in this course. <br/>"; |
|
} |
|
} else { |
|
$response = "No institutional course sections are currently associated with this course so there are no registered students for whom photos can be imported/updated"; |
|
} |
|
&print_reply($r,$response,$$tasktitleref{$action}); |
|
return; |
|
} |
|
|
|
sub get_ownerinfo { |
|
my ($dom,$owner) = @_; |
|
my ($ownername,$owneremail); |
|
if ($owner) { |
|
$ownername=&Apache::loncommon::plainname($owner,$dom,'firstname'); |
|
my %ownerinfo = &Apache::lonnet::get('environment',['permanentemail'], |
|
$dom,$owner); |
|
$owneremail = $ownerinfo{'permanentemail'}; |
|
} |
|
return ($ownername,$owneremail); |
|
} |
|
|
sub print_update_result () { |
sub print_update_result () { |
my ($r,$realm,$dom,$crs,$action,$tasktitleref) = @_; |
my ($r,$realm,$dom,$crs,$action,$tasktitleref) = @_; |
my $response = ''; |
my $response = ''; |
Line 2112 sub print_update_result () {
|
Line 2395 sub print_update_result () {
|
my %LC_code = (); |
my %LC_code = (); |
my $logmsg = ''; |
my $logmsg = ''; |
my $newusermsg = ''; |
my $newusermsg = ''; |
|
my %phototypes = (); |
my %settings = &Apache::lonnet::get('environment',['internal.coursecode','internal.sectionnums','internal.crosslistings','internal.authtype','internal.autharg'],$dom,$crs); |
my %settings = &Apache::lonnet::get('environment',['internal.coursecode','internal.sectionnums','internal.crosslistings','internal.authtype','internal.autharg','internal.showphoto'],$dom,$crs); |
my $coursecode = $settings{'internal.coursecode'}; |
my $coursecode = $settings{'internal.coursecode'}; |
my $authtype = $settings{'internal.authtype'}; |
my $authtype = $settings{'internal.authtype'}; |
my $autharg = $settings{'internal.autharg'}; |
my $autharg = $settings{'internal.autharg'}; |
|
my $showphotos = $settings{'internal.showphoto'}; |
my ($startaccess,$endaccess) = &get_dates_from_form(); |
my ($startaccess,$endaccess) = &get_dates_from_form(); |
if ( exists($env{'form.updateadds'}) ) { |
if ( exists($env{'form.updateadds'}) ) { |
$updateadds = $env{'form.updateadds'}; |
$updateadds = $env{'form.updateadds'}; |
Line 2133 sub print_update_result () {
|
Line 2417 sub print_update_result () {
|
} elsif ($coursecode eq '') { |
} elsif ($coursecode eq '') { |
$response = "There was a problem retrieving the course code for this LON-CAPA course. An update of the class roster has not been carried out, and enrollment remains unchanged"; |
$response = "There was a problem retrieving the course code for this LON-CAPA course. An update of the class roster has not been carried out, and enrollment remains unchanged"; |
} else { |
} else { |
# Get complete list of course sections to update |
&get_institutional_codes(\%settings,\@allcourses,\%LC_code); |
my @currsections = (); |
|
my @currxlists = (); |
|
|
|
if ($settings{'internal.sectionnums'} =~ m/,/) { |
|
@currsections = split/,/,$settings{'internal.sectionnums'}; |
|
} elsif ($settings{'internal.sectionnums'} ne '') { |
|
$currsections[0] = $settings{'internal.sectionnums'}; |
|
} |
|
|
|
if ($settings{'internal.crosslistings'} =~ m/,/) { |
|
@currxlists = split/,/,$settings{'internal.crosslistings'}; |
|
} elsif ($settings{'internal.crosslistings'} ne '') { |
|
$currxlists[0] = $settings{'internal.crosslistings'}; |
|
} |
|
|
|
if (@currxlists > 0) { |
|
foreach (@currxlists) { |
|
if (m/^(\w+):(\w*)$/) { |
|
unless (grep/^$1$/,@allcourses) { |
|
push @allcourses,$1; |
|
$LC_code{$1} = $2; |
|
} |
|
} |
|
} |
|
} |
|
|
|
if (@currsections > 0) { |
|
foreach (@currsections) { |
|
if (m/^(\w+):(\w*)$/) { |
|
my $sec = $coursecode.$1; |
|
my $gp = $2; |
|
unless (grep/^$sec$/,@allcourses) { |
|
push @allcourses,$sec; |
|
$LC_code{$sec} = $gp; |
|
} |
|
} |
|
} |
|
} |
|
|
|
if (@allcourses > 0) { |
if (@allcourses > 0) { |
@{$affiliates{$crs}} = @allcourses; |
@{$affiliates{$crs}} = @allcourses; |
my $outcome = &Apache::lonnet::fetch_enrollment_query('updatenow',\%affiliates,\%reply,$dom,$crs); |
my $outcome = &Apache::lonnet::fetch_enrollment_query('updatenow',\%affiliates,\%reply,$dom,$crs); |
Line 2184 sub print_update_result () {
|
Line 2429 sub print_update_result () {
|
": ".$outcome); |
": ".$outcome); |
} |
} |
if ($reply{$crs} > 0) { |
if ($reply{$crs} > 0) { |
($changecount,$response) = &LONCAPA::Enrollment::update_LC($dom,$crs,$updateadds,$updatedrops,$startaccess,$endaccess,$authtype,$autharg,\@allcourses,\%LC_code,\$logmsg,\$newusermsg,"updatenow"); |
($changecount,$response) = &LONCAPA::Enrollment::update_LC($dom,$crs,$updateadds,$updatedrops,$startaccess,$endaccess,$authtype,$autharg,\@allcourses,\%LC_code,\$logmsg,\$newusermsg,"updatenow",\%phototypes); |
} else { |
} else { |
$response = "There was a problem retrieving institutional class list data for the course sections and crosslisted courses which contribute enrollment to this course. No updates have been carried out, and the roster remains unchanged."; |
$response = "There was a problem retrieving institutional class list data for the course sections and crosslisted courses which contribute enrollment to this course. No updates have been carried out, and the roster remains unchanged."; |
} |
} |
Line 2206 sub print_update_result () {
|
Line 2451 sub print_update_result () {
|
return; |
return; |
} |
} |
|
|
|
sub get_institutional_codes { |
|
my ($settings,$allcourses,$LC_code) = @_; |
|
# Get complete list of course sections to update |
|
my @currsections = (); |
|
my @currxlists = (); |
|
my $coursecode = $$settings{'internal.coursecode'}; |
|
|
|
if ($$settings{'internal.sectionnums'} ne '') { |
|
@currsections = split(/,/,$$settings{'internal.sectionnums'}); |
|
} |
|
|
|
if ($$settings{'internal.crosslistings'} ne '') { |
|
@currxlists = split(/,/,$$settings{'internal.crosslistings'}); |
|
} |
|
|
|
if (@currxlists > 0) { |
|
foreach (@currxlists) { |
|
if (m/^([^:]+):(\w*)$/) { |
|
unless (grep/^$1$/,@{$allcourses}) { |
|
push @{$allcourses},$1; |
|
$$LC_code{$1} = $2; |
|
} |
|
} |
|
} |
|
} |
|
|
|
if (@currsections > 0) { |
|
foreach (@currsections) { |
|
if (m/^(\w+):(\w*)$/) { |
|
my $sec = $coursecode.$1; |
|
my $gp = $2; |
|
unless (grep/^$sec$/,@{$allcourses}) { |
|
push @{$allcourses},$sec; |
|
$$LC_code{$sec} = $gp; |
|
} |
|
} |
|
} |
|
} |
|
return; |
|
} |
|
|
|
|
sub print_viewclass_response { |
sub print_viewclass_response { |
my ($r,$realm,$dom,$crs,$action,$tasktitleref) = @_; |
my ($r,$realm,$dom,$crs,$action,$tasktitleref) = @_; |
my $response; |
my $response; |
Line 2222 sub print_viewclass_response {
|
Line 2509 sub print_viewclass_response {
|
my %otherdom = (); |
my %otherdom = (); |
my %lockchg = (); |
my %lockchg = (); |
my %nolockchg = (); |
my %nolockchg = (); |
my $classlist = &Apache::loncoursedata::get_classlist($cid,$dom,$crs); |
my $classlist = &Apache::loncoursedata::get_classlist($dom,$crs); |
my $endidx = &Apache::loncoursedata::CL_END; |
my $endidx = &Apache::loncoursedata::CL_END; |
my $startidx = &Apache::loncoursedata::CL_START; |
my $startidx = &Apache::loncoursedata::CL_START; |
my $ididx=&Apache::loncoursedata::CL_ID; |
my $ididx=&Apache::loncoursedata::CL_ID; |
Line 2304 sub print_viewclass_response {
|
Line 2591 sub print_viewclass_response {
|
} |
} |
if ($chgtotal > 0) { |
if ($chgtotal > 0) { |
$response = "You requested a change in enrollment type for $chgtotal students.<br /><br />\n"; |
$response = "You requested a change in enrollment type for $chgtotal students.<br /><br />\n"; |
$classlist = &Apache::loncoursedata::get_classlist($cid,$dom,$crs); |
$classlist = &Apache::loncoursedata::get_classlist($dom,$crs); |
if ($chgok > 0) { |
if ($chgok > 0) { |
$response .= "The following $chgok changes were successful:<br />"; |
$response .= "The following $chgok changes were successful:<br />"; |
$response .= &enrolltype_result(\%chg,$classlist,$endidx,$startidx,$ididx,$secidx,$typeidx); |
$response .= &enrolltype_result(\%chg,$classlist,$endidx,$startidx,$ididx,$secidx,$typeidx); |
Line 2321 sub print_viewclass_response {
|
Line 2608 sub print_viewclass_response {
|
} |
} |
if ($locktotal > 0) { |
if ($locktotal > 0) { |
$response .= "You requested locking/unlocking for $locktotal manually enrolled students.<br /><br />\n"; |
$response .= "You requested locking/unlocking for $locktotal manually enrolled students.<br /><br />\n"; |
$classlist = &Apache::loncoursedata::get_classlist($cid,$dom,$crs); |
$classlist = &Apache::loncoursedata::get_classlist($dom,$crs); |
if ($lockok > 0) { |
if ($lockok > 0) { |
$response .= "The following $lockok changes were successful:<br />"; |
$response .= "The following $lockok changes were successful:<br />"; |
$response .= &enrolltype_result(\%lockchg,$classlist,$endidx,$startidx,$ididx,$secidx,$typeidx,$lockedidx); |
$response .= &enrolltype_result(\%lockchg,$classlist,$endidx,$startidx,$ididx,$secidx,$typeidx,$lockedidx); |
Line 2525 sub handler {
|
Line 2812 sub handler {
|
if (! (($env{'request.course.fn'}) && (&Apache::lonnet::allowed('cst',$env{'request.course.id'})))) { |
if (! (($env{'request.course.fn'}) && (&Apache::lonnet::allowed('cst',$env{'request.course.id'})))) { |
# Not in a course, or not allowed to modify parms |
# Not in a course, or not allowed to modify parms |
$env{'user.error.msg'}="/adm/populate:cst:0:0:Cannot drop or add students"; |
$env{'user.error.msg'}="/adm/populate:cst:0:0:Cannot drop or add students"; |
return HTTP_NOT_ACCEPTABLE; |
return HTTP_NOT_ACCEPTABLE; |
} |
} |
# Start page |
# Start page |
&Apache::loncommon::content_type($r,'text/html'); |
&Apache::loncommon::content_type($r,'text/html'); |
$r->send_http_header; |
$r->send_http_header; |
|
|
my @tasks = ("information","chgsettings","setdates","setaccess","notify","crosslist","sections","photos","updatenow","viewclass"); |
my @tasks = ("information","chgsettings","setdates","setaccess","notify","crosslist","sections","photos","updatenow","updatephotos","viewclass"); |
|
|
my %tasklong = ( |
my %tasklong = ( |
information => "Task information", |
information => "Task information", |
Line 2541 sub handler {
|
Line 2828 sub handler {
|
notify => "Notification of changes", |
notify => "Notification of changes", |
crosslist => "Change crosslistings", |
crosslist => "Change crosslistings", |
sections => "Section settings", |
sections => "Section settings", |
photos => "Student photos", |
photos => "Student photo settings", |
|
updatephotos => "Update student photos", |
updatenow => "Update roster now", |
updatenow => "Update roster now", |
newcross => "Add crosslistings", |
newcross => "Add crosslistings", |
newsections => "Add sections", |
newsections => "Add sections", |
Line 2555 sub handler {
|
Line 2843 sub handler {
|
notify => "Notification of enrollment changes", |
notify => "Notification of enrollment changes", |
crosslist => "Changes to crosslistings", |
crosslist => "Changes to crosslistings", |
sections => "Changes to section settings", |
sections => "Changes to section settings", |
photos => "Automatic import of student photos", |
photos => "Student photo settings", |
|
updatephotos => "Update student photos", |
updatenow => "Immediate course roster update", |
updatenow => "Immediate course roster update", |
newcross => "Adding new crosslisted courses", |
newcross => "Adding new crosslisted courses", |
newsections => "Adding new course sections", |
newsections => "Adding new course sections", |
Line 2639 sub handler {
|
Line 2928 sub handler {
|
} elsif ($action eq "updatenow") { |
} elsif ($action eq "updatenow") { |
&print_update_result($r,$realm,$dom,$crs,$action,\%tasktitle); |
&print_update_result($r,$realm,$dom,$crs,$action,\%tasktitle); |
} elsif ($action eq "photos") { |
} elsif ($action eq "photos") { |
&print_photos_response($r,$realm,$dom,$crs,$action,\%tasktitle); |
if ($state eq "photoupdate") { |
|
&print_photoupdate_response($r,$realm,$dom,$crs,$action,\%tasktitle); |
|
} else { |
|
&photo_permission($r,$realm,$dom,$crs,$action,\%tasktitle); |
|
} |
|
} elsif ($action eq "updatephotos") { |
|
&print_photoupdate_response($r,$realm,$dom,$crs,$action,\%tasktitle); |
} elsif ($action eq "newcross") { |
} elsif ($action eq "newcross") { |
&print_crosslistings_response($r,$realm,$dom,$crs,$action,\%tasktitle); |
&print_crosslistings_response($r,$realm,$dom,$crs,$action,\%tasktitle); |
} elsif ($action eq "newsections") { |
} elsif ($action eq "newsections") { |