add storage info, fix URL generation
Signed-off-by: Arthur Schiwon <blizzz@arthur-schiwon.de>
This commit is contained in:
parent
9e924d74c9
commit
8bd887b2c6
4 changed files with 36 additions and 3 deletions
|
@ -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'),
|
||||
]);
|
||||
|
|
|
@ -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) {
|
||||
|
|
|
@ -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'],
|
||||
|
|
|
@ -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')); ?>">
|
||||
|
|
Loading…
Reference in a new issue