--- loncom/interface/domainprefs.pm 2020/10/25 18:40:38 1.160.6.102.2.5
+++ loncom/interface/domainprefs.pm 2018/05/08 01:48:18 1.326
@@ -1,7 +1,7 @@
# The LearningOnline Network with CAPA
# Handler to set domain-wide configuration settings
#
-# $Id: domainprefs.pm,v 1.160.6.102.2.5 2020/10/25 18:40:38 raeburn Exp $
+# $Id: domainprefs.pm,v 1.326 2018/05/08 01:48:18 raeburn Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -27,7 +27,7 @@
#
#
###############################################################
-##############################################################
+###############################################################
=pod
@@ -104,8 +104,8 @@ $datatable - HTML containing form eleme
In the case of course requests, radio buttons are displayed for each institutional
affiliate type (and also default, and _LC_adv) for each of the course types
-(official, unofficial, community, and textbook). In each case the radio buttons
-allow the selection of one of four values:
+(official, unofficial, community, textbook, placement, and lti).
+In each case the radio buttons allow the selection of one of four values:
0, approval, validate, autolimit=N (where N is blank, or a positive integer).
which have the following effects:
@@ -170,10 +170,12 @@ use Apache::loncoursequeueadmin();
use LONCAPA qw(:DEFAULT :match);
use LONCAPA::Enrollment;
use LONCAPA::lonauthcgi();
+use LONCAPA::SSL;
use File::Copy;
use Locale::Language;
use DateTime::TimeZone;
use DateTime::Locale;
+use Time::HiRes qw( sleep );
my $registered_cleanup;
my $modified_urls;
@@ -217,13 +219,14 @@ sub handler {
'serverstatuses','requestcourses','helpsettings',
'coursedefaults','usersessions','loadbalancing',
'requestauthor','selfenrollment','inststatus',
- 'passwords','ltitools'],$dom);
+ 'ltitools','ssl','trust','lti'],$dom);
+ my %encconfig =
+ &Apache::lonnet::get_dom('encconfig',['ltitools','lti'],$dom);
if (ref($domconfig{'ltitools'}) eq 'HASH') {
- my %encconfig =
- &Apache::lonnet::get_dom('encconfig',['ltitools'],$dom);
if (ref($encconfig{'ltitools'}) eq 'HASH') {
foreach my $id (keys(%{$domconfig{'ltitools'}})) {
- if (ref($domconfig{'ltitools'}{$id}) eq 'HASH') {
+ if ((ref($domconfig{'ltitools'}{$id}) eq 'HASH') &&
+ (ref($encconfig{'ltitools'}{$id}) eq 'HASH')) {
foreach my $item ('key','secret') {
$domconfig{'ltitools'}{$id}{$item} = $encconfig{'ltitools'}{$id}{$item};
}
@@ -231,12 +234,24 @@ sub handler {
}
}
}
- my @prefs_order = ('rolecolors','login','defaults','passwords','quotas','autoenroll',
+ if (ref($domconfig{'lti'}) eq 'HASH') {
+ if (ref($encconfig{'lti'}) eq 'HASH') {
+ foreach my $id (keys(%{$domconfig{'lti'}})) {
+ if ((ref($domconfig{'lti'}{$id}) eq 'HASH') &&
+ (ref($encconfig{'lti'}{$id}) eq 'HASH')) {
+ foreach my $item ('key','secret') {
+ $domconfig{'lti'}{$id}{$item} = $encconfig{'lti'}{$id}{$item};
+ }
+ }
+ }
+ }
+ }
+ my @prefs_order = ('rolecolors','login','defaults','quotas','autoenroll',
'autoupdate','autocreate','directorysrch','contacts',
'usercreation','selfcreation','usermodification','scantron',
'requestcourses','requestauthor','coursecategories',
'serverstatuses','helpsettings','coursedefaults',
- 'ltitools','selfenrollment','usersessions');
+ 'ltitools','selfenrollment','usersessions','ssl','trust','lti');
my %existing;
if (ref($domconfig{'loadbalancing'}) eq 'HASH') {
%existing = %{$domconfig{'loadbalancing'}};
@@ -276,25 +291,13 @@ sub handler {
help => 'Domain_Configuration_LangTZAuth',
header => [{col1 => 'Setting',
col2 => 'Value'},
+ {col1 => 'Internal Authentication',
+ col2 => 'Value'},
{col1 => 'Institutional user types',
col2 => 'Name displayed'}],
print => \&print_defaults,
modify => \&modify_defaults,
},
- 'passwords' =>
- { text => 'Passwords (Internal authentication)',
- help => 'Domain_Configuration_Passwords',
- header => [{col1 => 'Resetting Forgotten Password',
- col2 => 'Settings'},
- {col1 => 'Encryption of Stored Passwords (Internal Auth)',
- col2 => 'Settings'},
- {col1 => 'Rules for LON-CAPA Passwords',
- col2 => 'Settings'},
- {col1 => 'Course Owner Changing Student Passwords',
- col2 => 'Settings'}],
- print => \&print_passwords,
- modify => \&modify_passwords,
- },
'quotas' =>
{ text => 'Blogs, personal web pages, webDAV/quotas, portfolios',
help => 'Domain_Configuration_Quotas',
@@ -389,12 +392,11 @@ sub handler {
modify => \&modify_usermodification,
},
'scantron' =>
- { text => 'Bubblesheet format',
+ { text => 'Bubblesheet format file',
help => 'Domain_Configuration_Scantron_Format',
- header => [ {col1 => 'Bubblesheet format file',
- col2 => ''},
- {col1 => 'Bubblesheet data upload formats',
- col2 => 'Settings'}],
+ header => [ {col1 => 'Item',
+ col2 => '',
+ }],
print => \&print_scantron,
modify => \&modify_scantron,
},
@@ -479,6 +481,14 @@ sub handler {
print => \&print_selfenrollment,
modify => \&modify_selfenrollment,
},
+ 'privacy' =>
+ {text => 'User Privacy',
+ help => 'Domain_Configuration_User_Privacy',
+ header => [{col1 => 'Setting',
+ col2 => 'Value',}],
+ print => \&print_privacy,
+ modify => \&modify_privacy,
+ },
'usersessions' =>
{text => 'User session hosting/offloading',
help => 'Domain_Configuration_User_Sessions',
@@ -502,7 +512,7 @@ sub handler {
print => \&print_loadbalancing,
modify => \&modify_loadbalancing,
},
- 'ltitools' =>
+ 'ltitools' =>
{text => 'External Tools (LTI)',
help => 'Domain_Configuration_LTI_Tools',
header => [{col1 => 'Setting',
@@ -510,6 +520,52 @@ sub handler {
print => \&print_ltitools,
modify => \&modify_ltitools,
},
+ 'ssl' =>
+ {text => 'LON-CAPA Network (SSL)',
+ help => 'Domain_Configuration_Network_SSL',
+ header => [{col1 => 'Server',
+ col2 => 'Certificate Status'},
+ {col1 => 'Connections to other servers',
+ col2 => 'Rules'},
+ {col1 => 'Connections from other servers',
+ col2 => 'Rules'},
+ {col1 => "Replicating domain's published content",
+ col2 => 'Rules'}],
+ print => \&print_ssl,
+ modify => \&modify_ssl,
+ },
+ 'trust' =>
+ {text => 'Trust Settings',
+ help => 'Domain_Configuration_Trust',
+ header => [{col1 => "Access to this domain's content by others",
+ col2 => 'Rules'},
+ {col1 => "Access to other domain's content by this domain",
+ col2 => 'Rules'},
+ {col1 => "Enrollment in this domain's courses by others",
+ col2 => 'Rules',},
+ {col1 => "Co-author roles in this domain for others",
+ col2 => 'Rules',},
+ {col1 => "Co-author roles for this domain's users elsewhere",
+ col2 => 'Rules',},
+ {col1 => "Domain roles in this domain assignable to others",
+ col2 => 'Rules'},
+ {col1 => "Course catalog for this domain displayed elsewhere",
+ col2 => 'Rules'},
+ {col1 => "Requests for creation of courses in this domain by others",
+ col2 => 'Rules'},
+ {col1 => "Users in other domains can send messages to this domain",
+ col2 => 'Rules'},],
+ print => \&print_trust,
+ modify => \&modify_trust,
+ },
+ 'lti' =>
+ {text => 'LTI Provider',
+ help => 'Domain_Configuration_LTI_Provider',
+ header => [{col1 => 'Setting',
+ col2 => 'Value',}],
+ print => \&print_lti,
+ modify => \&modify_lti,
+ },
);
if (keys(%servers) > 1) {
$prefs{'login'} = { text => 'Log-in page options',
@@ -569,9 +625,6 @@ END
if (grep(/^contacts$/,@actions)) {
$js .= &contacts_javascript();
}
- if (grep(/^scantron$/,@actions)) {
- $js .= &scantron_javascript();
- }
&Apache::lonconfigsettings::display_settings($r,$dom,$phase,$context,\@prefs_order,\%prefs,\%domconfig,$confname,$js);
} else {
# check if domconfig user exists for the domain.
@@ -692,10 +745,14 @@ sub process_changes {
$output = &modify_usersessions($dom,$lastactref,%domconfig);
} elsif ($action eq 'loadbalancing') {
$output = &modify_loadbalancing($dom,%domconfig);
- } elsif ($action eq 'passwords') {
- $output = &modify_passwords($r,$dom,$confname,$lastactref,%domconfig);
} elsif ($action eq 'ltitools') {
$output = &modify_ltitools($r,$dom,$action,$lastactref,%domconfig);
+ } elsif ($action eq 'ssl') {
+ $output = &modify_ssl($dom,$lastactref,%domconfig);
+ } elsif ($action eq 'trust') {
+ $output = &modify_trust($dom,$lastactref,%domconfig);
+ } elsif ($action eq 'lti') {
+ $output = &modify_lti($r,$dom,$action,$lastactref,%domconfig);
}
return $output;
}
@@ -708,8 +765,6 @@ sub print_config_box {
$output = &coursecategories_javascript($settings);
} elsif ($action eq 'defaults') {
$output = &defaults_javascript($settings);
- } elsif ($action eq 'passwords') {
- $output = &passwords_javascript();
} elsif ($action eq 'helpsettings') {
my (%privs,%levelscurrent);
my %full=();
@@ -724,15 +779,13 @@ sub print_config_box {
&Apache::lonuserutils::custom_role_privs(\%privs,\%full,\%levels,\%levelscurrent);
my @templateroles = &Apache::lonuserutils::custom_template_roles($context,$crstype);
$output =
- &Apache::lonuserutils::custom_roledefs_js($context,$crstype,$formname,\%full,
+ &Apache::lonuserutils::custom_roledefs_js($context,$crstype,$formname,\%full,
\@templateroles);
- } elsif ($action eq 'ltitools') {
- $output .= <itools_javascript($settings);
}
$output .=
'
- '.
+ '.
&mt($item->{text}).' '.
&Apache::loncommon::help_open_topic($item->{'help'}).' '."\n".
' ';
@@ -744,7 +797,6 @@ sub print_config_box {
if ($numheaders > 1) {
my $colspan = '';
my $rightcolspan = '';
- my $leftnobr = '';
if (($action eq 'rolecolors') || ($action eq 'defaults') ||
($action eq 'directorysrch') ||
(($action eq 'login') && ($numheaders < 4))) {
@@ -753,29 +805,23 @@ sub print_config_box {
if ($action eq 'usersessions') {
$rightcolspan = ' colspan="3"';
}
- if ($action eq 'passwords') {
- $leftnobr = ' LC_nobreak';
- }
$output .= '
- '.&mt($item->{'header'}->[0]->{'col1'}).'
+ '.&mt($item->{'header'}->[0]->{'col1'}).'
'.&mt($item->{'header'}->[0]->{'col2'}).'
';
$rowtotal ++;
if (($action eq 'autoupdate') || ($action eq 'usercreation') || ($action eq 'selfcreation') ||
($action eq 'usermodification') || ($action eq 'defaults') || ($action eq 'coursedefaults') ||
- ($action eq 'selfenrollment') || ($action eq 'usersessions') || ($action eq 'directorysrch') ||
- ($action eq 'helpsettings') || ($action eq 'contacts')) {
+ ($action eq 'selfenrollment') || ($action eq 'usersessions') || ($action eq 'ssl') ||
+ ($action eq 'directorysrch') || ($action eq 'trust') || ($action eq 'helpsettings') ||
+ ($action eq 'contacts')) {
$output .= $item->{'print'}->('top',$dom,$settings,\$rowtotal);
- } elsif ($action eq 'passwords') {
- $output .= $item->{'print'}->('top',$dom,$confname,$settings,\$rowtotal);
} elsif ($action eq 'coursecategories') {
$output .= $item->{'print'}->('top',$dom,$item,$settings,\$rowtotal);
- } elsif ($action eq 'scantron') {
- $output .= $item->{'print'}->($r,'top',$dom,$confname,$settings,\$rowtotal);
} elsif ($action eq 'login') {
if ($numheaders == 4) {
$colspan = ' colspan="2"';
@@ -802,56 +848,89 @@ sub print_config_box {
$rowtotal ++;
if (($action eq 'autoupdate') || ($action eq 'usercreation') ||
($action eq 'selfcreation') || ($action eq 'selfenrollment') ||
- ($action eq 'usersessions') || ($action eq 'coursecategories') ||
- ($action eq 'contacts') || ($action eq 'passwords')) {
+ ($action eq 'usersessions') || ($action eq 'coursecategories') ||
+ ($action eq 'trust') || ($action eq 'contacts') || ($action eq 'defaults')) {
if ($action eq 'coursecategories') {
$output .= &print_coursecategories('middle',$dom,$item,$settings,\$rowtotal);
$colspan = ' colspan="2"';
- } elsif ($action eq 'passwords') {
- $output .= $item->{'print'}->('middle',$dom,$confname,$settings,\$rowtotal);
+ } elsif ($action eq 'trust') {
+ $output .= $item->{'print'}->('shared',$dom,$settings,\$rowtotal);
} else {
$output .= $item->{'print'}->('middle',$dom,$settings,\$rowtotal);
}
- $output .= '
-
+ if ($action eq 'trust') {
+ $output .= '
+
-
+ ';
+ my @trusthdrs = qw(2 3 4 5 6 7);
+ my @prefixes = qw(enroll othcoau coaurem domroles catalog reqcrs);
+ for (my $i=0; $i<@trusthdrs; $i++) {
+ $output .= '
- '.&mt($item->{'header'}->[2]->{'col1'}).'
- '.&mt($item->{'header'}->[2]->{'col2'}).'
- '."\n";
- if ($action eq 'coursecategories') {
- $output .= &print_coursecategories('bottom',$dom,$item,$settings,\$rowtotal);
- } elsif ($action eq 'passwords') {
- $output .= $item->{'print'}->('lower',$dom,$confname,$settings,\$rowtotal).'
-
+ '.&mt($item->{'header'}->[$trusthdrs[$i]]->{'col1'}).'
+ '.&mt($item->{'header'}->[$trusthdrs[$i]]->{'col2'}).' '.
+ $item->{'print'}->($prefixes[$i],$dom,$settings,\$rowtotal).'
-
-
-
+
+ ';
+ }
+ $output .= '
+
- '.&mt($item->{'header'}->[3]->{'col1'}).'
- '.&mt($item->{'header'}->[3]->{'col2'}).' '."\n".
- $item->{'print'}->('bottom',$dom,$confname,$settings,\$rowtotal).'
-
+ '.&mt($item->{'header'}->[8]->{'col1'}).'
+ '.&mt($item->{'header'}->[8]->{'col2'}).' '.
+ $item->{'print'}->('bottom',$dom,$settings,\$rowtotal);
+ } else {
+ $output .= '
+
- ';
- } else {
- $output .= $item->{'print'}->('bottom',$dom,$settings,\$rowtotal);
+
+
+
+
+ '.&mt($item->{'header'}->[2]->{'col1'}).'
+ '.&mt($item->{'header'}->[2]->{'col2'}).'
+ '."\n";
+ if ($action eq 'coursecategories') {
+ $output .= &print_coursecategories('bottom',$dom,$item,$settings,\$rowtotal);
+ } else {
+ $output .= $item->{'print'}->('bottom',$dom,$settings,\$rowtotal);
+ }
}
$rowtotal ++;
} elsif (($action eq 'usermodification') || ($action eq 'coursedefaults') ||
($action eq 'defaults') || ($action eq 'directorysrch') ||
($action eq 'helpsettings')) {
$output .= $item->{'print'}->('bottom',$dom,$settings,\$rowtotal);
- } elsif ($action eq 'scantron') {
- $output .= $item->{'print'}->($r,'bottom',$dom,$confname,$settings,\$rowtotal);
+ } elsif ($action eq 'ssl') {
+ $output .= $item->{'print'}->('connto',$dom,$settings,\$rowtotal).'
+
+
+
+
+
+
+
+ '.&mt($item->{'header'}->[2]->{'col1'}).'
+ '.&mt($item->{'header'}->[2]->{'col2'}).' '.
+ $item->{'print'}->('connfrom',$dom,$settings,\$rowtotal).'
+
+
+
+
+
+
+
+ '.&mt($item->{'header'}->[3]->{'col1'}).'
+ '.&mt($item->{'header'}->[3]->{'col2'}).' '.
+ $item->{'print'}->('bottom',$dom,$settings,\$rowtotal);
} elsif ($action eq 'login') {
if ($numheaders == 4) {
$output .= &print_login('page',$dom,$confname,$phase,$settings,\$rowtotal).'
@@ -922,8 +1001,8 @@ sub print_config_box {
- '.&mt($item->{'header'}->[4]->{'col1'}).'
- '.&mt($item->{'header'}->[4]->{'col2'}).'
+ '.&mt($item->{'header'}->[4]->{'col1'}).'
+ '.&mt($item->{'header'}->[4]->{'col2'}).'
'.
&print_validation_rows('requestcourses',$dom,$settings,\$rowtotal);
} elsif ($action eq 'requestauthor') {
@@ -938,9 +1017,9 @@ sub print_config_box {
- '.
+ '.
&mt($item->{'header'}->[2]->{'col1'}).'
- '.
+ '.
&mt($item->{'header'}->[2]->{'col2'}).'
'.
&print_rolecolors($phase,'author',$dom,$confname,$settings,\$rowtotal).'
@@ -968,30 +1047,30 @@ sub print_config_box {
'.&mt($item->{'header'}->[0]->{'col1'}).' ';
} elsif ($action eq 'serverstatuses') {
$output .= '
- '.&mt($item->{'header'}->[0]->{'col1'}).
+ '.&mt($item->{'header'}->[0]->{'col1'}).
' ('.&mt('Automatic access for Dom. Coords.').') ';
} else {
$output .= '
- '.&mt($item->{'header'}->[0]->{'col1'}).' ';
+ '.&mt($item->{'header'}->[0]->{'col1'}).' ';
}
if (defined($item->{'header'}->[0]->{'col3'})) {
- $output .= ''.
+ $output .= ' '.
&mt($item->{'header'}->[0]->{'col2'});
if ($action eq 'serverstatuses') {
$output .= ' ('.&mt('user1:domain1,user2:domain2 etc.').' )';
}
} else {
- $output .= ' '.
+ $output .= ' '.
&mt($item->{'header'}->[0]->{'col2'});
}
$output .= ' ';
if ($item->{'header'}->[0]->{'col3'}) {
if (defined($item->{'header'}->[0]->{'col4'})) {
- $output .= ''.
+ $output .= ' '.
&mt($item->{'header'}->[0]->{'col3'});
} else {
- $output .= ' '.
+ $output .= ' '.
&mt($item->{'header'}->[0]->{'col3'});
}
if ($action eq 'serverstatuses') {
@@ -1000,7 +1079,7 @@ sub print_config_box {
$output .= ' ';
}
if ($item->{'header'}->[0]->{'col4'}) {
- $output .= ''.
+ $output .= ' '.
&mt($item->{'header'}->[0]->{'col4'});
}
$output .= '';
@@ -1008,9 +1087,11 @@ sub print_config_box {
if ($action eq 'quotas') {
$output .= &print_quotas($dom,$settings,\$rowtotal,$action);
} elsif (($action eq 'autoenroll') || ($action eq 'autocreate') ||
- ($action eq 'serverstatuses') || ($action eq 'loadbalancing') ||
- ($action eq 'ltitools')) {
+ ($action eq 'serverstatuses') || ($action eq 'loadbalancing') ||
+ ($action eq 'ltitools') || ($action eq 'lti')) {
$output .= $item->{'print'}->($dom,$settings,\$rowtotal);
+ } elsif ($action eq 'scantron') {
+ $output .= &print_scantronformat($r,$dom,$confname,$settings,\$rowtotal);
}
}
$output .= '
@@ -1031,7 +1112,7 @@ sub print_login {
my $choice = $choices{'disallowlogin'};
$css_class = ' class="LC_odd_row"';
$datatable .= ' '.$choice.' '.
- ''.$choices{'hostid'}.' '.
+ ''.$choices{'hostid'}.' '.
''.$choices{'server'}.' '.
''.$choices{'serverpath'}.' '.
''.$choices{'custompath'}.' '.
@@ -1312,7 +1393,7 @@ sub print_login {
my $choice = $choices{'headtag'};
$css_class = ' class="LC_odd_row"';
$datatable .= ''.$choice.' '.
- ''.$choices{'hostid'}.' '.
+ ' ';
}
@@ -1515,7 +1596,7 @@ sub display_color_options {
my $datatable = ''.
''.$choices->{'font'}.' ';
if (!$is_custom->{'font'}) {
- $datatable .= ''.&mt('Default in use:').' '.$defaults->{'font'}.' ';
+ $datatable .= ''.&mt('Default in use:').' '.$defaults->{'font'}.' ';
} else {
$datatable .= ' ';
}
@@ -1524,12 +1605,12 @@ sub display_color_options {
$datatable .= ''.
' '.
- ' ';
+ ' ';
unless ($role eq 'login') {
$datatable .= ''.
''.$choices->{'fontmenu'}.' ';
if (!$is_custom->{'fontmenu'}) {
- $datatable .= ''.&mt('Default in use:').' '.$defaults->{'fontmenu'}.' ';
+ $datatable .= ''.&mt('Default in use:').' '.$defaults->{'fontmenu'}.' ';
} else {
$datatable .= ' ';
}
@@ -1539,7 +1620,7 @@ sub display_color_options {
' '.
- ' ';
+ ' ';
}
my $switchserver = &check_switchserver($dom,$confname);
foreach my $img (@{$images}) {
@@ -1657,7 +1738,7 @@ sub display_color_options {
my $bgs_def;
foreach my $item (@{$bgs}) {
if (!$is_custom->{$item}) {
- $bgs_def .= ''.$choices->{$item}.' '.$defaults->{'bgs'}{$item}.' ';
+ $bgs_def .= ''.$choices->{$item}.' '.$defaults->{'bgs'}{$item}.' ';
}
}
if ($bgs_def) {
@@ -1669,7 +1750,7 @@ sub display_color_options {
'';
foreach my $item (@{$bgs}) {
- $datatable .= ''.$choices->{$item};
+ $datatable .= ' '.$choices->{$item};
my $color = $designs->{'bgs'}{$item} ? $designs->{'bgs'}{$item} : $defaults->{'bgs'}{$item};
if ($designs->{'bgs'}{$item}) {
$datatable .= ' ';
@@ -1685,7 +1766,7 @@ sub display_color_options {
my $links_def;
foreach my $item (@{$links}) {
if (!$is_custom->{$item}) {
- $links_def .= ' '.$choices->{$item}.''.$defaults->{'links'}{$item}.' ';
+ $links_def .= ''.$choices->{$item}.''.$defaults->{'links'}{$item}.' ';
}
}
if ($links_def) {
@@ -1697,7 +1778,7 @@ sub display_color_options {
'';
foreach my $item (@{$links}) {
my $color = $designs->{'links'}{$item} ? $designs->{'links'}{$item} : $defaults->{'links'}{$item};
- $datatable .= ''.$choices->{$item}."\n";
+ $datatable .= ' '.$choices->{$item}."\n";
if ($designs->{'links'}{$item}) {
$datatable.=' ';
}
@@ -1758,7 +1839,7 @@ sub login_text_colors {
my ($img,$role,$logintext,$phase,$choices,$designs,$defaults) = @_;
my $color_menu = '';
foreach my $item (@{$logintext}) {
- $color_menu .= ''.$choices->{$item};
+ $color_menu .= ' '.$choices->{$item};
my $color = $designs->{'logintext'}{$item} ? $designs->{'logintext'}{$item} : $defaults->{'logintext'}{$item};
$color_menu .= ' ';
@@ -1771,15 +1852,17 @@ sub image_changes {
my ($is_custom,$alt_text,$img_import,$showfile,$fullsize,$role,$img,$imgfile,$logincolors) = @_;
my $output;
if ($img eq 'login') {
- $output = ''.$logincolors; # suppress image for Log-in header
+ # suppress image for Log-in header
} elsif (!$is_custom) {
if ($img ne 'domlogo') {
- $output = &mt('Default image:').' ';
+ $output .= &mt('Default image:').' ';
} else {
- $output = &mt('Default in use:').' ';
+ $output .= &mt('Default in use:').' ';
}
}
- if ($img ne 'login') {
+ if ($img eq 'login') { # suppress image for Log-in header
+ $output .= ' '.$logincolors;
+ } else {
if ($img_import) {
$output .= ' ';
}
@@ -1791,7 +1874,7 @@ sub image_changes {
$role.'_del_'.$img.'" value="1" />'.&mt('Delete?').
' '.&mt('Replace:').' ';
} else {
- $output .= ' '.$logincolors.&mt('Upload:').' ';
+ $output .= ' '.$logincolors.&mt('Upload:').' ';
}
}
return $output;
@@ -1810,7 +1893,7 @@ sub print_quotas {
my $typecount = 0;
my ($css_class,%titles);
if ($context eq 'requestcourses') {
- @usertools = ('official','unofficial','community','textbook');
+ @usertools = ('official','unofficial','community','textbook','placement','lti');
@options =('norequest','approval','validate','autolimit');
%validations = &Apache::lonnet::auto_courserequest_checks($dom);
%titles = &courserequest_titles();
@@ -2274,7 +2357,7 @@ sub print_studentcode {
my ($settings,$rowtotal) = @_;
my $rownum = 0;
my ($output,%current);
- my @crstypes = ('official','unofficial','community','textbook');
+ my @crstypes = ('official','unofficial','community','textbook','placement','lti');
if (ref($settings) eq 'HASH') {
if (ref($settings->{'uniquecode'}) eq 'HASH') {
foreach my $type (@crstypes) {
@@ -2370,8 +2453,7 @@ sub print_textbookcourses {
(' 'x2).
''.&mt('Thumbnail:');
if ($image) {
- $datatable .= ''.
- $imgsrc.
+ $datatable .= $imgsrc.
' '.&mt('Delete?').' '.
' '.&mt('Replace:').' ';
@@ -2402,7 +2484,7 @@ sub print_textbookcourses {
$datatable .= ''.$vpos.' ';
}
$datatable .= ' '."\n".
- ' '.&mt('Add').' '."\n".
+ ' '.&mt('Add').''."\n".
''.
''.&mt('Subject:').' '."\n".
(' 'x2).
@@ -2419,13 +2501,13 @@ sub print_textbookcourses {
} else {
$datatable .= ' ';
}
- $datatable .= ''."\n";
}
- $datatable .= ''.&mt('LON-CAPA course:').' '.
+ $datatable .= ' '."\n".
+ ''.&mt('LON-CAPA course:').' '.
&Apache::loncommon::select_dom_form($env{'request.role.domain'},$type.'_addbook_cdom').
' '.
&Apache::loncommon::selectcourse_link
- ('display',$type.'_addbook_cnum',$type.'_addbook_cdom',undef,undef,undef,'Course').
+ ('display',$type.'_addbook_cnum',$type.'_addbook_cdom',undef,undef,undef,'Course');
' '."\n".
' '."\n";
$itemcount ++;
@@ -2606,6 +2688,30 @@ sub ltitools_toggle_js {
function toggleLTITools(form,setting,item) {
var radioname = '';
var divid = '';
+ if ((setting == 'passback') || (setting == 'roster')) {
+ radioname = 'ltitools_'+setting+'_'+item;
+ divid = 'ltitools_'+setting+'time_'+item;
+ var num = form.elements[radioname].length;
+ if (num) {
+ var setvis = '';
+ for (var i=0; i{$item}) eq 'HASH') {
+ my $num = $settings->{$item}{'order'};
+ $ordered{$num} = $item;
+ }
+ }
+ $total = scalar(keys(%{$settings}));
+ my @jsarray = ();
+ foreach my $item (sort {$a <=> $b } (keys(%ordered))) {
+ push(@jsarray,$ordered{$item});
+ }
+ my $jstext = ' var lti = Array('."'".join("','",@jsarray)."'".');'."\n";
+ return <<"ENDSCRIPT";
+
+
+$togglejs
+
+ENDSCRIPT
+}
+
+sub lti_toggle_js {
+ my %lcauthparmtext = &Apache::lonlocal::texthash (
+ localauth => 'Local auth argument',
+ krb => 'Kerberos domain',
+ );
+ return <<"ENDSCRIPT";
+
+
+ENDSCRIPT
+}
+
sub print_autoenroll {
my ($dom,$settings,$rowtotal) = @_;
my $autorun = &Apache::lonnet::auto_run(undef,$dom),
@@ -2706,7 +3026,7 @@ sub print_autoenroll {
''.&mt('Failsafe for no drops when institutional data missing').' '.
''.
' ';
+ ' value="'.$failsafe.'" size="4" />';
$$rowtotal += 4;
return $datatable;
}
@@ -2999,7 +3319,7 @@ sub print_contacts {
}
} elsif ($position eq 'middle') {
@mailings = ('errormail','packagesmail','lonstatusmail','requestsmail',
- 'updatesmail','idconflictsmail','hostipmail');
+ 'updatesmail','idconflictsmail');
foreach my $type (@mailings) {
$otheremails{$type} = '';
}
@@ -3076,7 +3396,6 @@ sub print_contacts {
$checked{'requestsmail'}{'adminemail'} = ' checked="checked" ';
$checked{'updatesmail'}{'adminemail'} = ' checked="checked" ';
$checked{'idconflictsmail'}{'adminemail'} = ' checked="checked" ';
- $checked{'hostipmail'}{'adminemail'} = ' checked="checked" ';
} elsif ($position eq 'bottom') {
$checked{'helpdeskmail'}{'supportemail'} = ' checked="checked" ';
$checked{'otherdomsmail'}{'supportemail'} = ' checked="checked" ';
@@ -3137,7 +3456,7 @@ sub print_contacts {
if ($currfield{$field} eq 'no') {
$display = ' style="display:none"';
}
- $datatable .= ''.
+ $datatable .= ' '.
''.&mt('Maximum size for upload (MB)').' '.
' ';
}
@@ -3182,7 +3501,7 @@ sub print_contacts {
'value="'.$bccemails{$type}.'" />'.
''.&mt('Optional added text').' '.
&mt('Text automatically added to e-mail:').' '.
- ' '.
+ ' '.
''.&mt('Location:').' '.
' '.&mt('in subject').' '.
(' 'x2).
@@ -3234,7 +3553,7 @@ sub print_contacts {
$includeloc{'override_'.$key} = '';
$includestr{'override_'.$key} = '';
if ($settings->{'overrides'}{$key}{'include'} ne '') {
- ($includeloc{'override_'.$key},$includestr{'override_'.$key}) =
+ ($includeloc{'override_'.$key},$includestr{'override_'.$key}) =
split(/:/,$settings->{'overrides'}{$key}{'include'},2);
$includestr{'override_'.$key} = &unescape($includestr{'override_'.$key});
}
@@ -3246,7 +3565,7 @@ sub print_contacts {
my $optionsprefix = 'LC_options_helpdesk_';
my $onclicktypes = "toggleHelpdeskRow(this.form,'overrides','$customclass','$optionsprefix');";
-
+
$datatable .= &insttypes_row($settings,$types,$usertypes,$dom,
$numinrow,$othertitle,'overrides',
\$rownum,$onclicktypes,$customclass);
@@ -3308,7 +3627,7 @@ sub overridden_helpdesk {
}
my $title;
if (ref($short_titles) eq 'HASH') {
- $title = $short_titles->{$item};
+ $title = $short_titles->{$item};
}
$output .= ''.
' '.
''.&mt('Optional added text').' '.
&mt('Text automatically added to e-mail:').' '.
- ' '.
+ ' '.
''.&mt('Location:').' '.
' '.&mt('in subject').' '.
(' 'x2).
@@ -3387,6 +3706,7 @@ function toggleHelpdeskRow(form,checkbox
return;
}
+
// ]]>
@@ -3492,7 +3812,7 @@ sub print_helpsettings {
my @templateroles = &Apache::lonuserutils::custom_template_roles($context,$crstype);
$css_class = $itemcount%2?' class="LC_odd_row"':'';
my $chgstr = ' onchange="javascript:reorderHelpRoles(this.form,'."'helproles_".$num."_pos'".');"';
- $datatable .= ''.$role.' '.
+ $datatable .= ''.$role.' '.
'';
for (my $k=0; $k<=$maxnum; $k++) {
my $vpos = $k+1;
@@ -3531,7 +3851,7 @@ sub print_helpsettings {
&Apache::lonuserutils::custom_role_privs(\%privs,\%full,\%levels,\%levelscurrent);
my @templateroles = &Apache::lonuserutils::custom_template_roles($context,$crstype);
my $chgstr = ' onchange="javascript:reorderHelpRoles(this.form,'."'helproles_".$count."_pos'".');"';
- $datatable .= ''.
+ $datatable .= ''.
' '."\n".
'';
for (my $k=0; $k<$maxnum+1; $k++) {
@@ -3561,9 +3881,7 @@ sub print_helpsettings {
\@templateroles,$newcust).
&Apache::lonuserutils::custom_role_table('Course',\%full,\%levels,
\%levelscurrent,$newcust).
- ''.
- &helpsettings_javascript(\@roles_by_num,$maxnum,$hiddenstr,$formname).
- ' ';
+ ' ';
$count ++;
$$rowtotal += $count;
}
@@ -3812,7 +4130,7 @@ sub radiobutton_prefs {
foreach my $item (@{$toggles}) {
$css_class = $itemcount%2?' class="LC_odd_row"':'';
$datatable .=
- ''.
+ ' '.
''.$choices->{$item}.
' ';
if ($align eq 'left') {
@@ -3852,7 +4170,7 @@ sub print_ltitools {
my $confname = $dom.'-domainconfig';
my $switchserver = &check_switchserver($dom,$confname);
my $maxnum = scalar(keys(%ordered));
- my $datatable;
+ my $datatable = <itools_javascript($settings);
my %lt = <itools_names();
my @courseroles = ('cc','in','ta','ep','st');
my @ltiroles = qw(Instructor ContentDeveloper TeachingAssistant Learner);
@@ -3953,13 +4271,41 @@ sub print_ltitools {
' '.
(' 'x2);
}
- $datatable .= ' '.
+ $datatable .= ' '.
''.$lt{'linktext'}.' '.
- '
'.
+ ' '.
''.$lt{'explanation'}.' '.
'
'.
- '
';
+ '
';
+ my %units = (
+ 'passback' => 'days',
+ 'roster' => 'seconds',
+ );
+ foreach my $extra ('passback','roster') {
+ my $validsty = 'none';
+ my $currvalid;
+ my $checkedon = '';
+ my $checkedoff = ' checked="checked"';
+ if ($settings->{$item}->{$extra}) {
+ $checkedon = $checkedoff;
+ $checkedoff = '';
+ $validsty = 'inline-block';
+ if ($settings->{$item}->{$extra.'valid'} =~ /^\d+\.?\d*$/) {
+ $currvalid = $settings->{$item}->{$extra.'valid'};
+ }
+ }
+ my $onclick = ' onclick="toggleLTITools(this.form,'."'$extra','$i'".');"';
+ $datatable .= ''.$lt{$extra}.' '.
+ ' '.
+ &mt('No').' '.(' 'x2).
+ ' '.
+ &mt('Yes').'
'.
+ '
';
+ }
$datatable .= ''.$lt{'icon'}.': ';
if ($imgsrc) {
$datatable .= $imgsrc.
@@ -4028,7 +4374,7 @@ sub print_ltitools {
if (!$rolemaps{$role}) {
$selectnone = ' selected="selected"';
}
- $datatable .= ' '.
+ $datatable .= ' '.
&Apache::lonnet::plaintext($role,'Course').' '.
''.
''.&mt('Select').' ';
@@ -4098,7 +4444,7 @@ sub print_ltitools {
$datatable .= ''.$vpos.' ';
}
$datatable .= ' '."\n".
- ' '.&mt('Add').' '."\n".
+ ' '.&mt('Add').''."\n".
''.
''.&mt('Required settings').' '.
''.$lt{'title'}.': '."\n".
@@ -4135,13 +4481,33 @@ sub print_ltitools {
' '.
(' 'x2);
}
- $datatable .= ' '.
+ $datatable .= ' '.
''.$lt{'linktext'}.' '.
- '
'.
+ ' '.
''.$lt{'explanation'}.' '.
- ''.
- '
'.
- '
';
+ ''.
+ '
';
+ my %units = (
+ 'passback' => 'days',
+ 'roster' => 'seconds',
+ );
+ my %defaulttimes = (
+ 'passback' => '7',
+ 'roster' => '300',
+ );
+ foreach my $extra ('passback','roster') {
+ my $onclick = ' onclick="toggleLTITools(this.form,'."'$extra','add'".');"';
+ $datatable .= ''.$lt{$extra}.' '.
+ ' '.
+ &mt('No').' '.(' 'x2).''.
+ ' '.
+ &mt('Yes').'
'.
+ '
';
+ }
$datatable .= ''.$lt{'icon'}.': '.
'('.&mt('if larger than 21x21 pixels, image will be scaled').') ';
if ($switchserver) {
@@ -4175,7 +4541,7 @@ sub print_ltitools {
$datatable .= ''.&mt('Role mapping').' '."\n".
+ '
'."\n".
''."\n".
''."\n";
$itemcount ++;
@@ -4215,7 +4581,7 @@ sub ltitools_names {
'key' => 'Key',
'lifetime' => 'Nonce lifetime (s)',
'secret' => 'Secret',
- 'icon' => 'Icon',
+ 'icon' => 'Icon',
'user' => 'User',
'fullname' => 'Full Name',
'firstname' => 'First Name',
@@ -4229,22 +4595,460 @@ sub ltitools_names {
'width' => 'Width',
'linktext' => 'Default Link Text',
'explanation' => 'Default Explanation',
+ 'passback' => 'Tool can return grades:',
+ 'roster' => 'Tool can retrieve roster:',
'crstarget' => 'Display target',
'crslabel' => 'Course label',
- 'crstitle' => 'Course title',
+ 'crstitle' => 'Course title',
'crslinktext' => 'Link Text',
'crsexplanation' => 'Explanation',
'crsappend' => 'Provider URL',
);
+ return %lt;
+}
+sub print_lti {
+ my ($dom,$settings,$rowtotal) = @_;
+ my $itemcount = 1;
+ my $maxnum = 0;
+ my $css_class;
+ my %ordered;
+ if (ref($settings) eq 'HASH') {
+ foreach my $item (keys(%{$settings})) {
+ if (ref($settings->{$item}) eq 'HASH') {
+ my $num = $settings->{$item}{'order'};
+ $ordered{$num} = $item;
+ }
+ }
+ }
+ my $maxnum = scalar(keys(%ordered));
+ my $datatable = <i_javascript($settings);
+ my %lt = <i_names();
+ if (keys(%ordered)) {
+ my @items = sort { $a <=> $b } keys(%ordered);
+ for (my $i=0; $i<@items; $i++) {
+ $css_class = $itemcount%2?' class="LC_odd_row"':'';
+ my $item = $ordered{$items[$i]};
+ my ($key,$secret,$lifetime,$consumer,$current);
+ if (ref($settings->{$item}) eq 'HASH') {
+ $key = $settings->{$item}->{'key'};
+ $secret = $settings->{$item}->{'secret'};
+ $lifetime = $settings->{$item}->{'lifetime'};
+ $consumer = $settings->{$item}->{'consumer'};
+ $current = $settings->{$item};
+ }
+ my $chgstr = ' onchange="javascript:reorderLTI(this.form,'."'lti_pos_".$item."'".');"';
+ $datatable .= ''
+ .'';
+ for (my $k=0; $k<=$maxnum; $k++) {
+ my $vpos = $k+1;
+ my $selstr;
+ if ($k == $i) {
+ $selstr = ' selected="selected" ';
+ }
+ $datatable .= ''.$vpos.' ';
+ }
+ $datatable .= ' '.(' 'x2).
+ ' '.
+ &mt('Delete?').' '.
+ ''.
+ ''.&mt('Required settings').' '.
+ ''.$lt{'consumer'}.
+ ': '.
+ (' 'x2).
+ ''.$lt{'version'}.':'.
+ '1.1 '.
+ (' 'x2).
+ ''.$lt{'lifetime'}.': '.
+ ' '.
+ ''.$lt{'key'}.
+ ': '.
+ (' 'x2).
+ ''.$lt{'secret'}.':'.
+ ' '.
+ ' '.&mt('Visible input').' '.
+ ' '.
+ ' '.<i_options($i,$current,$itemcount,%lt).' ';
+ $itemcount ++;
+ }
+ }
+ $css_class = $itemcount%2?' class="LC_odd_row"':'';
+ my $chgstr = ' onchange="javascript:reorderLTI(this.form,'."'lti_pos_add'".');"';
+ $datatable .= ''."\n".
+ ' '."\n".
+ '';
+ for (my $k=0; $k<$maxnum+1; $k++) {
+ my $vpos = $k+1;
+ my $selstr;
+ if ($k == $maxnum) {
+ $selstr = ' selected="selected" ';
+ }
+ $datatable .= ''.$vpos.' ';
+ }
+ $datatable .= ' '."\n".
+ ' '.&mt('Add').' '."\n".
+ ''.
+ ''.&mt('Required settings').' '.
+ ''.$lt{'consumer'}.
+ ': '."\n".
+ (' 'x2).
+ ''.$lt{'version'}.':'.
+ '1.1 '."\n".
+ (' 'x2).
+ ''.$lt{'lifetime'}.': '."\n".
+ ' '.
+ ''.$lt{'key'}.': '."\n".
+ (' 'x2).
+ ''.$lt{'secret'}.': '.
+ ' '.&mt('Visible input').' '."\n".
+ ' '.<i_options('add',undef,$itemcount,%lt).
+ ' '."\n".
+ ' '."\n";
+ $$rowtotal ++;
+ return $datatable;;
+}
+
+sub lti_names {
+ my %lt = &Apache::lonlocal::texthash(
+ 'version' => 'LTI Version',
+ 'url' => 'URL',
+ 'key' => 'Key',
+ 'lifetime' => 'Nonce lifetime (s)',
+ 'consumer' => 'LTI Consumer',
+ 'secret' => 'Secret',
+ 'email' => 'Email address',
+ 'sourcedid' => 'User ID',
+ 'other' => 'Other',
+ 'passback' => 'Can return grades to Consumer:',
+ 'roster' => 'Can retrieve roster from Consumer:',
+ 'topmenu' => 'Display LON-CAPA page header',
+ 'inlinemenu'=> 'Display LON-CAPA inline menu',
+ );
return %lt;
}
+sub lti_options {
+ my ($num,$current,$itemcount,%lt) = @_;
+ my (%checked,%rolemaps,$crssecsrc,$userfield,$cidfield);
+ $checked{'mapuser'}{'sourcedid'} = ' checked="checked"';
+ $checked{'mapcrs'}{'course_offering_sourcedid'} = ' checked="checked"';
+ $checked{'makecrs'}{'N'} = ' checked="checked"';
+ $checked{'mapcrstype'} = {};
+ $checked{'makeuser'} = {};
+ $checked{'selfenroll'} = {};
+ $checked{'crssec'} = {};
+ $checked{'crssecsrc'} = {};
+ $checked{'lcauth'} = {};
+ $checked{'menuitem'} = {};
+ if ($num eq 'add') {
+ $checked{'lcauth'}{'lti'} = ' checked="checked"';
+ }
+ my $userfieldsty = 'none';
+ my $crsfieldsty = 'none';
+ my $crssecfieldsty = 'none';
+ my $secsrcfieldsty = 'none';
+ my $lcauthparm;
+ my $lcauthparmstyle = 'display:none';
+ my $lcauthparmtext;
+ my $menusty;
+ my $numinrow = 4;
+ my %menutitles = <imenu_titles();
+
+ if (ref($current) eq 'HASH') {
+ if (($current->{'mapuser'} ne '') && ($current->{'mapuser'} ne 'lis_person_sourcedid')) {
+ $checked{'mapuser'}{'sourcedid'} = '';
+ if ($current->{'mapuser'} eq 'lis_person_contact_email_primary') {
+ $checked{'mapuser'}{'email'} = ' checked="checked"';
+ } else {
+ $checked{'mapuser'}{'other'} = ' checked="checked"';
+ $userfield = $current->{'mapuser'};
+ $userfieldsty = 'inline-block';
+ }
+ }
+ if (($current->{'mapcrs'} ne '') && ($current->{'mapcrs'} ne 'course_offering_sourcedid')) {
+ $checked{'mapcrs'}{'course_offering_sourcedid'} = '';
+ if ($current->{'mapcrs'} eq 'context_id') {
+ $checked{'mapcrs'}{'context_id'} = ' checked="checked"';
+ } else {
+ $checked{'mapcrs'}{'other'} = ' checked="checked"';
+ $cidfield = $current->{'mapcrs'};
+ $crsfieldsty = 'inline-block';
+ }
+ }
+ if (ref($current->{'mapcrstype'}) eq 'ARRAY') {
+ foreach my $type (@{$current->{'mapcrstype'}}) {
+ $checked{'mapcrstype'}{$type} = ' checked="checked"';
+ }
+ }
+ if ($current->{'makecrs'}) {
+ $checked{'makecrs'}{'Y'} = ' checked="checked"';
+ }
+ if (ref($current->{'makeuser'}) eq 'ARRAY') {
+ foreach my $role (@{$current->{'makeuser'}}) {
+ $checked{'makeuser'}{$role} = ' checked="checked"';
+ }
+ }
+ if ($current->{'lcauth'} =~ /^(internal|localauth|krb4|krb5|lti)$/) {
+ $checked{'lcauth'}{$1} = ' checked="checked"';
+ unless (($current->{'lcauth'} eq 'lti') || ($current->{'lcauth'} eq 'internal')) {
+ $lcauthparm = $current->{'lcauthparm'};
+ $lcauthparmstyle = 'display:table-row';
+ if ($current->{'lcauth'} eq 'localauth') {
+ $lcauthparmtext = &mt('Local auth argument');
+ } else {
+ $lcauthparmtext = &mt('Kerberos domain');
+ }
+ }
+ }
+ if (ref($current->{'selfenroll'}) eq 'ARRAY') {
+ foreach my $role (@{$current->{'selfenroll'}}) {
+ $checked{'selfenroll'}{$role} = ' checked="checked"';
+ }
+ }
+ if (ref($current->{'maproles'}) eq 'HASH') {
+ %rolemaps = %{$current->{'maproles'}};
+ }
+ if ($current->{'section'} ne '') {
+ $checked{'crssec'}{'Y'} = ' checked="checked"';
+ $crssecfieldsty = 'inline-block';
+ if ($current->{'section'} eq 'course_section_sourcedid') {
+ $checked{'crssecsrc'}{'sourcedid'} = ' checked="checked"';
+ } else {
+ $checked{'crssecsrc'}{'other'} = ' checked="checked"';
+ $crssecsrc = $current->{'section'};
+ $secsrcfieldsty = 'inline-block';
+ }
+ } else {
+ $checked{'crssec'}{'N'} = ' checked="checked"';
+ }
+ if ($current->{'topmenu'}) {
+ $checked{'topmenu'}{'Y'} = ' checked="checked"';
+ } else {
+ $checked{'topmenu'}{'N'} = ' checked="checked"';
+ }
+ if ($current->{'inlinemenu'}) {
+ $checked{'inlinemenu'}{'Y'} = ' checked="checked"';
+ } else {
+ $checked{'inlinemenu'}{'N'} = ' checked="checked"';
+ }
+ if (($current->{'topmenu'}) || ($current->{'inlinemenu'})) {
+ $menusty = 'inline-block';
+ if (ref($current->{'lcmenu'}) eq 'ARRAY') {
+ foreach my $item (@{$current->{'lcmenu'}}) {
+ if (exists($menutitles{$item})) {
+ $checked{'menuitem'}{$item} = ' checked="checked"';
+ }
+ }
+ }
+ } else {
+ $menusty = 'none';
+ }
+ } else {
+ $checked{'makecrs'}{'N'} = ' checked="checked"';
+ $checked{'crssec'}{'N'} = ' checked="checked"';
+ $checked{'topmenu'}{'N'} = ' checked="checked"';
+ $checked{'inlinemenu'}{'Y'} = ' checked="checked"';
+ $checked{'menuitem'}{'grades'} = ' checked="checked"';
+ $menusty = 'inline-block';
+ }
+ my @coursetypes = ('official','unofficial','community','textbook','placement','lti');
+ my %coursetypetitles = &Apache::lonlocal::texthash (
+ official => 'Official',
+ unofficial => 'Unofficial',
+ community => 'Community',
+ textbook => 'Textbook',
+ placement => 'Placement Test',
+ lti => 'LTI Provider',
+ );
+ my @authtypes = ('internal','krb4','krb5','localauth');
+ my %shortauth = (
+ internal => 'int',
+ krb4 => 'krb4',
+ krb5 => 'krb5',
+ localauth => 'loc'
+ );
+ my %authnames = &authtype_names();
+ my @ltiroles = qw(Learner Instructor ContentDeveloper TeachingAssistant Mentor Member Manager Administrator);
+ my @lticourseroles = qw(Learner Instructor TeachingAssistant Mentor);
+ my @courseroles = ('cc','in','ta','ep','st');
+ my $onclickuser = ' onclick="toggleLTI(this.form,'."'user','$num'".');"';
+ my $onclickcrs = ' onclick="toggleLTI(this.form,'."'crs','$num'".');"';
+ my $onclicksec = ' onclick="toggleLTI(this.form,'."'sec','$num'".');"';
+ my $onclicksecsrc = ' onclick="toggleLTI(this.form,'."'secsrc','$num'".')"';
+ my $onclicklcauth = ' onclick="toggleLTI(this.form,'."'lcauth','$num'".')"';
+ my $onclickmenu = ' onclick="toggleLTI(this.form,'."'lcmenu','$num'".');"';
+ my $output = ''.&mt('Mapping users').' '.
+ ''.&mt('LON-CAPA username').': ';
+ foreach my $option ('sourcedid','email','other') {
+ $output .= ' '.$lt{$option}.' '.
+ ($option eq 'other' ? '' : (' 'x2) );
+ }
+ $output .= '
'.
+ ''.
+ '
'.
+ ''.&mt('Mapping course roles').' ';
+ foreach my $ltirole (@lticourseroles) {
+ my ($selected,$selectnone);
+ if ($rolemaps{$ltirole} eq '') {
+ $selectnone = ' selected="selected"';
+ }
+ $output .= ''.$ltirole.' '.
+ ''.
+ ''.&mt('Select').' ';
+ foreach my $role (@courseroles) {
+ unless ($selectnone) {
+ if ($rolemaps{$ltirole} eq $role) {
+ $selected = ' selected="selected"';
+ } else {
+ $selected = '';
+ }
+ }
+ $output .= ''.
+ &Apache::lonnet::plaintext($role,'Course').
+ ' ';
+ }
+ $output .= ' ';
+ }
+ $output .= '
'.
+ ''.&mt('Roles which may create user accounts').' ';
+ foreach my $ltirole (@ltiroles) {
+ $output .= ' '.$ltirole.' ';
+ }
+ $output .= ' '.
+ ''.&mt('New user accounts created for LTI users').' '.
+ ''.
+ &modifiable_userdata_row('lti','instdata_'.$num,$current,$numinrow,$itemcount).
+ '
'.
+ ' '.
+ ''.&mt('Mapping courses').' '.
+ ''.
+ &mt('Unique course identifier').': ';
+ foreach my $option ('course_offering_sourcedid','context_id','other') {
+ $output .= ' '.$option.' '.
+ ($option eq 'other' ? '' : (' 'x2) );
+ }
+ $output .= '
'.
+ ' '.
+ '
'.
+ ''.&mt('LON-CAPA course type(s)').': ';
+ foreach my $type (@coursetypes) {
+ $output .= ' '.$coursetypetitles{$type}.' '.
+ (' 'x2);
+ }
+ $output .= ' '.
+ ''.&mt('Creating courses').' '.
+ ''.&mt('Course created (if absent) on Instructor access').': '.
+ ' '.&mt('No').' '.(' 'x2).
+ ' '.&mt('Yes').' '.
+ ' '.
+ ''.&mt('Roles which may self-enroll').' ';
+ foreach my $lticrsrole (@lticourseroles) {
+ $output .= ' '.$lticrsrole.' ';
+ }
+ $output .= ' '.
+ ''.&mt('Course options').' '.
+ ''.&mt('Assign users to sections').': '.
+ ' '.&mt('No').' '.(' 'x2).
+ ' '.&mt('Yes').'
'.
+ ''.
+ ' '.
+ '
';
+ foreach my $extra ('passback','roster') {
+ my $checkedon = '';
+ my $checkedoff = ' checked="checked"';
+ if (ref($current) eq 'HASH') {
+ if (($current->{$extra})) {
+ $checkedon = $checkedoff;
+ $checkedoff = '';
+ }
+ }
+ $output .= $lt{$extra}.' '.
+ ' '.
+ &mt('No').' '.(' 'x2).
+ ' '.
+ &mt('Yes').' ';
+ }
+ $output .= ' '.
+ ''.&mt('Course defaults (Course Coordinator can override)').' '.
+ ''.$lt{'topmenu'}.': '.
+ ' '.&mt('No').' '.(' 'x2).
+ ' '.&mt('Yes').'
'.
+ '
'.
+ ''.$lt{'inlinemenu'}.': '.
+ ' '.&mt('No').' '.(' 'x2).
+ ' '.&mt('Yes').'
';
+ $output .='
'.
+ '