Index: openacs-4/packages/assessment/tcl/as-export-procs.tcl
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/assessment/tcl/as-export-procs.tcl,v
diff -u
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ openacs-4/packages/assessment/tcl/as-export-procs.tcl 8 Feb 2005 08:49:06 -0000 1.1
@@ -0,0 +1,72 @@
+ad_library {
+ Export procs
+ @author nperper@it.uc3m.es
+ @creation-date 2005-02-01
+}
+
+namespace eval as::export {}
+
+ad_proc -public as::export::new_element {
+ {-value ""}
+ {-father ""}
+ {-label ""}
+ {-root ""}
+ {-material_p "f"}
+ {-attribute_label ""}
+ {-attribute_value ""}
+} {
+ @author Natalia P�rez (nperper@it.uc3m.es)
+ @creation-date 2004-02-01
+
+ New element
+} {
+ #create a new element named "label" and child of "father", with attribute_label=attribute_value
+ if {![empty_string_p $value]} {
+ set label [$root createElement $label]
+ $father appendChild $label
+ if {![empty_string_p $attribute_label]} {
+ $label setAttribute $attribute_label $attribute_value
+ }
+ if {$material_p == "t"} {
+ set material [$root createElement material]
+ $label appendChild $material
+ set mattext [$root createElement mattext]
+ $material appendChild $mattext
+ set text [$root createCDATASection $value]
+ $mattext appendChild $text
+ } else {
+ set text [$root createCDATASection $value]
+ $label appendChild $text
+ }
+ }
+}
+
+
+ad_proc -public as::export::element_qtimetadatafield {
+ {-root ""}
+ {-father ""}
+ {-label ""}
+ {-value ""}
+} {
+ @author Natalia P�rez (nperper@it.uc3m.es)
+ @creation-date 2004-02-03
+
+ New element qtimetadatafield
+} {
+ #create an element
+ if {![empty_string_p $value]} {
+ #
+ set qtimetadatafield [$root createElement qtimetadatafield]
+ $father appendChild $qtimetadatafield
+ #
+ set fieldlabel [$root createElement fieldlabel]
+ $qtimetadatafield appendChild $fieldlabel
+ set text [$root createCDATASection $label]
+ $fieldlabel appendChild $text
+ #
+ set fieldentry [$root createElement fieldentry]
+ $qtimetadatafield appendChild $fieldentry
+ set text [$root createCDATASection $value]
+ $fieldentry appendChild $text
+ }
+}
\ No newline at end of file
Index: openacs-4/packages/assessment/www/asm-admin/export/index.vuh
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/assessment/www/asm-admin/export/index.vuh,v
diff -u -r1.1 -r1.2
--- openacs-4/packages/assessment/www/asm-admin/export/index.vuh 1 Feb 2005 22:05:51 -0000 1.1
+++ openacs-4/packages/assessment/www/asm-admin/export/index.vuh 8 Feb 2005 08:45:04 -0000 1.2
@@ -33,7 +33,7 @@
# Get the assessment data
as::assessment::data -assessment_id $assessment_id
-set assessment_id $assessment_data(assessment_rev_id)
+set assessment_id1 $assessment_data(assessment_rev_id)
# First create our top-level document
@@ -47,50 +47,113 @@
$assessment setAttribute ident $assessment_data(name)
$root appendChild $assessment
-if {![empty_string_p $assessment_data(description)]} {
- #
- set qticomment [$doc createElement qticomment]
- $assessment appendChild $qticomment
- set text [$doc createCDATASection $assessment_data(description)]
- $qticomment appendChild $text
- #
- set objectives [$doc createElement objectives]
- $assessment appendChild $objectives
- #
- set material [$doc createElement material]
- $objectives appendChild $material
- set mattext [$doc createElement mattext]
- $material appendChild $mattext
- set text [$doc createCDATASection $assessment_data(description)]
- $mattext appendChild $text
-}
+#
+as::export::new_element -value $assessment_data(description) -father $assessment -label qticomment -root $doc
+#, time_for_response
+as::export::new_element -value $assessment_data(time_for_response) -father $assessment -label duration -root $doc
+#
+if {![empty_string_p $assessment_data(run_mode)] || ![empty_string_p $assessment_data(anonymous_p)] || ![empty_string_p $assessment_data(secure_access_p)] || ![empty_string_p $assessment_data(reuse_responses_p)] || ![empty_string_p $assessment_data(show_item_name_p)] || ![empty_string_p $assessment_data(consent_page)] || ![empty_string_p $assessment_data(return_url)] || ![empty_string_p $assessment_data(start_time)] || ![empty_string_p $assessment_data(end_time)] || ![empty_string_p $assessment_data(number_tries)] || ![empty_string_p $assessment_data(wait_between_tries)] || ![empty_string_p $assessment_data(time_for_response)] || ![empty_string_p $assessment_data(ip_mask)] || ![empty_string_p $assessment_data(show_feedback)] || ![empty_string_p $assessment_data(section_navigation)]} {
-if {![empty_string_p $assessment_data(instructions)]} {
- #
- set rubric [$doc createElement rubric]
- $assessment appendChild $rubric
- #
- set material [$doc createElement material]
- $rubric appendChild $material
- set mattext [$doc createElement mattext]
- $material appendChild $mattext
- set text [$doc createCDATASection $assessment_data(instructions)]
- $mattext appendChild $text
+ set qtimetadata [$doc createElement qtimetadata]
+ $assessment appendChild $qtimetadata
+ #run_mode
+ as::export::element_qtimetadatafield -root $doc -father $qtimetadata -label run_mode -value $assessment_data(run_mode)
+ #anonymous_p
+ as::export::element_qtimetadatafield -root $doc -father $qtimetadata -label anonymous_p -value $assessment_data(anonymous_p)
+ #secure_access_p
+ as::export::element_qtimetadatafield -root $doc -father $qtimetadata -label secure_access_p -value $assessment_data(secure_access_p)
+ #reuse_responses_p
+ as::export::element_qtimetadatafield -root $doc -father $qtimetadata -label reuse_responses_p -value $assessment_data(reuse_responses_p)
+ #show_item_name_p
+ as::export::element_qtimetadatafield -root $doc -father $qtimetadata -label show_item_name_p -value $assessment_data(show_item_name_p)
+ #consent_page
+ as::export::element_qtimetadatafield -root $doc -father $qtimetadata -label consent_page -value $assessment_data(consent_page)
+ #return_url
+ as::export::element_qtimetadatafield -root $doc -father $qtimetadata -label return_url -value $assessment_data(return_url)
+ #start_time
+ as::export::element_qtimetadatafield -root $doc -father $qtimetadata -label start_time -value $assessment_data(start_time)
+ #end_time
+ as::export::element_qtimetadatafield -root $doc -father $qtimetadata -label end_time -value $assessment_data(end_time)
+ #number_tries
+ as::export::element_qtimetadatafield -root $doc -father $qtimetadata -label number_tries -value $assessment_data(number_tries)
+ #wait_between_tries
+ as::export::element_qtimetadatafield -root $doc -father $qtimetadata -label wait_between_tries -value $assessment_data(wait_between_tries)
+ #ip_mask
+ as::export::element_qtimetadatafield -root $doc -father $qtimetadata -label ip_mask -value $assessment_data(ip_mask)
+ #show_feedback
+ as::export::element_qtimetadatafield -root $doc -father $qtimetadata -label show_feedback -value $assessment_data(show_feedback)
+ #section_navigation
+ as::export::element_qtimetadatafield -root $doc -father $qtimetadata -label section_navigation -value $assessment_data(section_navigation)
}
+#
+as::export::new_element -value $assessment_data(description) -father $assessment -label objectives -root $doc -material_p t
+
#
set assessmentcontrol [$doc createElement assessmentcontrol]
-$assessmentcontrol setAttribute feedbackswitch "No"
+if { $assessment_data(show_feedback) == "none" } {
+ $assessmentcontrol setAttribute feedbackswitch "No"
+} else {
+ $assessmentcontrol setAttribute feedbackswitch "Yes"
+}
$assessmentcontrol setAttribute solutionswitch "No"
$assessment appendChild $assessmentcontrol
+#
+as::export::new_element -value $assessment_data(instructions) -father $assessment -label rubric -root $doc -material_p t
db_multirow sections query_all_sections {} {
#
set section [$doc createElement section]
$section setAttribute title $section_title
$section setAttribute ident $section_name
$assessment appendChild $section
+ #
+ as::export::new_element -value $section_description -father $section -label qticomment -root $doc
+
+ #
+ set section_display_type ""
+ set s_num_items ""
+ set s_adp_chunk ""
+ set s_branched_p ""
+ set s_back_button_p ""
+ set s_submit_answer_p ""
+ set s_sort_order_type ""
+ db_0or1row section_display_data {}
+
+ #
+ as::export::new_element -value $section_max_time_to_complete -father $section -label duration -root $doc
+
+ if {![empty_string_p $section_num_items] || ![empty_string_p $section_points] || ![empty_string_p $section_display_type] || ![empty_string_p $s_num_items] || ![empty_string_p $s_adp_chunk] || ![empty_string_p $s_branched_p] || ![empty_string_p $s_back_button_p] || ![empty_string_p $s_submit_answer_p] || ![empty_string_p $s_sort_order_type]} {
+ set qtimetadata [$doc createElement qtimetadata]
+ $section appendChild $qtimetadata
+ #num_items
+ as::export::element_qtimetadatafield -root $doc -father $qtimetadata -label num_items -value $section_num_items
+ #points
+ as::export::element_qtimetadatafield -root $doc -father $qtimetadata -label points -value $section_points
+ #display_type
+ as::export::element_qtimetadatafield -root $doc -father $qtimetadata -label display_type -value $section_display_type
+ #s_num_items
+ as::export::element_qtimetadatafield -root $doc -father $qtimetadata -label s_num_items -value $s_num_items
+ #adp_chunk
+ as::export::element_qtimetadatafield -root $doc -father $qtimetadata -label adp_chunk -value $s_adp_chunk
+ #branched_p
+ as::export::element_qtimetadatafield -root $doc -father $qtimetadata -label branched_p -value $s_branched_p
+ #back_button_p
+ as::export::element_qtimetadatafield -root $doc -father $qtimetadata -label back_button_p -value $s_back_button_p
+ #submit_answer_p
+ as::export::element_qtimetadatafield -root $doc -father $qtimetadata -label submit_answer_p -value $s_submit_answer_p
+ #sort_order_type
+ as::export::element_qtimetadatafield -root $doc -father $qtimetadata -label sort_order_type -value $s_sort_order_type
+ }
+
+ #
+ as::export::new_element -value $section_description -father $section -label objectives -root $doc -material_p t
+ #
+ as::export::new_element -value $section_instructions -father $section -label rubric -root $doc -material_p t
+ #
+ as::export::new_element -value $section_feedback_text -father $section -label sectionfeedback -root $doc -material_p t -attribute_label ident -attribute_value $section_id
+
#
set selection_ordering [$doc createElement selection_ordering]
$section appendChild $selection_ordering
@@ -133,20 +196,80 @@
set item [$doc createElement item]
$item setAttribute ident $item_name
$section appendChild $item
- if {![empty_string_p $item_subtext]} {
- #
- set objectives [$doc createElement objectives]
- $item appendChild $objectives
- #
- set material [$doc createElement material]
- $objectives appendChild $material
- #
- set mattext [$doc createElement mattext]
- $material appendChild $mattext
- set text [$doc createCDATASection $item_subtext]
- $mattext appendChild $text
- }
+
+ #
+ as::export::new_element -value $item_description -father $item -label qticomment -root $doc
+ #
+ as::export::new_element -value $item_max_time_to_complete -father $item -label duration -root $doc
+ if {![empty_string_p $item_field_code] || ![empty_string_p $item_required_p] || ![empty_string_p $item_points] || ![empty_string_p $item_data_type]} {
+ set itemmetadata [$doc createElement itemmetadata]
+ $item appendChild $itemmetadata
+ set qtimetadata [$doc createElement qtimetadata]
+ $itemmetadata appendChild $qtimetadata
+ #field_code
+ as::export::element_qtimetadatafield -root $doc -father $qtimetadata -label field_code -value $item_field_code
+ #required_p
+ as::export::element_qtimetadatafield -root $doc -father $qtimetadata -label required_p -value $item_required_p
+ #points
+ as::export::element_qtimetadatafield -root $doc -father $qtimetadata -label points -value $item_points
+ #data_type
+ as::export::element_qtimetadatafield -root $doc -father $qtimetadata -label data_type -value $item_data_type
+
+ #multiple response or multiple choice items
+ if {[info exists cb__display_id] || [info exists rb__display_id]} {
+ #as_item_type_mc-----------------
+ db_0or1row item_type_data {}
+ #increasing_p
+ as::export::element_qtimetadatafield -root $doc -father $qtimetadata -label increasing_p -value $increasing_p
+ #allow_negative_p
+ as::export::element_qtimetadatafield -root $doc -father $qtimetadata -label allow_negative_p -value $allow_negative_p
+ #num_correct_answers
+ as::export::element_qtimetadatafield -root $doc -father $qtimetadata -label num_correct_answers -value $num_correct_answers
+ #num_answers
+ as::export::element_qtimetadatafield -root $doc -father $qtimetadata -label num_answers -value $num_answers
+
+ #as_item_display_rb
+ if {[info exists rb__display_id]} {
+ db_0or1row item_display_rb_data { }
+ } else {
+ db_0or1row item_display_cb_data { }
+ }
+
+ #html_display_options
+ as::export::element_qtimetadatafield -root $doc -father $qtimetadata -label html_display_options -value $html_display_options
+ #choice_orientation
+ as::export::element_qtimetadatafield -root $doc -father $qtimetadata -label choice_orientation -value $choice_orientation
+ #choice_label_orientation
+ as::export::element_qtimetadatafield -root $doc -father $qtimetadata -label choice_label_orientation -value $choice_label_orientation
+ #sort_order_type
+ as::export::element_qtimetadatafield -root $doc -father $qtimetadata -label sort_order_type -value $sort_order_type
+ #item_answer_alignment
+ as::export::element_qtimetadatafield -root $doc -father $qtimetadata -label item_answer_alignment -value $item_answer_alignment
+
+ } elseif {[info exists ta__display_id]} {
+ db_0or1row item_display_ta_data {}
+ #abs_size
+ as::export::element_qtimetadatafield -root $doc -father $qtimetadata -label abs_size -value $abs_size
+ #item_answer_alignment
+ as::export::element_qtimetadatafield -root $doc -father $qtimetadata -label item_answer_alignment -value $item_answer_alignment
+ }
+
+ # open question item
+ db_0or1row as_item_oq { }
+ if {[info exists id__as_item_type_oq]} {
+ #default_value
+ as::export::element_qtimetadatafield -root $doc -father $qtimetadata -label default_value -value $default_value
+ #feedback_text
+ as::export::element_qtimetadatafield -root $doc -father $qtimetadata -label feedback_text -value $feedback_text
+ }
+ }
+
+ #
+ as::export::new_element -value $item_description -father $item -label objectives -root $doc -material_p t
+ #
+ as::export::new_element -value $item_subtext -father $item -label rubric -root $doc -material_p t
+
#
set presentation [$doc createElement presentation]
$item appendChild $presentation
@@ -213,8 +336,13 @@
$flow appendChild $response_str
#get rows and cols for painting a textarea (in abs_size is stored as "rows value cols value", we need to add the symbol =)
db_0or1row html_rows_cols "SELECT html_display_options FROM as_item_display_ta WHERE as_item_display_id=:item_display_id"
- set rows "[lindex $html_display_options 1]"
- set columns "[lindex $html_display_options 3]"
+ if {![empty_string_p $html_display_options]} {
+ set rows "[lindex $html_display_options 1]"
+ set columns "[lindex $html_display_options 3]"
+ } else {
+ set rows 5
+ set columns 25
+ }
#
set render_fib [$doc createElement render_fib]
$render_fib setAttribute fibtype "String"
@@ -271,6 +399,13 @@
#
set resprocessing [$doc createElement resprocessing]
$item appendChild $resprocessing
+ #
+ set outcomes [$doc createElement outcomes]
+ $resprocessing appendChild $outcomes
+ #decvar
+ set decvar [$doc createElement decvar]
+ $outcomes appendChild $decvar
+ $decvar setAttribute vartype "Integer"
#
set respcondition [$doc createElement respcondition]
$resprocessing appendChild $respcondition
@@ -355,10 +490,13 @@
#
set not [$doc createElement not]
$conditionvar appendChild $not
+ #
+ set and [$doc createElement and]
+ $not appendChild $and
db_foreach query_all_choices {} {
#
set or [$doc createElement or]
- $not appendChild $or
+ $and appendChild $or
set list_choice_title $choice_title
for {set j 0} {$j < [llength $list_choice_title]} {incr j 1} {
#
@@ -473,18 +611,9 @@
set ident { }
append ident $item_name displayWrong
$itemfeedback setAttribute ident $ident
- $item appendChild $itemfeedback
+ $item appendChild $itemfeedback
#
- set flow_mat [$doc createElement flow_mat]
- $itemfeedback appendChild $flow_mat
- #
- set material [$doc createElement material]
- $flow_mat appendChild $material
- #
- set mattext [$doc createElement mattext]
- $material appendChild $mattext
- set text [$doc createCDATASection $item_feedback_wrong]
- $mattext appendChild $text
+ as::export::new_element -value $item_feedback_wrong -father $itemfeedback -label flow_mat -root $doc -material_p t
}
#feedback_right
@@ -496,16 +625,7 @@
$itemfeedback setAttribute ident $ident
$item appendChild $itemfeedback
#
- set flow_mat [$doc createElement flow_mat]
- $itemfeedback appendChild $flow_mat
- #
- set material [$doc createElement material]
- $flow_mat appendChild $material
- #
- set mattext [$doc createElement mattext]
- $material appendChild $mattext
- set text [$doc createCDATASection $item_feedback_right]
- $mattext appendChild $text
+ as::export::new_element -value $item_feedback_right -father $itemfeedback -label flow_mat -root $doc -material_p t
}
}
@@ -515,8 +635,8 @@
#puts [$root asXML]
-set outfd ""
-append outfd ""
+set outfd ""
+append outfd ""
append outfd [$root asXML]
# publish the object to the file system
Index: openacs-4/packages/assessment/www/asm-admin/export/index.xql
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/assessment/www/asm-admin/export/index.xql,v
diff -u -r1.1 -r1.2
--- openacs-4/packages/assessment/www/asm-admin/export/index.xql 1 Feb 2005 22:05:51 -0000 1.1
+++ openacs-4/packages/assessment/www/asm-admin/export/index.xql 8 Feb 2005 08:45:04 -0000 1.2
@@ -3,18 +3,18 @@
- SELECT s.section_id, s.name as section_name, s.title as section_title, s.description as section_description, s.instructions as section_instructions, s.feedback_text as section_feedback_text, s.max_time_to_complete as section_max_time_to_complete
+ SELECT s.section_id, s.name as section_name, s.title as section_title, s.description as section_description, s.instructions as section_instructions, s.feedback_text as section_feedback_text, s.max_time_to_complete as section_max_time_to_complete, s.num_items as section_num_items, s.points as section_points
FROM as_sectionsx s, as_assessment_section_map asm, as_assessmentsx a
WHERE s.section_id = asm.section_id
AND asm.assessment_id = a.assessment_id
- AND a.assessment_id = :assessment_id
+ AND a.assessment_id = :assessment_id1
ORDER BY s.section_id
- SELECT i.as_item_id, i.title as item_title, i.name as item_name, i.description as item_description, i.subtext as item_subtext, i.field_code as item_field_code, i.required_p as item_required_p, i.data_type as item_data_type, i.max_time_to_complete as item_max_time_to_complete, i.feedback_right as item_feedback_right, i.feedback_wrong as item_feedback_wrong
+ SELECT i.as_item_id, i.title as item_title, i.name as item_name, i.description as item_description, i.subtext as item_subtext, i.field_code as item_field_code, i.required_p as item_required_p, i.data_type as item_data_type, i.max_time_to_complete as item_max_time_to_complete, i.feedback_right as item_feedback_right, i.feedback_wrong as item_feedback_wrong, i.points as item_points
FROM as_itemsx i, as_item_section_map ism
WHERE i.as_item_id = ism.as_item_id AND ism.section_id = :section_id
ORDER BY ism.sort_order
@@ -39,4 +39,60 @@
+
+
+ SELECT asdt.title as section_display_type, asdt.num_items as s_num_items, asdt.adp_chunk as s_adp_chunk, asdt.branched_p as s_branched_p, asdt.back_button_p as s_back_button_p, asdt.submit_answer_p as s_submit_answer_p, asdt.sort_order_type as s_sort_order_type
+ FROM as_section_display_typesx asdt, as_sectionsx s
+ WHERE asdt.display_type_id = s.display_type_id AND s.section_id = :section_id
+
+
+
+
+
+ SELECT html_display_options, choice_orientation, choice_label_orientation, sort_order_type, item_answer_alignment
+ FROM as_item_display_rb
+ WHERE as_item_display_id=:item_display_id
+
+
+
+
+
+ SELECT html_display_options, choice_orientation, choice_label_orientation, sort_order_type, item_answer_alignment
+ FROM as_item_display_cb
+ WHERE as_item_display_id=:item_display_id
+
+
+
+
+
+ SELECT html_display_options, abs_size, item_answer_alignment
+ FROM as_item_display_ta
+ WHERE as_item_display_id=:item_display_id
+
+
+
+
+
+
+ select r.title, i.increasing_p, i.allow_negative_p, i.num_correct_answers,
+ i.num_answers
+ from cr_revisions r, as_item_rels ir, as_item_type_mc i
+ where r.revision_id = i.as_item_type_id
+ and i.as_item_type_id = ir.target_rev_id
+ and ir.item_rev_id = :as_item_id
+ and ir.rel_type = 'as_item_type_rel'
+
+
+
+
+
+
+ SELECT i.as_item_type_id AS id__as_item_type_oq, i.default_value, i.feedback_text
+ from cr_revisions r, as_item_rels ir, as_item_type_oq i
+ where r.revision_id = i.as_item_type_id
+ and i.as_item_type_id = ir.target_rev_id
+ and ir.item_rev_id = :as_item_id
+ and ir.rel_type = 'as_item_type_rel'
+
+