Diff for /loncom/html/adm/helper/newslot.helper between versions 1.30.6.2 and 1.31

version 1.30.6.2, 2020/04/08 20:54:58 version 1.31, 2015/09/23 23:05:04
Line 26 Line 26
   my $name=$helper->{VARS}{'origname'};    my $name=$helper->{VARS}{'origname'};
   my %slot=&Apache::lonnet::get('slots', [$name], $cdom, $cnum);    my %slot=&Apache::lonnet::get('slots', [$name], $cdom, $cnum);
   if (!ref($slot{$name})) { return $default; }    if (!ref($slot{$name})) { return $default; }
           if (($which eq 'ipdeny') || ($which eq 'ipallow')) {    if (!exists($slot{$name}{$which})) { return $default; }
               if (!exists($slot{$name}{'ip'})) { return $default; }    return $slot{$name}{$which};
           } else {  
               if (!exists($slot{$name}{$which})) { return $default; }  
           }  
           if (($which eq 'ipdeny') || ($which eq 'ipallow')) {  
               my @allows;  
               my @denies;  
               foreach my $item (split(',',$slot{$name}{'ip'})) {  
                   $item =~ s/^\s*//;  
                   $item =~ s/\s*$//;  
                   if ($item =~ /^\!(.+)$/) {  
                       push(@denies,$1);  
                   } else {  
                       push(@allows,$item);  
                   }  
               }  
               if ($which eq 'ipdeny') {  
                   return join(',',@denies);  
               }  
               if ($which eq 'ipallow') {  
                   return join(',',@allows);  
               }  
           } else {  
               return $slot{$name}{$which};  
           }  
       }        }
     </exec>      </exec>
     <message>      <message>
Line 208 Line 184
         delete($helper->{'VARS'}{'startreserve'});          delete($helper->{'VARS'}{'startreserve'});
         delete($helper->{'VARS'}{'endreserve'});          delete($helper->{'VARS'}{'endreserve'});
         delete($helper->{'VARS'}{'maxspace'});          delete($helper->{'VARS'}{'maxspace'});
           delete($helper->{'VARS'}{'startunique'});
           delete($helper->{'VARS'}{'endunique'});
       </exec>        </exec>
       <message>  
          </p><p>Period of time when this slot can only be uniquely assigned:<br />&nbsp;&nbsp;&nbsp;Start:  
       </message>  
       <date variable="startunique" hoursminutes="1" anytime="1">  
         <defaultvalue>  
           my $default=&{$helper->{DATA}{origslot}}('uniqueperiod','anytime');  
           if ($default eq 'anytime') { return 'anytime' };  
           if (ref($default)) { return $default->[0]; }  
           return 'anytime';  
         </defaultvalue>  
       </date>  
       <message><br />&nbsp;&nbsp;&nbsp;End: </message>  
       <date variable="endunique" hoursminutes="1" anytime="1">  
         <defaultvalue>  
           my $default=&{$helper->{DATA}{origslot}}('uniqueperiod','anytime');  
           if ($default eq 'anytime') { return 'anytime' };  
           if (ref($default)) { return $default->[1]; }  
           return 'anytime';  
         </defaultvalue>  
         <validator>  
            if (defined($val) && $val < $helper->{'VARS'}{'startunique'}) {  
                return 'End time must be later than the start time.';  
            }  
            return undef;  
         </validator>  
       </date>  
     </condition>      </condition>
   
     <message>      <message>
       </p><p>Proctored access:        </p><p>Proctored access:
     </message>      </message>
Line 267 Line 220
   
     <choices variable="restricttosymb">      <choices variable="restricttosymb">
       <choice nextstate="PROCTOR" computer='any'>usable for any resource.</choice>        <choice nextstate="PROCTOR" computer='any'>usable for any resource.</choice>
         <choice nextstate="MAPSELECT" computer='map'>restricted to resources in a specific folder/composite page.</choice>
       <choice nextstate="RESOURCESELECT" computer='resource'>restricted to a specific resource.</choice>        <choice nextstate="RESOURCESELECT" computer='resource'>restricted to a specific resource.</choice>
       <defaultvalue>        <defaultvalue>
         my $default=&{$helper->{DATA}{origslot}}('symb');          my $default=&{$helper->{DATA}{origslot}}('symb');
         if ($default) { return 'resource'; }          if ($default) {
         return 'any';              if ($default =~ /\.(page|sequence)$/) {
                   return 'map';
               } else {
                   return 'resource';
               }
           } else {
               return 'any';
           }
       </defaultvalue>        </defaultvalue>
     </choices>      </choices>
           
     <message>      <message>
  </p><p>IP restrictions -- allow from all except:<br />&nbsp;&nbsp;&nbsp;         </p><p>IP restrictions:<br />&nbsp;&nbsp;&nbsp;      
     </message>      </message>
       <string variable="ip" size="30">
     <string variable="ipdeny" size="30">  
       <validator>  
           return undef;  
       </validator>  
       <defaultvalue>  
         return &{$helper->{DATA}{origslot}}('ipdeny');  
       </defaultvalue>  
     </string>  
   
     <message>  
         </p><p>IP restrictions -- deny from all except: <br />&nbsp;&nbsp;&nbsp;  
     </message>  
   
     <string variable="ipallow" size="30">  
       <validator>        <validator>
           return undef;            return undef;
       </validator>        </validator>
       <defaultvalue>        <defaultvalue>
         return &{$helper->{DATA}{origslot}}('ipallow');          return &{$helper->{DATA}{origslot}}('ip');
       </defaultvalue>        </defaultvalue>
     </string>      </string>
     <message>  </p>  </message>      <message>  </p>  </message>
Line 317 Line 264
     </resource>          </resource>    
   </state>    </state>
   
     <state name="MAPSELECT" title="Specify Optional Attributes">
   
       <nextstate>PROCTOR</nextstate>
   
       <resource variable="symb">
         <filterfunc>return $res->is_map()</filterfunc>
         <valuefunc>return $res->symb()</valuefunc>
         <defaultvalue>
           return &{$helper->{DATA}{origslot}}('symb');
         </defaultvalue>
       </resource>
     </state>
   
   <state name="PROCTOR" title="Specify Proctors"    <state name="PROCTOR" title="Specify Proctors"
  help="Slot_SpecifyProctors">   help="Slot_SpecifyProctors">
Line 387 Line 346
     $slot{$which} = $helper->{'VARS'}{$which};      $slot{$which} = $helper->{'VARS'}{$which};
  }   }
   
  foreach my $which ('description','maxspace','secret','symb') {   foreach my $which ('ip','description','maxspace','secret','symb') {
     if ( $helper->{'VARS'}{$which} =~/\S/ ) {      if ( $helper->{'VARS'}{$which} =~/\S/ ) {
  $slot{$which} = $helper->{'VARS'}{$which};   $slot{$which} = $helper->{'VARS'}{$which};
     }      }
  }   }
   
         if ($helper->{'VARS'}{'ipdeny'} =~/\S/ ) {  
             foreach my $item (split(',',$helper->{'VARS'}{'ipdeny'})) {  
                 $item =~ s/^\s*//;  
                 $item =~ s/\s*$//;  
                 $slot{'ip'} .= '!'.$item.',';  
             }  
         }  
   
         if ($helper->{'VARS'}{'ipallow'} =~/\S/ ) {  
             foreach my $item (split(',',$helper->{'VARS'}{'ipallow'})) {  
                 $item =~ s/^\s*//;  
                 $item =~ s/\s*$//;  
                 $slot{'ip'} .= $item.',';  
             }  
         }  
   
         if ($slot{'ip'} ne '') {  
             $slot{'ip'} =~s /,$//;  
         }  
   
         if ($helper->{'VARS'}{'type'} eq 'schedulable_student') {          if ($helper->{'VARS'}{'type'} eq 'schedulable_student') {
             if (($helper->{'VARS'}{'reservationmsg'} eq 'only_student') ||              if (($helper->{'VARS'}{'reservationmsg'} eq 'only_student') ||
                ($helper->{'VARS'}{'reservationmsg'} eq 'student_and_user_notes_screen')) {                 ($helper->{'VARS'}{'reservationmsg'} eq 'student_and_user_notes_screen')) {

Removed from v.1.30.6.2  
changed lines
  Added in v.1.31


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