]> source.dussan.org Git - nextcloud-server.git/commitdiff
Add percentage to user's quota info 3933/head
authorDavid Toledo <dtoledo@solidgear.es>
Mon, 27 Feb 2017 12:41:05 +0000 (13:41 +0100)
committerMorris Jobke <hey@morrisjobke.de>
Mon, 20 Mar 2017 04:04:55 +0000 (22:04 -0600)
* Add percentage to user's quota info

Fixes https://github.com/owncloud/core/issues/24011

* Do not show percentage if the quota is Unlimited

* translate quota

* correct condition and remove print_unescaped

Signed-off-by: Morris Jobke <hey@morrisjobke.de>
settings/personal.php
settings/templates/personal.php

index a1fcd10e0adb1107541b80f4eaa223fc114888b9..a4449754f644f3fb15d5ac5f6de749052e14ec27 100644 (file)
@@ -158,6 +158,7 @@ $userData = $accountManager->getUser($user);
 
 $tmpl->assign('total_space', $totalSpace);
 $tmpl->assign('usage_relative', $storageInfo['relative']);
+$tmpl->assign('quota', $storageInfo['quota']);
 $tmpl->assign('clients', $clients);
 $tmpl->assign('email', $userData[\OC\Accounts\AccountManager::PROPERTY_EMAIL]['value']);
 $tmpl->assign('languages', $languages);
index 31aa268f77638c1b942bb08ffe10a0a080e970d7..b47e2e28ffa39fde29021df474cc5717bda91e9b 100644 (file)
        <div style="width:<?php p($_['usage_relative']);?>%"
                <?php if($_['usage_relative'] > 80): ?> class="quota-warning" <?php endif; ?>>
                <p id="quotatext">
-                       <?php print_unescaped($l->t('You are using <strong>%s</strong> of <strong>%s</strong>',
-                       array($_['usage'], $_['total_space'])));?>
+                       <?php if ($_['quota'] === \OCP\Files\FileInfo::SPACE_UNLIMITED): ?>
+                               <?php print_unescaped($l->t('You are using <strong>%s</strong> of <strong>%s</strong>',
+                                       [$_['usage'], $_['total_space']]));?>
+                       <?php else: ?>
+                               <?php print_unescaped($l->t('You are using <strong>%s</strong> of <strong>%s</strong> (<strong>%s %%</strong>)',
+                                       [$_['usage'], $_['total_space'],  $_['usage_relative']]));?>
+                       <?php endif ?>
                </p>
        </div>
 </div>