'.$domservers{$lonhost}.' | '.
' | '.
''.
- ''.&mt('SSO').' | '.
- ''.&mt('Non-SSO').' | '.
+ ' '.
+ ''.
' | ';
@@ -2370,7 +2383,7 @@ sub print_quotas {
@options = ('norequest','approval','automatic');
%titles = &authorrequest_titles();
} else {
- @usertools = ('aboutme','blog','webdav','portfolio');
+ @usertools = ('aboutme','blog','webdav','portfolio','timezone');
%titles = &tool_titles();
}
if (ref($types) eq 'ARRAY') {
@@ -2474,9 +2487,12 @@ sub print_quotas {
}
} else {
my $checked = 'checked="checked" ';
+ if ($item eq 'timezone') {
+ $checked = '';
+ }
if (ref($settings) eq 'HASH') {
if (ref($settings->{$item}) eq 'HASH') {
- if ($settings->{$item}->{$type} == 0) {
+ if (!$settings->{$item}->{$type}) {
$checked = '';
} elsif ($settings->{$item}->{$type} == 1) {
$checked = 'checked="checked" ';
@@ -6567,12 +6583,12 @@ sub print_lti {
' '.
''.&mt('New Key').':'.
- ''.
+ ''.
''.
'';
} else {
$extra .= ''.&mt('Encryption Key').':'.
- ''.
+ ''.
'';
}
$extra .= '';
@@ -7698,13 +7714,15 @@ sub print_privacy {
my ($position,$dom,$settings,$rowtotal) = @_;
my ($datatable,$css_class,$numinrow,@items,%names,$othertitle,$usertypes,$types);
my $itemcount = 0;
- unless ($position eq 'top') {
+ if ($position eq 'top') {
+ $numinrow = 2;
+ } else {
@items = ('domain','author','course','community');
%names = &Apache::lonlocal::texthash (
domain => 'Assigned domain role(s)',
author => 'Assigned co-author role(s)',
course => 'Assigned course role(s)',
- community => 'Assigned community role',
+ community => 'Assigned community role(s)',
);
$numinrow = 4;
($othertitle,$usertypes,$types) =
@@ -7723,6 +7741,7 @@ sub print_privacy {
auto => 'Unrestricted',
instdom => 'Other domain shares institution/provider',
extdom => 'Other domain has different institution/provider',
+ notify => 'Receive notification of role requests requiring DC authorization',
);
my %names = &Apache::lonlocal::texthash (
domain => 'Domain role',
@@ -7774,6 +7793,28 @@ sub print_privacy {
$datatable .= '';
$itemcount ++;
}
+ $css_class = $itemcount%2?' class="LC_odd_row"':'';
+ $datatable .= ''.$titles{'notify'}.' | '.
+ '';
+ if ((@instdoms > 1) || (keys(%by_location) > 0)) {
+ my %curr;
+ if (ref($settings) eq 'HASH') {
+ if ($settings->{'notify'} ne '') {
+ map {$curr{$_}=1;} split(/,/,$settings->{'notify'});
+ }
+ }
+ $css_class = $itemcount%2?' class="LC_odd_row"':'';
+ my ($numdc,$table,$rows) = &active_dc_picker($dom,$numinrow,'checkbox',
+ 'privacy_notify',%curr);
+ if ($numdc > 0) {
+ $datatable .= $table;
+ } else {
+ $datatable .= &mt('There are no active Domain Coordinators');
+ }
+ } else {
+ $datatable .= &mt('Nothing to set here, as there are no other domains');
+ }
+ $datatable .=' | ';
} elsif ($position eq 'middle') {
if ((@instdoms > 1) || (keys(%by_location) > 0)) {
if ((ref($types) eq 'ARRAY') && (ref($usertypes) eq 'HASH')) {
@@ -9688,6 +9729,7 @@ sub tool_titles {
blog => 'Blog',
webdav => 'WebDAV',
portfolio => 'Portfolio',
+ timezone => 'Can set time zone',
official => 'Official courses (with institutional codes)',
unofficial => 'Unofficial courses',
community => 'Communities',
@@ -10658,13 +10700,29 @@ sub print_defaults {
} elsif ($item eq 'lang_def') {
my $includeempty = 1;
$datatable .= &Apache::loncommon::select_language($item,$defaults{$item},$includeempty);
- } else {
- my $size;
- if ($item eq 'portal_def') {
- $size = ' size="25"';
- }
+ } elsif ($item eq 'portal_def') {
$datatable .= '';
+ $defaults{$item}.'" size="25" onkeyup="portalExtras(this);" />';
+ my $portalsty = 'none';
+ if ($defaults{$item}) {
+ $portalsty = 'block';
+ }
+ foreach my $field ('email','web') {
+ my $checkedoff = ' checked="checked"';
+ my $checkedon;
+ if ($defaults{$item.'_'.$field}) {
+ $checkedon = $checkedoff;
+ $checkedoff = '';
+ }
+ $datatable .= ''.
+ ''.$titles->{$field}.' '.
+ ''.
+ (' 'x2).
+ ''.
+ ' ';
+ }
+ } else {
+ $datatable .= '';
}
$datatable .= '';
$rownum ++;
@@ -10760,6 +10818,8 @@ sub defaults_titles {
'timezone_def' => 'Default timezone',
'datelocale_def' => 'Default locale for dates',
'portal_def' => 'Portal/Default URL',
+ 'email' => 'Email links use portal URL',
+ 'web' => 'Public web links use portal URL',
'intauth_cost' => 'Encryption cost for bcrypt (positive integer)',
'intauth_check' => 'Check bcrypt cost if authenticated',
'intauth_switch' => 'Existing crypt-based switched to bcrypt on authentication',
@@ -11474,6 +11534,23 @@ sub serverstatus_pages {
sub defaults_javascript {
my ($settings) = @_;
return unless (ref($settings) eq 'HASH');
+ my $portal_js = <<"ENDPORTAL";
+
+function portalExtras(caller) {
+ var x = caller.value;
+ var y = new Array('email','web');
+ for (var i=0; i 0) {
+ z.style.display = 'block';
+ } else {
+ z.style.display = 'none';
+ }
+ }
+ }
+}
+ENDPORTAL
if ((ref($settings->{'inststatusorder'}) eq 'ARRAY') && (ref($settings->{'inststatustypes'}) eq 'HASH')) {
my $maxnum = scalar(@{$settings->{'inststatusorder'}});
if ($maxnum eq '') {
@@ -11527,6 +11604,17 @@ $jstext
return;
}
+$portal_js
+
+// ]]>
+
+
+ENDSCRIPT
+ } else {
+return <<"ENDSCRIPT";
+
@@ -12254,7 +12342,7 @@ sub modify_login {
my ($r,$dom,$confname,$lastactref,%domconfig) = @_;
my ($resulttext,$errors,$colchgtext,%changes,%colchanges,%newfile,%newurl,
%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',
adminmail => 'Display administrator E-mail address',
helpdesk => 'Display "Contact Helpdesk" link',
@@ -12278,6 +12366,7 @@ sub modify_login {
$samlalt{$lonhost} = $domconfig{login}{'saml'}{$lonhost}{'alt'};
$samlimg{$lonhost} = $domconfig{login}{'saml'}{$lonhost}{'img'};
$samltitle{$lonhost} = $domconfig{login}{'saml'}{$lonhost}{'title'};
+ $samlwindow{$lonhost} = $domconfig{login}{'saml'}{$lonhost}{'window'};
$samlnotsso{$lonhost} = $domconfig{login}{'saml'}{$lonhost}{'notsso'};
}
}
@@ -12535,10 +12624,13 @@ sub modify_login {
if ($env{'form.saml_img_'.$lonhost.'.filename'}) {
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;
}
if ($saml{$lonhost}) {
+ if ($env{'form.saml_window_'.$lonhost} ne '1') {
+ $env{'form.saml_window_'.$lonhost} = '';
+ }
if (grep(/^\Q$lonhost\E$/,@delsamlimg)) {
#FIXME Need to obsolete published image
delete($currsaml{$lonhost}{'img'});
@@ -12556,13 +12648,16 @@ sub modify_login {
if ($env{'form.saml_title_'.$lonhost} ne $samltitle{$lonhost}) {
$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}) {
$changes{'saml'}{$lonhost} = 1;
}
} else {
$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};
}
} else {
@@ -12763,19 +12858,22 @@ sub modify_login {
alt => 'Alt text for button image',
url => 'SSO URL',
title => 'Tooltip for SSO link',
+ window => 'Pop-up window if iframe',
notsso => 'Text for non-SSO log-in',
);
foreach my $lonhost (sort(keys(%{$changes{$item}}))) {
if (ref($currsaml{$lonhost}) eq 'HASH') {
$resulttext .= ''.&mt("$title{$item} in use for [_1]","$lonhost").
'';
- foreach my $key ('text','img','alt','url','title','notsso') {
+ foreach my $key ('text','img','alt','url','title','window','notsso') {
if ($currsaml{$lonhost}{$key} eq '') {
$resulttext .= '- '.&mt("$notlt{$key} not in use").'
';
} else {
my $value = "'$currsaml{$lonhost}{$key}'";
if ($key eq 'img') {
$value = '';
+ } elsif ($key eq 'window') {
+ $value = 'On';
}
$resulttext .= '- '.&mt("$notlt{$key} set to: [_1]",
$value).'
';
@@ -13940,7 +14038,7 @@ sub modify_quotas {
@usertools = ('author');
%titles = &authorrequest_titles();
} else {
- @usertools = ('aboutme','blog','webdav','portfolio');
+ @usertools = ('aboutme','blog','webdav','portfolio','timezone');
%titles = &tool_titles();
}
my %domdefaults = &Apache::lonnet::get_domain_defaults($dom,1);
@@ -17877,7 +17975,7 @@ sub modify_privacy {
domain => 'Assigned domain role(s)',
author => 'Assigned co-author role(s)',
course => 'Assigned course role(s)',
- community => 'Assigned community role',
+ community => 'Assigned community role(s)',
);
my %roles = &Apache::lonlocal::texthash (
domain => 'Domain role',
@@ -17896,6 +17994,7 @@ sub modify_privacy {
user => 'User authorizes',
domain => 'Domain Coordinator authorizes',
auto => 'Unrestricted',
+ notify => 'Receive notification of role requests requiring DC authorization',
);
my %fieldnames = &Apache::lonlocal::texthash (
id => 'Student/Employee ID',
@@ -17921,7 +18020,7 @@ sub modify_privacy {
);
foreach my $item (@items) {
if (@instdoms > 1) {
- if ($env{'form.privacy_approval_instdom'.$item} =~ /^(none|user|domain|auto)$/) {
+ if ($env{'form.privacy_approval_instdom_'.$item} =~ /^(none|user|domain|auto)$/) {
$privacyhash{'approval'}{'instdom'}{$item} = $env{'form.privacy_approval_instdom_'.$item};
}
if (ref($current{'approval'}) eq 'HASH') {
@@ -18013,6 +18112,18 @@ sub modify_privacy {
}
}
}
+ my %domcoords = &Apache::lonnet::get_active_domroles($dom,['dc']);
+ my %notify;
+ foreach my $possdc (&Apache::loncommon::get_env_multiple('form.privacy_notify')) {
+ if (exists($domcoords{$possdc})) {
+ $notify{$possdc} = 1;
+ }
+ }
+ my $notify = join(',',sort(keys(%notify)));
+ if ($current{'notify'} ne $notify) {
+ $changes{'notify'} = 1;
+ }
+ $privacyhash{'notify'} = $notify;
}
my %confighash = (
privacy => \%privacyhash,
@@ -18021,7 +18132,7 @@ sub modify_privacy {
if ($putresult eq 'ok') {
if (keys(%changes) > 0) {
$resulttext = &mt('Changes made: ').'';
- foreach my $key ('approval','othdom','priv','unpriv') {
+ foreach my $key ('approval','notify','othdom','priv','unpriv') {
if ($changes{$key}) {
$resulttext .= '- '.$titles{$key}.':
';
if ($key eq 'approval') {
@@ -18039,6 +18150,15 @@ sub modify_privacy {
}
$resulttext .= ' ';
}
+ } elsif ($key eq 'notify') {
+ if ($privacyhash{$key}) {
+ foreach my $dc (split(/,/,$privacyhash{$key})) {
+ my ($dcname,$dcdom) = split(/:/,$dc);
+ $resulttext .= '- '.&Apache::loncommon::plainname($dcname,$dcdom).'
';
+ }
+ } else {
+ $resulttext .= '- '.&mt('No DCs to notify').'
';
+ }
} elsif ($key eq 'othdom') {
my @statuses;
if (ref($types) eq 'ARRAY') {
@@ -19966,16 +20086,58 @@ sub modify_defaults {
}
} elsif ($item eq 'portal_def') {
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);
}
}
}
if (grep(/^\Q$item\E$/,@errors)) {
$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}) {
$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};
}
my %staticdefaults = (
@@ -20175,7 +20337,20 @@ sub modify_defaults {
$value = $authnames{$shortauth{$value}};
}
$resulttext .= '- '.&mt('[_1] set to "[_2]"',$title->{$item},$value).'
';
- $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 .= '- '.&mt('[_1] set to "[_2]"',$title->{$field},$value).'
';
+ }
+ }
+ }
}
}
$resulttext .= ' ';
|