summaryrefslogtreecommitdiffstats
path: root/apps
diff options
context:
space:
mode:
Diffstat (limited to 'apps')
-rw-r--r--apps/files_sharing/lib/Controllers/ShareController.php23
-rw-r--r--apps/files_sharing/templates/public.php20
2 files changed, 23 insertions, 20 deletions
diff --git a/apps/files_sharing/lib/Controllers/ShareController.php b/apps/files_sharing/lib/Controllers/ShareController.php
index 11359e5f2f2..124d633b99f 100644
--- a/apps/files_sharing/lib/Controllers/ShareController.php
+++ b/apps/files_sharing/lib/Controllers/ShareController.php
@@ -353,6 +353,29 @@ class ShareController extends Controller {
$shareTmpl['previewMaxX'] = $this->config->getSystemValue('preview_max_x', 1024);
$shareTmpl['previewMaxY'] = $this->config->getSystemValue('preview_max_y', 1024);
+ // Load files we need
+ OCP\Util::addScript('files', 'file-upload');
+ OCP\Util::addStyle('files_sharing', 'public');
+ OCP\Util::addStyle('files_sharing', 'mobile');
+ OCP\Util::addScript('files_sharing', 'public');
+ OCP\Util::addScript('files', 'fileactions');
+ OCP\Util::addScript('files', 'fileactionsmenu');
+ OCP\Util::addScript('files', 'jquery.fileupload');
+ OCP\Util::addScript('files_sharing', 'files_drop');
+
+ if (isset($shareTmpl['folder'])) {
+ // JS required for folders
+ OCP\Util::addStyle('files', 'files');
+ OCP\Util::addStyle('files', 'upload');
+ OCP\Util::addScript('files', 'filesummary');
+ OCP\Util::addScript('files', 'breadcrumb');
+ OCP\Util::addScript('files', 'fileinfomodel');
+ OCP\Util::addScript('files', 'newfilemenu');
+ OCP\Util::addScript('files', 'files');
+ OCP\Util::addScript('files', 'filelist');
+ OCP\Util::addscript('files', 'keyboardshortcuts');
+ }
+
$csp = new OCP\AppFramework\Http\ContentSecurityPolicy();
$csp->addAllowedFrameDomain('\'self\'');
$response = new TemplateResponse($this->appName, 'public', $shareTmpl, 'base');
diff --git a/apps/files_sharing/templates/public.php b/apps/files_sharing/templates/public.php
index 8a906f02a7e..f587b5109d4 100644
--- a/apps/files_sharing/templates/public.php
+++ b/apps/files_sharing/templates/public.php
@@ -1,26 +1,6 @@
<?php
/** @var $l OC_L10N */
/** @var $_ array */
-
-OCP\Util::addScript('files', 'file-upload');
-OCP\Util::addStyle('files_sharing', 'public');
-OCP\Util::addStyle('files_sharing', 'mobile');
-OCP\Util::addScript('files_sharing', 'public');
-OCP\Util::addScript('files', 'fileactions');
-OCP\Util::addScript('files', 'fileactionsmenu');
-OCP\Util::addScript('files', 'jquery.fileupload');
-OCP\Util::addScript('files_sharing', 'files_drop');
-
-// JS required for folders
-OCP\Util::addStyle('files', 'files');
-OCP\Util::addStyle('files', 'upload');
-OCP\Util::addScript('files', 'filesummary');
-OCP\Util::addScript('files', 'breadcrumb');
-OCP\Util::addScript('files', 'fileinfomodel');
-OCP\Util::addScript('files', 'newfilemenu');
-OCP\Util::addScript('files', 'files');
-OCP\Util::addScript('files', 'filelist');
-OCP\Util::addscript('files', 'keyboardshortcuts');
?>
<?php if ($_['previewSupported']): /* This enables preview images for links (e.g. on Facebook, Google+, ...)*/?>