Index: openacs-4/packages/dotlrn/tcl/dotlrn-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/dotlrn/tcl/dotlrn-procs.tcl,v diff -u -r1.50 -r1.51 --- openacs-4/packages/dotlrn/tcl/dotlrn-procs.tcl 13 May 2002 06:00:06 -0000 1.50 +++ openacs-4/packages/dotlrn/tcl/dotlrn-procs.tcl 15 May 2002 22:13:57 -0000 1.51 @@ -112,8 +112,8 @@ set package_list [nsv_array get site_nodes "*$package_key*"] set dotlrn_ancestor_p 0 - for {set x 1} {$x < [llength $package_list]} {incr x 2} { - array set package_info [lindex $package_list $x] + for {set i 1} {$i < [llength $package_list]} {incr i 2} { + array set package_info [lindex $package_list $i] if {[site_node_closest_ancestor_package -default 0 -url $package_info(url) "dotlrn"] != 0} { set dotlrn_ancestor_p 1 Index: openacs-4/packages/dotlrn/tcl/site-nodes-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/dotlrn/tcl/Attic/site-nodes-procs.tcl,v diff -u -r1.16 -r1.17 --- openacs-4/packages/dotlrn/tcl/site-nodes-procs.tcl 12 May 2002 18:20:31 -0000 1.16 +++ openacs-4/packages/dotlrn/tcl/site-nodes-procs.tcl 15 May 2002 22:13:57 -0000 1.17 @@ -341,4 +341,18 @@ return $node_id } + ad_proc -public get_child_package_id { + {-parent_package_id ""} + {-package_key:required} + } { + get the package_id of package_key that is mounted directly under + parent_package_id. returns 0 if not found. + } { + if {[empty_string_p $parent_package_id]} { + set parent_package_id [ad_conn package_id] + } + + return [db_string select_child_package_id {} -default 0] + } + } Index: openacs-4/packages/dotlrn/tcl/site-nodes-procs.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/dotlrn/tcl/Attic/site-nodes-procs.xql,v diff -u -r1.10 -r1.11 --- openacs-4/packages/dotlrn/tcl/site-nodes-procs.xql 12 May 2002 18:20:31 -0000 1.10 +++ openacs-4/packages/dotlrn/tcl/site-nodes-procs.xql 15 May 2002 22:13:57 -0000 1.11 @@ -40,4 +40,17 @@ + + + select sn1.object_id + from site_nodes sn1, + apm_packages + where sn1.parent_id = (select sn2.node_id + from site_nodes sn2 + where sn2.object_id = :parent_package_id) + and sn1.object_id = apm_packages.package_id + and apm_packages.package_key = :package_key + + + Index: openacs-4/packages/dotlrn/www/spam-variables.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/dotlrn/www/spam-variables.adp,v diff -u -r1.3 -r1.4 --- openacs-4/packages/dotlrn/www/spam-variables.adp 29 Mar 2002 19:14:46 -0000 1.3 +++ openacs-4/packages/dotlrn/www/spam-variables.adp 15 May 2002 22:13:57 -0000 1.4 @@ -19,45 +19,49 @@ %>
+ + - + - + - + - + - + - + +
The following variables can be used to insert user/community specific data:
<sender_email>{from_addr} = Sender's Email Address
<community_name>{community_name} = Community's Name
<community_url>{community_url} = Community's Web Address
<email>{email} = Recipient's Email
<first_names>{first_names} = Recipient's First Name
<last_name>{last_name} = Recipient's Last Name
+
Index: openacs-4/packages/dotlrn/www/spam.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/dotlrn/www/spam.tcl,v diff -u -r1.9 -r1.10 --- openacs-4/packages/dotlrn/www/spam.tcl 6 May 2002 23:55:02 -0000 1.9 +++ openacs-4/packages/dotlrn/www/spam.tcl 15 May 2002 22:13:57 -0000 1.10 @@ -29,7 +29,8 @@ portal_id:onevalue } -set context_bar {{$referer Admin} {Spam Community}} +set spam_name [bulk_mail::parameter -parameter PrettyName -default Spam] +set context_bar [list [list $referer Admin] "$spam_name Community"] if {[empty_string_p $community_id]} { set community_id [dotlrn_community::get_community_id] @@ -40,15 +41,7 @@ set sender_id [ad_conn user_id] set portal_id [dotlrn_community::get_portal_id -community_id $community_id] -db_1row select_sender_info { - select parties.email as sender_email, - persons.first_names as sender_first_names, - persons.last_name as sender_last_name - from parties, - persons - where parties.party_id = :sender_id - and persons.person_id = :sender_id -} +db_1row select_sender_info {} form create spam_message @@ -84,6 +77,13 @@ -widget textarea \ -html {rows 10 cols 80 wrap soft} +element create spam_message send_date \ + -label {Send Date} \ + -datatype date \ + -widget date \ + -format {MONTH DD YYYY HH12:MI AM} \ + -value [template::util::date::now] + element create spam_message referer \ -label Referer \ -datatype text \ @@ -92,30 +92,56 @@ if {[form is_valid spam_message]} { form get_values spam_message \ - community_id from rel_type subject message referer + community_id from rel_type subject message send_date referer - # YON: should redirect and close the connection here so that the user - # doesn't have to wait for the emails to get sent out. - set segment_id [db_string select_rel_segment_id {}] set community_name [dotlrn_community::get_community_name $community_id] - set community_url [dotlrn_community::get_community_url $community_id] + set community_url "[ad_parameter -package_id [ad_acs_kernel_id] SystemURL][dotlrn_community::get_community_url $community_id]" - # replace some values in the subject and the message - set message_values [list] - lappend message_values [list {} $from] - lappend message_values [list {} $community_name] - lappend message_values [list {} $community_url] + set query " + select '$from' as from_addr, + '$sender_first_names' as sender_first_names, + '$sender_last_name' as sender_last_name, + parties.email, + decode(acs_objects.object_type, + 'user', + (select first_names + from persons + where person_id = parties.party_id), + 'group', + (select group_name + from groups + where group_id = parties.party_id), + 'rel_segment', + (select segment_name + from rel_segments + where segment_id = parties.party_id), + '') as first_names, + decode(acs_objects.object_type, + 'user', + (select last_name + from persons + where person_id = parties.party_id), + '') as last_name, + '$community_name' as community_name, + '$community_url' as community_url + from party_approved_member_map, + parties, + acs_objects + where party_approved_member_map.party_id = $segment_id + 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 + " - set recepients [db_list select_recepients {}] - - spam::send \ - -recepients $recepients \ - -from $from \ - -real_from $sender_email \ + bulk_mail::new \ + -package_id [site_nodes::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 $subject \ -message $message \ - -message_values $message_values + -query $query ad_returnredirect $referer ad_script_abort Index: openacs-4/packages/dotlrn/www/spam.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/dotlrn/www/spam.xql,v diff -u -r1.6 -r1.7 --- openacs-4/packages/dotlrn/www/spam.xql 1 May 2002 01:19:47 -0000 1.6 +++ openacs-4/packages/dotlrn/www/spam.xql 15 May 2002 22:13:57 -0000 1.7 @@ -2,6 +2,18 @@ + + + select parties.email as sender_email, + persons.first_names as sender_first_names, + persons.last_name as sender_last_name + from parties, + persons + where parties.party_id = :sender_id + and persons.person_id = :sender_id + + + select rel_segments.segment_id @@ -11,48 +23,4 @@ - - - select parties.party_id - from party_approved_member_map, - parties - where party_approved_member_map.party_id = :segment_id - and party_approved_member_map.member_id <> :segment_id - and party_approved_member_map.member_id = parties.party_id - - - - - - select parties.email, - decode(acs_objects.object_type, - 'user', - (select first_names - from persons - where person_id = parties.party_id), - 'group', - (select group_name - from groups - where group_id = parties.party_id), - 'rel_segment', - (select segment_name - from rel_segments - where segment_id = parties.party_id), - '') as first_names, - decode(acs_objects.object_type, - 'user', - (select last_name - from persons - where person_id = parties.party_id), - '') as last_name - from party_approved_member_map, - parties, - acs_objects - where party_approved_member_map.party_id = :segment_id - 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 - - -