--- loncom/interface/domainprefs.pm 2016/08/12 19:49:56 1.160.6.69
+++ loncom/interface/domainprefs.pm 2016/09/16 23:53:01 1.160.6.70
@@ -1,7 +1,7 @@
# The LearningOnline Network with CAPA
# Handler to set domain-wide configuration settings
#
-# $Id: domainprefs.pm,v 1.160.6.69 2016/08/12 19:49:56 raeburn Exp $
+# $Id: domainprefs.pm,v 1.160.6.70 2016/09/16 23:53:01 raeburn Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -2899,11 +2899,13 @@ sub print_coursedefaults {
usejsme => 'Molecule editor uses JSME (HTML5) in place of JME (Java)',
postsubmit => 'Disable submit button/keypress following student submission',
canclone => "People who may clone a course (besides course's owner and coordinators)",
+ mysqltables => 'Lifetime (s) of "Temporary" MySQL tables (student performance data) on homeserver',
);
my %staticdefaults = (
anonsurvey_threshold => 10,
uploadquota => 500,
postsubmit => 60,
+ mysqltables => 172800,
);
if ($position eq 'top') {
%defaultchecked = (
@@ -2987,7 +2989,7 @@ sub print_coursedefaults {
$itemcount ++;
} else {
$css_class = $itemcount%2 ? ' class="LC_odd_row"' : '';
- my ($currdefresponder,%defcredits,%curruploadquota,%deftimeout);
+ my ($currdefresponder,%defcredits,%curruploadquota,%deftimeout,%currmysql));
my $currusecredits = 0;
my $postsubmitclient = 1;
my @types = ('official','unofficial','community','textbook');
@@ -3031,6 +3033,15 @@ sub print_coursedefaults {
$deftimeout{$type} = $staticdefaults{'postsubmit'};
}
}
+ if (ref($settings->{'mysqltables'}) eq 'HASH') {
+ foreach my $type (keys(%{$settings->{'mysqltables'}})) {
+ $currmysql{$type} = $settings->{'mysqltables'}{$type};
+ }
+ } else {
+ foreach my $type (@types) {
+ $currmysql{$type} = $staticdefaults{'mysqltables'};
+ }
+ }
} else {
foreach my $type (@types) {
$deftimeout{$type} = $staticdefaults{'postsubmit'};
@@ -3108,13 +3119,27 @@ sub print_coursedefaults {
$additional .= ''."\n";
%defaultchecked = ('postsubmit' => 'on');
@toggles = ('postsubmit');
- my $current = {
- 'postsubmit' => $postsubmitclient,
- };
+ $current = {
+ 'postsubmit' => $postsubmitclient,
+ };
($table,$itemcount) =
&radiobutton_prefs($current,\@toggles,\%defaultchecked,
\%choices,$itemcount,$onclick,$additional,'left');
$datatable .= $table;
+ $css_class = $itemcount%2 ? ' class="LC_odd_row"' : '';
+ $datatable .= '
'.
+ $choices{'mysqltables'}.
+ ' | '.
+ ''.
+ ' |
'."\n";
+ $itemcount ++;
+
}
$$rowtotal += $itemcount;
return $datatable;
@@ -10400,12 +10425,14 @@ sub modify_coursedefaults {
);
my @toggles = ('uselcmath','usejsme');
my @numbers = ('anonsurvey_threshold','uploadquota_official','uploadquota_unofficial',
- 'uploadquota_community','uploadquota_textbook');
+ 'uploadquota_community','uploadquota_textbook','mysqltables_official',
+ 'mysqltables_unofficial','mysqltables_community','mysqltables_textbook');
my @types = ('official','unofficial','community','textbook');
my %staticdefaults = (
anonsurvey_threshold => 10,
uploadquota => 500,
postsubmit => 60,
+ mysqltables => 172800,
);
$defaultshash{'coursedefaults'} = {};
@@ -10446,12 +10473,12 @@ sub modify_coursedefaults {
}
$defaultshash{'coursedefaults'}{$item} = $newdef;
} else {
- my ($type) = ($item =~ /^\Quploadquota_\E(\w+)$/);
- if (ref($domconfig{'coursedefaults'}{'uploadquota'}) eq 'HASH') {
- $currdef = $domconfig{'coursedefaults'}{'uploadquota'}{$type};
+ my ($setting,$type) = ($item =~ /^(uploadquota|mysqltables)_(\w+)$/);
+ if (ref($domconfig{'coursedefaults'}{$setting}) eq 'HASH') {
+ $currdef = $domconfig{'coursedefaults'}{$setting}{$type};
}
$newdef =~ s/[^\w.\-]//g;
- $defaultshash{'coursedefaults'}{'uploadquota'}{$type} = $newdef;
+ $defaultshash{'coursedefaults'}{$setting}{$type} = $newdef;
}
if ($currdef ne $newdef) {
my $staticdef;
@@ -10459,9 +10486,10 @@ sub modify_coursedefaults {
unless (($currdef eq '') && ($newdef == $staticdefaults{$item})) {
$changes{$item} = 1;
}
- } else {
- unless (($currdef eq '') && ($newdef == $staticdefaults{'uploadquota'})) {
- $changes{'uploadquota'} = 1;
+ } elsif ($item =~ /^(uploadquota|mysqltables)_/) {
+ my $setting = $1;
+ unless (($currdef eq '') && ($newdef == $staticdefaults{$setting})) {
+ $changes{$setting} = 1;
}
}
}
@@ -10586,7 +10614,7 @@ sub modify_coursedefaults {
my %domdefaults = &Apache::lonnet::get_domain_defaults($dom,1);
if (($changes{'uploadquota'}) || ($changes{'postsubmit'}) ||
($changes{'coursecredits'}) || ($changes{'uselcmath'}) || ($changes{'usejsme'}) ||
- ($changes{'canclone'})) {
+ ($changes{'canclone'}) || ($changes{'mysqltables'})) {
foreach my $item ('uselcmath','usejsme') {
if ($changes{$item}) {
$domdefaults{$item}=$defaultshash{'coursedefaults'}{$item};
@@ -10665,6 +10693,18 @@ sub modify_coursedefaults {
} else {
$resulttext .= ''.&mt('Default quota for content uploaded via Course Editor remains default: [_1] MB',$staticdefaults{'uploadquota'}).'';
}
+ } elsif ($item eq 'mysqltables') {
+ if (ref($defaultshash{'coursedefaults'}{'mysqltables'}) eq 'HASH') {
+ $resulttext .= ''.&mt('Lifetime of "Temporary" MySQL tables (student performance data) on homeserver').''.
+ '- '.&mt('Official courses: [_1] s',''.$defaultshash{'coursedefaults'}{'mysqltables'}{'official'}.'').'
'.
+ '- '.&mt('Unofficial courses: [_1] s',''.$defaultshash{'coursedefaults'}{'mysqltables'}{'unofficial'}.'').'
'.
+ '- '.&mt('Textbook courses: [_1] s',''.$defaultshash{'coursedefaults'}{'mysqltables'}{'textbook'}.'').'
'.
+ '- '.&mt('Communities: [_1] s',''.$defaultshash{'coursedefaults'}{'mysqltables'}{'community'}.'').'
'.
+ '
'.
+ '';
+ } else {
+ $resulttext .= ''.&mt('Lifetime of "Temporary" MySQL tables (student performance data) on homeserver remains default: [_1] s',$staticdefaults{'uploadquota'}).'';
+ }
} elsif ($item eq 'postsubmit') {
if ($domdefaults{'postsubmit'} eq 'off') {
$resulttext .= ''.&mt('Submit button(s) remain enabled on page after student makes submission.');