diff options
author | gnhb <gnoahb@gmail.com> | 2010-05-26 21:07:00 +0700 |
---|---|---|
committer | gnhb <gnoahb@gmail.com> | 2010-05-26 21:07:00 +0700 |
commit | 0661b194d96764d8cb2f09eb8615c558b9a57bec (patch) | |
tree | 2e9ac43c8c05ab48b3d036dac6781fb9981b41ff /usr | |
parent | d9e2c1714bc55f546702a8660f62e8cff2716aa4 (diff) | |
download | pfsense-0661b194d96764d8cb2f09eb8615c558b9a57bec.zip pfsense-0661b194d96764d8cb2f09eb8615c558b9a57bec.tar.gz |
Fix many things related to PPP connections.
Fixed tab array numbering in interfaces_* files. Enabled multilink over PPtP connections.
Fixed handling of bandwidth, mtu, mru settings. Removed unnecessary curly brackets from
single line if conditionals, and more . . .
Diffstat (limited to 'usr')
-rwxr-xr-x | usr/local/www/interfaces.php | 7 | ||||
-rw-r--r-- | usr/local/www/interfaces_bridge.php | 8 | ||||
-rw-r--r-- | usr/local/www/interfaces_gif.php | 8 | ||||
-rw-r--r-- | usr/local/www/interfaces_gre.php | 8 | ||||
-rwxr-xr-x | usr/local/www/interfaces_groups.php | 8 | ||||
-rw-r--r-- | usr/local/www/interfaces_lagg.php | 8 | ||||
-rw-r--r-- | usr/local/www/interfaces_ppps_edit.php | 159 | ||||
-rwxr-xr-x | usr/local/www/interfaces_qinq.php | 8 | ||||
-rwxr-xr-x | usr/local/www/interfaces_vlan.php | 8 | ||||
-rw-r--r-- | usr/local/www/interfaces_wireless.php | 8 | ||||
-rw-r--r-- | usr/local/www/javascript/interfaces_ppps_edit/ppps_edit.js | 57 |
11 files changed, 166 insertions, 121 deletions
diff --git a/usr/local/www/interfaces.php b/usr/local/www/interfaces.php index 22055f8..a68112a 100755 --- a/usr/local/www/interfaces.php +++ b/usr/local/www/interfaces.php @@ -103,11 +103,6 @@ if (is_array($config['ppps']['ppp']) && count($config['ppps']['ppp'])) { if ($wancfg['ptpid'] == $a_ppps[$pppid]['ptpid']) { $pconfig['pppid'] = $pppid; - if (isset($a_ppps[$pppid]['defaultgw'])) - $pconfig['defaultgw'] = true; - else - $pconfig['defaultgw'] = false; - if ($a_ppps[$pppid]['type'] == "pppoe"){ $pconfig['pppoe_username'] = $a_ppps[$pppid]['username']; $pconfig['pppoe_password'] = base64_decode($a_ppps[$pppid]['password']); @@ -584,7 +579,6 @@ if ($_POST) { $wancfg['if'] = $_POST['type'] . $if_num; $wancfg['ptpid'] = $_POST['ptpid']; $wancfg['ipaddr'] = $_POST['type']; - $ppp['defaultgw'] = $_POST['defaultgw']; if($gateway_item) { $a_gateways[] = $gateway_item; } @@ -1769,7 +1763,6 @@ $types = array("none" => "None", "static" => "Static", "dhcp" => "DHCP", "pppoe" <input name="pppid" type="hidden" value="<?=$pppid;?>"> <input name="ppp_port" type="hidden" value="<?=$a_ppps[$pppid]['ports'];?>"> <input name="ptpid" type="hidden" value="<?=$a_ppps[$pppid]['ptpid'];?>"> - <input name="defaultgw" type="hidden" value="<?=$pconfig['defaultgw'];?>"> <?php else: ?> <input name="ptpid" type="hidden" value="<?=uniqid('', true);?>"> <?php endif; ?> diff --git a/usr/local/www/interfaces_bridge.php b/usr/local/www/interfaces_bridge.php index 8244d50..e7aa71d 100644 --- a/usr/local/www/interfaces_bridge.php +++ b/usr/local/www/interfaces_bridge.php @@ -92,10 +92,10 @@ include("head.inc"); $tab_array[3] = array("VLANs", false, "interfaces_vlan.php"); $tab_array[4] = array("QinQs", false, "interfaces_qinq.php"); $tab_array[5] = array("PPPs", false, "interfaces_ppps.php"); - $tab_array[7] = array("GRE", false, "interfaces_gre.php"); - $tab_array[8] = array("GIF", false, "interfaces_gif.php"); - $tab_array[9] = array("Bridges", true, "interfaces_bridge.php"); - $tab_array[10] = array("LAGG", false, "interfaces_lagg.php"); + $tab_array[6] = array("GRE", false, "interfaces_gre.php"); + $tab_array[7] = array("GIF", false, "interfaces_gif.php"); + $tab_array[8] = array("Bridges", true, "interfaces_bridge.php"); + $tab_array[9] = array("LAGG", false, "interfaces_lagg.php"); display_top_tabs($tab_array); ?> </td></tr> diff --git a/usr/local/www/interfaces_gif.php b/usr/local/www/interfaces_gif.php index f09ef95..08ef8f8 100644 --- a/usr/local/www/interfaces_gif.php +++ b/usr/local/www/interfaces_gif.php @@ -91,10 +91,10 @@ include("head.inc"); $tab_array[3] = array("VLANs", false, "interfaces_vlan.php"); $tab_array[4] = array("QinQs", false, "interfaces_qinq.php"); $tab_array[5] = array("PPPs", false, "interfaces_ppps.php"); - $tab_array[7] = array("GRE", false, "interfaces_gre.php"); - $tab_array[8] = array("GIF", true, "interfaces_gif.php"); - $tab_array[9] = array("Bridges", false, "interfaces_bridge.php"); - $tab_array[10] = array("LAGG", false, "interfaces_lagg.php"); + $tab_array[6] = array("GRE", false, "interfaces_gre.php"); + $tab_array[7] = array("GIF", true, "interfaces_gif.php"); + $tab_array[8] = array("Bridges", false, "interfaces_bridge.php"); + $tab_array[9] = array("LAGG", false, "interfaces_lagg.php"); display_top_tabs($tab_array); ?> </td></tr> diff --git a/usr/local/www/interfaces_gre.php b/usr/local/www/interfaces_gre.php index b92a25f..17b14fe 100644 --- a/usr/local/www/interfaces_gre.php +++ b/usr/local/www/interfaces_gre.php @@ -91,10 +91,10 @@ include("head.inc"); $tab_array[3] = array("VLANs", false, "interfaces_vlan.php"); $tab_array[4] = array("QinQs", false, "interfaces_qinq.php"); $tab_array[5] = array("PPPs", false, "interfaces_ppps.php"); - $tab_array[7] = array("GRE", true, "interfaces_gre.php"); - $tab_array[8] = array("GIF", false, "interfaces_gif.php"); - $tab_array[9] = array("Bridges", false, "interfaces_bridge.php"); - $tab_array[10] = array("LAGG", false, "interfaces_lagg.php"); + $tab_array[6] = array("GRE", true, "interfaces_gre.php"); + $tab_array[7] = array("GIF", false, "interfaces_gif.php"); + $tab_array[8] = array("Bridges", false, "interfaces_bridge.php"); + $tab_array[9] = array("LAGG", false, "interfaces_lagg.php"); display_top_tabs($tab_array); ?> </td></tr> diff --git a/usr/local/www/interfaces_groups.php b/usr/local/www/interfaces_groups.php index b582eb2..27a088a 100755 --- a/usr/local/www/interfaces_groups.php +++ b/usr/local/www/interfaces_groups.php @@ -77,10 +77,10 @@ include("head.inc"); $tab_array[3] = array("VLANs", false, "interfaces_vlan.php"); $tab_array[4] = array("QinQs", false, "interfaces_qinq.php"); $tab_array[5] = array("PPPs", false, "interfaces_ppps.php"); - $tab_array[7] = array("GRE", false, "interfaces_gre.php"); - $tab_array[8] = array("GIF", false, "interfaces_gif.php"); - $tab_array[9] = array("Bridges", false, "interfaces_bridge.php"); - $tab_array[10] = array("LAGG", false, "interfaces_lagg.php"); + $tab_array[6] = array("GRE", false, "interfaces_gre.php"); + $tab_array[7] = array("GIF", false, "interfaces_gif.php"); + $tab_array[8] = array("Bridges", false, "interfaces_bridge.php"); + $tab_array[9] = array("LAGG", false, "interfaces_lagg.php"); display_top_tabs($tab_array); ?> </td></tr> diff --git a/usr/local/www/interfaces_lagg.php b/usr/local/www/interfaces_lagg.php index 19d2aa2..a8445e2 100644 --- a/usr/local/www/interfaces_lagg.php +++ b/usr/local/www/interfaces_lagg.php @@ -97,10 +97,10 @@ include("head.inc"); $tab_array[3] = array("VLANs", false, "interfaces_vlan.php"); $tab_array[4] = array("QinQs", false, "interfaces_qinq.php"); $tab_array[5] = array("PPPs", false, "interfaces_ppps.php"); - $tab_array[7] = array("GRE", false, "interfaces_gre.php"); - $tab_array[8] = array("GIF", false, "interfaces_gif.php"); - $tab_array[9] = array("Bridges", false, "interfaces_bridge.php"); - $tab_array[10] = array("LAGG", true, "interfaces_lagg.php"); + $tab_array[6] = array("GRE", false, "interfaces_gre.php"); + $tab_array[7] = array("GIF", false, "interfaces_gif.php"); + $tab_array[8] = array("Bridges", false, "interfaces_bridge.php"); + $tab_array[9] = array("LAGG", true, "interfaces_lagg.php"); display_top_tabs($tab_array); ?> </td></tr> diff --git a/usr/local/www/interfaces_ppps_edit.php b/usr/local/www/interfaces_ppps_edit.php index 0464a49..f9cd4ef 100644 --- a/usr/local/www/interfaces_ppps_edit.php +++ b/usr/local/www/interfaces_ppps_edit.php @@ -109,13 +109,13 @@ if (isset($id) && $a_ppps[$id]) { $pconfig['apnum'] = $a_ppps[$id]['apnum']; $pconfig['phone'] = $a_ppps[$id]['phone']; $pconfig['connect-timeout'] = $a_ppps[$id]['connect-timeout']; - $pconfig['localip'] = $a_ppps[$id]['localip']; - $pconfig['gateway'] = $a_ppps[$id]['gateway']; + $pconfig['localip'] = explode(",",$a_ppps[$id]['localip']); + $pconfig['gateway'] = explode(",",$a_ppps[$id]['gateway']); } if ($a_ppps[$id]['type'] == "pptp") { - $pconfig['localip'] = $a_ppps[$id]['localip']; - $pconfig['subnet'] = $a_ppps[$id]['subnet']; - $pconfig['gateway'] = $a_ppps[$id]['gateway']; + $pconfig['localip'] = explode(",",$a_ppps[$id]['localip']); + $pconfig['subnet'] = explode(",",$a_ppps[$id]['subnet']); + $pconfig['gateway'] = explode(",",$a_ppps[$id]['gateway']); } if ($a_ppps[$id]['type'] == "pppoe") { $pconfig['provider'] = $a_ppps[$id]['provider']; @@ -216,8 +216,6 @@ if ($_POST) { } if ($_POST['type'] == "ppp" && count($_POST['interfaces']) > 1) $input_errors[] = "Multilink connections (MLPPP) using the PPP link type is not currently supported. Please select only one Link Interface."; - if ($_POST['type'] == "pptp" && count($_POST['interfaces']) > 1) - $input_errors[] = "Multilink connections (MLPPP) using the PPTP link type is not currently supported. Please select only one Link Interface."; if (($_POST['provider'] && !is_domain($_POST['provider']))) $input_errors[] = "The service name contains invalid characters."; if (($_POST['idletimeout'] != "") && !is_numericint($_POST['idletimeout'])) @@ -239,20 +237,22 @@ if ($_POST) { if ($date_nums[2] < date("Y")) $input_errors[] = gettext("A valid PPPoE reset year must be specified. Don't select a year in the past!"); } - if (($_POST['localip'] && !is_ipaddr($_POST['localip']))) - $input_errors[] = "A valid PPTP local IP address must be specified."; - if (($_POST['subnet'] && !is_numeric($_POST['subnet']))) - $input_errors[] = "A valid PPTP subnet bit count must be specified."; - if (($_POST['gateway'] && !is_ipaddr($_POST['gateway']))) - $input_errors[] = "A valid PPTP remote IP address must be specified."; -/* - if (($_POST['bandwidth'] != "") && !is_numericint($_POST['bandwidth'])) - $input_errors[] = "The bandwidth value must be an integer."; - if ($_POST['mtu'] && ($_POST['mtu'] < 576)) - $input_errors[] = "The MTU must be greater than 576 bytes."; - if ($_POST['mru'] && ($_POST['mru'] < 576)) - $input_errors[] = "The MRU must be greater than 576 bytes."; + + foreach($_POST['interfaces'] as $iface){ + if ($_POST['localip'][$iface] && !is_ipaddr($_POST['localip'][$iface])) + $input_errors[] = "A valid local IP address must be specified for {$iface}."; +/* if (($_POST['subnet'][$iface] && !is_numeric($_POST['subnet'][$iface]))) + $input_errors[] = "A valid PPTP subnet bit count must be specified for {$iface}."; */ + if (($_POST['gateway'][$iface] && !is_ipaddr($_POST['gateway'][$iface]))) + $input_errors[] = "A valid gateway (remote IP) address must be specified for {$iface}."; + if (($_POST['bandwidth'][$iface] != "") && !is_numericint($_POST['bandwidth'][$iface])) + $input_errors[] = "The bandwidth value for {$iface} must be an integer."; + if ($_POST['mtu'][$iface] && ($_POST['mtu'][$iface] < 576)) + $input_errors[] = "The MTU for {$iface} must be greater than 576 bytes."; + if ($_POST['mru'][$iface] && ($_POST['mru'][$iface] < 576)) + $input_errors[] = "The MRU for {$iface} must be greater than 576 bytes."; + } /* foreach ($a_ppps as $ppp) { @@ -310,12 +310,18 @@ if ($_POST) { unset($ppp['apnum']); } $ppp['phone'] = $_POST['phone']; - if (!empty($_POST['localip'])) - $ppp['localip'] = $_POST['localip']; + foreach($_POST['interfaces'] as $iface){ + if (isset($_POST['localip'][$iface])) + $localip_array[] = $_POST['localip'][$iface]; + if (isset($_POST['gateway'][$iface])) + $gateway_array[] = $_POST['gateway'][$iface]; + } + if (count($localip_array)) + $ppp['localip'] = implode(',',$localip_array); else unset($ppp['localip']); - if (!empty($_POST['gateway'])) - $ppp['gateway'] = $_POST['gateway']; + if (count($gateway_array)) + $ppp['gateway'] = implode(',',$gateway_array); else unset($ppp['gateway']); if (!empty($_POST['connect-timeout'])) @@ -335,9 +341,26 @@ if ($_POST) { break; case "pptp": - $ppp['localip'] = $_POST['localip']; - $ppp['subnet'] = $_POST['subnet']; - $ppp['gateway'] = $_POST['gateway']; + foreach($_POST['interfaces'] as $iface){ + if (isset($_POST['localip'][$iface])) + $localip_array[] = $_POST['localip'][$iface]; + if (isset($_POST['gateway'][$iface])) + $gateway_array[] = $_POST['gateway'][$iface]; + if (isset($_POST['subnet'][$iface])) + $subnet_array[] = $_POST['subnet'][$iface]; + } + if (count($localip_array)) + $ppp['localip'] = implode(',',$localip_array); + else + unset($ppp['localip']); + if (count($gateway_array)) + $ppp['gateway'] = implode(',',$gateway_array); + else + unset($ppp['gateway']); + if (count($subnet_array)) + $ppp['subnet'] = implode(',',$subnet_array); + else + unset($ppp['subnet']); break; default: break; @@ -349,41 +372,35 @@ if ($_POST) { $ppp['protocomp'] = $_POST['protocomp'] ? true : false; $ppp['vjcomp'] = $_POST['vjcomp'] ? true : false; $ppp['tcpmssfix'] = $_POST['tcpmssfix'] ? true : false; - -/* while(count($_POST['bandwidth'])){ - if($_POST['bandwidth'][count($_POST['bandwidth'])-1] == "") - array_pop(&$_POST['bandwidth']); - else - break; +/* + $bw_array = array(); + $mtu_array = array(); + $mru_array = array(); + $mrru_array = array(); +*/ + foreach($_POST['interfaces'] as $iface){ + if (isset($_POST['bandwidth'][$iface])) + $bw_array[] = $_POST['bandwidth'][$iface]; + if (isset($_POST['mtu'][$iface])) + $mtu_array[] = $_POST['mtu'][$iface]; + if (isset($_POST['mru'][$iface])) + $mru_array[] = $_POST['mru'][$iface]; + if (isset($_POST['mrru'][$iface])) + $mrru_array[] = $_POST['mrru'][$iface]; } - */ - foreach($_POST['bandwidth'] as $bw){ - if(!empty($bw) && count($bw_array) < count($_POST['interfaces'])+1) - $bw_array[] = $bw; - } - if (count($bw_array)){ - + if (count($bw_array)) $ppp['bandwidth'] = implode(',', $bw_array); - } else + else unset($ppp['bandwidth']); - - foreach($_POST['mtu'] as $mtu){ - if(!empty($mtu)) - $mtu_array[] = $mtu; - } - if (count($mtu_array)){ + if (count($mtu_array)) $ppp['mtu'] = implode(',', $mtu_array); - } else + else unset($ppp['mtu']); - foreach($_POST['mru'] as $mru){ - if(!empty($mru)) - $mru_array[] = $mru; - } - if (count($mru_array)){ + if (count($mru_array)) $ppp['mru'] = implode(',', $mru_array); - } else + else unset($ppp['mru']); /* handle_pppoe_reset is called here because if user changes Link Type from PPPoE to another type we must be able to clear the config data in the <cron> section of config.xml if it exists @@ -764,31 +781,33 @@ $types = array("select" => "Select", "ppp" => "PPP", "pppoe" => "PPPoE", "pptp" </table> </td> </tr> - <tr style="display:none" id="ipfields"> + <?php for($j=0; $j < $port_count; $j++) : ?> + <tr style="display:none" id="ipfields<?=$j;?>"> <td colspan="2" style="padding:0px;"> <table width="100%" border="0" cellpadding="6" cellspacing="0"> <tr> - <td width="22%" valign="top" class="vncell"><?= gettext("Local IP address"); ?></td> + <td width="22%" name="<?= gettext("Local IP address"); ?>" id="localiplabel<?=$j;?>" valign="top" class="vncell"></td> <td width="78%" class="vtable"> - <input name="localip" type="text" class="formfld unknown" id="localip" size="20" value="<?=htmlspecialchars($pconfig['localip']);?>"> + <input name="localip[]" type="text" class="formfld unknown" id="localip<?=$j;?>" size="20" value="<?=htmlspecialchars($pconfig['localip'][$j]);?>"> / - <select style="display:none" name="subnet" class="formselect" id="subnet"> + <select style="display:none" name="subnet[]" class="formselect" id="subnet<?=$j;?>"> <?php for ($i = 31; $i > 0; $i--): ?> - <option value="<?=$i;?>"<?php if ($i == $pconfig['subnet']) echo "selected"; ?>><?=$i;?></option> + <option value="<?=$i;?>"<?php if ($i == $pconfig['subnet'][$j]) echo "selected"; ?>><?=$i;?></option> <?php endfor; ?> </select> <br><span class="vexpl"><?= gettext("Note: Local IP/subnet is required for PPTP connections. LocalIP is automatically assigned for PPP links if this field is empty."); ?></span> </td> </tr> <tr> - <td width="22%" valign="top" class="vncell"><?= gettext("Remote IP (Gateway)"); ?></td> + <td width="22%" name="<?= gettext("Remote IP (Gateway)"); ?>" id="gatewaylabel<?=$j;?>" valign="top" class="vncell"></td> <td width="78%" class="vtable"> - <input name="gateway" type="text" class="formfld unknown" id="gateway" size="20" value="<?=htmlspecialchars($pconfig['gateway']);?>"> + <input name="gateway[]" type="text" class="formfld unknown" id="gateway<?=$j;?>" size="20" value="<?=htmlspecialchars($pconfig['gateway'][$j]);?>"> <br><span class="vexpl"><?= gettext("Note: This is where the packets will be routed. Remote IP is required for PPTP connections. Remote IP is automatically assigned for PPP links if this field is empty."); ?></span> </td> </tr> </table> </td> + </tr><?php endfor; ?> <tr> <td colspan="2" valign="top" height="16"></td> </tr> @@ -844,23 +863,23 @@ $types = array("select" => "Select", "ppp" => "PPP", "pppoe" => "PPPoE", "pptp" <td class="vtable"> <table name="link_parameters" border="0" cellpadding="6" cellspacing="0"> <tr> - <td width="22%" valign="top"class="vncell"> Bandwidth</td> - <td width="78%" id="bandwidth<?=$i;?>" class="vtable"> - <br/><input name="bandwidth[]" type="text" class="formfld unknown" size="40" value="<?=htmlspecialchars($pconfig['bandwidth'][$i]);?>"> + <td width="22%" id="bwlabel<?=$i;?>" valign="top"class="vncell"> Bandwidth</td> + <td width="78%" class="vtable"> + <br/><input name="bandwidth[]" id="bandwidth<?=$i;?>" type="text" class="formfld unknown" size="40" value="<?=htmlspecialchars($pconfig['bandwidth'][$i]);?>"> <br/> <span class="vexpl">Set Bandwidth for each link ONLY for MLPPP connections and ONLY when links have different bandwidths.</span> </td> </tr> <tr> - <td width="22%" valign="top" class="vncell"> MTU</td> - <td width="78%" id="mtu<?=$i;?>" class="vtable"> - <input name="mtu[]" type="text" class="formfld unknown" size="6" value="<?=htmlspecialchars($pconfig['mtu'][$i]);?>"> + <td width="22%" id="mtulabel<?=$i;?>" valign="top" class="vncell"> MTU</td> + <td width="78%" class="vtable"> + <input name="mtu[]" id="mtu<?=$i;?>" type="text" class="formfld unknown" size="6" value="<?=htmlspecialchars($pconfig['mtu'][$i]);?>"> <br> <span class="vexpl">Set MTU for each link if links have different bandwidths, otherwise, mtu will default to 1492.</span> </td> </tr> <tr> - <td width="22%" valign="top" class="vncell"> MRU</td> - <td width="78%" id="mru<?=$i;?>" class="vtable"> - <input name="mru[]" type="text" class="formfld unknown" size="6" value="<?=htmlspecialchars($pconfig['mru'][$i]);?>"> + <td width="22%" id="mrulabel<?=$i;?>" valign="top" class="vncell"> MRU</td> + <td width="78%" class="vtable"> + <input name="mru[]" id="mru<?=$i;?>" type="text" class="formfld unknown" size="6" value="<?=htmlspecialchars($pconfig['mru'][$i]);?>"> <br> <span class="vexpl">Set MRU for each link if links have different bandwidths, otherwise, mru will default to 1492.</span> </td> </tr> diff --git a/usr/local/www/interfaces_qinq.php b/usr/local/www/interfaces_qinq.php index 62e4a41..f25a5dc 100755 --- a/usr/local/www/interfaces_qinq.php +++ b/usr/local/www/interfaces_qinq.php @@ -99,10 +99,10 @@ include("head.inc"); $tab_array[3] = array("VLANs", false, "interfaces_vlan.php"); $tab_array[4] = array("QinQs", true, "interfaces_qinq.php"); $tab_array[5] = array("PPPs", false, "interfaces_ppps.php"); - $tab_array[7] = array("GRE", false, "interfaces_gre.php"); - $tab_array[8] = array("GIF", false, "interfaces_gif.php"); - $tab_array[9] = array("Bridges", false, "interfaces_bridge.php"); - $tab_array[10] = array("LAGG", false, "interfaces_lagg.php"); + $tab_array[6] = array("GRE", false, "interfaces_gre.php"); + $tab_array[7] = array("GIF", false, "interfaces_gif.php"); + $tab_array[8] = array("Bridges", false, "interfaces_bridge.php"); + $tab_array[9] = array("LAGG", false, "interfaces_lagg.php"); display_top_tabs($tab_array); ?> </td></tr> diff --git a/usr/local/www/interfaces_vlan.php b/usr/local/www/interfaces_vlan.php index 20f41bb..cd8975c 100755 --- a/usr/local/www/interfaces_vlan.php +++ b/usr/local/www/interfaces_vlan.php @@ -93,10 +93,10 @@ include("head.inc"); $tab_array[3] = array("VLANs", true, "interfaces_vlan.php"); $tab_array[4] = array("QinQs", false, "interfaces_qinq.php"); $tab_array[5] = array("PPPs", false, "interfaces_ppps.php"); - $tab_array[7] = array("GRE", false, "interfaces_gre.php"); - $tab_array[8] = array("GIF", false, "interfaces_gif.php"); - $tab_array[9] = array("Bridges", false, "interfaces_bridge.php"); - $tab_array[10] = array("LAGG", false, "interfaces_lagg.php"); + $tab_array[6] = array("GRE", false, "interfaces_gre.php"); + $tab_array[7] = array("GIF", false, "interfaces_gif.php"); + $tab_array[8] = array("Bridges", false, "interfaces_bridge.php"); + $tab_array[9] = array("LAGG", false, "interfaces_lagg.php"); display_top_tabs($tab_array); ?> </td></tr> diff --git a/usr/local/www/interfaces_wireless.php b/usr/local/www/interfaces_wireless.php index f639615..42fd149 100644 --- a/usr/local/www/interfaces_wireless.php +++ b/usr/local/www/interfaces_wireless.php @@ -91,10 +91,10 @@ include("head.inc"); $tab_array[3] = array("VLANs", false, "interfaces_vlan.php"); $tab_array[4] = array("QinQs", false, "interfaces_qinq.php"); $tab_array[5] = array("PPPs", false, "interfaces_ppps.php"); - $tab_array[7] = array("GRE", false, "interfaces_gre.php"); - $tab_array[8] = array("GIF", false, "interfaces_gif.php"); - $tab_array[9] = array("Bridges", false, "interfaces_bridge.php"); - $tab_array[10] = array("LAGG", false, "interfaces_lagg.php"); + $tab_array[6] = array("GRE", false, "interfaces_gre.php"); + $tab_array[7] = array("GIF", false, "interfaces_gif.php"); + $tab_array[8] = array("Bridges", false, "interfaces_bridge.php"); + $tab_array[9] = array("LAGG", false, "interfaces_lagg.php"); display_top_tabs($tab_array); ?> </td></tr> diff --git a/usr/local/www/javascript/interfaces_ppps_edit/ppps_edit.js b/usr/local/www/javascript/interfaces_ppps_edit/ppps_edit.js index c9ace67..5f7c4dc 100644 --- a/usr/local/www/javascript/interfaces_ppps_edit/ppps_edit.js +++ b/usr/local/www/javascript/interfaces_ppps_edit/ppps_edit.js @@ -23,17 +23,50 @@ function clear_selected(list_name){ function show_hide_linkfields(options){ var select_count = 0; - // this for loop is not used currently for(var j=0; j < options.length; j++){ - var label = "link" + select_count.toString(); + var count = select_count.toString(); + var type = $('type').value; + var label = "link" + count; + var bw = "bandwidth" + count; + var mtu = "mtu" + count; + var mru = "mru" + count; + var ipfields = "ipfields" + count; + var localip = "localip" + count; + var localiplabel = "localiplabel" + count; + var subnet = "subnet" + count; + var gateway = "gateway" + count; + var gatewaylabel = "gatewaylabel" + count; + $(ipfields,label,subnet).invoke('hide'); + //$(label).hide(); + //$(subnet).hide(); + $(bw).name = "bandwidth[]"; + $(mtu).name = "mtu[]"; + $(mru).name = "mru[]"; + $(localip).name = "localip[]"; + $(subnet).name = "subnet[]"; + $(gateway).name = "gateway[]"; if (options[j].selected){ - var linklabel = "linklabel" + select_count.toString(); - $(linklabel).innerHTML = "Link Parameters (" + options[j].value + ")"; + var lnklabel = "linklabel" + count; + var bwlabel = "bwlabel" + count; + $(lnklabel).innerHTML = "Link Parameters (" + options[j].value + ")"; + $(bwlabel).innerHTML = "Bandwidth (" + options[j].value + ")"; + $(bw).name = "bandwidth[" + options[j].value + "]"; + $(mtu).name = "mtu[" + options[j].value + "]"; + $(mru).name = "mru[" + options[j].value + "]"; + if (type == 'pptp' || type == 'ppp'){ + $(localiplabel).innerHTML = "Local IP (" + options[j].value + ")"; + $(gatewaylabel).innerHTML = "Gateway (" + options[j].value + ")"; + $(localip).name = "localip[" + options[j].value + "]"; + $(subnet).name = "subnet[" + options[j].value + "]"; + $(gateway).name = "gateway[" + options[j].value + "]"; + if (type == 'pptp'){ + $(subnet).show(); + } + $(ipfields).show(); + } $(label).show(); select_count++; - continue; } - $(label).hide(); } } @@ -44,26 +77,26 @@ function updateType(t){ var select_list = document.iform["interfaces[]"].options; switch(t) { case "select": { - $('ppp','pppoe','pptp','ipfields','prefil_ppp').invoke('hide'); + $('ppp','pppoe','pptp','prefil_ppp').invoke('hide'); select_list.length = 0; - select_list.options[0] = new Option("Select Link Type First",""); + select_list[0] = new Option("Select Link Type First",""); break; } case "ppp": { update_select_list(serialports, select_list); - $('select','pppoe','pptp','subnet').invoke('hide'); - $('ipfields','prefil_ppp').invoke('show'); + $('select','pppoe','pptp').invoke('hide'); + $('prefil_ppp').show(); break; } case "pppoe": { update_select_list(ports, select_list); - $('select','ppp','pptp','ipfields','prefil_ppp').invoke('hide'); + $('select','ppp','pptp','prefil_ppp').invoke('hide'); break; } case "pptp": { update_select_list(ports, select_list); $('select','ppp','pppoe','prefil_ppp').invoke('hide'); - $('ipfields','subnet').invoke('show'); + //$('ipfields','subnet').invoke('show'); break; } default: |