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.2 -r1.3 --- openacs-4/packages/assessment/www/asm-admin/export/index.vuh 8 Feb 2005 08:45:04 -0000 1.2 +++ openacs-4/packages/assessment/www/asm-admin/export/index.vuh 11 Feb 2005 17:58:14 -0000 1.3 @@ -35,7 +35,15 @@ set assessment_id1 $assessment_data(assessment_rev_id) +# publish the object to the file system +set in_path [ns_tmpnam] +file mkdir $in_path + +# create a temp dir to put the archive in +set out_path [ns_tmpnam] +file mkdir $out_path + # First create our top-level document #set doc [dom createDocument questestinterop] dom createDocument questestinterop doc @@ -253,6 +261,12 @@ 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 + } elseif {[info exists tb__display_id]} { + db_0or1row item_display_tb_data {} + #abs_size + as::export::element_qtimetadatafield -root $doc -father $qtimetadata -label tb_abs_size -value $tb_abs_size + #item_answer_alignment + as::export::element_qtimetadatafield -root $doc -father $qtimetadata -label item_answer_alignment -value $item_answer_alignment } # open question item @@ -272,20 +286,34 @@ # set presentation [$doc createElement presentation] - $item appendChild $presentation - # - set flow [$doc createElement flow] - $presentation appendChild $flow + $item appendChild $presentation if {![info exists tb__display_id]} { # set material [$doc createElement material] - $flow appendChild $material + $presentation appendChild $material # set mattext [$doc createElement mattext] $material appendChild $mattext set text [$doc createCDATASection $item_title] $mattext appendChild $text + + #content_type: imagen + set content_type "" + + db_0or1row get_content_type_items {} + if {$content_type == "image"} { + # + set matimage [$doc createElement matimage] + $material appendChild $matimage + $matimage setAttribute uri $content_filename + if {![empty_string_p $mime_type]} { + $matimage setAttribute imagtype $mime_type + } + + set cr_path [cr_fs_path $storage_area_key] + file copy -force -- "${cr_path}${cr_file_name}" [file join ${in_path} $content_filename] + } } @@ -302,8 +330,8 @@ set response_lid [$doc createElement response_lid] $response_lid setAttribute ident $item_name $response_lid setAttribute rcardinality $rcardinality - $response_lid setAttribute rtiming "No" - $flow appendChild $response_lid + $response_lid setAttribute rtiming "No" + $presentation appendChild $response_lid # set render_choice [$doc createElement render_choice] $response_lid appendChild $render_choice @@ -319,11 +347,29 @@ # set material [$doc createElement material] $response_label appendChild $material - # - set mattext [$doc createElement mattext] - $material appendChild $mattext - set text [$doc createCDATASection $choice_title] - $mattext appendChild $text + + #content_type: imagen + set content_type "" + db_0or1row get_content_type_choices {} + + if {$content_type == "image"} { + # + set matimage [$doc createElement matimage] + $material appendChild $matimage + $matimage setAttribute uri $content_filename + if {![empty_string_p $mime_type]} { + $matimage setAttribute imagtype $mime_type + } + set cr_path [cr_fs_path $storage_area_key] + file copy -force -- "${cr_path}${cr_file_name}" [file join ${in_path} $content_filename] + + } else { + # + set mattext [$doc createElement mattext] + $material appendChild $mattext + set text [$doc createCDATASection $choice_title] + $mattext appendChild $text + } } } else { #short answer @@ -332,8 +378,8 @@ set response_str [$doc createElement response_str] $response_str setAttribute ident $item_name $response_str setAttribute rcardinality "Single" - $response_str setAttribute rtiming "No" - $flow appendChild $response_str + $response_str setAttribute rtiming "No" + $presentation 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" if {![empty_string_p $html_display_options]} { @@ -367,8 +413,8 @@ for {set i 0} {$i<[llength $item_title1]-1} {incr i 2} { set item_title [lindex $item_title1 $i] # - set material [$doc createElement material] - $flow appendChild $material + set material [$doc createElement material] + $presentation appendChild $material # set mattext [$doc createElement mattext] $material appendChild $mattext @@ -378,8 +424,8 @@ set response_str [$doc createElement response_str] $response_str setAttribute ident $item_name$i $response_str setAttribute rcardinality "Single" - $response_str setAttribute rtiming "No" - $flow appendChild $response_str + $response_str setAttribute rtiming "No" + $presentation appendChild $response_str # set render_fib [$doc createElement render_fib] $render_fib setAttribute fibtype "String" @@ -639,22 +685,14 @@ append outfd "" append outfd [$root asXML] -# publish the object to the file system -set in_path [ns_tmpnam] -file mkdir $in_path - # store the tree xml into a file set file_name "$in_path/$assessment_data(title).xml" set file [open $file_name w 0600] puts $file $outfd close $file -# create a temp dir to put the archive in -set out_path [ns_tmpnam] -file mkdir $out_path - set out_file [file join ${out_path} ${download_name}] - + # get the archive command # TODO SECURITY DONT USE GLOBBING set cmd "zip -r -9 -X '$out_file' *" 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.2 -r1.3 --- openacs-4/packages/assessment/www/asm-admin/export/index.xql 8 Feb 2005 08:45:04 -0000 1.2 +++ openacs-4/packages/assessment/www/asm-admin/export/index.xql 11 Feb 2005 17:58:14 -0000 1.3 @@ -71,6 +71,14 @@ + + + SELECT html_display_options, abs_size as tb_abs_size, item_answer_alignment + FROM as_item_display_tb + WHERE as_item_display_id=:item_display_id + + + @@ -85,6 +93,35 @@ + + + select r2.revision_id as content_rev_id, r2.title as content_filename, r2.content as cr_file_name, r2.mime_type, i.content_type, i.storage_area_key + from cr_revisions r2, cr_items i + where i.item_id = r2.item_id + and i.latest_revision = r2.revision_id + and r2.revision_id IN ( + select target_rev_id + from as_item_rels + where rel_type = 'as_item_content_rel' + and item_rev_id = :as_item_id + ) + + + + + + select r2.revision_id as content_rev_id, r2.title as content_filename, r2.mime_type, r2.content as cr_file_name, i.content_type, i.storage_area_key + from cr_revisions r2, cr_items i + where i.item_id = r2.item_id + and i.latest_revision = r2.revision_id + and r2.revision_id IN ( + select aic.content_value + from as_item_choices aic + where aic.choice_id = :choice_id ) + + + + SELECT i.as_item_type_id AS id__as_item_type_oq, i.default_value, i.feedback_text