summaryrefslogtreecommitdiffstats
path: root/apps
diff options
context:
space:
mode:
authorRoeland Jago Douma <roeland@famdouma.nl>2016-07-15 14:39:57 +0200
committerRoeland Jago Douma <roeland@famdouma.nl>2016-07-18 13:34:32 +0200
commitea3035aa0e2d4b58532a127c7f3dbe0b41470a33 (patch)
treefb9c082be4a2b01f99c84155e2511baae332c1e8 /apps
parent3e00edff990a9255f6e71b08f1e5ff43b4e3a95c (diff)
downloadnextcloud-server-ea3035aa0e2d4b58532a127c7f3dbe0b41470a33.tar.gz
nextcloud-server-ea3035aa0e2d4b58532a127c7f3dbe0b41470a33.zip
Move JS inclusion to Controller
* This way we can easier load files conditionally
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+, ...)*/?>