Index: frontends/php/include/classes/html/CTag.php
===================================================================
--- frontends/php/include/classes/html/CTag.php (revision 63139)
+++ frontends/php/include/classes/html/CTag.php (revision 63140)
@@ -166,23 +166,24 @@
* Syntax:
* property1: value1; property2: value2; property(n): value(n)
*
- * @return bool
+ * @return CTag
*/
public function setHint($text, $span_class = '', $freeze_on_click = true, $styles = '') {
- if (empty($text)) {
- return $this;
- }
+ $id = 'hintbox_'.uniqid();
- encodeValues($text);
- $text = unpack_object($text);
+ $this->addItem(
+ (new CSpan(
+ (new CSpan($text))->setId($id)
+ ))->setAttribute('style', 'display: none;')
+ );
$this->onMouseover(
- 'hintBox.HintWraper(event, this, '.zbx_jsvalue($text).', "'.$span_class.'", "'.$styles.'");'
+ 'hintBox.HintWraper(event, this, jQuery("#'.$id.'"), "'.$span_class.'", "'.$styles.'");'
);
if ($freeze_on_click) {
$this->onClick(
- 'hintBox.showStaticHint(event, this, '.zbx_jsvalue($text).', "'.$span_class.'", false, "'.$styles.'");'
+ 'hintBox.showStaticHint(event, this, jQuery("#'.$id.'"), "'.$span_class.'", false, "'.$styles.'");'
);
}
Index: frontends/php/include/html.inc.php
===================================================================
--- frontends/php/include/html.inc.php (revision 63139)
+++ frontends/php/include/html.inc.php (revision 63140)
@@ -594,10 +594,14 @@
$ai = (new CSpan($type))->addClass(ZBX_STYLE_STATUS_GREEN);
break;
case HOST_AVAILABLE_FALSE:
- $ai = (new CSpan($type))
- ->addClass(ZBX_STYLE_STATUS_RED)
- ->addClass(ZBX_STYLE_CURSOR_POINTER)
- ->setHint($host[$prefix.'error'], ZBX_STYLE_RED);
+ $ai = (new CSpan($type))->addClass(ZBX_STYLE_STATUS_RED);
+
+ if ($host[$prefix.'error'] !== '') {
+ $ai = (new CSpan($type))
+ ->addClass(ZBX_STYLE_CURSOR_POINTER)
+ ->setHint($host[$prefix.'error'], ZBX_STYLE_RED);
+ }
+
break;
case HOST_AVAILABLE_UNKNOWN:
$ai = (new CSpan($type))->addClass(ZBX_STYLE_STATUS_GREY);