[stable16] Show share settings only if incoming federated shares are allowed (#15926)

[stable16] Show share settings only if incoming federated shares are allowed
This commit is contained in:
John Molakvoæ 2019-06-12 08:58:49 +02:00 committed by GitHub
commit 9dfe777fc8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 49 additions and 50 deletions

View File

@ -63,7 +63,6 @@ class Personal implements ISettings {
$url = 'https://nextcloud.com/sharing#' . $cloudID; $url = 'https://nextcloud.com/sharing#' . $cloudID;
$parameters = [ $parameters = [
'outgoingServer2serverShareEnabled' => $this->federatedShareProvider->isOutgoingServer2serverShareEnabled(),
'message_with_URL' => $this->l->t('Share with me through my #Nextcloud Federated Cloud ID, see %s', [$url]), 'message_with_URL' => $this->l->t('Share with me through my #Nextcloud Federated Cloud ID, see %s', [$url]),
'message_without_URL' => $this->l->t('Share with me through my #Nextcloud Federated Cloud ID', [$cloudID]), 'message_without_URL' => $this->l->t('Share with me through my #Nextcloud Federated Cloud ID', [$cloudID]),
'logoPath' => $this->defaults->getLogo(), 'logoPath' => $this->defaults->getLogo(),
@ -80,10 +79,11 @@ class Personal implements ISettings {
* @since 9.1 * @since 9.1
*/ */
public function getSection() { public function getSection() {
if (!$this->federatedShareProvider->isOutgoingServer2serverShareEnabled()) { if ($this->federatedShareProvider->isIncomingServer2serverShareEnabled() ||
return null; $this->federatedShareProvider->isIncomingServer2serverGroupShareEnabled()) {
return 'sharing';
} }
return 'sharing'; return null;
} }
/** /**

View File

@ -5,57 +5,56 @@ script('federatedfilesharing', 'settings-personal');
style('federatedfilesharing', 'settings-personal'); style('federatedfilesharing', 'settings-personal');
?> ?>
<?php if ($_['outgoingServer2serverShareEnabled']): ?> <div id="fileSharingSettings" class="section">
<div id="fileSharingSettings" class="section"> <h2 data-anchor-name="federated-cloud"><?php p($l->t('Federated Cloud')); ?></h2>
<h2 data-anchor-name="federated-cloud"><?php p($l->t('Federated Cloud')); ?></h2> <a target="_blank" rel="noreferrer noopener" class="icon-info svg"
<a target="_blank" rel="noreferrer noopener" class="icon-info svg" title="<?php p($l->t('Open documentation'));?>"
title="<?php p($l->t('Open documentation'));?>" href="<?php p(link_to_docs('user-sharing-federated')); ?>"></a>
href="<?php p(link_to_docs('user-sharing-federated')); ?>"></a> <p class="settings-hint"><?php p($l->t('You can share with anyone who uses a Nextcloud server or other Open Cloud Mesh (OCM) compatible servers and services! Just put their Federated Cloud ID in the share dialog. It looks like person@cloud.example.com')); ?></p>
<p class="settings-hint"><?php p($l->t('You can share with anyone who uses a Nextcloud server or other Open Cloud Mesh (OCM) compatible servers and services! Just put their Federated Cloud ID in the share dialog. It looks like person@cloud.example.com')); ?></p>
<p> <p>
<?php p($l->t('Your Federated Cloud ID:')); ?> <?php p($l->t('Your Federated Cloud ID:')); ?>
<strong id="cloudid"><?php p($_['cloudId']); ?></strong> <strong id="cloudid"><?php p($_['cloudId']); ?></strong>
<a class="clipboardButton icon icon-clippy" data-clipboard-target="#cloudid"></a> <a class="clipboardButton icon icon-clippy" data-clipboard-target="#cloudid"></a>
</p> </p>
<br> <br>
<p> <p>
<?php p($l->t('Share it so your friends can share files with you:')); ?><br> <?php p($l->t('Share it so your friends can share files with you:')); ?><br>
<button class="social-facebook pop-up" <button class="social-facebook pop-up"
data-url='https://www.facebook.com/sharer/sharer.php?u=<?php p(urlencode($_['reference'])); ?>'> data-url='https://www.facebook.com/sharer/sharer.php?u=<?php p(urlencode($_['reference'])); ?>'>
Facebook Facebook
</button> </button>
<button class="social-twitter pop-up" <button class="social-twitter pop-up"
data-url='https://twitter.com/intent/tweet?text=<?php p(urlencode($_['message_with_URL'])); ?>'> data-url='https://twitter.com/intent/tweet?text=<?php p(urlencode($_['message_with_URL'])); ?>'>
Twitter Twitter
</button> </button>
<button class="social-diaspora pop-up" <button class="social-diaspora pop-up"
data-url='https://sharetodiaspora.github.io/?title=<?php p($_['message_without_URL']); ?>&url=<?php p(urlencode($_['reference'])); ?>'> data-url='https://sharetodiaspora.github.io/?title=<?php p($_['message_without_URL']); ?>&url=<?php p(urlencode($_['reference'])); ?>'>
Diaspora Diaspora
</button> </button>
<button id="oca-files-sharing-add-to-your-website"> <button id="oca-files-sharing-add-to-your-website">
<?php p($l->t('Add to your website')) ?> <?php p($l->t('Add to your website')) ?>
</button> </button>
</p> </p>
<div class="hidden" id="oca-files-sharing-add-to-your-website-expanded"> <div class="hidden" id="oca-files-sharing-add-to-your-website-expanded">
<p style="margin: 10px 0"> <p style="margin: 10px 0">
<a target="_blank" rel="noreferrer noopener" href="<?php p($_['reference']); ?>" <a target="_blank" rel="noreferrer noopener" href="<?php p($_['reference']); ?>"
style="padding:10px;background-color:<?php p($_['color']); ?>;color:<?php p($_['textColor']); ?>;border-radius:3px;padding-left:4px;"> style="padding:10px;background-color:<?php p($_['color']); ?>;color:<?php p($_['textColor']); ?>;border-radius:3px;padding-left:4px;">
<span style="background-image:url(<?php p(\OC::$server->getURLGenerator()->getAbsoluteURL($_['logoPath'])); ?>);width:50px;height:30px;position:relative;top:8px;background-size:contain;display:inline-block;background-repeat:no-repeat; background-position: center center;"></span> <span style="background-image:url(<?php p(\OC::$server->getURLGenerator()->getAbsoluteURL($_['logoPath'])); ?>);width:50px;height:30px;position:relative;top:8px;background-size:contain;display:inline-block;background-repeat:no-repeat; background-position: center center;"></span>
<?php p($l->t('Share with me via Nextcloud')); ?> <?php p($l->t('Share with me via Nextcloud')); ?>
</a> </a>
</p> </p>
<p> <p>
<?php p($l->t('HTML Code:')); ?> <?php p($l->t('HTML Code:')); ?>
<xmp><a target="_blank" rel="noreferrer noopener" href="<?php p($_['reference']); ?>" style="padding:10px;background-color:<?php p($_['color']); ?>;color:<?php p($_['textColor']); ?>;border-radius:3px;padding-left:4px;"> <xmp><a target="_blank" rel="noreferrer noopener" href="<?php p($_['reference']); ?>" style="padding:10px;background-color:<?php p($_['color']); ?>;color:<?php p($_['textColor']); ?>;border-radius:3px;padding-left:4px;">
<span style="background-image:url(<?php p(\OC::$server->getURLGenerator()->getAbsoluteURL($_['logoPath'])); ?>);width:50px;height:30px;position:relative;top:8px;background-size:contain;display:inline-block;background-repeat:no-repeat; background-position: center center;"></span> <span style="background-image:url(<?php p(\OC::$server->getURLGenerator()->getAbsoluteURL($_['logoPath'])); ?>);width:50px;height:30px;position:relative;top:8px;background-size:contain;display:inline-block;background-repeat:no-repeat; background-position: center center;"></span>
<?php p($l->t('Share with me via Nextcloud')); ?></a></xmp> <?php p($l->t('Share with me via Nextcloud')); ?></a></xmp>
</p> </p>
</div>
</div> </div>
<?php endif; ?>
</div>