diff options
Diffstat (limited to 'core/js')
-rw-r--r-- | core/js/js.js | 2 | ||||
-rw-r--r-- | core/js/share.js | 37 |
2 files changed, 30 insertions, 9 deletions
diff --git a/core/js/js.js b/core/js/js.js index ee8bdea7255..40c26d0011f 100644 --- a/core/js/js.js +++ b/core/js/js.js @@ -113,7 +113,7 @@ var OC={ } link+=file; }else{ - if ((app == 'settings' || app == 'core') && type == 'ajax') { + if ((app == 'settings' || app == 'core' || app == 'search') && type == 'ajax') { link+='/index.php/'; } else { diff --git a/core/js/share.js b/core/js/share.js index 00e5ef3eed6..73c74a7cb6d 100644 --- a/core/js/share.js +++ b/core/js/share.js @@ -10,17 +10,38 @@ OC.Share={ // Load all share icons $.get(OC.filePath('core', 'ajax', 'share.php'), { fetch: 'getItemsSharedStatuses', itemType: itemType }, function(result) { if (result && result.status === 'success') { - $.each(result.data, function(item, hasPrivateLink) { - // Private links override shared in terms of icon display + $.each(result.data, function(item, hasLink) { + OC.Share.statuses[item] = hasLink; + // Links override shared in terms of icon display + if (hasLink) { + var image = OC.imagePath('core', 'actions/public'); + } else { + var image = OC.imagePath('core', 'actions/shared'); + } if (itemType != 'file' && itemType != 'folder') { - if (hasPrivateLink) { - var image = OC.imagePath('core', 'actions/public'); - } else { - var image = OC.imagePath('core', 'actions/shared'); - } $('a.share[data-item="'+item+'"]').css('background', 'url('+image+') no-repeat center'); + } 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 dir = $('#dir').val(); + if (dir.length > 1) { + var last = ''; + var path = dir; + // Search for possible parent folders that are shared + while (path != last) { + if (path == item) { + var img = $('.fileactions .action').filterAttr('data-action', 'Share').find('img'); + if (img.attr('src') != OC.imagePath('core', 'actions/public')) { + img.attr('src', image); + } + } + last = path; + path = OC.Share.dirname(path); + } + } } - OC.Share.statuses[item] = hasPrivateLink; }); } }); |