--- rat/lonpageflip.pm 2021/12/31 20:03:33 1.80.8.13.2.1 +++ rat/lonpageflip.pm 2025/02/07 20:57:39 1.80.8.13.2.4 @@ -2,7 +2,7 @@ # # Page flip handler # -# $Id: lonpageflip.pm,v 1.80.8.13.2.1 2021/12/31 20:03:33 raeburn Exp $ +# $Id: lonpageflip.pm,v 1.80.8.13.2.4 2025/02/07 20:57:39 raeburn Exp $ # # Copyright Michigan State University Board of Trustees # @@ -463,9 +463,13 @@ sub handler { $r->send_http_header; $r->print(&Apache::loncommon::check_release_result(@reinit)); return OK; - } elsif ($reinitcheck eq 'update') { - my $cnum = $env{'course.'.$env{'request.course.id'}.'.num'}; - my $cdom = $env{'course.'.$env{'request.course.id'}.'.domain'}; + } + my ($cnum,$cdom); + if ($reinitcheck) { + $cnum = $env{'course.'.$env{'request.course.id'}.'.num'}; + $cdom = $env{'course.'.$env{'request.course.id'}.'.domain'}; + } + if (($reinitcheck eq 'main') || ($reinitcheck eq 'both')) { $preupdatepos = &Apache::lonnet::symbread($currenturl); unless ($direction eq 'return') { if (tie(%hash,'GDBM_File',$env{'request.course.fn'}.'_symb.db', @@ -501,6 +505,16 @@ sub handler { } } } + if (($reinitcheck eq 'both') || ($reinitcheck eq 'supp')) { + my $possdel; + if ($reinitcheck eq 'supp') { + $possdel = 1; + } + my ($supplemental,$refs_updated) = &Apache::loncommon::get_supplemental($cnum,$cdom,'',$possdel); + unless ($refs_updated) { + &Apache::loncommon::set_supp_httprefs($cnum,$cdom,$supplemental); + } + } } if ($direction eq 'firstres') { my $furl=&first_accessible_resource(); @@ -510,7 +524,7 @@ sub handler { } else { $furl=&Apache::lonnet::absolute_url().$furl; } - if ($reinitcheck eq 'update') { + if (($reinitcheck eq 'main') || ($reinitcheck eq 'both')) { &Apache::lonhtmlcommon::Close_PrgWin($r,\%prog_state); $r->print(&reinited_js($furl,$env{'request.course.id'},100)); $r->print(&Apache::loncommon::end_page()); @@ -552,7 +566,7 @@ sub handler { } else { $newloc=&Apache::lonnet::absolute_url().$newloc } - if ($reinitcheck eq 'update') { + if (($reinitcheck eq 'main') || ($reinitcheck eq 'both')) { $r->print(&reinited_js($newloc,$env{'request.course.id'},100)); $r->print(&Apache::loncommon::end_page()); return OK; @@ -579,7 +593,7 @@ sub handler { } else { my $newloc = &Apache::lonnet::absolute_url(). '/adm/navmaps'; - if ($reinitcheck eq 'update') { + if (($reinitcheck eq 'main') || ($reinitcheck eq 'both')) { &Apache::lonhtmlcommon::Close_PrgWin($r,\%prog_state); $r->print(&reinited_js($newloc,$env{'request.course.id'},100)); $r->print(&Apache::loncommon::end_page()); @@ -676,7 +690,7 @@ sub handler { &Apache::lonnet::linklog($redirecturl,$currenturl); } # ------------------------------------- Check for and display critical messages - my ($redirect, $url) = &Apache::loncommon::critical_redirect(300.'flip'); + my ($redirect, $url) = &Apache::loncommon::critical_redirect(300,'flip'); unless ($redirect) { my $usehttp = &check_http_req(\$redirecturl,$hostname); if (($usehttp) && ($hostname ne '')) { @@ -694,7 +708,7 @@ sub handler { $url .= $anchor; } } - if ($reinitcheck eq 'update') { + if (($reinitcheck eq 'main') || ($reinitcheck eq 'both')) { &Apache::lonhtmlcommon::Close_PrgWin($r,\%prog_state); $r->print(&reinited_js($url,$env{'request.course.id'},100)); $r->print(&Apache::loncommon::end_page()); @@ -808,7 +822,7 @@ ENDSTART } } else { # ------------------------------------------------- Problem, could not tie hash - if ($reinitcheck eq 'update') { + if (($reinitcheck eq 'main') || ($reinitcheck eq 'both')) { &Apache::lonhtmlcommon::Close_PrgWin($r,\%prog_state); $r->print(&Apache::loncommon::end_page()); } @@ -818,7 +832,7 @@ ENDSTART } else { # ---------------------------------------- No, could not determine where we are my $newloc = '/adm/ambiguous'; - if ($reinitcheck eq 'update') { + if (($reinitcheck eq 'main') || ($reinitcheck eq 'both')) { &Apache::lonhtmlcommon::Close_PrgWin($r,\%prog_state); $r->print(&reinited_js($newloc,$env{'request.course.id'},100)); $r->print(&Apache::loncommon::end_page());