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

version 1.125.2.2, 2016/08/08 21:18:31 version 1.126, 2015/09/23 23:04:53
Line 162  $js Line 162  $js
                 var startdate = startm+"/"+startd+"/"+starty;                  var startdate = startm+"/"+startd+"/"+starty;
                 var starttime = new Date(startdate).getTime();                  var starttime = new Date(startdate).getTime();
                 starttime = starttime/1000;                  starttime = starttime/1000;
                 var starth = form.start_hour.options[form.start_hour.selectedIndex].value;  
                 if (numberRegExp.test(starth)) {  
                     starth = parseInt(starth);  
                     if (starth > 0 && starth <= 23) {  
                         starttime += 3600 * starth;  
                     }  
                 }  
                 var enddate = endm+"/"+endd+"/"+endy;                  var enddate = endm+"/"+endd+"/"+endy;
                 var endtime = new Date(enddate).getTime();                  var endtime = new Date(enddate).getTime();
                 endtime = endtime/1000;                  endtime = endtime/1000;
                 var endh = form.end_hour.options[form.end_hour.selectedIndex].value;  
                 if (numberRegExp.test(endh)) {  
                     endh = parseInt(endh);  
                     if (endh > 0 && endh <= 23) {  
                         endtime += 3600 * endh;  
                     }  
                 }  
   
                 var shown = 0;                  var shown = 0;
                 for (var i=0; i<$i; i++) {                  for (var i=0; i<$i; i++) {
                     if ((slotstart[i] >= starttime) && (slotend[i] <= endtime)) {                      if ((slotstart[i] >= starttime) && (slotend[i] <= endtime)) {
Line 1015  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 1364  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 2687  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 2755  sub csv_upload_assign { Line 2751  sub csv_upload_assign {
  }   }
   
  if ($entries{$fields{'startreserve'}}) {   if ($entries{$fields{'startreserve'}}) {
             my $date = &UnixDate($entries{$fields{'startreserve'}},"%s");      $slot{'startreserve'}=
             if ($date eq '') {   &UnixDate($entries{$fields{'startreserve'}},"%s");
                 push(@errors,"$name -- No reservation start time set for slot -- value provided had invalid format");  
             } else {  
                 $slot{'startreserve'} = $date;  
             }  
  }   }
  if (defined($slot{'startreserve'})   if (defined($slot{'startreserve'})
     && $slot{'startreserve'} > $slot{'starttime'}) {      && $slot{'startreserve'} > $slot{'starttime'}) {
Line 2769  sub csv_upload_assign { Line 2761  sub csv_upload_assign {
  }   }
   
         if ($entries{$fields{'endreserve'}}) {          if ($entries{$fields{'endreserve'}}) {
             my $date = &UnixDate($entries{$fields{'endreserve'}},"%s");              $slot{'endreserve'}=
             if ($date eq '') {                  &UnixDate($entries{$fields{'endreserve'}},"%s");
                 push(@errors,"$name -- No reservation end time set for slot -- value provided had invalid format");  
             } else {  
                 $slot{'endreserve'} = $date;  
             }  
         }          }
         if (defined($slot{'endreserve'})          if (defined($slot{'endreserve'})
             && $slot{'endreserve'} > $slot{'starttime'}) {              && $slot{'endreserve'} > $slot{'starttime'}) {
Line 2834  sub csv_upload_assign { Line 2822  sub csv_upload_assign {
             }              }
         }          }
  if ($entries{$fields{'uniqueperiod'}}) {   if ($entries{$fields{'uniqueperiod'}}) {
             my ($start,$end)= map { &UnixDate($_,"%s"); } split(',',$entries{$fields{'uniqueperiod'}});      my ($start,$end)=split(',',$entries{$fields{'uniqueperiod'}});
             if (($start ne '') && ($end ne '')) {      my @times=(&UnixDate($start,"%s"),
                 $slot{'uniqueperiod'}=[$start,$end];         &UnixDate($end,"%s"));
             } else {      $slot{'uniqueperiod'}=\@times;
                 push(@errors,"$name -- Slot's unique period ignored -- one or both of the comma separated values for start and end had an invalid format");  
             }  
  }   }
  if (ref($slot{'uniqueperiod'}) eq 'ARRAY'    if (defined($slot{'uniqueperiod'})
     && $slot{'uniqueperiod'}[0] > $slot{'uniqueperiod'}[1]) {      && $slot{'uniqueperiod'}[0] > $slot{'uniqueperiod'}[1]) {
     push(@errors,"$name not created -- Slot's unique period start time is later than the unique period's end time.");      push(@errors,"$name not created -- Slot's unique period start time is later than the unique period's end time.");
     next;      next;

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


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