Index: openacs-4/packages/dotlrn/www/spam-2.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/dotlrn/www/spam-2.adp,v diff -u -r1.8 -r1.8.2.1 --- openacs-4/packages/dotlrn/www/spam-2.adp 9 Aug 2002 18:39:26 -0000 1.8 +++ openacs-4/packages/dotlrn/www/spam-2.adp 17 Oct 2002 12:17:40 -0000 1.8.2.1 @@ -27,17 +27,30 @@ Are you sure you want to send the following @spam_name@ Message?

- - - - - - - - - -
Subject
@subject@
Message
@message@
- + + + + + + + + + + +
Subject
@subject@
Message@preview_message@
+
+ + + + + + + + + + +
Subject@subject@
Message <%= [ad_text_to_html -- "$preview_message"] %>
+
@confirm_data@ Index: openacs-4/packages/dotlrn/www/spam-2.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/dotlrn/www/spam-2.tcl,v diff -u -r1.4 -r1.4.2.1 --- openacs-4/packages/dotlrn/www/spam-2.tcl 9 Aug 2002 18:39:26 -0000 1.4 +++ openacs-4/packages/dotlrn/www/spam-2.tcl 17 Oct 2002 12:17:40 -0000 1.4.2.1 @@ -30,10 +30,21 @@ portal_id:onevalue } -form get_values spam_message subject message -set subject [ad_quotehtml $subject] -set message [ad_quotehtml $message] +form get_values spam_message subject message message_type +# the following is just to make sure the previewing works ok. +# in case the user types a html message and chooses the messsage +# to be a plain text type or vice-versa. +if {$message_type == "html"} { + if [ad_looks_like_html_p $message] { + set preview_message "
$message
" + } else { + set preview_message "$message" + } +} else { + set preview_message [ad_quotehtml $message] +} + set spam_name [bulk_mail::parameter -parameter PrettyName -default Spam] set context_bar [list [list $referer Admin] "$spam_name Community"] set community_id [dotlrn_community::get_community_id] Index: openacs-4/packages/dotlrn/www/spam.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/dotlrn/www/spam.adp,v diff -u -r1.16 -r1.16.2.1 --- openacs-4/packages/dotlrn/www/spam.adp 9 Aug 2002 18:39:26 -0000 1.16 +++ openacs-4/packages/dotlrn/www/spam.adp 17 Oct 2002 12:17:40 -0000 1.16.2.1 @@ -23,8 +23,6 @@ @context_bar@ - - Index: openacs-4/packages/dotlrn/www/spam.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/dotlrn/www/spam.tcl,v diff -u -r1.17 -r1.17.2.1 --- openacs-4/packages/dotlrn/www/spam.tcl 9 Aug 2002 18:39:26 -0000 1.17 +++ openacs-4/packages/dotlrn/www/spam.tcl 17 Oct 2002 12:17:40 -0000 1.17.2.1 @@ -34,7 +34,7 @@ set community_id [dotlrn_community::get_community_id] } -dotlrn::require_user_admin_community -community_id $community_id +dotlrn::require_user_spam_community -community_id $community_id set sender_id [ad_conn user_id] set portal_id [dotlrn_community::get_portal_id -community_id $community_id] @@ -75,6 +75,13 @@ -widget textarea \ -html {rows 10 cols 80 wrap soft} +element create spam_message message_type \ + -label "Message Type" \ + -datatype text \ + -widget select \ + -options {{"Plain text" "text"} {HTML "html"}} \ + -value "text" + element create spam_message send_date \ -label {Send Date} \ -datatype date \ @@ -90,12 +97,14 @@ if {[ns_queryexists "form:confirm"]} { form get_values spam_message \ - community_id from rel_type subject message send_date referer + community_id from rel_type subject message message_type send_date referer set segment_id [db_string select_rel_segment_id {}] set community_name [dotlrn_community::get_community_name $community_id] set community_url "[ad_parameter -package_id [ad_acs_kernel_id] SystemURL][dotlrn_community::get_community_url $community_id]" + set safe_community_name [db_quote $community_name] + set query " select '$from' as from_addr, '$sender_first_names' as sender_first_names, @@ -121,7 +130,7 @@ from persons where person_id = parties.party_id), '') as last_name, - '$community_name' as community_name, + '$safe_community_name' as community_name, '$community_url' as community_url from party_approved_member_map, parties, @@ -130,15 +139,26 @@ and party_approved_member_map.member_id <> $segment_id and party_approved_member_map.member_id = parties.party_id and parties.party_id = acs_objects.object_id + and parties.party_id in (select acs_rels.object_id_two + from acs_rels, membership_rels + where acs_rels.object_id_one = + acs.magic_object_id('registered_users') + and acs_rels.rel_id = + membership_rels.rel_id + and membership_rels.member_state + = 'approved') " +ns_log notice "query: $query" + bulk_mail::new \ -package_id [site_node_apm_integration::get_child_package_id -package_key [bulk_mail::package_key]] \ -send_date [template::util::date::get_property linear_date $send_date] \ -date_format "YYYY MM DD HH24 MI SS" \ -from_addr $from \ -subject "\[$community_name\] $subject" \ -message $message \ + -message_type $message_type \ -query $query ad_returnredirect $referer