--- loncom/interface/loncommon.pm 2022/02/14 01:15:24 1.1376 +++ loncom/interface/loncommon.pm 2022/05/24 16:23:03 1.1378 @@ -1,7 +1,7 @@ # The LearningOnline Network with CAPA # a pile of common routines # -# $Id: loncommon.pm,v 1.1376 2022/02/14 01:15:24 raeburn Exp $ +# $Id: loncommon.pm,v 1.1378 2022/05/24 16:23:03 raeburn Exp $ # # Copyright Michigan State University Board of Trustees # @@ -1310,6 +1310,9 @@ sub help_open_topic { if (($env{'request.lti.login'}) && ($env{'request.lti.target'} eq 'iframe')) { $target = ''; } + if (($env{'request.deeplink.login'}) && ($env{'request.deeplink.target'})) { + $target = ' target="'.$env{'request.deeplink.target'}.'"'; + } if ($text ne "") { $template.='' .'' @@ -1520,6 +1523,9 @@ sub help_open_bug { if (($env{'request.lti.login'}) && ($env{'request.lti.target'} eq 'iframe')) { $target = ''; } + if (($env{'request.deeplink.login'}) && ($env{'request.deeplink.target'})) { + $target = ' target="'.$env{'request.deeplink.target'}.'"'; + } # Add the text if ($text ne "") { @@ -3649,8 +3655,27 @@ sub check_passwd_rules { } sub passwd_validation_js { - my ($currpasswdval,$domain) = @_; - my %passwdconf = &Apache::lonnet::get_passwdconf($domain); + my ($currpasswdval,$domain,$context,$id) = @_; + my (%passwdconf,$alertmsg); + if ($context eq 'linkprot') { + my %domconfig = &Apache::lonnet::get_dom('configuration',['ltisec'],$domain); + if (ref($domconfig{'ltisec'}) eq 'HASH') { + if (ref($domconfig{'ltisec'}{'rules'}) eq 'HASH') { + %passwdconf = %{$domconfig{'ltisec'}{'rules'}}; + } + } + if ($id eq 'add') { + $alertmsg = &mt('Secret for added launcher did not satisfy requirement(s):').'\n\n'; + } elsif ($id =~ /^\d+$/) { + my $pos = $id+1; + $alertmsg = &mt('Secret for launcher [_1] did not satisfy requirement(s):','#'.$pos).'\n\n'; + } else { + $alertmsg = &mt('A secret did not satisfy requirement(s):').'\n\n'; + } + } else { + %passwdconf = &Apache::lonnet::get_passwdconf($domain); + $alertmsg = &mt('Initial password did not satisfy requirement(s):').'\n\n'; + } my ($min,$max,@chars,$numrules,$intargjs,%alert); $numrules = 0; $min = $Apache::lonnet::passwdmin; @@ -3673,7 +3698,6 @@ sub passwd_validation_js { $numrules ++; } if (($min > 0) || ($max ne '') || (@chars > 0)) { - my $alertmsg = &mt('Initial password did not satisfy requirement(s):').'\n\n'; if ($min) { $alert{'min'} = &mt('minimum [quant,_1,character]',$min).'\n'; } @@ -6251,6 +6275,10 @@ sub CSTR_pageheader { $target = ''; $crumbtarget = ''; } + if (($env{'request.deeplink.login'}) && ($env{'request.deeplink.target'})) { + $target = ' target="'.$env{'request.deeplink.target'}.'"'; + $crumbtarget = $env{'request.deeplink.target'}; + } my $output = '
' @@ -9436,7 +9464,7 @@ sub menucoll_in_effect { } } if ($deeplink ne '') { - my ($state,$others,$listed,$scope,$protect,$display) = split(/,/,$deeplink); + my ($state,$others,$listed,$scope,$protect,$display,$target) = split(/,/,$deeplink); if ($display =~ /^\d+$/) { $deeplinkmenu = 1; $menucoll = $display;