Diff for /loncom/interface/slotrequest.pm between versions 1.122 and 1.126

version 1.122, 2015/05/10 03:58:12 version 1.126, 2015/09/23 23:04:53
Line 37  use Apache::lonnet; Line 37  use Apache::lonnet;
 use Apache::lonnavmaps();  use Apache::lonnavmaps();
 use Date::Manip;  use Date::Manip;
 use lib '/home/httpd/lib/perl/';  use lib '/home/httpd/lib/perl/';
 use LONCAPA;  use LONCAPA qw(:DEFAULT :match);
   
 sub fail {  sub fail {
     my ($r,$code)=@_;      my ($r,$code)=@_;
Line 237  function uncheckSlotRadio() { Line 237  function uncheckSlotRadio() {
     if (document.getElementsByClassName) {      if (document.getElementsByClassName) {
         slotpicks = document.getElementsByClassName('LC_slotpick_radio');          slotpicks = document.getElementsByClassName('LC_slotpick_radio');
     } else {      } else {
         sloctpicks = getElementsByClassName(document.body,'LC_slotpick_radio');          slotpicks = getElementsByClassName(document.body,'LC_slotpick_radio');
     }      }
     if (slotpicks.length) {      if (slotpicks.length) {
         for (var i=0; i<slotpicks.length; i++) {          for (var i=0; i<slotpicks.length; i++) {
Line 689  sub release_reservation { Line 689  sub release_reservation {
         return (0,'error: Unable to determine current status');          return (0,'error: Unable to determine current status');
     }      }
     my $passed_resource = $navmap->getBySymb($symb);      my $passed_resource = $navmap->getBySymb($symb);
     if ($passed_resource->is_map()) {      if (ref($passed_resource)) {
  my ($a_resource) =           if ($passed_resource->is_map()) {
     $navmap->retrieveResources($passed_resource,       my ($a_resource) = 
        sub {$_[0]->is_problem()},0,1);                  $navmap->retrieveResources($passed_resource, 
  $symb = $a_resource->symb();                                             sub {$_[0]->is_problem()},0,1);
               $symb = $a_resource->symb();
           }
       } else {
           unless ($mgr eq 'F') {
               return (0,'error: Unable to determine current status');
           }
     }      }
   
     # get parameter string, check for existance, rebuild string with the slot      # get parameter string, check for existence, rebuild string with the slot
     my $student = &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 @slots = split(/:/,$student);
Line 994  sub allowed_slot { Line 1000  sub allowed_slot {
     return 0 if (!$userallowed);      return 0 if (!$userallowed);
   
     # not allowed for this resource      # not allowed for this resource
     if (defined($slot->{'symb'})      if (defined($slot->{'symb'})) {
  && $slot->{'symb'} ne $symb) {          my $exclude = 1;
         unless ((ref($toskip) eq 'HASH') && ($toskip->{'symb'})) {          my ($slotmap,$slotid,$sloturl) = &Apache::lonnet::decode_symb($slot->{'symb'});
     return 0;          if ($sloturl=~/\.(page|sequence)$/) {
               my ($map,$id,$url) = &Apache::lonnet::decode_symb($symb);
               if (($map ne '') && ($map eq $slotmap)) {
                   $exclude = 0;
               }
           } elsif ($slot->{'symb'} eq $symb) {
               $exclude = 0;
           }
           if ($exclude) {
               unless ((ref($toskip) eq 'HASH') && ($toskip->{'symb'})) {
           return 0;
               }
         }          }
     }      }
   
Line 1343  sub show_table { Line 1360  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 slot is restricted to.',       'symb'            => 'Resource/Map 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 2666  sub csvupload_fields { Line 2683  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 Restriction'],      ['symb','Resource/Map 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'],
Line 2773  sub csv_upload_assign { Line 2790  sub csv_upload_assign {
  $slot{$key}=$entries{$fields{$key}};   $slot{$key}=$entries{$fields{$key}};
     }      }
  }   }
           if ($entries{$fields{'allowedusers'}}) {
               $entries{$fields{'allowedusers'}} =~ s/^\s+//;
               $entries{$fields{'allowedusers'}} =~ s/\s+$//;
               my @allowedusers;
               foreach my $poss (split(/\s*,\s*/,$entries{$fields{'allowedusers'}})) {
                   my ($possuname,$possudom) = split(/:/,$poss);
                   if (($possuname =~ /^$match_username$/) && ($possudom =~ /^$match_domain$/)) {
                       unless (grep(/^\Q$poss\E$/,@allowedusers)) {
                           push(@allowedusers,$poss);
                       }
                   }
               }
               if (@allowedusers > 0) {
                   $slot{'allowedusers'} = join(',',@allowedusers);
               }
           }
           if ($entries{$fields{'allowedsections'}}) {
               $entries{$fields{'allowedsections'}} =~ s/^\s+//;
               $entries{$fields{'allowedsections'}} =~ s/\s+$//;
               my @allowedsections;
               foreach my $poss (split(/\s*,\s*/,$entries{$fields{'allowedsections'}})) {
                   if (($poss !~ /\W/) && ($poss ne 'none')) {
                       unless (grep(/^\Q$poss\E$/,@allowedsections)) {
                           push(@allowedsections,$poss);
                       }
                   }
               }
               if (@allowedsections > 0) {
                   $slot{'allowedsections'} = join(',',@allowedsections);
               }
           }
  if ($entries{$fields{'uniqueperiod'}}) {   if ($entries{$fields{'uniqueperiod'}}) {
     my ($start,$end)=split(',',$entries{$fields{'uniqueperiod'}});      my ($start,$end)=split(',',$entries{$fields{'uniqueperiod'}});
     my @times=(&UnixDate($start,"%s"),      my @times=(&UnixDate($start,"%s"),

Removed from v.1.122  
changed lines
  Added in v.1.126


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