Diff for /rat/lonpageflip.pm between versions 1.43 and 1.50

version 1.43, 2003/09/15 21:50:49 version 1.50, 2004/11/11 19:43:22
Line 82  sub fullmove { Line 82  sub fullmove {
     return($rid,$mapurl);      return($rid,$mapurl);
 }  }
   
   sub hash_src {
       my ($id)=@_;
       if ($hash{'encrypted_'.$id}) {
    return &Apache::lonenc::encrypted($hash{'src_'.$id});
       }
       return $hash{'src_'.$id};
   }
   
 sub move {  sub move {
     my ($rid,$mapurl,$direction)=@_;      my ($rid,$mapurl,$direction)=@_;
     my $startoutrid=$rid;      my $startoutrid=$rid;
Line 120  sub move { Line 128  sub move {
       $hash{'map_type_'.$hash{'map_pc_'.$hash{'src_'.$next}}} eq 'sequence') {        $hash{'map_type_'.$hash{'map_pc_'.$hash{'src_'.$next}}} eq 'sequence') {
   $mapurl=$hash{'src_'.$next};    $mapurl=$hash{'src_'.$next};
   $next=$hash{'map_start_'.$hash{'src_'.$next}};    $next=$hash{'map_start_'.$hash{'src_'.$next}};
                        } elsif (
   # This jumps back up from an empty sequence, to a page up one level
                            $hash{'map_type_'.$hash{'map_pc_'.$hash{'src_'.$next}}} eq 'page') {
                            $mapurl=$hash{'map_id_'.(split(/\./,$next))[0]};
                      }                       }
                   } elsif                     } elsif 
                     ((split(/\./,$startoutrid))[0]!=(split(/\./,$next))[0]) {                      ((split(/\./,$startoutrid))[0]!=(split(/\./,$next))[0]) {
Line 156  sub move { Line 168  sub move {
       $hash{'map_type_'.$hash{'map_pc_'.$hash{'src_'.$next}}} eq 'sequence') {        $hash{'map_type_'.$hash{'map_pc_'.$hash{'src_'.$next}}} eq 'sequence') {
   $mapurl=$hash{'src_'.$next};    $mapurl=$hash{'src_'.$next};
   $next=$hash{'map_finish_'.$hash{'src_'.$next}};    $next=$hash{'map_finish_'.$hash{'src_'.$next}};
                      }                        } elsif (
         $hash{'map_type_'.$hash{'map_pc_'.$hash{'src_'.$next}}} eq 'page') {
   # This jumps back up from an empty sequence, to a page up one level
                             $mapurl=$hash{'map_id_'.(split(/\./,$next))[0]};
                         }
                   } elsif                     } elsif 
                     ((split(/\./,$startoutrid))[0]!=(split(/\./,$next))[0]) {                      ((split(/\./,$startoutrid))[0]!=(split(/\./,$next))[0]) {
 # This comes back up from a map (going up one level);  # This comes back up from a map (going up one level);
Line 190  sub handler { Line 206  sub handler {
       $ENV{'form.postdata'}=~/(\w+)\:(.*)/;        $ENV{'form.postdata'}=~/(\w+)\:(.*)/;
       my $direction=$1;        my $direction=$1;
       my $currenturl=$2;        my $currenturl=$2;
         if ($currenturl=~m|^/enc/|) {
     $currenturl=&Apache::lonenc::unencrypted($currenturl);
         }
         $currenturl=~s/\.\d+\.(\w+)$/\.$1/;
       if ($direction eq 'return') {        if ($direction eq 'return') {
 # -------------------------------------------------------- Return to last known  # -------------------------------------------------------- Return to last known
          my $last;           my $last;
Line 204  sub handler { Line 224  sub handler {
             my ($murl,$fn)=&Apache::lonnet::decode_symb($last);              my ($murl,$fn)=&Apache::lonnet::decode_symb($last);
             my $id;              my $id;
             ($murl,$id,$fn)=&Apache::lonnet::decode_symb(&Apache::lonnet::symbread($fn));              ($murl,$id,$fn)=&Apache::lonnet::decode_symb(&Apache::lonnet::symbread($fn));
     $newloc=$hash{'src_'.      $id=$hash{'map_pc_'.&Apache::lonnet::clutter($murl)}.'.'.$id;
                 $hash{'map_pc_'.&Apache::lonnet::clutter($murl)}.'.'.$id};      $newloc=$hash{'src_'.$id};
             unless ($newloc) { $newloc='/adm/noidea.html'; }      &Apache::lonnet::logthis(" hrrm 1 ");
       if ($newloc) {
    if ($hash{'encrypted_'.$id}) { $newloc=&Apache::lonenc::encrypted($newloc); }
         
       } else {
    $newloc='/adm/noidea.html';
       }
             untie %hash;              untie %hash;
          } else {           } else {
     $newloc='/adm/noidea.html';      $newloc='/adm/noidea.html';
Line 259  sub handler { Line 285  sub handler {
 # -------------------------------------- Do we have one and only one empty URL?  # -------------------------------------- Do we have one and only one empty URL?
               my $safecount=0;                my $safecount=0;
               while (($next) && ($next!~/\,/) &&                 while (($next) && ($next!~/\,/) && 
                      ((!$hash{'src_'.$next}) || ($hash{'randomout_'.$next}))                       ((!$hash{'src_'.$next}) || 
         ((!$ENV{'request.role.adv'}) && $hash{'randomout_'.$next}))
                      && ($safecount<10000)) {                       && ($safecount<10000)) {
                   ($next,$endupmap)=&move($next,$endupmap,$direction);                    ($next,$endupmap)=&move($next,$endupmap,$direction);
                   $safecount++;                    $safecount++;
Line 270  sub handler { Line 297  sub handler {
                   @possibilities=split(/\,/,$next);                    @possibilities=split(/\,/,$next);
                   if ($#possibilities==0) {                    if ($#possibilities==0) {
 # ---------------------------------------------- Only one possibility, redirect  # ---------------------------------------------- Only one possibility, redirect
               $redirecturl=$hash{'src_'.$next};                $redirecturl=&hash_src($next);
                       $cachehash{$endupmap}                        $cachehash{$endupmap}
                                 {&Apache::lonnet::declutter($redirecturl)}                                  {&Apache::lonnet::declutter($redirecturl)}
                                  =(split(/\./,$next))[1];                                   =(split(/\./,$next))[1];
Line 388  ENDNONE Line 415  ENDNONE
           }            }
       } else {        } else {
 # ---------------------------------------- No, could not determine where we are  # ---------------------------------------- No, could not determine where we are
   if ( $Apache::lonnet::perlvar{'MODPERL2'} ) {    if ( &Apache::lonnet::mod_perl_version() == 2 ) {
       &Apache::lonnet::cleanenv();        &Apache::lonnet::cleanenv();
   }    }
   $r->internal_redirect('/adm/ambiguous');    $r->internal_redirect('/adm/ambiguous');

Removed from v.1.43  
changed lines
  Added in v.1.50


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