Index: openacs-4/packages/assessment/www/asm-admin/action-params.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/assessment/www/asm-admin/action-params.tcl,v diff -u -r1.1 -r1.2 --- openacs-4/packages/assessment/www/asm-admin/action-params.tcl 1 Feb 2005 22:00:10 -0000 1.1 +++ openacs-4/packages/assessment/www/asm-admin/action-params.tcl 2 Feb 2005 16:54:12 -0000 1.2 @@ -11,6 +11,8 @@ action_id:integer check_id:optional edit_check:optional + item_id:optional + by_item_p:optional } permission::require_permission -object_id $assessment_id -privilege admin @@ -20,13 +22,24 @@ ad_return_complaint 1 "[_ assessment.Requested_assess_does]" ad_script_abort } + +set return_url "one-a?assessment_id=$assessment_id" set title $assessment_data(title) set context_bar [ad_context_bar [list "one-a?assessment_id=$assessment_id" $title] "[_ assessment.action_params]" ] -set new_assessment_revision [db_string get_assessment_id {select max(revision_id) from cr_revisions where item_id=:assessment_id}] - -set new_section_revision [db_string get_section_id {select max(revision_id) from cr_revisions where item_id=:section_id}] +set new_assessment_revision $assessment_data(assessment_rev_id) +if {[exists_and_not_null by_item_p]} { + set return_url "checks-admin?assessment_id=$assessment_id§ion_id=$section_id" + + if {$by_item_p == 1} { + append return_url "&by_item_p=$by_item_p&item_id=$item_id" + } else { + append return_url "&by_item_p=$by_item_p" + } +} + + set has_params_p [db_string has_params {} -default 0] if {$has_params_p == 0} { @@ -36,7 +49,7 @@ set action_perform [db_string get_perform {} -default " "] set title "[_ assessment.action_params]" -ad_form -name get_params -export { assessment_id section_id action_perform} -form { +ad_form -name get_params -export { assessment_id section_id action_perform by_item_p item_id} -form { check_id:key {inter_item_check_id:text(hidden) @@ -91,6 +104,6 @@ } } -on_submit { - ad_returnredirect "one-a?assessment_id=$assessment_id" + ad_returnredirect $return_url } Index: openacs-4/packages/assessment/www/asm-admin/action-select.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/assessment/www/asm-admin/action-select.tcl,v diff -u -r1.1 -r1.2 --- openacs-4/packages/assessment/www/asm-admin/action-select.tcl 1 Feb 2005 22:00:10 -0000 1.1 +++ openacs-4/packages/assessment/www/asm-admin/action-select.tcl 2 Feb 2005 16:54:12 -0000 1.2 @@ -10,6 +10,8 @@ section_id:integer check_id:optional edit_check:optional + by_item_p:optional + item_id:optional } permission::require_permission -object_id $assessment_id -privilege admin @@ -31,8 +33,17 @@ if {[info exists edit_check]} { set return_url "&check_id=$check_id&edit_check=t" -} -ad_form -name get_action -export {edit_p action_perform_value action_value return_url} -form { +} +if {[info exists by_item_p]} { + if { $by_item_p == 1} { + append return_url "&by_item_p=$by_item_p&item_id=$item_id" + } else { + append return_url "&by_item_p=$by_item_p" + } +} + + +ad_form -name get_action -export {edit_p action_perform_value action_value return_url by_item_p item_id} -form { check_id:key {inter_item_check_id:text(hidden) {value $inter_item_check_id}} Index: openacs-4/packages/assessment/www/asm-admin/add-edit-check.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/assessment/www/asm-admin/add-edit-check.tcl,v diff -u -r1.1 -r1.2 --- openacs-4/packages/assessment/www/asm-admin/add-edit-check.tcl 1 Feb 2005 22:00:10 -0000 1.1 +++ openacs-4/packages/assessment/www/asm-admin/add-edit-check.tcl 2 Feb 2005 16:54:12 -0000 1.2 @@ -11,6 +11,8 @@ inter_item_check_id:optional edit_check:optional type:optional + by_item_p:optional + item_id:optional } permission::require_permission -object_id $assessment_id -privilege admin @@ -51,8 +53,15 @@ if { ![exists_and_not_null type]} { set return_url "&check_id=$inter_item_check_id&edit_check=t" } - + } +if {[exists_and_not_null by_item_p]} { + if {$by_item_p==1} { + append return_url "&item_id=$item_id&by_item_p=$by_item_p" + } else { + append return_url "&by_item_p=$by_item_p" + } +} ad_form -name new_check -export {assessment_id return_url} -form { inter_item_check_id:key @@ -110,6 +119,8 @@ set check_sql [as::assessment::check::get_sql -condition $condition -item_id $item_id] db_dml update_check {} } -after_submit { + + set url [as::assessment::check::add_check_return_url $action_p] ad_returnredirect "${url}?assessment_id=$assessment_id&inter_item_check_id=$inter_item_check_id§ion_id=$section_id_from$return_url" Index: openacs-4/packages/assessment/www/asm-admin/checks-admin.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/assessment/www/asm-admin/checks-admin.tcl,v diff -u -r1.1 -r1.2 --- openacs-4/packages/assessment/www/asm-admin/checks-admin.tcl 1 Feb 2005 22:00:10 -0000 1.1 +++ openacs-4/packages/assessment/www/asm-admin/checks-admin.tcl 2 Feb 2005 16:54:12 -0000 1.2 @@ -7,13 +7,43 @@ } { assessment_id:integer section_id + item_id:optional + } permission::require_permission -object_id $assessment_id -privilege admin as::assessment::data -assessment_id $assessment_id set new_assessment_revision $assessment_data(assessment_rev_id) +set check_list "" +set show_p 1 +set by_item_p 0 +set item_p "" +if {[exists_and_not_null item_id]} { + set show_p 0 + set by_item_p 1 + set item_p "&item_id=$item_id" + set check_list "and c.inter_item_check_id in (" + set checks [db_list_of_lists get_all_checks { }] + + foreach check $checks { + set cond_list [split [lindex $check 1] "="] + set as_item_id [lindex [split [lindex $cond_list 2] " "] 0] + if { $item_id == $as_item_id} { + append check_list "[lindex $check 0]," + } + + } + set check_list [string range $check_list 0 [expr [string length $check_list] -2]] + append check_list ")" +} +db_multirow aa_checks get_aa_checks {} +db_multirow i_checks get_i_checks {} +db_multirow branches get_branches {} +db_multirow m_checks get_m_checks {} + + if {![info exists assessment_data(assessment_id)]} { ad_return_complaint 1 "[_ assessment.Requested_assess_does]" ad_script_abort @@ -22,8 +52,8 @@ set title "$assessment_data(title)" set context_bar [ad_context_bar [list "one-a?assessment_id=$assessment_id" $title] "$title [_ assessment.Administration]"] -db_multirow aa_checks get_aa_checks {} + template::list::create \ -name aa_checks \ -multirow aa_checks \ @@ -43,20 +73,22 @@ name { label "[_ assessment.Name]" display_template { - @aa_checks.name@ + @aa_checks.name@ } } action_name { label "[_ assessment.action_to_perform]" } counter { display_template { + #assessment.Move_Down# #assessment.Move_Up# + #assessment.notify_user# } @@ -65,7 +97,7 @@ } -db_multirow i_checks get_i_checks {} + template::list::create \ -name i_checks \ -multirow i_checks \ @@ -85,28 +117,30 @@ name { label "[_ assessment.Name]" display_template { - @i_checks.name@ + @i_checks.name@ } } action_name { label "[_ assessment.action_to_perform]" } inter_item_check_id { - display_template { + display_template { + #assessment.Move_Down# #assessment.Move_Up# + #assessment.notify_user# } } } -db_multirow m_checks get_m_checks {} + template::list::create \ -name m_checks \ -multirow m_checks \ @@ -126,7 +160,7 @@ name { label "[_ assessment.Name]" display_template { - @m_checks.name@ + @m_checks.name@ } } action_name { @@ -139,7 +173,7 @@ } } -db_multirow branches get_branches {} + template::list::create \ -name branches \ -multirow branches \ @@ -159,7 +193,7 @@ name { label "[_ assessment.Name]" display_template { - @branches.name@ + @branches.name@ } } section_id_to { Index: openacs-4/packages/assessment/www/asm-admin/checks-admin.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/assessment/www/asm-admin/checks-admin.xql,v diff -u -r1.1 -r1.2 --- openacs-4/packages/assessment/www/asm-admin/checks-admin.xql 1 Feb 2005 22:00:10 -0000 1.1 +++ openacs-4/packages/assessment/www/asm-admin/checks-admin.xql 2 Feb 2005 16:54:12 -0000 1.2 @@ -3,36 +3,44 @@ - select am.action_perform,c.inter_item_check_id,c.name,a.name as action_name, am.order_by,c.section_id_from from as_inter_item_checks c,as_actions a, as_action_map am where am.inter_item_check_id = c.inter_item_check_id and am.action_id=a.action_id and c.section_id_from =:section_id and am.action_perform = 'aa' and c.action_p = 't'and c.assessment_id=:assessment_id order by order_by + select c.check_sql,am.action_perform,c.inter_item_check_id,c.name,a.name as action_name, am.order_by,c.section_id_from from as_inter_item_checks c,as_actions a, as_action_map am where am.inter_item_check_id = c.inter_item_check_id and am.action_id=a.action_id and c.section_id_from =:section_id and am.action_perform = 'aa' and c.action_p = 't'and c.assessment_id=:assessment_id $check_list order by order_by - select am.action_perform,am.order_by, c.inter_item_check_id,c.name,a.name as action_name,c.section_id_from from + select c.check_sql,am.action_perform,am.order_by, c.inter_item_check_id,c.name,a.name as action_name,c.section_id_from from as_inter_item_checks c,as_actions a, as_action_map am where am.inter_item_check_id = c.inter_item_check_id and am.action_id=a.action_id and c.section_id_from =:section_id and am.action_perform = 'i' and c.action_p - = 't' and c.assessment_id=:assessment_id order by order_by + = 't' and c.assessment_id=:assessment_id $check_list order by order_by - select am.action_perform,am.order_by, c.inter_item_check_id,c.name,a.name as action_name,c.section_id_from from + select c.check_sql,am.action_perform,am.order_by, c.inter_item_check_id,c.name,a.name as action_name,c.section_id_from from as_inter_item_checks c,as_actions a, as_action_map am where am.inter_item_check_id = c.inter_item_check_id and am.action_id=a.action_id and c.section_id_from =:section_id and am.action_perform = 'm' and c.action_p - = 't' and c.assessment_id=:assessment_id order by order_by + = 't' and c.assessment_id=:assessment_id $check_list order by order_by - select c.name,c.inter_item_check_id,c.section_id_to,(select cr.title from + select c.check_sql,c.name,c.inter_item_check_id,c.section_id_to,(select cr.title from cr_revisions cr where cr.revision_id=c.section_id_to) as sname from - as_inter_item_checks c where c.action_p='f' and c.section_id_from=:section_id and c.assessment_id=:assessment_id + as_inter_item_checks c where c.action_p='f' and c.section_id_from=:section_id and c.assessment_id=:assessment_id $check_list + + + select inter_item_check_id,check_sql from + as_inter_item_checks where assessment_id=:assessment_id and section_id_from=:section_id + + + + Index: openacs-4/packages/assessment/www/asm-admin/section-select.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/assessment/www/asm-admin/section-select.tcl,v diff -u -r1.1 -r1.2 --- openacs-4/packages/assessment/www/asm-admin/section-select.tcl 1 Feb 2005 22:00:10 -0000 1.1 +++ openacs-4/packages/assessment/www/asm-admin/section-select.tcl 2 Feb 2005 16:54:12 -0000 1.2 @@ -8,23 +8,38 @@ assessment_id:integer inter_item_check_id:integer section_id:integer + by_item_p:optional + item_id:optional } + permission::require_permission -object_id $assessment_id -privilege admin as::assessment::data -assessment_id $assessment_id + if {![info exists assessment_data(assessment_id)]} { ad_return_complaint 1 "[_ assessment.Requested_assess_does]" ad_script_abort } -set new_assessment_revision [db_string get_assessment_id {select max(revision_id) from cr_revisions where item_id=:assessment_id}] -set new_section_revision [db_string get_section_id {select max(revision_id) from cr_revisions where item_id=:section_id}] +set return_url "one-a?assessment_id=$assessment_id" + +if { [exists_and_not_null by_item_p] } { + if { $by_item_p == 1} { + set return_url "checks-admin?assessment_id=$assessment_id§ion_id=$section_id&item_id=$item_id" + } else { + set return_url "checks-admin?assessment_id=$assessment_id§ion_id=$section_id" + } +} + + + +set new_assessment_revision $assessment_data(assessment_rev_id) set sections_list [db_list_of_lists get_sections {}] set title $assessment_data(title) set context_bar [ad_context_bar [list "one-a?assessment_id=$assessment_id" $title] "$title Triggers"] set title "[_ assessment.section_select]" -ad_form -name get_section -form { +ad_form -name get_section -export {by_item_p item_id} -form { inter_item_check_id:key {assessment_id:text(hidden) {value $assessment_id}} @@ -44,8 +59,9 @@ } -edit_request { db_1row get_section {} } -edit_data { - db_dml update_check {} - + db_dml update_check {} + } -on_submit { - ad_returnredirect "one-a?assessment_id=$assessment_id" + ad_returnredirect $return_url + } \ No newline at end of file