[LON-CAPA-cvs] cvs: loncom(version_2_11_X) /interface domainprefs.pm

raeburn raeburn at source.lon-capa.org
Fri Sep 16 19:53:02 EDT 2016


raeburn		Fri Sep 16 23:53:02 2016 EDT

  Modified files:              (Branch: version_2_11_X)
    /loncom/interface	domainprefs.pm 
  Log:
  - For 2.11
    - Backport 1.276, 1.280.
  
  
-------------- next part --------------
Index: loncom/interface/domainprefs.pm
diff -u loncom/interface/domainprefs.pm:1.160.6.69 loncom/interface/domainprefs.pm:1.160.6.70
--- loncom/interface/domainprefs.pm:1.160.6.69	Fri Aug 12 19:49:56 2016
+++ loncom/interface/domainprefs.pm	Fri Sep 16 23:53:01 2016
@@ -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 @@
         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 @@
         $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 @@
                     $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 @@
         $additional .= '</tr></table></div>'."\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 .= '<tr'.$css_class.'><td><span class="LC_nobreak">'.
+                      $choices{'mysqltables'}.
+                      '</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="mysqltables_'.$type.'"'.
+                           ' value="'.$currmysql{$type}.'" size="5" /></td>';
+        }
+        $datatable .= '</tr></table></td></tr>'."\n";
+        $itemcount ++;
+
     }
     $$rowtotal += $itemcount;
     return $datatable;
@@ -10400,12 +10425,14 @@
                          );
     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 @@
                 }
                 $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 @@
                     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 @@
             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 @@
                     } else {
                         $resulttext .= '<li>'.&mt('Default quota for content uploaded via Course Editor remains default: [_1] MB',$staticdefaults{'uploadquota'}).'</li>';
                     }
+                } elsif ($item eq 'mysqltables') {
+                    if (ref($defaultshash{'coursedefaults'}{'mysqltables'}) eq 'HASH') {
+                        $resulttext .= '<li>'.&mt('Lifetime of "Temporary" MySQL tables (student performance data) on homeserver').'<ul>'.
+                                       '<li>'.&mt('Official courses: [_1] s','<b>'.$defaultshash{'coursedefaults'}{'mysqltables'}{'official'}.'</b>').'</li>'.
+                                       '<li>'.&mt('Unofficial courses: [_1] s','<b>'.$defaultshash{'coursedefaults'}{'mysqltables'}{'unofficial'}.'</b>').'</li>'.
+                                       '<li>'.&mt('Textbook courses: [_1] s','<b>'.$defaultshash{'coursedefaults'}{'mysqltables'}{'textbook'}.'</b>').'</li>'.
+                                       '<li>'.&mt('Communities: [_1] s','<b>'.$defaultshash{'coursedefaults'}{'mysqltables'}{'community'}.'</b>').'</li>'.
+                                       '</ul>'.
+                                       '</li>';
+                    } else {
+                        $resulttext .= '<li>'.&mt('Lifetime of "Temporary" MySQL tables (student performance data) on homeserver remains default: [_1] s',$staticdefaults{'uploadquota'}).'</li>';
+                    }
                 } elsif ($item eq 'postsubmit') {
                     if ($domdefaults{'postsubmit'} eq 'off') {
                         $resulttext .= '<li>'.&mt('Submit button(s) remain enabled on page after student makes submission.');


More information about the LON-CAPA-cvs mailing list