Diff for /loncom/interface/slotrequest.pm between versions 1.77 and 1.83

version 1.77, 2007/04/10 23:31:18 version 1.83, 2008/09/20 02:53:13
Line 241  sub make_reservation { Line 241  sub make_reservation {
    $env{'user.domain'},$env{'user.name'});     $env{'user.domain'},$env{'user.name'});
     &Apache::lonxml::debug("value is  $value<br />");      &Apache::lonxml::debug("value is  $value<br />");
   
     my $use_slots = &Apache::lonnet::EXT("resource.0.useslots");      my $use_slots = &Apache::lonnet::EXT("resource.0.useslots",$symb,
    $env{'user.domain'},$env{'user.name'});
     &Apache::lonxml::debug("use_slots is  $use_slots<br />");      &Apache::lonxml::debug("use_slots is  $use_slots<br />");
   
     if (&Apache::lonnet::error($value)       if (&Apache::lonnet::error($value) 
Line 334  sub remove_registration { Line 335  sub remove_registration {
     my %consumed=&Apache::lonnet::dump('slot_reservations',$cdom,$cnum,      my %consumed=&Apache::lonnet::dump('slot_reservations',$cdom,$cnum,
        "^$slot_name\0");         "^$slot_name\0");
     if (&Apache::lonnet::error(%consumed)) {      if (&Apache::lonnet::error(%consumed)) {
  $r->print("<p>".&mt('A network error has occured.').'</p>');   $r->print("<p><span class=\"LC_error\">".&mt('A network error has occurred.').'</span></p>');
  return;   return;
     }      }
     if (!%consumed) {      if (!%consumed) {
Line 459  sub release_reservation { Line 460  sub release_reservation {
     return (0,&mt('Not allowed to release Reservation: [_1], as it has already ended.',$description));      return (0,&mt('Not allowed to release Reservation: [_1], as it has already ended.',$description));
  }   }
     }      }
   
       # if the reservation symb is for a map get a resource in that map
       # to check slot parameters on
       my $navmap=Apache::lonnavmaps::navmap->new;
       my $passed_resource = $navmap->getBySymb($symb);
       if ($passed_resource->is_map()) {
    my ($a_resource) = 
       $navmap->retrieveResources($passed_resource, 
          sub {$_[0]->is_problem()},0,1);
    $symb = $a_resource->symb();
       }
   
     # get parameter string, check for existance, rebuild string with the slot      # get parameter string, check for existance, rebuild string with the slot
     my @slots = split(/:/,&Apache::lonnet::EXT("resource.0.availablestudent",      my $student = &Apache::lonnet::EXT("resource.0.availablestudent",
        $symb,$udom,$uname));                                         $symb,$udom,$uname);
       my @slots = split(/:/,$student);
   
     my @new_slots;      my @new_slots;
     foreach my $exist_slot (@slots) {      foreach my $exist_slot (@slots) {
Line 482  sub release_reservation { Line 496  sub release_reservation {
  }   }
     }      }
   
     my $use_slots = &Apache::lonnet::EXT("resource.0.useslots");      my $use_slots = &Apache::lonnet::EXT("resource.0.useslots",
    $symb,$udom,$uname);
     &Apache::lonxml::debug("use_slots is  $use_slots<br />");      &Apache::lonxml::debug("use_slots is  $use_slots<br />");
   
     if (&Apache::lonnet::error($use_slots)) {       if (&Apache::lonnet::error($use_slots)) { 
Line 527  sub delete_slot { Line 542  sub delete_slot {
  if ($ret eq 'ok') {   if ($ret eq 'ok') {
     $r->print("<p>Slot <tt>$slot_name</tt> marked as deleted.</p>");      $r->print("<p>Slot <tt>$slot_name</tt> marked as deleted.</p>");
  } else {   } else {
     $r->print("<p> An error ($ret) occurse when attempting to delete Slot <tt>$slot_name</tt>.</p>");      $r->print("<p><span class=\"LC_error\"> An error ($ret) occurse when attempting to delete Slot <tt>$slot_name</tt>.</span></p>");
  }   }
     } else {      } else {
  if (%consumed) {   if (%consumed) {
Line 554  sub get_slot { Line 569  sub get_slot {
     my $slot_name=&check_for_conflict($symb,$env{'form.slotname'},\%slot);      my $slot_name=&check_for_conflict($symb,$env{'form.slotname'},\%slot);
   
     if ($slot_name =~ /^error: (.*)/) {      if ($slot_name =~ /^error: (.*)/) {
  $r->print("<p>An error occured while attempting to make a reservation. ($1)</p>");   $r->print('<p><span class="LC_error">'
                    .&mt('An error occurred while attempting to make a reservation. ([_1])',$1)
                    .'</span></p>');
  &return_link($r);   &return_link($r);
  return 0;   return 0;
     }      }
Line 595  STUFF Line 612  STUFF
     if (defined($reserved)) {      if (defined($reserved)) {
  my $retvalue = 0;   my $retvalue = 0;
  if ($slot_name =~ /^error: (.*)/) {   if ($slot_name =~ /^error: (.*)/) {
     $r->print("<p>An error occured while attempting to make a reservation. ($1)</p>");      $r->print('<p><span class="LC_error">'
                        .&mt('An error occurred while attempting to make a reservation. ([_1])',$1)
                        .'</span></p>');
  } elsif ($reserved > -1) {   } elsif ($reserved > -1) {
     $r->print("<p>Success: $description</p>");      $r->print("<p>Success: $description</p>");
     $retvalue = 1;      $retvalue = 1;
Line 616  STUFF Line 635  STUFF
     }      }
   
     $r->print(<<STUFF);      $r->print(<<STUFF);
 <p> <font color="red">Failed</font> to reserve a spot for $description. </p>  <p> <span class="LC_warning">Failed</span> 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'}" />
Line 1108  sub show_table { Line 1127  sub show_table {
  my ($id_count,$ids);   my ($id_count,$ids);
           
  if (exists($show{'scheduled'}) || exists($show{'space'}) ) {   if (exists($show{'scheduled'}) || exists($show{'space'}) ) {
     my @this_slot = grep(/^$slot\0/,keys(%consumed));      my $re_str = "$slot\0";
       my @this_slot = grep(/^\Q$re_str\E/,keys(%consumed));
     $id_count = scalar(@this_slot);      $id_count = scalar(@this_slot);
     if (exists($show{'scheduled'})) {      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))) {     (@this_slot)) {
     my (undef,$id)=split("\0",$entry);      my (undef,$id)=split("\0",$entry);
     my ($uname,$udom) = split(':',$consumed{$entry}{'name'});      my ($uname,$udom) = split(':',$consumed{$entry}{'name'});
     $ids.= '<nobr>';      $ids.= '<nobr>';
Line 1547  sub csv_upload_assign { Line 1567  sub csv_upload_assign {
     }      }
     $r->print("<p>Created $countdone slots\n</p>");      $r->print("<p>Created $countdone slots\n</p>");
     foreach my $error (@errors) {      foreach my $error (@errors) {
  $r->print("<p>$error\n</p>");   $r->print("<p><span class=\"LC_warning\">$error</span></p>\n");
     }      }
     &show_table($r,$mgr);      &show_table($r,$mgr);
     return '';      return '';

Removed from v.1.77  
changed lines
  Added in v.1.83


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