Index: openacs-4/packages/contacts/lib/comments.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/contacts/lib/comments.adp,v diff -u -r1.2 -r1.3 --- openacs-4/packages/contacts/lib/comments.adp 25 May 2005 02:09:52 -0000 1.2 +++ openacs-4/packages/contacts/lib/comments.adp 27 May 2005 09:02:14 -0000 1.3 @@ -1,18 +1,12 @@ -
-

Comments

+

Comments

-
- - - -
-
+
-
+
@comments.comment_number@. @comments.pretty_date@ at @comments.pretty_time@ - @comments.author@
@comments.comment_html;noquote@
@@ -22,10 +16,5 @@ -
- - - -
-
+
Index: openacs-4/packages/contacts/lib/comments.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/contacts/lib/comments.tcl,v diff -u -r1.2 -r1.3 --- openacs-4/packages/contacts/lib/comments.tcl 19 May 2005 16:45:52 -0000 1.2 +++ openacs-4/packages/contacts/lib/comments.tcl 27 May 2005 09:02:14 -0000 1.3 @@ -13,7 +13,6 @@ if { [string is false [exists_and_not_null recent_on_top_p]] } { error "The parameter RecentOnTopP is not set correctly for the General Comments package, please enter either a '0' or a '1'" } else { - if { $recent_on_top_p } { set orderby_clause "creation_date desc" } else { @@ -24,12 +23,15 @@ set size "normal" } switch $size { - normal { set textarea_size "cols=\"50\" rows=\"6\"" } - small { set textarea_size "cols=\"35\" rows=\"3\"" } + normal { + set textarea_size "cols 50 rows 6" + } + small { + set textarea_size "cols 35 rows 3" + } default { error "You have specified an invalid size for the textarea" } } -set package_url [ad_conn package_url] if { [string is false [exists_and_not_null form]] } { if { $recent_on_top_p } { set form "top" @@ -99,4 +101,26 @@ incr result_number } + + +ad_form -name comment_add \ + -action "[ad_conn package_url]comment-add" \ + -form " + party_id:integer(hidden) + return_url:text(hidden),optional + {comment:text(textarea),nospell {label {}} {html {$textarea_size}} {after_html {
}}} + {save:text(submit),optional {label {Add Comment}}} + " -on_request { + } -after_submit { + } + + + + + + + + + + set user_id [ad_conn user_id] Index: openacs-4/packages/contacts/lib/contact-master.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/contacts/lib/contact-master.tcl,v diff -u -r1.5 -r1.6 --- openacs-4/packages/contacts/lib/contact-master.tcl 27 May 2005 00:18:57 -0000 1.5 +++ openacs-4/packages/contacts/lib/contact-master.tcl 27 May 2005 09:02:14 -0000 1.6 @@ -2,22 +2,19 @@ # @creation-date 2005-05-09 # @cvs-id $Id$ -if { ![contact::exists_p -party_id $party_id] } { + +# Set up links in the navbar that the user has access to +set name [contact::name -party_id $party_id] +if { ![exists_and_not_null name] } { ad_complain "The contact specified does not exist" } -# Set up links in the navbar that the user has access to - set user_id [ad_conn user_id] set package_id [ad_conn package_id] set package_url [ad_conn package_url] set page_url [ad_conn url] set page_query [ad_conn query] -set admin_p [permission::permission_p -object_id [ad_conn package_id] -privilege admin] - - -set name [contact::name -party_id $party_id] set title $name set context [list $name] set prefix "${package_url}${party_id}/" Index: openacs-4/packages/contacts/lib/groups.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/contacts/lib/groups.adp,v diff -u -r1.2 -r1.3 --- openacs-4/packages/contacts/lib/groups.adp 25 May 2005 02:14:09 -0000 1.2 +++ openacs-4/packages/contacts/lib/groups.adp 27 May 2005 09:02:14 -0000 1.3 @@ -20,16 +20,14 @@ -
-

Groups

+

Groups

    (
  • @groups.group;noquote@ )
-
This contact is not part of any groups - this is a problem. Fisheye: Tag 1.2 refers to a dead (removed) revision in file `openacs-4/packages/contacts/lib/relationships.adp'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.3 refers to a dead (removed) revision in file `openacs-4/packages/contacts/lib/relationships.tcl'. Fisheye: No comparison available. Pass `N' to diff? Index: openacs-4/packages/contacts/www/contact-postgresql.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/contacts/www/Attic/contact-postgresql.xql,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/contacts/www/contact-postgresql.xql 27 May 2005 09:02:14 -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/www/contact-rels.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/contacts/www/contact-rels.tcl,v diff -u -r1.3 -r1.4 --- openacs-4/packages/contacts/www/contact-rels.tcl 25 May 2005 02:09:52 -0000 1.3 +++ openacs-4/packages/contacts/www/contact-rels.tcl 27 May 2005 09:02:14 -0000 1.4 @@ -243,6 +243,7 @@ } details { label "Details" + display_col details;noquote } actions { label "Actions" @@ -282,10 +283,19 @@ set package_id [ad_conn package_id] set return_url "[ad_conn package_url]${party_id}/relationships" db_multirow -unclobber -extend {contact_url rel_add_edit_url rel_delete_url details} relationships get_relationships "" { - set contact_url [contact::url -party_id $other_party_id] - set list_exists_p [ams::list::exists_p -package_key "contacts" -object_type ${rel_type} -list_name ${package_id}] - if { $list_exists_p } { - set rel_add_edit_url [export_vars -base "${package_url}relationship-ae" -url {rel_type object_id_one object_id_two party_id}] - } + set contact_url [contact::url -party_id $other_party_id] + set details "" + if { [ams::list::exists_p -package_key "contacts" -object_type ${rel_type} -list_name ${package_id}] } { + set rel_add_edit_url [export_vars -base "${package_url}relationship-ae" -url {rel_type object_id_one object_id_two party_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 } { + append details "
\n" + foreach {section attribute_name pretty_name value} $details_list { + append details "
${pretty_name}:
\n" + append details "
${value}
\n" + } + append details "
\n" + } + } set rel_delete_url [export_vars -base "${package_url}relationship-delete" -url {rel_id party_id return_url}] } Index: openacs-4/packages/contacts/www/contact.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/contacts/www/contact.adp,v diff -u -r1.3 -r1.4 --- openacs-4/packages/contacts/www/contact.adp 25 May 2005 16:23:51 -0000 1.3 +++ openacs-4/packages/contacts/www/contact.adp 27 May 2005 09:02:14 -0000 1.4 @@ -1,28 +1,51 @@ @party_id@ - - - - - -
+
+
- + + +

@attributes.section@

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

@rels.relationship@

+
+ +
@rels.relationship@:
+
@rels.contact@
+ + +
@rels.attribute@:
+
@rels.value;noquote@
+
+
+ + +
-
+ +
- + + + - + -
-

Last updated: @update_date@

- - +
+ +

Last updated: @update_date@

Index: openacs-4/packages/contacts/www/contact.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/contacts/www/contact.tcl,v diff -u -r1.2 -r1.3 --- openacs-4/packages/contacts/www/contact.tcl 19 May 2005 23:03:23 -0000 1.2 +++ openacs-4/packages/contacts/www/contact.tcl 27 May 2005 09:02:14 -0000 1.3 @@ -9,7 +9,7 @@ {party_id:integer,notnull} } -validate { contact_exists -requires {party_id} { - if { ![contact::exists_p -party_id $party_id] && ![ad_form_new_p -key party_id] } { + if { ![contact::exists_p -party_id $party_id] } { ad_complain "The contact specified does not exist" } } @@ -19,14 +19,17 @@ set user_id [ad_conn user_id] set package_id [ad_conn package_id] +if { $object_type == "person" } { + set hidden_attributes [list first_names last_name] +} elseif { $object_type = "organization" } { + set hide_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 "This users has not been approved" "This user is awaiting administrator approval" } -set form_elements {party_id:key} -lappend form_elements {object_type:text(hidden)} - - set ams_forms [list] foreach group [contact::groups -expand "all" -privilege_required "read"] { set group_id [lindex $group 1] @@ -35,89 +38,50 @@ } } +set revision_id [contact::live_revision -party_id $party_id] + +multirow create attributes section attribute value foreach form $ams_forms { - append form_elements " " - append form_elements [ams::ad_form::elements -package_key "contacts" -object_type $object_type -list_name $form] + 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 + } + } } -ad_form -name party_ae \ - -mode "display" \ - -form $form_elements \ - -has_edit "1" \ - -on_request { - if { $object_type == "person" } { - set required_attributes [list first_names last_name email] - } else { - set required_attributes [list name] - } +set package_url [ad_conn package_url] - set missing_elements [list] - foreach attribute $required_attributes { - if { [string is false [template::element::exists party_ae $attribute]] } { - lappend missing_elements $attribute - } - } - # make the error message multiple item aware - if { [llength $missing_elements] > 0 } { - ad_return_error "Configuration Error" "Some of the required elements for this form are missing. Please contact an administrator and make sure that the following attributes are included:" - } +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 - } -edit_request { - set revision_id [contact::live_revision -party_id $party_id] - foreach form $ams_forms { - ams::ad_form::values -package_key "contacts" \ - -object_type $object_type \ - -list_name $form \ - -form_name "party_ae" \ - -object_id $revision_id + 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 + } } - contact::special_attributes::ad_form_values -party_id $party_id -form "party_ae" - - } -on_submit { - } -new_data { - } -edit_data { - } -after_submit { - ad_returnredirect "./" } +} -if { $object_type == "person" } { - template::element::set_properties party_ae first_names widget hidden - template::element::set_properties party_ae last_name widget hidden -} else { - template::element::set_properties party_ae name widget hidden -} -foreach element [template::form::get_elements party_ae] { - # ns_log notice $element [template::element::get_value party_ae $element] - if { [template::element::get_value party_ae $element] == "" } { - template::element::set_properties party_ae $element widget hidden - } -} -# now we clean up the section headings (if necessary) -foreach element [template::form::get_elements party_ae] { - set section [template::element::get_property party_ae $element section] - set value [template::element::get_value party_ae $element] - if { ( $value == "" || $element == "first_names" || $element == "last_name" ) && $section != "" } { - # there is a section heading for a "non-existant" element - set carry_over_section $section - template::element::set_properties party_ae $element section "" - } else { - if { [exists_and_not_null carry_over_section] && $value != "" && [template::element::get_property party_ae $element widget] != "hidden" } { - if { ![exists_and_not_null section] } { set section $carry_over_section } - template::element::set_properties party_ae $element section $section - set carry_over_section "" - set section "" - } - } - set sec [template::element::get_property party_ae $element section] -} + + + + + + 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 {}] @@ -132,4 +96,6 @@ + + ad_return_template Index: openacs-4/packages/contacts/www/resources/contacts.css =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/contacts/www/resources/contacts.css,v diff -u -r1.5 -r1.6 --- openacs-4/packages/contacts/www/resources/contacts.css 25 May 2005 16:23:51 -0000 1.5 +++ openacs-4/packages/contacts/www/resources/contacts.css 27 May 2005 09:02:14 -0000 1.6 @@ -5,90 +5,53 @@ @cvs-id $Id$ ----------------------------------------------- */ - -#tasks dt { - display: block; - float: left; - margin: 0px; - width: 120px; - padding-top: 2px; +#contact-info div.primary { + width: 48%; + float: left; } -#tasks dl { - margin: 5px 0px 0px 0px; +#contact-info div.secondary { + width: 48%; + float: right; } -#tasks ul { - margin: 0px 0px 0px -10px; - clear: both; +p.last-updated { + clear: both; + font-size: small; + text-align: right; } -#tasks li { - margin: 0px; -} -#comments { - padding: 0px; - margin: 0px; - } -#comments dl { +dl.comments { font-size: 85%; margin: 0px; padding: 0px; } -#comments dt { +dl.comments dt { padding: 5px; margin: 5px 0px 0px 0px; background: #EEE; font-weight: normal; font-size: 75%; } -#comments dd { +dl.comments dd { padding: 5px; margin: 0 0px 5px 0px; background: #EEE; } -#comments dt.odd, #comments dd.odd { +dl.comments dt.odd, dl.comments dd.odd { background: #DDD; } -#comments dt.mine-odd, #comments dd.mine-odd { +dl.comments dt.mine-odd, dl.comments dd.mine-odd { background: #ECD; } -#comments dt.mine-even, #comments dd.mine-even { +dl.comments dt.mine-even, dl.comments dd.mine-even { background: #FDE; } -#comments .number { +dl.comments .number { padding: 0px 5px 0px 0px; margin: 0px 2px 0px 0px; border-style: solid; border-width: 0px 1px 0px 0px; border-color: #CCC; font: 160% Georgia,Serif; } -#comments textarea { - padding: 5px; - margin: 0px; - background-color: #FFF; - border-style: solid; - border-color: #AAA; - border-width: 1px 1px 1px 1px; -} -#comments form { - margin: 0px; - padding: 0px; -} -#comments .comment-button { - padding: 1px 30px 1px 30px; - margin: 0px; - font: 85% arial; - border: solid 1px #AAA; - border-top: 0px; - background-color: #e1e1e1; - color: black; - text-decoration: none; - white-space: nowrap; - text-align: center; - display: block; -} -#comments .comment-button:hover { - background-color: #ccc; -} #contacts-sortbars { font:70% verdana,sans-serif; @@ -122,79 +85,6 @@ color: red; } - -.summaries * { - padding: 0; - margin: 0; -} -.summaries div { - clear: both; -} -.summaries div.groups h3 { - float: left; - width: 39%; - padding-bottom: 15px; -} -.summaries div.groups ul { - font-size: small; - float: right; - width: 59%; - list-style: none; - padding-bottom: 15px; -} -.summaries div.groups li { - padding-left: 2em; - text-indent: -2em; - -} -.summaries div.relationships dl { - font-size: small; - list-style: none; - padding-bottom: 15px; -} -.summaries div.relationships dt { - text-align: right; - width: 39%; - clear: both; - float: left; - padding-bottom: 3px; -} -.summaries div.relationships dd { - text-align: left; - width: 59%; - float: right; - padding-bottom: 3px; -} - -.summaries #comments h3 { - padding-top: 10px; -} - -div.tasks * { - margin: 0; - padding: 0; -} -div.tasks h3 { - padding-bottom: 5px; -} -div.tasks ul { - padding-left: 1em; - list-style: square; -} -div.tasks li { - padding-bottom: .5em; -} -div.tasks dt { - clear: both; - float: left; - width: 25%; -} -div.tasks dd { - float: right; - width: 73%; - padding-bottom: .75em; -} - #section { margin: 0px 0px 0px 0px; } @@ -251,3 +141,82 @@ border-bottom: 1px solid #CCC; } +h3.contact-title { + margin: 0; + padding: 0; + clear: both; + line-height: 2em; +} + +dt.attribute-name { + margin: 0; + padding: 0; + font-size: smaller; + text-align: right; + line-height: 1.5em; + border-width: 0; + width: 33%; + float: left; + clear: both; +} + +dd.attribute-value { + margin: 0; + padding: 0 0 .5em 0; + text-align: left; + line-height: 1.2em; + border-width: 0; + width: 65%; + float: right; +} +dl.attribute-values { + margin: 0; + padding: 0; +} + + + + +/* Tasks */ +div.tasks * { + margin: 0; + padding: 0; +} +div.tasks h3 { + padding-bottom: 5px; +} +div.tasks ul { + padding-left: 1em; + list-style: square; +} +div.tasks li { + padding-bottom: .5em; +} +div.tasks dt { + clear: both; + float: left; + width: 25%; +} +div.tasks dd { + float: right; + width: 73%; + padding-bottom: .75em; +} + +#tasks dt { + display: block; + float: left; + margin: 0px; + width: 120px; + padding-top: 2px; +} +#tasks dl { + margin: 5px 0px 0px 0px; +} +#tasks ul { + margin: 0px 0px 0px -10px; + clear: both; +} +#tasks li { + margin: 0px; +}