diff options
author | Cash Costello <cash.costello@gmail.com> | 2010-04-25 01:15:26 +0000 |
---|---|---|
committer | Cash Costello <cash.costello@gmail.com> | 2010-04-25 01:15:26 +0000 |
commit | 0ccf8f23e31eb946b907da9e1d9365ce45831d15 (patch) | |
tree | 60f6eee9f464413e7c54d02e49f6a8e920a4d9a5 /views | |
parent | c940ce7ad01482798205a5d2e2b7336aef83bb05 (diff) | |
download | elgg-0ccf8f23e31eb946b907da9e1d9365ce45831d15.tar.gz elgg-0ccf8f23e31eb946b907da9e1d9365ce45831d15.tar.bz2 |
better quota message on upload form - need to start moving more functionality into libraries
Diffstat (limited to 'views')
-rw-r--r-- | views/default/tidypics/forms/upload.php | 14 |
1 files changed, 11 insertions, 3 deletions
diff --git a/views/default/tidypics/forms/upload.php b/views/default/tidypics/forms/upload.php index 077e90b1e..6e755612c 100644 --- a/views/default/tidypics/forms/upload.php +++ b/views/default/tidypics/forms/upload.php @@ -15,9 +15,17 @@ if ($quota) { $image_repo_size_md = get_metadata_byname($album->container_guid, "image_repo_size"); $image_repo_size = (int)$image_repo_size_md->value; - $image_repo_size = round($image_repo_size / 1024 / 1024); - if ($image_repo_size > $quota) + $image_repo_size = $image_repo_size / 1024 / 1024; + $quote_percentage = round(100 * ($image_repo_size / $quota)); + // for small quotas, so one decimal place + if ($quota < 10) { + $image_repo_size = sprintf('%.1f', $image_repo_size); + } else { + $image_repo_size = round($image_repo_size); + } + if ($image_repo_size > $quota) { $image_repo_size = $quota; + } } ?> @@ -32,7 +40,7 @@ <?php if ($quota) { ?> - <i><?php echo elgg_echo("tidypics:quota") . ' ' . $image_repo_size . '/' . $quota . ' MB'; ?></i><br /> + <i><?php echo elgg_echo("tidypics:quota") . ' ' . $image_repo_size . '/' . $quota . " MB ({$quote_percentage}%)"; ?></i><br /> <?php } ?> |