remove one use of sortHash

This commit is contained in:
Graham Knop 2010-08-24 17:05:00 -05:00
parent fadc4f34ea
commit 95f98696be
2 changed files with 15 additions and 7 deletions

View file

@ -199,15 +199,20 @@ sub view {
my $f = WebGUI::HTMLForm->new($session,-action=>$self->getUrl);
if (@users) {
my %nameHash;
tie %nameHash, "Tie::IxHash";
%nameHash = $self->_fetchNames(@users);
$nameHash{""} = $i18n->get('myself');
%nameHash = WebGUI::Utility::sortHash(%nameHash);
my %names = (
$self->_fetchNames(@users),
"" => $i18n->get('myself'),
);
my @options =
map { @$_ }
sort { $a->[1] cmp $b->[1] }
map { [ $_, $names{$_} ] }
keys %names
;
$f->selectBox(
-name=>"delegate",
-options=>\%nameHash,
-options=>\@options,
-value=>[ $session->scratch->get("userId") ],
-label=>$i18n->get('delegate'),
-hoverHelp=>$i18n->get('delegate description'),

View file

@ -165,7 +165,10 @@ sub getOptions {
my %options = ();
tie %options, 'Tie::IxHash';
if (ref $possibleValues eq "HASH") {
%options = %{$possibleValues};
%options = %{$possibleValues};
}
elsif (ref $possibleValues eq 'ARRAY') {
%options = @$possibleValues;
}
else {
foreach my $line (split "\n", $possibleValues) {