version 1.71, 2008/12/03 13:09:56
|
version 1.76.2.2, 2008/12/17 22:13:22
|
Line 105 sub handler {
|
Line 105 sub handler {
|
col2 => 'Value'}], |
col2 => 'Value'}], |
}, |
}, |
'quotas' => |
'quotas' => |
{ text => 'Default quotas for user portfolios', |
{ text => 'User blogs, home pages and portfolios', |
help => 'Domain_Configuration_Quotas', |
help => 'Domain_Configuration_Quotas', |
header => [{col1 => 'User type', |
header => [{col1 => 'User type', |
col2 => 'Default quota'}], |
col2 => 'Available tools', |
|
col3 => 'Portfolio quota',}], |
}, |
}, |
'autoenroll' => |
'autoenroll' => |
{ text => 'Auto-enrollment settings', |
{ text => 'Auto-enrollment settings', |
Line 270 sub handler {
|
Line 271 sub handler {
|
$r->print('<input type="hidden" name="phase" value="" />'. |
$r->print('<input type="hidden" name="phase" value="" />'. |
'<input type="hidden" name="numcols" value="'. |
'<input type="hidden" name="numcols" value="'. |
$env{'form.numcols'}.'" />'."\n". |
$env{'form.numcols'}.'" />'."\n". |
'<span clas="LC_error">'.&mt('No settings chosen'). |
'<span class="LC_error">'.&mt('No settings chosen'). |
'</span>'); |
'</span>'); |
} |
} |
$r->print('</form>'); |
$r->print('</form>'); |
Line 519 sub print_config_box {
|
Line 520 sub print_config_box {
|
$output .= ' |
$output .= ' |
<td class="LC_left_item" valign="top">'.&mt($item->{'header'}->[0]->{'col1'}).'</td>'; |
<td class="LC_left_item" valign="top">'.&mt($item->{'header'}->[0]->{'col1'}).'</td>'; |
} |
} |
if ($action eq 'serverstatuses') { |
if (defined($item->{'header'}->[0]->{'col3'})) { |
$output .= '<td class="LC_left_item" valign="top">'. |
$output .= '<td class="LC_left_item" valign="top">'. |
&mt($item->{'header'}->[0]->{'col2'}). |
&mt($item->{'header'}->[0]->{'col2'}); |
'<br />(<tt>'.&mt('user1:domain1,user2:domain2 etc.').'</tt>)'; |
if ($action eq 'serverstatuses') { |
|
$output .= '<br />(<tt>'.&mt('user1:domain1,user2:domain2 etc.').'</tt>)'; |
|
} |
} else { |
} else { |
$output .= '<td class="LC_right_item" valign="top">'. |
$output .= '<td class="LC_right_item" valign="top">'. |
&mt($item->{'header'}->[0]->{'col2'}); |
&mt($item->{'header'}->[0]->{'col2'}); |
Line 814 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 => "Container", |
sidebg => "Side panel", |
link => "Link", |
link => "Link", |
alink => "Active link", |
alink => "Active link", |
vlink => "Visited link", |
vlink => "Visited link", |
Line 1238 sub print_quotas {
|
Line 1241 sub print_quotas {
|
my ($othertitle,$usertypes,$types) = &Apache::loncommon::sorted_inst_types($dom); |
my ($othertitle,$usertypes,$types) = &Apache::loncommon::sorted_inst_types($dom); |
my $typecount = 0; |
my $typecount = 0; |
my $css_class; |
my $css_class; |
|
my @usertools = ('aboutme','blog','portfolio'); |
|
my %titles = &tool_titles(); |
if (ref($types) eq 'ARRAY') { |
if (ref($types) eq 'ARRAY') { |
foreach my $type (@{$types}) { |
foreach my $type (@{$types}) { |
|
my $currdefquota; |
|
if (ref($settings) eq 'HASH') { |
|
if (ref($settings->{defaultquota}) eq 'HASH') { |
|
$currdefquota = $settings->{defaultquota}->{$type}; |
|
} else { |
|
$currdefquota = $settings->{$type}; |
|
} |
|
} |
if (defined($usertypes->{$type})) { |
if (defined($usertypes->{$type})) { |
$typecount ++; |
$typecount ++; |
$css_class = $typecount%2?' class="LC_odd_row"':''; |
$css_class = $typecount%2?' class="LC_odd_row"':''; |
$datatable .= '<tr'.$css_class.'>'. |
$datatable .= '<tr'.$css_class.'>'. |
'<td>'.$usertypes->{$type}.'</td>'. |
'<td>'.$usertypes->{$type}.'</td>'. |
'<td class="LC_right_item"><span class="LC_nobreak">'. |
'<td class="LC_left_item">'; |
|
foreach my $item (@usertools) { |
|
my $checked = 'checked="checked" '; |
|
if (ref($settings) eq 'HASH') { |
|
if (ref($settings->{$item}) eq 'HASH') { |
|
if ($settings->{$item}->{$type} == 0) { |
|
$checked = ''; |
|
} |
|
} |
|
} |
|
$datatable .= '<span class="LC_nobreak"><label>'. |
|
'<input type="checkbox" name="tools_'.$item. |
|
'" value="'.$type.'" '.$checked.'/>'.$titles{$item}. |
|
'</label></span> '; |
|
} |
|
$datatable .= '</td><td class="LC_right_item"><span class="LC_nobreak">'. |
'<input type="text" name="quota_'.$type. |
'<input type="text" name="quota_'.$type. |
'" value="'.$settings->{$type}. |
'" value="'.$currdefquota. |
'" size="5" /> Mb</span></td></tr>'; |
'" size="5" /> Mb</span></td></tr>'; |
} |
} |
} |
} |
} |
} |
my $defaultquota = '20'; |
my $defaultquota = '20'; |
if (ref($settings) eq 'HASH') { |
if (ref($settings) eq 'HASH') { |
if (defined($settings->{'default'})) { |
if (ref($settings->{'defaultquota'}) eq 'HASH') { |
|
$defaultquota = $settings->{'defaultquota'}->{'default'}; |
|
} elsif (defined($settings->{'default'})) { |
$defaultquota = $settings->{'default'}; |
$defaultquota = $settings->{'default'}; |
} |
} |
} |
} |
Line 1262 sub print_quotas {
|
Line 1292 sub print_quotas {
|
$css_class = $typecount%2?' class="LC_odd_row"':''; |
$css_class = $typecount%2?' class="LC_odd_row"':''; |
$datatable .= '<tr'.$css_class.'>'. |
$datatable .= '<tr'.$css_class.'>'. |
'<td>'.$othertitle.'</td>'. |
'<td>'.$othertitle.'</td>'. |
'<td class="LC_right_item"><span class="LC_nobreak">'. |
'<td class="LC_left_item">'; |
|
foreach my $item (@usertools) { |
|
my $checked = 'checked="checked" '; |
|
if (ref($settings) eq 'HASH') { |
|
if (ref($settings->{$item}) eq 'HASH') { |
|
if ($settings->{$item}->{'default'} == 0) { |
|
$checked = ''; |
|
} |
|
} |
|
} |
|
$datatable .= '<span class="LC_nobreak"><label>'. |
|
'<input type="checkbox" name="tools_'.$item. |
|
'" value="default" '.$checked.'/>'.$titles{$item}. |
|
'</label></span> '; |
|
} |
|
$datatable .= '</td><td class="LC_right_item"><span class="LC_nobreak">'. |
'<input type="text" name="defaultquota" value="'. |
'<input type="text" name="defaultquota" value="'. |
$defaultquota.'" size="5" /> Mb</span></td></tr>'; |
$defaultquota.'" size="5" /> Mb</span></td></tr>'; |
|
$typecount ++; |
|
$css_class = $typecount%2?' class="LC_odd_row"':''; |
|
$datatable .= '<tr'.$css_class.'>'. |
|
'<td><br/>'.&mt('LON-CAPA Advanced Users').'</td>'. |
|
'<td class="LC_left_item" colspan="2"><br />'; |
|
foreach my $item (@usertools) { |
|
my $checked = 'checked="checked" '; |
|
if (ref($settings) eq 'HASH') { |
|
if (ref($settings->{$item}) eq 'HASH') { |
|
if ($settings->{$item}->{'_LC_adv'} == 0) { |
|
$checked = ''; |
|
} |
|
} |
|
} |
|
$datatable .= '<span class="LC_nobreak"><label>'. |
|
'<input type="checkbox" name="tools_'.$item. |
|
'" value="_LC_adv" '.$checked.'/>'.$titles{$item}. |
|
'</label></span> '; |
|
} |
|
$datatable .= '('.&mt('overrides affiliation').')</td></tr>'; |
$$rowtotal += $typecount; |
$$rowtotal += $typecount; |
return $datatable; |
return $datatable; |
} |
} |
Line 1585 sub contact_titles {
|
Line 1650 sub contact_titles {
|
return (\%titles,\%short_titles); |
return (\%titles,\%short_titles); |
} |
} |
|
|
|
sub tool_titles { |
|
my %titles = &Apache::lonlocal::texthash ( |
|
aboutme => 'Personal Home Page', |
|
blog => 'Blog', |
|
portfolio => 'Portfolio', |
|
); |
|
return %titles; |
|
} |
|
|
sub print_usercreation { |
sub print_usercreation { |
my ($position,$dom,$settings,$rowtotal) = @_; |
my ($position,$dom,$settings,$rowtotal) = @_; |
my $numinrow = 4; |
my $numinrow = 4; |
Line 2808 sub color_font_choices {
|
Line 2882 sub color_font_choices {
|
links => "Link colors", |
links => "Link colors", |
images => "Images", |
images => "Images", |
font => "Font color", |
font => "Font color", |
pgbg => "Header", |
pgbg => "Page", |
tabbg => "Header", |
tabbg => "Header", |
sidebg => "Border", |
sidebg => "Border", |
link => "Link", |
link => "Link", |
Line 3430 END
|
Line 3504 END
|
|
|
sub modify_quotas { |
sub modify_quotas { |
my ($dom,%domconfig) = @_; |
my ($dom,%domconfig) = @_; |
|
my %domdefaults = &Apache::lonnet::get_domain_defaults($dom); |
my ($resulttext,%changes); |
my ($resulttext,%changes); |
my ($othertitle,$usertypes,$types) = &Apache::loncommon::sorted_inst_types($dom); |
my ($othertitle,$usertypes,$types) = &Apache::loncommon::sorted_inst_types($dom); |
my %formhash; |
my @usertools = ('aboutme','blog','portfolio'); |
|
my %titles = &tool_titles(); |
|
my (%confhash,%toolshash); |
foreach my $key (keys(%env)) { |
foreach my $key (keys(%env)) { |
if ($key =~ /^form\.quota_(.+)$/) { |
if ($key =~ /^form\.quota_(.+)$/) { |
$formhash{$1} = $env{$key}; |
$confhash{'defaultquota'}{$1} = $env{$key}; |
|
} elsif ($key =~ /^form\.tools_(.+)$/) { |
|
@{$toolshash{$1}} = &Apache::loncommon::get_env_multiple($key); |
} |
} |
} |
} |
$formhash{'default'} = $env{'form.defaultquota'}; |
$confhash{'defaultquota'}{'default'} = $env{'form.defaultquota'}; |
if (ref($domconfig{'quotas'}) eq 'HASH') { |
foreach my $item (@usertools) { |
foreach my $key (keys(%{$domconfig{'quotas'}})) { |
foreach my $type (@{$types},'default','_LC_adv') { |
if (exists($formhash{$key})) { |
if (grep(/^\Q$type\E$/,@{$toolshash{$item}})) { |
if ($formhash{$key} ne $domconfig{'quotas'}{$key}) { |
$confhash{$item}{$type} = 1; |
$changes{$key} = 1; |
} else { |
|
$confhash{$item}{$type} = 0; |
|
} |
|
if (ref($domconfig{'quotas'}) eq 'HASH') { |
|
if (ref($domconfig{'quotas'}{$item}) eq 'HASH') { |
|
if ($domconfig{'quotas'}{$item}{$type} ne $confhash{$item}{$type}) { |
|
$changes{$item}{$type} = 1; |
|
} |
|
} else { |
|
if (!$confhash{$item}{$type}) { |
|
$changes{$item}{$type} = 1; |
|
} |
} |
} |
} else { |
} else { |
$formhash{$key} = $domconfig{'quotas'}{$key}; |
if (!$confhash{$item}{$type}) { |
|
$changes{$item}{$type} = 1; |
|
} |
} |
} |
} |
} |
} |
} |
foreach my $key (keys(%formhash)) { |
if (ref($domconfig{'quotas'}) eq 'HASH') { |
if ($formhash{$key} ne '') { |
if (ref($domconfig{'quotas'}{'defaultquota'}) eq 'HASH') { |
|
foreach my $key (keys(%{$domconfig{'quotas'}{'defaultquota'}})) { |
|
if (exists($confhash{'defaultquota'}{$key})) { |
|
if ($confhash{'defaultquota'}{$key} ne $domconfig{'quotas'}{'defaultquota'}{$key}) { |
|
$changes{'defaultquota'}{$key} = 1; |
|
} |
|
} else { |
|
$confhash{'defaultquota'}{$key} = $domconfig{'quotas'}{'defaultquota'}{$key}; |
|
} |
|
} |
|
} else { |
|
foreach my $key (keys(%{$domconfig{'quotas'}})) { |
|
if (exists($confhash{'defaultquota'}{$key})) { |
|
if ($confhash{'defaultquota'}{$key} ne $domconfig{'quotas'}{$key}) { |
|
$changes{'defaultquota'}{$key} = 1; |
|
} |
|
} else { |
|
$confhash{'defaultquota'}{$key} = $domconfig{'quotas'}{$key}; |
|
} |
|
} |
|
} |
|
} |
|
if (ref($confhash{'defaultquota'}) eq 'HASH') { |
|
foreach my $key (keys(%{$confhash{'defaultquota'}})) { |
if (ref($domconfig{'quotas'}) eq 'HASH') { |
if (ref($domconfig{'quotas'}) eq 'HASH') { |
if (!exists($domconfig{'quotas'}{$key})) { |
if (ref($domconfig{'quotas'}{'defaultquota'}) eq 'HASH') { |
$changes{$key} = 1; |
if (!exists($domconfig{'quotas'}{'defaultquota'}{$key})) { |
|
$changes{'defaultquota'}{$key} = 1; |
|
} |
|
} else { |
|
if (!exists($domconfig{'quotas'}{$key})) { |
|
$changes{'defaultquota'}{$key} = 1; |
|
} |
} |
} |
} else { |
} else { |
$changes{$key} = 1; |
$changes{'defaultquota'}{$key} = 1; |
} |
} |
} |
} |
} |
} |
|
|
|
foreach my $key (keys(%confhash)) { |
|
$domdefaults{$key} = $confhash{$key}; |
|
} |
|
|
my %quotahash = ( |
my %quotahash = ( |
quotas => {%formhash}, |
quotas => { %confhash } |
); |
); |
my $putresult = &Apache::lonnet::put_dom('configuration',\%quotahash, |
my $putresult = &Apache::lonnet::put_dom('configuration',\%quotahash, |
$dom); |
$dom); |
if ($putresult eq 'ok') { |
if ($putresult eq 'ok') { |
if (keys(%changes) > 0) { |
if (keys(%changes) > 0) { |
|
my $cachetime = 24*60*60; |
|
&Apache::lonnet::do_cache_new('domdefaults',$dom,\%domdefaults,$cachetime); |
|
|
$resulttext = &mt('Changes made:').'<ul>'; |
$resulttext = &mt('Changes made:').'<ul>'; |
foreach my $type (@{$types},'default') { |
if (ref($changes{'defaultquota'}) eq 'HASH') { |
if (defined($changes{$type})) { |
$resulttext .= '<li>'.&mt('Portfolio default quotas').'<ul>'; |
my $typetitle = $usertypes->{$type}; |
foreach my $type (@{$types},'default') { |
if ($type eq 'default') { |
if (defined($changes{'defaultquota'}{$type})) { |
$typetitle = $othertitle; |
my $typetitle = $usertypes->{$type}; |
|
if ($type eq 'default') { |
|
$typetitle = $othertitle; |
|
} |
|
$resulttext .= '<li>'.&mt('[_1] set to [_2] Mb',$typetitle,$confhash{'defaultquota'}{$type}).'</li>'; |
|
} |
|
} |
|
$resulttext .= '</ul></li>'; |
|
} |
|
foreach my $item (@usertools) { |
|
if (ref($changes{$item}) eq 'HASH') { |
|
my $hashid = $env{'user.name'}.':'.$env{'user.domain'}; |
|
&Apache::lonnet::devalidate_cache_new('usertools.'.$item,$hashid); |
|
$resulttext .= '<li>'.$titles{$item}.'<ul>'; |
|
foreach my $type (@{$types},'default','_LC_adv') { |
|
if ($changes{$item}{$type}) { |
|
my $typetitle = $usertypes->{$type}; |
|
if ($type eq 'default') { |
|
$typetitle = $othertitle; |
|
} elsif ($type eq '_LC_adv') { |
|
$typetitle = 'LON-CAPA Advanced Users'; |
|
} |
|
if ($confhash{$item}{$type}) { |
|
$resulttext .= '<li>'.&mt('Set to be available to [_1]',$typetitle).'</li>'; |
|
} else { |
|
$resulttext .= '<li>'.&mt('Set to be unavailable to [_1]',$typetitle).'</li>'; |
|
} |
|
} |
} |
} |
$resulttext .= '<li>'.&mt('[_1] set to [_2] Mb',$typetitle,$formhash{$type}).'</li>'; |
$resulttext .= '</ul></li>'; |
} |
} |
} |
} |
$resulttext .= '</ul>'; |
$resulttext .= '</ul>'; |
} else { |
} else { |
$resulttext = &mt('No changes made to default quotas'); |
$resulttext = &mt('No changes made to availability of home pages, blogs, portfolios or default quotas'); |
} |
} |
} else { |
} else { |
$resulttext = '<span class="LC_error">'. |
$resulttext = '<span class="LC_error">'. |
Line 4443 sub modify_defaults {
|
Line 4599 sub modify_defaults {
|
} elsif ($domdefaults{$item} ne $newvalues{$item}) { |
} elsif ($domdefaults{$item} ne $newvalues{$item}) { |
$changes{$item} = 1; |
$changes{$item} = 1; |
} |
} |
|
$domdefaults{$item} = $newvalues{$item}; |
} |
} |
my %defaults_hash = ( |
my %defaults_hash = ( |
defaults => { auth_def => $newvalues{'auth_def'}, |
defaults => \%newvalues, |
auth_arg_def => $newvalues{'auth_arg_def'}, |
); |
lang_def => $newvalues{'lang_def'}, |
|
timezone_def => $newvalues{'timezone_def'}, |
|
datelocale_def => $newvalues{'datelocale_def'}, |
|
} |
|
); |
|
my $title = &defaults_titles(); |
my $title = &defaults_titles(); |
my $putresult = &Apache::lonnet::put_dom('configuration',\%defaults_hash, |
my $putresult = &Apache::lonnet::put_dom('configuration',\%defaults_hash, |
$dom); |
$dom); |
Line 4480 sub modify_defaults {
|
Line 4632 sub modify_defaults {
|
$resulttext .= '</ul>'; |
$resulttext .= '</ul>'; |
$mailmsgtext .= "\n"; |
$mailmsgtext .= "\n"; |
my $cachetime = 24*60*60; |
my $cachetime = 24*60*60; |
&Apache::lonnet::do_cache_new('domdefaults',$dom, |
&Apache::lonnet::do_cache_new('domdefaults',$dom,\%domdefaults,$cachetime); |
$defaults_hash{'defaults'},$cachetime); |
|
if ($changes{'auth_def'} || $changes{'auth_arg_def'} || $changes{'lang_def'} || $changes{'datelocale_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); |