Push all work on mlppp to the interfaces_ppp_edit and interfaces_ppp pages.

This commit is contained in:
gnhb 2010-04-27 15:53:17 +07:00
parent dc8c07403f
commit 258f1ca439
3 changed files with 865 additions and 246 deletions

View File

@ -91,7 +91,7 @@ if (isset($_POST['id']))
if (isset($id) && $a_ppps[$id]) {
$pconfig['type'] = $a_ppps[$id]['type'];
$pconfig['interfaces'] = $a_ppps[$id]['ports'];
$pconfig['username'] = $a_ppps[$id]['username'];
$pconfig['user'] = $a_ppps[$id]['username'];
$pconfig['password'] = $a_ppps[$id]['password'];
if (isset($a_ppps[$id]['defaultgw']))
$pconfig['defaultgw'] = true;
@ -203,20 +203,20 @@ if ($_POST) {
break;
case "pppoe":
if ($_POST['ondemand']) {
$reqdfields = explode(" ", "interfaces username password ondemand idletimeout");
$reqdfields = explode(" ", "interfaces user password ondemand idletimeout");
$reqdfieldsn = explode(",", "Link Interface(s),Username,Password,Dial on demand,Idle timeout value");
} else {
$reqdfields = explode(" ", "interfaces username password");
$reqdfields = explode(" ", "interfaces user password");
$reqdfieldsn = explode(",", "Link Interface(s),Username,Password");
}
do_input_validation($_POST, $reqdfields, $reqdfieldsn, &$input_errors);
break;
case "pptp":
if ($_POST['ondemand']) {
$reqdfields = explode(" ", "interfaces username password localip subnet gateway ondemand idletimeout");
$reqdfields = explode(" ", "interfaces user password localip subnet gateway ondemand idletimeout");
$reqdfieldsn = explode(",", "Link Interface(s),Username,Password,Local IP address,Subnet,Remote IP address,Dial on demand,Idle timeout value");
} else {
$reqdfields = explode(" ", "interfaces username password localip subnet gateway");
$reqdfields = explode(" ", "interfaces user password localip subnet gateway");
$reqdfieldsn = explode(",", "Link Interface(s),Username,Password,Local IP address,Subnet,Remote IP address");
}
do_input_validation($_POST, $reqdfields, $reqdfieldsn, &$input_errors);
@ -264,7 +264,7 @@ if ($_POST) {
$ppp = array();
$ppp['type'] = $_POST['type'];
$ppp['ports'] = implode(',', $_POST['interfaces']);
$ppp['username'] = $_POST['username'];
$ppp['username'] = $_POST['user'];
$ppp['password'] = $_POST['password'];
$ppp['defaultgw'] = $_POST['defaultgw'] ? true : false;
$ppp['ondemand'] = $_POST['ondemand'] ? true : false;
@ -480,7 +480,8 @@ $types = array("select" => "Select", "ppp" => "PPP", "pppoe" => "PPPoE", "pptp"
for(var j=0; j < option_array.length-1; j++){
var option = option_array[j].split(",");
var selected = Boolean(parseInt(option[2]));
select_list.options[j] = new Option("&nbsp;"+option[0]+"&nbsp;", option[1], false, selected);
select_list.options[j] = new Option(option[0], option[1], false, selected);
//this line for debugging the javascript above
//select_list.options[option_array.length-1+j] = new Option(option[2].toString() +" "+ selected.toString());
}
}
@ -538,7 +539,7 @@ $types = array("select" => "Select", "ppp" => "PPP", "pppoe" => "PPPoE", "pptp"
$('apn').value = "ISP.CINGULAR";
$('apnum').value = "1";
$('phone').value = "*99#";
$('username').value = "att";
$('user').value = "att";
$('password').value = "att";
}
function prefill_sprint() {
@ -546,7 +547,7 @@ $types = array("select" => "Select", "ppp" => "PPP", "pppoe" => "PPPoE", "pptp"
$('apn').value = "";
$('apnum').value = "";
$('phone').value = "#777";
$('username').value = "sprint";
$('user').value = "sprint";
$('password').value = "sprint";
}
function prefill_vzw() {
@ -554,7 +555,7 @@ $types = array("select" => "Select", "ppp" => "PPP", "pppoe" => "PPPoE", "pptp"
$('apn').value = "";
$('apnum').value = "";
$('phone').value = "#777";
$('username').value = "123@vzw3g.com";
$('user').value = "123@vzw3g.com";
$('password').value = "vzw";
}
document.observe("dom:loaded", function() { updateType(<?php echo "'{$pconfig['type']}'";?>); });
@ -587,12 +588,13 @@ $types = array("select" => "Select", "ppp" => "PPP", "pppoe" => "PPPoE", "pptp"
<td width="22%" valign="top" class="vncellreq">Link interface(s)</td>
<td width="78%" class="vtable">
<select name="interfaces[]" multiple="true" class="formselect" size="4">
<option>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</option>
<option></option>
</select>
<br/><span class="vexpl">Interfaces participating in the multilink connection.</span>
<br/><span class="vexpl">Select one or more interfaces or ports to participate in the connection. Select more than one
interface to create a multilink (MLPPP) connection.</span>
</td>
</tr>
<tr style="display:none" name="portlists" id="portlists">
<tr style="display:none">
<td id="serialports"><?php
$serial = glob("/dev/cua*");
$modems = glob("/dev/modem*");
@ -604,7 +606,7 @@ $types = array("select" => "Select", "ppp" => "PPP", "pppoe" => "PPPoE", "pptp"
if (stristr($pconfig['interfaces'], $port))
echo ",1|";
else
echo ",0|";
echo ",|";
}
?></td>
<td id="ports"><?php
@ -615,14 +617,14 @@ $types = array("select" => "Select", "ppp" => "PPP", "pppoe" => "PPPoE", "pptp"
if (stristr($pconfig['interfaces'], $ifn))
echo ",1|";
else
echo ",0|";
echo ",|";
}
?></td>
</tr>
<tr>
<td width="22%" valign="top" class="vncell">Username</td>
<td width="78%" class="vtable">
<input name="username" type="text" class="formfld usr" id="username" size="20" value="<?=htmlspecialchars($pconfig['username']);?>">
<input name="user" type="text" class="formfld usr" id="user" size="20" value="<?=htmlspecialchars($pconfig['user']);?>">
</td>
</tr>
<tr>
@ -679,6 +681,15 @@ $types = array("select" => "Select", "ppp" => "PPP", "pppoe" => "PPPoE", "pptp"
<tr>
<td colspan="2" valign="top" class="listtopic">PPP configuration</td>
</tr>
<tr>
<td width="22%" valign="top" class="vncell">Default PPP settings</td>
<td width="22%" valign="top" class="vtable">
<a href='#' onClick='javascript:prefill_att();'>ATT</A>&nbsp;
<a href='#' onClick='javascript:prefill_sprint();'>Sprint</A>&nbsp;
<a href='#' onClick='javascript:prefill_vzw();'>Verizon</A>
<br/><span class="vexpl">Click the links to fill default connection settings for these carriers.</span>
</td>
</tr>
<tr>
<td width="22%" valign="top" class="vncell">Init String</td>
<td width="78%" class="vtable">
@ -846,8 +857,8 @@ $types = array("select" => "Select", "ppp" => "PPP", "pppoe" => "PPPoE", "pptp"
<td width="22%" width="100" valign="top" class="vncell">Bandwidth</td>
<td width="78%" class="vtable">
<input name="bandwidths" type="checkbox" id="bandwidths" value="yes" <?php if (isset($pconfig['bandwidth'])) echo "checked"; ?> onclick="show_more_settings(this,bandwidth_input);" />
Set <bold>unequal</bold> bandwidths for links in this multilink connection.
<span style="display:none" id="bandwidth_input"><input name="bandwidth[]" type="text" class="formfld unknown" id="bandwidth" size="40" value="<?=htmlspecialchars($pconfig['bandwidth']);?>">
Set bandwidths for links in multilink connections.
<span style="display:none" id="bandwidth_input"><br/><input name="bandwidth[]" type="text" class="formfld unknown" id="bandwidth" size="40" value="<?=htmlspecialchars($pconfig['bandwidth']);?>">
<br/> <span class="vexpl">Set Bandwidth for each link ONLY when links have different bandwidths.</span>
</span>
</td>

View File

@ -1,13 +1,10 @@
<?php
/* $Id$ */
/*
interfaces_lan.php
part of pfSense(http://pfsense.org)
interfaces_ppp.php
part of m0n0wall (http://m0n0.ch/wall)
Originally written by Adam Lebsack <adam at holonyx dot com>
Changes by Chris Buechler <cmb at pfsense dot org>
Copyright (C) 2004-2008 BSD Perimeter LLC.
Copyright (C) 2004-2009 Scott Ullrich
Copyright (C) 2003-2004 Manuel Kasper <mk@neon1.net>.
All rights reserved.
Redistribution and use in source and binary forms, with or without
@ -32,14 +29,14 @@
POSSIBILITY OF SUCH DAMAGE.
*/
/*
pfSense_BUILDER_BINARIES: /bin/kill /sbin/ifconfig
pfSense_BUILDER_BINARIES: /sbin/ifconfig
pfSense_MODULE: interfaces
*/
##|+PRIV
##|*IDENT=page-interfaces-ppp
##|*NAME=Interfaces: PPP page
##|*DESCR=Allow access to the 'Interfaces: PPP' page.
##|*NAME=Interfaces: ppp page
##|*DESCR=Allow access to the 'Interfaces: ppp' page.
##|*MATCH=interfaces_ppp.php*
##|-PRIV
@ -63,7 +60,7 @@ function ppp_inuse($num) {
if ($_GET['act'] == "del") {
/* check if still in use */
if (ppp_inuse($_GET['id'])) {
$input_errors[] = "This PPP interface cannot be deleted because it is still being used as an interface.";
$input_errors[] = "This interface cannot be deleted because it is still being used as an interface.";
} else {
unset($a_ppps[$_GET['id']]);
write_config();
@ -89,8 +86,8 @@ include("head.inc");
$tab_array[2] = array("Wireless", false, "interfaces_wireless.php");
$tab_array[3] = array("VLANs", false, "interfaces_vlan.php");
$tab_array[4] = array("QinQs", false, "interfaces_qinq.php");
$tab_array[5] = array("PPP", true, "interfaces_ppp.php");
$tab_array[6] = array("MLPPP", false, "interfaces_mlppp.php");
$tab_array[5] = array("PPP", false, "interfaces_ppp.php");
$tab_array[6] = array("MLPPP", true, "interfaces_mlppp.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");
@ -103,14 +100,18 @@ include("head.inc");
<div id="mainarea">
<table class="tabcont" width="100%" border="0" cellpadding="0" cellspacing="0">
<tr>
<td width="20%" class="listhdrr">Serial Port</td>
<td width="20%" class="listhdrr">Type</td>
<td width="20%" class="listhdrr">Interface(s)/Port(s)</td>
<td width="40%" class="listhdr">Description</td>
<td width="10%" class="list"></td>
</tr>
<?php $i = 0; foreach ($a_ppps as $id => $ppp): ?>
<tr ondblclick="document.location='interfaces_ppp_edit.php?id=<?=$i;?>'">
<td class="listr">
<?=htmlspecialchars($ppp['type']);?>
</td>
<td class="listr">
<?=htmlspecialchars($ppp['port']);?>
<?=htmlspecialchars($ppp['ports']);?>
</td>
<td class="listbg">
<?=htmlspecialchars($ppp['descr']);?>&nbsp;
@ -120,7 +121,7 @@ include("head.inc");
</tr>
<?php $i++; endforeach; ?>
<tr>
<td class="list" colspan="2">&nbsp;</td>
<td class="list" colspan="3">&nbsp;</td>
<td class="list"> <a href="interfaces_ppp_edit.php"><img src="./themes/<?= $g['theme']; ?>/images/icons/icon_plus.gif" width="17" height="17" border="0"></a></td>
</tr>
</table>

File diff suppressed because it is too large Load Diff