From 3a2ca47b9220efd7ac9212e63388b2b0870f0cc9 Mon Sep 17 00:00:00 2001 From: "Jalpreet Singh Nanda (imjalpreet)" Date: Sat, 12 Mar 2016 00:49:53 +0530 Subject: [PATCH] Issue #565: Add the checkbox in the share dialogue to allow uploading from the public side --- controller/pagecontroller.php | 3 +- js/vendor/owncloud/share.js | 109 +++++++++++++++++----------------- templates/part.content.php | 2 +- 3 files changed, 56 insertions(+), 58 deletions(-) diff --git a/controller/pagecontroller.php b/controller/pagecontroller.php index 186f31796e..c79cff39d6 100644 --- a/controller/pagecontroller.php +++ b/controller/pagecontroller.php @@ -84,7 +84,8 @@ public function index() { // Parameters sent to the template $params = [ 'appName' => $appName, - 'uploadUrl' => $this->urlGenerator->linkTo('files', 'ajax/upload.php') + 'uploadUrl' => $this->urlGenerator->linkTo('files', 'ajax/upload.php'), + 'publicUploadEnabled' => $this->appConfig->getAppValue('core', 'shareapi_allow_public_upload', 'yes') ]; // Will render the page using the template found in templates/index.php diff --git a/js/vendor/owncloud/share.js b/js/vendor/owncloud/share.js index 4c1d49bc98..7776b85a1e 100644 --- a/js/vendor/owncloud/share.js +++ b/js/vendor/owncloud/share.js @@ -173,20 +173,19 @@ // Used later on to determine if the // respective checkbox should be checked or // not. - // FIXME public uploading is not supported in Gallery - /*var publicUploadEnabled = $('#filestable').data('allow-public-upload'); - if (typeof publicUploadEnabled == 'undefined') { - publicUploadEnabled = 'no'; - } - var allowPublicUploadStatus = false; + var publicUploadEnabled = $('#gallery').data('allow-public-upload'); + if (typeof publicUploadEnabled == 'undefined') { + publicUploadEnabled = 'no'; + } + var allowPublicUploadStatus = false; - $.each(data, function (key, value) { - if (value.share_type === self.SHARE_TYPE_LINK) { - allowPublicUploadStatus = - (value.permissions & OC.PERMISSION_CREATE) ? true : false; - return true; - } - });*/ + $.each(data, function (key, value) { + if (value.share_type === self.SHARE_TYPE_LINK) { + allowPublicUploadStatus = + (value.permissions & OC.PERMISSION_CREATE) ? true : false; + return true; + } + }); var sharePlaceholder = t('core', 'Share with users or groups …'); if (oc_appconfig.core.remoteShareAllowed) { @@ -244,20 +243,18 @@ html += ''; html += ''; - // FIXME public uploading is not supported in Gallery - /*if (itemType === 'folder' && (possiblePermissions & OC.PERMISSION_CREATE) && - publicUploadEnabled === 'yes') { - html += ''; - } - html += ''; - var mailPublicNotificationEnabled = $( + if (itemType === 'folder' && (possiblePermissions & OC.PERMISSION_CREATE) && + publicUploadEnabled === 'yes') { + html += ''; + } + /*var mailPublicNotificationEnabled = $( 'input:hidden[name=mailPublicNotificationEnabled]').val(); if (mailPublicNotificationEnabled === 'yes') { html += '