--- loncom/interface/lonhtmlcommon.pm 2022/07/08 16:04:35 1.358.2.19.2.3 +++ loncom/interface/lonhtmlcommon.pm 2023/10/06 15:24:21 1.358.2.19.2.9 @@ -1,7 +1,7 @@ # The LearningOnline Network with CAPA # a pile of common html routines # -# $Id: lonhtmlcommon.pm,v 1.358.2.19.2.3 2022/07/08 16:04:35 raeburn Exp $ +# $Id: lonhtmlcommon.pm,v 1.358.2.19.2.9 2023/10/06 15:24:21 raeburn Exp $ # # Copyright Michigan State University Board of Trustees # @@ -1687,13 +1687,29 @@ sub show_return_link { unless ($env{'request.course.id'}) { return 0; } if ($env{'request.noversionuri'}=~m{^/priv/} || $env{'request.uri'}=~m{^/priv/}) { return 1; } - return if ($env{'request.noversionuri'} eq '/adm/supplemental'); - - if (($env{'request.noversionuri'} =~ m{^/adm/(viewclasslist|navmaps)($|\?)}) + return if (($env{'request.noversionuri'} eq '/adm/supplemental') && + ($env{'form.folder'} ne 'supplemental')); + return if (($env{'form.folderpath'} ne '') && + (($env{'request.noversionuri'} =~ m{^/adm/$match_domain/$match_username/aboutme$}) || + ($env{'request.noversionuri'} =~ m{^/public/$match_domain/$match_courseid/syllabus$}))); + if (($env{'request.noversionuri'} =~ m{^/adm/viewclasslist($|\?)}) || ($env{'request.noversionuri'} =~ m{^/adm/.*/aboutme($|\?)})) { return if ($env{'form.register'}); } + if ((($env{'request.symb'} ne '') || ($env{'form.folderpath'} ne '')) && + ($env{'request.noversionuri'} =~m{^/adm/coursedocs/showdoc/uploaded/($match_domain)/($match_courseid)/(docs|supplemental)/})) { + my ($cdom,$cnum,$area) = ($1,$2,$3); + if (($env{'course.'.$env{'request.course.id'}.'.domain'} eq $cdom) && + ($env{'course.'.$env{'request.course.id'}.'.num'} eq $cnum)) { + if (($env{'request.symb'}) && ($area eq 'docs')) { + my ($map,$resid,$url) = &Apache::lonnet::decode_symb($env{'request.symb'}); + return if ($env{'request.noversionuri'} eq '/adm/coursedocs/showdoc/'.$url); + } elsif (($env{'form.folderpath'}) && ($area eq 'supplemental')) { + return; + } + } + } return (($env{'request.noversionuri'}=~m{^/(res|public)/} && $env{'request.symb'} eq '') || @@ -1762,6 +1778,48 @@ clientTime = (new Date()).getTime(); END } +## +# Client-side javascript to convert any dashes in text pasted +# into textbox(es) for numericalresponse item(s) to a standard +# minus, i.e., - . Calls to dash_to_minus_js() in end_problem() +# and in loncommon::endbodytag() for a .page (arg: dashjs => 1) +# +# Will apply to any input tag with class: LC_numresponse_text. +# Currently set in start_textline for numericalresponse items. +# + +sub dash_to_minus_js { + return <<'ENDJS'; + + + +ENDJS +} + ############################################################ ############################################################ @@ -2148,8 +2206,10 @@ sub docs_breadcrumbs { # each of randompick number, hidden, encrypted, random order, is_page # are appended with ":"s to the foldername $name=~s/\:(\d*)\:(\w*)\:(\w*):(\d*)\:?(\d*)$//; - unless ($supplementalflag) { - if ($contenteditor) { + if ($contenteditor) { + if ($supplementalflag) { + if ($2) { $ishidden=1; } + } else { if ($1 ne '') { $randompick=$1; } else { @@ -2190,7 +2250,7 @@ sub docs_breadcrumbs { $plain=~s/\>\;\s*$//; } my $menulink = 0; - if (!$allowed && !$contenteditor) { + if (!$allowed && !$contenteditor && !$supplementalflag) { $menulink = 1; } if ($checklinkprot) { @@ -3420,7 +3480,10 @@ THIRD sub javascript_jumpto_resource { my $confirm_switch = &mt("Editing requires switching to the resource's home server.")."\n". &mt('Switch server?'); + my $confirm_new_tab = &mt("Editing requires using the resource's home server.")."\n". + &mt('Open a new browser tab?'); &js_escape(\$confirm_switch); + &js_escape(\$confirm_new_tab); return (<&'); - if ($symb) { - $cfile .= '&symb='.&HTML::Entities::encode($symb,'"<>&'); + if ($shownsymb) { + $cfile .= '&symb='.&HTML::Entities::encode($shownsymb,'"<>&'); + if ($resedit) { + $cfile .= '&edit=1'; + } } elsif ($folderpath) { $cfile .= '&folderpath='.&HTML::Entities::encode($folderpath,'"<>&'); } @@ -3473,7 +3556,7 @@ sub jump_to_editres { if ($forcereg) { $cfile .= '&register=1'; } - $jscall = "need_switchserver('".&Apache::loncommon::escape_single($cfile)."');"; + $jscall = "need_switchserver('".&Apache::loncommon::escape_single($cfile)."','$target')"; } } else { unless ($cfile =~ m{^/priv/}) {