--- loncom/interface/domainprefs.pm 2013/06/04 23:12:08 1.196
+++ loncom/interface/domainprefs.pm 2013/07/02 19:04:36 1.197
@@ -1,7 +1,7 @@
# The LearningOnline Network with CAPA
# Handler to set domain-wide configuration settings
#
-# $Id: domainprefs.pm,v 1.196 2013/06/04 23:12:08 raeburn Exp $
+# $Id: domainprefs.pm,v 1.197 2013/07/02 19:04:36 raeburn Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -94,7 +94,8 @@ about default quota sizes for portfolio
institutional affiliation in the domain (e.g., Faculty, Staff, Student etc.),
but is now also used to manage availability of user tools:
i.e., blogs, aboutme page, and portfolios, and the course request tool,
-used by course owners to request creation of a course.
+used by course owners to request creation of a course, and to display/store
+default quota sizes for authoring spaces.
Outputs: 1
@@ -254,11 +255,11 @@ sub handler {
col2 => 'Value'}],
},
'quotas' =>
- { text => 'Blogs, personal web pages, webDAV, portfolios',
+ { text => 'Blogs, personal web pages, webDAV/quotas, portfolios',
help => 'Domain_Configuration_Quotas',
header => [{col1 => 'User affiliation',
col2 => 'Available tools',
- col3 => 'Portfolio quota',}],
+ col3 => 'Quotas, Mb; (Authoring requires role)',}],
},
'autoenroll' =>
{ text => 'Auto-enrollment settings',
@@ -1524,7 +1525,7 @@ sub print_quotas {
} else {
$context = $action;
}
- my ($datatable,$defaultquota,@usertools,@options,%validations);
+ my ($datatable,$defaultquota,$authorquota,@usertools,@options,%validations);
my ($othertitle,$usertypes,$types) = &Apache::loncommon::sorted_inst_types($dom);
my $typecount = 0;
my ($css_class,%titles);
@@ -1543,15 +1544,18 @@ sub print_quotas {
}
if (ref($types) eq 'ARRAY') {
foreach my $type (@{$types}) {
- my $currdefquota;
+ my ($currdefquota,$currauthorquota);
unless (($context eq 'requestcourses') ||
($context eq 'requestauthor')) {
if (ref($settings) eq 'HASH') {
if (ref($settings->{defaultquota}) eq 'HASH') {
- $currdefquota = $settings->{defaultquota}->{$type};
+ $currdefquota = $settings->{defaultquota}->{$type};
} else {
$currdefquota = $settings->{$type};
}
+ if (ref($settings->{authorquota}) eq 'HASH') {
+ $currauthorquota = $settings->{authorquota}->{$type};
+ }
}
}
if (defined($usertypes->{$type})) {
@@ -1665,10 +1669,15 @@ sub print_quotas {
unless (($context eq 'requestcourses') ||
($context eq 'requestauthor')) {
$datatable .=
- '
'.
+ ' | '.
+ ''.&mt('Portfolio').': '.
' Mb | ';
+ '" size="5" />'.(' ' x 2).
+ ''.&mt('Authoring').': '.
+ '';
}
$datatable .= '';
}
@@ -1676,12 +1685,16 @@ sub print_quotas {
}
unless (($context eq 'requestcourses') || ($context eq 'requestauthor')) {
$defaultquota = '20';
+ $authorquota = '500';
if (ref($settings) eq 'HASH') {
if (ref($settings->{'defaultquota'}) eq 'HASH') {
$defaultquota = $settings->{'defaultquota'}->{'default'};
} elsif (defined($settings->{'default'})) {
$defaultquota = $settings->{'default'};
}
+ if (ref($settings->{'authorquota'}) eq 'HASH') {
+ $authorquota = $settings->{'authorquota'}->{'default'};
+ }
}
}
$typecount ++;
@@ -1792,15 +1805,19 @@ sub print_quotas {
}
$datatable .= '';
unless (($context eq 'requestcourses') || ($context eq 'requestauthor')) {
- $datatable .= ''.
+ $datatable .= ' | '.
+ ''.&mt('Portfolio').': '.
' Mb | ';
+ $defaultquota.'" size="5" />'.(' ' x2).
+ ''.&mt('Authoring').': '.
+ '';
}
$datatable .= '';
$typecount ++;
$css_class = $typecount%2?' class="LC_odd_row"':'';
$datatable .= ''.
- ''.&mt('LON-CAPA Advanced Users').' ';
+ ' | '.&mt('LON-CAPA Advanced Users').' ';
if ($context eq 'requestcourses') {
$datatable .= &mt('(overrides affiliation, if set)').
' | '.
@@ -5740,8 +5757,9 @@ sub modify_quotas {
} else {
if ($key =~ /^form\.quota_(.+)$/) {
$confhash{'defaultquota'}{$1} = $env{$key};
- }
- if ($key =~ /^form\.\Q$context\E_(.+)$/) {
+ } elsif ($key =~ /^form\.authorquota_(.+)$/) {
+ $confhash{'authorquota'}{$1} = $env{$key};
+ } elsif ($key =~ /^form\.\Q$context\E_(.+)$/) {
@{$toolshash{$1}} = &Apache::loncommon::get_env_multiple($key);
}
}
@@ -5767,6 +5785,7 @@ sub modify_quotas {
}
} else {
$confhash{'defaultquota'}{'default'} = $env{'form.defaultquota'};
+ $confhash{'authorquota'}{'default'} = $env{'form.authorquota'};
}
foreach my $item (@usertools) {
foreach my $type (@{$types},'default','_LC_adv') {
@@ -5854,6 +5873,17 @@ sub modify_quotas {
}
}
}
+ if (ref($domconfig{'quotas'}{'authorquota'}) eq 'HASH') {
+ foreach my $key (keys(%{$domconfig{'quotas'}{'authorquota'}})) {
+ if (exists($confhash{'authorquota'}{$key})) {
+ if ($confhash{'authorquota'}{$key} ne $domconfig{'quotas'}{'authorquota'}{$key}) {
+ $changes{'authorquota'}{$key} = 1;
+ }
+ } else {
+ $confhash{'authorquota'}{$key} = $domconfig{'quotas'}{'authorquota'}{$key};
+ }
+ }
+ }
}
if (ref($confhash{'defaultquota'}) eq 'HASH') {
foreach my $key (keys(%{$confhash{'defaultquota'}})) {
@@ -5872,6 +5902,21 @@ sub modify_quotas {
}
}
}
+ if (ref($confhash{'authorquota'}) eq 'HASH') {
+ foreach my $key (keys(%{$confhash{'authorquota'}})) {
+ if (ref($domconfig{'quotas'}) eq 'HASH') {
+ if (ref($domconfig{'quotas'}{'authorquota'}) eq 'HASH') {
+ if (!exists($domconfig{'quotas'}{'authorquota'}{$key})) {
+ $changes{'authorquota'}{$key} = 1;
+ }
+ } else {
+ $changes{'authorquota'}{$key} = 1;
+ }
+ } else {
+ $changes{'authorquota'}{$key} = 1;
+ }
+ }
+ }
}
if ($context eq 'requestauthor') {
@@ -5907,6 +5952,19 @@ sub modify_quotas {
}
}
$resulttext .= '';
+ }
+ if (ref($changes{'authorquota'}) eq 'HASH') {
+ $resulttext .= ''.&mt('Authoring space default quotas').'';
+ foreach my $type (@{$types},'default') {
+ if (defined($changes{'authorquota'}{$type})) {
+ my $typetitle = $usertypes->{$type};
+ if ($type eq 'default') {
+ $typetitle = $othertitle;
+ }
+ $resulttext .= '- '.&mt('[_1] set to [_2] Mb',$typetitle,$confhash{'authorquota'}{$type}).'
';
+ }
+ }
+ $resulttext .= '
';
}
}
my %newenv;