From ecf6bad940170328c9ea87aecbc3dd97f0d26492 Mon Sep 17 00:00:00 2001 From: Benoit Mortier <benoit.mortier@opensides.be> Date: Sat, 24 Dec 2016 17:02:11 +0100 Subject: [PATCH] Revert "Fixes #5137 Improving error messages" This reverts commit 39683c036f8e2e28406fffad82882ddf547ddc29. Conflicts: html/themes/breezy/dialog.css --- html/themes/breezy/dialog.css | 4 --- include/class_msgPool.inc | 28 ++++--------------- .../attributes/class_SetAttribute.inc | 8 +----- include/simpleplugin/class_Attribute.inc | 4 +-- 4 files changed, 8 insertions(+), 36 deletions(-) diff --git a/html/themes/breezy/dialog.css b/html/themes/breezy/dialog.css index b3d347813..3b8b0f712 100644 --- a/html/themes/breezy/dialog.css +++ b/html/themes/breezy/dialog.css @@ -23,10 +23,6 @@ top: 200px; } } -div.msgdialog .description { -font-style: italic; -} - /* Small screens (i.e. phones) */ @media (max-width: 640px) { div.msgdialog { diff --git a/include/class_msgPool.inc b/include/class_msgPool.inc index 9ec3bff10..b2ebc176e 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 13d609f3b..f8be21e68 100644 --- a/include/simpleplugin/attributes/class_SetAttribute.inc +++ b/include/simpleplugin/attributes/class_SetAttribute.inc @@ -579,13 +579,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 44586cd8f..14bf31c40 100644 --- a/include/simpleplugin/class_Attribute.inc +++ b/include/simpleplugin/class_Attribute.inc @@ -431,7 +431,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())) { @@ -527,7 +527,7 @@ class Attribute continue; } - return msgPool::duplicated($this->getLabel(), $attrs['dn'], $this->getLdapName(), $this->getDescription()); + return msgPool::duplicated($this->getLabel(), $attrs['dn']); } } } -- GitLab