[LON-CAPA-cvs] cvs: loncom /interface domainprefs.pm
raeburn
lon-capa-cvs-allow@mail.lon-capa.org
Tue, 03 Jun 2008 17:02:18 -0000
raeburn Tue Jun 3 13:02:18 2008 EDT
Modified files:
/loncom/interface domainprefs.pm
Log:
Eliminate potential ISE.
- Starting in 2.6.0, all domain configuration settings need no longer be displayed on the first visit to the Domain Configuration menu.
- As a result need to make $domconfig{'rolecolors'} a HASH, if not already one.
- Some other sanity checking of references added
- Include images => "Images" in %choices hash returned by &color_font_choices().
Index: loncom/interface/domainprefs.pm
diff -u loncom/interface/domainprefs.pm:1.54 loncom/interface/domainprefs.pm:1.55
--- loncom/interface/domainprefs.pm:1.54 Sat May 31 19:37:46 2008
+++ loncom/interface/domainprefs.pm Tue Jun 3 13:02:12 2008
@@ -1,7 +1,7 @@
# The LearningOnline Network with CAPA
# Handler to set domain-wide configuration settings
#
-# $Id: domainprefs.pm,v 1.54 2008/05/31 23:37:46 raeburn Exp $
+# $Id: domainprefs.pm,v 1.55 2008/06/03 17:02:12 raeburn Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -2474,34 +2474,36 @@
'adminmail' => 'off',
'newuser' => 'off',
);
- foreach my $item (@toggles) {
- if ($defaultchecked{$item} eq 'on') {
- if (($domconfig{'login'}{$item} eq '0') &&
- ($env{'form.'.$item} eq '1')) {
- $changes{$item} = 1;
- } elsif (($domconfig{'login'}{$item} eq '' ||
- $domconfig{'login'}{$item} eq '1') &&
- ($env{'form.'.$item} eq '0')) {
- $changes{$item} = 1;
- }
- } elsif ($defaultchecked{$item} eq 'off') {
- if (($domconfig{'login'}{$item} eq '1') &&
- ($env{'form.'.$item} eq '0')) {
- $changes{$item} = 1;
- } elsif (($domconfig{'login'}{$item} eq '' ||
- $domconfig{'login'}{$item} eq '0') &&
- ($env{'form.'.$item} eq '1')) {
- $changes{$item} = 1;
+ if (ref($domconfig{'login'}) eq 'HASH') {
+ foreach my $item (@toggles) {
+ if ($defaultchecked{$item} eq 'on') {
+ if (($domconfig{'login'}{$item} eq '0') &&
+ ($env{'form.'.$item} eq '1')) {
+ $changes{$item} = 1;
+ } elsif (($domconfig{'login'}{$item} eq '' ||
+ $domconfig{'login'}{$item} eq '1') &&
+ ($env{'form.'.$item} eq '0')) {
+ $changes{$item} = 1;
+ }
+ } elsif ($defaultchecked{$item} eq 'off') {
+ if (($domconfig{'login'}{$item} eq '1') &&
+ ($env{'form.'.$item} eq '0')) {
+ $changes{$item} = 1;
+ } elsif (($domconfig{'login'}{$item} eq '' ||
+ $domconfig{'login'}{$item} eq '0') &&
+ ($env{'form.'.$item} eq '1')) {
+ $changes{$item} = 1;
+ }
}
}
- }
- if (($domconfig{'login'}{'loginheader'} eq 'text') &&
- ($env{'form.loginheader'} eq 'image')) {
- $changes{'loginheader'} = 1;
- } elsif (($domconfig{'login'}{'loginheader'} eq '' ||
- $domconfig{'login'}{'loginheader'} eq 'image') &&
- ($env{'form.loginheader'} eq 'text')) {
- $changes{'loginheader'} = 1;
+ if (($domconfig{'login'}{'loginheader'} eq 'text') &&
+ ($env{'form.loginheader'} eq 'image')) {
+ $changes{'loginheader'} = 1;
+ } elsif (($domconfig{'login'}{'loginheader'} eq '' ||
+ $domconfig{'login'}{'loginheader'} eq 'image') &&
+ ($env{'form.loginheader'} eq 'text')) {
+ $changes{'loginheader'} = 1;
+ }
}
if (keys(%changes) > 0 || $colchgtext) {
&Apache::loncommon::devalidate_domconfig_cache($dom);
@@ -2534,6 +2536,7 @@
img => "Header",
bgs => "Background colors",
links => "Link colors",
+ images => "Images",
font => "Font color",
pgbg => "Page",
tabbg => "Header",
@@ -2549,6 +2552,11 @@
my ($r,$dom,$confname,$roles,%domconfig) = @_;
my ($resulttext,%rolehash);
$rolehash{'rolecolors'} = {};
+ if (ref($domconfig{'rolecolors'}) ne 'HASH') {
+ if ($domconfig{'rolecolors'} eq '') {
+ $domconfig{'rolecolors'} = {};
+ }
+ }
my ($errors,%changes) = &modify_colors($r,$dom,$confname,$roles,
$domconfig{'rolecolors'},$rolehash{'rolecolors'});
my $putresult = &Apache::lonnet::put_dom('configuration',\%rolehash,
@@ -3144,7 +3152,11 @@
}
foreach my $key (keys(%formhash)) {
if ($formhash{$key} ne '') {
- if (!exists($domconfig{'quotas'}{$key})) {
+ if (ref($domconfig{'quotas'}) eq 'HASH') {
+ if (!exists($domconfig{'quotas'}{$key})) {
+ $changes{$key} = 1;
+ }
+ } else {
$changes{$key} = 1;
}
}
@@ -4247,8 +4259,10 @@
my ($dom,%domconfig) = @_;
my ($resulttext,%deletions,%reorderings,%needreordering,%adds,$errors);
my @deletecategory = &Apache::loncommon::get_env_multiple('form.deletecategory');
- if (($domconfig{'coursecategories'}{'instcode::0'} ne '') && ($env{'form.instcode'} == 0)) {
- push (@deletecategory,'instcode::0');
+ if (ref($domconfig{'coursecategories'}) eq 'HASH') {
+ if (($domconfig{'coursecategories'}{'instcode::0'} ne '') && ($env{'form.instcode'} == 0)) {
+ push (@deletecategory,'instcode::0');
+ }
}
my (@predelcats,@predeltrails,%predelallitems);
if (ref($domconfig{'coursecategories'}) eq 'HASH') {