1: <?php
2: 3: 4: 5: 6: 7: 8: 9: 10:
11: class EditRecord extends Horde_Form
12: {
13: 14:
15: function EditRecord(&$vars)
16: {
17: $isnew = !$vars->exists('id');
18: $rectype = $vars->get('rectype');
19: $recset = Beatnik::getRecFields($rectype);
20: if ($isnew) {
21:
22: foreach ($recset as $field => $fdata) {
23: if (isset($fdata['default'])) {
24: $vars->set($field, $fdata['default']);
25: }
26: }
27: }
28:
29: parent::Horde_Form($vars, $isnew ? _("Add DNS Record") : _("Edit DNS Record"));
30:
31: $types = Beatnik::getRecTypes();
32: if (empty($_SESSION['beatnik']['curdomain'])) {
33:
34: $types = array('soa' => _('SOA (Start of Authority)'));
35: }
36: $action = &Horde_Form_Action::factory('reload');
37: $select = &$this->addVariable(_("Record Type"), 'rectype', 'enum', true,
38: false, null, array($types, true));
39: $select->setAction($action);
40: $select->setOption('trackchange', true);
41:
42:
43: if (!$rectype) {
44: return true;
45: }
46:
47: foreach ($recset as $field => $fdata) {
48: if ($fdata['type'] == 'hidden' || ($fdata['infoset'] != 'basic' &&
49: !$_SESSION['beatnik']['expertmode'])) {
50: $this->addHidden(_($fdata['description']), $field, 'text',
51: $fdata['required']);
52: } else {
53: $this->addVariable(_($fdata['description']), $field,
54: $fdata['type'], $fdata['required']);
55: }
56:
57: }
58:
59: return true;
60: }
61: }
62: