[LON-CAPA-cvs] cvs: loncom(GCI_1) /interface domainprefs.pm
raeburn
raeburn@source.lon-capa.org
Mon, 14 Sep 2009 15:47:17 -0000
This is a MIME encoded message
--raeburn1252943237
Content-Type: text/plain
raeburn Mon Sep 14 15:47:17 2009 EDT
Modified files: (Branch: GCI_1)
/loncom/interface domainprefs.pm
Log:
- domainprefs.pm for GCI_1 updated to 2.8.X
- No change to log-in page for 2.8.
- Backport 1.78, 1.79, 1.80, 1.81, 1.82, 1.83, 1.84, 1.87, 1.89.
--raeburn1252943237
Content-Type: text/plain
Content-Disposition: attachment; filename="raeburn-20090914154717.txt"
Index: loncom/interface/domainprefs.pm
diff -u loncom/interface/domainprefs.pm:1.76 loncom/interface/domainprefs.pm:1.76.4.1
--- loncom/interface/domainprefs.pm:1.76 Thu Dec 11 13:53:44 2008
+++ loncom/interface/domainprefs.pm Mon Sep 14 15:47:17 2009
@@ -1,7 +1,7 @@
# The LearningOnline Network with CAPA
# Handler to set domain-wide configuration settings
#
-# $Id: domainprefs.pm,v 1.76 2008/12/11 13:53:44 raeburn Exp $
+# $Id: domainprefs.pm,v 1.76.4.1 2009/09/14 15:47:17 raeburn Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -39,7 +39,7 @@
use Apache::lonmsg();
use LONCAPA qw(:DEFAULT :match);
use LONCAPA::Enrollment;
-use LONCAPA::loncgi();
+use LONCAPA::lonauthcgi();
use File::Copy;
use Locale::Language;
use DateTime::TimeZone;
@@ -817,9 +817,9 @@
bgs => "Background colors",
links => "Link colors",
font => "Font color",
- pgbg => "Header",
- mainbg => "Page",
- sidebg => "Login box",
+ pgbg => "Page",
+ mainbg => "Main panel",
+ sidebg => "Side panel",
link => "Link",
alink => "Active link",
vlink => "Visited link",
@@ -1246,10 +1246,12 @@
if (ref($types) eq 'ARRAY') {
foreach my $type (@{$types}) {
my $currdefquota;
- if (ref($settings->{defaultquota}) eq 'HASH') {
- $currdefquota = $settings->{defaultquota}->{$type};
- } else {
- $currdefquota = $settings->{$type};
+ if (ref($settings) eq 'HASH') {
+ if (ref($settings->{defaultquota}) eq 'HASH') {
+ $currdefquota = $settings->{defaultquota}->{$type};
+ } else {
+ $currdefquota = $settings->{$type};
+ }
}
if (defined($usertypes->{$type})) {
$typecount ++;
@@ -1259,9 +1261,11 @@
'<td class="LC_left_item">';
foreach my $item (@usertools) {
my $checked = 'checked="checked" ';
- if (ref($settings->{$item}) eq 'HASH') {
- if ($settings->{$item}->{$type} == 0) {
- $checked = '';
+ if (ref($settings) eq 'HASH') {
+ if (ref($settings->{$item}) eq 'HASH') {
+ if ($settings->{$item}->{$type} == 0) {
+ $checked = '';
+ }
}
}
$datatable .= '<span class="LC_nobreak"><label>'.
@@ -1291,9 +1295,11 @@
'<td class="LC_left_item">';
foreach my $item (@usertools) {
my $checked = 'checked="checked" ';
- if (ref($settings->{$item}) eq 'HASH') {
- if ($settings->{$item}->{'default'} == 0) {
- $checked = '';
+ if (ref($settings) eq 'HASH') {
+ if (ref($settings->{$item}) eq 'HASH') {
+ if ($settings->{$item}->{'default'} == 0) {
+ $checked = '';
+ }
}
}
$datatable .= '<span class="LC_nobreak"><label>'.
@@ -1311,9 +1317,11 @@
'<td class="LC_left_item" colspan="2"><br />';
foreach my $item (@usertools) {
my $checked = 'checked="checked" ';
- if (ref($settings->{$item}) eq 'HASH') {
- if ($settings->{$item}->{'_LC_adv'} == 0) {
- $checked = '';
+ if (ref($settings) eq 'HASH') {
+ if (ref($settings->{$item}) eq 'HASH') {
+ if ($settings->{$item}->{'_LC_adv'} == 0) {
+ $checked = '';
+ }
}
}
$datatable .= '<span class="LC_nobreak"><label>'.
@@ -1321,7 +1329,8 @@
'" value="_LC_adv" '.$checked.'/>'.$titles{$item}.
'</label></span> ';
}
- $datatable .= '('.&mt('overrides affiliation').')</td></tr>';
+ $datatable .= '<span class="LC_nobreak">('.&mt('overrides affiliation').
+ ')</span></td></tr>';
$$rowtotal += $typecount;
return $datatable;
}
@@ -1562,7 +1571,7 @@
my $datatable;
my @contacts = ('adminemail','supportemail');
my (%checked,%to,%otheremails);
- my @mailings = ('errormail','packagesmail','helpdeskmail');
+ my @mailings = ('errormail','packagesmail','lonstatusmail','helpdeskmail');
foreach my $type (@mailings) {
$otheremails{$type} = '';
}
@@ -1582,6 +1591,8 @@
}
$otheremails{$type} = $settings->{$type}{'others'};
}
+ } elsif ($type eq 'lonstatusmail') {
+ $checked{'lonstatusmail'}{'adminemail'} = ' checked="checked" ';
}
}
} else {
@@ -1589,7 +1600,8 @@
$to{'adminemail'} = $Apache::lonnet::perlvar{'lonAdmEMail'};
$checked{'errormail'}{'adminemail'} = ' checked="checked" ';
$checked{'packagesmail'}{'adminemail'} = ' checked="checked" ';
- $checked{'helpdeskmail'}{'supportemail'} = ' checked="checked" ';
+ $checked{'helpdeskmail'}{'supportemail'} = ' checked="checked" ';
+ $checked{'lonstatusmail'}{'adminemail'} = ' checked="checked" ';
}
my ($titles,$short_titles) = &contact_titles();
my $rownum = 0;
@@ -1633,7 +1645,8 @@
'adminemail' => 'Default Server Admin E-mail address',
'errormail' => 'Error reports to be e-mailed to',
'packagesmail' => 'Package update alerts to be e-mailed to',
- 'helpdeskmail' => 'Helpdesk requests to be e-mailed to'
+ 'helpdeskmail' => 'Helpdesk requests to be e-mailed to',
+ 'lonstatusmail' => 'E-mail from nightly status check (warnings/errors)',
);
my %short_titles = &Apache::lonlocal::texthash (
adminemail => 'Admin E-mail address',
@@ -2364,7 +2377,7 @@
}
}
}
- my $titles= &LONCAPA::loncgi::serverstatus_titles();
+ my $titles= &LONCAPA::lonauthcgi::serverstatus_titles();
my $rownum = 0;
my $css_class;
foreach my $type (@pages) {
@@ -3603,10 +3616,16 @@
}
$resulttext .= '</ul></li>';
}
+ my %newenv;
foreach my $item (@usertools) {
if (ref($changes{$item}) eq 'HASH') {
- my $hashid = $env{'user.name'}.':'.$env{'user.domain'};
- &Apache::lonnet::devalidate_cache_new('usertools.'.$item,$hashid);
+ my $newacc =
+ &Apache::lonnet::usertools_access($env{'user.name'},
+ $env{'user.domain'},
+ $item,'reload');
+ if ($env{'environment.availabletools.'.$item} ne $newacc) {
+ $newenv{'environment.availabletools.'.$item} = $newacc;
+ }
$resulttext .= '<li>'.$titles{$item}.'<ul>';
foreach my $type (@{$types},'default','_LC_adv') {
if ($changes{$item}{$type}) {
@@ -3627,6 +3646,9 @@
}
}
$resulttext .= '</ul>';
+ if (keys(%newenv)) {
+ &Apache::lonnet::appenv(\%newenv);
+ }
} else {
$resulttext = &mt('No changes made to availability of home pages, blogs, portfolios or default quotas');
}
@@ -4011,7 +4033,7 @@
}
my (%others,%to);
my @contacts = ('supportemail','adminemail');
- my @mailings = ('errormail','packagesmail','helpdeskmail');
+ my @mailings = ('errormail','packagesmail','helpdeskmail','lonstatusmail');
foreach my $type (@mailings) {
@{$newsetting{$type}} =
&Apache::loncommon::get_env_multiple('form.'.$type);
@@ -4056,6 +4078,7 @@
$default{'errormail'} = 'adminemail';
$default{'packagesmail'} = 'adminemail';
$default{'helpdeskmail'} = 'supportemail';
+ $default{'lonstatusmail'} = 'adminemail';
foreach my $item (@contacts) {
if ($to{$item} ne $default{$item}) {
$changes{$item} = 1;
@@ -4743,8 +4766,10 @@
} else {
$changes{'togglecats'} = 1;
$changes{'categorize'} = 1;
- $domconfig{'coursecategories'}{'togglecats'} = $env{'form.togglecats'};
- $domconfig{'coursecategories'}{'categorize'} = $env{'form.categorize'};
+ $domconfig{'coursecategories'} = {
+ togglecats => $env{'form.togglecats'},
+ categorize => $env{'form.categorize'},
+ };
}
if (ref($cathash) eq 'HASH') {
if (($domconfig{'coursecategories'}{'cats'}{'instcode::0'} ne '') && ($env{'form.instcode'} == 0)) {
@@ -4959,58 +4984,57 @@
my %serverstatushash = (
serverstatuses => \%newserverstatus,
);
- my $putresult = &Apache::lonnet::put_dom('configuration',\%serverstatushash,
- $dom);
my %changes;
foreach my $type (@pages) {
- if (ref($currserverstatus{$type}) eq 'HASH') {
- my @currnamed = split(/,/,$currserverstatus{$type}{'namedusers'});
- my @newusers = split(/,/,$newserverstatus{$type}{'namedusers'});
- foreach my $item (@currnamed) {
- if (!grep(/^\Q$item\E$/,@newusers)) {
- $changes{$type}{'namedusers'} = 1;
- last;
+ foreach my $setting ('namedusers','machines') {
+ my (@current,@new);
+ if (ref($currserverstatus{$type}) eq 'HASH') {
+ if ($currserverstatus{$type}{$setting} ne '') {
+ @current = split(/,/,$currserverstatus{$type}{$setting});
}
}
- foreach my $item (@newusers) {
- if (!grep(/^\Q$item\E$/,@currnamed)) {
- $changes{$type}{'namedusers'} = 1;
- last;
- }
- }
- my @currmachines = split(/,/,$currserverstatus{$type}{'machines'});
- my @newmachines = split(/,/,$newserverstatus{$type}{'machines'});
- foreach my $item (@currmachines) {
- if (!grep(/^\Q$item\E$/,@newmachines)) {
- $changes{$type}{'machines'} = 1;
- last;
- }
- }
- foreach my $item (@newmachines) {
- if (!grep(/^\Q$item\E$/,@currmachines)) {
- $changes{$type}{'machines'} = 1;
- last;
+ if ($newserverstatus{$type}{$setting} ne '') {
+ @new = split(/,/,$newserverstatus{$type}{$setting});
+ }
+ if (@current > 0) {
+ if (@new > 0) {
+ foreach my $item (@current) {
+ if (!grep(/^\Q$item\E$/,@new)) {
+ $changes{$type}{$setting} = 1;
+ last;
+ }
+ }
+ foreach my $item (@new) {
+ if (!grep(/^\Q$item\E$/,@current)) {
+ $changes{$type}{$setting} = 1;
+ last;
+ }
+ }
+ } else {
+ $changes{$type}{$setting} = 1;
}
+ } elsif (@new > 0) {
+ $changes{$type}{$setting} = 1;
}
-
}
}
if (keys(%changes) > 0) {
- my $titles= &LONCAPA::loncgi::serverstatus_titles();
+ my $titles= &LONCAPA::lonauthcgi::serverstatus_titles();
my $putresult = &Apache::lonnet::put_dom('configuration',
\%serverstatushash,$dom);
if ($putresult eq 'ok') {
$resulttext .= &mt('Changes made:').'<ul>';
foreach my $type (@pages) {
- if (defined($changes{$type})) {
+ if (ref($changes{$type}) eq 'HASH') {
$resulttext .= '<li>'.$titles->{$type}.'<ul>';
- if (defined($changes{$type}{'namedusers'})) {
+ if ($changes{$type}{'namedusers'}) {
if ($newserverstatus{$type}{'namedusers'} eq '') {
$resulttext .= '<li>'.&mt("Access terminated for all specific (named) users").'</li>'."\n";
} else {
$resulttext .= '<li>'.&mt("Access available for the following specified users: ").$newserverstatus{$type}{'namedusers'}.'</li>'."\n";
}
- } elsif (defined($changes{$type}{'machines'})) {
+ }
+ if ($changes{$type}{'machines'}) {
if ($newserverstatus{$type}{'machines'} eq '') {
$resulttext .= '<li>'.&mt("Access terminated for all specific IP addresses").'</li>'."\n";
} else {
--raeburn1252943237--