--- rat/lonpageflip.pm 2002/07/08 20:10:40 1.27 +++ rat/lonpageflip.pm 2002/10/10 19:05:32 1.31 @@ -2,7 +2,7 @@ # # Page flip handler # -# $Id: lonpageflip.pm,v 1.27 2002/07/08 20:10:40 www Exp $ +# $Id: lonpageflip.pm,v 1.31 2002/10/10 19:05:32 www Exp $ # # Copyright Michigan State University Board of Trustees # @@ -66,7 +66,7 @@ sub addrid { sub fullmove { my ($rid,$mapurl,$direction)=@_; if (tie(%hash,'GDBM_File',$ENV{'request.course.fn'}.'.db', - &GDBM_READER,0640)) { + &GDBM_READER(),0640)) { ($rid,$mapurl)=&move($rid,$mapurl,$direction); untie(%hash); } @@ -84,7 +84,7 @@ sub move { if ($direction eq 'forward') { # --------------------------------------------------------------------- Forward if ($hash{'type_'.$rid} eq 'finish') { - $rid=$hash{'ids_/res/'.$mapurl}; + $rid=$hash{'ids_'.&Apache::lonnet::clutter($mapurl)}; } map { my $thiscond= @@ -120,7 +120,7 @@ sub move { } elsif ($direction eq 'back') { # ------------------------------------------------------------------- Backwards if ($hash{'type_'.$rid} eq 'start') { - $rid=$hash{'ids_/res/'.$mapurl}; + $rid=$hash{'ids_'.&Apache::lonnet::clutter($mapurl)}; } map { my $thiscond= @@ -184,13 +184,13 @@ sub handler { # -------------------------------------------------------- Return to last known my $last; if (tie(%hash,'GDBM_File',$ENV{'request.course.fn'}.'_symb.db', - &GDBM_READER,0640)) { + &GDBM_READER(),0640)) { $last=$hash{'last_known'}; untie(%hash); } my $newloc; if ($last) { - $newloc='/res/'.(split(/\_\_\_/,$last))[1]; + $newloc=&Apache::lonnet::clutter((split(/\_\_\_/,$last))[1]); } else { $newloc='/adm/noidea.html'; } @@ -202,16 +202,15 @@ sub handler { } $currenturl=~s/^http\:\/\///; $currenturl=~s/^[^\/]+//; - unless (($currenturl=~/^\/res\//) || - ($currenturl=~/^\/adm\/wrapper\//)) { + unless ($currenturl=~/^\/(res|adm\/wrapper|public|adm\/coursedocs)\//) { my $last; if (tie(%hash,'GDBM_File',$ENV{'request.course.fn'}.'_symb.db', - &GDBM_READER,0640)) { + &GDBM_READER(),0640)) { $last=$hash{'last_known'}; untie(%hash); } if ($last) { - $currenturl='/res/'.(split(/\_\_\_/,$last))[1]; + $currenturl=&Apache::lonnet::clutter((split(/\_\_\_/,$last))[1]); } else { $r->content_type('text/html'); $r->header_out(Location => @@ -230,8 +229,9 @@ sub handler { # ============================================================ Tie the big hash if (tie(%hash,'GDBM_File',$ENV{'request.course.fn'}.'.db', - &GDBM_READER,0640)) { - my $rid=$hash{'map_pc_/res/'.$startoutmap}.'.'.$mapnum; + &GDBM_READER(),0640)) { + my $rid=$hash{'map_pc_'.&Apache::lonnet::clutter($startoutmap)}. + '.'.$mapnum; # ------------------------------------------------- Move forward, backward, etc my $endupmap; @@ -285,6 +285,20 @@ sub handler { # ============================================== Do not return before this line if ($redirecturl) { # ----------------------------------------------------- There is a URL to go to +# ------------------------------------------------- Check for critical messages + if ((time-$ENV{'user.criticalcheck.time'})>300) { + my @what=&Apache::lonnet::dump + ('critical',$ENV{'user.domain'}, + $ENV{'user.name'}); + if ($what[0]) { + if (($what[0] ne 'con_lost') && + ($what[0]!~/^error\:/)) { + $redirecturl='/adm/email?critical=display'; + } + } + &Apache::lonnet::appenv('user.criticalcheck.time'=>time); + } + $r->content_type('text/html'); $r->header_out(Location => 'http://'.$ENV{'HTTP_HOST'}.$redirecturl);