--- capa/capa51/GUITools/quizzer.tcl 1999/09/28 21:25:36 1.1.1.1 +++ capa/capa51/GUITools/quizzer.tcl 1999/10/13 18:45:28 1.2 @@ -1162,7 +1162,7 @@ proc addDate { listbox } { ########################################################### proc createDBHeader {} { global gNumberParsedText gPrompt gLoadHeaderSet gControlDates \ - gSetNumberText gHeaderQCount + gSetNumberText gHeaderQCount gEnableDiscussion gFile if { $gNumberParsedText == "" } { displayError "You must first preview the file before creating the \ @@ -1182,8 +1182,9 @@ proc createDBHeader {} { message $dialog.msg -text "Header Information" -aspect 1000 set loadFrame [frame $dialog.loadFrame -borderwidth 4 -relief sunken] set infoFrame [frame $dialog.infoFrame -borderwidth 4 -relief sunken] + set optionFrame [frame $dialog.options] set buttonFrame [frame $dialog.buttons -bd 10] - pack $dialog.msg $loadFrame $infoFrame $buttonFrame -side top -fill x + pack $dialog.msg $loadFrame $infoFrame $optionFrame $buttonFrame -side top -fill x set legendFrame [frame $infoFrame.legendFrame] set listFrame [frame $infoFrame.listFrame] @@ -1212,6 +1213,15 @@ proc createDBHeader {} { button $loadFrame.load -text "load" -command "loadDates $listbox" pack $loadFrame.msg $loadFrame.entry $loadFrame.load -side left + if { [file exists [file join [file dirname $gFile] discussion $gSetNumberText]] } { + set gEnableDiscussion 1 + } else { + set gEnableDiscussion 0 + } + checkbutton $optionFrame.discuss -text "Enable Discussion Forum" \ + -variable gEnableDiscussion + pack $optionFrame.discuss + button $buttonFrame.ok -text Set -command { set gPrompt(ok) 1 } \ -underline 0 button $buttonFrame.cancel -text Cancel -command { set gPrompt(ok) 0 } \ @@ -1241,6 +1251,7 @@ proc createDBHeader {} { capaGrab release $dialog destroy $dialog if {$gPrompt(ok) == 1 } { + updateDiscussion eval updateHeader [ eval concat $gControlDates ] } @@ -1249,12 +1260,40 @@ proc createDBHeader {} { } ########################################################### +# updateDiscussion +########################################################### +########################################################### +########################################################### +proc updateDiscussion {} { + global gFile gSetNumberText gEnableDiscussion + set dir [file dirname $gFile] + set disDir [file join $dir discussion $gSetNumberText] + set logDir [file join $dir discussion logs] + if { $gEnableDiscussion } { + if { ![file exists $disDir] } { + if { [file exists $disDir.unavailable] } { + exec mv $disDir.unavailable $disDir + } else { + file mkdir $disDir + file attributes $disDir -permissions 0777 + } + } + if { ![file exists $logDir] } { + file mkdir [file join $dir discussion logs] + file attributes [file join $dir discussion logs] -permissions 0777 + } + } else { + if { [file exists $disDir] } { exec mv $disDir $disDir.unavailable } + } +} + +########################################################### # allFieldsComplete2 ########################################################### ########################################################### ########################################################### proc allFieldsComplete2 {} { - global gLoadHeaderSet gControlDates + global gLoadHeaderSet gControlDates if { [string length $gOpenDate] != 8 } { return 0