+$helpitem $titles{'extt'}
+$type: $cdesc
+$titles{'curd'}: $domdefdisplay
+
+
+
+
+
+$submit
+
+$hidden_elements
+$titles{'back'}
+
+ENDDOCUMENT
+ return;
+}
+
+sub exttool_titles {
+ my ($type) = @_;
+ my %titles = &Apache::lonlocal::texthash(
+ 'extt' => 'External Tool permissions',
+ 'none' => 'Use of external tools not permitted',
+ 'crs' => 'Only external tools defined in course may be used',
+ 'dom' => 'Only external tools defined in domain may be used',
+ 'both' => 'External tools defined/configured in either domain or course may be used',
+ 'used' => 'Use domain default',
+ 'cour' => 'Use course-specific setting',
+ 'curd' => 'Current domain default is',
+ 'valu' => 'Value for this course',
+ 'modi' => 'Save',
+ 'back' => 'Pick another action',
+ );
+ if ($type eq 'Community') {
+ $titles{'crs'} = &mt('Only external tools defined in community may be used');
+ $titles{'both'} = &mt('External tools defined/configured in either domain or community may be used');
+ $titles{'cour'} = &mt('Use community-specific setting');
+ $titles{'valu'} = &mt('Value for this community');
+ }
+ return %titles;
+}
+
sub modify_selfenrollconfig {
my ($r,$type,$cdesc,$coursehash) = @_;
return unless(ref($coursehash) eq 'HASH');
@@ -1302,6 +1532,8 @@ sub gather_authenitems {
$curr_authtype = 'int';
} elsif ($enrollvar->{'authtype'} eq 'localauth' ) {
$curr_authtype = 'loc';
+ } elsif ($enrollvar->{'authtype'} eq 'lti' ) {
+ $curr_authtype = 'lti';
}
}
unless ($curr_authtype eq '') {
@@ -1322,7 +1554,8 @@ sub gather_authenitems {
$authform{'krb'} = &Apache::loncommon::authform_kerberos(%param);
$authform{'int'} = &Apache::loncommon::authform_internal(%param);
$authform{'loc'} = &Apache::loncommon::authform_local(%param);
- foreach my $item ('krb','int','loc') {
+ $authform{'lti'} = &Apache::loncommon::authform_lti(%param);
+ foreach my $item ('krb','int','loc','lti') {
if ($authform{$item} ne '') {
$authenitems .= $authform{$item}.'
';
}
@@ -1393,6 +1626,8 @@ sub modify_course {
if ((defined($env{'form.locarg'})) && ($env{'form.locarg'})) {
$newattr{'autharg'} = $env{'form.locarg'};
}
+ } elsif ($env{'form.login'} eq 'lti') {
+ $newattr{'authtype'} = 'lti';
}
if ( $newattr{'authtype'}=~ /^krb/) {
if ($newattr{'autharg'} eq '') {
@@ -2231,6 +2466,217 @@ sub modify_catsettings {
return;
}
+sub modify_ltiauth {
+ my ($r,$cdom,$cnum,$cdesc,$domdesc,$type) = @_;
+ my %lt = &Apache::lonlocal::texthash(
+ 'requ' => 'Requirement for re-authentication for student LTI-limited launch of deep-linked item',
+ 'link' => 'Link protection can be set to accept username for an enrolled student (if sent by Consumer)',
+ 'logi' => 'Login needed, regardless of user information sent by LTI Consumer in (signed) parameters',
+ 'used' => 'Use domain default',
+ 'cour' => 'Use course-specific setting',
+ 'modi' => 'Save',
+ 'back' => 'Pick another action',
+ );
+ &print_header($r,$type);
+ $r->print('');
+ return;
+}
+
+sub modify_exttool {
+ my ($r,$cdom,$cnum,$cdesc,$domdesc,$type) = @_;
+ my %titles = &exttool_titles($type);
+ &print_header($r,$type);
+ $r->print('');
+ return;
+}
+
sub print_header {
my ($r,$type,$javascript_validations) = @_;
my $phase = "start";
@@ -2269,9 +2715,10 @@ ENDJS
$js .= <<"ENDSCRIPT";
function verify_quota() {
- var newquota = document.setquota.coursequota.value;
+ var newcoursequota = document.setquota.coursequota.value;
+ var newuploadquota = document.setquota.uploadquota.value;
var num_reg = $regexp;
- if (num_reg.test(newquota)) {
+ if ((num_reg.test(newcoursequota)) && (num_reg.test(newuploadquota))) {
changePage(document.setquota,'processquota');
} else {
alert("$invalid\\n$alert");
@@ -2386,6 +2833,64 @@ function togglePostsubmit(caller) {
ENDSCRIPT
+ } elsif ($phase eq 'setltiauth') {
+ $js .= <<"ENDJS";
+function toggleLTIOptions(form) {
+ var radioname = 'ltiauthset';
+ var divid = 'crsltiauth';
+ var num = form.elements[radioname].length;
+ if (num) {
+ var setvis = '';
+ for (var i=0; i {'onload' => "hide_searching(); courseSet(document.filterpicker.official, 'load');"},
};
+ } elsif ($env{'form.phase'} eq 'setltiauth') {
+ $starthash = {
+ add_entries => {'onload' => "toggleLTIOptions(document.setltiauth);"},
+ };
+ } elsif ($env{'form.phase'} eq 'setexttool') {
+ $starthash = {
+ add_entries => {'onload' => "toggleExtToolOptions(document.setexttool);"},
+ };
}
$r->print(&Apache::loncommon::start_page('View/Modify Course/Community Settings',
&Apache::lonhtmlcommon::scripttag($js),
@@ -2493,8 +3006,8 @@ sub hidden_form_elements {
'locarg','krbarg','krbver','counter','hidefromcat','usecategory',
'threshold','postsubmit','postsubtimeout','defaultcredits','uploadquota',
'selfenrollmgrdc','selfenrollmgrcc','action','state','currsec_st',
- 'sections','newsec','mysqltables','nopasswdchg'],
- ['^selfenrollmgr_','^selfenroll_'])."\n".
+ 'sections','newsec','mysqltables','nopasswdchg','ltiauth','ltiauthset',
+ 'exttoolset','exttool'],['^selfenrollmgr_','^selfenroll_'])."\n".
'';
return $hidden_elements;
}
@@ -2527,6 +3040,10 @@ sub get_permission {
processcat => 'edit',
selfenroll => 'edit',
adhocrole => 'coord',
+ setltiauth => 'edit',
+ processltiauth => 'edit',
+ setexttool => 'edit',
+ processexttool => 'edit',
);
if ($passwdconf{'crsownerchg'}) {
$permission{passwdchg} = 'edit';
@@ -2542,6 +3059,8 @@ sub get_permission {
catsettings => 'view',
selfenroll => 'view',
adhocrole => 'custom',
+ setltiauth => 'view',
+ setexttool => 'view',
);
if ($passwdconf{'crsownerchg'}) {
$permission{passwdchg} = 'view';
@@ -2741,6 +3260,30 @@ sub handler {
text=>"Result"});
&modify_selfenrollconfig($r,$type,$cdesc,$coursehash);
}
+ } elsif (($phase eq 'setltiauth') && ($permission->{'setltiauth'})) {
+ &Apache::lonhtmlcommon::add_breadcrumb
+ ({href=>"javascript:changePage(document.$phase,'$phase')",
+ text=>"Requirement for re-authentication for LTI launch of deep-linked item"});
+ &print_set_ltiauth($r,$cdom,$cnum,$cdesc,$type,$readonly);
+ } elsif (($phase eq 'processltiauth') && ($permission->{'processltiauth'})) {
+ &Apache::lonhtmlcommon::add_breadcrumb
+ ({href=>"javascript:changePage(document.$phase,'setltiauth')",
+ text=>"Requirement for re-authentication for LTI launch of deep-linked item"},
+ {href=>"javascript:changePage(document.$phase,'$phase')",
+ text=>"Result"});
+ &modify_ltiauth($r,$cdom,$cnum,$cdesc,$domdesc,$type);
+ } elsif (($phase eq 'setexttool') && ($permission->{'setexttool'})) {
+ &Apache::lonhtmlcommon::add_breadcrumb
+ ({href=>"javascript:changePage(document.$phase,'$phase')",
+ text=>"External Tool permission"});
+ &print_set_exttool($r,$cdom,$cnum,$cdesc,$type,$readonly);
+ } elsif (($phase eq 'processexttool') && ($permission->{'processexttool'})) {
+ &Apache::lonhtmlcommon::add_breadcrumb
+ ({href=>"javascript:changePage(document.$phase,'setexttool')",
+ text=>"External Tool permission"},
+ {href=>"javascript:changePage(document.$phase,'$phase')",
+ text=>"Result"});
+ &modify_exttool($r,$cdom,$cnum,$cdesc,$domdesc,$type);
}
}
} else {