2012-08-22 16:31:54 +00:00
|
|
|
$(document).ready(function() {
|
|
|
|
|
2013-10-17 09:59:13 +00:00
|
|
|
var disableSharing = $('#disableSharing').data('status'),
|
|
|
|
sharesLoaded = false;
|
2013-01-26 13:07:35 +00:00
|
|
|
|
2013-01-23 08:18:26 +00:00
|
|
|
if (typeof OC.Share !== 'undefined' && typeof FileActions !== 'undefined' && !disableSharing) {
|
2013-08-17 11:07:18 +00:00
|
|
|
$('#fileList').on('fileActionsReady',function(){
|
2013-10-17 09:59:13 +00: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 11:50:04 +00:00
|
|
|
});
|
|
|
|
|
2012-10-28 20:01:50 +00:00
|
|
|
FileActions.register('all', 'Share', OC.PERMISSION_READ, OC.imagePath('core', 'actions/share'), function(filename) {
|
2012-08-22 16:31:54 +00:00
|
|
|
if ($('#dir').val() == '/') {
|
|
|
|
var item = $('#dir').val() + filename;
|
|
|
|
} else {
|
|
|
|
var item = $('#dir').val() + '/' + filename;
|
|
|
|
}
|
2012-08-23 18:48:35 +00:00
|
|
|
var tr = $('tr').filterAttr('data-file', filename);
|
|
|
|
if ($(tr).data('type') == 'dir') {
|
2012-08-22 16:31:54 +00:00
|
|
|
var itemType = 'folder';
|
|
|
|
} else {
|
|
|
|
var itemType = 'file';
|
|
|
|
}
|
2012-08-23 18:48:35 +00:00
|
|
|
var possiblePermissions = $(tr).data('permissions');
|
2013-12-03 14:23:13 +00:00
|
|
|
var appendTo = $(tr).find('td.filename');
|
2012-08-22 16:31:54 +00:00
|
|
|
// Check if drop down is already visible for a different file
|
|
|
|
if (OC.Share.droppedDown) {
|
2012-10-09 16:42:49 +00:00
|
|
|
if ($(tr).data('id') != $('#dropdown').attr('data-item-source')) {
|
2012-08-22 16:31:54 +00:00
|
|
|
OC.Share.hideDropDown(function () {
|
2012-08-24 14:01:01 +00:00
|
|
|
$(tr).addClass('mouseOver');
|
2013-10-23 16:39:37 +00:00
|
|
|
OC.Share.showDropDown(itemType, $(tr).data('id'), appendTo, true, possiblePermissions, filename);
|
2012-08-22 16:31:54 +00:00
|
|
|
});
|
|
|
|
} else {
|
|
|
|
OC.Share.hideDropDown();
|
|
|
|
}
|
|
|
|
} else {
|
2012-08-24 14:01:01 +00:00
|
|
|
$(tr).addClass('mouseOver');
|
2013-10-23 16:39:37 +00:00
|
|
|
OC.Share.showDropDown(itemType, $(tr).data('id'), appendTo, true, possiblePermissions, filename);
|
2012-08-22 16:31:54 +00:00
|
|
|
}
|
|
|
|
});
|
|
|
|
}
|
2013-08-18 09:02:08 +00:00
|
|
|
});
|