diff --git a/apps/files/js/file-upload.js b/apps/files/js/file-upload.js index d1730fa7bc7c9..e9534111e10eb 100644 --- a/apps/files/js/file-upload.js +++ b/apps/files/js/file-upload.js @@ -130,7 +130,7 @@ OC.FileUpload.prototype = { }, /** - * Get full path for the target file, + * Get full path for the target file, * including relative path and file name. * * @return {String} full path diff --git a/apps/files/js/filelist.js b/apps/files/js/filelist.js index fa9819b78b507..f75c9d18ea048 100644 --- a/apps/files/js/filelist.js +++ b/apps/files/js/filelist.js @@ -1751,7 +1751,6 @@ return true; } - // TODO: parse remaining quota from PROPFIND response this.updateStorageStatistics(true); // first entry is the root diff --git a/apps/files/js/files.js b/apps/files/js/files.js index 017bf7ecf41a6..afc114c588652 100644 --- a/apps/files/js/files.js +++ b/apps/files/js/files.js @@ -29,6 +29,7 @@ state.dir = null; state.call = null; Files.updateMaxUploadFilesize(response); + Files.updateQuota(response); }); }, /** @@ -77,6 +78,32 @@ }, + updateQuota:function(response) { + if (response === undefined) { + return; + } + if (response.data !== undefined + && response.data.quota !== undefined + && response.data.used !== undefined + && response.data.usedSpacePercent !== undefined) { + var humanUsed = OC.Util.humanFileSize(response.data.used, true); + var humanQuota = OC.Util.humanFileSize(response.data.quota, true); + if (response.data.quota > 0) { + $('#quota').attr('data-original-title', Math.floor(response.data.used/response.data.quota*1000)/10 + '%'); + $('#quota progress').val(response.data.usedSpacePercent); + $('#quotatext').text(t('files', '{used} of {quota} used', {used: humanUsed, quota: humanQuota})); + } else { + $('#quotatext').text(t('files', '{used} used', {used: humanUsed})); + } + if (response.data.usedSpacePercent > 80) { + $('#quota progress').addClass('warn'); + } else { + $('#quota progress').removeClass('warn'); + } + } + + }, + /** * Fix path name by removing double slash at the beginning, if any */ diff --git a/apps/files/lib/Helper.php b/apps/files/lib/Helper.php index ab952c97dfb4d..9d9717c94015c 100644 --- a/apps/files/lib/Helper.php +++ b/apps/files/lib/Helper.php @@ -56,6 +56,8 @@ public static function buildFileStorageStatistics($dir) { 'uploadMaxFilesize' => $maxUploadFileSize, 'maxHumanFilesize' => $maxHumanFileSize, 'freeSpace' => $storageInfo['free'], + 'quota' => $storageInfo['quota'], + 'used' => $storageInfo['used'], 'usedSpacePercent' => (int)$storageInfo['relative'], 'owner' => $storageInfo['owner'], 'ownerDisplayName' => $storageInfo['ownerDisplayName'], diff --git a/apps/files/templates/appnavigation.php b/apps/files/templates/appnavigation.php index 955cd03a019a1..5d270914ff19e 100644 --- a/apps/files/templates/appnavigation.php +++ b/apps/files/templates/appnavigation.php @@ -11,7 +11,7 @@ class="nav-icon- s -