aboutsummaryrefslogtreecommitdiffstats
path: root/apps/files_sharing
diff options
context:
space:
mode:
authorMorris Jobke <hey@morrisjobke.de>2018-04-06 13:16:26 +0200
committerGitHub <noreply@github.com>2018-04-06 13:16:26 +0200
commit2a2ab1b871d3b262c9d17a0ebb12e10d12c1e9f2 (patch)
tree56b7caf2d54851f61cd8fab2be512f2507ed7c76 /apps/files_sharing
parent4a6e31c91dcbdc2cfd2cae44bf64243c5005fa13 (diff)
parent5598d30ef1bf1f4b4dc763b9528cf8bc2b6e34ed (diff)
downloadnextcloud-server-2a2ab1b871d3b262c9d17a0ebb12e10d12c1e9f2.tar.gz
nextcloud-server-2a2ab1b871d3b262c9d17a0ebb12e10d12c1e9f2.zip
Merge pull request #9084 from nextcloud/public-page-template-extend
Public page template enhancements
Diffstat (limited to 'apps/files_sharing')
-rw-r--r--apps/files_sharing/composer/composer/autoload_classmap.php2
-rw-r--r--apps/files_sharing/composer/composer/autoload_static.php2
-rw-r--r--apps/files_sharing/css/mobile.scss4
-rw-r--r--apps/files_sharing/css/public.scss14
-rw-r--r--apps/files_sharing/js/public.js38
-rw-r--r--apps/files_sharing/lib/Controller/ShareController.php4
-rw-r--r--apps/files_sharing/lib/Template/ExternalShareMenuAction.php72
-rw-r--r--apps/files_sharing/lib/Template/LinkMenuAction.php58
-rw-r--r--apps/files_sharing/templates/public.php8
-rw-r--r--apps/files_sharing/tests/Controller/ShareControllerTest.php4
10 files changed, 16 insertions, 190 deletions
diff --git a/apps/files_sharing/composer/composer/autoload_classmap.php b/apps/files_sharing/composer/composer/autoload_classmap.php
index 0388c7990ec..a68db3421b6 100644
--- a/apps/files_sharing/composer/composer/autoload_classmap.php
+++ b/apps/files_sharing/composer/composer/autoload_classmap.php
@@ -53,7 +53,5 @@ return array(
'OCA\\Files_Sharing\\ShareBackend\\Folder' => $baseDir . '/../lib/ShareBackend/Folder.php',
'OCA\\Files_Sharing\\SharedMount' => $baseDir . '/../lib/SharedMount.php',
'OCA\\Files_Sharing\\SharedStorage' => $baseDir . '/../lib/SharedStorage.php',
- 'OCA\\Files_Sharing\\Template\\ExternalShareMenuAction' => $baseDir . '/../lib/Template/ExternalShareMenuAction.php',
- 'OCA\\Files_Sharing\\Template\\LinkMenuAction' => $baseDir . '/../lib/Template/LinkMenuAction.php',
'OCA\\Files_Sharing\\Updater' => $baseDir . '/../lib/Updater.php',
);
diff --git a/apps/files_sharing/composer/composer/autoload_static.php b/apps/files_sharing/composer/composer/autoload_static.php
index dd75dbaa18a..328d6aca01d 100644
--- a/apps/files_sharing/composer/composer/autoload_static.php
+++ b/apps/files_sharing/composer/composer/autoload_static.php
@@ -68,8 +68,6 @@ class ComposerStaticInitFiles_Sharing
'OCA\\Files_Sharing\\ShareBackend\\Folder' => __DIR__ . '/..' . '/../lib/ShareBackend/Folder.php',
'OCA\\Files_Sharing\\SharedMount' => __DIR__ . '/..' . '/../lib/SharedMount.php',
'OCA\\Files_Sharing\\SharedStorage' => __DIR__ . '/..' . '/../lib/SharedStorage.php',
- 'OCA\\Files_Sharing\\Template\\ExternalShareMenuAction' => __DIR__ . '/..' . '/../lib/Template/ExternalShareMenuAction.php',
- 'OCA\\Files_Sharing\\Template\\LinkMenuAction' => __DIR__ . '/..' . '/../lib/Template/LinkMenuAction.php',
'OCA\\Files_Sharing\\Updater' => __DIR__ . '/..' . '/../lib/Updater.php',
);
diff --git a/apps/files_sharing/css/mobile.scss b/apps/files_sharing/css/mobile.scss
index 56f57d53263..272dbbc0c34 100644
--- a/apps/files_sharing/css/mobile.scss
+++ b/apps/files_sharing/css/mobile.scss
@@ -46,10 +46,6 @@ table td.filename .nametext {
text-overflow: ellipsis;
}
-// Hide Download label of 3-dot-menu on public share pages
-.share-menutoggle-text {
- display: none;
-}
#header .menutoggle {
padding-right: 14px;
background-position: center;
diff --git a/apps/files_sharing/css/public.scss b/apps/files_sharing/css/public.scss
index cc3788884e7..277814207b3 100644
--- a/apps/files_sharing/css/public.scss
+++ b/apps/files_sharing/css/public.scss
@@ -1,13 +1,3 @@
-#content {
- height: initial;
- min-height: calc(100vh - 160px);
-}
-
-/* force layout to make sure the content element's height matches its contents' height */
-.ie #content {
- display: inline-block;
-}
-
#preview {
background: #fff;
text-align: center;
@@ -105,10 +95,6 @@ thead {
border-color: rgba(0,0,0,0.3) !important;
}
-#share-menu input[type='text'] {
- width: 200px;
-}
-
#public-upload .avatardiv {
margin: 0 auto;
}
diff --git a/apps/files_sharing/js/public.js b/apps/files_sharing/js/public.js
index 4b3ede24389..33d8da09166 100644
--- a/apps/files_sharing/js/public.js
+++ b/apps/files_sharing/js/public.js
@@ -263,15 +263,15 @@ OCA.Sharing.PublicApp = {
var remote = $(this).find('#remote_address').val();
var token = $('#sharingToken').val();
- var owner = $('#save').data('owner');
- var ownerDisplayName = $('#save').data('owner-display-name');
- var name = $('#save').data('name');
- var isProtected = $('#save').data('protected') ? 1 : 0;
+ var owner = $('#save-external-share').data('owner');
+ var ownerDisplayName = $('#save-external-share').data('owner-display-name');
+ var name = $('#save-external-share').data('name');
+ var isProtected = $('#save-external-share').data('protected') ? 1 : 0;
OCA.Sharing.PublicApp._createFederatedShare(remote, token, owner, ownerDisplayName, name, isProtected);
});
$('#remote_address').on("keyup paste", function() {
- if ($(this).val() === '' || $('#save > .icon.icon-loading-small').length > 0) {
+ if ($(this).val() === '' || $('#save-external-share > .icon.icon-loading-small').length > 0) {
$('#save-button-confirm').prop('disabled', true);
} else {
$('#save-button-confirm').prop('disabled', false);
@@ -352,18 +352,18 @@ OCA.Sharing.PublicApp = {
},
_toggleLoading: function() {
- var loading = $('#save > .icon.icon-loading-small').length === 0;
+ var loading = $('#save-external-share > .icon.icon-loading-small').length === 0;
if (loading) {
- $('#save > .icon-external')
+ $('#save-external-share > .icon-external')
.removeClass("icon-external")
.addClass("icon-loading-small");
- $('#save #save-button-confirm').prop("disabled", true);
+ $('#save-external-share #save-button-confirm').prop("disabled", true);
} else {
- $('#save > .icon-loading-small')
+ $('#save-external-share > .icon-loading-small')
.addClass("icon-external")
.removeClass("icon-loading-small");
- $('#save #save-button-confirm').prop("disabled", false);
+ $('#save-external-share #save-button-confirm').prop("disabled", false);
}
},
@@ -423,20 +423,4 @@ $(document).ready(function () {
};
}
- $('#share-menutoggle').click(function() {
- $('#share-menu').toggleClass('open');
- });
-});
-
-
-$(document).mouseup(function(e) {
- var toggle = $('#share-menutoggle');
- var container = $('#share-menu');
-
- // if the target of the click isn't the menu toggle, nor a descendant of the
- // menu toggle, nor the container nor a descendant of the container
- if (!toggle.is(e.target) && toggle.has(e.target).length === 0 &&
- !container.is(e.target) && container.has(e.target).length === 0) {
- container.removeClass('open');
- }
-});
+}); \ No newline at end of file
diff --git a/apps/files_sharing/lib/Controller/ShareController.php b/apps/files_sharing/lib/Controller/ShareController.php
index f793d35e3ae..a196f552f6e 100644
--- a/apps/files_sharing/lib/Controller/ShareController.php
+++ b/apps/files_sharing/lib/Controller/ShareController.php
@@ -38,9 +38,9 @@ namespace OCA\Files_Sharing\Controller;
use OC_Files;
use OC_Util;
use OCA\FederatedFileSharing\FederatedShareProvider;
-use OCA\Files_Sharing\Template\ExternalShareMenuAction;
-use OCA\Files_Sharing\Template\LinkMenuAction;
use OCP\AppFramework\Http\Template\SimpleMenuAction;
+use OCP\AppFramework\Http\Template\ExternalShareMenuAction;
+use OCP\AppFramework\Http\Template\LinkMenuAction;
use OCP\AppFramework\Http\Template\PublicTemplateResponse;
use OCP\Defaults;
use OCP\IL10N;
diff --git a/apps/files_sharing/lib/Template/ExternalShareMenuAction.php b/apps/files_sharing/lib/Template/ExternalShareMenuAction.php
deleted file mode 100644
index e30a77cb2e6..00000000000
--- a/apps/files_sharing/lib/Template/ExternalShareMenuAction.php
+++ /dev/null
@@ -1,72 +0,0 @@
-<?php
-/**
- * @copyright Copyright (c) 2018 Julius Härtl <jus@bitgrid.net>
- *
- * @author Julius Härtl <jus@bitgrid.net>
- *
- * @license GNU AGPL version 3 or any later version
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License as
- * published by the Free Software Foundation, either version 3 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Affero General Public License for more details.
- *
- * You should have received a copy of the GNU Affero General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
- *
- */
-
-namespace OCA\Files_Sharing\Template;
-
-use OCP\AppFramework\Http\Template\SimpleMenuAction;
-use OCP\Util;
-
-class ExternalShareMenuAction extends SimpleMenuAction {
-
- /** @var string */
- private $owner;
-
- /** @var string */
- private $displayname;
-
- /** @var string */
- private $shareName;
-
- /**
- * ExternalShareMenuAction constructor.
- *
- * @param string $label
- * @param string $icon
- * @param string $owner
- * @param string $displayname
- * @param string $shareName
- */
- public function __construct(string $label, string $icon, string $owner, string $displayname, string $shareName) {
- parent::__construct('save', $label, $icon);
- $this->owner = $owner;
- $this->displayname = $displayname;
- $this->shareName = $shareName;
- }
-
- public function render(): string {
- return '<li>' .
- '<a id="save" data-protected="false" data-owner-display-name="' . Util::sanitizeHTML($this->displayname) . '" data-owner="' . Util::sanitizeHTML($this->owner) . '" data-name="' . Util::sanitizeHTML($this->shareName) . '">' .
- '<span class="icon ' . Util::sanitizeHTML($this->getIcon()) . '"></span>' .
- '<label for="remote_address">' . Util::sanitizeHTML($this->getLabel()) . '</label>' .
- '</a>' .
- '</li>' .
- '<li>' .
- '<span class="menuitem">' .
- '<form class="save-form" action="#">' .
- '<input type="text" id="remote_address" placeholder="user@yourNextcloud.org">' .
- '<input type="submit" value=" " id="save-button-confirm" class="icon-confirm" disabled="disabled"></button>' .
- '</form>' .
- '</span>' .
- '</li>';
- }
-}
diff --git a/apps/files_sharing/lib/Template/LinkMenuAction.php b/apps/files_sharing/lib/Template/LinkMenuAction.php
deleted file mode 100644
index 519bc553228..00000000000
--- a/apps/files_sharing/lib/Template/LinkMenuAction.php
+++ /dev/null
@@ -1,58 +0,0 @@
-<?php
-/**
- * @copyright Copyright (c) 2018 Julius Härtl <jus@bitgrid.net>
- *
- * @author Julius Härtl <jus@bitgrid.net>
- *
- * @license GNU AGPL version 3 or any later version
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License as
- * published by the Free Software Foundation, either version 3 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Affero General Public License for more details.
- *
- * You should have received a copy of the GNU Affero General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
- *
- */
-
-namespace OCA\Files_Sharing\Template;
-
-use OCP\AppFramework\Http\Template\SimpleMenuAction;
-use OCP\Util;
-
-class LinkMenuAction extends SimpleMenuAction {
-
- /**
- * LinkMenuAction constructor.
- *
- * @param string $label
- * @param string $icon
- * @param string $link
- */
- public function __construct(string $label, string $icon, string $link) {
- parent::__construct('directLink-container', $label, $icon, $link);
- }
-
- /**
- * @return string
- */
- public function render(): string {
- return '<li>' .
- '<a id="directLink-container">' .
- '<span class="icon ' . Util::sanitizeHTML($this->getIcon()) . '"></span>' .
- '<label for="directLink">' . Util::sanitizeHTML($this->getLabel()) . '</label>' .
- '</a>' .
- '</li>' .
- '<li>' .
- '<span class="menuitem">' .
- '<input id="directLink" type="text" readonly="" value="' . Util::sanitizeHTML($this->getLink()) . '">' .
- '</span>' .
- '</li>';
- }
-}
diff --git a/apps/files_sharing/templates/public.php b/apps/files_sharing/templates/public.php
index e8eb28f25c6..476f0851547 100644
--- a/apps/files_sharing/templates/public.php
+++ b/apps/files_sharing/templates/public.php
@@ -30,7 +30,7 @@ $maxUploadFilesize = min($upload_max_filesize, $post_max_size);
<?php endif; ?>
<input type="hidden" name="maxSizeAnimateGif" value="<?php p($_['maxSizeAnimateGif']); ?>" id="maxSizeAnimateGif">
<?php if (!isset($_['hideFileList']) || (isset($_['hideFileList']) && $_['hideFileList'] === false)) { ?>
- <div id="content">
+ <div id="files-public-content">
<div id="preview">
<?php if (isset($_['folder'])): ?>
<?php print_unescaped($_['folder']); ?>
@@ -84,9 +84,3 @@ $maxUploadFilesize = min($upload_max_filesize, $post_max_size);
data-url="<?php p(\OC::$server->getURLGenerator()->linkTo('files', 'ajax/upload.php')); ?>" />
</div>
<?php endif; ?>
-
-<footer>
- <p class="info">
- <?php print_unescaped($theme->getLongFooter()); ?>
- </p>
-</footer>
diff --git a/apps/files_sharing/tests/Controller/ShareControllerTest.php b/apps/files_sharing/tests/Controller/ShareControllerTest.php
index a977a422e7d..be99c5ee194 100644
--- a/apps/files_sharing/tests/Controller/ShareControllerTest.php
+++ b/apps/files_sharing/tests/Controller/ShareControllerTest.php
@@ -34,9 +34,9 @@ namespace OCA\Files_Sharing\Tests\Controllers;
use OC\Files\Filesystem;
use OCA\FederatedFileSharing\FederatedShareProvider;
use OCA\Files_Sharing\Controller\ShareController;
-use OCA\Files_Sharing\Template\ExternalShareMenuAction;
-use OCA\Files_Sharing\Template\LinkMenuAction;
use OCP\AppFramework\Http\DataResponse;
+use OCP\AppFramework\Http\Template\ExternalShareMenuAction;
+use OCP\AppFramework\Http\Template\LinkMenuAction;
use OCP\AppFramework\Http\Template\PublicTemplateResponse;
use OCP\AppFramework\Http\Template\SimpleMenuAction;
use OCP\IConfig;