version 1.82, 2003/04/01 05:21:48
|
version 1.84, 2003/04/11 17:57:37
|
Line 717 sub sub_page_kw_js {
|
Line 717 sub sub_page_kw_js {
|
height = 600; |
height = 600; |
scrollbar = "yes"; |
scrollbar = "yes"; |
} |
} |
// if (window.pWin) window.pWin.close(); |
// if (window.pWin) {window.pWin.close(); window.pWin=null} |
pWin = window.open('', 'MessageCenter', 'toolbar=no,location=no,scrollbars='+scrollbar+',screenx=70,screeny=75,width=600,height='+height); |
pWin = window.open('', 'MessageCenter', 'toolbar=no,location=no,scrollbars='+scrollbar+',screenx=70,screeny=75,width=600,height='+height); |
pWin.focus(); |
pWin.focus(); |
pDoc = pWin.document; |
pDoc = pWin.document; |
Line 752 sub sub_page_kw_js {
|
Line 752 sub sub_page_kw_js {
|
pDoc.write(" includemsg = 1;"); |
pDoc.write(" includemsg = 1;"); |
pDoc.write(" }"); |
pDoc.write(" }"); |
pDoc.write(" imgformname = eval(\\"opener.document.SCORE.mailicon\\"+usrctr);"); |
pDoc.write(" imgformname = eval(\\"opener.document.SCORE.mailicon\\"+usrctr);"); |
pDoc.write(" if (includemsg) {"); |
pDoc.write(" imgformname.src = \\"$iconpath/\\"+((includemsg) ? \\"mailto.gif\\" : \\"mailbkgrd.gif\\");"); |
pDoc.write(" imgformname.src = \\"$iconpath/mailto.gif\\";"); |
|
pDoc.write(" } else {"); |
|
pDoc.write(" imgformname.src = \\"$iconpath/mailbkgrd.gif\\";"); |
|
pDoc.write(" }"); |
|
pDoc.write(" var includemsg = eval(\\"opener.document.SCORE.includemsg\\"+usrctr);"); |
pDoc.write(" var includemsg = eval(\\"opener.document.SCORE.includemsg\\"+usrctr);"); |
pDoc.write(" includemsg.value = msgchk;"); |
pDoc.write(" includemsg.value = msgchk;"); |
|
|
Line 1250 KEYWORDS
|
Line 1246 KEYWORDS
|
my $lastone = pop @col_fullnames; |
my $lastone = pop @col_fullnames; |
$msgfor .= ', '.(join ', ',@col_fullnames).' and '.$lastone.'.'; |
$msgfor .= ', '.(join ', ',@col_fullnames).' and '.$lastone.'.'; |
} |
} |
|
$msgfor =~ s/\'/\\'/g; |
$result.='<tr><td bgcolor="#ffffff">'."\n". |
$result.='<tr><td bgcolor="#ffffff">'."\n". |
' <a href="javascript:msgCenter(document.SCORE,'.$counter. |
' <a href="javascript:msgCenter(document.SCORE,'.$counter. |
',\''.$msgfor.'\')"; TARGET=_self>'. |
',\''.$msgfor.'\')"; TARGET=_self>'. |
Line 2924 sub scantron_parse_scanline {
|
Line 2921 sub scantron_parse_scanline {
|
my $data=substr($line,0,$$scantron_config{'Qstart'}-1); |
my $data=substr($line,0,$$scantron_config{'Qstart'}-1); |
if ($$scantron_config{'CODElocation'} ne 0) { |
if ($$scantron_config{'CODElocation'} ne 0) { |
if ($$scantron_config{'CODElocation'} < 0) { |
if ($$scantron_config{'CODElocation'} < 0) { |
$record{'CODE'}=substr($data,$$scantron_config{'CODEstart'}-1, |
$record{'scantron.CODE'}=substr($data,$$scantron_config{'CODEstart'}-1, |
$$scantron_config{'CODElength'}); |
$$scantron_config{'CODElength'}); |
} else { |
} else { |
#FIXME interpret first N questions |
#FIXME interpret first N questions |
} |
} |
} |
} |
$record{'ID'}=substr($data,$$scantron_config{'IDstart'}-1, |
$record{'scantron.ID'}=substr($data,$$scantron_config{'IDstart'}-1, |
$$scantron_config{'IDlength'}); |
$$scantron_config{'IDlength'}); |
my @alphabet=('A'..'Z'); |
my @alphabet=('A'..'Z'); |
my $questnum=0; |
my $questnum=0; |
while ($questions) { |
while ($questions) { |
$questnum++; |
$questnum++; |
my $currentquest=substr($questions,0,$$scantron_config{'Qlength'}); |
my $currentquest=substr($questions,0,$$scantron_config{'Qlength'}); |
substr($questions,0,$$scantron_config{'Qlength'})=''; |
substr($questions,0,$$scantron_config{'Qlength'})=''; |
|
if (length($currentquest) < $$scantron_config{'Qlength'}) { next; } |
my (@array)=split(/$$scantron_config{'Qon'}/,$currentquest); |
my (@array)=split(/$$scantron_config{'Qon'}/,$currentquest); |
if (scalar(@array) gt 2) { |
if (scalar(@array) gt 2) { |
#FIXME do something intelligent with double bubbles |
#FIXME do something intelligent with double bubbles |
Apache->request->print("<br ><b>Wha!!!</b> ".scalar(@array). |
Apache->request->print("<br ><b>Wha!!!</b> <pre>".scalar(@array). |
'-'.$questions.'-'.$currentquest.'-'.$questnum. |
'-'.$currentquest.'-'.$questnum.'</pre><br />'); |
'-'.length($questions). |
|
'-'.$line.'-'.length($line).'-'. |
|
'-'.$data.'-'.length($data).'-'. |
|
'<br />'); |
|
} |
} |
if (length($array[0]) eq $$scantron_config{'Qlength'}) { |
if (length($array[0]) eq $$scantron_config{'Qlength'}) { |
$record{"$questnum.answer"}=''; |
$record{"scantron.$questnum.answer"}=''; |
} else { |
} else { |
$record{"$questnum.answer"}=$alphabet[length($array[0])]; |
$record{"scantron.$questnum.answer"}=$alphabet[length($array[0])]; |
} |
} |
} |
} |
$record{'maxquest'}=$questnum; |
$record{'scantron.maxquest'}=$questnum; |
$Apache::lonxml::debug=1; |
return \%record; |
&Apache::lonhomework::showhash(%record); |
|
$Apache::lonxml::debug=0; |
|
return %record; |
|
} |
} |
|
|
sub scantron_add_delay { |
sub scantron_add_delay { |
} |
} |
|
|
sub scantron_find_student { |
sub scantron_find_student { |
|
my ($scantron_record,$idmap)=@_; |
|
my $scanID=$$scantron_record{'scantron.ID'}; |
|
foreach my $id (keys(%$idmap)) { |
|
Apache->request->print('<pre>checking studnet -'.$id.'- againt -'.$scanID.'- </pre>'); |
|
if (lc($id) eq lc($scanID)) { Apache->request->print('success');return $$idmap{$id}; } |
|
} |
|
return undef; |
|
} |
|
|
|
sub scantron_filter { |
|
my ($curres)=@_; |
|
if (ref($curres) && $curres->is_problem() && !$curres->randomout) { |
|
return 1; |
|
} |
|
return 0; |
} |
} |
|
|
sub scantron_process_students { |
sub scantron_process_students { |
Line 2978 sub scantron_process_students {
|
Line 2984 sub scantron_process_students {
|
my $scanlines=Apache::File->new($Apache::lonnet::perlvar{'lonScansDir'}."/$ENV{'form.scantron_selectfile'}"); |
my $scanlines=Apache::File->new($Apache::lonnet::perlvar{'lonScansDir'}."/$ENV{'form.scantron_selectfile'}"); |
my $classlist=&Apache::loncoursedata::get_classlist(); |
my $classlist=&Apache::loncoursedata::get_classlist(); |
my %idmap=&username_to_idmap($classlist); |
my %idmap=&username_to_idmap($classlist); |
|
my $navmap=Apache::lonnavmaps::navmap->new($ENV{'request.course.fn'}.'.db',$ENV{'request.course.fn'}.'_parms.db',1, 1); |
|
my $map=$navmap->getResourceByUrl($sequence); |
|
my @resources=$navmap->retrieveResources($map,\&scantron_filter,1,0); |
|
$r->print("geto ".scalar(@resources)."<br />"); |
my $result= <<SCANTRONFORM; |
my $result= <<SCANTRONFORM; |
<form method="post" enctype="multipart/form-data" action="/adm/grades" name="scantronupload"> |
<form method="post" enctype="multipart/form-data" action="/adm/grades" name="scantronupload"> |
<input type="hidden" name="command" value="scantron_configphase" /> |
<input type="hidden" name="command" value="scantron_configphase" /> |
Line 2988 SCANTRONFORM
|
Line 2998 SCANTRONFORM
|
my @delayqueue; |
my @delayqueue; |
|
|
foreach my $line (<$scanlines>) { |
foreach my $line (<$scanlines>) { |
|
chomp($line); |
my $scan_record=&scantron_parse_scanline($line,\%scantron_config); |
my $scan_record=&scantron_parse_scanline($line,\%scantron_config); |
my ($uname,$udom); |
my ($uname,$udom); |
if ($uname=&scantron_find_student($scan_record,\%idmap)) { |
if ($uname=&scantron_find_student($scan_record,\%idmap)) { |
&scantron_add_delay(\@delayqueue,$line, |
&scantron_add_delay(\@delayqueue,$line, |
'Unable to find a student that matches'); |
'Unable to find a student that matches'); |
} |
} |
|
$r->print('<pre>doing studnet'.$uname.'</pre>'); |
($uname,$udom)=split(/:/,$uname); |
($uname,$udom)=split(/:/,$uname); |
|
&Apache::lonnet::delenv('form\.counter$'); #') stupid emacs |
|
&Apache::lonnet::appenv(%$scan_record); |
|
$Apache::lonxml::debug=1; |
|
&Apache::lonhomework::showhash(%ENV); |
|
$Apache::lonxml::debug=0; |
|
|
|
foreach my $resource (@resources) { |
|
my $result=&Apache::lonnet::ssi($resource->src(), |
|
('submitted' =>'scantron', |
|
'grade_target' =>'grade', |
|
'grade_username'=>$uname, |
|
'grade_domain' =>$udom, |
|
'grade_courseid'=>$ENV{'request.course.id'}, |
|
'grade_symb' =>$resource->symb())); |
|
$r->print('<pre>'. |
|
$resource->symb().'-'. |
|
$resource->src().'-'.'</pre>result is'.$result); |
|
last; |
|
} |
|
&Apache::lonnet::delenv('form\.counter$'); #') stupid emacs |
|
&Apache::lonnet::delenv('scantron\.'); |
|
last; |
#FIXME |
#FIXME |
#get iterator for $sequence |
#get iterator for $sequence |
#foreach question 'submit' the students answer to the server |
#foreach question 'submit' the students answer to the server |