--- rat/lonpageflip.pm 2003/03/03 20:24:25 1.36 +++ rat/lonpageflip.pm 2003/10/29 22:09:17 1.46 @@ -2,7 +2,7 @@ # # Page flip handler # -# $Id: lonpageflip.pm,v 1.36 2003/03/03 20:24:25 www Exp $ +# $Id: lonpageflip.pm,v 1.46 2003/10/29 22:09:17 www Exp $ # # Copyright Michigan State University Board of Trustees # @@ -185,10 +185,12 @@ sub handler { my $redirecturl=''; my $next=''; my @possibilities=(); + &Apache::loncommon::get_unprocessed_cgi($ENV{'QUERY_STRING'},['postdata']); if (($ENV{'form.postdata'})&&($ENV{'request.course.fn'})) { $ENV{'form.postdata'}=~/(\w+)\:(.*)/; my $direction=$1; my $currenturl=$2; + $currenturl=~s/\.\d+\.(\w+)$/\.$1/; if ($direction eq 'return') { # -------------------------------------------------------- Return to last known my $last; @@ -200,10 +202,12 @@ sub handler { my $newloc; if (($last) && (tie(%hash,'GDBM_File',$ENV{'request.course.fn'}.'.db', &GDBM_READER(),0640))) { - my ($murl,$mid,$fn)=split(/\_\_\_/,$last); - $newloc=$hash{'src_'. - $hash{'map_pc_'.&Apache::lonnet::clutter($murl)}. - '.'.$mid}; + my ($murl,$fn)=&Apache::lonnet::decode_symb($last); + my $id; + ($murl,$id,$fn)=&Apache::lonnet::decode_symb(&Apache::lonnet::symbread($fn)); + $newloc=$hash{'src_'. + $hash{'map_pc_'.&Apache::lonnet::clutter($murl)}.'.'.$id}; + unless ($newloc) { $newloc='/adm/noidea.html'; } untie %hash; } else { $newloc='/adm/noidea.html'; @@ -227,7 +231,7 @@ sub handler { untie(%hash); } if ($last) { - $currenturl=&Apache::lonnet::clutter((split(/\_\_\_/,$last))[1]); + $currenturl=&Apache::lonnet::clutter((&Apache::lonnet::decode_symb($last))[1]); } else { $r->content_type('text/html'); $r->header_out(Location => @@ -239,7 +243,7 @@ sub handler { my $position; if ($position=Apache::lonnet::symbread($currenturl)) { # ------------------------------------------------------------------------- Yes - my ($startoutmap,$mapnum,$thisurl)=split(/\_\_\_/,$position); + my ($startoutmap,$mapnum,$thisurl)=&Apache::lonnet::decode_symb($position); $cachehash{$startoutmap}{$thisurl}=$mapnum; $cachehash{$startoutmap}{'last_known'}= &Apache::lonnet::declutter($currenturl); @@ -308,6 +312,12 @@ sub handler { # ============================================== Do not return before this line if ($redirecturl) { # ----------------------------------------------------- There is a URL to go to + if ($direction eq 'forward') { + &Apache::lonnet::linklog($currenturl,$redirecturl); + } + if ($direction eq 'back') { + &Apache::lonnet::linklog($redirecturl,$currenturl); + } # ------------------------------------------------- Check for critical messages if ((time-$ENV{'user.criticalcheck.time'})>300) { my @what=&Apache::lonnet::dump @@ -331,11 +341,12 @@ sub handler { $r->content_type('text/html'); $r->send_http_header; if ($#possibilities>0) { + my $bodytag= + &Apache::loncommon::bodytag('Multiple Resources'); $r->print(<Choose Next Location - -

LON-CAPA

-There are several possibilities of where to go next. +$bodytag +

There are several possibilities of where to go next

Please click on the the resource you intend to access:

@@ -354,13 +365,17 @@ ENDSTART $r->print(''); return OK; } else { + my $bodytag=&Apache::loncommon::bodytag('No Resource'); $r->print(<Choose Next Location - - -

Sorry!

-

Next resource could not be identified.

-

You probably are at the beginning or the end of the course.

+No Resource +$bodytag +

Next resource could not be identified.

+

You probably are at the beginning or the end of the +course.

+ ENDNONE @@ -374,7 +389,10 @@ ENDNONE } } else { # ---------------------------------------- No, could not determine where we are - $r->internal_redirect('/adm/ambiguous'); + if ( &Apache::lonnet::mod_perl_version() == 2 ) { + &Apache::lonnet::cleanenv(); + } + $r->internal_redirect('/adm/ambiguous'); } } else { # -------------------------- Class was not initialized or page fliped strangely