version 1.67, 2008/07/23 02:50:57
|
version 1.68, 2008/09/19 03:27:04
|
Line 42 use LONCAPA::Enrollment;
|
Line 42 use LONCAPA::Enrollment;
|
use File::Copy; |
use File::Copy; |
use Locale::Language; |
use Locale::Language; |
use DateTime::TimeZone; |
use DateTime::TimeZone; |
|
use DateTime::Locale; |
|
|
sub handler { |
sub handler { |
my $r=shift; |
my $r=shift; |
Line 1823 sub print_usermodification {
|
Line 1824 sub print_usermodification {
|
|
|
sub print_defaults { |
sub print_defaults { |
my ($dom,$rowtotal) = @_; |
my ($dom,$rowtotal) = @_; |
my @items = ('auth_def','auth_arg_def','lang_def','timezone_def'); |
my @items = ('auth_def','auth_arg_def','lang_def','timezone_def', |
|
'datelocale_def'); |
my %domdefaults = &Apache::lonnet::get_domain_defaults($dom); |
my %domdefaults = &Apache::lonnet::get_domain_defaults($dom); |
my $titles = &defaults_titles(); |
my $titles = &defaults_titles(); |
my $rownum = 0; |
my $rownum = 0; |
Line 1858 sub print_defaults {
|
Line 1860 sub print_defaults {
|
} elsif ($item eq 'timezone_def') { |
} elsif ($item eq 'timezone_def') { |
my $includeempty = 1; |
my $includeempty = 1; |
$datatable .= &Apache::loncommon::select_timezone($item,$domdefaults{$item},undef,$includeempty); |
$datatable .= &Apache::loncommon::select_timezone($item,$domdefaults{$item},undef,$includeempty); |
|
} elsif ($item eq 'datelocale_def') { |
|
my $includeempty = 1; |
|
$datatable .= &Apache::loncommon::select_datelocale($item,$domdefaults{$item},undef,$includeempty); |
} else { |
} else { |
$datatable .= '<input type="text" name="'.$item.'" value="'. |
$datatable .= '<input type="text" name="'.$item.'" value="'. |
$domdefaults{$item}.'" />'; |
$domdefaults{$item}.'" />'; |
Line 1875 sub defaults_titles {
|
Line 1880 sub defaults_titles {
|
'auth_arg_def' => 'Default authentication argument', |
'auth_arg_def' => 'Default authentication argument', |
'lang_def' => 'Default language', |
'lang_def' => 'Default language', |
'timezone_def' => 'Default timezone', |
'timezone_def' => 'Default timezone', |
|
'datelocale_def' => 'Default locale for dates', |
); |
); |
return (\%titles); |
return (\%titles); |
} |
} |
Line 4251 sub modify_defaults {
|
Line 4257 sub modify_defaults {
|
my ($dom,$r) = @_; |
my ($dom,$r) = @_; |
my ($resulttext,$mailmsgtxt,%newvalues,%changes,@errors); |
my ($resulttext,$mailmsgtxt,%newvalues,%changes,@errors); |
my %domdefaults = &Apache::lonnet::get_domain_defaults($dom); |
my %domdefaults = &Apache::lonnet::get_domain_defaults($dom); |
my @items = ('auth_def','auth_arg_def','lang_def','timezone_def'); |
my @items = ('auth_def','auth_arg_def','lang_def','timezone_def','datelocale_def'); |
my @authtypes = ('internal','krb4','krb5','localauth'); |
my @authtypes = ('internal','krb4','krb5','localauth'); |
foreach my $item (@items) { |
foreach my $item (@items) { |
$newvalues{$item} = $env{'form.'.$item}; |
$newvalues{$item} = $env{'form.'.$item}; |
Line 4278 sub modify_defaults {
|
Line 4284 sub modify_defaults {
|
push(@errors,$item); |
push(@errors,$item); |
} |
} |
} |
} |
|
} elsif ($item eq 'datelocale_def') { |
|
if ($newvalues{$item} ne '') { |
|
my @datelocale_ids = DateTime::Locale->ids(); |
|
if (!grep(/^\Q$newvalues{$item}\E$/,@datelocale_ids)) { |
|
push(@errors,$item); |
|
} |
|
} |
} |
} |
if (grep(/^\Q$item\E$/,@errors)) { |
if (grep(/^\Q$item\E$/,@errors)) { |
$newvalues{$item} = $domdefaults{$item}; |
$newvalues{$item} = $domdefaults{$item}; |
Line 4290 sub modify_defaults {
|
Line 4303 sub modify_defaults {
|
auth_arg_def => $newvalues{'auth_arg_def'}, |
auth_arg_def => $newvalues{'auth_arg_def'}, |
lang_def => $newvalues{'lang_def'}, |
lang_def => $newvalues{'lang_def'}, |
timezone_def => $newvalues{'timezone_def'}, |
timezone_def => $newvalues{'timezone_def'}, |
|
datelocale_def => $newvalues{'datelocale_def'}, |
} |
} |
); |
); |
my $title = &defaults_titles(); |
my $title = &defaults_titles(); |
Line 4322 sub modify_defaults {
|
Line 4336 sub modify_defaults {
|
my $cachetime = 24*60*60; |
my $cachetime = 24*60*60; |
&Apache::lonnet::do_cache_new('domdefaults',$dom, |
&Apache::lonnet::do_cache_new('domdefaults',$dom, |
$defaults_hash{'defaults'},$cachetime); |
$defaults_hash{'defaults'},$cachetime); |
if ($changes{'auth_def'} || $changes{'auth_arg_def'} || $changes{'lang_def'}) { |
if ($changes{'auth_def'} || $changes{'auth_arg_def'} || $changes{'lang_def'} || $changes{'datelocale_def'}) { |
my $sysmail = $r->dir_config('lonSysEMail'); |
my $sysmail = $r->dir_config('lonSysEMail'); |
&Apache::lonmsg::sendemail($sysmail,"LON-CAPA Domain Settings Change - $dom",$mailmsgtext); |
&Apache::lonmsg::sendemail($sysmail,"LON-CAPA Domain Settings Change - $dom",$mailmsgtext); |
} |
} |