示例#1
0
    exit;
}
$form = new Form();
$form->setAction('system_groupmanager.php?act=edit');
$form->addGlobal(new Form_Input('groupid', null, 'hidden', $id));
if (isset($id) && $a_group[$id]) {
    $form->addGlobal(new Form_Input('id', null, 'hidden', $id));
    $form->addGlobal(new Form_Input('gid', null, 'hidden', $pconfig['gid']));
}
$section = new Form_Section('Group Properties');
if ($_GET['act'] != "new") {
    $section->addInput(new Form_StaticText('Defined by', strtoupper($pconfig['gtype'])));
}
$section->addInput($input = new Form_Input('groupname', 'Group name', 'text', $pconfig['name']));
if ($pconfig['gtype'] == "system") {
    $input->setReadonly();
}
$section->addInput(new Form_Input('description', 'Description', 'text', $pconfig['description']))->setHelp('Group description, for your own information only');
$form->add($section);
if ($pconfig['gid'] != 1998) {
    // all users group
    // ==== Group membership ==================================================
    $group = new Form_Group('Group membership');
    // Make a list of all the groups configured on the system, and a list of
    // those which this user is a member of
    $systemGroups = array();
    $usersGroups = array();
    foreach ($config['system']['user'] as $user) {
        if (is_array($pconfig['members']) && in_array($user['uid'], $pconfig['members'])) {
            $usersGroups[$user['uid']] = $user['name'];
            // Add it to the user's list
if ($pconfig['attribute'] == "system" || is_numeric($pconfig['attribute'])) {
    $form->addGlobal(new Form_Input('attribute', null, 'hidden', $pconfig['attribute']));
}
if (isset($id) && $a_gateways[$id]) {
    $form->addGlobal(new Form_Input('id', null, 'hidden', $id));
}
$form->addGlobal(new Form_Input('friendlyiface', null, 'hidden', $pconfig['friendlyiface']));
$section = new Form_Section('Edit Gateway');
$section->addInput(new Form_Checkbox('disabled', 'Disabled', 'Disable this gateway', $pconfig['disabled']))->setHelp('Set this option to disable this gateway without removing it from the ' . 'list.');
$section->addInput(new Form_Select('interface', 'Interface', $pconfig['friendlyiface'], get_configured_interface_with_descr(false, true)))->setHelp('Choose which interface this gateway applies to.');
$section->addInput(new Form_Select('ipprotocol', 'Address Family', $pconfig['ipprotocol'], array("inet" => "IPv4", "inet6" => "IPv6")))->setHelp('Choose the Internet Protocol this gateway uses.');
$section->addInput(new Form_Input('name', 'Name', 'text', $pconfig['name']))->setHelp('Gateway name');
$egw = new Form_Input('gateway', 'Gateway', 'text', $pconfig['dynamic'] ? 'dynamic' : $pconfig['gateway']);
$egw->setHelp('Gateway IP address');
if ($pconfig['dynamic']) {
    $egw->setReadonly();
}
$section->addInput($egw);
$section->addInput(new Form_Checkbox('defaultgw', 'Default Gateway', 'This will select the above gateway as the default gateway', $pconfig['defaultgw']));
$section->addInput(new Form_Checkbox('monitor_disable', 'Gateway Monitoring', 'Disable Gateway Monitoring', $pconfig['monitor_disable']))->toggles('.toggle-monitor-ip')->setHelp('This will consider this gateway as always being up');
$group = new Form_Group('Monitor IP');
$group->addClass('toggle-monitor-ip', 'collapse');
if (!$pconfig['monitor_disable']) {
    $group->addClass('in');
}
$group->add(new Form_Input('monitor', null, 'text', $pconfig['gateway'] == $pconfig['monitor'] ? '' : $pconfig['monitor']))->setHelp('Enter an alternative address here to be ' . 'used to monitor the link. This is used for the quality RRD graphs as well as the ' . 'load balancer entries. Use this if the gateway does not respond to ICMP echo ' . 'requests (pings).');
$section->add($group);
$section->addInput(new Form_Checkbox('force_down', 'Force state', 'Mark Gateway as Down', $pconfig['force_down']))->setHelp('This will force this gateway to be considered Down');
$section->addInput(new Form_Input('descr', 'Description', 'text', $pconfig['descr']))->setHelp('You may enter a description here for your reference (not parsed).');
// If any of the advanced options are non-default, we will not show the "Advanced" button
// and will display the advanced section