diff options
author | Arthur Schiwon <blizzz@owncloud.com> | 2015-09-02 16:47:25 +0200 |
---|---|---|
committer | Vincent Petry <pvince81@owncloud.com> | 2015-09-16 07:23:27 +0200 |
commit | 60abfcdab16ed674015422a6300bd28f3baa5e91 (patch) | |
tree | 6619b8e5af3017b55123fb3fc02e5f5c488d4b13 /core/js/share.js | |
parent | 44ecdde10d347dc0e77576b35dc3d066dfc0fce6 (diff) | |
download | nextcloud-server-60abfcdab16ed674015422a6300bd28f3baa5e91.tar.gz nextcloud-server-60abfcdab16ed674015422a6300bd28f3baa5e91.zip |
old OC.Share.addShareWith now reimplemented
Diffstat (limited to 'core/js/share.js')
-rw-r--r-- | core/js/share.js | 106 |
1 files changed, 0 insertions, 106 deletions
diff --git a/core/js/share.js b/core/js/share.js index 1fc1ac9e20c..bd87ab10d40 100644 --- a/core/js/share.js +++ b/core/js/share.js @@ -685,112 +685,6 @@ OC.Share = _.extend(OC.Share, { } }); }, - addShareWith:function(shareType, shareWith, shareWithDisplayName, permissions, possiblePermissions, mailSend, collection) { - var shareItem = { - share_type: shareType, - share_with: shareWith, - share_with_displayname: shareWithDisplayName, - permissions: permissions - }; - if (shareType === OC.Share.SHARE_TYPE_GROUP) { - shareWithDisplayName = shareWithDisplayName + " (" + t('core', 'group') + ')'; - } - if (shareType === OC.Share.SHARE_TYPE_REMOTE) { - shareWithDisplayName = shareWithDisplayName + " (" + t('core', 'remote') + ')'; - } - if (!OC.Share.itemShares[shareType]) { - OC.Share.itemShares[shareType] = []; - } - OC.Share.itemShares[shareType].push(shareWith); - if (collection) { - if (collection.item_type == 'file' || collection.item_type == 'folder') { - var item = collection.path; - } else { - var item = collection.item_source; - } - var collectionList = $('#shareWithList li').filterAttr('data-collection', item); - if (collectionList.length > 0) { - $(collectionList).append(', '+shareWithDisplayName); - } else { - var html = '<li style="clear: both;" data-collection="'+item+'">'+t('core', 'Shared in {item} with {user}', {'item': item, user: shareWithDisplayName})+'</li>'; - $('#shareWithList').prepend(html); - } - } else { - var editChecked = createChecked = updateChecked = deleteChecked = shareChecked = ''; - if (permissions & OC.PERMISSION_CREATE) { - createChecked = 'checked="checked"'; - editChecked = 'checked="checked"'; - } - if (permissions & OC.PERMISSION_UPDATE) { - updateChecked = 'checked="checked"'; - editChecked = 'checked="checked"'; - } - if (permissions & OC.PERMISSION_DELETE) { - deleteChecked = 'checked="checked"'; - editChecked = 'checked="checked"'; - } - if (permissions & OC.PERMISSION_SHARE) { - shareChecked = 'checked="checked"'; - } - var html = '<li style="clear: both;" data-share-type="'+escapeHTML(shareType)+'" data-share-with="'+escapeHTML(shareWith)+'" title="' + escapeHTML(shareWith) + '">'; - var showCrudsButton; - html += '<a href="#" class="unshare"><img class="svg" alt="'+t('core', 'Unshare')+'" title="'+t('core', 'Unshare')+'" src="'+OC.imagePath('core', 'actions/delete')+'"/></a>'; - if (oc_config.enable_avatars === true) { - html += '<div class="avatar"></div>'; - } - html += '<span class="username">' + escapeHTML(shareWithDisplayName) + '</span>'; - var mailNotificationEnabled = $('input:hidden[name=mailNotificationEnabled]').val(); - if (mailNotificationEnabled === 'yes' && shareType !== OC.Share.SHARE_TYPE_REMOTE) { - var checked = ''; - if (mailSend === '1') { - checked = 'checked'; - } - html += '<label><input type="checkbox" name="mailNotification" class="mailNotification" ' + checked + ' />'+t('core', 'notify by email')+'</label> '; - } - if (oc_appconfig.core.resharingAllowed && (possiblePermissions & OC.PERMISSION_SHARE)) { - html += '<label><input id="canShare-'+escapeHTML(shareWith)+'" type="checkbox" name="share" class="permissions" '+shareChecked+' data-permissions="'+OC.PERMISSION_SHARE+'" />'+t('core', 'can share')+'</label>'; - } - if (possiblePermissions & OC.PERMISSION_CREATE || possiblePermissions & OC.PERMISSION_UPDATE || possiblePermissions & OC.PERMISSION_DELETE) { - html += '<label><input id="canEdit-'+escapeHTML(shareWith)+'" type="checkbox" name="edit" class="permissions" '+editChecked+' />'+t('core', 'can edit')+'</label>'; - } - if (shareType !== OC.Share.SHARE_TYPE_REMOTE) { - showCrudsButton = '<a href="#" class="showCruds"><img class="svg" alt="'+t('core', 'access control')+'" src="'+OC.imagePath('core', 'actions/triangle-s')+'"/></a>'; - } - html += '<div class="cruds" style="display:none;">'; - if (possiblePermissions & OC.PERMISSION_CREATE) { - html += '<label><input id="canCreate-' + escapeHTML(shareWith) + '" type="checkbox" name="create" class="permissions" ' + createChecked + ' data-permissions="' + OC.PERMISSION_CREATE + '"/>' + t('core', 'create') + '</label>'; - } - if (possiblePermissions & OC.PERMISSION_UPDATE) { - html += '<label><input id="canUpdate-' + escapeHTML(shareWith) + '" type="checkbox" name="update" class="permissions" ' + updateChecked + ' data-permissions="' + OC.PERMISSION_UPDATE + '"/>' + t('core', 'change') + '</label>'; - } - if (possiblePermissions & OC.PERMISSION_DELETE) { - html += '<label><input id="canDelete-' + escapeHTML(shareWith) + '" type="checkbox" name="delete" class="permissions" ' + deleteChecked + ' data-permissions="' + OC.PERMISSION_DELETE + '"/>' + t('core', 'delete') + '</label>'; - } - html += '</div>'; - html += '</li>'; - html = $(html).appendTo('#shareWithList'); - if (oc_config.enable_avatars === true) { - if (shareType === OC.Share.SHARE_TYPE_USER) { - html.find('.avatar').avatar(escapeHTML(shareWith), 32); - } else { - //Add sharetype to generate different seed if there is a group and use with the same name - html.find('.avatar').imageplaceholder(escapeHTML(shareWith) + ' ' + shareType); - } - } - // insert cruds button into last label element - var lastLabel = html.find('>label:last'); - if (lastLabel.exists()){ - lastLabel.append(showCrudsButton); - } - else{ - html.find('.cruds').before(showCrudsButton); - } - if (!OC.Share.currentShares[shareType]) { - OC.Share.currentShares[shareType] = []; - } - OC.Share.currentShares[shareType].push(shareItem); - } - }, showLink:function(token, password, itemSource) { OC.Share.itemShares[OC.Share.SHARE_TYPE_LINK] = true; $('#linkCheckbox').attr('checked', true); |