Diff for /loncom/interface/lonpopulate.pm between versions 1.34 and 1.37

version 1.34, 2006/02/07 05:08:32 version 1.37, 2006/02/08 23:47:23
Line 866  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 876  your changes.</td> Line 876  your changes.</td>
                          Automatic import of student photos from institutional data repository:&nbsp;&nbsp;                           Automatic import of student photos from institutional data repository:&nbsp;&nbsp;
   
       ");        ");
       if ($enrollvar{showphotos}) {        if ($enrollvar{showphoto}) {
           $r->print("            $r->print("
                         <input type=\"radio\" name=\"showphotos\" value=\"1\" checked=\"true\" />&nbsp;Yes&nbsp;&nbsp;&nbsp;                          <input type=\"radio\" name=\"showphotos\" value=\"1\" checked=\"true\" />&nbsp;Yes&nbsp;&nbsp;&nbsp;
                         <input type=\"radio\" name=\"showphotos\" value=\"0\" />&nbsp;No                          <input type=\"radio\" name=\"showphotos\" value=\"0\" />&nbsp;No
Line 1021  Note: Any students previously added manu Line 1021  Note: Any students previously added manu
                      <td align=\"left\"><b>$$tasktitleref{$action}</b>                       <td align=\"left\"><b>$$tasktitleref{$action}</b>
                      </td>                       </td>
                     </tr><tr><td>");                      </tr><tr><td>");
       if ($enrollvar{'showphotos'}) {        if ($enrollvar{'showphoto'}) {
           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.showphoto'],
    $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.showphoto'],
                                                                     $dom,$crs);   $dom,$crs);
     my $currphotos = $settings{'internal.showphotos'};      my $currphotos = $settings{'internal.showphoto'};
     my $response = "";      my $response = "";
     if (defined($photopermission)) {      if (defined($photopermission)) {
         if ($photopermission eq 'yes') {          if ($photopermission eq 'yes') {
Line 2255  sub print_photos_response { Line 2260  sub print_photos_response {
             $showphotos = 0;              $showphotos = 0;
         }          }
     }      }
     my %cenv = ('internal.showphotos' => $showphotos);      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 retrieval 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/>";
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 2364  sub get_ownerinfo { Line 2372  sub get_ownerinfo {
     my ($ownername,$owneremail);      my ($ownername,$owneremail);
     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);
Line 2384  sub print_update_result () { Line 2392  sub print_update_result () {
     my $logmsg = '';      my $logmsg = '';
     my $newusermsg = '';      my $newusermsg = '';
     my %phototypes = ();      my %phototypes = ();
     my %settings = &Apache::lonnet::get('environment',['internal.coursecode','internal.sectionnums','internal.crosslistings','internal.authtype','internal.autharg','internal.showphotos'],$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.showphotos'};      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'};

Removed from v.1.34  
changed lines
  Added in v.1.37


FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>