version 1.76.4.2, 2009/09/14 15:59:10
|
version 1.77, 2008/12/11 16:37:42
|
Line 39 use Apache::lonlocal;
|
Line 39 use Apache::lonlocal;
|
use Apache::lonmsg(); |
use Apache::lonmsg(); |
use LONCAPA qw(:DEFAULT :match); |
use LONCAPA qw(:DEFAULT :match); |
use LONCAPA::Enrollment; |
use LONCAPA::Enrollment; |
use LONCAPA::lonauthcgi(); |
use LONCAPA::loncgi(); |
use File::Copy; |
use File::Copy; |
use Locale::Language; |
use Locale::Language; |
use DateTime::TimeZone; |
use DateTime::TimeZone; |
Line 107 sub handler {
|
Line 107 sub handler {
|
'quotas' => |
'quotas' => |
{ text => 'User blogs, home pages and portfolios', |
{ text => 'User blogs, home pages and portfolios', |
help => 'Domain_Configuration_Quotas', |
help => 'Domain_Configuration_Quotas', |
header => [{col1 => 'User type', |
header => [{col1 => 'User affiliation', |
col2 => 'Available tools', |
col2 => 'Available tools', |
col3 => 'Portfolio quota',}], |
col3 => 'Portfolio quota',}], |
}, |
}, |
Line 175 sub handler {
|
Line 175 sub handler {
|
}], |
}], |
}, |
}, |
'serverstatuses' => |
'serverstatuses' => |
{text => 'Access to Server Status Pages', |
{text => 'Access to server status pages', |
help => 'Domain_Configuration_Server_Status', |
help => 'Domain_Configuration_Server_Status', |
header => [{col1 => 'Status Page', |
header => [{col1 => 'Status Page', |
col2 => 'Other named users', |
col2 => 'Other named users', |
Line 817 sub login_choices {
|
Line 817 sub login_choices {
|
bgs => "Background colors", |
bgs => "Background colors", |
links => "Link colors", |
links => "Link colors", |
font => "Font color", |
font => "Font color", |
pgbg => "Page", |
pgbg => "Header", |
mainbg => "Main panel", |
mainbg => "Page", |
sidebg => "Side panel", |
sidebg => "Login box", |
link => "Link", |
link => "Link", |
alink => "Active link", |
alink => "Active link", |
vlink => "Visited link", |
vlink => "Visited link", |
Line 1246 sub print_quotas {
|
Line 1246 sub print_quotas {
|
if (ref($types) eq 'ARRAY') { |
if (ref($types) eq 'ARRAY') { |
foreach my $type (@{$types}) { |
foreach my $type (@{$types}) { |
my $currdefquota; |
my $currdefquota; |
if (ref($settings) eq 'HASH') { |
if (ref($settings->{defaultquota}) eq 'HASH') { |
if (ref($settings->{defaultquota}) eq 'HASH') { |
$currdefquota = $settings->{defaultquota}->{$type}; |
$currdefquota = $settings->{defaultquota}->{$type}; |
} else { |
} else { |
$currdefquota = $settings->{$type}; |
$currdefquota = $settings->{$type}; |
|
} |
|
} |
} |
if (defined($usertypes->{$type})) { |
if (defined($usertypes->{$type})) { |
$typecount ++; |
$typecount ++; |
Line 1261 sub print_quotas {
|
Line 1259 sub print_quotas {
|
'<td class="LC_left_item">'; |
'<td class="LC_left_item">'; |
foreach my $item (@usertools) { |
foreach my $item (@usertools) { |
my $checked = 'checked="checked" '; |
my $checked = 'checked="checked" '; |
if (ref($settings) eq 'HASH') { |
if (ref($settings->{$item}) eq 'HASH') { |
if (ref($settings->{$item}) eq 'HASH') { |
if ($settings->{$item}->{$type} == 0) { |
if ($settings->{$item}->{$type} == 0) { |
$checked = ''; |
$checked = ''; |
|
} |
|
} |
} |
} |
} |
$datatable .= '<span class="LC_nobreak"><label>'. |
$datatable .= '<span class="LC_nobreak"><label>'. |
Line 1295 sub print_quotas {
|
Line 1291 sub print_quotas {
|
'<td class="LC_left_item">'; |
'<td class="LC_left_item">'; |
foreach my $item (@usertools) { |
foreach my $item (@usertools) { |
my $checked = 'checked="checked" '; |
my $checked = 'checked="checked" '; |
if (ref($settings) eq 'HASH') { |
if (ref($settings->{$item}) eq 'HASH') { |
if (ref($settings->{$item}) eq 'HASH') { |
if ($settings->{$item}->{'default'} == 0) { |
if ($settings->{$item}->{'default'} == 0) { |
$checked = ''; |
$checked = ''; |
|
} |
|
} |
} |
} |
} |
$datatable .= '<span class="LC_nobreak"><label>'. |
$datatable .= '<span class="LC_nobreak"><label>'. |
Line 1317 sub print_quotas {
|
Line 1311 sub print_quotas {
|
'<td class="LC_left_item" colspan="2"><br />'; |
'<td class="LC_left_item" colspan="2"><br />'; |
foreach my $item (@usertools) { |
foreach my $item (@usertools) { |
my $checked = 'checked="checked" '; |
my $checked = 'checked="checked" '; |
if (ref($settings) eq 'HASH') { |
if (ref($settings->{$item}) eq 'HASH') { |
if (ref($settings->{$item}) eq 'HASH') { |
if ($settings->{$item}->{'_LC_adv'} == 0) { |
if ($settings->{$item}->{'_LC_adv'} == 0) { |
$checked = ''; |
$checked = ''; |
|
} |
|
} |
} |
} |
} |
$datatable .= '<span class="LC_nobreak"><label>'. |
$datatable .= '<span class="LC_nobreak"><label>'. |
Line 1330 sub print_quotas {
|
Line 1322 sub print_quotas {
|
'</label></span> '; |
'</label></span> '; |
} |
} |
$datatable .= '<span class="LC_nobreak">('.&mt('overrides affiliation'). |
$datatable .= '<span class="LC_nobreak">('.&mt('overrides affiliation'). |
')</span></td></tr>'; |
')</span</td></tr>'; |
$$rowtotal += $typecount; |
$$rowtotal += $typecount; |
return $datatable; |
return $datatable; |
} |
} |
Line 1571 sub print_contacts {
|
Line 1563 sub print_contacts {
|
my $datatable; |
my $datatable; |
my @contacts = ('adminemail','supportemail'); |
my @contacts = ('adminemail','supportemail'); |
my (%checked,%to,%otheremails); |
my (%checked,%to,%otheremails); |
my @mailings = ('errormail','packagesmail','lonstatusmail','helpdeskmail'); |
my @mailings = ('errormail','packagesmail','helpdeskmail'); |
foreach my $type (@mailings) { |
foreach my $type (@mailings) { |
$otheremails{$type} = ''; |
$otheremails{$type} = ''; |
} |
} |
Line 1591 sub print_contacts {
|
Line 1583 sub print_contacts {
|
} |
} |
$otheremails{$type} = $settings->{$type}{'others'}; |
$otheremails{$type} = $settings->{$type}{'others'}; |
} |
} |
} elsif ($type eq 'lonstatusmail') { |
|
$checked{'lonstatusmail'}{'adminemail'} = ' checked="checked" '; |
|
} |
} |
} |
} |
} else { |
} else { |
Line 1600 sub print_contacts {
|
Line 1590 sub print_contacts {
|
$to{'adminemail'} = $Apache::lonnet::perlvar{'lonAdmEMail'}; |
$to{'adminemail'} = $Apache::lonnet::perlvar{'lonAdmEMail'}; |
$checked{'errormail'}{'adminemail'} = ' checked="checked" '; |
$checked{'errormail'}{'adminemail'} = ' checked="checked" '; |
$checked{'packagesmail'}{'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 ($titles,$short_titles) = &contact_titles(); |
my $rownum = 0; |
my $rownum = 0; |
Line 1645 sub contact_titles {
|
Line 1634 sub contact_titles {
|
'adminemail' => 'Default Server Admin E-mail address', |
'adminemail' => 'Default Server Admin E-mail address', |
'errormail' => 'Error reports to be e-mailed to', |
'errormail' => 'Error reports to be e-mailed to', |
'packagesmail' => 'Package update alerts 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 ( |
my %short_titles = &Apache::lonlocal::texthash ( |
adminemail => 'Admin E-mail address', |
adminemail => 'Admin E-mail address', |
Line 2377 sub print_serverstatuses {
|
Line 2365 sub print_serverstatuses {
|
} |
} |
} |
} |
} |
} |
my $titles= &LONCAPA::lonauthcgi::serverstatus_titles(); |
my $titles= &LONCAPA::loncgi::serverstatus_titles(); |
my $rownum = 0; |
my $rownum = 0; |
my $css_class; |
my $css_class; |
foreach my $type (@pages) { |
foreach my $type (@pages) { |
Line 3616 sub modify_quotas {
|
Line 3604 sub modify_quotas {
|
} |
} |
$resulttext .= '</ul></li>'; |
$resulttext .= '</ul></li>'; |
} |
} |
my %newenv; |
|
foreach my $item (@usertools) { |
foreach my $item (@usertools) { |
if (ref($changes{$item}) eq 'HASH') { |
if (ref($changes{$item}) eq 'HASH') { |
my $newacc = |
my $hashid = $env{'user.name'}.':'.$env{'user.domain'}; |
&Apache::lonnet::usertools_access($env{'user.name'}, |
&Apache::lonnet::devalidate_cache_new('usertools.'.$item,$hashid); |
$env{'user.domain'}, |
|
$item,'reload'); |
|
if ($env{'environment.availabletools.'.$item} ne $newacc) { |
|
$newenv{'environment.availabletools.'.$item} = $newacc; |
|
} |
|
$resulttext .= '<li>'.$titles{$item}.'<ul>'; |
$resulttext .= '<li>'.$titles{$item}.'<ul>'; |
foreach my $type (@{$types},'default','_LC_adv') { |
foreach my $type (@{$types},'default','_LC_adv') { |
if ($changes{$item}{$type}) { |
if ($changes{$item}{$type}) { |
Line 3646 sub modify_quotas {
|
Line 3628 sub modify_quotas {
|
} |
} |
} |
} |
$resulttext .= '</ul>'; |
$resulttext .= '</ul>'; |
if (keys(%newenv)) { |
|
&Apache::lonnet::appenv(\%newenv); |
|
} |
|
} else { |
} else { |
$resulttext = &mt('No changes made to availability of home pages, blogs, portfolios or default quotas'); |
$resulttext = &mt('No changes made to availability of home pages, blogs, portfolios or default quotas'); |
} |
} |
Line 4033 sub modify_contacts {
|
Line 4012 sub modify_contacts {
|
} |
} |
my (%others,%to); |
my (%others,%to); |
my @contacts = ('supportemail','adminemail'); |
my @contacts = ('supportemail','adminemail'); |
my @mailings = ('errormail','packagesmail','helpdeskmail','lonstatusmail'); |
my @mailings = ('errormail','packagesmail','helpdeskmail'); |
foreach my $type (@mailings) { |
foreach my $type (@mailings) { |
@{$newsetting{$type}} = |
@{$newsetting{$type}} = |
&Apache::loncommon::get_env_multiple('form.'.$type); |
&Apache::loncommon::get_env_multiple('form.'.$type); |
Line 4078 sub modify_contacts {
|
Line 4057 sub modify_contacts {
|
$default{'errormail'} = 'adminemail'; |
$default{'errormail'} = 'adminemail'; |
$default{'packagesmail'} = 'adminemail'; |
$default{'packagesmail'} = 'adminemail'; |
$default{'helpdeskmail'} = 'supportemail'; |
$default{'helpdeskmail'} = 'supportemail'; |
$default{'lonstatusmail'} = 'adminemail'; |
|
foreach my $item (@contacts) { |
foreach my $item (@contacts) { |
if ($to{$item} ne $default{$item}) { |
if ($to{$item} ne $default{$item}) { |
$changes{$item} = 1; |
$changes{$item} = 1; |
Line 4588 sub modify_defaults {
|
Line 4566 sub modify_defaults {
|
if ($newvalues{$item} ne '') { |
if ($newvalues{$item} ne '') { |
if ($newvalues{$item} =~ /^(\w+)/) { |
if ($newvalues{$item} =~ /^(\w+)/) { |
my $langcode = $1; |
my $langcode = $1; |
if ($langcode ne 'gci' && $langcode ne 'x_chef') { |
if (code2language($langcode) eq '') { |
if (code2language($langcode) eq '') { |
push(@errors,$item); |
push(@errors,$item); |
|
} |
|
} |
} |
} else { |
} else { |
push(@errors,$item); |
push(@errors,$item); |
Line 4768 sub modify_coursecategories {
|
Line 4744 sub modify_coursecategories {
|
} else { |
} else { |
$changes{'togglecats'} = 1; |
$changes{'togglecats'} = 1; |
$changes{'categorize'} = 1; |
$changes{'categorize'} = 1; |
$domconfig{'coursecategories'} = { |
$domconfig{'coursecategories'}{'togglecats'} = $env{'form.togglecats'}; |
togglecats => $env{'form.togglecats'}, |
$domconfig{'coursecategories'}{'categorize'} = $env{'form.categorize'}; |
categorize => $env{'form.categorize'}, |
|
}; |
|
} |
} |
if (ref($cathash) eq 'HASH') { |
if (ref($cathash) eq 'HASH') { |
if (($domconfig{'coursecategories'}{'cats'}{'instcode::0'} ne '') && ($env{'form.instcode'} == 0)) { |
if (($domconfig{'coursecategories'}{'cats'}{'instcode::0'} ne '') && ($env{'form.instcode'} == 0)) { |
Line 4986 sub modify_serverstatuses {
|
Line 4960 sub modify_serverstatuses {
|
my %serverstatushash = ( |
my %serverstatushash = ( |
serverstatuses => \%newserverstatus, |
serverstatuses => \%newserverstatus, |
); |
); |
|
my $putresult = &Apache::lonnet::put_dom('configuration',\%serverstatushash, |
|
$dom); |
my %changes; |
my %changes; |
foreach my $type (@pages) { |
foreach my $type (@pages) { |
foreach my $setting ('namedusers','machines') { |
if (ref($currserverstatus{$type}) eq 'HASH') { |
my (@current,@new); |
my @currnamed = split(/,/,$currserverstatus{$type}{'namedusers'}); |
if (ref($currserverstatus{$type}) eq 'HASH') { |
my @newusers = split(/,/,$newserverstatus{$type}{'namedusers'}); |
if ($currserverstatus{$type}{$setting} ne '') { |
foreach my $item (@currnamed) { |
@current = split(/,/,$currserverstatus{$type}{$setting}); |
if (!grep(/^\Q$item\E$/,@newusers)) { |
|
$changes{$type}{'namedusers'} = 1; |
|
last; |
} |
} |
} |
} |
if ($newserverstatus{$type}{$setting} ne '') { |
foreach my $item (@newusers) { |
@new = split(/,/,$newserverstatus{$type}{$setting}); |
if (!grep(/^\Q$item\E$/,@currnamed)) { |
} |
$changes{$type}{'namedusers'} = 1; |
if (@current > 0) { |
last; |
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; |
|
} |
} |
|
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 (keys(%changes) > 0) { |
if (keys(%changes) > 0) { |
my $titles= &LONCAPA::lonauthcgi::serverstatus_titles(); |
my $titles= &LONCAPA::loncgi::serverstatus_titles(); |
my $putresult = &Apache::lonnet::put_dom('configuration', |
my $putresult = &Apache::lonnet::put_dom('configuration', |
\%serverstatushash,$dom); |
\%serverstatushash,$dom); |
if ($putresult eq 'ok') { |
if ($putresult eq 'ok') { |
$resulttext .= &mt('Changes made:').'<ul>'; |
$resulttext .= &mt('Changes made:').'<ul>'; |
foreach my $type (@pages) { |
foreach my $type (@pages) { |
if (ref($changes{$type}) eq 'HASH') { |
if (defined($changes{$type})) { |
$resulttext .= '<li>'.$titles->{$type}.'<ul>'; |
$resulttext .= '<li>'.$titles->{$type}.'<ul>'; |
if ($changes{$type}{'namedusers'}) { |
if (defined($changes{$type}{'namedusers'})) { |
if ($newserverstatus{$type}{'namedusers'} eq '') { |
if ($newserverstatus{$type}{'namedusers'} eq '') { |
$resulttext .= '<li>'.&mt("Access terminated for all specific (named) users").'</li>'."\n"; |
$resulttext .= '<li>'.&mt("Access terminated for all specific (named) users").'</li>'."\n"; |
} else { |
} else { |
$resulttext .= '<li>'.&mt("Access available for the following specified users: ").$newserverstatus{$type}{'namedusers'}.'</li>'."\n"; |
$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 '') { |
if ($newserverstatus{$type}{'machines'} eq '') { |
$resulttext .= '<li>'.&mt("Access terminated for all specific IP addresses").'</li>'."\n"; |
$resulttext .= '<li>'.&mt("Access terminated for all specific IP addresses").'</li>'."\n"; |
} else { |
} else { |