version 1.160.6.118.2.11, 2023/01/23 03:28:37
|
version 1.160.6.118.2.12, 2023/01/23 17:40:19
|
Line 8520 sub print_defaults {
|
Line 8520 sub print_defaults {
|
} elsif ($item eq 'lang_def') { |
} elsif ($item eq 'lang_def') { |
my $includeempty = 1; |
my $includeempty = 1; |
$datatable .= &Apache::loncommon::select_language($item,$defaults{$item},$includeempty); |
$datatable .= &Apache::loncommon::select_language($item,$defaults{$item},$includeempty); |
} else { |
} elsif ($item eq 'portal_def') { |
my $size; |
|
if ($item eq 'portal_def') { |
|
$size = ' size="25"'; |
|
} |
|
$datatable .= '<input type="text" name="'.$item.'" value="'. |
$datatable .= '<input type="text" name="'.$item.'" value="'. |
$defaults{$item}.'"'.$size.' />'; |
$defaults{$item}.'" size="25" onkeyup="portalExtras(this);" />'; |
|
my $portalsty = 'none'; |
|
if ($defaults{$item}) { |
|
$portalsty = 'block'; |
|
} |
|
foreach my $field ('email','web') { |
|
my $checkedoff = ' checked="checked"'; |
|
my $checkedon; |
|
if ($defaults{$item.'_'.$field}) { |
|
$checkedon = $checkedoff; |
|
$checkedoff = ''; |
|
} |
|
$datatable .= '<div id="'.$item.'_'.$field.'_div" style="display:'.$portalsty.'">'. |
|
'<span class="LC_nobreak">'.$titles->{$field}.' '. |
|
'<label><input type="radio" name="'.$item.'_'.$field.'" value="1"'.$checkedon.'/>'.&mt('Yes').'</label>'. |
|
(' 'x2). |
|
'<label><input type="radio" name="'.$item.'_'.$field.'" value="0"'.$checkedoff.'/>'.&mt('No').'</label>'. |
|
'</div>'; |
|
} |
|
} else { |
|
$datatable .= '<input type="text" name="'.$item.'" value="'.$defaults{$item}.'" />'; |
} |
} |
$datatable .= '</td></tr>'; |
$datatable .= '</td></tr>'; |
$rownum ++; |
$rownum ++; |
Line 8622 sub defaults_titles {
|
Line 8638 sub defaults_titles {
|
'timezone_def' => 'Default timezone', |
'timezone_def' => 'Default timezone', |
'datelocale_def' => 'Default locale for dates', |
'datelocale_def' => 'Default locale for dates', |
'portal_def' => 'Portal/Default URL', |
'portal_def' => 'Portal/Default URL', |
|
'email' => 'Email links use portal URL', |
|
'web' => 'Public web links use portal URL', |
'intauth_cost' => 'Encryption cost for bcrypt (positive integer)', |
'intauth_cost' => 'Encryption cost for bcrypt (positive integer)', |
'intauth_check' => 'Check bcrypt cost if authenticated', |
'intauth_check' => 'Check bcrypt cost if authenticated', |
'intauth_switch' => 'Existing crypt-based switched to bcrypt on authentication', |
'intauth_switch' => 'Existing crypt-based switched to bcrypt on authentication', |
Line 9304 sub serverstatus_pages {
|
Line 9322 sub serverstatus_pages {
|
sub defaults_javascript { |
sub defaults_javascript { |
my ($settings) = @_; |
my ($settings) = @_; |
return unless (ref($settings) eq 'HASH'); |
return unless (ref($settings) eq 'HASH'); |
|
my $portal_js = <<"ENDPORTAL"; |
|
|
|
function portalExtras(caller) { |
|
var x = caller.value; |
|
var y = new Array('email','web'); |
|
for (var i=0; i<y.length; i++) { |
|
if (document.getElementById('portal_def_'+y[i]+'_div')) { |
|
var z = document.getElementById('portal_def_'+y[i]+'_div'); |
|
if (x.length > 0) { |
|
z.style.display = 'block'; |
|
} else { |
|
z.style.display = 'none'; |
|
} |
|
} |
|
} |
|
} |
|
ENDPORTAL |
if ((ref($settings->{'inststatusorder'}) eq 'ARRAY') && (ref($settings->{'inststatustypes'}) eq 'HASH')) { |
if ((ref($settings->{'inststatusorder'}) eq 'ARRAY') && (ref($settings->{'inststatustypes'}) eq 'HASH')) { |
my $maxnum = scalar(@{$settings->{'inststatusorder'}}); |
my $maxnum = scalar(@{$settings->{'inststatusorder'}}); |
if ($maxnum eq '') { |
if ($maxnum eq '') { |
Line 9357 $jstext
|
Line 9392 $jstext
|
return; |
return; |
} |
} |
|
|
|
$portal_js |
|
|
|
// ]]> |
|
</script> |
|
|
|
ENDSCRIPT |
|
} else { |
|
return <<"ENDSCRIPT"; |
|
<script type="text/javascript"> |
|
// <![CDATA[ |
|
$portal_js |
// ]]> |
// ]]> |
</script> |
</script> |
|
|
Line 16366 sub modify_defaults {
|
Line 16412 sub modify_defaults {
|
} |
} |
} elsif ($item eq 'portal_def') { |
} elsif ($item eq 'portal_def') { |
if ($newvalues{$item} ne '') { |
if ($newvalues{$item} ne '') { |
unless ($newvalues{$item} =~ /^https?\:\/\/(([a-zA-Z0-9]|[a-zA-Z0-9][a-zA-Z0-9\-]*[a-zA-Z0-9])\.)*([A-Za-z]|[A-Za-z][A-Za-z0-9\-]*[A-Za-z0-9])\/?$/) { |
if ($newvalues{$item} =~ /^https?\:\/\/(([a-zA-Z0-9]|[a-zA-Z0-9][a-zA-Z0-9\-]*[a-zA-Z0-9])\.)*([A-Za-z]|[A-Za-z][A-Za-z0-9\-]*[A-Za-z0-9])\/?$/) { |
|
foreach my $field ('email','web') { |
|
if ($env{'form.'.$item.'_'.$field}) { |
|
$newvalues{$item.'_'.$field} = $env{'form.'.$item.'_'.$field}; |
|
} |
|
} |
|
} else { |
push(@errors,$item); |
push(@errors,$item); |
} |
} |
} |
} |
} |
} |
if (grep(/^\Q$item\E$/,@errors)) { |
if (grep(/^\Q$item\E$/,@errors)) { |
$newvalues{$item} = $domdefaults{$item}; |
$newvalues{$item} = $domdefaults{$item}; |
|
if ($item eq 'portal_def') { |
|
if ($domdefaults{$item}) { |
|
foreach my $field ('email','web') { |
|
if (exists($domdefaults{$item.'_'.$field})) { |
|
$newvalues{$item.'_'.$field} = $domdefaults{$item.'_'.$field}; |
|
} |
|
} |
|
} |
|
} |
} elsif ($domdefaults{$item} ne $newvalues{$item}) { |
} elsif ($domdefaults{$item} ne $newvalues{$item}) { |
$changes{$item} = 1; |
$changes{$item} = 1; |
} |
} |
|
if ($item eq 'portal_def') { |
|
unless (grep(/^\Q$item\E$/,@errors)) { |
|
if ($newvalues{$item} eq '') { |
|
foreach my $field ('email','web') { |
|
if (exists($domdefaults{$item.'_'.$field})) { |
|
delete($domdefaults{$item.'_'.$field}); |
|
} |
|
} |
|
} else { |
|
unless ($changes{$item}) { |
|
foreach my $field ('email','web') { |
|
if ($domdefaults{$item.'_'.$field} ne $newvalues{$item.'_'.$field}) { |
|
$changes{$item} = 1; |
|
last; |
|
} |
|
} |
|
} |
|
foreach my $field ('email','web') { |
|
if ($newvalues{$item.'_'.$field}) { |
|
$domdefaults{$item.'_'.$field} = $newvalues{$item.'_'.$field}; |
|
} elsif (exists($domdefaults{$item.'_'.$field})) { |
|
delete($domdefaults{$item.'_'.$field}); |
|
} |
|
} |
|
} |
|
} |
|
} |
$domdefaults{$item} = $newvalues{$item}; |
$domdefaults{$item} = $newvalues{$item}; |
} |
} |
my %staticdefaults = ( |
my %staticdefaults = ( |
Line 16576 sub modify_defaults {
|
Line 16664 sub modify_defaults {
|
$value = $authnames{$shortauth{$value}}; |
$value = $authnames{$shortauth{$value}}; |
} |
} |
$resulttext .= '<li>'.&mt('[_1] set to "[_2]"',$title->{$item},$value).'</li>'; |
$resulttext .= '<li>'.&mt('[_1] set to "[_2]"',$title->{$item},$value).'</li>'; |
$mailmsgtext .= "$title->{$item} set to $value\n"; |
$mailmsgtext .= "$title->{$item} set to $value\n"; |
|
if ($item eq 'portal_def') { |
|
if ($env{'form.'.$item} ne '') { |
|
foreach my $field ('email','web') { |
|
$value = $env{'form.'.$item.'_'.$field}; |
|
if ($value) { |
|
$value = &mt('Yes'); |
|
} else { |
|
$value = &mt('No'); |
|
} |
|
$resulttext .= '<li>'.&mt('[_1] set to "[_2]"',$title->{$field},$value).'</li>'; |
|
} |
|
} |
|
} |
} |
} |
} |
} |
$resulttext .= '</ul>'; |
$resulttext .= '</ul>'; |