[LON-CAPA-cvs] cvs: loncom(version_2_11_X) /interface domainprefs.pm
raeburn
raeburn at source.lon-capa.org
Sat Aug 3 20:39:10 EDT 2013
raeburn Sun Aug 4 00:39:10 2013 EDT
Modified files: (Branch: version_2_11_X)
/loncom/interface domainprefs.pm
Log:
- For 2.11
- Backport 1.198, 1.199
-------------- next part --------------
Index: loncom/interface/domainprefs.pm
diff -u loncom/interface/domainprefs.pm:1.160.6.20 loncom/interface/domainprefs.pm:1.160.6.21
--- loncom/interface/domainprefs.pm:1.160.6.20 Fri Jul 5 19:18:34 2013
+++ loncom/interface/domainprefs.pm Sun Aug 4 00:39:09 2013
@@ -1,7 +1,7 @@
# The LearningOnline Network with CAPA
# Handler to set domain-wide configuration settings
#
-# $Id: domainprefs.pm,v 1.160.6.20 2013/07/05 19:18:34 raeburn Exp $
+# $Id: domainprefs.pm,v 1.160.6.21 2013/08/04 00:39:09 raeburn Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -2426,9 +2426,14 @@
my $itemcount = 1;
my %choices = &Apache::lonlocal::texthash (
canuse_pdfforms => 'Course/Community users can create/upload PDF forms',
+ uploadquota => 'Default quota for files uploaded directly to course/community using Course Editor (MB)',
anonsurvey_threshold => 'Responder count needed before showing submissions for anonymous surveys',
coursecredits => 'Credits can be specified for courses',
);
+ my %staticdefaults = (
+ anonsurvey_threshold => 10,
+ uploadquota => 500,
+ );
if ($position eq 'top') {
%defaultchecked = ('canuse_pdfforms' => 'off');
@toggles = ('canuse_pdfforms');
@@ -2436,10 +2441,16 @@
\%choices,$itemcount);
} else {
$css_class = $itemcount%2 ? ' class="LC_odd_row"' : '';
- my ($currdefresponder,$def_official_credits,$def_unofficial_credits);
+ my ($currdefresponder,$def_official_credits,$def_unofficial_credits,%curruploadquota);
my $currusecredits = 0;
+ my @types = ('official','unofficial','community');
if (ref($settings) eq 'HASH') {
$currdefresponder = $settings->{'anonsurvey_threshold'};
+ if (ref($settings->{'uploadquota'}) eq 'HASH') {
+ foreach my $type (keys(%{$settings->{'uploadquota'}})) {
+ $curruploadquota{$type} = $settings->{'uploadquota'}{$type};
+ }
+ }
if (ref($settings->{'coursecredits'}) eq 'HASH') {
$def_official_credits = $settings->{'coursecredits'}->{'official'};
$def_unofficial_credits = $settings->{'coursecredits'}->{'unofficial'};
@@ -2449,10 +2460,15 @@
}
}
if (!$currdefresponder) {
- $currdefresponder = 10;
+ $currdefresponder = $staticdefaults{'anonsurvey_threshold'};
} elsif ($currdefresponder < 1) {
$currdefresponder = 1;
}
+ foreach my $type (@types) {
+ if ($curruploadquota{$type} eq '') {
+ $curruploadquota{$type} = $staticdefaults{'uploadquota'};
+ }
+ }
$datatable .=
'<tr'.$css_class.'><td><span class="LC_nobreak">'.
$choices{'anonsurvey_threshold'}.
@@ -2460,8 +2476,19 @@
'<td class="LC_right_item"><span class="LC_nobreak">'.
'<input type="text" name="anonsurvey_threshold"'.
' value="'.$currdefresponder.'" size="5" /></span>'.
- '</td></tr>'."\n";
- $itemcount ++;
+ '</td></tr>'."\n".
+ '<tr><td><span class="LC_nobreak">'.
+ $choices{'uploadquota'}.
+ '</span></td>'.
+ '<td align="right" class="LC_right_item">'.
+ '<table><tr>';
+ foreach my $type (@types) {
+ $datatable .= '<td align="center">'.&mt($type).'<br />'.
+ '<input type="text" name="uploadquota_'.$type.'"'.
+ ' value="'.$curruploadquota{$type}.'" size="5" /></td>';
+ }
+ $datatable .= '</tr></table></td></tr>'."\n";
+ $itemcount += 2;
my $onclick = 'toggleCredits(this.form);';
my $display = 'none';
if ($currusecredits) {
@@ -3874,8 +3901,8 @@
$datatable .= '<td>'.&mt('Default in use:').'<br />'.
'<span class="LC_nobreak">';
if ($scantronurl) {
- $datatable .= '<a href="'.$scantronurl.'" target="_blank">'.
- &mt('Default bubblesheet format file').'</a>';
+ $datatable .= &Apache::loncommon::modal_link($scantronurl,&mt('Default bubblesheet format file'),600,500,
+ undef,undef,undef,undef,'background-color:#ffffff');
} else {
$datatable = &mt('File unavailable for display');
}
@@ -3900,11 +3927,12 @@
}
$datatable .= '<td>'.$errorstr.'</td><td> ';
} elsif ($scantronurl) {
+ my $link = &Apache::loncommon::modal_link($scantronurl,&mt('Custom bubblesheet format file'),600,500,
+ undef,undef,undef,undef,'background-color:#ffffff');
$datatable .= '<td><span class="LC_nobreak">'.
- '<a href="'.$scantronurl.'" target="_blank">'.
- &mt('Custom bubblesheet format file').'</a><label>'.
- '<input type="checkbox" name="scantronformat_del"'.
- '" value="1" />'.&mt('Delete?').'</label></span></td>'.
+ $link.
+ '<label><input type="checkbox" name="scantronformat_del"'.
+ ' value="1" />'.&mt('Delete?').'</label></span></td>'.
'<td><span class="LC_nobreak"> '.
&mt('Replace:').'</span><br />';
}
@@ -7889,6 +7917,13 @@
my ($resulttext,$errors,%changes,%defaultshash);
my %defaultchecked = ('canuse_pdfforms' => 'off');
my @toggles = ('canuse_pdfforms');
+ my @numbers = ('anonsurvey_threshold','uploadquota_official','uploadquota_unofficial',
+ 'uploadquota_community');
+ my @types = ('official','unofficial','community');
+ my %staticdefaults = (
+ anonsurvey_threshold => 10,
+ uploadquota => 500,
+ );
$defaultshash{'coursedefaults'} = {};
@@ -7917,16 +7952,35 @@
}
$defaultshash{'coursedefaults'}{$item} = $env{'form.'.$item};
}
- my $currdefresponder = $domconfig{'coursedefaults'}{'anonsurvey_threshold'};
- my $newdefresponder = $env{'form.anonsurvey_threshold'};
- $newdefresponder =~ s/\D//g;
- if ($newdefresponder eq '' || $newdefresponder < 1) {
- $newdefresponder = 1;
- }
- $defaultshash{'coursedefaults'}{'anonsurvey_threshold'} = $newdefresponder;
- if ($currdefresponder ne $newdefresponder) {
- unless ($currdefresponder eq '' && $newdefresponder == 10) {
- $changes{'anonsurvey_threshold'} = 1;
+ foreach my $item (@numbers) {
+ my ($currdef,$newdef);
+ my $newdef = $env{'form.'.$item};
+ if ($item eq 'anonsurvey_threshold') {
+ $currdef = $domconfig{'coursedefaults'}{$item};
+ $newdef =~ s/\D//g;
+ if ($newdef eq '' || $newdef < 1) {
+ $newdef = 1;
+ }
+ $defaultshash{'coursedefaults'}{$item} = $newdef;
+ } else {
+ my ($type) = ($item =~ /^\Quploadquota_\E(\w+)$/);
+ if (ref($domconfig{'coursedefaults'}{'uploadquota'}) eq 'HASH') {
+ $currdef = $domconfig{'coursedefaults'}{'uploadquota'}{$type};
+ }
+ $newdef =~ s/[^\w.\-]//g;
+ $defaultshash{'coursedefaults'}{'uploadquota'}{$type} = $newdef;
+ }
+ if ($currdef ne $newdef) {
+ my $staticdef;
+ if ($item eq 'anonsurvey_threshold') {
+ unless (($currdef eq '') && ($newdef == $staticdefaults{$item})) {
+ $changes{$item} = 1;
+ }
+ } else {
+ unless (($currdef eq '') && ($newdef == $staticdefaults{'uploadquota'})) {
+ $changes{'uploadquota'} = 1;
+ }
+ }
}
}
my $officialcreds = $env{'form.official_credits'};
@@ -7952,7 +8006,7 @@
if ($putresult eq 'ok') {
my %domdefaults;
if (keys(%changes) > 0) {
- if (($changes{'canuse_pdfforms'}) || ($changes{'coursecredits'})) {
+ if (($changes{'canuse_pdfforms'}) || ($changes{'coursecredits'}) || ($changes{'uploadquota'})) {
%domdefaults = &Apache::lonnet::get_domain_defaults($dom);
if ($changes{'canuse_pdfforms'}) {
$domdefaults{'canuse_pdfforms'}=$defaultshash{'coursedefaults'}{'canuse_pdfforms'};
@@ -7965,6 +8019,13 @@
$defaultshash{'coursedefaults'}{'coursecredits'}{'unofficial'};
}
}
+ if ($changes{'uploadquota'}) {
+ if (ref($defaultshash{'coursedefaults'}{'uploadquota'}) eq 'HASH') {
+ foreach my $type (@types) {
+ $domdefaults{$type.'quota'}=$defaultshash{'coursedefaults'}{'uploadquota'}{$type};
+ }
+ }
+ }
my $cachetime = 24*60*60;
&Apache::lonnet::do_cache_new('domdefaults',$dom,\%domdefaults,$cachetime);
}
@@ -7978,6 +8039,17 @@
}
} elsif ($item eq 'anonsurvey_threshold') {
$resulttext .= '<li>'.&mt('Responder count required for display of anonymous survey submissions set to [_1].',$defaultshash{'coursedefaults'}{'anonsurvey_threshold'}).'</li>';
+ } elsif ($item eq 'uploadquota') {
+ if (ref($defaultshash{'coursedefaults'}{'uploadquota'}) eq 'HASH') {
+ $resulttext .= '<li>'.&mt('Default quota for content uploaded to a course/community via Course Editor set as follows:').'<ul>'.
+ '<li>'.&mt('Official courses: [_1] MB','<b>'.$defaultshash{'coursedefaults'}{'uploadquota'}{'official'}.'</b>').'</li>'.
+ '<li>'.&mt('Unofficial courses: [_1] MB','<b>'.$defaultshash{'coursedefaults'}{'uploadquota'}{'unofficial'}.'</b>').'</li>'.
+ '<li>'.&mt('Communities: [_1] MB','<b>'.$defaultshash{'coursedefaults'}{'uploadquota'}{'community'}.'</b>').'</li>'.
+ '</ul>'.
+ '</li>';
+ } else {
+ $resulttext .= '<li>'.&mt('Default quota for content uploaded via Course Editor remains default: [_1] MB',$staticdefaults{'uploadquota'}).'</li>';
+ }
} elsif ($item eq 'coursecredits') {
if (ref($defaultshash{'coursedefaults'}{'coursecredits'}) eq 'HASH') {
if (($domdefaults{'officialcredits'} eq '') &&
More information about the LON-CAPA-cvs
mailing list