Merge remote-tracking branch 'origin/support/3.2' into develop

This commit is contained in:
Molkobain
2024-02-06 21:53:38 +01:00
7 changed files with 110 additions and 51 deletions

View File

@@ -37,6 +37,7 @@ class DisplayableNode extends GraphNode
{
public $x;
public $y;
public bool $bFiltered;
/**
* Create a new node inside a graph

View File

@@ -11,10 +11,6 @@ $ibo-scrollbar--scrollbar-thumb-background-color: $ibo-color-grey-300 !default;
$ibo-scrollbar--scrollbar-thumb-border: none !default;
$ibo-scrollbar--scrollbar-thumb-border-radius: $ibo-border-radius-500 !default;
$ibo-hyperlink-color: $ibo-color-primary-700 !default;
$ibo-hyperlink-color--on-hover: $ibo-color-primary-800 !default;
$ibo-hyperlink-color--on-active: $ibo-color-primary-900 !default;
$ibo-svg-illustration--fill: $ibo-color-primary-500 !default;
$ibo-content-block--background-color: $ibo-color-white-100 !default;
@@ -29,10 +25,6 @@ $ibo-content-block--border: 1px solid $ibo-color-grey-400 !default;
--ibo-scrollbar--scrollbar-thumb-background-color: #{$ibo-scrollbar--scrollbar-thumb-background-color};
--ibo-scrollbar--scrollbar-thumb-border: #{$ibo-scrollbar--scrollbar-thumb-border};
--ibo-scrollbar--scrollbar-thumb-border-radius: #{$ibo-scrollbar--scrollbar-thumb-border-radius};
--ibo-hyperlink-color: #{$ibo-hyperlink-color};
--ibo-hyperlink-color--on-hover: #{$ibo-hyperlink-color--on-hover};
--ibo-hyperlink-color--on-active: #{$ibo-hyperlink-color--on-active};
}
/* Box sizing reset */
@@ -73,17 +65,19 @@ html{
/* Hyperlinks reset, ensure that they are of the right color and without decoration everywhere (of course this can be overloaded in some components) */
a{
color: var(--ibo-hyperlink-color);
text-decoration: none;
text-decoration: var(--ibo-hyperlink-text-decoration);
&:hover,
&:active,
&:visited{
text-decoration: none;
text-decoration: var(--ibo-hyperlink-text-decoration);
}
&:hover{
color: var(--ibo-hyperlink-color--on-hover);
text-decoration: var(--ibo-hyperlink-text-decoration--on-hover);
}
&:active{
color: var(--ibo-hyperlink-color--on-active);
text-decoration: var(--ibo-hyperlink-text-decoration--on-active);
}
}

View File

@@ -36,31 +36,30 @@ $ibo-popover-menu--item--no-message--image--svg--padding : 15px !default;
#ibo-navigation-menu--notifications-menu {
flex-flow: column;
min-width: $ibo-navigation-menu--notifications-menu--min-width;
.ibo-navigation-menu--notifications--messages-section{
.ibo-navigation-menu--notifications--messages-section {
overflow: auto;
}
}
.ibo-navigation-menu--notifications--show-all-messages, .ibo-navigation-menu--notifications-dismiss-all, .ibo-navigation-menu--notifications-show-all-multiple{
.ibo-navigation-menu--notifications--show-all-messages, .ibo-navigation-menu--notifications-dismiss-all, .ibo-navigation-menu--notifications-show-all-multiple {
overflow-x: inherit;
text-align: center;
min-height: 45px;
}
.ibo-navigation-menu--notifications--item--image{
.ibo-navigation-menu--notifications--item--image {
max-width: $ibo-navigation-menu--notifications--item--image--max-width;
max-height: $ibo-navigation-menu--notifications--item--image--max-height;
margin: $ibo-navigation-menu--notifications--item--image--margin-y $ibo-navigation-menu--notifications--item--image--margin-x;
border-radius: $ibo-navigation-menu--notifications--item--image--border-radius;
}
img.ibo-navigation-menu--notifications--item--image[src=""]{
.ibo-navigation-menu--notifications--item--image[src=""] {
display: none;
}
img.ibo-navigation-menu--notifications--item--image:not([src=""]) ~ i.ibo-navigation-menu--notifications--item--image
{
.ibo-navigation-menu--notifications--item--image:not([src=""]) ~ .ibo-navigation-menu--notifications--item--image {
display: none;
}
.ibo-navigation-menu--notifications--item--bottom-text{
.ibo-navigation-menu--notifications--item--bottom-text {
display: flex;
flex-direction: column;
align-items: center;
@@ -68,18 +67,23 @@ img.ibo-navigation-menu--notifications--item--image:not([src=""]) ~ i.ibo-naviga
align-self: center;
margin-left: $ibo-navigation-menu--notifications--item--bottom-text--margin-left;
}
.ibo-navigation-menu--notifications--item--content{
.ibo-navigation-menu--notifications--item--content {
padding: $ibo-navigation-menu--notifications--item--content--padding-y $ibo-navigation-menu--notifications--item--content--padding-x;
img{
img {
max-height: $ibo-navigation-menu--notifications--item--content--img--max-height;
padding: $ibo-navigation-menu--notifications--item--content--img--padding;
}
}
.ibo-navigation-menu--notifications-item{
.ibo-navigation-menu--notifications-item {
display: flex;
flex-direction: row;
.ibo-navigation-menu--notifications--item--content a {
@extend %ibo-hyperlink-forced-colors;
}
}
.ibo-navigation-menu--notifications--item--new-message-indicator{
.ibo-navigation-menu--notifications--item--new-message-indicator {
width: $ibo-navigation-menu--notifications--item--new-message-indicator--width;
height: $ibo-navigation-menu--notifications--item--new-message-indicator--height;
background-color: $ibo-navigation-menu--notifications--item--new-message-indicator--background-color;
@@ -87,22 +91,22 @@ img.ibo-navigation-menu--notifications--item--image:not([src=""]) ~ i.ibo-naviga
margin-top: $ibo-navigation-menu--notifications--item--new-message-indicator--margin-top;
}
.ibo-navigation-menu--notifications-show-all-multiple ~ .ibo-popover-menu{
.ibo-navigation-menu--notifications--item--new-message-indicator{
.ibo-navigation-menu--notifications-show-all-multiple ~ .ibo-popover-menu {
.ibo-navigation-menu--notifications--item--new-message-indicator {
display: inline-block;
margin-right: $ibo-navigation-menu--notifications-show-all-multiple--ibo-popover-menu--indicator--margin-right;
}
.ibo-navigation-menu--notifications-show-all-multiple--counter{
.ibo-navigation-menu--notifications-show-all-multiple--counter {
@extend %ibo-font-weight-600;
}
}
.ibo-navigation-menu--notifications-dismiss-all--icon{
.ibo-navigation-menu--notifications-dismiss-all--icon {
margin: $ibo-navigation-menu--notifications-dismiss-all--icon--margin;
}
.ibo-popover-menu--item--no-message{
.ibo-popover-menu--item--no-message {
text-align: center;
}
.ibo-popover-menu--item--no-message--image>svg{
.ibo-popover-menu--item--no-message--image > svg {
display: flex;
width: $ibo-popover-menu--item--no-message--image--svg--width;
height: $ibo-popover-menu--item--no-message--image--svg--height;

View File

@@ -12,6 +12,23 @@ $ibo-has-description--font-size: 0.7em !default; /* Font size is em on purpose a
$ibo-is-code--background-color: $ibo-color-white-200 !default;
$ibo-is-code--padding: 1.25rem 1.5rem !default;
$ibo-hyperlink-color: $ibo-color-primary-700 !default;
$ibo-hyperlink-text-decoration: none !default;
$ibo-hyperlink-color--on-hover: $ibo-color-primary-800 !default;
$ibo-hyperlink-text-decoration--on-hover: $ibo-hyperlink-text-decoration !default;
$ibo-hyperlink-color--on-active: $ibo-color-primary-900 !default;
$ibo-hyperlink-text-decoration--on-active: $ibo-hyperlink-text-decoration !default;
/* CSS variables */
:root{
--ibo-hyperlink-color: #{$ibo-hyperlink-color};
--ibo-hyperlink-text-decoration: #{$ibo-hyperlink-text-decoration};
--ibo-hyperlink-color--on-hover: #{$ibo-hyperlink-color--on-hover};
--ibo-hyperlink-text-decoration--on-hover: #{$ibo-hyperlink-text-decoration--on-hover};
--ibo-hyperlink-color--on-active: #{$ibo-hyperlink-color--on-active};
--ibo-hyperlink-text-decoration--on-active: #{$ibo-hyperlink-text-decoration--on-active};
}
/* Rules */
%ibo-text-truncated-with-ellipsis {
white-space: nowrap;
@@ -32,6 +49,20 @@ $ibo-is-code--padding: 1.25rem 1.5rem !default;
color: inherit;
}
}
/* Use this when you want the hyperlink to be of the color of its container's text instead of the global hyperlink color */
%ibo-hyperlink-forced-colors {
color: $ibo-hyperlink-color;
text-decoration: $ibo-hyperlink-text-decoration;
&:hover {
color: $ibo-hyperlink-color--on-hover;
text-decoration: $ibo-hyperlink-text-decoration--on-hover;
}
&:active {
color: $ibo-hyperlink-color--on-active;
text-decoration: $ibo-hyperlink-text-decoration--on-active;
}
}
.ibo-is-broken-hyperlink {
text-decoration: line-through;

View File

@@ -93,12 +93,12 @@
<target_class>User</target_class>
<allow_target_creation>false</allow_target_creation>
</field>
<field id="contact_id" xsi:type="AttributeExternalField">
<extkey_attcode>user_id</extkey_attcode>
<target_attcode>contactid</target_attcode>
<dependencies>
<attribute id="user_id"/>
</dependencies>
<field id="contact_id" xsi:type="AttributeExternalKey">
<sql>contact_id</sql>
<is_null_allowed>true</is_null_allowed>
<on_target_delete>DEL_MANUAL</on_target_delete>
<target_class>Person</target_class>
<allow_target_creation>false</allow_target_creation>
</field>
</fields>
<methods>
@@ -110,8 +110,14 @@
public function DBInsertNoReload()
{
$this->SetCurrentDateIfNull('creation_date');
$this->SetIfNull('user_id', CMDBChange::GetCurrentUserId());
$iUserId = CMDBChange::GetCurrentUserId();
if(utils::IsNotNullOrEmptyString($iUserId)){
$this->SetIfNull('user_id', $iUserId);
// Get Contact from user
$oUser = MetaModel::GetObject('User', $iUserId);
$this->SetIfNull('contact_id', $oUser->Get('contactid'));
}
return parent::DBInsertNoReload();
}
]]></code>

View File

@@ -194,14 +194,25 @@ SQL;
$oContainer = MetaModel::GetObject($oAttachment->Get('item_class'), $oAttachment->Get('item_id'), false /* must be found */, true /* allow all data */);
if ($oContainer)
{
if ($oContainer) {
$oAttachment->SetItem($oContainer, true /*updateonchange*/);
$iUpdated++;
}
}
SetupLog::Info("Initializing attachment/item_org_id - $iUpdated records have been adjusted");
if (MetaModel::GetAttributeDef('Attachment', 'contact_id') instanceof AttributeExternalKey) {
SetupLog::Info("Upgrading itop-attachment from '$sPreviousVersion' to '$sCurrentVersion'. Starting with 3.2.0, contact_id will be added into the DB...");
$sUserTableName = MetaModel::DBGetTable('User');
$sUserFieldContactId = MetaModel::GetAttributeDef('User', 'contactid')->Get('sql');
$sAttachmentFieldUserId = MetaModel::GetAttributeDef('Attachment', 'user_id')->Get('sql');
$sAttachmentFieldContactId = MetaModel::GetAttributeDef('Attachment', 'contact_id')->Get('sql');
$sAddContactId = "UPDATE `$sTableName` att, `$sUserTableName` us SET att.`$sAttachmentFieldContactId` = us.`$sUserFieldContactId` WHERE att.`$sAttachmentFieldUserId` = us.id AND att.`$sAttachmentFieldContactId` = 0";
CMDBSource::Query($sAddContactId);
$iNbProcessed = CMDBSource::AffectedRows();
SetupLog::Info("| | ".$iNbProcessed." attachment processed.");
}
}
}
}

View File

@@ -28,6 +28,8 @@ $(function()
{
menu_toggler: '[data-role="ibo-navigation-menu--notifications-toggler"]',
menu_toggler_message: '[data-role="ibo-navigation-menu--user-notifications--toggler--message"]',
notification_message: '[data-role="ibo-navigation-menu--notifications-item"]',
notification_dismiss_all: '[data-role="ibo-navigation-menu--notifications-dismiss-all"]',
},
// the constructor
@@ -124,7 +126,7 @@ $(function()
jsonp: "callback"
})
.done(function(oJSONData) {
me._cacheData(idx, oJSONData);
me._cacheData(idx, oJSONData);
me._onMessagesFetched(idx, oJSONData);
}).error(function() {
console.warn('Newsroom: failed to fetch data from the web for provider '+idx+' url: '+me.options.providers[idxProvider].fetch_url);
@@ -213,8 +215,8 @@ $(function()
var sBottomText = '<span class="ibo-navigation-menu--notifications--item--bottom-text">' + sImage + '<span>' + this.options.providers[sProvider].label + '</span> <span> ' + moment(sStartDate).fromNow() + '</span></span>';
return '<a class="ibo-popover-menu--item ibo-navigation-menu--notifications-item" data-role="ibo-navigation-menu--notifications-item" data-msg-id="' + sId + '" data-provider-id="' + sProvider + '" href="' + sUrl + '" target="' + sTarget + '" id="newsroom_menu_item_' + sId + '">' +
sNewMessageIndicator + sRichDescription + sBottomText + '</a>';
return '<div class="ibo-popover-menu--item ibo-navigation-menu--notifications-item" data-role="ibo-navigation-menu--notifications-item" data-msg-id="' + sId + '" data-provider-id="' + sProvider + '" href="' + sUrl + '" target="' + sTarget + '" id="newsroom_menu_item_' + sId + '">' +
sNewMessageIndicator + sRichDescription + sBottomText + '</div>';
},
_buildNoMessageItem: function()
{
@@ -242,7 +244,7 @@ $(function()
},
_buildMenu: function(aAllMessages)
{
var me = this;
const me = this;
var iTotalCount = aAllMessages.length;
var iCount = 0;
var sDismissAllSection = this._buildDismissAllSection();
@@ -291,11 +293,15 @@ $(function()
$('.ibo-navigation-menu--notifications--item--content img').each(function(){
tippy(this, {'content': this.outerHTML, 'placement': 'left', 'trigger': 'mouseenter focus', 'animation':'shift-away-subtle', 'allowHTML': true });
});
var me = this;
$('[data-role="ibo-navigation-menu--notifications-item"]').on('click', function(oEvent){
me._handleClick(this);
// Add events listeners
$(this.js_selectors.notification_message).on('click', function(oEvent){
me._handleClick(this, oEvent);
});
$('[data-role="ibo-navigation-menu--notifications-dismiss-all"]').on('click', function(ev) { me._markAllAsRead(); });
$(this.js_selectors.notification_dismiss_all).on('click', function(ev) {
me._markAllAsRead();
});
// Remove class to show there is new messages
$(this.js_selectors.menu_toggler).removeClass(this.css_classes.empty);
@@ -303,7 +309,7 @@ $(function()
else
{
$(this.element).html(sMessageSection + sShowAllMessagesSection);
var me = this;
// Add class to show there is no messages
$(this.js_selectors.menu_toggler).addClass(this.css_classes.empty);
}
@@ -320,14 +326,20 @@ $(function()
}
this._initializePopoverMenu();
},
_handleClick: function(elem)
_handleClick: function(oElem, oEvent)
{
var me = this;
var idxProvider = $(elem).attr('data-provider-id');
var msgId = $(elem).attr('data-msg-id');
// If click was made on an hyperlink in the message, just follow the hyperlink
if (oEvent.target.nodeName.toLowerCase() === 'a') {
oEvent.stopPropagation();
return;
}
// Otherwise we open the message as intended
var idxProvider = $(oElem).attr('data-provider-id');
var msgId = $(oElem).attr('data-msg-id');
this._markOneMessageAsRead(idxProvider, msgId);
$(me.element).popover_menu("togglePopup");
$(this.element).popover_menu("togglePopup");
this._getAllMessages();
},
clearCache: function(idx)