summaryrefslogtreecommitdiffstats
path: root/core/js
diff options
context:
space:
mode:
authorJan-Christoph Borchardt <hey@jancborchardt.net>2013-01-30 13:53:43 +0100
committerJan-Christoph Borchardt <hey@jancborchardt.net>2013-01-30 13:53:43 +0100
commit284e69073782d634dbee9368a81607ae2afebc7b (patch)
tree26c40b2c76e9a70c72d24a1a8336d13b7689c5c3 /core/js
parent3bafa87a1223d18e7f772c9551f17aaf7bcc7abb (diff)
parent5761bd771f4142394a00083712b63e77f8976946 (diff)
downloadnextcloud-server-284e69073782d634dbee9368a81607ae2afebc7b.tar.gz
nextcloud-server-284e69073782d634dbee9368a81607ae2afebc7b.zip
Merge branch 'master' into navigation
Diffstat (limited to 'core/js')
-rw-r--r--core/js/share.js41
1 files changed, 29 insertions, 12 deletions
diff --git a/core/js/share.js b/core/js/share.js
index bb3ec010ff5..0c45765bd8b 100644
--- a/core/js/share.js
+++ b/core/js/share.js
@@ -23,7 +23,10 @@ OC.Share={
} else {
var file = $('tr').filterAttr('data-file', OC.basename(item));
if (file.length > 0) {
- $(file).find('.fileactions .action').filterAttr('data-action', 'Share').find('img').attr('src', image);
+ var action = $(file).find('.fileactions .action').filterAttr('data-action', 'Share');
+ action.find('img').attr('src', image);
+ action.addClass('permanent');
+ action.html(action.html().replace(t('core', 'Share'), t('core', 'Shared')));
}
var dir = $('#dir').val();
if (dir.length > 1) {
@@ -32,9 +35,12 @@ OC.Share={
// Search for possible parent folders that are shared
while (path != last) {
if (path == item) {
- var img = $('.fileactions .action').filterAttr('data-action', 'Share').find('img');
+ var action = $('.fileactions .action').filterAttr('data-action', 'Share');
+ var img = action.find('img');
if (img.attr('src') != OC.imagePath('core', 'actions/public')) {
img.attr('src', image);
+ action.addClass('permanent');
+ action.html(action.html().replace(t('core', 'Share'), t('core', 'Shared')));
}
}
last = path;
@@ -48,7 +54,8 @@ OC.Share={
},
updateIcon:function(itemType, itemSource) {
if (itemType == 'file' || itemType == 'folder') {
- var filename = $('tr').filterAttr('data-id', String(itemSource)).data('file');
+ var file = $('tr').filterAttr('data-id', String(itemSource));
+ var filename = file.data('file');
if ($('#dir').val() == '/') {
itemSource = $('#dir').val() + filename;
} else {
@@ -75,6 +82,16 @@ OC.Share={
});
if (itemType != 'file' && itemType != 'folder') {
$('a.share[data-item="'+itemSource+'"]').css('background', 'url('+image+') no-repeat center');
+ } else {
+ var action = $(file).find('.fileactions .action').filterAttr('data-action', 'Share');
+ action.find('img').attr('src', image);
+ if (shares) {
+ action.addClass('permanent');
+ action.html(action.html().replace(t('core', 'Share'), t('core', 'Shared')));
+ } else {
+ action.removeClass('permanent');
+ action.html(action.html().replace(t('core', 'Shared'), t('core', 'Share')));
+ }
}
if (shares) {
OC.Share.statuses[itemSource] = link;
@@ -148,9 +165,9 @@ OC.Share={
var html = '<div id="dropdown" class="drop" data-item-type="'+itemType+'" data-item-source="'+itemSource+'">';
if (data !== false && data.reshare !== false && data.reshare.uid_owner !== undefined) {
if (data.reshare.share_type == OC.Share.SHARE_TYPE_GROUP) {
- html += '<span class="reshare">'+t('core', 'Shared with you and the group {group} by {owner}', {group: data.reshare.share_with, owner: data.reshare.uid_owner})+'</span>';
+ html += '<span class="reshare">'+t('core', 'Shared with you and the group {group} by {owner}', {group: data.reshare.share_with, owner: data.reshare.displayname_owner})+'</span>';
} else {
- html += '<span class="reshare">'+t('core', 'Shared with you by {owner}', {owner: data.reshare.uid_owner})+'</span>';
+ html += '<span class="reshare">'+t('core', 'Shared with you by {owner}', {owner: data.reshare.displayname_owner})+'</span>';
}
html += '<br />';
}
@@ -186,9 +203,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.permissions, possiblePermissions, share.collection);
+ OC.Share.addShareWith(share.share_type, share.share_with, share.share_with_displayname, share.permissions, possiblePermissions, share.collection);
} else {
- OC.Share.addShareWith(share.share_type, share.share_with, share.permissions, possiblePermissions, false);
+ OC.Share.addShareWith(share.share_type, share.share_with, share.share_with_displayname, share.permissions, possiblePermissions, false);
}
}
if (share.expiration != null) {
@@ -228,7 +245,7 @@ OC.Share={
// Default permissions are Read and Share
var permissions = OC.PERMISSION_READ | OC.PERMISSION_SHARE;
OC.Share.share(itemType, itemSource, shareType, shareWith, permissions, function() {
- OC.Share.addShareWith(shareType, shareWith, permissions, possiblePermissions);
+ OC.Share.addShareWith(shareType, shareWith, selected.item.label, permissions, possiblePermissions);
$('#shareWith').val('');
OC.Share.updateIcon(itemType, itemSource);
});
@@ -257,7 +274,7 @@ OC.Share={
}
});
},
- addShareWith:function(shareType, shareWith, permissions, possiblePermissions, collection) {
+ addShareWith:function(shareType, shareWith, shareWithDisplayName, permissions, possiblePermissions, collection) {
if (!OC.Share.itemShares[shareType]) {
OC.Share.itemShares[shareType] = [];
}
@@ -272,7 +289,7 @@ OC.Share={
if (collectionList.length > 0) {
$(collectionList).append(', '+shareWith);
} else {
- var html = '<li style="clear: both;" data-collection="'+item+'">'+t('core', 'Shared in {item} with {user}', {'item': item, user: shareWith})+'</li>';
+ 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 {
@@ -295,9 +312,9 @@ OC.Share={
var html = '<li style="clear: both;" data-share-type="'+shareType+'" data-share-with="'+shareWith+'" title="' + shareWith + '">';
html += '<a href="#" class="unshare" style="display:none;"><img class="svg" alt="'+t('core', 'Unshare')+'" src="'+OC.imagePath('core', 'actions/delete')+'"/></a>';
if(shareWith.length > 14){
- html += shareWith.substr(0,11) + '...';
+ html += shareWithDisplayName.substr(0,11) + '...';
}else{
- html += shareWith;
+ html += shareWithDisplayName;
}
if (possiblePermissions & OC.PERMISSION_CREATE || possiblePermissions & OC.PERMISSION_UPDATE || possiblePermissions & OC.PERMISSION_DELETE) {
if (editChecked == '') {