--- loncom/homework/functionplotresponse.pm 2012/02/29 01:24:47 1.94 +++ loncom/homework/functionplotresponse.pm 2012/02/29 01:46:52 1.95 @@ -1,7 +1,7 @@ # LearningOnline Network with CAPA # Functionplot responses # -# $Id: functionplotresponse.pm,v 1.94 2012/02/29 01:24:47 www Exp $ +# $Id: functionplotresponse.pm,v 1.95 2012/02/29 01:46:52 www Exp $ # # Copyright Michigan State University Board of Trustees # @@ -551,6 +551,10 @@ sub start_plotvector { $label=~s/\W//gs; $label=ucfirst($label); unless ($label) { $label="NewVector"; } + if ($Apache::functionplotresponse::vectorlabels{$label}) { + &Apache::lonxml::warning(&mt('Vector labels must be unique: [_1]',$label)); + } + $Apache::functionplotresponse::vectorlabels{$label}=1; if ($target eq 'web') { my ($xmin,$xmax,$ymin,$ymax)=&boundaries($parstack,$safeeval,-3); unless (defined($tailx)) { $tailx=$xmin; } @@ -621,6 +625,10 @@ sub start_drawvectorsum { $thisvector=~s/\W//gs; $thisvector=ucfirst($thisvector); unless ($thisvector) { next; } + unless ($Apache::functionplotresponse::vectorlabels{$thisvector}) { + &Apache::lonxml::warning(&mt('Vectors must be defined before using them for drawing vector sums: [_1]',$thisvector)); + next; + } my $vectorx=$thisvector.'X'; my $vectory=$thisvector.'Y'; $result.=(<