Commit ecf6bad9 authored by Benoit Mortier's avatar Benoit Mortier
Browse files

Revert "Fixes #5137 Improving error messages"

This reverts commit 39683c03.

Conflicts:
	html/themes/breezy/dialog.css
Showing with 8 additions and 36 deletions
+8 -36
...@@ -23,10 +23,6 @@ top: 200px; ...@@ -23,10 +23,6 @@ top: 200px;
} }
} }
div.msgdialog .description {
font-style: italic;
}
/* Small screens (i.e. phones) */ /* Small screens (i.e. phones) */
@media (max-width: 640px) { @media (max-width: 640px) {
div.msgdialog { div.msgdialog {
......
...@@ -398,22 +398,13 @@ class msgPool { ...@@ -398,22 +398,13 @@ class msgPool {
* *
* \param string $name The entry duplicated * \param string $name The entry duplicated
*/ */
public static function duplicated($name, $dn = NULL, $ldapName = '', $description = '') public static function duplicated($name, $dn = NULL)
{ {
if (empty($name)) {
$fieldName = sprintf('<em>%s</em>', $ldapName);
} else {
$fieldName = sprintf(_('"%s"'), $name);
}
if ($dn == NULL) { if ($dn == NULL) {
$msg = sprintf(_('There is already an entry with this %s attribute in the system!'), $fieldName); return sprintf(_("There is already an entry with this '%s' attribute in the system!"), $name);
} else { } else {
$msg = sprintf(_('The entry "%s" already use this %s attribute!'), $dn, $fieldName); return sprintf(_("The entry '%s' already use this '%s' attribute!"), $dn, $name);
}
if (!empty($description)) {
$msg .= sprintf('<p class="description">%s</p>', $description);
} }
return $msg;
} }
/*! /*!
...@@ -421,18 +412,9 @@ class msgPool { ...@@ -421,18 +412,9 @@ class msgPool {
* *
* \param string $name Name of the field * \param string $name Name of the field
*/ */
public static function required($name, $ldapName = '', $description = '') public static function required($name)
{ {
if (empty($name)) { return sprintf(_("The required field '%s' is empty!"), $name);
$fieldName = sprintf('<em>%s</em>', $ldapName);
} else {
$fieldName = sprintf(_('"%s"'), $name);
}
$msg = sprintf(_('The required field %s is empty!'), $fieldName);
if (!empty($description)) {
$msg .= sprintf('<p class="description">%s</p>', $description);
}
return $msg;
} }
/*! /*!
......
...@@ -579,13 +579,7 @@ class OrderedArrayAttribute extends SetAttribute ...@@ -579,13 +579,7 @@ class OrderedArrayAttribute extends SetAttribute
$this->attribute->loadPostValue(); $this->attribute->loadPostValue();
$this->attribute->applyPostValue(); $this->attribute->applyPostValue();
if ($error = $this->attribute->check()) { if ($error = $this->attribute->check()) {
$label = $this->getLabel(); msg_dialog::display(sprintf(_('Invalid value for %s'), $this->getLabel()), $error);
if (empty($label)) {
$label = '<em>'.$this->getLdapName().'</em>';
} else {
$label = sprintf(_('"%s"'), $label);
}
msg_dialog::display(sprintf(_('Invalid value for %s'), $label), $error);
} else { } else {
$this->addPostValue($this->attribute->getValue()); $this->addPostValue($this->attribute->getValue());
} }
......
...@@ -431,7 +431,7 @@ class Attribute ...@@ -431,7 +431,7 @@ class Attribute
global $config; global $config;
$value = $this->getValue(); $value = $this->getValue();
if ($this->isRequired() && !$this->disabled && (($value === "") || ($value === array()))) { if ($this->isRequired() && !$this->disabled && (($value === "") || ($value === array()))) {
return msgPool::required($this->getLabel(), $this->getLdapName(), $this->getDescription()); return msgPool::required($this->getLabel());
} elseif (($this->unique !== FALSE) && !$this->disabled) { } elseif (($this->unique !== FALSE) && !$this->disabled) {
$value = $this->computeLdapValue(); $value = $this->computeLdapValue();
if (($value === "") || ($value === array())) { if (($value === "") || ($value === array())) {
...@@ -527,7 +527,7 @@ class Attribute ...@@ -527,7 +527,7 @@ class Attribute
continue; continue;
} }
return msgPool::duplicated($this->getLabel(), $attrs['dn'], $this->getLdapName(), $this->getDescription()); return msgPool::duplicated($this->getLabel(), $attrs['dn']);
} }
} }
} }
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment