--- loncom/interface/londocs.pm 2015/06/09 21:22:56 1.594 +++ loncom/interface/londocs.pm 2015/06/18 20:19:06 1.595 @@ -1,7 +1,7 @@ # The LearningOnline Network # Documents # -# $Id: londocs.pm,v 1.594 2015/06/09 21:22:56 damieng Exp $ +# $Id: londocs.pm,v 1.595 2015/06/18 20:19:06 musolffc Exp $ # # Copyright Michigan State University Board of Trustees # @@ -4769,7 +4769,9 @@ sub handler { .'// '."\n" - .''."\n"; + .''."\n" + .''."\n"; # Breadcrumbs &Apache::lonhtmlcommon::clear_breadcrumbs(); @@ -4899,9 +4901,30 @@ sub handler { 'webctce4' => 'WebCT 4 Campus Edition', ); # ----------------------------------------------------------------------------- + + # Calculate free quota space for a user or course. A javascript function checks + # file size to determine if upload should be allowed. + my $quotatype = 'unofficial'; + if ($crstype eq 'Community') { + $quotatype = 'community'; + } elsif ($env{'course.'.$coursedom.'_'.$coursenum.'.internal.coursecode'}) { + $quotatype = 'official'; + } elsif ($env{'course.'.$coursedom.'_'.$coursenum.'.internal.textbook'}) { + $quotatype = 'textbook'; + } + my $disk_quota = &Apache::loncommon::get_user_quota($coursenum,$coursedom, + 'course',$quotatype); # expressed in MB + my $current_disk_usage = 0; + foreach my $subdir ('docs','supplemental') { + $current_disk_usage += &Apache::lonnet::diskusage($coursedom,$coursenum, + "userfiles/$subdir",1); # expressed in kB + } + my $free_space = 1024 * ((1024 * $disk_quota) - $current_disk_usage); + my $fileupload=(< - + + FIUP my $checkbox=(<