servnest/pg-view/ns/form.ns.php
2023-07-31 01:13:06 +02:00

56 lines
2.4 KiB
PHP

<?php declare(strict_types=1); ?>
<label for="action"><?= _('Action') ?></label>
<select name="action" id="action">
<option value="add"<?= ($_POST['action'] ?? NULL) === 'add' ? ' selected=""' : '' ?>><?= _('Add') ?></option>
<option value="delete"<?= ($_POST['action'] ?? NULL) === 'delete' ? ' selected=""' : '' ?>><?= _('Delete') ?></option>
</select>
<fieldset>
<legend><?= _('Domain') ?></legend>
<div>
<label for="subdomain"><?= _('Subdomain') ?></label>
<br>
<input id="subdomain" size="16" placeholder="www" pattern="^(([a-z0-9_-]{1,63}\.?){1,127})|(@){1}$" name="subdomain" type="text" value="<?= htmlspecialchars($_POST['subdomain'] ?? '') ?>">
</div>
<div>
<label for="zone"><?= _('Zone') ?></label>
<br>
<select required="" name="zone" id="zone">
<?php
$user_zones = nsListUserZones();
if (!in_array($_POST['zone'] ?? NULL, $user_zones, true))
echo ' <option value="" disabled="" selected="">—</option>' . LF;
foreach ($user_zones as $zone)
echo ' <option value="' . $zone . '"' . (($_POST['zone'] ?? NULL) === $zone ? ' selected=""' : '') . '>.' . $zone . '</option>' . LF;
?>
</select>
</div>
</fieldset>
<fieldset>
<legend><abbr title="Time To Live"><?= _('TTL') ?></abbr></legend>
<div>
<label for="ttl-value"><?= _('Value') ?></label>
<br>
<input required="" id="ttl-value" list="ttls" name="ttl-value" size="6" type="number" min="1" max="432000" value="<?= $_POST['ttl-value'] ?? NS_DEFAULT_TTL ?>" placeholder="<?= NS_DEFAULT_TTL ?>">
<datalist id="ttls">
<option value="900">
<option value="1800">
<option value="3600">
<option value="10800">
<option value="21600">
<option value="86400">
<option value="432000">
</datalist>
</div>
<div>
<label for="ttl-multiplier"><?= _('Unit') ?></label>
<br>
<select required="" name="ttl-multiplier" id="ttl-multiplier">
<option value="1"<?= ($_POST['ttl-multiplier'] ?? NULL) === '1' ? ' selected=""' : '' ?>><?= _('second') ?></option>
<option value="60"<?= ($_POST['ttl-multiplier'] ?? NULL) === '60' ? ' selected=""' : '' ?>><?= _('minute') ?></option>
<option value="3600"<?= ($_POST['ttl-multiplier'] ?? NULL) === '3600' ? ' selected=""' : '' ?>><?= _('hour') ?></option>
<option value="86400"<?= ($_POST['ttl-multiplier'] ?? NULL) === '86400' ? ' selected=""' : '' ?>><?= _('day') ?></option>
</select>
</div>
</fieldset>