2012-08-22 20:31:54 +04:00
|
|
|
$(document).ready(function() {
|
|
|
|
|
2012-10-10 19:43:09 +04:00
|
|
|
if (typeof OC.Share !== 'undefined' && typeof FileActions !== 'undefined' && !publicListView) {
|
2012-10-29 00:01:50 +04:00
|
|
|
|
|
|
|
FileActions.register('all', 'Share', OC.PERMISSION_READ, OC.imagePath('core', 'actions/share'), function(filename) {
|
2012-08-22 20:31:54 +04:00
|
|
|
if ($('#dir').val() == '/') {
|
|
|
|
var item = $('#dir').val() + filename;
|
|
|
|
} else {
|
|
|
|
var item = $('#dir').val() + '/' + filename;
|
|
|
|
}
|
2012-08-23 22:48:35 +04:00
|
|
|
var tr = $('tr').filterAttr('data-file', filename);
|
|
|
|
if ($(tr).data('type') == 'dir') {
|
2012-08-22 20:31:54 +04:00
|
|
|
var itemType = 'folder';
|
|
|
|
} else {
|
|
|
|
var itemType = 'file';
|
|
|
|
}
|
2012-08-23 22:48:35 +04:00
|
|
|
var possiblePermissions = $(tr).data('permissions');
|
2012-08-24 18:01:01 +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');
|
2012-09-19 07:56:00 +04:00
|
|
|
OC.Share.showDropDown(itemType, $(tr).data('id'), appendTo, true, possiblePermissions);
|
2012-08-22 20:31:54 +04:00
|
|
|
});
|
|
|
|
} else {
|
|
|
|
OC.Share.hideDropDown();
|
|
|
|
}
|
|
|
|
} else {
|
2012-08-24 18:01:01 +04:00
|
|
|
$(tr).addClass('mouseOver');
|
2012-09-19 07:56:00 +04:00
|
|
|
OC.Share.showDropDown(itemType, $(tr).data('id'), appendTo, true, possiblePermissions);
|
2012-08-22 20:31:54 +04:00
|
|
|
}
|
|
|
|
});
|
2012-10-29 00:01:50 +04:00
|
|
|
OC.Share.loadIcons('file');
|
2012-08-22 20:31:54 +04:00
|
|
|
}
|
2012-12-10 21:41:08 +04:00
|
|
|
|
|
|
|
$('#emailPrivateLink').live('submit', function(event) {
|
|
|
|
event.preventDefault();
|
|
|
|
var link = $('#linkText').val();
|
|
|
|
var itemType = $('#dropdown').data('item-type');
|
|
|
|
var itemSource = $('#dropdown').data('item-source');
|
|
|
|
|
|
|
|
var file = $('tr').filterAttr('data-id', String(itemSource)).data('file');
|
|
|
|
var email = $('#email').val();
|
|
|
|
if (email != '') {
|
|
|
|
$.post(OC.filePath('files_sharing', 'ajax', 'email.php'), { toaddress: email, link: link, type: itemType, file: file }, function(result) {
|
|
|
|
if (result && result.status == 'success') {
|
|
|
|
$('#email').css('font-weight', 'bold');
|
|
|
|
$('#email').animate({ fontWeight: 'normal' }, 2000, function() {
|
|
|
|
$(this).val('');
|
|
|
|
}).val('Email sent');
|
|
|
|
} else {
|
|
|
|
OC.dialogs.alert(result.data.message, 'Error while sharing');
|
|
|
|
}
|
|
|
|
});
|
|
|
|
}
|
|
|
|
});
|
|
|
|
|
2012-08-22 20:31:54 +04:00
|
|
|
|
|
|
|
});
|