[LON-CAPA-cvs] cvs: loncom(version_2_11_X) /interface londocs.pm
raeburn
raeburn at source.lon-capa.org
Fri Dec 17 11:38:35 EST 2021
raeburn Fri Dec 17 16:38:35 2021 EDT
Modified files: (Branch: version_2_11_X)
/loncom/interface londocs.pm
Log:
- For 2.11
Backport 1.677
Index: loncom/interface/londocs.pm
diff -u loncom/interface/londocs.pm:1.484.2.91 loncom/interface/londocs.pm:1.484.2.92
--- loncom/interface/londocs.pm:1.484.2.91 Wed Feb 10 12:46:11 2021
+++ loncom/interface/londocs.pm Fri Dec 17 16:38:35 2021
@@ -1,7 +1,7 @@
# The LearningOnline Network
# Documents
#
-# $Id: londocs.pm,v 1.484.2.91 2021/02/10 12:46:11 raeburn Exp $
+# $Id: londocs.pm,v 1.484.2.92 2021/12/17 16:38:35 raeburn Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -177,6 +177,45 @@
}
}
+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 {
my ($r) = @_;
my $crstype = &Apache::loncommon::course_type();
@@ -5139,35 +5178,11 @@
if ($env{'form.tools'}) { $toolsflag=1; }
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'});
- }
+ &validate_folderpath($supplementalflag);
}
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'});
- }
+ &validate_suppath();
}
my $script='';
@@ -5225,6 +5240,9 @@
} else {
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
More information about the LON-CAPA-cvs
mailing list