Index: openacs-4/packages/contacts/lib/contacts.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/contacts/lib/contacts.adp,v diff -u -r1.2 -r1.3 --- openacs-4/packages/contacts/lib/contacts.adp 27 Jul 2005 14:06:14 -0000 1.2 +++ openacs-4/packages/contacts/lib/contacts.adp 8 Sep 2005 18:04:47 -0000 1.3 @@ -1 +1,8 @@ + +
+ You can extend this search by: + +
+
+
\ No newline at end of file Index: openacs-4/packages/contacts/lib/contacts.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/contacts/lib/contacts.tcl,v diff -u -r1.22 -r1.23 --- openacs-4/packages/contacts/lib/contacts.tcl 13 Aug 2005 14:17:34 -0000 1.22 +++ openacs-4/packages/contacts/lib/contacts.tcl 8 Sep 2005 18:04:47 -0000 1.23 @@ -1,5 +1,5 @@ set required_param_list [list] -set optional_param_list [list base_url] +set optional_param_list [list base_url extend_p extend_values] set default_param_list [list orderby format query page page_size package_id search_id group_id ] set optional_unset_list [list] @@ -32,7 +32,31 @@ # 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 "" + set group_where_clause "" + # Also we can extend this search. + # Is to allow extend the list by any extend_options defined in contact_extend_options + set available_options [contact::extend::get_options -ignore_extends $extend_values] + ad_form -name extend -form { + {extend_option:text(select),optional + {label "Available Options" } + {options {{" - - - - - - -" ""} $available_options}} + } + {search_id:text(hidden) + {value "$search_id"} + } + {extend_values:text(hidden) + {value "$extend_values"} + } + } -on_submit { + # We clear the list when no value is submited, otherwise + # we acumulate the extend values. + if { [empty_string_p $extend_option] } { + set extend_values [list] + } else { + lappend extend_values [list $extend_option] + } + ad_returnredirect [export_vars -base "?" {search_id extend_values}] + } } else { set group_where_clause "and group_distinct_member_map.group_id = [contacts::default_group]" } @@ -104,6 +128,53 @@ # if { [permission::permission_p -object_id $package_id -privilege "delete"] } { # lappend bulk_actions "[_ contacts.Delete]" "${base_url}delete" "[_ contacts.lt_Delete_the_selected_C]" # } + +set elements [list \ + contact [list \ + label \ + {$name_label} \ + display_template \ + { + @contacts.name@ + + \[[_ contacts.Edit]\] + + + + + @contacts.email@ + + + + , + + @contacts.url@ + + + + }] \ + contact_id [list display_col party_id] \ + first_names [list display_col first_names] \ + last_name [list display_col last_name] \ + organization [list display_col organization] \ + email [list display_col email]] + +set row_list [list \ + checkbox {} \ + contact {}] + +# For each extend value we add the element to the list and to the query +set extend_query "" +foreach value $extend_values { + set extend_info [lindex [contact::extend::option_info -extend_id $value] 0] + set name [lindex $extend_info 0] + set pretty_name [lindex $extend_info 1] + set sub_query [lindex $extend_info 2] + lappend elements $name [list label "$pretty_name" display_col $name] + lappend row_list $name [list] + append extend_query "( $sub_query ) as $name," +} + template::list::create \ -html {width 100%} \ -name "contacts" \ @@ -119,39 +190,8 @@ -bulk_actions $bulk_actions \ -bulk_action_method post \ -bulk_action_export_vars { search_id return_url } \ - -elements { - contact { - label "$name_label" - display_template { - @contacts.name@ \[[_ contacts.Edit]\] - - - - @contacts.email@ - - - , @contacts.url@ - - - - } - } - contact_id { - display_col party_id - } - first_names { - display_col first_names - } - last_name { - display_col last_name - } - organization { - display_col organization - } - email { - display_col email - } - } -filters { + -elements $elements \ + -filters { search_id {} page_size {} tasks_interval {} @@ -179,8 +219,7 @@ label "[_ contacts.Table]" layout table row { - checkbox {} - contact {} + $row_list } } csv { @@ -197,7 +236,7 @@ } } -db_multirow -extend {contact_url name} -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] } @@ -210,3 +249,4 @@ list::write_output -name contacts + Index: openacs-4/packages/contacts/lib/contacts.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/contacts/lib/contacts.xql,v diff -u -r1.9 -r1.10 --- openacs-4/packages/contacts/lib/contacts.xql 15 Aug 2005 09:09:45 -0000 1.9 +++ openacs-4/packages/contacts/lib/contacts.xql 8 Sep 2005 18:04:47 -0000 1.10 @@ -20,7 +20,8 @@ -select organizations.name, +select $extend_query + organizations.name, first_names, last_name, parties.party_id, parties.email,