proc export {} {
global problem
set file [ tk_getSaveFile -defaultextension .qz \
-filetypes {{{Quizzer file} {.qz}}} ]
if { $file == "" } {
tk_messageBox -icon info -type ok -message "Information not saved"
return
}
set fileid [open $file "w"]
exportQZHeader $fileid
for { set i 1 } { $i <= $problem(num) } { incr i } {
switch $problem(prob.$i.type) {
"Multiple Choice"
{
MCexportHeader $fileid $i
MCexportLeafs $fileid $i
MCexportAns $fileid $i
}
-
{
tk_messageBox -icon error \
-message "Problem type $problem(prob.$i.type) not supported" \
-type ok
}
}
}
exportQZFooter $fileid
close $fileid
tk_messageBox -icon info -message "Exported to $file" -type ok
}
proc exportQZHeader { fileid } {
global problem
puts $fileid "//Created by HACK GUI to qz files"
puts $fileid "//CAPA system software is copyrighted by Michigan State University."
puts $fileid "//"
puts $fileid "/IMP \"../Tools/StdMacros\""
puts $fileid "/IMP \"../Tools/StdUnits\""
if { $problem(includes) != "" } {
}
puts $fileid "/IMP \"HWTop\""
}
proc exportQZFooter { fileid } {
global problem
puts $fileid "//*********************"
puts $fileid "/END($problem(endline))"
}
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>