Example #1
0
$section->addInput(new Form_Checkbox('enable', 'Enable', 'Enable interface', $pconfig['enable'], 'yes'));
$section->addInput(new Form_Input('descr', 'Description', 'text', $pconfig['descr']))->setHelp('Enter a description (name) for the interface here.');
$section->addInput(new Form_Select('type', 'IPv4 Configuration Type', $pconfig['type'], $types4));
$section->addInput(new Form_Select('type6', 'IPv6 Configuration Type', $pconfig['type6'], $types6));
$macaddress = new Form_Input('mac', 'MAC Address', 'text', $pconfig['mac'], ['placeholder' => 'xx:xx:xx:xx:xx:xx']);
$btnmymac = new Form_Button('btnmymac', 'Copy My MAC');
$btnmymac->removeClass('btn-primary')->addClass('btn-success btn-sm');
$group = new Form_Group('MAC controls');
$group->add($macaddress);
// $group->add($btnmymac);
$group->setHelp('This field can be used to modify ("spoof") the MAC address of this interface.' . '<br />' . 'Enter a MAC address in the following format: xx:xx:xx:xx:xx:xx or leave blank');
$section->add($group);
$section->addInput(new Form_Input('mtu', 'MTU', 'number', $pconfig['mtu']))->setHelp('If you leave this field blank, the adapter\'s default MTU will be used. ' . 'This is typically 1500 bytes but can vary in some circumstances.');
$section->addInput(new Form_Input('mss', 'MSS', 'number', $pconfig['mss']))->setHelp('If you enter a value in this field, then MSS clamping for TCP connections to the value entered above minus 40 (TCP/IP ' . 'header size) will be in effect.');
if (count($mediaopts_list) > 0) {
    $section->addInput(new Form_Select('mediaopt', 'Speed and Duplex', rtrim($mediaopt_from_config), build_mediaopts_list()))->setHelp('Here you can explicitly set speed and duplex mode for this interface.' . '<br />' . 'WARNING: You MUST leave this set to autoselect (automatically negotiate speed) unless the port this interface connects to has its speed and duplex forced.');
}
$form->add($section);
$section = new Form_Section('Static IPv4 configuration');
$section->addClass('staticv4');
$section->addInput(new Form_IpAddress('ipaddr', 'IPv4 Address', $pconfig['ipaddr']))->addMask('subnet', $pconfig['subnet'], 32);
$group = new Form_Group('IPv4 Upstream gateway');
$group->add(new Form_Select('gateway', 'IPv4 Upstream Gateway', $pconfig['gateway'], build_gateway_list()));
$group->add(new Form_Button('addgw', 'Add a new gateway'))->removeClass('btn-primary')->setAttribute('data-target', '#newgateway')->setAttribute('data-toggle', 'modal');
$group->setHelp('If this interface is an Internet connection, select an existing Gateway from the list or add a new one using the "Add" button.' . '<br />' . 'On local LANs the upstream gateway should be "none".' . gettext('You can manage gateways by ') . '<a target="_blank" href="system_gateways.php">' . gettext(" clicking here") . '</a>');
$section->add($group);
$form->add($section);
// Add new gateway modal pop-up
$modal = new Modal('New gateway', 'newgateway', 'large');
$modal->addInput(new Form_Checkbox('defaultgw', 'Default', 'Default gateway', $if == "wan" || $if == "WAN"));
$modal->addInput(new Form_Input('name', 'Gateway name', 'text', $wancfg['descr'] . "GW"));
Example #2
0
$section->addInput(new Form_Checkbox('enable', 'Enable', 'Enable interface', $pconfig['enable'], 'yes'));
$section->addInput(new Form_Input('descr', 'Description', 'text', $pconfig['descr']))->setHelp('Enter a description (name) for the interface here.');
$section->addInput(new Form_Select('type', 'IPv4 Configuration Type', $pconfig['type'], $types4));
$section->addInput(new Form_Select('type6', 'IPv6 Configuration Type', $pconfig['type6'], $types6));
$macaddress = new Form_Input('spoofmac', 'MAC Address', 'text', $pconfig['spoofmac'], ['placeholder' => 'xx:xx:xx:xx:xx:xx']);
$btnmymac = new Form_Button('btnmymac', 'Copy My MAC', null, 'fa-clone');
$btnmymac->setAttribute('type', 'button')->addClass('btn-success btn-sm');
$group = new Form_Group('MAC controls');
$group->add($macaddress);
// $group->add($btnmymac);
$group->setHelp('This field can be used to modify ("spoof") the MAC address of this interface.' . '<br />' . 'Enter a MAC address in the following format: xx:xx:xx:xx:xx:xx or leave blank.');
$section->add($group);
$section->addInput(new Form_Input('mtu', 'MTU', 'number', $pconfig['mtu']))->setHelp('If this field is blank, the adapter\'s default MTU will be used. ' . 'This is typically 1500 bytes but can vary in some circumstances.');
$section->addInput(new Form_Input('mss', 'MSS', 'number', $pconfig['mss']))->setHelp('If a value is entered in this field, then MSS clamping for TCP connections to the value entered above minus 40 (TCP/IP ' . 'header size) will be in effect.');
if (count($mediaopts_list) > 0) {
    $section->addInput(new Form_Select('mediaopt', 'Speed and Duplex', rtrim($config['interfaces'][$if]['media'] . ' ' . $config['interfaces'][$if]['mediaopt']), build_mediaopts_list()))->setHelp('Explicitly set speed and duplex mode for this interface.' . '<br />' . 'WARNING: MUST be set to autoselect (automatically negotiate speed) unless the port this interface connects to has its speed and duplex forced.');
}
$form->add($section);
$section = new Form_Section('Static IPv4 Configuration');
$section->addClass('staticv4');
$section->addInput(new Form_IpAddress('ipaddr', 'IPv4 Address', $pconfig['ipaddr']))->addMask('subnet', $pconfig['subnet'], 32);
$group = new Form_Group('IPv4 Upstream gateway');
$group->add(new Form_Select('gateway', 'IPv4 Upstream Gateway', $pconfig['gateway'], build_gateway_list()));
$group->add(new Form_Button('addgw', 'Add a new gateway', null, 'fa-plus'))->setAttribute('type', 'button')->addClass('btn-success')->setAttribute('data-target', '#newgateway')->setAttribute('data-toggle', 'modal');
$group->setHelp('If this interface is an Internet connection, select an existing Gateway from the list or add a new one using the "Add" button.' . '<br />' . 'On local LANs the upstream gateway should be "none". ' . gettext('Gateways can be managed by ') . '<a target="_blank" href="system_gateways.php">' . gettext(" clicking here") . '</a>.');
$section->add($group);
$form->add($section);
$section = new Form_Section('Static IPv6 Configuration');
$section->addClass('staticv6');
$section->addInput(new Form_IpAddress('ipaddrv6', 'IPv6 address', $pconfig['ipaddrv6']))->addMask('subnetv6', $pconfig['subnetv6'], 128);
$group = new Form_Group('IPv6 Upstream gateway');