Diff for /loncom/interface/slotrequest.pm between versions 1.7 and 1.12

version 1.7, 2005/08/09 15:38:13 version 1.12, 2005/09/06 21:31:03
Line 38  use Apache::lonnet; Line 38  use Apache::lonnet;
 sub fail {  sub fail {
     my ($r,$code)=@_;      my ($r,$code)=@_;
     if ($code eq 'not_valid') {      if ($code eq 'not_valid') {
  $r->print('<p>'.&mt('Unable to understand what resource you wanted to sign up for.').'</p>'.$env{'form.symb'});   $r->print('<p>'.&mt('Unable to understand what resource you wanted to sign up for.').'</p>');
   
       } elsif ($code eq 'not_allowed') {
    $r->print('<p>'.&mt('Not allowed to sign up or change reservations at this time.').'</p>');
       } else {
    $r->print('<p>'.&mt('Failed.').'</p>');
     }      }
       
     $r->print('<p><a href="/adm/flip?postdata=return:">'.      $r->print('<p><a href="/adm/flip?postdata=return:">'.
       &mt('Return to last resource').'</a></p>');        &mt('Return to last resource').'</a></p>');
     &end_page($r);      &end_page($r);
Line 451  sub show_table { Line 456  sub show_table {
     my ($cnum,$cdom)=&get_course();      my ($cnum,$cdom)=&get_course();
     my %slots=&Apache::lonnet::dump('slots',$cdom,$cnum);      my %slots=&Apache::lonnet::dump('slots',$cdom,$cnum);
     my $available;      my $available;
     $r->print('<table border="1">');      $r->print('<table border="1">
   <tr>
     <th>Slot name</th>
     <th>Type</th>
     <th>Description</th>
     <th>Start Time</th>
     <th>End Time</th>
     <th>Max space</th>
     <th>Scheduled Students</th>
     <th>Proctors</th>
     <th>Unique Period</th>
   </tr>');
     foreach my $slot (sort       foreach my $slot (sort 
       { return $slots{$a}->{'starttime'} <=> $slots{$b}->{'starttime'} }        { return $slots{$a}->{'starttime'} <=> $slots{$b}->{'starttime'} }
       (keys(%slots)))  {        (keys(%slots)))  {
Line 472  sub show_table { Line 488  sub show_table {
  $r->print(<<STUFF);   $r->print(<<STUFF);
 <tr>  <tr>
  <td>$slot</td>   <td>$slot</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>$slots{$slot}->{'maxspace'}</td>   <td>$slots{$slot}->{'maxspace'}</td>
  <td>$ids</td>   <td>$ids</td>
    <td>$slots{$slot}->{'proctor'}</td>
    <td>$slots{$slot}->{'uniqueperiod'}</td>
 </tr>  </tr>
 STUFF  STUFF
     }      }
Line 486  STUFF Line 505  STUFF
 sub handler {  sub handler {
     my $r=shift;      my $r=shift;
   
       &Apache::loncommon::get_unprocessed_cgi($ENV{'QUERY_STRING'});
     &start_page($r);      &start_page($r);
     my $symb=&Apache::lonnet::unescape($env{'form.symb'});      my $symb=&Apache::lonnet::unescape($env{'form.symb'});
     my (undef,undef,$res)=&Apache::lonnet::decode_symb($symb);      my (undef,undef,$res)=&Apache::lonnet::decode_symb($symb);
Line 493  sub handler { Line 513  sub handler {
  &fail($r,'not_valid');   &fail($r,'not_valid');
  return OK;   return OK;
     }      }
        $env{'request.symb'}=$symb;
     if ($env{'form.command'} eq 'showslots') {      my $vgr=&Apache::lonnet::allowed('vgr',$env{'request.course.id'});
       if ($env{'form.command'} eq 'showslots' && $vgr eq 'F') {
  &show_table($r,$symb);   &show_table($r,$symb);
     } elsif ($env{'form.requestattempt'}) {      } else {
  &show_choices($r,$symb);   my ($status) = &Apache::lonhomework::check_task_access('0');
     } elsif ($env{'form.command'} eq 'release') {   if ($status eq 'CAN_ANSWER' ||
  &release_slot($r,$symb);      $status eq 'NEEDS_CHECKIN' ||
     } elsif ($env{'form.command'} eq 'get') {      $status eq 'WAITING_FOR_GRADE') {
  &get_slot($r,$symb);      &fail($r,'not_allowed');
     } elsif ($env{'form.command'} eq 'change') {      return OK;
         &release_slot($r,$symb,$env{'form.releaseslot'},1);   }
  &get_slot($r,$symb);   if ($env{'form.requestattempt'}) {
       &show_choices($r,$symb);
    } elsif ($env{'form.command'} eq 'release') {
       &release_slot($r,$symb);
    } elsif ($env{'form.command'} eq 'get') {
       &get_slot($r,$symb);
    } elsif ($env{'form.command'} eq 'change') {
       &release_slot($r,$symb,$env{'form.releaseslot'},1);
       &get_slot($r,$symb);
    } else {
       $r->print("<p>Unknown command: ".$env{'form.command'}."</p>");
    }
     }      }
     &end_page($r);      &end_page($r);
     return OK;      return OK;

Removed from v.1.7  
changed lines
  Added in v.1.12


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