Diff for /loncom/lonnet/perl/lonnet.pm between versions 1.1535 and 1.1538

version 1.1535, 2025/02/07 02:06:07 version 1.1538, 2025/04/02 23:44:03
Line 3734  sub ssi_body { Line 3734  sub ssi_body {
     $output=~s|//(\s*<!--)? BEGIN LON-CAPA Internal.+?// END LON-CAPA Internal\s*(-->)?\s||gs;      $output=~s|//(\s*<!--)? BEGIN LON-CAPA Internal.+?// END LON-CAPA Internal\s*(-->)?\s||gs;
     $output=~s/^.*?\<body[^\>]*\>//si;      $output=~s/^.*?\<body[^\>]*\>//si;
     $output=~s/\<\/body\s*\>.*?$//si;      $output=~s/\<\/body\s*\>.*?$//si;
       $output=~s{\Q<div class="LC_landmark" role="main">\E}{<div>}gs;
     if (wantarray) {      if (wantarray) {
         return ($output, $response);          return ($output, $response);
     } else {      } else {
Line 13215  my %cachedmaps=(); Line 13216  my %cachedmaps=();
 # When this was last done  # When this was last done
 my $cachedmaptime='';  my $cachedmaptime='';
   
   # Cache (5 seconds) of mapsymb hierarchy for speedup of reservations display
   #
   # The course for which we cache
   my $cachedmapsymbkey='';
   # The cached recursive map symbs for this course
   my %cachedmapsymbs=();
   # When this was last done
   my $cachedmapsymbtime='';
   
 sub clear_EXT_cache_status {  sub clear_EXT_cache_status {
     &delenv('cache.EXT.');      &delenv('cache.EXT.');
 }  }
Line 13406  sub EXT { Line 13416  sub EXT {
   
     #print '<br>'.$space.' - '.$qualifier.' - '.$spacequalifierrest;      #print '<br>'.$space.' - '.$qualifier.' - '.$spacequalifierrest;
   
   # --------------------------------------------- Special handling for encrypturl
   
               if ($spacequalifierrest eq '0.encrypturl') {
                   unless ($recursed) {
                       my ($map_from_symb,@mapsymbs);
                       if ($symbparm =~ /\.(page|sequence)$/) {
                           push(@mapsymbs,$symbparm);
                           $map_from_symb = &deversion((&decode_symb($symbparm))[2]);
                       } else {
                           $map_from_symb = &deversion((&decode_symb($symbparm))[0]);
                       }
                       if (($map_from_symb ne '') && ($map_from_symb !~ /default\.sequence$/)) {
                           my @parents = &get_mapsymb_hierarchy($map_from_symb,$courseid);
                           if (@parents) {
                               push(@mapsymbs,@parents);
                           }
                       }
                       if (@mapsymbs) {
                           my $earlyout;
                           my %parmhash=();
                           if (tie(%parmhash,'GDBM_File',
                                   $env{'request.course.fn'}.'_parms.db',
                                   &GDBM_READER(),0640)) {
                               foreach my $mapsymb (@mapsymbs) {
                                   if ((exists($parmhash{$mapsymb.'.'.$spacequalifierrest})) &&
                                       (lc($parmhash{$mapsymb.'.'.$spacequalifierrest}) eq 'yes')) {
                                       $earlyout = $parmhash{$mapsymb.'.'.$spacequalifierrest};
                                       last;
                                   }
                               }
                               untie(%parmhash);
                           }
                           if ($earlyout) { return &get_reply([$earlyout,'map']); }
                       }
                   }
               }
   
 # ----------------------------------------------------- Cascading lookup scheme  # ----------------------------------------------------- Cascading lookup scheme
     my $symbp=$symbparm;      my $symbp=$symbparm;
     $mapp=&deversion((&decode_symb($symbp))[0]);      $mapp=&deversion((&decode_symb($symbp))[0]);
Line 13609  sub get_map_hierarchy { Line 13656  sub get_map_hierarchy {
     return @recurseup;      return @recurseup;
 }  }
   
   sub get_mapsymb_hierarchy {
       my ($mapname,$courseid) = @_;
       my @recurseup;
       if ($mapname) {
           if (($cachedmapsymbkey eq $courseid) &&
               (abs($cachedmapsymbtime-time)<5)) {
               if (ref($cachedmapsymbs{$mapname}) eq 'ARRAY') {
                   return @{$cachedmapsymbs{$mapname}};
               }
           }
           my $navmap = Apache::lonnavmaps::navmap->new();
           if (ref($navmap)) {
               my $getsymb = 1;
               my $inclusive = 1;
               @recurseup = $navmap->recurseup_maps($mapname,$getsymb,$inclusive);
               undef($navmap);
               $cachedmapsymbs{$mapname} = \@recurseup;
               $cachedmapsymbtime=time;
               $cachedmapsymbkey=$courseid;
           }
       }
       return @recurseup;
   }
   
 }  }
   
 sub sort_course_groups { # Sort groups based on defined rankings. Default is sort().  sub sort_course_groups { # Sort groups based on defined rankings. Default is sort().
Line 15116  sub whichuser { Line 15187  sub whichuser {
     $courseid=$tmp_courseid;      $courseid=$tmp_courseid;
     ($domain)=&get_env_multiple('form.grade_domain');      ($domain)=&get_env_multiple('form.grade_domain');
     ($name)=&get_env_multiple('form.grade_username');      ($name)=&get_env_multiple('form.grade_username');
               if ($name eq 'public' && $domain eq 'public') {
                   $publicuser = 1;
               }
     return ($symb,$courseid,$domain,$name,$publicuser);      return ($symb,$courseid,$domain,$name,$publicuser);
  }   }
     }      }
Line 15132  sub whichuser { Line 15206  sub whichuser {
     $env{'form.username'}.=time.rand(10000000);      $env{'form.username'}.=time.rand(10000000);
  }   }
  $name.=$env{'form.username'};   $name.=$env{'form.username'};
           $publicuser = 1;
     }      }
     return ($symb,$courseid,$domain,$name,$publicuser);      return ($symb,$courseid,$domain,$name,$publicuser);
   

Removed from v.1.1535  
changed lines
  Added in v.1.1538


FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>