version 1.76, 2008/12/11 13:53:44
|
version 1.76.2.7, 2009/03/18 21:30:05
|
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::loncgi(); |
use LONCAPA::lonauthcgi(); |
use File::Copy; |
use File::Copy; |
use Locale::Language; |
use Locale::Language; |
use DateTime::TimeZone; |
use DateTime::TimeZone; |
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 => "Header", |
pgbg => "Page", |
mainbg => "Page", |
mainbg => "Main panel", |
sidebg => "Login box", |
sidebg => "Side panel", |
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->{defaultquota}) eq 'HASH') { |
if (ref($settings) eq 'HASH') { |
$currdefquota = $settings->{defaultquota}->{$type}; |
if (ref($settings->{defaultquota}) eq 'HASH') { |
} else { |
$currdefquota = $settings->{defaultquota}->{$type}; |
$currdefquota = $settings->{$type}; |
} else { |
|
$currdefquota = $settings->{$type}; |
|
} |
} |
} |
if (defined($usertypes->{$type})) { |
if (defined($usertypes->{$type})) { |
$typecount ++; |
$typecount ++; |
Line 1259 sub print_quotas {
|
Line 1261 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->{$item}) eq 'HASH') { |
if (ref($settings) eq 'HASH') { |
if ($settings->{$item}->{$type} == 0) { |
if (ref($settings->{$item}) eq 'HASH') { |
$checked = ''; |
if ($settings->{$item}->{$type} == 0) { |
|
$checked = ''; |
|
} |
} |
} |
} |
} |
$datatable .= '<span class="LC_nobreak"><label>'. |
$datatable .= '<span class="LC_nobreak"><label>'. |
Line 1291 sub print_quotas {
|
Line 1295 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->{$item}) eq 'HASH') { |
if (ref($settings) eq 'HASH') { |
if ($settings->{$item}->{'default'} == 0) { |
if (ref($settings->{$item}) eq 'HASH') { |
$checked = ''; |
if ($settings->{$item}->{'default'} == 0) { |
|
$checked = ''; |
|
} |
} |
} |
} |
} |
$datatable .= '<span class="LC_nobreak"><label>'. |
$datatable .= '<span class="LC_nobreak"><label>'. |
Line 1311 sub print_quotas {
|
Line 1317 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->{$item}) eq 'HASH') { |
if (ref($settings) eq 'HASH') { |
if ($settings->{$item}->{'_LC_adv'} == 0) { |
if (ref($settings->{$item}) eq 'HASH') { |
$checked = ''; |
if ($settings->{$item}->{'_LC_adv'} == 0) { |
|
$checked = ''; |
|
} |
} |
} |
} |
} |
$datatable .= '<span class="LC_nobreak"><label>'. |
$datatable .= '<span class="LC_nobreak"><label>'. |
Line 1321 sub print_quotas {
|
Line 1329 sub print_quotas {
|
'" value="_LC_adv" '.$checked.'/>'.$titles{$item}. |
'" value="_LC_adv" '.$checked.'/>'.$titles{$item}. |
'</label></span> '; |
'</label></span> '; |
} |
} |
$datatable .= '('.&mt('overrides affiliation').')</td></tr>'; |
$datatable .= '<span class="LC_nobreak">('.&mt('overrides affiliation'). |
|
')</span></td></tr>'; |
$$rowtotal += $typecount; |
$$rowtotal += $typecount; |
return $datatable; |
return $datatable; |
} |
} |
Line 1562 sub print_contacts {
|
Line 1571 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','helpdeskmail'); |
my @mailings = ('errormail','packagesmail','lonstatusmail','helpdeskmail'); |
foreach my $type (@mailings) { |
foreach my $type (@mailings) { |
$otheremails{$type} = ''; |
$otheremails{$type} = ''; |
} |
} |
Line 1582 sub print_contacts {
|
Line 1591 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 1589 sub print_contacts {
|
Line 1600 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 1633 sub contact_titles {
|
Line 1645 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 2364 sub print_serverstatuses {
|
Line 2377 sub print_serverstatuses {
|
} |
} |
} |
} |
} |
} |
my $titles= &LONCAPA::loncgi::serverstatus_titles(); |
my $titles= &LONCAPA::lonauthcgi::serverstatus_titles(); |
my $rownum = 0; |
my $rownum = 0; |
my $css_class; |
my $css_class; |
foreach my $type (@pages) { |
foreach my $type (@pages) { |
Line 3603 sub modify_quotas {
|
Line 3616 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 $hashid = $env{'user.name'}.':'.$env{'user.domain'}; |
my $newacc = |
&Apache::lonnet::devalidate_cache_new('usertools.'.$item,$hashid); |
&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>'; |
$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 3627 sub modify_quotas {
|
Line 3646 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 4011 sub modify_contacts {
|
Line 4033 sub modify_contacts {
|
} |
} |
my (%others,%to); |
my (%others,%to); |
my @contacts = ('supportemail','adminemail'); |
my @contacts = ('supportemail','adminemail'); |
my @mailings = ('errormail','packagesmail','helpdeskmail'); |
my @mailings = ('errormail','packagesmail','helpdeskmail','lonstatusmail'); |
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 4056 sub modify_contacts {
|
Line 4078 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 4743 sub modify_coursecategories {
|
Line 4766 sub modify_coursecategories {
|
} else { |
} else { |
$changes{'togglecats'} = 1; |
$changes{'togglecats'} = 1; |
$changes{'categorize'} = 1; |
$changes{'categorize'} = 1; |
$domconfig{'coursecategories'}{'togglecats'} = $env{'form.togglecats'}; |
$domconfig{'coursecategories'} = { |
$domconfig{'coursecategories'}{'categorize'} = $env{'form.categorize'}; |
togglecats => $env{'form.togglecats'}, |
|
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 4959 sub modify_serverstatuses {
|
Line 4984 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) { |
if (ref($currserverstatus{$type}) eq 'HASH') { |
foreach my $setting ('namedusers','machines') { |
my @currnamed = split(/,/,$currserverstatus{$type}{'namedusers'}); |
my (@current,@new); |
my @newusers = split(/,/,$newserverstatus{$type}{'namedusers'}); |
if (ref($currserverstatus{$type}) eq 'HASH') { |
foreach my $item (@currnamed) { |
if ($currserverstatus{$type}{$setting} ne '') { |
if (!grep(/^\Q$item\E$/,@newusers)) { |
@current = split(/,/,$currserverstatus{$type}{$setting}); |
$changes{$type}{'namedusers'} = 1; |
|
last; |
|
} |
} |
} |
} |
foreach my $item (@newusers) { |
if ($newserverstatus{$type}{$setting} ne '') { |
if (!grep(/^\Q$item\E$/,@currnamed)) { |
@new = split(/,/,$newserverstatus{$type}{$setting}); |
$changes{$type}{'namedusers'} = 1; |
} |
last; |
if (@current > 0) { |
} |
if (@new > 0) { |
} |
foreach my $item (@current) { |
my @currmachines = split(/,/,$currserverstatus{$type}{'machines'}); |
if (!grep(/^\Q$item\E$/,@new)) { |
my @newmachines = split(/,/,$newserverstatus{$type}{'machines'}); |
$changes{$type}{$setting} = 1; |
foreach my $item (@currmachines) { |
last; |
if (!grep(/^\Q$item\E$/,@newmachines)) { |
} |
$changes{$type}{'machines'} = 1; |
} |
last; |
foreach my $item (@new) { |
} |
if (!grep(/^\Q$item\E$/,@current)) { |
} |
$changes{$type}{$setting} = 1; |
foreach my $item (@newmachines) { |
last; |
if (!grep(/^\Q$item\E$/,@currmachines)) { |
} |
$changes{$type}{'machines'} = 1; |
} |
last; |
} else { |
|
$changes{$type}{$setting} = 1; |
} |
} |
|
} elsif (@new > 0) { |
|
$changes{$type}{$setting} = 1; |
} |
} |
|
|
} |
} |
} |
} |
if (keys(%changes) > 0) { |
if (keys(%changes) > 0) { |
my $titles= &LONCAPA::loncgi::serverstatus_titles(); |
my $titles= &LONCAPA::lonauthcgi::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 (defined($changes{$type})) { |
if (ref($changes{$type}) eq 'HASH') { |
$resulttext .= '<li>'.$titles->{$type}.'<ul>'; |
$resulttext .= '<li>'.$titles->{$type}.'<ul>'; |
if (defined($changes{$type}{'namedusers'})) { |
if ($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 { |