Index: openacs-4/packages/rules/www/process-response-oracle.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/rules/www/Attic/process-response-oracle.xql,v diff -u -N -r1.2 -r1.3 --- openacs-4/packages/rules/www/process-response-oracle.xql 9 Dec 2004 20:11:25 -0000 1.2 +++ openacs-4/packages/rules/www/process-response-oracle.xql 9 Dec 2004 21:26:50 -0000 1.3 @@ -19,10 +19,14 @@ + select * from rules where asm_id=:survey_id + + select * from rules_triggers where rule_id=:rule_id + 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 -N -r1.4 -r1.5 --- openacs-4/packages/rules/www/process-response.tcl 9 Dec 2004 20:11:25 -0000 1.4 +++ openacs-4/packages/rules/www/process-response.tcl 9 Dec 2004 21:26:50 -0000 1.5 @@ -15,88 +15,70 @@ 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 } { - #ad_return_complaint 1 "$qs_id $response_id" - #ad_script_abort - - set answer [db_string answer { select choice_id from survey_question_responses where question_id=:qs_id and response_id=:response_id}] - if { $answer == $result_id } { - set perform_actions 1 - } else { - set perform_actions 0 - } - } - if { $perform_actions == 1 } { - db_foreach action { select * from rules_actions where rule_id=:rule_id} { - # ad_return_complaint 1 "$action_type" -# ad_script_abort - 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 { - - 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')} +db_foreach rules_related { select * from rules where asm_id=:survey_id } { + if { $active_p == "y"} { + db_foreach rule_triggers {select result_id,rule_def_id, qs_id, active_p, rule_id from rules_triggers where rule_id=:rule_id } { + if { $active_p == "y" } { + set answer [db_string answer { select choice_id from survey_question_responses where question_id=:qs_id and response_id=:response_id}] + + if { $answer == $result_id } { + set perform_actions 1 + } else { + set perform_actions 0 } - } 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')} - - + if { $perform_actions == 1 } { + db_foreach action { select * from rules_actions where rule_id=:rule_id} { + 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 { + 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')} + } + } 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')} + } + } elseif { $action_type == 3 } { + set s_id "" + db_foreach questions { *SQL* } { + if { $question_text == "student_id"} { + set s_id $question_id } - } elseif { $action_type == 3 } { - set s_id "" - db_foreach questions { *SQL* } { - if { $question_text == "student_id"} { - set s_id $question_id + } + set user_info [db_string student_id {select number_answer from survey_question_responses where question_id = :s_id and response_id = :response_id}] + 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 +
    +
    + User Name: $user_info@viaro.net +
    + 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,-1,:user_id,:rule_action_id,to_date(:today,'YYYY-MM-DD'),to_date(:today,'YYYY-MM-DD'),'y')} + } + } } - } -# ad_return_complaint 1 "$s_id" -# ad_script_abort - - set user_info [db_string student_id {select number_answer from survey_question_responses where question_id = :s_id and response_id = :response_id}] - - 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 -
    -
    - User Name: $user_info@viaro.net -
    - 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 has been executed" -notif_text $notif_text + } + } } - } - 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 -} + + Index: openacs-4/packages/rules/www/admin/admin-request.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/rules/www/admin/Attic/admin-request.adp,v diff -u -N -r1.4 -r1.5 --- openacs-4/packages/rules/www/admin/admin-request.adp 9 Dec 2004 20:11:25 -0000 1.4 +++ openacs-4/packages/rules/www/admin/admin-request.adp 9 Dec 2004 21:26:51 -0000 1.5 @@ -13,8 +13,7 @@ function get_specific_date() { date=document.specific_date.specific_date.value; destination ="admin-request?community=@default_community@&state=@default_state@&rule=@default_rule@&interval=@default_interval@&specific_date="+date; - alert (destination); - if (destination) location.href = destination; + if (destination) location.href = destination; } Index: openacs-4/packages/rules/www/admin/admin-request.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/rules/www/admin/Attic/admin-request.tcl,v diff -u -N -r1.3 -r1.4 --- openacs-4/packages/rules/www/admin/admin-request.tcl 9 Dec 2004 20:11:25 -0000 1.3 +++ openacs-4/packages/rules/www/admin/admin-request.tcl 9 Dec 2004 21:26:51 -0000 1.4 @@ -49,8 +49,9 @@ } if {[exists_and_not_null rule] && $rule != "all" } { + set default_rule $rule - set rule_query " and r.rule_action_id= (select rule_action_id from rules_actions where rule_id = $default_rule)" + set rule_query " and r.rule_action_id in (select rule_action_id from rules_actions where rule_id = $default_rule)" }