--- loncom/interface/domainprefs.pm 2021/12/16 19:46:34 1.160.6.114
+++ loncom/interface/domainprefs.pm 2023/11/03 01:12:15 1.430
@@ -1,7 +1,7 @@
# The LearningOnline Network with CAPA
# Handler to set domain-wide configuration settings
#
-# $Id: domainprefs.pm,v 1.160.6.114 2021/12/16 19:46:34 raeburn Exp $
+# $Id: domainprefs.pm,v 1.430 2023/11/03 01:12:15 raeburn Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -27,7 +27,7 @@
#
#
###############################################################
-##############################################################
+###############################################################
=pod
@@ -95,8 +95,7 @@ about default quota sizes for portfolio
institutional affiliation in the domain (e.g., Faculty, Staff, Student etc.),
but is now also used to manage availability of user tools:
i.e., blogs, aboutme page, and portfolios, and the course request tool,
-used by course owners to request creation of a course, and to display/store
-default quota sizes for Authoring Spaces.
+used by course owners to request creation of a course.
Outputs: 1
@@ -104,8 +103,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:
@@ -167,14 +166,18 @@ use Apache::lonmsg();
use Apache::lonconfigsettings;
use Apache::lonuserutils();
use Apache::loncoursequeueadmin();
+use Apache::courseprefs();
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 );
use Net::CIDR;
+use Crypt::CBC;
my $registered_cleanup;
my $modified_urls;
@@ -218,13 +221,92 @@ sub handler {
'serverstatuses','requestcourses','helpsettings',
'coursedefaults','usersessions','loadbalancing',
'requestauthor','selfenrollment','inststatus',
- 'passwords','wafproxy','ipaccess'],$dom);
+ 'ltitools','toolsec','ssl','trust','lti','ltisec',
+ 'privacy','passwords','proctoring','wafproxy',
+ 'ipaccess','authordefaults'],$dom);
+ my %encconfig =
+ &Apache::lonnet::get_dom('encconfig',['ltitools','lti','proctoring','linkprot'],$dom,undef,1);
+ my ($checked_is_home,$is_home);
+ if (ref($domconfig{'ltitools'}) eq 'HASH') {
+ if (ref($encconfig{'ltitools'}) eq 'HASH') {
+ my $home = &Apache::lonnet::domain($dom,'primary');
+ unless (($home eq 'no_host') || ($home eq '')) {
+ my @ids=&Apache::lonnet::current_machine_ids();
+ if (grep(/^\Q$home\E$/,@ids)) {
+ $is_home = 1;
+ }
+ }
+ $checked_is_home = 1;
+ foreach my $id (keys(%{$domconfig{'ltitools'}})) {
+ if ((ref($domconfig{'ltitools'}{$id}) eq 'HASH') &&
+ (ref($encconfig{'ltitools'}{$id}) eq 'HASH')) {
+ $domconfig{'ltitools'}{$id}{'key'} = $encconfig{'ltitools'}{$id}{'key'};
+ if (($is_home) && ($phase eq 'process')) {
+ $domconfig{'ltitools'}{$id}{'secret'} = $encconfig{'ltitools'}{$id}{'secret'};
+ }
+ }
+ }
+ }
+ }
+ if (ref($domconfig{'lti'}) eq 'HASH') {
+ if (ref($encconfig{'lti'}) eq 'HASH') {
+ unless ($checked_is_home) {
+ my $home = &Apache::lonnet::domain($dom,'primary');
+ unless (($home eq 'no_host') || ($home eq '')) {
+ my @ids=&Apache::lonnet::current_machine_ids();
+ if (grep(/^\Q$home\E$/,@ids)) {
+ $is_home = 1;
+ }
+ }
+ $checked_is_home = 1;
+ }
+ foreach my $id (keys(%{$domconfig{'lti'}})) {
+ if ((ref($domconfig{'lti'}{$id}) eq 'HASH') &&
+ (ref($encconfig{'lti'}{$id}) eq 'HASH')) {
+ $domconfig{'lti'}{$id}{'key'} = $encconfig{'lti'}{$id}{'key'};
+ if (($is_home) && ($phase eq 'process')) {
+ $domconfig{'lti'}{$id}{'secret'} = $encconfig{'lti'}{$id}{'secret'};
+ }
+ }
+ }
+ }
+ }
+ if (ref($domconfig{'ltisec'}) eq 'HASH') {
+ if (ref($domconfig{'ltisec'}{'linkprot'}) eq 'HASH') {
+ if (ref($encconfig{'linkprot'}) eq 'HASH') {
+ foreach my $id (keys(%{$domconfig{'ltisec'}{'linkprot'}})) {
+ unless ($id =~ /^\d+$/) {
+ delete($domconfig{'ltisec'}{'linkprot'}{$id});
+ }
+ if ((ref($domconfig{'ltisec'}{'linkprot'}{$id}) eq 'HASH') &&
+ (ref($encconfig{'linkprot'}{$id}) eq 'HASH')) {
+ foreach my $item ('key','secret') {
+ $domconfig{'ltisec'}{'linkprot'}{$id}{$item} = $encconfig{'linkprot'}{$id}{$item};
+ }
+ }
+ }
+ }
+ }
+ }
+ if (ref($domconfig{'proctoring'}) eq 'HASH') {
+ if (ref($encconfig{'proctoring'}) eq 'HASH') {
+ foreach my $provider (keys(%{$domconfig{'proctoring'}})) {
+ if ((ref($domconfig{'proctoring'}{$provider}) eq 'HASH') &&
+ (ref($encconfig{'proctoring'}{$provider}) eq 'HASH')) {
+ foreach my $item ('key','secret') {
+ $domconfig{'proctoring'}{$provider}{$item} = $encconfig{'proctoring'}{$provider}{$item};
+ }
+ }
+ }
+ }
+ }
my @prefs_order = ('rolecolors','login','ipaccess','defaults','wafproxy','passwords',
'quotas','autoenroll','autoupdate','autocreate','directorysrch',
- 'contacts','usercreation','selfcreation','usermodification',
- 'scantron','requestcourses','requestauthor','coursecategories',
- 'serverstatuses','helpsettings','coursedefaults',
- 'selfenrollment','usersessions');
+ 'contacts','privacy','usercreation','selfcreation',
+ 'usermodification','scantron','requestcourses','requestauthor',
+ 'coursecategories','serverstatuses','helpsettings','coursedefaults',
+ 'authordefaults','ltitools','proctoring','selfenrollment',
+ 'usersessions','ssl','trust','lti');
my %existing;
if (ref($domconfig{'loadbalancing'}) eq 'HASH') {
%existing = %{$domconfig{'loadbalancing'}};
@@ -268,7 +350,9 @@ sub handler {
header => [{col1 => 'Setting',
col2 => 'Value'},
{col1 => 'Institutional user types',
- col2 => 'Name displayed'}],
+ col2 => 'Name displayed'},
+ {col1 => 'Mapping for missing usernames via standard log-in',
+ col2 => 'Rules in use'}],
print => \&print_defaults,
modify => \&modify_defaults,
},
@@ -298,11 +382,11 @@ sub handler {
modify => \&modify_passwords,
},
'quotas' =>
- { text => 'Blogs, personal web pages, webDAV/quotas, portfolios',
+ { text => 'Blogs, personal pages/timezones, portfolio/quotas',
help => 'Domain_Configuration_Quotas',
header => [{col1 => 'User affiliation',
col2 => 'Available tools',
- col3 => 'Quotas, MB; (Authoring requires role)',}],
+ col3 => 'Portfilo quota (MB)',}],
print => \&print_quotas,
modify => \&modify_quotas,
},
@@ -483,6 +567,20 @@ sub handler {
print => \&print_selfenrollment,
modify => \&modify_selfenrollment,
},
+ 'privacy' =>
+ {text => 'Role assignments and user privacy',
+ help => 'Domain_Configuration_User_Privacy',
+ header => [{col1 => 'Role assigned in different domain',
+ col2 => 'Approval options'},
+ {col1 => 'Role assigned in different domain to user of type',
+ col2 => 'User information available in that domain'},
+ {col1 => "Role assigned in user's domain",
+ col2 => 'Information viewable by privileged user'},
+ {col1 => "Role assigned in user's domain",
+ col2 => 'Information viewable by unprivileged user'}],
+ print => \&print_privacy,
+ modify => \&modify_privacy,
+ },
'usersessions' =>
{text => 'User session hosting/offloading',
help => 'Domain_Configuration_User_Sessions',
@@ -506,7 +604,79 @@ sub handler {
print => \&print_loadbalancing,
modify => \&modify_loadbalancing,
},
- 'ipaccess' =>
+ 'ltitools' =>
+ {text => 'External Tools (LTI)',
+ help => 'Domain_Configuration_LTI_Tools',
+ header => [{col1 => 'Encryption of shared secrets',
+ col2 => 'Settings'},
+ {col1 => 'Rules for shared secrets',
+ col2 => 'Settings'},
+ {col1 => 'Providers',
+ col2 => 'Settings',}],
+ print => \&print_ltitools,
+ modify => \&modify_ltitools,
+ },
+ 'proctoring' =>
+ {text => 'Remote Proctoring Integration',
+ help => 'Domain_Configuration_Proctoring',
+ header => [{col1 => 'Name',
+ col2 => 'Configuration'}],
+ print => \&print_proctoring,
+ modify => \&modify_proctoring,
+ },
+ '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 Link Protection and LTI Consumers',
+ help => 'Domain_Configuration_LTI_Provider',
+ header => [{col1 => 'Encryption of shared secrets',
+ col2 => 'Settings'},
+ {col1 => 'Rules for shared secrets',
+ col2 => 'Settings'},
+ {col1 => 'Link Protectors',
+ col2 => 'Settings'},
+ {col1 => 'Consumers',
+ col2 => 'Settings'},],
+ print => \&print_lti,
+ modify => \&modify_lti,
+ },
+ 'ipaccess' =>
{text => 'IP-based access control',
help => 'Domain_Configuration_IP_Access',
header => [{col1 => 'Setting',
@@ -514,6 +684,16 @@ sub handler {
print => \&print_ipaccess,
modify => \&modify_ipaccess,
},
+ 'authordefaults' =>
+ {text => 'Authoring Space defaults',
+ help => 'Domain_Configuration_Author_Defaults',
+ header => [{col1 => 'Defaults which can be overridden by Author',
+ col2 => 'Settings',},
+ {col1 => 'Defaults which can be overridden by a Dom. Coord.',
+ col2 => 'Settings',},],
+ print => \&print_authordefaults,
+ modify => \&modify_authordefaults,
+ },
);
if (keys(%servers) > 1) {
$prefs{'login'} = { text => 'Log-in page options',
@@ -521,7 +701,7 @@ sub handler {
header => [{col1 => 'Log-in Service',
col2 => 'Server Setting',},
{col1 => 'Log-in Page Items',
- col2 => ''},
+ col2 => 'Settings'},
{col1 => 'Log-in Help',
col2 => 'Value'},
{col1 => 'Custom HTML in document head',
@@ -701,12 +881,26 @@ sub process_changes {
$output = &modify_usersessions($dom,$lastactref,%domconfig);
} elsif ($action eq 'loadbalancing') {
$output = &modify_loadbalancing($dom,%domconfig);
+ } elsif ($action eq 'ltitools') {
+ $output = &modify_ltitools($r,$dom,$action,$lastactref,%domconfig);
+ } elsif ($action eq 'proctoring') {
+ $output = &modify_proctoring($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);
+ } elsif ($action eq 'privacy') {
+ $output = &modify_privacy($dom,$lastactref,%domconfig);
} elsif ($action eq 'passwords') {
$output = &modify_passwords($r,$dom,$confname,$lastactref,%domconfig);
} elsif ($action eq 'wafproxy') {
$output = &modify_wafproxy($dom,$action,$lastactref,%domconfig);
} elsif ($action eq 'ipaccess') {
$output = &modify_ipaccess($dom,$lastactref,%domconfig);
+ } elsif ($action eq 'authordefaults') {
+ $output = &modify_authordefaults($dom,$lastactref,%domconfig);
}
return $output;
}
@@ -720,7 +914,7 @@ sub print_config_box {
} elsif ($action eq 'defaults') {
$output = &defaults_javascript($settings);
} elsif ($action eq 'passwords') {
- $output = &passwords_javascript();
+ $output = &passwords_javascript($action);
} elsif ($action eq 'helpsettings') {
my (%privs,%levelscurrent);
my %full=();
@@ -737,14 +931,25 @@ sub print_config_box {
$output =
&Apache::lonuserutils::custom_roledefs_js($context,$crstype,$formname,\%full,
\@templateroles);
+ } elsif ($action eq 'ltitools') {
+ $output .= &Apache::lonconfigsettings::ltitools_javascript($settings);
+ } elsif ($action eq 'lti') {
+ $output .= &passwords_javascript('ltisecrets')."\n".
+ <i_javascript($dom,$settings);
+ } elsif ($action eq 'proctoring') {
+ $output .= &proctoring_javascript($settings);
} elsif ($action eq 'wafproxy') {
$output .= &wafproxy_javascript($dom);
} elsif ($action eq 'autoupdate') {
$output .= &autoupdate_javascript();
+ } elsif ($action eq 'autoenroll') {
+ $output .= &autoenroll_javascript();
} elsif ($action eq 'login') {
$output .= &saml_javascript();
} elsif ($action eq 'ipaccess') {
$output .= &ipaccess_javascript($settings);
+ } elsif ($action eq 'authordefaults') {
+ $output .= &authordefaults_javascript();
}
$output .=
'
+
+
+
+ '.&mt($item->{'header'}->[3]->{'col1'}).'
+ '.&mt($item->{'header'}->[3]->{'col2'}).' '.
+ $item->{'print'}->('bottom',$dom,$settings,\$rowtotal);
} elsif ($action eq 'login') {
if ($numheaders == 5) {
$output .= &print_login('page',$dom,$confname,$phase,$settings,\$rowtotal).'
@@ -969,8 +1233,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') {
@@ -985,9 +1249,9 @@ sub print_config_box {
- '.
+ '.
&mt($item->{'header'}->[2]->{'col1'}).'
- '.
+ '.
&mt($item->{'header'}->[2]->{'col2'}).'
'.
&print_rolecolors($phase,'author',$dom,$confname,$settings,\$rowtotal).'
@@ -1015,30 +1279,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') {
@@ -1047,7 +1311,7 @@ sub print_config_box {
$output .= ' ';
}
if ($item->{'header'}->[0]->{'col4'}) {
- $output .= ''.
+ $output .= ' '.
&mt($item->{'header'}->[0]->{'col4'});
}
$output .= '';
@@ -1055,8 +1319,8 @@ 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 'ipaccess')) {
+ ($action eq 'serverstatuses') || ($action eq 'loadbalancing') ||
+ ($action eq 'proctoring') || ($action eq 'ipaccess')) {
$output .= $item->{'print'}->($dom,$settings,\$rowtotal);
}
}
@@ -1076,13 +1340,12 @@ sub print_login {
%lt = &login_file_options();
$switchserver = &check_switchserver($dom,$confname);
}
-
if ($caller eq 'service') {
my %servers = &Apache::lonnet::internet_dom_servers($dom);
my $choice = $choices{'disallowlogin'};
$css_class = ' class="LC_odd_row"';
$datatable .= ' '.$choice.' '.
- ''.$choices{'hostid'}.' '.
+ ''.$choices{'hostid'}.' '.
''.$choices{'server'}.' '.
''.$choices{'serverpath'}.' '.
''.$choices{'custompath'}.' '.
@@ -1163,6 +1426,7 @@ sub print_login {
}
}
my @images = ('img','logo','domlogo','login');
+ my @alttext = ('img','logo','domlogo');
my @logintext = ('textcol','bgcol');
my @bgs = ('pgbg','mainbg','sidebg');
my @links = ('link','alink','vlink');
@@ -1204,6 +1468,13 @@ sub print_login {
$designs{'showlogo'}{$item} = $settings->{'showlogo'}{$item};
}
}
+ foreach my $item (@alttext) {
+ if (ref($settings->{'alttext'}) eq 'HASH') {
+ if ($settings->{'alttext'}->{$item} ne '') {
+ $designs{'alttext'}{$item} = $settings->{'alttext'}{$item};
+ }
+ }
+ }
foreach my $item (@logintext) {
if ($settings->{$item} ne '') {
$designs{'logintext'}{$item} = $settings->{$item};
@@ -1355,7 +1626,7 @@ sub print_login {
my $choice = $choices{'headtag'};
$css_class = ' class="LC_odd_row"';
$datatable .= ''.$choice.' '.
- ''.$choices{'hostid'}.' '.
+ ''.$choices{'hostid'}.' '.
''.$choices{'current'}.' '.
''.$choices{'action'}.' '.
''.$choices{'exempt'}.' '."\n";
@@ -1399,13 +1670,13 @@ sub print_login {
''.$choices{'hostid'}.' '.
''.$choices{'samllanding'}.' '.
''.$choices{'samloptions'}.' '."\n";
- my (%saml,%samltext,%samlimg,%samlalt,%samlurl,%samltitle,%samlnotsso,%styleon,%styleoff);
+ my (%saml,%samltext,%samlimg,%samlalt,%samlurl,%samltitle,%samlwindow,%samlnotsso,%styleon,%styleoff);
foreach my $lonhost (keys(%domservers)) {
$samlurl{$lonhost} = '/adm/sso';
$styleon{$lonhost} = 'display:none';
$styleoff{$lonhost} = '';
}
- if (ref($settings->{'saml'}) eq 'HASH') {
+ if ((ref($settings) eq 'HASH') && (ref($settings->{'saml'}) eq 'HASH')) {
foreach my $lonhost (keys(%{$settings->{'saml'}})) {
if (ref($settings->{'saml'}{$lonhost}) eq 'HASH') {
$saml{$lonhost} = 1;
@@ -1414,6 +1685,7 @@ sub print_login {
$samlalt{$lonhost} = $settings->{'saml'}{$lonhost}{'alt'};
$samlurl{$lonhost} = $settings->{'saml'}{$lonhost}{'url'};
$samltitle{$lonhost} = $settings->{'saml'}{$lonhost}{'title'};
+ $samlwindow{$lonhost} = $settings->{'saml'}{$lonhost}{'window'};
$samlnotsso{$lonhost} = $settings->{'saml'}{$lonhost}{'notsso'};
$styleon{$lonhost} = '';
$styleoff{$lonhost} = 'display:none';
@@ -1431,6 +1703,12 @@ sub print_login {
$samlon = $samloff;
$samloff = ' ';
}
+ my $samlwinon = '';
+ my $samlwinoff = ' checked="checked"';
+ if ($samlwindow{$lonhost}) {
+ $samlwinon = $samlwinoff;
+ $samlwinoff = '';
+ }
my $css_class = $itemcount%2?' class="LC_odd_row"':'';
$datatable .= ''.$domservers{$lonhost}.' '.
' '.
&mt('Yes').' '.
''.
- ''.&mt('SSO').' '.
- ''.&mt('Non-SSO').' '.
+ ' '.
+ ''.
' ';
@@ -1513,6 +1797,7 @@ sub login_choices {
current => "Current",
samllanding => "Dual login?",
samloptions => "Options",
+ alttext => "Alt text",
);
return %choices;
}
@@ -1701,8 +1986,11 @@ sub commblocktype_text {
'printout' => 'Printouts',
'passwd' => 'Change Password',
'grades' => 'Gradebook',
+ 'search' => 'Course search',
+ 'wishlist' => 'Stored links',
+ 'annotate' => 'Annotations',
);
- my $typeorder = ['com','chat','boards','port','groups','blogs','about','printout','grades','passwd'];
+ my $typeorder = ['com','chat','boards','port','groups','blogs','about','wishlist','printout','grades','search','annotate','passwd'];
return ($typeorder,\%types);
}
@@ -1855,7 +2143,7 @@ sub display_color_options {
$css_class = $itemcount%2?' class="LC_odd_row"':'';
$datatable .= ''.
''.$choices->{$img};
- my ($imgfile,$img_import,$login_hdr_pick,$logincolors);
+ my ($imgfile,$img_import,$login_hdr_pick,$logincolors,$alttext);
if ($role eq 'login') {
if ($img eq 'login') {
$login_hdr_pick =
@@ -1863,8 +2151,13 @@ sub display_color_options {
$logincolors =
&login_text_colors($img,$role,$logintext,$phase,$choices,
$designs,$defaults);
- } elsif ($img ne 'domlogo') {
- $datatable.= &logo_display_options($img,$defaults,$designs);
+ } else {
+ if ($img ne 'domlogo') {
+ $datatable.= &logo_display_options($img,$defaults,$designs);
+ }
+ if (ref($designs->{'alttext'}) eq 'HASH') {
+ $alttext = $designs->{'alttext'}{$img};
+ }
}
}
$datatable .= ' ';
@@ -1956,6 +2249,11 @@ sub display_color_options {
$datatable .=' ';
}
}
+ if (($role eq 'login') && ($img ne 'login')) {
+ $datatable .= (' ' x2).' '.$choices->{'alttext'}.':'.
+ ' '.
+ ' ';
+ }
$datatable .= ' ';
}
$itemcount ++;
@@ -1977,7 +2275,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 .= ' ';
@@ -2005,7 +2303,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.=' ';
}
@@ -2066,7 +2364,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 .= ' ';
@@ -2099,7 +2397,7 @@ sub image_changes {
$role.'_del_'.$img.'" value="1" />'.&mt('Delete?').
' '.&mt('Replace:').' ';
} else {
- $output .= ''.$logincolors.&mt('Upload:').' ';
+ $output .= ' '.$logincolors.&mt('Upload:').' ';
}
}
return $output;
@@ -2113,12 +2411,12 @@ sub print_quotas {
} else {
$context = $action;
}
- my ($datatable,$defaultquota,$authorquota,@usertools,@options,%validations);
+ my ($datatable,$defaultquota,@usertools,@options,%validations);
my ($othertitle,$usertypes,$types) = &Apache::loncommon::sorted_inst_types($dom);
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();
@@ -2127,12 +2425,12 @@ sub print_quotas {
@options = ('norequest','approval','automatic');
%titles = &authorrequest_titles();
} else {
- @usertools = ('aboutme','blog','webdav','portfolio');
+ @usertools = ('aboutme','blog','portfolio','portaccess','timezone');
%titles = &tool_titles();
}
if (ref($types) eq 'ARRAY') {
foreach my $type (@{$types}) {
- my ($currdefquota,$currauthorquota);
+ my $currdefquota;
unless (($context eq 'requestcourses') ||
($context eq 'requestauthor')) {
if (ref($settings) eq 'HASH') {
@@ -2141,9 +2439,6 @@ sub print_quotas {
} else {
$currdefquota = $settings->{$type};
}
- if (ref($settings->{authorquota}) eq 'HASH') {
- $currauthorquota = $settings->{authorquota}->{$type};
- }
}
}
if (defined($usertypes->{$type})) {
@@ -2231,9 +2526,12 @@ sub print_quotas {
}
} else {
my $checked = 'checked="checked" ';
+ if ($item eq 'timezone') {
+ $checked = '';
+ }
if (ref($settings) eq 'HASH') {
if (ref($settings->{$item}) eq 'HASH') {
- if ($settings->{$item}->{$type} == 0) {
+ if (!$settings->{$item}->{$type}) {
$checked = '';
} elsif ($settings->{$item}->{$type} == 1) {
$checked = 'checked="checked" ';
@@ -2258,13 +2556,9 @@ sub print_quotas {
($context eq 'requestauthor')) {
$datatable .=
' '.
- ''.&mt('Portfolio').': '.
+ ''.
' '.(' ' x 2).
- ''.&mt('Authoring').': '.
- ' ';
}
$datatable .= ' ';
@@ -2273,16 +2567,12 @@ sub print_quotas {
}
unless (($context eq 'requestcourses') || ($context eq 'requestauthor')) {
$defaultquota = '20';
- $authorquota = '500';
if (ref($settings) eq 'HASH') {
if (ref($settings->{'defaultquota'}) eq 'HASH') {
$defaultquota = $settings->{'defaultquota'}->{'default'};
} elsif (defined($settings->{'default'})) {
$defaultquota = $settings->{'default'};
}
- if (ref($settings->{'authorquota'}) eq 'HASH') {
- $authorquota = $settings->{'authorquota'}->{'default'};
- }
}
}
$typecount ++;
@@ -2394,12 +2684,9 @@ sub print_quotas {
$datatable .= '';
unless (($context eq 'requestcourses') || ($context eq 'requestauthor')) {
$datatable .= ''.
- ''.&mt('Portfolio').': '.
+ ''.
' '.(' ' x2).
- ''.&mt('Authoring').': '.
- ' ';
+ $defaultquota.'" size="5" />';
}
$datatable .= '';
$typecount ++;
@@ -2582,7 +2869,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) {
@@ -2832,6 +3119,132 @@ $jstext{'templates'};
ENDSCRIPT
}
+sub ltitools_javascript {
+ my ($settings) = @_;
+ my $togglejs = <itools_toggle_js();
+ unless (ref($settings) eq 'HASH') {
+ return $togglejs;
+ }
+ my (%ordered,$total,%jstext);
+ $total = 0;
+ foreach my $item (keys(%{$settings})) {
+ if (ref($settings->{$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 ltitools = Array('."'".join("','",@jsarray)."'".');'."\n";
+ return <<"ENDSCRIPT";
+
+
+$togglejs
+
+ENDSCRIPT
+}
+
+sub ltitools_toggle_js {
+ return <<"ENDSCRIPT";
+
+
+ENDSCRIPT
+}
+
sub wafproxy_javascript {
my ($dom) = @_;
return <<"ENDSCRIPT";
@@ -2947,6 +3360,408 @@ function toggleWAF() {
ENDSCRIPT
}
+sub proctoring_javascript {
+ my ($settings) = @_;
+ my (%ordered,$total,%jstext);
+ $total = 0;
+ if (ref($settings) eq 'HASH') {
+ foreach my $item (keys(%{$settings})) {
+ if (ref($settings->{$item}) eq 'HASH') {
+ my $num = $settings->{$item}{'order'};
+ $ordered{$num} = $item;
+ }
+ }
+ $total = scalar(keys(%{$settings}));
+ } else {
+ %ordered = (
+ 0 => 'proctorio',
+ 1 => 'examity',
+ );
+ $total = 2;
+ }
+ my @jsarray = ();
+ foreach my $item (sort {$a <=> $b } (keys(%ordered))) {
+ push(@jsarray,$ordered{$item});
+ }
+ my $jstext = ' var proctors = Array('."'".join("','",@jsarray)."'".');'."\n";
+ return <<"ENDSCRIPT";
+
+
+ENDSCRIPT
+}
+
+
+sub lti_javascript {
+ my ($dom,$settings) = @_;
+ my $togglejs = <i_toggle_js($dom);
+ my $linkprot_js = &Apache::courseprefs::linkprot_javascript();
+ unless (ref($settings) eq 'HASH') {
+ return $togglejs.'
+
+';
+ }
+ my (%ordered,$total,%jstext);
+ $total = scalar(keys(%{$settings}));
+ foreach my $item (keys(%{$settings})) {
+ if (ref($settings->{$item}) eq 'HASH') {
+ my $num = $settings->{$item}{'order'};
+ if ($num eq '') {
+ $num = $total - 1;
+ }
+ $ordered{$num} = $item;
+ }
+ }
+ 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 ($dom) = @_;
+ my %lcauthparmtext = &Apache::lonlocal::texthash (
+ localauth => 'Local auth argument',
+ krb => 'Kerberos domain',
+ );
+ my $crsincalert = &mt('"User\'s identity sent" needs to be set to "Yes" first,[_1] before setting "Course\'s identity sent" to "Yes"',"\n");
+ &js_escape(\$crsincalert);
+ my %servers = &Apache::lonnet::get_servers($dom,'library');
+ my $primary = &Apache::lonnet::domain($dom,'primary');
+ my $course_servers = "'".join("','",keys(%servers))."'";
+ return <<"ENDSCRIPT";
+
+
+ENDSCRIPT
+}
+
sub autoupdate_javascript {
return <<"ENDSCRIPT";
+
+ENDSCRIPT
+}
+
sub saml_javascript {
return <<"ENDSCRIPT";
+
+ENDSCRIPT
+}
+
sub print_autoenroll {
my ($dom,$settings,$rowtotal) = @_;
my $autorun = &Apache::lonnet::auto_run(undef,$dom),
- my ($defdom,$runon,$runoff,$coownerson,$coownersoff,$failsafe);
+ my ($defdom,$runon,$runoff,$coownerson,$coownersoff,
+ $failsafe,$autofailsafe,$failsafesty,%failsafechecked);
+ $failsafesty = 'none';
+ %failsafechecked = (
+ off => ' checked="checked"',
+ );
if (ref($settings) eq 'HASH') {
if (exists($settings->{'run'})) {
if ($settings->{'run'} eq '0') {
@@ -3129,8 +4017,24 @@ sub print_autoenroll {
if (exists($settings->{'sender_domain'})) {
$defdom = $settings->{'sender_domain'};
}
- if (exists($settings->{'autofailsafe'})) {
- $failsafe = $settings->{'autofailsafe'};
+ if (exists($settings->{'failsafe'})) {
+ $failsafe = $settings->{'failsafe'};
+ if ($failsafe eq 'zero') {
+ $failsafechecked{'zero'} = ' checked="checked"';
+ $failsafechecked{'off'} = '';
+ $failsafesty = 'inline-block';
+ } elsif ($failsafe eq 'any') {
+ $failsafechecked{'any'} = ' checked="checked"';
+ $failsafechecked{'off'} = '';
+ }
+ $autofailsafe = $settings->{'autofailsafe'};
+ } elsif (exists($settings->{'autofailsafe'})) {
+ $autofailsafe = $settings->{'autofailsafe'};
+ if ($autofailsafe ne '') {
+ $failsafechecked{'zero'} = ' checked="checked"';
+ $failsafe = 'zero';
+ $failsafechecked{'off'} = '';
+ }
}
} else {
if ($autorun) {
@@ -3169,9 +4073,15 @@ sub print_autoenroll {
$coownersoff.' value="0" />'.&mt('No').''.
''.
''.&mt('Failsafe for no drops when institutional data missing').' '.
- ''.
- ' ';
+ ''.
+ ' '.&mt('Not in use').' '.
+ ' '.&mt('Retrieved section enrollment is zero').' '.
+ ' '.&mt('Retrieved section enrollment is zero or greater').' '.
+ ''.
+ ''.
+ &mt('Threshold for number of students in section to drop: [_1]',
+ ' ').
+ '
';
$$rowtotal += 4;
return $datatable;
}
@@ -3195,8 +4105,8 @@ sub print_autoupdate {
$updateoff = ' ';
}
}
- $enable = ''.
- ''.&mt($choices{'run'}).' '.
+ $enable = ' '.
+ ''.$choices{'run'}.' '.
''.
' '.&mt('No').' '.
@@ -3830,7 +4740,6 @@ 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);
@@ -4047,7 +4956,6 @@ sub print_helpsettings {
push(@jsarray,('notinc','notexc'));
}
my $hiddenstr = join("','",@jsarray);
- $datatable .= &helpsettings_javascript(\@roles_by_num,$maxnum,$hiddenstr,$formname);
my $context = 'domprefs';
my $crstype = 'Course';
my $prefix = 'helproles_';
@@ -4081,7 +4989,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;
@@ -4120,7 +5028,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++) {
@@ -4401,7 +5309,7 @@ sub radiobutton_prefs {
foreach my $item (@{$toggles}) {
$css_class = $itemcount%2?' class="LC_odd_row"':'';
$datatable .=
- ''.
+ ' '.
''.$choices->{$item}.
' ';
if ($align eq 'left') {
@@ -4418,10 +5326,10 @@ sub radiobutton_prefs {
$checkedon{$item}.' value="1"'.$onclick.' />'.&mt('Yes').'';
} else {
$datatable .=
- ' '.&mt('Yes').
- ' '.&mt('No').' ';
+ ' '.&mt('Yes').
+ ' '.&mt('No').' ';
}
$datatable .= ''.$additional.' ';
$itemcount ++;
@@ -4429,34 +5337,1523 @@ sub radiobutton_prefs {
return ($datatable,$itemcount);
}
+sub print_ltitools {
+ my ($position,$dom,$settings,$rowtotal) = @_;
+ my (%rules,%encrypt,%privkeys,%linkprot);
+ if (ref($settings) eq 'HASH') {
+ if ($position eq 'top') {
+ if (exists($settings->{'encrypt'})) {
+ if (ref($settings->{'encrypt'}) eq 'HASH') {
+ foreach my $key (keys(%{$settings->{'encrypt'}})) {
+ $encrypt{'toolsec_'.$key} = $settings->{'encrypt'}{$key};
+ }
+ }
+ }
+ if (exists($settings->{'private'})) {
+ if (ref($settings->{'private'}) eq 'HASH') {
+ if (ref($settings->{'private'}) eq 'HASH') {
+ if (ref($settings->{'private'}{'keys'}) eq 'ARRAY') {
+ map { $privkeys{$_} = 1; } (@{$settings->{'private'}{'keys'}});
+ }
+ }
+ }
+ }
+ } elsif ($position eq 'middle') {
+ if (exists($settings->{'rules'})) {
+ if (ref($settings->{'rules'}) eq 'HASH') {
+ %rules = %{$settings->{'rules'}};
+ }
+ }
+ } else {
+ foreach my $key ('encrypt','private','rules') {
+ if (exists($settings->{$key})) {
+ delete($settings->{$key});
+ }
+ }
+ }
+ }
+ my $datatable;
+ my $itemcount = 1;
+ if ($position eq 'top') {
+ $datatable = &secrets_form($dom,'toolsec',\%encrypt,\%privkeys,$rowtotal);
+ } elsif ($position eq 'middle') {
+ $datatable = &password_rules('toolsecrets',\$itemcount,\%rules);
+ $$rowtotal += $itemcount;
+ } else {
+ $datatable = &Apache::courseprefs::print_ltitools($dom,'',$settings,\$rowtotal,'','','domain');
+ }
+ return $datatable;
+}
+
+sub ltitools_names {
+ my %lt = &Apache::lonlocal::texthash(
+ 'title' => 'Title',
+ 'version' => 'Version',
+ 'msgtype' => 'Message Type',
+ 'sigmethod' => 'Signature Method',
+ 'url' => 'URL',
+ 'key' => 'Key',
+ 'lifetime' => 'Nonce lifetime (s)',
+ 'secret' => 'Secret',
+ 'icon' => 'Icon',
+ 'user' => 'User',
+ 'fullname' => 'Full Name',
+ 'firstname' => 'First Name',
+ 'lastname' => 'Last Name',
+ 'email' => 'E-mail',
+ 'roles' => 'Role',
+ 'window' => 'Window',
+ 'tab' => 'Tab',
+ 'iframe' => 'iFrame',
+ 'height' => 'Height',
+ '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',
+ 'crslinktext' => 'Link Text',
+ 'crsexplanation' => 'Explanation',
+ 'crsappend' => 'Provider URL',
+ );
+ return %lt;
+}
+
+sub secrets_form {
+ my ($dom,$context,$encrypt,$privkeys,$rowtotal) = @_;
+ my @ids=&Apache::lonnet::current_machine_ids();
+ my %servers = &Apache::lonnet::get_servers($dom,'library');
+ my $primary = &Apache::lonnet::domain($dom,'primary');
+ my ($css_class,$extra,$numshown,$itemcount,$output);
+ $itemcount = 0;
+ foreach my $hostid (sort(keys(%servers))) {
+ my ($showextra,$divsty,$switch);
+ if ($hostid eq $primary) {
+ if ($context eq 'ltisec') {
+ if (($encrypt->{'ltisec_consumers'}) || ($encrypt->{'ltisec_domlinkprot'})) {
+ $showextra = 1;
+ }
+ if ($encrypt->{'ltisec_crslinkprot'}) {
+ $showextra = 1;
+ }
+ } else {
+ if (($encrypt->{'toolsec_crs'}) || ($encrypt->{'toolsec_dom'})) {
+ $showextra = 1;
+ }
+ }
+ unless (grep(/^\Q$hostid\E$/,@ids)) {
+ $switch = 1;
+ }
+ if ($showextra) {
+ $numshown ++;
+ $divsty = 'display:inline-block';
+ } else {
+ $divsty = 'display:none';
+ }
+ $extra .= ''.
+ ''.$hostid.' ';
+ if ($switch) {
+ my $switchserver = ''.&mt('Switch Server').' ';
+ if (exists($privkeys->{$hostid})) {
+ $extra .= '
'.
+ ''.
+ &mt('Encryption Key').': ['.&mt('not shown').'] '.(' 'x2).' '.
+ ''.&mt('Change?').
+ ' '.&mt('No').' '.
+ (' 'x2).
+ ' '.&mt('Yes').
+ '
'.
+ ' - '.&mt('submit from server ([_1]): [_2].',$hostid,$switchserver).
+ ' ';
+ } else {
+ $extra .= ''.
+ &mt('Key required').' - '.&mt('submit from server ([_1]): [_2].',$hostid,$switchserver).
+ ' '."\n";
+ }
+ } elsif (exists($privkeys->{$hostid})) {
+ $extra .= '
'.
+ &mt('Encryption Key').': ['.&mt('not shown').'] '.(' 'x2).' '.
+ ''.&mt('Change?').
+ ' '.&mt('No').' '.
+ (' 'x2).
+ ' '.&mt('Yes').
+ '
'.
+ ''.&mt('New Key').':'.
+ ' '.
+ ' '.&mt('Visible input').' '.
+ ' ';
+ } else {
+ $extra .= ''.&mt('Encryption Key').':'.
+ ' '.
+ ' '.&mt('Visible input').' ';
+ }
+ $extra .= ' ';
+ }
+ }
+ my (%choices,@toggles,%defaultchecked);
+ if ($context eq 'ltisec') {
+ %choices = &Apache::lonlocal::texthash (
+ ltisec_crslinkprot => 'Encrypt stored link protection secrets defined in courses',
+ ltisec_domlinkprot => 'Encrypt stored link protection secrets defined in domain',
+ ltisec_consumers => 'Encrypt stored consumer secrets defined in domain',
+ );
+ @toggles = qw(ltisec_crslinkprot ltisec_domlinkprot ltisec_consumers);
+ %defaultchecked = (
+ 'ltisec_crslinkprot' => 'off',
+ 'ltisec_domlinkprot' => 'off',
+ 'ltisec_consumers' => 'off',
+ );
+ } else {
+ %choices = &Apache::lonlocal::texthash (
+ toolsec_crs => 'Encrypt stored external tool secrets defined in courses',
+ toolsec_dom => 'Encrypt stored external tool secrets defined in domain',
+ );
+ @toggles = qw(toolsec_crs toolsec_dom);
+ %defaultchecked = (
+ 'toolsec_crs' => 'off',
+ 'toolsec_dom' => 'off',
+ );
+ }
+ my ($onclick,$itemcount);
+ $onclick = 'javascript:toggleLTIEncKey(this.form,'."'$context'".');';
+ ($output,$itemcount) = &radiobutton_prefs($encrypt,\@toggles,\%defaultchecked,
+ \%choices,$itemcount,$onclick,'','left','no');
+
+ $css_class = $itemcount%2?' class="LC_odd_row"':'';
+ my $noprivkeysty = 'display:inline-block';
+ if ($numshown) {
+ $noprivkeysty = 'display:none';
+ }
+ $output .= ''.&mt('Encryption Key(s)').' '.
+ ''.
+ ''.&mt('Not in use').'
'.
+ $extra.
+ ' ';
+ $itemcount ++;
+ $$rowtotal += $itemcount;
+ return $output;
+}
+
+sub print_proctoring {
+ my ($dom,$settings,$rowtotal) = @_;
+ my $itemcount = 1;
+ my (%ordered,%providernames,%current,%currentdef);
+ my $confname = $dom.'-domainconfig';
+ my $switchserver = &check_switchserver($dom,$confname);
+ if (ref($settings) eq 'HASH') {
+ foreach my $item (keys(%{$settings})) {
+ if (ref($settings->{$item}) eq 'HASH') {
+ my $num = $settings->{$item}{'order'};
+ $ordered{$num} = $item;
+ }
+ }
+ } else {
+ %ordered = (
+ 1 => 'proctorio',
+ 2 => 'examity',
+ );
+ }
+ %providernames = &proctoring_providernames();
+ my $maxnum = scalar(keys(%ordered));
+ my (%requserfields,%optuserfields,%defaults,%extended,%crsconf,@courseroles,@ltiroles);
+ my ($requref,$opturef,$defref,$extref,$crsref,$rolesref,$ltiref) = &proctoring_data();
+ if (ref($requref) eq 'HASH') {
+ %requserfields = %{$requref};
+ }
+ if (ref($opturef) eq 'HASH') {
+ %optuserfields = %{$opturef};
+ }
+ if (ref($defref) eq 'HASH') {
+ %defaults = %{$defref};
+ }
+ if (ref($extref) eq 'HASH') {
+ %extended = %{$extref};
+ }
+ if (ref($crsref) eq 'HASH') {
+ %crsconf = %{$crsref};
+ }
+ if (ref($rolesref) eq 'ARRAY') {
+ @courseroles = @{$rolesref};
+ }
+ if (ref($ltiref) eq 'ARRAY') {
+ @ltiroles = @{$ltiref};
+ }
+ my $datatable;
+ my $css_class;
+ 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 $provider = $ordered{$items[$i]};
+ my $optionsty = 'none';
+ my ($available,$version,$lifetime,$imgsrc,$userincdom,$showroles,
+ %checkedfields,%rolemaps,%inuse,%crsconfig,%current);
+ if (ref($settings) eq 'HASH') {
+ if (ref($settings->{$provider}) eq 'HASH') {
+ %current = %{$settings->{$provider}};
+ if ($current{'available'}) {
+ $optionsty = 'block';
+ $available = 1;
+ }
+ if ($current{'lifetime'} =~ /^\d+$/) {
+ $lifetime = $current{'lifetime'};
+ }
+ if ($current{'version'} =~ /^\d+\.\d+$/) {
+ $version = $current{'version'};
+ }
+ if ($current{'image'} ne '') {
+ $imgsrc = ' ';
+ }
+ if (ref($current{'fields'}) eq 'ARRAY') {
+ map { $checkedfields{$_} = 1; } @{$current{'fields'}};
+ }
+ $userincdom = $current{'incdom'};
+ if (ref($current{'roles'}) eq 'HASH') {
+ %rolemaps = %{$current{'roles'}};
+ $checkedfields{'roles'} = 1;
+ }
+ if (ref($current{'defaults'}) eq 'ARRAY') {
+ foreach my $val (@{$current{'defaults'}}) {
+ if (grep(/^\Q$val\E$/,@{$defaults{$provider}})) {
+ $inuse{$val} = 1;
+ } else {
+ foreach my $poss (keys(%{$extended{$provider}})) {
+ if (ref($extended{$provider}{$poss}) eq 'ARRAY') {
+ if (grep(/^\Q$val\E$/,@{$extended{$provider}{$poss}})) {
+ $inuse{$poss} = $val;
+ last;
+ }
+ }
+ }
+ }
+ }
+ } elsif (ref($current{'defaults'}) eq 'HASH') {
+ foreach my $key (keys(%{$current{'defaults'}})) {
+ my $currval = $current{'defaults'}{$key};
+ if (grep(/^\Q$key\E$/,@{$defaults{$provider}})) {
+ $inuse{$key} = 1;
+ } else {
+ my $match;
+ foreach my $poss (keys(%{$extended{$provider}})) {
+ if (ref($extended{$provider}{$poss}) eq 'ARRAY') {
+ if (grep(/^\Q$key\E$/,@{$extended{$provider}{$poss}})) {
+ $inuse{$poss} = $key;
+ last;
+ }
+ } elsif (ref($extended{$provider}{$poss}) eq 'HASH') {
+ foreach my $inner (sort(keys(%{$extended{$provider}{$poss}}))) {
+ if (ref($extended{$provider}{$poss}{$inner}) eq 'ARRAY') {
+ if (grep(/^\Q$currval\E$/,@{$extended{$provider}{$poss}{$inner}})) {
+ $currentdef{$inner} = $currval;
+ $match = 1;
+ last;
+ }
+ } elsif ($inner eq $key) {
+ $currentdef{$key} = $currval;
+ $match = 1;
+ last;
+ }
+ }
+ }
+ last if ($match);
+ }
+ }
+ }
+ }
+ if (ref($current{'crsconf'}) eq 'ARRAY') {
+ map { $crsconfig{$_} = 1; } @{$current{'crsconf'}};
+ }
+ }
+ }
+ my %lt = &proctoring_titles($provider);
+ my %fieldtitles = &proctoring_fieldtitles($provider);
+ my $onclickavailable = ' onclick="toggleProctoring(this.form,'."'$provider'".');"';
+ my %checkedavailable = (
+ yes => '',
+ no => ' checked="checked"',
+ );
+ if ($available) {
+ $checkedavailable{'yes'} = $checkedavailable{'no'};
+ $checkedavailable{'no'} = '';
+ }
+ my $chgstr = ' onchange="javascript:reorderProctoring(this.form,'."'proctoring_pos_".$provider."'".');"';
+ $datatable .= ''
+ .'';
+ for (my $k=0; $k<$maxnum; $k++) {
+ my $vpos = $k+1;
+ my $selstr;
+ if ($k == $i) {
+ $selstr = ' selected="selected" ';
+ }
+ $datatable .= ''.$vpos.' ';
+ }
+ if ($version eq '') {
+ if ($provider eq 'proctorio') {
+ $version = '1.0';
+ } elsif ($provider eq 'examity') {
+ $version = '1.1';
+ }
+ }
+ if ($lifetime eq '') {
+ $lifetime = '300';
+ }
+ $datatable .=
+ ' '.(' 'x2).''.$providernames{$provider}.' '.
+ ''.$lt{'avai'}.' '.
+ ' '.&mt('Yes').' '."\n".
+ ' '.&mt('No').' '."\n".
+ ' '.
+ ''.
+ ''.$lt{'base'}.' '.
+ ''.$lt{'version'}.':'.
+ ''.$version.' '."\n".
+ (' 'x2).
+ ''.$lt{'sigmethod'}.':'.
+ 'HMAC-SHA1 '.
+ 'HMAC-SHA256 '.
+ (' 'x2).
+ ''.$lt{'lifetime'}.': '."\n".
+ ' '.
+ ''.$lt{'url'}.': '."\n".
+ ' '.
+ ''.$lt{'key'}.': '."\n".
+ (' 'x2).
+ ''.$lt{'secret'}.': '.
+ ' '.$lt{'visible'}.' '."\n";
+ $datatable .= ''.$lt{'icon'}.': ';
+ if ($imgsrc) {
+ $datatable .= $imgsrc.
+ ' '.&mt('Delete?').' '.
+ ' '.&mt('Replace:');
+ }
+ $datatable .= ' ';
+ if ($switchserver) {
+ $datatable .= &mt('Upload to library server: [_1]',$switchserver);
+ } else {
+ $datatable .= ' ';
+ }
+ unless ($imgsrc) {
+ $datatable .= ' ('.&mt('if larger than 21x21 pixels, image will be scaled').')';
+ }
+ $datatable .= ' '."\n";
+ if (ref($requserfields{$provider}) eq 'ARRAY') {
+ if (@{$requserfields{$provider}} > 0) {
+ $datatable .= ''.$lt{'requ'}.' ';
+ foreach my $field (@{$requserfields{$provider}}) {
+ $datatable .= ''.
+ ' '.
+ $lt{$field}.' ';
+ if ($field eq 'user') {
+ my $seluserdom = '';
+ my $unseluserdom = ' selected="selected"';
+ if ($userincdom) {
+ $seluserdom = $unseluserdom;
+ $unseluserdom = '';
+ }
+ $datatable .= ': '.
+ ''.
+ ''.$lt{'username'}.' '.
+ ''.$lt{'uname:dom'}.' '.
+ ' ';
+ } else {
+ $datatable .= ' ';
+ if ($field eq 'roles') {
+ $showroles = 1;
+ }
+ }
+ $datatable .= ' ';
+ }
+ }
+ $datatable .= ' '."\n";
+ }
+ if (ref($optuserfields{$provider}) eq 'ARRAY') {
+ if (@{$optuserfields{$provider}} > 0) {
+ $datatable .= ''.$lt{'optu'}.' ';
+ foreach my $field (@{$optuserfields{$provider}}) {
+ my $checked;
+ if ($checkedfields{$field}) {
+ $checked = ' checked="checked"';
+ }
+ $datatable .= ''.
+ ' '.$lt{$field}.' ';
+ }
+ $datatable .= ' '."\n";
+ }
+ }
+ if (ref($defaults{$provider}) eq 'ARRAY') {
+ if (@{$defaults{$provider}}) {
+ my (%options,@selectboxes);
+ if (ref($extended{$provider}) eq 'HASH') {
+ %options = %{$extended{$provider}};
+ }
+ $datatable .= ''.$lt{'defa'}.' ';
+ my ($rem,$numinrow,$dropdowns);
+ if ($provider eq 'proctorio') {
+ $datatable .= '';
+ if (@selectboxes) {
+ $datatable .= '';
+ $numinrow = 2;
+ for (my $i=0; $i<@selectboxes; $i++) {
+ $rem = $i%($numinrow);
+ if ($rem == 0) {
+ if ($i > 0) {
+ $datatable .= '';
+ }
+ $datatable .= '';
+ }
+ $datatable .= ''.
+ $selectboxes[$i].' ';
+ }
+ if ($numinrow) {
+ $rem = $i%$numinrow;
+ }
+ $colsleft = $numinrow - $rem;
+ if ($colsleft > 1) {
+ $datatable .= '';
+ } else {
+ $datatable .= ' ';
+ }
+ $datatable .= ' '.
+ '
';
+ }
+ }
+ $datatable .= ' ';
+ }
+ if (ref($crsconf{$provider}) eq 'ARRAY') {
+ $datatable .= ''.
+ ''.&mt('Configurable in course').' ';
+ my ($rem,$numinrow);
+ if ($provider eq 'proctorio') {
+ $datatable .= '';
+ $numinrow = 4;
+ }
+ my $i = 0;
+ foreach my $item (@{$crsconf{$provider}}) {
+ my $name;
+ if ($provider eq 'examity') {
+ $name = $lt{'crs'.$item};
+ } elsif ($provider eq 'proctorio') {
+ $name = $fieldtitles{$item};
+ $rem = $i%($numinrow);
+ if ($rem == 0) {
+ if ($i > 0) {
+ $datatable .= '';
+ }
+ $datatable .= '';
+ }
+ $datatable .= ' '.
+ $name.'';
+ if ($provider eq 'examity') {
+ $datatable .= ' ';
+ }
+ $datatable .= "\n";
+ $i++;
+ }
+ if ($provider eq 'proctorio') {
+ if ($numinrow) {
+ $rem = $i%$numinrow;
+ }
+ my $colsleft = $numinrow - $rem;
+ if ($colsleft > 1) {
+ $datatable .= '';
+ } else {
+ $datatable .= ' ';
+ }
+ $datatable .= ' '.
+ '
';
+ }
+ $datatable .= ' ';
+ }
+ if ($showroles) {
+ $datatable .= ''.
+ ''.&mt('Role mapping').' ';
+ foreach my $role (@courseroles) {
+ my ($selected,$selectnone);
+ if (!$rolemaps{$role}) {
+ $selectnone = ' selected="selected"';
+ }
+ $datatable .= ''.
+ &Apache::lonnet::plaintext($role,'Course').' '.
+ ''.
+ ''.&mt('Select').' ';
+ foreach my $ltirole (@ltiroles) {
+ unless ($selectnone) {
+ if ($rolemaps{$role} eq $ltirole) {
+ $selected = ' selected="selected"';
+ } else {
+ $selected = '';
+ }
+ }
+ $datatable .= ''.$ltirole.' ';
+ }
+ $datatable .= ' ';
+ }
+ $datatable .= '
'.
+ ''.
+ ''.&mt('Custom items sent on launch').' '.
+ ' '."\n";
+ }
+ $datatable .= ' ';
+ }
+ $itemcount ++;
+ }
+ }
+ return $datatable;
+}
+
+sub proctoring_data {
+ my $requserfields = {
+ proctorio => ['user'],
+ examity => ['roles','user'],
+ };
+ my $optuserfields = {
+ proctorio => ['fullname'],
+ examity => ['fullname','firstname','lastname','email'],
+ };
+ my $defaults = {
+ proctorio => ['recordvideo','recordaudio','recordscreen','recordwebtraffic',
+ 'recordroomstart','verifyvideo','verifyaudio','verifydesktop',
+ 'verifyid','verifysignature','fullscreen','clipboard','tabslinks',
+ 'closetabs','onescreen','print','downloads','cache','rightclick',
+ 'reentry','calculator','whiteboard'],
+ examity => ['display'],
+ };
+ my $extended = {
+ proctorio => {
+ verifyid => ['verifyidauto','verifyidlive'],
+ fullscreen => ['fullscreenlenient','fullscreenmoderate','fullscreensever'],
+ tabslinks => ['notabs','linksonly'],
+ reentry => ['noreentry','agentreentry'],
+ calculator => ['calculatorbasic','calculatorsci'],
+ },
+ examity => {
+ display => {
+ target => ['iframe','tab','window'],
+ width => '',
+ height => '',
+ linktext => '',
+ explanation => '',
+ },
+ },
+ };
+ my $crsconf = {
+ proctorio => ['recordvideo','recordaudio','recordscreen','recordwebtraffic',
+ 'recordroomstart','verifyvideo','verifyaudio','verifydesktop',
+ 'verifyid','verifysignature','fullscreen','clipboard','tabslinks',
+ 'closetabs','onescreen','print','downloads','cache','rightclick',
+ 'reentry','calculator','whiteboard'],
+ examity => ['label','title','target','linktext','explanation','append'],
+ };
+ my $courseroles = ['cc','in','ta','ep','st'];
+ my $ltiroles = ['Instructor','ContentDeveloper','TeachingAssistant','Learner'];
+ return ($requserfields,$optuserfields,$defaults,$extended,$crsconf,$courseroles,$ltiroles);
+}
+
+sub proctoring_titles {
+ my ($item) = @_;
+ my (%common_lt,%custom_lt);
+ %common_lt = &Apache::lonlocal::texthash (
+ 'avai' => 'Available?',
+ 'base' => 'Basic Settings',
+ 'requ' => 'User data required to be sent on launch',
+ 'optu' => 'User data optionally sent on launch',
+ 'udsl' => 'User data sent on launch',
+ 'defa' => 'Defaults for items configurable in course',
+ 'sigmethod' => 'Signature Method',
+ 'key' => 'Key',
+ 'lifetime' => 'Nonce lifetime (s)',
+ 'secret' => 'Secret',
+ 'icon' => 'Icon',
+ 'fullname' => 'Full Name',
+ 'visible' => 'Visible input',
+ 'username' => 'username',
+ 'user' => 'User',
+ );
+ if ($item eq 'proctorio') {
+ %custom_lt = &Apache::lonlocal::texthash (
+ 'version' => 'OAuth version',
+ 'url' => 'API URL',
+ 'uname:dom' => 'username-domain',
+ );
+ } elsif ($item eq 'examity') {
+ %custom_lt = &Apache::lonlocal::texthash (
+ 'version' => 'LTI Version',
+ 'url' => 'URL',
+ 'uname:dom' => 'username:domain',
+ 'msgtype' => 'Message Type',
+ 'firstname' => 'First Name',
+ 'lastname' => 'Last Name',
+ 'email' => 'E-mail',
+ 'roles' => 'Role',
+ 'crstarget' => 'Display target',
+ 'crslabel' => 'Course label',
+ 'crstitle' => 'Course title',
+ 'crslinktext' => 'Link Text',
+ 'crsexplanation' => 'Explanation',
+ 'crsappend' => 'Provider URL',
+ );
+ }
+ my %lt = (%common_lt,%custom_lt);
+ return %lt;
+}
+
+sub proctoring_fieldtitles {
+ my ($item) = @_;
+ if ($item eq 'proctorio') {
+ return &Apache::lonlocal::texthash (
+ 'recordvideo' => 'Record video',
+ 'recordaudio' => 'Record audio',
+ 'recordscreen' => 'Record screen',
+ 'recordwebtraffic' => 'Record web traffic',
+ 'recordroomstart' => 'Record room scan',
+ 'verifyvideo' => 'Verify webcam',
+ 'verifyaudio' => 'Verify microphone',
+ 'verifydesktop' => 'Verify desktop recording',
+ 'verifyid' => 'Photo ID verification',
+ 'verifysignature' => 'Require signature',
+ 'fullscreen' => 'Fullscreen',
+ 'clipboard' => 'Disable copy/paste',
+ 'tabslinks' => 'New tabs/windows',
+ 'closetabs' => 'Close other tabs',
+ 'onescreen' => 'Limit to single screen',
+ 'print' => 'Disable Printing',
+ 'downloads' => 'Disable Downloads',
+ 'cache' => 'Empty cache after exam',
+ 'rightclick' => 'Disable right click',
+ 'reentry' => 'Re-entry to exam',
+ 'calculator' => 'Onscreen calculator',
+ 'whiteboard' => 'Onscreen whiteboard',
+ 'verifyidauto' => 'Automated verification',
+ 'verifyidlive' => 'Live agent verification',
+ 'fullscreenlenient' => 'Forced, but can navigate away for up to 30s',
+ 'fullscreenmoderate' => 'Forced, but can navigate away for up to 15s',
+ 'fullscreensever' => 'Forced, navigation away ends exam',
+ 'notabs' => 'Disaallowed',
+ 'linksonly' => 'Allowed from links in exam',
+ 'noreentry' => 'Disallowed',
+ 'agentreentry' => 'Agent required for re-entry',
+ 'calculatorbasic' => 'Basic',
+ 'calculatorsci' => 'Scientific',
+ );
+ } elsif ($item eq 'examity') {
+ return &Apache::lonlocal::texthash (
+ 'target' => 'Display target',
+ 'window' => 'Window',
+ 'tab' => 'Tab',
+ 'iframe' => 'iFrame',
+ 'height' => 'Height (pixels)',
+ 'width' => 'Width (pixels)',
+ 'linktext' => 'Default Link Text',
+ 'explanation' => 'Default Explanation',
+ 'append' => 'Provider URL',
+ );
+ }
+}
+
+sub proctoring_providernames {
+ return (
+ proctorio => 'Proctorio',
+ examity => 'Examity',
+ );
+}
+
+sub print_lti {
+ my ($position,$dom,$settings,$rowtotal) = @_;
+ my $itemcount = 1;
+ my ($datatable,$css_class);
+ my (%rules,%encrypt,%privkeys,%linkprot);
+ if (ref($settings) eq 'HASH') {
+ if ($position eq 'top') {
+ if (exists($settings->{'encrypt'})) {
+ if (ref($settings->{'encrypt'}) eq 'HASH') {
+ foreach my $key (keys(%{$settings->{'encrypt'}})) {
+ if ($key eq 'consumers') {
+ $encrypt{'ltisec_'.$key} = $settings->{'encrypt'}{$key};
+ } else {
+ $encrypt{'ltisec_'.$key.'linkprot'} = $settings->{'encrypt'}{$key};
+ }
+ }
+ }
+ }
+ if (exists($settings->{'private'})) {
+ if (ref($settings->{'private'}) eq 'HASH') {
+ if (ref($settings->{'private'}) eq 'HASH') {
+ if (ref($settings->{'private'}{'keys'}) eq 'ARRAY') {
+ map { $privkeys{$_} = 1; } (@{$settings->{'private'}{'keys'}});
+ }
+ }
+ }
+ }
+ } elsif ($position eq 'middle') {
+ if (exists($settings->{'rules'})) {
+ if (ref($settings->{'rules'}) eq 'HASH') {
+ %rules = %{$settings->{'rules'}};
+ }
+ }
+ } elsif ($position eq 'lower') {
+ if (exists($settings->{'linkprot'})) {
+ if (ref($settings->{'linkprot'}) eq 'HASH') {
+ %linkprot = %{$settings->{'linkprot'}};
+ if ($linkprot{'lock'}) {
+ delete($linkprot{'lock'});
+ }
+ }
+ }
+ } else {
+ foreach my $key ('encrypt','private','rules','linkprot') {
+ if (exists($settings->{$key})) {
+ delete($settings->{$key});
+ }
+ }
+ }
+ }
+ if ($position eq 'top') {
+ $datatable = &secrets_form($dom,'ltisec',\%encrypt,\%privkeys,$rowtotal);
+ } elsif ($position eq 'middle') {
+ $datatable = &password_rules('ltisecrets',\$itemcount,\%rules);
+ $$rowtotal += $itemcount;
+ } elsif ($position eq 'lower') {
+ $datatable .= &Apache::courseprefs::print_linkprotection($dom,'',$settings,$rowtotal,'','','domain');
+ } else {
+ my ($switchserver,$switchmessage);
+ $switchserver = &check_switchserver($dom);
+ $switchmessage = &mt("submit from domain's primary library server: [_1].",$switchserver);
+ my $maxnum = 0;
+ my %ordered;
+ if (ref($settings) eq 'HASH') {
+ foreach my $item (keys(%{$settings})) {
+ if (ref($settings->{$item}) eq 'HASH') {
+ my $num = $settings->{$item}{'order'};
+ if ($num eq '') {
+ $num = scalar(keys(%{$settings}));
+ }
+ $ordered{$num} = $item;
+ }
+ }
+ }
+ $maxnum = scalar(keys(%ordered));
+ 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,$usable,$lifetime,$consumer,$requser,$crsinc,$current);
+ if (ref($settings->{$item}) eq 'HASH') {
+ $key = $settings->{$item}->{'key'};
+ $usable = $settings->{$item}->{'usable'};
+ $lifetime = $settings->{$item}->{'lifetime'};
+ $consumer = $settings->{$item}->{'consumer'};
+ $requser = $settings->{$item}->{'requser'};
+ $crsinc = $settings->{$item}->{'crsinc'};
+ $current = $settings->{$item};
+ }
+ my $onclickrequser = ' onclick="toggleLTI(this.form,'."'requser','$i'".');"';
+ my %checkedrequser = (
+ yes => ' checked="checked"',
+ no => '',
+ );
+ if (!$requser) {
+ $checkedrequser{'no'} = $checkedrequser{'yes'};
+ $checkedrequser{'yes'} = '';
+ }
+ my $onclickcrsinc = ' onclick="toggleLTI(this.form,'."'crsinc','$i'".');"';
+ my %checkedcrsinc = (
+ yes => ' checked="checked"',
+ no => '',
+ );
+ if (!$crsinc) {
+ $checkedcrsinc{'no'} = $checkedcrsinc{'yes'};
+ $checkedcrsinc{'yes'} = '';
+ }
+ 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'}.': ';
+ if ($key ne '') {
+ $datatable .= ''.$lt{'key'};
+ if ($switchserver) {
+ $datatable .= ': ['.&mt('[_1] to view/edit',$switchserver).']';
+ } else {
+ $datatable .= ': ';
+ }
+ $datatable .= ' '.(' 'x2);
+ } elsif (!$switchserver) {
+ $datatable .= ''.$lt{'key'}.':'.
+ ' '.
+ ' '.(' 'x2);
+ }
+ if ($switchserver) {
+ if ($usable ne '') {
+ $datatable .= '
'.
+ $lt{'secret'}.': ['.&mt('not shown').'] '.(' 'x2).' '.
+ ''.&mt('Change secret?').
+ ' '.&mt('No').' '.
+ (' 'x2).
+ ' '.&mt('Yes').' '.(' 'x2).
+ '
'.
+ ' - '.$switchmessage.' '.
+ '';
+ } elsif ($key eq '') {
+ $datatable .= ''.&mt('Key and Secret are required').' - '.$switchmessage.' '."\n";
+ } else {
+ $datatable .= ''.&mt('Secret required').' - '.$switchmessage.' '."\n";
+ }
+ } else {
+ if ($usable ne '') {
+ $datatable .= '
'.
+ $lt{'secret'}.': ['.&mt('not shown').'] '.(' 'x2).' '.
+ ''.&mt('Change?').
+ ' '.&mt('No').' '.
+ (' 'x2).
+ ' '.&mt('Yes').
+ '
'.
+ ''.&mt('New Secret').':'.
+ ' '.
+ ' '.&mt('Visible input').' ';
+ } else {
+ $datatable .=
+ ''.$lt{'secret'}.':'.
+ ' '.
+ ' '.&mt('Visible input').' ';
+ }
+ }
+ $datatable .= ' '.
+ ''.$lt{'requser'}.':'.
+ ' '.&mt('Yes').' '."\n".
+ ' '.&mt('No').' '."\n".
+ ' '.
+ ''.$lt{'crsinc'}.':'.
+ ' '.&mt('Yes').' '."\n".
+ ' '.&mt('No').' '."\n".
+ (' 'x4).
+ ' '.
+ ' '.<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";
+ if ($switchserver) {
+ $datatable .= ''.&mt('Key and Secret are required').' - '.$switchmessage.' '."\n";
+ } else {
+ $datatable .= ''.$lt{'key'}.': '."\n".
+ (' 'x2).
+ ''.$lt{'secret'}.': '.
+ ' '.&mt('Visible input').' '."\n";
+ }
+ $datatable .= ' '.
+ ''.$lt{'requser'}.':'.
+ ' '.&mt('Yes').' '."\n".
+ ' '.&mt('No').' '."\n".
+ ' '.
+ ''.$lt{'crsinc'}.':'.
+ ' '.&mt('Yes').' '."\n".
+ ' '.&mt('No').' '."\n".
+ ' '.<i_options('add',undef,$itemcount,%lt).
+ ' '."\n".
+ ' '."\n";
+ $itemcount ++;
+ }
+ $$rowtotal += $itemcount;
+ return $datatable;
+}
+
+sub lti_names {
+ my %lt = &Apache::lonlocal::texthash(
+ 'version' => 'LTI Version',
+ 'url' => 'URL',
+ 'key' => 'Key',
+ 'lifetime' => 'Nonce lifetime (s)',
+ 'consumer' => 'Consumer',
+ 'secret' => 'Secret',
+ 'requser' => "User's identity sent",
+ 'crsinc' => "Course's identity sent",
+ '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,$callback);
+ $checked{'mapuser'}{'sourcedid'} = ' checked="checked"';
+ $checked{'mapcrs'}{'course_offering_sourcedid'} = ' checked="checked"';
+ $checked{'storecrs'}{'Y'} = ' 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 $callbacksty = 'none';
+ my $passbacksty = 'none';
+ my $optionsty = 'block';
+ my $crssty = 'block';
+ my $lcauthparm;
+ my $lcauthparmstyle = 'display:none';
+ my $lcauthparmtext;
+ my $menusty;
+ my $numinrow = 4;
+ my %menutitles = <imenu_titles();
+
+ if (ref($current) eq 'HASH') {
+ if (!$current->{'requser'}) {
+ $optionsty = 'none';
+ $crssty = 'none';
+ } elsif (!$current->{'crsinc'}) {
+ $crssty = 'none';
+ }
+ 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->{'storecrs'}) {
+ $checked{'storecrs'}{'N'} = $checked{'storecrs'}{'Y'};
+ $checked{'storecrs'}{'Y'} = '';
+ }
+ 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->{'callback'} ne '') {
+ $callback = $current->{'callback'};
+ $checked{'callback'}{'Y'} = ' checked="checked"';
+ $callbacksty = 'inline-block';
+ } else {
+ $checked{'callback'}{'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{'callback'}{'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 $onclickcallback = ' onclick="toggleLTI(this.form,'."'callback','$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('Logout options').' '.
+ ''.&mt('Callback to logout LON-CAPA on log out from Consumer').': '.
+ ' '.&mt('No').' '.(' 'x2).
+ ' '.&mt('Yes').'
'.
+ ''.
+ ''.&mt('Parameter').': '.
+ ' '.
+ '
'.
+ ''.&mt('Mapping users').' '.
+ ''.&mt('LON-CAPA username').': ';
+ foreach my $option ('sourcedid','email','other') {
+ $output .= ' '.$lt{$option}.' '.
+ ($option eq 'other' ? '' : (' 'x2) );
+ }
+ $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('LON-CAPA menu items (Course Coordinator can override)').' '.
+ ''.$lt{'topmenu'}.': '.
+ ' '.&mt('No').' '.(' 'x2).
+ ' '.&mt('Yes').'
'.
+ '
'.
+ ''.$lt{'inlinemenu'}.': '.
+ ' '.&mt('No').' '.(' 'x2).
+ ' '.&mt('Yes').'
';
+ $output .='
'.
+ ' '.
+ ''.&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('Store mapping of course identifier to LON-CAPA CourseID').': '.
+ ' '.&mt('No').' '.(' 'x2).
+ ' '.&mt('Yes').' '.
+ ' '.
+ ''.&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('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').'
'.
+ ''.
+ ' '.
+ '
';
+ my ($pb1p1chk,$pb1p0chk,$onclickpb);
+ foreach my $extra ('roster','passback') {
+ my $checkedon = '';
+ my $checkedoff = ' checked="checked"';
+ if ($extra eq 'passback') {
+ $pb1p1chk = ' checked="checked"';
+ $pb1p0chk = '';
+ $onclickpb = ' onclick="toggleLTI(this.form,'."'passback','$num'".');"';
+ } else {
+ $onclickpb = '';
+ }
+ if (ref($current) eq 'HASH') {
+ if (($current->{$extra})) {
+ $checkedon = $checkedoff;
+ $checkedoff = '';
+ if ($extra eq 'passback') {
+ $passbacksty = 'inline-block';
+ }
+ if ($current->{'passbackformat'} eq '1.0') {
+ $pb1p0chk = ' checked="checked"';
+ $pb1p1chk = '';
+ }
+ }
+ }
+ $output .= $lt{$extra}.' '.
+ ' '.
+ &mt('No').' '.(' 'x2).
+ ' '.
+ &mt('Yes').' ';
+ }
+ $output .= ''.
+ ''.&mt('Grade format').
+ ' '.
+ &mt('Outcomes Service (1.1)').' '.(' 'x2).
+ ' '.
+ &mt('Outcomes Extension (1.0)').'
'.
+ '
';
+ $output .= ' ';
+# ''.&mt('Assigning author roles').' ';
+#
+# $output .= ' '.
+# ''.&mt('Assigning domain roles').' ';
+ return $output;
+}
+
+sub ltimenu_titles {
+ return &Apache::lonlocal::texthash(
+ fullname => 'Full name',
+ coursetitle => 'Course title',
+ role => 'Role',
+ logout => 'Logout',
+ grades => 'Grades',
+ );
+}
+
sub print_coursedefaults {
my ($position,$dom,$settings,$rowtotal) = @_;
my ($css_class,$datatable,%checkedon,%checkedoff,%defaultchecked,@toggles);
my $itemcount = 1;
my %choices = &Apache::lonlocal::texthash (
+ canuse_pdfforms => 'Course/Community users can create/upload PDF forms',
uploadquota => 'Default quota for files uploaded directly to course/community using Course Editor (MB)',
+ coursequota => 'Default cumulative quota for all group portfolio spaces in course',
anonsurvey_threshold => 'Responder count needed before showing submissions for anonymous surveys',
coursecredits => 'Credits can be specified for courses',
uselcmath => 'Math preview uses LON-CAPA previewer (javascript) in place of DragMath (Java)',
usejsme => 'Molecule editor uses JSME (HTML5) in place of JME (Java)',
+ inline_chem => 'Use inline previewer for chemical reaction response in place of pop-up',
texengine => 'Default method to display mathematics',
postsubmit => 'Disable submit button/keypress following student submission',
canclone => "People who may clone a course (besides course's owner and coordinators)",
mysqltables => 'Lifetime (s) of "Temporary" MySQL tables (student performance data) on homeserver',
+ ltiauth => 'Student username in LTI launch of deep-linked URL can be accepted without re-authentication',
+ domexttool => 'External Tools defined in the domain may be used in courses/communities (by type)',
+ exttool => 'External Tools can be defined and configured in courses/communities (by type)',
);
my %staticdefaults = (
anonsurvey_threshold => 10,
uploadquota => 500,
+ coursequota => 20,
postsubmit => 60,
mysqltables => 172800,
+ domexttool => 1,
+ exttool => 0,
);
if ($position eq 'top') {
%defaultchecked = (
+ 'canuse_pdfforms' => 'off',
'uselcmath' => 'on',
'usejsme' => 'on',
+ 'inline_chem' => 'on',
'canclone' => 'none',
);
- @toggles = ('uselcmath','usejsme');
+ @toggles = ('canuse_pdfforms','uselcmath','usejsme','inline_chem');
my $deftex = $Apache::lonnet::deftex;
if (ref($settings) eq 'HASH') {
if ($settings->{'texengine'}) {
@@ -4489,7 +6886,7 @@ sub print_coursedefaults {
$datatable = $mathdisp.$datatable;
$css_class = $itemcount%2?' class="LC_odd_row"':'';
$datatable .=
- ''.
+ ' '.
''.$choices{'canclone'}.
' ';
my $currcanclone = 'none';
@@ -4533,7 +6930,7 @@ sub print_coursedefaults {
if ($checked) {
$show = 'block';
}
- $additional = '
'.
+ $additional = '
'.
&mt('Institutional codes for new and cloned course have identical:').
' ';
foreach my $item (@code_order) {
@@ -4560,17 +6957,49 @@ sub print_coursedefaults {
$itemcount ++;
} else {
$css_class = $itemcount%2 ? ' class="LC_odd_row"' : '';
- my ($currdefresponder,%defcredits,%curruploadquota,%deftimeout,%currmysql);
+ my ($currdefresponder,%defcredits,%curruploadquota,%currcoursequota,
+ %deftimeout,%currmysql);
my $currusecredits = 0;
my $postsubmitclient = 1;
- my @types = ('official','unofficial','community','textbook');
+ my $ltiauth = 0;
+ my %domexttool;
+ my %exttool;
+ my @types = ('official','unofficial','community','textbook','placement');
if (ref($settings) eq 'HASH') {
+ if ($settings->{'ltiauth'}) {
+ $ltiauth = 1;
+ }
+ if (ref($settings->{'domexttool'}) eq 'HASH') {
+ foreach my $type (@types) {
+ if ($settings->{'domexttool'}->{$type}) {
+ $domexttool{$type} = ' checked="checked"';
+ }
+ }
+ } else {
+ foreach my $type (@types) {
+ if ($staticdefaults{'domexttool'}) {
+ $domexttool{$type} = ' checked="checked"';
+ }
+ }
+ }
+ if (ref($settings->{'exttool'}) eq 'HASH') {
+ foreach my $type (@types) {
+ if ($settings->{'exttool'}->{$type}) {
+ $exttool{$type} = ' checked="checked"';
+ }
+ }
+ }
$currdefresponder = $settings->{'anonsurvey_threshold'};
if (ref($settings->{'uploadquota'}) eq 'HASH') {
foreach my $type (keys(%{$settings->{'uploadquota'}})) {
$curruploadquota{$type} = $settings->{'uploadquota'}{$type};
}
}
+ if (ref($settings->{'coursequota'}) eq 'HASH') {
+ foreach my $type (keys(%{$settings->{'coursequota'}})) {
+ $currcoursequota{$type} = $settings->{'coursequota'}{$type};
+ }
+ }
if (ref($settings->{'coursecredits'}) eq 'HASH') {
foreach my $type (@types) {
next if ($type eq 'community');
@@ -4616,6 +7045,9 @@ sub print_coursedefaults {
} else {
foreach my $type (@types) {
$deftimeout{$type} = $staticdefaults{'postsubmit'};
+ if ($staticdefaults{'domexttool'}) {
+ $domexttool{$type} = ' checked="checked"';
+ }
}
}
if (!$currdefresponder) {
@@ -4627,6 +7059,9 @@ sub print_coursedefaults {
if ($curruploadquota{$type} eq '') {
$curruploadquota{$type} = $staticdefaults{'uploadquota'};
}
+ if ($currcoursequota{$type} eq '') {
+ $currcoursequota{$type} = $staticdefaults{'coursequota'};
+ }
}
$datatable .=
' '.
@@ -4641,15 +7076,28 @@ sub print_coursedefaults {
$datatable .= ''.
$choices{'uploadquota'}.
' '.
- ''.
+ ' '.
' '."\n";
$itemcount ++;
+ $css_class = $itemcount%2 ? ' class="LC_odd_row"' : '';
+ $datatable .= ''.
+ $choices{'coursequota'}.
+ ' '.
+ ''.
+ ' '."\n";
+ $itemcount ++;
my $onclick = "toggleDisplay(this.form,'credits');";
my $display = 'none';
if ($currusecredits) {
@@ -4659,7 +7107,7 @@ sub print_coursedefaults {
''.&mt('Default credits').' ';
foreach my $type (@types) {
next if ($type eq 'community');
- $additional .= ''.&mt($type).' '.
+ $additional .= ' '.&mt($type).' '.
' ';
}
@@ -4683,7 +7131,7 @@ sub print_coursedefaults {
''.&mt('Enter 0 to remain disabled until page reload.').' '.
'';
foreach my $type (@types) {
- $additional .= ''.&mt($type).' '.
+ $additional .= ' '.&mt($type).' '.
' ';
}
@@ -4701,26 +7149,271 @@ sub print_coursedefaults {
$datatable .= ' '.
$choices{'mysqltables'}.
' '.
- ''.
+ ' '.
' '."\n";
$itemcount ++;
+ %defaultchecked = ('ltiauth' => 'off');
+ @toggles = ('ltiauth');
+ $current = {
+ 'ltiauth' => $ltiauth,
+ };
+ ($table,$itemcount) =
+ &radiobutton_prefs($current,\@toggles,\%defaultchecked,
+ \%choices,$itemcount,undef,undef,'left');
+ $datatable .= $table;
+ $css_class = $itemcount%2 ? ' class="LC_odd_row"' : '';
+ $datatable .= ''.
+ $choices{'domexttool'}.
+ ' '.
+ ''.
+ ' '."\n";
+ $itemcount ++;
+ $css_class = $itemcount%2 ? ' class="LC_odd_row"' : '';
+ $datatable .= ''.
+ $choices{'exttool'}.
+ ' '.
+ ''.
+ ' '."\n";
+ }
+ $$rowtotal += $itemcount;
+ return $datatable;
+}
+sub print_authordefaults {
+ my ($position,$dom,$settings,$rowtotal) = @_;
+ my ($css_class,$datatable,%checkedon,%checkedoff);
+ my $itemcount = 1;
+ my %titles = &authordefaults_titles();
+ if ($position eq 'top') {
+ my %defaultchecked = (
+ 'nocodemirror' => 'off',
+ 'domcoordacc' => 'on',
+ );
+ my @toggles = ('nocodemirror','domcoordacc');
+ ($datatable,$itemcount) = &radiobutton_prefs($settings,\@toggles,\%defaultchecked,
+ \%titles,$itemcount);
+ my %staticdefaults = (
+ 'copyright' => 'default',
+ 'sourceavail' => 'closed',
+ );
+ $css_class = $itemcount%2?' class="LC_odd_row"':'';
+ my %currrights;
+ foreach my $item ('copyright','sourceavail') {
+ $currrights{$item} = $staticdefaults{$item};
+ if (ref($settings) eq 'HASH') {
+ if (exists($settings->{$item})) {
+ $currrights{$item} = $settings->{$item};
+ }
+ }
+ }
+ $datatable .= ''.
+ ''.$titles{'copyright'}.
+ ' '.
+ &selectbox('copyright',$currrights{'copyright'},'',
+ \&Apache::loncommon::copyrightdescription,
+ (grep !/^priv|custom$/,(&Apache::loncommon::copyrightids))).
+ ' '."\n";
+ $itemcount ++;
+ $css_class = $itemcount%2?' class="LC_odd_row"':'';
+ $datatable .= ''.
+ ''.$titles{'sourceavail'}.
+ ' '.
+ &selectbox('sourceavail',$currrights{'sourceavail'},'',
+ \&Apache::loncommon::source_copyrightdescription,
+ (&Apache::loncommon::source_copyrightids)).
+ ' '."\n";
+ } else {
+ $css_class = $itemcount%2 ? ' class="LC_odd_row"' : '';
+ my $curreditors;
+ my %staticdefaults = (
+ editors => ['edit','xml'],
+ authorquota => 500,
+ webdav => 0,
+ );
+ my $curreditors = $staticdefaults{'editors'};
+ if ((ref($settings) eq 'HASH') &&
+ (ref($settings->{'editors'}) eq 'ARRAY')) {
+ $curreditors = $settings->{'editors'};
+ } else {
+ $curreditors = $staticdefaults{'editors'};
+ }
+ my @editors = ('edit','xml','daxe');
+ $datatable = ''."\n".
+ ''.$titles{'editors'}.' '."\n".
+ ''."\n".
+ '';
+ foreach my $editor (@editors) {
+ my $checked;
+ if (grep(/^\Q$editor\E$/,@{$curreditors})) {
+ $checked = ' checked="checked"';
+ }
+ $datatable .= ''.
+ ' '.
+ $titles{$editor}.' ';
+ }
+ $datatable .= ' '."\n".' '."\n".' '."\n";
+ $itemcount ++;
+ $css_class = $itemcount%2?' class="LC_odd_row"':'';
+ my ($othertitle,$usertypes,$types) = &Apache::loncommon::sorted_inst_types($dom);
+ my @insttypes;
+ if (ref($types) eq 'ARRAY') {
+ @insttypes = @{$types};
+ }
+ my $typecount = 0;
+ my %domconf = &Apache::lonnet::get_dom('configuration',['quotas'],$dom);
+ my @items = ('webdav','authorquota');
+ my %quotas;
+ if (ref($domconf{'quotas'}) eq 'HASH') {
+ %quotas = %{$domconf{'quotas'}};
+ foreach my $item (@items) {
+ if (ref($quotas{$item}) eq 'HASH') {
+ foreach my $type (@insttypes,'default') {
+ if ($item eq 'authorquota') {
+ if ($quotas{$item}{$type} !~ /^\d+$/) {
+ $quotas{$item}{$type} = $staticdefaults{$item};
+ }
+ } elsif ($item eq 'webdav') {
+ if ($quotas{$item}{$type} !~ /^(0|1)$/) {
+ $quotas{$item}{$type} = $staticdefaults{$item};
+ }
+ }
+ }
+ } else {
+ foreach my $type (@insttypes,'default') {
+ $quotas{$item}{$type} = $staticdefaults{$item};
+ }
+ }
+ }
+ } else {
+ foreach my $item (@items) {
+ foreach my $type (@insttypes,'default') {
+ $quotas{$item}{$type} = $staticdefaults{$item};
+ }
+ }
+ }
+ if (ref($usertypes) eq 'HASH') {
+ my $numinrow = 4;
+ my $onclick = '';
+ $datatable .= &insttypes_row(\%quotas,$types,$usertypes,$dom,
+ $numinrow,$othertitle,'authorquota',
+ \$itemcount,$onclick);
+ $itemcount ++;
+ $datatable .= &insttypes_row(\%quotas,$types,$usertypes,$dom,
+ $numinrow,$othertitle,'webdav',
+ \$itemcount);
+ $itemcount ++;
+ }
+ my $checkedno = ' checked="checked"';
+ my ($checkedon,$checkedoff);
+ if (ref($quotas{'webdav'}) eq 'HASH') {
+ if ($quotas{'webdav'}{'_LC_adv'} =~ /^0|1$/) {
+ if ($quotas{'webdav'}{'_LC_adv'}) {
+ $checkedon = $checkedno;
+ } else {
+ $checkedoff = $checkedno;
+ }
+ undef($checkedno);
+ }
+ }
+ $css_class = $itemcount%2?' class="LC_odd_row"':'';
+ $datatable .= ''.
+ ''.$titles{'webdav_LC_adv'}.' '.
+ $titles{'webdav_LC_adv_over'}.
+ ' '.
+ '';
+ foreach my $option ('none','off','on') {
+ my ($text,$val,$checked);
+ if ($option eq 'none') {
+ $text = $titles{'none'};
+ $val = '';
+ $checked = $checkedno;
+ } elsif ($option eq 'off') {
+ $text = $titles{'overoff'};
+ $val = 0;
+ $checked = $checkedoff;
+ } elsif ($option eq 'on') {
+ $text = $titles{'overon'};
+ $val = 1;
+ $checked = $checkedon;
+ }
+ $datatable .= ''.
+ ' '.
+ $text.' ';
+ }
+ $datatable .= ' ';
+ $itemcount ++;
}
$$rowtotal += $itemcount;
return $datatable;
}
+sub authordefaults_titles {
+ return &Apache::lonlocal::texthash(
+ copyright => 'Copyright/Distribution',
+ sourceavail => ' Source Available',
+ editors => 'Available Editors',
+ webdav => 'WebDAV',
+ authorquota => 'Authoring Space quotas (MB)',
+ nocodemirror => 'Deactivate CodeMirror for EditXML editor',
+ domcoordacc => 'Dom. Coords. can enter Authoring Spaces in domain',
+ edit => 'Standard editor (Edit)',
+ xml => 'Text editor (EditXML)',
+ daxe => 'Daxe editor (Daxe)',
+ webdav_LC_adv => 'WebDAV access for LON-CAPA "advanced" users',
+ webdav_LC_adv_over => '(overrides access based on affiliation, if set)',
+ none => 'No override set',
+ overon => 'Override -- webDAV on',
+ overoff => 'Override -- webDAV off',
+ );
+}
+
+sub selectbox {
+ my ($name,$value,$readonly,$functionref,@idlist)=@_;
+ my $selout = '';
+ foreach my $id (@idlist) {
+ $selout.=''.&{$functionref}($id).' ';
+ }
+ $selout.=' ';
+ return $selout;
+}
+
sub print_selfenrollment {
my ($position,$dom,$settings,$rowtotal) = @_;
my ($css_class,$datatable);
my $itemcount = 1;
- my @types = ('official','unofficial','community','textbook');
+ my @types = ('official','unofficial','community','textbook','placement');
if (($position eq 'top') || ($position eq 'middle')) {
my ($rowsref,$titlesref) = &Apache::lonuserutils::get_selfenroll_titles();
my %descs = &Apache::lonuserutils::selfenroll_default_descs();
@@ -4941,6 +7634,168 @@ sub print_validation_rows {
return $datatable;
}
+sub print_privacy {
+ my ($position,$dom,$settings,$rowtotal) = @_;
+ my ($datatable,$css_class,$numinrow,@items,%names,$othertitle,$usertypes,$types);
+ my $itemcount = 0;
+ if ($position eq 'top') {
+ $numinrow = 2;
+ } else {
+ @items = ('domain','author','course','community');
+ %names = &Apache::lonlocal::texthash (
+ domain => 'Assigned domain role(s)',
+ author => 'Assigned co-author role(s)',
+ course => 'Assigned course role(s)',
+ community => 'Assigned community role(s)',
+ );
+ $numinrow = 4;
+ ($othertitle,$usertypes,$types) =
+ &Apache::loncommon::sorted_inst_types($dom);
+ }
+ if (($position eq 'top') || ($position eq 'middle')) {
+ my (%by_ip,%by_location,@intdoms,@instdoms);
+ &build_location_hashes(\@intdoms,\%by_ip,\%by_location,\@instdoms);
+ if ($position eq 'top') {
+ my %curr;
+ my @options = ('none','user','domain','auto');
+ my %titles = &Apache::lonlocal::texthash (
+ none => 'Not allowed',
+ user => 'User authorizes',
+ domain => 'DC authorizes',
+ auto => 'Unrestricted',
+ instdom => 'Other domain shares institution/provider',
+ extdom => 'Other domain has different institution/provider',
+ notify => 'Notify when role needs authorization',
+ );
+ my %names = &Apache::lonlocal::texthash (
+ domain => 'Domain role',
+ author => 'Co-author role',
+ course => 'Course role',
+ community => 'Community role',
+ );
+ my $primary_id = &Apache::lonnet::domain($dom,'primary');
+ my $intdom = &Apache::lonnet::internet_dom($primary_id);
+ foreach my $domtype ('instdom','extdom') {
+ my (%checked,$skip);
+ $css_class = $itemcount%2?' class="LC_odd_row"':'';
+ $datatable .= ''.$titles{$domtype}.' '.
+ '';
+ if ($domtype eq 'instdom') {
+ unless (@instdoms > 1) {
+ $datatable .= &mt('Nothing to set, as no domains besides [_1] are hosted by [_2]',$dom,$intdom);
+ $skip = 1;
+ }
+ } elsif ($domtype eq 'extdom') {
+ if (keys(%by_location) == 0) {
+ $datatable .= &mt('Nothing to set, as no other hosts besides [_1]',$intdom);
+ $skip = 1;
+ }
+ }
+ unless ($skip) {
+ foreach my $roletype ('domain','author','course','community') {
+ $checked{'auto'} = ' checked="checked"';
+ if (ref($settings) eq 'HASH') {
+ if (ref($settings->{approval}) eq 'HASH') {
+ if (ref($settings->{approval}->{$domtype}) eq 'HASH') {
+ if ($settings->{approval}->{$domtype}->{$roletype}=~ /^(none|user|domain)$/) {
+ $checked{$1} = ' checked="checked"';
+ $checked{'auto'} = '';
+ }
+ }
+ }
+ }
+ $datatable .= ''.$names{$roletype}.' ';
+ foreach my $option (@options) {
+ $datatable .= ''.
+ ' '.$titles{$option}.
+ ' ';
+ }
+ $datatable .= ' ';
+ }
+ }
+ $datatable .= ' ';
+ $itemcount ++;
+ }
+ $css_class = $itemcount%2?' class="LC_odd_row"':'';
+ $datatable .= ''.$titles{'notify'}.' '.
+ '';
+ if ((@instdoms > 1) || (keys(%by_location) > 0)) {
+ my %curr;
+ if (ref($settings) eq 'HASH') {
+ if ($settings->{'notify'} ne '') {
+ map {$curr{$_}=1;} split(/,/,$settings->{'notify'});
+ }
+ }
+ $css_class = $itemcount%2?' class="LC_odd_row"':'';
+ my ($numdc,$table,$rows) = &active_dc_picker($dom,$numinrow,'checkbox',
+ 'privacy_notify',%curr);
+ if ($numdc > 0) {
+ $datatable .= $table;
+ } else {
+ $datatable .= &mt('There are no active Domain Coordinators');
+ }
+ } else {
+ $datatable .= &mt('Nothing to set here, as there are no other domains');
+ }
+ $datatable .=' ';
+ } elsif ($position eq 'middle') {
+ if ((@instdoms > 1) || (keys(%by_location) > 0)) {
+ if ((ref($types) eq 'ARRAY') && (ref($usertypes) eq 'HASH')) {
+ foreach my $item (@{$types}) {
+ $datatable .= &modifiable_userdata_row('privacy','othdom_'.$item,$settings,
+ $numinrow,$itemcount,'','','','','',
+ '',$usertypes->{$item});
+ $itemcount ++;
+ }
+ }
+ $datatable .= &modifiable_userdata_row('privacy','othdom_default',$settings,
+ $numinrow,$itemcount,'','','','','',
+ '',$othertitle);
+ $itemcount ++;
+ } else {
+ my (@insttypes,%insttitles);
+ if ((ref($types) eq 'ARRAY') && (ref($usertypes) eq 'HASH')) {
+ @insttypes = @{$types};
+ %insttitles = %{$usertypes};
+ }
+ foreach my $item (@insttypes,'default') {
+ my $title;
+ if ($item eq 'default') {
+ $title = $othertitle;
+ } else {
+ $title = $insttitles{$item};
+ }
+ $css_class = $itemcount%2?' class="LC_odd_row"':'';
+ $datatable .= ''.
+ ''.$title.' '.
+ ''.
+ &mt('Nothing to set here, as there are no other domains').
+ ' ';
+ $itemcount ++;
+ }
+ }
+ }
+ } else {
+ my $prefix;
+ if ($position eq 'lower') {
+ $prefix = 'priv';
+ } else {
+ $prefix = 'unpriv';
+ }
+ foreach my $item (@items) {
+ $datatable .= &modifiable_userdata_row('privacy',$prefix.'_'.$item,$settings,
+ $numinrow,$itemcount,'','','','','',
+ '',$names{$item});
+ $itemcount ++;
+ }
+ }
+ if (ref($rowtotal)) {
+ $$rowtotal += $itemcount;
+ }
+ return $datatable;
+}
+
sub print_passwords {
my ($position,$dom,$confname,$settings,$rowtotal) = @_;
my ($datatable,$css_class);
@@ -4962,6 +7817,7 @@ sub print_passwords {
min => 'Minimum password length',
max => 'Maximum password length',
chars => 'Required characters',
+ expire => 'Password expiration (days)',
numsaved => 'Number of previous passwords to save and disallow reuse',
);
if ($position eq 'top') {
@@ -5226,84 +8082,7 @@ sub print_passwords {
$itemcount ++;
}
} elsif ($position eq 'lower') {
- my ($min,$max,%chars,$numsaved);
- $min = $Apache::lonnet::passwdmin;
- if (ref($settings) eq 'HASH') {
- if ($settings->{min}) {
- $min = $settings->{min};
- }
- if ($settings->{max}) {
- $max = $settings->{max};
- }
- if (ref($settings->{chars}) eq 'ARRAY') {
- map { $chars{$_} = 1; } (@{$settings->{chars}});
- }
- if ($settings->{numsaved}) {
- $numsaved = $settings->{numsaved};
- }
- }
- my %rulenames = &Apache::lonlocal::texthash(
- uc => 'At least one upper case letter',
- lc => 'At least one lower case letter',
- num => 'At least one number',
- spec => 'At least one non-alphanumeric',
- );
- $css_class = $itemcount%2?' class="LC_odd_row"':'';
- $datatable .= ''.$titles{'min'}.' '.
- ''.
- ' '.
- ' '.&mt('(Enter an integer: 7 or larger)').' '.
- ' ';
- $itemcount ++;
- $css_class = $itemcount%2?' class="LC_odd_row"':'';
- $datatable .= ''.$titles{'max'}.' '.
- ''.
- ' '.
- ' '.&mt('(Leave blank for no maximum)').' '.
- ' ';
- $itemcount ++;
- $css_class = $itemcount%2?' class="LC_odd_row"':'';
- $datatable .= ''.$titles{'chars'}.' '.
- ''.&mt('(Leave unchecked if not required)').
- ' ';
- my $numinrow = 2;
- my @possrules = ('uc','lc','num','spec');
- $datatable .= ' ';
- $itemcount ++;
- $css_class = $itemcount%2?' class="LC_odd_row"':'';
- $datatable .= ''.$titles{'numsaved'}.' '.
- ''.
- ' '.
- ' '.&mt('(Leave blank to not save previous passwords)').' '.
- ' ';
+ $datatable .= &password_rules('passwords',\$itemcount,$settings);
} else {
my ($othertitle,$usertypes,$types) = &Apache::loncommon::sorted_inst_types($dom);
my %ownerchg = (
@@ -5328,7 +8107,7 @@ sub print_passwords {
$datatable .= ''.
''.
&mt('Requirements').''.
- ''.&mt("Course 'type' is not a Community").' '.
+ ''.&mt("Course 'type' is not a Community or Placement Test").' '.
''.&mt('User is Course Coordinator and also course owner').' '.
''.&mt("Student's only active roles are student role(s) in course(s) owned by this user").' '.
''.&mt('User, course, and student share same domain').' '.
@@ -5363,6 +8142,129 @@ sub print_passwords {
return $datatable;
}
+sub password_rules {
+ my ($prefix,$itemcountref,$settings) = @_;
+ my ($min,$max,%chars,$expire,$numsaved,$numinrow);
+ my %titles;
+ if ($prefix eq 'passwords') {
+ %titles = &Apache::lonlocal::texthash (
+ min => 'Minimum password length',
+ max => 'Maximum password length',
+ chars => 'Required characters',
+ );
+ } elsif (($prefix eq 'ltisecrets') || ($prefix eq 'toolsecrets')) {
+ %titles = &Apache::lonlocal::texthash (
+ min => 'Minimum secret length',
+ max => 'Maximum secret length',
+ chars => 'Required characters',
+ );
+ }
+ $min = $Apache::lonnet::passwdmin;
+ my $datatable;
+ my $itemcount;
+ if (ref($itemcountref)) {
+ $itemcount = $$itemcountref;
+ }
+ if (ref($settings) eq 'HASH') {
+ if ($settings->{min}) {
+ $min = $settings->{min};
+ }
+ if ($settings->{max}) {
+ $max = $settings->{max};
+ }
+ if (ref($settings->{chars}) eq 'ARRAY') {
+ map { $chars{$_} = 1; } (@{$settings->{chars}});
+ }
+ if ($prefix eq 'passwords') {
+ if ($settings->{expire}) {
+ $expire = $settings->{expire};
+ }
+ if ($settings->{numsaved}) {
+ $numsaved = $settings->{numsaved};
+ }
+ }
+ }
+ my %rulenames = &Apache::lonlocal::texthash(
+ uc => 'At least one upper case letter',
+ lc => 'At least one lower case letter',
+ num => 'At least one number',
+ spec => 'At least one non-alphanumeric',
+ );
+ my $css_class = $itemcount%2?' class="LC_odd_row"':'';
+ $datatable .= ''.$titles{'min'}.' '.
+ ''.
+ ' '.
+ ' '.&mt('(Enter an integer: 7 or larger)').' '.
+ ' ';
+ $itemcount ++;
+ $css_class = $itemcount%2?' class="LC_odd_row"':'';
+ $datatable .= ''.$titles{'max'}.' '.
+ ''.
+ ' '.
+ ' '.&mt('(Leave blank for no maximum)').' '.
+ ' ';
+ $itemcount ++;
+ $css_class = $itemcount%2?' class="LC_odd_row"':'';
+ $datatable .= ''.$titles{'chars'}.' '.
+ ''.&mt('(Leave unchecked if not required)').
+ ' ';
+ my $numinrow = 2;
+ my @possrules = ('uc','lc','num','spec');
+ $datatable .= ' ';
+ $itemcount ++;
+ if ($prefix eq 'passwords') {
+ $titles{'expire'} = &mt('Password expiration (days)');
+ $titles{'numsaved'} = &mt('Number of previous passwords to save and disallow reuse');
+ $css_class = $itemcount%2?' class="LC_odd_row"':'';
+ $datatable .= ''.$titles{'expire'}.' '.
+ ''.
+ ' '.
+ ' '.&mt('(Leave blank for no expiration)').' '.
+ ' ';
+ $itemcount ++;
+ $css_class = $itemcount%2?' class="LC_odd_row"':'';
+ $datatable .= ''.$titles{'numsaved'}.' '.
+ ''.
+ ' '.
+ ' '.&mt('(Leave blank to not save previous passwords)').' '.
+ ' ';
+ $itemcount ++;
+ }
+ if (ref($itemcountref)) {
+ $$itemcountref += $itemcount;
+ }
+ return $datatable;
+}
+
sub print_wafproxy {
my ($position,$dom,$settings,$rowtotal) = @_;
my $css_class;
@@ -5672,15 +8574,14 @@ sub remoteip_methods {
sub print_usersessions {
my ($position,$dom,$settings,$rowtotal) = @_;
- my ($css_class,$datatable,%checked,%choices);
- my (%by_ip,%by_location,@intdoms);
- &build_location_hashes(\@intdoms,\%by_ip,\%by_location);
+ my ($css_class,$datatable,$itemcount,%checked,%choices);
+ my (%by_ip,%by_location,@intdoms,@instdoms);
+ &build_location_hashes(\@intdoms,\%by_ip,\%by_location,\@instdoms);
my @alldoms = &Apache::lonnet::all_domains();
my %serverhomes = %Apache::lonnet::serverhomeIDs;
my %servers = &Apache::lonnet::internet_dom_servers($dom);
my %altids = &id_for_thisdom(%servers);
- my $itemcount = 1;
if ($position eq 'top') {
if (keys(%serverhomes) > 1) {
my %spareid = ¤t_offloads_to($dom,$settings,\%servers);
@@ -5698,118 +8599,256 @@ sub print_usersessions {
$other_insts,$curroffloadnow,$curroffloadoth,$rowtotal);
} else {
$datatable .= ''.
- &mt('Nothing to set here, as the cluster to which this domain belongs only contains one server.');
+ &mt('Nothing to set here, as the cluster to which this domain belongs only contains one server.').
+ ' ';
}
} else {
- if (keys(%by_location) == 0) {
- $datatable .= ''.
- &mt('Nothing to set here, as the cluster to which this domain belongs only contains one institution.');
+ my %titles = &usersession_titles();
+ my ($prefix,@types);
+ if ($position eq 'bottom') {
+ $prefix = 'remote';
+ @types = ('version','excludedomain','includedomain');
} else {
- my %lt = &usersession_titles();
- my $numinrow = 5;
- my $prefix;
- my @types;
- if ($position eq 'bottom') {
- $prefix = 'remote';
- @types = ('version','excludedomain','includedomain');
- } else {
- $prefix = 'hosted';
- @types = ('excludedomain','includedomain');
- }
- my (%current,%checkedon,%checkedoff);
- my @lcversions = &Apache::lonnet::all_loncaparevs();
- my @locations = sort(keys(%by_location));
- foreach my $type (@types) {
- $checkedon{$type} = '';
- $checkedoff{$type} = ' checked="checked"';
- }
- if (ref($settings) eq 'HASH') {
- if (ref($settings->{$prefix}) eq 'HASH') {
- foreach my $key (keys(%{$settings->{$prefix}})) {
- $current{$key} = $settings->{$prefix}{$key};
- if ($key eq 'version') {
- if ($current{$key} ne '') {
- $checkedon{$key} = ' checked="checked"';
- $checkedoff{$key} = '';
- }
- } elsif (ref($current{$key}) eq 'ARRAY') {
+ $prefix = 'hosted';
+ @types = ('excludedomain','includedomain');
+ }
+ ($datatable,$itemcount) = &rules_by_location($settings,$prefix,\%by_location,\%by_ip,\@types,\%titles);
+ }
+ $$rowtotal += $itemcount;
+ return $datatable;
+}
+
+sub rules_by_location {
+ my ($settings,$prefix,$by_location,$by_ip,$types,$titles) = @_;
+ my ($datatable,$itemcount,$css_class);
+ if (keys(%{$by_location}) == 0) {
+ $css_class = $itemcount%2 ? ' class="LC_odd_row"' : '';
+ $datatable = ' '.
+ &mt('Nothing to set here, as the cluster to which this domain belongs only contains one institution.').
+ ' ';
+ $itemcount = 1;
+ } else {
+ $itemcount = 0;
+ my $numinrow = 5;
+ my (%current,%checkedon,%checkedoff);
+ my @locations = sort(keys(%{$by_location}));
+ foreach my $type (@{$types}) {
+ $checkedon{$type} = '';
+ $checkedoff{$type} = ' checked="checked"';
+ }
+ if (ref($settings) eq 'HASH') {
+ if (ref($settings->{$prefix}) eq 'HASH') {
+ foreach my $key (keys(%{$settings->{$prefix}})) {
+ $current{$key} = $settings->{$prefix}{$key};
+ if ($key eq 'version') {
+ if ($current{$key} ne '') {
$checkedon{$key} = ' checked="checked"';
$checkedoff{$key} = '';
}
+ } elsif (ref($current{$key}) eq 'ARRAY') {
+ $checkedon{$key} = ' checked="checked"';
+ $checkedoff{$key} = '';
}
}
}
- foreach my $type (@types) {
- next if ($type ne 'version' && !@locations);
- $css_class = $itemcount%2 ? ' class="LC_odd_row"' : '';
- $datatable .= '
- '.$lt{$type}.'
-
- '.&mt('Not in use').'
- '.&mt('In use').' ';
- if ($type eq 'version') {
- my $selector = '';
- foreach my $version (@lcversions) {
- my $selected = '';
- if ($current{'version'} eq $version) {
- $selected = ' selected="selected"';
- }
- $selector .= ' '.$version.' ';
- }
- $selector .= ' ';
- $datatable .= &mt('remote server must be version: [_1] or later',$selector);
- } else {
- $datatable.= ' '.(' 'x2).
- ' '.
- "\n".
- '
';
- my $rem;
- for (my $i=0; $i<@locations; $i++) {
- my ($showloc,$value,$checkedtype);
- if (ref($by_location{$locations[$i]}) eq 'ARRAY') {
- my $ip = $by_location{$locations[$i]}->[0];
- if (ref($by_ip{$ip}) eq 'ARRAY') {
- $value = join(':',@{$by_ip{$ip}});
- $showloc = join(', ',@{$by_ip{$ip}});
- if (ref($current{$type}) eq 'ARRAY') {
- foreach my $loc (@{$by_ip{$ip}}) {
- if (grep(/^\Q$loc\E$/,@{$current{$type}})) {
- $checkedtype = ' checked="checked"';
- last;
- }
+ }
+ foreach my $type (@{$types}) {
+ next if ($type ne 'version' && !@locations);
+ $css_class = $itemcount%2 ? ' class="LC_odd_row"' : '';
+ $datatable .= '
+ '.$titles->{$type}.'
+
+ '.&mt('Not in use').'
+ '.&mt('In use').' ';
+ if ($type eq 'version') {
+ my @lcversions = &Apache::lonnet::all_loncaparevs();
+ my $selector = '';
+ foreach my $version (@lcversions) {
+ my $selected = '';
+ if ($current{'version'} eq $version) {
+ $selected = ' selected="selected"';
+ }
+ $selector .= ' '.$version.' ';
+ }
+ $selector .= ' ';
+ $datatable .= &mt('remote server must be version: [_1] or later',$selector);
+ } else {
+ $datatable.= ' '.(' 'x2).
+ ' '.
+ "\n".
+ '
';
+ $itemcount ++;
+ }
+ }
+ return ($datatable,$itemcount);
+}
+
+sub print_ssl {
+ my ($position,$dom,$settings,$rowtotal) = @_;
+ my ($css_class,$datatable);
+ my $itemcount = 1;
+ if ($position eq 'top') {
+ my $primary_id = &Apache::lonnet::domain($dom,'primary');
+ my $intdom = &Apache::lonnet::internet_dom($primary_id);
+ my $same_institution;
+ if ($intdom ne '') {
+ my $internet_names = &Apache::lonnet::get_internet_names($Apache::lonnet::perlvar{'lonHostID'});
+ if (ref($internet_names) eq 'ARRAY') {
+ if (grep(/^\Q$intdom\E$/,@{$internet_names})) {
+ $same_institution = 1;
+ }
+ }
+ }
+ $css_class = $itemcount%2?' class="LC_odd_row"':'';
+ $datatable = '';
+ if ($same_institution) {
+ my %domservers = &Apache::lonnet::get_servers($dom);
+ $datatable .= &LONCAPA::SSL::print_certstatus(\%domservers,'web','domprefs');
+ } else {
+ $datatable .= &mt("You need to be logged into one of your own domain's servers to display information about the status of LON-CAPA SSL certificates.");
+ }
+ $datatable .= ' ';
+ $itemcount ++;
+ } else {
+ my %titles = &ssl_titles();
+ my (%by_ip,%by_location,@intdoms,@instdoms);
+ &build_location_hashes(\@intdoms,\%by_ip,\%by_location,\@instdoms);
+ my @alldoms = &Apache::lonnet::all_domains();
+ my %serverhomes = %Apache::lonnet::serverhomeIDs;
+ my @domservers = &Apache::lonnet::get_servers($dom);
+ my %servers = &Apache::lonnet::internet_dom_servers($dom);
+ my %altids = &id_for_thisdom(%servers);
+ if (($position eq 'connto') || ($position eq 'connfrom')) {
+ my $legacy;
+ unless (ref($settings) eq 'HASH') {
+ my $name;
+ if ($position eq 'connto') {
+ $name = 'loncAllowInsecure';
+ } else {
+ $name = 'londAllowInsecure';
+ }
+ my $primarylibserv = &Apache::lonnet::domain($dom,'primary');
+ my @ids=&Apache::lonnet::current_machine_ids();
+ if (($primarylibserv ne '') && (!grep(/^\Q$primarylibserv\E$/,@ids))) {
+ my %what = (
+ $name => 1,
+ );
+ my ($result,$returnhash) =
+ &Apache::lonnet::get_remote_globals($primarylibserv,\%what);
+ if ($result eq 'ok') {
+ if (ref($returnhash) eq 'HASH') {
+ $legacy = $returnhash->{$name};
+ }
+ }
+ } else {
+ $legacy = $Apache::lonnet::perlvar{$name};
+ }
+ }
+ foreach my $type ('dom','intdom','other') {
+ my %checked;
+ $css_class = $itemcount%2?' class="LC_odd_row"':'';
+ $datatable .= ''.$titles{$type}.' '.
+ '';
+ my $skip;
+ if ($type eq 'dom') {
+ unless (keys(%servers) > 1) {
+ $datatable .= &mt('Nothing to set here, as there are no other servers/VMs');
+ $skip = 1;
+ }
+ }
+ if ($type eq 'intdom') {
+ unless (@instdoms > 1) {
+ $datatable .= &mt('Nothing to set here, as there are no other domains for this institution');
+ $skip = 1;
+ }
+ } elsif ($type eq 'other') {
+ if (keys(%by_location) == 0) {
+ $datatable .= &mt('Nothing to set here, as there are no other institutions');
+ $skip = 1;
+ }
+ }
+ unless ($skip) {
+ $checked{'yes'} = ' checked="checked"';
+ if (ref($settings) eq 'HASH') {
+ if (ref($settings->{$position}) eq 'HASH') {
+ if ($settings->{$position}->{$type} =~ /^(no|req)$/) {
+ $checked{$1} = $checked{'yes'};
+ delete($checked{'yes'});
+ }
+ }
+ } else {
+ if ($legacy == 0) {
+ $checked{'req'} = $checked{'yes'};
+ delete($checked{'yes'});
+ }
+ }
+ foreach my $option ('no','yes','req') {
+ $datatable .= ''.
+ ' '.$titles{$option}.
+ ' '.(' 'x2);
}
- $datatable .= '
';
}
$datatable .= '
';
+ $itemcount ++;
+ }
+ } else {
+ my $prefix = 'replication';
+ my @types = ('certreq','nocertreq');
+ if (keys(%by_location) == 0) {
+ $datatable .= ''.
+ &mt('Nothing to set here, as there are no other institutions').
+ ' ';
$itemcount ++;
+ } else {
+ ($datatable,$itemcount) =
+ &rules_by_location($settings,$prefix,\%by_location,\%by_ip,\@types,\%titles);
}
}
}
@@ -5817,10 +8856,60 @@ sub print_usersessions {
return $datatable;
}
+sub ssl_titles {
+ return &Apache::lonlocal::texthash (
+ dom => 'LON-CAPA servers/VMs from same domain',
+ intdom => 'LON-CAPA servers/VMs from same "internet" domain',
+ other => 'External LON-CAPA servers/VMs',
+ connto => 'Connections to other servers',
+ connfrom => 'Connections from other servers',
+ replication => 'Replicating content to other institutions',
+ certreq => 'Client certificate required, but specific domains exempt',
+ nocertreq => 'No client certificate required, except for specific domains',
+ no => 'SSL not used',
+ yes => 'SSL Optional (used if available)',
+ req => 'SSL Required',
+ );
+}
+
+sub print_trust {
+ my ($prefix,$dom,$settings,$rowtotal) = @_;
+ my ($css_class,$datatable,%checked,%choices);
+ my (%by_ip,%by_location,@intdoms,@instdoms);
+ &build_location_hashes(\@intdoms,\%by_ip,\%by_location,\@instdoms);
+ my $itemcount = 1;
+ my %titles = &trust_titles();
+ my @types = ('exc','inc');
+ if ($prefix eq 'top') {
+ $prefix = 'content';
+ } elsif ($prefix eq 'bottom') {
+ $prefix = 'msg';
+ }
+ ($datatable,$itemcount) = &rules_by_location($settings,$prefix,\%by_location,\%by_ip,\@types,\%titles);
+ $$rowtotal += $itemcount;
+ return $datatable;
+}
+
+sub trust_titles {
+ return &Apache::lonlocal::texthash(
+ content => "Access to this domain's content by others",
+ shared => "Access to other domain's content by this domain",
+ enroll => "Enrollment in this domain's courses by others",
+ othcoau => "Co-author roles in this domain for others",
+ coaurem => "Co-author roles for this domain's users elsewhere",
+ domroles => "Domain roles in this domain assignable to others",
+ catalog => "Course Catalog for this domain displayed elsewhere",
+ reqcrs => "Requests for creation of courses in this domain by others",
+ msg => "Users in other domains can send messages to this domain",
+ exc => "Allow all, but exclude specific domains",
+ inc => "Deny all, but include specific domains",
+ );
+}
+
sub build_location_hashes {
- my ($intdoms,$by_ip,$by_location) = @_;
+ my ($intdoms,$by_ip,$by_location,$instdoms) = @_;
return unless((ref($intdoms) eq 'ARRAY') && (ref($by_ip) eq 'HASH') &&
- (ref($by_location) eq 'HASH'));
+ (ref($by_location) eq 'HASH') && (ref($instdoms) eq 'ARRAY'));
my %iphost = &Apache::lonnet::get_iphost();
my $primary_id = &Apache::lonnet::domain($env{'request.role.domain'},'primary');
my $primary_ip = &Apache::lonnet::get_host_ip($primary_id);
@@ -5837,7 +8926,13 @@ sub build_location_hashes {
foreach my $id (@{$iphost{$ip}}) {
my $location = &Apache::lonnet::internet_dom($id);
if ($location) {
- next if (grep(/^\Q$location\E$/,@{$intdoms}));
+ if (grep(/^\Q$location\E$/,@{$intdoms})) {
+ my $dom = &Apache::lonnet::host_domain($id);
+ unless (grep(/^\Q$dom\E/,@{$instdoms})) {
+ push(@{$instdoms},$dom);
+ }
+ next;
+ }
if (ref($by_ip->{$ip}) eq 'ARRAY') {
unless(grep(/^\Q$location\E$/,@{$by_ip->{$ip}})) {
push(@{$by_ip->{$ip}},$location);
@@ -6157,7 +9252,7 @@ sub print_loadbalancing {
my $disabled_div_style = 'display: block';
my $homedom_div_style = 'display: none';
$datatable .= ''.
- ''.
+ ' '.
'';
if ($lonhost eq '') {
$datatable .= '';
@@ -6190,7 +9285,7 @@ sub print_loadbalancing {
$homedom_div_style = 'display: block';
}
}
- $datatable .= '
'.
+ $datatable .= ' '.
''.$disabledtext.'
'."\n".
''.&mt('Offloads to:').'
';
@@ -6419,10 +9514,10 @@ sub loadbalance_rule_row {
}
my $space;
if ($islast && $num == 1) {
- $space = '
';
+ $space = '
';
}
my $output =
- '
'.$space.
+ ' '.$space.
''.$title.'
'."\n".
''.$space.
''."\n";
@@ -6556,12 +9651,14 @@ sub tool_titles {
my %titles = &Apache::lonlocal::texthash (
aboutme => 'Personal web page',
blog => 'Blog',
- webdav => 'WebDAV',
portfolio => 'Portfolio',
+ portaccess => 'Share portfolio files',
+ timezone => 'Can set time zone',
official => 'Official courses (with institutional codes)',
unofficial => 'Unofficial courses',
community => 'Communities',
textbook => 'Textbook courses',
+ placement => 'Placement tests',
);
return %titles;
}
@@ -6572,8 +9669,10 @@ sub courserequest_titles {
unofficial => 'Unofficial',
community => 'Communities',
textbook => 'Textbook',
+ placement => 'Placement tests',
+ lti => 'LTI Provider',
norequest => 'Not allowed',
- approval => 'Approval by Dom. Coord.',
+ approval => 'Approval by DC',
validate => 'With validation',
autolimit => 'Numerical limit',
unlimited => '(blank for unlimited)',
@@ -6662,7 +9761,7 @@ sub print_usercreation {
}
$datatable .= '
'.
''.$lt{$item}.
- ' ';
+ ' ';
my @options = ('any');
if (ref($rules) eq 'HASH') {
if (keys(%{$rules}) > 0) {
@@ -6685,7 +9784,7 @@ sub print_usercreation {
}
} else {
my @contexts = ('author','course','domain');
- my @authtypes = ('int','krb4','krb5','loc');
+ my @authtypes = ('int','krb4','krb5','loc','lti');
my %checked;
if (ref($settings) eq 'HASH') {
if (ref($settings->{'authtypes'}) eq 'HASH') {
@@ -7105,7 +10204,7 @@ sub noninst_users {
}
$output .= ' ';
foreach my $item ('approve','email','username') {
- $output .= '';
+ $output .= ' ';
my (%choices,@options,$hashref,$defoption,$name,$onclick,$hascustom);
if ($item eq 'approve') {
%choices = &Apache::lonlocal::texthash (
@@ -7247,7 +10346,7 @@ sub noninst_users {
sub captcha_choice {
my ($context,$settings,$itemcount,$customcss,$rowstyle) = @_;
my ($keyentry,$currpub,$currpriv,%checked,$rowname,$pubtext,$privtext,
- $vertext,$currver);
+ $vertext,$currver);
my %lt = &captcha_phrases();
$keyentry = 'hidden';
my $colspan=2;
@@ -7336,7 +10435,7 @@ sub user_formats_row {
'username' => 'new usernames',
'id' => 'IDs',
);
- unless ($type eq 'email') {
+ unless (($type eq 'email') || ($type eq 'unamemap')) {
my $css_class = $rowcount%2?' class="LC_odd_row"':'';
$output = ' '.
''.
@@ -7391,9 +10490,9 @@ sub user_formats_row {
} elsif ($colsleft == 1) {
$output .= ' ';
}
- $output .= '
';
- unless ($type eq 'email') {
- $output .= ' ';
+ $output .= '';
+ unless (($type eq 'email') || ($type eq 'unamemap')) {
+ $output .= '
';
}
return $output;
}
@@ -7429,6 +10528,7 @@ sub authtype_names {
krb4 => 'Kerberos 4',
krb5 => 'Kerberos 5',
loc => 'Local',
+ lti => 'LTI',
);
return %lt;
}
@@ -7497,12 +10597,13 @@ sub print_defaults {
''.$titles->{$item}.
' ';
if ($item eq 'auth_def') {
- my @authtypes = ('internal','krb4','krb5','localauth');
+ my @authtypes = ('internal','krb4','krb5','localauth','lti');
my %shortauth = (
internal => 'int',
krb4 => 'krb4',
krb5 => 'krb5',
- localauth => 'loc'
+ localauth => 'loc',
+ lti => 'lti',
);
my %authnames = &authtype_names();
foreach my $auth (@authtypes) {
@@ -7523,18 +10624,34 @@ sub print_defaults {
} elsif ($item eq 'lang_def') {
my $includeempty = 1;
$datatable .= &Apache::loncommon::select_language($item,$defaults{$item},$includeempty);
- } else {
- my $size;
- if ($item eq 'portal_def') {
- $size = ' size="25"';
- }
+ } elsif ($item eq 'portal_def') {
$datatable .= ' ';
+ $defaults{$item}.'" size="25" onkeyup="portalExtras(this);" />';
+ my $portalsty = 'none';
+ if ($defaults{$item}) {
+ $portalsty = 'block';
+ }
+ foreach my $field ('email','web') {
+ my $checkedoff = ' checked="checked"';
+ my $checkedon;
+ if ($defaults{$item.'_'.$field}) {
+ $checkedon = $checkedoff;
+ $checkedoff = '';
+ }
+ $datatable .= ''.
+ ''.$titles->{$field}.' '.
+ ' '.&mt('Yes').' '.
+ (' 'x2).
+ ' '.&mt('No').' '.
+ '
';
+ }
+ } else {
+ $datatable .= ' ';
}
$datatable .= ' ';
$rownum ++;
}
- } else {
+ } elsif ($position eq 'middle') {
my %defaults;
if (ref($settings) eq 'HASH') {
if ((ref($settings->{'inststatusorder'}) eq 'ARRAY') && (ref($settings->{'inststatustypes'}) eq 'HASH')) {
@@ -7558,7 +10675,7 @@ sub print_defaults {
$datatable .= ' '.&mt('Internal ID:').' '.$item.' '.
' '.
&mt('delete').' '.
- ''.&mt('Name displayed').':'.
+ ' '.&mt('Name displayed').':'.
' '.
' ';
}
@@ -7577,13 +10694,29 @@ sub print_defaults {
$datatable .= ' '.&mt('Internal ID:').
' '.
' '.&mt('(new)').
- ''.
+ ' '.
&mt('Name displayed').':'.
' '.
' '."\n";
$rownum ++;
}
}
+ } else {
+ my ($unamemaprules,$ruleorder) =
+ &Apache::lonnet::inst_userrules($dom,'unamemap');
+ $css_class = $rownum%2?' class="LC_odd_row"':'';
+ if ((ref($unamemaprules) eq 'HASH') && (ref($ruleorder) eq 'ARRAY')) {
+ my $numinrow = 2;
+ $datatable .= ''.&mt('Available conversions').' '.
+ &user_formats_row('unamemap',$settings,$unamemaprules,
+ $ruleorder,$numinrow).
+ '
';
+ }
+ if ($datatable eq '') {
+ $datatable .= ''.
+ &mt('No rules set for domain in customized localenroll.pm').
+ ' ';
+ }
}
$$rowtotal += $rownum;
return $datatable;
@@ -7609,6 +10742,8 @@ sub defaults_titles {
'timezone_def' => 'Default timezone',
'datelocale_def' => 'Default locale for dates',
'portal_def' => 'Portal/Default URL',
+ 'email' => 'Email links use portal URL',
+ 'web' => 'Public web links use portal URL',
'intauth_cost' => 'Encryption cost for bcrypt (positive integer)',
'intauth_check' => 'Check bcrypt cost if authenticated',
'intauth_switch' => 'Existing crypt-based switched to bcrypt on authentication',
@@ -7794,7 +10929,7 @@ sub print_scantronformat {
}
$datatable .= '';
if (keys(%error) == 0) {
- $datatable .= '';
+ $datatable .= ' ';
if (!$switchserver) {
$datatable .= &mt('Upload:').' ';
}
@@ -7841,10 +10976,13 @@ sub legacy_scantronformat {
my ($url,$error);
my @statinfo = &Apache::lonnet::stat_file($newurl);
if ((!@statinfo) || ($statinfo[0] eq 'no_such_dir')) {
+ my $modified = [];
(my $result,$url) =
- &publishlogo($r,'copy',$legacyfile,$dom,$confname,'scantron',
- '','',$newfile);
- if ($result ne 'ok') {
+ &Apache::lonconfigsettings::publishlogo($r,'copy',$legacyfile,$dom,$confname,
+ 'scantron','','',$newfile,$modified);
+ if ($result eq 'ok') {
+ &update_modify_urls($r,$modified);
+ } else {
$error = &mt("An error occurred publishing the [_1] bubblesheet format file in RES space. Error was: [_2].",$newfile,$result);
}
}
@@ -8029,6 +11167,10 @@ sub print_coursecategories {
my $toggle_catscomm_dom = ' checked="checked" ';
my $can_catcomm_comm = ' ';
my $can_catcomm_dom = ' checked="checked" ';
+ my $toggle_catsplace_place = ' ';
+ my $toggle_catsplace_dom = ' checked="checked" ';
+ my $can_catplace_place = ' ';
+ my $can_catplace_dom = ' checked="checked" ';
if (ref($settings) eq 'HASH') {
if ($settings->{'togglecats'} eq 'crs') {
@@ -8047,17 +11189,28 @@ sub print_coursecategories {
$can_catcomm_comm = $can_catcomm_dom;
$can_catcomm_dom = ' ';
}
+ if ($settings->{'togglecatsplace'} eq 'place') {
+ $toggle_catsplace_place = $toggle_catsplace_dom;
+ $toggle_catsplace_dom = ' ';
+ }
+ if ($settings->{'categorizeplace'} eq 'place') {
+ $can_catplace_place = $can_catplace_dom;
+ $can_catplace_dom = ' ';
+ }
}
my %title = &Apache::lonlocal::texthash (
- togglecats => 'Show/Hide a course in catalog',
- togglecatscomm => 'Show/Hide a community in catalog',
- categorize => 'Assign a category to a course',
- categorizecomm => 'Assign a category to a community',
+ togglecats => 'Show/Hide a course in catalog',
+ togglecatscomm => 'Show/Hide a community in catalog',
+ togglecatsplace => 'Show/Hide a placement test in catalog',
+ categorize => 'Assign a category to a course',
+ categorizecomm => 'Assign a category to a community',
+ categorizeplace => 'Assign a category to a placement test',
);
my %level = &Apache::lonlocal::texthash (
- dom => 'Set in Domain',
- crs => 'Set in Course',
- comm => 'Set in Community',
+ dom => 'Set in Domain',
+ crs => 'Set in Course',
+ comm => 'Set in Community',
+ place => 'Set in Placement Test',
);
$datatable = ' '.
''.$title{'togglecats'}.' '.
@@ -8087,8 +11240,22 @@ sub print_coursecategories {
$can_catcomm_dom.' value="dom" />'.$level{'dom'}.' '.
' '.$level{'comm'}.' '.
+ ' '.
+ ''.$title{'togglecatsplace'}.' '.
+ ''.
+ ' '.$level{'dom'}.' '.
+ ' '.$level{'place'}.' '.
+ ' '.
+ ''.$title{'categorizeplace'}.' '.
+ ''.
+ ' '.$level{'dom'}.' '.
+ ' '.$level{'place'}.' '.
' ';
- $$rowtotal += 4;
+ $$rowtotal += 6;
} else {
my $css_class;
my $itemcount = 1;
@@ -8113,12 +11280,15 @@ sub print_coursecategories {
my %default_names = (
instcode => &mt('Official courses'),
communities => &mt('Communities'),
+ placement => &mt('Placement Tests'),
);
if ((!grep(/^instcode$/,@{$cats[0]})) ||
($cathash->{'instcode::0'} eq '') ||
(!grep(/^communities$/,@{$cats[0]})) ||
- ($cathash->{'communities::0'} eq '')) {
+ ($cathash->{'communities::0'} eq '') ||
+ (!grep(/^placement$/,@{$cats[0]})) ||
+ ($cathash->{'placement::0'} eq '')) {
$maxnum ++;
}
my $lastidx;
@@ -8139,7 +11309,7 @@ sub print_coursecategories {
$datatable .= ''.$vpos.' ';
}
$datatable .= '';
- if ($parent eq 'instcode' || $parent eq 'communities') {
+ if ($parent eq 'instcode' || $parent eq 'communities' || $parent eq 'placement') {
$datatable .= ''
.$default_names{$parent}.' ';
if ($parent eq 'instcode') {
@@ -8162,7 +11332,7 @@ sub print_coursecategories {
$datatable .= ' '
.&mt('Do not display').' ';
- if ($parent eq 'communities') {
+ if (($parent eq 'communities') || ($parent eq 'placement')) {
$datatable .= '
';
}
$datatable .= ' ';
@@ -8194,7 +11364,7 @@ sub print_coursecategories {
.' '
.' '."\n";
$itemcount ++;
- foreach my $default ('instcode','communities') {
+ foreach my $default ('instcode','communities','placement') {
if ((!grep(/^\Q$default\E$/,@{$cats[0]})) || ($cathash->{$default.'::0'} eq '')) {
$css_class = $itemcount%2?' class="LC_odd_row"':'';
my $chgstr = ' onchange="javascript:reorderCats(this.form,'."'','$default"."_pos','$lastidx'".');"';
@@ -8283,14 +11453,31 @@ sub print_serverstatuses {
sub serverstatus_pages {
return ('userstatus','lonstatus','loncron','server-status','codeversions',
- 'checksums','clusterstatus','metadata_keywords','metadata_harvest',
- 'takeoffline','takeonline','showenv','toggledebug','ping','domconf',
- 'uniquecodes','diskusage','coursecatalog');
+ 'checksums','clusterstatus','certstatus','metadata_keywords',
+ 'metadata_harvest','takeoffline','takeonline','showenv','toggledebug',
+ 'ping','domconf','uniquecodes','diskusage','coursecatalog');
}
sub defaults_javascript {
my ($settings) = @_;
return unless (ref($settings) eq 'HASH');
+ my $portal_js = <<"ENDPORTAL";
+
+function portalExtras(caller) {
+ var x = caller.value;
+ var y = new Array('email','web');
+ for (var i=0; i 0) {
+ z.style.display = 'block';
+ } else {
+ z.style.display = 'none';
+ }
+ }
+ }
+}
+ENDPORTAL
if ((ref($settings->{'inststatusorder'}) eq 'ARRAY') && (ref($settings->{'inststatustypes'}) eq 'HASH')) {
my $maxnum = scalar(@{$settings->{'inststatusorder'}});
if ($maxnum eq '') {
@@ -8344,25 +11531,47 @@ $jstext
return;
}
+$portal_js
+
+// ]]>
+
+
+ENDSCRIPT
+ } else {
+return <<"ENDSCRIPT";
+
ENDSCRIPT
}
+ return;
}
sub passwords_javascript {
- my %intalert = &Apache::lonlocal::texthash (
- authcheck => 'Warning: disallowing login for an authenticated user if the stored cost is less than the default will require a password reset by/for the user.',
- authcost => 'Warning: bcrypt encryption cost for internal authentication must be an integer.',
- passmin => 'Warning: minimum password length must be a positive integer greater than 6.',
- passmax => 'Warning: maximum password length must be a positive integer (or blank).',
- passexp => 'Warning: days before password expiration must be a positive integer (or blank).',
- passnum => 'Warning: number of previous passwords to save must be a positive integer (or blank).',
- );
+ my ($prefix) = @_;
+ my %intalert;
+ if ($prefix eq 'passwords') {
+ %intalert = &Apache::lonlocal::texthash (
+ authcheck => 'Warning: disallowing login for an authenticated user if the stored cost is less than the default will require a password reset by/for the user.',
+ authcost => 'Warning: bcrypt encryption cost for internal authentication must be an integer.',
+ passmin => 'Warning: minimum password length must be a positive integer greater than 6.',
+ passmax => 'Warning: maximum password length must be a positive integer (or blank).',
+ passexp => 'Warning: days before password expiration must be a positive integer (or blank).',
+ passnum => 'Warning: number of previous passwords to save must be a positive integer (or blank).',
+ );
+ } elsif (($prefix eq 'ltisecrets') || ($prefix eq 'toolsecrets')) {
+ %intalert = &Apache::lonlocal::texthash (
+ passmin => 'Warning: minimum secret length must be a positive integer greater than 6.',
+ passmax => 'Warning: maximum secret length must be a positive integer (or blank).',
+ );
+ }
&js_escape(\%intalert);
my $defmin = $Apache::lonnet::passwdmin;
- my $intauthjs = <<"ENDSCRIPT";
+ my $intauthjs;
+ if ($prefix eq 'passwords') { $intauthjs = <<"ENDSCRIPT";
function warnIntAuth(field) {
if (field.name == 'intauth_check') {
@@ -8382,11 +11591,17 @@ function warnIntAuth(field) {
return;
}
-function warnIntPass(field) {
+ENDSCRIPT
+
+ }
+
+ $intauthjs .= <<"ENDSCRIPT";
+
+function warnInt$prefix(field) {
field.value.replace(/^\s+/,'');
field.value.replace(/\s+\$/,'');
var regexdigit=/^\\d+\$/;
- if (field.name == 'passwords_min') {
+ if (field.name == '${prefix}_min') {
if (field.value == '') {
alert('$intalert{passmin}');
field.value = '$defmin';
@@ -8406,8 +11621,8 @@ function warnIntPass(field) {
field.value = '';
}
if (field.value != '') {
- if (field.name == 'passwords_expire') {
- var regexpposnum=/^\\d+(|\\.\\d*)\$/;
+ if (field.name == '${prefix}_expire') {
+ var regexpposnum=/^\\d+(|\\.\\d*)\$/;
if (!regexpposnum.test(field.value)) {
alert('$intalert{passexp}');
field.value = '';
@@ -8420,10 +11635,10 @@ function warnIntPass(field) {
}
} else {
if (!regexdigit.test(field.value)) {
- if (field.name == 'passwords_max') {
+ if (field.name == '${prefix}_max') {
alert('$intalert{passmax}');
} else {
- if (field.name == 'passwords_numsaved') {
+ if (field.name == '${prefix}_numsaved') {
alert('$intalert{passnum}');
}
}
@@ -8463,9 +11678,11 @@ sub coursecategories_javascript {
}
my $instcode_reserved = &mt('The name: [_1] is a reserved category.','"instcode"');
my $communities_reserved = &mt('The name: [_1] is a reserved category.','"communities"');
+ my $placement_reserved = &mt('The name: [_1] is a reserved category.','"placement"');
my $choose_again = "\n".&mt('Please use a different name for the new top level category.');
&js_escape(\$instcode_reserved);
&js_escape(\$communities_reserved);
+ &js_escape(\$placement_reserved);
&js_escape(\$choose_again);
$output = <<"ENDSCRIPT";