Diff for /loncom/interface/slotrequest.pm between versions 1.28 and 1.29

version 1.28, 2005/11/02 22:46:12 version 1.29, 2005/11/08 03:13:20
Line 468  sub show_table { Line 468  sub show_table {
 <input type="submit" name="newslot" value="'.&mt('Create a New Slot').'" />  <input type="submit" name="newslot" value="'.&mt('Create a New Slot').'" />
 </form>');  </form>');
     }      }
       
       my %Saveable_Parameters = ('show' => 'array');
   
       &Apache::loncommon::store_course_settings('chart',\%Saveable_Parameters);
       &Apache::loncommon::restore_course_settings('chart',\%Saveable_Parameters);
   
       my %fields=&Apache::lonlocal::texthash(
        'name'         => 'Slot Name',
        'description'  => 'Description',
        'type'         => 'Type',
        'starttime'    => 'Start time',
        'endtime'      => 'End Time',
                'startreserve' => 'Time students can start reserving',
        'secret'       => 'Secret Word',
        'maxspace'     => 'Maxium # of students',
        'ip'           => 'IP or DNS restrictions',
        'symb'         => 'Resource slot is restricted to.',
        'uniqueperiod' => 'Period of time slot is unique',
        'proctor'      => 'List of proctors');
       my @order=('name','description','type','starttime','endtime',
          'startreserve','secret','maxspace','ip','symb',
          'uniqueperiod','proctor');
       my @sel = 
    (exists($env{'form.show'})) ? &Apache::loncommon::get_env_multiple('form.show')
                               : keys(%fields);
       my %sel =  map { $_ => 1 } (@sel);
   
       $r->print('<form method="POST" action="/adm/slotrequest">
   <input type="hidden" name="command" value="showslots" />
   <input type="submit" name="start" value="'.&mt('Change').'" />');
       $r->print('<table><tr><td>Show: '.&Apache::loncommon::multiple_select_form('show',\@sel,6,\%fields,\@order).
         '</td></tr></table>');
     my $linkstart='<a href="/adm/slotrequest?command=showslots&amp;order=';      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>'.$linkstart.'name"        >Slot name</a></th>      foreach my $which (@order) {
   <th>'.$linkstart.'type"        >Type</a></th>   if ($which ne 'proctor' && exists($sel{$which})) {
   <th>'.$linkstart.'description" >Description</a></th>      $r->print('<th>'.$linkstart.$which.'">'.$fields{$which}.'</a></th>');
   <th>'.$linkstart.'starttime"   >Start Time</a></th>   }
   <th>'.$linkstart.'endtime"     >End Time</a></th>      }
   <th>'.$linkstart.'startreserve">Time Students Can Start Reserving</a></th>      $r->print('<th>Scheduled Students</th></tr>');
   <th>'.$linkstart.'secret"      >Secret</a></th>  
   <th>'.$linkstart.'maxspace"    >Max space</a></th>  
   <th>                            Scheduled Students</th>  
   <th>'.$linkstart.'unique"      >Unique Period</a></th>  
 </tr>');  
     my %name_cache;      my %name_cache;
     my $slotsort = sub {      my $slotsort = sub {
  if ($env{'form.order'}=~/^(type|description|endtime|maxspace)$/) {   if ($env{'form.order'}=~/^(type|description|endtime|startreserve|maxspace|ip|symb)$/) {
     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'}}) 
Line 495  sub show_table { Line 523  sub show_table {
     if (lc($a) cmp lc($b)) {      if (lc($a) cmp lc($b)) {
  return lc($a) cmp lc($b);   return lc($a) cmp lc($b);
     }      }
  } elsif ($env{'form.order'} eq 'unique') {   } elsif ($env{'form.order'} eq 'uniqueperiod') {
           
     if ($slots{$a}->{'uniqueperiod'}[0]       if ($slots{$a}->{'uniqueperiod'}[0] 
  ne $slots{$b}->{'uniqueperiod'}[0]) {   ne $slots{$b}->{'uniqueperiod'}[0]) {
Line 535  sub show_table { Line 563  sub show_table {
     $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 $title;
     my ($uname,$udom)=split(/@/,$_);   if (exists($slots{$slot}{'symb'})) {
     my $fullname=$name_cache{$_};      my (undef,undef,$res)=
     if (!defined($fullname)) {   &Apache::lonnet::decode_symb($slots{$slot}{'symb'});
  &Apache::lonnet::logthis("Gettign $uname $udom");      $res =   &Apache::lonnet::clutter($res);
  $fullname = &Apache::loncommon::plainname($uname,$udom);      $title = &Apache::lonnet::gettitle($slots{$slot}{'symb'});
  $fullname =~s/\s/&nbsp;/g;      $title='<a href="'.$res.'?symb='.$slots{$slot}{'symb'}.'">'.$title.'</a>';
  $name_cache{$_} = $fullname;   }
     }   my @proctors;
     &Apache::loncommon::aboutmewrapper($fullname,$uname,$udom);   my $rowspan=1;
  } (sort(split(/\s*,\s*/,$slots{$slot}->{'proctor'})));   my $colspan=1;
    if (exists($sel{'proctor'})) {
       $rowspan=2;
       @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);
       } (sort(split(/\s*,\s*/,$slots{$slot}->{'proctor'})));
    }
  my $proctors=join(', ',@proctors);   my $proctors=join(', ',@proctors);
   
  my $edit=(<<EDITFORM);   my $edit=(<<EDITFORM);
Line 555  sub show_table { Line 596  sub show_table {
   <input type="submit" name="Edit" value="Edit" />    <input type="submit" name="Edit" value="Edit" />
 </form>  </form>
 EDITFORM  EDITFORM
  $r->print(<<STUFF);   
 <tr>          $r->print("<tr>\n<td rowspan=\"$rowspan\">$edit</td>\n");
  <td rowspan="2">$edit</td>   if (exists($sel{'name'})) {
  <td>$slot</td>      $colspan++;$r->print("<td>$slot</td>");
  <td>$slots{$slot}->{'type'}</td>   }
  <td>$description</td>   if (exists($sel{'type'})) {
  <td>$start</td>      $colspan++;$r->print("<td>$slots{$slot}->{'type'}</td>\n");
  <td>$end</td>   }
  <td>$start_reserve</td>   if (exists($sel{'description'})) {
  <td>$slots{$slot}->{'secret'}</td>      $colspan++;$r->print("<td>$description</td>\n");
  <td>$slots{$slot}->{'maxspace'}</td>   }
  <td>$ids</td>   if (exists($sel{'starttime'})) {
  <td>$unique</td>      $colspan++;$r->print("<td>$start</td>\n");
 </tr>   }
    if (exists($sel{'endtime'})) {
       $colspan++;$r->print("<td>$end</td>\n");
    }
    if (exists($sel{'startreserve'})) {
       $colspan++;$r->print("<td>$start_reserve</td>\n");
    }
    if (exists($sel{'secret'})) {
       $colspan++;$r->print("<td>$slots{$slot}{'secret'}</td>\n");
    }
    if (exists($sel{'maxspace'})) {
       $colspan++;$r->print("<td>$slots{$slot}{'maxspace'}</td>\n");
    }
    if (exists($sel{'ip'})) {
       $colspan++;$r->print("<td>$slots{$slot}{'ip'}</td>\n");
    }
    if (exists($sel{'symb'})) {
       $colspan++;$r->print("<td>$title</td>\n");
    }
    if (exists($sel{'uniqueperiod'})) {
       $colspan++;$r->print("<td>$unique</td>\n");
    }
    $colspan++;$r->print("<td>$ids</td>\n</tr>\n");
    if (exists($sel{'proctor'})) {
       $r->print(<<STUFF);
 <tr>  <tr>
  <td colspan="10">$proctors</td>   <td colspan="$colspan">$proctors</td>
 </tr>  </tr>
 STUFF  STUFF
           }
     }      }
     $r->print('</table>');      $r->print('</table>');
 }  }

Removed from v.1.28  
changed lines
  Added in v.1.29


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