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.19 -r1.20 --- openacs-4/packages/contacts/catalog/contacts.en_US.ISO-8859-1.xml 14 Jun 2005 11:29:27 -0000 1.19 +++ openacs-4/packages/contacts/catalog/contacts.en_US.ISO-8859-1.xml 15 Jun 2005 05:04:46 -0000 1.20 @@ -1,5 +1,5 @@ - + -- select a group -- --select one-- @@ -12,6 +12,7 @@ Add Comment Add Condition Add Group + Add new %object_type% in Group(s) Add Organization Add Person Add Search @@ -118,10 +119,9 @@ -- no not include a signature -- -- Recent Searches -- -- top level group -- + Add new %object_type% in Selected Group(s) Add relationship type Add to Selected Group(s) - Add new %object_type% in Selected Group(s) - Add new %object_type% in Group(s) Advanced searches are very powerful but in return they require very specific input... All searches are case insensitive, capitalization does not matter. If more than one contact match the search a list of results is returned. If only one contact meets the search criteria you are redirected to that contact. %attribute_pretty% area code is: <strong>%option_pretty%</strong> @@ -357,6 +357,7 @@ Upload More View all roles View next + Visit Club which match Widget your signatures Index: openacs-4/packages/contacts/lib/letter.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/contacts/lib/letter.tcl,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/contacts/lib/letter.tcl 15 Jun 2005 05:05:23 -0000 1.1 @@ -0,0 +1,66 @@ +# packages/contacts/lib/email.tcl +# Template for email inclusion +# @author Malte Sussdorff (sussdorff@sussdorff.de) +# @creation-date 2005-06-14 +# @arch-tag: 48fe00a8-a527-4848-b5de-0f76dfb60291 +# @cvs-id $Id: letter.tcl,v 1.1 2005/06/15 05:05:23 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 {} + } +} + +set todays_date [lc_time_fmt [dt_sysdate] "%q"] +append form_elements { + {paper_type:text(select),optional + {label "[_ contacts.Paper_Type]"} + {options {{{Letter} letter} {Letterhead letterhead}}} + } + {date:text(inform),optional + {label "[_ contacts.Date]"} + {value $todays_date} + } + {address:text(inform),optional + {label "[_ contacts.Address]"} + {value "{name}
{mailing_address}"} + {help_text {The recipeints name and mailing address will automatically be included so that they work with window envelopes}} + } + {content:richtext(richtext),optional + {label "[_ contacts.Message]"} + {html {cols 70 rows 24}} + {help_text {[_ contacts.lt_remember_that_you_can]}} + } +} + +ad_form -action message \ + -name message \ + -cancel_label "[_ contacts.Cancel]" \ + -cancel_url $return_url \ + -edit_buttons $edit_buttons \ + -form $form_elements \ + -on_request { + } -new_request { + } -edit_request { + } -on_submit { + if {[exists_and_not_null include_signature]} { + + set content_raw [string trim \ + [ad_html_text_convert \ + -from [template::util::richtext::get_property format $content] \ + -to "text/plain" \ + [template::util::richtext::get_property content $content] \ + ] \ + ] + if {$content_raw == "" } { + template::element set_error message content "[_ contacts.Message_is_required]" + } + } + } +} + Index: openacs-4/packages/contacts/www/index.vuh =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/contacts/www/index.vuh,v diff -u -r1.4 -r1.5 --- openacs-4/packages/contacts/www/index.vuh 14 Jun 2005 09:49:43 -0000 1.4 +++ openacs-4/packages/contacts/www/index.vuh 15 Jun 2005 05:04:46 -0000 1.5 @@ -35,6 +35,8 @@ relationships { set file "contact-rels" } comments { set file "comments" } message { set file "message" } + letter { set file "letter" } + email { set file "email" } default { set file "contact" } } set form_supplied_party_id [ns_queryget party_id] Index: openacs-4/packages/contacts/www/letter.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/contacts/www/Attic/letter.tcl,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/contacts/www/letter.tcl 15 Jun 2005 05:04:46 -0000 1.1 @@ -0,0 +1,170 @@ +ad_page_contract { + List and manage contacts. + + @author Matthew Geddert openacs@geddert.com + @creation-date 2004-07-28 + @cvs-id $Id: letter.tcl,v 1.1 2005/06/15 05:04:46 maltes Exp $ +} { + {party_id:integer,multiple,optional} + {party_ids:optional} + {message_id:integer,optional} + {message_type:optional} + {message:optional} + {return_url "./"} +} -validate { + valid_message_type -requires {message_type} { + if { [lsearch [list email letter label] $message_type] < 0 } { + ad_complain "[_ contacts.lt_Your_provided_an_inva]" + } + } + valid_party_submission { + if { ![exists_and_not_null party_id] && ![exists_and_not_null party_ids] } { + ad_complain "[_ contacts.lt_Your_need_to_provide_]" + } + } +} + +if { [exists_and_not_null party_id] } { + set party_ids [list] + foreach party_id $party_id { + lappend party_ids $party_id + } +} + +# TODO. If Party_id = Organization, then we need to get a list of all +# possible people who can retrieve this message due to +# person-organization relationship. +# This could be on a new page that let's the user choose all the +# relationships on the first step and then click / hide the actual +# users. + +set party_count [llength $party_ids] + + +set title "[_ contacts.Messages]" +set user_id [ad_conn user_id] +set context [list $title] + +set recipients [list] +foreach party_id $party_ids { + lappend recipients "[contact::name -party_id $party_id]" +} + + +set form_elements { + message_id:key + party_ids:text(hidden) + return_url:text(hidden) + {to:text(inform),optional {label "[_ contacts.Recipients]"} {value $recipients}} +} + + +append form_elements { + {message_type:text(hidden)} +} +set title [_ contacts.create_$message_type] + +set context [list $title] + +append form_elements { + {message:text(hidden)} +} + +# We have an email +if { $message_type == "email" } { + append form_elements { + {subject:text(text),optional + {label "[_ contacts.Subject]"} + {html {size 55}} + } + {content:text(textarea),optional + {label "[_ contacts.Message]"} + {html {cols 55 rows 18}} + {help_text {remember that you can use mail merge substitutions. the most common wildcards are \{name\} \{first_names\}, \{last_name\}, \{home_address\} and \{date\}}} + } + } + + # Signature Options + set sig_options "{{[_ contacts.lt_--_no_not_include_a_s]} \"none\"} [db_list_of_lists select_sigs {select title, signature from contact_signatures where party_id = :user_id}]" + append form_elements { + {include_signature:text(select),optional {label "[_ contacts.Signature]"} {options $sig_options} {help_text {you may modify [_ contacts.your_signatures]}}} + {save_as:text(text),optional {label "[_ contacts.Save_Message_As]"} {html {size 35}}} + } + append form_elements + set edit_buttons [list [list "[_ contacts.Preview]" create]] +} + +ad_form -action message \ + -name message \ + -cancel_label "[_ contacts.Cancel]" \ + -cancel_url $return_url \ + -edit_buttons $edit_buttons \ + -form $form_elements \ + -on_request { + } -new_request { + } -edit_request { + } -on_submit { + if { [exists_and_not_null include_signature] } { + # we need to do validation + switch $message_type { + letter { + set content_raw [string trim \ + [ad_html_text_convert \ + -from [template::util::richtext::get_property format $content] \ + -to "text/plain" \ + [template::util::richtext::get_property content $content] \ + ] \ + ] + if { $content_raw == "" } { + template::element set_error message content "[_ contacts.Message_is_required]" + } + } + email { + if { [string trim $subject] == "" } { + template::element set_error message subject "[_ contacts.Subject_is_required]" + } + if { [string trim $content] == "" } { + template::element set_error message content "[_ contacts.Message_is_required]" + } + } + } + } + } + + + + +if { [string is false [::template::form::is_valid message]] } { + ad_return_template message +} else { + if { [exists_and_not_null include_signature] } { + # we had good input + switch $message_type { + letter { + set content [ad_html_text_convert -from [template::util::richtext::get_property format $content] -to "text/html" [template::util::richtext::get_property content $content]] + set subject "" + } + email { + set this_subject [string trim $subject] + } + } + set from [contact::name -party_id [ad_conn user_id]] + template::multirow create messages message_type to subject content + foreach party_id $party_ids { + 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 values [list] + foreach element [list first_names last_name name date] { + lappend values [list "{$element}" [set $element]] + } + template::multirow append messages $message_type $to [contact::util::interpolate -text $subject -values $values] [contact::util::interpolate -text $content -values $values] + } + + ad_return_template message-messages + } else { + ad_return_template message + } +} Index: openacs-4/packages/contacts/www/message.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/contacts/www/message.tcl,v diff -u -r1.2 -r1.3 --- openacs-4/packages/contacts/www/message.tcl 7 Jun 2005 07:45:40 -0000 1.2 +++ openacs-4/packages/contacts/www/message.tcl 15 Jun 2005 05:04:46 -0000 1.3 @@ -8,7 +8,7 @@ {party_id:integer,multiple,optional} {party_ids:optional} {message_id:integer,optional} - {message_type:optional} + {message_type ""} {message:optional} {return_url "./"} } -validate { @@ -57,9 +57,6 @@ } set title [_ contacts.create_a_message] } else { - append form_elements { - {message_type:text(hidden)} - } set title [_ contacts.create_$message_type] } set context [list $title] @@ -69,131 +66,48 @@ {message:text(select) {label "[_ contacts.Message]"} {options {{{-- Create New Message --} new}}}} } set edit_buttons [list [list "[_ contacts.Next]" create]] -} else { - append form_elements { - {message:text(hidden)} - } - if { $message_type == "email" } { - append form_elements { - {subject:text(text),optional - {label "[_ contacts.Subject]"} - {html {size 55}} - } - {content:text(textarea),optional - {label "[_ contacts.Message]"} - {html {cols 55 rows 18}} - {help_text {remember that you can use mail merge substitutions. the most common wildcards are \{name\} \{first_names\}, \{last_name\}, \{home_address\} and \{date\}}} - } + + ad_form -action message \ + -name message \ + -cancel_label "[_ contacts.Cancel]" \ + -cancel_url $return_url \ + -edit_buttons $edit_buttons \ + -form $form_elements \ + -on_request { + } -new_request { + } -edit_request { + } -on_submit { } - } elseif { $message_type == "letter" } { - set todays_date [lc_time_fmt [dt_sysdate] "%q"] - append form_elements { - {paper_type:text(select),optional - {label "[_ contacts.Paper_Type]"} - {options {{{Letter} letter} {Letterhead letterhead}}} - } - {date:text(inform),optional - {label "[_ contacts.Date]"} - {value $todays_date} - } - {address:text(inform),optional - {label "[_ contacts.Address]"} - {value "{name}
{mailing_address}"} - {help_text {The recipeints name and mailing address will automatically be included so that they work with window envelopes}} - } - {content:richtext(richtext),optional - {label "[_ contacts.Message]"} - {html {cols 70 rows 24}} - {help_text {[_ contacts.lt_remember_that_you_can]}} - } - } - } else { - error "[_ contacts.lt_labels_are_not_implem]" - } - set sig_options "{{[_ contacts.lt_--_no_not_include_a_s]} \"none\"} [db_list_of_lists select_sigs {select title, signature from contact_signatures where party_id = :user_id}]" - append form_elements { - {include_signature:text(select),optional {label "[_ contacts.Signature]"} {options $sig_options} {help_text {you may modify [_ contacts.your_signatures]}}} - {save_as:text(text),optional {label "[_ contacts.Save_Message_As]"} {html {size 35}}} - } - append form_elements - set edit_buttons [list [list "[_ contacts.Preview]" create]] } - - - -ad_form -action message \ - -name message \ - -cancel_label "[_ contacts.Cancel]" \ - -cancel_url $return_url \ - -edit_buttons $edit_buttons \ - -form $form_elements \ - -on_request { - } -new_request { - } -edit_request { - } -on_submit { - if { [exists_and_not_null include_signature] } { - # we need to do validation - switch $message_type { - letter { - set content_raw [string trim \ - [ad_html_text_convert \ - -from [template::util::richtext::get_property format $content] \ - -to "text/plain" \ - [template::util::richtext::get_property content $content] \ - ] \ - ] - if { $content_raw == "" } { - template::element set_error message content "[_ contacts.Message_is_required]" - } - } - email { - if { [string trim $subject] == "" } { - template::element set_error message subject "[_ contacts.Subject_is_required]" - } - if { [string trim $content] == "" } { - template::element set_error message content "[_ contacts.Message_is_required]" - } - } - } +if { [exists_and_not_null include_signature] } { + # we had good input + switch $message_type { + letter { + set content [ad_html_text_convert -from [template::util::richtext::get_property format $content] -to "text/html" [template::util::richtext::get_property content $content]] + set subject "" } + email { + set this_subject [string trim $subject] + } } - - - - -if { [string is false [::template::form::is_valid message]] } { - ad_return_template message -} else { - if { [exists_and_not_null include_signature] } { - # we had good input - switch $message_type { - letter { - set content [ad_html_text_convert -from [template::util::richtext::get_property format $content] -to "text/html" [template::util::richtext::get_property content $content]] - set subject "" - } - email { - set this_subject [string trim $subject] - } + set from [contact::name -party_id [ad_conn user_id]] + template::multirow create messages message_type to subject content + foreach party_id $party_ids { + 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 values [list] + foreach element [list first_names last_name name date] { + lappend values [list "{$element}" [set $element]] } - set from [contact::name -party_id [ad_conn user_id]] - template::multirow create messages message_type to subject content - foreach party_id $party_ids { - 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 values [list] - foreach element [list first_names last_name name date] { - lappend values [list "{$element}" [set $element]] - } - template::multirow append messages $message_type $to [contact::util::interpolate -text $subject -values $values] [contact::util::interpolate -text $content -values $values] - } - - ad_return_template message-messages - } else { - ad_return_template message + template::multirow append messages $message_type $to [contact::util::interpolate -text $subject -values $values] [contact::util::interpolate -text $content -values $values] } + + ad_return_template message-messages +} else { + ad_return_template message }