Diff for /loncom/interface/slotrequest.pm between versions 1.45 and 1.47

version 1.45, 2006/02/06 22:42:11 version 1.47, 2006/02/09 18:04:51
Line 694  sub show_table { Line 694  sub show_table {
        'order'   => 'scalar',         'order'   => 'scalar',
        'deleted' => 'scalar',         'deleted' => 'scalar',
        );         );
     &Apache::loncommon::store_course_settings('slotrequest',\%Saveable_Parameters);      &Apache::loncommon::store_course_settings('slotrequest',
     &Apache::loncommon::restore_course_settings('slotrequest',\%Saveable_Parameters);        \%Saveable_Parameters);
       &Apache::loncommon::restore_course_settings('slotrequest',
    \%Saveable_Parameters);
       &Apache::grades::init_perm();
       my ($classlist,$section,$fullname)=&Apache::grades::getclasslist('all');
       &Apache::grades::reset_perm();
   
     my %show_fields=&Apache::lonlocal::texthash(      my %show_fields=&Apache::lonlocal::texthash(
      'name'         => 'Slot Name',       'name'         => 'Slot Name',
Line 709  sub show_table { Line 714  sub show_table {
      'ip'           => 'IP or DNS restrictions',       'ip'           => 'IP or DNS restrictions',
      'symb'         => 'Resource slot is restricted to.',       'symb'         => 'Resource slot is restricted to.',
      'uniqueperiod' => 'Period of time slot is unique',       'uniqueperiod' => 'Period of time slot is unique',
        'scheduled'    => 'Scheduled Students',
      'proctor'      => 'List of proctors');       'proctor'      => 'List of proctors');
     my @show_order=('name','description','type','starttime','endtime',      my @show_order=('name','description','type','starttime','endtime',
        'startreserve','secret','maxspace','ip','symb',         'startreserve','secret','maxspace','ip','symb',
        'uniqueperiod','proctor');         'uniqueperiod','scheduled','proctor');
     my @show =       my @show = 
  (exists($env{'form.show'})) ? &Apache::loncommon::get_env_multiple('form.show')   (exists($env{'form.show'})) ? &Apache::loncommon::get_env_multiple('form.show')
                             : keys(%show_fields);                              : keys(%show_fields);
Line 731  sub show_table { Line 737  sub show_table {
     my $when = (exists($env{'form.when'})) ? $env{'form.when'}      my $when = (exists($env{'form.when'})) ? $env{'form.when'}
                                             : 'now';                                              : 'now';
   
       my %stu_display_fields=
    &Apache::lonlocal::texthash('username' => 'User name',
       'fullname' => 'Full name',
       );
       my @stu_display_order=('fullname','username');
       my @stu_display = 
    (exists($env{'form.studisplay'})) ? &Apache::loncommon::get_env_multiple('form.studisplay')
                                     : keys(%stu_display_fields);
       my %stu_display =  map { $_ => 1 } (@stu_display);
   
     my $hide_radio =       my $hide_radio = 
  &Apache::lonhtmlcommon::radio('deleted',$env{'form.deleted'},'hide');   &Apache::lonhtmlcommon::radio('deleted',$env{'form.deleted'},'hide');
     my $show_radio =       my $show_radio = 
Line 741  sub show_table { Line 757  sub show_table {
     $r->print('<div>');      $r->print('<div>');
     $r->print('<table class="inline">      $r->print('<table class="inline">
       <tr><th>'.&mt('Show').'</th>        <tr><th>'.&mt('Show').'</th>
             <th>'.&mt('Student Display').'</th>
           <th>'.&mt('Open').'</th>            <th>'.&mt('Open').'</th>
           <th>'.&mt('Options').'</th>            <th>'.&mt('Options').'</th>
       </tr>        </tr>
       <tr><td>'.&Apache::loncommon::multiple_select_form('show',\@show,6,\%show_fields,\@show_order).        <tr><td>'.&Apache::loncommon::multiple_select_form('show',\@show,6,\%show_fields,\@show_order).
       '</td>        '</td>
              <td>
            '.&Apache::loncommon::multiple_select_form('studisplay',\@stu_display,
       6,\%stu_display_fields,
       \@stu_display_order).'
              </td>
            <td>'.&Apache::loncommon::select_form($when,'when',%when_fields).             <td>'.&Apache::loncommon::select_form($when,'when',%when_fields).
           '</td>            '</td>
            <td>             <td>
Line 772  sub show_table { Line 794  sub show_table {
     $r->print('<th>'.$linkstart.$which.'">'.$show_fields{$which}.'</a></th>');      $r->print('<th>'.$linkstart.$which.'">'.$show_fields{$which}.'</a></th>');
  }   }
     }      }
     $r->print('<th>Scheduled Students</th></tr>');  
   
     my %name_cache;      my %name_cache;
     my $slotsort = sub {      my $slotsort = sub {
Line 808  sub show_table { Line 829  sub show_table {
     #next;      #next;
  }   }
  my $description=&get_description($slot,$slots{$slot});   my $description=&get_description($slot,$slots{$slot});
  my %consumed=&Apache::lonnet::dump('slot_reservations',$cdom,$cnum,  
    "^$slot\0");  
  my $ids;   my $ids;
    if (exists($show{'scheduled'})) {
  my ($tmp)=%consumed;      my %consumed=&Apache::lonnet::dump('slot_reservations',$cdom,$cnum,
  if ($tmp !~ /^error: /) {         "^$slot\0");
     foreach my $entry (sort(keys(%consumed))) {      my ($tmp)=%consumed;
  my (undef,$id)=split("\0",$entry);      if ($tmp !~ /^error: /) {
  my ($uname,$udom) = split('@',$consumed{$entry}{'name'});   foreach my $entry (sort(keys(%consumed))) {
  my $name = &Apache::loncommon::plainname($uname,$udom);      my (undef,$id)=split("\0",$entry);
  $ids.= '<nobr>'.$name.&remove_link($slot,$entry,$uname,$udom,      my ($uname,$udom) = split('@',$consumed{$entry}{'name'});
    $consumed{$entry}{'symb'})      $ids.= '<nobr>';
     .'</nobr><br />';      foreach my $item (@stu_display_order) {
    if ($stu_display{$item}) {
       if ($item eq 'fullname') {
    $ids.=$fullname->{"$uname:$udom"}.' ';
       } elsif ($item eq 'username') {
    $ids.="<tt>$uname\@$udom</tt> ";
       }
    }
       }
       $ids.=&remove_link($slot,$entry,$uname,$udom,
          $consumed{$entry}{'symb'}).'</nobr><br />';
    }
     }      }
  }   }
   
Line 908  DELETELINK Line 938  DELETELINK
  if (exists($show{'uniqueperiod'})) {   if (exists($show{'uniqueperiod'})) {
     $colspan++;$r->print("<td>$unique</td>\n");      $colspan++;$r->print("<td>$unique</td>\n");
  }   }
  $colspan++;$r->print("<td>$ids</td>\n</tr>\n");   if (exists($show{'scheduled'})) {
       $colspan++;$r->print("<td>$ids</td>\n</tr>\n");
    }
  if (exists($show{'proctor'})) {   if (exists($show{'proctor'})) {
     $r->print(<<STUFF);      $r->print(<<STUFF);
 <tr>  <tr>

Removed from v.1.45  
changed lines
  Added in v.1.47


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