version 1.1134, 2013/07/02 19:04:36
|
version 1.1135, 2013/07/03 05:03:12
|
Line 8759 sub default_quota {
|
Line 8759 sub default_quota {
|
} |
} |
} |
} |
|
|
|
############################################### |
|
|
|
=pod |
|
|
|
=item * &excess_filesize_authorspace() |
|
|
|
Returns warning message if upload of file to authoring space, or copying |
|
of existing file within authoring space will cause quota to be exceeded. |
|
|
|
Inputs: 6 |
|
1. username |
|
2. domain |
|
3. directory path for top level of current authoring space |
|
4. filename of file for which action is being requested |
|
5. filesize (kB) of file |
|
6. action being taken: copy or upload. |
|
|
|
Returns: 1 scalar: HTML to display containing warning if quota would be exceeded, |
|
otherwise return null. |
|
|
|
=cut |
|
|
|
sub excess_filesize_authorspace { |
|
my ($uname,$udom,$authorspace,$filename,$filesize,$action) = @_; |
|
my $disk_quota = &Apache::loncommon::get_user_quota($uname,$udom,'author'); #expressed in MB |
|
$disk_quota = int($disk_quota * 1000); |
|
my $current_disk_usage = &Apache::lonnet::diskusage($udom,$uname,$authorspace); |
|
if (($current_disk_usage + $filesize) > $disk_quota) { |
|
return '<p><span class="LC_warning">'. |
|
&mt("Unable to $action [_1]. (size = [_2] kilobytes). Disk quota will be exceeded.", |
|
'<span class="LC_filename">'.$filename.'</span>',$filesize).'</span>'. |
|
'<br />'.&mt('Disk quota is [_1] kilobytes. Your current disk usage is [_2] kilobytes.', |
|
$disk_quota,$current_disk_usage). |
|
'</p>'; |
|
} |
|
return; |
|
} |
|
|
|
############################################### |
|
|
|
|
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); |