Diff for /loncom/interface/londocs.pm between versions 1.484.2.91 and 1.484.2.92

version 1.484.2.91, 2021/02/10 12:46:11 version 1.484.2.92, 2021/12/17 16:38:35
Line 177  sub default_folderpath { Line 177  sub default_folderpath {
     }      }
 }  }
   
   sub validate_folderpath {
       my ($supplementalflag) = @_;
       if ($env{'form.folderpath'} ne '') {
           my @items = split(/\&/,$env{'form.folderpath'});
           my $badpath;
           for (my $i=0; $i<@items; $i++) {
               my $odd = $i%2;
               if (($odd) && (!$supplementalflag) && ($items[$i] !~ /^[^:]*:(|\d+):(|1):(|1):(|1):(|1)$/)) {
                   $badpath = 1;
               } elsif ((!$odd) && ($items[$i] !~ /^(default|supplemental)(|_\d+)$/)) {
                   $badpath = 1;
               }
               last if ($badpath);
           }
           if ($badpath) {
               delete($env{'form.folderpath'});
           }
       }
       return;
   }
   
   sub validate_suppath {
       if ($env{'form.supppath'} ne '') {
           my @items = split(/\&/,$env{'form.supppath'});
           my $badpath;
           for (my $i=0; $i<@items; $i++) {
               my $odd = $i%2;
               if ((!$odd) && ($items[$i] !~ /^supplemental(|_\d+)$/)) {
                   $badpath = 1;
               }
               last if ($badpath);
           }
           if ($badpath) {
               delete($env{'form.supppath'});
           }
       }
       return;
   }
   
 sub dumpcourse {  sub dumpcourse {
     my ($r) = @_;      my ($r) = @_;
     my $crstype = &Apache::loncommon::course_type();      my $crstype = &Apache::loncommon::course_type();
Line 5139  sub handler { Line 5178  sub handler {
     if ($env{'form.tools'}) { $toolsflag=1; }      if ($env{'form.tools'}) { $toolsflag=1; }
   
     if ($env{'form.folderpath'} ne '') {      if ($env{'form.folderpath'} ne '') {
         my @items = split(/\&/,$env{'form.folderpath'});          &validate_folderpath($supplementalflag);
         my $badpath;  
         for (my $i=0; $i<@items; $i++) {  
             my $odd = $i%2;  
             if (($odd) && (!$supplementalflag) && ($items[$i] !~ /^[^:]*:(|\d+):(|1):(|1):(|1):(|1)$/)) {  
                 $badpath = 1;  
             } elsif ((!$odd) && ($items[$i] !~ /^(default|supplemental)(|_\d+)$/)) {  
                 $badpath = 1;  
             }  
             last if ($badpath);  
         }  
         if ($badpath) {  
             delete($env{'form.folderpath'});  
         }  
     }      }
   
     if ($env{'form.supppath'} ne '') {      if ($env{'form.supppath'} ne '') {
         my @items = split(/\&/,$env{'form.supppath'});          &validate_suppath();
         my $badpath;  
         for (my $i=0; $i<@items; $i++) {  
             my $odd = $i%2;  
             if ((!$odd) && ($items[$i] !~ /^supplemental(|_\d+)$/)) {  
                 $badpath = 1;  
             }  
             last if ($badpath);  
         }  
         if ($badpath) {  
             delete($env{'form.supppath'});  
         }  
     }      }
   
     my $script='';      my $script='';
Line 5225  sub handler { Line 5240  sub handler {
         } else {          } else {
             undef($env{'form.folderpath'});              undef($env{'form.folderpath'});
         }          }
           if ($env{'form.folderpath'} ne '') {
               &validate_folderpath($supplementalflag);
           }
     }      }
         
 # If we are not allowed to make changes, all we can see are supplemental docs  # If we are not allowed to make changes, all we can see are supplemental docs

Removed from v.1.484.2.91  
changed lines
  Added in v.1.484.2.92


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