version 1.8, 2021/11/03 01:04:03
|
version 1.8.2.2, 2022/05/27 18:10:44
|
Line 172 sub handler {
|
Line 172 sub handler {
|
} |
} |
} |
} |
my @allposs = keys(%possroles); |
my @allposs = keys(%possroles); |
if ($env{'request.lti.login'}) { |
|
&Apache::loncommon::get_unprocessed_cgi($ENV{'QUERY_STRING'}); |
|
if ($env{'request.lti.target'} eq '') { |
|
if ($env{'form.ltitarget'} eq 'iframe') { |
|
&Apache::lonnet::appenv({'request.lti.target' => 'iframe'}); |
|
delete($env{'form.ltitarget'}); |
|
} |
|
} |
|
if ($env{'form.selectrole'}) { |
|
foreach my $role (@allposs) { |
|
my $newrole = "$role./$cdom/$cnum"; |
|
if ($possroles{$allposs[0]} ne '') { |
|
$newrole .= "/$possroles{$role}"; |
|
} |
|
if ($env{"form.$newrole"}) { |
|
my $destination .= '/adm/roles?selectrole=1&'.$newrole.'=1'. |
|
'&destinationurl='.&HTML::Entities::encode($r->uri); |
|
if ($env{'form.ltitarget'} eq 'iframe') { |
|
$destination .= '<itarget=iframe'; |
|
} |
|
&do_redirect($r,$destination); |
|
return OK; |
|
} |
|
} |
|
} |
|
} |
|
if (@allposs == 0) { |
if (@allposs == 0) { |
&show_roles($r,\%crsenv,\%possroles); |
&show_roles($r,\%crsenv,\%possroles); |
} elsif (@allposs == 1) { |
} elsif (@allposs == 1) { |
Line 256 sub launch_check {
|
Line 230 sub launch_check {
|
my %link_info = &Apache::lonnet::tmpget($env{'form.ttoken'}); |
my %link_info = &Apache::lonnet::tmpget($env{'form.ttoken'}); |
&Apache::lonnet::tmpdel($env{'form.ttoken'}); |
&Apache::lonnet::tmpdel($env{'form.ttoken'}); |
delete($env{'form.ttoken'}); |
delete($env{'form.ttoken'}); |
|
if ($link_info{'ltoken'}) { |
|
unless (($link_info{'linkprot'}) || ($link_info{'linkkey'} ne '')) { |
|
my %ltoken_info = &Apache::lonnet::tmpget($link_info{'ltoken'}); |
|
if ($ltoken_info{'linkprot'}) { |
|
$link_info{'linkprot'} = $ltoken_info{'linkprot'}; |
|
} elsif ($ltoken_info{'linkkey'} ne '') { |
|
$link_info{'linkkey'} = $ltoken_info{'linkkey'}; |
|
} |
|
} |
|
&Apache::lonnet::tmpdel($env{'form.ltoken'}); |
|
delete($env{'form.ltoken'}); |
|
} |
if ($link_info{'linkprot'}) { |
if ($link_info{'linkprot'}) { |
($linkprotector,$linkproturi) = split(/:/,$link_info{'linkprot'},2); |
($linkprotector,$linkproturi) = split(/:/,$link_info{'linkprot'},2); |
if ($env{'user.linkprotector'}) { |
if ($env{'user.linkprotector'}) { |
Line 317 sub launch_check {
|
Line 303 sub launch_check {
|
} |
} |
if ($deeplink ne '') { |
if ($deeplink ne '') { |
my $disallow; |
my $disallow; |
my ($state,$others,$listed,$scope,$protect) = split(/,/,$deeplink); |
my ($state,$others,$listed,$scope,$protect,$display,$target) = split(/,/,$deeplink); |
if (($protect ne 'none') && ($protect ne '')) { |
if (($protect ne 'none') && ($protect ne '')) { |
my ($acctype,$item) = split(/:/,$protect); |
my ($acctype,$item) = split(/:/,$protect); |
if ($acctype =~ /lti(c|d)$/) { |
if ($acctype =~ /lti(c|d)$/) { |
Line 342 sub launch_check {
|
Line 328 sub launch_check {
|
if ($disallow) { |
if ($disallow) { |
if ($currdeeplinklogin eq $linkuri) { |
if ($currdeeplinklogin eq $linkuri) { |
&Apache::lonnet::delenv('request.deeplink.login'); |
&Apache::lonnet::delenv('request.deeplink.login'); |
|
if ($env{'request.deeplink.target'} ne '') { |
|
&Apache::lonnet::delenv('request.deeplink.target'); |
|
} |
} |
} |
} else { |
} else { |
unless ($currdeeplinklogin eq $linkuri) { |
unless ($currdeeplinklogin eq $linkuri) { |
Line 360 sub launch_check {
|
Line 349 sub launch_check {
|
} |
} |
} |
} |
&Apache::lonnet::appenv({'request.deeplink.login' => $linkuri}); |
&Apache::lonnet::appenv({'request.deeplink.login' => $linkuri}); |
|
if ($target ne '') { |
|
&Apache::lonnet::appenv({'request.deeplink.target' => $target}); |
|
} elsif ($env{'request.deeplink.target'} ne '') { |
|
&Apache::lonnet::delenv('request.deeplink.target'); |
|
} |
} |
} |
} else { |
} else { |
if ($linkprotector) { |
if ($linkprotector) { |
Line 373 sub launch_check {
|
Line 367 sub launch_check {
|
&Apache::lonnet::delenv({'request.linkkey'}); |
&Apache::lonnet::delenv({'request.linkkey'}); |
} |
} |
&Apache::lonnet::appenv({'request.deeplink.login' => $linkuri}); |
&Apache::lonnet::appenv({'request.deeplink.login' => $linkuri}); |
|
if ($env{'request.deeplink.target'} ne '') { |
|
&Apache::lonnet::delenv('request.deeplink.target'); |
|
} |
} |
} |
return $newlauncher; |
return $newlauncher; |
} |
} |
Line 380 sub launch_check {
|
Line 377 sub launch_check {
|
sub do_redirect { |
sub do_redirect { |
my ($r,$destination) = @_; |
my ($r,$destination) = @_; |
my $windowname = 'loncapaclient'; |
my $windowname = 'loncapaclient'; |
if ($env{'request.lti.login'}) { |
|
$windowname .= 'lti'; |
|
} |
|
my $header = '<meta HTTP-EQUIV="Refresh" CONTENT="0; url='.$destination.'" />'; |
my $header = '<meta HTTP-EQUIV="Refresh" CONTENT="0; url='.$destination.'" />'; |
my $args = {'bread_crumbs' => [{'href' => '','text' => 'Role initialization'},],}; |
my $args = {'bread_crumbs' => [{'href' => '','text' => 'Role initialization'},],}; |
&Apache::loncommon::content_type($r,'text/html'); |
&Apache::loncommon::content_type($r,'text/html'); |
Line 527 ENDJS
|
Line 521 ENDJS
|
sub generic_error { |
sub generic_error { |
my ($r) = @_; |
my ($r) = @_; |
my $continuelink; |
my $continuelink; |
unless ($env{'request.lti.login'}) { |
my $linktext; |
my $linktext; |
if ($env{'user.adv'}) { |
if ($env{'user.adv'}) { |
$linktext = &mt('Continue to your roles page'); |
$linktext = &mt('Continue to your roles page'); |
} else { |
} else { |
$linktext = &mt('Continue to your courses page'); |
$linktext = &mt('Continue to your courses page'); |
|
} |
|
$continuelink='<a href="/adm/roles">'.$linktext.'</a>'; |
|
} |
} |
|
$continuelink='<a href="/adm/roles">'.$linktext.'</a>'; |
my $msg = &mt('The page you requested does not exist.'); |
my $msg = &mt('The page you requested does not exist.'); |
&Apache::loncommon::content_type($r,'text/html'); |
&Apache::loncommon::content_type($r,'text/html'); |
$r->send_http_header; |
$r->send_http_header; |