Index: openacs-4/packages/assessment/tcl/assessment-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/assessment/tcl/Attic/assessment-procs.tcl,v diff -u -r1.10 -r1.11 --- openacs-4/packages/assessment/tcl/assessment-procs.tcl 21 Sep 2004 15:07:11 -0000 1.10 +++ openacs-4/packages/assessment/tcl/assessment-procs.tcl 22 Sep 2004 15:27:09 -0000 1.11 @@ -190,13 +190,13 @@ 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 - set as_session_exists [db_string as_session_exists {SELECT COUNT(*) FROM as_sessionsx WHERE subject_id = :subject_id AND assessment_id = :assessment_id}] - if { ! $as_session_exists } { + db_0or1row as_session_last {SELECT session_id AS as_session_id FROM as_sessionsx WHERE subject_id = :subject_id AND assessment_id = :assessment_id} + if { ! [info exists as_session_id] } { # Insert as_session in the CR (and as_sessions table) getting the revision_id (session_id) set session_id [content::item::new -parent_id $folder_id -content_type {as_sessions} -name "$subject_id-$assessment_id" -title "$subject_id-$assessment_id" ] set as_session_id [content::revision::new -item_id $session_id -content_type {as_sessions} -title "$subject_id-$assessment_id" -attributes [list [list assessment_id $assessment_id] [list subject_id $subject_id] [list staff_id $staff_id] [list target_datetime $target_datetime] [list creation_datetime $creation_datetime] [list first_mod_datetime $first_mod_datetime] [list last_mod_datetime $last_mod_datetime] [list completed_datetime $completed_datetime] [list percent_score $percent_score] [list consent_timestamp $consent_timestamp] ] ] - return $as_session_id } + return $as_session_id } ad_proc -public as_item_data_new { @@ -224,20 +224,8 @@ set folder_id [db_string get_folder_id "select folder_id from cr_folders where package_id=:package_id"] # Insert as_item_data in the CR (and as_item_data table) getting the revision_id (item_data_id) - set item_data_id [content::item::new -parent_id $folder_id -content_type {as_item_data} -name "$as_item_id-$subject_id-$choice_id_answer" -title "$as_item_id-$subject_id-$choice_id_answer" ] - set as_item_data_id [content::revision::new -item_id $item_data_id -content_type {as_item_data} -title "$as_item_id-$subject_id-$choice_id_answer" -attributes [list [list session_id $session_id] [list event_id $event_id] [list subject_id $subject_id] [list staff_id $staff_id] [list as_item_id $as_item_id] [list choice_id_answer $choice_id_answer] [list boolean_answer $boolean_answer] [list numeric_answer $numeric_answer] [list integer_answer $integer_answer] [list text_answer $text_answer] [list timestamp_answer $timestamp_answer] [list content_answer $content_answer] [list signed_data $signed_data] [list percent_score $percent_score] ] ] + set item_data_id [content::item::new -parent_id $folder_id -content_type {as_item_data} -name "$as_item_id-$session_id-$choice_id_answer" -title "$as_item_id-$session_id-$choice_id_answer" ] + set as_item_data_id [content::revision::new -item_id $item_data_id -content_type {as_item_data} -title "$as_item_id-$session_id-$choice_id_answer" -attributes [list [list session_id $session_id] [list event_id $event_id] [list subject_id $subject_id] [list staff_id $staff_id] [list as_item_id $as_item_id] [list choice_id_answer $choice_id_answer] [list boolean_answer $boolean_answer] [list numeric_answer $numeric_answer] [list integer_answer $integer_answer] [list text_answer $text_answer] [list timestamp_answer $timestamp_answer] [list content_answer $content_answer] [list signed_data $signed_data] [list percent_score $percent_score] ] ] return $as_item_data_id } - -ad_proc -public as_session__get_session_id_from_user_assessment { - {-subject_id:required} - {-assessment_id:required} -} { - @author Eduardo Perez (eperez@it.uc3m.es) - @creation-date 2004-09-12 - - Get the session_id from the user_id and the assessment_id -} { - return [db_string as_session_id_get {SELECT session_id FROM as_sessionsx WHERE creation_user = :subject_id AND assessment_id = :assessment_id}] -} Index: openacs-4/packages/assessment/www/assessment.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/assessment/www/assessment.adp,v diff -u -r1.2 -r1.3 --- openacs-4/packages/assessment/www/assessment.adp 21 Sep 2004 08:54:14 -0000 1.2 +++ openacs-4/packages/assessment/www/assessment.adp 22 Sep 2004 15:27:08 -0000 1.3 @@ -3,7 +3,7 @@ @context;noquote@ - +
   Items 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.2 -r1.3 --- openacs-4/packages/assessment/www/assessment.tcl 19 Sep 2004 22:26:06 -0000 1.2 +++ openacs-4/packages/assessment/www/assessment.tcl 22 Sep 2004 15:27:08 -0000 1.3 @@ -4,15 +4,17 @@ } -query { assessment_id:notnull } -properties { + as_session_id context:onevalue } set context [list "Show Items"] -as_session_new -assessment_id $assessment_id -subject_id [ad_conn user_id] +set as_session_id [as_session_new -assessment_id $assessment_id -subject_id [ad_conn user_id]] +db_dml session_start {UPDATE as_sessions SET creation_datetime = NOW() WHERE session_id=:as_session_id} ad_form -name show_item_form -action process-response -html {enctype multipart/form-data} -form { - { assessment_id:text {value $assessment_id} } + { as_session_id:text {value $as_session_id} } } #For each item: Index: openacs-4/packages/assessment/www/assessment.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/assessment/www/Attic/assessment.xql,v diff -u -r1.1 -r1.2 --- openacs-4/packages/assessment/www/assessment.xql 21 Sep 2004 15:35:01 -0000 1.1 +++ openacs-4/packages/assessment/www/assessment.xql 22 Sep 2004 15:27:08 -0000 1.2 @@ -8,6 +8,7 @@ FROM (as_sectionsx INNER JOIN (as_assessmentsx INNER JOIN as_assessment_section_map ON as_assessmentsx.assessment_id=as_assessment_section_map.assessment_id) ON as_sectionsx.section_id=as_assessment_section_map.section_id) INNER JOIN (as_itemsx INNER JOIN as_item_section_map ON as_itemsx.as_item_id=as_item_section_map.as_item_id) ON as_sectionsx.section_id=as_item_section_map.section_id WHERE as_assessmentsx.assessment_id=:assessment_id + ORDER BY as_item_section_map.sort_order Index: openacs-4/packages/assessment/www/process-response.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/assessment/www/Attic/process-response.adp,v diff -u -r1.1 -r1.2 --- openacs-4/packages/assessment/www/process-response.adp 15 Sep 2004 19:47:48 -0000 1.1 +++ openacs-4/packages/assessment/www/process-response.adp 22 Sep 2004 15:27:08 -0000 1.2 @@ -1,7 +1,8 @@ -Response Submitted +#assessment.Response_Submitted# @context_bar;noquote@
-

Response submitted Correcly!

+

Response submitted Correctly!

+

#assessment.View_results#

Index: openacs-4/packages/assessment/www/process-response.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/assessment/www/Attic/process-response.tcl,v diff -u -r1.2 -r1.3 --- openacs-4/packages/assessment/www/process-response.tcl 21 Sep 2004 15:07:12 -0000 1.2 +++ openacs-4/packages/assessment/www/process-response.tcl 22 Sep 2004 15:27:08 -0000 1.3 @@ -7,19 +7,23 @@ @author eperez@it.uc3m.es @date 2004-09-12 } { - assessment_id:integer + as_session_id:integer,notnull response_to_item:array,optional,multiple,html } set context_bar [list] -set as_session_id [as_session__get_session_id_from_user_assessment -subject_id [ad_conn user_id] -assessment_id $assessment_id] +# FIXME Check staff_id or subject_id against user_id +db_dml session_finished {UPDATE as_sessions SET last_mod_datetime = NOW(), completed_datetime = NOW() WHERE session_id = :as_session_id} + foreach response_to_item_id [array names response_to_item] { - db_foreach session_responses_to_item {SELECT as_item_datax.item_id FROM (as_item_datax INNER JOIN as_sessionsx ON as_item_datax.session_id = as_sessionsx.session_id) INNER JOIN as_itemsx ON as_item_datax.as_item_id=as_itemsx.as_item_id WHERE as_itemsx.as_item_id=:response_to_item_id AND as_sessionsx.session_id=:as_session_id} { + db_foreach session_responses_to_item {SELECT as_item_datax.item_id FROM as_item_datax WHERE as_item_datax.as_item_id=:response_to_item_id AND as_sessionsx.session_id=:as_session_id} { content::item::delete -item_id $item_id } foreach response $response_to_item($response_to_item_id) { as_item_data_new -session_id $as_session_id -as_item_id $response_to_item_id -choice_id_answer $response } } + +ad_return_template Index: openacs-4/packages/assessment/www/admin/unzip-file.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/assessment/www/admin/Attic/unzip-file.adp,v diff -u -r1.1 -r1.2 --- openacs-4/packages/assessment/www/admin/unzip-file.adp 21 Sep 2004 17:35:40 -0000 1.1 +++ openacs-4/packages/assessment/www/admin/unzip-file.adp 22 Sep 2004 15:27:09 -0000 1.2 @@ -4,5 +4,5 @@ # items imported: @qti_items_imported_number@

Show items -Upload files +Upload files