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

raeburn raeburn at source.lon-capa.org
Fri Jul 5 15:18:34 EDT 2013


raeburn		Fri Jul  5 19:18:34 2013 EDT

  Modified files:              (Branch: version_2_11_X)
    /loncom/interface	domainprefs.pm 
  Log:
  - For 2.11
    - Backport 1.197.
  
  
-------------- next part --------------
Index: loncom/interface/domainprefs.pm
diff -u loncom/interface/domainprefs.pm:1.160.6.19 loncom/interface/domainprefs.pm:1.160.6.20
--- loncom/interface/domainprefs.pm:1.160.6.19	Wed Jun  5 13:31:19 2013
+++ loncom/interface/domainprefs.pm	Fri Jul  5 19:18:34 2013
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # Handler to set domain-wide configuration settings
 #
-# $Id: domainprefs.pm,v 1.160.6.19 2013/06/05 13:31:19 raeburn Exp $
+# $Id: domainprefs.pm,v 1.160.6.20 2013/07/05 19:18:34 raeburn Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -94,7 +94,9 @@
 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
 
@@ -252,11 +254,11 @@
                                   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',
@@ -1504,7 +1506,7 @@
     } else {
         $context = $action;
     }
-    my ($datatable,$defaultquota, at usertools, at options,%validations);
+    my ($datatable,$defaultquota,$authorquota, at usertools, at options,%validations);
     my ($othertitle,$usertypes,$types) = &Apache::loncommon::sorted_inst_types($dom);
     my $typecount = 0;
     my ($css_class,%titles);
@@ -1523,15 +1525,18 @@
     }
     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})) {
@@ -1645,10 +1650,15 @@
                 unless (($context eq 'requestcourses') ||
                         ($context eq 'requestauthor')) {
                     $datatable .= 
-                              '<td class="LC_right_item"><span class="LC_nobreak">'.
+                              '<td class="LC_right_item">'.
+                              '<span class="LC_nobreak">'.&mt('Portfolio').': '.
                               '<input type="text" name="quota_'.$type.
                               '" value="'.$currdefquota.
-                              '" size="5" /> Mb</span></td>';
+                              '" size="5" /></span>'.(' ' x 2).
+                              '<span class="LC_nobreak">'.&mt('Authoring').': '.
+                              '<input type="text" name="authorquota_'.$type.
+                              '" value="'.$currauthorquota.
+                              '" size="5" /></span></td>';
                 }
                 $datatable .= '</tr>';
             }
@@ -1656,12 +1666,16 @@
     }
     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 ++;
@@ -1772,15 +1786,19 @@
     }
     $datatable .= '</td>';
     unless (($context eq 'requestcourses') || ($context eq 'requestauthor')) {
-        $datatable .= '<td class="LC_right_item"><span class="LC_nobreak">'.
+        $datatable .= '<td class="LC_right_item">'.
+                      '<span class="LC_nobreak">'.&mt('Portfolio').': '.
                       '<input type="text" name="defaultquota" value="'.
-                      $defaultquota.'" size="5" /> Mb</span></td>';
+                      $defaultquota.'" size="5" /></span>'.(' ' x2).
+                      '<span class="LC_nobreak">'.&mt('Authoring').': '.
+                      '<input type="text" name="authorquota" value="'.
+                      $authorquota.'" size="5" /></span></td>';
     }
     $datatable .= '</tr>';
     $typecount ++;
     $css_class = $typecount%2?' class="LC_odd_row"':'';
     $datatable .= '<tr'.$css_class.'>'.
-                  '<td>'.&mt('LON-CAPA Advanced Users').' ';
+                  '<td>'.&mt('LON-CAPA Advanced Users').'<br />';
     if ($context eq 'requestcourses') {
         $datatable .= &mt('(overrides affiliation, if set)').
                       '</td>'.
@@ -5720,8 +5738,9 @@
         } 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);
             }
         }
@@ -5747,6 +5766,7 @@
         }
     } else {
         $confhash{'defaultquota'}{'default'} = $env{'form.defaultquota'};
+        $confhash{'authorquota'}{'default'} = $env{'form.authorquota'};
     }
     foreach my $item (@usertools) {
         foreach my $type (@{$types},'default','_LC_adv') {
@@ -5834,6 +5854,17 @@
                     }
                 }
             }
+            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'}})) {
@@ -5852,6 +5883,21 @@
                 }
             }
         }
+        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') {
@@ -5888,6 +5934,19 @@
                     }
                     $resulttext .= '</ul></li>';
                 }
+                if (ref($changes{'authorquota'}) eq 'HASH') {
+                    $resulttext .= '<li>'.&mt('Authoring space default quotas').'<ul>';
+                    foreach my $type (@{$types},'default') {
+                        if (defined($changes{'authorquota'}{$type})) {
+                            my $typetitle = $usertypes->{$type};
+                            if ($type eq 'default') {
+                                $typetitle = $othertitle;
+                            }
+                            $resulttext .= '<li>'.&mt('[_1] set to [_2] Mb',$typetitle,$confhash{'authorquota'}{$type}).'</li>';
+                        }
+                    }
+                    $resulttext .= '</ul></li>';
+                }
             }
             my %newenv;
             foreach my $item (@usertools) {


More information about the LON-CAPA-cvs mailing list