]> source.dussan.org Git - nextcloud-server.git/commitdiff
Fixed storage stats to be based on current directory
authorVincent Petry <pvince81@owncloud.com>
Wed, 6 Nov 2013 09:55:19 +0000 (10:55 +0100)
committerVincent Petry <pvince81@owncloud.com>
Tue, 19 Nov 2013 10:05:05 +0000 (11:05 +0100)
Previously, the storage statistics were always for the root dir.
This means that the upload button would always show the limit for the
root dir, even when uploading to a shared dir or external storage.

This fix adds a "dir" argument to getstoragestats.php.

Partial backport of 31181e4348b9af2625cf4d6ad38cf4cd81db3c1f

apps/files/ajax/getstoragestats.php
apps/files/js/files.js

index 7a2b642a9bd11296f64bc16afd1fb559dbde2443..573179e2866f83ac6ae25a6bf4fddf721bb152a4 100644 (file)
@@ -3,7 +3,13 @@
 // only need filesystem apps
 $RUNTIME_APPTYPES = array('filesystem');
 
+$dir = '/';
+
+if (isset($_GET['dir'])) {
+       $dir = $_GET['dir'];
+}
+
 OCP\JSON::checkLoggedIn();
 
 // send back json
-OCP\JSON::success(array('data' => \OCA\files\lib\Helper::buildFileStorageStatistics('/')));
+OCP\JSON::success(array('data' => \OCA\files\lib\Helper::buildFileStorageStatistics($dir)));
index d8aca4dd26aeabd7ac875619efbf213fe84f5bba..1e523e8441daaf1c2f5f78e719b4e9507f8d01a1 100644 (file)
@@ -523,7 +523,8 @@ $(document).ready(function() {
 
        // file space size sync
        function update_storage_statistics() {
-               $.getJSON(OC.filePath('files','ajax','getstoragestats.php'),function(response) {
+               var currentDir = $('#dir').val() || '/';
+               $.getJSON(OC.filePath('files','ajax','getstoragestats.php?dir=' + encodeURIComponent(currentDir)),function(response) {
                        Files.updateMaxUploadFilesize(response);
                });
        }