'."\n";
- $result.='Fullname: '.$ENV{'form.fullname'}.
- ' Username: '.$uname.
- ($ENV{'user.domain'} eq $udom ? '' : ' ('.$udom.')').' '."\n";
+ $result.='Fullname: '.&nameUserString(undef,$ENV{'form.fullname'},$uname,$udom).' '."\n";
$result.=''."\n";
@@ -1528,17 +1541,21 @@ KEYWORDS
my %seen = ();
my @partlist;
+ my @gradePartRespid;
for (sort keys(%$handgrade)) {
my ($partid,$respid) = split(/_/);
next if ($seen{$partid} > 0);
$seen{$partid}++;
next if ($$handgrade{$_} =~ /:no$/ && $ENV{'form.lastSub'} =~ /^(hdgrade)$/);
push @partlist,$partid;
+ push @gradePartRespid,$partid.'.'.$respid;
$request->print(&gradeBox($request,$symb,$uname,$udom,$counter,$partid,\%record));
}
$result=''."\n";
+ $result.=''."\n" if ($counter == 0);
my $ctr = 0;
while ($ctr < scalar(@partlist)) {
$result.=''."\n".
'
No.
'.
- '
Fullname (Username)
'."\n";
+ '
'.&nameUserString('header')."
\n";
my (@parts) = sort(&getpartlist($url));
foreach my $part (@parts) {
my $display=&Apache::lonnet::metadata($url,$part.'.display');
@@ -2160,7 +2175,7 @@ sub viewgrades {
#--- call by previous routine to display each student
sub viewstudentgrade {
- my ($$url,$symb,$courseid,$student,$fullname,$parts,$weight,$ctr) = @_;
+ my ($url,$symb,$courseid,$student,$fullname,$parts,$weight,$ctr) = @_;
my ($uname,$udom) = split(/:/,$student);
$student=~s/:/_/;
my %record=&Apache::lonnet::restore($symb,$courseid,$udom,$uname);
@@ -2216,8 +2231,9 @@ sub editgrades {
$title.='Section: '.$ENV{'form.section'}.''."\n";
my $result= '
'."\n";
- $result.= '
No.
'.
- '
Fullname (username)
'."\n";
+ $result.= '
'.
+ '
No.
'.
+ '
'.&nameUserString('header')."
\n";
my %scoreptr = (
'correct' =>'correct_by_override',
@@ -2276,8 +2292,7 @@ sub editgrades {
my ($uname,$udom)=split(/_/,$user);
my %newrecord;
my $updateflag = 0;
- $line .= '
';
my $usec=$classlist->{"$uname:$udom"}[5];
if (!&canmodify($usec)) {
my $numcols=scalar(@partid)*4+2;
@@ -2495,7 +2510,6 @@ to this page if the data selected is ins
$javascript
ENDPICK
- $request->print(&show_grading_menu_form($symb,$url));
return '';
}
@@ -2756,9 +2770,9 @@ LISTJAVASCRIPT
'
'.
'
'.
'
No.
'.
- '
Fullname (username)
'.
+ '
'.&nameUserString('header').'
'.
'
No.
'.
- '
Fullname (username)
';
+ '
'.&nameUserString('header').'
';
my (undef,undef,$fullname) = &getclasslist($getsec,'1');
my $ptr = 1;
@@ -2766,8 +2780,8 @@ LISTJAVASCRIPT
my ($uname,$udom) = split(/:/,$student);
$studentTable.=($ptr%2 == 1 ? '
'."\n";
$request->print($result);
@@ -3132,16 +3145,30 @@ sub getSequenceDropDown {
return $result;
}
+#FIXME, I am in loncreatecourse, use that one instead
+sub propath {
+ my ($udom,$uname)=@_;
+ $udom=~s/\W//g;
+ $uname=~s/\W//g;
+ my $subdir=$uname.'__';
+ $subdir =~ s/(.)(.)(.).*/$1\/$2\/$3/;
+ my $proname="$Apache::lonnet::perlvar{'lonUsersDir'}/$udom/$subdir/$uname";
+ return $proname;
+}
+
sub scantron_uploads {
if (!-e $Apache::lonnet::perlvar{'lonScansDir'}) { return ''};
my $result= '";
return $result;
}
@@ -3169,9 +3196,11 @@ sub scantron_selectphase {
my $file_selector=&scantron_uploads();
my $format_selector=&scantron_scantab();
my $result;
+ #FIXME allow instructor to be able to download the scantron file
+ # and to upload it,
$result.= <
-
+
$default_form_data
@@ -3197,11 +3226,18 @@ sub scantron_selectphase {
Format of data file: $format_selector
+
+
+
+ Last line to expect an answer on:
+
+
+
-
+
$grading_menu_button
SCANTRONFORM
@@ -3213,6 +3249,7 @@ sub get_scantron_config {
my ($which) = @_;
my $fh=Apache::File->new($Apache::lonnet::perlvar{'lonTabDir'}.'/scantronformat.tab');
my %config;
+ #FIXME probably should move to XML it has already gotten a bit much now
foreach my $line (<$fh>) {
my ($name,$descrip)=split(/:/,$line);
if ($name ne $which ) { next; }
@@ -3229,6 +3266,12 @@ sub get_scantron_config {
$config{'Qlength'}=$config[8];
$config{'Qoff'}=$config[9];
$config{'Qon'}=$config[10];
+ $config{'PaperID'}=$config[11];
+ $config{'PaperIDlength'}=$config[12];
+ $config{'FirstName'}=$config[13];
+ $config{'FirstNamelength'}=$config[14];
+ $config{'LastName'}=$config[15];
+ $config{'LastNamelength'}=$config[16];
last;
}
return %config;
@@ -3244,8 +3287,53 @@ sub username_to_idmap {
return %idmap;
}
+sub scantron_fixup_scanline {
+ my ($scantron_config,$scan_data,$line,$whichline,$field,$args)=@_;
+ if ($field eq 'ID') {
+ if (length($args->{'newid'}) > $$scantron_config{'IDlength'}) {
+ return ($line,1,'New value to large');
+ }
+ if (length($args->{'newid'}) < $$scantron_config{'IDlength'}) {
+ $args->{'newid'}=sprintf('%-'.$$scantron_config{'IDlength'}.'s',
+ $args->{'newid'});
+ }
+ substr($line,$$scantron_config{'IDstart'}-1,
+ $$scantron_config{'IDlength'})=$args->{'newid'};
+ if ($args->{'newid'}=~/^\s*$/) {
+ &scan_data($scan_data,"$whichline.user",
+ $args->{'username'}.':'.$args->{'domain'});
+ }
+ } elsif ($field eq 'answer') {
+ my $length=$scantron_config->{'Qlength'};
+ my $off=$scantron_config->{'Qoff'};
+ my $on=$scantron_config->{'Qon'};
+ my $answer=${off}x$length;
+ if ($args->{'response'} eq 'none') {
+ &scan_data($scan_data,
+ "$whichline.no_bubble.".$args->{'question'},'1');
+ } else {
+ substr($answer,$args->{'response'},1)=$on;
+ &scan_data($scan_data,
+ "$whichline.no_bubble.".$args->{'question'},undef,'1');
+ }
+ my $where=$length*($args->{'question'}-1)+$scantron_config->{'Qstart'};
+ substr($line,$where-1,$length)=$answer;
+ }
+ return $line;
+}
+
+sub scan_data {
+ my ($scan_data,$key,$value,$delete)=@_;
+ my $filename=$ENV{'form.scantron_selectfile'};
+ if (defined($value)) {
+ $scan_data->{$filename.'_'.$key} = $value;
+ }
+ if ($delete) { delete($scan_data->{$filename.'_'.$key}); }
+ return $scan_data->{$filename.'_'.$key};
+}
+
sub scantron_parse_scanline {
- my ($line,$scantron_config)=@_;
+ my ($line,$whichline,$scantron_config,$scan_data)=@_;
my %record;
my $questions=substr($line,$$scantron_config{'Qstart'}-1);
my $data=substr($line,0,$$scantron_config{'Qstart'}-1);
@@ -3259,6 +3347,15 @@ sub scantron_parse_scanline {
}
$record{'scantron.ID'}=substr($data,$$scantron_config{'IDstart'}-1,
$$scantron_config{'IDlength'});
+ $record{'scantron.PaperID'}=
+ substr($data,$$scantron_config{'PaperID'}-1,
+ $$scantron_config{'PaperIDlength'});
+ $record{'scantron.FirstName'}=
+ substr($data,$$scantron_config{'FirstName'}-1,
+ $$scantron_config{'FirstNamelength'});
+ $record{'scantron.LastName'}=
+ substr($data,$$scantron_config{'LastName'}-1,
+ $$scantron_config{'LastNamelength'});
my @alphabet=('A'..'Z');
my $questnum=0;
while ($questions) {
@@ -3266,31 +3363,48 @@ sub scantron_parse_scanline {
my $currentquest=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);
- if (scalar(@array) gt 2) {
- #FIXME do something intelligent with double bubbles
- Apache->request->print(" Wha!!!