--- loncom/interface/domainprefs.pm 2008/05/29 03:27:33 1.53
+++ loncom/interface/domainprefs.pm 2008/05/31 23:37:46 1.54
@@ -1,7 +1,7 @@
# The LearningOnline Network with CAPA
# Handler to set domain-wide configuration settings
#
-# $Id: domainprefs.pm,v 1.53 2008/05/29 03:27:33 raeburn Exp $
+# $Id: domainprefs.pm,v 1.54 2008/05/31 23:37:46 raeburn Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -96,7 +96,7 @@ sub handler {
col2 => '',}],
},
'defaults' =>
- { text => 'Default authentication/language',
+ { text => 'Default authentication/language/timezone',
help => '',
header => [{col1 => 'Setting',
col2 => 'Value'}],
@@ -1782,7 +1782,7 @@ sub print_usermodification {
sub print_defaults {
my ($dom,$rowtotal) = @_;
- my @items = ('auth_def','auth_arg_def','lang_def');
+ my @items = ('auth_def','auth_arg_def','lang_def','timezone_def');
my %domdefaults = &Apache::lonnet::get_domain_defaults($dom);
my $titles = &defaults_titles();
my $rownum = 0;
@@ -1814,6 +1814,9 @@ sub print_defaults {
'" value="'.$auth.'"'.$checked.'/>'.
$authnames{$shortauth{$auth}}.' ';
}
+ } elsif ($item eq 'timezone_def') {
+ my $includeempty = 1;
+ $datatable .= &Apache::loncommon::select_timezone($item,$domdefaults{$item},undef,$includeempty);
} else {
$datatable .= '';
@@ -1830,6 +1833,7 @@ sub defaults_titles {
'auth_def' => 'Default authentication type',
'auth_arg_def' => 'Default authentication argument',
'lang_def' => 'Default language',
+ 'timezone_def' => 'Default timezone',
);
return (\%titles);
}
@@ -4067,7 +4071,7 @@ sub modify_defaults {
my ($dom,$r) = @_;
my ($resulttext,$mailmsgtxt,%newvalues,%changes,@errors);
my %domdefaults = &Apache::lonnet::get_domain_defaults($dom);
- my @items = ('auth_def','auth_arg_def','lang_def');
+ my @items = ('auth_def','auth_arg_def','lang_def','timezone_def');
my @authtypes = ('internal','krb4','krb5','localauth');
foreach my $item (@items) {
$newvalues{$item} = $env{'form.'.$item};
@@ -4088,6 +4092,13 @@ sub modify_defaults {
push(@errors,$item);
}
}
+ } elsif ($item eq 'timezone_def') {
+ if ($newvalues{$item} ne '') {
+ my @timezones = &DateTime::TimeZone->all_names;
+ if (!grep(/^\Q$newvalues{$item}\E/,@timezones)) {
+ push(@errors,$item);
+ }
+ }
}
if (grep(/^\Q$item\E$/,@errors)) {
$newvalues{$item} = $domdefaults{$item};
@@ -4099,6 +4110,7 @@ sub modify_defaults {
defaults => { auth_def => $newvalues{'auth_def'},
auth_arg_def => $newvalues{'auth_arg_def'},
lang_def => $newvalues{'lang_def'},
+ timezone_def => $newvalues{'timezone_def'},
}
);
my $title = &defaults_titles();
@@ -4131,10 +4143,12 @@ sub modify_defaults {
my $cachetime = 24*60*60;
&Apache::lonnet::do_cache_new('domdefaults',$dom,
$defaults_hash{'defaults'},$cachetime);
- my $sysmail = $r->dir_config('lonSysEMail');
- &Apache::lonmsg::sendemail($sysmail,"LON-CAPA Domain Settings Change - $dom",$mailmsgtext);
+ if ($changes{'auth_def'} || $changes{'auth_arg_def'} || $changes{'lang_def'}) {
+ my $sysmail = $r->dir_config('lonSysEMail');
+ &Apache::lonmsg::sendemail($sysmail,"LON-CAPA Domain Settings Change - $dom",$mailmsgtext);
+ }
} else {
- $resulttext = &mt('No changes made to default authentication/language settings');
+ $resulttext = &mt('No changes made to default authentication/language/timezone settings');
}
} else {
$resulttext = ''.