[LON-CAPA-cvs] cvs: loncom / loncapa_apache.conf /auth lonslotcheck.pm /html/adm/helper newslot.helper /interface slotrequest.pm
raeburn
raeburn at source.lon-capa.org
Thu Jul 6 23:52:41 EDT 2023
raeburn Fri Jul 7 03:52:41 2023 EDT
Modified files:
/loncom loncapa_apache.conf
/loncom/auth lonslotcheck.pm
/loncom/interface slotrequest.pm
/loncom/html/adm/helper newslot.helper
Log:
- Bug 6754 LON-CAPA as LTI Consumer
Support for access control using slots for both "gradable" and "non-gradable"
external tools.
Index: loncom/loncapa_apache.conf
diff -u loncom/loncapa_apache.conf:1.280 loncom/loncapa_apache.conf:1.281
--- loncom/loncapa_apache.conf:1.280 Sun Apr 2 20:25:33 2023
+++ loncom/loncapa_apache.conf Fri Jul 7 03:52:39 2023
@@ -2,7 +2,7 @@
## loncapa_apache.conf -- Apache HTTP LON-CAPA configuration file
##
-# $Id: loncapa_apache.conf,v 1.280 2023/04/02 20:25:33 raeburn Exp $
+# $Id: loncapa_apache.conf,v 1.281 2023/07/07 03:52:39 raeburn Exp $
#
# LON-CAPA Section (extensions to httpd.conf daemon configuration)
@@ -280,6 +280,7 @@
Require valid-user
PerlAuthzHandler Apache::lonacc
SetHandler perl-script
+PerlHandler Apache::lonslotcheck
PerlHandler Apache::londatecheck
PerlHandler Apache::lonipcheck
PerlHandler Apache::lonexttool
Index: loncom/auth/lonslotcheck.pm
diff -u loncom/auth/lonslotcheck.pm:1.1 loncom/auth/lonslotcheck.pm:1.2
--- loncom/auth/lonslotcheck.pm:1.1 Wed Jan 31 15:29:07 2018
+++ loncom/auth/lonslotcheck.pm Fri Jul 7 03:52:40 2023
@@ -1,6 +1,6 @@
# Checks slot access settings - disable subsequent
# PerlHandlers unless access availble
-# $Id: lonslotcheck.pm,v 1.1 2018/01/31 15:29:07 raeburn Exp $
+# $Id: lonslotcheck.pm,v 1.2 2023/07/07 03:52:40 raeburn Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -106,10 +106,25 @@
return OK;
}
+ my $target;
+ my ($marker,$exttool) = (split(m{/},$r->uri))[4,5];
+ $marker=~s/\D//g;
+ if (($marker) && ($exttool) && ($env{'request.course.id'})) {
+ my $cdom = $env{'course.'.$env{'request.course.id'}.'.domain'};
+ my $cnum = $env{'course.'.$env{'request.course.id'}.'.num'};
+ my ($idx,$crstool,$is_tool,%toolhash,%toolsettings);
+ if ($r->uri eq "/adm/$cdom/$cnum/$marker/$exttool") {
+ my %toolsettings=&Apache::lonnet::dump('exttool_'.$marker,$cdom,$cnum);
+ $target = $toolsettings{'target'};
+ }
+ }
+ my $args = {'bgcolor' => '#FFFFFF',
+ 'force_register' => 1,};
+ if ($target eq 'iframe') {
+ $args->{'only_body'} = 1;
+ }
my $start_page =
- &Apache::loncommon::start_page('Not Open',undef,
- {'bgcolor' => '#FFFFFF',
- 'force_register' => 1,});
+ &Apache::loncommon::start_page('Not Open',undef,$args);
my $end_page =
&Apache::loncommon::end_page({'discussion' => 1});
$r->print($start_page.$output.$end_page);
Index: loncom/interface/slotrequest.pm
diff -u loncom/interface/slotrequest.pm:1.144 loncom/interface/slotrequest.pm:1.145
--- loncom/interface/slotrequest.pm:1.144 Wed Mar 29 16:01:13 2023
+++ loncom/interface/slotrequest.pm Fri Jul 7 03:52:40 2023
@@ -1,7 +1,7 @@
# The LearningOnline Network with CAPA
# Handler for requesting to have slots added to a students record
#
-# $Id: slotrequest.pm,v 1.144 2023/03/29 16:01:13 raeburn Exp $
+# $Id: slotrequest.pm,v 1.145 2023/07/07 03:52:40 raeburn Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -56,7 +56,7 @@
}
sub start_page {
- my ($r,$title,$brcrum,$bread_crumbs_component,$js)=@_;
+ my ($r,$title,$brcrum,$bread_crumbs_component,$js,$mgr)=@_;
my $args;
if (ref($brcrum) eq 'ARRAY') {
$args = {bread_crumbs => $brcrum};
@@ -74,6 +74,31 @@
$args = { 'add_entries' => \%loaditems };
}
}
+ unless (($env{'form.context'} eq 'usermanage') || (($mgr eq 'F') &&
+ (($env{'form.command'} eq 'release') ||
+ ($env{'form.command'} eq 'remove_registration')))) {
+ if ($env{'form.symb'}) {
+ my $symb=&unescape($env{'form.symb'});
+ my ($mapurl,$id,$resurl) = &Apache::lonnet::decode_symb($symb);
+ if ($resurl =~ /ext\.tool$/) {
+ my $target;
+ my ($marker,$exttool) = (split(m{/},$resurl))[3,4];
+ $marker=~s/\D//g;
+ if (($marker) && ($exttool) && ($env{'request.course.id'})) {
+ my $cdom = $env{'course.'.$env{'request.course.id'}.'.domain'};
+ my $cnum = $env{'course.'.$env{'request.course.id'}.'.num'};
+ my ($idx,$crstool,$is_tool,%toolhash,%toolsettings);
+ if ($resurl eq "adm/$cdom/$cnum/$marker/$exttool") {
+ my %toolsettings=&Apache::lonnet::dump('exttool_'.$marker,$cdom,$cnum);
+ $target = $toolsettings{'target'};
+ }
+ }
+ if ($target eq 'iframe') {
+ $args->{'only_body'} = 1;
+ }
+ }
+ }
+ }
$r->print(&Apache::loncommon::start_page($title,$js,$args));
}
@@ -1138,15 +1163,32 @@
sub return_link {
my ($r) = @_;
+ my $target = &return_target();
if (($env{'form.command'} eq 'manageresv') || ($env{'form.context'} eq 'usermanage')) {
- $r->print('<p><a href="/adm/slotrequest?command=manageresv">'.
- &mt('Return to reservations'));
+ $r->print('<p><a href="/adm/slotrequest?command=manageresv" target="'.$target.'">'.
+ &mt('Return to reservations').'</a></p>');
} else {
- $r->print('<p><a href="/adm/flip?postdata=return:">'.
+ $r->print('<p><a href="/adm/flip?postdata=return:" target="'.$target.'">'.
&mt('Return to last resource').'</a></p>');
}
}
+sub return_target {
+ my ($target,$ltitarget,$deeplinktarget);
+ if ($env{'request.lti.login'}) {
+ $ltitarget = $env{'request.lti.target'};
+ }
+ if ($env{'request.deeplink.login'}) {
+ $deeplinktarget = $env{'request.deeplink.target'};
+ }
+ if (($ltitarget eq 'iframe') || ($deeplinktarget eq '_self')) {
+ $target = '_self';
+ } else {
+ $target = '_top';
+ }
+ return $target;
+}
+
sub get_slot {
my ($r,$symb,$conflictable_slot,$inhibit_return_link)=@_;
@@ -1406,7 +1448,8 @@
if (!@{$available}) {
$output = '<span class="LC_info">'.&mt('No available times.').'</span>';
if ($env{'form.command'} ne 'manageresv') {
- $output .= ' <a href="/adm/flip?postdata=return:">'.
+ my $target = &return_target();
+ $output .= ' <a href="/adm/flip?postdata=return:" target="'.$target.'">'.
&mt('Return to last resource').'</a>';
}
if ($class) {
@@ -3476,7 +3519,7 @@
if (($env{'form.requestattempt'}) || ($env{'form.command'} eq 'manageresv')) {
$js = &reservation_js(\%slots,$consumed_uniqueperiods,$available,$got_slots,$symb);
}
- &start_page($r,$title,$brcrum,$bread_crumbs_component,$js);
+ &start_page($r,$title,$brcrum,$bread_crumbs_component,$js,$mgr);
if ($env{'form.command'} eq 'manageresv') {
$allavailable = $available;
Index: loncom/html/adm/helper/newslot.helper
diff -u loncom/html/adm/helper/newslot.helper:1.35 loncom/html/adm/helper/newslot.helper:1.36
--- loncom/html/adm/helper/newslot.helper:1.35 Sun Jun 24 04:11:12 2018
+++ loncom/html/adm/helper/newslot.helper Fri Jul 7 03:52:41 2023
@@ -338,8 +338,8 @@
<nextstate>PROCTOR</nextstate>
<resource variable="symb" multichoice="1">
- <filterfunc>return $res->is_map() || $res->is_problem()</filterfunc>
- <choicefunc>return $res->is_problem()</choicefunc>
+ <filterfunc>return $res->is_map() || $res->is_problem() || $res->is_tool()</filterfunc>
+ <choicefunc>return $res->is_problem() || || $res->is_tool()</choicefunc>
<valuefunc>return $res->symb()</valuefunc>
<defaultvalue>
my @defaults;
More information about the LON-CAPA-cvs
mailing list