diff --git a/apps/files_sharing/ajax/share.php b/apps/files_sharing/ajax/share.php index 0de899a0e1..10a235e432 100644 --- a/apps/files_sharing/ajax/share.php +++ b/apps/files_sharing/ajax/share.php @@ -8,9 +8,7 @@ $sources = explode(";", $_POST['sources']); $uid_shared_with = $_POST['uid_shared_with']; $permissions = $_POST['permissions']; foreach ($sources as $source) { - foreach ($uid_shared_with as $uid) { - new OC_Share($source, $uid, $permissions); - } + new OC_Share($source, $uid_shared_with, $permissions); } ?> \ No newline at end of file diff --git a/apps/files_sharing/ajax/userautocomplete.php b/apps/files_sharing/ajax/userautocomplete.php index 816e01ba9e..c6519cc6b5 100644 --- a/apps/files_sharing/ajax/userautocomplete.php +++ b/apps/files_sharing/ajax/userautocomplete.php @@ -7,23 +7,22 @@ if (!OC_User::isLoggedIn()) { echo json_encode(array("status" => "error", "data" => array("message" => "Authentication error"))); exit(); } -$query = $_GET['term']; -$length = strlen($query); -$query = strtolower($query); $users = array(); $ocusers = OC_User::getUsers(); $self = OC_User::getUser(); $groups = OC_GROUP::getUserGroups($self); +$users[] = ""; +$users[] = ""; echo json_encode($users); ?> diff --git a/apps/files_sharing/appinfo/app.php b/apps/files_sharing/appinfo/app.php index 7f7aebb2b2..0587ce550e 100644 --- a/apps/files_sharing/appinfo/app.php +++ b/apps/files_sharing/appinfo/app.php @@ -5,7 +5,9 @@ require_once('apps/files_sharing/sharedstorage.php'); OC_Filesystem::registerStorageType("shared", "OC_Filestorage_Shared", array("datadir"=>"string")); OC_Util::addScript("files_sharing", "share"); +OC_Util::addScript("3rdparty", "chosen/chosen.jquery.min"); OC_Util::addStyle( 'files_sharing', 'sharing' ); +OC_Util::addStyle("3rdparty", "chosen/chosen"); OC_App::addNavigationSubEntry("files_index", array( "id" => "files_sharing_list", "order" => 10, diff --git a/apps/files_sharing/js/share.js b/apps/files_sharing/js/share.js index d6cf45bf44..f914f8da17 100644 --- a/apps/files_sharing/js/share.js +++ b/apps/files_sharing/js/share.js @@ -28,17 +28,21 @@ $(document).ready(function() { } createShareDropdown(filenames, files); }); - $('#uid_shared_with').live('keyup', function() { - $(this).autocomplete({ - source: OC.linkTo('files_sharing','ajax/userautocomplete.php') - }); - $('.ui-autocomplete').click(function(event) { - event.stopPropagation(); + $('#uid_shared_with').live('change', function() { + var source = $('#dropdown').data('file'); + var uid_shared_with = $(this).val(); + var permissions = 0; + var data = 'sources='+encodeURIComponent(source)+'&uid_shared_with='+encodeURIComponent(uid_shared_with)+'&permissions='+encodeURIComponent(permissions); + $.ajax({ + type: 'POST', + url: OC.linkTo('files_sharing','ajax/share.php'), + cache: false, + data: data }); }); $('.permissions').live('change', function() { var permissions; - if (this.checked) { + if ($(this).checked) { permissions = 1; } else { permissions = 0; @@ -111,7 +115,9 @@ $(document).ready(function() { function createShareDropdown(filenames, files) { var html = "