Diff for /loncom/interface/slotrequest.pm between versions 1.19 and 1.23

version 1.19, 2005/10/07 19:44:06 version 1.23, 2005/10/17 18:23:46
Line 466  sub show_table { Line 466  sub show_table {
 <input type="submit" name="start" value="'.&mt('Upload Slot List').'" />  <input type="submit" name="start" value="'.&mt('Upload Slot List').'" />
 </form>');  </form>');
     }      }
       my $linkstart='<a href="/adm/slotrequest?command=showslots&amp;order=';
     $r->print('<table border="1">      $r->print('<table border="1">
 <tr>  <tr>
   <th></th>    <th></th>
   <th>Slot name</th>    <th>'.$linkstart.'name"        >Slot name</a></th>
   <th>Type</th>    <th>'.$linkstart.'type"        >Type</a></th>
   <th>Description</th>    <th>'.$linkstart.'description" >Description</a></th>
   <th>Start Time</th>    <th>'.$linkstart.'starttime"   >Start Time</a></th>
   <th>End Time</th>    <th>'.$linkstart.'endtime"     >End Time</a></th>
   <th>Max space</th>    <th>'.$linkstart.'startreserve">Time Students Can Start Reserving</a></th>
   <th>Scheduled Students</th>    <th>'.$linkstart.'secret"      >Secret</a></th>
   <th>Proctors</th>    <th>'.$linkstart.'maxspace"    >Max space</a></th>
   <th>Unique Period</th>    <th>                            Scheduled Students</th>
     <th>'.$linkstart.'unique"      >Unique Period</a></th>
 </tr>');  </tr>');
     foreach my $slot (sort       my %name_cache;
       { return $slots{$a}->{'starttime'} <=> $slots{$b}->{'starttime'} }      my $slotsort = sub {
       (keys(%slots)))  {   if ($env{'form.order'}=~/^(type|description|endtime|maxspace)$/) {
       if (lc($slots{$a}->{$env{'form.order'}})
    ne lc($slots{$b}->{$env{'form.order'}})) {
    return (lc($slots{$a}->{$env{'form.order'}}) 
    cmp lc($slots{$b}->{$env{'form.order'}}));
       }
    } elsif ($env{'form.order'} eq 'name') {
       if (lc($a) cmp lc($b)) {
    return lc($a) cmp lc($b);
       }
    } elsif ($env{'form.order'} eq 'unique') {
       
       if ($slots{$a}->{'uniqueperiod'}[0] 
    ne $slots{$b}->{'uniqueperiod'}[0]) {
    return ($slots{$a}->{'uniqueperiod'}[0]
    cmp $slots{$b}->{'uniqueperiod'}[0]);
       }
       if ($slots{$a}->{'uniqueperiod'}[1] 
    ne $slots{$b}->{'uniqueperiod'}[1]) {
    return ($slots{$a}->{'uniqueperiod'}[1]
    cmp $slots{$b}->{'uniqueperiod'}[1]);
       }
    }
    return $slots{$a}->{'starttime'} <=> $slots{$b}->{'starttime'};
       };
       foreach my $slot (sort $slotsort (keys(%slots)))  {
  if (defined($slots{$slot}->{'type'})   if (defined($slots{$slot}->{'type'})
     && $slots{$slot}->{'type'} ne 'schedulable_student') {      && $slots{$slot}->{'type'} ne 'schedulable_student') {
     #next;      #next;
Line 494  sub show_table { Line 521  sub show_table {
     my (undef,$id)=split("\0",$entry);      my (undef,$id)=split("\0",$entry);
     $ids.= $id.'-> '.$consumed{$entry}->{'name'}.'<br />';      $ids.= $id.'-> '.$consumed{$entry}->{'name'}.'<br />';
  }   }
  my $start=localtime($slots{$slot}->{'starttime'});   my $start=&Apache::lonlocal::locallocaltime($slots{$slot}->{'starttime'});
  my $end=localtime($slots{$slot}->{'endtime'});   my $end=&Apache::lonlocal::locallocaltime($slots{$slot}->{'endtime'});
    my $start_reserve=&Apache::lonlocal::locallocaltime($slots{$slot}->{'startreserve'});
  my $unique;   my $unique;
  if (ref($slots{$slot}{'uniqueperiod'})) {   if (ref($slots{$slot}{'uniqueperiod'})) {
     $unique=localtime($slots{$slot}{'uniqueperiod'}[0]).','.      $unique=localtime($slots{$slot}{'uniqueperiod'}[0]).','.
  localtime($slots{$slot}{'uniqueperiod'}[1]);   localtime($slots{$slot}{'uniqueperiod'}[1]);
  }   }
    my @proctors = map {
       my ($uname,$udom)=split(/@/,$_);
       my $fullname=$name_cache{$_};
       if (!defined($fullname)) {
    &Apache::lonnet::logthis("Gettign $uname $udom");
    $fullname = &Apache::loncommon::plainname($uname,$udom);
    $fullname =~s/\s/&nbsp;/g;
    $name_cache{$_} = $fullname;
       }
       &Apache::loncommon::aboutmewrapper($fullname,$uname,$udom);
    } (split(/\s*,\s*/,$slots{$slot}->{'proctor'}));
   
    my $proctors=join(', ',@proctors);
   
  my $edit=(<<EDITFORM);   my $edit=(<<EDITFORM);
 <form method="POST">  <form method="POST">
Line 511  sub show_table { Line 552  sub show_table {
 EDITFORM  EDITFORM
  $r->print(<<STUFF);   $r->print(<<STUFF);
 <tr>  <tr>
  <td>$edit</td>   <td rowspan="2">$edit</td>
  <td>$slot</td>   <td>$slot</td>
  <td>$slots{$slot}->{'type'}</td>   <td>$slots{$slot}->{'type'}</td>
  <td>$description</td>   <td>$description</td>
  <td>$start</td>   <td>$start</td>
  <td>$end</td>   <td>$end</td>
    <td>$start_reserve</td>
    <td>$slots{$slot}->{'secret'}</td>
  <td>$slots{$slot}->{'maxspace'}</td>   <td>$slots{$slot}->{'maxspace'}</td>
  <td>$ids</td>   <td>$ids</td>
  <td>$slots{$slot}->{'proctor'}</td>  
  <td>$unique</td>   <td>$unique</td>
 </tr>  </tr>
   <tr>
    <td colspan="10">$proctors</td>
   </tr>
 STUFF  STUFF
     }      }
     $r->print('</table>');      $r->print('</table>');
Line 725  sub csv_upload_assign { Line 770  sub csv_upload_assign {
  if ($entries{$fields{'endtime'}}) {   if ($entries{$fields{'endtime'}}) {
     $slot{'endtime'}=&UnixDate($entries{$fields{'endtime'}},"%s");      $slot{'endtime'}=&UnixDate($entries{$fields{'endtime'}},"%s");
  }   }
    if ($entries{$fields{'startreserve'}}) {
       $slot{'startreserve'}=
    &UnixDate($entries{$fields{'startreserve'}},"%s");
    }
  foreach my $key ('ip','proctor','description','maxspace',   foreach my $key ('ip','proctor','description','maxspace',
  'secret','symb') {   'secret','symb') {
     if ($entries{$fields{$key}}) {      if ($entries{$fields{$key}}) {

Removed from v.1.19  
changed lines
  Added in v.1.23


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