Make unshare work from dropdown

This commit is contained in:
Michael Gapczynski 2011-08-11 14:20:50 -04:00
parent 6d25943f2f
commit c65046773d
3 changed files with 11 additions and 9 deletions

View File

@ -4,7 +4,7 @@ $RUNTIME_NOAPPS = true;
require_once('../../../lib/base.php'); require_once('../../../lib/base.php');
require_once('../lib_share.php'); require_once('../lib_share.php');
$source = $_GET['source']; $source = "/".OC_User::getUser()."/files".$_GET['source'];
$uid_shared_with = $_GET['uid_shared_with']; $uid_shared_with = $_GET['uid_shared_with'];
OC_Share::unshare($source, $uid_shared_with); OC_Share::unshare($source, $uid_shared_with);

View File

@ -33,7 +33,7 @@ $(document).ready(function() {
if (!($(event.target).hasClass('drop')) && $(event.target).parents().index($('#dropdown')) == -1) { if (!($(event.target).hasClass('drop')) && $(event.target).parents().index($('#dropdown')) == -1) {
if ($('#dropdown').is(':visible')) { if ($('#dropdown').is(':visible')) {
$('#dropdown').hide('blind', function() { $('#dropdown').hide('blind', function() {
$('#dropdown').remove(); $('#dropdown').remove();S
$('tr').removeClass('mouseOver'); $('tr').removeClass('mouseOver');
}); });
} }
@ -51,7 +51,7 @@ $(document).ready(function() {
cache: false, cache: false,
data: data, data: data,
success: function() { success: function() {
addUser(uid_shared_with, 0, false); addUser(uid_shared_with, permissions, false);
} }
}); });
}); });
@ -82,11 +82,10 @@ $(document).ready(function() {
}); });
$('.unshare').live('click', function(event) { $('.unshare').live('click', function(event) {
// TODO Fix unshare
event.preventDefault(); event.preventDefault();
event.stopPropagation(); var user = $(this).parent();
var source = $('#dropdown').data('file'); var source = $('#dropdown').data('file');
var uid_shared_with = $(this).parent().data('uid_shared_with'); var uid_shared_with = user.data('uid_shared_with');
var data = 'source='+encodeURIComponent(source)+'&uid_shared_with='+encodeURIComponent(uid_shared_with); var data = 'source='+encodeURIComponent(source)+'&uid_shared_with='+encodeURIComponent(uid_shared_with);
$.ajax({ $.ajax({
type: 'GET', type: 'GET',
@ -94,7 +93,10 @@ $(document).ready(function() {
cache: false, cache: false,
data: data, data: data,
success: function() { success: function() {
$(this).parent().remove(); var option = "<option value='"+uid_shared_with+"'>"+uid_shared_with+"</option>";
$(user).remove();
$(option).appendTo('#share_with');
$('#share_with').trigger('liszt:updated');
} }
}); });
}); });

View File

@ -21,7 +21,7 @@ $(document).ready(function() {
}); });
// Sets the file link behaviour : // Sets the file link behaviour :
$('td.filename a').live('click',function(event) { $('td.filename.name a').live('click',function(event) {
event.preventDefault(); event.preventDefault();
var filename=$(this).parent().parent().data('file'); var filename=$(this).parent().parent().data('file');
if(!FileList.isLoading(filename)){ if(!FileList.isLoading(filename)){