server/apps/files_sharing/js/share.js

39 lines
1.3 KiB
JavaScript
Raw Normal View History

$(document).ready(function() {
var disableSharing = $('#disableSharing').data('status');
if (typeof OC.Share !== 'undefined' && typeof FileActions !== 'undefined' && !disableSharing) {
2013-01-14 19:30:39 +00:00
2012-10-28 20:01:50 +00:00
FileActions.register('all', 'Share', OC.PERMISSION_READ, OC.imagePath('core', 'actions/share'), function(filename) {
if ($('#dir').val() == '/') {
var item = $('#dir').val() + filename;
} else {
var item = $('#dir').val() + '/' + filename;
}
var tr = $('tr').filterAttr('data-file', filename);
if ($(tr).data('type') == 'dir') {
var itemType = 'folder';
} else {
var itemType = 'file';
}
var possiblePermissions = $(tr).data('permissions');
var appendTo = $(tr).find('td.filename');
// Check if drop down is already visible for a different file
if (OC.Share.droppedDown) {
if ($(tr).data('id') != $('#dropdown').attr('data-item-source')) {
OC.Share.hideDropDown(function () {
$(tr).addClass('mouseOver');
2012-09-19 03:56:00 +00:00
OC.Share.showDropDown(itemType, $(tr).data('id'), appendTo, true, possiblePermissions);
});
} else {
OC.Share.hideDropDown();
}
} else {
$(tr).addClass('mouseOver');
2012-09-19 03:56:00 +00:00
OC.Share.showDropDown(itemType, $(tr).data('id'), appendTo, true, possiblePermissions);
}
});
2012-10-28 20:01:50 +00:00
OC.Share.loadIcons('file');
}
2012-12-10 22:22:42 +00:00
});