'.
- "$description | \n".
+ "$description | \n".
''.
'';
- my %headers = &Apache::lonlocal::texthash(
+ my %headers = &Apache::lonlocal::texthash(
approve => 'Processing',
email => 'E-mail',
username => 'Username',
@@ -10012,7 +10054,7 @@ sub noninst_users {
my $value;
if (ref($emaildomain) eq 'HASH') {
if (ref($emaildomain->{$type}) eq 'HASH') {
- $value = $emaildomain->{$type}->{$option};
+ $value = $emaildomain->{$type}->{$option};
}
}
if ($value eq '') {
@@ -10330,7 +10372,7 @@ sub print_defaults {
if ($defaults{$item.'_'.$field}) {
$checkedon = $checkedoff;
$checkedoff = '';
- }
+ }
$datatable .= ''.
' '.$titles->{$field}.' '.
''.
@@ -11159,7 +11201,7 @@ sub defaults_javascript {
function portalExtras(caller) {
var x = caller.value;
var y = new Array('email','web');
- for (var i=0; i 0) {
@@ -11263,7 +11305,7 @@ sub passwords_javascript {
}
&js_escape(\%intalert);
my $defmin = $Apache::lonnet::passwdmin;
- my $intauthjs;
+ my $intauthjs;
if ($prefix eq 'passwords') { $intauthjs = <<"ENDSCRIPT";
function warnIntAuth(field) {
@@ -11657,7 +11699,6 @@ sub modifiable_userdata_row {
'';
my $rem;
my %checks;
- my %current;
if (ref($settings) eq 'HASH') {
my $hashref;
if ($context eq 'lti') {
@@ -11683,7 +11724,7 @@ sub modifiable_userdata_row {
}
}
}
- if (ref($hashref) eq 'HASH') {
+ if (ref($hashref) eq 'HASH') {
foreach my $field (@fields) {
if ($hashref->{$field}) {
if ($role eq 'emailusername') {
@@ -11695,7 +11736,6 @@ sub modifiable_userdata_row {
}
}
}
-
my $total = scalar(@fields);
for (my $i=0; $i<$total; $i++) {
$rem = $i%($numinrow);
@@ -11859,7 +11899,7 @@ sub insttypes_row {
} else {
$output .= '';
}
- $output .= ' ';
+ $output .= ' ';
} else {
if ($rem == 0) {
$output .= ' | ';
@@ -12135,7 +12175,7 @@ sub modify_login {
if ($lang eq $env{'form.loginhelpurl_add_lang'}) {
$formelem = 'loginhelpurl_add_file';
}
- (my $result,$newurl{$lang}) =
+ (my $result,$newurl{$lang}) =
&Apache::lonconfigsettings::publishlogo($r,'upload',$formelem,$dom,$confname,
"help/$lang",'','',$newfile{$lang},
$modified);
@@ -12212,7 +12252,7 @@ sub modify_login {
my $modified = [];
foreach my $lonhost (@newhosts) {
my $formelem = 'loginheadtag_'.$lonhost;
- (my $result,$newheadtagurls{$lonhost}) =
+ (my $result,$newheadtagurls{$lonhost}) =
&Apache::lonconfigsettings::publishlogo($r,'upload',$formelem,$dom,$confname,
"login/headtag/$lonhost",'','',
$env{'form.loginheadtag_'.$lonhost.'.filename'},
@@ -12289,15 +12329,15 @@ sub modify_login {
$currsaml{$lonhost}{$item} = $env{'form.saml_'.$item.'_'.$lonhost};
}
} else {
- if ($saml{$lonhost}) {
+ if ($saml{$lonhost}) {
$changes{'saml'}{$lonhost} = 1;
delete($currsaml{$lonhost});
}
}
}
foreach my $posshost (keys(%currsaml)) {
- unless (exists($domservers{$posshost})) {
- delete($currsaml{$posshost});
+ unless (exists($domservers{$posshost})) {
+ delete($currsaml{$posshost});
}
}
%{$loginhash{'login'}{'saml'}} = %currsaml;
@@ -12311,7 +12351,7 @@ sub modify_login {
my $modified = [];
foreach my $lonhost (@newsamlimgs) {
my $formelem = 'saml_img_'.$lonhost;
- my ($result,$imgurl) =
+ my ($result,$imgurl) =
&Apache::lonconfigsettings::publishlogo($r,'upload',$formelem,$dom,$confname,
"login/saml/$lonhost",'','',
$env{'form.saml_img_'.$lonhost.'.filename'},
@@ -12681,7 +12721,7 @@ sub modify_ipaccess {
$possrange =~ s/,+/,/g;
if ($possrange ne '') {
my (@ok,$count);
- $count = 0;
+ $count = 0;
foreach my $poss (split(/\,/,$possrange)) {
$count ++;
$poss = &validate_ip_pattern($poss);
@@ -12714,9 +12754,9 @@ sub modify_ipaccess {
}
}
$confhash{$itemid}{'commblocks'} = {};
-
+
my %commblocks;
- map { $commblocks{$_} = 1; } &Apache::loncommon::get_env_multiple('form.ipaccess_block_'.$idx);
+ map { $commblocks{$_} = 1; } &Apache::loncommon::get_env_multiple('form.ipaccess_block_'.$idx);
foreach my $type (@{$typeorder}) {
if ($commblocks{$type}) {
$confhash{$itemid}{'commblocks'}{$type} = 'on';
@@ -12748,7 +12788,7 @@ sub modify_ipaccess {
}
$env{'form.ipaccess_cnum_'.$idx} =~ s/^\s+|\s+$//g;
$env{'form.ipaccess_cdom_'.$idx} =~ s/^\s+|\s+$//g;
- if (($env{'form.ipaccess_cnum_'.$idx} =~ /^$match_courseid$/) &&
+ if (($env{'form.ipaccess_cnum_'.$idx} =~ /^$match_courseid$/) &&
($env{'form.ipaccess_cdom_'.$idx} =~ /^$match_domain$/)) {
if (&Apache::lonnet::homeserver($env{'form.ipaccess_cnum_'.$idx},
$env{'form.ipaccess_cdom_'.$idx}) eq 'no_host') {
@@ -12828,7 +12868,7 @@ sub modify_ipaccess {
if (keys(%{$confhash{$itemid}{'courses'}})) {
my @courses;
foreach my $cid (sort(keys(%{$confhash{$itemid}{'courses'}}))) {
- my %courseinfo = &Apache::lonnet::coursedescription($cid,{'one_time' => 1});
+ my %courseinfo = &Apache::lonnet::coursedescription($cid,{'one_time' => 1});
push(@courses,$courseinfo{'description'}.' ('.$cid.')');
}
$resulttext .= ''.&mt('Courses/Communities allowed').':- '.
@@ -13423,15 +13463,21 @@ sub subscribed_hosts {
sub check_switchserver {
my ($dom,$confname) = @_;
- my ($allowed,$switchserver);
- my $home = &Apache::lonnet::homeserver($confname,$dom);
- if ($home eq 'no_host') {
+ my ($allowed,$switchserver,$home);
+ if ($confname eq '') {
$home = &Apache::lonnet::domain($dom,'primary');
+ } else {
+ $home = &Apache::lonnet::homeserver($confname,$dom);
+ if ($home eq 'no_host') {
+ $home = &Apache::lonnet::domain($dom,'primary');
+ }
}
my @ids=&Apache::lonnet::current_machine_ids();
foreach my $id (@ids) { if ($id eq $home) { $allowed=1; } }
if (!$allowed) {
- $switchserver=''.&mt('Switch Server').'';
+ $switchserver=''.&mt('Switch Server').'';
}
return $switchserver;
}
@@ -14352,7 +14398,6 @@ sub fetch_secrets {
foreach my $hostid (keys(%servers)) {
if (($hostid ne '') && (grep(/^\Q$hostid\E$/,@ids))) {
- my $newkey;
my $keyitem = 'form.'.$context.'_privkey_'.$hostid;
if (exists($env{$keyitem})) {
$env{$keyitem} =~ s/(`)/'/g;
@@ -14376,7 +14421,7 @@ sub fetch_secrets {
}
sub store_security {
- my ($dom,$context,$secchanges,$newkeyset,$keystore,$lastactref) = @_;
+ my ($dom,$context,$secchanges,$newkeyset,$keystore) = @_;
return unless ((ref($secchanges) eq 'HASH') && (ref($newkeyset) eq 'HASH') &&
(ref($keystore) eq 'HASH'));
if (keys(%{$secchanges})) {
@@ -14391,11 +14436,6 @@ sub store_security {
$dom,$hostid);
}
}
- if (ref($lastactref) eq 'HASH') {
- if (($secchanges->{'encrypt'}) || ($secchanges->{'private'})) {
- $lastactref->{'domdefaults'} = 1;
- }
- }
}
}
@@ -15075,7 +15115,7 @@ sub process_proctoring_image {
sub modify_lti {
my ($r,$dom,$action,$lastactref,%domconfig) = @_;
my %domdefaults = &Apache::lonnet::get_domain_defaults($dom,1);
- my ($newid,@allpos,%changes,%confhash,%encconfig,$errors,$resulttext);
+ my ($newid,@allpos,%changes,%confhash,%ltienc,$errors,$resulttext);
my (%posslti,%posslticrs,%posscrstype);
my @courseroles = ('cc','in','ta','ep','st');
my @ltiroles = qw(Learner Instructor ContentDeveloper TeachingAssistant Mentor Member Manager Administrator);
@@ -15189,29 +15229,43 @@ sub modify_lti {
}
}
}
+ my (%keystore,$secstored);
+ if ($is_home) {
+ &store_security($dom,'lti',\%secchanges,\%newkeyset,\%keystore);
+ }
+
+ my ($cipher,$privnum);
+ if ((@items > 0) && ($is_home)) {
+ ($cipher,$privnum) = &get_priv_creds($dom,$home,$secchanges{'encrypt'},
+ $newltisec{'encrypt'},$keystore{$home});
+ }
foreach my $idx (@items) {
my $itemid = $itemids{$idx};
next unless ($itemid);
+ my %currlti;
+ unless ($idx eq 'add') {
+ if (ref($domconfig{$action}) eq 'HASH') {
+ if (ref($domconfig{$action}{$itemid}) eq 'HASH') {
+ %currlti = %{$domconfig{$action}{$itemid}};
+ }
+ }
+ }
my $position = $env{'form.lti_pos_'.$itemid};
$position =~ s/\D+//g;
if ($position ne '') {
$allpos[$position] = $itemid;
}
- foreach my $item ('consumer','key','secret','lifetime','requser','crsinc') {
+ foreach my $item ('consumer','lifetime','requser','crsinc') {
my $formitem = 'form.lti_'.$item.'_'.$idx;
$env{$formitem} =~ s/(`)/'/g;
if ($item eq 'lifetime') {
$env{$formitem} =~ s/[^\d.]//g;
}
if ($env{$formitem} ne '') {
- if (($item eq 'key') || ($item eq 'secret')) {
- $encconfig{$itemid}{$item} = $env{$formitem};
- } else {
- $confhash{$itemid}{$item} = $env{$formitem};
- unless (($idx eq 'add') || ($changes{$itemid})) {
- if ($domconfig{$action}{$itemid}{$item} ne $confhash{$itemid}{$item}) {
- $changes{$itemid} = 1;
- }
+ $confhash{$itemid}{$item} = $env{$formitem};
+ unless (($idx eq 'add') || ($changes{$itemid})) {
+ if ($currlti{$item} ne $confhash{$itemid}{$item}) {
+ $changes{$itemid} = 1;
}
}
}
@@ -15352,27 +15406,27 @@ sub modify_lti {
unless (($idx eq 'add') || ($changes{$itemid})) {
if ($confhash{$itemid}{'crsinc'}) {
foreach my $field ('mapcrs','storecrs','makecrs','section','passback','roster') {
- if ($domconfig{$action}{$itemid}{$field} ne $confhash{$itemid}{$field}) {
+ if ($currlti{$field} ne $confhash{$itemid}{$field}) {
$changes{$itemid} = 1;
}
}
unless ($changes{$itemid}) {
- if ($domconfig{$action}{$itemid}{'passback'} eq $confhash{$itemid}{'passback'}) {
- if ($domconfig{$action}{$itemid}{'passbackformat'} ne $confhash{$itemid}{'passbackformat'}) {
+ if ($currlti{'passback'} eq $confhash{$itemid}{'passback'}) {
+ if ($currlti{'passbackformat'} ne $confhash{$itemid}{'passbackformat'}) {
$changes{$itemid} = 1;
}
}
}
foreach my $field ('mapcrstype','selfenroll') {
unless ($changes{$itemid}) {
- if (ref($domconfig{$action}{$itemid}{$field}) eq 'ARRAY') {
+ if (ref($currlti{$field}) eq 'ARRAY') {
if (ref($confhash{$itemid}{$field}) eq 'ARRAY') {
- my @diffs = &Apache::loncommon::compare_arrays($domconfig{$action}{$itemid}{$field},
+ my @diffs = &Apache::loncommon::compare_arrays($currlti{$field},
$confhash{$itemid}{$field});
if (@diffs) {
$changes{$itemid} = 1;
}
- } elsif (@{$domconfig{$action}{$itemid}{$field}} > 0) {
+ } elsif (@{$currlti{$field}} > 0) {
$changes{$itemid} = 1;
}
} elsif (ref($confhash{$itemid}{$field}) eq 'ARRAY') {
@@ -15383,10 +15437,10 @@ sub modify_lti {
}
}
unless ($changes{$itemid}) {
- if (ref($domconfig{$action}{$itemid}{'maproles'}) eq 'HASH') {
+ if (ref($currlti{'maproles'}) eq 'HASH') {
if (ref($confhash{$itemid}{'maproles'}) eq 'HASH') {
- foreach my $ltirole (keys(%{$domconfig{$action}{$itemid}{'maproles'}})) {
- if ($domconfig{$action}{$itemid}{'maproles'}{$ltirole} ne
+ foreach my $ltirole (keys(%{$currlti{'maproles'}})) {
+ if ($currlti{'maproles'}{$ltirole} ne
$confhash{$itemid}{'maproles'}{$ltirole}) {
$changes{$itemid} = 1;
last;
@@ -15395,13 +15449,13 @@ sub modify_lti {
unless ($changes{$itemid}) {
foreach my $ltirole (keys(%{$confhash{$itemid}{'maproles'}})) {
if ($confhash{$itemid}{'maproles'}{$ltirole} ne
- $domconfig{$action}{$itemid}{'maproles'}{$ltirole}) {
+ $currlti{'maproles'}{$ltirole}) {
$changes{$itemid} = 1;
last;
}
}
}
- } elsif (keys(%{$domconfig{$action}{$itemid}{'maproles'}}) > 0) {
+ } elsif (keys(%{$currlti{'maproles'}}) > 0) {
$changes{$itemid} = 1;
}
} elsif (ref($confhash{$itemid}{'maproles'}) eq 'HASH') {
@@ -15415,20 +15469,20 @@ sub modify_lti {
}
unless ($changes{$itemid}) {
foreach my $field ('mapuser','lcauth','lcauthparm','topmenu','inlinemenu','callback') {
- if ($domconfig{$action}{$itemid}{$field} ne $confhash{$itemid}{$field}) {
+ if ($currlti{$field} ne $confhash{$itemid}{$field}) {
$changes{$itemid} = 1;
}
}
unless ($changes{$itemid}) {
foreach my $field ('makeuser','lcmenu') {
- if (ref($domconfig{$action}{$itemid}{$field}) eq 'ARRAY') {
+ if (ref($currlti{$field}) eq 'ARRAY') {
if (ref($confhash{$itemid}{$field}) eq 'ARRAY') {
- my @diffs = &Apache::loncommon::compare_arrays($domconfig{$action}{$itemid}{$field},
+ my @diffs = &Apache::loncommon::compare_arrays($currlti{$field},
$confhash{$itemid}{$field});
if (@diffs) {
$changes{$itemid} = 1;
}
- } elsif (@{$domconfig{$action}{$itemid}{$field}} > 0) {
+ } elsif (@{$currlti{$field}} > 0) {
$changes{$itemid} = 1;
}
} elsif (ref($confhash{$itemid}{$field}) eq 'ARRAY') {
@@ -15441,6 +15495,71 @@ sub modify_lti {
}
}
}
+ if ($is_home) {
+ my $keyitem = 'form.lti_key_'.$idx;
+ $env{$keyitem} =~ s/(`)/'/g;
+ if ($env{$keyitem} ne '') {
+ $ltienc{$itemid}{'key'} = $env{$keyitem};
+ unless ($changes{$itemid}) {
+ if ($currlti{'key'} ne $env{$keyitem}) {
+ $changes{$itemid} = 1;
+ }
+ }
+ }
+ my $secretitem = 'form.lti_secret_'.$idx;
+ $env{$secretitem} =~ s/(`)/'/g;
+ if ($currlti{'usable'}) {
+ if ($env{'form.lti_changesecret_'.$idx}) {
+ if ($env{$secretitem} ne '') {
+ if ($privnum && $cipher) {
+ $ltienc{$itemid}{'secret'} = $cipher->encrypt_hex($env{$secretitem});
+ $confhash{$itemid}{'cipher'} = $privnum;
+ } else {
+ $ltienc{$itemid}{'secret'} = $env{$secretitem};
+ }
+ $changes{$itemid} = 1;
+ }
+ } else {
+ $ltienc{$itemid}{'secret'} = $currlti{'secret'};
+ $confhash{$itemid}{'cipher'} = $currlti{'cipher'};
+ }
+ if (ref($ltienc{$itemid}) eq 'HASH') {
+ if (($ltienc{$itemid}{'key'} ne '') && ($ltienc{$itemid}{'secret'} ne '')) {
+ $confhash{$itemid}{'usable'} = 1;
+ }
+ }
+ } elsif ($env{$secretitem} ne '') {
+ if ($privnum && $cipher) {
+ $ltienc{$itemid}{'secret'} = $cipher->encrypt_hex($env{$secretitem});
+ $confhash{$itemid}{'cipher'} = $privnum;
+ } else {
+ $ltienc{$itemid}{'secret'} = $env{$secretitem};
+ }
+ if (ref($ltienc{$itemid}) eq 'HASH') {
+ if (($ltienc{$itemid}{'key'} ne '') && ($ltienc{$itemid}{'key'} ne '')) {
+ $confhash{$itemid}{'usable'} = 1;
+ }
+ }
+ $changes{$itemid} = 1;
+ }
+ }
+ unless ($changes{$itemid}) {
+ foreach my $key (keys(%currlti)) {
+ if (ref($currlti{$key}) eq 'HASH') {
+ if (ref($confhash{$itemid}{$key}) eq 'HASH') {
+ foreach my $innerkey (keys(%{$currlti{$key}})) {
+ unless (exists($confhash{$itemid}{$key}{$innerkey})) {
+ $changes{$itemid} = 1;
+ last;
+ }
+ }
+ } elsif (keys(%{$currlti{$key}}) > 0) {
+ $changes{$itemid} = 1;
+ }
+ }
+ last if ($changes{$itemid});
+ }
+ }
}
if (@allpos > 0) {
my $idx = 0;
@@ -15458,12 +15577,21 @@ sub modify_lti {
}
}
}
+
+ if ((keys(%changes) == 0) && (keys(%secchanges) == 0)) {
+ return &mt('No changes made.');
+ }
+
my %ltihash = (
$action => { %confhash }
);
- my %ltienchash = (
- $action => { %encconfig }
- );
+ my %ltienchash;
+
+ if ($is_home) {
+ %ltienchash = (
+ $action => { %ltienc }
+ );
+ }
if (keys(%secchanges)) {
$ltihash{'ltisec'} = \%newltisec;
if ($secchanges{'linkprot'}) {
@@ -15474,11 +15602,8 @@ sub modify_lti {
}
my $putresult = &Apache::lonnet::put_dom('configuration',\%ltihash,$dom);
if ($putresult eq 'ok') {
- my %keystore;
- &store_security($dom,'lti',\%secchanges,\%newkeyset,\%keystore,$lastactref);
- &Apache::lonnet::put_dom('encconfig',\%ltienchash,$dom,undef,1);
- if ((keys(%changes) == 0) && (keys(%secchanges) == 0)) {
- return &mt('No changes made.');
+ if (keys(%ltienchash)) {
+ &Apache::lonnet::put_dom('encconfig',\%ltienchash,$dom,undef,1);
}
$resulttext = &mt('Changes made:').'
';
if (keys(%secchanges) > 0) {
@@ -15489,28 +15614,20 @@ sub modify_lti {
}
if (keys(%changes) > 0) {
my $cachetime = 24*60*60;
- my %ltiall = %confhash;
- foreach my $id (keys(%ltiall)) {
- if (ref($encconfig{$id}) eq 'HASH') {
- foreach my $item ('key','secret') {
- $ltiall{$id}{$item} = $encconfig{$id}{$item};
- }
- }
- }
- &Apache::lonnet::do_cache_new('lti',$dom,\%ltiall,$cachetime);
+ &Apache::lonnet::do_cache_new('lti',$dom,\%confhash,$cachetime);
if (ref($lastactref) eq 'HASH') {
$lastactref->{'lti'} = 1;
}
my %bynum;
foreach my $itemid (sort(keys(%changes))) {
- my $position = $confhash{$itemid}{'order'};
- $bynum{$position} = $itemid;
+ if (ref($confhash{$itemid}) eq 'HASH') {
+ my $position = $confhash{$itemid}{'order'};
+ $bynum{$position} = $itemid;
+ }
}
foreach my $pos (sort { $a <=> $b } keys(%bynum)) {
my $itemid = $bynum{$pos};
- if (ref($confhash{$itemid}) ne 'HASH') {
- $resulttext .= '- '.&mt('Deleted: [_1]',$changes{$itemid}).'
';
- } else {
+ if (ref($confhash{$itemid}) eq 'HASH') {
$resulttext .= '- '.$confhash{$itemid}{'consumer'}.'
';
my $position = $pos + 1;
$resulttext .= '- '.&mt('Order: [_1]',$position).'
';
@@ -15519,13 +15636,11 @@ sub modify_lti {
$resulttext .= '- '.$lt{$item}.': '.$confhash{$itemid}{$item}.'
';
}
}
- if ($encconfig{$itemid}{'key'} ne '') {
- $resulttext .= '- '.$lt{'key'}.': '.$encconfig{$itemid}{'key'}.'
';
+ if ($ltienc{$itemid}{'key'} ne '') {
+ $resulttext .= '- '.$lt{'key'}.': '.$ltienc{$itemid}{'key'}.'
';
}
- if ($encconfig{$itemid}{'secret'} ne '') {
- $resulttext .= '- '.$lt{'secret'}.': ';
- my $num = length($encconfig{$itemid}{'secret'});
- $resulttext .= ('*'x$num).'
';
+ if ($ltienc{$itemid}{'secret'} ne '') {
+ $resulttext .= '- '.$lt{'secret'}.': ['.&mt('not shown').']
';
}
if ($confhash{$itemid}{'requser'}) {
if ($confhash{$itemid}{'callback'}) {
@@ -15677,8 +15792,18 @@ sub modify_lti {
$resulttext .= ' ';
}
}
+ if (keys(%deletions)) {
+ foreach my $itemid (sort { $a <=> $b } keys(%deletions)) {
+ $resulttext .= '- '.&mt('Deleted: [_1]',$changes{$itemid}).'
';
+ }
+ }
}
$resulttext .= ' ';
+ if (ref($lastactref) eq 'HASH') {
+ if (($secchanges{'encrypt'}) || ($secchanges{'private'})) {
+ $lastactref->{'domdefaults'} = 1;
+ }
+ }
} else {
$errors .= ' - '.&mt('Failed to save changes').'
';
}
@@ -15689,6 +15814,30 @@ sub modify_lti {
return $resulttext;
}
+sub get_priv_creds {
+ my ($dom,$home,$encchg,$encrypt,$storedsec) = @_;
+ my ($needenc,$cipher,$privnum);
+ my %domdefs = &Apache::lonnet::get_domain_defaults($dom);
+ if (($encchg) && (ref($encrypt) eq 'HASH')) {
+ $needenc = $encrypt->{'consumers'}
+ } else {
+ $needenc = $domdefs{'ltienc_consumers'};
+ }
+ if ($needenc) {
+ if (($storedsec eq 'ok') || ((ref($domdefs{'ltiprivhosts'}) eq 'ARRAY') &&
+ (grep(/^\Q$home\E$/,@{$domdefs{'ltiprivhosts'}})))) {
+ my %privhash = &Apache::lonnet::restore_dom('lti','private',$dom,$home,1);
+ my $privkey = $privhash{'key'};
+ $privnum = $privhash{'version'};
+ if (($privnum) && ($privkey ne '')) {
+ $cipher = Crypt::CBC->new({'key' => $privkey,
+ 'cipher' => 'DES'});
+ }
+ }
+ }
+ return ($cipher,$privnum);
+}
+
sub get_lti_id {
my ($domain,$consumer) = @_;
# get lock on lti db
@@ -16491,7 +16640,7 @@ sub modify_contacts {
$contacts_hash{'contacts'}{'overrides'}{$type}{'include'} = $includeloc{$type}.':'.&escape($includestr{$type});
$newsetting{'override_'.$type}{'include'} = $contacts_hash{'contacts'}{'overrides'}{$type}{'include'};
}
- }
+ }
}
}
if (keys(%currsetting) > 0) {
@@ -16549,12 +16698,12 @@ sub modify_contacts {
}
}
if (@statuses) {
- if (ref($currsetting{'overrides'}) eq 'HASH') {
+ if (ref($currsetting{'overrides'}) eq 'HASH') {
foreach my $key (keys(%{$currsetting{'overrides'}})) {
if (ref($currsetting{'overrides'}{$key}) eq 'HASH') {
if (ref($newsetting{'override_'.$key}) eq 'HASH') {
foreach my $item (@contacts,'bcc','others','include') {
- if ($currsetting{'overrides'}{$key}{$item} ne $newsetting{'override_'.$key}{$item}) {
+ if ($currsetting{'overrides'}{$key}{$item} ne $newsetting{'override_'.$key}{$item}) {
push(@{$changes{'overrides'}},$key);
last;
}
@@ -16571,7 +16720,7 @@ sub modify_contacts {
}
} else {
foreach my $key (@overrides) {
- push(@{$changes{'overrides'}},$key);
+ push(@{$changes{'overrides'}},$key);
}
}
}
@@ -16753,7 +16902,7 @@ sub modify_contacts {
$resulttext .= $bcctext.': '.$bcc{$type}.'';
} elsif (!@text) {
$resulttext .= &mt('No one');
- }
+ }
if ($includestr{$type} ne '') {
if ($includeloc{$type} eq 'b') {
$resulttext .= ' '.&mt('Text automatically added to e-mail body:').' '.$includestr{$type};
@@ -16777,14 +16926,14 @@ sub modify_contacts {
if (ref($newsetting{'override_'.$type}) eq 'HASH') {
my @text;
foreach my $item (@contacts) {
- if ($newsetting{'override_'.$type}{$item}) {
+ if ($newsetting{'override_'.$type}{$item}) {
push(@text,$short_titles->{$item});
}
}
if ($newsetting{'override_'.$type}{'others'} ne '') {
push(@text,$newsetting{'override_'.$type}{'others'});
}
-
+
if (@text) {
$resulttext .= &mt('Helpdesk e-mail sent to: [_1]',
''.join(', ',@text).'');
@@ -16947,7 +17096,7 @@ sub modify_contacts {
}
sub modify_privacy {
- my ($dom,%domconfig) = @_;
+ my ($dom,$lastactref,%domconfig) = @_;
my ($resulttext,%current,%changes);
if (ref($domconfig{'privacy'}) eq 'HASH') {
%current = %{$domconfig{'privacy'}};
@@ -17183,6 +17332,28 @@ sub modify_privacy {
}
}
$resulttext .= ' ';
+ if ($changes{'approval'}) {
+ my %domdefaults = &Apache::lonnet::get_domain_defaults($dom);
+ delete($domdefaults{'userapprovals'});
+ if (ref($privacyhash{'approval'}) eq 'HASH') {
+ foreach my $domtype ('instdom','extdom') {
+ if (ref($privacyhash{'approval'}{$domtype}) eq 'HASH') {
+ foreach my $roletype ('domain','author','course','community') {
+ if ($privacyhash{'approval'}{$domtype}{$roletype} eq 'user') {
+ $domdefaults{'userapprovals'} = 1;
+ last;
+ }
+ }
+ }
+ last if ($domdefaults{'userapprovals'});
+ }
+ }
+ my $cachetime = 24*60*60;
+ &Apache::lonnet::do_cache_new('domdefaults',$dom,\%domdefaults,$cachetime);
+ if (ref($lastactref) eq 'HASH') {
+ $lastactref->{'domdefaults'} = 1;
+ }
+ }
} else {
$resulttext = &mt('No changes made to user information settings');
}
@@ -17625,7 +17796,7 @@ sub modify_passwords {
);
my $needed = '- '.
join('
- ',map {$rulenames{$_} } @{$confighash{'passwords'}{'chars'}}).
- '
';
+ '';
$resulttext .= ''.&mt('[_1] set to: [_2]',$titles{'chars'},$needed).'';
} else {
$resulttext .= ''.&mt('[_1] set to none',$titles{'chars'}).'';
@@ -18108,7 +18279,7 @@ sub modify_selfcreation {
if (($chosen eq 'inst') || ($chosen eq 'noninst')) {
my $emaildom;
if ($env{'form.cancreate_emaildomain_'.$chosen.'_'.$type} =~ /^\@[^\@]+$/) {
- $emaildom = $env{'form.cancreate_emaildomain_'.$chosen.'_'.$type};
+ $emaildom = $env{'form.cancreate_emaildomain_'.$chosen.'_'.$type};
$cancreate{'emaildomain'}{$type}{$chosen} = $emaildom;
if (ref($curremaildom{$type}) eq 'HASH') {
if (exists($curremaildom{$type}{$chosen})) {
@@ -18120,7 +18291,7 @@ sub modify_selfcreation {
}
} elsif ($emaildom ne '') {
push(@{$changes{'cancreate'}},'emaildomain');
- }
+ }
}
$cancreate{'emailoptions'}{$type} = $env{'form.cancreate_emailoptions_'.$type};
} elsif ($chosen eq 'custom') {
@@ -18547,7 +18718,7 @@ sub modify_selfcreation {
);
if (@types) {
if (@statuses) {
- $chgtext .= &mt('Processing of requests to create account with e-mail verification set as follows:').
+ $chgtext .= &mt('Processing of requests to create account with e-mail verification set as follows:').
'';
foreach my $status (@statuses) {
if ($status eq 'default') {
@@ -18755,7 +18926,7 @@ sub modify_selfcreation {
$typename = $othertitle;
} else {
$typename = $usertypes{$type};
- }
+ }
$chgtext .= &mt('(Affiliation: [_1])',$typename);
}
if (@{$email_rule{$type}} > 0) {
@@ -19100,7 +19271,7 @@ sub modify_defaults {
}
if ($item eq 'portal_def') {
unless (grep(/^\Q$item\E$/,@errors)) {
- if ($newvalues{$item} eq '') {
+ if ($newvalues{$item} eq '') {
foreach my $field ('email','web') {
if (exists($domdefaults{$item.'_'.$field})) {
delete($domdefaults{$item.'_'.$field});
@@ -19285,7 +19456,7 @@ sub modify_defaults {
$resulttext =~ s/, $//;
$resulttext .= '';
} else {
- $resulttext .= '- '.&mt('Institutional user status types deleted').'
';
+ $resulttext .= '- '.&mt('Institutional user status types deleted').'
';
}
}
} elsif ($item eq 'unamemap_rule') {
@@ -20522,7 +20693,7 @@ sub modify_coursedefaults {
}
my (%newdomexttool,%newexttool,%olddomexttool,%oldexttool);
map { $newdomexttool{$_} = 1; } &Apache::loncommon::get_env_multiple('form.domexttool');
- map { $newexttool{$_} = 1; } &Apache::loncommon::get_env_multiple('form.exttool');
+ map { $newexttool{$_} = 1; } &Apache::loncommon::get_env_multiple('form.exttool');
if (ref($domconfig{'coursedefaults'}{'domexttool'}) eq 'HASH') {
%olddomexttool = %{$domconfig{'coursedefaults'}{'domexttool'}};
} else {
@@ -20535,7 +20706,7 @@ sub modify_coursedefaults {
}
}
if (ref($domconfig{'coursedefaults'}{'exttool'}) eq 'HASH') {
- %oldexttool = %{$domconfig{'coursedefaults'}{'exttool'}};
+ %oldexttool = %{$domconfig{'coursedefaults'}{'exttool'}};
} else {
foreach my $type (@types) {
if ($staticdefaults{'exttool'}) {
@@ -21188,7 +21359,7 @@ sub modify_wafproxy {
}
} elsif ($currvalue{$item}) {
$changes{$item} = 1;
- }
+ }
}
} else {
if (keys(%curralias)) {
@@ -21196,7 +21367,7 @@ sub modify_wafproxy {
}
if (keys(%currsaml)) {
$changes{'saml'} = 1;
- }
+ }
if (keys(%currvalue)) {
foreach my $key (keys(%currvalue)) {
$changes{$key} = 1;
@@ -21206,7 +21377,7 @@ sub modify_wafproxy {
if (keys(%changes)) {
my %defaultshash = (
wafproxy => \%wafproxy,
- );
+ );
my $putresult = &Apache::lonnet::put_dom('configuration',\%defaultshash,
$dom);
if ($putresult eq 'ok') {
@@ -21222,7 +21393,7 @@ sub modify_wafproxy {
$domdefaults{'waf_'.$item} = $wafproxy{$item};
} elsif (exists($domdefaults{'waf_'.$item})) {
delete($domdefaults{'waf_'.$item});
- }
+ }
}
}
if ($updatedomdefs) {
@@ -21289,7 +21460,7 @@ sub modify_wafproxy {
$output .= '- '.&mt('Aliases deleted for hostnames').'
';
}
} elsif ($item eq 'saml') {
- my $shown;
+ my $shown;
if (ref($wafproxy{'saml'}) eq 'HASH') {
if (keys(%{$wafproxy{'saml'}})) {
$shown = join(', ',sort(keys(%{$wafproxy{'saml'}})));
@@ -21619,7 +21790,7 @@ sub modify_usersessions {
if (($offload eq 'offloadoth') && (@okoffloadoth)) {
$changes{'offloadoth'} = 1;
}
- }
+ }
}
} else {
if (@okoffload) {
@@ -22157,7 +22328,7 @@ sub modify_loadbalancing {
}
if ($env{'form.loadbalancing_cookie_'.$i}) {
$defaultshash{'loadbalancing'}{$balancer}{'cookie'} = 1;
- if (exists($currbalancer{$balancer})) {
+ if (exists($currbalancer{$balancer})) {
unless ($currcookies{$balancer}) {
$changes{'curr'}{$balancer}{'cookie'} = 1;
}
@@ -22843,7 +23014,6 @@ function balancerChange(balnum,baltotal,
END
}
-
sub new_spares_js {
my @sparestypes = ('primary','default');
my $types = join("','",@sparestypes);
|
|