summaryrefslogtreecommitdiffstats
path: root/core/js
diff options
context:
space:
mode:
authorJoas Schilling <coding@schilljs.com>2016-11-02 11:04:33 +0100
committerGitHub <noreply@github.com>2016-11-02 11:04:33 +0100
commit7da3ba3f91f561da664fc601b29cd7948f876f3f (patch)
tree8e320070d69622432fdf8ab641b36b160a901533 /core/js
parent42b0a0d2afe95b974545436e112a1d97edaeeb1a (diff)
parentf2b2b8d8940b2487d7f9f3a3a304a6a95d145fd2 (diff)
downloadnextcloud-server-7da3ba3f91f561da664fc601b29cd7948f876f3f.tar.gz
nextcloud-server-7da3ba3f91f561da664fc601b29cd7948f876f3f.zip
Merge pull request #657 from nextcloud/share-by-mail
New share provider: Share by mail
Diffstat (limited to 'core/js')
-rw-r--r--core/js/shareconfigmodel.js1
-rw-r--r--core/js/sharedialogshareelistview.js29
-rw-r--r--core/js/sharedialogview.js63
3 files changed, 69 insertions, 24 deletions
diff --git a/core/js/shareconfigmodel.js b/core/js/shareconfigmodel.js
index b04c2acae16..24922d62636 100644
--- a/core/js/shareconfigmodel.js
+++ b/core/js/shareconfigmodel.js
@@ -25,6 +25,7 @@
isDefaultExpireDateEnforced: oc_appconfig.core.defaultExpireDateEnforced === true,
isDefaultExpireDateEnabled: oc_appconfig.core.defaultExpireDateEnabled === true,
isRemoteShareAllowed: oc_appconfig.core.remoteShareAllowed,
+ isMailShareAllowed: oc_appconfig.shareByMailEnabled !== undefined,
defaultExpireDate: oc_appconfig.core.defaultExpireDate,
isResharingAllowed: oc_appconfig.core.resharingAllowed,
allowGroupSharing: oc_appconfig.core.allowGroupSharing
diff --git a/core/js/sharedialogshareelistview.js b/core/js/sharedialogshareelistview.js
index 66ed85eda33..775eaa554b0 100644
--- a/core/js/sharedialogshareelistview.js
+++ b/core/js/sharedialogshareelistview.js
@@ -24,25 +24,28 @@
'{{#if avatarEnabled}}' +
'<div class="avatar {{#if modSeed}}imageplaceholderseed{{/if}}" data-username="{{shareWith}}" {{#if modSeed}}data-seed="{{shareWith}} {{shareType}}"{{/if}}></div>' +
'{{/if}}' +
- '<span class="has-tooltip username" title="{{shareWith}}">{{shareWithDisplayName}}</span>' +
+ '<span class="has-tooltip username" title="{{shareWithTitle}}">{{shareWithDisplayName}}</span>' +
'<span class="sharingOptionsGroup">' +
'{{#if editPermissionPossible}}' +
+ '{{#unless isFileSharedByMail}}' +
'<span class="shareOption">' +
'<input id="canEdit-{{cid}}-{{shareWith}}" type="checkbox" name="edit" class="permissions checkbox" {{#if hasEditPermission}}checked="checked"{{/if}} />' +
'<label for="canEdit-{{cid}}-{{shareWith}}">{{canEditLabel}}</label>' +
'</span>' +
+ '{{/unless}}' +
'{{/if}}' +
+ '{{#unless isMailShare}}' +
'<a href="#"><span class="icon icon-more"></span></a>' +
'<div class="popovermenu bubble hidden menu">' +
'<ul>' +
- '{{#if isResharingAllowed}} {{#if sharePermissionPossible}}' +
+ '{{#if isResharingAllowed}} {{#if sharePermissionPossible}} {{#unless isMailShare}}' +
'<li>' +
'<span class="shareOption">' +
'<input id="canShare-{{cid}}-{{shareWith}}" type="checkbox" name="share" class="permissions checkbox" {{#if hasSharePermission}}checked="checked"{{/if}} data-permissions="{{sharePermission}}" />' +
'<label for="canShare-{{cid}}-{{shareWith}}">{{canShareLabel}}</label>' +
'</span>' +
'</li>' +
- '{{/if}} {{/if}}' +
+ '{{/unless}} {{/if}} {{/if}}' +
'{{#if isFolder}}' +
'{{#if createPermissionPossible}}' +
'<li>' +
@@ -74,7 +77,9 @@
'</li>' +
'</ul>' +
'</div>' +
- '</span>' +
+ '{{/unless}}' +
+ '<a href="#" class="unshare"><span class="icon-loading-small hidden"></span><span class="icon icon-delete"></span><span class="hidden-visually">{{unshareLabel}}</span></a>' +
+ '</span>' +
'</li>' +
'{{/each}}' +
'{{#each linkReshares}}' +
@@ -141,6 +146,7 @@
getShareeObject: function(shareIndex) {
var shareWith = this.model.getShareWith(shareIndex);
var shareWithDisplayName = this.model.getShareWithDisplayName(shareIndex);
+ var shareWithTitle = '';
var shareType = this.model.getShareType(shareIndex);
var hasPermissionOverride = {};
@@ -148,6 +154,16 @@
shareWithDisplayName = shareWithDisplayName + " (" + t('core', 'group') + ')';
} else if (shareType === OC.Share.SHARE_TYPE_REMOTE) {
shareWithDisplayName = shareWithDisplayName + " (" + t('core', 'remote') + ')';
+ } else if (shareType === OC.Share.SHARE_TYPE_EMAIL) {
+ shareWithDisplayName = shareWithDisplayName + " (" + t('core', 'email') + ')';
+ }
+
+ if (shareType === OC.Share.SHARE_TYPE_GROUP) {
+ shareWithTitle = shareWith + " (" + t('core', 'group') + ')';
+ } else if (shareType === OC.Share.SHARE_TYPE_REMOTE) {
+ shareWithTitle = shareWith + " (" + t('core', 'remote') + ')';
+ } else if (shareType === OC.Share.SHARE_TYPE_EMAIL) {
+ shareWithTitle = shareWith + " (" + t('core', 'email') + ')';
}
return _.extend(hasPermissionOverride, {
@@ -160,10 +176,13 @@
wasMailSent: this.model.notificationMailWasSent(shareIndex),
shareWith: shareWith,
shareWithDisplayName: shareWithDisplayName,
+ shareWithTitle: shareWithTitle,
shareType: shareType,
shareId: this.model.get('shares')[shareIndex].id,
modSeed: shareType !== OC.Share.SHARE_TYPE_USER,
- isRemoteShare: shareType === OC.Share.SHARE_TYPE_REMOTE
+ isRemoteShare: shareType === OC.Share.SHARE_TYPE_REMOTE,
+ isMailShare: shareType === OC.Share.SHARE_TYPE_EMAIL,
+ isFileSharedByMail: shareType === OC.Share.SHARE_TYPE_EMAIL && !this.model.isFolder()
});
},
diff --git a/core/js/sharedialogview.js b/core/js/sharedialogview.js
index 7efb361f512..3b2a7480c47 100644
--- a/core/js/sharedialogview.js
+++ b/core/js/sharedialogview.js
@@ -154,10 +154,16 @@
var users = result.ocs.data.exact.users.concat(result.ocs.data.users);
var groups = result.ocs.data.exact.groups.concat(result.ocs.data.groups);
var remotes = result.ocs.data.exact.remotes.concat(result.ocs.data.remotes);
+ if (typeof(result.ocs.data.emails) !== 'undefined') {
+ var emails = result.ocs.data.exact.emails.concat(result.ocs.data.emails);
+ } else {
+ var emails = [];
+ }
var usersLength;
var groupsLength;
var remotesLength;
+ var emailsLength;
var i, j;
@@ -212,10 +218,18 @@
break;
}
}
+ } else if (share.share_type === OC.Share.SHARE_TYPE_EMAIL) {
+ emailsLength = emails.length;
+ for (j = 0; j < emailsLength; j++) {
+ if (emails[j].value.shareWith === share.share_with) {
+ emails.splice(j, 1);
+ break;
+ }
+ }
}
}
- var suggestions = users.concat(groups).concat(remotes);
+ var suggestions = users.concat(groups).concat(remotes).concat(emails);
if (suggestions.length > 0) {
$('.shareWithField').removeClass('error')
@@ -258,16 +272,13 @@
sharee: text
});
} else if (item.value.shareType === OC.Share.SHARE_TYPE_REMOTE) {
- if (item.value.server) {
- text = t('core', '{sharee} (at {server})', {
- sharee: text,
- server: item.value.server
- });
- } else {
text = t('core', '{sharee} (remote)', {
sharee: text
});
- }
+ } else if (item.value.shareType === OC.Share.SHARE_TYPE_EMAIL) {
+ text = t('core', '{sharee} (email)', {
+ sharee: text
+ });
}
var insert = $("<div class='share-autocomplete-item'/>");
var avatar = $("<div class='avatardiv'></div>").appendTo(insert);
@@ -397,7 +408,7 @@
var infoTemplate = this._getRemoteShareInfoTemplate();
remoteShareInfo = infoTemplate({
docLink: this.configModel.getFederatedShareDocLink(),
- tooltip: t('core', 'Share with people on other Nextclouds using the syntax username@example.com/nextcloud')
+ tooltip: t('core', 'Share with people on other servers using the syntax username@example.com/nextcloud')
});
}
@@ -405,19 +416,33 @@
},
_renderSharePlaceholderPart: function () {
- var sharePlaceholder = t('core', 'Share with users…');
+ var allowGroupSharing = this.configModel.get('allowGroupSharing');
+ var allowRemoteSharing = this.configModel.get('isRemoteShareAllowed');
+ var allowMailSharing = this.configModel.get('isMailShareAllowed');
- if (this.configModel.get('allowGroupSharing')) {
- if (this.configModel.get('isRemoteShareAllowed')) {
- sharePlaceholder = t('core', 'Share with users, groups or remote users…');
- } else {
- sharePlaceholder = t('core', 'Share with users or groups…');
- }
- } else if (this.configModel.get('isRemoteShareAllowed')) {
- sharePlaceholder = t('core', 'Share with users or remote users…');
+ if (!allowGroupSharing && !allowRemoteSharing && allowMailSharing) {
+ return t('core', 'Share with users or by mail...');
+ }
+ if (!allowGroupSharing && allowRemoteSharing && !allowMailSharing) {
+ return t('core', 'Share with users or remote users...');
+ }
+ if (!allowGroupSharing && allowRemoteSharing && allowMailSharing) {
+ return t('core', 'Share with users, remote users or by mail...');
+ }
+ if (allowGroupSharing && !allowRemoteSharing && !allowMailSharing) {
+ return t('core', 'Share with users or groups...');
+ }
+ if (allowGroupSharing && !allowRemoteSharing && allowMailSharing) {
+ return t('core', 'Share with users, groups or by mail...');
+ }
+ if (allowGroupSharing && allowRemoteSharing && !allowMailSharing) {
+ return t('core', 'Share with users, groups or remote users...');
+ }
+ if (allowGroupSharing && allowRemoteSharing && allowMailSharing) {
+ return t('core', 'Share with users, groups, remote users or by mail...');
}
- return sharePlaceholder;
+ return t('core', 'Share with users...');
},
/**