diff options
author | Robin Appelman <icewind@owncloud.com> | 2012-11-30 00:18:42 +0100 |
---|---|---|
committer | Robin Appelman <icewind@owncloud.com> | 2012-11-30 00:18:42 +0100 |
commit | d33f697a5f3438f286ba3abe63255b6797a6fc03 (patch) | |
tree | 3bde00fb82540d9a44d0cfe97b41a7c6ecc668d3 /core/js/share.js | |
parent | a609992a75d1dad15398f55e22ad2244c78650dc (diff) | |
parent | 9b709fa95df5b93b9fb05e33158122003891c154 (diff) | |
download | nextcloud-server-d33f697a5f3438f286ba3abe63255b6797a6fc03.tar.gz nextcloud-server-d33f697a5f3438f286ba3abe63255b6797a6fc03.zip |
merge master into filesystem
Diffstat (limited to 'core/js/share.js')
-rw-r--r-- | core/js/share.js | 28 |
1 files changed, 17 insertions, 11 deletions
diff --git a/core/js/share.js b/core/js/share.js index 8fcea84af88..0f71ae22419 100644 --- a/core/js/share.js +++ b/core/js/share.js @@ -179,7 +179,7 @@ OC.Share={ if (data.shares) { $.each(data.shares, function(index, share) { if (share.share_type == OC.Share.SHARE_TYPE_LINK) { - OC.Share.showLink(itemSource, share.share_with); + OC.Share.showLink(share.token, share.share_with, itemSource); } else { if (share.collection) { OC.Share.addShareWith(share.share_type, share.share_with, share.permissions, possiblePermissions, share.collection); @@ -323,18 +323,24 @@ OC.Share={ $('#expiration').show(); } }, - showLink:function(itemSource, password) { + showLink:function(token, password, itemSource) { OC.Share.itemShares[OC.Share.SHARE_TYPE_LINK] = true; $('#linkCheckbox').attr('checked', true); - var filename = $('tr').filterAttr('data-id', String(itemSource)).data('file'); - var type = $('tr').filterAttr('data-id', String(itemSource)).data('type'); - if ($('#dir').val() == '/') { - var file = $('#dir').val() + filename; + if (! token) { + //fallback to pre token link + var filename = $('tr').filterAttr('data-id', String(itemSource)).data('file'); + var type = $('tr').filterAttr('data-id', String(itemSource)).data('type'); + if ($('#dir').val() == '/') { + var file = $('#dir').val() + filename; + } else { + var file = $('#dir').val() + '/' + filename; + } + file = '/'+OC.currentUser+'/files'+file; + var link = parent.location.protocol+'//'+location.host+OC.linkTo('', 'public.php')+'?service=files&'+type+'='+encodeURIComponent(file); } else { - var file = $('#dir').val() + '/' + filename; + //TODO add path param when showing a link to file in a subfolder of a public link share + var link = parent.location.protocol+'//'+location.host+OC.linkTo('', 'public.php')+'?service=files&t='+token; } - file = '/'+OC.currentUser+'/files'+file; - var link = parent.location.protocol+'//'+location.host+OC.linkTo('', 'public.php')+'?service=files&'+type+'='+encodeURIComponent(file); $('#linkText').val(link); $('#linkText').show('blind'); $('#showPassword').show(); @@ -480,8 +486,8 @@ $(document).ready(function() { var itemSource = $('#dropdown').data('item-source'); if (this.checked) { // Create a link - OC.Share.share(itemType, itemSource, OC.Share.SHARE_TYPE_LINK, '', OC.PERMISSION_READ, function() { - OC.Share.showLink(itemSource); + OC.Share.share(itemType, itemSource, OC.Share.SHARE_TYPE_LINK, '', OC.PERMISSION_READ, function(data) { + OC.Share.showLink(data.token, null, itemSource); OC.Share.updateIcon(itemType, itemSource); }); } else { |