Diff for /loncom/interface/Attic/londropadd.pm between versions 1.51 and 1.52

version 1.51, 2002/09/18 14:17:47 version 1.52, 2002/09/24 18:24:43
Line 773  END Line 773  END
     } else {      } else {
         # Print out the available choices          # Print out the available choices
         if ($ENV{'form.action'} eq 'modifystudent') {          if ($ENV{'form.action'} eq 'modifystudent') {
             &show_class_list($r,'view','modify',$student_array,$student_data);              &show_class_list($r,'view','modify','any',$student_array,$student_data);
         } else {          } else {
             &show_class_list($r,'view','aboutme',$student_array,$student_data);              &show_class_list($r,'view','aboutme','any',$student_array,$student_data);
         }          }
     }      }
 }  }
Line 788  sub print_csv_classlist { Line 788  sub print_csv_classlist {
     if (! scalar(@$student_array)) {      if (! scalar(@$student_array)) {
         $r->print("There are no students currently enrolled.\n");          $r->print("There are no students currently enrolled.\n");
     } else {      } else {
         &show_class_list($r,'csv','nolink',$student_array,$student_data);          &show_class_list($r,'csv','nolink','any',$student_array,$student_data);
     }      }
 }  }
   
 # =================================================== Show student list to drop  # =================================================== Show student list to drop
 sub show_class_list {  sub show_class_list {
     my ($r,$mode,$linkto,$students,$student_data)=@_;      my ($r,$mode,$linkto,$statusmode,$students,$student_data)=@_;
     my $cid=$ENV{'request.course.id'};      my $cid=$ENV{'request.course.id'};
     # Print out header       # Print out header 
     if ($mode eq 'view') {      if ($mode eq 'view') {
Line 814  END Line 814  END
                                   "section")).'"'."\n");                                    "section")).'"'."\n");
     }      }
     foreach my $student (@$students) {      foreach my $student (@$students) {
           my $error;
           if (exists($student_data->{$student.':error'})) {
               $error = $student_data->{$student.':error'};
           }
           if ($error) {
               $r->print('<tr><td colspan="6">'.
                         '<font color="#FF8888">Error</font>'.
                         'Error retrieving data for '.
                         join('@',split(/:/,$student)).
                         ', '.$error.'</td></tr>'."\n");
               next;
           }
         my $username = $student_data->{$student.':username'};          my $username = $student_data->{$student.':username'};
         my $domain   = $student_data->{$student.':domain'};          my $domain   = $student_data->{$student.':domain'};
         my $section  = $student_data->{$student.':section'};          my $section  = $student_data->{$student.':section'};
         my $name     = $student_data->{$student.':fullname'};          my $name     = $student_data->{$student.':fullname'};
         my $status   = $student_data->{$student.':Status'};          my $status   = $student_data->{$student.':Status'};
         my $id       = $student_data->{$student.':id'};          my $id       = $student_data->{$student.':id'};
         next if ($status ne 'Active');          next if (($statusmode ne 'any') && ($status ne $statusmode));
         if ($mode eq 'view') {          if ($mode eq 'view') {
             $r->print("<tr>\n    <td>\n        ");              $r->print("<tr>\n    <td>\n        ");
             if ($linkto eq 'nothing') {              if ($linkto eq 'nothing') {
Line 871  sub print_modify_student_form { Line 883  sub print_modify_student_form {
     # determine the students name information      # determine the students name information
     my %info=&Apache::lonnet::get('environment',      my %info=&Apache::lonnet::get('environment',
                                   ['firstname','middlename',                                    ['firstname','middlename',
                                    'lastname','generation'],                                     'lastname','generation','id'],
                                   $sdom, $sname);                                    $sdom, $sname);
     my ($tmp) = keys(%info);      my ($tmp) = keys(%info);
     if ($tmp =~ /^(con_lost|error|no_such_host)/i) {      if ($tmp =~ /^(con_lost|error|no_such_host)/i) {
Line 894  sub print_modify_student_form { Line 906  sub print_modify_student_form {
                                                           $endtime);                                                            $endtime);
     # Make sure student is enrolled in course          # Make sure student is enrolled in course    
     $r->print(<<END);      $r->print(<<END);
   <p>
   <font size="+1">
   Only domain coordinators can change a users password.
   </font>
   </p>
 <input type="hidden" name="slogin"  value="$sname"  />  <input type="hidden" name="slogin"  value="$sname"  />
 <input type="hidden" name="sdomain" value="$sdom" />  <input type="hidden" name="sdomain" value="$sdom" />
 <input type="hidden" name="action"  value="modifystudent" />  <input type="hidden" name="action"  value="modifystudent" />
Line 911  $info{'lastname'} $info{'generation'}, $ Line 928  $info{'lastname'} $info{'generation'}, $
 <input type="text" name="generation" value="$info{'generation'}" /></td></tr>  <input type="text" name="generation" value="$info{'generation'}" /></td></tr>
 </table>  </table>
 </p><p>  </p><p>
   <b>Student ID</b>: <input type="text" name="id" value="$info{'id'}" size="12"/>
   </p><p>
 <b>Section</b>: <input type="text" name="section" value="$section" size="4"/>  <b>Section</b>: <input type="text" name="section" value="$section" size="4"/>
 </p><p>  </p><p>
 <table>  <table>
Line 938  sub modify_single_student { Line 957  sub modify_single_student {
     my $courseid   = $ENV{'request.course.id'};      my $courseid   = $ENV{'request.course.id'};
     my $sname      = $ENV{'form.slogin'};      my $sname      = $ENV{'form.slogin'};
     my $sdom       = $ENV{'form.sdomain'};      my $sdom       = $ENV{'form.sdomain'};
       my $sid        = $ENV{'form.id'};
     my $starttime = &Apache::lonhtmlcommon::get_date_from_form('startdate',      my $starttime = &Apache::lonhtmlcommon::get_date_from_form('startdate',
                                                                time);                                                                 time);
     my $endtime   = &Apache::lonhtmlcommon::get_date_from_form('enddate',      my $endtime   = &Apache::lonhtmlcommon::get_date_from_form('enddate',
Line 946  sub modify_single_student { Line 966  sub modify_single_student {
     my $displayable_endtime   = localtime($endtime);      my $displayable_endtime   = localtime($endtime);
     # talk to the user about what we are going to do      # talk to the user about what we are going to do
     $r->print(<<END);      $r->print(<<END);
 Modifying data for user: $sname \@ $sdom <br />  <h2>Modifying data for user $sname \@ $sdom </h2>
 <h3>Student Information</h3>  <h3>Student Information</h3>
 <table>  <table>
 <tr><td>First name  </td><td> $firstname  </td></tr>  <tr><td>First name  </td><td> $firstname  </td></tr>
Line 960  Modifying data for user: $sname \@ $sdom Line 980  Modifying data for user: $sname \@ $sdom
 <tr><td>Start Time  </td><td> $displayable_starttime </td></tr>  <tr><td>Start Time  </td><td> $displayable_starttime </td></tr>
 <tr><td>End Time    </td><td> $displayable_endtime   </td></tr>  <tr><td>End Time    </td><td> $displayable_endtime   </td></tr>
 </table>  </table>
   <p>
 END  END
     # send request(s) to modify data      # Send request(s) to modify data
     my $roleresults = 'refused';      #   The '1' in the call to modifystudent is to force the students 
     #my $roleresults = &Apache::lonnet::assignrole($sdom,$sname,      #   id to be changed.
     #                                              $courseid.'/'.$section,      my $roleresults = &Apache::lonnet::modifystudent
     #                                              'st',          ($sdom,$sname,$sid,undef,undef,$firstname,$middlename,$lastname,
     #                                              $endtime,$starttime);           $generation,$section,$endtime,$starttime,1);
     if ($roleresults =~/refused/) {      if ($roleresults =~/refused/) {
         $r->print("Your request to change the role information for this ".          $r->print("Your request to change the role information for this ".
                   "student was refused.");                    "student was refused.");
     } elsif ($roleresults !~ /ok/) {      } elsif ($roleresults !~ /ok/) {
         $r->print("An error occurred during the attempt to change the role".          $r->print("An error occurred during the attempt to change the role".
                   " information for this student.  The error reported was ".                    " information for this student.  <br />".
                     "The error reported was ".
                   $roleresults);                    $roleresults);
     } else { # everything is okay!      } else { # everything is okay!
         $r->print("Student role updated successfully.");          $r->print("Student information updated successfully. <br />".
                     "The student must log out and log in again to see ".
                     "these changes.");
     }      }
     #   
     $r->print(<<END);      $r->print(<<END);
   </p><p>
   <a href="/adm/dropadd?action=modifystudent">Modify another students data</a>
 </body></html>  </body></html>
 END  END
     return;      return;
Line 1042  function uncheckAll(field) { Line 1067  function uncheckAll(field) {
     <th>ID</th><th>student name</th><th>section</th></tr>      <th>ID</th><th>student name</th><th>section</th></tr>
 END  END
     foreach my $student (@$students) {      foreach my $student (@$students) {
           my $error;
           if (exists($student_data->{$student.':error'})) {
               $error = $student_data->{$student.':error'};
           }
           if ($error) {
               $r->print('<tr><td colspan="6">'.
                         '<font color="#FF8888">Error</font>'.
                         'Error retrieving data for '.
                         join('@',split(/:/,$student)).
                         ', '.$error.'</td></tr>'."\n");
               next;
           }
         my $username = $student_data->{$student.':username'};          my $username = $student_data->{$student.':username'};
         my $domain   = $student_data->{$student.':domain'};          my $domain   = $student_data->{$student.':domain'};
         my $section  = $student_data->{$student.':section'};          my $section  = $student_data->{$student.':section'};

Removed from v.1.51  
changed lines
  Added in v.1.52


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