diff options
author | Morris Jobke <hey@morrisjobke.de> | 2015-06-05 18:21:41 +0200 |
---|---|---|
committer | Morris Jobke <hey@morrisjobke.de> | 2015-06-05 18:21:41 +0200 |
commit | 62ae39208a0deed71d4cd373c6822946fd489586 (patch) | |
tree | 219d97cf14af0afb43939aa403a5863838cbc794 /apps | |
parent | 9899e10a0411d161db1b4e1302690ac74c1ae72c (diff) | |
download | nextcloud-server-62ae39208a0deed71d4cd373c6822946fd489586.tar.gz nextcloud-server-62ae39208a0deed71d4cd373c6822946fd489586.zip |
Add owner to the storage stats to enable better notifications
* getstoragestats.php returns now the owner and it's display name
* show proper storage stats notifications for shared folders
Diffstat (limited to 'apps')
-rw-r--r-- | apps/files/index.php | 2 | ||||
-rw-r--r-- | apps/files/js/files.js | 16 | ||||
-rw-r--r-- | apps/files/lib/helper.php | 4 | ||||
-rw-r--r-- | apps/files/templates/index.php | 2 |
4 files changed, 22 insertions, 2 deletions
diff --git a/apps/files/index.php b/apps/files/index.php index c7a45e54854..ee12df5f075 100644 --- a/apps/files/index.php +++ b/apps/files/index.php @@ -138,6 +138,8 @@ OCP\Util::addscript('files', 'navigation'); OCP\Util::addscript('files', 'keyboardshortcuts'); $tmpl = new OCP\Template('files', 'index', 'user'); $tmpl->assign('usedSpacePercent', (int)$storageInfo['relative']); +$tmpl->assign('owner', $storageInfo['owner']); +$tmpl->assign('ownerDisplayName', $storageInfo['ownerDisplayName']); $tmpl->assign('isPublic', false); $tmpl->assign("mailNotificationEnabled", $config->getAppValue('core', 'shareapi_allow_mail_notification', 'no')); $tmpl->assign("mailPublicNotificationEnabled", $config->getAppValue('core', 'shareapi_allow_public_notification', 'no')); diff --git a/apps/files/js/files.js b/apps/files/js/files.js index 68e9315954f..44868e78bd0 100644 --- a/apps/files/js/files.js +++ b/apps/files/js/files.js @@ -63,6 +63,8 @@ $('#free_space').val(response.data.freeSpace); $('#upload.button').attr('original-title', response.data.maxHumanFilesize); $('#usedSpacePercent').val(response.data.usedSpacePercent); + $('#owner').val(response.data.owner); + $('#ownerDisplayName').val(response.data.ownerDisplayName); Files.displayStorageWarnings(); } if (response[0] === undefined) { @@ -109,12 +111,24 @@ return; } - var usedSpacePercent = $('#usedSpacePercent').val(); + var usedSpacePercent = $('#usedSpacePercent').val(), + owner = $('#owner').val(), + ownerDisplayName = $('#ownerDisplayName').val(); if (usedSpacePercent > 98) { + if (owner !== oc_current_user) { + OC.Notification.show(t('files', 'Storage of {owner} is full, files can not be updated or synced anymore!', + { owner: ownerDisplayName })); + return; + } OC.Notification.show(t('files', 'Your storage is full, files can not be updated or synced anymore!')); return; } if (usedSpacePercent > 90) { + if (owner !== oc_current_user) { + OC.Notification.show(t('files', 'Storage of {owner} is almost full ({usedSpacePercent}%)', + { usedSpacePercent: usedSpacePercent, owner: ownerDisplayName })); + return; + } OC.Notification.show(t('files', 'Your storage is almost full ({usedSpacePercent}%)', {usedSpacePercent: usedSpacePercent})); } diff --git a/apps/files/lib/helper.php b/apps/files/lib/helper.php index e966e60d00a..6bfdc0a095c 100644 --- a/apps/files/lib/helper.php +++ b/apps/files/lib/helper.php @@ -52,7 +52,9 @@ class Helper { 'uploadMaxFilesize' => $maxUploadFileSize, 'maxHumanFilesize' => $maxHumanFileSize, 'freeSpace' => $storageInfo['free'], - 'usedSpacePercent' => (int)$storageInfo['relative'] + 'usedSpacePercent' => (int)$storageInfo['relative'], + 'owner' => $storageInfo['owner'], + 'ownerDisplayName' => $storageInfo['ownerDisplayName'], ]; } diff --git a/apps/files/templates/index.php b/apps/files/templates/index.php index 77f80bc346d..a068f306ac4 100644 --- a/apps/files/templates/index.php +++ b/apps/files/templates/index.php @@ -11,6 +11,8 @@ <!-- config hints for javascript --> <input type="hidden" name="filesApp" id="filesApp" value="1" /> <input type="hidden" name="usedSpacePercent" id="usedSpacePercent" value="<?php p($_['usedSpacePercent']); ?>" /> +<input type="hidden" name="owner" id="owner" value="<?php p($_['owner']); ?>" /> +<input type="hidden" name="ownerDisplayName" id="ownerDisplayName" value="<?php p($_['ownerDisplayName']); ?>" /> <?php if (!$_['isPublic']) :?> <input type="hidden" name="mailNotificationEnabled" id="mailNotificationEnabled" value="<?php p($_['mailNotificationEnabled']) ?>" /> <input type="hidden" name="mailPublicNotificationEnabled" id="mailPublicNotificationEnabled" value="<?php p($_['mailPublicNotificationEnabled']) ?>" /> |