Add the "where is your data?" frontend

Signed-off-by: Michael Weimann <mail@michael-weimann.eu>
This commit is contained in:
Michael Weimann 2018-12-16 18:39:01 +01:00
parent 71e26d12c0
commit 107fab9dfa
No known key found for this signature in database
GPG Key ID: 34F0524D4DA694A1
5 changed files with 111 additions and 11 deletions

View File

@ -60,11 +60,11 @@ a {
* {
cursor: pointer;
}
}
a.external {
margin: 0 3px;
text-decoration: underline;
&.external {
margin: 0 3px;
text-decoration: underline;
}
}
input {

View File

@ -38,6 +38,7 @@ use OCP\IUser;
use OCP\IUserManager;
use OCP\L10N\IFactory;
use OCP\Settings\ISettings;
use OCP\Encryption\IManager as EncryptionManager;
class PersonalInfo implements ISettings {
@ -55,6 +56,8 @@ class PersonalInfo implements ISettings {
private $l10nFactory;
/** @var IL10N */
private $l;
/** @var EncryptionManager */
private $encryptionManager;
/**
* @param IConfig $config
@ -71,7 +74,8 @@ class PersonalInfo implements ISettings {
AccountManager $accountManager,
IAppManager $appManager,
IFactory $l10nFactory,
IL10N $l
IL10N $l,
EncryptionManager $encryptionManager
) {
$this->config = $config;
$this->userManager = $userManager;
@ -80,6 +84,7 @@ class PersonalInfo implements ISettings {
$this->appManager = $appManager;
$this->l10nFactory = $l10nFactory;
$this->l = $l;
$this->encryptionManager = $encryptionManager;
}
/**
@ -135,9 +140,15 @@ class PersonalInfo implements ISettings {
'twitterScope' => $userData[AccountManager::PROPERTY_TWITTER]['scope'],
'twitterVerification' => $userData[AccountManager::PROPERTY_TWITTER]['verified'],
'groups' => $this->getGroups($user),
'dataLocation' => 'Germany',
'provider' => 'Hetzner Online GmbH',
'providerLink' => 'https://www.hetzner.de/',
'providerPrivacyLink' => 'https://www.hetzner.de/rechtliches/datenschutz',
'encryptionEnabled' => true || $this->encryptionManager->isEnabled(),
'adminName' => 'Michael Weimann',
'adminMail' => 'mail@michael-weimann.eu'
] + $messageParameters + $languageParameters + $localeParameters;
return new TemplateResponse('settings', 'settings/personal/personal.info', $parameters, '');
}

View File

@ -98,6 +98,7 @@ input {
#personal-settings-avatar-container {
display: inline-grid;
grid-row: span 3;
grid-template-columns: 1fr;
grid-template-rows: 2fr 1fr;
vertical-align: top;
@ -178,6 +179,15 @@ select {
grid-template-columns: 1fr;
#personal-settings-avatar-container {
grid-template-rows: 1fr;
// swap "Where is my data" and "Detail"
*:nth-child(2) {
order: 3;
}
*:nth-child(3) {
order: 2;
}
}
.personal-settings-container {
grid-template-columns: 1fr 1fr;
@ -1614,3 +1624,10 @@ doesnotexist:-o-prefocus, .strengthify-wrapper {
}
}
}
.where-is-your-data {
// @todo replace by common Nextcloud link style as soon as available
a {
border-bottom: 1px dotted;
}
}

View File

@ -0,0 +1,76 @@
<div class="personal-settings-setting-box personal-settings-group-box section where-is-your-data">
<h3>
<?php p($l->t('Where is your data?')); ?>
<a
target="_blank"
rel="noreferrer noopener"
class="icon-info"
title=""
href="https://nextcloud.com/yourdata/"
data-original-title="Open documentation"></a>
</h3>
<?php if (empty($_['dataLocation']) === false): ?>
<div class="personal-info icon-address">
<p>
<?php echo $l->t('Your data is located in <b>%s</b>.', [$_['dataLocation']]); ?>
</p>
</div>
<?php endif; ?>
<?php if (empty($_['provider']) === false): ?>
<div class="personal-info icon-category-integration">
<p>
<?php
if (empty($_['providerLink']) === false) {
echo $l->t('Your provider is %s%s%s.', [
'<a href="' . $_['providerLink'] . '" target="_blank" title="" rel="noreferrer noopener">',
$_['provider'],
'</a>'
]);
} else {
echo $l->t('Your provider is %s.', [$_['provider']]);
}
?>
<?php
if (empty($_['providerPrivacyLink']) === false) {
echo $l->t('Read the %sprivacy policy%s now.', [
'<a href="' . $_['providerPrivacyLink'] . '" target="_blank" title="" rel="noreferrer noopener">',
'</a>'
]);
}
?>
</p>
</div>
<?php endif; ?>
<?php if ($_['encryptionEnabled'] === true): ?>
<div class="personal-info icon-password">
<p>
<?php echo $l->t(
'Your data is protected by %sserver side encryption%s.',
[
'<a href="https://nextcloud.com/blog/encryption-in-nextcloud/" target="_blank" title="" rel="noreferrer noopener">',
'</a>'
]
); ?>
</p>
</div>
<?php endif; ?>
<?php if (empty($_['adminName']) === false): ?>
<div class="personal-info icon-user-admin">
<p>
<?php echo $l->t(
'%s%s%s is your admin. If you have any issues, %scontact them%s.',
[
'<a href="mailto:' . $_['adminMail'] . '" target="_blank" title="" rel="noreferrer noopener">',
$_['adminName'],
'</a>',
'<a href="mailto:' . $_['adminMail'] . '" target="_blank" title="" rel="noreferrer noopener">',
'</a>'
]
); ?>
</p>
</div>
<?php endif; ?>
</div>

View File

@ -95,6 +95,7 @@ script('settings', [
<progress value="<?php p($_['usage_relative']); ?>" max="100"<?php if($_['usage_relative'] > 80): ?> class="warn" <?php endif; ?>></progress>
</div>
</div>
<?php include __DIR__ . '/partials/where-is-your-data.php' ?>
</div>
<div class="personal-settings-container">
@ -375,9 +376,4 @@ script('settings', [
</div>
<span class="msg"></span>
</div>
<div id="personal-settings-group-container">
</div>
</div>