diff options
-rw-r--r-- | lib/private/NavigationManager.php | 2 | ||||
-rw-r--r-- | lib/private/Settings/Manager.php | 2 | ||||
-rw-r--r-- | lib/private/Settings/Personal/PersonalInfo.php | 20 | ||||
-rw-r--r-- | settings/templates/settings/personal/personal.info.php | 15 |
4 files changed, 36 insertions, 3 deletions
diff --git a/lib/private/NavigationManager.php b/lib/private/NavigationManager.php index e0b83fe5e47..16552005931 100644 --- a/lib/private/NavigationManager.php +++ b/lib/private/NavigationManager.php @@ -182,7 +182,7 @@ class NavigationManager implements INavigationManager { 'type' => 'settings', 'id' => 'settings', 'order' => 1, - 'href' => $this->urlGenerator->linkToRoute('settings_personal'), + 'href' => $this->urlGenerator->linkToRoute('settings.PersonalSettings.index'), 'name' => $l->t('Settings'), 'icon' => $this->urlGenerator->imagePath('settings', 'admin.svg'), ]); diff --git a/lib/private/Settings/Manager.php b/lib/private/Settings/Manager.php index d6b3398d0fc..41db5be9740 100644 --- a/lib/private/Settings/Manager.php +++ b/lib/private/Settings/Manager.php @@ -368,7 +368,7 @@ class Manager implements IManager { try { if ($section === 'personal-info') { /** @var ISettings $form */ - $form = new Personal\PersonalInfo($this->config, $this->userManager, $this->groupManager, $this->accountManager, $this->l10nFactory, $this->defaults); + $form = new Personal\PersonalInfo($this->config, $this->userManager, $this->groupManager, $this->accountManager, $this->l10nFactory, $this->defaults, $this->l); $forms[$form->getPriority()] = [$form]; } } catch (QueryException $e) { diff --git a/lib/private/Settings/Personal/PersonalInfo.php b/lib/private/Settings/Personal/PersonalInfo.php index 605d0c4df60..14c96d2fc4f 100644 --- a/lib/private/Settings/Personal/PersonalInfo.php +++ b/lib/private/Settings/Personal/PersonalInfo.php @@ -26,9 +26,11 @@ namespace OC\Settings\Personal; use OC\Accounts\AccountManager; use OCP\AppFramework\Http\TemplateResponse; +use OCP\Files\FileInfo; use OCP\IConfig; use OCP\IGroup; use OCP\IGroupManager; +use OCP\IL10N; use OCP\IUser; use OCP\IUserManager; use OCP\L10N\IFactory; @@ -52,6 +54,8 @@ class PersonalInfo implements ISettings { ]; /** @var \OC_Defaults */ private $defaults; + /** @var IL10N */ + private $l; /** * @param IConfig $config @@ -60,6 +64,7 @@ class PersonalInfo implements ISettings { * @param AccountManager $accountManager * @param IFactory $l10nFactory * @param \OC_Defaults $defaults + * @param IL10N $l */ public function __construct( IConfig $config, @@ -67,7 +72,8 @@ class PersonalInfo implements ISettings { IGroupManager $groupManager, AccountManager $accountManager, IFactory $l10nFactory, - \OC_Defaults $defaults + \OC_Defaults $defaults, + IL10N $l ) { $this->config = $config; $this->userManager = $userManager; @@ -75,6 +81,7 @@ class PersonalInfo implements ISettings { $this->groupManager = $groupManager; $this->l10nFactory = $l10nFactory; $this->defaults = $defaults; + $this->l = $l; } /** @@ -89,9 +96,20 @@ class PersonalInfo implements ISettings { $user = $this->userManager->get($uid); $userData = $this->accountManager->getUser($user); + $storageInfo = \OC_Helper::getStorageInfo('/'); + if ($storageInfo['quota'] === FileInfo::SPACE_UNLIMITED) { + $totalSpace = $this->l->t('Unlimited'); + } else { + $totalSpace = \OC_Helper::humanFileSize($storageInfo['total']); + } + list($activeLanguage, $commonLanguages, $languages) = $this->getLanguages($user); $parameters = [ + 'total_space' => $totalSpace, + 'usage' => \OC_Helper::humanFileSize($storageInfo['used']), + 'usage_relative' => $storageInfo['relative'], + 'quota' => $storageInfo['quota'], 'avatarChangeSupported' => \OC_User::canUserChangeAvatar($uid), 'lookupServerUploadEnabled' => $lookupServerUploadEnabled, 'avatar_scope' => $userData[AccountManager::PROPERTY_AVATAR]['scope'], diff --git a/settings/templates/settings/personal/personal.info.php b/settings/templates/settings/personal/personal.info.php index eb1bb43d267..dd271563c60 100644 --- a/settings/templates/settings/personal/personal.info.php +++ b/settings/templates/settings/personal/personal.info.php @@ -42,6 +42,21 @@ vendor_style('jcrop/css/jquery.Jcrop'); ?> +<div id="quota" class="section"> + <div style="width:<?php p($_['usage_relative']);?>%" + <?php if($_['usage_relative'] > 80): ?> class="quota-warning" <?php endif; ?>> + <p id="quotatext"> + <?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> + <div id="personal-settings"> <div id="personal-settings-avatar-container"> <form id="avatarform" class="section" method="post" action="<?php p(\OC::$server->getURLGenerator()->linkToRoute('core.avatar.postAvatar')); ?>"> |