aboutsummaryrefslogtreecommitdiffstats
path: root/core
diff options
context:
space:
mode:
authorLukas Reschke <lukas@statuscode.ch>2016-06-10 18:29:09 +0200
committerGitHub <noreply@github.com>2016-06-10 18:29:09 +0200
commit842cc2a7889d1ff8004fddd2546aec1232e0eaed (patch)
treee309a759b4ebee9ab9fa32d839d8ebb819c145f6 /core
parent74580daa23016fab370b2f6c14d82401032733cb (diff)
parent54e2ac57130666add0ad5d3c583c6f29527b4ebc (diff)
downloadnextcloud-server-842cc2a7889d1ff8004fddd2546aec1232e0eaed.tar.gz
nextcloud-server-842cc2a7889d1ff8004fddd2546aec1232e0eaed.zip
Merge pull request #19 from nextcloud/files-drop
add "hide file list" option
Diffstat (limited to 'core')
-rw-r--r--core/Controller/AvatarController.php3
-rw-r--r--core/js/share.js1
-rw-r--r--core/js/sharedialoglinkshareview.js39
-rw-r--r--core/js/shareitemmodel.js20
4 files changed, 59 insertions, 4 deletions
diff --git a/core/Controller/AvatarController.php b/core/Controller/AvatarController.php
index 1bff58cfc4e..788125f0cfe 100644
--- a/core/Controller/AvatarController.php
+++ b/core/Controller/AvatarController.php
@@ -85,7 +85,7 @@ class AvatarController extends Controller {
IL10N $l10n,
IUserManager $userManager,
IUserSession $userSession,
- Folder $userFolder,
+ Folder $userFolder = null,
ILogger $logger) {
parent::__construct($appName, $request);
@@ -101,6 +101,7 @@ class AvatarController extends Controller {
/**
* @NoAdminRequired
* @NoCSRFRequired
+ * @PublicPage
*
* @param string $userId
* @param int $size
diff --git a/core/js/share.js b/core/js/share.js
index 61483f4cf4d..cd399dd3cee 100644
--- a/core/js/share.js
+++ b/core/js/share.js
@@ -442,7 +442,6 @@ OC.Share = _.extend(OC.Share || {}, {
});
$(document).ready(function() {
-
if(typeof monthNames != 'undefined'){
// min date should always be the next day
var minDate = new Date();
diff --git a/core/js/sharedialoglinkshareview.js b/core/js/sharedialoglinkshareview.js
index 817c3408e7e..9b5a2c93c04 100644
--- a/core/js/sharedialoglinkshareview.js
+++ b/core/js/sharedialoglinkshareview.js
@@ -30,7 +30,14 @@
' <input type="checkbox" value="1" name="allowPublicUpload" id="sharingDialogAllowPublicUpload-{{cid}}" class="checkbox publicUploadCheckbox" {{{publicUploadChecked}}} />' +
'<label for="sharingDialogAllowPublicUpload-{{cid}}">{{publicUploadLabel}}</label>' +
'</div>' +
- ' {{/if}}' +
+ '{{#if hideFileList}}' +
+ '<div id="hideFileListWrapper">' +
+ ' <span class="icon-loading-small hidden"></span>' +
+ ' <input type="checkbox" value="1" name="hideFileList" id="sharingDialogHideFileList-{{cid}}" class="checkbox hideFileListCheckbox" {{{hideFileListChecked}}} />' +
+ '<label for="sharingDialogHideFileList-{{cid}}">{{hideFileListLabel}}</label>' +
+ '</div>' +
+ '{{/if}}' +
+ ' {{/if}}' +
' {{#if showPasswordCheckBox}}' +
'<input type="checkbox" name="showPassword" id="showPassword-{{cid}}" class="checkbox showPasswordCheckbox" {{#if isPasswordSet}}checked="checked"{{/if}} value="1" />' +
'<label for="showPassword-{{cid}}">{{enablePasswordLabel}}</label>' +
@@ -75,6 +82,7 @@
'click .linkCheckbox': 'onLinkCheckBoxChange',
'click .linkText': 'onLinkTextClick',
'change .publicUploadCheckbox': 'onAllowPublicUploadChange',
+ 'change .hideFileListCheckbox': 'onHideFileListChange',
'click .showPasswordCheckbox': 'onShowPasswordClick'
},
@@ -93,6 +101,10 @@
view.render();
});
+ this.model.on('change:hideFileListStatus', function() {
+ view.render();
+ });
+
this.model.on('change:linkShare', function() {
view.render();
});
@@ -110,6 +122,7 @@
'onPasswordKeyUp',
'onLinkTextClick',
'onShowPasswordClick',
+ 'onHideFileListChange',
'onAllowPublicUploadChange'
);
},
@@ -210,6 +223,20 @@
});
},
+ onHideFileListChange: function () {
+ var $checkbox = this.$('.hideFileListCheckbox');
+ $checkbox.siblings('.icon-loading-small').removeClass('hidden').addClass('inlineblock');
+
+ var permissions = OC.PERMISSION_UPDATE | OC.PERMISSION_CREATE | OC.PERMISSION_READ;
+ if ($checkbox.is(':checked')) {
+ permissions = OC.PERMISSION_UPDATE | OC.PERMISSION_CREATE;
+ }
+
+ this.model.saveLinkShare({
+ permissions: permissions
+ });
+ },
+
render: function() {
var linkShareTemplate = this.template();
var resharingAllowed = this.model.sharePermissionPossible();
@@ -237,6 +264,13 @@
publicUploadChecked = 'checked="checked"';
}
+ var hideFileList = publicUploadChecked;
+
+ var hideFileListChecked = '';
+ if(this.model.isHideFileListSet()) {
+ hideFileListChecked = 'checked="checked"';
+ }
+
var isLinkShare = this.model.get('linkShare').isLinkShare;
var isPasswordSet = !!this.model.get('linkShare').password;
var showPasswordCheckBox = isLinkShare
@@ -246,6 +280,7 @@
this.$el.html(linkShareTemplate({
cid: this.cid,
shareAllowed: true,
+ hideFileList: hideFileList,
isLinkShare: isLinkShare,
shareLinkURL: this.model.get('linkShare').link,
linkShareLabel: t('core', 'Share link'),
@@ -257,7 +292,9 @@
showPasswordCheckBox: showPasswordCheckBox,
publicUpload: publicUpload && isLinkShare,
publicUploadChecked: publicUploadChecked,
+ hideFileListChecked: hideFileListChecked,
publicUploadLabel: t('core', 'Allow editing'),
+ hideFileListLabel: t('core', 'Hide file listing'),
mailPublicNotificationEnabled: isLinkShare && this.configModel.isMailPublicNotificationEnabled(),
mailPrivatePlaceholder: t('core', 'Email link to person'),
mailButtonText: t('core', 'Send')
diff --git a/core/js/shareitemmodel.js b/core/js/shareitemmodel.js
index 3ced66a1a78..56ed3f0039b 100644
--- a/core/js/shareitemmodel.js
+++ b/core/js/shareitemmodel.js
@@ -275,6 +275,13 @@
/**
* @returns {boolean}
*/
+ isHideFileListSet: function() {
+ return this.get('hideFileListStatus');
+ },
+
+ /**
+ * @returns {boolean}
+ */
isFolder: function() {
return this.get('itemType') === 'folder';
},
@@ -685,6 +692,16 @@
});
}
+ var hideFileListStatus = false;
+ if(!_.isUndefined(data.shares)) {
+ $.each(data.shares, function (key, value) {
+ if (value.share_type === OC.Share.SHARE_TYPE_LINK) {
+ hideFileListStatus = (value.permissions & OC.PERMISSION_READ) ? false : true;
+ return true;
+ }
+ });
+ }
+
/** @type {OC.Share.Types.ShareInfo[]} **/
var shares = _.map(data.shares, function(share) {
// properly parse some values because sometimes the server
@@ -757,7 +774,8 @@
shares: shares,
linkShare: linkShare,
permissions: permissions,
- allowPublicUploadStatus: allowPublicUploadStatus
+ allowPublicUploadStatus: allowPublicUploadStatus,
+ hideFileListStatus: hideFileListStatus
};
},