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) { if (false === isset($data['skip_validation']) || $data['skip_validation'] == 0) {
$configObject = new ConfigObject($this->getValues()); $configObject = new ConfigObject($this->getValues());
if (false === DbResourceForm::isValidResource($this, $configObject)) { 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; return false;
} elseif (false === BackendConfigForm::isValidIdoSchema($this, $configObject)) { } elseif (false === BackendConfigForm::isValidIdoSchema($this, $configObject)) {
$this->addSkipValidationCheckbox(); $this->addSkipValidationCheckbox($this->translate(
'Check this to not to validate the ido schema'
));
return false; return false;
} elseif (false === BackendConfigForm::isValidIdoInstance($this, $configObject)) { } elseif (false === BackendConfigForm::isValidIdoInstance($this, $configObject)) {
$this->addSkipValidationCheckbox(); $this->addSkipValidationCheckbox($this->translate(
'Check this to not to validate the ido instance'
));
return false; 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 * 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( $this->addElement(
'checkbox', 'checkbox',
'skip_validation', 'skip_validation',
array( array(
'required' => true, 'required' => true,
'label' => $this->translate('Skip Validation'), 'label' => $this->translate('Skip Validation'),
'description' => $this->translate( 'description' => $description
'Check this to not to validate connectivity with the given database server'
)
) )
); );
} }