--- capa/capa51/GUITools/gradesubjective.tcl 1999/12/13 21:38:44 1.9 +++ capa/capa51/GUITools/gradesubjective.tcl 2000/08/07 20:47:29 1.12 @@ -1,3 +1,26 @@ +# grade subjective responses +# Copyright (C) 1992-2000 Michigan State University +# +# The CAPA system is free software; you can redistribute it and/or +# modify it under the terms of the GNU General Public License as +# published by the Free Software Foundation; either version 2 of the +# License, or (at your option) any later version. +# +# The CAPA system is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# General Public License for more details. +# +# You should have received a copy of the GNU General Public +# License along with the CAPA system; see the file COPYING. If not, +# write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, +# Boston, MA 02111-1307, USA. +# +# As a special exception, you have permission to link this program +# with the TtH/TtM library and distribute executables, as long as you +# follow the requirements of the GNU GPL in regard to all of the +# software in the executable aside from TtH/TtM. + set gMaxSet 99 proc gradeSubjective {} { @@ -227,6 +250,11 @@ proc updateSecCount {} { proc subjCheckForNew {} { global gSubj + + foreach file [glob ?????????] { + if { [lsearch $gSubj(stunums) $file] == -1 } { lappend gSubj(stunums) $file } + } + set gSubj(togo) [expr [llength $gSubj(stunums)]-$gSubj(done)] } proc checkGSubj {} { @@ -292,6 +320,8 @@ proc subjInitAllLists {} { incr i set aline [gets $fileId] if { [eof $fileId]} {break} + # skip blank lines + if { [string trim $aline] == "" } { continue } lappend gSubj(allstunum) [string toupper [string range $aline 14 22]] #lappend gSubj(allname) [string toupper [string range $aline 24 59]] lappend gSubj(allname) [string range $aline 24 59] @@ -419,7 +449,8 @@ proc subjFindIds2 {} { set text [string toupper [$gSubj(response) get 0.0 end]] set result "" if { [catch {lsearch $text a}] } { - puts badlist; return subjFindIds1 + #puts badlist + return subjFindIds1 } else { foreach id $gSubj(allstunum) { if { [lsearch -glob $text *$id*] != -1 } { @@ -739,7 +770,7 @@ proc subjGetOneStudent { window path idV ########################################################### ########################################################### proc subjSendResponse {} { - global gSubj + global gSubj gCapaConfig if { "" == [set which [$gSubj(responseList) curselection]]} { displayMessage "Please select a message to send." @@ -755,8 +786,8 @@ proc subjSendResponse {} { set index [lsearch $gSubj(allstunum) $stu] set name [lindex $gSubj(allname) $index] set email [lindex $gSubj(allemail) $index] - puts "$name:[split $name ,]:[lindex [split $name ,] 1]:[lindex [lindex [split $name ,] 1] 0]:$index:$stu" - puts [lsearch $gSubj(allemail) albertel@pilot.msu.edu] + #puts "$name:[split $name ,]:[lindex [split $name ,] 1]:[lindex [lindex [split $name ,] 1] 0]:$index:$stu" + #puts [lsearch $gSubj(allemail) albertel@pilot.msu.edu] set first_name [lindex [lindex [split $name ,] 1] 0] set last_name [lindex [split $name , ] 0] set score $gSubj(score) @@ -765,12 +796,13 @@ proc subjSendResponse {} { regsub -all -- \\\$score $message $score message # set message [subst -nobackslashes -nocommands $gSubj(response.$which)] if { [regexp -- (^Subject:\[^\n\]*)(\n)(.*) $message matchvar subjline newline messagebody] } { - set message "$subjline Class [file tail $gSubj(dir)], Set $gSubj(set), Question $gSubj(quest) \n$messagebody" + set subject "$subjline Class [file tail $gSubj(dir)], Set $gSubj(set), Question $gSubj(quest)" + set message $messagebody } else { - set message "Subject: Class [file tail $gSubj(dir)], Set $gSubj(set), Question $gSubj(quest) \n$message" + set subject "Subject: Class [file tail $gSubj(dir)], Set $gSubj(set), Question $gSubj(quest)" } displayMessage "$message sent to $email" - exec echo $message | mail $email + exec echo $message | $gCapaConfig(mail_command) -s $subject $email } } @@ -852,7 +884,7 @@ proc subjDeleteResponse {} { if { "" == [set which [$gSubj(responseList) curselection]]} { return } incr which if { [catch {unset gSubj(response.$which)}] } { - puts [array names gSubj response.*] + #puts [array names gSubj response.*] return } for {set i [expr $which + 1]} { [info exists gSubj(response.$i)] } {incr i} { @@ -1143,4 +1175,4 @@ proc subjDeleteKeyword {} { } set gSubj(keywords) $newkeyword subjUpdateKeywords -} \ No newline at end of file +}