Diff for /loncom/interface/Attic/lonspreadsheet.pm between versions 1.128 and 1.130

version 1.128, 2002/10/25 15:58:35 version 1.130, 2002/10/29 16:04:13
Line 828  sub expandnamed { Line 828  sub expandnamed {
         foreach $parameter (keys(%c)) {          foreach $parameter (keys(%c)) {
             push @matches,$parameter if ($parameter =~ /$expression/);              push @matches,$parameter if ($parameter =~ /$expression/);
         }          }
         if (scalar(@matches )== 0) {          if (scalar(@matches) == 0) {
             return;              $returnvalue = 'unmatched parameter: '.$parameter;
         } elsif (scalar(@matches) == 1) {          } elsif (scalar(@matches) == 1) {
             $returnvalue = '$c{\''.$matches[0].'\'}';              $returnvalue = '$c{\''.$matches[0].'\'}';
         } elsif (scalar(@matches) > 0) {          } elsif (scalar(@matches) > 0) {
Line 840  sub expandnamed { Line 840  sub expandnamed {
                     $returnvalue = '$c{\''.$_.'\'}';                      $returnvalue = '$c{\''.$_.'\'}';
                 }                  }
             }              }
           } else {
               # There was a negative number of matches, which indicates 
               # something is wrong with reality.  Better warn the user.
               $returnvalue = 'bizzare parameter: '.$parameter;
         }          }
         return $returnvalue;          return $returnvalue;
     }      }
Line 946  ENDDEFS Line 950  ENDDEFS
 }  }
   
 #  #
 # This is actually used for the student spreadsheet, not the assessment sheet  #
 # Do not be fooled by the name!  
 #  #
 sub templaterow {  sub templaterow {
     my $sheet = shift;      my $sheet = shift;
Line 1092  sub exportdata { Line 1095  sub exportdata {
     my @exportarray=();      my @exportarray=();
     foreach ('A','B','C','D','E','F','G','H','I','J','K','L','M',      foreach ('A','B','C','D','E','F','G','H','I','J','K','L','M',
      'N','O','P','Q','R','S','T','U','V','W','X','Y','Z') {       'N','O','P','Q','R','S','T','U','V','W','X','Y','Z') {
  push(@exportarray,$sheet->{'values'}->{$_.'0'});          if (exists($sheet->{'values'}->{$_.'0'})) {
               push(@exportarray,$sheet->{'values'}->{$_.'0'});
           } else {
               push(@exportarray,'');
           }
     }       } 
     return @exportarray;      return @exportarray;
 }  }
Line 1924  ENDPOP Line 1931  ENDPOP
  next if ($_!~/^A(\d+)/);   next if ($_!~/^A(\d+)/);
         my $row=$1;          my $row=$1;
         next if (($f{$_}=~/^[\!\~\-]/)  || ($row==0));          next if (($f{$_}=~/^[\!\~\-]/)  || ($row==0));
         my @studentdata=&exportsheet($sheet,split(/\:/,$f{$_}),          my ($sname,$sdom) = split(':',$f{$_});
                                      'studentcalc');          my @studentdata=&exportsheet($sheet,$sname,$sdom,'studentcalc');
         undef %userrdatas;          undef %userrdatas;
         $now++;          $now++;
         $r->print('<script>popwin.document.popremain.remaining.value="'.          $r->print('<script>popwin.document.popremain.remaining.value="'.
Line 1936  ENDPOP Line 1943  ENDPOP
         my $index=0;          my $index=0;
         foreach ('A','B','C','D','E','F','G','H','I','J','K','L','M',          foreach ('A','B','C','D','E','F','G','H','I','J','K','L','M',
                  'N','O','P','Q','R','S','T','U','V','W','X','Y','Z') {                   'N','O','P','Q','R','S','T','U','V','W','X','Y','Z') {
             if ($studentdata[$index]) {              if (defined($studentdata[$index++])) {
                 my $col=$_;                  my $col=$_;
                 if ($studentdata[$index]=~/\D/) {                  if ($studentdata[$index]=~/\D/) {
                     $c{$col.$row}="'".$studentdata[$index]."'";                      $c{$col.$row}="'".$studentdata[$index]."'";
Line 1946  ENDPOP Line 1953  ENDPOP
                 unless ($col eq 'A') {                   unless ($col eq 'A') { 
                     $f{$col.$row}='import';                      $f{$col.$row}='import';
                 }                  }
                 $index++;  
             }              }
         }          }
     }      }

Removed from v.1.128  
changed lines
  Added in v.1.130


FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>