Index: openacs-4/packages/assessment/www/asm-admin/assessment-delete.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/assessment/www/asm-admin/assessment-delete.tcl,v diff -u -r1.4 -r1.4.2.1 --- openacs-4/packages/assessment/www/asm-admin/assessment-delete.tcl 12 Jun 2006 02:49:51 -0000 1.4 +++ openacs-4/packages/assessment/www/asm-admin/assessment-delete.tcl 24 Jan 2007 21:56:03 -0000 1.4.2.1 @@ -36,7 +36,7 @@ -on_submit { if {$confirmation} { as::assessment::check::delete_assessment_checks -assessment_id $assessment_id - db_dml remove_assessment {} + as::assessment::delete -assessment_id $assessment_id } } -after_submit { if {$confirmation} { Index: openacs-4/packages/assessment/www/asm-admin/assessment-form.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/assessment/www/asm-admin/assessment-form.adp,v diff -u -r1.3.2.1 -r1.3.2.2 --- openacs-4/packages/assessment/www/asm-admin/assessment-form.adp 24 Jan 2007 20:15:30 -0000 1.3.2.1 +++ openacs-4/packages/assessment/www/asm-admin/assessment-form.adp 24 Jan 2007 21:56:03 -0000 1.3.2.2 @@ -118,42 +118,9 @@

-
- - - - - - - - - - - - - - - - - - - - -
- @formerror.run_mode;noquote@ -
-

- - - -

- -
#assessment.assessment_form_response_options# Index: openacs-4/packages/assessment/www/asm-admin/assessment-form.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/assessment/www/asm-admin/assessment-form.tcl,v diff -u -r1.12.2.1 -r1.12.2.2 --- openacs-4/packages/assessment/www/asm-admin/assessment-form.tcl 24 Jan 2007 20:15:30 -0000 1.12.2.1 +++ openacs-4/packages/assessment/www/asm-admin/assessment-form.tcl 24 Jan 2007 21:56:03 -0000 1.12.2.2 @@ -63,16 +63,10 @@ } if { $edit_p } { - ad_form -extend -name assessment_form -form {{instructions:text(textarea),optional {label "[_ assessment.Instructions]"} {html {rows 5 cols 80}} {help_text "[_ assessment.as_Instructions_help]"}}} + ad_form -extend -name assessment_form -form {{instructions:text(textarea),optional {label "[_ assessment.Instructions]"} {html {rows 5 cols 80}}}} - if { $type eq "test" } { - ad_form -extend -name assessment_form -form { - {run_mode:text,optional,nospell {label "[_ assessment.Mode]"} {html {size 25 maxlength 25}} {help_text "[_ assessment.as_Mode_help]"}} - } - } else { - ad_form -extend -name assessment_form -form { {run_mode:text(hidden) {value {}}} } - } + ad_form -extend -name assessment_form -form { {run_mode:text(hidden) {value {}}} } if { !$permission_p } { ad_form -extend -name assessment_form -form { Index: openacs-4/packages/assessment/www/asm-admin/item-add.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/assessment/www/asm-admin/item-add.tcl,v diff -u -r1.13.2.1 -r1.13.2.2 --- openacs-4/packages/assessment/www/asm-admin/item-add.tcl 24 Jan 2007 20:15:30 -0000 1.13.2.1 +++ openacs-4/packages/assessment/www/asm-admin/item-add.tcl 24 Jan 2007 21:56:03 -0000 1.13.2.2 @@ -108,12 +108,11 @@ ad_form -extend -name item-add -form { {ms_label:text,optional} - {add_another_choice:text(submit)} + {add_another_choice:text(submit) {label "[_ assessment.Add_another_choice]"}} } - if {[template::form::is_submission item-add] \ && [template::element::get_value item-add add_another_choice] \ - eq "add_another_choice"} { + eq [_ assessment.Add_another_choice]} { set num_choices [element::get_value item-add num_choices] incr num_choices element::set_value item-add num_choices $num_choices @@ -142,8 +141,8 @@ } ad_form -extend -name item-add -form { - {formbutton_ok:text(submit)} - {formbutton_add_another_question:text(submit)} + {formbutton_ok:text(submit) {label "[_ assessment.Save_and_finish]"}} + {formbutton_add_another_question:text(submit) {label "[_ assessment.Save_and_add_another_question]"}} } ad_form -extend -name item-add -validate { @@ -195,6 +194,8 @@ } } set question_text [template::util::richtext::get_property content $question_text] + set feedback_right [template::util::richtext::get_property content $feedback_right] + set feedback_wrong [template::util::richtext::get_property content $feedback_wrong] db_transaction { if {![db_0or1row item_exists {}]} { Index: openacs-4/packages/assessment/www/asm-admin/item-edit-general.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/assessment/www/asm-admin/item-edit-general.tcl,v diff -u -r1.15 -r1.15.2.1 --- openacs-4/packages/assessment/www/asm-admin/item-edit-general.tcl 28 Nov 2006 22:43:15 -0000 1.15 +++ openacs-4/packages/assessment/www/asm-admin/item-edit-general.tcl 24 Jan 2007 21:56:03 -0000 1.15.2.1 @@ -117,6 +117,8 @@ } } -edit_data { set question_text [template::util::richtext::get_property contents $question_text] + set feedback_right [template::util::richtext::get_property content $feedback_right] + set feedback_wrong [template::util::richtext::get_property content $feedback_wrong] db_transaction { set old_display_type [string range [db_string get_display_type {}] end-1 end] set new_item_id [as::item::edit \ Index: openacs-4/packages/assessment/www/asm-admin/item-stats.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/assessment/www/asm-admin/item-stats.tcl,v diff -u -r1.3 -r1.3.2.1 --- openacs-4/packages/assessment/www/asm-admin/item-stats.tcl 7 Dec 2006 05:01:18 -0000 1.3 +++ openacs-4/packages/assessment/www/asm-admin/item-stats.tcl 24 Jan 2007 21:56:03 -0000 1.3.2.1 @@ -9,29 +9,63 @@ @arch-tag: 5b26edbe-3bed-464a-b76c-3bf4d0b6ab3c @cvs-id $Id$ } { - assessment_id:integer,notnull + assessment_id:integer,optional + assessment_id_list:optional return_url:notnull + as_item_id:integer,notnull,optional + section_id:integer,optional + catalog_section_id:integer,optional + session_id_list:optional } -properties { } -validate { } -errors { } set package_id [ad_conn package_id] + +# HAM : +# if we get a dotlrn_ecommerce_section_id (catalog_section_id), +# let's create a clause to query all the rel_ids with type membership_rels +set limit_to_section_clause "" +if { [exists_and_not_null catalog_section_id] } { + set limit_to_section_clause "(select session_id from dotlrn_ecommerce_application_assessment_map where rel_id in (select rel_id from acs_rels where rel_type='dotlrn_member_rel' and object_id_one = (select community_id from dotlrn_ecommerce_section where section_id=:catalog_section_id)))" +} + + if {[info exists session_id_list]} { + set session_ids $session_id_list + set session_id_list [list] + foreach elm [split $session_id_list] { + if {$elm ne ""} { + lappend session_id_list $elm + } + } + } +#if {[info exists session_id_list]} { +# set session_id_list [split $session_id_list] +#} permission::require_permission -object_id $package_id -privilege create template::multirow create items item_id revision_id title data_type display_type stats - +if {[info exists assessment_id_list]} { + set assessment_id_list [db_list get_assessment_id_list "select distinct item_id from cr_revisions where revision_id in ([template::util::tcl_to_sql_list [split $assessment_id_list]])"] +} +if {![info exists assessment_id] && [info exists assessment_id_list] && [llength $assessment_id_list]} { + set assessment_id [lindex $assessment_id_list 0] +} else { + set assessment_id_list [list $assessment_id] +} +#ad_return_complaint 1 "'${assessment_id}' '${assessment_id_list}'" as::assessment::data -assessment_id $assessment_id -foreach section_id [db_list sections { - select s.section_id +foreach section_id [db_list sections " + select distinct s.section_id, asm.sort_order from as_sections s, cr_revisions cr, cr_items ci, as_assessment_section_map asm, cr_items ai 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 = ai.latest_revision - and ai.item_id = :assessment_id + and ai.item_id in ([template::util::tcl_to_sql_list $assessment_id_list]) order by asm.sort_order -}] { +"] { db_foreach items { select ci.item_id, cr.title, cr.revision_id, i.data_type @@ -61,35 +95,37 @@ set choices [list] set visited_session_ids [list] - db_foreach item_choices { - select r.title as choice_title, c.choice_id, c.correct_answer_p, - (select count(*) - from as_item_data_choices - where choice_id = c.choice_id - and item_data_id in (select item_data_id - from as_item_data d, as_sessions s - where d.session_id = s.session_id - and s.assessment_id = (select latest_revision - from cr_items - where item_id = :assessment_id))) as choice_responses + + set item_choices_limit_session "" + if { [exists_and_not_null limit_to_section_clause] } { set item_choices_limit_session "and d.session_id in $limit_to_section_clause" } +if {[exists_and_not_null session_id_list]} {set item_choices_limit_session " and d.session_id in ([template::util::tcl_to_sql_list $session_id_list]) " } + set item_choices_query "select r.title as choice_title, c.choice_id, c.correct_answer_p, + (select count(*) + from as_item_data_choices + where choice_id = c.choice_id + and item_data_id in (select item_data_id + from as_item_data d, as_sessions s + where d.session_id = s.session_id + $item_choices_limit_session + and s.assessment_id = (select latest_revision + from cr_items + where item_id = :assessment_id))) as choice_responses + + from cr_revisions r, as_item_choices c + left outer join cr_revisions r2 on (c.content_value = r2.revision_id) + where r.revision_id = c.choice_id + and c.mc_id = (select max(t.as_item_type_id) + from as_item_type_mc t, cr_revisions c, as_item_rels r + where t.as_item_type_id = r.target_rev_id + and r.item_rev_id = :revision_id + and r.rel_type = 'as_item_type_rel' + and c.revision_id = t.as_item_type_id + group by c.title, t.increasing_p, t.allow_negative_p, + t.num_correct_answers, t.num_answers) + order by c.sort_order" - from cr_revisions r, as_item_choices c - left outer join cr_revisions r2 on (c.content_value = r2.revision_id) - - where r.revision_id = c.choice_id - and c.mc_id = (select max(t.as_item_type_id) - from as_item_type_mc t, cr_revisions c, as_item_rels r - where t.as_item_type_id = r.target_rev_id - and r.item_rev_id = :revision_id - and r.rel_type = 'as_item_type_rel' - and c.revision_id = t.as_item_type_id - group by c.title, t.increasing_p, t.allow_negative_p, - t.num_correct_answers, t.num_answers) - - order by c.sort_order - } { + db_foreach item_choices $item_choices_query { incr total_choices - lappend choices [list choice_title $choice_title \ choice_responses $choice_responses \ correct_answer_p [template::util::is_true $correct_answer_p]] @@ -99,8 +135,15 @@ incr total_correct $choice_responses } } - set total_responses [db_string count_responses "select count(*) from (select distinct session_id from as_item_data, cr_revisions cr1, cr_revisions cr2 where cr1.revision_id=:revision_id and cr1.item_id=cr2.item_id and as_item_id = cr2.revision_id ) d"] + + set total_responses_limit_session "" + if { [exists_and_not_null limit_to_section_clause] } { set total_responses_limit_session "and session_id in $limit_to_section_clause" } +if {[exists_and_not_null session_id_list]} { + set total_responses_limit_session " and session_id in ([template::util::tcl_to_sql_list $session_id_list]) " +} + set total_responses [db_string count_responses "select count(*) from (select distinct session_id from as_item_data, cr_revisions cr1, cr_revisions cr2 where cr1.revision_id=:revision_id and cr1.item_id=cr2.item_id and as_item_id = cr2.revision_id $total_responses_limit_session ) d"] + if { $total_responses } { append stats "\n" set first_p 1 Index: openacs-4/packages/assessment/www/asm-admin/one-a.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/assessment/www/asm-admin/one-a.tcl,v diff -u -r1.11.2.1 -r1.11.2.2 --- openacs-4/packages/assessment/www/asm-admin/one-a.tcl 24 Jan 2007 20:15:30 -0000 1.11.2.1 +++ openacs-4/packages/assessment/www/asm-admin/one-a.tcl 24 Jan 2007 21:56:03 -0000 1.11.2.2 @@ -59,6 +59,8 @@ # This is the user-registration assessment set is_reg_asm_p 1 set p_title "[_ assessment.Reg_Assessment_title]" +} else { + set p_title [_ assessment.One_Assessment_data] } if {![info exists assessment_data(assessment_id)]} {