2012-08-22 20:31:54 +04:00
|
|
|
$(document).ready(function() {
|
|
|
|
|
2013-10-17 13:59:13 +04:00
|
|
|
var disableSharing = $('#disableSharing').data('status'),
|
|
|
|
sharesLoaded = false;
|
2013-01-26 17:07:35 +04:00
|
|
|
|
2013-01-23 12:18:26 +04:00
|
|
|
if (typeof OC.Share !== 'undefined' && typeof FileActions !== 'undefined' && !disableSharing) {
|
2013-08-17 15:07:18 +04:00
|
|
|
$('#fileList').on('fileActionsReady',function(){
|
2014-01-30 17:47:00 +04:00
|
|
|
|
2014-02-01 17:52:41 +04:00
|
|
|
var allShared = $('#fileList').find('[data-share-owner]').find('[data-Action="Share"]');
|
2014-01-30 17:47:00 +04:00
|
|
|
allShared.addClass('permanent');
|
|
|
|
allShared.find('span').text(function(){
|
|
|
|
$owner = $(this).closest('tr').attr('data-share-owner');
|
2014-01-30 19:29:32 +04:00
|
|
|
return ' ' + t('files_sharing', 'Shared by {owner}', {owner: $owner});
|
2014-01-30 17:47:00 +04:00
|
|
|
});
|
|
|
|
|
2013-10-17 13:59:13 +04:00
|
|
|
if (!sharesLoaded){
|
|
|
|
OC.Share.loadIcons('file');
|
|
|
|
// assume that we got all shares, so switching directories
|
|
|
|
// will not invalidate that list
|
|
|
|
sharesLoaded = true;
|
|
|
|
}
|
|
|
|
else{
|
|
|
|
OC.Share.updateIcons('file');
|
|
|
|
}
|
2013-08-08 15:50:04 +04:00
|
|
|
});
|
|
|
|
|
2012-10-29 00:01:50 +04:00
|
|
|
FileActions.register('all', 'Share', OC.PERMISSION_READ, OC.imagePath('core', 'actions/share'), function(filename) {
|
2014-01-30 17:49:38 +04:00
|
|
|
var dir = $('#dir').val();
|
2014-01-30 19:29:32 +04:00
|
|
|
var item = dir + '/' + filename;
|
|
|
|
if (dir == '/') {
|
|
|
|
item = dir + filename;
|
2012-08-22 20:31:54 +04:00
|
|
|
}
|
2014-01-10 18:02:26 +04:00
|
|
|
var tr = FileList.findFileEl(filename);
|
2014-01-30 17:49:38 +04:00
|
|
|
var itemType = 'file';
|
2012-08-23 22:48:35 +04:00
|
|
|
if ($(tr).data('type') == 'dir') {
|
2014-01-30 17:49:38 +04:00
|
|
|
itemType = 'folder';
|
2012-08-22 20:31:54 +04:00
|
|
|
}
|
2012-08-23 22:48:35 +04:00
|
|
|
var possiblePermissions = $(tr).data('permissions');
|
2013-12-03 18:23:13 +04:00
|
|
|
var appendTo = $(tr).find('td.filename');
|
2012-08-22 20:31:54 +04:00
|
|
|
// Check if drop down is already visible for a different file
|
|
|
|
if (OC.Share.droppedDown) {
|
2012-10-09 20:42:49 +04:00
|
|
|
if ($(tr).data('id') != $('#dropdown').attr('data-item-source')) {
|
2012-08-22 20:31:54 +04:00
|
|
|
OC.Share.hideDropDown(function () {
|
2012-08-24 18:01:01 +04:00
|
|
|
$(tr).addClass('mouseOver');
|
2013-10-23 20:39:37 +04:00
|
|
|
OC.Share.showDropDown(itemType, $(tr).data('id'), appendTo, true, possiblePermissions, filename);
|
2012-08-22 20:31:54 +04:00
|
|
|
});
|
|
|
|
} else {
|
|
|
|
OC.Share.hideDropDown();
|
|
|
|
}
|
|
|
|
} else {
|
2012-08-24 18:01:01 +04:00
|
|
|
$(tr).addClass('mouseOver');
|
2013-10-23 20:39:37 +04:00
|
|
|
OC.Share.showDropDown(itemType, $(tr).data('id'), appendTo, true, possiblePermissions, filename);
|
2012-08-22 20:31:54 +04:00
|
|
|
}
|
|
|
|
});
|
|
|
|
}
|
2013-08-18 13:02:08 +04:00
|
|
|
});
|