Index: openacs-4/packages/contacts/contacts.info =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/contacts/contacts.info,v diff -u -r1.50 -r1.51 --- openacs-4/packages/contacts/contacts.info 15 Nov 2005 15:56:45 -0000 1.50 +++ openacs-4/packages/contacts/contacts.info 17 Nov 2005 18:22:01 -0000 1.51 @@ -7,14 +7,14 @@ f f - + Matthew Geddert This application lets you collaboratively view, edit and categorize contacts. - 2005-11-15 + 2005-11-17 Contacts is an application for managing all those people and or organization you need to keep track of. It has a complete UI for storing and categorizing contacts. Each contact can have an arbitrary number of custom attributes associated with it, including other contacts (i.e. a certain contact "belongs" to a certain organization). It also functions as a service contract provider for attributes related to users in your system 0 - + Index: openacs-4/packages/contacts/catalog/contacts.de_DE.ISO-8859-1.xml =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/contacts/catalog/contacts.de_DE.ISO-8859-1.xml,v diff -u -r1.17 -r1.18 --- openacs-4/packages/contacts/catalog/contacts.de_DE.ISO-8859-1.xml 14 Nov 2005 22:55:45 -0000 1.17 +++ openacs-4/packages/contacts/catalog/contacts.de_DE.ISO-8859-1.xml 17 Nov 2005 18:22:01 -0000 1.18 @@ -1,5 +1,5 @@ - + -- eine Gruppe markieren -- -- Neue Nachricht erstellen -- Index: openacs-4/packages/contacts/catalog/contacts.en_US.ISO-8859-1.xml =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/contacts/catalog/contacts.en_US.ISO-8859-1.xml,v diff -u -r1.50 -r1.51 --- openacs-4/packages/contacts/catalog/contacts.en_US.ISO-8859-1.xml 15 Nov 2005 15:56:46 -0000 1.50 +++ openacs-4/packages/contacts/catalog/contacts.en_US.ISO-8859-1.xml 17 Nov 2005 18:22:01 -0000 1.51 @@ -1,5 +1,5 @@ - + -- select a group -- -- Create New Message -- Index: openacs-4/packages/contacts/lib/contacts-aggregated.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/contacts/lib/contacts-aggregated.adp,v diff -u -r1.2 -r1.3 --- openacs-4/packages/contacts/lib/contacts-aggregated.adp 14 Nov 2005 22:55:45 -0000 1.2 +++ openacs-4/packages/contacts/lib/contacts-aggregated.adp 17 Nov 2005 18:22:02 -0000 1.3 @@ -20,4 +20,7 @@
- +
+ + + \ No newline at end of file Index: openacs-4/packages/contacts/lib/contacts-aggregated.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/contacts/lib/contacts-aggregated.tcl,v diff -u -r1.7 -r1.8 --- openacs-4/packages/contacts/lib/contacts-aggregated.tcl 15 Nov 2005 16:27:40 -0000 1.7 +++ openacs-4/packages/contacts/lib/contacts-aggregated.tcl 17 Nov 2005 18:22:02 -0000 1.8 @@ -65,48 +65,36 @@ # If we are extending the result list then # we add the element dynamically to the list -set extend_pretty_name "" -if { [exists_and_not_null extend_id] } { - set extend_info [contact::extend::option_info -extend_id $extend_id] - set extend_var_name [lindex [lindex $extend_info 0] 0] - set extend_pretty_name [lindex [lindex $extend_info 0] 1] - set extend_subquery [lindex [lindex $extend_info 0] 2] - set elements [list \ - option [list \ - label "$attr_name"] \ - result [list \ - display_template { - @contacts.result@ - }] \ - $extend_var_name [list \ - label "$extend_pretty_name" \ - display_template { - - @contacts.$extend_var_name@ - - - 0.00 - - }]] - # For the db_multirow extend variables - set extend_list [list result $extend_var_name] +set elements [list \ + option [list \ + label "$attr_name"] \ + result [list \ + display_template { + @contacts.result@ + }]] -} else { - set elements [list \ - option [list \ - label "$attr_name"] \ - result [list \ - display_template { - @contacts.result@ - } - ]] +set extend_list [list result] - # For the db_multirow extend variables - set extend_list [list result] +set saved_extend_ids [db_list get_saved_extend_ids { }] +foreach extend $extend_id { + lappend saved_extend_ids $extend } +set extend_id $saved_extend_ids + +if { [exists_and_not_null extend_id] } { + foreach extend $extend_id { + set extend_info [contact::extend::option_info -extend_id $extend] + set extend_var_name [lindex [lindex $extend_info 0] 0] + set extend_pretty_name [lindex [lindex $extend_info 0] 1] + lappend elements $extend_var_name [list label "$extend_pretty_name"] + # For the db_multirow extend variables + lappend extend_list $extend_var_name + } +} + # We create the list template::list::create \ -name "contacts" \ @@ -116,7 +104,6 @@ -bulk_actions "" \ -elements $elements - db_multirow -extend $extend_list contacts $query_name " " { # We get the value_id here and not in the options query since # the value_id is only present when one attribute is associated @@ -136,21 +123,32 @@ set result [db_string $result_query " " -default 0] # Get the extend_var_name value for the extend attribute - if {[exists_and_not_null extend_var_name] } { - if { [catch { set $extend_var_name [db_string $extend_result_query " " -default 0] } errMsg] } { - # We got an error so we are going to return to the user - set title "[_ contacts.extend_error_msg]" - set error_pos [string first "ERROR: " $errMsg] - set sql_pos [string first "SQL: " $errMsg] - set error [string range $errMsg [expr $error_pos + 7] [expr $sql_pos - 1]] - set sql [string range $errMsg [expr $sql_pos + 5] [string length $errMsg]] - ad_return_error $title "[_ contacts.Error]:
$error

SQL:
$sql
" - ad_script_abort + if {[exists_and_not_null extend_id] } { + + foreach extend $extend_id { + set extend_info [contact::extend::option_info -extend_id $extend] + set extend_var_name [lindex [lindex $extend_info 0] 0] + set extend_subquery [lindex [lindex $extend_info 0] 2] + if { [catch { set $extend_var_name [db_string $extend_result_query " " -default 0] + set value [db_string $extend_result_query " " -default 0] } errMsg] } { + # We got an error so we are going to return to the user + set title "[_ contacts.extend_error_msg]" + set error_pos [string first "ERROR: " $errMsg] + set sql_pos [string first "SQL: " $errMsg] + set error [string range $errMsg [expr $error_pos + 7] [expr $sql_pos - 1]] + set sql [string range $errMsg [expr $sql_pos + 5] [string length $errMsg]] + ad_return_error $title "[_ contacts.Error]:
$error

SQL:
$sql
" + ad_script_abort + } + if { [empty_string_p $value] } { + set $extend_var_name "0.00" + } } } } + # This is for the display of the forms # for the aggregate and extend options set select_options [list] @@ -191,11 +189,32 @@ {aggregate_attribute_id:integer(hidden) {value $attr_id} } - {aggregate_extend_id:text(select) - {label "[_ contacts.Extend_result_list_by]" } + {aggregate_extend_id:text(multiselect),optional + {label "
[_ contacts.Extend_result_list_by]:
" } {options $extend_options} {html { onChange document.extend.submit();}} {value $extend_id} } } + +ad_form -has_submit 1 -name save -form { + {search_id:integer(hidden) + {value $search_id} + } + {aggregate_attribute_id:integer(hidden) + {value $attr_id} + } + {extend_id:text(hidden) + {value $extend_id} + } +} -on_submit { + foreach extend $extend_id { + set already_p [db_string check { } -default 0] + if { !$already_p } { + db_dml insert_extend { } + } + } +} -after_submit { + ad_returnredirect "?search_id=$search_id&aggregate_attribute_id=$aggregate_attribute_id" +} Index: openacs-4/packages/contacts/lib/contacts-aggregated.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/contacts/lib/contacts-aggregated.xql,v diff -u -r1.6 -r1.7 --- openacs-4/packages/contacts/lib/contacts-aggregated.xql 15 Nov 2005 16:27:40 -0000 1.6 +++ openacs-4/packages/contacts/lib/contacts-aggregated.xql 17 Nov 2005 18:22:02 -0000 1.7 @@ -1,6 +1,39 @@ + + + select + ceo.extend_id + from + contact_search_extend_map cse, + contact_extend_options ceo + where + cse.search_id = :search_id + and ceo.extend_id = cse.extend_id + and ceo.aggregated_p = 't' + + + + + + select + 1 + from + contact_search_extend_map + where + search_id = :search_id + and extend_id = :extend + + + + + + insert into contact_search_extend_map (search_id, extend_id, attribute_id) + values (:search_id, :extend, null) + + + select @@ -150,14 +183,19 @@ select ceo.pretty_name, - ceo.extend_id + ceo.extend_id as e_id from - contact_extend_options ceo, - contact_search_extend_map csem + contact_extend_options ceo where ceo.aggregated_p = 't' - and csem.extend_id = ceo.extend_id - and csem.search_id = :search_id + and ceo.extend_id not in ( + select + extend_id + from + contact_search_extend_map + where + search_id = :search_id + ) @@ -188,7 +226,6 @@ a.object_id = i.latest_revision and i.item_id = p.party_id and a.value_id = $value_id ) - Index: openacs-4/packages/contacts/lib/contacts.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/contacts/lib/contacts.tcl,v diff -u -r1.34 -r1.35 --- openacs-4/packages/contacts/lib/contacts.tcl 17 Nov 2005 16:23:45 -0000 1.34 +++ openacs-4/packages/contacts/lib/contacts.tcl 17 Nov 2005 18:22:02 -0000 1.35 @@ -213,7 +213,7 @@ if { ![exists_and_not_null attr_val_name] && [exists_and_not_null search_id] } { - set object_type [db_string get_search_object_type { }] + set object_type [db_string get_object_type { }] switch $object_type { person { set default_attr_extend [parameter::get -parameter "DefaultPersonAttributeExtension"] Index: openacs-4/packages/contacts/www/index.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/contacts/www/index.tcl,v diff -u -r1.18 -r1.19 --- openacs-4/packages/contacts/www/index.tcl 14 Nov 2005 22:55:45 -0000 1.18 +++ openacs-4/packages/contacts/www/index.tcl 17 Nov 2005 18:22:02 -0000 1.19 @@ -14,7 +14,7 @@ {add_person:optional} {add_organization:optional} {aggregate_attribute_id ""} - {aggregate_extend_id ""} + {aggregate_extend_id:multiple ""} {extend_values:optional ""} {attr_val_name:optional ""} } Index: openacs-4/packages/contacts/www/admin/ext-search-options.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/contacts/www/admin/ext-search-options.tcl,v diff -u -r1.4 -r1.5 --- openacs-4/packages/contacts/www/admin/ext-search-options.tcl 14 Nov 2005 22:55:46 -0000 1.4 +++ openacs-4/packages/contacts/www/admin/ext-search-options.tcl 17 Nov 2005 18:22:02 -0000 1.5 @@ -106,7 +106,7 @@ lappend row_list \ action_buttons [list] } else { - set extra_query "where extend_id not in (select extend_id from contact_search_extend_map where search_id in ([template::util::tcl_to_sql_list $search_id]))" + set extra_query "where extend_id not in (select extend_id from contact_search_extend_map where search_id in ([template::util::tcl_to_sql_list $search_id])) and aggregated_p ='f'" lappend bulk_actions "[_ contacts.Set_default]" set-default "[_ contacts.Stored_extended_default]" lappend row_list \ checkbox [list] Index: openacs-4/packages/contacts/www/admin/search-list.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/contacts/www/admin/search-list.tcl,v diff -u -r1.1 -r1.2 --- openacs-4/packages/contacts/www/admin/search-list.tcl 11 Nov 2005 22:57:43 -0000 1.1 +++ openacs-4/packages/contacts/www/admin/search-list.tcl 17 Nov 2005 18:22:02 -0000 1.2 @@ -26,16 +26,21 @@ -key search_id \ -elements { title { - label {#contacts.Title#} + label {[_ contacts.Title]} display_col title link_url_eval "../search?search_id=$search_id" } + owner { + display_template { + by @searches.owner@ + } + } query { - label {#contacts.Query#} + label { [_ contacts.Query]} display_col query;noquote } results { - label {#contacts.Results#} + label {[_ contacts.Results]} display_col results link_url_eval $search_url } @@ -69,8 +74,12 @@ set search_ids [list] set admin_p [permission::permission_p -object_id $package_id -privilege "admin"] -db_multirow -extend {query search_url make_public_url delete_url copy_url results} -unclobber searches select_searches {} { +db_multirow -extend {query search_url make_public_url delete_url copy_url results owner} -unclobber searches select_searches {} { set search_url [export_vars -base ../ -url {search_id}] + set owner [contact::name -party_id $owner_id] + if { [empty_string_p $owner] } { + set owner "Public" + } lappend search_ids $search_id } Index: openacs-4/packages/contacts/www/admin/search-list.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/contacts/www/admin/search-list.xql,v diff -u -r1.1 -r1.2 --- openacs-4/packages/contacts/www/admin/search-list.xql 11 Nov 2005 22:57:43 -0000 1.1 +++ openacs-4/packages/contacts/www/admin/search-list.xql 17 Nov 2005 18:22:02 -0000 1.2 @@ -3,16 +3,16 @@ -( select search_id, title, upper(title) as order_title, all_or_any, object_type +( select search_id, title, upper(title) as order_title, all_or_any, object_type, owner_id from contact_searches - where owner_id = :owner_id - and title is not null + where + title is not null and not deleted_p ) union ( - select search_id, 'Search \#' || to_char(search_id,'FM9999999999999999999') || ' on ' || to_char(creation_date,'Mon FMDD') as title, 'zzzzzzzzzzz' as order_title, all_or_any, contact_searches.object_type + select search_id, 'Search \#' || to_char(search_id,'FM9999999999999999999') || ' on ' || to_char(creation_date,'Mon FMDD') as title, 'zzzzzzzzzzz' as order_title, all_or_any, contact_searches.object_type, owner_id from contact_searches, acs_objects - where owner_id = :owner_id - and search_id = object_id + where + search_id = object_id and contact_searches.title is null and not deleted_p limit 10