Diff for /loncom/interface/lonpopulate.pm between versions 1.50 and 1.51

version 1.50, 2007/05/02 01:33:49 version 1.51, 2007/12/14 00:20:53
Line 33  use Apache::lonhtmlcommon; Line 33  use Apache::lonhtmlcommon;
 use Apache::lonlocal;  use Apache::lonlocal;
 use Apache::loncoursedata;  use Apache::loncoursedata;
 use Apache::longroup;  use Apache::longroup;
   use Apache::lonuserutils;
 use Apache::Constants qw(:common :http REDIRECT);  use Apache::Constants qw(:common :http REDIRECT);
 use Time::Local;  use Time::Local;
 use LONCAPA::Enrollment;  use LONCAPA::Enrollment;
Line 225  sub print_mainbox { Line 226  sub print_mainbox {
 <table width="100%" border="0" cellpadding="0" cellspacing="0">  <table width="100%" border="0" cellpadding="0" cellspacing="0">
  <tr>   <tr>
   <td bgcolor="#CCCCFF">     <td bgcolor="#CCCCFF"> 
    <font size="2"><a href="/adm/menu">$realm</a> -&gt; <a href="/adm/dropadd">Enrollment Manager</a> -&gt; $page</font><br/>     <font size="2"><a href="/adm/menu">$realm</a> -&gt; <a href="/adm/createuser">User Management</a> -&gt; $page</font><br/>
   </td>    </td>
   <td align="right" bgcolor="#CCCCFF" valign="top">    <td align="right" bgcolor="#CCCCFF" valign="top">
    <font size="+1">Automated Enrollment Manager&nbsp;</font>     <font size="+1">Automated Enrollment Manager&nbsp;</font>
Line 1121  onclick="javascript:document.photoupdate Line 1122  onclick="javascript:document.photoupdate
       }        }
       my $status_select = &Apache::lonhtmlcommon::StatusOptions($env{'form.Status'});        my $status_select = &Apache::lonhtmlcommon::StatusOptions($env{'form.Status'});
 #  Get current classlist  #  Get current classlist
       my ($classlist,$keylist)=&Apache::loncoursedata::get_classlist();        my %userlist;
         my ($indexhash,$keylist) = &Apache::lonuserutils::make_keylist_array();
         my $classlist = &Apache::loncoursedata::get_classlist();
         my $secidx = &Apache::loncoursedata::CL_SECTION();
         my ($permission,$allowed) = &Apache::lonuserutils::get_permission();
         foreach my $student (keys(%{$classlist})) {
             if (exists($permission->{'view_section'})) {
                 if ($classlist->{$student}[$secidx] ne $permission->{'view_section'}) {
                     next;
                 } else {
                     $userlist{$student} = $classlist->{$student};
                 }
             } else {
                 $userlist{$student} = $classlist->{$student};
             }
         }
   
       if (! defined($classlist)) {        if (! defined($classlist)) {
           $r->print(&mt('There are no students either currently or previously enrolled.').            $r->print(&mt('There are no students either currently or previously enrolled.')."
                       "\n");                        </td>
                        </tr>\n");
       } else {        } else {
           $r->print(&mt('Student Status: [_1]',$status_select)."\n");            $r->print(&mt('Student Status: [_1]',$status_select)."\n");
           $r->print('<input type="submit" value="'.&mt('Update Display').'" />'.            $r->print('<input type="submit" value="'.&mt('Update Display').'" />'.
               "\n</p>\n");                "\n</p>\n");
             my $context = 'course';
           my ($studentcount,$autocount,$manualcount,$lockcount,$unlockcount) = &Apache::londropadd::show_class_list($r,'autoenroll','nothing',$env{'form.Status'},$classlist,$keylist);            my $mode = 'autoenroll';
             my ($studentcount,$autocount,$manualcount,$lockcount,$unlockcount) = &Apache::lonuserutils::show_users_list($r,$context,$mode,$permission,$env{'form.Status'},\%userlist,$keylist);
           $r->print("            $r->print("
                      </td>                       </td>
                     </tr>                      </tr>
Line 1185  END Line 1204  END
                      </td>                       </td>
                     </tr>                      </tr>
               ");                ");
             } else {
                 $r->print('
                       <tr>
                        <td><br />
                         '.&mt('There are no students with the selected status.').'
                        </td>
                       </tr>
                 ');
           }            }
           $r->print("            $r->print("
                    </table>                     </table>
Line 2689  sub print_viewclass_response { Line 2716  sub print_viewclass_response {
        &Apache::loncommon::get_env_multiple('form.unlockchg'));         &Apache::loncommon::get_env_multiple('form.unlockchg'));
   
     foreach my $student (sort @typechglist) {      foreach my $student (sort @typechglist) {
         my ($uname,$udom) = split/:/,$student;          my ($uname,$udom) = split(/:/,$student);
         my $sdata    = $classlist->{$student};          my $sdata    = $classlist->{$student};
         my $section  = $sdata->[$secidx];          my $section  = $sdata->[$secidx];
         my $uid       = $sdata->[$ididx];          my $uid       = $sdata->[$ididx];
Line 2727  sub print_viewclass_response { Line 2754  sub print_viewclass_response {
         }          }
     }      }
     foreach my $student (@lockchglist) {      foreach my $student (@lockchglist) {
         my ($uname,$udom) = split/:/,$student;          my ($uname,$udom) = split(/:/,$student);
         my $sdata    = $classlist->{$student};          my $sdata    = $classlist->{$student};
         my $section  = $sdata->[$secidx];          my $section  = $sdata->[$secidx];
         my $uid       = $sdata->[$ididx];          my $uid       = $sdata->[$ididx];
Line 2756  sub print_viewclass_response { Line 2783  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 = &mt('You requested a change in enrollment type for [quant,_1,student].',$chgtotal).'<br /><br />'."\n";
         $classlist = &Apache::loncoursedata::get_classlist($dom,$crs);          $classlist = &Apache::loncoursedata::get_classlist($dom,$crs);
         if ($chgok > 0) {          if ($chgok > 0) {
             $response .= "The following $chgok changes were successful:<br />";              $response .= &mt('The following [quant,_1,change was,changes were] successful;',$chgtotal).':<br /><br />';
             $response .= &enrolltype_result(\%chg,$classlist,$endidx,$startidx,$ididx,$secidx,$typeidx);              $response .= &enrolltype_result(\%chg,$classlist,$endidx,$startidx,$ididx,$secidx,$typeidx);
         }          }
         if ($chgfail > 0) {          if ($chgfail > 0) {
             $response .= "The following $chgfail students were not modified successfully:&nbsp;<br />";              $response .= &mt('The following [quant,_1,student was,students were] not modified successfully',$chgfail).':&nbsp;<br />';
             $response .= &enrolltype_result(\%nochg,$classlist,$endidx,$startidx,$ididx,$secidx,$typeidx);              $response .= &enrolltype_result(\%nochg,$classlist,$endidx,$startidx,$ididx,$secidx,$typeidx);
         }          }
         if ($othdom > 0) {          if ($othdom > 0) {
             $response .= "The following $othdom students were not modified because students must be in the same LON-CAPA domain as the course, in order to be set to an enrollment type of 'auto':<br />";               $response .= &mt("The following [quant,_1,student was,students were] not modified because students must be in the same LON-CAPA domain as the course, in order to be set to an enrollment type of 'auto'",$othdom).':<br />'; 
             $response .= &enrolltype_result(\%otherdom,$classlist,$endidx,$startidx,$ididx,$secidx,$typeidx);              $response .= &enrolltype_result(\%otherdom,$classlist,$endidx,$startidx,$ididx,$secidx,$typeidx);
         }          }
         $response .= "<br /><br />";          $response .= "<br /><br />";
     }      }
     if ($locktotal > 0) {      if ($locktotal > 0) {
         $response .= "You requested locking/unlocking for $locktotal manually enrolled students.<br /><br />\n";          $response .= &mt('You requested locking/unlocking for [quant,_1,manually enrolled student]',$locktotal).'<br /><br />'."\n";
         $classlist = &Apache::loncoursedata::get_classlist($dom,$crs);          $classlist = &Apache::loncoursedata::get_classlist($dom,$crs);
         if ($lockok > 0) {          if ($lockok > 0) {
             $response .= "The following $lockok changes were successful:<br />";              $response .= &mt('The following [quant,_1,change was,changes were] successful',$lockok).':<br /><br />';
             $response .= &enrolltype_result(\%lockchg,$classlist,$endidx,$startidx,$ididx,$secidx,$typeidx,$lockedidx);              $response .= &enrolltype_result(\%lockchg,$classlist,$endidx,$startidx,$ididx,$secidx,$typeidx,$lockedidx);
         }          }
         if ($lockfail > 0) {          if ($lockfail > 0) {
             $response .= "The following $lockfail students were not modified successfully:&nbsp;<br />";              $response .= &mt('The following [quant,_1,student was,students were] not modified successfully',$lockfail).':&nbsp;<br />';
             $response .= &enrolltype_result(\%nolockchg,$classlist,$endidx,$startidx,$ididx,$secidx,$typeidx,$lockedidx);              $response .= &enrolltype_result(\%nolockchg,$classlist,$endidx,$startidx,$ididx,$secidx,$typeidx,$lockedidx);
         }          }
     }      }
Line 2790  sub print_viewclass_response { Line 2817  sub print_viewclass_response {
   
 sub enrolltype_result {  sub enrolltype_result {
     my ($changes,$classlist,$endidx,$startidx,$ididx,$secidx,$typeidx,$lockedidx) = @_;      my ($changes,$classlist,$endidx,$startidx,$ididx,$secidx,$typeidx,$lockedidx) = @_;
     my $reply = "      my $reply = &Apache::loncommon::start_data_table().
             <table border='2'>                  &Apache::loncommon::start_data_table_header_row().'
              <tr>  
               <th>username</th>                <th>username</th>
               <th>domain</th>                <th>domain</th>
               <th>ID</th>                <th>ID</th>
Line 2800  sub enrolltype_result { Line 2826  sub enrolltype_result {
               <th>section</th>                <th>section</th>
               <th>start date</th>                <th>start date</th>
               <th>end date</th>                <th>end date</th>
               <th>enrollment change</th>                <th>enrollment change</th>'."\n".
              </tr>";                  &Apache::loncommon::end_data_table_header_row();
     foreach (sort keys %{$changes}) {      foreach my $chg (sort keys %{$changes}) {
         my $sdata  = $classlist->{$_};          my $sdata  = $classlist->{$chg};
         my ($uname,$udom) = split/:/,$_;          my ($uname,$udom) = split(/:/,$chg);
         my $section  = $sdata->[$secidx];          my $section  = $sdata->[$secidx];
         my $uid      = $sdata->[$ididx];          my $uid      = $sdata->[$ididx];
         my $start    = $sdata->[$startidx];          my $start    = $sdata->[$startidx];
Line 2821  sub enrolltype_result { Line 2847  sub enrolltype_result {
             $end = &Apache::lonlocal::locallocaltime($end);              $end = &Apache::lonlocal::locallocaltime($end);
         }          }
         if (!defined($section) || ($section eq '')) {          if (!defined($section) || ($section eq '')) {
             $section eq '&nbsp;';              $section = '&nbsp;';
         }          }
         if (!defined($uid) || ($uid eq '')) {          if (!defined($uid) || ($uid eq '')) {
             $uid = '&nbsp';              $uid = '&nbsp;';
         }          }
         $reply .= "          $reply .= &Apache::loncommon::start_data_table_row().' 
              <tr>                <td>'.$uname.'</td>
               <td>$uname</td>                <td>'.$udom.'</td>
               <td>$udom</td>                <td>'.$uid.'</td>
               <td>$uid</td>                <td>'.&Apache::loncommon::plainname($uname,$udom).'</td>
               <td>".&Apache::loncommon::plainname($uname,$udom)."</td>                <td>'.$section.'</td>
               <td>$section</td>                <td>'.$start.'</td>
               <td>$start</td>                <td>'.$end.'</td>
               <td>$end</td>                <td>'.$$changes{$chg}.'</td>'."\n".
               <td>$$changes{$_}</td>               &Apache::loncommon::end_data_table_row();
              </tr>";  
     }      }
     $reply .= "</table>";      $reply .= &Apache::loncommon::end_data_table();
     return $reply;      return $reply;
 }  }
   

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


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