Diff for /rat/lonpageflip.pm between versions 1.53 and 1.56

version 1.53, 2005/04/07 06:56:27 version 1.56, 2005/08/31 07:38:29
Line 73  sub fullmove { Line 73  sub fullmove {
   
 sub hash_src {  sub hash_src {
     my ($id)=@_;      my ($id)=@_;
       my ($mapid,$resid)=split(/\./,$id);
       my $symb=&Apache::lonnet::encode_symb($hash{'map_id_'.$mapid},
     $resid,$hash{'src_'.$id});
     if ($hash{'encrypted_'.$id}) {      if ($hash{'encrypted_'.$id}) {
  return &Apache::lonenc::encrypted($hash{'src_'.$id});   return (&Apache::lonenc::encrypted($hash{'src_'.$id}),
    &Apache::lonenc::encrypted($symb));
     }      }
     return $hash{'src_'.$id};      return ($hash{'src_'.$id},$symb);
 }  }
   
 sub move {  sub move {
Line 171  sub move { Line 175  sub move {
               return ($next,$mapurl);                return ($next,$mapurl);
 }  }
   
   sub navlaunch {
       my ($r)=@_;
       &Apache::loncommon::content_type($r,'text/html');
       &Apache::loncommon::no_cache($r);
       $r->send_http_header;
       my $html=&Apache::lonxml::xmlbegin();
       $r->print("$html<head>\n");
       $r->print('</head>'.
         &Apache::loncommon::bodytag('Launched'));   
       $r->print(<<ENDNAV);
       <p><a href="/adm/flip?postdata=firstres%3a">Goto first resource</a></p>
       <script type="text/javascript">
    function collapse() {
       menu=window.open("/adm/navmaps?collapseExternal","loncapanav",
        "height=600,width=400,scrollbars=1");
       this.document.location='/adm/navmaps?turningOffExternal';
    }
       </script>
       <p><a href="javascript:collapse();">Collapse external navigation window</a></p>
   ENDNAV
       $r->print(&Apache::loncommon::endbodytag().'</html>');
   }
 # ================================================================ Main Handler  # ================================================================ Main Handler
   
 sub handler {  sub handler {
Line 187  sub handler { Line 213  sub handler {
   my %cachehash=();     my %cachehash=(); 
   my $multichoice=0;    my $multichoice=0;
   my %multichoicehash=();    my %multichoicehash=();
   my $redirecturl='';    my ($redirecturl,$redirectsymb);
   my $next='';    my $next='';
   my @possibilities=();    my @possibilities=();
    &Apache::loncommon::get_unprocessed_cgi($ENV{'QUERY_STRING'},['postdata']);     &Apache::loncommon::get_unprocessed_cgi($ENV{'QUERY_STRING'},['postdata']);
Line 199  sub handler { Line 225  sub handler {
   $currenturl=&Apache::lonenc::unencrypted($currenturl);    $currenturl=&Apache::lonenc::unencrypted($currenturl);
       }        }
       $currenturl=~s/\.\d+\.(\w+)$/\.$1/;        $currenturl=~s/\.\d+\.(\w+)$/\.$1/;
       if ($direction eq 'return') {        if ($direction eq 'firstres') {
     my $furl;
     if (tie(my %bighash,'GDBM_File',$env{'request.course.fn'}.'.db',
     &GDBM_READER(),0640)) {
         $furl=$bighash{'first_url'};
         untie(%bighash);
     }
     &Apache::loncommon::content_type($r,'text/html');
     $r->header_out(Location => 
    'http://'.$ENV{'HTTP_HOST'}.$furl);
        
     return REDIRECT;
         }
         if ($direction eq 'return' || $direction eq 'navlaunch') {
 # -------------------------------------------------------- Return to last known  # -------------------------------------------------------- Return to last known
          my $last;           my $last;
          if (tie(%hash,'GDBM_File',$env{'request.course.fn'}.'_symb.db',           if (tie(%hash,'GDBM_File',$env{'request.course.fn'}.'_symb.db',
Line 223  sub handler { Line 262  sub handler {
          } else {           } else {
     $newloc='/adm/noidea.html';      $newloc='/adm/noidea.html';
          }             }  
  &Apache::loncommon::content_type($r,'text/html');   if ($newloc eq '/adm/noidea.html' && $direction eq 'navlaunch') {
          $r->header_out(Location =>        &navlaunch($r);
  'http://'.$ENV{'HTTP_HOST'}.$newloc);       return OK;
                                   } else {
          return REDIRECT;       &Apache::loncommon::content_type($r,'text/html');
        $r->header_out(Location => 
       'http://'.$ENV{'HTTP_HOST'}.$newloc);
        
        return REDIRECT;
    }
       }        }
       $currenturl=~s/^http\:\/\///;        $currenturl=~s/^http\:\/\///;
       $currenturl=~s/^[^\/]+//;        $currenturl=~s/^[^\/]+//;
Line 244  sub handler { Line 288  sub handler {
          if ($last) {           if ($last) {
      $currenturl=&Apache::lonnet::clutter((&Apache::lonnet::decode_symb($last))[2]);       $currenturl=&Apache::lonnet::clutter((&Apache::lonnet::decode_symb($last))[2]);
  } else {   } else {
      &Apache::loncommon::content_type($r,'text/html');       if ($direction eq 'return') {
              $r->header_out(Location =>    &Apache::loncommon::content_type($r,'text/html');
                                'http://'.$ENV{'HTTP_HOST'}.'/adm/noidea.html');   $r->header_out(Location => 
              return REDIRECT;   'http://'.$ENV{'HTTP_HOST'}.'/adm/noidea.html');
    return REDIRECT;
        } else {
    &navlaunch($r);
    return OK;
        }
          }           }
       }        }
 # ------------------------------------------- Do we have any idea where we are?  # ------------------------------------------- Do we have any idea where we are?
Line 283  sub handler { Line 332  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,$redirectsymb)=&hash_src($next);
                       $cachehash{$endupmap}{$redirecturl}=                        $cachehash{$endupmap}{$redirecturl}=
   [$redirecturl,(split(/\./,$next))[1]];    [$redirecturl,(split(/\./,$next))[1]];
                   } else {                    } else {
Line 337  sub handler { Line 386  sub handler {
                 if (($what[0] ne 'con_lost') &&                   if (($what[0] ne 'con_lost') && 
                             ($what[0]!~/^error\:/)) {                              ($what[0]!~/^error\:/)) {
                    $redirecturl='/adm/email?critical=display';                     $redirecturl='/adm/email?critical=display';
      $redirectsymb='';
                         }                          }
                      }                       }
                      &Apache::lonnet::appenv('user.criticalcheck.time'=>time);                       &Apache::lonnet::appenv('user.criticalcheck.time'=>time);
   }    }
   
   &Apache::loncommon::content_type($r,'text/html');    &Apache::loncommon::content_type($r,'text/html');
                   $r->header_out(Location =>     my $url='http://'.$ENV{'HTTP_HOST'}.$redirecturl;
                                 'http://'.$ENV{'HTTP_HOST'}.$redirecturl);    if ($redirectsymb ne '') { $url.='?symb='.$redirectsymb; }
                     $r->header_out(Location => $url);
                   return REDIRECT;                    return REDIRECT;
       } else {        } else {
 # --------------------------------------------------------- There was a problem  # --------------------------------------------------------- There was a problem

Removed from v.1.53  
changed lines
  Added in v.1.56


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