--- loncom/interface/domainprefs.pm 2018/07/06 13:32:56 1.332
+++ loncom/interface/domainprefs.pm 2018/12/05 21:13:23 1.343
@@ -1,7 +1,7 @@
# The LearningOnline Network with CAPA
# Handler to set domain-wide configuration settings
#
-# $Id: domainprefs.pm,v 1.332 2018/07/06 13:32:56 raeburn Exp $
+# $Id: domainprefs.pm,v 1.343 2018/12/05 21:13:23 raeburn Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -352,6 +352,8 @@ sub handler {
col2 => 'Value',},
{col1 => 'Recipient(s) for notifications',
col2 => 'Value',},
+ {col1 => 'Nightly status check e-mail',
+ col2 => 'Settings',},
{col1 => 'Ask helpdesk form settings',
col2 => 'Value',},],
print => \&print_contacts,
@@ -781,6 +783,10 @@ sub print_config_box {
$output =
&Apache::lonuserutils::custom_roledefs_js($context,$crstype,$formname,\%full,
\@templateroles);
+ } elsif ($action eq 'ltitools') {
+ $output .= <itools_javascript($settings);
+ } elsif ($action eq 'lti') {
+ $output .= <i_javascript($settings);
}
$output .=
'
@@ -900,6 +906,23 @@ sub print_config_box {
'."\n";
if ($action eq 'coursecategories') {
$output .= &print_coursecategories('bottom',$dom,$item,$settings,\$rowtotal);
+ } elsif ($action eq 'contacts') {
+ $output .= $item->{'print'}->('lower',$dom,$settings,\$rowtotal).'
+
+
+
+
+
+
+
+
+ '.&mt($item->{'header'}->[3]->{'col1'}).'
+ '.&mt($item->{'header'}->[3]->{'col2'}).' '.
+ $item->{'print'}->('bottom',$dom,$settings,\$rowtotal).'
+
+
+
+ ';
} else {
$output .= $item->{'print'}->('bottom',$dom,$settings,\$rowtotal);
}
@@ -2482,7 +2505,7 @@ sub print_textbookcourses {
$datatable .= ''.$vpos.' ';
}
$datatable .= ' '."\n".
- ' '.&mt('Add').''."\n".
+ ' '.&mt('Add').''."\n".
''.
''.&mt('Subject:').' '."\n".
(' 'x2).
@@ -2499,13 +2522,13 @@ sub print_textbookcourses {
} else {
$datatable .= ' ';
}
+ $datatable .= ''."\n";
}
- $datatable .= ''."\n".
- ''.&mt('LON-CAPA course:').' '.
+ $datatable .= ''.&mt('LON-CAPA course:').' '.
&Apache::loncommon::select_dom_form($env{'request.role.domain'},$type.'_addbook_cdom').
' '.
&Apache::loncommon::selectcourse_link
- ('display',$type.'_addbook_cnum',$type.'_addbook_cdom',undef,undef,undef,'Course');
+ ('display',$type.'_addbook_cnum',$type.'_addbook_cdom',undef,undef,undef,'Course').
' '."\n".
' '."\n";
$itemcount ++;
@@ -2813,27 +2836,40 @@ sub lti_toggle_js {
// '.&mt('Failsafe for no drops when institutional data missing').''.
''.
' ';
+ ' value="'.$failsafe.'" size="4" />';
$$rowtotal += 4;
return $datatable;
}
@@ -3306,7 +3342,7 @@ sub print_contacts {
my $datatable;
my @contacts = ('adminemail','supportemail');
my (%checked,%to,%otheremails,%bccemails,%includestr,%includeloc,%currfield,
- $maxsize,$fields,$fieldtitles,$fieldoptions,$possoptions,@mailings);
+ $maxsize,$fields,$fieldtitles,$fieldoptions,$possoptions,@mailings,%lonstatus);
if ($position eq 'top') {
if (ref($settings) eq 'HASH') {
foreach my $item (@contacts) {
@@ -3321,6 +3357,12 @@ sub print_contacts {
foreach my $type (@mailings) {
$otheremails{$type} = '';
}
+ } elsif ($position eq 'lower') {
+ if (ref($settings) eq 'HASH') {
+ if (ref($settings->{'lonstatus'}) eq 'HASH') {
+ %lonstatus = %{$settings->{'lonstatus'}};
+ }
+ }
} else {
@mailings = ('helpdeskmail','otherdomsmail');
foreach my $type (@mailings) {
@@ -3333,7 +3375,7 @@ sub print_contacts {
($fields,$fieldtitles,$fieldoptions,$possoptions) = &helpform_fields();
}
if (ref($settings) eq 'HASH') {
- unless ($position eq 'top') {
+ unless (($position eq 'top') || ($position eq 'lower')) {
foreach my $type (@mailings) {
if (exists($settings->{$type})) {
if (ref($settings->{$type}) eq 'HASH') {
@@ -3454,7 +3496,7 @@ sub print_contacts {
if ($currfield{$field} eq 'no') {
$display = ' style="display:none"';
}
- $datatable .= ' '.
+ $datatable .= ''.
''.&mt('Maximum size for upload (MB)').' '.
' ';
}
@@ -3465,7 +3507,7 @@ sub print_contacts {
$datatable .= ' '."\n";
$rownum ++;
}
- unless ($position eq 'top') {
+ unless (($position eq 'top') || ($position eq 'lower')) {
foreach my $type (@mailings) {
$css_class = $rownum%2?' class="LC_odd_row"':'';
$datatable .= ''.
@@ -3499,7 +3541,7 @@ sub print_contacts {
'value="'.$bccemails{$type}.'" />'.
''.&mt('Optional added text').' '.
&mt('Text automatically added to e-mail:').' '.
- ' '.
+ ' '.
''.&mt('Location:').' '.
' '.&mt('in subject').' '.
(' 'x2).
@@ -3512,18 +3554,110 @@ sub print_contacts {
}
if ($position eq 'middle') {
my %choices;
- $choices{'reporterrors'} = &mt('E-mail error reports to [_1]',
- &Apache::loncommon::modal_link('http://loncapa.org/core.html',
- &mt('LON-CAPA core group - MSU'),600,500));
+ my $corelink = &core_link_msu();
+ $choices{'reporterrors'} = &mt('E-mail error reports to [_1]',$corelink);
$choices{'reportupdates'} = &mt('E-mail record of completed LON-CAPA updates to [_1]',
- &Apache::loncommon::modal_link('http://loncapa.org/core.html',
- &mt('LON-CAPA core group - MSU'),600,500));
- my @toggles = ('reporterrors','reportupdates');
+ $corelink);
+ $choices{'reportstatus'} = &mt('E-mail status if errors above threshold to [_1]',$corelink);
+ my @toggles = ('reporterrors','reportupdates','reportstatus');
my %defaultchecked = ('reporterrors' => 'on',
- 'reportupdates' => 'on');
+ 'reportupdates' => 'on',
+ 'reportstatus' => 'on');
(my $reports,$rownum) = &radiobutton_prefs($settings,\@toggles,\%defaultchecked,
\%choices,$rownum);
$datatable .= $reports;
+ } elsif ($position eq 'lower') {
+ $css_class = $rownum%2?' class="LC_odd_row"':'';
+ my ($threshold,$sysmail,%excluded,%weights);
+ my ($defaults,$names) = &Apache::loncommon::lon_status_items();
+ if ($lonstatus{'threshold'} =~ /^\d+$/) {
+ $threshold = $lonstatus{'threshold'};
+ } else {
+ $threshold = $defaults->{'threshold'};
+ }
+ if ($lonstatus{'sysmail'} =~ /^\d+$/) {
+ $sysmail = $lonstatus{'sysmail'};
+ } else {
+ $sysmail = $defaults->{'sysmail'};
+ }
+ if (ref($lonstatus{'weights'}) eq 'HASH') {
+ foreach my $type ('E','W','N','U') {
+ if ($lonstatus{'weights'}{$type} =~ /^\d+$/) {
+ $weights{$type} = $lonstatus{'weights'}{$type};
+ } else {
+ $weights{$type} = $defaults->{$type};
+ }
+ }
+ } else {
+ foreach my $type ('E','W','N','U') {
+ $weights{$type} = $defaults->{$type};
+ }
+ }
+ if (ref($lonstatus{'excluded'}) eq 'ARRAY') {
+ if (@{$lonstatus{'excluded'}} > 0) {
+ map {$excluded{$_} = 1; } @{$lonstatus{'excluded'}};
+ }
+ }
+ $datatable .= ''.
+ ''.
+ $titles->{'errorthreshold'}.
+ ' '.
+ ' ';
+ $rownum ++;
+ $css_class = $rownum%2?' class="LC_odd_row"':'';
+ $datatable .= ''.
+ ''.
+ ''.$titles->{'errorweights'}.
+ ' ';
+ $rownum ++;
+ $css_class = $rownum%2?' class="LC_odd_row"':'';
+ $datatable .= ''.
+ $titles->{'errorexcluded'}.' '.
+ ' ';
+ $rownum ++;
+ $css_class = $rownum%2?' class="LC_odd_row"':'';
+ $datatable .= ''.
+ ''.
+ $titles->{'errorsysmail'}.
+ ' '.
+ ' ';
+ $rownum ++;
} elsif ($position eq 'bottom') {
my ($othertitle,$usertypes,$types) = &Apache::loncommon::sorted_inst_types($dom);
my (@posstypes,%usertypeshash);
@@ -3597,6 +3731,11 @@ sub print_contacts {
return $datatable;
}
+sub core_link_msu {
+ return &Apache::loncommon::modal_link('http://loncapa.org/core.html',
+ &mt('LON-CAPA core group - MSU'),600,500);
+}
+
sub overridden_helpdesk {
my ($checked,$otheremails,$bccemails,$includeloc,$includestr,$type,$rowid,
$typetitle,$css_class,$rowstyle,$contacts,$short_titles) = @_;
@@ -3647,7 +3786,7 @@ sub overridden_helpdesk {
'value="'.$bccemails.'" /> '.
''.&mt('Optional added text').' '.
&mt('Text automatically added to e-mail:').' '.
- ' '.
+ ' '.
''.&mt('Location:').' '.
' '.&mt('in subject').' '.
(' 'x2).
@@ -3776,7 +3915,6 @@ sub print_helpsettings {
push(@jsarray,('notinc','notexc'));
}
my $hiddenstr = join("','",@jsarray);
- $datatable .= &helpsettings_javascript(\@roles_by_num,$maxnum,$hiddenstr,$formname);
my $context = 'domprefs';
my $crstype = 'Course';
my $prefix = 'helproles_';
@@ -3879,7 +4017,9 @@ sub print_helpsettings {
\@templateroles,$newcust).
&Apache::lonuserutils::custom_role_table('Course',\%full,\%levels,
\%levelscurrent,$newcust).
- ' ';
+ ''.
+ &helpsettings_javascript(\@roles_by_num,$maxnum,$hiddenstr,$formname).
+ '';
$count ++;
$$rowtotal += $count;
}
@@ -4168,7 +4308,7 @@ sub print_ltitools {
my $confname = $dom.'-domainconfig';
my $switchserver = &check_switchserver($dom,$confname);
my $maxnum = scalar(keys(%ordered));
- my $datatable = <itools_javascript($settings);
+ my $datatable;
my %lt = <itools_names();
my @courseroles = ('cc','in','ta','ep','st');
my @ltiroles = qw(Instructor ContentDeveloper TeachingAssistant Learner);
@@ -4269,9 +4409,9 @@ sub print_ltitools {
' '.
(' 'x2);
}
- $datatable .= ' '.
+ $datatable .= ' '.
''.$lt{'linktext'}.' '.
- '
'.
+ ' '.
''.$lt{'explanation'}.' '.
'
';
@@ -4442,7 +4582,7 @@ sub print_ltitools {
$datatable .= ''.$vpos.' ';
}
$datatable .= ' '."\n".
- ' '.&mt('Add').''."\n".
+ ' '.&mt('Add').''."\n".
''.
''.&mt('Required settings').' '.
''.$lt{'title'}.': '."\n".
@@ -4479,11 +4619,11 @@ sub print_ltitools {
' '.
(' 'x2);
}
- $datatable .= ' '.
+ $datatable .= ' '.
''.$lt{'linktext'}.' '.
- '
'.
+ ' '.
''.$lt{'explanation'}.' '.
- ''.
+ ''.
'
';
my %units = (
'passback' => 'days',
@@ -4562,7 +4702,7 @@ sub print_ltitools {
' '.
&mt('Add').' '.
' '.
- ''."\n".
+ ''."\n".
''."\n".
''."\n";
$itemcount ++;
@@ -4620,7 +4760,7 @@ sub print_lti {
}
}
my $maxnum = scalar(keys(%ordered));
- my $datatable = <i_javascript($settings);
+ my $datatable;
my %lt = <i_names();
if (keys(%ordered)) {
my @items = sort { $a <=> $b } keys(%ordered);
@@ -4685,7 +4825,7 @@ sub print_lti {
$datatable .= ''.$vpos.' ';
}
$datatable .= ' '."\n".
- ' '.&mt('Add').''."\n".
+ ' '.&mt('Add').''."\n".
''.
''.&mt('Required settings').' '.
''.$lt{'consumer'}.
@@ -4746,6 +4886,7 @@ sub lti_options {
my $crsfieldsty = 'none';
my $crssecfieldsty = 'none';
my $secsrcfieldsty = 'none';
+ my $passbacksty = 'none';
my $lcauthparm;
my $lcauthparmstyle = 'display:none';
my $lcauthparmtext;
@@ -4948,7 +5089,7 @@ sub lti_options {
$checked{'mapcrs'}{$option}.$onclickcrs.' />'.$option.''.
($option eq 'other' ? '' : (' 'x2) );
}
- $output .= ''.
+ $output .= '
'.
' '.
'
'.
''.&mt('LON-CAPA course type(s)').': ';
@@ -4976,7 +5117,7 @@ sub lti_options {
' '.&mt('No').' '.(' 'x2).
' '.&mt('Yes').''.
+ $checked{'crssec'}{'Y'}.$onclicksec.' />'.&mt('Yes').' '.
''.
+ '
'.
' '.
- '
';
- foreach my $extra ('passback','roster') {
+ '
';
+ my ($pb1p1chk,$pb1p0chk,$onclickpb);
+ foreach my $extra ('roster','passback') {
my $checkedon = '';
my $checkedoff = ' checked="checked"';
+ if ($extra eq 'passback') {
+ $pb1p1chk = ' checked="checked"';
+ $pb1p0chk = '';
+ $onclickpb = ' onclick="toggleLTI(this.form,'."'passback','$num'".');"';
+ } else {
+ $onclickpb = '';
+ }
if (ref($current) eq 'HASH') {
if (($current->{$extra})) {
$checkedon = $checkedoff;
$checkedoff = '';
+ if ($extra eq 'passback') {
+ $passbacksty = 'inline-block';
+ }
+ if ($current->{'passbackformat'} eq '1.0') {
+ $pb1p0chk = ' checked="checked"';
+ $pb1p1chk = '';
+ }
}
}
$output .= $lt{$extra}.' '.
- ' '.
+ ' '.
&mt('No').' '.(' 'x2).
- ' '.
+ ' '.
&mt('Yes').' ';
}
- $output .= ' '.
+ $output .= ''.
+ ''.&mt('Grade format').
+ ' '.
+ &mt('Outcomes Service (1.1)').' '.(' 'x2).
+ ' '.
+ &mt('Outcomes Extension (1.0)').'
'.
''.&mt('Course defaults (Course Coordinator can override)').' '.
''.$lt{'topmenu'}.': '.
' '.&mt('No').' '.(' 'x2).
' '.&mt('Yes').'
'.
+ $checked{'topmenu'}{'Y'}.$onclickmenu.' />'.&mt('Yes').''.
'
'.
''.$lt{'inlinemenu'}.': '.
' '.&mt('No').' '.(' 'x2).
' '.&mt('Yes').'
';
+ $checked{'inlinemenu'}{'Y'}.$onclickmenu.' />'.&mt('Yes').'';
$output .='
'.
' ';
# ''.&mt('Assigning author roles').' ';
#
# $output .= ' '.
@@ -5519,7 +5680,7 @@ sub print_validation_rows {
' ';
}
} elsif ($item eq 'markup') {
- $datatable .= ' ';
+ $datatable .= ' ';
if ($numdc > 1) {
$datatable .= &mt('Course creation processed as: (choose Dom. Coord.)');
} else {
@@ -6178,13 +6339,13 @@ sub print_loadbalancing {
my $numinrow = 1;
my $datatable;
my %servers = &Apache::lonnet::internet_dom_servers($dom);
- my (%currbalancer,%currtargets,%currrules,%existing);
+ my (%currbalancer,%currtargets,%currrules,%existing,%currcookies);
if (ref($settings) eq 'HASH') {
%existing = %{$settings};
}
if ((keys(%servers) > 1) || (keys(%existing) > 0)) {
&get_loadbalancers_config(\%servers,\%existing,\%currbalancer,
- \%currtargets,\%currrules);
+ \%currtargets,\%currrules,\%currcookies);
} else {
return;
}
@@ -6261,6 +6422,9 @@ sub print_loadbalancing {
my %hostherechecked = (
no => ' checked="checked"',
);
+ my %balcookiechecked = (
+ no => ' checked="checked"',
+ );
foreach my $sparetype (@sparestypes) {
my $targettable;
for (my $i=0; $i<$numspares; $i++) {
@@ -6316,6 +6480,11 @@ sub print_loadbalancing {
}
}
}
+ if ($currcookies{$lonhost}) {
+ %balcookiechecked = (
+ yes => ' checked="checked"',
+ );
+ }
$datatable .= &mt('Hosting on balancer itself').' '.
' '.&mt('No').' ';
@@ -6324,7 +6493,12 @@ sub print_loadbalancing {
'value="'.$sparetype.'"'.$hostherechecked{$sparetype}.' />'.$typetitles{$sparetype}.
' ';
}
- $datatable .= ' '.
+ $datatable .= &mt('Use balancer cookie').' '.
+ ' '.&mt('Yes').' '.
+ ' '.&mt('No').' '.
+ ''.
&loadbalancing_rules($dom,$intdom,$currrules{$lonhost},
$othertitle,$usertypes,$types,\%servers,
\%currbalancer,$lonhost,
@@ -6338,10 +6512,11 @@ sub print_loadbalancing {
}
sub get_loadbalancers_config {
- my ($servers,$existing,$currbalancer,$currtargets,$currrules) = @_;
+ my ($servers,$existing,$currbalancer,$currtargets,$currrules,$currcookies) = @_;
return unless ((ref($servers) eq 'HASH') &&
(ref($existing) eq 'HASH') && (ref($currbalancer) eq 'HASH') &&
- (ref($currtargets) eq 'HASH') && (ref($currrules) eq 'HASH'));
+ (ref($currtargets) eq 'HASH') && (ref($currrules) eq 'HASH') &&
+ (ref($currcookies) eq 'HASH'));
if (keys(%{$existing}) > 0) {
my $oldlonhost;
foreach my $key (sort(keys(%{$existing}))) {
@@ -6360,6 +6535,9 @@ sub get_loadbalancers_config {
$currbalancer->{$key} = 1;
$currtargets->{$key} = $existing->{$key}{'targets'};
$currrules->{$key} = $existing->{$key}{'rules'};
+ if ($existing->{$key}{'cookie'}) {
+ $currcookies->{$key} = 1;
+ }
}
}
} else {
@@ -6555,6 +6733,10 @@ sub contact_titles {
'requestsmail' => 'E-mail from course requests requiring approval',
'updatesmail' => 'E-mail from nightly check of LON-CAPA module integrity/updates',
'idconflictsmail' => 'E-mail from bi-nightly check for multiple users sharing same student/employee ID',
+ 'errorthreshold' => 'Error/warning threshold for status e-mail',
+ 'errorsysmail' => 'Error threshold for e-mail to core group',
+ 'errorweights' => 'Weights used to compute error count',
+ 'errorexcluded' => 'Servers with unsent updates excluded from count',
);
my %short_titles = &Apache::lonlocal::texthash (
adminemail => 'Admin E-mail address',
@@ -6844,7 +7026,7 @@ sub print_selfcreation {
$datatable .= ''.
''.&mt('Mapping of Shibboleth environment variable names to user data fields (SSO auth)').' '.
''."\n".
- ''."\n";
+ ''."\n";
for (my $i=0; $i<@fields; $i++) {
$rem = $i%($numperrow);
if ($rem == 0) {
@@ -8251,7 +8433,7 @@ sub print_serverstatuses {
''.
' '.
- ''."\n";
+ ' '."\n";
}
$$rowtotal += $rownum;
return $datatable;
@@ -8844,7 +9026,7 @@ sub insttypes_row {
}
$output .= ' ';
} else {
- if (($rem == 0) && (@{$types} > 0)) {
+ if ($rem == 0) {
$output .= '';
}
if ($colsleft > 1) {
@@ -11123,7 +11305,7 @@ sub modify_ltitools {
if ($env{'form.ltitools_'.$extra.'_'.$i}) {
$confhash{$itemid}{$extra} = 1;
if ($env{'form.ltitools_'.$extra.'valid_'.$i} ne '') {
- my $lifetime = $env{'form.ltitools_'.$extra.'valid_add'};
+ my $lifetime = $env{'form.ltitools_'.$extra.'valid_'.$i};
$lifetime =~ s/^\s+|\s+$//g;
if ($lifetime =~ /^\d+\.?\d*$/) {
$confhash{$itemid}{$extra.'valid'} = $lifetime;
@@ -11709,7 +11891,13 @@ sub modify_lti {
$confhash{$itemid}{$field} = 1;
}
}
-
+ if ($env{'form.lti_passback_'.$idx}) {
+ if ($env{'form.lti_passbackformat_'.$idx} eq '1.0') {
+ $confhash{$itemid}{'passbackformat'} = '1.0';
+ } else {
+ $confhash{$itemid}{'passbackformat'} = '1.1';
+ }
+ }
if ($env{'form.lti_topmenu_'.$idx} || $env{'form.lti_inlinemenu_'.$idx}) {
$confhash{$itemid}{lcmenu} = [];
my @possmenu = &Apache::loncommon::get_env_multiple('form.lti_menuitem_'.$idx);
@@ -11728,6 +11916,13 @@ sub modify_lti {
$changes{$itemid} = 1;
}
}
+ unless ($changes{$itemid}) {
+ if ($domconfig{$action}{$itemid}{'passback'} eq $confhash{$itemid}{'passback'}) {
+ if ($domconfig{$action}{$itemid}{'passbackformat'} ne $confhash{$itemid}{'passbackformat'}) {
+ $changes{$itemid} = 1;
+ }
+ }
+ }
foreach my $field ('makeuser','mapcrstype','selfenroll','instdata','lcmenu') {
unless ($changes{$itemid}) {
if (ref($domconfig{$action}{$itemid}{$field}) eq 'ARRAY') {
@@ -11944,6 +12139,13 @@ sub modify_lti {
$resulttext .= ''.$lt{$item}.': ';
if ($confhash{$itemid}{$item}) {
$resulttext .= &mt('Yes');
+ if ($item eq 'passback') {
+ if ($confhash{$itemid}{'passbackformat'} eq '1.0') {
+ $resulttext .= ' ('.&mt('Outcomes Extension (1.0)').')';
+ } elsif ($confhash{$itemid}{'passbackformat'} eq '1.1') {
+ $resulttext .= ' ('.&mt('Outcomes Service (1.1)').')';
+ }
+ }
} else {
$resulttext .= &mt('No');
}
@@ -12603,7 +12805,8 @@ sub modify_contacts {
my @contacts = ('supportemail','adminemail');
my @mailings = ('errormail','packagesmail','helpdeskmail','otherdomsmail',
'lonstatusmail','requestsmail','updatesmail','idconflictsmail');
- my @toggles = ('reporterrors','reportupdates');
+ my @toggles = ('reporterrors','reportupdates','reportstatus');
+ my @lonstatus = ('threshold','sysmail','weights','excluded');
my ($fields,$fieldtitles,$fieldoptions,$possoptions) = &helpform_fields();
foreach my $type (@mailings) {
@{$newsetting{$type}} =
@@ -12636,6 +12839,41 @@ sub modify_contacts {
$contacts_hash{'contacts'}{$item} = $env{'form.'.$item};
}
}
+ my ($lonstatus_defs,$lonstatus_names) = &Apache::loncommon::lon_status_items();
+ foreach my $item (@lonstatus) {
+ if ($item eq 'excluded') {
+ my (%serverhomes,@excluded);
+ map { $serverhomes{$_} = 1; } values(%Apache::lonnet::serverhomeIDs);
+ my @possexcluded = &Apache::loncommon::get_env_multiple('form.errorexcluded');
+ if (@possexcluded) {
+ foreach my $id (sort(@possexcluded)) {
+ if ($serverhomes{$id}) {
+ push(@excluded,$id);
+ }
+ }
+ }
+ if (@excluded) {
+ $contacts_hash{'contacts'}{'lonstatus'}{$item} = \@excluded;
+ }
+ } elsif ($item eq 'weights') {
+ foreach my $type ('E','W','N') {
+ $env{'form.error'.$item.'_'.$type} =~ s/^\s+|\s+$//g;
+ if ($env{'form.error'.$item.'_'.$type} =~ /^\d+$/) {
+ unless ($env{'form.error'.$item.'_'.$type} == $lonstatus_defs->{$type}) {
+ $contacts_hash{'contacts'}{'lonstatus'}{$item}{$type} =
+ $env{'form.error'.$item.'_'.$type};
+ }
+ }
+ }
+ } elsif (($item eq 'threshold') || ($item eq 'sysmail')) {
+ $env{'form.error'.$item} =~ s/^\s+|\s+$//g;
+ if ($env{'form.error'.$item} =~ /^\d+$/) {
+ unless ($env{'form.error'.$item} == $lonstatus_defs->{$item}) {
+ $contacts_hash{'contacts'}{'lonstatus'}{$item} = $env{'form.error'.$item};
+ }
+ }
+ }
+ }
if ((ref($fields) eq 'ARRAY') && (ref($possoptions) eq 'HASH')) {
foreach my $field (@{$fields}) {
if (ref($possoptions->{$field}) eq 'ARRAY') {
@@ -12774,6 +13012,76 @@ sub modify_contacts {
}
}
}
+ if (ref($currsetting{'lonstatus'}) eq 'HASH') {
+ foreach my $key ('excluded','weights','threshold','sysmail') {
+ if ($key eq 'excluded') {
+ if ((ref($contacts_hash{contacts}{lonstatus}) eq 'HASH') &&
+ (ref($contacts_hash{contacts}{lonstatus}{excluded}) eq 'ARRAY')) {
+ if ((ref($currsetting{'lonstatus'}{$key}) eq 'ARRAY') &&
+ (@{$currsetting{'lonstatus'}{$key}})) {
+ my @diffs =
+ &Apache::loncommon::compare_arrays($contacts_hash{contacts}{lonstatus}{excluded},
+ $currsetting{'lonstatus'}{$key});
+ if (@diffs) {
+ push(@{$changes{'lonstatus'}},$key);
+ }
+ } elsif (@{$contacts_hash{contacts}{lonstatus}{excluded}}) {
+ push(@{$changes{'lonstatus'}},$key);
+ }
+ } elsif ((ref($currsetting{'lonstatus'}{$key}) eq 'ARRAY') &&
+ (@{$currsetting{'lonstatus'}{$key}})) {
+ push(@{$changes{'lonstatus'}},$key);
+ }
+ } elsif ($key eq 'weights') {
+ if ((ref($contacts_hash{contacts}{lonstatus}) eq 'HASH') &&
+ (ref($contacts_hash{contacts}{lonstatus}{$key}) eq 'HASH')) {
+ if (ref($currsetting{'lonstatus'}{$key}) eq 'HASH') {
+ foreach my $type ('E','W','N','U') {
+ unless ($contacts_hash{contacts}{lonstatus}{$key}{$type} eq
+ $currsetting{'lonstatus'}{$key}{$type}) {
+ push(@{$changes{'lonstatus'}},$key);
+ last;
+ }
+ }
+ } else {
+ foreach my $type ('E','W','N','U') {
+ if ($contacts_hash{contacts}{lonstatus}{$key}{$type} ne '') {
+ push(@{$changes{'lonstatus'}},$key);
+ last;
+ }
+ }
+ }
+ } elsif (ref($currsetting{'lonstatus'}{$key}) eq 'HASH') {
+ foreach my $type ('E','W','N','U') {
+ if ($currsetting{'lonstatus'}{$key}{$type} ne '') {
+ push(@{$changes{'lonstatus'}},$key);
+ last;
+ }
+ }
+ }
+ } elsif (($key eq 'threshold') || ($key eq 'sysmail')) {
+ if (ref($contacts_hash{contacts}{lonstatus}) eq 'HASH') {
+ if ($currsetting{'lonstatus'}{$key} =~ /^\d+$/) {
+ if ($currsetting{'lonstatus'}{$key} != $contacts_hash{contacts}{lonstatus}{$key}) {
+ push(@{$changes{'lonstatus'}},$key);
+ }
+ } elsif ($contacts_hash{contacts}{lonstatus}{$key} =~ /^\d+$/) {
+ push(@{$changes{'lonstatus'}},$key);
+ }
+ } elsif ($currsetting{'lonstatus'}{$key} =~ /^\d+$/) {
+ push(@{$changes{'lonstatus'}},$key);
+ }
+ }
+ }
+ } else {
+ if (ref($contacts_hash{contacts}{lonstatus}) eq 'HASH') {
+ foreach my $key ('excluded','weights','threshold','sysmail') {
+ if (exists($contacts_hash{contacts}{lonstatus}{$key})) {
+ push(@{$changes{'lonstatus'}},$key);
+ }
+ }
+ }
+ }
} else {
my %default;
$default{'supportemail'} = $Apache::lonnet::perlvar{'lonSupportEMail'};
@@ -12818,6 +13126,13 @@ sub modify_contacts {
}
}
}
+ if (ref($contacts_hash{contacts}{lonstatus}) eq 'HASH') {
+ foreach my $key ('excluded','weights','threshold','sysmail') {
+ if (exists($contacts_hash{contacts}{lonstatus}{$key})) {
+ push(@{$changes{'lonstatus'}},$key);
+ }
+ }
+ }
}
foreach my $item (@toggles) {
if (($env{'form.'.$item} == 1) && ($currsetting{$item} == 0)) {
@@ -12943,22 +13258,79 @@ sub modify_contacts {
}
}
my @offon = ('off','on');
+ my $corelink = &core_link_msu();
if ($changes{'reporterrors'}) {
$resulttext .= ' '.
&mt('E-mail error reports to [_1] set to "'.
$offon[$env{'form.reporterrors'}].'".',
- &Apache::loncommon::modal_link('http://loncapa.org/core.html',
- &mt('LON-CAPA core group - MSU'),600,500)).
+ $corelink).
' ';
}
if ($changes{'reportupdates'}) {
$resulttext .= ''.
&mt('E-mail record of completed LON-CAPA updates to [_1] set to "'.
$offon[$env{'form.reportupdates'}].'".',
- &Apache::loncommon::modal_link('http://loncapa.org/core.html',
- &mt('LON-CAPA core group - MSU'),600,500)).
+ $corelink).
+ ' ';
+ }
+ if ($changes{'reportstatus'}) {
+ $resulttext .= ''.
+ &mt('E-mail status if errors above threshold to [_1] set to "'.
+ $offon[$env{'form.reportstatus'}].'".',
+ $corelink).
' ';
}
+ if (ref($changes{'lonstatus'}) eq 'ARRAY') {
+ $resulttext .= ''.
+ &mt('Nightly status check e-mail settings').':';
+ my (%defval,%use_def,%shown);
+ $defval{'threshold'} = $lonstatus_defs->{'threshold'};
+ $defval{'sysmail'} = $lonstatus_defs->{'sysmail'};
+ $defval{'weights'} =
+ join(', ',map { $lonstatus_names->{$_}.'='.$lonstatus_defs->{$_}; } ('E','W','N','U'));
+ $defval{'excluded'} = &mt('None');
+ if (ref($contacts_hash{'contacts'}{'lonstatus'}) eq 'HASH') {
+ foreach my $item ('threshold','sysmail','weights','excluded') {
+ if (exists($contacts_hash{'contacts'}{'lonstatus'}{$item})) {
+ if (($item eq 'threshold') || ($item eq 'sysmail')) {
+ $shown{$item} = $contacts_hash{'contacts'}{'lonstatus'}{$item};
+ } elsif ($item eq 'weights') {
+ if (ref($contacts_hash{'contacts'}{'lonstatus'}{$item}) eq 'HASH') {
+ foreach my $type ('E','W','N','U') {
+ $shown{$item} .= $lonstatus_names->{$type}.'=';
+ if (exists($contacts_hash{'contacts'}{'lonstatus'}{$item}{$type})) {
+ $shown{$item} .= $contacts_hash{'contacts'}{'lonstatus'}{$item}{$type};
+ } else {
+ $shown{$item} .= $lonstatus_defs->{$type};
+ }
+ $shown{$item} .= ', ';
+ }
+ $shown{$item} =~ s/, $//;
+ } else {
+ $shown{$item} = $defval{$item};
+ }
+ } elsif ($item eq 'excluded') {
+ if (ref($contacts_hash{'contacts'}{'lonstatus'}{$item}) eq 'ARRAY') {
+ $shown{$item} = join(', ',@{$contacts_hash{'contacts'}{'lonstatus'}{$item}});
+ } else {
+ $shown{$item} = $defval{$item};
+ }
+ }
+ } else {
+ $shown{$item} = $defval{$item};
+ }
+ }
+ } else {
+ foreach my $item ('threshold','weights','excluded','sysmail') {
+ $shown{$item} = $defval{$item};
+ }
+ }
+ foreach my $item ('threshold','weights','excluded','sysmail') {
+ $resulttext .= ''.&mt($titles->{'error'.$item}.' -- [_1]',
+ $shown{$item}).' ';
+ }
+ $resulttext .= ' ';
+ }
if ((ref($changes{'helpform'}) eq 'ARRAY') && (ref($fields) eq 'ARRAY')) {
my (@optional,@required,@unused,$maxsizechg);
foreach my $field (@{$changes{'helpform'}}) {
@@ -16358,12 +16730,17 @@ sub modify_ssl {
if ($env{'form.'.$prefix.'_'.$type} =~ /^(no|req)$/) {
$value = $env{'form.'.$prefix.'_'.$type};
}
- if (ref($domconfig{$action}{$prefix}) eq 'HASH') {
- if ($domconfig{$action}{$prefix}{$type} ne '') {
- if ($value ne $domconfig{$action}{$prefix}{$type}) {
+ if (ref($domconfig{$action}) eq 'HASH') {
+ if (ref($domconfig{$action}{$prefix}) eq 'HASH') {
+ if ($domconfig{$action}{$prefix}{$type} ne '') {
+ if ($value ne $domconfig{$action}{$prefix}{$type}) {
+ $changes{$prefix}{$type} = 1;
+ }
+ $defaultshash{$action}{$prefix}{$type} = $value;
+ } else {
+ $defaultshash{$action}{$prefix}{$type} = $value;
$changes{$prefix}{$type} = 1;
}
- $defaultshash{$action}{$prefix}{$type} = $value;
} else {
$defaultshash{$action}{$prefix}{$type} = $value;
$changes{$prefix}{$type} = 1;
@@ -16433,6 +16810,17 @@ sub modify_ssl {
}
}
}
+ if (keys(%changes)) {
+ foreach my $prefix (keys(%changes)) {
+ if (ref($changes{$prefix}) eq 'HASH') {
+ if (scalar(keys(%{$changes{$prefix}})) == 0) {
+ delete($changes{$prefix});
+ }
+ } else {
+ delete($changes{$prefix});
+ }
+ }
+ }
my $nochgmsg = &mt('No changes made to LON-CAPA SSL settings');
if (keys(%changes) > 0) {
my $putresult = &Apache::lonnet::put_dom('configuration',\%defaultshash,
@@ -16443,10 +16831,10 @@ sub modify_ssl {
$domdefaults{'replication'} = $defaultshash{$action}{'replication'};
}
if (ref($defaultshash{$action}{'connto'}) eq 'HASH') {
- $domdefaults{'connto'} = $domconfig{$action}{'connto'};
+ $domdefaults{'connto'} = $defaultshash{$action}{'connto'};
}
if (ref($defaultshash{$action}{'connfrom'}) eq 'HASH') {
- $domdefaults{'connfrom'} = $domconfig{$action}{'connfrom'};
+ $domdefaults{'connfrom'} = $defaultshash{$action}{'connfrom'};
}
}
my $cachetime = 24*60*60;
@@ -16632,12 +17020,12 @@ sub modify_loadbalancing {
my @sparestypes = ('primary','default');
my %typetitles = &sparestype_titles();
my $resulttext;
- my (%currbalancer,%currtargets,%currrules,%existing);
+ my (%currbalancer,%currtargets,%currrules,%existing,%currcookies);
if (ref($domconfig{'loadbalancing'}) eq 'HASH') {
%existing = %{$domconfig{'loadbalancing'}};
}
&get_loadbalancers_config(\%servers,\%existing,\%currbalancer,
- \%currtargets,\%currrules);
+ \%currtargets,\%currrules,\%currcookies);
my ($saveloadbalancing,%defaultshash,%changes);
my ($alltypes,$othertypes,$titles) =
&loadbalancing_titles($dom,$intdom,$usertypes,$types);
@@ -16689,6 +17077,18 @@ sub modify_loadbalancing {
}
$defaultshash{'loadbalancing'}{$balancer}{'targets'}{$sparetype} = \@offloadto;
}
+ if ($env{'form.loadbalancing_cookie_'.$i}) {
+ $defaultshash{'loadbalancing'}{$balancer}{'cookie'} = 1;
+ if (exists($currbalancer{$balancer})) {
+ unless ($currcookies{$balancer}) {
+ $changes{'curr'}{$balancer}{'cookie'} = 1;
+ }
+ }
+ } elsif (exists($currbalancer{$balancer})) {
+ if ($currcookies{$balancer}) {
+ $changes{'curr'}{$balancer}{'cookie'} = 1;
+ }
+ }
if (ref($currtargets{$balancer}) eq 'HASH') {
foreach my $sparetype (@sparestypes) {
if (ref($currtargets{$balancer}{$sparetype}) eq 'ARRAY') {
@@ -16842,6 +17242,10 @@ sub modify_loadbalancing {
}
}
}
+ if ($changes{'curr'}{$balancer}{'cookie'}) {
+ $resulttext .= ''.&mt('Load Balancer: [_1] -- cookie use enabled',
+ $balancer).' ';
+ }
if (keys(%toupdate)) {
my %thismachine;
my $updatedhere;
@@ -17071,12 +17475,12 @@ sub lonbalance_targets_js {
}
push(@alltypes,'default','_LC_adv','_LC_author','_LC_internetdom','_LC_external');
$allinsttypes = join("','",@alltypes);
- my (%currbalancer,%currtargets,%currrules,%existing);
+ my (%currbalancer,%currtargets,%currrules,%existing,%currcookies);
if (ref($settings) eq 'HASH') {
%existing = %{$settings};
}
&get_loadbalancers_config($servers,\%existing,\%currbalancer,
- \%currtargets,\%currrules);
+ \%currtargets,\%currrules,\%currcookies);
my $balancers = join("','",sort(keys(%currbalancer)));
return <<"END";