Merge pull request #5446 from frisco82/fixNotifyUser

Fix notify user checkbox
This commit is contained in:
Frank Karlitschek 2013-10-21 14:07:33 -07:00
commit 6915367622
2 changed files with 11 additions and 12 deletions

View File

@ -531,13 +531,13 @@ $(document).ready(function() {
}); });
$(document).on('click', '#dropdown .unshare', function() { $(document).on('click', '#dropdown .unshare', function() {
var li = $(this).parent(); var $li = $(this).closest('li');
var itemType = $('#dropdown').data('item-type'); var itemType = $('#dropdown').data('item-type');
var itemSource = $('#dropdown').data('item-source'); var itemSource = $('#dropdown').data('item-source');
var shareType = $(li).data('share-type'); var shareType = $li.data('share-type');
var shareWith = $(li).data('share-with'); var shareWith = $li.data('share-with');
OC.Share.unshare(itemType, itemSource, shareType, shareWith, function() { OC.Share.unshare(itemType, itemSource, shareType, shareWith, function() {
$(li).remove(); $li.remove();
var index = OC.Share.itemShares[shareType].indexOf(shareWith); var index = OC.Share.itemShares[shareType].indexOf(shareWith);
OC.Share.itemShares[shareType].splice(index, 1); OC.Share.itemShares[shareType].splice(index, 1);
OC.Share.updateIcon(itemType, itemSource); OC.Share.updateIcon(itemType, itemSource);
@ -549,8 +549,8 @@ $(document).ready(function() {
}); });
$(document).on('change', '#dropdown .permissions', function() { $(document).on('change', '#dropdown .permissions', function() {
var li = $(this).closest('li');
if ($(this).attr('name') == 'edit') { if ($(this).attr('name') == 'edit') {
var li = $(this).parent().parent();
var checkboxes = $('.permissions', li); var checkboxes = $('.permissions', li);
var checked = $(this).is(':checked'); var checked = $(this).is(':checked');
// Check/uncheck Create, Update, and Delete checkboxes if Edit is checked/unck // Check/uncheck Create, Update, and Delete checkboxes if Edit is checked/unck
@ -558,7 +558,6 @@ $(document).ready(function() {
$(checkboxes).filter('input[name="update"]').attr('checked', checked); $(checkboxes).filter('input[name="update"]').attr('checked', checked);
$(checkboxes).filter('input[name="delete"]').attr('checked', checked); $(checkboxes).filter('input[name="delete"]').attr('checked', checked);
} else { } else {
var li = $(this).parent().parent().parent();
var checkboxes = $('.permissions', li); var checkboxes = $('.permissions', li);
// Uncheck Edit if Create, Update, and Delete are not checked // Uncheck Edit if Create, Update, and Delete are not checked
if (!$(this).is(':checked') if (!$(this).is(':checked')
@ -581,8 +580,8 @@ $(document).ready(function() {
}); });
OC.Share.setPermissions($('#dropdown').data('item-type'), OC.Share.setPermissions($('#dropdown').data('item-type'),
$('#dropdown').data('item-source'), $('#dropdown').data('item-source'),
$(li).data('share-type'), li.data('share-type'),
$(li).data('share-with'), li.data('share-with'),
permissions); permissions);
}); });
@ -736,7 +735,7 @@ $(document).ready(function() {
}); });
$(document).on('click', '#dropdown input[name=mailNotification]', function() { $(document).on('click', '#dropdown input[name=mailNotification]', function() {
var li = $(this).parent(); var $li = $(this).closest('li');
var itemType = $('#dropdown').data('item-type'); var itemType = $('#dropdown').data('item-type');
var itemSource = $('#dropdown').data('item-source'); var itemSource = $('#dropdown').data('item-source');
var action = ''; var action = '';
@ -746,8 +745,8 @@ $(document).ready(function() {
action = 'informRecipientsDisabled'; action = 'informRecipientsDisabled';
} }
var shareType = $(li).data('share-type'); var shareType = $li.data('share-type');
var shareWith = $(li).data('share-with'); var shareWith = $li.data('share-with');
$.post(OC.filePath('core', 'ajax', 'share.php'), {action: action, recipient: shareWith, shareType: shareType, itemSource: itemSource, itemType: itemType}, function(result) { $.post(OC.filePath('core', 'ajax', 'share.php'), {action: action, recipient: shareWith, shareType: shareType, itemSource: itemSource, itemType: itemType}, function(result) {
if (result.status !== 'success') { if (result.status !== 'success') {