From 1ad49aaf2f1cb23a81909576437997fffa3951d2 Mon Sep 17 00:00:00 2001 From: ben Date: Thu, 31 Jul 2008 15:56:43 +0000 Subject: More updates for collections - save now works properly. git-svn-id: https://code.elgg.org/elgg/trunk@1637 36083f99-b078-4883-b0ff-0f9b5a30f544 --- engine/lib/access.php | 21 +++++++++++++-------- views/default/friends/picker.php | 4 +++- 2 files changed, 16 insertions(+), 9 deletions(-) diff --git a/engine/lib/access.php b/engine/lib/access.php index a1741f8bf..29f87a1f8 100644 --- a/engine/lib/access.php +++ b/engine/lib/access.php @@ -213,16 +213,21 @@ global $CONFIG; $collection_id = (int) $collection_id; - if ($collection = get_access_collection($collection_id)) { - delete_data("delete from {$CONFIG->dbprefix}access_collection_membership where access_collection_id = {$collection_id}"); - } + $collections = get_write_access_array(); + + if (array_key_exists($collection_id, $collections)) { - if (is_array($members) && sizeof($members) > 0) { - foreach($members as $member) { - $member = (int) $member; - add_user_to_access_collection($member, $collection_id); + delete_data("delete from {$CONFIG->dbprefix}access_collection_membership where access_collection_id = {$collection_id}"); + + if (is_array($members) && sizeof($members) > 0) { + foreach($members as $member) { + $member = (int) $member; + if (get_user($member)) + insert_data("insert into {$CONFIG->dbprefix}access_collection_membership set access_collection_id = {$collection_id}, user_guid = {$member}"); + } + return true; } - return true; + } return false; diff --git a/views/default/friends/picker.php b/views/default/friends/picker.php index d813e6fe7..2f51a02d7 100644 --- a/views/default/friends/picker.php +++ b/views/default/friends/picker.php @@ -102,7 +102,9 @@ $('#collectionMembersForm').submit(function() { var inputs = []; $(':input', this).each(function() { - inputs.push(this.name + '=' + escape(this.value)); + if (this.type != 'checkbox' || (this.type == 'checkbox' && this.checked != false)) { + inputs.push(this.name + '=' + escape(this.value)); + } }); jQuery.ajax({ type: "POST", -- cgit v1.2.3