Пример #1
0
$cfgPtr['hostnameupdatesrc'] =& $config['interfaces']['lan']['hostnameupdatesrc'];
$cfgPtr['dyndnsusername'] =& $config['dyndns']['username'];
$cfgPtr['dyndnspassword'] =& $config['dyndns']['password'];
$cfgPtr['dyndnstype'] =& $config['dyndns']['type'];
$cfgPtr['dyndnsenable'] =& $config['dyndns']['enable'];
$cfgPtr['dyndnswildcard'] =& $config['dyndns']['wildcard'];
// static routes
$cfgPtr['route'] =& $config['system']['staticroutes']['route'];
// get ethernet interfaces list
$netInterfaces = network_get_interfaces();
// temporary variable to check later if static ip address is changed
$oldIpaddr = $netInterfaces[$cfgPtr['if']]['ipaddr'];
// instantiate the config form object
$form = new cfgForm('sys_network.php', 'method=post|name=iform|id=iform');
// initialize form
$form->startWrapper('tab-1');
$form->startFieldset('fset_lanport', _('Port') . " {$cfgPtr['if']} ({$netInterfaces[$cfgPtr['if']]['mac']})");
// if address mode selector
$form->startBlock('rw_usedhcp');
$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');
Пример #2
0
$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();
// hold form data in a session variable
$_SESSION[$cfgSvcName] = $confForm->serialize();
//
// variables for messages populated later from js code
$msgStartPartion = escapeStr(_('Creating new partition') . ' ' . $_POST['par'] . ' ' . _('on') . ' ' . $_POST['dev'] . '... ');
$msgStartFormat = escapeStr(_('Formatting partition') . ' ' . $_POST['par'] . ' ' . _('on') . ' ' . $_POST['dev'] . '... ');
$msgAskReboot = escapeStr(_('Reboot required'));
$msgDone = escapeStr(_('done.'));
// render main layout
require 'fbegin.inc';
$initForm->renderForm();
$confForm->renderForm();
Пример #3
0
                } else {
                    $errstr = _('The configuration could not be restored.');
                    if ($xmlerr) {
                        $errstr .= " (" . sprintf(_("XML error: %s") . ")", $xmlerr);
                    }
                    $input_errors[] = $errstr;
                }
            } else {
                $input_errors[] = _('The configuration could not be restored (file upload error).');
            }
        }
    }
}
$form = new cfgForm('maint_backup.php', 'enctype=multipart/form-data|method=post|name=iform|id=iform');
// initialize form
$form->startWrapper('tab-1');
// let user choose the task
$form->startFieldset('fset_task', _('Task selection'));
$form->startBlock('rw_task');
$form->setLabel(null, _('Task'), 'bck_task', 'class=labelcol');
$form->startBlock('rw_task', 'right');
$form->setField('bck_task', 'select', 'name=task');
$taskOpts['backup'] = _('Backup');
$taskOpts['restore'] = _('Restore');
$form->setSelectOptFill('bck_task', $taskOpts);
$form->setFieldOptionsState('bck_task', 'backup');
//
$form->exitBlock();
$form->startBlock('rw_file');
$form->setLabel(null, _('Backup file'), 'restore_file', 'class=labelcol');
$form->startBlock('rw_file', 'right');