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 ea72f92e561715aa8d1327d999f5e3a83ad770a8..3b6f0fc0e21c26d9d037c95f078c86f59991e16a 100644 --- a/include/class_msgPool.inc +++ b/include/class_msgPool.inc @@ -393,13 +393,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; } /*! @@ -407,9 +416,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 3e022f8f5824e15b407febfd1f1e247e5b527d96..9b7b6610c4c20a42ac99a16251ee28b50d88b087 100644 --- a/include/simpleplugin/attributes/class_SetAttribute.inc +++ b/include/simpleplugin/attributes/class_SetAttribute.inc @@ -562,7 +562,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 f6e88bdcf5c700a0226f5b08fc7ba894ce4d536a..f34f390b4ed5d52f42421b1d77486be0d77421b3 100644 --- a/include/simpleplugin/class_Attribute.inc +++ b/include/simpleplugin/class_Attribute.inc @@ -424,7 +424,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())) { @@ -516,7 +516,7 @@ class Attribute continue; } - return msgPool::duplicated($this->getLabel(), $attrs['dn']); + return msgPool::duplicated($this->getLabel(), $attrs['dn'], $this->getLdapName(), $this->getDescription()); } } }