--- loncom/interface/lonmenu.pm 2022/05/29 21:49:06 1.369.2.83.2.2 +++ loncom/interface/lonmenu.pm 2023/01/21 21:40:54 1.369.2.83.2.6 @@ -1,7 +1,7 @@ # The LearningOnline Network with CAPA # Routines to control the menu # -# $Id: lonmenu.pm,v 1.369.2.83.2.2 2022/05/29 21:49:06 raeburn Exp $ +# $Id: lonmenu.pm,v 1.369.2.83.2.6 2023/01/21 21:40:54 raeburn Exp $ # # Copyright Michigan State University Board of Trustees # @@ -522,7 +522,7 @@ sub secondary_menu { if ($links_target ne '') { $target = $links_target; } else { - my $deeplinktarget + my $deeplinktarget; if ($env{'request.deeplink.login'}) { $deeplinktarget = $env{'request.deeplink.target'}; } @@ -779,6 +779,7 @@ sub build_submenu { unless (($href eq '') || ($href =~ /^\#/)) { if ($target ne '') { $targetattr = ' target="'.$target.'"'; + } } $menu .= '
  • &'); ($trail) = - &Apache::lonhtmlcommon::docs_breadcrumbs(undef,$crstype,undef,$title,1); + &Apache::lonhtmlcommon::docs_breadcrumbs(undef,$crstype,undef,$title,1,1); } else { &Apache::lonhtmlcommon::add_breadcrumb( {text => "Supplemental $crstype Content", href => "javascript:gopost('/adm/supplemental','')"}); - $title = &mt('View Resource'); + $title = &HTML::Entities::encode(&mt('View Resource'),'\'"<>&'); ($trail) = - &Apache::lonhtmlcommon::docs_breadcrumbs(undef,$crstype,undef,$title,1); + &Apache::lonhtmlcommon::docs_breadcrumbs(undef,$crstype,undef,$title,1,1); + } + if (ref($showncrumbsref)) { + $$showncrumbsref = 1; } return $trail; } elsif ($resurl =~ m{^\Q/uploaded$courseurl/portfolio/syllabus/}) { &Apache::lonhtmlcommon::clear_breadcrumbs(); &prepare_functions('/public'.$courseurl."/syllabus", $forcereg,$group,undef,undef,1,$hostname); - $title = &mt('Syllabus File'); + $title = &HTML::Entities::encode(&mt('Syllabus File'),'\'"<>&'); my ($trail) = - &Apache::lonhtmlcommon::docs_breadcrumbs(undef,$crstype,undef,$title,1,$hostname); + &Apache::lonhtmlcommon::docs_breadcrumbs(undef,$crstype,undef,$title,1,1); + if (ref($showncrumbsref)) { + $$showncrumbsref = 1; + } return $trail; } unless ($env{'request.state'} eq 'construct') { @@ -1192,6 +1206,10 @@ ENDMENUITEMS } } } + my $linkprotout; + if ($env{'request.deeplink.login'}) { + $linkprotout = &linkprot_exit(); + } if ($noremote) { my $addremote=0; foreach (@inlineremote) { if ($_ ne '') { $addremote=1; last;} } @@ -1217,11 +1235,17 @@ ENDMENUITEMS if ($countdown) { &Apache::lonhtmlcommon::add_breadcrumb_tool('tools',$countdown); } + if ($linkprotout) { + &Apache::lonhtmlcommon::add_breadcrumb_tool('tools',$linkprotout); + } } else { my @tools = @inlineremote[93,91,81,82,83]; if ($countdown) { unshift(@tools,$countdown); } + if ($linkprotout) { + unshift(@tools,$linkprotout); + } &Apache::lonhtmlcommon::add_breadcrumb_tool( 'tools',@tools); @@ -1235,6 +1259,10 @@ ENDMENUITEMS } &advtools_crumbs(@inlineremote); } + } else { + if ($linkprotout) { + &Apache::lonhtmlcommon::add_breadcrumb_tool('tools',$linkprotout); + } } my ($topic_help,$topic_help_text); if ($is_const_dir == 2) { @@ -1246,6 +1274,9 @@ ENDMENUITEMS $topic_help_text = 'About WebDAV access'; } } + if (ref($showncrumbsref)) { + $$showncrumbsref = 1; + } return &Apache::lonhtmlcommon::scripttag('', 'start') . &Apache::lonhtmlcommon::breadcrumbs(undef,undef,0,'','','','',$topic_help,$topic_help_text) . &Apache::lonhtmlcommon::scripttag('', 'end'); @@ -1580,8 +1611,12 @@ sub get_editbutton { if ($env{'form.folderpath'}) { $suppanchor = $env{'form.anchor'}; } + my $shownsymb; + if ($env{'request.symb'}) { + $shownsymb = &Apache::lonenc::check_encrypt($env{'request.symb'}); + } $jscall = &Apache::lonhtmlcommon::jump_to_editres($cfile,$home,$switchserver, - $forceedit,$forcereg,$env{'request.symb'}, + $forceedit,$forcereg,$env{'request.symb'},$shownsymb, &escape($env{'form.folderpath'}), &escape($env{'form.title'}),$hostname, $env{'form.idx'},&escape($env{'form.suppurl'}), @@ -3427,6 +3462,94 @@ END } } return; +} + +sub linkprot_exit { + if (($env{'request.course.id'}) && ($env{'request.deeplink.login'})) { + my ($deeplink_symb,$deeplink); + my $cnum = $env{'course.'.$env{'request.course.id'}.'.num'}; + my $cdom = $env{'course.'.$env{'request.course.id'}.'.domain'}; + if (($cnum ne '') && ($cdom ne '')) { + $deeplink_symb = &Apache::loncommon::deeplink_login_symb($cnum,$cdom); + if ($deeplink_symb) { + if ($deeplink_symb =~ /\.(page|sequence)$/) { + my $mapname = &Apache::lonnet::deversion((&Apache::lonnet::decode_symb($deeplink_symb))[2]); + my $navmap = Apache::lonnavmaps::navmap->new(); + if (ref($navmap)) { + $deeplink = $navmap->get_mapparam(undef,$mapname,'0.deeplink'); + } + } else { + $deeplink = &Apache::lonnet::EXT('resource.0.deeplink',$deeplink_symb); + } + if ($deeplink ne '') { + my ($state,$others,$listed,$scope,$protect,$display,$target,$exit) = split(/,/,$deeplink); + my %lt = &Apache::lonlocal::texthash( + title => 'Exit Tool', + okdone => 'Click "OK" to exit embedded tool', + cancel => 'Click "Cancel" to continue working.', + ok => 'OK', + exit => 'Cancel', + ); + if ($exit) { + my ($show,$text) = split(/:/,$exit); + unless ($show eq 'no') { + my $height = 250; + my $width = 300; + my $exitbuttontext; + if ($text eq '') { + $exitbuttontext = &mt('Exit Tool'); + } else { + $exitbuttontext = $text; + } + return < + + + + +
    +

    $lt{'okdone'} $lt{'cancel'}

    +
    + + + +END + } + } + } + } + } + } + return; } # ================================================================ Main Program