Example #1
0
                $svcAttrib = 'disabled=disabled';
            } elseif ($cfgPtr['services'][$svc]['fsmount'] == $mntDir) {
                $cbState = 1;
            }
        }
    }
    $confForm->setField($svc, 'checkbox', $svcAttrib);
    $confForm->setCbItems($svc, "yes={$svcAvail[$svc]['fld_desc_se']}", true);
    $confForm->setCbState($svc, 'yes', $cbState);
    $confForm->exitBlock();
}
$confForm->exitFieldSet();
$confForm->setField('label', 'hidden');
$confForm->setField('desc', 'hidden');
$confForm->setField('fsmount', 'hidden');
$confForm->setInputText('fsmount', $mntDir);
$confForm->setField('uuid', 'hidden');
// set fs type to a constant value until a choice will be available
$fsType = 'vfat';
$confForm->setField('filesystem', 'hidden');
$confForm->setInputText('filesystem', $fsType);
// set the active flag to a constant value until editing will be available
$devActive = '1';
$confForm->setField('active', 'hidden');
$confForm->setInputText('active', $devActive);
$confForm->setRequired('uuid', _('Disk unique identifier'));
$confForm->setRequired('fsmount', _('Service mount point'));
$confForm->startWrapper('saveservices');
$saveClick = "onclick=callApply('#confform')";
$confForm->setField('savecfg', 'submit', $saveClick . '|class=startjob|disabled=disabled|value=' . _('Save'), false);
$confForm->exitWrapper();
Example #2
0
    $form->setField('buffer', 'select', 'name=buffer');
    //
    $modeOptions = array('16' => '16 KB', '32' => '32 KB', '64' => '64 KB', '128' => '128 KB', '256' => '256 KB', '512' => '512 KB', '1024' => '1024 KB', '2048' => '2048 KB', '4096' => '4096 KB');
    $form->setSelectOptFill('buffer', $modeOptions);
    $form->setFieldOptionsState('buffer', $cfgPtr['buffer'], '512');
    //
    $form->exitBlock();
    $form->exitFieldSet();
    //
    $form->startFieldSet('fset_remote', _('Remote log'));
    $form->startBlock('rw_remote');
    $form->setLabel(null, _('Syslog server'), null, 'class=labelcol');
    $form->startBlock('rw_remote', 'right');
    $form->setLabel(null, _('IP address'), 'remotehost');
    $form->setField('remotehost', 'text', "size=16|maxlength=15|class=required");
    $form->setInputText('remotehost', $cfgPtr['remotehost']);
    $form->setLabel(null, _('Port'), 'remoteport');
    $form->setField('remoteport', 'text', "size=6|maxlength=5");
    $form->setDefault('remoteport', 514);
    $form->setInputText('remoteport', $cfgPtr['remoteport']);
    $form->setBlockHint('hint-remote', _('Log messages will also be sent to the host address/port above if set.') . '<br>' . _('Local logs will still be updated regardless of this setting.'));
    $form->exitBlock();
    $form->exitFieldSet();
    $form->setField('submit', 'submit', 'value=' . _('Save'));
    // set validation constraints
    $hostValidArgs = array('errorMsg' => _('Please enter a valid ip address for') . _('Syslog server'), 'except' => 'empty');
    $form->setValidationFunc('remotehost', 'validIpAddr', $hostValidArgs);
    $form->setValidationFunc('remoteport', 'validPort', array('unprivileged' => false));
    // hold form data in a session variable
    $_SESSION[$sessionName] = $form->serialize();
}
Example #3
0
$form->setLabel(null, _('Settings'), 'dhcp', 'class=labelcol');
$form->startBlock('rw_usedhcp', 'right');
$form->setField('dhcp', 'select', 'name=dhcp', false, 'yes');
$selectOpts['yes'] = _('configured via DHCP client');
$selectOpts['no'] = _('configured manually');
$form->setSelectOptFill('dhcp', $selectOpts);
$form->setFieldOptionsState('dhcp', $cfgPtr['dhcp']);
unset($selectOpts);
//
$form->exitBlock();
// static ip address and netmask
$form->startBlock('rw_ipaddr');
$form->setLabel(null, _('IP Address'), 'ipaddr', 'class=labelcol');
$form->startBlock('rw_ipaddr', 'right');
$form->setField('ipaddr', 'text', 'size=15|maxlength=15', false, '192.168.1.222');
$form->setInputText('ipaddr', $cfgPtr['ipaddr']);
$form->setValidationFunc('ipaddr', 'validIpAddr');
// netmask selector
$form->setLabel(null, _('Subnet') . ' /', 'subnet');
$form->setField('subnet', 'select', 'name=subnet', false, '24');
$form->setSelectOptFill('subnet', $netmask);
$form->setFieldOptionsState('subnet', $cfgPtr['subnet']);
//
$form->exitBlock();
// gateway
$form->startBlock('rw_gateway');
$form->setLabel(null, _('Gateway'), 'gateway', 'class=labelcol');
$form->startBlock('rw_gateway', 'right');
$form->setField('gateway', 'text', 'size=15|maxlength=15', false, '192.168.1.1');
$form->setInputText('gateway', $cfgPtr['gateway']);
$form->setValidationFunc('gateway', 'validIpAddr');