summaryrefslogtreecommitdiffstats
path: root/core/js/share.js
diff options
context:
space:
mode:
authorBjoern Schiessle <schiessle@owncloud.com>2013-08-30 13:53:49 +0200
committerBjoern Schiessle <schiessle@owncloud.com>2013-08-30 13:53:49 +0200
commit77adaee6457c3e17d0f0b32c74da4cdbfce60164 (patch)
treefc793d2965d0a9541a183f620a63dae3ea2bfb0b /core/js/share.js
parent0a23ac18bc1f74cea98eed2c37aa03c99fd957f7 (diff)
downloadnextcloud-server-77adaee6457c3e17d0f0b32c74da4cdbfce60164.tar.gz
nextcloud-server-77adaee6457c3e17d0f0b32c74da4cdbfce60164.zip
enable user to inform recipients about a shared file by mail
Diffstat (limited to 'core/js/share.js')
-rw-r--r--core/js/share.js39
1 files changed, 35 insertions, 4 deletions
diff --git a/core/js/share.js b/core/js/share.js
index 27c16f38b92..c806d83f10c 100644
--- a/core/js/share.js
+++ b/core/js/share.js
@@ -217,9 +217,9 @@ OC.Share={
OC.Share.showLink(share.token, share.share_with, itemSource);
} else {
if (share.collection) {
- OC.Share.addShareWith(share.share_type, share.share_with, share.share_with_displayname, share.permissions, possiblePermissions, share.collection);
+ OC.Share.addShareWith(share.share_type, share.share_with, share.share_with_displayname, share.permissions, possiblePermissions, share.mail_send, share.collection);
} else {
- OC.Share.addShareWith(share.share_type, share.share_with, share.share_with_displayname, share.permissions, possiblePermissions, false);
+ OC.Share.addShareWith(share.share_type, share.share_with, share.share_with_displayname, share.mail_send, share.permissions, possiblePermissions, share.mail_send, false);
}
}
if (share.expiration != null) {
@@ -299,7 +299,7 @@ OC.Share={
}
});
},
- addShareWith:function(shareType, shareWith, shareWithDisplayName, permissions, possiblePermissions, collection) {
+ addShareWith:function(shareType, shareWith, shareWithDisplayName, permissions, possiblePermissions, mailSend, collection) {
if (!OC.Share.itemShares[shareType]) {
OC.Share.itemShares[shareType] = [];
}
@@ -341,6 +341,14 @@ OC.Share={
}else{
html += escapeHTML(shareWithDisplayName);
}
+ mailNotificationEnabled = $('input:hidden[name=mailNotificationEnabled]').val();
+ if (mailNotificationEnabled === 'yes') {
+ checked = '';
+ if (mailSend === true) {
+ checked = 'checked';
+ }
+ html += '<input type="checkbox" name="mailNotification" class="mailNotification" ' + checked + ' />'+t('core', 'notify user by email')+'</label>';
+ }
if (possiblePermissions & OC.PERMISSION_CREATE || possiblePermissions & OC.PERMISSION_UPDATE || possiblePermissions & OC.PERMISSION_DELETE) {
if (editChecked == '') {
html += '<label style="display:none;">';
@@ -484,7 +492,7 @@ $(document).ready(function() {
$('input:[type=checkbox]', this).hide();
$('label', this).hide();
}
- } else {
+ } else {
$('a.unshare', this).hide();
}
});
@@ -686,5 +694,28 @@ $(document).ready(function() {
}
});
+ $(document).on('click', '#dropdown input[name=mailNotification]', function(event) {
+ event.preventDefault();
+ event.stopPropagation();
+ var li = $(this).parent();
+ var itemType = $('#dropdown').data('item-type');
+ var itemSource = $('#dropdown').data('item-source');
+ if (this.checked) {
+ action = 'informRecipients';
+ } else {
+ action = 'informRecipientsDisabled';
+ }
+
+ shareType = $(li).data('share-type');
+ shareWith = $(li).data('share-with');
+
+ $.post(OC.filePath('core', 'ajax', 'share.php'), {action: action, recipient: shareWith, shareType: shareType, itemSource: itemSource, itemType: itemType}, function(result) {
+ if (result.status !== 'success') {
+ OC.dialogs.alert(t('core', result.data.message), t('core', 'Warning'));
+ }
+ });
+
+});
+
});