3 # Display list of options for PPP, and show if mgetty has autoPPP mode enabled
5 require './pap-lib.pl';
6 $access{'options'} || &error($text{'options_ecannot'});
8 &ui_print_header(undef, $text{'options_title'}, "");
9 $of = $config{'ppp_options'};
10 if ($in{'file'} =~ /^\Q$of\E\.ttyS(\d+)$/) {
12 print "<center><font size=+1>",&text('options_serial', $1+1),
15 elsif ($in{'file'} =~ /^\Q$of\E\.(\S+)$/) {
18 print "<center><font size=+1>",&text('options_dev', "<tt>$tty</tt>"),
22 # Check if the PPP daemon is actually installed
23 if (!&has_command($config{'pppd'})) {
24 print "<p>",&text('options_ecmd', "<tt>$config{'pppd'}</tt>"),"<p>\n";
25 &ui_print_footer("", $text{'index_return'});
29 # Check if the pppd is the linux one
30 $out = `$config{'pppd'} -v 2>&1`;
31 if ($out !~ /version\s+([0-9\.]+)/) {
32 print "<p>",&text('options_epppd', "<tt>$config{'pppd'}</tt>"),"<p>\n";
33 &ui_print_footer("", $text{'index_return'});
37 @opts = &parse_ppp_options($in{'file'} || $of);
39 # Check for the mgetty login config file
40 if (!-r $config{'login_config'}) {
41 print "<p>",&text('options_elogin',
42 "<tt>$config{'login_config'}</tt>",
43 "$gconfig{'webprefix'}/config.cgi?$module_name"),"<p>\n";
44 &ui_print_footer("", $text{'index_return'});
47 @login = &parse_login_config();
50 print "<p>$text{'options_desc'}<p>\n" if (!$in{'file'});
52 print "<form action=save_options.cgi>\n";
53 print "<input type=hidden name=file value='$in{'file'}'>\n";
54 print "<input type=hidden name=tty value='$tty'>\n";
55 print "<table border width=100%>\n";
56 print "<tr $tb> <td><b>$text{'options_header'}</b></td> </tr>\n";
57 print "<tr $cb> <td><table width=100%>\n";
60 # Show if autoPPP is being used or not
61 ($auto) = grep { $_->{'user'} eq "/AutoPPP/" } @login;
62 print "<tr> <td colspan=2><b>$text{'options_autoppp'}</b></td>\n";
63 printf "<td><input name=auto type=radio value=1 %s> %s\n",
64 $auto ? "checked" : "", $text{'yes'};
65 printf "<input name=auto type=radio value=0 %s> %s</td> </tr>\n",
66 $auto ? "" : "checked", $text{'no'};
67 print "<tr> <td colspan=4><hr></td> </tr>\n";
70 ($ip) = grep { $_->{'local'} } @opts;
71 print "<tr> <td><b>$text{'options_ip'}</b></td>\n";
72 printf "<td colspan=3><input type=radio name=ip_def value=1 %s> %s\n",
73 $ip ? "" : "checked", $text{'options_auto'};
74 printf "<input type=radio name=ip_def value=0 %s>\n",
76 printf "%s <input name=local size=15 value='%s'>\n",
77 $text{'options_local'}, $ip->{'local'};
78 printf "%s <input name=remote size=15 value='%s'></td> </tr>\n",
79 $text{'options_remote'}, $ip->{'remote'};
81 $nm = &find("netmask", \@opts);
82 print "<tr> <td><b>$text{'options_netmask'}</b></td>\n";
83 printf "<td><input type=radio name=netmask_def value=1 %s> %s\n",
84 $nm ? "" : "checked", $text{'default'};
85 printf "<input type=radio name=netmask_def value=0 %s>\n",
87 printf "<input name=netmask size=15 value='%s'></td>\n", $nm->{'value'};
89 $proxy = &find("proxyarp", \@opts);
90 print "<td><b>$text{'options_proxyarp'}</b></td>\n";
91 printf "<td><input type=radio name=proxyarp value=1 %s> %s\n",
92 $proxy ? "checked" : "", $text{'yes'};
93 printf "<input type=radio name=proxyarp value=0 %s> %s</td> </tr>\n",
94 $proxy ? "" : "checked", $text{'no'};
96 $lock = &find("lock", \@opts);
97 print "<tr> <td><b>$text{'options_lock'}</b></td>\n";
98 printf "<td><input type=radio name=lock value=1 %s> %s\n",
99 $lock ? "checked" : "", $text{'yes'};
100 printf "<input type=radio name=lock value=0 %s> %s</td>\n",
101 $lock ? "" : "checked", $text{'no'};
103 $modem = &find("modem", \@opts);
104 $local = &find("local", \@opts);
105 print "<td><b>$text{'options_ctrl'}</b></td>\n";
106 print "<td><select name=ctrl>\n";
107 printf "<option value=0 %s> %s\n",
108 $local ? "selected" : "", $text{'options_ctrl0'};
109 printf "<option value=1 %s> %s\n",
110 $modem ? "selected" : "", $text{'options_ctrl1'};
111 printf "<option value=2 %s> %s\n",
112 $modem || $local ? "" : "selected", $text{'default'};
113 print "</select></td> </tr>\n";
115 $auth = &find("auth", \@opts);
116 $noauth = &find("noauth", \@opts);
117 print "<tr> <td><b>$text{'options_auth'}</b></td>\n";
118 printf "<td colspan=3><input type=radio name=auth value=0 %s> %s\n",
119 $noauth || $auth ? "" : "checked", $text{'options_auth0'};
120 printf "<input type=radio name=auth value=1 %s> %s\n",
121 $noauth ? "checked" : "", $text{'options_auth1'};
122 printf "<input type=radio name=auth value=2 %s> %s</td> </tr>\n",
123 $auth ? "checked" : "", $text{'options_auth2'};
125 $login = &find("login", \@opts);
126 print "<tr> <td><b>$text{'options_login'}</b></td>\n";
127 printf "<td><input type=radio name=login value=1 %s> %s\n",
128 $login ? "checked" : "", $text{'yes'};
129 printf "<input type=radio name=login value=0 %s> %s</td>\n",
130 $login ? "" : "checked", $text{'no'};
132 $idle = &find("idle", \@opts);
133 print "<td><b>$text{'options_idle'}</b></td>\n";
134 printf "<td><input type=radio name=idle_def value=1 %s> %s\n",
135 $idle ? "" : "checked", $text{'options_idle_def'};
136 printf "<input type=radio name=idle_def value=0 %s>\n",
137 $idle ? "checked" : "";
138 printf "<input name=idle size=8 value='%s'> %s</td> </tr>\n",
139 $idle->{'value'}, $text{'mgetty_secs'};
141 @dns = &find("ms-dns", \@opts);
142 print "<tr> <td><b>$text{'options_dns'}</b></td>\n";
143 printf "<td colspan=3><input name=dns size=50 value='%s'></td> </tr>\n",
144 join(" ", map { $_->{'value'} } @dns);
146 print "</table></td></tr></table>\n";
147 print "<input type=submit value='$text{'save'}'></form>\n";
150 &ui_print_footer("list_mgetty.cgi", $text{'mgetty_return'});
153 &ui_print_footer("", $text{'index_return'});