Index: openacs-4/packages/rules/www/process-response.tcl
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/rules/www/Attic/process-response.tcl,v
diff -u -r1.2 -r1.3
--- openacs-4/packages/rules/www/process-response.tcl 7 Dec 2004 20:04:48 -0000 1.2
+++ openacs-4/packages/rules/www/process-response.tcl 8 Dec 2004 21:21:25 -0000 1.3
@@ -13,6 +13,7 @@
set perform_actions 0
set rest ""
set message ""
+set notif_text ""
db_foreach rules_related {select * from rules where asm_id=:survey_id} {
db_foreach rule_triggers { select * from rules_triggers where rule_id=:rule_id } {
set answer [db_string answer { select choice_id from survey_question_responses where question_id=:qs_id and response_id=:response_id}]
@@ -27,9 +28,12 @@
set rha_id [db_nextval rha_seq]
set community_name [db_string name {select pretty_name from dotlrn_communities_all where community_id=:group_id} -default System]
set today [db_string date "select to_date(sysdate,'YYYY-MM-DD') from dual"]
+ set username [db_string name {select p.first_names || ' ' || p.last_name as name from persons p where p.person_id = :user_id}]
+
if { $action_type == 1} {
append message "
You have joined the $community_name community."
+ append notif_text "The user user has joined the $community_name community."
dotlrn_community::add_user $group_id $user_id
db_transaction {
@@ -38,6 +42,7 @@
}
} elseif {$action_type == 2} {
append message " Your request to join $community_name has been sent to the administrator of the group."
+ append notif_text "The user $username requested to join $community_name has been sent to the administrator of the group."
set today [db_string date "select sysdate from dual"]
db_transaction {
db_dml add_history { insert into rule_history_actions (rha_id,group_id,user_id,rule_action_id,request_date,processing_date,approved_p) values (:rha_id,:group_id,:user_id,:rule_action_id,to_date(:today,'YYYY-MM-DD'),'','n')}
@@ -47,7 +52,7 @@
} elseif {$action_type == 3 } {
set user_info [db_string student_id {select number_answer from survey_question_responses where question_id = (:qs_id+1) and response_id = :response_id}]
- array set user_new_info [auth::create_user -username $user_info -email $user_info@viaro.com -first_names $user_info -last_name $user_info -password $user_info]
+ array set user_new_info [auth::create_user -username $user_info -email $user_info@viaro.net -first_names $user_info -last_name $user_info -password $user_info]
append message " You have joined the System
@@ -56,14 +61,23 @@
Password: $user_info
-"
+"
+ append notif_text "A user has joined to the system User Name: $user_info@viaro.net"
set user_id $user_new_info(user_id)
+ dotlrn::user_add -can_browse -user_id $user_id
db_transaction {
+
db_dml add_history { insert into rule_history_actions (rha_id,group_id,user_id,rule_action_id,request_date,processing_date,approved_p) values (:rha_id,:group_id,:user_id,:rule_action_id,to_date(:today,'YYYY-MM-DD'),to_date(:today,'YYYY-MM-DD'),'y')}
}
}
}
}
- }
+ append notif_text "
+ You can visit this rule history at http://216.230.130.230:3500/rules/admin/admin-request
+ "
+ notification::new -type_id [notification::type::get_type_id -short_name rule_notif] -object_id $rule_id -notif_subject "$rule_name" -notif_text $notif_text
+}
+
+