my $print = defined ($FieldNames{$field}) ? $FieldNames{$field} : $field;
my @values = @{$contacts->{$field}};
- next if (!$UserID and $field eq 'group');
+ next if ($field eq 'group');
push (@values, '');
}
}
+ if ($UserID)
+ {
+ my %c_groups = map { $_ => 1 } (@{$contacts->{'group'}});
+ my %a_groups = ();
+ my @a_persons = LiCoM::Person->search ();
+
+ for (@a_persons)
+ {
+ $a_groups{$_} = 1 for ($_->get ('group'));
+ }
+
+ print "\t\t\t<tr>\n",
+ "\t\t\t\t<th>", $FieldNames{'group'}, "</th>\n",
+ qq(\t\t\t\t<td><select name="group" multiple="multiple">\n);
+ for (sort (keys %a_groups))
+ {
+ my $group = $_;
+ my $selec = defined ($c_groups{$group}) ? ' selected="selected"' : '';
+
+ print qq(\t\t\t\t\t<option value="$group"$selec>$group</option>\n);
+ }
+ print "\t\t\t\t</select></td>\n",
+ "\t\t\t</tr>\n";
+ }
+
print <<EOF;
<tr>
<th colspan="2" class="menu">