Index: openacs-4/packages/contacts/lib/comments.adp
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/contacts/lib/comments.adp,v
diff -u
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ openacs-4/packages/contacts/lib/comments.adp 18 May 2005 16:47:47 -0000 1.1
@@ -0,0 +1,31 @@
+
+
+
+
+
+
Index: openacs-4/packages/contacts/lib/comments.tcl
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/contacts/lib/comments.tcl,v
diff -u
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ openacs-4/packages/contacts/lib/comments.tcl 18 May 2005 16:47:47 -0000 1.1
@@ -0,0 +1,98 @@
+if { [string is false [contact::exists_p -party_id $party_id]] } {
+ error "The party_id specified does not exist"
+}
+
+if { [string is false [exists_and_not_null recent_on_top_p]] } {
+ set recent_on_top_p [parameter::get_from_package_key -boolean -package_key "general-comments" -parameter "RecentOnTopP"]
+}
+
+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 {
+ set orderby_clause "creation_date asc"
+ }
+}
+if { [string is false [exists_and_not_null size]] } {
+ set size "normal"
+}
+switch $size {
+ 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"
+ } else {
+ set form "bottom"
+ }
+}
+if { [lsearch [list top bottom none] $form] < 0 } {
+ error "Invalid input, you specified form as '$form' but should only specify: top, bottom, none"
+}
+
+
+
+
+set total_count [db_string get_count {
+ select count(*)
+ from general_comments g,
+ cr_revisions r,
+ acs_objects o
+ where g.object_id = :party_id
+ and r.revision_id = content_item__get_live_revision(g.comment_id)
+ and o.object_id = g.comment_id
+}]
+
+
+
+
+if { [exists_and_not_null limit] } {
+ set limit_clause "limit $limit"
+} else {
+ set limit_clause ""
+}
+
+
+
+
+set result_number 1
+
+db_multirow -extend { comment_html comment_number } comments get_comments "
+ select g.comment_id,
+ r.title,
+ r.mime_type,
+ o.creation_user,
+ acs_object__name(o.creation_user) as author,
+ CASE WHEN to_char(o.creation_date, 'YYYY') = to_char(now(),'YYYY') THEN to_char(o.creation_date,'Mon FMDD') ELSE to_char(o.creation_date,'Mon FMDD, YYYY') END as pretty_date,
+ to_char(o.creation_date, 'FMHH12:MIpm') as pretty_time,
+ content
+ from general_comments g,
+ cr_revisions r,
+ acs_objects o
+ where g.object_id = :party_id
+ and r.revision_id = content_item__get_live_revision(g.comment_id)
+ and o.object_id = g.comment_id
+ order by $orderby_clause
+ $limit_clause
+" {
+ if { [exists_and_not_null truncate_len] } {
+ set comment_html [ad_html_text_convert -truncate_len $truncate_len -from $mime_type -to "text/html" $content]
+ } else {
+ set comment_html [ad_html_text_convert -from $mime_type -to "text/html" $content]
+ }
+ if { $recent_on_top_p } {
+ set comment_number [expr $total_count - $result_number + 1]
+ } else {
+ set comment_number $result_number
+ }
+ incr result_number
+}
+
+set user_id [ad_conn user_id]
Index: openacs-4/packages/contacts/lib/contact-master.adp
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/contacts/lib/contact-master.adp,v
diff -u
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ openacs-4/packages/contacts/lib/contact-master.adp 18 May 2005 16:47:47 -0000 1.1
@@ -0,0 +1,19 @@
+
+@title@
+@context@
+
+
+
+
+@focus@
+
+
+
+
+
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
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ openacs-4/packages/contacts/lib/contact-master.tcl 18 May 2005 16:47:47 -0000 1.1
@@ -0,0 +1,88 @@
+if { ![contact::exists_p -party_id $party_id] } {
+ 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 link_list [list]
+if { [ad_conn user_id] != 0} {
+ lappend link_list "/contacts/contact-edit"
+ lappend link_list "All / Edit"
+
+ lappend link_list "/contacts/contact"
+ lappend link_list "Summary View"
+
+ lappend link_list "/contacts/contact-groups"
+ lappend link_list "Groups"
+
+ lappend link_list "/contacts/contact-rels"
+ lappend link_list "Relationships"
+
+ lappend link_list "/contacts/comments"
+ lappend link_list "Comments"
+
+ lappend link_list "/tasks/"
+ lappend link_list "Tasks"
+
+ lappend link_list "/contacts/message"
+ lappend link_list "Mail"
+}
+# lappend link_list "/tasks/contact"
+# lappend link_list "Tasks"
+# lappend link_list "/contacts/contact-files"
+# lappend link_list "Files"
+# lappend link_list "/contacts/contact-history"
+# lappend link_list "History"
+
+
+
+if { $admin_p } {
+
+}
+
+
+# Convert the list to a multirow and add the selected_p attribute
+multirow create links label url selected_p
+
+foreach {url label} $link_list {
+ set selected_p 0
+
+ if {[string equal $page_url $url]} {
+
+
+ set selected_p 1
+ if { $url != "/contacts/contact" } {
+ set context [list [list [contact::url -party_id $party_id] $name] $label]
+ }
+
+ }
+
+ multirow append links $label [export_vars -base $url -url {party_id}] $selected_p
+}
+
+
+
+
+
+
+
+
+
+
+
+
+
+ad_return_template
Index: openacs-4/packages/contacts/lib/groups.adp
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/contacts/lib/groups.adp,v
diff -u
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ openacs-4/packages/contacts/lib/groups.adp 18 May 2005 16:47:47 -0000 1.1
@@ -0,0 +1,36 @@
+
+
+
+
+
+
+
+You cannot add this contact to more groups.
+
+
+
+
+
Groups
+
+
+(
+@groups.group;noquote@
+)
+
+
+
+
+
+This contact is not part of any groups - this is a problem.
+
Index: openacs-4/packages/contacts/lib/groups.tcl
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/contacts/lib/groups.tcl,v
diff -u
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ openacs-4/packages/contacts/lib/groups.tcl 18 May 2005 16:47:47 -0000 1.1
@@ -0,0 +1,38 @@
+if { [string is false [contact::exists_p -party_id $party_id]] } {
+ error "The party_id specified does not exist"
+}
+if { [string is false [exists_and_not_null hide_form_p]] } {
+ set hide_form_p 0
+}
+set user_id [ad_conn user_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 }]
+
+multirow create addable_groups group_id group top_level
+set active_top_level ""
+foreach group [contact::groups -expand "all" -privilege_required "create"] {
+ if { [lindex $group 2] == "1" } { set active_top_level [lindex $group 0] }
+ if { [lsearch $groups_belonging_to [lindex $group 1]] < 0 } {
+ multirow append addable_groups [lindex $group 1] [lindex $group 0] $active_top_level
+ }
+}
+
+multirow create groups group_id group sub_p
+set sub_p "0"
+foreach group [contact::groups -expand "all" -privilege_required "read"] {
+ set group_name [lindex $group 0]
+ if { [regexp {^(\.\.\.)(.*)} $group_name] } {
+ set sub_p "1"
+ } else {
+ set sub_p "0"
+ }
+ if { [lindex $group 2] == "1" } { set active_top_level [lindex $group 0] }
+ if { [lsearch $groups_belonging_to [lindex $group 1]] >= 0 } {
+ multirow append groups [lindex $group 1] $group_name $sub_p
+ }
+}
+
+
+
+
Index: openacs-4/packages/contacts/lib/relationships.adp
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/contacts/lib/Attic/relationships.adp,v
diff -u
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ openacs-4/packages/contacts/lib/relationships.adp 18 May 2005 16:47:47 -0000 1.1
@@ -0,0 +1,15 @@
+
+
+
+
+
Index: openacs-4/packages/contacts/lib/relationships.tcl
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/contacts/lib/Attic/relationships.tcl,v
diff -u
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ openacs-4/packages/contacts/lib/relationships.tcl 18 May 2005 16:47:47 -0000 1.1
@@ -0,0 +1,25 @@
+if { [string is false [contact::exists_p -party_id $party_id]] } {
+ error "The party_id specified does not exist"
+}
+
+
+db_multirow -extend {contact_url} relationships get_relationships {
+select rel_id, other_name, other_party_id, role, role_singular, role_plural
+from
+(
+ select rel_id,
+ 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
+ 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), upper(other_name)
+} {
+ set contact_url [contact::url -party_id $other_party_id]
+}
Comments
+ ++
+ - @comments.comment_number@. @comments.pretty_date@ at @comments.pretty_time@ - @comments.author@
+
- @comments.comment_html;noquote@
+
+
+