Index: openacs-4/packages/assessment/lib/item-show-display-sb.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/assessment/lib/item-show-display-sb.tcl,v diff -u -r1.3 -r1.4 --- openacs-4/packages/assessment/lib/item-show-display-sb.tcl 12 Jun 2006 02:49:49 -0000 1.3 +++ openacs-4/packages/assessment/lib/item-show-display-sb.tcl 12 Jun 2006 03:02:37 -0000 1.4 @@ -8,5 +8,4 @@ {html_options:text,optional {label "[_ assessment.Html_Options]"} {html {size 80 maxlength 1000}} {value $html_display_options} {help_text "[_ assessment.Html_Options_help]"}} {multiple_p:text(select) {label "[_ assessment.Multiple]"} {options $boolean_options} {value $multiple_p} {help_text "[_ assessment.Multiple_help]"}} {order_type:text {label "[_ assessment.Order_Type]"} {value "[_ assessment.$sort_order_type]"} {help_text "[_ assessment.Order_Type_help]"}} - {prepend_empty_p:text(select) {label "[_ assessment.Prepend_Empty_Item]"} {options $boolean_options} {value $prepend_empty_p} {help_text "[_ assessment.lt_Prepend_an_empty_item]"}} } Index: openacs-4/packages/assessment/lib/session-items.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/assessment/lib/session-items.adp,v diff -u -r1.9 -r1.10 --- openacs-4/packages/assessment/lib/session-items.adp 12 Jun 2006 02:49:50 -0000 1.9 +++ openacs-4/packages/assessment/lib/session-items.adp 12 Jun 2006 03:02:37 -0000 1.10 @@ -1,133 +1,118 @@ - - - - +
#assessment.not_answered#
+ + + - + + - - - - - - + + + + - - + - - - - - - + - + + - - - - - - - - - - - - - - Index: openacs-4/packages/assessment/www/view/index.vuh =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/assessment/www/view/index.vuh,v diff -u -r1.3 -r1.4 --- openacs-4/packages/assessment/www/view/index.vuh 29 Mar 2005 10:53:35 -0000 1.3 +++ openacs-4/packages/assessment/www/view/index.vuh 12 Jun 2006 03:02:38 -0000 1.4 @@ -20,7 +20,7 @@ set template_root [db_1row template_root {}] # Serve the page - +#ad_return_complaint 1 "$the_url $the_root $content_root $template_root " if { [content::init the_url the_root $content_root $template_root public $revision_id $content_type] } { set file "$the_root/$the_url" rp_internal_redirect -absolute_path $file
#assessment.not_answered#
@items.name@: 
@items.name@: 
+ + (#assessment.max_time# @items.max_time_to_complete@) + @items.result_points@ / @items.points@ #assessment.points# + + : @items.feedback;noquote@ + + + + + #assessment.not_yet_reviewed# + #assessment.not_answered# + + #assessment.Edit# + + +  
- - (#assessment.max_time# @items.max_time_to_complete@) - @items.result_points@ / @items.points@ #assessment.points# - - : @items.feedback;noquote@ - - - - - #assessment.not_yet_reviewed# - #assessment.not_answered# - - #assessment.Edit# - - - 
+ + @items.title;noquote@ + @items.content;noquote@ + + +
- - @items.title;noquote@ - -
- - -
- - - - - - - + - +
@items.description;noquote@ - - - -
@items.result_points@ / @items.points@ #assessment.points# - - :
@items.feedback;noquote@
-
-
-
- -
#assessment.not_yet_reviewed#
-
#assessment.not_answered#
-
- #assessment.Edit# - -
- -
#assessment.not_yet_reviewed#
-
#assessment.not_answered#
-
- #assessment.Edit# - -
-
-
- @formgroup.widget;noquote@ @formgroup.label;noquote@
-
- - -
- @formgroup.widget;noquote@ @formgroup.label;noquote@ - -
- - - -
@formgroup.widget;noquote@ @formgroup.label;noquote@
+
+ + + + + + +
+ + + @formgroup.widget;noquote@ @formgroup.label;noquote@
+
+
+ + + @formgroup.widget;noquote@ @formgroup.label;noquote@ + +
+
+ + + @formgroup.widget;noquote@ @formgroup.label;noquote@ + +
+ + + +
@items.description;noquote@ + + + +
@items.result_points@ / @items.points@ #assessment.points# + + :
@items.feedback;noquote@
+
+
+
+ +
#assessment.not_yet_reviewed#
+
#assessment.not_answered#
+
+ #assessment.Edit# + +
+ +
#assessment.not_yet_reviewed#
+
#assessment.not_answered#
+
+ #assessment.Edit# + +
+
+
- - - @items.html;noquote@ - - - - - - - - -
- [i] - @items.subtext@ -
-
-
@items.html;noquote@ + + + + + + + + +
+ [i] + @items.subtext@ +
+
+
-
Index: openacs-4/packages/assessment/lib/session-items.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/assessment/lib/session-items.tcl,v diff -u -r1.10 -r1.11 --- openacs-4/packages/assessment/lib/session-items.tcl 12 Jun 2006 02:49:50 -0000 1.10 +++ openacs-4/packages/assessment/lib/session-items.tcl 12 Jun 2006 03:02:37 -0000 1.11 @@ -2,13 +2,26 @@ set edit_p 0 } +if {![exists_and_not_null feedback_only_p] } { + set feedback_only_p 0 +} + +set items_clause "" +if {[info exists item_id_list]} { + if {[llength $item_id_list]} { + set items_clause "and i.as_item_id in ([join $item_id_list ,])" + } +} + ad_form -name session_results_$section_id -mode display -form { {section_id:text(hidden) {value $section_id}} } # todo: display feedback text -db_multirow -extend { presentation_type html result_points feedback answered_p choice_orientation next_title next_pr_type num } items session_items {} { +set feedback_count 0 +db_multirow -extend { presentation_type html result_points feedback answered_p choice_orientation next_title next_pr_type num content has_feedback_p } items session_items {} { set default_value [as::item_data::get -subject_id $subject_id -as_item_id $as_item_id -session_id $session_id] + array set item [as::item::item_data -as_item_id $as_item_id] set presentation_type [as::item_form::add_item_to_form -name session_results_$section_id -section_id $section_id -item_id $as_item_id -session_id $session_id -default_value $default_value -show_feedback $show_feedback] @@ -21,10 +34,8 @@ } if {$presentation_type == "rb" || $presentation_type == "cb"} { - array set item [as::item::item_data -as_item_id $as_item_id] array set type [as::item_display_$presentation_type\::data -type_id $item(display_type_id)] set choice_orientation $type(choice_orientation) - array unset item array unset type } else { set choice_orientation "" @@ -44,11 +55,21 @@ if { $points != 0 } { if {$result_points < $points} { if {$show_feedback != "correct"} { - set feedback "$feedback_wrong" + if { $feedback_wrong ne "" } { + set feedback "$feedback_wrong" + set has_feedback_p 1 + } else { + set feedback "" + } } } else { if {$show_feedback != "incorrect"} { - set feedback "$feedback_right" + if { $feedback_right ne "" } { + set feedback "$feedback_right" + set has_feedback_p 1 + } else { + set feedback "" + } } } } else { @@ -62,11 +83,21 @@ if { [lsearch $correct_answers $user_answers] == -1 } { if {$show_feedback != "correct"} { - set feedback "$feedback_wrong" + if { $feedback_wrong ne "" } { + set feedback "$feedback_wrong" + set has_feedback_p 1 + } else { + set feedback "" + } } } else { if {$show_feedback != "incorrect"} { - set feedback "$feedback_right" + if { $feedback_right ne "" } { + set feedback "$feedback_right" + set has_feedback_p 1 + } else { + set feedback "" + } } } } else { @@ -86,11 +117,21 @@ if { !$correct_p } { if {$show_feedback != "correct"} { - set feedback "$feedback_wrong" + if { $feedback_wrong ne "" } { + set feedback "$feedback_wrong" + set has_feedback_p 1 + } else { + set feedback "" + } } } else { if {$show_feedback != "incorrect"} { - set feedback "$feedback_right" + if { $feedback_right ne "" } { + set feedback "$feedback_right" + set has_feedback_p 1 + } else { + set feedback "" + } } } } @@ -100,9 +141,21 @@ set result_points "" set feedback "" set answered_p f - } + } + + set content [as::assessment::display_content -content_id $item(content_rev_id) -filename $item(content_filename) -content_type $item(content_type)] + + if { $has_feedback_p == 1 } { + incr feedback_count + } } +if { $feedback_only_p && $feedback_count == 0 && [exists_and_not_null next_url] } { + ns_log notice "feedback going to $next_url" + ad_returnredirect $next_url + ad_script_abort +} + set counter 1 for {set i 1; set j 2} {$i <= ${items:rowcount}} {incr i; incr j} { upvar 0 items:$i this Index: openacs-4/packages/assessment/lib/session-items.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/assessment/lib/session-items.xql,v diff -u -r1.7 -r1.8 --- openacs-4/packages/assessment/lib/session-items.xql 20 May 2006 16:38:05 -0000 1.7 +++ openacs-4/packages/assessment/lib/session-items.xql 12 Jun 2006 03:02:37 -0000 1.8 @@ -16,6 +16,7 @@ and ism.as_item_id = si.as_item_id and si.section_id = :section_id and si.session_id = :session_id + $items_clause order by si.sort_order Index: openacs-4/packages/assessment/tcl/as-assessment-procs-postgresql.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/assessment/tcl/as-assessment-procs-postgresql.xql,v diff -u -r1.9 -r1.10 --- openacs-4/packages/assessment/tcl/as-assessment-procs-postgresql.xql 12 Jun 2006 02:49:50 -0000 1.9 +++ openacs-4/packages/assessment/tcl/as-assessment-procs-postgresql.xql 12 Jun 2006 03:02:38 -0000 1.10 @@ -5,7 +5,7 @@ - select a.assessment_id as assessment_rev_id, cr.item_id as assessment_id, cr.title, ci.name, + select o.package_id, a.assessment_id as assessment_rev_id, cr.item_id as assessment_id, cr.title, ci.name, cr.description, coalesce(o.creation_user, o2.creation_user) as creation_user, o.creation_date, a.instructions, a.run_mode, a.anonymous_p, a.secure_access_p, a.reuse_responses_p, a.ip_mask, a.password, a.show_item_name_p, a.entry_page, a.exit_page, a.consent_page, a.return_url, Index: openacs-4/packages/assessment/tcl/as-assessment-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/assessment/tcl/as-assessment-procs.tcl,v diff -u -r1.29 -r1.30 --- openacs-4/packages/assessment/tcl/as-assessment-procs.tcl 12 Jun 2006 02:49:50 -0000 1.29 +++ openacs-4/packages/assessment/tcl/as-assessment-procs.tcl 12 Jun 2006 03:02:38 -0000 1.30 @@ -479,6 +479,7 @@ Returns the folder_id of the package instance. Cached } { + ns_log notice "assessment folder id package_id = '${package_id}'" return [content::folder::get_folder_from_package -package_id $package_id] } Index: openacs-4/packages/assessment/tcl/as-item-data-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/assessment/tcl/as-item-data-procs.tcl,v diff -u -r1.10 -r1.11 --- openacs-4/packages/assessment/tcl/as-item-data-procs.tcl 12 Jun 2006 02:49:50 -0000 1.10 +++ openacs-4/packages/assessment/tcl/as-item-data-procs.tcl 12 Jun 2006 03:02:38 -0000 1.11 @@ -23,13 +23,16 @@ {-signed_data ""} {-allow_overwrite_p t} {-points ""} + {-package_id ""} } { @author Eduardo Perez (eperez@it.uc3m.es) @creation-date 2004-09-12 New as_item_data to the database } { - set package_id [ad_conn package_id] + if {$package_id eq ""} { + set package_id [ad_conn package_id] + } set folder_id [as::assessment::folder_id -package_id $package_id] set name "$as_item_id-$section_id-$session_id" set new_p 1 Index: openacs-4/packages/assessment/tcl/as-item-procs.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/assessment/tcl/as-item-procs.xql,v diff -u -r1.7 -r1.8 --- openacs-4/packages/assessment/tcl/as-item-procs.xql 12 Jun 2006 02:49:50 -0000 1.7 +++ openacs-4/packages/assessment/tcl/as-item-procs.xql 12 Jun 2006 03:02:38 -0000 1.8 @@ -76,9 +76,14 @@ select cr.title, i.subtext, i.data_type, i.field_name, max(oi.object_id) as item_type_id, oi.object_type as item_type, - od.object_id as display_type_id, od.object_type as display_type - from as_items i, cr_revisions cr, as_item_rels it, - as_item_rels dt, acs_objects oi, acs_objects od + od.object_id as display_type_id, od.object_type as display_type, + r2.revision_id as content_rev_id, r2.title as content_filename, ci2.content_type + from cr_revisions cr, as_item_rels it, + as_item_rels dt, acs_objects oi, acs_objects od, + as_items i + left outer join as_item_rels ar on (ar.item_rev_id = i.as_item_id and ar.rel_type = 'as_item_content_rel') + left outer join cr_revisions r2 on (ar.target_rev_id = r2.revision_id) + left outer join cr_items ci2 on (ci2.item_id = r2.item_id) where i.as_item_id = :as_item_id and cr.revision_id = i.as_item_id and it.item_rev_id = i.as_item_id @@ -87,7 +92,7 @@ and dt.rel_type = 'as_item_display_rel' and oi.object_id = it.target_rev_id and od.object_id = dt.target_rev_id - group by cr.title, i.subtext, i.field_name, i.data_type, oi.object_type,od.object_id, od.object_type + group by cr.title, i.subtext, i.field_name, i.data_type, oi.object_type,od.object_id, od.object_type, r2.revision_id, r2.title, ci2.content_type Index: openacs-4/packages/assessment/tcl/as-item-type-mc-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/assessment/tcl/as-item-type-mc-procs.tcl,v diff -u -r1.19 -r1.20 --- openacs-4/packages/assessment/tcl/as-item-type-mc-procs.tcl 12 Jun 2006 02:49:50 -0000 1.19 +++ openacs-4/packages/assessment/tcl/as-item-type-mc-procs.tcl 12 Jun 2006 03:02:38 -0000 1.20 @@ -168,7 +168,7 @@ lappend choice_list [list "$title $feedback_text" $choice_id] } else { if {$correct_answer_p == "t" && $show_feedback != "incorrect" && $show_feedback != "correct"} { - lappend choice_list [list "$title " $choice_id] + lappend choice_list [list "$title " $choice_id] } else { lappend choice_list [list $title $choice_id] } @@ -286,6 +286,7 @@ {-response ""} {-max_points 0} {-allow_overwrite_p t} + {-package_id ""} } { @author Timo Hentschel (timo@timohentschel.de) @creation-date 2004-12-11 @@ -320,8 +321,8 @@ set points [expr round($max_points * $percent / 100)] - set item_data_id [as::item_data::new -session_id $session_id -subject_id $subject_id -staff_id $staff_id -as_item_id $as_item_id -section_id $section_id -choice_answer $response -points $points -allow_overwrite_p $allow_overwrite_p] - as::session_results::new -target_id $item_data_id -points $points + set item_data_id [as::item_data::new -session_id $session_id -subject_id $subject_id -staff_id $staff_id -as_item_id $as_item_id -section_id $section_id -choice_answer $response -points $points -allow_overwrite_p $allow_overwrite_p -package_id $package_id] + as::session_results::new -target_id $item_data_id -points $points -package_id $package_id } ad_proc -public as::item_type_mc::data { Index: openacs-4/packages/assessment/tcl/as-section-data-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/assessment/tcl/as-section-data-procs.tcl,v diff -u -r1.4 -r1.5 --- openacs-4/packages/assessment/tcl/as-section-data-procs.tcl 21 Feb 2005 14:32:56 -0000 1.4 +++ openacs-4/packages/assessment/tcl/as-section-data-procs.tcl 12 Jun 2006 03:02:38 -0000 1.5 @@ -12,13 +12,16 @@ {-subject_id ""} {-staff_id ""} {-points ""} + {-package_id ""} } { @author Timo Hentschel (timo@timohentschel.de) @creation-date 2005-01-14 New as_section_data } { - set package_id [ad_conn package_id] + if {$package_id eq ""} { + set package_id [ad_conn package_id] + } set folder_id [as::assessment::folder_id -package_id $package_id] if {[db_0or1row section_data_exists {}]} { Index: openacs-4/packages/assessment/tcl/as-section-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/assessment/tcl/as-section-procs.tcl,v diff -u -r1.26 -r1.27 --- openacs-4/packages/assessment/tcl/as-section-procs.tcl 12 Jun 2006 02:49:50 -0000 1.26 +++ openacs-4/packages/assessment/tcl/as-section-procs.tcl 12 Jun 2006 03:02:38 -0000 1.27 @@ -332,14 +332,15 @@ -session_id:required -subject_id:required {-staff_id ""} + {-package_id ""} } { @author Timo Hentschel (timo@timohentschel.de) @creation-date 2005-01-22 Skip section in a session and award 0 points } { db_transaction { - as::section_data::new -section_id $section_id -session_id $session_id -subject_id $subject_id -staff_id $staff_id + as::section_data::new -section_id $section_id -session_id $session_id -subject_id $subject_id -staff_id $staff_id -package_id $package_id db_dml set_zero_points {} } } Index: openacs-4/packages/assessment/tcl/as-session-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/assessment/tcl/as-session-procs.tcl,v diff -u -r1.4 -r1.5 --- openacs-4/packages/assessment/tcl/as-session-procs.tcl 12 Jun 2006 02:49:50 -0000 1.4 +++ openacs-4/packages/assessment/tcl/as-session-procs.tcl 12 Jun 2006 03:02:38 -0000 1.5 @@ -18,13 +18,17 @@ {-ip_address ""} {-percent_score ""} {-consent_timestamp ""} + {-package_id ""} } { @author Eduardo Perez (eperez@it.uc3m.es) @creation-date 2004-09-12 New as_session to the database } { - set package_id [ad_conn package_id] + if {$package_id eq ""} { + set package_id [ad_conn package_id] + } + set folder_id [db_string get_folder_id "select folder_id from cr_folders where package_id=:package_id"] # # Check to see if there's a session already to not submit another one Index: openacs-4/packages/assessment/tcl/as-session-results-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/assessment/tcl/as-session-results-procs.tcl,v diff -u -r1.2 -r1.3 --- openacs-4/packages/assessment/tcl/as-session-results-procs.tcl 12 Jun 2006 02:49:50 -0000 1.2 +++ openacs-4/packages/assessment/tcl/as-session-results-procs.tcl 12 Jun 2006 03:02:38 -0000 1.3 @@ -11,13 +11,17 @@ -points:required {-title ""} {-description ""} + {-package_id ""} } { @author Timo Hentschel (timo@timohentschel.de) @creation-date 2005-02-17 New as_session_results } { - set package_id [ad_conn package_id] + if {$package_id eq ""} { + set package_id [ad_conn package_id] + } + ns_log notice "session results new package_id = '${package_id}'" set folder_id [as::assessment::folder_id -package_id $package_id] # Insert as_session_results in the CR (and as_session_results table) getting the revision_id Index: openacs-4/packages/assessment/www/assessment-section-submit.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/assessment/www/assessment-section-submit.adp,v diff -u -r1.11 -r1.12 --- openacs-4/packages/assessment/www/assessment-section-submit.adp 12 Jun 2006 02:49:51 -0000 1.11 +++ openacs-4/packages/assessment/www/assessment-section-submit.adp 12 Jun 2006 03:02:38 -0000 1.12 @@ -1,4 +1,4 @@ - + @assessment_data.html_title;noquote@ @context;noquote@ Index: openacs-4/packages/assessment/www/assessment.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/assessment/www/Attic/assessment.tcl,v diff -u -r1.51 -r1.52 --- openacs-4/packages/assessment/www/assessment.tcl 12 Jun 2006 02:49:51 -0000 1.51 +++ openacs-4/packages/assessment/www/assessment.tcl 12 Jun 2006 03:02:38 -0000 1.52 @@ -1,534 +1 @@ -ad_page_contract { - - This page allows to display an assessment with sections and items - - @author Eduardo P�rez Ureta (eperez@it.uc3m.es) - @author Timo Hentschel (timo@timohentschel.de) - @creation-date 2004-09-13 -} -query { - assessment_id:integer,notnull - {password:optional ""} - {session_id:integer,optional ""} - {section_order:integer,optional ""} - {item_order:integer,optional ""} - {item_id ""} - {return_url:optional} - response_to_item:array,optional,multiple,html - {next_asm:optional} - {response:multiple,optional} -} -properties { - context:onevalue - page_title:onevalue -} - -set user_id [ad_conn user_id] -set page_title "[_ assessment.Show_Items]" -set context [list $page_title] -set section_to "" -set item_to "" -set url "" - - -if { [info exists return_url] } { - - set url $return_url - ns_log notice "$return_url" -} - -set return_url "$url" - - - -# Get the assessment data -as::assessment::data -assessment_id $assessment_id -permission::require_permission -object_id $assessment_id -privilege read - -if {![info exists assessment_data(assessment_id)]} { - ad_return_complaint 1 "[_ assessment.Requested_assess_does]" - ad_script_abort -} - -set assessment_rev_id $assessment_data(assessment_rev_id) -set number_tries $assessment_data(number_tries) -db_1row total_tries {} -if {![empty_string_p $number_tries] && $number_tries <= $total_tries} { - ad_returnredirect [export_vars -base sessions {assessment_id}] -} -set errors [as::assessment::check_session_conditions -assessment_id $assessment_rev_id -subject_id $user_id -password $password] - -if {![empty_string_p $errors]} { - ad_return_complaint 1 $errors - ad_script_abort -} - -db_transaction { - if {[empty_string_p $session_id]} { - - # Check if there is an unfinished session lying around - set session_id [db_string unfinished_session_id {}] - if {[empty_string_p $session_id]} { - # start new session - set session_id [as::session::new -assessment_id $assessment_rev_id -subject_id $user_id] - if {[empty_string_p $assessment_data(consent_page)]} { - # set the time when the subject initiated the Assessment - db_dml session_start {} - } else { - set consent_url [export_vars -base assessment-consent {assessment_id session_id password return_url next_asm}] - } - } else { - # pick up old session - db_1row unfinished_section_order {} - if {[empty_string_p $section_order]} { - set consent_url [export_vars -base assessment-consent {assessment_id session_id password return_url next_asm}] - } else { - db_1row unfinished_section_id {} - db_1row unfinished_item_order {} - if {[empty_string_p $item_order]} { - db_1row unfinished_last_item {} - } - incr section_order -1 - incr item_order -1 - } - } - } else { - # set time the subject initiated the assessment, if not already done - db_dml session_start {} - } - - if {![info exists consent_url]} { - db_1row session_time {} - set assessment_data(elapsed_time) $elapsed_time - if {![empty_string_p $assessment_data(time_for_response)]} { - set assessment_data(time_for_response) [expr 60 * $assessment_data(time_for_response)] - set assessment_data(pretty_remaining_time) [as::assessment::pretty_time -seconds [expr $assessment_data(time_for_response) - $assessment_data(elapsed_time)]] - } - - - # get all sections of assessment in correct order - set section_list [as::assessment::sections -assessment_id $assessment_rev_id -session_id $session_id -sort_order_type $assessment_data(section_navigation) -random_p $assessment_data(random_p)] - - if {[empty_string_p $section_order]} { - # start at the first section - set section_order 0 - set section_id [lindex $section_list 0] - } else { - # continue with given section - set section_id [lindex $section_list $section_order] - } - - - as::section_data::new -section_id $section_id -session_id $session_id -subject_id $user_id - db_1row section_data {} -column_array section - set display_type_id $section(display_type_id) - if {![empty_string_p $display_type_id]} { - db_1row display_data {} -column_array display - } else { - array set display [list num_items "" adp_chunk "" branched_p f back_button_p t submit_answer_p f sort_order_type order_of_entry] - } - - # get all items of section in correct order - set item_list [as::section::items -section_id $section_id -session_id $session_id -sort_order_type $display(sort_order_type) -num_items $section(num_items) -random_p $assessment_data(random_p)] - - set section(num_sections) [llength $section_list] - set section(num_items) [llength $item_list] - if {![empty_string_p $section(max_time_to_complete)]} { - set section(pretty_remaining_time) [as::assessment::pretty_time -seconds [expr $section(max_time_to_complete) - $section(elapsed_time)]] - } - - if {![empty_string_p $item_order]} { - # show next items on section page - if {![empty_string_p $display(num_items)]} { - # make sure to display correct section page - set item_order [expr $item_order - ($item_order % $display(num_items))] - } elseif {$display(submit_answer_p) == "t"} { - # show whole section when picking up a seperate submit section - set item_order 0 - } - # strip away items on previous section pages - set item_list [lreplace $item_list 0 [expr $item_order-1]] - } - - if {![empty_string_p $display(num_items)]} { - if {[llength $item_list] > $display(num_items)} { - # next page: more items of this section - set new_item_order $item_order - set new_section_order $section_order - if {[empty_string_p $item_order]} { - set new_item_order 0 - } - set new_item_order [expr $new_item_order + $display(num_items)] - - # show only a few items per page - set item_list [lreplace $item_list $display(num_items) end] - } else { - # next page: next section - set new_item_order "" - set new_section_order [expr $section_order + 1] - } - } else { - # next page: next section - set new_section_order [expr $section_order + 1] - set new_item_order "" - } - - if {$new_section_order == [llength $section_list]} { - # last section - set new_section_order "" - } - } -} - -if {[info exists consent_url]} { - ad_returnredirect $consent_url - ad_script_abort -} - -set section(cur_section) [expr $section_order + 1] -set section(cur_first_item) [expr $item_order + 1] -set section(cur_last_item) [expr $item_order + [llength $item_list]] - -# check if section or session time ran out -if {(![empty_string_p $assessment_data(time_for_response)] && $assessment_data(time_for_response) < $assessment_data(elapsed_time)) || (![empty_string_p $section(max_time_to_complete)] && $section(max_time_to_complete) < $section(elapsed_time))} { - if {[empty_string_p $assessment_data(time_for_response)] || $assessment_data(time_for_response) >= $assessment_data(elapsed_time)} { - # skip to next section - set new_section_order [expr $section_order + 1] - set new_item_order "" - if {$new_section_order == [llength $section_list]} { - # last section - set new_section_order "" - } - - # answer all remaining section items with empty string - db_transaction { - as::section::close -section_id $section_id -assessment_id $assessment_rev_id -session_id $session_id -subject_id $user_id - #immediate checks execution - as::assessment::check::eval_i_checks -session_id $session_id -section_id $section_id - set section_to_tmp [as::assessment::check::branch_checks -session_id $session_id -assessment_id $assessment_id -section_id $section_id] - if { $section_to_tmp != "f" && $section_to_tmp != "f"} { - set section_to $section_to_tmp - } - } - - - } else { - # skip entire session - set new_section_order "" - set new_item_order "" - - db_transaction { - # answer all remaining section items with empty string - as::section::close -section_id $section_id -assessment_id $assessment_rev_id -session_id $session_id -subject_id $user_id - # immediate checks execution - as::assessment::check::eval_i_checks -session_id $session_id -section_id $section_id - set section_to_tmp [as::assessment::check::branch_checks -session_id $session_id -assessment_id $assessment_id -section_id $section_id] - if { $section_to_tmp != "f" && $section_to_tmp != "f"} { - set section_to $section_to_tmp - } - - - set section_list [lreplace $section_list 0 [expr $section_order]] - foreach section_id $section_list { - # skip remaining sections - as::section::skip -section_id $section_id -session_id $session_id -subject_id $user_id - } - } - } - - if {![empty_string_p $new_section_order]} { - # go to next section - set section_order $new_section_order - set item_order $new_item_order - ad_returnredirect [export_vars -base assessment {assessment_id session_id section_order item_order password return_url next_asm}] - ad_script_abort - } else { - # calculate session points at end of session - as::assessment::calculate -session_id $session_id -assessment_id $assessment_rev_id - db_dml session_finished {} - as::assessment::check::eval_aa_checks -session_id $session_id -assessment_id $assessment_id - # section based aa checks - as::assessment::check::eval_sa_checks -session_id $session_id -assessment_id $assessment_id - as::assessment::check::eval_m_checks -session_id $session_id -assessment_id $assessment_id - if {[empty_string_p $assessment_data(return_url)]} { - ad_returnredirect [export_vars -base finish {session_id assessment_id return_url next_asm}] - } else { - ad_returnredirect $assessment_data(return_url) - } - ad_script_abort - } -} - - -# form for display an assessment with sections and items -ad_form -name show_item_form -action assessment -html {enctype multipart/form-data} -export { next_asm assessment_id section_id section_order item_order password return_url} -form { - {session_id:text(hidden) {value $session_id}} -} - -multirow create items as_item_id name title description subtext required_p max_time_to_complete presentation_type html submitted_p content as_item_type_id choice_orientation next_title validate_block next_pr_type - -set unsubmitted_list [list] -set validate_list [list] -set required_count 0 - -foreach one_item $item_list { - util_unlist $one_item as_item_id name title description subtext required_p max_time_to_complete content_rev_id content_filename content_type as_item_type_id validate_block - - if {$required_p == "t"} { - # make sure that mandatory items are answered - lappend validate_list "response_to_item.$as_item_id {\[exists_and_not_null response_to_item($as_item_id)\]} \"\[_ assessment.form_element_required\]\"" - incr required_count - } - - foreach {check_expr check_message} [split $validate_block \n] { - regsub -all {%answer%} $check_expr \$response_to_item($as_item_id) check_expr - regsub -all {%answer%} [lang::util::localize $check_message] \$response_to_item($as_item_id) check_message - lappend validate_list "response_to_item.$as_item_id { $check_expr } { $check_message }" - } - - set default_value "" - set submitted_p f - - if {$display(submit_answer_p) != "t"} { - # no seperate submit of each item - if {$assessment_data(reuse_responses_p) == "t"} { - set default_value [as::item_data::get -subject_id $user_id -as_item_id $as_item_id] - } - set presentation_type [as::item_form::add_item_to_form -name show_item_form -session_id $session_id -section_id $section_id -item_id $as_item_id -default_value $default_value -required_p $required_p -random_p $assessment_data(random_p)] - - } else { - # submit each item seperately - set default_value [as::item_data::get -subject_id $user_id -as_item_id $as_item_id -session_id $session_id] - if {![empty_string_p $default_value]} { - # value already submitted - set submitted_p t - set mode display - if {$required_p == "t"} { - # correct count of mandatory items not yet answered (to display next-button) - incr required_count -1 - } - } else { - # value not submitted yet. get older submitted value if necessary - set mode edit - if {$assessment_data(reuse_responses_p) == "t"} { - set default_value [as::item_data::get -subject_id $user_id -as_item_id $as_item_id] - } - lappend unsubmitted_list $as_item_id - } - - # create seperate submit form for each item - ad_form -name show_item_form_$as_item_id -mode $mode -action assessment -html {enctype multipart/form-data} -export {assessment_id section_id section_order item_order password return_url next_asm} -form { - {session_id:text(hidden) {value $session_id}} - {item_id:text(hidden) {value $as_item_id}} - } - set presentation_type [as::item_form::add_item_to_form -name show_item_form_$as_item_id -session_id $session_id -section_id $section_id -item_id $as_item_id -default_value $default_value -required_p $required_p] - - # process single submit - set on_submit "{ - db_transaction { - db_dml session_updated {} - - # save answer - set response_item_id \$item_id - - db_1row process_item_type {} - set item_type \[string range \$item_type end-1 end\] - if {!\[info exists response_to_item(\$response_item_id)\]} { - set response_to_item(\$response_item_id) \"\" - } else { - - set section_to_tmp \[as::assessment::check::branch_checks -session_id $session_id -assessment_id $assessment_id\ -section_id $section_id] - if { \$section_to_tmp != \"f\" && \$section_to_tmp != \"f\"} { - set section_to \$section_to_tmp - } - } - - set points \[ad_decode \$points \"\" 0 \$points\] - - set response \$response_to_item(\$response_item_id) - - if { \$item_type == \"fu\" } { - set response \[list \$response_to_item(\$response_item_id) \$response_to_item(\${response_item_id}.tmpfile) \$response_to_item(\${response_item_id}.content-type)\] - } - - as::item_type_\$item_type\\::process -type_id \$item_type_id -session_id \$session_id -as_item_id \$response_item_id -section_id \$section_id -subject_id \$user_id -response \$response -max_points \$points -allow_overwrite_p \$display(back_button_p) - } - }" - set after_submit "{ - ad_returnredirect \[export_vars -base assessment {assessment_id session_id section_order item_order password return_url next_asm}\] - ad_script_abort - }" - - eval ad_form -extend -name show_item_form_$as_item_id -validate "{$validate_list}" -on_submit $on_submit -after_submit $after_submit - set validate_list [list] - } - - # Fill in the blank item. Replace all that appear in the title by an of type="text" - if {$presentation_type == {tb}} { - regsub -all -line -nocase -- { - select section_id + select section_id as unfinished_section_id from as_session_sections where session_id = :session_id and sort_order = :section_order @@ -53,11 +53,11 @@ select min(i.sort_order) as item_order from as_session_items i where i.session_id = :session_id - and i.section_id = :section_id + and i.section_id = :unfinished_section_id and not exists (select 1 from as_item_data d where d.session_id = :session_id - and d.section_id = :section_id + and d.section_id = :unfinished_section_id and d.as_item_id = i.as_item_id) Index: openacs-4/packages/assessment/www/session.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/assessment/www/session.adp,v diff -u -r1.28 -r1.29 --- openacs-4/packages/assessment/www/session.adp 12 Jun 2006 02:49:51 -0000 1.28 +++ openacs-4/packages/assessment/www/session.adp 12 Jun 2006 03:02:38 -0000 1.29 @@ -2,52 +2,8 @@ @page_title;noquote@ @context_bar;noquote@ - - - - - - + - - - - - - - -
#assessment.Assessment#: @assessment_data.title@
#assessment.User_ID#: @first_names@ @last_name@
#assessment.lt_bNoteb_This_assessmen#
#assessment.anonymous_name#
#assessment.Attempt#: @session_attempt@ / @assessment_data.number_tries@ #assessment.Percent_Score#: @assessment_score@
#assessment.Started#: @session_start@#assessment.Finished#: @session_finish@#assessment.Time_spent#: @session_time@
-

- - - - - - - -
- - - - - - - -
#assessment.section# @sections.title@ - (#assessment.max_time# @sections.max_time_to_complete@) - (@sections.points@ / @sections.max_points@ #assessment.points#) -
@sections.description@
@sections.feedback_text@
- -
- -
- -
-
- -
-


-#assessment.Total_score#: @session_score@ / @assessment_score@ = @percent_score@% Index: openacs-4/packages/assessment/www/session.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/assessment/www/session.tcl,v diff -u -r1.35 -r1.36 --- openacs-4/packages/assessment/www/session.tcl 12 Jun 2006 02:49:51 -0000 1.35 +++ openacs-4/packages/assessment/www/session.tcl 12 Jun 2006 03:02:38 -0000 1.36 @@ -1,74 +1,74 @@ -ad_page_contract { +# ad_page_contract { - Show the result of a session. +# Show the result of a session. - @author timo@timohentschel.de - @date 2004-12-24 - @cvs-id $Id: -} { - session_id:integer -} -properties { - context_bar:onevalue - page_title:onevalue -} +# @author timo@timohentschel.de +# @date 2004-12-24 +# @cvs-id $Id: +# } { +# session_id:integer +# } -properties { +# context_bar:onevalue +# page_title:onevalue +# } -db_1row find_assessment {} +# db_1row find_assessment {} -# Get the assessment data -as::assessment::data -assessment_id $assessment_id -permission::require_permission -object_id $assessment_id -privilege read +# # Get the assessment data +# as::assessment::data -assessment_id $assessment_id +# permission::require_permission -object_id $assessment_id -privilege read -if {![info exists assessment_data(assessment_id)]} { - ad_return_complaint 1 "[_ assessment.Requested_assess_does]" - ad_script_abort -} +# if {![info exists assessment_data(assessment_id)]} { +# ad_return_complaint 1 "[_ assessment.Requested_assess_does]" +# ad_script_abort +# } -set user_id [ad_conn user_id] -if {$subject_id != $user_id} { - permission::require_permission -object_id $assessment_id -privilege admin -} +# set user_id [ad_conn user_id] +# if {$subject_id != $user_id} { +# permission::require_permission -object_id $assessment_id -privilege admin +# } -set page_title "[_ assessment.View_Results]" -set context_bar [ad_context_bar [list [export_vars -base sessions {assessment_id}] "[_ assessment.Show_Sessions]"] $page_title] -set format "[lc_get formbuilder_date_format], [lc_get formbuilder_time_format]" -set session_user_url [acs_community_member_url -user_id $subject_id] +# set page_title "[_ assessment.View_Results]" +# set context_bar [ad_context_bar [list [export_vars -base sessions {assessment_id}] "[_ assessment.Show_Sessions]"] $page_title] +# set format "[lc_get formbuilder_date_format], [lc_get formbuilder_time_format]" +# set session_user_url [acs_community_member_url -user_id $subject_id] -# get start and end times -db_1row session_data {} -set session_time [as::assessment::pretty_time -seconds $session_time -hours] +# # get start and end times +# db_1row session_data {} +# set session_time [as::assessment::pretty_time -seconds $session_time -hours] -# get the number of attempts -set session_attempt [db_string session_attempt {}] +# # get the number of attempts +# set session_attempt [db_string session_attempt {}] -set show_username_p 1 -# only admins are allowed to see responses of other users -if {$assessment_data(anonymous_p) == "t" && $subject_id != $user_id} { - set show_username_p 0 -} +# set show_username_p 1 +# # only admins are allowed to see responses of other users +# if {$assessment_data(anonymous_p) == "t" && $subject_id != $user_id} { +# set show_username_p 0 +# } -if {[empty_string_p $assessment_data(show_feedback)]} { - set assessment_data(show_feedback) "all" -} +# if {[empty_string_p $assessment_data(show_feedback)]} { +# set assessment_data(show_feedback) "all" +# } -# show_feedback: none, all, incorrect, correct +# # show_feedback: none, all, incorrect, correct -set session_score 0 -set assessment_score 0 -db_multirow sections sections {} { - if {[empty_string_p $points]} { - set points 0 - } - if {[empty_string_p $max_points]} { - set max_points 0 - } - set max_time_to_complete [as::assessment::pretty_time -seconds $max_time_to_complete] - incr session_score $points - incr assessment_score $max_points -} +# set session_score 0 +# set assessment_score 0 +# db_multirow sections sections {} { +# if {[empty_string_p $points]} { +# set points 0 +# } +# if {[empty_string_p $max_points]} { +# set max_points 0 +# } +# set max_time_to_complete [as::assessment::pretty_time -seconds $max_time_to_complete] +# incr session_score $points +# incr assessment_score $max_points +# } -set showpoints [parameter::get -parameter "ShowPoints" -default 1 ] +# set showpoints [parameter::get -parameter "ShowPoints" -default 1 ] -set comments_installed_p [apm_package_enabled_p "general-comments"] + set comments_installed_p [apm_package_enabled_p "general-comments"] ad_return_template Index: openacs-4/packages/assessment/www/asm-admin/index.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/assessment/www/asm-admin/index.adp,v diff -u -r1.7 -r1.8 --- openacs-4/packages/assessment/www/asm-admin/index.adp 12 Jun 2006 02:49:51 -0000 1.7 +++ openacs-4/packages/assessment/www/asm-admin/index.adp 12 Jun 2006 03:02:38 -0000 1.8 @@ -4,7 +4,7 @@ #assessment.admin_categories# -| #assessment.admin_actions# | #assessment.admin_requests# | #assessment.permissions# +| #assessment.admin_actions# | #assessment.admin_requests# | #assessment.permissions# | View Sessions #assessment.admin_requests# Index: openacs-4/packages/assessment/www/asm-admin/item-add-display-sb.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/assessment/www/asm-admin/item-add-display-sb.tcl,v diff -u -r1.6 -r1.7 --- openacs-4/packages/assessment/www/asm-admin/item-add-display-sb.tcl 12 Jun 2006 02:49:51 -0000 1.6 +++ openacs-4/packages/assessment/www/asm-admin/item-add-display-sb.tcl 12 Jun 2006 03:02:38 -0000 1.7 @@ -110,15 +110,13 @@ {multiple_p:text(select) {label "[_ assessment.Multiple]"} {options $boolean_options} {help_text "[_ assessment.Multiple_help]"}} {label_orientation:text(hidden)} {order_type:text(select) {label "[_ assessment.Order_Type]"} {options $order_types} {help_text "[_ assessment.Order_Type_help]"}} - {prepend_empty_p:text(select) {label "[_ assessment.Prepend_Empty_Item]"} {options $boolean_options} {help_text "[_ assessment.lt_Prepend_an_empty_item]"}} {answer_alignment:text(hidden)} } -edit_request { set html_options "" set multiple_p f set label_orientation "top" set order_type "order_of_entry" set answer_alignment "besideright" - set prepend_empty_p f } -validate { {html_options {[as::assessment::check_html_options -options $html_options]} "[_ assessment.error_html_options]"} } -edit_data { @@ -136,7 +134,7 @@ -choice_label_orientation $label_orientation \ -sort_order_type $order_type \ -item_answer_alignment $answer_alignment \ - -prepend_empty_p $prepend_empty_p] + -prepend_empty_p t] if {![info exists object_type]} { # first item display mapped @@ -155,7 +153,7 @@ -choice_label_orientation $label_orientation \ -sort_order_type $order_type \ -item_answer_alignment $answer_alignment \ - -prepend_empty_p $prepend_empty_p] + -prepend_empty_p t] } set old_item_id [as::item::latest -as_item_id $old_item_id -section_id $new_section_id -default 0] Index: openacs-4/packages/assessment/www/asm-admin/item-edit-display-sb.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/assessment/www/asm-admin/item-edit-display-sb.tcl,v diff -u -r1.8 -r1.9 --- openacs-4/packages/assessment/www/asm-admin/item-edit-display-sb.tcl 12 Jun 2006 02:49:51 -0000 1.8 +++ openacs-4/packages/assessment/www/asm-admin/item-edit-display-sb.tcl 12 Jun 2006 03:02:38 -0000 1.9 @@ -52,7 +52,6 @@ {choice_label_orientation:text(hidden)} {sort_order_type:text(select) {label "[_ assessment.Order_Type]"} {options $order_types} {help_text "[_ assessment.Order_Type_help]"}} {item_answer_alignment:text(hidden)} - {prepend_empty_p:text(select) {label "[_ assessment.Prepend_Empty_Item]"} {options $boolean_options} {help_text "[_ assessment.lt_Prepend_an_empty_item]"}} {as_item_display_id:text(hidden)} } -edit_request { db_1row last_used_display_type {} @@ -66,7 +65,7 @@ set sort_order_type "order_of_entry" set item_answer_alignment "besideright" set as_item_display_id 0 - set prepend_empty_p f + set prepend_empty_p t } } -validate { {html_display_options {[as::assessment::check_html_options -options $html_display_options]} "[_ assessment.error_html_options]"} @@ -83,7 +82,7 @@ -choice_label_orientation $choice_label_orientation \ -sort_order_type $sort_order_type \ -item_answer_alignment $item_answer_alignment \ - -prepend_empty_p $prepend_empty_p] + -prepend_empty_p t] } else { # create new display type set new_item_display_id [as::item_display_sb::new \ @@ -92,7 +91,7 @@ -choice_label_orientation $choice_label_orientation \ -sort_order_type $sort_order_type \ -item_answer_alignment $item_answer_alignment \ - -prepend_empty_p $prepend_empty_p] + -prepend_empty_p t] } set new_assessment_rev_id [as::assessment::new_revision -assessment_id $assessment_id] Index: openacs-4/packages/assessment/www/asm-admin/one-a.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/assessment/www/asm-admin/one-a.adp,v diff -u -r1.13 -r1.14 --- openacs-4/packages/assessment/www/asm-admin/one-a.adp 12 Jun 2006 02:49:51 -0000 1.13 +++ openacs-4/packages/assessment/www/asm-admin/one-a.adp 12 Jun 2006 03:02:38 -0000 1.14 @@ -28,7 +28,7 @@
#assessment.View_Responses# - #assessment.All# | + #assessment.All# | #assessment.By_user# | #assessment.CSV_file#