Index: openacs-4/packages/assessment/tcl/apm-callback-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/assessment/tcl/apm-callback-procs.tcl,v diff -u -r1.1 -r1.2 --- openacs-4/packages/assessment/tcl/apm-callback-procs.tcl 24 Jan 2005 17:59:52 -0000 1.1 +++ openacs-4/packages/assessment/tcl/apm-callback-procs.tcl 1 Feb 2005 22:13:44 -0000 1.2 @@ -1,7 +1,7 @@ ad_library { Procedures to do a new impl and aliases in the acs-sc. - @creation date 2005-01-19 + @creation date 2004-11-24 @author Anny Flores (annyflores@viaro.net) } @@ -13,105 +13,71 @@ } { db_transaction { - # Create the impl and aliases for one as_inter_item_checks action - set impl_id [create_as_inter_item_checks_impl] + # Create the impl and aliases for one inter_item_check action + set impl_id [create_inter_item_check_impl] # Create the notification type for one specific action - set type_id [create_as_inter_item_checks_type $impl_id] + set type_id [create_inter_item_check_type $impl_id] - # Enable the delivery intervals and delivery methods for a specific AS_INTER_ITEM_CHECKS + # Enable the delivery intervals and delivery methods for a specific INTER_ITEM_CHECK enable_intervals_and_methods $type_id } } -ad_proc -private inter_item_checks::apm_callback::after_upgrade { - {-from_version_name:required} - {-to_version_name:required} -} { - Does the integration whith the notifications package. -} { - apm_upgrade_logic -from_version_name $from_version_name -to_version_name $to_version_name\ - -spec { - 0.07d 0.08d { - - db_transaction { - - # Create the impl and aliases for one as_inter_item_checks action - set impl_id [create_as_inter_item_checks_impl] - - # Create the notification type for one specific action - set type_id [create_as_inter_item_checks_type $impl_id] - - # Enable the delivery intervals and delivery methods for a specific AS_INTER_ITEM_CHECKS - enable_intervals_and_methods $type_id - - } - - } - } -} - ad_proc -private inter_item_checks::apm_callback::package_uninstall { } { Remove the integration whith the notification package } { db_transaction { - # Delete the type_id for a specific AS_INTER_ITEM_CHECKS - notification::type::delete -short_name as_inter_item_checks_notif + # Delete the type_id for a specific INTER_ITEM_CHECK + notification::type::delete -short_name inter_item_check_notif - # Delete the implementation for the notification of one specific AS_INTER_ITEM_CHECKS - delete_as_inter_item_checks_impl - - # Delete the type_id for all inter_item_checks - notification::type::delete -short_name as_inter_item_checks_notif + # Delete the implementation for the notification of one specific INTER_ITEM_CHECK + delete_inter_item_check_impl - - } + } } -ad_proc -public inter_item_checks::apm_callback::delete_as_inter_item_checks_impl {} { - Unregister the NotificationType implementation for as_inter_item_checks_notif_type. +ad_proc -public inter_item_checks::apm_callback::delete_inter_item_check_impl {} { + Unregister the NotificationType implementation for inter_item_check_notif_type. } { acs_sc::impl::delete \ -contract_name "NotificationType" \ - -impl_name as_inter_item_checks_notif_type + -impl_name inter_item_check_notif_type } -ad_proc -public inter_item_checks::apm_callback::create_as_inter_item_checks_impl {} { +ad_proc -public inter_item_checks::apm_callback::create_inter_item_check_impl {} { Register the service contract implementation and return the impl_id @return impl_id of the created implementation } { return [acs_sc::impl::new_from_spec -spec { - name as_inter_item_checks_notif_type + name inter_item_check_notif_type contract_name NotificationType - owner as_inter_item_checks + owner inter_item_check aliases { GetURL inter_item_checks::notification::get_url ProcessReply inter_item_checks::notification::process_reply } }] } -ad_proc -public inter_item_checks::apm_callback::create_as_inter_item_checks_type {impl_id} { - Create the notification type for one specific AS_INTER_ITEM_CHECKS +ad_proc -public inter_item_checks::apm_callback::create_inter_item_check_type {impl_id} { + Create the notification type for one specific INTER_ITEM_CHECK @return the type_id of the created type } { return [notification::type::new \ -sc_impl_id $impl_id \ - -short_name as_inter_item_checks_notif \ - -pretty_name "One AS_INTER_ITEM_CHECKS" \ - -description "Notification of execution of one specific action in the as_inter_item_checks"] + -short_name inter_item_check_notif \ + -pretty_name "One INTER_ITEM_CHECK" \ + -description "Notification of execution of one specific action in the inter_item_check"] } ad_proc -public inter_item_checks::apm_callback::enable_intervals_and_methods {type_id} { Enable the intervals and delivery methods of a specific type } { # Enable the various intervals and delivery method - notification::type::interval_enable \ - -type_id $type_id \ - -interval_id [notification::interval::get_id_from_name -name instant] notification::type::interval_enable \ -type_id $type_id \ @@ -121,6 +87,9 @@ -type_id $type_id \ -interval_id [notification::interval::get_id_from_name -name daily] + notification::type::interval_enable \ + -type_id $type_id \ + -interval_id [notification::interval::get_id_from_name -name instant] # Enable the delivery methods notification::type::delivery_method_enable \ -type_id $type_id \ Index: openacs-4/packages/assessment/tcl/as-checks-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/assessment/tcl/as-checks-procs.tcl,v diff -u -r1.9 -r1.10 --- openacs-4/packages/assessment/tcl/as-checks-procs.tcl 31 Jan 2005 22:30:48 -0000 1.9 +++ openacs-4/packages/assessment/tcl/as-checks-procs.tcl 1 Feb 2005 22:13:44 -0000 1.10 @@ -179,6 +179,7 @@ set log_id [db_string get_next_val {}] set action_id [db_string action_id {}] set message " " + if { $failed == "f" } { set message "This action failed." } @@ -242,14 +243,16 @@ set tcl_code_p [db_1row select_tcl {}] set failed_p "t" - set failed [catch $tcl_code] + set failed [catch $tcl_code errorMsg] + if { $failed > 0 } { set failed_p "f" - set error_txt "This action failed" } - notification::new -type_id [notification::type::get_type_id -short_name as_inter_item_checks_notif] -object_id $inter_item_check_id -notif_subject "$action_name has been executed" -notif_text "The action $action_name has been executed. This message has been showed to the user: $user_message $error_txt" + ns_log notice "-----------------------> error $errorMsg" + + notification::new -type_id [notification::type::get_type_id -short_name inter_item_check_notif] -object_id $inter_item_check_id -notif_subject "$action_name has been executed" -notif_text "The action $action_name has been executed. This message has been showed to the user: $user_message $error_txt" as::assessment::check::action_log -session_id $session_id -check_id $inter_item_check_id -failed $failed_p Index: openacs-4/packages/assessment/tcl/as-checks-procs.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/assessment/tcl/as-checks-procs.xql,v diff -u -r1.7 -r1.8 --- openacs-4/packages/assessment/tcl/as-checks-procs.xql 31 Jan 2005 22:30:48 -0000 1.7 +++ openacs-4/packages/assessment/tcl/as-checks-procs.xql 1 Feb 2005 22:13:44 -0000 1.8 @@ -201,7 +201,7 @@ - select a.tcl_code, am.name as action_name,am.user_message from as_actions a,as_action_map am where am.action_id = a.action_id and inter_item_check_id = :inter_item_check_id + select a.tcl_code, a.name as action_name,am.user_message from as_actions a,as_action_map am where am.action_id = a.action_id and inter_item_check_id = :inter_item_check_id