Diff for /loncom/interface/slotrequest.pm between versions 1.129 and 1.130

version 1.129, 2015/09/27 14:21:48 version 1.130, 2015/09/27 22:35:39
Line 1114  sub allowed_slot { Line 1114  sub allowed_slot {
     # not allowed for this resource      # not allowed for this resource
     if (defined($slot->{'symb'})) {      if (defined($slot->{'symb'})) {
         my $exclude = 1;          my $exclude = 1;
         my ($slotmap,$slotid,$sloturl) = &Apache::lonnet::decode_symb($slot->{'symb'});          my @symbs;
         if ($sloturl=~/\.(page|sequence)$/) {          if ($slot->{'symb'} =~ /,/) {
             my ($map,$id,$url) = &Apache::lonnet::decode_symb($symb);              @symbs = split(/\s*,\s*/,$slot->{'symb'});
             if (($map ne '') && ($map eq $slotmap)) {          } else {
               @symbs = ($slot->{'symb'});
           }
           my ($map,$id,$url) = &Apache::lonnet::decode_symb($symb);
           foreach my $reqsymb (@symbs) {
               next if ($reqsymb eq '');
               my ($slotmap,$slotid,$sloturl) = &Apache::lonnet::decode_symb($reqsymb);
               if ($sloturl=~/\.(page|sequence)$/) {
                   if (($map ne '') && ($map eq $sloturl)) {
                       $exclude = 0;
                       last;
                   }
               } elsif ($reqsymb eq $symb) {
                 $exclude = 0;                  $exclude = 0;
                   last;
             }              }
         } elsif ($slot->{'symb'} eq $symb) {  
             $exclude = 0;  
         }          }
         if ($exclude) {          if ($exclude) {
             unless ((ref($toskip) eq 'HASH') && ($toskip->{'symb'})) {              unless ((ref($toskip) eq 'HASH') && ($toskip->{'symb'})) {
Line 1478  sub show_table { Line 1489  sub show_table {
      'secret'          => 'Secret Word',       'secret'          => 'Secret Word',
      'space'           => '# of students/max',       'space'           => '# of students/max',
      'ip'              => 'IP or DNS restrictions',       'ip'              => 'IP or DNS restrictions',
      'symb'            => 'Resource/Map slot is restricted to.',       'symb'            => 'Resource(s)/Map(s) slot is restricted to.',
      'allowedsections' => 'Sections slot is restricted to.',       'allowedsections' => 'Sections slot is restricted to.',
      'allowedusers'    => 'Users slot is restricted to.',       'allowedusers'    => 'Users slot is restricted to.',
      'uniqueperiod'    => 'Period of time slot is unique',       'uniqueperiod'    => 'Period of time slot is unique',
Line 1693  sub show_table { Line 1704  sub show_table {
  localtime($slots{$slot}{'uniqueperiod'}[1]);   localtime($slots{$slot}{'uniqueperiod'}[1]);
  }   }
   
  my $title;   my @titles;
  if (exists($slots{$slot}{'symb'})) {   if (exists($slots{$slot}{'symb'})) {
     my (undef,undef,$res)=              my @symbs;
  &Apache::lonnet::decode_symb($slots{$slot}{'symb'});              if ($slots{$slot}{'symb'} =~ /,/) {
     $res =   &Apache::lonnet::clutter($res);                  @symbs = split(/\s*,\s*/,$slots{$slot}{'symb'});
     $title = &Apache::lonnet::gettitle($slots{$slot}{'symb'});              } else {
     $title='<a href="'.$res.'?symb='.$slots{$slot}{'symb'}.'">'.$title.'</a>';                  @symbs = ($slots{$slot}{'symb'});
               }
               foreach my $reqsymb (@symbs) {
           my (undef,undef,$res) =
       &Apache::lonnet::decode_symb($reqsymb);
           $res = &Apache::lonnet::clutter($res);
           my $title = &Apache::lonnet::gettitle($reqsymb);
           push(@titles,'<a href="'.$res.'?symb='.$reqsymb.'">'.$title.'</a>');
               }
  }   }
   
  my $allowedsections;   my $allowedsections;
Line 1816  LOGLINK Line 1835  LOGLINK
     $colspan++;$r->print("<td>$slots{$slot}{'ip'}</td>\n");      $colspan++;$r->print("<td>$slots{$slot}{'ip'}</td>\n");
  }   }
  if (exists($show{'symb'})) {   if (exists($show{'symb'})) {
     $colspan++;$r->print("<td>$title</td>\n");      $colspan++;$r->print("<td>".join('<br />',@titles)."</td>\n");
  }   }
  if (exists($show{'allowedsections'})) {   if (exists($show{'allowedsections'})) {
     $colspan++;$r->print("<td>$allowedsections</td>\n");      $colspan++;$r->print("<td>$allowedsections</td>\n");
Line 2186  sub slot_chooser { Line 2205  sub slot_chooser {
                 foreach my $slot (@{$allavailable}) {                  foreach my $slot (@{$allavailable}) {
                     # not allowed for this resource                      # not allowed for this resource
                     if (ref($slots->{$slot}) eq 'HASH') {                      if (ref($slots->{$slot}) eq 'HASH') {
                         if ((defined($slots->{$slot}->{'symb'})) &&                          if ($slots->{$slot}->{'symb'} ne '') {
                             ($slots->{$slot}->{'symb'} ne $symb)) {                              my ($map,$id,$url) = &Apache::lonnet::decode_symb($symb);
                             next;                              my $exclude = 1;
                               my @reqsymbs = split(/\s*,\s*/,$slots->{$slot}->{'symb'});
                               if (@reqsymbs) {
                                   if (grep(/^\Q$symb\E$/,@reqsymbs)) {
                                       $exclude = 0;
                                   } else {
                                       foreach my $reqsymb (@reqsymbs) {
                                           my (undef,undef,$sloturl) = &Apache::lonnet::decode_symb($reqsymb);
                                           if ($sloturl=~/\.(page|sequence)$/) {
                                               if (($map ne '') && ($map eq $sloturl)) {
                                                   $exclude = 0;
                                                   last;
                                               }
                                           }
                                       }
                                   }
                                   next if ($exclude);   
                               }
                         }                          }
                     }                      }
                     push(@available,$slot);                      push(@available,$slot);
Line 2919  sub csvupload_fields { Line 2955  sub csvupload_fields {
     ['proctor','List of proctor ids'],      ['proctor','List of proctor ids'],
     ['description','Slot Description'],      ['description','Slot Description'],
     ['maxspace','Maximum number of reservations'],      ['maxspace','Maximum number of reservations'],
     ['symb','Resource/Map Restriction'],      ['symb','Resource(s)/Map(s) Restriction'],
     ['uniqueperiod','Date range of slot exclusion'],      ['uniqueperiod','Date range of slot exclusion'],
     ['secret','Secret word proctor uses to validate'],      ['secret','Secret word proctor uses to validate'],
     ['allowedsections','Sections slot is restricted to'],      ['allowedsections','Sections slot is restricted to'],

Removed from v.1.129  
changed lines
  Added in v.1.130


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