Index: openacs-4/packages/contacts/lib/contacts.tcl
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/contacts/lib/contacts.tcl,v
diff -u -r1.21 -r1.22
--- openacs-4/packages/contacts/lib/contacts.tcl 12 Aug 2005 07:45:17 -0000 1.21
+++ openacs-4/packages/contacts/lib/contacts.tcl 13 Aug 2005 14:17:34 -0000 1.22
@@ -29,6 +29,14 @@
}
}
+# If we do not have a search_id, limit the list to only users in the default group.
+
+if {[exists_and_not_null search_id]} {
+ set group_where_clause ""
+} else {
+ set group_where_clause "and group_distinct_member_map.group_id = [contacts::default_group]"
+}
+
set group_by_group_id ""
if { ![exists_and_not_null group_id] } {
set where_group_id " = [contacts::default_group]"
Index: openacs-4/packages/contacts/lib/contacts.xql
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/contacts/lib/contacts.xql,v
diff -u -r1.6 -r1.7
--- openacs-4/packages/contacts/lib/contacts.xql 12 Aug 2005 07:45:17 -0000 1.6
+++ openacs-4/packages/contacts/lib/contacts.xql 13 Aug 2005 14:17:34 -0000 1.7
@@ -3,15 +3,16 @@
-select parties.party_id, organizations.name,
- first_names, last_name
+select parties.party_id
from parties
left join persons on (parties.party_id = persons.person_id)
- left join organizations on (parties.party_id = organizations.organization_id), group_distinct_member_map, cr_items, cr_revisions
+ left join organizations on (parties.party_id =
+ organizations.organization_id)
+ left join cr_items on (parties.party_id = cr_items.item_id)
+ left join cr_revisions on (cr_items.latest_revision =
+ cr_revisions.revision_id ), group_distinct_member_map
where parties.party_id = group_distinct_member_map.member_id
- and parties.party_id = cr_items.item_id
- and cr_items.latest_revision = cr_revisions.revision_id
- and group_distinct_member_map.group_id $where_group_id
+ $group_where_clause
[contact::search_clause -and -search_id $search_id -query $query -party_id "parties.party_id" -revision_id "revision_id"]
[template::list::orderby_clause -orderby -name "contacts"]
@@ -28,9 +29,10 @@
left join persons on (parties.party_id = persons.person_id)
left join organizations on (parties.party_id = organizations.organization_id), group_distinct_member_map
where parties.party_id = group_distinct_member_map.member_id
- and group_distinct_member_map.group_id $where_group_id
+$group_where_clause
[template::list::page_where_clause -and -name "contacts" -key "party_id"]
$group_by_group_id
+[contact::search_clause -and -search_id $search_id -query $query -party_id "parties.party_id" -revision_id "revision_id"]
[template::list::orderby_clause -orderby -name "contacts"]
Index: openacs-4/packages/contacts/tcl/contact-search-condition-type-procs.tcl
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/contacts/tcl/contact-search-condition-type-procs.tcl,v
diff -u -r1.4 -r1.5
--- openacs-4/packages/contacts/tcl/contact-search-condition-type-procs.tcl 15 Jul 2005 01:44:31 -0000 1.4
+++ openacs-4/packages/contacts/tcl/contact-search-condition-type-procs.tcl 13 Aug 2005 14:17:35 -0000 1.5
@@ -671,7 +671,7 @@
switch $operand {
in {
set output_pretty "[_ contacts.lt_The_contact_is_in_the]"
- set output_code "$party_id in ( select member_id from group_distinct_member_map where group_id = '$group_id')"
+ set output_code "group_distinct_member_map.group_id = '$group_id'"
}
not_in {
set output_pretty "[_ contacts.lt_The_contact_is_NOT_in]"
Index: openacs-4/packages/contacts/tcl/contact-search-procs.tcl
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/contacts/tcl/contact-search-procs.tcl,v
diff -u -r1.15 -r1.16
--- openacs-4/packages/contacts/tcl/contact-search-procs.tcl 15 Jul 2005 21:01:52 -0000 1.15
+++ openacs-4/packages/contacts/tcl/contact-search-procs.tcl 13 Aug 2005 14:17:35 -0000 1.16
@@ -158,6 +158,14 @@
} {
Get the total number of results from a search
} {
+
+ # If we do not have a search_id, limit the list to only users in the default group.
+
+ if {[exists_and_not_null search_id]} {
+ set group_where_clause ""
+ } else {
+ set group_where_clause "and group_distinct_member_map.group_id = [contacts::default_group]"
+ }
return [db_string select_results_count {}]
}
@@ -167,12 +175,19 @@
{-not:boolean}
} {
} {
+ # If we do not have a search_id, limit the list to only users in the default group.
+
+ if {[exists_and_not_null search_id]} {
+ set group_where_clause ""
+ } else {
+ set group_where_clause "and group_distinct_member_map.group_id = [contacts::default_group]"
+ }
set query "
select parties.party_id
from parties left join cr_items on (parties.party_id = cr_items.item_id) left join cr_revisions on (cr_items.latest_revision = cr_revisions.revision_id ),
group_distinct_member_map
where parties.party_id = group_distinct_member_map.member_id
- and group_distinct_member_map.group_id = '[contacts::default_group]'
+ $group_where_clause
[contact::search_clause -and -search_id $search_id -query "" -party_id "parties.party_id" -revision_id "revision_id"]
"
if { [exists_and_not_null query] } {
@@ -308,7 +323,7 @@
lappend query_clauses "$party_id = $query"
} elseif { [exists_and_not_null query] } {
foreach term $query {
- lappend query_clauses "upper(contact__name($party_id)) like upper('%${term}%')"
+ lappend query_clauses "upper(organizations.name) like upper('%${term}%')"
}
}
@@ -404,9 +419,9 @@
if { [exists_and_not_null all_or_any] } {
set result {}
if { $object_type == "person" } {
- append result "$party_id in ( select person_id from persons )\n"
+ append result "$party_id = persons.person_id\n"
} elseif { $object_type == "organization" } {
- append result "$party_id in ( select organization_id from organizations )\n"
+ append result "$party_id = organizations.organization_id\n"
}
# the reason we do not put this in the db_foreach statement is because we
Index: openacs-4/packages/contacts/tcl/contact-search-procs.xql
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/contacts/tcl/contact-search-procs.xql,v
diff -u -r1.6 -r1.7
--- openacs-4/packages/contacts/tcl/contact-search-procs.xql 15 Jul 2005 21:01:52 -0000 1.6
+++ openacs-4/packages/contacts/tcl/contact-search-procs.xql 13 Aug 2005 14:17:35 -0000 1.7
@@ -23,16 +23,6 @@
-
-
- select parties.party_id
- from parties left join cr_items on (parties.party_id = cr_items.item_id) left join cr_revisions on (cr_items.latest_revision = cr_revisions.revision_id ),
- group_distinct_member_map
- where parties.party_id = group_distinct_member_map.member_id
- and group_distinct_member_map.group_id = '[contacts::default_group]'
- [contact::search_clause -and -search_id $search_id -query "" -party_id "parties.party_id" -revision_id "revision_id"]
-
-
@@ -48,7 +38,7 @@
select count(*)
from parties left join cr_items on (parties.party_id = cr_items.item_id) left join cr_revisions on (cr_items.latest_revision = cr_revisions.revision_id ) , group_distinct_member_map
where parties.party_id = group_distinct_member_map.member_id
- and group_distinct_member_map.group_id = '[contacts::default_group]'
+ $group_where_clause
[contact::search_clause -and -search_id $search_id -query $query -party_id "parties.party_id" -revision_id "revision_id"]
Index: openacs-4/packages/contacts/tcl/contacts-procs-postgresql.xql
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/contacts/tcl/contacts-procs-postgresql.xql,v
diff -u -r1.9 -r1.10
--- openacs-4/packages/contacts/tcl/contacts-procs-postgresql.xql 26 Jul 2005 12:58:03 -0000 1.9
+++ openacs-4/packages/contacts/tcl/contacts-procs-postgresql.xql 13 Aug 2005 14:17:35 -0000 1.10
@@ -20,7 +20,6 @@
from groups left join contact_groups on ( groups.group_id = contact_groups.group_id )
where groups.group_id not in ('-1','[contacts::default_group]')
and groups.group_id not in ( select gcm.component_id from group_component_map gcm where gcm.group_id != -1 )
- and acs_permission__permission_p(groups.group_id,:user_id,:privilege_required)
$filter_clause
order by mapped_p desc, CASE WHEN contact_groups.default_p THEN '000000000' ELSE upper(groups.group_name) END