The mutt-script now displays groups as extra info
[licom.git] / licom.cgi
index 58c88cc..59eddd6 100755 (executable)
--- a/licom.cgi
+++ b/licom.cgi
@@ -482,7 +482,7 @@ EOF
                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, '');
                
@@ -499,6 +499,31 @@ EOF
                }
        }
 
+       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">