* (c) 2004-2007 Linbox / Free&ALter Soft, http://linbox.com
 * (c) 2007-2008 Mandriva, http://www.mandriva.com/
 *
 * $Id: edit.php 61 2007-05-29 15:55:22Z cedric $
 *
 * This file is part of Mandriva Management Console (MMC).
 *
 * MMC is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation; either version 2 of the License, or
 * (at your option) any later version.
 *
 * MMC is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with MMC; if not, write to the Free Software
 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
 */
$zone = $_GET["zone"];
$subnet = $_GET["subnet"];
$current = $_GET["current"];
if ($zone) {
    /* We lookup an IP address available in the subnet and its corresponding zone */
    print getSubnetAndZoneFreeIp($subnet, $zone, $current);
} else {
    /* We only lookup an IP address available in the subnet */
    print getSubnetFreeIp($subnet, $current);
}
Example #2
0
    if ($_GET["action"] == "subnetaddhost") {
        if (!isset($error)) {
            /* Reset the field only if no error were found */
            $hostname = strtolower($_GET["host"]);
            $macaddress = $_GET["macaddress"];
        }
    }
}
$f = new ValidatingForm();
$f->push(new Table());
if ($_GET["action"] == "subnetaddhost") {
    $formElt = new HostnameInputTpl("hostname");
    if ($domainexist) {
        $ipaddress = getSubnetAndZoneFreeIp($subnet, $subnetOptions["primarydomainname"]);
    } else {
        $ipaddress = getSubnetFreeIp($subnet);
    }
} else {
    $formElt = new HiddenTpl("hostname");
}
$f->add(new TrFormElement(_T("Host name"), $formElt), array("value" => $hostname, "required" => True));
$a = array("value" => $ipaddress, "required" => True, "ajaxurl" => "ajaxDhcpGetSubnetFreeIp", "subnet" => $subnet);
if ($domainexist) {
    $a["zone"] = $domain;
}
$f->add(new TrFormElement(_T("IP address"), new GetFreeIPInputTpl()), $a);
/* Keep the old IP in the page to detect that the user want to change the machine IP */
$f->add(new HiddenTpl("oldip"), array("value" => $ipaddress, "hide" => True));
$f->add(new TrFormElement(_T("MAC address"), new MACInputTpl("macaddress")), array("value" => $macaddress, "required" => True));
$f->pop();
if (isset($subnetOptions["primarydomainname"])) {