--- rat/lonpageflip.pm 2005/04/07 06:56:27 1.53 +++ rat/lonpageflip.pm 2005/08/02 20:51:18 1.54 @@ -2,7 +2,7 @@ # # Page flip handler # -# $Id: lonpageflip.pm,v 1.53 2005/04/07 06:56:27 albertel Exp $ +# $Id: lonpageflip.pm,v 1.54 2005/08/02 20:51:18 albertel Exp $ # # Copyright Michigan State University Board of Trustees # @@ -171,6 +171,28 @@ sub move { 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\n"); + $r->print(''. + &Apache::loncommon::bodytag('Launched')); + $r->print(<Goto first resource

+ +

Collapse External Navigation Window

+ENDNAV + $r->print(&Apache::loncommon::endbodytag().''); +} # ================================================================ Main Handler sub handler { @@ -199,7 +221,20 @@ sub handler { $currenturl=&Apache::lonenc::unencrypted($currenturl); } $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 my $last; if (tie(%hash,'GDBM_File',$env{'request.course.fn'}.'_symb.db', @@ -223,11 +258,16 @@ sub handler { } else { $newloc='/adm/noidea.html'; } - &Apache::loncommon::content_type($r,'text/html'); - $r->header_out(Location => - 'http://'.$ENV{'HTTP_HOST'}.$newloc); - - return REDIRECT; + if ($newloc eq '/adm/noidea.html' && $direction eq 'navlaunch') { + &navlaunch($r); + return OK; + } else { + &Apache::loncommon::content_type($r,'text/html'); + $r->header_out(Location => + 'http://'.$ENV{'HTTP_HOST'}.$newloc); + + return REDIRECT; + } } $currenturl=~s/^http\:\/\///; $currenturl=~s/^[^\/]+//; @@ -244,10 +284,15 @@ sub handler { if ($last) { $currenturl=&Apache::lonnet::clutter((&Apache::lonnet::decode_symb($last))[2]); } else { - &Apache::loncommon::content_type($r,'text/html'); - $r->header_out(Location => - 'http://'.$ENV{'HTTP_HOST'}.'/adm/noidea.html'); - return REDIRECT; + if ($direction eq 'return') { + &Apache::loncommon::content_type($r,'text/html'); + $r->header_out(Location => + 'http://'.$ENV{'HTTP_HOST'}.'/adm/noidea.html'); + return REDIRECT; + } else { + &navlaunch($r); + return OK; + } } } # ------------------------------------------- Do we have any idea where we are?