コード例 #1
0
ファイル: editrecord.php プロジェクト: pulse-project/pulse
        $hostname = $record["hostname"];
        $type = $record["type"];
        $value = $record["value"];
        $typeToLoad = in_array(strtoupper($type), $recordTypes) ? strtolower($type) : "custom";
        require_once "dnsrecords/" . $typeToLoad . ".php";
        $RecordClass = $typeToLoad . "Record";
        $r = new $RecordClass(array("zone" => $zone, "type" => strtolower($type), "hostname" => $hostname));
        $r->initValuesFromString($value);
        $recordUiContainers = $r->createUiContainers(true);
    }
}
$f = new ValidatingForm();
$f->push(new Table());
if ($_GET["action"] == "addrecord") {
    $typeComboBox = new ExtendedSelectItem("recordtype", "onRecordTypeChanged");
    $typeComboBox->setJsFuncParams(array("'" . $zone . "'"));
    $typeComboBox->setAdditionalParams("onkeyup=\"this.blur();this.focus();\"");
    $typeComboBox->setElements(array_values($recordTypes));
    $typeComboBox->setElementsVal(array_keys($recordTypes));
    $f->add(new TrFormElement(_T("Record type"), $typeComboBox), array("value" => $typeIndex));
} else {
    $f->add(new TrFormElement(_T("Record type"), new HiddenTpl("recordtype")), array("value" => $type));
}
$f->pop();
$typeContentDiv = new Div(array("id" => "typecontentdiv"));
$f->push($typeContentDiv);
if (isset($recordUiContainers)) {
    foreach ($recordUiContainers as $cnt) {
        if ($cnt[2]) {
            $f->add($cnt[0][0], $cnt[0][1]);
            continue;