Add descriptive message to custom validations

refs #9203
This commit is contained in:
Alexander Fuhr 2015-05-15 15:49:57 +02:00
parent 19243e6885
commit e6ba3d6470
1 changed files with 17 additions and 7 deletions

View File

@ -57,13 +57,19 @@ class IdoResourcePage extends Form
if (false === isset($data['skip_validation']) || $data['skip_validation'] == 0) {
$configObject = new ConfigObject($this->getValues());
if (false === DbResourceForm::isValidResource($this, $configObject)) {
$this->addSkipValidationCheckbox();
$this->addSkipValidationCheckbox($this->translate(
'Check this to not to validate connectivity with the given database server'
));
return false;
} elseif (false === BackendConfigForm::isValidIdoSchema($this, $configObject)) {
$this->addSkipValidationCheckbox();
$this->addSkipValidationCheckbox($this->translate(
'Check this to not to validate the ido schema'
));
return false;
} elseif (false === BackendConfigForm::isValidIdoInstance($this, $configObject)) {
$this->addSkipValidationCheckbox();
$this->addSkipValidationCheckbox($this->translate(
'Check this to not to validate the ido instance'
));
return false;
}
}
@ -74,17 +80,21 @@ class IdoResourcePage extends Form
/**
* Add a checkbox to the form by which the user can skip the connection validation
*/
protected function addSkipValidationCheckbox()
protected function addSkipValidationCheckbox($description = '')
{
if (empty($description)) {
$description = $this->translate(
'Proceed without any further (custom) validation'
);
}
$this->addElement(
'checkbox',
'skip_validation',
array(
'required' => true,
'label' => $this->translate('Skip Validation'),
'description' => $this->translate(
'Check this to not to validate connectivity with the given database server'
)
'description' => $description
)
);
}