[LON-CAPA-cvs] cvs: loncom(version_2_2_X) /interface portfolio.pm
albertel
lon-capa-cvs@mail.lon-capa.org
Thu, 29 Jun 2006 18:02:58 -0000
albertel Thu Jun 29 14:02:58 2006 EDT
Modified files: (Branch: version_2_2_X)
/loncom/interface portfolio.pm
Log:
- backport 1.126
Index: loncom/interface/portfolio.pm
diff -u loncom/interface/portfolio.pm:1.121.2.3 loncom/interface/portfolio.pm:1.121.2.4
--- loncom/interface/portfolio.pm:1.121.2.3 Wed Jun 28 15:57:44 2006
+++ loncom/interface/portfolio.pm Thu Jun 29 14:02:58 2006
@@ -1,7 +1,7 @@
# The LearningOnline Network
# portfolio browser
#
-# $Id: portfolio.pm,v 1.121.2.3 2006/06/28 19:57:44 albertel Exp $
+# $Id: portfolio.pm,v 1.121.2.4 2006/06/29 18:02:58 albertel Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -1447,6 +1447,14 @@
my $fname=$env{'form.uploaddoc.filename'};
my $filesize = (length($env{'form.uploaddoc'})) / 1000; #express in k (1024?)
my $disk_quota = 20000; # expressed in k
+ if (defined($group)) {
+ my $grp_quota = &get_group_quota($group); # quota expressed in k
+ if ($grp_quota ne '') {
+ $disk_quota = $grp_quota;
+ } else {
+ $disk_quota = 0;
+ }
+ }
$fname=&Apache::lonnet::clean_filename($fname);
my $portfolio_root=&get_portfolio_root($group);
@@ -1498,6 +1506,7 @@
}
}
}
+
sub lock_info {
my ($r,$url,$group) = @_;
my ($uname,$udom) = &get_name_dom($group);
@@ -1580,6 +1589,23 @@
return (&Apache::loncommon::propath($udom,$uname).$path);
}
+sub get_group_quota {
+ my ($group) = @_;
+ my $group_quota;
+ my $cdom = $env{'course.'.$env{'request.course.id'}.'.domain'};
+ my $cnum = $env{'course.'.$env{'request.course.id'}.'.num'};
+ my %curr_groups = &Apache::longroup::coursegroups($cdom,$cnum,$group);
+ if (%curr_groups) {
+ my %group_info = &Apache::longroup::get_group_settings(
+ $curr_groups{$group});
+ $group_quota = $group_info{'quota'}; #expressed in Mb
+ if ($group_quota) {
+ $group_quota = 1000 * $group_quota; #expressed in k
+ }
+ }
+ return $group_quota;
+}
+
sub get_dir_list {
my ($portfolio_root,$group) = @_;
my ($uname,$udom) = &get_name_dom($group);
@@ -1708,17 +1734,24 @@
$earlyout = 1;
}
if ($earlyout) { return OK; }
- if (&Apache::lonnet::allowed('agf',$env{'request.course.id'}.'/'.$group)) {
- $can_setacl = 1;
- }
- if (&Apache::lonnet::allowed('ugf',$env{'request.course.id'}.'/'.$group)) {
- $can_upload = 1;
- }
- if (&Apache::lonnet::allowed('mgf',$env{'request.course.id'}.'/'.$group)) {
+ if (&Apache::lonnet::allowed('mdg',$env{'request.course.id'})) {
$can_modify = 1;
- }
- if (&Apache::lonnet::allowed('dgf',$env{'request.course.id'}.'/'.$group)) {
$can_delete = 1;
+ $can_upload = 1;
+ $can_setacl = 1;
+ } else {
+ if (&Apache::lonnet::allowed('agf',$env{'request.course.id'}.'/'.$group)) {
+ $can_setacl = 1;
+ }
+ if (&Apache::lonnet::allowed('ugf',$env{'request.course.id'}.'/'.$group)) {
+ $can_upload = 1;
+ }
+ if (&Apache::lonnet::allowed('mgf',$env{'request.course.id'}.'/'.$group)) {
+ $can_modify = 1;
+ }
+ if (&Apache::lonnet::allowed('dgf',$env{'request.course.id'}.'/'.$group)) {
+ $can_delete = 1;
+ }
}
} else {
($uname,$udom) = &get_name_dom();