diff --git a/application/itopwebpage.class.inc.php b/application/itopwebpage.class.inc.php index 932f771a1..ecba75b4b 100644 --- a/application/itopwebpage.class.inc.php +++ b/application/itopwebpage.class.inc.php @@ -259,21 +259,32 @@ EOF; EOF ); - // Attribute tag tooltips + // Attribute set tooltip on items $this->add_ready_script( <<').text($(this).attr('data-label')).html()}, - }, - show: { delay: 300, when: 'mouseover' }, - hide: { delay: 140, when: 'mouseout', fixed: true }, - style: { name: 'dark', tip: 'bottomLeft' }, - position: { corner: { target: 'topMiddle', tooltip: 'bottomLeft' }} - }); + var sLabel = $('
').text($(this).attr('data-label')).html(); + var sDescription = $(this).attr('data-description'); + + // Make nice tooltip if item has a description, otherwise just make a title attribute so the truncated label can be read. + if(sDescription !== '') + { + $(this).qtip({ + content: { + // Encoding only title as the content is already sanitized by the HTML attribute. + text: sDescription, + title: { text: sLabel}, + }, + show: { delay: 300, when: 'mouseover' }, + hide: { delay: 140, when: 'mouseout', fixed: true }, + style: { name: 'dark', tip: 'bottomLeft' }, + position: { corner: { target: 'topMiddle', tooltip: 'bottomLeft' }} + }); + } + else + { + $(this).attr('title', sLabel); + } }); EOF );