Diff for /loncom/interface/slotrequest.pm between versions 1.60 and 1.64

version 1.60, 2006/05/12 01:20:31 version 1.64, 2006/06/16 19:49:00
Line 36  use Apache::lonlocal; Line 36  use Apache::lonlocal;
 use Apache::lonnet;  use Apache::lonnet;
 use Apache::lonnavmaps();  use Apache::lonnavmaps();
 use Date::Manip;  use Date::Manip;
   use lib '/home/httpd/lib/perl/';
   use LONCAPA;
   
 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>');   $r->print('<p>'.&mt('Unable to understand what resource you wanted to sign up for.').'</p>');
       } elsif ($code eq 'not_available') {
    $r->print('<p>'.&mt('No slots are available.').'</p>');
     } elsif ($code eq 'not_allowed') {      } elsif ($code eq 'not_allowed') {
  $r->print('<p>'.&mt('Not allowed to sign up or change reservations at this time.').'</p>');   $r->print('<p>'.&mt('Not allowed to sign up or change reservations at this time.').'</p>');
     } else {      } else {
Line 382  sub remove_registration_confirmation { Line 385  sub remove_registration_confirmation {
  'no'  => 'No',);   'no'  => 'No',);
     $r->print(<<"END_CONFIRM");      $r->print(<<"END_CONFIRM");
 <p> $msg </p>  <p> $msg </p>
 <form action="/adm/slotrequest" method="POST">  <form action="/adm/slotrequest" method="post">
     <input type="hidden" name="command" value="release" />      <input type="hidden" name="command" value="release" />
     <input type="hidden" name="button" value="yes" />      <input type="hidden" name="button" value="yes" />
     $hidden_input      $hidden_input
     <input type="submit" value="$lt{'yes'}" />      <input type="submit" value="$lt{'yes'}" />
 </form>  </form>
 <form action="/adm/slotrequest" method="POST">  <form action="/adm/slotrequest" method="post">
     <input type="hidden" name="command" value="showslots" />      <input type="hidden" name="command" value="showslots" />
     <input type="submit" value="$lt{'no'}" />      <input type="submit" value="$lt{'no'}" />
 </form>  </form>
Line 568  sub get_slot { Line 571  sub get_slot {
  $r->print("<p>Already have a reservation: $description1</p>");   $r->print("<p>Already have a reservation: $description1</p>");
  if ($slot_name ne $env{'form.slotname'}) {   if ($slot_name ne $env{'form.slotname'}) {
     $r->print(<<STUFF);      $r->print(<<STUFF);
 <form method="POST" action="/adm/slotrequest">  <form method="post" action="/adm/slotrequest">
    <input type="hidden" name="symb" value="$env{'form.symb'}" />     <input type="hidden" name="symb" value="$env{'form.symb'}" />
    <input type="hidden" name="slotname" value="$env{'form.slotname'}" />     <input type="hidden" name="slotname" value="$env{'form.slotname'}" />
    <input type="hidden" name="releaseslot" value="$slot_name" />     <input type="hidden" name="releaseslot" value="$slot_name" />
Line 613  STUFF Line 616  STUFF
     $r->print(<<STUFF);      $r->print(<<STUFF);
 <p> <font color="red">Failed</font> to reserve a spot for $description. </p>  <p> <font color="red">Failed</font> to reserve a spot for $description. </p>
 <p>  <p>
 <form method="POST" action="/adm/slotrequest">  <form method="post" action="/adm/slotrequest">
    <input type="submit" name="Try Again" value="$lt{'try'}" />     <input type="submit" name="Try Again" value="$lt{'try'}" />
    <input type="hidden" name="symb" value="$env{'form.symb'}" />     <input type="hidden" name="symb" value="$env{'form.symb'}" />
    <input type="hidden" name="slotname" value="$env{'form.slotname'}" />     <input type="hidden" name="slotname" value="$env{'form.slotname'}" />
Line 623  STUFF Line 626  STUFF
 </p>  </p>
 <p>  <p>
 or  or
 <form method="POST" action="/adm/slotrequest">  <form method="post" action="/adm/slotrequest">
     <input type="hidden" name="symb" value="$env{'form.symb'}" />      <input type="hidden" name="symb" value="$env{'form.symb'}" />
     <input type="submit" name="requestattempt" value="$lt{'request'}" />      <input type="submit" name="requestattempt" value="$lt{'request'}" />
 </form>  </form>
Line 762  sub show_choices { Line 765  sub show_choices {
     $command='get';      $command='get';
  }   }
     }      }
     my $escsymb=&Apache::lonnet::escape($symb);      my $escsymb=&escape($symb);
     $form=<<STUFF;      $form=<<STUFF;
    <form method="POST" action="/adm/slotrequest">     <form method="post" action="/adm/slotrequest">
      <input type="submit" name="Select" value="$text" />       <input type="submit" name="Select" value="$text" />
      <input type="hidden" name="symb" value="$escsymb" />       <input type="hidden" name="symb" value="$escsymb" />
      <input type="hidden" name="slotname" value="$slot" />       <input type="hidden" name="slotname" value="$slot" />
Line 861  sub remove_link { Line 864  sub remove_link {
  undef($udom);   undef($udom);
     }      }
   
     $slotname  = &Apache::lonnet::escape($slotname);      $slotname  = &escape($slotname);
     $entry     = &Apache::lonnet::escape($entry);      $entry     = &escape($entry);
     $uname     = &Apache::lonnet::escape($uname);      $uname     = &escape($uname);
     $udom      = &Apache::lonnet::escape($udom);      $udom      = &escape($udom);
     $symb      = &Apache::lonnet::escape($symb);      $symb      = &escape($symb);
   
     return <<"END_LINK";      return <<"END_LINK";
  <a href="/adm/slotrequest?command=remove_registration&slotname=$slotname&entry=$entry&uname=$uname&udom=$udom&symb=$symb"   <a href="/adm/slotrequest?command=remove_registration&amp;slotname=$slotname&amp;entry=$entry&amp;uname=$uname&amp;udom=$udom&amp;symb=$symb"
    >($remove)</a>     >($remove)</a>
 END_LINK  END_LINK
   
Line 885  sub show_table { Line 888  sub show_table {
     my $available;      my $available;
     if ($mgr eq 'F') {      if ($mgr eq 'F') {
  $r->print('<div>');   $r->print('<div>');
  $r->print('<form method="POST" action="/adm/slotrequest">   $r->print('<form method="post" action="/adm/slotrequest">
 <input type="hidden" name="command" value="uploadstart" />  <input type="hidden" name="command" value="uploadstart" />
 <input type="submit" name="start" value="'.&mt('Upload Slot List').'" />  <input type="submit" name="start" value="'.&mt('Upload Slot List').'" />
 </form>');  </form>');
  $r->print('<form method="POST" action="/adm/helper/newslot.helper">   $r->print('<form method="post" action="/adm/helper/newslot.helper">
 <input type="submit" name="newslot" value="'.&mt('Create a New Slot').'" />  <input type="submit" name="newslot" value="'.&mt('Create a New Slot').'" />
 </form>');  </form>');
  $r->print('</div>');   $r->print('</div>');
Line 976  sub show_table { Line 979  sub show_table {
     my $name_filter = {'type'  => $name_filter_type,      my $name_filter = {'type'  => $name_filter_type,
        'value' => $env{'form.name_filter_value'},};         'value' => $env{'form.name_filter_value'},};
   
       
     #deleted slot filtering      #deleted slot filtering
       #default to hide if no value
       $env{'form.deleted'} ||= 'hide';
     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 = 
  &Apache::lonhtmlcommon::radio('deleted',$env{'form.deleted'},'show');   &Apache::lonhtmlcommon::radio('deleted',$env{'form.deleted'},'show');
   
     $r->print('<form method="POST" action="/adm/slotrequest">      $r->print('<form method="post" action="/adm/slotrequest">
 <input type="hidden" name="command" value="showslots" />');  <input type="hidden" name="command" value="showslots" />');
     $r->print('<div>');      $r->print('<div>');
     $r->print('<table class="inline">      $r->print('<table class="inline">
Line 1105  sub show_table { Line 1111  sub show_table {
   
  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]);
  }   }
   
Line 1146  sub show_table { Line 1152  sub show_table {
  if (exists($show{'proctor'})) {   if (exists($show{'proctor'})) {
     $rowspan=2;      $rowspan=2;
     @proctors= map {      @proctors= map {
  my ($uname,$udom)=split(/@/,$_);   my ($uname,$udom)=split(/:/,$_);
  my $fullname=$name_cache{$_};   my $fullname=$name_cache{$_};
  if (!defined($fullname)) {   if (!defined($fullname)) {
     $fullname = &Apache::loncommon::plainname($uname,$udom);      $fullname = &Apache::loncommon::plainname($uname,$udom);
Line 1163  sub show_table { Line 1169  sub show_table {
 EDITLINK  EDITLINK
   
  my $delete=(<<"DELETELINK");   my $delete=(<<"DELETELINK");
 <a href="/adm/slotrequest?command=delete&slotname=$slot">Delete</a>  <a href="/adm/slotrequest?command=delete&amp;slotname=$slot">Delete</a>
 DELETELINK  DELETELINK
   
         my $remove_all=&remove_link($slot,'remove all').'<br />';          my $remove_all=&remove_link($slot,'remove all').'<br />';
Line 1211  DELETELINK Line 1217  DELETELINK
  if (exists($show{'allowedusers'})) {   if (exists($show{'allowedusers'})) {
     $colspan++;$r->print("<td>$allowedusers</td>\n");      $colspan++;$r->print("<td>$allowedusers</td>\n");
  }   }
    if (exists($show{'uniqueperiod'})) {
       $colspan++;$r->print("<td>$unique</td>\n");
    }
  if (exists($show{'scheduled'})) {   if (exists($show{'scheduled'})) {
     $colspan++;$r->print("<td>$remove_all $ids</td>\n</tr>\n");      $colspan++;$r->print("<td>$remove_all $ids</td>\n");
  }   }
    $r->print("</tr>\n");
  if (exists($show{'proctor'})) {   if (exists($show{'proctor'})) {
     $r->print(<<STUFF);      $r->print(<<STUFF);
 <tr>  <tr>
Line 1222  DELETELINK Line 1232  DELETELINK
 STUFF  STUFF
         }          }
     }      }
     $r->print('</table>');      $r->print('</table></form>');
 }  }
   
 sub upload_start {  sub upload_start {
Line 1549  sub handler { Line 1559  sub handler {
     &csv_upload_map($r);      &csv_upload_map($r);
  }   }
     } else {      } else {
  my $symb=&Apache::lonnet::unescape($env{'form.symb'});   my $symb=&unescape($env{'form.symb'});
    if (!defined($symb)) {
       &fail($r,'not_valid');
       return OK;
    }
  my (undef,undef,$res)=&Apache::lonnet::decode_symb($symb);   my (undef,undef,$res)=&Apache::lonnet::decode_symb($symb);
  my $useslots = &Apache::lonnet::EXT("resource.0.useslots",$symb);   my $useslots = &Apache::lonnet::EXT("resource.0.useslots",$symb);
  if ($useslots ne 'resource' && $useslots ne 'map') {   if ($useslots ne 'resource' && $useslots ne 'map') {
     &fail($r,'not_valid');      &fail($r,'not_available');
     return OK;      return OK;
  }   }
  $env{'request.symb'}=$symb;   $env{'request.symb'}=$symb;

Removed from v.1.60  
changed lines
  Added in v.1.64


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