Index: openacs-4/packages/contacts/lib/contacts.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/contacts/lib/contacts.tcl,v diff -u -r1.20 -r1.21 --- openacs-4/packages/contacts/lib/contacts.tcl 9 Aug 2005 12:44:19 -0000 1.20 +++ openacs-4/packages/contacts/lib/contacts.tcl 12 Aug 2005 07:45:17 -0000 1.21 @@ -35,7 +35,7 @@ } else { if {[llength $group_id] > 1} { set where_group_id " IN ('[join $group_id "','"]')" - set group_by_group_id "group by parties.party_id , cr_revisions.revision_id, parties.email" + set group_by_group_id "group by parties.party_id , parties.email" } else { set where_group_id " = :group_id" } @@ -45,12 +45,16 @@ set package_id [apm_package_id_from_key contacts] -if { $orderby == "first_names,asc" } { - set name_order 0 - set name_label "[_ contacts.Sort_by]: [_ contacts.First_Names] | [_ contacts.Last_Name]" -} else { - set name_order 1 - set name_label "[_ contacts.Sort_by] [_ contacts.First_Names] | [_ contacts.Last_Name]" +switch $orderby { + "first_names,asc" { + set name_label "[_ contacts.Sort_by]: [_ contacts.First_Names] | [_ contacts.Last_Name] | [_ contacts.Organization]" + } + "last_name,asc" { + set name_label "[_ contacts.Sort_by] [_ contacts.First_Names] | [_ contacts.Last_Name] | [_ contacts.Organization]" + } + "organization,asc" { + set name_label "[_ contacts.Sort_by] [_ contacts.First_Names] | [_ contacts.Last_Name] | [_ contacts.Organization]" + } } append name_label "    [_ contacts.Show]: " @@ -147,14 +151,20 @@ } -orderby { first_names { label "[_ contacts.First_Name]" - orderby_asc "lower(contact__name(party_id,'f')) asc" - orderby_desc "lower(contact__name(party_id,'f')) asc" + orderby_asc "lower(first_names) asc" + orderby_desc "lower(first_names) asc" } last_name { label "[_ contacts.Last_Name]" - orderby_asc "lower(contact__name(party_id,'t')) asc" - orderby_desc "lower(contact__name(party_id,'t')) asc" + orderby_asc "lower(last_name) asc" + orderby_desc "lower(last_name) asc" } + organization { + label "[_ contacts.Last_Name]" + orderby_asc "lower(organizations.name) asc" + orderby_desc "lower(organizations.name) asc" + } + default_value first_names,asc } -formats { normal { @@ -179,8 +189,9 @@ } } -db_multirow -extend {contact_url} -unclobber contacts contacts_select {} { +db_multirow -extend {contact_url name} -unclobber contacts contacts_select {} { set contact_url [contact::url -party_id $party_id] + set name [contact::name -party_id $party_id] } if { [exists_and_not_null query] && [template::multirow size contacts] == 1 } {