--- loncom/interface/lonhelper.pm 2005/10/17 19:46:12 1.124 +++ loncom/interface/lonhelper.pm 2005/10/17 20:21:31 1.125 @@ -1,7 +1,7 @@ # The LearningOnline Network with CAPA # .helper XML handler to implement the LON-CAPA helper # -# $Id: lonhelper.pm,v 1.124 2005/10/17 19:46:12 albertel Exp $ +# $Id: lonhelper.pm,v 1.125 2005/10/17 20:21:31 albertel Exp $ # # Copyright Michigan State University Board of Trustees # @@ -2017,18 +2017,19 @@ BUTTONS $mapUrl = $self->{MAP_URL}; } - my @defaultSymbs; + my %defaultSymbs; if (defined($self->{DEFAULT_VALUE})) { my $valueFunc = eval($self->{DEFAULT_VALUE}); die 'Error in default value code for variable ' . $self->{'variable'} . ', Perl said: ' . $@ if $@; - @defaultSymbs = &$valueFunc($helper, $self); - if (!$multichoice) { # only allowed 1 + my @defaultSymbs = &$valueFunc($helper, $self); + if (!$multichoice && @defaultSymbs) { # only allowed 1 @defaultSymbs = ($defaultSymbs[0]); } + %defaultSymbs = map { if ($_) {($_,1) } } @defaultSymbs; + delete($defaultSymbs{''}); } - # Create the composite function that renders the column on the nav map # have to admit any language that lets me do this can't be all bad # - Jeremy (Pythonista) ;-) @@ -2076,9 +2077,9 @@ BUTTONS } $col .= "symb(); - if (grep(/\Q$symb\E/,@defaultSymbs)) { + if (exists($defaultSymbs{$symb})) { $col .= "checked='checked' "; $checked = 1; }