Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/support/3.2' into develop
Browse files Browse the repository at this point in the history
  • Loading branch information
accognet committed Feb 28, 2024
2 parents 2cafa78 + e8c11f3 commit 4e53dee
Show file tree
Hide file tree
Showing 49 changed files with 1,517 additions and 170 deletions.
11 changes: 10 additions & 1 deletion application/loginwebpage.class.inc.php
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ public static function NewLoginWebPage()
}

protected static $m_sLoginFailedMessage = '';

public function __construct($sTitle = null)
{
if ($sTitle === null) {
Expand All @@ -101,6 +101,15 @@ public function SetStyleSheet()
$this->add_linked_stylesheet(utils::GetAbsoluteUrlAppRoot().'css/font-awesome/css/all.min.css');
}

/**
* @inheritDoc
* @since 3.2.0
*/
protected function GetFaviconAbsoluteUrl()
{
return Branding::GetLoginFavIconAbsoluteUrl();
}

public static function SetLoginFailedMessage($sMessage)
{
self::$m_sLoginFailedMessage = $sMessage;
Expand Down
17 changes: 1 addition & 16 deletions core/action.class.inc.php
Original file line number Diff line number Diff line change
Expand Up @@ -41,12 +41,6 @@
*/
abstract class Action extends cmdbAbstractObject
{
/**
* @var $oCallingTrigger Trigger|null The trigger that called this action {@see DoExecute}
* @since 3.2.0
*/
protected ?Trigger $oCallingTrigger = null;

/**
* @throws \CoreException
* @throws \Exception
Expand Down Expand Up @@ -276,14 +270,6 @@ public static function Init()
// MetaModel::Init_SetZListItems('default_search', array('name'));
}

/**
* @inheritDoc
*/
public function DoExecute($oTrigger, $aContextArgs)
{
$this->oCallingTrigger = $oTrigger;
}

/**
* @param $sLanguage
* @param $sLanguageCode
Expand Down Expand Up @@ -447,7 +433,7 @@ public static function Init()
*/
protected function FindRecipients($sRecipAttCode, $aArgs)
{
$oTrigger = $this->oCallingTrigger;
$oTrigger = $aArgs['trigger->object()'] ?? null;
$sOQL = $this->Get($sRecipAttCode);
if (utils::IsNullOrEmptyString($sOQL)) return '';

Expand Down Expand Up @@ -523,7 +509,6 @@ protected function FindRecipients($sRecipAttCode, $aArgs)
*/
public function DoExecute($oTrigger, $aContextArgs)
{
parent::DoExecute($oTrigger, $aContextArgs);
if (MetaModel::IsLogEnabledNotification())
{
$oLog = new EventNotificationEmail();
Expand Down
37 changes: 23 additions & 14 deletions core/config.class.inc.php
Original file line number Diff line number Diff line change
Expand Up @@ -447,14 +447,14 @@ class Config
'show_in_conf_sample' => true,
],
'export_pdf_font' => [ // @since 2.7.0 PR #49 / N°1947
'type' => 'string',
'description' => 'Font used when generating a PDF file',
'default' => 'DejaVuSans', // DejaVuSans is a UTF-8 Unicode font, embedded in the TCPPDF lib we're using
// Standard PDF fonts like helvetica or times newroman are NOT Unicode
// A new DroidSansFallback can be used to improve CJK support (se PR #49)
'value' => '',
'source_of_value' => '',
'show_in_conf_sample' => false,
'type' => 'string',
'description' => 'Font used when generating a PDF file',
'default' => 'DejaVuSans', // DejaVuSans is a UTF-8 Unicode font, embedded in the TCPPDF lib we're using
// Standard PDF fonts like helvetica or times newroman are NOT Unicode
// A new DroidSansFallback can be used to improve CJK support (se PR #49)
'value' => '',
'source_of_value' => '',
'show_in_conf_sample' => false,
],
'access_mode' => [
'type' => 'integer',
Expand Down Expand Up @@ -1119,6 +1119,14 @@ class Config
'source_of_value' => '',
'show_in_conf_sample' => false,
],
'purge_data.max_chunk_size' => [
'type' => 'integer',
'description' => 'Maximum number of items deleted per loop. Used in function MetaModel::PurgeData',
'default' => 1000,
'value' => 1000,
'source_of_value' => '',
'show_in_conf_sample' => false,
],
'max_history_length' => [
'type' => 'integer',
'description' => 'Maximum length of the history table (in the "History" tab on each object) before it gets truncated. Latest modifications are displayed first.',
Expand Down Expand Up @@ -1324,9 +1332,9 @@ class Config
'draft_attachments_lifetime' => [
'type' => 'integer',
'description' => 'Lifetime (in seconds) of drafts\' attachments and inline images: after this duration, the garbage collector will delete them.',
'default' => 86400,
'value' => '',
'source_of_value' => '',
'default' => 86400,
'value' => '',
'source_of_value' => '',
'show_in_conf_sample' => false,
],
'date_and_time_format' => [
Expand Down Expand Up @@ -1882,6 +1890,7 @@ public function IsCustomValue(string $sPropCode): bool
* @var integer Number of seconds between two reloads of the display (standard)
*/
protected $m_iStandardReloadInterval;

/**
* @var integer Number of seconds between two reloads of the display (fast)
*/
Expand Down Expand Up @@ -2553,9 +2562,9 @@ public function WriteToFile($sFileName = '')

// Old fashioned integer settings
$aIntValues = array(
'fast_reload_interval' => $this->m_iFastReloadInterval,
'max_display_limit' => $this->m_iMaxDisplayLimit,
'min_display_limit' => $this->m_iMinDisplayLimit,
'fast_reload_interval' => $this->m_iFastReloadInterval,
'max_display_limit' => $this->m_iMaxDisplayLimit,
'min_display_limit' => $this->m_iMinDisplayLimit,
'standard_reload_interval' => $this->m_iStandardReloadInterval,
);
foreach ($aIntValues as $sKey => $iValue)
Expand Down
15 changes: 13 additions & 2 deletions core/datamodel.core.xml
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@
<db_final_class_field/>
<naming>
<attributes>
<attribute id="title"/>
<attribute id="name"/>
</attributes>
</naming>
<style>
Expand Down Expand Up @@ -390,7 +390,18 @@
<is_null_allowed>false</is_null_allowed>
</field>
</fields>
<presentation/>
<presentation>
<summary>
<items>
<item id="date">
<rank>10</rank>
</item>
<item id="message">
<rank>20</rank>
</item>
</items>
</summary>
</presentation>
<methods/>
</class>
</classes>
Expand Down
3 changes: 2 additions & 1 deletion core/dbobject.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -2311,7 +2311,6 @@ private function GetUniquenessRuleGenericMessage(string $sCurrentClass, string $
protected function HasObjectsInDbForUniquenessRule($sUniquenessRuleId, $aUniquenessRuleProperties)
{
$oUniquenessQuery = $this->GetSearchForUniquenessRule($sUniquenessRuleId, $aUniquenessRuleProperties);
$oUniquenessQuery->AllowAllData();
$oUniquenessDuplicates = new DBObjectSet($oUniquenessQuery);
$bHasDuplicates = $oUniquenessDuplicates->CountExceeds(0);

Expand Down Expand Up @@ -2357,6 +2356,8 @@ protected function GetSearchForUniquenessRule($sUniquenessRuleId, $aUniquenessRu
$oUniquenessQuery->AddConditionForInOperatorUsingParam('finalclass', $aChildClassesWithRuleDisabled, false);
}

$oUniquenessQuery->AllowAllData();

return $oUniquenessQuery;
}

Expand Down
53 changes: 33 additions & 20 deletions core/metamodel.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -7168,32 +7168,45 @@ public static function BulkUpdate(DBObjectSearch $oFilter, array $aValues)
*/
public static function PurgeData($oFilter)
{
$iMaxChunkSize = MetaModel::GetConfig()->Get('purge_data.max_chunk_size');
$sTargetClass = $oFilter->GetClass();
$oSet = new DBObjectSet($oFilter);
$oSet->OptimizeColumnLoad(array($sTargetClass => array('finalclass')));
$aIdToClass = $oSet->GetColumnAsArray('finalclass', true);
$iNbIdsDeleted = 0;
$bExecuteQuery = true;

// This loop allows you to delete objects in batches of $iMaxChunkSize elements
while ($bExecuteQuery) {
$oSet = new DBObjectSet($oFilter);
$oSet->SetLimit($iMaxChunkSize);
$oSet->OptimizeColumnLoad(array($sTargetClass => array('finalclass')));
$aIdToClass = $oSet->GetColumnAsArray('finalclass', true);

$aIds = array_keys($aIdToClass);
$iNbIds = count($aIds);
if ($iNbIds > 0) {
$aQuotedIds = CMDBSource::Quote($aIds);
$sIdList = implode(',', $aQuotedIds);
$aTargetClasses = array_merge(
self::EnumChildClasses($sTargetClass, ENUM_CHILD_CLASSES_ALL),
self::EnumParentClasses($sTargetClass, ENUM_PARENT_CLASSES_EXCLUDELEAF)
);
foreach ($aTargetClasses as $sSomeClass) {
$sTable = MetaModel::DBGetTable($sSomeClass);
$sPKField = MetaModel::DBGetKey($sSomeClass);

$aIds = array_keys($aIdToClass);
if (count($aIds) > 0)
{
$aQuotedIds = CMDBSource::Quote($aIds);
$sIdList = implode(',', $aQuotedIds);
$aTargetClasses = array_merge(
self::EnumChildClasses($sTargetClass, ENUM_CHILD_CLASSES_ALL),
self::EnumParentClasses($sTargetClass, ENUM_PARENT_CLASSES_EXCLUDELEAF)
);
foreach($aTargetClasses as $sSomeClass)
{
$sTable = MetaModel::DBGetTable($sSomeClass);
$sPKField = MetaModel::DBGetKey($sSomeClass);
$sDeleteSQL = "DELETE FROM `$sTable` WHERE `$sPKField` IN ($sIdList)";
CMDBSource::DeleteFrom($sDeleteSQL);
}
$iNbIdsDeleted += $iNbIds;
}

$sDeleteSQL = "DELETE FROM `$sTable` WHERE `$sPKField` IN ($sIdList)";
CMDBSource::DeleteFrom($sDeleteSQL);
// stop loop if query returned fewer objects than $iMaxChunkSize. In this case, all objects have been deleted.
if ($iNbIds < $iMaxChunkSize) {
$bExecuteQuery = false;
}
}
return count($aIds);
}

return $iNbIdsDeleted;
}
// Links
//
//
Expand Down
5 changes: 4 additions & 1 deletion core/trigger.class.inc.php
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,8 @@ public function DoActivate($aContextArgs)
return;
}

$aContextArgs['trigger->object()'] = $this;

// Find the related actions
$oLinkedActions = $this->Get('action_list');

Expand All @@ -121,7 +123,7 @@ public function DoActivate($aContextArgs)
$aActionListOrdered[(int) $oLink->Get('order')][] = $oLink;
}
ksort($aActionListOrdered);

// Execute actions
foreach ($aActionListOrdered as $aActionSubList) {
foreach ($aActionSubList as $oLink) /** @var \DBObject $oLink */ {
Expand All @@ -131,6 +133,7 @@ public function DoActivate($aContextArgs)
$oAction = MetaModel::GetObject('Action', $iActionId);
if ($oAction->IsActive()) {
$oKPI = new ExecutionKPI();
$aContextArgs['action->object()'] = $oAction;
$oAction->DoExecute($this, $aContextArgs);
$oKPI->ComputeStatsForExtension($oAction, 'DoExecute');
}
Expand Down
60 changes: 60 additions & 0 deletions css/backoffice/_shame.scss
Original file line number Diff line number Diff line change
Expand Up @@ -49,3 +49,63 @@
.ibo-navigation-menu.ibo-is-active .ibo-navigation-menu--drawer{
transform: translate3d(0,0,0);
}

// Toggler legacy CSS that has somehow been added to iTop 3.0 and that is now used by some extensions
// Round Toggle
/* The switch - the box around the slider */
.switch {
position: relative;
display: inline-block;
width: 36px;
height: 20px;
vertical-align: baseline;
}

/* Hide default HTML checkbox */
.switch input {
display: none;
}

/* The slider */
.slider {
position: absolute;
cursor: pointer;
top: 0;
left: 0;
right: 0;
bottom: 0;
background-color: $ibo-color-secondary-600;
transition: .4s;
}

.slider:before {
position: absolute;
content: "";
height: 15px;
width: 15px;
left: 3px;
bottom: 3px;
background-color: $ibo-color-secondary-300;
transition: .4s;
}

input:checked + .slider {
background-color: $ibo-color-primary-600;
}

input:focus + .slider {
box-shadow: 0 0 1px $ibo-color-primary-600;
}

input:checked + .slider:before {
transform: translateX(14.5px);
}

/* Rounded sliders */
.slider.round {
border-radius: 20px;
}

.slider.round:before {
border-radius: 7px;
}
27 changes: 27 additions & 0 deletions css/backoffice/components/_panel.scss
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,9 @@ $ibo-panel--collapsible-toggler--margin-right: $ibo-spacing-300 !default;
$ibo-panel--collapsible-toggler--font-size: $ibo-font-size-250 !default;
$ibo-panel--collapsible-toggler--color: $ibo-color-grey-700 !default;

$ibo-panel--is-selectable--body--after--z-index: $ibo-panel--header--z-index + 1 !default;
$ibo-panel--is-selectable--body--after--font-size: $ibo-font-size-700 !default;

/* Rules */
.ibo-panel {
--ibo-main-color: #{map-get($ibo-panel-colors, 'neutral')}; /* --ibo-main-color is to allow overload from custom dynamic value from the DM. The overload will be done through an additional CSS class of a particular DM class or DM attribute */
Expand Down Expand Up @@ -128,6 +131,30 @@ $ibo-panel--collapsible-toggler--color: $ibo-color-grey-700 !default;
}
}
}
&.ibo-is-selectable .ibo-panel--body::after {
@include ibo-selectable;
position: absolute;
display: flex;
align-items: center;
justify-content: center;

height: 100%;
width: 100%;
z-index: $ibo-panel--is-selectable--body--after--z-index;
font-size: $ibo-panel--is-selectable--body--after--font-size;
}
&.ibo-is-selectable:hover .ibo-panel--body::after {
@include ibo-selectable-hover;
display: flex;
}
&.ibo-is-selected .ibo-panel--body::after {
@include ibo-selected;
display: flex;
}
&.ibo-is-selected:hover .ibo-panel--body::after {
@include ibo-selected-hover;
display: flex;
}
}

.ibo-panel--header {
Expand Down
1 change: 1 addition & 0 deletions css/backoffice/components/input/_all.scss
Original file line number Diff line number Diff line change
Expand Up @@ -16,3 +16,4 @@
@import "input-one-way-password";
@import "input-set";
@import "input-text";
@import "input-toggler";
Loading

0 comments on commit 4e53dee

Please sign in to comment.