Index: openacs-4/packages/contacts/contacts.info
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/contacts/contacts.info,v
diff -u -r1.59 -r1.60
--- openacs-4/packages/contacts/contacts.info 31 Dec 2005 07:39:37 -0000 1.59
+++ openacs-4/packages/contacts/contacts.info 3 Jan 2006 22:14:54 -0000 1.60
@@ -7,14 +7,14 @@
f
t
-
+
Matthew Geddert
This application lets you collaboratively view, edit and categorize contacts.
2005-11-23
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
-
+
@@ -66,6 +66,7 @@
+
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.58 -r1.59
--- openacs-4/packages/contacts/catalog/contacts.en_US.ISO-8859-1.xml 31 Dec 2005 07:39:39 -0000 1.58
+++ openacs-4/packages/contacts/catalog/contacts.en_US.ISO-8859-1.xml 3 Jan 2006 22:14:54 -0000 1.59
@@ -484,8 +484,8 @@
signatures
Sort By
Sort by
- Spoiler?
- Path to the file containing the image used as a spoiler
+ Banner?
+ Path to the file containing the image used as a banner
state/province is ->
Status
Stored Extended Options
Index: openacs-4/packages/contacts/lib/email.tcl
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/contacts/lib/email.tcl,v
diff -u -r1.14 -r1.15
--- openacs-4/packages/contacts/lib/email.tcl 24 Oct 2005 18:18:03 -0000 1.14
+++ openacs-4/packages/contacts/lib/email.tcl 3 Jan 2006 22:14:55 -0000 1.15
@@ -201,44 +201,37 @@
# Send the mail to all parties.
foreach party_id $to {
- set name [contact::name -party_id $party_id]
- set first_names [lindex $name 0]
- set last_name [lindex $name 1]
- set date [lc_time_fmt [dt_sysdate] "%q"]
- set to $name
- set to_addr [cc_email_from_party $party_id]
- set party_revision_id [contact::live_revision -party_id $party_id]
- if { ![exists_and_not_null locale]} {
+
+ # Differentiate between person and organization
+ if {[person::person_p -party_id]} {
+ contact::employee::get -employee_id $party_id -array employee
+ set first_names $employee(first_names)
+ set last_name $employee(last_name)
+ set name "$employee(title) $first_names $last_name"
+ set salutation $employee(salutation)
+ set locale $employee(locale)
+ set to_addr $employee(email)
+ } else {
+ set name [contact::name -party_id $party_id]
+ set to_addr [cc_email_from_party $party_id]
+ set salutation "Dear ladies and gentlemen"
set locale [lang::user::site_wide_locale -user_id $party_id]
}
- set salutation [ams::value \
- -attribute_id $attribute_id \
- -attribute_name "salutation" \
- -object_id $party_revision_id \
- -locale $locale]
- lappend recipients_addr $to_addr
+ set date [lc_time_fmt [dt_sysdate] "%q"]
+ set to $name
if {[empty_string_p $to_addr]} {
- # We are going to check if this party_id has an employer and if this
- # employer has an email
- set employer_id [relation::get_object_two -object_id_one $party_id \
- -rel_type "contact_rels_employment"]
- if { ![empty_string_p $employer_id] } {
- # Get the employer email adress
- set to_addr [cc_email_from_party -party_id $employer_id]
- if {[empty_string_p $to_addr]} {
- ad_return_error [_ contacts.Error] [_ contacts.lt_there_was_an_error_processing]
- break
- }
- } else {
- ad_return_error [_ contacts.Error] [_ contacts.lt_there_was_an_error_processing]
- break
- }
- }
+ ad_return_error [_ contacts.Error] [_ contacts.lt_there_was_an_error_processing]
+ break
+ }
+
+ lappend recipients_addr $to_addr
+
set values [list]
foreach element [list first_names last_name name date salutation] {
lappend values [list "{$element}" [set $element]]
}
+
template::multirow append messages $message_type $to_addr $party_id [contact::message::interpolate -text $subject -values $values] [contact::message::interpolate -text $content_body -values $values]
# Link the files to all parties
Index: openacs-4/packages/contacts/lib/oo_mailing.tcl
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/contacts/lib/oo_mailing.tcl,v
diff -u -r1.4 -r1.5
--- openacs-4/packages/contacts/lib/oo_mailing.tcl 28 Dec 2005 12:38:11 -0000 1.4
+++ openacs-4/packages/contacts/lib/oo_mailing.tcl 3 Jan 2006 22:14:55 -0000 1.5
@@ -39,8 +39,9 @@
set footer ""
}
-set spoiler_options [util::find_all_files -extension jpg -path "/web/wieners/packages/wieners/templates/spoiler"]
-
+set template_path "[acs_root_dir][parameter::get_from_package_key -package_key contacts -parameter OOMailingPath]"
+set banner_options [util::find_all_files -extension jpg -path "${template_path}/banner"]
+
set date [split [dt_sysdate] "-"]
append form_elements {
message_id:key
@@ -54,28 +55,39 @@
{date:date(date)
{label "[_ contacts.Date]"}
}
- {spoiler:text(select),optional
- {label "[_ contacts.Spoiler]"}
- {help_text "[_ contacts.Spoiler_help_text]"}
- {options $spoiler_options}
+ {banner:text(select),optional
+ {label "[_ contacts.Banner]"}
+ {help_text "[_ contacts.Banner_help_text]"}
+ {options $banner_options}
+ {section "[_ contacts.oo_message]"}
}
{content:richtext(richtext)
- {label "[_ contacts.Message]"}
+ {label "[_ contacts.oo_message]"}
{html {cols 70 rows 24}}
- {help_text {[_ contacts.lt_remember_that_you_can]}}
+ {help_text {[_ contacts.oo_content_help]}}
}
{ps:text(text),optional
{label "[_ contacts.PS]"}
{help_text "[_ contacts.PS_help_text]"}
{html {size 45 maxlength 1000}}
}
+ {subject:text(text),optional
+ {label "[_ contacts.Subject]"}
+ {html {size 55}}
+ {section "[_ contacts.oo_email_content]"}
+ {help_text {[_ contacts.oo_email_subject_help]}}
+ }
+ {email_content:text(textarea),optional
+ {label "[_ contacts.oo_email_content]"}
+ {html {cols 65 rows 12}}
+ {help_text {[_ contacts.oo_email_help]}}
+ }
}
ad_form -action message \
-name letter \
-cancel_label "[_ contacts.Cancel]" \
-cancel_url $return_url \
- -edit_buttons [list [list [_ contacts.Print] print]] \
-form $form_elements \
-on_request {
} -new_request {
@@ -90,7 +102,7 @@
set content [list $content $message_info(content_format)]
set title $message_info(title)
set ps $message_info(ps)
- set spoiler $message_info(spoiler)
+ set banner $message_info(banner)
} else {
if { [exists_and_not_null signature] } {
set content [list $signature "text/html"]
@@ -99,6 +111,7 @@
set paper_type "letterhead"
} -edit_request {
} -on_submit {
+
# Make sure the content actually exists
set content_raw [string trim \
[ad_html_text_convert \
@@ -110,17 +123,21 @@
if {$content_raw == "" } {
template::element set_error message content "[_ contacts.Message_is_required]"
}
-
+
# Now parse the content for openoffice
set content_format [template::util::richtext::get_property format $content]
set content [contact::oo::convert -content [string trim [template::util::richtext::get_property content $content]]]
-
+
# Retrieve information about the user so it can be used in the template
set user_id [ad_conn user_id]
if {![contact::employee::get -employee_id $user_id -array user_info]} {
ad_return_error $user_id "User is not an employee"
}
+ template::multirow create messages revision_id to_addr to_party_id subject content_body
+
+ set file_revisions [list]
+
foreach party_id $party_ids {
# get the user information
if {[contact::employee::get -employee_id $party_id -array employee]} {
@@ -130,42 +147,98 @@
ad_return_error [_ contacts.Error] [_ contacts.lt_there_was_an_error_processing_this_request]
break
}
-
- set file [open "/web/wieners/vorlage.xml"]
+
+ set file [open "${template_path}/content.xml"]
fconfigure $file -translation binary
set template_content [read $file]
close $file
+ set file [open "${template_path}/styles.xml"]
+ fconfigure $file -translation binary
+ set style_content [read $file]
+ close $file
+
eval [template::adp_compile -string $template_content]
- set letter $__adp_output
+ set content $__adp_output
- set odt_filename [contact::oo::change_content -document_filename "vorlage.odt" -path "/web" -contents [list "content.xml" "$letter"]]
- set revision_id [contact::oo::import_oo_pdf -oo_file $odt_filename -parent_id $party_id]
+ eval [template::adp_compile -string $style_content]
+ set style $__adp_output
+ set odt_filename [contact::oo::change_content -path "${template_path}" -document_filename "document.odt" -contents [list "content.xml" $content "styles.xml" $style]]
+
+ set item_id [contact::oo::import_oo_pdf -oo_file $odt_filename -parent_id $party_id -title "${title}.pdf"]
+ set revision_id [content::item::get_best_revision -item_id $item_id]
+ lappend file_revisions $revision_id
+
+ # Now we need to find a way to join all these files. Probably using a new procedure to join all the revision ids
+
+ # Subject is set => we send an email.
+ if {$subject ne ""} {
+
+ # Differentiate between person and organization
+ if {[person::person_p -party_id $party_id]} {
+ contact::employee::get -employee_id $party_id -array employee
+ set first_names $employee(first_names)
+ set last_name $employee(last_name)
+ set name "$first_names $last_name"
+ set salutation $employee(salutation)
+ set locale $employee(locale)
+ set to_addr $employee(email)
+ } else {
+ set name [contact::name -party_id $party_id]
+ set to_addr [cc_email_from_party $party_id]
+ set salutation "Dear ladies and gentlemen"
+ set locale [lang::user::site_wide_locale -user_id $party_id]
+ }
+ set date [lc_time_fmt [dt_sysdate] "%q"]
+
+ set values [list]
+ foreach element [list first_names last_name name date salutation] {
+ lappend values [list "{$element}" [set $element]]
+ }
+
+ # We are going to create a multirow which knows about the file (revision_id) and contains
+ # the parsed e-mail.
+ template::multirow append messages $revision_id $to_addr "" [contact::message::interpolate -text $subject -values $values] [contact::message::interpolate -text $email_content -values $values]
+ }
+
+ # Log that we have been sending this oo-mailing
contact::message::log \
-message_type "oo_mailing" \
-sender_id $user_id \
-recipient_id $party_id \
-title $title \
-description "" \
- -content $letter \
+ -content $content \
-content_format "text/html"
+ }
- }
-
+ if {$subject ne ""} {
+ set from [ad_conn user_id]
+ set from_addr [cc_email_from_party $from]
+ set package_id [ad_conn package_id]
- # onLoad=\"window.print()\"
- ns_return 200 text/html "
-
-
-[_ contacts.Print_Letter]
-
-
-$letter
-
-
-