[LON-CAPA-cvs] cvs: loncom /interface loncreateuser.pm

raeburn lon-capa-cvs-allow@mail.lon-capa.org
Sun, 20 Jan 2008 01:40:37 -0000


raeburn		Sat Jan 19 20:40:37 2008 EDT

  Modified files:              
    /loncom/interface	loncreateuser.pm 
  Log:
  Custom quota now set if supplied for a new user account.
  
  
Index: loncom/interface/loncreateuser.pm
diff -u loncom/interface/loncreateuser.pm:1.231 loncom/interface/loncreateuser.pm:1.232
--- loncom/interface/loncreateuser.pm:1.231	Sat Jan 19 20:24:16 2008
+++ loncom/interface/loncreateuser.pm	Sat Jan 19 20:40:37 2008
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # Create a user
 #
-# $Id: loncreateuser.pm,v 1.231 2008/01/20 01:24:16 raeburn Exp $
+# $Id: loncreateuser.pm,v 1.232 2008/01/20 01:40:37 raeburn Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -1636,6 +1636,27 @@
 	$r->print(&mt('Generating user').': '.$result);
         $uhome = &Apache::lonnet::homeserver($env{'form.ccuname'},
                                                $env{'form.ccdomain'});
+        if (($uhome ne 'no_host') && ($env{'form.customquota'} == 1)) {
+            my (%changeHash,$newportfolioquota);
+            if ($env{'form.portfolioquota'} eq '') {
+                $newportfolioquota = 0;
+            } else {
+                $newportfolioquota = $env{'form.portfolioquota'};
+                $newportfolioquota =~ s/[^\d\.]//g;
+            }
+            my $quotachanged = &quota_admin($newportfolioquota,\%changeHash);
+            if ($quotachanged) {
+                $changeHash{'firstname'}  = $env{'form.cfirstname'};
+                $changeHash{'middlename'} = $env{'form.cmiddlename'};
+                $changeHash{'lastname'}   = $env{'form.clastname'};
+                $changeHash{'generation'} = $env{'form.cgeneration'};
+                $changeHash{'id'}         = $env{'form.cid'};
+                $changeHash{'permanentemail'} = $env{'form.cpermanentemail'};
+                my $quotachgresult =
+                    &Apache::lonnet::put('environment',\%changeHash,
+                                         $env{'form.ccdomain'},$env{'form.ccuname'});
+            }
+        }
         $r->print('<br />'.&mt('Home server').': '.$uhome.' '.
                   &Apache::lonnet::hostname($uhome));
     } elsif (($env{'form.login'} ne 'nochange') &&