--- loncom/lonmap.pm 2013/07/22 18:07:01 1.13
+++ loncom/lonmap.pm 2022/10/04 20:39:58 1.16
@@ -2,7 +2,7 @@
#
# Read maps into a 'big hash'.
#
-# $Id: lonmap.pm,v 1.13 2013/07/22 18:07:01 bisitz Exp $
+# $Id: lonmap.pm,v 1.16 2022/10/04 20:39:58 raeburn Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -157,7 +157,7 @@ sub merge_hash {
$key .= '.'; # If we are prefixing, prefix then .
}
- foreach my $childkey (keys (%$child)) {
+ foreach my $childkey (keys(%$child)) {
$parent->{$key . $childkey} = $child->{$childkey};
}
}
@@ -279,7 +279,7 @@ sub process_versions {
$cenv->{'domain'},
$cenv->{'num'});
- foreach my $ver (keys (%versions)) {
+ foreach my $ver (keys(%versions)) {
if ($ver =~/^error\:/) { # lonc/lond transaction failed.
throw Error::Simple('lonc/lond returned error: ' . $ver);
}
@@ -410,7 +410,7 @@ sub hiddenurls {
my $courseid = $hash->{'context.courseid'};
my $randomoutentry='';
- foreach my $rid (keys %randompick) {
+ foreach my $rid (keys(%randompick)) {
my $rndpick=$randompick{$rid};
my $mpc=$hash->{'map_pc_'.$hash->{'src_'.$rid}};
# ------------------------------------------- put existing resources into array
@@ -450,7 +450,7 @@ sub hiddenurls {
}
}
# ------------------------------ take care of explicitly hidden urls or folders
- foreach my $rid (keys %hiddenurl) {
+ foreach my $rid (keys(%hiddenurl)) {
$hash->{'randomout_'.$rid}='1';
my ($mapid,$resid)=split(/\./,$rid);
$randomoutentry.='&'.
@@ -616,9 +616,9 @@ sub traceroute {
my $symb=&Apache::lonnet::encode_symb($hash->{'map_id_'.$mapid},$resid,
$hash->{'src_'.$rid});
my $hidden=&Apache::lonnet::EXT('resource.0.hiddenresource',$symb);
+ my $ignorehidden;
if ($hdnflag || lc($hidden) eq 'yes') {
- my $ignorehidden;
if (defined($hash->{'is_map_'.$rid})) {
if (($hash->{'context.nohideurl'}) && ($hash->{'context.nohideurl'} eq $hash->{'src_'.$rid})) {
$ignorehidden = 1; # Hidden parameter explicitly deleted
@@ -657,12 +657,16 @@ sub traceroute {
if (defined($hash->{'is_map_'.$rid})) {
if (defined($hash->{'map_start_'.$hash->{'src_'.$rid}})) {
+ my $maphidden;
+ unless ($ignorehidden) {
+ $maphidden = $hdnflag || $hiddenurl{$rid};
+ }
$sofar=$newsofar=
&traceroute($sofar,
$hash->{'map_start_'.$hash->{'src_'.$rid}},
$beenhere,
$encflag || $encurl{$rid},
- $hdnflag || $hiddenurl{$rid}, $hash);
+ $maphidden, $hash);
}
}
@@ -1264,6 +1268,7 @@ sub read_map {
my $contents = &Apache::lonnet::getfile($filename);
if($contents eq -1) {
+ $hash->{'map_type_'.$lmap_no} = 'none';
throw Error::Simple('
'.&mt('Map not loaded: The file [_1] does not exist.',
''.$filename.''));
}