version 1.1164, 2013/12/20 00:08:22
|
version 1.1165, 2013/12/24 19:15:10
|
Line 8693 Incoming parameters:
|
Line 8693 Incoming parameters:
|
2. user's domain |
2. user's domain |
3. quota name - portfolio, author, or course |
3. quota name - portfolio, author, or course |
(if no quota name provided, defaults to portfolio). |
(if no quota name provided, defaults to portfolio). |
4. crstype - official, unofficial or community, if quota name is |
4. crstype - official, unofficial, textbook or community, if quota name is |
course |
course |
|
|
Returns: |
Returns: |
Line 8767 sub get_user_quota {
|
Line 8767 sub get_user_quota {
|
if ($quota eq '' || wantarray) { |
if ($quota eq '' || wantarray) { |
if ($quotaname eq 'course') { |
if ($quotaname eq 'course') { |
my %domdefs = &Apache::lonnet::get_domain_defaults($udom); |
my %domdefs = &Apache::lonnet::get_domain_defaults($udom); |
if (($crstype eq 'official') || ($crstype eq 'unofficial') || ($crstype eq 'community')) { |
if (($crstype eq 'official') || ($crstype eq 'unofficial') || |
|
($crstype eq 'community') || ($crstype eq 'textbook')) { |
$defquota = $domdefs{$crstype.'quota'}; |
$defquota = $domdefs{$crstype.'quota'}; |
} |
} |
if ($defquota eq '') { |
if ($defquota eq '') { |
Line 8908 space to be exceeded.
|
Line 8909 space to be exceeded.
|
Same, if upload of a file directly to a course/community via Course Editor |
Same, if upload of a file directly to a course/community via Course Editor |
will cause quota for uploaded content for the course to be exceeded. |
will cause quota for uploaded content for the course to be exceeded. |
|
|
Inputs: 6 |
Inputs: 7 |
1. username or coursenum |
1. username or coursenum |
2. domain |
2. domain |
3. context ('author' or 'course') |
3. context ('author' or 'course') |
4. filename of file for which action is being requested |
4. filename of file for which action is being requested |
5. filesize (kB) of file |
5. filesize (kB) of file |
6. action being taken: copy or upload. |
6. action being taken: copy or upload. |
|
7. quotatype (in course context -- official, unofficial, community or textbook). |
|
|
Returns: 1 scalar: HTML to display containing warning if quota would be exceeded, |
Returns: 1 scalar: HTML to display containing warning if quota would be exceeded, |
otherwise return null. |
otherwise return null. |
Line 8924 Returns: 1 scalar: HTML to display conta
|
Line 8926 Returns: 1 scalar: HTML to display conta
|
=cut |
=cut |
|
|
sub excess_filesize_warning { |
sub excess_filesize_warning { |
my ($uname,$udom,$context,$filename,$filesize,$action) = @_; |
my ($uname,$udom,$context,$filename,$filesize,$action,$quotatype) = @_; |
my $current_disk_usage = 0; |
my $current_disk_usage = 0; |
my $disk_quota = &get_user_quota($uname,$udom,$context); #expressed in MB |
my $disk_quota = &get_user_quota($uname,$udom,$context,$quotatype); #expressed in MB |
if ($context eq 'author') { |
if ($context eq 'author') { |
my $authorspace = $Apache::lonnet::perlvar{'lonDocRoot'}."/priv/$udom/$uname"; |
my $authorspace = $Apache::lonnet::perlvar{'lonDocRoot'}."/priv/$udom/$uname"; |
$current_disk_usage = &Apache::lonnet::diskusage($udom,$uname,$authorspace); |
$current_disk_usage = &Apache::lonnet::diskusage($udom,$uname,$authorspace); |
Line 14259 sub group_term {
|
Line 14261 sub group_term {
|
} |
} |
|
|
sub course_types { |
sub course_types { |
my @types = ('official','unofficial','community'); |
my @types = ('official','unofficial','community','textbook'); |
my %typename = ( |
my %typename = ( |
official => 'Official course', |
official => 'Official course', |
unofficial => 'Unofficial course', |
unofficial => 'Unofficial course', |
community => 'Community', |
community => 'Community', |
|
textbook => 'Textbook course', |
); |
); |
return (\@types,\%typename); |
return (\@types,\%typename); |
} |
} |
Line 14466 sub init_user_environment {
|
Line 14469 sub init_user_environment {
|
undef,\%userenv,\%domdef,\%is_adv); |
undef,\%userenv,\%domdef,\%is_adv); |
} |
} |
|
|
foreach my $crstype ('official','unofficial','community') { |
foreach my $crstype ('official','unofficial','community','textbook') { |
$userenv{'canrequest.'.$crstype} = |
$userenv{'canrequest.'.$crstype} = |
&Apache::lonnet::usertools_access($username,$domain,$crstype, |
&Apache::lonnet::usertools_access($username,$domain,$crstype, |
'reload','requestcourses', |
'reload','requestcourses', |