3 # Edit options for all poll sections in a file
5 require './fetchmail-lib.pl';
8 if ($config{'config_file'}) {
9 $file = $config{'config_file'};
12 &can_edit_user($in{'user'}) || &error($text{'poll_ecannot'});
13 @uinfo = getpwnam($in{'user'});
14 $file = "$uinfo[7]/.fetchmailrc";
15 $uheader = &text('poll_foruser', "<tt>$in{'user'}</tt>");
18 &ui_print_header($uheader, $text{'global_title'}, "");
20 @conf = &parse_config_file($file);
22 $poll = $c if ($c->{'defaults'});
25 print "<form action=save_global.cgi>\n";
26 print "<input type=hidden name=file value='$file'>\n";
27 print "<input type=hidden name=user value='$in{'user'}'>\n";
29 # Show default server options
30 print "<table border width=100%>\n";
31 print "<tr $tb> <td><b>$text{'global_header'}</b></td> </tr>\n";
32 print "<tr $cb> <td><table width=100%>\n";
34 print "<tr> <td><b>$text{'poll_proto'}</b></td>\n";
35 print "<td><select name=proto>\n";
36 printf "<option value='' %s> %s\n",
37 $poll->{'proto'} ? '' : 'selected', $text{'default'};
38 foreach $p ('pop3', 'pop2', 'imap', 'imap-k4', 'imap-gss', 'apop', 'kpop') {
39 printf "<option value=%s %s>%s\n",
40 $p, lc($poll->{'proto'}) eq $p ? 'selected' : '', uc($p);
41 $found++ if (lc($poll->{'proto'}) eq $p);
43 printf "<option value=%s selected>%s\n", $poll->{'proto'}, uc($poll->{'proto'})
44 if (!$found && $poll->{'proto'});
45 print "</select></td>\n";
47 print "<td><b>$text{'poll_port'}</b></td>\n";
48 printf "<td><input type=radio name=port_def value=1 %s> %s\n",
49 $poll->{'port'} ? '' : 'checked', $text{'default'};
50 printf "<input type=radio name=port_def value=0 %s> %s\n",
51 $poll->{'port'} ? 'checked' : '';
52 printf "<input name=port size=8 value='%s'></td> </tr>\n",
55 @interface = split(/\//, $poll->{'interface'});
56 print "<tr> <td valign=top><b>$text{'poll_interface'}</b></td><td colspan=3>\n";
57 printf "<input type=radio name=interface_def value=1 %s> %s<br>\n",
58 @interface ? '' : 'checked', $text{'poll_interface_def'};
59 printf "<input type=radio name=interface_def value=0 %s> %s\n",
60 @interface ? 'checked' : '', $text{'poll_interface_ifc'};
61 print "<input name=interface size=8 value='$interface[0]'> ",
62 "$text{'poll_interface_ip'}\n";
63 print "<input name=interface_net size=15 value='$interface[1]'> /\n";
64 print "<input name=interface_mask size=15 value='$interface[2]'></td> </tr>\n";
66 print "</table></td></tr></table>\n";
68 print "<table width=100%><tr>\n";
69 print "<td><input type=submit value='$text{'save'}'></td>\n";
70 print "</tr></table>\n";
72 if (!$fetchmail_config && $config{'view_mode'}) {
73 &ui_print_footer("edit_user.cgi?user=$in{'user'}", $text{'user_return'},
74 "", $text{'index_return'});
77 &ui_print_footer("", $text{'index_return'});