version 1.396, 2021/12/06 03:31:54
|
version 1.413, 2022/09/08 01:41:13
|
Line 220 sub handler {
|
Line 220 sub handler {
|
'serverstatuses','requestcourses','helpsettings', |
'serverstatuses','requestcourses','helpsettings', |
'coursedefaults','usersessions','loadbalancing', |
'coursedefaults','usersessions','loadbalancing', |
'requestauthor','selfenrollment','inststatus', |
'requestauthor','selfenrollment','inststatus', |
'ltitools','ssl','trust','lti','privacy','passwords', |
'ltitools','ssl','trust','lti','ltisec','privacy','passwords', |
'proctoring','wafproxy','ipaccess'],$dom); |
'proctoring','wafproxy','ipaccess'],$dom); |
my %encconfig = |
my %encconfig = |
&Apache::lonnet::get_dom('encconfig',['ltitools','lti','proctoring'],$dom,undef,1); |
&Apache::lonnet::get_dom('encconfig',['ltitools','lti','proctoring','linkprot'],$dom,undef,1); |
if (ref($domconfig{'ltitools'}) eq 'HASH') { |
if (ref($domconfig{'ltitools'}) eq 'HASH') { |
if (ref($encconfig{'ltitools'}) eq 'HASH') { |
if (ref($encconfig{'ltitools'}) eq 'HASH') { |
foreach my $id (keys(%{$domconfig{'ltitools'}})) { |
foreach my $id (keys(%{$domconfig{'ltitools'}})) { |
Line 248 sub handler {
|
Line 248 sub handler {
|
} |
} |
} |
} |
} |
} |
|
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($domconfig{'proctoring'}) eq 'HASH') { |
if (ref($encconfig{'proctoring'}) eq 'HASH') { |
if (ref($encconfig{'proctoring'}) eq 'HASH') { |
foreach my $provider (keys(%{$domconfig{'proctoring'}})) { |
foreach my $provider (keys(%{$domconfig{'proctoring'}})) { |
Line 310 sub handler {
|
Line 327 sub handler {
|
header => [{col1 => 'Setting', |
header => [{col1 => 'Setting', |
col2 => 'Value'}, |
col2 => 'Value'}, |
{col1 => 'Institutional user types', |
{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, |
print => \&print_defaults, |
modify => \&modify_defaults, |
modify => \&modify_defaults, |
}, |
}, |
Line 340 sub handler {
|
Line 359 sub handler {
|
modify => \&modify_passwords, |
modify => \&modify_passwords, |
}, |
}, |
'quotas' => |
'quotas' => |
{ text => 'Blogs, personal web pages, webDAV/quotas, portfolios', |
{ text => 'Blogs, personal pages/timezones, webDAV/quotas, portfolio', |
help => 'Domain_Configuration_Quotas', |
help => 'Domain_Configuration_Quotas', |
header => [{col1 => 'User affiliation', |
header => [{col1 => 'User affiliation', |
col2 => 'Available tools', |
col2 => 'Available tools', |
Line 617 sub handler {
|
Line 636 sub handler {
|
modify => \&modify_trust, |
modify => \&modify_trust, |
}, |
}, |
'lti' => |
'lti' => |
{text => 'LTI Provider', |
{text => 'LTI Link Protection and LTI Consumers', |
help => 'Domain_Configuration_LTI_Provider', |
help => 'Domain_Configuration_LTI_Provider', |
header => [{col1 => 'Setting', |
header => [{col1 => 'Encryption of shared secrets', |
col2 => 'Value',}], |
col2 => 'Settings'}, |
|
{col1 => 'Rules for shared secrets', |
|
col2 => 'Settings'}, |
|
{col1 => 'Link Protectors', |
|
col2 => 'Settings'}, |
|
{col1 => 'Consumers', |
|
col2 => 'Settings'},], |
print => \&print_lti, |
print => \&print_lti, |
modify => \&modify_lti, |
modify => \&modify_lti, |
}, |
}, |
Line 639 sub handler {
|
Line 664 sub handler {
|
header => [{col1 => 'Log-in Service', |
header => [{col1 => 'Log-in Service', |
col2 => 'Server Setting',}, |
col2 => 'Server Setting',}, |
{col1 => 'Log-in Page Items', |
{col1 => 'Log-in Page Items', |
col2 => ''}, |
col2 => 'Settings'}, |
{col1 => 'Log-in Help', |
{col1 => 'Log-in Help', |
col2 => 'Value'}, |
col2 => 'Value'}, |
{col1 => 'Custom HTML in document head', |
{col1 => 'Custom HTML in document head', |
Line 850 sub print_config_box {
|
Line 875 sub print_config_box {
|
} elsif ($action eq 'defaults') { |
} elsif ($action eq 'defaults') { |
$output = &defaults_javascript($settings); |
$output = &defaults_javascript($settings); |
} elsif ($action eq 'passwords') { |
} elsif ($action eq 'passwords') { |
$output = &passwords_javascript(); |
$output = &passwords_javascript($action); |
} elsif ($action eq 'helpsettings') { |
} elsif ($action eq 'helpsettings') { |
my (%privs,%levelscurrent); |
my (%privs,%levelscurrent); |
my %full=(); |
my %full=(); |
Line 870 sub print_config_box {
|
Line 895 sub print_config_box {
|
} elsif ($action eq 'ltitools') { |
} elsif ($action eq 'ltitools') { |
$output .= <itools_javascript($settings); |
$output .= <itools_javascript($settings); |
} elsif ($action eq 'lti') { |
} elsif ($action eq 'lti') { |
$output .= <i_javascript($settings); |
$output .= &passwords_javascript('secrets')."\n". |
|
<i_javascript($dom,$settings); |
} elsif ($action eq 'proctoring') { |
} elsif ($action eq 'proctoring') { |
$output .= &proctoring_javascript($settings); |
$output .= &proctoring_javascript($settings); |
} elsif ($action eq 'wafproxy') { |
} elsif ($action eq 'wafproxy') { |
$output .= &wafproxy_javascript($dom); |
$output .= &wafproxy_javascript($dom); |
} elsif ($action eq 'autoupdate') { |
} elsif ($action eq 'autoupdate') { |
$output .= &autoupdate_javascript(); |
$output .= &autoupdate_javascript(); |
|
} elsif ($action eq 'autoenroll') { |
|
$output .= &autoenroll_javascript(); |
} elsif ($action eq 'login') { |
} elsif ($action eq 'login') { |
$output .= &saml_javascript(); |
$output .= &saml_javascript(); |
} elsif ($action eq 'ipaccess') { |
} elsif ($action eq 'ipaccess') { |
Line 922 sub print_config_box {
|
Line 950 sub print_config_box {
|
($action eq 'usermodification') || ($action eq 'defaults') || ($action eq 'coursedefaults') || |
($action eq 'usermodification') || ($action eq 'defaults') || ($action eq 'coursedefaults') || |
($action eq 'selfenrollment') || ($action eq 'usersessions') || ($action eq 'ssl') || |
($action eq 'selfenrollment') || ($action eq 'usersessions') || ($action eq 'ssl') || |
($action eq 'directorysrch') || ($action eq 'trust') || ($action eq 'helpsettings') || |
($action eq 'directorysrch') || ($action eq 'trust') || ($action eq 'helpsettings') || |
($action eq 'contacts') || ($action eq 'privacy') || ($action eq 'wafproxy')) { |
($action eq 'contacts') || ($action eq 'privacy') || ($action eq 'wafproxy') || ($action eq 'lti')) { |
$output .= $item->{'print'}->('top',$dom,$settings,\$rowtotal); |
$output .= $item->{'print'}->('top',$dom,$settings,\$rowtotal); |
} elsif ($action eq 'passwords') { |
} elsif ($action eq 'passwords') { |
$output .= $item->{'print'}->('top',$dom,$confname,$settings,\$rowtotal); |
$output .= $item->{'print'}->('top',$dom,$confname,$settings,\$rowtotal); |
Line 957 sub print_config_box {
|
Line 985 sub print_config_box {
|
if (($action eq 'autoupdate') || ($action eq 'usercreation') || |
if (($action eq 'autoupdate') || ($action eq 'usercreation') || |
($action eq 'selfcreation') || ($action eq 'selfenrollment') || |
($action eq 'selfcreation') || ($action eq 'selfenrollment') || |
($action eq 'usersessions') || ($action eq 'coursecategories') || |
($action eq 'usersessions') || ($action eq 'coursecategories') || |
($action eq 'trust') || ($action eq 'contacts') || |
($action eq 'trust') || ($action eq 'contacts') || ($action eq 'defaults') || |
($action eq 'privacy') || ($action eq 'passwords')) { |
($action eq 'privacy') || ($action eq 'passwords') || ($action eq 'lti')) { |
if ($action eq 'coursecategories') { |
if ($action eq 'coursecategories') { |
$output .= &print_coursecategories('middle',$dom,$item,$settings,\$rowtotal); |
$output .= &print_coursecategories('middle',$dom,$item,$settings,\$rowtotal); |
$colspan = ' colspan="2"'; |
$colspan = ' colspan="2"'; |
Line 1011 sub print_config_box {
|
Line 1039 sub print_config_box {
|
</tr>'."\n"; |
</tr>'."\n"; |
if ($action eq 'coursecategories') { |
if ($action eq 'coursecategories') { |
$output .= &print_coursecategories('bottom',$dom,$item,$settings,\$rowtotal); |
$output .= &print_coursecategories('bottom',$dom,$item,$settings,\$rowtotal); |
} elsif (($action eq 'contacts') || ($action eq 'privacy') || ($action eq 'passwords')) { |
} elsif (($action eq 'contacts') || ($action eq 'privacy') || |
|
($action eq 'passwords') || ($action eq 'lti')) { |
if ($action eq 'passwords') { |
if ($action eq 'passwords') { |
$output .= $item->{'print'}->('lower',$dom,$confname,$settings,\$rowtotal); |
$output .= $item->{'print'}->('lower',$dom,$confname,$settings,\$rowtotal); |
} else { |
} else { |
Line 1044 sub print_config_box {
|
Line 1073 sub print_config_box {
|
} |
} |
$rowtotal ++; |
$rowtotal ++; |
} elsif (($action eq 'usermodification') || ($action eq 'coursedefaults') || |
} elsif (($action eq 'usermodification') || ($action eq 'coursedefaults') || |
($action eq 'defaults') || ($action eq 'directorysrch') || |
($action eq 'directorysrch') || ($action eq 'helpsettings') || |
($action eq 'helpsettings') || ($action eq 'wafproxy')) { |
($action eq 'wafproxy')) { |
$output .= $item->{'print'}->('bottom',$dom,$settings,\$rowtotal); |
$output .= $item->{'print'}->('bottom',$dom,$settings,\$rowtotal); |
} elsif ($action eq 'scantron') { |
} elsif ($action eq 'scantron') { |
$output .= $item->{'print'}->($r,'bottom',$dom,$confname,$settings,\$rowtotal); |
$output .= $item->{'print'}->($r,'bottom',$dom,$confname,$settings,\$rowtotal); |
Line 1248 sub print_config_box {
|
Line 1277 sub print_config_box {
|
$output .= &print_quotas($dom,$settings,\$rowtotal,$action); |
$output .= &print_quotas($dom,$settings,\$rowtotal,$action); |
} elsif (($action eq 'autoenroll') || ($action eq 'autocreate') || |
} elsif (($action eq 'autoenroll') || ($action eq 'autocreate') || |
($action eq 'serverstatuses') || ($action eq 'loadbalancing') || |
($action eq 'serverstatuses') || ($action eq 'loadbalancing') || |
($action eq 'ltitools') || ($action eq 'lti') || |
($action eq 'ltitools') || ($action eq 'proctoring') || |
($action eq 'proctoring') || ($action eq 'ipaccess')) { |
($action eq 'ipaccess')) { |
$output .= $item->{'print'}->($dom,$settings,\$rowtotal); |
$output .= $item->{'print'}->($dom,$settings,\$rowtotal); |
} |
} |
} |
} |
Line 1355 sub print_login {
|
Line 1384 sub print_login {
|
} |
} |
} |
} |
my @images = ('img','logo','domlogo','login'); |
my @images = ('img','logo','domlogo','login'); |
|
my @alttext = ('img','logo','domlogo'); |
my @logintext = ('textcol','bgcol'); |
my @logintext = ('textcol','bgcol'); |
my @bgs = ('pgbg','mainbg','sidebg'); |
my @bgs = ('pgbg','mainbg','sidebg'); |
my @links = ('link','alink','vlink'); |
my @links = ('link','alink','vlink'); |
Line 1396 sub print_login {
|
Line 1426 sub print_login {
|
$designs{'showlogo'}{$item} = $settings->{'showlogo'}{$item}; |
$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) { |
foreach my $item (@logintext) { |
if ($settings->{$item} ne '') { |
if ($settings->{$item} ne '') { |
$designs{'logintext'}{$item} = $settings->{$item}; |
$designs{'logintext'}{$item} = $settings->{$item}; |
Line 1591 sub print_login {
|
Line 1628 sub print_login {
|
'<table><tr><th>'.$choices{'hostid'}.'</th>'. |
'<table><tr><th>'.$choices{'hostid'}.'</th>'. |
'<th>'.$choices{'samllanding'}.'</th>'. |
'<th>'.$choices{'samllanding'}.'</th>'. |
'<th>'.$choices{'samloptions'}.'</th></tr>'."\n"; |
'<th>'.$choices{'samloptions'}.'</th></tr>'."\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)) { |
foreach my $lonhost (keys(%domservers)) { |
$samlurl{$lonhost} = '/adm/sso'; |
$samlurl{$lonhost} = '/adm/sso'; |
$styleon{$lonhost} = 'display:none'; |
$styleon{$lonhost} = 'display:none'; |
$styleoff{$lonhost} = ''; |
$styleoff{$lonhost} = ''; |
} |
} |
if (ref($settings->{'saml'}) eq 'HASH') { |
if ((ref($settings) eq 'HASH') && (ref($settings->{'saml'}) eq 'HASH')) { |
foreach my $lonhost (keys(%{$settings->{'saml'}})) { |
foreach my $lonhost (keys(%{$settings->{'saml'}})) { |
if (ref($settings->{'saml'}{$lonhost}) eq 'HASH') { |
if (ref($settings->{'saml'}{$lonhost}) eq 'HASH') { |
$saml{$lonhost} = 1; |
$saml{$lonhost} = 1; |
Line 1606 sub print_login {
|
Line 1643 sub print_login {
|
$samlalt{$lonhost} = $settings->{'saml'}{$lonhost}{'alt'}; |
$samlalt{$lonhost} = $settings->{'saml'}{$lonhost}{'alt'}; |
$samlurl{$lonhost} = $settings->{'saml'}{$lonhost}{'url'}; |
$samlurl{$lonhost} = $settings->{'saml'}{$lonhost}{'url'}; |
$samltitle{$lonhost} = $settings->{'saml'}{$lonhost}{'title'}; |
$samltitle{$lonhost} = $settings->{'saml'}{$lonhost}{'title'}; |
|
$samlwindow{$lonhost} = $settings->{'saml'}{$lonhost}{'window'}; |
$samlnotsso{$lonhost} = $settings->{'saml'}{$lonhost}{'notsso'}; |
$samlnotsso{$lonhost} = $settings->{'saml'}{$lonhost}{'notsso'}; |
$styleon{$lonhost} = ''; |
$styleon{$lonhost} = ''; |
$styleoff{$lonhost} = 'display:none'; |
$styleoff{$lonhost} = 'display:none'; |
Line 1623 sub print_login {
|
Line 1661 sub print_login {
|
$samlon = $samloff; |
$samlon = $samloff; |
$samloff = ' '; |
$samloff = ' '; |
} |
} |
|
my $samlwinon = ''; |
|
my $samlwinoff = ' checked="checked"'; |
|
if ($samlwindow{$lonhost}) { |
|
$samlwinon = $samlwinoff; |
|
$samlwinoff = ''; |
|
} |
my $css_class = $itemcount%2?' class="LC_odd_row"':''; |
my $css_class = $itemcount%2?' class="LC_odd_row"':''; |
$datatable .= '<tr'.$css_class.'><td><span class="LC_nobreak">'.$domservers{$lonhost}.'</span></td>'. |
$datatable .= '<tr'.$css_class.'><td><span class="LC_nobreak">'.$domservers{$lonhost}.'</span></td>'. |
'<td><span class="LC_nobreak"><label><input type="radio" name="saml_'.$lonhost.'"'.$samloff. |
'<td><span class="LC_nobreak"><label><input type="radio" name="saml_'.$lonhost.'"'.$samloff. |
Line 1632 sub print_login {
|
Line 1676 sub print_login {
|
'onclick="toggleSamlOptions(this.form,'."'$lonhost'".');" value="1" />'. |
'onclick="toggleSamlOptions(this.form,'."'$lonhost'".');" value="1" />'. |
&mt('Yes').'</label></span></td>'. |
&mt('Yes').'</label></span></td>'. |
'<td id="samloptionson_'.$lonhost.'" style="'.$styleon{$lonhost}.'" width="100%">'. |
'<td id="samloptionson_'.$lonhost.'" style="'.$styleon{$lonhost}.'" width="100%">'. |
'<table><tr><th colspan="5" align="center">'.&mt('SSO').'</th><th align="center">'. |
'<table width="100%"><tr><th colspan="3" align="center">'.&mt('SSO').'</th></tr>'. |
'<span class="LC_nobreak">'.&mt('Non-SSO').'</span></th></tr>'. |
|
'<tr><th>'.&mt('Text').'</th><th>'.&mt('Image').'</th>'. |
'<tr><th>'.&mt('Text').'</th><th>'.&mt('Image').'</th>'. |
'<th>'.&mt('Alt Text').'</th><th>'.&mt('URL').'</th>'. |
'<th>'.&mt('Alt Text').'</th></tr>'. |
'<th>'.&mt('Tool Tip').'</th><th>'.&mt('Text').'</th></tr>'. |
'<tr'.$css_class.'><td><input type="text" name="saml_text_'.$lonhost.'" size="20" value="'. |
'<tr'.$css_class.'><td><input type="text" name="saml_text_'.$lonhost.'" size="8" value="'. |
|
$samltext{$lonhost}.'" /></td><td>'; |
$samltext{$lonhost}.'" /></td><td>'; |
if ($samlimg{$lonhost}) { |
if ($samlimg{$lonhost}) { |
$datatable .= '<img src="'.$samlimg{$lonhost}.'" /><br />'. |
$datatable .= '<img src="'.$samlimg{$lonhost}.'" /><br />'. |
Line 1654 sub print_login {
|
Line 1696 sub print_login {
|
$datatable .= '<input type="file" name="saml_img_'.$lonhost.'" />'; |
$datatable .= '<input type="file" name="saml_img_'.$lonhost.'" />'; |
} |
} |
$datatable .= '</td>'. |
$datatable .= '</td>'. |
'<td><input type="text" name="saml_alt_'.$lonhost.'" size="20" '. |
'<td><input type="text" name="saml_alt_'.$lonhost.'" size="25" '. |
'value="'.$samlalt{$lonhost}.'" /></td>'. |
'value="'.$samlalt{$lonhost}.'" /></td></tr></table><br />'. |
'<td><input type="text" name="saml_url_'.$lonhost.'" size="8" '. |
'<table width="100%"><tr><th colspan="3" align="center">'.&mt('SSO').'</th><th align="center">'. |
|
'<span class="LC_nobreak">'.&mt('Non-SSO').'</span></th></tr>'. |
|
'<tr><th>'.&mt('URL').'</th><th>'.&mt('Tool Tip').'</th>'. |
|
'<th>'.&mt('Pop-up if iframe').'</th><th>'.&mt('Text').'</th></tr>'. |
|
'<tr'.$css_class.'>'. |
|
'<td><input type="text" name="saml_url_'.$lonhost.'" size="30" '. |
'value="'.$samlurl{$lonhost}.'" /></td>'. |
'value="'.$samlurl{$lonhost}.'" /></td>'. |
'<td><textarea name="saml_title_'.$lonhost.'" rows="3" cols="15">'. |
'<td><textarea name="saml_title_'.$lonhost.'" rows="3" cols="20">'. |
$samltitle{$lonhost}.'</textarea></td>'. |
$samltitle{$lonhost}.'</textarea></td>'. |
'<td><input type="text" name="saml_notsso_'.$lonhost.'" size="8" '. |
'<td><label><input type="radio" name="saml_window_'.$lonhost.'" value=""'.$samlwinoff.'>'. |
|
&mt('No').'</label>'.(' 'x2).'<label><input type="radio" '. |
|
'name="saml_window_'.$lonhost.'" value="1"'.$samlwinon.'>'.&mt('Yes').'</label></td>'. |
|
'<td><input type="text" name="saml_notsso_'.$lonhost.'" size="12" '. |
'value="'.$samlnotsso{$lonhost}.'" /></td></tr>'. |
'value="'.$samlnotsso{$lonhost}.'" /></td></tr>'. |
'</table></td>'. |
'</table></td>'. |
'<td id="samloptionsoff_'.$lonhost.'" style="'.$styleoff{$lonhost}.'" width="100%"> </td></tr>'; |
'<td id="samloptionsoff_'.$lonhost.'" style="'.$styleoff{$lonhost}.'" width="100%"> </td></tr>'; |
Line 1705 sub login_choices {
|
Line 1755 sub login_choices {
|
current => "Current", |
current => "Current", |
samllanding => "Dual login?", |
samllanding => "Dual login?", |
samloptions => "Options", |
samloptions => "Options", |
|
alttext => "Alt text", |
); |
); |
return %choices; |
return %choices; |
} |
} |
Line 1893 sub commblocktype_text {
|
Line 1944 sub commblocktype_text {
|
'printout' => 'Printouts', |
'printout' => 'Printouts', |
'passwd' => 'Change Password', |
'passwd' => 'Change Password', |
'grades' => 'Gradebook', |
'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); |
return ($typeorder,\%types); |
} |
} |
|
|
Line 2047 sub display_color_options {
|
Line 2101 sub display_color_options {
|
$css_class = $itemcount%2?' class="LC_odd_row"':''; |
$css_class = $itemcount%2?' class="LC_odd_row"':''; |
$datatable .= '<tr'.$css_class.'>'. |
$datatable .= '<tr'.$css_class.'>'. |
'<td>'.$choices->{$img}; |
'<td>'.$choices->{$img}; |
my ($imgfile,$img_import,$login_hdr_pick,$logincolors); |
my ($imgfile,$img_import,$login_hdr_pick,$logincolors,$alttext); |
if ($role eq 'login') { |
if ($role eq 'login') { |
if ($img eq 'login') { |
if ($img eq 'login') { |
$login_hdr_pick = |
$login_hdr_pick = |
Line 2055 sub display_color_options {
|
Line 2109 sub display_color_options {
|
$logincolors = |
$logincolors = |
&login_text_colors($img,$role,$logintext,$phase,$choices, |
&login_text_colors($img,$role,$logintext,$phase,$choices, |
$designs,$defaults); |
$designs,$defaults); |
} elsif ($img ne 'domlogo') { |
} else { |
$datatable.= &logo_display_options($img,$defaults,$designs); |
if ($img ne 'domlogo') { |
|
$datatable.= &logo_display_options($img,$defaults,$designs); |
|
} |
|
if (ref($designs->{'alttext'}) eq 'HASH') { |
|
$alttext = $designs->{'alttext'}{$img}; |
|
} |
} |
} |
} |
} |
$datatable .= '</td>'; |
$datatable .= '</td>'; |
Line 2148 sub display_color_options {
|
Line 2207 sub display_color_options {
|
$datatable .=' <input type="file" name="'.$role.'_'.$img.'" />'; |
$datatable .=' <input type="file" name="'.$role.'_'.$img.'" />'; |
} |
} |
} |
} |
|
if (($role eq 'login') && ($img ne 'login')) { |
|
$datatable .= (' ' x2).' <span class="LC_nobreak"><label>'.$choices->{'alttext'}.':'. |
|
'<input type="text" name="'.$role.'_alt_'.$img.'" size="10" value="'.$alttext.'" />'. |
|
'</label></span>'; |
|
} |
$datatable .= '</td></tr>'; |
$datatable .= '</td></tr>'; |
} |
} |
$itemcount ++; |
$itemcount ++; |
Line 2319 sub print_quotas {
|
Line 2383 sub print_quotas {
|
@options = ('norequest','approval','automatic'); |
@options = ('norequest','approval','automatic'); |
%titles = &authorrequest_titles(); |
%titles = &authorrequest_titles(); |
} else { |
} else { |
@usertools = ('aboutme','blog','webdav','portfolio'); |
@usertools = ('aboutme','blog','webdav','portfolio','timezone'); |
%titles = &tool_titles(); |
%titles = &tool_titles(); |
} |
} |
if (ref($types) eq 'ARRAY') { |
if (ref($types) eq 'ARRAY') { |
Line 2423 sub print_quotas {
|
Line 2487 sub print_quotas {
|
} |
} |
} else { |
} else { |
my $checked = 'checked="checked" '; |
my $checked = 'checked="checked" '; |
|
if ($item eq 'timezone') { |
|
$checked = ''; |
|
} |
if (ref($settings) eq 'HASH') { |
if (ref($settings) eq 'HASH') { |
if (ref($settings->{$item}) eq 'HASH') { |
if (ref($settings->{$item}) eq 'HASH') { |
if ($settings->{$item}->{$type} == 0) { |
if (!$settings->{$item}->{$type}) { |
$checked = ''; |
$checked = ''; |
} elsif ($settings->{$item}->{$type} == 1) { |
} elsif ($settings->{$item}->{$type} == 1) { |
$checked = 'checked="checked" '; |
$checked = 'checked="checked" '; |
Line 3362 ENDSCRIPT
|
Line 3429 ENDSCRIPT
|
|
|
|
|
sub lti_javascript { |
sub lti_javascript { |
my ($settings) = @_; |
my ($dom,$settings) = @_; |
my $togglejs = <i_toggle_js(); |
my $togglejs = <i_toggle_js($dom); |
unless (ref($settings) eq 'HASH') { |
unless (ref($settings) eq 'HASH') { |
return $togglejs; |
return $togglejs; |
} |
} |
Line 3383 sub lti_javascript {
|
Line 3450 sub lti_javascript {
|
push(@jsarray,$ordered{$item}); |
push(@jsarray,$ordered{$item}); |
} |
} |
my $jstext = ' var lti = Array('."'".join("','",@jsarray)."'".');'."\n"; |
my $jstext = ' var lti = Array('."'".join("','",@jsarray)."'".');'."\n"; |
|
my $linkprot_js = &Apache::courseprefs::linkprot_javascript(); |
return <<"ENDSCRIPT"; |
return <<"ENDSCRIPT"; |
<script type="text/javascript"> |
<script type="text/javascript"> |
// <![CDATA[ |
// <![CDATA[ |
Line 3427 $jstext
|
Line 3495 $jstext
|
} |
} |
return; |
return; |
} |
} |
|
|
|
$linkprot_js |
|
|
// ]]> |
// ]]> |
</script> |
</script> |
|
|
Line 3436 ENDSCRIPT
|
Line 3507 ENDSCRIPT
|
} |
} |
|
|
sub lti_toggle_js { |
sub lti_toggle_js { |
|
my ($dom) = @_; |
my %lcauthparmtext = &Apache::lonlocal::texthash ( |
my %lcauthparmtext = &Apache::lonlocal::texthash ( |
localauth => 'Local auth argument', |
localauth => 'Local auth argument', |
krb => 'Kerberos domain', |
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"); |
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); |
&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"; |
return <<"ENDSCRIPT"; |
<script type="text/javascript"> |
<script type="text/javascript"> |
// <![CDATA[ |
// <![CDATA[ |
Line 3644 function toggleLTI(form,setting,item) {
|
Line 3720 function toggleLTI(form,setting,item) {
|
} |
} |
return; |
return; |
} |
} |
|
|
|
function toggleLTIEncKey(form) { |
|
var shownhosts = new Array(); |
|
var hiddenhosts = new Array(); |
|
var forcourse = new Array($course_servers); |
|
var fromdomain = '$primary'; |
|
var crsradio = form.elements['ltisec_crslinkprot']; |
|
if (crsradio.length) { |
|
for (var i=0; i<crsradio.length; i++) { |
|
if (crsradio[i].checked) { |
|
if (crsradio[i].value == 1) { |
|
if (forcourse.length > 0) { |
|
for (var j=0; j<forcourse.length; j++) { |
|
if (!shownhosts.includes(forcourse[j])) { |
|
shownhosts.push(forcourse[j]); |
|
} |
|
} |
|
} |
|
} else { |
|
if (forcourse.length > 0) { |
|
for (var j=0; j<forcourse.length; j++) { |
|
if (!hiddenhosts.includes(forcourse[j])) { |
|
hiddenhosts.push(forcourse[j]); |
|
} |
|
} |
|
} |
|
} |
|
} |
|
} |
|
} |
|
var domradio = form.elements['ltisec_domlinkprot']; |
|
if (domradio.length) { |
|
for (var i=0; i<domradio.length; i++) { |
|
if (domradio[i].checked) { |
|
if (domradio[i].value == 1) { |
|
if (!shownhosts.includes(fromdomain)) { |
|
shownhosts.push(fromdomain); |
|
} |
|
} else { |
|
if (!hiddenhosts.includes(fromdomain)) { |
|
hiddenhosts.push(fromdomain); |
|
} |
|
} |
|
} |
|
} |
|
} |
|
var consumersradio = form.elements['ltisec_consumers']; |
|
if (consumersradio.length) { |
|
for (var i=0; i<consumersradio.length; i++) { |
|
if (consumersradio[i].checked) { |
|
if (consumersradio[i].value == 1) { |
|
if (!shownhosts.includes(fromdomain)) { |
|
shownhosts.push(fromdomain); |
|
} |
|
} else { |
|
if (!hiddenhosts.includes(fromdomain)) { |
|
hiddenhosts.push(fromdomain); |
|
} |
|
} |
|
} |
|
} |
|
} |
|
if (shownhosts.length > 0) { |
|
for (var i=0; i<shownhosts.length; i++) { |
|
if (document.getElementById('ltisec_info_'+shownhosts[i])) { |
|
document.getElementById('ltisec_info_'+shownhosts[i]).style.display = 'block'; |
|
} |
|
} |
|
if (document.getElementById('ltisec_noprivkey')) { |
|
document.getElementById('ltisec_noprivkey').style.display = 'none'; |
|
} |
|
} else { |
|
if (document.getElementById('ltisec_noprivkey')) { |
|
document.getElementById('ltisec_noprivkey').style.display = 'inline-block'; |
|
} |
|
} |
|
if (hiddenhosts.length > 0) { |
|
for (var i=0; i<hiddenhosts.length; i++) { |
|
if (!shownhosts.includes(hiddenhosts[i])) { |
|
if (document.getElementById('ltisec_info_'+hiddenhosts[i])) { |
|
document.getElementById('ltisec_info_'+hiddenhosts[i]).style.display = 'none'; |
|
} |
|
} |
|
} |
|
} |
|
return; |
|
} |
|
|
|
function togglePrivKey(form,hostid) { |
|
var radioname = ''; |
|
var currdivid = ''; |
|
var newdivid = ''; |
|
if ((document.getElementById('ltisec_divcurrprivkey_'+hostid)) && |
|
(document.getElementById('ltisec_divchgprivkey_'+hostid))) { |
|
currdivid = document.getElementById('ltisec_divcurrprivkey_'+hostid); |
|
newdivid = document.getElementById('ltisec_divchgprivkey_'+hostid); |
|
radioname = form.elements['ltisec_changeprivkey_'+hostid]; |
|
if (radioname) { |
|
if (radioname.length > 0) { |
|
var setvis; |
|
for (var i=0; i<radioname.length; i++) { |
|
if (radioname[i].checked == true) { |
|
if (radioname[i].value == 1) { |
|
newdivid.style.display = 'inline-block'; |
|
currdivid.style.display = 'none'; |
|
setvis = 1; |
|
} |
|
break; |
|
} |
|
} |
|
if (!setvis) { |
|
newdivid.style.display = 'none'; |
|
currdivid.style.display = 'inline-block'; |
|
} |
|
} |
|
} |
|
} |
|
} |
|
|
// ]]> |
// ]]> |
</script> |
</script> |
|
|
Line 3685 function toggleLastActiveDays(form) {
|
Line 3880 function toggleLastActiveDays(form) {
|
ENDSCRIPT |
ENDSCRIPT |
} |
} |
|
|
|
sub autoenroll_javascript { |
|
return <<"ENDSCRIPT"; |
|
<script type="text/javascript"> |
|
// <![CDATA[ |
|
function toggleFailsafe(form) { |
|
var radioname = 'autoenroll_failsafe'; |
|
var divid = 'autoenroll_failsafe_div'; |
|
var num = form.elements[radioname].length; |
|
if (num) { |
|
var setvis = ''; |
|
for (var i=0; i<num; i++) { |
|
if (form.elements[radioname][i].checked) { |
|
if ((form.elements[radioname][i].value == 'zero') || (form.elements[radioname][i].value == 'any')) { |
|
if (document.getElementById(divid)) { |
|
document.getElementById(divid).style.display = 'inline-block'; |
|
} |
|
setvis = 1; |
|
} |
|
break; |
|
} |
|
} |
|
if (!setvis) { |
|
if (document.getElementById(divid)) { |
|
document.getElementById(divid).style.display = 'none'; |
|
} |
|
} |
|
} |
|
return; |
|
} |
|
// ]]> |
|
</script> |
|
|
|
ENDSCRIPT |
|
} |
|
|
sub saml_javascript { |
sub saml_javascript { |
return <<"ENDSCRIPT"; |
return <<"ENDSCRIPT"; |
<script type="text/javascript"> |
<script type="text/javascript"> |
Line 3798 ENDSCRIPT
|
Line 4028 ENDSCRIPT
|
sub print_autoenroll { |
sub print_autoenroll { |
my ($dom,$settings,$rowtotal) = @_; |
my ($dom,$settings,$rowtotal) = @_; |
my $autorun = &Apache::lonnet::auto_run(undef,$dom), |
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 (ref($settings) eq 'HASH') { |
if (exists($settings->{'run'})) { |
if (exists($settings->{'run'})) { |
if ($settings->{'run'} eq '0') { |
if ($settings->{'run'} eq '0') { |
Line 3832 sub print_autoenroll {
|
Line 4067 sub print_autoenroll {
|
if (exists($settings->{'sender_domain'})) { |
if (exists($settings->{'sender_domain'})) { |
$defdom = $settings->{'sender_domain'}; |
$defdom = $settings->{'sender_domain'}; |
} |
} |
if (exists($settings->{'autofailsafe'})) { |
if (exists($settings->{'failsafe'})) { |
$failsafe = $settings->{'autofailsafe'}; |
$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 { |
} else { |
if ($autorun) { |
if ($autorun) { |
Line 3872 sub print_autoenroll {
|
Line 4123 sub print_autoenroll {
|
$coownersoff.' value="0" />'.&mt('No').'</label></span></td>'. |
$coownersoff.' value="0" />'.&mt('No').'</label></span></td>'. |
'</tr><tr>'. |
'</tr><tr>'. |
'<td>'.&mt('Failsafe for no drops when institutional data missing').'</td>'. |
'<td>'.&mt('Failsafe for no drops when institutional data missing').'</td>'. |
'<td class="LC_right_item"><span class="LC_nobreak">'. |
'<td class="LC_left_item"><span class="LC_nobreak">'. |
'<input type="text" name="autoenroll_failsafe"'. |
'<span class="LC_nobreak"><label><input type="radio" name="autoenroll_failsafe" value="off" onclick="toggleFailsafe(this.form)"'.$failsafechecked{'off'}.' />'.&mt('Not in use').'</label></span> '. |
' value="'.$failsafe.'" size="4" /></span></td></tr>'; |
'<span class="LC_nobreak"><label><input type="radio" name="autoenroll_failsafe" value="zero" onclick="toggleFailsafe(this.form)"'.$failsafechecked{'zero'}.' />'.&mt('Retrieved section enrollment is zero').'</label></span><br />'. |
|
'<span class="LC_nobreak"><label><input type="radio" name="autoenroll_failsafe" value="any" onclick="toggleFailsafe(this.form)"'.$failsafechecked{'any'}.' />'.&mt('Retrieved section enrollment is zero or greater').'</label></span>'. |
|
'<div class="LC_floatleft" style="display:'.$failsafesty.';" id="autoenroll_failsafe_div">'. |
|
'<span class="LC_nobreak">'. |
|
&mt('Threshold for number of students in section to drop: [_1]', |
|
'<input type="text" name="autoenroll_autofailsafe" value="'.$autofailsafe.'" size="4" />'). |
|
'</span></div></td></tr>'; |
$$rowtotal += 4; |
$$rowtotal += 4; |
return $datatable; |
return $datatable; |
} |
} |
Line 3902 sub print_autoupdate {
|
Line 4159 sub print_autoupdate {
|
'<td>'.$choices{'run'}.'</td>'. |
'<td>'.$choices{'run'}.'</td>'. |
'<td class="LC_left_item"><span class="LC_nobreak"><label>'. |
'<td class="LC_left_item"><span class="LC_nobreak"><label>'. |
'<input type="radio" name="autoupdate_run"'. |
'<input type="radio" name="autoupdate_run"'. |
$updateoff.' value="0" />'.&mt('No').'</label> '. |
$updateoff.'value="0" />'.&mt('No').'</label> '. |
'<label><input type="radio" name="autoupdate_run"'. |
'<label><input type="radio" name="autoupdate_run"'. |
$updateon.'value="1" />'.&mt('Yes').'</label></span></td>'. |
$updateon.'value="1" />'.&mt('Yes').'</label></span></td>'. |
'</tr>'; |
'</tr>'; |
Line 6222 sub proctoring_providernames {
|
Line 6479 sub proctoring_providernames {
|
} |
} |
|
|
sub print_lti { |
sub print_lti { |
my ($dom,$settings,$rowtotal) = @_; |
my ($position,$dom,$settings,$rowtotal) = @_; |
my $itemcount = 1; |
my $itemcount = 1; |
my $maxnum = 0; |
my ($datatable,$css_class); |
my $css_class; |
my (%rules,%encrypt,%privkeys,%linkprot); |
my %ordered; |
|
if (ref($settings) eq 'HASH') { |
if (ref($settings) eq 'HASH') { |
foreach my $item (keys(%{$settings})) { |
if ($position eq 'top') { |
if (ref($settings->{$item}) eq 'HASH') { |
if (exists($settings->{'encrypt'})) { |
my $num = $settings->{$item}{'order'}; |
if (ref($settings->{'encrypt'}) eq 'HASH') { |
if ($num eq '') { |
foreach my $key (keys(%{$settings->{'encrypt'}})) { |
$num = scalar(keys(%{$settings})); |
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}); |
} |
} |
$ordered{$num} = $item; |
|
} |
} |
} |
} |
} |
} |
my $maxnum = scalar(keys(%ordered)); |
if ($position eq 'top') { |
my $datatable; |
my @ids=&Apache::lonnet::current_machine_ids(); |
my %lt = <i_names(); |
my %servers = &Apache::lonnet::get_servers($dom,'library'); |
if (keys(%ordered)) { |
my $primary = &Apache::lonnet::domain($dom,'primary'); |
my @items = sort { $a <=> $b } keys(%ordered); |
my ($extra,$numshown); |
for (my $i=0; $i<@items; $i++) { |
foreach my $hostid (sort(keys(%servers))) { |
$css_class = $itemcount%2?' class="LC_odd_row"':''; |
my ($showextra,$divsty,$switch); |
my $item = $ordered{$items[$i]}; |
if ($hostid eq $primary) { |
my ($key,$secret,$lifetime,$consumer,$requser,$crsinc,$current); |
if (($encrypt{'ltisec_consumers'}) || ($encrypt{'ltisec_domlinkprot'})) { |
if (ref($settings->{$item}) eq 'HASH') { |
$showextra = 1; |
$key = $settings->{$item}->{'key'}; |
} |
$secret = $settings->{$item}->{'secret'}; |
} |
$lifetime = $settings->{$item}->{'lifetime'}; |
if ($encrypt{'ltisec_crslinkprot'}) { |
$consumer = $settings->{$item}->{'consumer'}; |
$showextra = 1; |
$requser = $settings->{$item}->{'requser'}; |
} |
$crsinc = $settings->{$item}->{'crsinc'}; |
unless (grep(/^\Q$hostid\E$/,@ids)) { |
$current = $settings->{$item}; |
$switch = 1; |
} |
} |
my $onclickrequser = ' onclick="toggleLTI(this.form,'."'requser','$i'".');"'; |
if ($showextra) { |
my %checkedrequser = ( |
$numshown ++; |
yes => ' checked="checked"', |
$divsty = 'display:inline-block'; |
no => '', |
} else { |
); |
$divsty = 'display:none'; |
if (!$requser) { |
} |
$checkedrequser{'no'} = $checkedrequser{'yes'}; |
$extra .= '<fieldset id="ltisec_info_'.$hostid.'" style="'.$divsty.'">'. |
$checkedrequser{'yes'} = ''; |
'<legend>'.$hostid.'</legend>'; |
|
if ($switch) { |
|
my $switchserver = '<a href="/adm/switchserver?otherserver='.$hostid.'&role='. |
|
&HTML::Entities::encode($env{'request.role'},'\'<>"&'). |
|
'&destinationurl=/adm/domainprefs">'.&mt('Switch Server').'</a>'; |
|
if (exists($privkeys{$hostid})) { |
|
$extra .= '<div id="ltisec_divcurrprivkey_'.$hostid.'" style="display:inline-block" />'. |
|
'<span class="LC_nobreak">'. |
|
&mt('Encryption Key').': ['.&mt('not shown').'] '.(' 'x2).'</span></div>'. |
|
'<span class="LC_nobreak">'.&mt('Change?'). |
|
'<label><input type="radio" value="0" name="ltisec_changeprivkey_'.$hostid.'" onclick="javascript:togglePrivKey(this.form,'."'$hostid'".');" checked="checked" />'.&mt('No').'</label>'. |
|
(' 'x2). |
|
'<label><input type="radio" value="1" name="ltisec_changeprivkey_'.$hostid.'" onclick="javascript:togglePrivKey(this.form,'."'$hostid'".');" />'.&mt('Yes'). |
|
'</label> </span><div id="ltisec_divchgprivkey_'.$hostid.'" style="display:none" />'. |
|
'<span class="LC_nobreak"> - '.&mt('submit from server ([_1]): [_2].',$hostid,$switchserver). |
|
'</span></div>'; |
|
} else { |
|
$extra .= '<span class="LC_nobreak">'. |
|
&mt('Key required').' - '.&mt('submit from server ([_1]): [_2].',$hostid,$switchserver). |
|
'</span>'."\n"; |
|
} |
|
} elsif (exists($privkeys{$hostid})) { |
|
$extra .= '<div id="ltisec_divcurrprivkey_'.$hostid.'" style="display:inline-block" /><span class="LC_nobreak">'. |
|
&mt('Encryption Key').': ['.&mt('not shown').'] '.(' 'x2).'</span></div>'. |
|
'<span class="LC_nobreak">'.&mt('Change?'). |
|
'<label><input type="radio" value="0" name="ltisec_changeprivkey_'.$hostid.'" onclick="javascript:togglePrivKey(this.form,'."'$hostid'".');" checked="checked" />'.&mt('No').'</label>'. |
|
(' 'x2). |
|
'<label><input type="radio" value="1" name="ltisec_changeprivkey_'.$hostid.'" onclick="javascript:togglePrivKey(this.form,'."'$hostid'".');" />'.&mt('Yes'). |
|
'</label> </span><div id="ltisec_divchgprivkey_'.$hostid.'" style="display:none" />'. |
|
'<span class="LC_nobreak">'.&mt('New Key').':'. |
|
'<input type="password" size="20" name="ltisec_privkey_'.$hostid.'" value="" autocomplete="off" />'. |
|
'<label><input type="checkbox" name="visible" onclick="if (this.checked) { this.form.ltisec_privkey_'.$hostid.'.type='."'text'".' } else { this.form.ltisec_privkey_'.$hostid.'.type='."'password'".' }" />'.&mt('Visible input').'</label>'. |
|
'</span></div>'; |
|
} else { |
|
$extra .= '<span class="LC_nobreak">'.&mt('Encryption Key').':'. |
|
'<input type="password" size="20" name="ltisec_privkey_'.$hostid.'" value="" autocomplete="off" />'. |
|
'<label><input type="checkbox" name="visible" onclick="if (this.checked) { this.form.ltisec_privkey_'.$hostid.'.type='."'text'".' } else { this.form.ltisec_privkey_'.$hostid.'.type='."'password'".' }" />'.&mt('Visible input').'</label>'; |
} |
} |
my $onclickcrsinc = ' onclick="toggleLTI(this.form,'."'crsinc','$i'".');"'; |
$extra .= '</fieldset>'; |
my %checkedcrsinc = ( |
} |
|
my %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', |
|
); |
|
my @toggles = qw(ltisec_crslinkprot ltisec_domlinkprot ltisec_consumers); |
|
my %defaultchecked = ( |
|
'ltisec_crslinkprot' => 'off', |
|
'ltisec_domlinkprot' => 'off', |
|
'ltisec_consumers' => 'off', |
|
); |
|
my ($onclick,$itemcount); |
|
$onclick = 'javascript:toggleLTIEncKey(this.form);'; |
|
($datatable,$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'; |
|
} |
|
$datatable .= '<tr '.$css_class.'><td><span class="LC_nobreak">'.&mt('Encryption Key(s)').'</td>'. |
|
'<td><div id="ltisec_noprivkey" style="'.$noprivkeysty.'" >'. |
|
'<span class="LC_nobreak">'.&mt('Not in use').'</span></div>'. |
|
$extra. |
|
'</td></tr>'; |
|
$itemcount ++; |
|
$$rowtotal += $itemcount; |
|
} elsif ($position eq 'middle') { |
|
$datatable = &password_rules('secrets',\$itemcount,\%rules); |
|
$$rowtotal += $itemcount; |
|
} elsif ($position eq 'lower') { |
|
$datatable .= &Apache::courseprefs::print_linkprotection($dom,'',$settings,$rowtotal,'','','domain'); |
|
} else { |
|
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,$lifetime,$consumer,$requser,$crsinc,$current); |
|
if (ref($settings->{$item}) eq 'HASH') { |
|
$key = $settings->{$item}->{'key'}; |
|
$secret = $settings->{$item}->{'secret'}; |
|
$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"', |
yes => ' checked="checked"', |
no => '', |
no => '', |
); |
); |
if (!$crsinc) { |
if (!$crsinc) { |
$checkedcrsinc{'no'} = $checkedcrsinc{'yes'}; |
$checkedcrsinc{'no'} = $checkedcrsinc{'yes'}; |
$checkedcrsinc{'yes'} = ''; |
$checkedcrsinc{'yes'} = ''; |
} |
} |
my $chgstr = ' onchange="javascript:reorderLTI(this.form,'."'lti_pos_".$item."'".');"'; |
my $chgstr = ' onchange="javascript:reorderLTI(this.form,'."'lti_pos_".$item."'".');"'; |
$datatable .= '<tr '.$css_class.'><td><span class="LC_nobreak">' |
$datatable .= '<tr '.$css_class.'><td><span class="LC_nobreak">' |
.'<select name="lti_pos_'.$item.'"'.$chgstr.'>'; |
.'<select name="lti_pos_'.$item.'"'.$chgstr.'>'; |
for (my $k=0; $k<=$maxnum; $k++) { |
for (my $k=0; $k<=$maxnum; $k++) { |
my $vpos = $k+1; |
my $vpos = $k+1; |
my $selstr; |
my $selstr; |
if ($k == $i) { |
if ($k == $i) { |
$selstr = ' selected="selected" '; |
$selstr = ' selected="selected" '; |
|
} |
|
$datatable .= '<option value="'.$k.'"'.$selstr.'>'.$vpos.'</option>'; |
} |
} |
$datatable .= '<option value="'.$k.'"'.$selstr.'>'.$vpos.'</option>'; |
$datatable .= '</select>'.(' 'x2). |
|
'<label><input type="checkbox" name="lti_del" value="'.$item.'" />'. |
|
&mt('Delete?').'</label></span></td>'. |
|
'<td colspan="2">'. |
|
'<fieldset><legend>'.&mt('Required settings').'</legend>'. |
|
'<span class="LC_nobreak">'.$lt{'consumer'}. |
|
':<input type="text" size="15" name="lti_consumer_'.$i.'" value="'.$consumer.'" /></span> '. |
|
(' 'x2). |
|
'<span class="LC_nobreak">'.$lt{'version'}.':<select name="lti_version_'.$i.'">'. |
|
'<option value="LTI-1p0" selected="selected">1.1</option></select></span> '. |
|
(' 'x2). |
|
'<span class="LC_nobreak">'.$lt{'lifetime'}.':<input type="text" name="lti_lifetime_'.$i.'"'. |
|
'value="'.$lifetime.'" size="3" /></span>'. |
|
(' 'x2). |
|
'<span class="LC_nobreak">'.$lt{'requser'}.':'. |
|
'<label><input type="radio" name="lti_requser_'.$i.'" value="1"'.$onclickrequser.$checkedrequser{yes}.' />'.&mt('Yes').'</label> '."\n". |
|
'<label><input type="radio" name="lti_requser_'.$i.'" value="0"'.$onclickrequser.$checkedrequser{no}.' />'.&mt('No').'</label></span>'."\n". |
|
'<br /><br />'. |
|
'<span class="LC_nobreak">'.$lt{'crsinc'}.':'. |
|
'<label><input type="radio" name="lti_crsinc_'.$i.'" value="1"'.$onclickcrsinc.$checkedcrsinc{yes}.' />'.&mt('Yes').'</label> '."\n". |
|
'<label><input type="radio" name="lti_crsinc_'.$i.'" value="0"'.$onclickcrsinc.$checkedcrsinc{no}.' />'.&mt('No').'</label></span>'."\n". |
|
(' 'x4). |
|
'<span class="LC_nobreak">'.$lt{'key'}. |
|
':<input type="text" size="25" name="lti_key_'.$i.'" value="'.$key.'" /></span> '. |
|
(' 'x2). |
|
'<span class="LC_nobreak">'.$lt{'secret'}.':'. |
|
'<input type="password" size="20" name="lti_secret_'.$i.'" value="'.$secret.'" />'. |
|
'<label><input type="checkbox" name="visible" onclick="if (this.checked) { this.form.lti_secret_'.$i.'.type='."'text'".' } else { this.form.lti_secret_'.$i.'.type='."'password'".' }" />'.&mt('Visible input').'</label>'. |
|
'<input type="hidden" name="lti_id_'.$i.'" value="'.$item.'" /></span>'. |
|
'</fieldset>'.<i_options($i,$current,$itemcount,%lt).'</td></tr>'; |
|
$itemcount ++; |
} |
} |
$datatable .= '</select>'.(' 'x2). |
|
'<label><input type="checkbox" name="lti_del" value="'.$item.'" />'. |
|
&mt('Delete?').'</label></span></td>'. |
|
'<td colspan="2">'. |
|
'<fieldset><legend>'.&mt('Required settings').'</legend>'. |
|
'<span class="LC_nobreak">'.$lt{'consumer'}. |
|
':<input type="text" size="15" name="lti_consumer_'.$i.'" value="'.$consumer.'" /></span> '. |
|
(' 'x2). |
|
'<span class="LC_nobreak">'.$lt{'version'}.':<select name="lti_version_'.$i.'">'. |
|
'<option value="LTI-1p0" selected="selected">1.1</option></select></span> '. |
|
(' 'x2). |
|
'<span class="LC_nobreak">'.$lt{'lifetime'}.':<input type="text" name="lti_lifetime_'.$i.'"'. |
|
'value="'.$lifetime.'" size="3" /></span>'. |
|
(' 'x2). |
|
'<span class="LC_nobreak">'.$lt{'requser'}.':'. |
|
'<label><input type="radio" name="lti_requser_'.$i.'" value="1"'.$onclickrequser.$checkedrequser{yes}.' />'.&mt('Yes').'</label> '."\n". |
|
'<label><input type="radio" name="lti_requser_'.$i.'" value="0"'.$onclickrequser.$checkedrequser{no}.' />'.&mt('No').'</label></span>'."\n". |
|
'<br /><br />'. |
|
'<span class="LC_nobreak">'.$lt{'crsinc'}.':'. |
|
'<label><input type="radio" name="lti_crsinc_'.$i.'" value="1"'.$onclickcrsinc.$checkedcrsinc{yes}.' />'.&mt('Yes').'</label> '."\n". |
|
'<label><input type="radio" name="lti_crsinc_'.$i.'" value="0"'.$onclickcrsinc.$checkedcrsinc{no}.' />'.&mt('No').'</label></span>'."\n". |
|
(' 'x4). |
|
'<span class="LC_nobreak">'.$lt{'key'}. |
|
':<input type="text" size="25" name="lti_key_'.$i.'" value="'.$key.'" /></span> '. |
|
(' 'x2). |
|
'<span class="LC_nobreak">'.$lt{'secret'}.':'. |
|
'<input type="password" size="20" name="lti_secret_'.$i.'" value="'.$secret.'" />'. |
|
'<label><input type="checkbox" name="visible" onclick="if (this.checked) { this.form.lti_secret_'.$i.'.type='."'text'".' } else { this.form.lti_secret_'.$i.'.type='."'password'".' }" />'.&mt('Visible input').'</label>'. |
|
'<input type="hidden" name="lti_id_'.$i.'" value="'.$item.'" /></span>'. |
|
'</fieldset>'.<i_options($i,$current,$itemcount,%lt).'</td></tr>'; |
|
$itemcount ++; |
|
} |
} |
} |
$css_class = $itemcount%2?' class="LC_odd_row"':''; |
$css_class = $itemcount%2?' class="LC_odd_row"':''; |
my $chgstr = ' onchange="javascript:reorderLTI(this.form,'."'lti_pos_add'".');"'; |
my $chgstr = ' onchange="javascript:reorderLTI(this.form,'."'lti_pos_add'".');"'; |
$datatable .= '<tr '.$css_class.'><td><span class="LC_nobreak">'."\n". |
$datatable .= '<tr '.$css_class.'><td><span class="LC_nobreak">'."\n". |
'<input type="hidden" name="lti_maxnum" value="'.$maxnum.'" />'."\n". |
'<input type="hidden" name="lti_maxnum" value="'.$maxnum.'" />'."\n". |
'<select name="lti_pos_add"'.$chgstr.'>'; |
'<select name="lti_pos_add"'.$chgstr.'>'; |
for (my $k=0; $k<$maxnum+1; $k++) { |
for (my $k=0; $k<$maxnum+1; $k++) { |
my $vpos = $k+1; |
my $vpos = $k+1; |
my $selstr; |
my $selstr; |
if ($k == $maxnum) { |
if ($k == $maxnum) { |
$selstr = ' selected="selected" '; |
$selstr = ' selected="selected" '; |
} |
|
$datatable .= '<option value="'.$k.'"'.$selstr.'>'.$vpos.'</option>'; |
} |
} |
$datatable .= '<option value="'.$k.'"'.$selstr.'>'.$vpos.'</option>'; |
$datatable .= '</select> '."\n". |
|
'<input type="checkbox" name="lti_add" value="1" />'.&mt('Add').'</span></td>'."\n". |
|
'<td colspan="2">'. |
|
'<fieldset><legend>'.&mt('Required settings').'</legend>'. |
|
'<span class="LC_nobreak">'.$lt{'consumer'}. |
|
':<input type="text" size="15" name="lti_consumer_add" value="" /></span> '."\n". |
|
(' 'x2). |
|
'<span class="LC_nobreak">'.$lt{'version'}.':<select name="lti_version_add">'. |
|
'<option value="LTI-1p0" selected="selected">1.1</option></select></span> '."\n". |
|
(' 'x2). |
|
'<span class="LC_nobreak">'.$lt{'lifetime'}.':<input type="text" size="3" name="lti_lifetime_add" value="300" /></span> '."\n". |
|
(' 'x2). |
|
'<span class="LC_nobreak">'.$lt{'requser'}.':'. |
|
'<label><input type="radio" name="lti_requser_add" value="1" onclick="toggleLTI(this.form,'."'requser','add'".');" checked="checked" />'.&mt('Yes').'</label> '."\n". |
|
'<label><input type="radio" name="lti_requser_add" value="0" onclick="toggleLTI(this.form,'."'requser','add'".');" />'.&mt('No').'</label></span>'."\n". |
|
'<br /><br />'. |
|
'<span class="LC_nobreak">'.$lt{'crsinc'}.':'. |
|
'<label><input type="radio" name="lti_crsinc_add" value="1" onclick="toggleLTI(this.form,'."'crsinc','add'".');" checked="checked" />'.&mt('Yes').'</label> '."\n". |
|
'<label><input type="radio" name="lti_crsinc_add" value="0" onclick="toggleLTI(this.form,'."'crsinc','add'".');" />'.&mt('No').'</label></span>'."\n". |
|
(' 'x4). |
|
'<span class="LC_nobreak">'.$lt{'key'}.':<input type="text" size="25" name="lti_key_add" value="" /></span> '."\n". |
|
(' 'x2). |
|
'<span class="LC_nobreak">'.$lt{'secret'}.':<input type="password" size="20" name="lti_secret_add" value="" />'. |
|
'<label><input type="checkbox" name="visible" onclick="if (this.checked) { this.form.lti_secret_add.type='."'text'".' } else { this.form.lti_secret_add.type='."'password'".' }" />'.&mt('Visible input').'</label></span> '."\n". |
|
'</fieldset>'.<i_options('add',undef,$itemcount,%lt). |
|
'</td>'."\n". |
|
'</tr>'."\n"; |
|
$itemcount ++; |
} |
} |
$datatable .= '</select> '."\n". |
$$rowtotal += $itemcount; |
'<input type="checkbox" name="lti_add" value="1" />'.&mt('Add').'</span></td>'."\n". |
return $datatable; |
'<td colspan="2">'. |
|
'<fieldset><legend>'.&mt('Required settings').'</legend>'. |
|
'<span class="LC_nobreak">'.$lt{'consumer'}. |
|
':<input type="text" size="15" name="lti_consumer_add" value="" /></span> '."\n". |
|
(' 'x2). |
|
'<span class="LC_nobreak">'.$lt{'version'}.':<select name="lti_version_add">'. |
|
'<option value="LTI-1p0" selected="selected">1.1</option></select></span> '."\n". |
|
(' 'x2). |
|
'<span class="LC_nobreak">'.$lt{'lifetime'}.':<input type="text" size="3" name="lti_lifetime_add" value="300" /></span> '."\n". |
|
(' 'x2). |
|
'<span class="LC_nobreak">'.$lt{'requser'}.':'. |
|
'<label><input type="radio" name="lti_requser_add" value="1" onclick="toggleLTI(this.form,'."'requser','add'".');" checked="checked" />'.&mt('Yes').'</label> '."\n". |
|
'<label><input type="radio" name="lti_requser_add" value="0" onclick="toggleLTI(this.form,'."'requser','add'".');" />'.&mt('No').'</label></span>'."\n". |
|
'<br /><br />'. |
|
'<span class="LC_nobreak">'.$lt{'crsinc'}.':'. |
|
'<label><input type="radio" name="lti_crsinc_add" value="1" onclick="toggleLTI(this.form,'."'crsinc','add'".');" checked="checked" />'.&mt('Yes').'</label> '."\n". |
|
'<label><input type="radio" name="lti_crsinc_add" value="0" onclick="toggleLTI(this.form,'."'crsinc','add'".');" />'.&mt('No').'</label></span>'."\n". |
|
(' 'x4). |
|
'<span class="LC_nobreak">'.$lt{'key'}.':<input type="text" size="25" name="lti_key_add" value="" /></span> '."\n". |
|
(' 'x2). |
|
'<span class="LC_nobreak">'.$lt{'secret'}.':<input type="password" size="20" name="lti_secret_add" value="" />'. |
|
'<label><input type="checkbox" name="visible" onclick="if (this.checked) { this.form.lti_secret_add.type='."'text'".' } else { this.form.lti_secret_add.type='."'password'".' }" />'.&mt('Visible input').'</label></span> '."\n". |
|
'</fieldset>'.<i_options('add',undef,$itemcount,%lt). |
|
'</td>'."\n". |
|
'</tr>'."\n"; |
|
$$rowtotal ++; |
|
return $datatable;; |
|
} |
} |
|
|
sub lti_names { |
sub lti_names { |
Line 6761 sub ltimenu_titles {
|
Line 7164 sub ltimenu_titles {
|
); |
); |
} |
} |
|
|
|
sub check_switchserver { |
|
my ($home) = @_; |
|
my $switchserver; |
|
if ($home ne '') { |
|
my $allowed; |
|
my @ids=&Apache::lonnet::current_machine_ids(); |
|
foreach my $id (@ids) { if ($id eq $home) { $allowed=1; } } |
|
if (!$allowed) { |
|
$switchserver='<a href="/adm/switchserver?otherserver='.$home.'&role='. |
|
&HTML::Entities::encode($env{'request.role'},'\'<>"&'). |
|
'&destinationurl=/adm/domainprefs">'.&mt('Switch Server').'</a>'; |
|
} |
|
} |
|
return $switchserver; |
|
} |
|
|
sub print_coursedefaults { |
sub print_coursedefaults { |
my ($position,$dom,$settings,$rowtotal) = @_; |
my ($position,$dom,$settings,$rowtotal) = @_; |
my ($css_class,$datatable,%checkedon,%checkedoff,%defaultchecked,@toggles); |
my ($css_class,$datatable,%checkedon,%checkedoff,%defaultchecked,@toggles); |
Line 6772 sub print_coursedefaults {
|
Line 7191 sub print_coursedefaults {
|
coursecredits => 'Credits can be specified for courses', |
coursecredits => 'Credits can be specified for courses', |
uselcmath => 'Math preview uses LON-CAPA previewer (javascript) in place of DragMath (Java)', |
uselcmath => 'Math preview uses LON-CAPA previewer (javascript) in place of DragMath (Java)', |
usejsme => 'Molecule editor uses JSME (HTML5) in place of JME (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', |
texengine => 'Default method to display mathematics', |
postsubmit => 'Disable submit button/keypress following student submission', |
postsubmit => 'Disable submit button/keypress following student submission', |
canclone => "People who may clone a course (besides course's owner and coordinators)", |
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', |
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', |
); |
); |
my %staticdefaults = ( |
my %staticdefaults = ( |
anonsurvey_threshold => 10, |
anonsurvey_threshold => 10, |
Line 6788 sub print_coursedefaults {
|
Line 7209 sub print_coursedefaults {
|
'canuse_pdfforms' => 'off', |
'canuse_pdfforms' => 'off', |
'uselcmath' => 'on', |
'uselcmath' => 'on', |
'usejsme' => 'on', |
'usejsme' => 'on', |
|
'inline_chem' => 'on', |
'canclone' => 'none', |
'canclone' => 'none', |
); |
); |
@toggles = ('canuse_pdfforms','uselcmath','usejsme'); |
@toggles = ('canuse_pdfforms','uselcmath','usejsme','inline_chem'); |
my $deftex = $Apache::lonnet::deftex; |
my $deftex = $Apache::lonnet::deftex; |
if (ref($settings) eq 'HASH') { |
if (ref($settings) eq 'HASH') { |
if ($settings->{'texengine'}) { |
if ($settings->{'texengine'}) { |
Line 6897 sub print_coursedefaults {
|
Line 7319 sub print_coursedefaults {
|
my ($currdefresponder,%defcredits,%curruploadquota,%deftimeout,%currmysql); |
my ($currdefresponder,%defcredits,%curruploadquota,%deftimeout,%currmysql); |
my $currusecredits = 0; |
my $currusecredits = 0; |
my $postsubmitclient = 1; |
my $postsubmitclient = 1; |
|
my $ltiauth = 0; |
my @types = ('official','unofficial','community','textbook','placement'); |
my @types = ('official','unofficial','community','textbook','placement'); |
if (ref($settings) eq 'HASH') { |
if (ref($settings) eq 'HASH') { |
|
if ($settings->{'ltiauth'}) { |
|
$ltiauth = 1; |
|
} |
$currdefresponder = $settings->{'anonsurvey_threshold'}; |
$currdefresponder = $settings->{'anonsurvey_threshold'}; |
if (ref($settings->{'uploadquota'}) eq 'HASH') { |
if (ref($settings->{'uploadquota'}) eq 'HASH') { |
foreach my $type (keys(%{$settings->{'uploadquota'}})) { |
foreach my $type (keys(%{$settings->{'uploadquota'}})) { |
Line 7044 sub print_coursedefaults {
|
Line 7470 sub print_coursedefaults {
|
} |
} |
$datatable .= '</tr></table></td></tr>'."\n"; |
$datatable .= '</tr></table></td></tr>'."\n"; |
$itemcount ++; |
$itemcount ++; |
|
%defaultchecked = ('ltiauth' => 'off'); |
|
@toggles = ('ltiauth'); |
|
$current = { |
|
'ltiauth' => $ltiauth, |
|
}; |
|
($table,$itemcount) = |
|
&radiobutton_prefs($current,\@toggles,\%defaultchecked, |
|
\%choices,$itemcount,undef,undef,'left'); |
|
$datatable .= $table; |
|
$itemcount ++; |
} |
} |
$$rowtotal += $itemcount; |
$$rowtotal += $itemcount; |
return $datatable; |
return $datatable; |
Line 7698 sub print_passwords {
|
Line 8133 sub print_passwords {
|
$itemcount ++; |
$itemcount ++; |
} |
} |
} elsif ($position eq 'lower') { |
} elsif ($position eq 'lower') { |
my ($min,$max,%chars,$expire,$numsaved); |
$datatable .= &password_rules('passwords',\$itemcount,$settings); |
$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->{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', |
|
); |
|
$css_class = $itemcount%2?' class="LC_odd_row"':''; |
|
$datatable .= '<tr'.$css_class.'><td>'.$titles{'min'}.'</td>'. |
|
'<td class="LC_left_item"><span class="LC_nobreak">'. |
|
'<input type="text" name="passwords_min" value="'.$min.'" size="3" '. |
|
'onblur="javascript:warnIntPass(this);" />'. |
|
'<span class="LC_fontsize_small"> '.&mt('(Enter an integer: 7 or larger)').'</span>'. |
|
'</span></td></tr>'; |
|
$itemcount ++; |
|
$css_class = $itemcount%2?' class="LC_odd_row"':''; |
|
$datatable .= '<tr'.$css_class.'><td>'.$titles{'max'}.'</td>'. |
|
'<td class="LC_left_item"><span class="LC_nobreak">'. |
|
'<input type="text" name="passwords_max" value="'.$max.'" size="3" '. |
|
'onblur="javascript:warnIntPass(this);" />'. |
|
'<span class="LC_fontsize_small"> '.&mt('(Leave blank for no maximum)').'</span>'. |
|
'</span></td></tr>'; |
|
$itemcount ++; |
|
$css_class = $itemcount%2?' class="LC_odd_row"':''; |
|
$datatable .= '<tr'.$css_class.'><td>'.$titles{'chars'}.'<br />'. |
|
'<span class="LC_nobreak LC_fontsize_small">'.&mt('(Leave unchecked if not required)'). |
|
'</span></td>'; |
|
my $numinrow = 2; |
|
my @possrules = ('uc','lc','num','spec'); |
|
$datatable .= '<td class="LC_left_item"><table>'; |
|
for (my $i=0; $i<@possrules; $i++) { |
|
my ($rem,$checked); |
|
if ($chars{$possrules[$i]}) { |
|
$checked = ' checked="checked"'; |
|
} |
|
$rem = $i%($numinrow); |
|
if ($rem == 0) { |
|
if ($i > 0) { |
|
$datatable .= '</tr>'; |
|
} |
|
$datatable .= '<tr>'; |
|
} |
|
$datatable .= '<td><span class="LC_nobreak"><label>'. |
|
'<input type="checkbox" name="passwords_chars" value="'.$possrules[$i].'"'.$checked.' />'. |
|
$rulenames{$possrules[$i]}.'</label></span></td>'; |
|
} |
|
my $rem = @possrules%($numinrow); |
|
my $colsleft = $numinrow - $rem; |
|
if ($colsleft > 1 ) { |
|
$datatable .= '<td colspan="'.$colsleft.'" class="LC_left_item">'. |
|
' </td>'; |
|
} elsif ($colsleft == 1) { |
|
$datatable .= '<td class="LC_left_item"> </td>'; |
|
} |
|
$datatable .='</table></td></tr>'; |
|
$itemcount ++; |
|
$css_class = $itemcount%2?' class="LC_odd_row"':''; |
|
$datatable .= '<tr'.$css_class.'><td>'.$titles{'expire'}.'</td>'. |
|
'<td class="LC_left_item"><span class="LC_nobreak">'. |
|
'<input type="text" name="passwords_expire" value="'.$expire.'" size="4" '. |
|
'onblur="javascript:warnIntPass(this);" />'. |
|
'<span class="LC_fontsize_small"> '.&mt('(Leave blank for no expiration)').'</span>'. |
|
'</span></td></tr>'; |
|
$itemcount ++; |
|
$css_class = $itemcount%2?' class="LC_odd_row"':''; |
|
$datatable .= '<tr'.$css_class.'><td>'.$titles{'numsaved'}.'</td>'. |
|
'<td class="LC_left_item"><span class="LC_nobreak">'. |
|
'<input type="text" name="passwords_numsaved" value="'.$numsaved.'" size="3" '. |
|
'onblur="javascript:warnIntPass(this);" />'. |
|
'<span class="LC_fontsize_small"> '.&mt('(Leave blank to not save previous passwords)').'</span>'. |
|
'</span></td></tr>'; |
|
} else { |
} else { |
my ($othertitle,$usertypes,$types) = &Apache::loncommon::sorted_inst_types($dom); |
my ($othertitle,$usertypes,$types) = &Apache::loncommon::sorted_inst_types($dom); |
my %ownerchg = ( |
my %ownerchg = ( |
Line 7846 sub print_passwords {
|
Line 8193 sub print_passwords {
|
return $datatable; |
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 'secrets') { |
|
%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 .= '<tr'.$css_class.'><td>'.$titles{'min'}.'</td>'. |
|
'<td class="LC_left_item"><span class="LC_nobreak">'. |
|
'<input type="text" name="'.$prefix.'_min" value="'.$min.'" size="3" '. |
|
'onblur="javascript:warnInt'.$prefix.'(this);" />'. |
|
'<span class="LC_fontsize_small"> '.&mt('(Enter an integer: 7 or larger)').'</span>'. |
|
'</span></td></tr>'; |
|
$itemcount ++; |
|
$css_class = $itemcount%2?' class="LC_odd_row"':''; |
|
$datatable .= '<tr'.$css_class.'><td>'.$titles{'max'}.'</td>'. |
|
'<td class="LC_left_item"><span class="LC_nobreak">'. |
|
'<input type="text" name="'.$prefix.'_max" value="'.$max.'" size="3" '. |
|
'onblur="javascript:warnInt'.$prefix.'(this);" />'. |
|
'<span class="LC_fontsize_small"> '.&mt('(Leave blank for no maximum)').'</span>'. |
|
'</span></td></tr>'; |
|
$itemcount ++; |
|
$css_class = $itemcount%2?' class="LC_odd_row"':''; |
|
$datatable .= '<tr'.$css_class.'><td>'.$titles{'chars'}.'<br />'. |
|
'<span class="LC_nobreak LC_fontsize_small">'.&mt('(Leave unchecked if not required)'). |
|
'</span></td>'; |
|
my $numinrow = 2; |
|
my @possrules = ('uc','lc','num','spec'); |
|
$datatable .= '<td class="LC_left_item"><table>'; |
|
for (my $i=0; $i<@possrules; $i++) { |
|
my ($rem,$checked); |
|
if ($chars{$possrules[$i]}) { |
|
$checked = ' checked="checked"'; |
|
} |
|
$rem = $i%($numinrow); |
|
if ($rem == 0) { |
|
if ($i > 0) { |
|
$datatable .= '</tr>'; |
|
} |
|
$datatable .= '<tr>'; |
|
} |
|
$datatable .= '<td><span class="LC_nobreak"><label>'. |
|
'<input type="checkbox" name="'.$prefix.'_chars" value="'.$possrules[$i].'"'.$checked.' />'. |
|
$rulenames{$possrules[$i]}.'</label></span></td>'; |
|
} |
|
my $rem = @possrules%($numinrow); |
|
my $colsleft = $numinrow - $rem; |
|
if ($colsleft > 1 ) { |
|
$datatable .= '<td colspan="'.$colsleft.'" class="LC_left_item">'. |
|
' </td>'; |
|
} elsif ($colsleft == 1) { |
|
$datatable .= '<td class="LC_left_item"> </td>'; |
|
} |
|
$datatable .='</table></td></tr>'; |
|
$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 .= '<tr'.$css_class.'><td>'.$titles{'expire'}.'</td>'. |
|
'<td class="LC_left_item"><span class="LC_nobreak">'. |
|
'<input type="text" name="'.$prefix.'_expire" value="'.$expire.'" size="4" '. |
|
'onblur="javascript:warnInt'.$prefix.'(this);" />'. |
|
'<span class="LC_fontsize_small"> '.&mt('(Leave blank for no expiration)').'</span>'. |
|
'</span></td></tr>'; |
|
$itemcount ++; |
|
$css_class = $itemcount%2?' class="LC_odd_row"':''; |
|
$datatable .= '<tr'.$css_class.'><td>'.$titles{'numsaved'}.'</td>'. |
|
'<td class="LC_left_item"><span class="LC_nobreak">'. |
|
'<input type="text" name="'.$prefix.'_numsaved" value="'.$numsaved.'" size="3" '. |
|
'onblur="javascript:warnInt'.$prefix.'(this);" />'. |
|
'<span class="LC_fontsize_small"> '.&mt('(Leave blank to not save previous passwords)').'</span>'. |
|
'</span></td></tr>'; |
|
$itemcount ++; |
|
} |
|
if (ref($itemcountref)) { |
|
$$itemcountref += $itemcount; |
|
} |
|
return $datatable; |
|
} |
|
|
sub print_wafproxy { |
sub print_wafproxy { |
my ($position,$dom,$settings,$rowtotal) = @_; |
my ($position,$dom,$settings,$rowtotal) = @_; |
my $css_class; |
my $css_class; |
Line 9234 sub tool_titles {
|
Line 9704 sub tool_titles {
|
blog => 'Blog', |
blog => 'Blog', |
webdav => 'WebDAV', |
webdav => 'WebDAV', |
portfolio => 'Portfolio', |
portfolio => 'Portfolio', |
|
timezone => 'Can set time zone', |
official => 'Official courses (with institutional codes)', |
official => 'Official courses (with institutional codes)', |
unofficial => 'Unofficial courses', |
unofficial => 'Unofficial courses', |
community => 'Communities', |
community => 'Communities', |
Line 10015 sub user_formats_row {
|
Line 10486 sub user_formats_row {
|
'username' => 'new usernames', |
'username' => 'new usernames', |
'id' => 'IDs', |
'id' => 'IDs', |
); |
); |
unless ($type eq 'email') { |
unless (($type eq 'email') || ($type eq 'unamemap')) { |
my $css_class = $rowcount%2?' class="LC_odd_row"':''; |
my $css_class = $rowcount%2?' class="LC_odd_row"':''; |
$output = '<tr '.$css_class.'>'. |
$output = '<tr '.$css_class.'>'. |
'<td><span class="LC_nobreak">'. |
'<td><span class="LC_nobreak">'. |
Line 10070 sub user_formats_row {
|
Line 10541 sub user_formats_row {
|
} elsif ($colsleft == 1) { |
} elsif ($colsleft == 1) { |
$output .= '<td class="LC_left_item"> </td>'; |
$output .= '<td class="LC_left_item"> </td>'; |
} |
} |
$output .= '</tr></table>'; |
$output .= '</tr>'; |
unless ($type eq 'email') { |
unless (($type eq 'email') || ($type eq 'unamemap')) { |
$output .= '</td></tr>'; |
$output .= '</table></td></tr>'; |
} |
} |
return $output; |
return $output; |
} |
} |
Line 10215 sub print_defaults {
|
Line 10686 sub print_defaults {
|
$datatable .= '</td></tr>'; |
$datatable .= '</td></tr>'; |
$rownum ++; |
$rownum ++; |
} |
} |
} else { |
} elsif ($position eq 'middle') { |
my %defaults; |
my %defaults; |
if (ref($settings) eq 'HASH') { |
if (ref($settings) eq 'HASH') { |
if ((ref($settings->{'inststatusorder'}) eq 'ARRAY') && (ref($settings->{'inststatustypes'}) eq 'HASH')) { |
if ((ref($settings->{'inststatusorder'}) eq 'ARRAY') && (ref($settings->{'inststatustypes'}) eq 'HASH')) { |
Line 10265 sub print_defaults {
|
Line 10736 sub print_defaults {
|
$rownum ++; |
$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 .= '<tr'.$css_class.'><td>'.&mt('Available conversions').'</td><td><table>'. |
|
&user_formats_row('unamemap',$settings,$unamemaprules, |
|
$ruleorder,$numinrow). |
|
'</table></td></tr>'; |
|
} |
|
if ($datatable eq '') { |
|
$datatable .= '<tr'.$css_class.'><td colspan="2">'. |
|
&mt('No rules set for domain in customized localenroll.pm'). |
|
'</td></tr>'; |
|
} |
} |
} |
$$rowtotal += $rownum; |
$$rowtotal += $rownum; |
return $datatable; |
return $datatable; |
Line 11066 ENDSCRIPT
|
Line 11553 ENDSCRIPT
|
} |
} |
|
|
sub passwords_javascript { |
sub passwords_javascript { |
my %intalert = &Apache::lonlocal::texthash ( |
my ($prefix) = @_; |
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.', |
my %intalert; |
authcost => 'Warning: bcrypt encryption cost for internal authentication must be an integer.', |
if ($prefix eq 'passwords') { |
passmin => 'Warning: minimum password length must be a positive integer greater than 6.', |
%intalert = &Apache::lonlocal::texthash ( |
passmax => 'Warning: maximum password length must be a positive integer (or blank).', |
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.', |
passexp => 'Warning: days before password expiration must be a positive integer (or blank).', |
authcost => 'Warning: bcrypt encryption cost for internal authentication must be an integer.', |
passnum => 'Warning: number of previous passwords to save must be a positive integer (or blank).', |
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 'secrets') { |
|
%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); |
&js_escape(\%intalert); |
my $defmin = $Apache::lonnet::passwdmin; |
my $defmin = $Apache::lonnet::passwdmin; |
my $intauthjs = <<"ENDSCRIPT"; |
my $intauthjs; |
|
if ($prefix eq 'passwords') { $intauthjs = <<"ENDSCRIPT"; |
|
|
function warnIntAuth(field) { |
function warnIntAuth(field) { |
if (field.name == 'intauth_check') { |
if (field.name == 'intauth_check') { |
Line 11096 function warnIntAuth(field) {
|
Line 11593 function warnIntAuth(field) {
|
return; |
return; |
} |
} |
|
|
function warnIntPass(field) { |
ENDSCRIPT |
|
|
|
} |
|
|
|
$intauthjs .= <<"ENDSCRIPT"; |
|
|
|
function warnInt$prefix(field) { |
field.value.replace(/^\s+/,''); |
field.value.replace(/^\s+/,''); |
field.value.replace(/\s+\$/,''); |
field.value.replace(/\s+\$/,''); |
var regexdigit=/^\\d+\$/; |
var regexdigit=/^\\d+\$/; |
if (field.name == 'passwords_min') { |
if (field.name == '${prefix}_min') { |
if (field.value == '') { |
if (field.value == '') { |
alert('$intalert{passmin}'); |
alert('$intalert{passmin}'); |
field.value = '$defmin'; |
field.value = '$defmin'; |
Line 11120 function warnIntPass(field) {
|
Line 11623 function warnIntPass(field) {
|
field.value = ''; |
field.value = ''; |
} |
} |
if (field.value != '') { |
if (field.value != '') { |
if (field.name == 'passwords_expire') { |
if (field.name == '${prefix}_expire') { |
var regexpposnum=/^\\d+(|\\.\\d*)\$/; |
var regexpposnum=/^\\d+(|\\.\\d*)\$/; |
if (!regexpposnum.test(field.value)) { |
if (!regexpposnum.test(field.value)) { |
alert('$intalert{passexp}'); |
alert('$intalert{passexp}'); |
Line 11134 function warnIntPass(field) {
|
Line 11637 function warnIntPass(field) {
|
} |
} |
} else { |
} else { |
if (!regexdigit.test(field.value)) { |
if (!regexdigit.test(field.value)) { |
if (field.name == 'passwords_max') { |
if (field.name == '${prefix}_max') { |
alert('$intalert{passmax}'); |
alert('$intalert{passmax}'); |
} else { |
} else { |
if (field.name == 'passwords_numsaved') { |
if (field.name == '${prefix}_numsaved') { |
alert('$intalert{passnum}'); |
alert('$intalert{passnum}'); |
} |
} |
} |
} |
Line 11768 sub modify_login {
|
Line 12271 sub modify_login {
|
my ($r,$dom,$confname,$lastactref,%domconfig) = @_; |
my ($r,$dom,$confname,$lastactref,%domconfig) = @_; |
my ($resulttext,$errors,$colchgtext,%changes,%colchanges,%newfile,%newurl, |
my ($resulttext,$errors,$colchgtext,%changes,%colchanges,%newfile,%newurl, |
%curr_loginvia,%loginhash,@currlangs,@newlangs,$addedfile,%title,@offon, |
%curr_loginvia,%loginhash,@currlangs,@newlangs,$addedfile,%title,@offon, |
%currsaml,%saml,%samltext,%samlimg,%samlalt,%samlurl,%samltitle,%samlnotsso); |
%currsaml,%saml,%samltext,%samlimg,%samlalt,%samlurl,%samltitle,%samlwindow,%samlnotsso); |
%title = ( coursecatalog => 'Display course catalog', |
%title = ( coursecatalog => 'Display course catalog', |
adminmail => 'Display administrator E-mail address', |
adminmail => 'Display administrator E-mail address', |
helpdesk => 'Display "Contact Helpdesk" link', |
helpdesk => 'Display "Contact Helpdesk" link', |
Line 11792 sub modify_login {
|
Line 12295 sub modify_login {
|
$samlalt{$lonhost} = $domconfig{login}{'saml'}{$lonhost}{'alt'}; |
$samlalt{$lonhost} = $domconfig{login}{'saml'}{$lonhost}{'alt'}; |
$samlimg{$lonhost} = $domconfig{login}{'saml'}{$lonhost}{'img'}; |
$samlimg{$lonhost} = $domconfig{login}{'saml'}{$lonhost}{'img'}; |
$samltitle{$lonhost} = $domconfig{login}{'saml'}{$lonhost}{'title'}; |
$samltitle{$lonhost} = $domconfig{login}{'saml'}{$lonhost}{'title'}; |
|
$samlwindow{$lonhost} = $domconfig{login}{'saml'}{$lonhost}{'window'}; |
$samlnotsso{$lonhost} = $domconfig{login}{'saml'}{$lonhost}{'notsso'}; |
$samlnotsso{$lonhost} = $domconfig{login}{'saml'}{$lonhost}{'notsso'}; |
} |
} |
} |
} |
Line 12049 sub modify_login {
|
Line 12553 sub modify_login {
|
if ($env{'form.saml_img_'.$lonhost.'.filename'}) { |
if ($env{'form.saml_img_'.$lonhost.'.filename'}) { |
push(@newsamlimgs,$lonhost); |
push(@newsamlimgs,$lonhost); |
} |
} |
foreach my $item ('text','alt','url','title','notsso') { |
foreach my $item ('text','alt','url','title','window','notsso') { |
$env{'form.saml_'.$item.'_'.$lonhost} =~ s/^\s+|\s+$//g; |
$env{'form.saml_'.$item.'_'.$lonhost} =~ s/^\s+|\s+$//g; |
} |
} |
if ($saml{$lonhost}) { |
if ($saml{$lonhost}) { |
|
if ($env{'form.saml_window_'.$lonhost} ne '1') { |
|
$env{'form.saml_window_'.$lonhost} = ''; |
|
} |
if (grep(/^\Q$lonhost\E$/,@delsamlimg)) { |
if (grep(/^\Q$lonhost\E$/,@delsamlimg)) { |
#FIXME Need to obsolete published image |
#FIXME Need to obsolete published image |
delete($currsaml{$lonhost}{'img'}); |
delete($currsaml{$lonhost}{'img'}); |
Line 12070 sub modify_login {
|
Line 12577 sub modify_login {
|
if ($env{'form.saml_title_'.$lonhost} ne $samltitle{$lonhost}) { |
if ($env{'form.saml_title_'.$lonhost} ne $samltitle{$lonhost}) { |
$changes{'saml'}{$lonhost} = 1; |
$changes{'saml'}{$lonhost} = 1; |
} |
} |
|
if ($env{'form.saml_window_'.$lonhost} ne $samlwindow{$lonhost}) { |
|
$changes{'saml'}{$lonhost} = 1; |
|
} |
if ($env{'form.saml_notsso_'.$lonhost} ne $samlnotsso{$lonhost}) { |
if ($env{'form.saml_notsso_'.$lonhost} ne $samlnotsso{$lonhost}) { |
$changes{'saml'}{$lonhost} = 1; |
$changes{'saml'}{$lonhost} = 1; |
} |
} |
} else { |
} else { |
$changes{'saml'}{$lonhost} = 1; |
$changes{'saml'}{$lonhost} = 1; |
} |
} |
foreach my $item ('text','alt','url','title','notsso') { |
foreach my $item ('text','alt','url','title','window','notsso') { |
$currsaml{$lonhost}{$item} = $env{'form.saml_'.$item.'_'.$lonhost}; |
$currsaml{$lonhost}{$item} = $env{'form.saml_'.$item.'_'.$lonhost}; |
} |
} |
} else { |
} else { |
Line 12277 sub modify_login {
|
Line 12787 sub modify_login {
|
alt => 'Alt text for button image', |
alt => 'Alt text for button image', |
url => 'SSO URL', |
url => 'SSO URL', |
title => 'Tooltip for SSO link', |
title => 'Tooltip for SSO link', |
|
window => 'Pop-up window if iframe', |
notsso => 'Text for non-SSO log-in', |
notsso => 'Text for non-SSO log-in', |
); |
); |
foreach my $lonhost (sort(keys(%{$changes{$item}}))) { |
foreach my $lonhost (sort(keys(%{$changes{$item}}))) { |
if (ref($currsaml{$lonhost}) eq 'HASH') { |
if (ref($currsaml{$lonhost}) eq 'HASH') { |
$resulttext .= '<li>'.&mt("$title{$item} in use for [_1]","<b>$lonhost</b>"). |
$resulttext .= '<li>'.&mt("$title{$item} in use for [_1]","<b>$lonhost</b>"). |
'<ul>'; |
'<ul>'; |
foreach my $key ('text','img','alt','url','title','notsso') { |
foreach my $key ('text','img','alt','url','title','window','notsso') { |
if ($currsaml{$lonhost}{$key} eq '') { |
if ($currsaml{$lonhost}{$key} eq '') { |
$resulttext .= '<li>'.&mt("$notlt{$key} not in use").'</li>'; |
$resulttext .= '<li>'.&mt("$notlt{$key} not in use").'</li>'; |
} else { |
} else { |
my $value = "'$currsaml{$lonhost}{$key}'"; |
my $value = "'$currsaml{$lonhost}{$key}'"; |
if ($key eq 'img') { |
if ($key eq 'img') { |
$value = '<img src="'.$currsaml{$lonhost}{$key}.'" />'; |
$value = '<img src="'.$currsaml{$lonhost}{$key}.'" />'; |
|
} elsif ($key eq 'window') { |
|
$value = 'On'; |
} |
} |
$resulttext .= '<li>'.&mt("$notlt{$key} set to: [_1]", |
$resulttext .= '<li>'.&mt("$notlt{$key} set to: [_1]", |
$value).'</li>'; |
$value).'</li>'; |
Line 12787 sub modify_colors {
|
Line 13300 sub modify_colors {
|
$domconfig->{$role} = {}; |
$domconfig->{$role} = {}; |
} |
} |
foreach my $img (@images) { |
foreach my $img (@images) { |
if (($role eq 'login') && (($img eq 'img') || ($img eq 'logo'))) { |
if ($role eq 'login') { |
if (defined($env{'form.login_showlogo_'.$img})) { |
if (($img eq 'img') || ($img eq 'logo')) { |
$confhash->{$role}{'showlogo'}{$img} = 1; |
if (defined($env{'form.login_showlogo_'.$img})) { |
} else { |
$confhash->{$role}{'showlogo'}{$img} = 1; |
$confhash->{$role}{'showlogo'}{$img} = 0; |
} else { |
|
$confhash->{$role}{'showlogo'}{$img} = 0; |
|
} |
} |
} |
} |
if ($env{'form.login_alt_'.$img} ne '') { |
|
$confhash->{$role}{'alttext'}{$img} = $env{'form.login_alt_'.$img}; |
|
} |
|
} |
if ( ! $env{'form.'.$role.'_'.$img.'.filename'} |
if ( ! $env{'form.'.$role.'_'.$img.'.filename'} |
&& !defined($domconfig->{$role}{$img}) |
&& !defined($domconfig->{$role}{$img}) |
&& !$env{'form.'.$role.'_del_'.$img} |
&& !$env{'form.'.$role.'_del_'.$img} |
Line 12868 sub modify_colors {
|
Line 13386 sub modify_colors {
|
$changes{$role}{'images'}{$img} = 1; |
$changes{$role}{'images'}{$img} = 1; |
} |
} |
} |
} |
if (($role eq 'login') && (($img eq 'logo') || ($img eq 'img'))) { |
if ($role eq 'login') { |
if (ref($domconfig->{'login'}{'showlogo'}) eq 'HASH') { |
if (($img eq 'logo') || ($img eq 'img')) { |
if ($confhash->{$role}{'showlogo'}{$img} ne |
if (ref($domconfig->{'login'}{'showlogo'}) eq 'HASH') { |
$domconfig->{$role}{'showlogo'}{$img}) { |
if ($confhash->{$role}{'showlogo'}{$img} ne |
$changes{$role}{'showlogo'}{$img} = 1; |
$domconfig->{$role}{'showlogo'}{$img}) { |
|
$changes{$role}{'showlogo'}{$img} = 1; |
|
} |
|
} else { |
|
if ($confhash->{$role}{'showlogo'}{$img} == 0) { |
|
$changes{$role}{'showlogo'}{$img} = 1; |
|
} |
} |
} |
} else { |
} |
if ($confhash->{$role}{'showlogo'}{$img} == 0) { |
if ($img ne 'login') { |
$changes{$role}{'showlogo'}{$img} = 1; |
if (ref($domconfig->{$role}{'alttext'}) eq 'HASH') { |
|
if ($confhash->{$role}{'alttext'}{$img} ne |
|
$domconfig->{$role}{'alttext'}{$img}) { |
|
$changes{$role}{'alttext'}{$img} = 1; |
|
} |
|
} else { |
|
if ($confhash->{$role}{'alttext'}{$img} ne '') { |
|
$changes{$role}{'alttext'}{$img} = 1; |
|
} |
} |
} |
} |
} |
} |
} |
Line 12987 sub default_change_checker {
|
Line 13519 sub default_change_checker {
|
if ($confhash->{$role}{'showlogo'}{$img} == 0) { |
if ($confhash->{$role}{'showlogo'}{$img} == 0) { |
$changes->{$role}{'showlogo'}{$img} = 1; |
$changes->{$role}{'showlogo'}{$img} = 1; |
} |
} |
|
if (ref($confhash->{$role}{'alttext'}) eq 'HASH') { |
|
if ($confhash->{$role}{'alttext'}{$img} ne '') { |
|
$changes->{$role}{'alttext'}{$img} = 1; |
|
} |
|
} |
} |
} |
} |
} |
if ($confhash->{$role}{'font'}) { |
if ($confhash->{$role}{'font'}) { |
Line 13025 sub display_colorchgs {
|
Line 13562 sub display_colorchgs {
|
} else { |
} else { |
$resulttext .= '<li>'.&mt("$choices{$item} set to not be displayed").'</li>'; |
$resulttext .= '<li>'.&mt("$choices{$item} set to not be displayed").'</li>'; |
} |
} |
|
} elsif (($role eq 'login') && ($key eq 'alttext')) { |
|
if ($confhash->{$role}{$key}{$item} ne '') { |
|
$resulttext .= '<li>'.&mt("$choices{$key} for $choices{$item} set to [_1].", |
|
$confhash->{$role}{$key}{$item}).'</li>'; |
|
} else { |
|
$resulttext .= '<li>'.&mt("$choices{$key} for $choices{$item} deleted.").'</li>'; |
|
} |
} elsif ($confhash->{$role}{$item} eq '') { |
} elsif ($confhash->{$role}{$item} eq '') { |
$resulttext .= '<li>'.&mt("$choices{$item} set to default").'</li>'; |
$resulttext .= '<li>'.&mt("$choices{$item} set to default").'</li>'; |
} else { |
} else { |
Line 13423 sub modify_quotas {
|
Line 13967 sub modify_quotas {
|
@usertools = ('author'); |
@usertools = ('author'); |
%titles = &authorrequest_titles(); |
%titles = &authorrequest_titles(); |
} else { |
} else { |
@usertools = ('aboutme','blog','webdav','portfolio'); |
@usertools = ('aboutme','blog','webdav','portfolio','timezone'); |
%titles = &tool_titles(); |
%titles = &tool_titles(); |
} |
} |
my %domdefaults = &Apache::lonnet::get_domain_defaults($dom,1); |
my %domdefaults = &Apache::lonnet::get_domain_defaults($dom,1); |
Line 15340 sub modify_lti {
|
Line 15884 sub modify_lti {
|
|
|
my %menutitles = <imenu_titles(); |
my %menutitles = <imenu_titles(); |
|
|
|
my (%currltisec,%secchanges,%newltisec,%newltienc,%keyset,%newkeyset); |
|
$newltisec{'private'}{'keys'} = []; |
|
$newltisec{'encrypt'} = {}; |
|
$newltisec{'rules'} = {}; |
|
$newltisec{'linkprot'} = {}; |
|
if (ref($domconfig{'ltisec'}) eq 'HASH') { |
|
%currltisec = %{$domconfig{'ltisec'}}; |
|
if (ref($currltisec{'linkprot'}) eq 'HASH') { |
|
foreach my $id (keys(%{$currltisec{'linkprot'}})) { |
|
unless ($id =~ /^\d+$/) { |
|
delete($currltisec{'linkprot'}{$id}); |
|
} |
|
} |
|
} |
|
if (ref($currltisec{'private'}) eq 'HASH') { |
|
if (ref($currltisec{'private'}{'keys'}) eq 'ARRAY') { |
|
$newltisec{'private'}{'keys'} = $currltisec{'private'}{'keys'}; |
|
map { $keyset{$_} = 1; } @{$currltisec{'private'}{'keys'}}; |
|
} |
|
} |
|
} |
|
foreach my $item ('crs','dom','consumers') { |
|
my $formelement; |
|
if ($item eq 'consumers') { |
|
$formelement = 'form.ltisec_'.$item; |
|
} else { |
|
$formelement = 'form.ltisec_'.$item.'linkprot'; |
|
} |
|
if ($env{$formelement}) { |
|
$newltisec{'encrypt'}{$item} = 1; |
|
if (ref($currltisec{'encrypt'}) eq 'HASH') { |
|
unless ($currltisec{'encrypt'}{$item}) { |
|
$secchanges{'encrypt'} = 1; |
|
} |
|
} else { |
|
$secchanges{'encrypt'} = 1; |
|
} |
|
} elsif (ref($currltisec{'encrypt'}) eq 'HASH') { |
|
if ($currltisec{'encrypt'}{$item}) { |
|
$secchanges{'encrypt'} = 1; |
|
} |
|
} |
|
} |
|
unless (exists($currltisec{'rules'})) { |
|
$currltisec{'rules'} = {}; |
|
} |
|
&password_rule_changes('secrets',$newltisec{'rules'},$currltisec{'rules'},\%secchanges); |
|
|
|
my @ids=&Apache::lonnet::current_machine_ids(); |
|
my %servers = &Apache::lonnet::get_servers($dom,'library'); |
|
|
|
foreach my $hostid (keys(%servers)) { |
|
if (($hostid ne '') && (grep(/^\Q$hostid\E$/,@ids))) { |
|
my $newkey; |
|
my $keyitem = 'form.ltisec_privkey_'.$hostid; |
|
if (exists($env{$keyitem})) { |
|
$env{$keyitem} =~ s/(`)/'/g; |
|
if ($keyset{$hostid}) { |
|
if ($env{'form.ltisec_changeprivkey_'.$hostid}) { |
|
if ($env{$keyitem} ne '') { |
|
$secchanges{'private'} = 1; |
|
$newkeyset{$hostid} = $env{$keyitem}; |
|
} |
|
} |
|
} elsif ($env{$keyitem} ne '') { |
|
unless (grep(/^\Q$hostid\E$/,@{$newltisec{'private'}{'keys'}})) { |
|
push(@{$newltisec{'private'}{'keys'}},$hostid); |
|
} |
|
$secchanges{'private'} = 1; |
|
$newkeyset{$hostid} = $env{$keyitem}; |
|
} |
|
} |
|
} |
|
} |
|
|
|
my (%linkprotchg,$linkprotoutput,$is_home); |
|
my $proterror = &Apache::courseprefs::process_linkprot($dom,'',$currltisec{'linkprot'}, |
|
\%linkprotchg,'domain'); |
|
my $home = &Apache::lonnet::domain($dom,'primary'); |
|
unless (($home eq 'no_host') || ($home eq '')) { |
|
my @ids=&Apache::lonnet::current_machine_ids(); |
|
foreach my $id (@ids) { if ($id eq $home) { $is_home=1; } } |
|
} |
|
|
|
if (keys(%linkprotchg)) { |
|
$secchanges{'linkprot'} = 1; |
|
my %oldlinkprot; |
|
if (ref($currltisec{'linkprot'}) eq 'HASH') { |
|
%oldlinkprot = %{$currltisec{'linkprot'}}; |
|
} |
|
foreach my $id (keys(%linkprotchg)) { |
|
if (ref($linkprotchg{$id}) eq 'HASH') { |
|
foreach my $inner (keys(%{$linkprotchg{$id}})) { |
|
if (($inner eq 'secret') || ($inner eq 'key')) { |
|
if ($is_home) { |
|
$newltienc{$id}{$inner} = $linkprotchg{$id}{$inner}; |
|
} |
|
} |
|
} |
|
} else { |
|
$newltisec{'linkprot'}{$id} = $linkprotchg{$id}; |
|
} |
|
} |
|
$linkprotoutput = &Apache::courseprefs::store_linkprot($dom,'','domain',\%linkprotchg,\%oldlinkprot); |
|
if (keys(%linkprotchg)) { |
|
%{$newltisec{'linkprot'}} = %linkprotchg; |
|
} |
|
} |
|
if (ref($currltisec{'linkprot'}) eq 'HASH') { |
|
foreach my $id (%{$currltisec{'linkprot'}}) { |
|
next if ($id !~ /^\d+$/); |
|
unless (exists($linkprotchg{$id})) { |
|
if (ref($currltisec{'linkprot'}{$id}) eq 'HASH') { |
|
foreach my $inner (keys(%{$currltisec{'linkprot'}{$id}})) { |
|
if (($inner eq 'secret') || ($inner eq 'key')) { |
|
if ($is_home) { |
|
$newltienc{$id}{$inner} = $currltisec{'linkprot'}{$id}{$inner}; |
|
} |
|
} else { |
|
$newltisec{'linkprot'}{$id}{$inner} = $currltisec{'linkprot'}{$id}{$inner}; |
|
} |
|
} |
|
} else { |
|
$newltisec{'linkprot'}{$id} = $currltisec{'linkprot'}{$id}; |
|
} |
|
} |
|
} |
|
} |
|
if ($proterror) { |
|
$errors .= '<li>'.$proterror.'</li>'; |
|
} |
my (@items,%deletions,%itemids); |
my (@items,%deletions,%itemids); |
if ($env{'form.lti_add'}) { |
if ($env{'form.lti_add'}) { |
my $consumer = $env{'form.lti_consumer_add'}; |
my $consumer = $env{'form.lti_consumer_add'}; |
Line 15405 sub modify_lti {
|
Line 16080 sub modify_lti {
|
} |
} |
if ($confhash{$itemid}{'requser'}) { |
if ($confhash{$itemid}{'requser'}) { |
if ($env{'form.lti_mapuser_'.$idx} eq 'sourcedid') { |
if ($env{'form.lti_mapuser_'.$idx} eq 'sourcedid') { |
$confhash{$itemid}{'mapuser'} = 'lis_person_sourcedid'; |
$confhash{$itemid}{'mapuser'} = 'lis_person_sourcedid'; |
} elsif ($env{'form.lti_mapuser_'.$idx} eq 'email') { |
} elsif ($env{'form.lti_mapuser_'.$idx} eq 'email') { |
$confhash{$itemid}{'mapuser'} = 'lis_person_contact_email_primary'; |
$confhash{$itemid}{'mapuser'} = 'lis_person_contact_email_primary'; |
} elsif ($env{'form.lti_mapuser_'.$idx} eq 'other') { |
} elsif ($env{'form.lti_mapuser_'.$idx} eq 'other') { |
my $mapuser = $env{'form.lti_customuser_'.$idx}; |
my $mapuser = $env{'form.lti_customuser_'.$idx}; |
$mapuser =~ s/(`)/'/g; |
$mapuser =~ s/(`)/'/g; |
$mapuser =~ s/^\s+|\s+$//g; |
$mapuser =~ s/^\s+|\s+$//g; |
$confhash{$itemid}{'mapuser'} = $mapuser; |
$confhash{$itemid}{'mapuser'} = $mapuser; |
} |
} |
my @possmakeuser = &Apache::loncommon::get_env_multiple('form.lti_makeuser_'.$idx); |
my @possmakeuser = &Apache::loncommon::get_env_multiple('form.lti_makeuser_'.$idx); |
my @makeuser; |
my @makeuser; |
Line 15643 sub modify_lti {
|
Line 16318 sub modify_lti {
|
} |
} |
} |
} |
my %ltihash = ( |
my %ltihash = ( |
$action => { %confhash } |
$action => { %confhash } |
); |
); |
my $putresult = &Apache::lonnet::put_dom('configuration',\%ltihash, |
my %ltienchash = ( |
$dom); |
$action => { %encconfig } |
|
); |
|
if (keys(%secchanges)) { |
|
$ltihash{'ltisec'} = \%newltisec; |
|
if ($secchanges{'linkprot'}) { |
|
if ($is_home) { |
|
$ltienchash{'linkprot'} = \%newltienc; |
|
} |
|
} |
|
} |
|
my $putresult = &Apache::lonnet::put_dom('configuration',\%ltihash,$dom); |
if ($putresult eq 'ok') { |
if ($putresult eq 'ok') { |
my %ltienchash = ( |
my %keystore; |
$action => { %encconfig } |
if (keys(%secchanges)) { |
); |
if ($secchanges{'private'}) { |
|
my $who = &escape($env{'user.name'}.':'.$env{'user.domain'}); |
|
foreach my $hostid (keys(%newkeyset)) { |
|
my $storehash = { |
|
key => $newkeyset{$hostid}, |
|
who => $env{'user.name'}.':'.$env{'user.domain'}, |
|
}; |
|
$keystore{$hostid} = &Apache::lonnet::store_dom($storehash,'lti','private', |
|
$dom,$hostid); |
|
} |
|
} |
|
if (ref($lastactref) eq 'HASH') { |
|
if (($secchanges{'encrypt'}) || ($secchanges{'private'})) { |
|
$lastactref->{'domdefaults'} = 1; |
|
} |
|
} |
|
} |
&Apache::lonnet::put_dom('encconfig',\%ltienchash,$dom,undef,1); |
&Apache::lonnet::put_dom('encconfig',\%ltienchash,$dom,undef,1); |
|
if ((keys(%changes) == 0) && (keys(%secchanges) == 0)) { |
|
return &mt('No changes made.'); |
|
} |
|
$resulttext = &mt('Changes made:').'<ul>'; |
|
if (keys(%secchanges) > 0) { |
|
foreach my $item (keys(%secchanges)) { |
|
if ($item eq 'encrypt') { |
|
my %encrypted = ( |
|
crs => { |
|
on => &mt('Encryption of stored link protection secrets defined in courses enabled'), |
|
off => &mt('Encryption of stored link protection secrets defined in courses disabled'), |
|
}, |
|
dom => { |
|
on => &mt('Encryption of stored link protection secrets defined in domain enabled'), |
|
off => &mt('Encryption of stored link protection secrets defined in domain disabled'), |
|
}, |
|
consumers => { |
|
on => &mt('Encryption of stored consumer secrets defined in domain enabled'), |
|
off => &mt('Encryption of stored consumer secrets defined in domain disabled'), |
|
}, |
|
); |
|
foreach my $type ('crs','dom','consumers') { |
|
my $shown = $encrypted{$type}{'off'}; |
|
if (ref($newltisec{$item}) eq 'HASH') { |
|
if ($newltisec{$item}{$type}) { |
|
$shown = $encrypted{$type}{'on'}; |
|
} |
|
} |
|
$resulttext .= '<li>'.$shown.'</li>'; |
|
} |
|
} elsif ($item eq 'rules') { |
|
my %titles = &Apache::lonlocal::texthash( |
|
min => 'Minimum password length', |
|
max => 'Maximum password length', |
|
chars => 'Required characters', |
|
); |
|
foreach my $rule ('min','max') { |
|
if ($newltisec{rules}{$rule} eq '') { |
|
if ($rule eq 'min') { |
|
$resulttext .= '<li>'.&mt('[_1] not set.',$titles{$rule}); |
|
' '.&mt('Default of [_1] will be used', |
|
$Apache::lonnet::passwdmin).'</li>'; |
|
} else { |
|
$resulttext .= '<li>'.&mt('[_1] set to none',$titles{$rule}).'</li>'; |
|
} |
|
} else { |
|
$resulttext .= '<li>'.&mt('[_1] set to [_2]',$titles{$rule},$newltisec{rules}{$rule}).'</li>'; |
|
} |
|
} |
|
if (ref($newltisec{'rules'}{'chars'}) eq 'ARRAY') { |
|
if (@{$newltisec{'rules'}{'chars'}} > 0) { |
|
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 $needed = '<ul><li>'. |
|
join('</li><li>',map {$rulenames{$_} } @{$newltisec{'rules'}{'chars'}}). |
|
'</li></ul>'; |
|
$resulttext .= '<li>'.&mt('[_1] set to: [_2]',$titles{'chars'},$needed).'</li>'; |
|
} else { |
|
$resulttext .= '<li>'.&mt('[_1] set to none',$titles{'chars'}).'</li>'; |
|
} |
|
} else { |
|
$resulttext .= '<li>'.&mt('[_1] set to none',$titles{'chars'}).'</li>'; |
|
} |
|
} elsif ($item eq 'private') { |
|
if (keys(%newkeyset)) { |
|
foreach my $hostid (sort(keys(%newkeyset))) { |
|
if ($keystore{$hostid} eq 'ok') { |
|
$resulttext .= '<li>'.&mt('Encryption key for storage of shared secrets saved for [_1]',$hostid).'</li>'; |
|
} |
|
} |
|
} |
|
} elsif ($item eq 'linkprot') { |
|
$resulttext .= $linkprotoutput; |
|
} |
|
} |
|
} |
if (keys(%changes) > 0) { |
if (keys(%changes) > 0) { |
my $cachetime = 24*60*60; |
my $cachetime = 24*60*60; |
my %ltiall = %confhash; |
my %ltiall = %confhash; |
Line 15666 sub modify_lti {
|
Line 16447 sub modify_lti {
|
if (ref($lastactref) eq 'HASH') { |
if (ref($lastactref) eq 'HASH') { |
$lastactref->{'lti'} = 1; |
$lastactref->{'lti'} = 1; |
} |
} |
$resulttext = &mt('Changes made:').'<ul>'; |
|
my %bynum; |
my %bynum; |
foreach my $itemid (sort(keys(%changes))) { |
foreach my $itemid (sort(keys(%changes))) { |
my $position = $confhash{$itemid}{'order'}; |
my $position = $confhash{$itemid}{'order'}; |
Line 15843 sub modify_lti {
|
Line 16623 sub modify_lti {
|
$resulttext .= '</ul></li>'; |
$resulttext .= '</ul></li>'; |
} |
} |
} |
} |
$resulttext .= '</ul>'; |
|
} else { |
|
$resulttext = &mt('No changes made.'); |
|
} |
} |
|
$resulttext .= '</ul>'; |
} else { |
} else { |
$errors .= '<li><span class="LC_error">'.&mt('Failed to save changes').'</span></li>'; |
$errors .= '<li><span class="LC_error">'.&mt('Failed to save changes').'</span></li>'; |
} |
} |
Line 15913 sub modify_autoenroll {
|
Line 16691 sub modify_autoenroll {
|
my %title = ( run => 'Auto-enrollment active', |
my %title = ( run => 'Auto-enrollment active', |
sender => 'Sender for notification messages', |
sender => 'Sender for notification messages', |
coowners => 'Automatic assignment of co-ownership to instructors of record (institutional data)', |
coowners => 'Automatic assignment of co-ownership to instructors of record (institutional data)', |
failsafe => 'Failsafe for no drops if institutional data missing for a section'); |
autofailsafe => 'Failsafe for no drops if institutional data missing for a section'); |
my @offon = ('off','on'); |
my @offon = ('off','on'); |
my $sender_uname = $env{'form.sender_uname'}; |
my $sender_uname = $env{'form.sender_uname'}; |
my $sender_domain = $env{'form.sender_domain'}; |
my $sender_domain = $env{'form.sender_domain'}; |
Line 15923 sub modify_autoenroll {
|
Line 16701 sub modify_autoenroll {
|
$sender_domain = ''; |
$sender_domain = ''; |
} |
} |
my $coowners = $env{'form.autoassign_coowners'}; |
my $coowners = $env{'form.autoassign_coowners'}; |
|
my $autofailsafe = $env{'form.autoenroll_autofailsafe'}; |
|
$autofailsafe =~ s{^\s+|\s+$}{}g; |
|
if ($autofailsafe =~ /\D/) { |
|
undef($autofailsafe); |
|
} |
my $failsafe = $env{'form.autoenroll_failsafe'}; |
my $failsafe = $env{'form.autoenroll_failsafe'}; |
$failsafe =~ s{^\s+|\s+$}{}g; |
unless (($failsafe eq 'zero') || ($failsafe eq 'any')) { |
if ($failsafe =~ /\D/) { |
$failsafe = 'off'; |
undef($failsafe); |
undef($autofailsafe); |
} |
} |
my %autoenrollhash = ( |
my %autoenrollhash = ( |
autoenroll => { 'run' => $env{'form.autoenroll_run'}, |
autoenroll => { 'run' => $env{'form.autoenroll_run'}, |
'sender_uname' => $sender_uname, |
'sender_uname' => $sender_uname, |
'sender_domain' => $sender_domain, |
'sender_domain' => $sender_domain, |
'co-owners' => $coowners, |
'co-owners' => $coowners, |
'autofailsafe' => $failsafe, |
'autofailsafe' => $autofailsafe, |
|
'failsafe' => $failsafe, |
} |
} |
); |
); |
my $putresult = &Apache::lonnet::put_dom('configuration',\%autoenrollhash, |
my $putresult = &Apache::lonnet::put_dom('configuration',\%autoenrollhash, |
Line 15961 sub modify_autoenroll {
|
Line 16745 sub modify_autoenroll {
|
} elsif ($coowners) { |
} elsif ($coowners) { |
$changes{'coowners'} = 1; |
$changes{'coowners'} = 1; |
} |
} |
if ($currautoenroll{'autofailsafe'} ne $failsafe) { |
if ($currautoenroll{'autofailsafe'} ne $autofailsafe) { |
$changes{'autofailsafe'} = 1; |
$changes{'autofailsafe'} = 1; |
} |
} |
|
if ($currautoenroll{'failsafe'} ne $failsafe) { |
|
$changes{'failsafe'} = 1; |
|
} |
if (keys(%changes) > 0) { |
if (keys(%changes) > 0) { |
$resulttext = &mt('Changes made:').'<ul>'; |
$resulttext = &mt('Changes made:').'<ul>'; |
if ($changes{'run'}) { |
if ($changes{'run'}) { |
Line 15984 sub modify_autoenroll {
|
Line 16771 sub modify_autoenroll {
|
} |
} |
} |
} |
if ($changes{'autofailsafe'}) { |
if ($changes{'autofailsafe'}) { |
if ($failsafe ne '') { |
if ($autofailsafe ne '') { |
$resulttext .= '<li>'.&mt('Failsafe for no drops if institutional data missing for a section set to: [_1]',$failsafe).'</li>'; |
$resulttext .= '<li>'.&mt('Failsafe for no drops if institutional data missing for a section set to: [_1]',$autofailsafe).'</li>'; |
|
} else { |
|
$resulttext .= '<li>'.&mt('Failsafe for no drops if institutional data missing for a section not in use').'</li>'; |
|
} |
|
} |
|
if ($changes{'failsafe'}) { |
|
if ($failsafe eq 'off') { |
|
unless ($changes{'autofailsafe'}) { |
|
$resulttext .= '<li>'.&mt('Failsafe for no drops if institutional data missing for a section not in use').'</li>'; |
|
} |
|
} elsif ($failsafe eq 'zero') { |
|
$resulttext .= '<li>'.&mt('Failsafe applies if retrieved section enrollment is zero').'</li>'; |
} else { |
} else { |
$resulttext .= '<li>'.&mt('Failsafe for no drops if institutional data missing for a section: deleted'); |
$resulttext .= '<li>'.&mt('Failsafe applies if retrieved section enrollment is zero or greater').'</li>'; |
} |
} |
|
} |
|
if (($changes{'autofailsafe'}) || ($changes{'failsafe'})) { |
&Apache::lonnet::get_domain_defaults($dom,1); |
&Apache::lonnet::get_domain_defaults($dom,1); |
if (ref($lastactref) eq 'HASH') { |
if (ref($lastactref) eq 'HASH') { |
$lastactref->{'domdefaults'} = 1; |
$lastactref->{'domdefaults'} = 1; |
Line 17550 sub modify_passwords {
|
Line 18350 sub modify_passwords {
|
$updatedefaults = 1; |
$updatedefaults = 1; |
} |
} |
} |
} |
foreach my $rule ('min','max','expire','numsaved') { |
&password_rule_changes('passwords',\%newvalues,\%current,\%changes); |
$env{'form.passwords_'.$rule} =~ s/^\s+|\s+$//g; |
|
my $ruleok; |
|
if ($rule eq 'expire') { |
|
if (($env{'form.passwords_'.$rule} =~ /^\d+(|\.\d*)$/) && |
|
($env{'form.passwords_'.$rule} ne '0')) { |
|
$ruleok = 1; |
|
} |
|
} elsif ($rule eq 'min') { |
|
if ($env{'form.passwords_'.$rule} =~ /^\d+$/) { |
|
if ($env{'form.passwords_'.$rule} >= $Apache::lonnet::passwdmin) { |
|
$ruleok = 1; |
|
} |
|
} |
|
} elsif (($env{'form.passwords_'.$rule} =~ /^\d+$/) && |
|
($env{'form.passwords_'.$rule} ne '0')) { |
|
$ruleok = 1; |
|
} |
|
if ($ruleok) { |
|
$newvalues{$rule} = $env{'form.passwords_'.$rule}; |
|
if (exists($current{$rule})) { |
|
if ($newvalues{$rule} ne $current{$rule}) { |
|
$changes{'rules'} = 1; |
|
} |
|
} elsif ($rule eq 'min') { |
|
if ($staticdefaults{$rule} ne $newvalues{$rule}) { |
|
$changes{'rules'} = 1; |
|
} |
|
} else { |
|
$changes{'rules'} = 1; |
|
} |
|
} elsif (exists($current{$rule})) { |
|
$changes{'rules'} = 1; |
|
} |
|
} |
|
my @posschars = &Apache::loncommon::get_env_multiple('form.passwords_chars'); |
|
my @chars; |
|
foreach my $item (sort(@posschars)) { |
|
if ($item =~ /^(uc|lc|num|spec)$/) { |
|
push(@chars,$item); |
|
} |
|
} |
|
$newvalues{'chars'} = \@chars; |
|
unless ($changes{'rules'}) { |
|
if (ref($current{'chars'}) eq 'ARRAY') { |
|
my @diffs = &Apache::loncommon::compare_arrays($current{'chars'},\@chars); |
|
if (@diffs > 0) { |
|
$changes{'rules'} = 1; |
|
} |
|
} else { |
|
if (@chars > 0) { |
|
$changes{'rules'} = 1; |
|
} |
|
} |
|
} |
|
my %crsownerchg = ( |
my %crsownerchg = ( |
by => [], |
by => [], |
for => [], |
for => [], |
Line 17864 sub modify_passwords {
|
Line 18610 sub modify_passwords {
|
return $resulttext; |
return $resulttext; |
} |
} |
|
|
|
sub password_rule_changes { |
|
my ($prefix,$newvalues,$current,$changes) = @_; |
|
return unless ((ref($newvalues) eq 'HASH') && |
|
(ref($current) eq 'HASH') && |
|
(ref($changes) eq 'HASH')); |
|
my (@rules,%staticdefaults); |
|
if ($prefix eq 'passwords') { |
|
@rules = ('min','max','expire','numsaved'); |
|
} elsif ($prefix eq 'secrets') { |
|
@rules = ('min','max'); |
|
} |
|
$staticdefaults{'min'} = $Apache::lonnet::passwdmin; |
|
foreach my $rule (@rules) { |
|
$env{'form.'.$prefix.'_'.$rule} =~ s/^\s+|\s+$//g; |
|
my $ruleok; |
|
if ($rule eq 'expire') { |
|
if (($env{'form.'.$prefix.'_'.$rule} =~ /^\d+(|\.\d*)$/) && |
|
($env{'form.'.$prefix.'_'.$rule} ne '0')) { |
|
$ruleok = 1; |
|
} |
|
} elsif ($rule eq 'min') { |
|
if ($env{'form.'.$prefix.'_'.$rule} =~ /^\d+$/) { |
|
if ($env{'form.'.$prefix.'_'.$rule} >= $staticdefaults{$rule}) { |
|
$ruleok = 1; |
|
} |
|
} |
|
} elsif (($env{'form.'.$prefix.'_'.$rule} =~ /^\d+$/) && |
|
($env{'form.'.$prefix.'_'.$rule} ne '0')) { |
|
$ruleok = 1; |
|
} |
|
if ($ruleok) { |
|
$newvalues->{$rule} = $env{'form.'.$prefix.'_'.$rule}; |
|
if (exists($current->{$rule})) { |
|
if ($newvalues->{$rule} ne $current->{$rule}) { |
|
$changes->{'rules'} = 1; |
|
} |
|
} elsif ($rule eq 'min') { |
|
if ($staticdefaults{$rule} ne $newvalues->{$rule}) { |
|
$changes->{'rules'} = 1; |
|
} |
|
} else { |
|
$changes->{'rules'} = 1; |
|
} |
|
} elsif (exists($current->{$rule})) { |
|
$changes->{'rules'} = 1; |
|
} |
|
} |
|
my @posschars = &Apache::loncommon::get_env_multiple('form.'.$prefix.'_chars'); |
|
my @chars; |
|
foreach my $item (sort(@posschars)) { |
|
if ($item =~ /^(uc|lc|num|spec)$/) { |
|
push(@chars,$item); |
|
} |
|
} |
|
$newvalues->{'chars'} = \@chars; |
|
unless ($changes->{'rules'}) { |
|
if (ref($current->{'chars'}) eq 'ARRAY') { |
|
my @diffs = &Apache::loncommon::compare_arrays($current->{'chars'},\@chars); |
|
if (@diffs > 0) { |
|
$changes->{'rules'} = 1; |
|
} |
|
} else { |
|
if (@chars > 0) { |
|
$changes->{'rules'} = 1; |
|
} |
|
} |
|
} |
|
return; |
|
} |
|
|
sub modify_usercreation { |
sub modify_usercreation { |
my ($dom,%domconfig) = @_; |
my ($dom,%domconfig) = @_; |
my ($resulttext,%curr_usercreation,%changes,%authallowed,%cancreate,%save_usercreate); |
my ($resulttext,%curr_usercreation,%changes,%authallowed,%cancreate,%save_usercreate); |
Line 19201 sub modify_defaults {
|
Line 20017 sub modify_defaults {
|
$newvalues{$item} = $staticdefaults{$item}; |
$newvalues{$item} = $staticdefaults{$item}; |
} |
} |
} |
} |
|
my ($unamemaprules,$ruleorder); |
|
my @possunamemaprules = &Apache::loncommon::get_env_multiple('form.unamemap_rule'); |
|
if (@possunamemaprules) { |
|
($unamemaprules,$ruleorder) = |
|
&Apache::lonnet::inst_userrules($dom,'unamemap'); |
|
if ((ref($unamemaprules) eq 'HASH') && (ref($ruleorder) eq 'ARRAY')) { |
|
if (@{$ruleorder} > 0) { |
|
my %possrules; |
|
map { $possrules{$_} = 1; } @possunamemaprules; |
|
foreach my $rule (@{$ruleorder}) { |
|
if ($possrules{$rule}) { |
|
push(@{$newvalues{'unamemap_rule'}},$rule); |
|
} |
|
} |
|
} |
|
} |
|
} |
|
if (ref($domdefaults{'unamemap_rule'}) eq 'ARRAY') { |
|
if (ref($newvalues{'unamemap_rule'}) eq 'ARRAY') { |
|
my @rulediffs = &Apache::loncommon::compare_arrays($domdefaults{'unamemap_rule'}, |
|
$newvalues{'unamemap_rule'}); |
|
if (@rulediffs) { |
|
$changes{'unamemap_rule'} = 1; |
|
$domdefaults{'unamemap_rule'} = $newvalues{'unamemap_rule'}; |
|
} |
|
} elsif (@{$domdefaults{'unamemap_rule'}} > 0) { |
|
$changes{'unamemap_rule'} = 1; |
|
delete($domdefaults{'unamemap_rule'}); |
|
} |
|
} elsif (ref($newvalues{'unamemap_rule'}) eq 'ARRAY') { |
|
if (@{$newvalues{'unamemap_rule'}} > 0) { |
|
$changes{'unamemap_rule'} = 1; |
|
$domdefaults{'unamemap_rule'} = $newvalues{'unamemap_rule'}; |
|
} |
|
} |
my %defaults_hash = ( |
my %defaults_hash = ( |
defaults => \%newvalues, |
defaults => \%newvalues, |
); |
); |
Line 19315 sub modify_defaults {
|
Line 20166 sub modify_defaults {
|
$resulttext .= '<li>'.&mt('Institutional user status types deleted').'</li>'; |
$resulttext .= '<li>'.&mt('Institutional user status types deleted').'</li>'; |
} |
} |
} |
} |
|
} elsif ($item eq 'unamemap_rule') { |
|
if (ref($newvalues{'unamemap_rule'}) eq 'ARRAY') { |
|
my @rulenames; |
|
if (ref($unamemaprules) eq 'HASH') { |
|
foreach my $rule (@{$newvalues{'unamemap_rule'}}) { |
|
if (ref($unamemaprules->{$rule}) eq 'HASH') { |
|
push(@rulenames,$unamemaprules->{$rule}->{'name'}); |
|
} |
|
} |
|
} |
|
if (@rulenames) { |
|
$resulttext .= '<li>'.&mt('Mapping for missing usernames includes: [_1]', |
|
'<ul><li>'.join('</li><li>',@rulenames).'</li></ul>'). |
|
'</li>'; |
|
} else { |
|
$resulttext .= '<li>'.&mt('No mapping for missing usernames via standard log-in').'</li>'; |
|
} |
|
} else { |
|
$resulttext .= '<li>'.&mt('Mapping for missing usernames via standard log-in deleted').'</li>'; |
|
} |
} else { |
} else { |
my $value = $env{'form.'.$item}; |
my $value = $env{'form.'.$item}; |
if ($value eq '') { |
if ($value eq '') { |
Line 20304 sub modify_coursedefaults {
|
Line 21175 sub modify_coursedefaults {
|
my %defaultchecked = ( |
my %defaultchecked = ( |
'canuse_pdfforms' => 'off', |
'canuse_pdfforms' => 'off', |
'uselcmath' => 'on', |
'uselcmath' => 'on', |
'usejsme' => 'on' |
'usejsme' => 'on', |
|
'inline_chem' => 'on', |
|
'ltiauth' => 'off', |
); |
); |
my @toggles = ('canuse_pdfforms','uselcmath','usejsme'); |
my @toggles = ('canuse_pdfforms','uselcmath','usejsme','inline_chem','ltiauth'); |
my @numbers = ('anonsurvey_threshold','uploadquota_official','uploadquota_unofficial', |
my @numbers = ('anonsurvey_threshold','uploadquota_official','uploadquota_unofficial', |
'uploadquota_community','uploadquota_textbook','uploadquota_placement', |
'uploadquota_community','uploadquota_textbook','uploadquota_placement', |
'mysqltables_official','mysqltables_unofficial','mysqltables_community', |
'mysqltables_official','mysqltables_unofficial','mysqltables_community', |
Line 20516 sub modify_coursedefaults {
|
Line 21389 sub modify_coursedefaults {
|
my %domdefaults = &Apache::lonnet::get_domain_defaults($dom,1); |
my %domdefaults = &Apache::lonnet::get_domain_defaults($dom,1); |
if (($changes{'canuse_pdfforms'}) || ($changes{'uploadquota'}) || ($changes{'postsubmit'}) || |
if (($changes{'canuse_pdfforms'}) || ($changes{'uploadquota'}) || ($changes{'postsubmit'}) || |
($changes{'coursecredits'}) || ($changes{'uselcmath'}) || ($changes{'usejsme'}) || |
($changes{'coursecredits'}) || ($changes{'uselcmath'}) || ($changes{'usejsme'}) || |
($changes{'canclone'}) || ($changes{'mysqltables'}) || ($changes{'texengine'})) { |
($changes{'canclone'}) || ($changes{'mysqltables'}) || ($changes{'texengine'}) || |
foreach my $item ('canuse_pdfforms','uselcmath','usejsme','texengine') { |
($changes{'inline_chem'}) || ($changes{'ltiauth'})) { |
|
foreach my $item ('canuse_pdfforms','uselcmath','usejsme','inline_chem','texengine','ltiauth') { |
if ($changes{$item}) { |
if ($changes{$item}) { |
$domdefaults{$item}=$defaultshash{'coursedefaults'}{$item}; |
$domdefaults{$item}=$defaultshash{'coursedefaults'}{$item}; |
} |
} |
Line 20586 sub modify_coursedefaults {
|
Line 21460 sub modify_coursedefaults {
|
} else { |
} else { |
$resulttext .= '<li>'.&mt('Molecule editor uses JME (Java), if supported by client OS.').'</li>'; |
$resulttext .= '<li>'.&mt('Molecule editor uses JME (Java), if supported by client OS.').'</li>'; |
} |
} |
|
} elsif ($item eq 'inline_chem') { |
|
if ($env{'form.'.$item} eq '1') { |
|
$resulttext .= '<li>'.&mt('Chemical Reaction Response uses inline previewer').'</li>'; |
|
} else { |
|
$resulttext .= '<li>'.&mt('Chemical Reaction Response uses pop-up previewer').'</li>'; |
|
} |
} elsif ($item eq 'texengine') { |
} elsif ($item eq 'texengine') { |
if ($defaultshash{'coursedefaults'}{'texengine'} ne '') { |
if ($defaultshash{'coursedefaults'}{'texengine'} ne '') { |
$resulttext .= '<li>'.&mt('Default method to display mathematics set to: "[_1]"', |
$resulttext .= '<li>'.&mt('Default method to display mathematics set to: "[_1]"', |
Line 20685 sub modify_coursedefaults {
|
Line 21565 sub modify_coursedefaults {
|
} else { |
} else { |
$resulttext .= '<li>'.&mt('By default, only course owner and coordinators may clone a course.').'</li>'; |
$resulttext .= '<li>'.&mt('By default, only course owner and coordinators may clone a course.').'</li>'; |
} |
} |
|
} elsif ($item eq 'ltiauth') { |
|
if ($env{'form.'.$item} eq '1') { |
|
$resulttext .= '<li>'.&mt('LTI launch of deep-linked URL need not require re-authentication').'</li>'; |
|
} else { |
|
$resulttext .= '<li>'.&mt('LTI launch of deep-linked URL will require re-authentication').'</li>'; |
|
} |
} |
} |
} |
} |
$resulttext .= '</ul>'; |
$resulttext .= '</ul>'; |
Line 21156 sub modify_wafproxy {
|
Line 22042 sub modify_wafproxy {
|
} |
} |
} |
} |
$output = &mt('Changes were made to Web Application Firewall/Reverse Proxy').'<ul>'; |
$output = &mt('Changes were made to Web Application Firewall/Reverse Proxy').'<ul>'; |
foreach my $item ('alias','remoteip','ipheader','trusted','vpnint','vpnext','sslopt') { |
foreach my $item ('alias','saml','remoteip','ipheader','trusted','vpnint','vpnext','sslopt') { |
if ($changes{$item}) { |
if ($changes{$item}) { |
if ($item eq 'alias') { |
if ($item eq 'alias') { |
my $numaliased = 0; |
my $numaliased = 0; |
Line 21925 sub modify_trust {
|
Line 22811 sub modify_trust {
|
} |
} |
my $cachetime = 24*60*60; |
my $cachetime = 24*60*60; |
&Apache::lonnet::do_cache_new('domdefaults',$dom,\%domdefaults,$cachetime); |
&Apache::lonnet::do_cache_new('domdefaults',$dom,\%domdefaults,$cachetime); |
|
&Apache::lonnet::do_cache_new('trust',$dom,$defaultshash{'trust'},3600); |
if (ref($lastactref) eq 'HASH') { |
if (ref($lastactref) eq 'HASH') { |
$lastactref->{'domdefaults'} = 1; |
$lastactref->{'domdefaults'} = 1; |
|
$lastactref->{'trust'} = 1; |
} |
} |
if (keys(%changes) > 0) { |
if (keys(%changes) > 0) { |
my %lt = &trust_titles(); |
my %lt = &trust_titles(); |
Line 22995 sub devalidate_remote_domconfs {
|
Line 23883 sub devalidate_remote_domconfs {
|
map { $thismachine{$_} = 1; } &Apache::lonnet::current_machine_ids(); |
map { $thismachine{$_} = 1; } &Apache::lonnet::current_machine_ids(); |
my @posscached = ('domainconfig','domdefaults','ltitools','usersessions', |
my @posscached = ('domainconfig','domdefaults','ltitools','usersessions', |
'directorysrch','passwdconf','cats','proxyalias','proxysaml', |
'directorysrch','passwdconf','cats','proxyalias','proxysaml', |
'ipaccess'); |
'ipaccess','trust'); |
my %cache_by_lonhost; |
my %cache_by_lonhost; |
if (exists($cachekeys->{'samllanding'})) { |
if (exists($cachekeys->{'samllanding'})) { |
if (ref($cachekeys->{'samllanding'}) eq 'HASH') { |
if (ref($cachekeys->{'samllanding'}) eq 'HASH') { |