--- loncom/lonnet/perl/lonnet.pm 2019/01/27 23:16:36 1.1403 +++ loncom/lonnet/perl/lonnet.pm 2019/02/15 20:56:18 1.1405 @@ -1,7 +1,7 @@ # The LearningOnline Network # TCP networking package # -# $Id: lonnet.pm,v 1.1403 2019/01/27 23:16:36 raeburn Exp $ +# $Id: lonnet.pm,v 1.1405 2019/02/15 20:56:18 raeburn Exp $ # # Copyright Michigan State University Board of Trustees # @@ -77,7 +77,7 @@ use CGI::Cookie; use Encode; -use vars qw(%perlvar %spareid %pr %prp $memcache %packagetab $tmpdir +use vars qw(%perlvar %spareid %pr %prp $memcache %packagetab $tmpdir $deftex $_64bit %env %protocol %loncaparevs %serverhomeIDs %needsrelease %managerstab); @@ -4361,7 +4361,13 @@ sub bubblesheet_converter { if ((&domain($cdom) ne '') && ($fullpath =~ m{^\Q$perlvar{'lonDocRoot'}/userfiles/$cdom/\E$match_courseid/scantron_orig}) && (-e $fullpath) && (ref($config) eq 'HASH') && ($format ne '')) { - my %csvcols = %{$config}; + my (%csvcols,%csvoptions); + if (ref($config->{'fields'}) eq 'HASH') { + %csvcols = %{$config->{'fields'}}; + } + if (ref($config->{'options'}) eq 'HASH') { + %csvoptions = %{$config->{'options'}}; + } my %csvbynum = reverse(%csvcols); my %scantronconf = &get_scantron_config($format,$cdom); if (keys(%scantronconf)) { @@ -4397,7 +4403,10 @@ sub bubblesheet_converter { my %lettdig = &letter_to_digits(); my %diglett = reverse(%lettdig); my $numletts = scalar(keys(%lettdig)); + my $num = 0; while (my $line=<$fh>) { + $num ++; + next if (($num == 1) && ($csvoptions{'hdr'} == 1)); $line =~ s{[\r\n]+$}{}; my %found; my @values = split(/,/,$line); @@ -4454,8 +4463,10 @@ sub bubblesheet_converter { $found{'FirstQuestion'} .= $values[$i]; } } elsif (exists($csvbynum{$i})) { - $values[$i] =~ s/^\s+//; - if ($csvbynum{$i} eq 'PaperID') { + if ($csvoptions{'rem'}) { + $values[$i] =~ s/^\s+//; + } + if (($csvbynum{$i} eq 'PaperID') && ($csvoptions{'pad'})) { while (length($values[$i]) < $scantronconf{$maplength{$csvbynum{$i}}}) { $values[$i] = '0'.$values[$i]; } @@ -14800,6 +14811,11 @@ BEGIN { } +# ------------- set default texengine (domain default overrides this) +{ + $deftex = LONCAPA::texengine(); +} + $memcache=new Cache::Memcached({'servers' => ['127.0.0.1:11211'], 'compress_threshold'=> 20_000, }); @@ -15525,7 +15541,6 @@ Returns: for the sheet of paper FirstName - column that the first name starts in FirstNameLength - number of columns that the first name spans - LastName - column that the last name starts in LastNameLength - number of columns that the last name spans BubblesPerRow - number of bubbles available in each row used to