diff --git a/html/themes/breezy/dialog.css b/html/themes/breezy/dialog.css index 3b8b0f7129823adb1ecc22eb5bfe9a6ec31f4246..026270dbba69c3702a9ac4b32178a977f9df6a95 100644 --- a/html/themes/breezy/dialog.css +++ b/html/themes/breezy/dialog.css @@ -23,6 +23,10 @@ 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 1d617951ee384c1edeca0b284571b055d631e997..5bbbb9ebfd9c9d010bbd8938bfc2225a1178a490 100644 --- a/include/class_msgPool.inc +++ b/include/class_msgPool.inc @@ -398,13 +398,22 @@ class msgPool { * * \param string $name The entry duplicated */ - public static function duplicated($name, $dn = NULL) + public static function duplicated($name, $dn = NULL, $ldapName = '', $description = '') { + if (empty($name)) { + $fieldName = sprintf('<em>%s</em>', $ldapName); + } else { + $fieldName = sprintf(_('"%s"'), $name); + } if ($dn == NULL) { - return sprintf(_("There is already an entry with this '%s' attribute in the system!"), $name); + $msg = sprintf(_('There is already an entry with this %s attribute in the system!'), $fieldName); } else { - return sprintf(_("The entry '%s' already use this '%s' attribute!"), $dn, $name); + $msg = sprintf(_('The entry "%s" already use this %s attribute!'), $dn, $fieldName); + } + if (!empty($description)) { + $msg .= sprintf('<p class="description">%s</p>', $description); } + return $msg; } /*! @@ -412,9 +421,18 @@ class msgPool { * * \param string $name Name of the field */ - public static function required($name) + public static function required($name, $ldapName = '', $description = '') { - return sprintf(_("The required field '%s' is empty!"), $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; } /*! diff --git a/include/simpleplugin/attributes/class_SetAttribute.inc b/include/simpleplugin/attributes/class_SetAttribute.inc index 8f93933bd3e9882df3c2505802d69aedf4e008ac..5478f47ba110f00be6b65198fc39c5f5fa676a67 100644 --- a/include/simpleplugin/attributes/class_SetAttribute.inc +++ b/include/simpleplugin/attributes/class_SetAttribute.inc @@ -579,7 +579,13 @@ class OrderedArrayAttribute extends SetAttribute $this->attribute->loadPostValue(); $this->attribute->applyPostValue(); if ($error = $this->attribute->check()) { - msg_dialog::display(sprintf(_('Invalid value for %s'), $this->getLabel()), $error); + $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); } else { $this->addPostValue($this->attribute->getValue()); } diff --git a/include/simpleplugin/class_Attribute.inc b/include/simpleplugin/class_Attribute.inc index 14bf31c406bc2db2f0caf87d45c45bc49f839368..44586cd8ffaca9cd3f410d32af6cf0083c54eb0e 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()); + return msgPool::required($this->getLabel(), $this->getLdapName(), $this->getDescription()); } 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']); + return msgPool::duplicated($this->getLabel(), $attrs['dn'], $this->getLdapName(), $this->getDescription()); } } }