version 1.125, 2005/10/17 20:21:31
|
version 1.126, 2005/10/17 21:14:55
|
Line 2370 BUTTONS
|
Line 2370 BUTTONS
|
$result .= '<font color="#FF0000">' . $self->{ERROR_MSG} . '</font><br /><br />'; |
$result .= '<font color="#FF0000">' . $self->{ERROR_MSG} . '</font><br /><br />'; |
} |
} |
|
|
|
my %defaultUsers; |
|
if (defined($self->{DEFAULT_VALUE})) { |
|
my $valueFunc = eval($self->{DEFAULT_VALUE}); |
|
die 'Error in default value code for variable ' . |
|
$self->{'variable'} . ', Perl said: ' . $@ if $@; |
|
my @defaultUsers = &$valueFunc($helper, $self); |
|
if (!$self->{'multichoice'} && @defaultUsers) { # only allowed 1 |
|
@defaultUsers = ($defaultUsers[0]); |
|
} |
|
%defaultUsers = map { if ($_) {($_,1) } } @defaultUsers; |
|
delete($defaultUsers{''}); |
|
} |
my $choices = []; |
my $choices = []; |
|
|
# Load up the non-students, if necessary |
# Load up the non-students, if necessary |
Line 2435 BUTTONS
|
Line 2447 BUTTONS
|
$result .= "<tr><td><input type='$type' name='" . |
$result .= "<tr><td><input type='$type' name='" . |
$self->{'variable'} . '.forminput' . "'"; |
$self->{'variable'} . '.forminput' . "'"; |
|
|
if (!$self->{'multichoice'} && !$checked) { |
if (%defaultUsers) { |
|
my $user=$choice->[0]; |
|
if (exists($defaultUsers{$user})) { |
|
$result .= " checked='checked' "; |
|
$checked = 1; |
|
} |
|
} elsif (!$self->{'multichoice'} && !$checked) { |
$result .= " checked='checked' "; |
$result .= " checked='checked' "; |
$checked = 1; |
$checked = 1; |
} |
} |