Diff for /loncom/interface/slotrequest.pm between versions 1.73 and 1.74

version 1.73, 2006/12/18 22:59:30 version 1.74, 2007/04/10 23:26:49
Line 932  sub show_table { Line 932  sub show_table {
      'endtime'         => 'End Time',       'endtime'         => 'End Time',
              'startreserve'    => 'Time students can start reserving',               'startreserve'    => 'Time students can start reserving',
      'secret'          => 'Secret Word',       'secret'          => 'Secret Word',
      'maxspace'        => 'Maximum # of students',       'space'           => '# of students/max',
      'ip'              => 'IP or DNS restrictions',       'ip'              => 'IP or DNS restrictions',
      'symb'            => 'Resource slot is restricted to.',       'symb'            => 'Resource slot is restricted to.',
      'allowedsections' => 'Sections slot is restricted to.',       'allowedsections' => 'Sections slot is restricted to.',
Line 941  sub show_table { Line 941  sub show_table {
      'scheduled'       => 'Scheduled Students',       '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','space','ip','symb',
     'allowedsections','allowedusers','uniqueperiod',      'allowedsections','allowedusers','uniqueperiod',
     'scheduled','proctor');      'scheduled','proctor');
     my @show =       my @show = 
Line 1053  sub show_table { Line 1053  sub show_table {
   
     my %name_cache;      my %name_cache;
     my $slotsort = sub {      my $slotsort = sub {
  if ($env{'form.order'}=~/^(type|description|endtime|startreserve|maxspace|ip|symb|allowedsections|allowedusers)$/) {   if ($env{'form.order'}=~/^(type|description|endtime|startreserve|ip|symb|allowedsections|allowedusers)$/) {
     if (lc($slots{$a}->{$env{'form.order'}})      if (lc($slots{$a}->{$env{'form.order'}})
  ne lc($slots{$b}->{$env{'form.order'}})) {   ne lc($slots{$b}->{$env{'form.order'}})) {
  return (lc($slots{$a}->{$env{'form.order'}})    return (lc($slots{$a}->{$env{'form.order'}}) 
  cmp lc($slots{$b}->{$env{'form.order'}}));   cmp lc($slots{$b}->{$env{'form.order'}}));
     }      }
    } elsif ($env{'form.order'} eq 'space') {
       if ($slots{$a}{'maxspace'} ne $slots{$b}{'maxspace'}) {
    return ($slots{$a}{'maxspace'} cmp $slots{$b}{'maxspace'});
       }
  } elsif ($env{'form.order'} eq 'name') {   } elsif ($env{'form.order'} eq 'name') {
     if (lc($a) cmp lc($b)) {      if (lc($a) cmp lc($b)) {
  return lc($a) cmp lc($b);   return lc($a) cmp lc($b);
Line 1078  sub show_table { Line 1082  sub show_table {
  }   }
  return $slots{$a}->{'starttime'} <=> $slots{$b}->{'starttime'};   return $slots{$a}->{'starttime'} <=> $slots{$b}->{'starttime'};
     };      };
   
       my %consumed;
       if (exists($show{'scheduled'}) || exists($show{'space'}) ) {
    %consumed=&Apache::lonnet::dump('slot_reservations',$cdom,$cnum);
    my ($tmp)=%consumed;
    if ($tmp =~ /^error: /) { undef(%consumed); }
       }
   
     foreach my $slot (sort $slotsort (keys(%slots)))  {      foreach my $slot (sort $slotsort (keys(%slots)))  {
  if (!&to_show($slot,$slots{$slot},$when,   if (!&to_show($slot,$slots{$slot},$when,
       $env{'form.deleted'},$name_filter)) { next; }        $env{'form.deleted'},$name_filter)) { next; }
Line 1086  sub show_table { Line 1098  sub show_table {
     #next;      #next;
  }   }
  my $description=&get_description($slot,$slots{$slot});   my $description=&get_description($slot,$slots{$slot});
  my $ids;   my ($id_count,$ids);
  if (exists($show{'scheduled'})) {      
     my %consumed=&Apache::lonnet::dump('slot_reservations',$cdom,$cnum,   if (exists($show{'scheduled'}) || exists($show{'space'}) ) {
        "^$slot\0");      my @this_slot = grep(/^$slot\0/,keys(%consumed));
     my ($tmp)=%consumed;      $id_count = scalar(@this_slot);
     if ($tmp !~ /^error: /) {      if (exists($show{'scheduled'})) {
  foreach my $entry (sort { $consumed{$a}{name} cmp    foreach my $entry (sort { $consumed{$a}{name} cmp 
       $consumed{$b}{name} }        $consumed{$b}{name} }
    (keys(%consumed))) {     (keys(%consumed))) {
Line 1216  DELETELINK Line 1228  DELETELINK
  if (exists($show{'secret'})) {   if (exists($show{'secret'})) {
     $colspan++;$r->print("<td>$slots{$slot}{'secret'}</td>\n");      $colspan++;$r->print("<td>$slots{$slot}{'secret'}</td>\n");
  }   }
  if (exists($show{'maxspace'})) {   if (exists($show{'space'})) {
     $colspan++;$r->print("<td>$slots{$slot}{'maxspace'}</td>\n");      my $display = $id_count;
       if ($slots{$slot}{'maxspace'}>0) {
    $display.='/'.$slots{$slot}{'maxspace'};
    if ($slots{$slot}{'maxspace'} <= $id_count) {
       $display = '<strong>'.$display.' (full) </strong>';
    }
       }
       $colspan++;$r->print("<td>$display</td>\n");
  }   }
  if (exists($show{'ip'})) {   if (exists($show{'ip'})) {
     $colspan++;$r->print("<td>$slots{$slot}{'ip'}</td>\n");      $colspan++;$r->print("<td>$slots{$slot}{'ip'}</td>\n");

Removed from v.1.73  
changed lines
  Added in v.1.74


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