Index: openacs-4/packages/contacts/www/contact-rels-postgresql.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/contacts/www/contact-rels-postgresql.xql,v diff -u -r1.3 -r1.4 --- openacs-4/packages/contacts/www/contact-rels-postgresql.xql 14 Jun 2005 06:08:28 -0000 1.3 +++ openacs-4/packages/contacts/www/contact-rels-postgresql.xql 19 Jun 2005 09:07:04 -0000 1.4 @@ -1,4 +1,4 @@ - +` @@ -55,6 +55,7 @@ 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 = '-2' + $type_clause [contact::search_clause -and -search_id $search_id -query $query -party_id "parties.party_id" -revision_id "revision_id"] order by upper(contact__name(parties.party_id)) limit 100 Index: openacs-4/packages/contacts/www/contact-rels.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/contacts/www/contact-rels.tcl,v diff -u -r1.11 -r1.12 --- openacs-4/packages/contacts/www/contact-rels.tcl 14 Jun 2005 06:08:28 -0000 1.11 +++ openacs-4/packages/contacts/www/contact-rels.tcl 19 Jun 2005 09:07:04 -0000 1.12 @@ -56,12 +56,13 @@ } if { $org_valid_p && $person_valid_p } { # we do nothing + set type_clause } else { if { $org_valid_p } { - set rel_type "organization_rel" + set type_clause "and parties.party_id in ( select organization_id from organizations )" set pretty_plural_list_name "[_ contacts.organizations]" } elseif { $person_valid_p } { - set rel_type "membership_rel" + set type_clause "and parties.party_id in ( select person_id from persons )" set pretty_plural_list_name "[_ contacts.people]" } else { error "[_ contacts.lt_neither_person_nor_or]" @@ -164,21 +165,12 @@ } -set rel_options [list [list "[_ contacts.--select_one--]" ""]] set rel_options [db_list_of_lists get_rels {}] +set rel_options [ams::util::localize_and_sort_list_of_lists -list $rel_options] -set rel_options "{{-Select One-} {}} $rel_options" +set rel_options [concat [list [list "[_ contacts.--select_one--]" ""]] $rel_options] - - - -db_foreach get_rels {} { - set pretty_name [lang::util::localize $pretty_name] - lappend rel_options [list $pretty_name $role] - } - - ad_form -name "search" -method "GET" -export {party_id} -form { {role_two:text(select) {label "[_ contacts.Add]"} {options $rel_options}} {query:text(text) {label ""} {html {size 24}}}