You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

879 lines
30 KiB

#!/usr/bin/perl
#
# $Id: tmasterp.pl,v 1.5 2006/10/17 14:39:59 ddoughty Exp $
#
# Source File: tmasterp.pl
# Get config
require 'sitecfg.pl';
require 'testlib.pl';
$FORM{'frm'}="";
&app_initialize;
if ($FORM{'outputto'} eq 'html') {
print "Content-Type: application/x-doc\n\n";
$bDisplay = 0;
} else {
print "Content-Type: text/html\n\n";
$bDisplay = 1;
}
if (&get_session($FORM{'tid'})) {
&LanguageSupportInit();
if ($FORM{'clid'} eq '') {
&get_client_profile($SESSION{'clid'});
&get_candidate_profile( $SESSION{'clid'}, $FORM{'cndid'});
} else {
&get_client_profile($FORM{'clid'});
&get_candidate_profile( $FORM{'clid'}, $FORM{'cndid'});
}
&get_test_profile($CLIENT{'clid'}, $FORM{'tstid'});
&get_test_sequence( $CLIENT{'clid'}, $CANDIDATE{'uid'}, $TEST{'id'}, $testpending);
&CreateMasters();
}
sub CreateMasters() {
if ($TEST{'seq'} eq 'svy') {
@skilllevel = ( '','','','' );
$itemdescription = "Survey";
} else {
@skilllevel = ( 'Basic','Intermediate','Advanced','' );
$itemdescription = "Test";
}
$oshowqid = ($FORM{'showqid'} ne '') ? 1 : 0;
$oshowsubj = ($FORM{'showsubj'} ne '') ? 1 : 0;
$oshowskill = ($FORM{'showskill'} ne '') ? 1 : 0;
$oautoprint = ($FORM{'outputto'} eq 'autoprint') ? 1 : 0;
$oblackoutthrowoffs = ($FORM{'blackoutthrowoffs'} ne '') ? 1 : 0;
$onoradios = ($FORM{'noradios'} ne '') ? 1 : 0;
$tcolor=$FORM{'ocrtextcolor'};
$printwidth = 640;
$titlewidth = 260;
$titlecolwidth = 190;
if ($FORM{'prtwidth'} ne '') {
$printwidth = int($FORM{'prtwidth'});
$titlewidth = int($printwidth / 2);
$titlecolwidth = int($titlewidth / 2);
if ($titlecolwidth < 170) {
$titlewidth = int($printwidth - ($titlecolwidth * 2));
}
}
$refpage = ($FORM{'showgraphics'} eq 'refpage') ? 1 : 0;
if ($refpage) {
$showgraphics = 1;
} else {
$showgraphics = ($FORM{'showgraphics'} eq 'ON') ? 1 : 0;
}
$ocrstyle=($FORM{'ocrstyle'} ne '') ? 1 : 0;
if ($ocrstyle) {
$scoreboxwarning = "MARK THE CIRCLES UNDER THE CORRECT ANSWER LABEL FOR EACH QUESTION USING A \#2 LEAD PENCIL ONLY.";
} else {
$printscoreboxes = ($FORM{'showscoreboxes'} ne '') ? 1 : 0;
$scoreboxwarning = ($printscoreboxes) ? "DO NOT MARK BOXES TO THE RIGHT OF THE QUESTION. (FOR SCORING USE ONLY)" : "";
}
if ($FORM{'showdates'} ne '') {
$testavailabilitydates = "Take On/After:<BR>$TEST{'availon'}<BR>Take On/Before:<BR>$TEST{'availthru'} <BR>\n";
} else {
$testavailabilitydates = "";
}
@questions = split(/&/,$SUBTEST_QUESTIONS{2});
@keyanswers = split(/&/,$SUBTEST_ANSWERS{2});
$masterid = 1;
$timed = ($TEST{'tmd'} eq 'Y') ? "Allotted Time: $TEST{'maxtm'} mins" : "";
$testmasterdir = join($pathsep, $secroot, "tests", "master");
if ($oautoprint) {
print "<HTML>
<HEAD>
<SCRIPT LANGUAGE=\"JavaScript\">
<!--
function onWdwLoad() {
window.print();
history.back();
}
// -->
</SCRIPT>
</HEAD>
<BODY onLoad=\"onWdwLoad()\">\n";
} else {
print "<HTML>
<HEAD>
</HEAD>
<BODY>\n";
}
if ($ocrstyle) {
@ocrsheets=();
$ocrsheets[0] = ($FORM{'showmaster'} ne '') ? 1 : 0;
$ocrsheets[1] = ($FORM{'showocransw'} ne '') ? 1 : 0;
$ocrsheets[2] = ($FORM{'showkey'} ne '') ? 1 : 0;
for (0 .. 2) {
$keyprint = (($ocrsheets[$_]) && ($_ == 2)) ? 1 : 0;
if ($ocrsheets[$_]) {
$ocrsheetno=$_;
if ($ocrsheetno > 0) {
$textcolor="color=\"$tcolor\"";
$bordercolor="bordercolor=\"$tcolor\"";
$scoreboxwarning = "MARK THE CIRCLES UNDER THE CORRECT ANSWER LABEL FOR EACH QUESTION USING A \#2 LEAD PENCIL ONLY.";
$keyhdr = ($keyprint) ? "KEY" : "ANSWER SHEET";
} else {
$textcolor="black";
$bordercolor="black";
$scoreboxwarning = "DO NOT MARK ON THIS PAGE. USE THE ANSWER SHEET TO MARK ALL ANSWERS WITH A \#2 PENCIL.";
}
if (($ocrstyle) && ($ocrsheetno > 0)) {
&PrintPageHeader();
&PrintSectionHeader();
&PrintQuestionsOCR();
&PrintSection();
} else {
$keyhdr = ($keyprint) ? "KEY" : "";
@pagequestions = &PrintQuestions();
if (($refpage == 1) && ($referencepage ne '')) {
$referencepage = join('', "<!--NEW-PAGE-->\n", $referencepage);
}
&PrintPageHeader();
&PrintSectionHeader();
for (0 .. $#pagequestions) {
print $pagequestions[$_];
print "<TR><TD>\&nbsp\;<BR></TD></TR>\n";
}
}
@pagequestions = ();
print "</TABLE>\n$referencepage\n";
if ($bDisplay) {
print "</FORM>\n";
}
}
}
} else {
$ocrsheetno=-1;
$textcolor="black";
$bordercolor="black";
$keyprint = ($FORM{'showkey'} ne '') ? 1 : 0;
$printsheet = ($FORM{'showmaster'} ne '') ? 1 : 0;
$keyhdr = ($keyprint) ? "KEY" : "";
@pagequestions = &PrintQuestions();
if (($refpage == 1) && ($referencepage ne '')) {
$referencepage = join('', "<!--NEW-PAGE-->\n", $referencepage);
}
&PrintPageHeader();
&PrintSectionHeader();
for (0 .. $#pagequestions) {
print $pagequestions[$_];
print "<TR><TD>\&nbsp\;<BR></TD></TR>\n";
}
@pagequestions = ();
print "</TABLE>\n$referencepage\n";
if ($bDisplay) {
print "</FORM>\n";
}
}
print "
</BODY>
</HTML>
";
}
sub PrintPageHeader {
if ($bDisplay) {
print "<FORM name=\"form1\" method=\"POST\">
<input type=hidden name=\"tid\" value=\"$SESSION{'tid'}\">
<input type=hidden name=\"masterno\" value=\"$masterid\">
<input type=hidden name=\"cndid\" value=\"$CANDIDATE{'uid'}\">
<input type=hidden name=\"tstid\" value=\"$TEST{'id'}\">
<input type=hidden name=\"pageno\" value=\"$pageno\">
";
}
print "<CENTER>
<TABLE cellpadding=0 cellspacing=0 border=1 width=$printwidth $bordercolor>
<TR>
<TD colspan=2 valign=top width=$titlecolwidth>
<font size=2 $textcolor><B>
Master: $TEST{'id'}.001<BR>
Questions: $#questions<BR>
$timed
</B></font>
</TD>
<TD align=center valign=middle width=$titlewidth>
<font size=4 $textcolor><B>$TEST{'desc'}<BR>$keyhdr</B></font>
</TD>
<TD align=right valign=top width=$titlecolwidth>
<font size=2 $textcolor><B>
Taker ID: $CANDIDATE{'uid'}<BR>
$testavailabilitydates
</B></font>
</TD>
</TR>
</TABLE>
<TABLE cellpadding=0 cellspacing=0 border=0 width=$printwidth $bordercolor>
<TR><TD colspan=8><FONT SIZE=1 $textcolor>\&nbsp\;<BR></FONT></TD></TR>
<TR>
<TD align=right valign=middle>
<font $textcolor>
<B>Date:\&nbsp\;</B>
</font>
</TD>
<TD valign=middle>
<B>";
if ($bDisplay) {
print "<input type=textbox size=10></B>";
} else {
print "____________";
}
print "
</TD>
<TD valign=middle>
<B>\&nbsp\;</B>
</TD>
<TD align=right valign=middle>
<font $textcolor>
<B>Name:\&nbsp\;</B>
</font>
</TD>
<TD valign=middle>";
if ($bDisplay) {
print "<B><input type=textbox size=27></B>";
} else {
print "______________________________";
}
print "
</TD>
<TD valign=middle>
<font $textcolor>
<B>\&nbsp\;</B>
</font>
</TD>
<TD align=right valign=middle>
<font $textcolor>
<B>Email:\&nbsp\;</B>
</font>
</TD>
<TD align=left valign=middle>";
if ($bDisplay) {
print "<B><input type=textbox size=25></B>";
} else {
print "______________________________";
}
print "
</TD>
</TR>
<TR>
<TD colspan=8 align=center valign=middle>
<FONT SIZE=1 $textcolor><B>$scoreboxwarning</B></FONT>
</TD>
</TR>
</TABLE>
";
}
sub PrintSectionHeader {
my $noq=$#questions;
if (($ocrstyle) && ($ocrsheetno != 0)) {
@ocrcoltbl0=();
@ocrcoltbl1=();
@ocrcoltbl2=();
$ocrcolumns = int($noq/50);
my $vernoq = $ocrcolumns*50;
if ($vernoq != $noq) {
$ocrcolumns++;
}
$ocrtblwidth=510/$ocrcolumns;
print "<TABLE cellpadding=0 cellspacing=0 border=1 width=$printwidth $bordercolor>\n";
} else {
print "<TABLE cellpadding=0 cellspacing=0 border=0 width=$printwidth $bordercolor>
<TR>
<TD width=30><font size=1 $textcolor>&nbsp;<br></TD>
<TD width=275><font size=1 $textcolor>&nbsp;<br></TD>
<TD width=275><font size=1 $textcolor>&nbsp;<br></TD>
<TD width=60><font size=1 $textcolor>&nbsp;<br></TD>
</TR>
<TR><TD colspan=4 $textcolor><HR WIDTH=$printwidth></TD></TR>
";
}
}
sub PrintSection {
if ($ocrstyle) {
my $i;
print "<TR>\n<TD>\n";
print "<TABLE cellpadding=0 cellspacing=0 border=0 width=$ocrtblwidth $bordercolor>\n";
for $i (0 .. $#ocrcoltbl0) {
print "$ocrcoltbl0[$i]";
}
print "</TABLE>\n</TD>\n";
if ($ocrcolumns > 1) {
print "<TD>\n";
print "<TABLE cellpadding=0 cellspacing=0 border=0 width=$ocrtblwidth $bordercolor>\n";
for $i (0 .. $#ocrcoltbl1) {
print "$ocrcoltbl1[$i]";
}
print "</TABLE>\n</TD>\n";
}
if ($ocrcolumns > 2) {
print "<TD>\n";
print "<TABLE cellpadding=0 cellspacing=0 border=0 width=$ocrtblwidth $bordercolor>\n";
for $i (0 .. $#ocrcoltbl2) {
print "$ocrcoltbl2[$i]";
}
print "</TABLE>\n</TD>\n";
}
print "<\TR>\n";
}
}
sub PrintQuestionsOCR() {
my $trash;
my $r=0;
my $c=0;
my $rowhtml;
my $questionindex;
$referencepage = "";
$allowupdate = 0;
$scored = 1;
foreach $questionindex (1 .. $#questions) {
&get_question_definition($TEST{'id'},$CLIENT{'clid'},$questions[$questionindex]);
$qtype = $QUESTION{'qtp'};
$anstype = $QUESTION{'qalb'};
($qsubj, $sklvl) = split(/\./, $QUESTION{'subj'});
if ($sklvl eq '') { $sklvl = 3; }
($keyresponse,$kflags) = split(/::/, $keyanswers[$questionindex]);
$scoreable = 1;
$credit = $noanswertag;
$checked = "";
$answerkey = "";
$studentkey = "";
$qanswermatch = "";
@txts = ();
if ($qtype eq 'nrt') {
# &PrintQuestionNRT($TEST{'seq'});
} elsif ($qtype eq 'tf') {
&PrintQuestionTF($TEST{'seq'});
} elsif ($qtype eq 'esa') {
# &PrintQuestionESA($TEST{'seq'});
} elsif ($qtype eq 'mcs') {
&PrintQuestionMCS($TEST{'seq'});
} elsif ($qtype eq 'mcm') {
# &PrintQuestionMCM($TEST{'seq'});
} elsif ($qtype eq 'mch') {
# &PrintQuestionMCH($TEST{'seq'});
} elsif ($qtype eq 'ord') {
# &PrintQuestionORD($TEST{'seq'});
}
$rowhtml = join('',"<TR>","<TD align=right valign=\"top\" width=30><font $textcolor>$questionindex. </font></TD>",$answerkey,"</TR>\n");
$c=int(($questionindex-1) / 50);
$r=(($questionindex-1) % 50);
if ($c == 0) {
push @ocrcoltbl0,$rowhtml;
} elsif ($c==1) {
push @ocrcoltbl1,$rowhtml;
} elsif ($c==2) {
push @ocrcoltbl2,$rowhtml;
}
}
}
sub PrintQuestions() {
my $trash;
$referencepage = "";
$allowupdate = 0;
$scored = 1;
@tstquestions = ();
foreach $questionindex (1 .. $#questions) {
&get_question_definition($TEST{'id'},$CLIENT{'clid'},$questions[$questionindex]);
$qtype = $QUESTION{'qtp'};
$anstype = $QUESTION{'qalb'};
($qsubj, $sklvl) = split(/\./, $QUESTION{'subj'});
if ($sklvl eq '') { $sklvl = 3; }
($keyresponse,$kflags) = split(/::/, $keyanswers[$questionindex]);
$scoreable = 1;
$credit = $noanswertag;
$checked = "";
$answerkey = "<table cellspacing=0 cellpadding=0 border=0 width=550 $bordercolor>\n";
$studentkey = "";
$qanswermatch = "";
@txts = ();
if ($qtype eq 'nrt') {
&PrintQuestionNRT($TEST{'seq'});
} elsif ($qtype eq 'tf') {
&PrintQuestionTF($TEST{'seq'});
} elsif ($qtype eq 'esa') {
&PrintQuestionESA($TEST{'seq'});
} elsif ($qtype eq 'mcs') {
&PrintQuestionMCS($TEST{'seq'});
} elsif ($qtype eq 'mcm') {
&PrintQuestionMCM($TEST{'seq'});
} elsif ($qtype eq 'mch') {
&PrintQuestionMCH($TEST{'seq'});
} elsif ($qtype eq 'ord') {
&PrintQuestionORD($TEST{'seq'});
}
if ($qtype ne 'esa' ) { $answerkey = join('', $answerkey,"</table>\n"); }
$qlinked = "";
$questionillustration = "";
if ($showgraphics) {
if ($QUESTION{'qim'} eq '1') {
$qlinked = $QUESTION{'illustration'};
($trash,$qlinked)= split(/img=/, $qlinked);
($qlinked,$trash) = split(/\" /, $qlinked);
$qlinked = "<IMG NAME=\"qimage\" SRC=\"$cgiroot/image.pl?tid=$SESSION{'tid'}\&img=$qlinked\" BORDER=0>";
} elsif ($QUESTION{'qim'} eq '2') {
$qlinked = $QUESTION{'illustration'};
}
if ($qlinked ne "") {
if ($refpage) {
$referencepage = join('', $referencepage,"<font size=2 $textcolor><B><I>Illustration below is for question $questionindex.</I></B><BR></font>\n$qlinked<BR>\&nbsp\;<BR>\n");
} else {
$questionillustration = " <TR>
<TD width=30>\&nbsp\;<BR></TD>
<TD colspan=2 width=550>
<font size=2 $textcolor><B><I>Illustration below is for question $questionindex.</I></B><BR></font>
$qlinked
</TD>
</TR>\n";
}
$questionillustration =~ s/BORDER=0/BORDER=1/g;
}
}
$qother = "";
$joinsc = " ";
if ($oshowqid) {
$qother = join('', $qother, "$QUESTION{'id'}");
$joinsc = ":";
}
if ($oshowsubj) {
$qother = join($joinsc, $qother, "$qsubj ");
$joinsc = ":";
}
if ($oshowskill) {
$qother = join($joinsc, $qother, "$skilllevel[$sklvl] ");
}
if ($qother ne '') {
$qother = join('', "<font size=1><B>", uc($qother), "</B></font><BR>");
}
$scoremsg = ($printscoreboxes) ? "<input type=checkbox> <input type=checkbox><BR>\nSCORING<BR>USE ONLY" : "";
if ($colspan eq 2) {
$tstquestion = "$questionillustration
<TR>
<TD rowspan=2 valign=\"top\" width=30><font $textcolor>$questionindex. </font></TD>
<TD colspan=2 valign=\"top\" width=550><font $textcolor>$qother$QUESTION{'qtx'}</font></TD>
<TD rowspan=2 align=center valign=\"top\" width=60>
<Font size=1 $textcolor>
$scoremsg
</font>
</TD>
</TR>
<TR>
<TD colspan=2 valign=\"top\" width=550><font $textcolor>$answerkey</font></TD>
</TR>\n";
} else {
$tstquestion = "$questionillustration
<TR>
<TD rowspan=2 valign=\"top\" width=30><font $textcolor>$questionindex. </font></TD>
<TD colspan=2 valign=\"top\" width=550><font $textcolor>$qother$QUESTION{'qtx'}</font></TD>
<TD rowspan=2 align=center valign=\"top\" width=60>
<Font size=1 $textcolor>
$scoremsg
</font>
</TD>
</TR>
<TR>
<TD valign=\"top\" width=275><font $textcolor>$answerkey</font></TD>
<TD valign=\"top\" width=275><font $textcolor>$qanswermatch</font></TD>
</TR>\n";
}
push @tstquestions, $tstquestion;
}
return @tstquestions;
}
sub PrintQuestionNRT {
my ($ttyp) = @_;
$answerkey = join('',$answerkey,"<tr><td valign=top width=550><font $textcolor>\n");
if ($keyprint == 1) {
$answerkey = join('',$answerkey,"<textarea rows=10 cols=60>$keyresponse</textarea>");
} else {
$answerkey = join('',$answerkey,"<textarea rows=10 cols=60></textarea>");
}
$answerkey = join('',$answerkey,"</font></td></tr>\n");
$colspan=2;
}
sub PrintQuestionTF {
my ($ttyp) = @_;
$answerkey = join('',$answerkey,"<td valign=top colspan=8><font $textcolor>\n");
if ($ttyp eq 'svy') {
$checked = ($QUESTION{'qca'} eq "TRUE") ? "CHECKED": "";
$checked = ($keyprint == 1) ? $checked : "";
if (!$onoradios) { $answerkey .= "<input type=\"radio\"$checked>"; }
$answerkey .= "TRUE<BR>\n";
$checked = ($QUESTION{'qca'} eq "FALSE") ? "CHECKED": "";
$checked = ($keyprint == 1) ? $checked : "";
if (!$onoradios) { $answerkey = join('',$answerkey,"<input type=\"radio\"$checked>"); }
$answerkey = join('',$answerkey,"FALSE<BR>\n");
} else {
if ($keyprint) {
if ($oblackoutthrowoffs) {
if ($QUESTION{'qca'} eq "TRUE") {
$answerkey = join('',$answerkey,"<input type=\"radio\" CHECKED>");
$answerkey = join('',$answerkey,"TRUE<BR>\n");
$answerkey = join('',$answerkey,"<img src=\"$PATHS{'graphurl'}/blackbar.jpg\" height=10 width=100 border=1>");
if (!$onoradios) { $answerkey = join('',$answerkey,"<input type=\"radio\">"); }
$answerkey = join('',$answerkey,"X<BR>\n");
} else {
$answerkey = join('',$answerkey,"<img src=\"$PATHS{'graphurl'}/blackbar.jpg\" height=10 width=100 border=1>");
if (!$onoradios) { $answerkey = join('',$answerkey,"<input type=\"radio\">"); }
$answerkey = join('',$answerkey,"X<BR>\n");
$answerkey = join('',$answerkey,"<input type=\"radio\" CHECKED>");
$answerkey = join('',$answerkey,"FALSE<BR>\n");
}
} else {
if ($QUESTION{'qca'} eq "TRUE") {
$answerkey = join('',$answerkey,"<input type=\"radio\" CHECKED>");
$answerkey = join('',$answerkey,"TRUE<BR>\n");
if (!$onoradios) { $answerkey = join('',$answerkey,"<input type=\"radio\">"); }
$answerkey = join('',$answerkey,"FALSE<BR>\n");
} else {
if (!$onoradios) { $answerkey = join('',$answerkey,"<input type=\"radio\">\n"); }
$answerkey = join('',$answerkey,"TRUE<BR>\n");
$answerkey = join('',$answerkey,"<input type=\"radio\" CHECKED>\n");
$answerkey = join('',$answerkey,"FALSE<BR>\n");
}
}
} else {
if (!$onoradios) { $answerkey = join('',$answerkey,"&nbsp;&nbsp;<input type=\"radio\">");}
$answerkey = join('',$answerkey,"&nbsp;&nbsp;TRUE");
if (!$onoradios) { $answerkey = join('',$answerkey,"&nbsp;&nbsp;<input type=\"radio\">");}
$answerkey = join('',$answerkey,"&nbsp;&nbsp;FALSE");
}
}
$colspan=2;
$answerkey = join('',$answerkey,"</font></td>\n");
}
sub PrintQuestionESA {
my ($ttyp) = @_;
$answerkey = join('',$answerkey,"<tr><td valign=top width=550><font $textcolor>\n");
$lenresponse = length($keyresponse) + 4;
if ($keyprint == 1) {
$answerkey = "<input type=text size=$lenresponse value=\"$keyresponse\">";
} else {
$answerkey = "<input type=text size=$lenresponse>";
}
$colspan=2;
$answerkey = join('',$answerkey,"</font></td></tr>\n");
}
sub PrintQuestionMCS {
my ($ttyp) = @_;
if ($ttyp eq 'svy') {
@txts = ();
if ($QUESTION{'qca'} ne '') {
push @txts, $QUESTION{'qca'};
}
@txts_wro = split(/\n/, $QUESTION{'qia'});
foreach $qia (@txts_wro) {
push @txts, $qia;
}
@kans = split(/\?/,$keyresponse);
@albls=&set_answer_labels($anstype);
foreach $j (1 .. $#kans) {
$jidx = $j-1;
@indexs = split(/=/, $kans[$j]);
$checked = ($indexs[1] == '1') ? " CHECKED" : "";
$checked = ($keyprint == 1) ? $checked : "";
$answerkey = join('',$answerkey,"<td align=right valign=top width=20><font $textcolor>\n");
if (!$onoradios) { $answerkey = join('',$answerkey,"<input type=\"radio\"$checked>"); }
$answerkey = join('',$answerkey,"\&nbsp;</font></td>\n");
$answerkey = join('',$answerkey,"<td align=right valign=top width=20><font $textcolor>\n");
$answerkey = join('',$answerkey,"$albls[$jidx].");
$answerkey = join('',$answerkey,"\&nbsp;</font></td><td valign=top width=510><font $textcolor>\n");
$answerkey = join('',$answerkey,"$txts[$indexs[0]]\n");
$answerkey = join('',$answerkey,"\&nbsp;</font></td>\n");
}
} else {
push @txts, $QUESTION{'qca'};
@txts_wro = split(/\n/, $QUESTION{'qia'});
foreach $qia (@txts_wro) {
push @txts, $qia;
}
@kans = split(/\?/,$keyresponse);
@albls=&set_answer_labels($anstype);
foreach $j (1 .. $#kans) {
$jidx = $j-1;
@indexs = split(/=/, $kans[$j]);
$checked="";
if ($keyprint) {
$checked = ($indexs[1] eq '1') ? " CHECKED" : "";
}
if (($ocrstyle) && ($ocrsheetno > 0)) {
if ($checked ne "") {
$answerkey = join('',$answerkey,"<td align=left valign=top width=20><font $textcolor>");
$answerkey = join('',$answerkey,"\&nbsp;$albls[$jidx].");
$answerkey = join('',$answerkey,"</font></td><td valign=top width=10><font $textcolor>");
$answerkey = join('',$answerkey,"<img src=\"$PATHS{'graphurl'}/blackbar.jpg\" height=10 width=10 border=1>");
$answerkey = join('',$answerkey,"\&nbsp;</font></td>");
} elsif (($oblackoutthrowoffs) && ($keyprint)) {
$answerkey = join('',$answerkey,"<td align=left valign=top width=20><font $textcolor>");
$answerkey = join('',$answerkey,"\&nbsp;$albls[$jidx].");
$answerkey = join('',$answerkey,"</font></td><td valign=top width=10><font $textcolor>");
$answerkey = join('',$answerkey,"<img src=\"$PATHS{'graphurl'}/redbar.jpg\" height=10 width=10 border=1>");
$answerkey = join('',$answerkey,"\&nbsp;</font></td>");
} else {
$answerkey = join('',$answerkey,"<td align=left valign=top width=20><font $textcolor>");
$answerkey = join('',$answerkey,"\&nbsp;$albls[$jidx].");
$answerkey = join('',$answerkey,"</font></td><td valign=top width=10><font $textcolor>");
if (!$onoradios) { $answerkey = join('',$answerkey,"<input type=radio $checked>"); }
$answerkey = join('',$answerkey,"\&nbsp;</font></td>");
}
} else {
if ($checked ne "") {
$answerkey = join('',$answerkey,"<tr><td align=right valign=top width=20><font $textcolor>\n");
if (!$onoradios) { $answerkey = join('',$answerkey,"<input type=\"radio\"$checked>"); }
$answerkey = join('',$answerkey,"\&nbsp;</font></td>\n");
$answerkey = join('',$answerkey,"<td align=right valign=top width=20><font $textcolor>\n");
$answerkey = join('',$answerkey,"$albls[$jidx].");
$answerkey = join('',$answerkey,"\&nbsp;</font></td><td valign=top width=510><font $textcolor>\n");
$answerkey = join('',$answerkey,"$txts[$indexs[0]]\n");
$answerkey = join('',$answerkey,"\&nbsp;</font></td></tr>\n");
} elsif (($oblackoutthrowoffs) && ($keyprint)) {
$answerkey = join('',$answerkey,"<tr><td align=right valign=top width=20><font $textcolor>\n");
$answerkey = join('',$answerkey,"<img src=\"$PATHS{'graphurl'}/blackbar.jpg\" height=10 width=30 border=1>");
$answerkey = join('',$answerkey,"\&nbsp;</font></td>\n");
$answerkey = join('',$answerkey,"<td align=right valign=top width=20><font $textcolor>\n");
$answerkey = join('',$answerkey,"\&nbsp;");
$answerkey = join('',$answerkey,"\&nbsp;</font></td><td valign=top width=510><font $textcolor>\n");
$answerkey = join('',$answerkey,"<img src=\"$PATHS{'graphurl'}/blackbar.jpg\" height=10 width=100 border=1>\n");
$answerkey = join('',$answerkey,"\&nbsp;</font></td></tr>\n");
} else {
$answerkey = join('',$answerkey,"<tr><td align=right valign=top width=20><font $textcolor>\n");
if ($ocrstyle || $onoradios) {
$answerkey = join('',$answerkey,"\&nbsp;");
} else {
$answerkey = join('',$answerkey,"<input type=\"radio\"$checked>");
}
$answerkey = join('',$answerkey,"\&nbsp;</font></td>\n");
$answerkey = join('',$answerkey,"<td align=right valign=top width=20><font $textcolor>\n");
$answerkey = join('',$answerkey,"$albls[$jidx].");
$answerkey = join('',$answerkey,"\&nbsp;</font></td><td valign=top width=510><font $textcolor>\n");
$answerkey = join('',$answerkey,"$txts[$indexs[0]]\n");
$answerkey = join('',$answerkey,"\&nbsp;</font></td></tr>\n");
}
}
}
}
$colspan=2;
}
sub PrintQuestionMCM {
my ($ttyp) = @_;
if ($ttyp eq 'svy') {
@txts = ();
if ($QUESTION{'qca'} ne '') {
@txts = split(/\n/, $QUESTION{'qca'});
}
@txts_wro = split(/\n/, $QUESTION{'qia'});
foreach $qia (@txts_wro) {
push @txts, $qia;
}
@kans = split(/\?/,$keyresponse);
@albls=&set_answer_labels($anstype);
$answerkey = join('',$answerkey,"<tr><td valign=top width=550><font $textcolor>\n");
foreach $j (1 .. $#kans) {
$jidx = $j-1;
@indexs = split(/=/, $kans[$j]);
$checked = ($studentresponse =~ /$jidx/) ? " CHECKED" : "";
$answerkey = join('',$studentkey,"$albls[$jidx].","<input type=\"checkbox\"$checked>$txts[$indexs[0]]<BR>\n");
}
$answerkey = join('',$answerkey,"</font></td></tr>\n");
} else {
@txts = split(/\n/, $QUESTION{'qca'});
@txts_wro = split(/\n/, $QUESTION{'qia'});
foreach $qia (@txts_wro) {
push @txts, $qia;
}
@kans = split(/\?/,$keyresponse);
@albls=&set_answer_labels($anstype);
foreach $j (1 .. $#kans) {
$jidx = $j-1;
@indexs = split(/=/, $kans[$j]);
$checked="";
if ($keyprint) {
$checked = ($indexs[1] eq '1') ? " CHECKED" : "";
}
if (($ocrstyle) && ($ocrsheetno > 0)) {
if ($checked ne "") {
$answerkey = join('',$answerkey,"<td align=left valign=top width=20><font $textcolor>");
$answerkey = join('',$answerkey,"\&nbsp;$albls[$jidx].");
$answerkey = join('',$answerkey,"</font></td><td valign=top width=10><font $textcolor>");
$answerkey = join('',$answerkey,"<img src=\"$PATHS{'graphurl'}/blackbar.jpg\" height=10 width=10 border=1>");
$answerkey = join('',$answerkey,"\&nbsp;</font></td>");
} elsif (($oblackoutthrowoffs) && ($keyprint)) {
$answerkey = join('',$answerkey,"<td align=left valign=top width=20><font $textcolor>");
$answerkey = join('',$answerkey,"\&nbsp;$albls[$jidx].");
$answerkey = join('',$answerkey,"</font></td><td valign=top width=10><font $textcolor>");
$answerkey = join('',$answerkey,"<img src=\"$PATHS{'graphurl'}/redbar.jpg\" height=10 width=10 border=1>");
$answerkey = join('',$answerkey,"\&nbsp;</font></td>");
} else {
$answerkey = join('',$answerkey,"<td align=left valign=top width=20><font $textcolor>");
$answerkey = join('',$answerkey,"\&nbsp;$albls[$jidx].");
$answerkey = join('',$answerkey,"</font></td><td valign=top width=10><font $textcolor>");
if (!$onoradios) { $answerkey = join('',$answerkey,"<input type=radio $checked>"); }
$answerkey = join('',$answerkey,"\&nbsp;</font></td>");
}
} else {
if ($checked ne "") {
$answerkey = join('',$answerkey,"<tr><td align=right valign=top width=20><font $textcolor>\n");
$answerkey = join('',$answerkey,"<input type=\"checkbox\"$checked>");
$answerkey = join('',$answerkey,"\&nbsp;</font></td>\n");
$answerkey = join('',$answerkey,"<td align=right valign=top width=20><font $textcolor>\n");
$answerkey = join('',$answerkey,"$albls[$jidx].");
$answerkey = join('',$answerkey,"\&nbsp;</font></td><td valign=top width=510><font $textcolor>\n");
$answerkey = join('',$answerkey,"$txts[$indexs[0]]\n");
$answerkey = join('',$answerkey,"\&nbsp;</font></td></tr>\n");
} elsif (($oblackoutthrowoffs) && ($keyprint)) {
$answerkey = join('',$answerkey,"<tr><td align=right valign=top width=20><font $textcolor>\n");
$answerkey = join('',$answerkey,"<img src=\"$PATHS{'graphurl'}/blackbar.jpg\" height=10 width=30 border=1>");
$answerkey = join('',$answerkey,"\&nbsp;</font></td>\n");
$answerkey = join('',$answerkey,"<td align=right valign=top width=20><font $textcolor>\n");
$answerkey = join('',$answerkey,"\&nbsp;");
$answerkey = join('',$answerkey,"\&nbsp;</font></td><td valign=top width=510><font $textcolor>\n");
$answerkey = join('',$answerkey,"<img src=\"$PATHS{'graphurl'}/blackbar.jpg\" height=10 width=100 border=1>\n");
$answerkey = join('',$answerkey,"\&nbsp;</font></td></tr>\n");
} else {
$answerkey = join('',$answerkey,"<tr><td align=right valign=top width=20><font $textcolor>\n");
if ($ocrstyle) {
$answerkey = join('',$answerkey,"\&nbsp;");
} else {
$answerkey = join('',$answerkey,"<input type=\"checkbox\"$checked>");
}
$answerkey = join('',$answerkey,"\&nbsp;</font></td>\n");
$answerkey = join('',$answerkey,"<td align=right valign=top width=20><font $textcolor>\n");
$answerkey = join('',$answerkey,"$albls[$jidx].");
$answerkey = join('',$answerkey,"\&nbsp;</font></td><td valign=top width=510><font $textcolor>\n");
$answerkey = join('',$answerkey,"$txts[$indexs[0]]\n");
$answerkey = join('',$answerkey,"\&nbsp;</font></td></tr>\n");
}
}
# if ($keyprint) {
# $checked = ($indexs[1] eq '1') ? " CHECKED" : "";
# if ($oblackoutthrowoffs) {
# if ($checked ne '') {
# $answerkey = join('',$answerkey,"$albls[$jidx].","<input type=\"checkbox\" $checked>$txts[$indexs[0]]<BR>\n");
# } else {
# $answerkey = join('',$answerkey,"<img src=\"$PATHS{'graphurl'}/blackbar.jpg\" height=10 width=100 border=1><input type=\"checkbox\">X<BR>\n");
# }
# } else {
# $answerkey = join('',$answerkey,"$albls[$jidx].","<input type=\"checkbox\"$checked>$txts[$indexs[0]]<BR>\n");
# }
# } else {
# $answerkey = join('',$answerkey,"$albls[$jidx].","<input type=\"checkbox\">$txts[$indexs[0]]<BR>\n");
# }
}
}
# $colspan=2;
}
sub PrintQuestionMCH {
my ($ttyp) = @_;
$answerkey = join('',$answerkey,"<tr><td valign=top width=550><font $textcolor>\n");
if ($ttyp eq 'svy') {
@txts = split(/\n/, $QUESTION{'qca'});
@txts_wro = split(/\n/, $QUESTION{'qia'});
@ansopts = split(/\./, $keyresponse);
$ansopt = shift @ansopts;
@albls=&set_answer_labels($anstype);
$keyresponse = "";
for (0 .. $#ansopts) {
$cansord[$ansopts[$_]] = $albls[$_];
$qanswermatch = join('',$qanswermatch, "<I>($cansord[$ansopts[$_]]) $txts_wro[$ansopts[$_]]</I><BR>\n");
}
foreach $cansord (@cansord) {
$keyresponse = join('', $keyresponse, $cansord);
}
for (0 .. $#ansopts) {
if ($keyprint == 1) {
$answerkey = join('',$answerkey,"$albls[$_].","<input type=text size=2 value=\"$cansord[$_]\"> $txts[$_]<BR>\n");
} else {
$answerkey = join('',$answerkey,"$albls[$_].","<input type=text size=2> $txts[$_]<BR>\n");
}
}
@cansord = ();
} else {
@txts = split(/\n/, $QUESTION{'qca'});
@txts_wro = split(/\n/, $QUESTION{'qia'});
@ansopts = split(/\./, $keyresponse);
$trash = shift @ansopts;
@albls=&set_answer_labels($anstype);
$keyresponse = "";
for (0 .. $#ansopts) {
$cansord[$ansopts[$_]] = $albls[$_];
$qanswermatch = join('',$qanswermatch, "$cansord[$ansopts[$_]].\&nbsp\;\&nbsp\;$txts_wro[$ansopts[$_]]<BR>\n");
}
foreach $cansord (@cansord) {
$keyresponse = join('', $keyresponse, $cansord);
}
for (0 .. $#ansopts) {
if ($keyprint == 1) {
$answerkey = join('',$answerkey,"$albls[$_].","<input type=text size=2 value=\"$cansord[$_]\"> $txts[$_]<BR>\n");
} else {
$answerkey = join('',$answerkey,"$albls[$_].","<input type=text size=2> $txts[$_]<BR>\n");
}
}
@cansord = ();
}
# $colspan=1;
$answerkey = join('',$answerkey,"</font></td></tr>\n");
}
sub PrintQuestionORD {
my ($ttyp) = @_;
$answerkey = join('',$answerkey,"<tr><td valign=top width=550><font $textcolor>\n");
if ($ttyp eq 'svy') {
@txts = split(/\n/, $QUESTION{'qca'});
@ansopts = split(/\./, $keyresponse);
$trash = shift @ansopts;
@albls=&set_answer_labels($anstype);
for (0 .. $#ansopts) {
$ansopt = $ansopts[$_];
$ansopt++;
if ($keyprint == 1) {
$answerkey = join('',$answerkey,"$albls[$_].","<input type=text size=3 value=\"$ansopt\"> $txts[$ansopts[$_]]<BR>\n");
} else {
$answerkey = join('',$answerkey,"$albls[$_].","<input type=text size=3> $txts[$ansopts[$_]]<BR>\n");
}
}
} else {
@txts = split(/\n/, $QUESTION{'qca'});
@ansopts = split(/\./, $keyresponse);
$trash = shift @ansopts;
@albls=&set_answer_labels($anstype);
for (0 .. $#ansopts) {
$ansopt = $ansopts[$_];
$ansopt++;
if ($keyprint == 1) {
$answerkey = join('',$answerkey,"$albls[$_].","<input type=text size=3 value=\"$ansopt\"> $txts[$ansopts[$_]]<BR>\n");
} else {
$answerkey = join('',$answerkey,"$albls[$_].","<input type=text size=3> $txts[$ansopts[$_]]<BR>\n");
}
}
}
# $colspan=2;
$answerkey = join('',$answerkey,"</font></td></tr>\n");
}
sub PrintOCRSheets() {
my @tstquestions = ();
return @tstquestions;
}