From 03ae10ce63f5fbbe802d08052d9e945cddc8651e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=B4me=20Chilliet?= <come@opensides.be> Date: Thu, 16 Feb 2017 14:59:47 +0100 Subject: [PATCH] Revert "Fixes #5137 Improving error messages" This reverts commit 39683c036f8e2e28406fffad82882ddf547ddc29. Conflicts: html/themes/breezy/dialog.css --- include/class_msgPool.inc | 28 ++++--------------- .../attributes/class_SetAttribute.inc | 8 +----- include/simpleplugin/class_Attribute.inc | 4 +-- 3 files changed, 8 insertions(+), 32 deletions(-) diff --git a/include/class_msgPool.inc b/include/class_msgPool.inc index f3cb895a8..cac3a0a44 100644 --- a/include/class_msgPool.inc +++ b/include/class_msgPool.inc @@ -398,22 +398,13 @@ class msgPool { * * \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) { - $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 { - $msg = sprintf(_('The entry "%s" already use this %s attribute!'), $dn, $fieldName); - } - if (!empty($description)) { - $msg .= sprintf('<p class="description">%s</p>', $description); + return sprintf(_("The entry '%s' already use this '%s' attribute!"), $dn, $name); } - return $msg; } /*! @@ -421,18 +412,9 @@ class msgPool { * * \param string $name Name of the field */ - public static function required($name, $ldapName = '', $description = '') + public static function required($name) { - if (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; + return sprintf(_("The required field '%s' is empty!"), $name); } /*! diff --git a/include/simpleplugin/attributes/class_SetAttribute.inc b/include/simpleplugin/attributes/class_SetAttribute.inc index e147531ef..c04c7c93a 100644 --- a/include/simpleplugin/attributes/class_SetAttribute.inc +++ b/include/simpleplugin/attributes/class_SetAttribute.inc @@ -582,13 +582,7 @@ class OrderedArrayAttribute extends SetAttribute $this->attribute->loadPostValue(); $this->attribute->applyPostValue(); if ($error = $this->attribute->check()) { - $label = $this->getLabel(); - if (empty($label)) { - $label = '<em>'.$this->getLdapName().'</em>'; - } else { - $label = sprintf(_('"%s"'), $label); - } - msg_dialog::display(sprintf(_('Invalid value for %s'), $label), $error); + msg_dialog::display(sprintf(_('Invalid value for %s'), $this->getLabel()), $error); } else { $this->addPostValue($this->attribute->getValue()); } diff --git a/include/simpleplugin/class_Attribute.inc b/include/simpleplugin/class_Attribute.inc index e880555e5..19b067244 100644 --- a/include/simpleplugin/class_Attribute.inc +++ b/include/simpleplugin/class_Attribute.inc @@ -436,7 +436,7 @@ class Attribute global $config; $value = $this->getValue(); 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) { $value = $this->computeLdapValue(); if (($value === "") || ($value === array())) { @@ -532,7 +532,7 @@ class Attribute continue; } - return msgPool::duplicated($this->getLabel(), $attrs['dn'], $this->getLdapName(), $this->getDescription()); + return msgPool::duplicated($this->getLabel(), $attrs['dn']); } } } -- GitLab