Index: openacs-4/packages/contacts/lib/contact-attributes.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/contacts/lib/contact-attributes.adp,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/contacts/lib/contact-attributes.adp 21 Jun 2005 12:25:18 -0000 1.1 @@ -0,0 +1,12 @@ + + +

@attributes.section@

+
+ +
@attributes.attribute@:
+
@attributes.value;noquote@
+
+
+
+
+ Index: openacs-4/packages/contacts/lib/contact-attributes.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/contacts/lib/contact-attributes.tcl,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/contacts/lib/contact-attributes.tcl 21 Jun 2005 12:25:18 -0000 1.1 @@ -0,0 +1,62 @@ +# packages/contacts/lib/contact-attributes.tcl +# +# Include for the contact attributes +# +# @author Malte Sussdorff (sussdorff@sussdorff.de) +# @creation-date 2005-06-21 +# @arch-tag: 1df33468-0ff5-44e2-874a-5eec78747b8c +# @cvs-id $Id: contact-attributes.tcl,v 1.1 2005/06/21 12:25:18 maltes Exp $ + +foreach required_param {party_id} { + if {![info exists $required_param]} { + return -code error "$required_param is a required parameter." + } +} +foreach optional_param {package_id hidden_attributes} { + if {![info exists $optional_param]} { + set $optional_param {} + } +} + +if {[empty_string_p $package_id]} { + set package_id [ad_conn package_id] +} + +set object_type [util_memoize [list acs_object_type $party_id]] + +set groups_belonging_to [db_list get_party_groups { select group_id from group_distinct_member_map where member_id = :party_id }] +if { [lsearch $groups_belonging_to -2] < 0 } { + ad_return_error "[_ contacts.lt_This_users_has_not_be]" "[_ contacts.lt_This_user_is_awaiting]" +} +set ams_forms [list] +foreach group [contact::groups -expand "all" -privilege_required "read"] { + set group_id [lindex $group 1] + if { [lsearch $groups_belonging_to $group_id] >= 0 } { + lappend ams_forms "${package_id}__${group_id}" + } +} + +set revision_id [contact::live_revision -party_id $party_id] + +# This is the multirow that gets the values for each attribute +# If you map the categories you have to check for the group (which is +# passed along in the form_name) and see the mapped categories. Then you have to +# retrieve the values for the category and append them to the +# attributes multirow with a section heading (e.g. the name of the +# category tree) and the pretty_name of the category along with the +# value. + +multirow create attributes section attribute value +foreach form $ams_forms { + set values [ams::values -package_key "contacts" -object_type $object_type -list_name $form -object_id $revision_id -format "html"] + foreach {section attribute_name pretty_name value} $values { + if { [lsearch $hidden_attributes $attribute_name] < 0 } { + multirow append attributes $section $pretty_name $value + } + } +} +set append_list [list] +callback contact::append_attribute -multirow_name append_list -name [contact::name -party_id $party_id] +foreach append $append_list { + multirow append attributes [lindex $append 0] [lindex $append 1] [lindex $append 2] +} Index: openacs-4/packages/contacts/lib/contact-attributes.tcl~ =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/contacts/lib/Attic/contact-attributes.tcl~,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/contacts/lib/contact-attributes.tcl~ 21 Jun 2005 12:25:18 -0000 1.1 @@ -0,0 +1,60 @@ +# packages/contacts/lib/contact-attributes.tcl +# +# Include for the contact attributes +# +# @author Malte Sussdorff (sussdorff@sussdorff.de) +# @creation-date 2005-06-21 +# @arch-tag: 1df33468-0ff5-44e2-874a-5eec78747b8c +# @cvs-id $Id: contact-attributes.tcl~,v 1.1 2005/06/21 12:25:18 maltes Exp $ + +foreach required_param {party_id} { + if {![info exists $required_param]} { + return -code error "$required_param is a required parameter." + } +} +foreach optional_param {package_id hidden_attributes} { + if {![info exists $optional_param]} { + set $optional_param {} + } +} + +if {[empty_string_p $package_id]} { + set package_id [ad_conn package_id] +} + +set groups_belonging_to [db_list get_party_groups { select group_id from group_distinct_member_map where member_id = :party_id }] +if { [lsearch $groups_belonging_to -2] < 0 } { + ad_return_error "[_ contacts.lt_This_users_has_not_be]" "[_ contacts.lt_This_user_is_awaiting]" +} +set ams_forms [list] +foreach group [contact::groups -expand "all" -privilege_required "read"] { + set group_id [lindex $group 1] + if { [lsearch $groups_belonging_to $group_id] >= 0 } { + lappend ams_forms "${package_id}__${group_id}" + } +} + +set revision_id [contact::live_revision -party_id $party_id] + +# This is the multirow that gets the values for each attribute +# If you map the categories you have to check for the group (which is +# passed along in the form_name) and see the mapped categories. Then you have to +# retrieve the values for the category and append them to the +# attributes multirow with a section heading (e.g. the name of the +# category tree) and the pretty_name of the category along with the +# value. + +multirow create attributes section attribute value +foreach form $ams_forms { + set values [ams::values -package_key "contacts" -object_type $object_type -list_name $form -object_id $revision_id -format "html"] + foreach {section attribute_name pretty_name value} $values { + if { [lsearch $hidden_attributes $attribute_name] < 0 } { + multirow append attributes $section $pretty_name $value + } + } +} +set append_list [list] +callback contact::append_attribute -multirow_name append_list -name [contact::name -party_id $party_id] +foreach append $append_list { + multirow append attributes [lindex $append 0] [lindex $append 1] [lindex $append 2] +} Index: openacs-4/packages/contacts/lib/contact-relationships-postgresql.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/contacts/lib/contact-relationships-postgresql.xql,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/contacts/lib/contact-relationships-postgresql.xql 21 Jun 2005 12:25:18 -0000 1.1 @@ -0,0 +1,24 @@ + + + + + +select rel_id, other_name, other_party_id, role_singular, role_plural, rel_type, object_id_one, object_id_two + from ( select CASE WHEN object_id_one = :party_id THEN contact__name(object_id_two) ELSE contact__name(object_id_one) END as other_name, + CASE WHEN object_id_one = :party_id THEN object_id_two ELSE object_id_one END as other_party_id, + CASE WHEN object_id_one = :party_id THEN role_two ELSE role_one END as role, + CASE WHEN object_id_one = :party_id THEN acs_rel_type__role_pretty_name(role_two) ELSE acs_rel_type__role_pretty_name(role_one) END as role_singular, + CASE WHEN object_id_one = :party_id THEN acs_rel_type__role_pretty_plural(role_two) ELSE acs_rel_type__role_pretty_name(role_two) END as role_plural, + role_one, role_two, + acs_rels.rel_id, acs_rels.rel_type, object_id_one, object_id_two + from acs_rels, + acs_rel_types + where acs_rels.rel_type = acs_rel_types.rel_type + and ( object_id_one = :party_id or object_id_two = :party_id ) + and acs_rels.rel_type in ( select object_type from acs_object_types where supertype = 'contact_rel') + ) rels_temp + order by upper(role_singular) asc, CASE WHEN object_id_one = :party_id THEN upper(contact__name(object_id_two)) ELSE upper(contact__name(object_id_one)) END asc + + + + Index: openacs-4/packages/contacts/lib/contact-relationships.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/contacts/lib/contact-relationships.adp,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/contacts/lib/contact-relationships.adp 21 Jun 2005 12:25:18 -0000 1.1 @@ -0,0 +1,23 @@ + + +

@rels.relationship@

+
+ +
+ @rels.relationship@: +
+
+ + @rels.contact@ + +
+ + +
@rels.attribute@:
+
@rels.value;noquote@
+
+
+
+
+
+
Index: openacs-4/packages/contacts/lib/contact-relationships.adp~ =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/contacts/lib/Attic/contact-relationships.adp~,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/contacts/lib/contact-relationships.adp~ 21 Jun 2005 12:25:18 -0000 1.1 @@ -0,0 +1,24 @@ + + +

@rels.relationship@

+
+ +
+ @rels.relationship@: +
+
+ + @rels.contact@ + +
+ + +
@rels.attribute@:
+
@rels.value;noquote@
+
+
+
+
+
+
+ Index: openacs-4/packages/contacts/lib/contact-relationships.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/contacts/lib/contact-relationships.tcl,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/contacts/lib/contact-relationships.tcl 21 Jun 2005 12:25:18 -0000 1.1 @@ -0,0 +1,41 @@ +# packages/contacts/lib/contact-relationships.tcl +# +# Include for the relationships of a contact +# +# @author Malte Sussdorff (sussdorff@sussdorff.de) +# @creation-date 2005-06-21 +# @arch-tag: 291a71c2-5442-4618-bb9f-13ff23d854b5 +# @cvs-id $Id: contact-relationships.tcl,v 1.1 2005/06/21 12:25:18 maltes Exp $ + +foreach required_param {party_id} { + if {![info exists $required_param]} { + return -code error "$required_param is a required parameter." + } +} +foreach optional_param {package_id} { + if {![info exists $optional_param]} { + set $optional_param {} + } +} + +if {[empty_string_p $package_id]} { + set package_id [ad_conn package_id] +} + +multirow create rels relationship contact contact_url attribute value + +db_foreach get_relationships {} { + set contact_url [contact::url -party_id $other_party_id] + multirow append rels $role_singular $other_name $contact_url {} {} + + # NOT YET IMPLEMENTED - Checking to see if role_singular or role_plural is needed + + if { [ams::list::exists_p -package_key "contacts" -object_type ${rel_type} -list_name ${package_id}] } { + set details_list [ams::values -package_key "contacts" -object_type $rel_type -list_name $package_id -object_id $rel_id -format "text"] + if { [llength $details_list] > 0 } { + foreach {section attribute_name pretty_name value} $details_list { + multirow append rels $role_singular $other_name $contact_url $pretty_name $value + } + } + } +} Index: openacs-4/packages/contacts/lib/contact-relationships.tcl~ =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/contacts/lib/Attic/contact-relationships.tcl~,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/contacts/lib/contact-relationships.tcl~ 21 Jun 2005 12:25:18 -0000 1.1 @@ -0,0 +1,21 @@ +# packages/contacts/lib/contact-relationships.tcl +# +# Include for the relationships of a contact +# +# @author Malte Sussdorff (sussdorff@sussdorff.de) +# @creation-date 2005-06-21 +# @arch-tag: 291a71c2-5442-4618-bb9f-13ff23d854b5 +# @cvs-id $Id: contact-relationships.tcl~,v 1.1 2005/06/21 12:25:18 maltes Exp $ + +foreach required_param {} { + if {![info exists $required_param]} { + return -code error "$required_param is a required parameter." + } +} +foreach optional_param {} { + if {![info exists $optional_param]} { + set $optional_param {} + } +} + +multirow create rels relationship contact contact_url attribute value Index: openacs-4/packages/contacts/www/contact.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/contacts/www/contact.adp,v diff -u -r1.19 -r1.20 --- openacs-4/packages/contacts/www/contact.adp 21 Jun 2005 11:45:13 -0000 1.19 +++ openacs-4/packages/contacts/www/contact.adp 21 Jun 2005 12:24:53 -0000 1.20 @@ -2,40 +2,8 @@ @party_id@
- - -

@attributes.section@

-
- -
@attributes.attribute@:
-
@attributes.value;noquote@
-
-
-
-
- - -

@rels.relationship@

-
- -
- @rels.relationship@: -
-
- - @rels.contact@ - -
- - -
@rels.attribute@:
-
@rels.value;noquote@
-
-
-
-
-
-
+ +
Index: openacs-4/packages/contacts/www/contact.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/contacts/www/contact.tcl,v diff -u -r1.16 -r1.17 --- openacs-4/packages/contacts/www/contact.tcl 20 Jun 2005 16:48:36 -0000 1.16 +++ openacs-4/packages/contacts/www/contact.tcl 21 Jun 2005 12:24:53 -0000 1.17 @@ -18,61 +18,9 @@ set object_type [contact::type -party_id $party_id] set user_id [ad_conn user_id] -set package_id [ad_conn package_id] -set pm_package_id "" -# I don't think it is wise to rely on the "title" attribute to be -# displayed by the master template. Sadly there is no quick way to do -# this, so maybe if you still want to rely on this, you can make a -# parameter out of it? -set hidden_attributes [list] -#if { $object_type == "person" } { -# set hidden_attributes [list first_names last_name] -#} elseif { $object_type == "organization" } { -# set hidden_attributes [list name] -#} -# - -set groups_belonging_to [db_list get_party_groups { select group_id from group_distinct_member_map where member_id = :party_id }] -if { [lsearch $groups_belonging_to -2] < 0 } { - ad_return_error "[_ contacts.lt_This_users_has_not_be]" "[_ contacts.lt_This_user_is_awaiting]" -} -set ams_forms [list] -foreach group [contact::groups -expand "all" -privilege_required "read"] { - set group_id [lindex $group 1] - if { [lsearch $groups_belonging_to $group_id] >= 0 } { - lappend ams_forms "${package_id}__${group_id}" - } -} - -set revision_id [contact::live_revision -party_id $party_id] - -# This is the multirow that gets the values for each attribute -# If you map the categories you have to check for the group (which is -# passed along in the form_name) and see the mapped categories. Then you have to -# retrieve the values for the category and append them to the -# attributes multirow with a section heading (e.g. the name of the -# category tree) and the pretty_name of the category along with the -# value. - -multirow create attributes section attribute value -foreach form $ams_forms { - set values [ams::values -package_key "contacts" -object_type $object_type -list_name $form -object_id $revision_id -format "html"] - foreach {section attribute_name pretty_name value} $values { - if { [lsearch $hidden_attributes $attribute_name] < 0 } { - multirow append attributes $section $pretty_name $value - } - } -} -set append_list [list] -callback contact::append_attribute -multirow_name append_list -name [contact::name -party_id $party_id] -foreach append $append_list { - multirow append attributes [lindex $append 0] [lindex $append 1] [lindex $append 2] -} - set package_url [ad_conn package_url] -multirow create rels relationship contact contact_url attribute value # Code for quickly adding an employee @@ -82,22 +30,6 @@ set employee_url "" } -db_foreach get_relationships {} { - set contact_url [contact::url -party_id $other_party_id] - multirow append rels $role_singular $other_name $contact_url {} {} - - # NOT YET IMPLEMENTED - Checking to see if role_singular or role_plural is needed - - if { [ams::list::exists_p -package_key "contacts" -object_type ${rel_type} -list_name ${package_id}] } { - set details_list [ams::values -package_key "contacts" -object_type $rel_type -list_name $package_id -object_id $rel_id -format "text"] - if { [llength $details_list] > 0 } { - foreach {section attribute_name pretty_name value} $details_list { - multirow append rels $role_singular $other_name $contact_url $pretty_name $value - } - } - } -} - set live_revision [contact::live_revision -party_id $party_id] if { [exists_and_not_null live_revision] } { set update_date [db_string get_update_date { select to_char(publish_date,'Mon FMDD, YYYY at FMHH12:MIam') from cr_revisions where revision_id = :live_revision } -default {}] @@ -111,6 +43,7 @@ } # Get the linked projekt_id to display the subprojects if projects is installed +set pm_package_id "" if { [string is false [empty_string_p [info procs "::application_data_link::get_linked"]]] } {