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
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ openacs-4/packages/assessment/tcl/apm-callback-procs.tcl 24 Jan 2005 17:59:52 -0000 1.1
@@ -0,0 +1,130 @@
+ad_library {
+
+ Procedures to do a new impl and aliases in the acs-sc.
+ @creation date 2005-01-19
+ @author Anny Flores (annyflores@viaro.net)
+}
+
+namespace eval inter_item_checks::apm_callback {}
+
+ad_proc -private inter_item_checks::apm_callback::package_install {
+} {
+ Does the integration whith the notifications package.
+} {
+ 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::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 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
+
+
+ }
+}
+
+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.
+} {
+ acs_sc::impl::delete \
+ -contract_name "NotificationType" \
+ -impl_name as_inter_item_checks_notif_type
+}
+ad_proc -public inter_item_checks::apm_callback::create_as_inter_item_checks_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
+ contract_name NotificationType
+ owner as_inter_item_checks
+ 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
+ @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"]
+}
+
+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 \
+ -interval_id [notification::interval::get_id_from_name -name hourly]
+
+ notification::type::interval_enable \
+ -type_id $type_id \
+ -interval_id [notification::interval::get_id_from_name -name daily]
+
+ # Enable the delivery methods
+ notification::type::delivery_method_enable \
+ -type_id $type_id \
+ -delivery_method_id [notification::delivery::get_id -short_name email]
+}
+
+
Index: openacs-4/packages/assessment/tcl/apm-callback-procs.tcl~
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/assessment/tcl/Attic/apm-callback-procs.tcl~,v
diff -u
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ openacs-4/packages/assessment/tcl/apm-callback-procs.tcl~ 24 Jan 2005 18:03:29 -0000 1.1
@@ -0,0 +1,128 @@
+ad_library {
+
+ Procedures to do a new impl and aliases in the acs-sc.
+ @creation date 2005-01-19
+ @author Anny Flores (annyflores@viaro.net)
+}
+
+namespace eval inter_item_checks::apm_callback {}
+
+ad_proc -private inter_item_checks::apm_callback::package_install {
+} {
+ Does the integration whith the notifications package.
+} {
+ 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::after_upgrade_logic {
+ {-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 { } {
+
+ 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 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
+
+
+ }
+}
+
+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.
+} {
+ acs_sc::impl::delete \
+ -contract_name "NotificationType" \
+ -impl_name as_inter_item_checks_notif_type
+}
+ad_proc -public inter_item_checks::apm_callback::create_as_inter_item_checks_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
+ contract_name NotificationType
+ owner as_inter_item_checks
+ 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
+ @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"]
+}
+
+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 \
+ -interval_id [notification::interval::get_id_from_name -name hourly]
+
+ notification::type::interval_enable \
+ -type_id $type_id \
+ -interval_id [notification::interval::get_id_from_name -name daily]
+
+ # Enable the delivery methods
+ notification::type::delivery_method_enable \
+ -type_id $type_id \
+ -delivery_method_id [notification::delivery::get_id -short_name email]
+}
+
+
Index: openacs-4/packages/assessment/tcl/as-action-proc.tcl
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/assessment/tcl/as-action-proc.tcl,v
diff -u
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ openacs-4/packages/assessment/tcl/as-action-proc.tcl 24 Jan 2005 17:59:52 -0000 1.1
@@ -0,0 +1,32 @@
+ad_library {
+ Assessment action procs
+ @author vivian@viaro.net Viaro Networks (www.viaro.net)
+ @creation-date 2005-01-13
+
+}
+
+namespace eval as::action_p {}
+
+ad_proc -public as::action_p::action_exec {
+ {-inter_item_check_id}
+ {-session_id}
+
+
+} {
+ Execute the action created on the tcl_code
+} {
+ db_foreach get_check_params { select * from as_param_map where inter_item_check_id = :inter_item_check_id } {
+ set parameter_name [db_1row select_name "select varname from as_action_params where parameter_id = :parameter_id"]
+ if {![exixts_and_not_null value]} {
+ set $varname [db_string get_item_choice {select idc.choice_id from as_item_data_choices idc,as_item_data id where id.as_item_id=$item_id and id.item_data_id=idc.item_data_id and id.session_id=:session_id}]
+
+ }else {
+
+ set $varname $value
+ }
+ }
+ set tcl_code [db_1row select_tcl "select a.tcl_code from as_actions a,as_actions_map am where am.action_id = a.action_id and inter_item_check_id = :inter_item_check_id"]
+ eval $tcl_code
+ return
+
+}
Index: openacs-4/packages/assessment/tcl/as-action-proc.tcl~
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/assessment/tcl/Attic/as-action-proc.tcl~,v
diff -u
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ openacs-4/packages/assessment/tcl/as-action-proc.tcl~ 24 Jan 2005 17:59:52 -0000 1.1
@@ -0,0 +1,32 @@
+ad_library {
+ Assessment action procs
+ @author vivian@viaro.net Viaro Networks (www.viaro.net)
+ @creation-date 2005-01-13
+
+}
+
+namespace eval as::action {}
+
+ad_proc -public as::action::action_exec {
+ {-inter_item_check_id}
+ {-session_id}
+
+
+} {
+ Execute the action created on the tcl_code
+} {
+ db_foreach get_check_params { select * from as_param_map where inter_item_check_id = :inter_item_check_id } {
+ set parameter_name [db_1row select_name "select varname from as_action_params where parameter_id = :parameter_id"]
+ if {![exixts_and_not_null value]} {
+ set $varname [db_string get_item_choice {select idc.choice_id from as_item_data_choices idc,as_item_data id where id.as_item_id=$item_id and id.item_data_id=idc.item_data_id and id.session_id=:session_id}]
+
+ }else {
+
+ set $varname $value
+ }
+ }
+ set tcl_code [db_1row select_tcl "select a.tcl_code from as_actions a,as_actions_map am where am.action_id = a.action_id and inter_item_check_id = :inter_item_check_id"]
+ eval $tcl_code
+ return
+
+}
Index: openacs-4/packages/assessment/tcl/as-action-proc.xql
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/assessment/tcl/as-action-proc.xql,v
diff -u
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ openacs-4/packages/assessment/tcl/as-action-proc.xql 24 Jan 2005 17:59:52 -0000 1.1
@@ -0,0 +1,28 @@
+
+
+
+
+
+ select a.tcl_code from as_actions a,as_actions_map am where am.action_id = a.action_id and inter_item_check_id = :inter_item_check_id
+
+
+
+
+
+
+
+ select parameter_id,value from as_param_map where inter_item_check_id = :inter_item_check_id
+
+
+
+
+
+
+
+
+ select varname from as_action_params where parameter_id = :parameter_id
+
+
+
+
+
Index: openacs-4/packages/assessment/tcl/as-actions-proc.tcl
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/assessment/tcl/as-actions-proc.tcl,v
diff -u
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ openacs-4/packages/assessment/tcl/as-actions-proc.tcl 24 Jan 2005 17:59:52 -0000 1.1
@@ -0,0 +1,34 @@
+ad_library {
+ Assessment action procs
+ @author vivian@viaro.net Viaro Networks (www.viaro.net)
+ @creation-date 2005-01-13
+
+}
+
+namespace eval as::action {}
+
+ad_proc -public as::action::action_exec {
+ {-inter_item_check_id}
+ {-session_id}
+} {
+
+} {
+ db_foreach get_check_params { select * from as_param_map where inter_item_check_id = :inter_item_check_id } {
+
+ set parameter_name [db_1row select_name "select varname from as_action_params where parameter_id = :parameter_id"]
+
+ if {![exixts_and_not_null value]} {
+
+ set $varname [db_string get_item_choice {select idc.choice_id from as_item_data_choices idc,as_item_data id where id.as_item_id=$item_id and id.item_data_id=idc.item_data_id and id.session_id=:session_id}]
+
+ } else {
+
+ set $varname $value
+ }
+
+ set tcl_code [db_1row select_tcl "select a.tcl_code from as_actions a,as_actions_map am where am.action_id = a.action_id and inter_item_check_id = :inter_item_check_id"]
+ eval $tcl_code
+ return
+ }
+
+}
Index: openacs-4/packages/assessment/tcl/as-actions-proc.tcl~
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/assessment/tcl/Attic/as-actions-proc.tcl~,v
diff -u
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ openacs-4/packages/assessment/tcl/as-actions-proc.tcl~ 24 Jan 2005 17:59:52 -0000 1.1
@@ -0,0 +1,37 @@
+ad_library {
+ Assessment action procs
+ @author vivian@viaro.net Viaro Networks (www.viaro.net)
+ @creation-date 2005-01-13
+
+}
+
+namespace eval as::action {}
+
+ad_proc -public as::action::action_exec {
+ {-inter_item_check_id}
+ {-session_id}
+
+
+
+} {
+
+} {
+ db_foreach get_check_params { select * from as_param_map where inter_item_check_id = :inter_item_check_id } {
+
+ set parameter_name [db_1row select_name "select varname from as_action_params where parameter_id = :parameter_id"]
+
+ if {![exixts_and_not_null value]} {
+
+ set $varname [db_string get_item_choice {select idc.choice_id from as_item_data_choices idc,as_item_data id where id.as_item_id=$item_id and id.item_data_id=idc.item_data_id and id.session_id=:session_id}]
+
+ } else {
+
+ set $varname $value
+ }
+
+ set tcl_code [db_1row select_tcl "select a.tcl_code from as_actions a,as_actions_map am where am.action_id = a.action_id and inter_item_check_id = :inter_item_check_id"]
+ eval $tcl_code
+ return
+ }
+
+}
Index: openacs-4/packages/assessment/tcl/as-checks-procs-oracle.xql
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/assessment/tcl/as-checks-procs-oracle.xql,v
diff -u
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ openacs-4/packages/assessment/tcl/as-checks-procs-oracle.xql 24 Jan 2005 17:59:52 -0000 1.1
@@ -0,0 +1,20 @@
+
+
+
+
+
+
+ select nextval('as_actions_log_action_log_id')
+
+
+
+
+
+
+
+
+ select nextval('as_actions_log_action_log_id')
+
+
+
+
\ No newline at end of file
Index: openacs-4/packages/assessment/tcl/as-checks-procs-postgresql.xql
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/assessment/tcl/as-checks-procs-postgresql.xql,v
diff -u
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ openacs-4/packages/assessment/tcl/as-checks-procs-postgresql.xql 24 Jan 2005 17:59:52 -0000 1.1
@@ -0,0 +1,20 @@
+
+
+
+
+
+
+ select nextval('as_actions_log_action_log_id')
+
+
+
+
+
+
+
+
+ select nextval('as_actions_log_action_log_id')
+
+
+
+
\ No newline at end of file
Index: openacs-4/packages/assessment/tcl/as-checks-procs-postgresql.xql~
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/assessment/tcl/Attic/as-checks-procs-postgresql.xql~,v
diff -u
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ openacs-4/packages/assessment/tcl/as-checks-procs-postgresql.xql~ 24 Jan 2005 17:59:52 -0000 1.1
@@ -0,0 +1,12 @@
+
+
+
+
+
+
+ select nextval('as_actions_log_action_log_id')
+
+
+
+
+
\ No newline at end of file
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
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ openacs-4/packages/assessment/tcl/as-checks-procs.tcl 24 Jan 2005 17:59:52 -0000 1.1
@@ -0,0 +1,417 @@
+ad_library {
+ Assessment Checks procs
+ @author Anny Flores (annyflores@viaro.net) Viaro Networks (www.viaro.net)
+ @creation-date 2005-01-13
+}
+
+namespace eval as::assessment::check {}
+
+ad_proc -public as::assessment::check::get_types {
+} {
+ Return the checks types
+} {
+ set types [list [list "Action" "t"] [list "Branch" "f"]]
+ return $types
+}
+
+ad_proc -public as::assessment::check::get_assessments {
+} {
+
+} {
+ set package_id [ad_conn package_id]
+ set assessment_list [list [list "All" "all"]]
+ db_foreach assessment {} {
+ lappend assessment_list [list $title $assessment_id]
+ }
+
+ return $assessment_list
+}
+
+ad_proc -public as::assessment::check::state_options {
+} {
+
+} {
+ set approved_options [list {"Approved" "t"} {"Approved with errors" "ae"} {"Not Approved" "f"} ]
+ return $approved_options
+}
+
+ad_proc -public as::assessment::check::intervals {
+} {
+ Return the time intervals
+} {
+
+ set today [db_string today {}]
+ set yesterday [db_string yesterday {}]
+ set two_days [db_string two_days {}]
+ set last_week [db_string last_week {}]
+ set last_month [db_string last_month {}]
+
+ set intervals [list [list "All" "all"] [list "Today" $today] [list "Yesterday" $yesterday] [list "Two days ago" $two_days] [list "Last Week" $last_week] [list "Last Month" $last_month]]
+
+}
+
+ad_proc -public as::assessment::check::add_check_return_url {
+ {action_p}
+} {
+ Return the url
+} {
+ if { $action_p == "t"} {
+ return "action-select"
+ } else {
+ return "section-select"
+ }
+}
+
+ad_proc -public as::assessment::check::get_max_order {
+ {-action_perform}
+ {-section_id}
+} {
+ Return the next value for order_by
+} {
+ set order [db_string get_max_order {}]
+ if { $order == ""} {
+ set order 1
+ } else {
+ incr order
+ }
+ return $order
+}
+
+ad_proc -public as::assessment::check::get_parameter_value {
+ {-parameter_id}
+ {-type}
+ {-check_id}
+} {
+ Return the parameter_value
+} {
+ if { $type == "n"} {
+ return [db_string get_param_n {} -default " "]
+ } else {
+ return [db_string get_param_q {} -default " "]
+
+ }
+}
+
+
+ad_proc -public as::assessment::check::set_parameter_value {
+ {-parameter_id}
+ {-value}
+ {-check_id}
+ {-type}
+} {
+
+} {
+ set exists_p [db_string get_check_id {select inter_item_check_id from as_param_map where parameter_id=:parameter_id and inter_item_check_id = :check_id } -default 0]
+
+ if { $type == "n"} {
+ if {$exists_p != 0} {
+ db_dml param_value_update_n {}
+ } else {
+ db_dml param_value_insert_n {}
+ }
+ } else {
+ if { $exists_p != 0} {
+ db_dml param_value_update_q {}
+ } else {
+ db_dml param_value_insert_q {}
+ }
+
+ }
+
+}
+
+ad_proc -public as::assessment::check::re_order_actions {
+ {-check_id}
+ {-action_perform}
+ {-section_id}
+} {
+
+} {
+ set order_by [db_string get_order_by {}]
+ set count 0
+ db_foreach next_order {} {
+ set order [expr $order_by+$count]
+ db_dml update_order {}
+ incr count
+ }
+
+}
+
+ad_proc -public as::assessment::check::get_sql {
+ {-item_id}
+ {-condition}
+} {
+
+} {
+ set check_sql "select (case when idc.choice_id=$condition then \'1\' else \'0\' end) as perform_p from as_item_data id, as_item_data_choices idc where id.as_item_id=$item_id and id.item_data_id=idc.item_data_id and id.session_id=:session_id"
+
+ return $check_sql
+}
+
+
+ad_proc -public as::assessment::check::swap_actions {
+ {-check_id}
+ {-action_perform}
+ {-section_id}
+ {-direction}
+ {-order_by}
+} {
+
+} {
+ if { $direction == "d"} {
+ set order [expr $order_by + 1]
+ set swap_check_id [db_string get_swap_check {}]
+ db_dml update_1 {}
+ db_dml update_2 {}
+ } else {
+ set order [expr $order_by - 1]
+ set swap_check_id [db_string get_swap_check_e {}]
+ db_dml update_1_e {}
+ db_dml update_2_e {}
+
+ }
+
+}
+ad_proc -public as::assessment::check::action_log {
+ {-session_id}
+ {-check_id}
+ {-failed }
+} {
+
+} {
+
+ db_transaction {
+ set user_id [ad_conn user_id]
+ set log_id [db_string get_next_val {}]
+ set action_id [db_string action_id {}]
+ db_dml insert_action {}
+ }
+}
+
+ad_proc -public as::assessment::check::manual_action_log {
+ {-session_id}
+ {-check_id}
+
+} {
+
+} {
+
+ db_transaction {
+ set user_id [ad_conn user_id]
+ set log_id [db_string get_next_val {}]
+ set action_id [db_string action_id {}]
+ db_dml insert_action {}
+ }
+}
+
+
+ad_proc -public as::assessment::check::action_exec {
+ {-inter_item_check_id}
+ {-session_id}
+} {
+
+} {
+ db_foreach get_check_params { } {
+ set parameter_name [db_1row select_name {}]
+
+ set $varname ""
+
+ if {$value == ""} {
+ set choice [db_0or1row get_item_choice {}]
+ set answer [db_0or1row get_answer {}]
+ if {[exists_and_not_null choice_id]} {
+ set $varname "$choice_id"
+ } else {
+ append $varname $boolean_answer
+ append $varname $numeric_answer
+ append $varname $integer_answer
+ append $varname $text_answer
+ append $varname $clob_answer
+ append $varname $content_answer
+ }
+ } else {
+ set $varname $value
+ }
+ ns_log notice "--------------------------parameter $varname [set $varname]"
+
+ }
+
+ set tcl_code_p [db_1row select_tcl {}]
+ set failed_p "t"
+ set failed [catch $tcl_code]
+ ns_log notice "--------------------------TCL $tcl_code"
+ if { $failed > 0 } {
+ set failed_p "f"
+ }
+ as::assessment::check::action_log -session_id $session_id -check_id $inter_item_check_id -failed $failed_p
+}
+
+
+ad_proc -public as::assessment::check::manual_action_exec {
+ {-inter_item_check_id}
+ {-session_id}
+ {-action_log_id}
+} {
+
+} {
+ db_foreach get_check_params {} {
+ set parameter_name [db_1row select_name {}]
+
+ set $varname ""
+
+ if {$value == " "} {
+ set $varname [db_string get_item_choice {}]
+
+ } else {
+ set $varname $value
+ }
+ }
+
+ set tcl_code [db_1row select_tcl {}]
+ set failed_p [catch {eval $tcl_code}]
+
+ set user_id [ad_conn user_id]
+ db_dml update_actions_log {}
+
+}
+
+
+
+ad_proc -public as::assessment::check::eval_i_checks {
+ {-session_id}
+ {-section_id}
+} {
+
+} {
+
+ db_foreach section_checks {} {
+ set perform [db_string check_sql $check_sql]
+ if {$action_p == "t"} {
+ if {$perform == 1} {
+ as::assessment::check::action_exec -inter_item_check_id $inter_item_check_id -session_id $session_id
+ }
+ }
+ }
+}
+
+
+ad_proc -public as::assessment::check::branch_checks {
+ {-session_id}
+ {-section_id}
+ {-assessment_id}
+} {
+
+} {
+ set order "f"
+
+ db_foreach section_checks {} {
+ set new_assessment_revision [db_string get_assessment_id {select max(revision_id) from cr_revisions where item_id=:assessment_id}]
+
+ set perform [db_string check_sql $check_sql]
+ if {$perform == 1} {
+ set order [db_string get_order { }]
+ }
+
+ }
+ if {$order == "f"} {
+ return $order
+ } {
+ return [expr $order -1]
+ }
+}
+
+
+
+
+ad_proc -public as::assessment::check::eval_aa_checks {
+ {-session_id}
+ {-assessment_id}
+} {
+
+} {
+
+ set assessment_rev_id [db_string get_assessment_id {}]
+
+ set section_list [db_list_of_lists sections {}]
+ foreach section_id $section_list {
+ set checks [db_list_of_lists section_checks {}]
+ foreach check $checks {
+ set info [db_0or1row check_info {}]
+ set perform [db_string check_sql $check_sql]
+ if {$action_p == "t"} {
+ if {$perform == 1} {
+ as::assessment::check::action_exec -inter_item_check_id $inter_item_check_id -session_id $session_id
+ }
+ }
+ }
+ }
+}
+
+
+ad_proc -public as::assessment::check::eval_m_checks {
+ {-session_id}
+ {-assessment_id}
+} {
+
+} {
+
+ set assessment_rev_id [db_string get_assessment_id {}]
+
+ db_foreach sections {} {
+ db_foreach section_checks {} {
+ set perform [db_string check_sql $check_sql]
+ if {$action_p == "t"} {
+ if {$perform == 1} {
+ set failed ""
+ as::assessment::check::manual_action_log -check_id $inter_item_check_id -session_id $session_id
+ }
+ }
+ }
+ }
+
+}
+
+ad_proc -public as::assessment::check::confirm_display {
+ {-check_id}
+ {-index}
+} {
+
+} {
+ set show_check_info ""
+ set mod ""
+
+ set info [db_0or1row get_check_info {}]
+
+
+ set mod [expr $index%2]
+
+ if {$mod==0} {
+ set class "odd"
+ } else {
+ set class "even"
+ }
+
+ set action ""
+
+ if { $action_p=="t"} {
+ set info [db_0or1row get_check_info_a {}]
+
+ db_foreach parameters {} {
+ append parameter_list "
$varname: "
+ if {$type == "q"} {
+ append parameter_list "$value"
+ } else {
+ append parameter_list "$item_id"
+ }
+ }
+
+ set action "$name | $action_name | |
"
+ } else {
+ set section_name_to [db_string get_section_name {} ]
+ set action "$name | $section_name_to |
"
+ }
+
+
+ set display_info $action
+ return $display_info
+}
Index: openacs-4/packages/assessment/tcl/as-checks-procs.tcl~
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/assessment/tcl/Attic/as-checks-procs.tcl~,v
diff -u
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ openacs-4/packages/assessment/tcl/as-checks-procs.tcl~ 24 Jan 2005 17:59:52 -0000 1.1
@@ -0,0 +1,406 @@
+ad_library {
+ Assessment Checks procs
+ @author Anny Flores (annyflores@viaro.net) Viaro Networks (www.viaro.net)
+ @creation-date 2005-01-13
+}
+
+namespace eval as::assessment::check {}
+
+ad_proc -public as::assessment::check::get_types {
+} {
+ Return the checks types
+} {
+ set types [list [list "Action" "t"] [list "Branch" "f"]]
+ return $types
+}
+
+ad_proc -public as::assessment::check::get_assessments {
+} {
+
+} {
+ set package_id [ad_conn package_id]
+ set assessment_list [list [list "All" "all"]]
+ db_foreach assessment {} {
+ lappend assessment_list [list $title $assessment_id]
+ }
+
+ return $assessment_list
+}
+
+ad_proc -public as::assessment::check::state_options {
+} {
+
+} {
+ set approved_options [list {"Approved" "t"} {"Approved with errors" "ae"} {"Not Approved" "f"} ]
+ return $approved_options
+}
+
+ad_proc -public as::assessment::check::intervals {
+} {
+ Return the time intervals
+} {
+
+ set today [db_string today {}]
+ set yesterday [db_string yesterday {}]
+ set two_days [db_string two_days {}]
+ set last_week [db_string last_week {}]
+ set last_month [db_string last_month {}]
+
+ set intervals [list [list "All" "all"] [list "Today" $today] [list "Yesterday" $yesterday] [list "Two days ago" $two_days] [list "Last Week" $last_week] [list "Last Month" $last_month]]
+
+}
+
+ad_proc -public as::assessment::check::add_check_return_url {
+ {action_p}
+} {
+ Return the url
+} {
+ if { $action_p == "t"} {
+ return "action-select"
+ } else {
+ return "section-select"
+ }
+}
+
+ad_proc -public as::assessment::check::get_max_order {
+ {-action_perform}
+ {-section_id}
+} {
+ Return the next value for order_by
+} {
+ set order [db_string get_max_order {}]
+ if { $order == ""} {
+ set order 1
+ } else {
+ incr order
+ }
+ return $order
+}
+
+ad_proc -public as::assessment::check::get_parameter_value {
+ {-parameter_id}
+ {-type}
+ {-check_id}
+} {
+ Return the parameter_value
+} {
+ if { $type == "n"} {
+ return [db_string get_param_n {}]
+ } else {
+ return [db_string get_param_q {}]
+
+ }
+}
+
+
+ad_proc -public as::assessment::check::set_parameter_value {
+ {-parameter_id}
+ {-value}
+ {-check_id}
+ {-type}
+} {
+
+} {
+ if { $type == "n"} {
+ db_dml param_value_update_n {}
+ } else {
+ db_dml param_value_update_q {}
+ }
+
+}
+
+ad_proc -public as::assessment::check::re_order_actions {
+ {-check_id}
+ {-action_perform}
+ {-section_id}
+} {
+
+} {
+ set order_by [db_string get_order_by {}]
+ set count 0
+ db_foreach next_order {} {
+ set order [expr $order_by+$count]
+ db_dml update_order {}
+ incr count
+ }
+
+}
+
+ad_proc -public as::assessment::check::get_sql {
+ {-item_id}
+ {-condition}
+} {
+
+} {
+ set check_sql "select (case when idc.choice_id=$condition then \'1\' else \'0\' end) as perform_p from as_item_data id, as_item_data_choices idc where id.as_item_id=$item_id and id.item_data_id=idc.item_data_id and id.session_id=:session_id"
+
+ return $check_sql
+}
+
+
+ad_proc -public as::assessment::check::swap_actions {
+ {-check_id}
+ {-action_perform}
+ {-section_id}
+ {-direction}
+ {-order_by}
+} {
+
+} {
+ if { $direction == "d"} {
+ set order [expr $order_by + 1]
+ set swap_check_id [db_string get_swap_check {}]
+ db_dml update_1 {}
+ db_dml update_2 {}
+ } else {
+ set order [expr $order_by - 1]
+ set swap_check_id [db_string get_swap_check_e {}]
+ db_dml update_1_e {}
+ db_dml update_2_e {}
+
+ }
+
+}
+ad_proc -public as::assessment::check::action_log {
+ {-session_id}
+ {-check_id}
+ {-failed }
+} {
+
+} {
+
+ db_transaction {
+ set user_id [ad_conn user_id]
+ set log_id [db_string get_next_val {}]
+ set action_id [db_string action_id {}]
+ db_dml insert_action {}
+ }
+}
+
+ad_proc -public as::assessment::check::manual_action_log {
+ {-session_id}
+ {-check_id}
+
+} {
+
+} {
+
+ db_transaction {
+ set user_id [ad_conn user_id]
+ set log_id [db_string get_next_val {}]
+ set action_id [db_string action_id {}]
+ db_dml insert_action {}
+ }
+}
+
+
+ad_proc -public as::assessment::check::action_exec {
+ {-inter_item_check_id}
+ {-session_id}
+} {
+
+} {
+ db_foreach get_check_params { } {
+ set parameter_name [db_1row select_name {}]
+
+ set $varname ""
+
+ if {$value == ""} {
+ set choice [db_0or1row get_item_choice {}]
+ set answer [db_0or1row get_answer {}]
+ if {[exists_and_not_null choice_id]} {
+ set $varname "$choice_id"
+ } else {
+ append $varname $boolean_answer
+ append $varname $numeric_answer
+ append $varname $integer_answer
+ append $varname $text_answer
+ append $varname $clob_answer
+ append $varname $content_answer
+ }
+ } else {
+ set $varname $value
+ }
+ ns_log notice "--------------------------parameter $varname [set $varname]"
+
+ }
+
+ set tcl_code_p [db_1row select_tcl {}]
+ set failed_p "t"
+ set failed [catch $tcl_code]
+ ns_log notice "--------------------------TCL $tcl_code"
+ if { $failed > 0 } {
+ set failed_p "f"
+ }
+ as::assessment::check::action_log -session_id $session_id -check_id $inter_item_check_id -failed $failed_p
+}
+
+
+ad_proc -public as::assessment::check::manual_action_exec {
+ {-inter_item_check_id}
+ {-session_id}
+ {-action_log_id}
+} {
+
+} {
+ db_foreach get_check_params {} {
+ set parameter_name [db_1row select_name {}]
+
+ set $varname ""
+
+ if {$value == " "} {
+ set $varname [db_string get_item_choice {}]
+
+ } else {
+ set $varname $value
+ }
+ }
+
+ set tcl_code [db_1row select_tcl {}]
+ set failed_p [catch {eval $tcl_code}]
+
+ set user_id [ad_conn user_id]
+ db_dml update_actions_log {}
+
+}
+
+
+
+ad_proc -public as::assessment::check::eval_i_checks {
+ {-session_id}
+ {-section_id}
+} {
+
+} {
+
+ db_foreach section_checks {} {
+ set perform [db_string check_sql $check_sql]
+ if {$action_p == "t"} {
+ if {$perform == 1} {
+ as::assessment::check::action_exec -inter_item_check_id $inter_item_check_id -session_id $session_id
+ }
+ }
+ }
+}
+
+
+ad_proc -public as::assessment::check::branch_checks {
+ {-session_id}
+ {-section_id}
+ {-assessment_id}
+} {
+
+} {
+ set order "f"
+
+ db_foreach section_checks {} {
+ set new_assessment_revision [db_string get_assessment_id {select max(revision_id) from cr_revisions where item_id=:assessment_id}]
+
+ set perform [db_string check_sql $check_sql]
+ if {$perform == 1} {
+ set order [db_string get_order { }]
+ }
+
+ }
+ if {$order == "f"} {
+ return $order
+ } {
+ return [expr $order -1]
+ }
+}
+
+
+
+
+ad_proc -public as::assessment::check::eval_aa_checks {
+ {-session_id}
+ {-assessment_id}
+} {
+
+} {
+
+ set assessment_rev_id [db_string get_assessment_id {}]
+
+ set section_list [db_list_of_lists sections {}]
+ foreach section_id $section_list {
+ set checks [db_list_of_lists section_checks {}]
+ foreach check $checks {
+ set info [db_0or1row check_info {}]
+ set perform [db_string check_sql $check_sql]
+ if {$action_p == "t"} {
+ if {$perform == 1} {
+ as::assessment::check::action_exec -inter_item_check_id $inter_item_check_id -session_id $session_id
+ }
+ }
+ }
+ }
+}
+
+
+ad_proc -public as::assessment::check::eval_m_checks {
+ {-session_id}
+ {-assessment_id}
+} {
+
+} {
+
+ set assessment_rev_id [db_string get_assessment_id {}]
+
+ db_foreach sections {} {
+ db_foreach section_checks {} {
+ set perform [db_string check_sql $check_sql]
+ if {$action_p == "t"} {
+ if {$perform == 1} {
+ set failed ""
+ as::assessment::check::manual_action_log -check_id $inter_item_check_id -session_id $session_id
+ }
+ }
+ }
+ }
+
+}
+
+ad_proc -public as::assessment::check::confirm_display {
+ {-check_id}
+ {-index}
+} {
+
+} {
+ set show_check_info ""
+ set mod ""
+
+ set info [db_0or1row get_check_info {}]
+
+
+ set mod [expr $index%2]
+
+ if {$mod==0} {
+ set class "odd"
+ } else {
+ set class "even"
+ }
+
+ set action ""
+
+ if { $action_p=="t"} {
+ set info [db_0or1row get_check_info_a {}]
+
+ db_foreach parameters {} {
+ append parameter_list "$varname: "
+ if {$type == "q"} {
+ append parameter_list "$value"
+ } else {
+ append parameter_list "$item_id"
+ }
+ }
+
+ set action "$name | $action_name | |
"
+ } else {
+ set section_name_to [db_string get_section_name {} ]
+ set action "$name | $section_name_to |
"
+ }
+
+
+ set display_info $action
+ return $display_info
+}
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
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ openacs-4/packages/assessment/tcl/as-checks-procs.xql 24 Jan 2005 17:59:52 -0000 1.1
@@ -0,0 +1,305 @@
+
+
+
+
+
+ select cr.title ,ci.item_id as assessment_id from cr_folders cf, cr_items ci, cr_revisions cr, as_assessments a where cr.revision_id = ci.latest_revision and a.assessment_id = cr.revision_id and ci.parent_id = cf.folder_id and cf.package_id = :package_id order by cr.title
+
+
+
+
+
+
+ select to_date(now(),'YYYY-MM-DD')
+
+
+
+
+
+ select to_date (to_date(now(),'YYYY-MM-DD')-1,'YYYY-MM-DD')
+
+
+
+
+
+ select to_date (to_date(now(),'YYYY-MM-DD')-2,'YYYY-MM-DD')
+
+
+
+
+ select to_date (to_date(now(),'YYYY-MM-DD')-7,'YYYY-MM-DD')
+
+
+
+
+ select to_date (to_date(now(),'YYYY-MM-DD')-30,'YYYY-MM-DD')
+
+
+
+
+
+ select max(am.order_by) from as_action_map am,as_inter_item_checks c
+ where c.inter_item_check_id=am.inter_item_check_id and
+ c.section_id_from = :section_id and am.action_perform=:action_perform
+
+
+
+
+
+ select item_id from as_param_map where parameter_id=:parameter_id and inter_item_check_id=:check_id
+
+
+
+
+
+ select value from as_param_map where parameter_id=:parameter_id and inter_item_check_id=:check_id
+
+
+
+
+
+ update as_param_map set item_id=:value where parameter_id=:parameter_id and inter_item_check_id=:check_id
+
+
+
+
+
+ insert into as_param_map (parameter_id,inter_item_check_id,value,item_id) values (:parameter_id,:check_id,null,:value)
+
+
+
+
+
+
+ insert into as_param_map (parameter_id,inter_item_check_id,value,item_id) values (:parameter_id,:check_id,:value,null)
+
+
+
+
+
+
+ update as_param_map set value=:value where parameter_id=:parameter_id and inter_item_check_id=:check_id
+
+
+
+
+
+ select order_by from as_action_map where inter_item_check_id=:check_id
+
+
+
+
+
+ select c.inter_item_check_id from as_inter_item_checks c,as_action_map am where c.inter_item_check_id=am.inter_item_check_id and c.section_id_from = :section_id and am.action_perform=:action_perform and am.order_by > :order_by
+
+
+
+
+
+ update as_action_map set order_by=:order where inter_item_check_id=:inter_item_check_id
+
+
+
+
+
+
+ select c.inter_item_check_id from as_inter_item_checks c ,as_action_map am where c.inter_item_check_id=am.inter_item_check_id and am.order_by=:order and c.section_id_from=:section_id and am.action_perform=:action_perform
+
+
+
+
+
+ update as_action_map set order_by=:order where inter_item_check_id=:check_id
+
+
+
+
+
+ update as_action_map set order_by=:order_by where inter_item_check_id=:swap_check_id
+
+
+
+
+
+ select c.inter_item_check_id from as_inter_item_checks c,as_action_map am where c.inter_item_check_id=am.inter_item_check_id and am.order_by=:order and c.section_id_from=:section_id and am.action_perform=:action_perform
+
+
+
+
+ update as_action_map set order_by=:order where inter_item_check_id=:check_id
+
+
+
+
+
+ update as_action_map set order_by=:order_by where inter_item_check_id=:swap_check_id
+
+
+
+
+
+
+ select am.action_id from as_inter_item_checks c,as_action_map am where c.inter_item_check_id=am.inter_item_check_id and c.inter_item_check_id=:check_id
+
+
+
+
+
+ insert into as_actions_log (action_log_id,inter_item_check_id,action_id,date_requested,date_processed,approved_p,failed_p,finally_executed_by,session_id) values (:log_id,:check_id,:action_id,now(),now(),'t',:failed,:user_id,:session_id)
+
+
+
+
+
+
+ select am.action_id from as_inter_item_checks c,as_action_map am where c.inter_item_check_id=am.inter_item_check_id and c.inter_item_check_id=:check_id
+
+
+
+
+
+ insert into as_actions_log (action_log_id,inter_item_check_id,action_id,date_requested,date_processed,approved_p,failed_p,finally_executed_by,session_id) values (:log_id,:check_id,:action_id,now(),null,'f','f',null,:session_id)
+
+
+
+
+
+ select * from as_param_map where inter_item_check_id = :inter_item_check_id
+
+
+
+
+
+ select varname from as_action_params where parameter_id = :parameter_id
+
+
+
+
+ select item_data_id, boolean_answer, clob_answer, numeric_answer,
+ integer_answer, text_answer, timestamp_answer, content_answer
+ from as_item_data
+ where session_id = :session_id
+ and as_item_id = :item_id
+
+
+
+
+ select idc.choice_id from as_item_data_choices idc,as_item_data id where id.as_item_id=:item_id and id.item_data_id=idc.item_data_id and id.session_id=:session_id
+
+
+
+
+
+
+ select a.tcl_code from as_actions a,as_action_map am where am.action_id = a.action_id and am.inter_item_check_id = :inter_item_check_id
+
+
+
+
+
+ select * from as_param_map where inter_item_check_id = :inter_item_check_id
+
+
+
+
+
+ select varname from as_action_params where parameter_id = :parameter_id
+
+
+
+
+
+ select idc.choice_id from as_item_data_choices idc,as_item_data id where id.as_item_id=:item_id and id.item_data_id=idc.item_data_id and id.session_id=:session_id
+
+
+
+
+
+ select a.tcl_code from as_actions a,as_action_map am where am.action_id = a.action_id and inter_item_check_id = :inter_item_check_id
+
+
+
+
+
+ update as_actions_log set failed_p=:failed_p,date_processed=now(),finally_executed_by=:user_id,approved_p='t' where action_log_id=:action_log_id
+
+
+
+
+
+ select * from as_inter_item_checks c,as_action_map am where c.inter_item_check_id=am.inter_item_check_id and am.action_perform='i' and section_id_from=:section_id order by am.order_by
+
+
+
+
+
+ select * from as_inter_item_checks where action_p = 'f' and section_id_from=:section_id
+
+
+
+
+ select sort_order from as_assessment_section_map where section_id=:section_id_to and assessment_id=:new_assessment_revision
+
+
+
+
+ select max(revision_id) from cr_revisions where item_id=:assessment_id
+
+
+
+
+ select s.section_id from as_sections s, cr_revisions cr, cr_items ci, as_assessment_section_map asm where ci.item_id = cr.item_id and cr.revision_id = s.section_id and s.section_id = asm.section_id and asm.assessment_id =:assessment_rev_id order by asm.sort_order
+
+
+
+
+ select c.inter_item_check_id as check from as_inter_item_checks c,as_action_map am where c.inter_item_check_id=am.inter_item_check_id and am.action_perform='aa' and section_id_from=:section_id order by am.order_by
+
+
+
+
+ select * from as_inter_item_checks c,as_action_map am where
+ c.inter_item_check_id=am.inter_item_check_id and am.action_perform='aa'
+ and section_id_from=:section_id and c.inter_item_check_id=:check order by am.order_by
+
+
+
+
+
+
+ select max(revision_id) from cr_revisions where item_id=:assessment_id
+
+
+
+
+ select s.section_id from as_sections s, cr_revisions cr, cr_items ci, as_assessment_section_map asm where ci.item_id = cr.item_id and cr.revision_id = s.section_id and s.section_id = asm.section_id and asm.assessment_id =:assessment_rev_id order by asm.sort_order
+
+
+
+
+ select * from as_inter_item_checks c,as_action_map am where c.inter_item_check_id=am.inter_item_check_id and am.action_perform='m' and section_id_from=:section_id order by am.order_by
+
+
+
+
+ select * from as_inter_item_checks where inter_item_check_id=:check_id
+
+
+
+
+ select a.name as action_name from as_actions a, as_action_map am where inter_item_check_id=:check_id and a.action_id=am.action_id
+
+
+
+
+ select * from as_param_map pm,as_action_params p where pm.parameter_id=p.parameter_id and pm.inter_item_check_id=:check_id
+
+
+
+
+ select cr.title from cr_revisions cr,as_sections s where cr.revision_id=s.section_id and s.section_id=:section_id_to
+
+
+
+
+
Index: openacs-4/packages/assessment/tcl/as-checks-procs.xql~
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/assessment/tcl/Attic/as-checks-procs.xql~,v
diff -u
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ openacs-4/packages/assessment/tcl/as-checks-procs.xql~ 24 Jan 2005 17:59:52 -0000 1.1
@@ -0,0 +1,292 @@
+
+
+
+
+
+ select cr.title ,ci.item_id as assessment_id from cr_folders cf, cr_items ci, cr_revisions cr, as_assessments a where cr.revision_id = ci.latest_revision and a.assessment_id = cr.revision_id and ci.parent_id = cf.folder_id and cf.package_id = :package_id order by cr.title
+
+
+
+
+
+
+ select to_date(now(),'YYYY-MM-DD')
+
+
+
+
+
+ select to_date (to_date(now(),'YYYY-MM-DD')-1,'YYYY-MM-DD')
+
+
+
+
+
+ select to_date (to_date(now(),'YYYY-MM-DD')-2,'YYYY-MM-DD')
+
+
+
+
+ select to_date (to_date(now(),'YYYY-MM-DD')-7,'YYYY-MM-DD')
+
+
+
+
+ select to_date (to_date(now(),'YYYY-MM-DD')-30,'YYYY-MM-DD')
+
+
+
+
+
+ select max(am.order_by) from as_action_map am,as_inter_item_checks c
+ where c.inter_item_check_id=am.inter_item_check_id and
+ c.section_id_from = :section_id and am.action_perform=:action_perform
+
+
+
+
+
+ select item_id from as_param_map where parameter_id=:parameter_id and inter_item_check_id=:check_id
+
+
+
+
+
+ select value from as_param_map where parameter_id=:parameter_id and inter_item_check_id=:check_id
+
+
+
+
+
+ update as_param_map set item_id=:value where parameter_id=:parameter_id and inter_item_check_id=:check_id
+
+
+
+
+
+
+ update as_param_map set value=:value where parameter_id=:parameter_id and inter_item_check_id=:check_id
+
+
+
+
+
+ select order_by from as_action_map where inter_item_check_id=:check_id
+
+
+
+
+
+ select c.inter_item_check_id from as_inter_item_checks c,as_action_map am where c.inter_item_check_id=am.inter_item_check_id and c.section_id_from = :section_id and am.action_perform=:action_perform and am.order_by > :order_by
+
+
+
+
+
+ update as_action_map set order_by=:order where inter_item_check_id=:inter_item_check_id
+
+
+
+
+
+
+ select c.inter_item_check_id from as_inter_item_checks c ,as_action_map am where c.inter_item_check_id=am.inter_item_check_id and am.order_by=:order and c.section_id_from=:section_id and am.action_perform=:action_perform
+
+
+
+
+
+ update as_action_map set order_by=:order where inter_item_check_id=:check_id
+
+
+
+
+
+ update as_action_map set order_by=:order_by where inter_item_check_id=:swap_check_id
+
+
+
+
+
+ select c.inter_item_check_id from as_inter_item_checks c,as_action_map am where c.inter_item_check_id=am.inter_item_check_id and am.order_by=:order and c.section_id_from=:section_id and am.action_perform=:action_perform
+
+
+
+
+ update as_action_map set order_by=:order where inter_item_check_id=:check_id
+
+
+
+
+
+ update as_action_map set order_by=:order_by where inter_item_check_id=:swap_check_id
+
+
+
+
+
+
+ select am.action_id from as_inter_item_checks c,as_action_map am where c.inter_item_check_id=am.inter_item_check_id and c.inter_item_check_id=:check_id
+
+
+
+
+
+ insert into as_actions_log (action_log_id,inter_item_check_id,action_id,date_requested,date_processed,approved_p,failed_p,finally_executed_by,session_id) values (:log_id,:check_id,:action_id,now(),now(),'t',:failed,:user_id,:session_id)
+
+
+
+
+
+
+ select am.action_id from as_inter_item_checks c,as_action_map am where c.inter_item_check_id=am.inter_item_check_id and c.inter_item_check_id=:check_id
+
+
+
+
+
+ insert into as_actions_log (action_log_id,inter_item_check_id,action_id,date_requested,date_processed,approved_p,failed_p,finally_executed_by,session_id) values (:log_id,:check_id,:action_id,now(),null,'f','f',null,:session_id)
+
+
+
+
+
+ select * from as_param_map where inter_item_check_id = :inter_item_check_id
+
+
+
+
+
+ select varname from as_action_params where parameter_id = :parameter_id
+
+
+
+
+ select item_data_id, boolean_answer, clob_answer, numeric_answer,
+ integer_answer, text_answer, timestamp_answer, content_answer
+ from as_item_data
+ where session_id = :session_id
+ and as_item_id = :item_id
+
+
+
+
+ select idc.choice_id from as_item_data_choices idc,as_item_data id where id.as_item_id=:item_id and id.item_data_id=idc.item_data_id and id.session_id=:session_id
+
+
+
+
+
+
+ select a.tcl_code from as_actions a,as_action_map am where am.action_id = a.action_id and am.inter_item_check_id = :inter_item_check_id
+
+
+
+
+
+ select * from as_param_map where inter_item_check_id = :inter_item_check_id
+
+
+
+
+
+ select varname from as_action_params where parameter_id = :parameter_id
+
+
+
+
+
+ select idc.choice_id from as_item_data_choices idc,as_item_data id where id.as_item_id=:item_id and id.item_data_id=idc.item_data_id and id.session_id=:session_id
+
+
+
+
+
+ select a.tcl_code from as_actions a,as_action_map am where am.action_id = a.action_id and inter_item_check_id = :inter_item_check_id
+
+
+
+
+
+ update as_actions_log set failed_p=:failed_p,date_processed=now(),finally_executed_by=:user_id,approved_p='t' where action_log_id=:action_log_id
+
+
+
+
+
+ select * from as_inter_item_checks c,as_action_map am where c.inter_item_check_id=am.inter_item_check_id and am.action_perform='i' and section_id_from=:section_id order by am.order_by
+
+
+
+
+
+ select * from as_inter_item_checks where action_p = 'f' and section_id_from=:section_id
+
+
+
+
+ select sort_order from as_assessment_section_map where section_id=:section_id_to and assessment_id=:new_assessment_revision
+
+
+
+
+ select max(revision_id) from cr_revisions where item_id=:assessment_id
+
+
+
+
+ select s.section_id from as_sections s, cr_revisions cr, cr_items ci, as_assessment_section_map asm where ci.item_id = cr.item_id and cr.revision_id = s.section_id and s.section_id = asm.section_id and asm.assessment_id =:assessment_rev_id order by asm.sort_order
+
+
+
+
+ select c.inter_item_check_id as check from as_inter_item_checks c,as_action_map am where c.inter_item_check_id=am.inter_item_check_id and am.action_perform='aa' and section_id_from=:section_id order by am.order_by
+
+
+
+
+ select * from as_inter_item_checks c,as_action_map am where
+ c.inter_item_check_id=am.inter_item_check_id and am.action_perform='aa'
+ and section_id_from=:section_id and c.inter_item_check_id=:check order by am.order_by
+
+
+
+
+
+
+ select max(revision_id) from cr_revisions where item_id=:assessment_id
+
+
+
+
+ select s.section_id from as_sections s, cr_revisions cr, cr_items ci, as_assessment_section_map asm where ci.item_id = cr.item_id and cr.revision_id = s.section_id and s.section_id = asm.section_id and asm.assessment_id =:assessment_rev_id order by asm.sort_order
+
+
+
+
+ select * from as_inter_item_checks c,as_action_map am where c.inter_item_check_id=am.inter_item_check_id and am.action_perform='m' and section_id_from=:section_id order by am.order_by
+
+
+
+
+ select * from as_inter_item_checks where inter_item_check_id=:check_id
+
+
+
+
+ select a.name as action_name from as_actions a, as_action_map am where inter_item_check_id=:check_id and a.action_id=am.action_id
+
+
+
+
+ select * from as_param_map pm,as_action_params p where pm.parameter_id=p.parameter_id and pm.inter_item_check_id=:check_id
+
+
+
+
+ select cr.title from cr_revisions cr,as_sections s where cr.revision_id=s.section_id and s.section_id=:section_id_to
+
+
+
+
+
Index: openacs-4/packages/assessment/tcl/as-pram-procs.tcl
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/assessment/tcl/as-pram-procs.tcl,v
diff -u
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ openacs-4/packages/assessment/tcl/as-pram-procs.tcl 24 Jan 2005 17:59:52 -0000 1.1
@@ -0,0 +1,41 @@
+ad_library {
+ Assessment Checks procs
+ @author Vivian Aguilar (vivian@viaro.net) Viaro Networks (www.viaro.net)
+ @creation-date 2005-01-13
+}
+
+namespace eval as::actionparam {}
+
+ad_proc -public as::actionparam::paramdelete {
+ {parameter_id}
+} {
+ Delete parameter if it doesnt have a value asociated
+} {
+
+ db_1row select_params ""
+
+ if { $maps == 0 } {
+ db_dml delete_param ""
+ } else {
+ ad_return_complaint 1 "You have information stored on the db related to this parameter"
+ }
+ return
+}
+
+
+ad_proc -public as::actionparam::actiondelete {
+ {action_id}
+} {
+ Delete action if it doesnt have a parameter asociated
+} {
+
+ db_1row select_actions ""
+
+ if { $maps == 0 } {
+ db_dml delete_action ""
+ db_dml delete_param ""
+ } else {
+ ad_return_complaint 1 "You have information stored on the db related to this action"
+ }
+ return
+}
Index: openacs-4/packages/assessment/tcl/as-pram-procs.tcl~
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/assessment/tcl/Attic/as-pram-procs.tcl~,v
diff -u
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ openacs-4/packages/assessment/tcl/as-pram-procs.tcl~ 24 Jan 2005 17:59:52 -0000 1.1
@@ -0,0 +1,41 @@
+ad_library {
+ Assessment Checks procs
+ @author Vivian Aguilar (vivian@viaro.net) Viaro Networks (www.viaro.net)
+ @creation-date 2005-01-13
+}
+
+namespace eval as::actionparam {}
+
+ad_proc -public as::actionparam::paramdelete {
+ {parameter_id}
+} {
+ Delete parameter if it doesnt have a value asociated
+} {
+
+ db_1row select_params "select count(inter_item_check_id) as maps from as_param_map where parameter_id=:parameter_id"
+
+ if { $maps == 0 } {
+ db_dml delete_param "delete from as_action_params where parameter_id =:parameter_id "
+ } else {
+ ad_return_complaint 1 "You have information stored on the db related to this parameter"
+ }
+ return
+}
+
+
+ad_proc -public as::actionparam::actiondelete {
+ {action_id}
+} {
+ Delete action if it doesnt have a parameter asociated
+} {
+
+ db_1row select_actions "select count(inter_item_check_id) as maps from as_action_map where action_id=:action_id"
+
+ if { $maps == 0 } {
+ db_dml delete_action "delete from as_actions where action_id =:action_id "
+ db_dml delete_param "delete from as_action_params where action_id =:action_id "
+ } else {
+ ad_return_complaint 1 "You have information stored on the db related to this action"
+ }
+ return
+}
Index: openacs-4/packages/assessment/tcl/as-pram-procs.xql
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/assessment/tcl/as-pram-procs.xql,v
diff -u
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ openacs-4/packages/assessment/tcl/as-pram-procs.xql 24 Jan 2005 17:59:52 -0000 1.1
@@ -0,0 +1,37 @@
+
+
+
+
+ select count(inter_item_check_id) as maps from as_param_map where parameter_id=:parameter_id
+
+
+
+
+
+
+ delete from as_action_params where parameter_id =:parameter_id
+
+
+
+
+
+
+ select count(inter_item_check_id) as maps from as_action_map where action_id=:action_id
+
+
+
+
+
+ delete from as_actions where action_id =:action_id
+
+
+
+
+
+
+ delete from as_action_params where action_id =:action_id
+
+
+
+
+
Index: openacs-4/packages/assessment/tcl/as-pram-procs.xql~
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/assessment/tcl/Attic/as-pram-procs.xql~,v
diff -u
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ openacs-4/packages/assessment/tcl/as-pram-procs.xql~ 24 Jan 2005 17:59:52 -0000 1.1
@@ -0,0 +1,36 @@
+
+
+
+
+ select count(inter_item_check_id) as maps from as_param_map where parameter_id=:parameter_id
+
+
+
+
+
+
+ delete from as_action_params where parameter_id =:parameter_id
+
+
+
+
+
+
+ select count(inter_item_check_id) as maps from as_action_map where action_id=:action_id
+
+
+
+
+
+ delete from as_actions where action_id =:action_id
+
+
+
+
+
+
+ delete from as_action_params where action_id =:action_id
+
+
+
+