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

version 1.33, 2005/11/07 15:43:31 version 1.34, 2006/02/07 05:08:32
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>&nbsp;</td>                <td>&nbsp;</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>&nbsp;</td>                <td>&nbsp;</td>
Line 320  sub print_main_frame { Line 320  sub print_main_frame {
             </tr>              </tr>
             <tr>              <tr>
               <td>&nbsp;</td>                <td>&nbsp;</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>&nbsp;</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 883  your changes.</td> Line 887  your changes.</td>
                         <input type=\"radio\" name=\"showphotos\" value=\"0\" checked=\"true\" />&nbsp;No                          <input type=\"radio\" name=\"showphotos\" value=\"0\" checked=\"true\" />&nbsp;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>').'&nbsp;<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'});
                 $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 (e-mail: [_1]) to visit the "Student photos" page in the Automated Enrollment Manager to indicate acceptance of these conditions of use',$owneremail).'<br /><br /><input type="button" name=mainmenu" value="Go back" onclick="javascript:history.go(-1);" />
                       </td>
                      </tr>
                     </form>
                ');
                return;
             }
         }
         $r->print('
                     <tr>                      <tr>
                      </td>&nbsp;</td>                       </td>&nbsp;</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 952  Note: Any students previously added manu Line 1014  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{'showphotos'}) {
             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>&nbsp;</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 2024  sub print_sections_response () { Line 2109  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',['internal.courseowner',
     my $currphotos = $settings{'internal.showphotos'};                    'internal.photopermission','internal.showphotos'],$dom,$crs);
     my $showphotos = '';      my ($showphotos,$response);
     if ( exists($env{'form.showphotos'}) ) {      if (exists($env{'form.cancel_agreement'})) {
  $showphotos=$env{'form.showphotos'};          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.showphotos'],
                                                                       $dom,$crs);
       my $currphotos = $settings{'internal.showphotos'};
     my $response = "";      my $response = "";
       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.showphotos' => $showphotos);      my %cenv = ('internal.showphotos' => $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});
       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 .= '&nbsp;<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});      &print_reply($r,$response,$$tasktitleref{$action});
     return;      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 2069  sub print_update_result () { Line 2383  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.showphotos'],$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 ($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 2090  sub print_update_result () { Line 2405  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'} 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;   
     }  
  }  
     }  
  }  
   
  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 2137  sub print_update_result () { Line 2417  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 2159  sub print_update_result () { Line 2439  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 2478  sub handler { Line 2800  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 2494  sub handler { Line 2816  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 2508  sub handler { Line 2831  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 2592  sub handler { Line 2916  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") {

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


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