#!/usr/local/bin/perl # list_addresses.cgi # Display contents of the user's address book require './mailbox-lib.pl'; &ReadParse(); &ui_print_header(undef, $text{'address_title'}, ""); # Start tabs for users and groups $prog = "list_addresses.cgi?mode="; print &ui_tabs_start([ [ "users", $text{'address_users'}, $prog."users" ], [ "groups", $text{'address_groups'}, $prog."groups" ] ], "mode", $in{'mode'} || "users", 1); print &ui_tabs_start_tab("mode", "users"); @addrs = &list_addresses(); print "$text{'address_desc'}

\n"; if (@addrs || $in{'add'}) { if ($in{'add'} || $in{'edit'} ne '') { print "

\n"; print "\n"; print "\n"; } print "\n"; print " ", " ", " ", $config{'edit_from'} ? " " : "", "\n"; foreach $a (@addrs) { next if (!defined($a->[2])); print "\n"; if ($in{'edit'} eq $a->[2]) { # Editing this row print "\n"; print "\n"; if ($config{'edit_from'}) { &from_sel($a->[3]); } else { print "\n"; } print "\n"; } else { # Just showing this row print "\n"; print "\n"; print "\n" if ($config{'edit_from'}); } print "\n"; } if ($in{'add'}) { print "\n"; print "\n"; print "\n"; print "\n"; print &from_sel() if ($config{'edit_from'}); print "\n"; print "\n"; } print "
$text{'address_addr'}$text{'address_name'}$text{'address_from'}
\n"; if ($in{'edit'} ne $a->[2]) { print "", "$text{'address_edit'}\n"; } else { print "", "$text{'cancel'}\n"; } print " \n"; print "", "$text{'address_delete'}$a->[0]",$a->[1] ? $a->[1] : "
","
",$a->[3] == 1 ? $text{'yes'} : $a->[3] == 2 ? $text{'address_yd'} : $text{'no'},"
$text{'cancel'}
\n"; if ($in{'add'} || $in{'edit'} ne '') { print "
\n"; } } else { print "$text{'address_none'}

\n"; } print "", "$text{'address_add'}
\n" if (!$in{'add'}); print &ui_tabs_end_tab(); print &ui_tabs_start_tab("mode", "groups"); @gaddrs = grep { defined($_->[2]) } &list_address_groups(); print "$text{'address_gdesc'}

\n"; if (@gaddrs || $in{'gadd'}) { if ($in{'gadd'} || $in{'gedit'} ne '') { print "

\n"; print "\n"; print "\n"; } print "\n"; print " ", " ", " ", "\n"; foreach $a (@gaddrs) { print "\n"; if ($in{'gedit'} eq $a->[2]) { print "\n"; print "\n"; } else { print "\n"; print "\n"; } print "\n"; } if ($in{'gadd'}) { print "\n"; print "\n"; print "\n"; print "\n"; print "\n"; } print "
$text{'address_group'}$text{'address_members'}
\n"; if ($in{'gedit'} ne $a->[2]) { print "", "$text{'address_edit'}\n"; } else { print "", "$text{'cancel'}\n"; } print " \n"; print "", "$text{'address_delete'} ", &address_button("members", 0, 0, 0, 1),"\n"; print "$a->[0]",&html_escape($a->[1]),"
$text{'cancel'} ", &address_button("members", 0, 0, 0, 1),"\n"; print "
\n"; if ($in{'gadd'} || $in{'gedit'} ne '') { print "
\n"; } } else { print "$text{'address_gnone'}

\n"; } print "", "$text{'address_gadd'}
\n" if (!$in{'gadd'}); print &ui_tabs_end_tab(); print &ui_tabs_end(1); &ui_print_footer("", $text{'mail_return'}); sub from_sel { print "\n"; }