Diff for /rat/lonuserstate.pm between versions 1.52 and 1.60

version 1.52, 2003/02/28 16:17:00 version 1.60, 2003/09/19 18:20:35
Line 97  sub loadmap { Line 97  sub loadmap {
   
     my $instr=&Apache::lonnet::getfile($fn);      my $instr=&Apache::lonnet::getfile($fn);
   
     unless ($instr == -1) {      unless ($instr eq -1) {
   
 # Successfully got file, parse it  # Successfully got file, parse it
   
Line 120  sub loadmap { Line 120  sub loadmap {
                     $hash{'kind_'.$rid}='res';                      $hash{'kind_'.$rid}='res';
                     $hash{'title_'.$rid}=$token->[2]->{'title'};                      $hash{'title_'.$rid}=$token->[2]->{'title'};
                     my $turi=$token->[2]->{'src'};                      my $turi=$token->[2]->{'src'};
                     $Apache::lonnet::titlecache{      &Apache::lonnet::do_cache(\%Apache::lonnet::titlecache,
      &Apache::lonnet::symbclean(         &Apache::lonnet::symbclean(
                       &Apache::lonnet::declutter($uri).'___'.                          &Apache::lonnet::declutter($uri).'___'.
                       $token->[2]->{'id'}.'___'.                          $token->[2]->{'id'}.'___'.
       &Apache::lonnet::declutter($turi))}=          &Apache::lonnet::declutter($turi)),
                           $token->[2]->{'title'};        $token->[2]->{'title'});
                     unless ($ispage) {                      unless ($ispage) {
                         $turi=~/\.(\w+)$/;                          $turi=~/\.(\w+)$/;
                         my $embstyle=&Apache::loncommon::fileembstyle($1);                          my $embstyle=&Apache::loncommon::fileembstyle($1);
Line 139  sub loadmap { Line 139  sub loadmap {
  $turi='/adm/coursedocs/showdoc'.$turi;   $turi='/adm/coursedocs/showdoc'.$turi;
                             }                              }
                         } else { # normal internal resource                          } else { # normal internal resource
                            if (($embstyle eq 'img') || ($embstyle eq 'emb')                             if (($embstyle eq 'img') || ($embstyle eq 'emb')) {
              || ($turi=~/\/(syllabus|aboutme|navmaps|smppg|bulletinboard)$/)) {         $turi='/adm/wrapper'.$turi;
        $turi=$turi.'?register=1';  
                            }                             }
                         }                          }
     }      }
                     $hash{'src_'.$rid}=$turi;  
   
                     if (defined($hash{'ids_'.$turi})) {                      if (defined($hash{'ids_'.$turi})) {
                         $hash{'ids_'.$turi}.=','.$rid;                          $hash{'ids_'.$turi}.=','.$rid;
                     } else {                      } else {
                         $hash{'ids_'.$turi}=''.$rid;                          $hash{'ids_'.$turi}=''.$rid;
                     }                      }
                  
                       if
           ($turi=~/\/(syllabus|aboutme|navmaps|smppg|bulletinboard)$/) {
    $turi.='?register=1';
       }
   
                       $hash{'src_'.$rid}=$turi;
   
                     if ($token->[2]->{'external'} eq 'true') {                      if ($token->[2]->{'external'} eq 'true') {
                         $hash{'ext_'.$rid}='true:';                          $hash{'ext_'.$rid}='true:';
Line 372  sub accinit { Line 377  sub accinit {
     my $resid=$_;      my $resid=$_;
             my $uri=$hash{'src_'.$resid};              my $uri=$hash{'src_'.$resid};
             $uri=~s/^\/adm\/wrapper//;              $uri=~s/^\/adm\/wrapper//;
               $uri=&Apache::lonnet::declutter($uri);
             my @uriparts=split(/\//,$uri);              my @uriparts=split(/\//,$uri);
             my $urifile=$uriparts[$#uriparts];              my $urifile=$uriparts[$#uriparts];
             $#uriparts--;              $#uriparts--;
             my $uripath=join('/',@uriparts);              my $uripath=join('/',@uriparts);
             $uripath=~s/^\/res\///;  
            if ($uripath) {             if ($uripath) {
             my $uricond='0';              my $uricond='0';
             if (defined($hash{'conditions_'.$resid})) {              if (defined($hash{'conditions_'.$resid})) {
Line 384  sub accinit { Line 389  sub accinit {
             }              }
             if (defined($acchash{'acc.res.'.$short.'.'.$uripath})) {              if (defined($acchash{'acc.res.'.$short.'.'.$uripath})) {
                 if ($acchash{'acc.res.'.$short.'.'.$uripath}=~                  if ($acchash{'acc.res.'.$short.'.'.$uripath}=~
                    /(\&$urifile\:[^\&]*)/) {                     /(\&\Q$urifile\E\:[^\&]*)/) {
     my $replace=$1;      my $replace=$1;
                     my $regexp=$replace;                      my $regexp=$replace;
                     $regexp=~s/\|/\\\|/g;                      $regexp=~s/\|/\\\|/g;
Line 438  sub pickrandom { Line 443  sub pickrandom {
  my (undef,$id)=split(/\./,$rid);   my (undef,$id)=split(/\./,$rid);
         if ($randompickseed{$rid}) { $id=$randompickseed{$rid}; }          if ($randompickseed{$rid}) { $id=$randompickseed{$rid}; }
  my $rndseed=&Apache::lonnet::rndseed($id); # use id instead of symb   my $rndseed=&Apache::lonnet::rndseed($id); # use id instead of symb
  &Math::Random::random_set_seed_from_phrase($rndseed);   &Apache::lonnet::setup_random_from_rndseed($rndseed);
  my @whichids=&Math::Random::random_permuted_index($#currentrids+1);   my @whichids=&Math::Random::random_permuted_index($#currentrids+1);
         for (my $i=1;$i<=$rndpick;$i++) { $currentrids[$whichids[$i]]=''; }          for (my $i=1;$i<=$rndpick;$i++) { $currentrids[$whichids[$i]]=''; }
  #&Apache::lonnet::logthis("$id,$rndseed,".join(':',@whichids));   #&Apache::lonnet::logthis("$id,$rndseed,".join(':',@whichids));

Removed from v.1.52  
changed lines
  Added in v.1.60


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