* [bug#56873] Adjust host disksize and memory form config.

This commit is contained in:
liyang
2024-11-13 08:32:15 +08:00
committed by 曹延义
parent 7f6afd21c6
commit 2fcc56502a
3 changed files with 19 additions and 4 deletions
+1
View File
@@ -5,6 +5,7 @@ $config->host->changestatus = new stdclass();
$config->host->create->requiredFields = 'name,intranet,extranet';
$config->host->edit->requiredFields = 'name,intranet,extranet';
$config->host->create->ipFields = 'intranet,extranet';
$config->host->create->intFields = 'diskSize,memory';
$config->host->editor = new stdclass();
$config->host->editor->changestatus = array('id' => 'reason', 'tools' => 'simple');
+4 -4
View File
@@ -3,8 +3,8 @@ $config->host->form = new stdclass();
$config->host->form->create = array();
$config->host->form->create['name'] = array('type' => 'string', 'required' => true, 'default' => '');
$config->host->form->create['cpuNumber'] = array('type' => 'int', 'required' => false, 'default' => 0);
$config->host->form->create['diskSize'] = array('type' => 'float', 'required' => false, 'default' => 0);
$config->host->form->create['memory'] = array('type' => 'float', 'required' => false, 'default' => 0);
$config->host->form->create['diskSize'] = array('type' => 'string', 'required' => false, 'default' => '');
$config->host->form->create['memory'] = array('type' => 'string', 'required' => false, 'default' => '');
$config->host->form->create['group'] = array('type' => 'string', 'required' => false, 'default' => '');
$config->host->form->create['serverRoom'] = array('type' => 'int', 'required' => false, 'default' => '');
$config->host->form->create['osName'] = array('type' => 'string', 'required' => false, 'default' => '');
@@ -18,8 +18,8 @@ $config->host->form->create['desc'] = array('type' => 'string', 'required'
$config->host->form->edit = array();
$config->host->form->edit['name'] = array('type' => 'string', 'required' => true, 'default' => '');
$config->host->form->edit['cpuNumber'] = array('type' => 'int', 'required' => false, 'default' => 0);
$config->host->form->edit['diskSize'] = array('type' => 'float', 'required' => false, 'default' => 0);
$config->host->form->edit['memory'] = array('type' => 'float', 'required' => false, 'default' => 0);
$config->host->form->edit['diskSize'] = array('type' => 'string', 'required' => false, 'default' => '');
$config->host->form->edit['memory'] = array('type' => 'string', 'required' => false, 'default' => '');
$config->host->form->edit['group'] = array('type' => 'string', 'required' => false, 'default' => '');
$config->host->form->edit['serverRoom'] = array('type' => 'int', 'required' => false, 'default' => '');
$config->host->form->edit['osName'] = array('type' => 'string', 'required' => false, 'default' => '');
+14
View File
@@ -31,9 +31,23 @@ class hostZen extends host
dao::$errors['desc'] = $this->lang->host->notice->descLength;
}
$intFields = explode(',', $this->config->host->create->intFields);
foreach($intFields as $field)
{
if(!$formData->{$field}) continue;
if(!preg_match("/^-?\d+$/", $formData->{$field}))
{
dao::$errors[$field] = $this->lang->host->notice->{$field};
}
}
$ipFields = explode(',', $this->config->host->create->ipFields);
foreach($ipFields as $field)
{
if(!$formData->{$field}) continue;
$ipList = explode(',', $formData->{$field});
foreach($ipList as $ip)
{