version 1.1393, 2022/10/27 20:30:11
|
version 1.1394, 2022/10/29 17:44:05
|
Line 18673 sub validate_folderpath {
|
Line 18673 sub validate_folderpath {
|
my ($supplementalflag,$allowed,$coursenum,$coursedom) = @_; |
my ($supplementalflag,$allowed,$coursenum,$coursedom) = @_; |
if ($env{'form.folderpath'} ne '') { |
if ($env{'form.folderpath'} ne '') { |
my @items = split(/\&/,$env{'form.folderpath'}); |
my @items = split(/\&/,$env{'form.folderpath'}); |
my ($badpath,$got_supp,$supppath,%supphidden,%suppids); |
my ($badpath,$changed,$got_supp,$supppath,%supphidden,%suppids); |
for (my $i=0; $i<@items; $i++) { |
for (my $i=0; $i<@items; $i++) { |
my $odd = $i%2; |
my $odd = $i%2; |
if (($odd) && (!$supplementalflag) && ($items[$i] !~ /^[^:]*:(|\d+):(|1):(|1):(|1):(|1)$/)) { |
if (($odd) && (!$supplementalflag) && ($items[$i] !~ /^[^:]*:(|\d+):(|1):(|1):(|1):(|1)$/)) { |
$badpath = 1; |
$badpath = 1; |
} elsif ($odd && $supplementalflag && $allowed) { |
} elsif ($odd && $supplementalflag) { |
my $suffix; |
|
my $idx = $i-1; |
my $idx = $i-1; |
if (($items[$i] !~ /^[^:]*::(|1):::$/) && ($items[$idx] ne 'supplemental')) { |
if ($items[$i] =~ /^([^:]*)::(|1):::$/) { |
|
my $esc_name = $1; |
|
if ((!$allowed) || ($items[$idx] eq 'supplemental')) { |
|
$supppath .= '&'.$esc_name; |
|
$changed = 1; |
|
} else { |
|
$supppath .= '&'.$items[$i]; |
|
} |
|
} elsif (($allowed) && ($items[$idx] ne 'supplemental')) { |
|
$changed = 1; |
my $is_hidden; |
my $is_hidden; |
unless ($got_supp) { |
unless ($got_supp) { |
my ($supplemental) = &Apache::lonnet::get_supplemental($coursenum,$coursedom); |
my ($supplemental) = &Apache::lonnet::get_supplemental($coursenum,$coursedom); |
Line 18701 sub validate_folderpath {
|
Line 18709 sub validate_folderpath {
|
$is_hidden = 1; |
$is_hidden = 1; |
} |
} |
} |
} |
$suffix = '::'.$is_hidden.':::'; |
$supppath .= '&'.$items[$i].'::'.$is_hidden.':::'; |
|
} else { |
|
$supppath .= '&'.$items[$i]; |
} |
} |
$supppath .= '&'.$items[$i].$suffix; |
|
} elsif ((!$odd) && ($items[$i] !~ /^(default|supplemental)(|_\d+)$/)) { |
} elsif ((!$odd) && ($items[$i] !~ /^(default|supplemental)(|_\d+)$/)) { |
$badpath = 1; |
$badpath = 1; |
} elsif (!$odd && $supplementalflag && $allowed) { |
} elsif ($supplementalflag) { |
$supppath .= '&'.$items[$i]; |
$supppath .= '&'.$items[$i]; |
} |
} |
last if ($badpath); |
last if ($badpath); |
} |
} |
if ($badpath) { |
if ($badpath) { |
delete($env{'form.folderpath'}); |
delete($env{'form.folderpath'}); |
} elsif ($supplementalflag && $allowed) { |
} elsif ($changed && $supplementalflag) { |
$supppath =~ s/^\&//; |
$supppath =~ s/^\&//; |
$env{'form.folderpath'} = $supppath; |
$env{'form.folderpath'} = $supppath; |
} |
} |