Diff for /loncom/interface/loncommon.pm between versions 1.471 and 1.472

version 1.471, 2006/11/20 21:00:47 version 1.472, 2006/11/21 21:38:44
Line 4612  sub get_user_info { Line 4612  sub get_user_info {
     return;      return;
 }  }
   
   ###############################################
   
   =pod
   
   =item * &get_user_quota()
   
   Retrieves quota assigned for storage of portfolio files for a user  
   
   Incoming parameters:
   1. user's username
   2. user's domain
   
   Returns:
   1. Disk quota (in Mb) assigned to student. 
   
   If a value has been stored in the user's environment, 
   it will return that, otherwise it returns the default
   for users in the domain.
   
   =cut
   
   ###############################################
   
   
   sub get_user_quota {
       my ($uname,$udom) = @_;
       my $quota;
       if (!defined($udom)) {
           $udom = $env{'user.domain'};
       }
       if (!defined($uname)) {
           $uname = $env{'user.name'};
       }
       if (($udom eq '' || $uname eq '') ||
           ($udom eq 'public') && ($uname eq 'public')) {
           $quota = 0;
       } else {
           if ($udom eq $env{'user.domain'} && $uname eq $env{'user.name'}) {
               $quota = $env{'environment.portfolioquota'};
           } else {
               my %userenv = &Apache::lonnet::dump('environment',$udom,$uname);
               my ($tmp) = keys(%userenv);
               if ($tmp !~ /^(con_lost|error|no_such_host)/i) {
                   $quota = $userenv{'portfolioquota'};
               } else {
                   undef(%userenv);
               }
           }
           if ($quota eq '') {
               $quota = &default_quota($udom);
           }
       }
       return $quota;
   }
   
   ###############################################
   
   =pod
   
   =item * &default_quota()
   
   Retrieves default quota assigned for storage of user portfolio files
   
   Incoming parameters:
   1. domain
   
   Returns:
   1. Default disk quota (in Mb) for user portfolios in the domain.
   
   If a value has been stored in the domain's configuration db,
   it will return that, otherwise it returns 20 (for backwards 
   compatibility with domains which have not set up a configuration
   db file; the original statically defined portfolio quota was 20 Mb). 
   
   =cut
   
   ###############################################
   
   
   sub default_quota {
       my ($udom) = @_;
       my %defaults = &Apache::lonnet::get_dom('configuration',
                                               ['portfolioquota'],$udom);
       if ($defaults{'portfolioquota'} ne '') {
           return $defaults{'portfolioquota'};
       } else {
           return '20';
       }
   }
   
 sub get_secgrprole_info {  sub get_secgrprole_info {
     my ($cdom,$cnum,$needroles,$type)  = @_;      my ($cdom,$cnum,$needroles,$type)  = @_;
     my %sections_count = &get_sections($cdom,$cnum);      my %sections_count = &get_sections($cdom,$cnum);

Removed from v.1.471  
changed lines
  Added in v.1.472


FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>