version 1.676, 2021/02/10 12:09:29
|
version 1.677, 2021/04/23 01:37:14
|
Line 183 sub default_folderpath {
|
Line 183 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 5546 sub handler {
|
Line 5585 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 5633 sub handler {
|
Line 5648 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 |