[LON-CAPA-cvs] cvs: loncom /interface loncommon.pm
raeburn
raeburn at source.lon-capa.org
Sat Oct 29 13:44:05 EDT 2022
raeburn Sat Oct 29 17:44:05 2022 EDT
Modified files:
/loncom/interface loncommon.pm
Log:
- For supplemental content folderpath will contain ::1::: or ::::: suffix
appendend to (escaped) foldername in Editor context. Suffixes will be absent
when not in Editor context.
Index: loncom/interface/loncommon.pm
diff -u loncom/interface/loncommon.pm:1.1393 loncom/interface/loncommon.pm:1.1394
--- loncom/interface/loncommon.pm:1.1393 Thu Oct 27 20:30:11 2022
+++ loncom/interface/loncommon.pm Sat Oct 29 17:44:05 2022
@@ -1,7 +1,7 @@
# The LearningOnline Network with CAPA
# a pile of common routines
#
-# $Id: loncommon.pm,v 1.1393 2022/10/27 20:30:11 raeburn Exp $
+# $Id: loncommon.pm,v 1.1394 2022/10/29 17:44:05 raeburn Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -18673,15 +18673,23 @@
my ($supplementalflag,$allowed,$coursenum,$coursedom) = @_;
if ($env{'form.folderpath'} ne '') {
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++) {
my $odd = $i%2;
if (($odd) && (!$supplementalflag) && ($items[$i] !~ /^[^:]*:(|\d+):(|1):(|1):(|1):(|1)$/)) {
$badpath = 1;
- } elsif ($odd && $supplementalflag && $allowed) {
- my $suffix;
+ } elsif ($odd && $supplementalflag) {
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;
unless ($got_supp) {
my ($supplemental) = &Apache::lonnet::get_supplemental($coursenum,$coursedom);
@@ -18701,19 +18709,20 @@
$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+)$/)) {
$badpath = 1;
- } elsif (!$odd && $supplementalflag && $allowed) {
+ } elsif ($supplementalflag) {
$supppath .= '&'.$items[$i];
}
last if ($badpath);
}
if ($badpath) {
delete($env{'form.folderpath'});
- } elsif ($supplementalflag && $allowed) {
+ } elsif ($changed && $supplementalflag) {
$supppath =~ s/^\&//;
$env{'form.folderpath'} = $supppath;
}
More information about the LON-CAPA-cvs
mailing list