mirror of
https://github.com/Combodo/iTop.git
synced 2026-02-13 07:24:13 +01:00
N°2841 - Error when trying to delete a user with a no admin
This commit is contained in:
@@ -1,20 +1,7 @@
|
|||||||
<?php
|
<?php
|
||||||
/**
|
/*
|
||||||
* Copyright (C) 2013-2021 Combodo SARL
|
* @copyright Copyright (C) 2010-2021 Combodo SARL
|
||||||
*
|
* @license http://opensource.org/licenses/AGPL-3.0
|
||||||
* This file is part of iTop.
|
|
||||||
*
|
|
||||||
* iTop is free software; you can redistribute it and/or modify
|
|
||||||
* it under the terms of the GNU Affero General Public License as published by
|
|
||||||
* the Free Software Foundation, either version 3 of the License, or
|
|
||||||
* (at your option) any later version.
|
|
||||||
*
|
|
||||||
* iTop is distributed in the hope that it will be useful,
|
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
* GNU Affero General Public License for more details.
|
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU Affero General Public License
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
define('ADMIN_PROFILE_NAME', 'Administrator');
|
define('ADMIN_PROFILE_NAME', 'Administrator');
|
||||||
@@ -266,17 +253,54 @@ class URP_UserProfile extends UserRightsBaseClassGUI
|
|||||||
|
|
||||||
public function CheckToDelete(&$oDeletionPlan)
|
public function CheckToDelete(&$oDeletionPlan)
|
||||||
{
|
{
|
||||||
if (MetaModel::GetConfig()->Get('demo_mode'))
|
if (MetaModel::GetConfig()->Get('demo_mode')) {
|
||||||
{
|
|
||||||
// Users deletion is NOT allowed in demo mode
|
// Users deletion is NOT allowed in demo mode
|
||||||
$oDeletionPlan->AddToDelete($this, null);
|
$oDeletionPlan->AddToDelete($this, null);
|
||||||
$oDeletionPlan->SetDeletionIssues($this, array('deletion not allowed in demo mode.'), true);
|
$oDeletionPlan->SetDeletionIssues($this, array('deletion not allowed in demo mode.'), true);
|
||||||
$oDeletionPlan->ComputeResults();
|
$oDeletionPlan->ComputeResults();
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
try {
|
||||||
|
$this->CheckIfProfileIsAllowed(UR_ACTION_DELETE);
|
||||||
|
}
|
||||||
|
catch (SecurityException $e) {
|
||||||
|
// Users deletion is NOT allowed
|
||||||
|
$oDeletionPlan->AddToDelete($this, null);
|
||||||
|
$oDeletionPlan->SetDeletionIssues($this, [$e->getMessage()], true);
|
||||||
|
$oDeletionPlan->ComputeResults();
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
return parent::CheckToDelete($oDeletionPlan);
|
return parent::CheckToDelete($oDeletionPlan);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function DoCheckToDelete(&$oDeletionPlan)
|
||||||
|
{
|
||||||
|
if (MetaModel::GetConfig()->Get('demo_mode')) {
|
||||||
|
// Users deletion is NOT allowed in demo mode
|
||||||
|
$oDeletionPlan->AddToDelete($this, null);
|
||||||
|
$oDeletionPlan->SetDeletionIssues($this, array('deletion not allowed in demo mode.'), true);
|
||||||
|
$oDeletionPlan->ComputeResults();
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
try {
|
||||||
|
$this->CheckIfProfileIsAllowed(UR_ACTION_DELETE);
|
||||||
|
}
|
||||||
|
catch (SecurityException $e) {
|
||||||
|
// Users deletion is NOT allowed
|
||||||
|
$oDeletionPlan->AddToDelete($this, null);
|
||||||
|
$oDeletionPlan->SetDeletionIssues($this, [$e->getMessage()], true);
|
||||||
|
$oDeletionPlan->ComputeResults();
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
return parent::DoCheckToDelete($oDeletionPlan);
|
||||||
|
}
|
||||||
|
|
||||||
protected function OnInsert()
|
protected function OnInsert()
|
||||||
{
|
{
|
||||||
$this->CheckIfProfileIsAllowed(UR_ACTION_CREATE);
|
$this->CheckIfProfileIsAllowed(UR_ACTION_CREATE);
|
||||||
@@ -289,7 +313,6 @@ class URP_UserProfile extends UserRightsBaseClassGUI
|
|||||||
|
|
||||||
protected function OnDelete()
|
protected function OnDelete()
|
||||||
{
|
{
|
||||||
$this->CheckIfProfileIsAllowed(UR_ACTION_DELETE);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -4961,7 +4961,7 @@ EOF
|
|||||||
$sSubtitle = Dict::Format('UI:Delect:Confirm_Count_ObjectsOf_Class', count($aObjects),
|
$sSubtitle = Dict::Format('UI:Delect:Confirm_Count_ObjectsOf_Class', count($aObjects),
|
||||||
MetaModel::GetName($sClass));
|
MetaModel::GetName($sClass));
|
||||||
}
|
}
|
||||||
$oP->AddUiBlock(TitleUIBlockFactory::MakeForPage($sSubtitle));
|
$oP->AddUiBlock(TitleUIBlockFactory::MakeStandard(new Html($sSubtitle)));
|
||||||
|
|
||||||
foreach ($aObjects as $oObj) {
|
foreach ($aObjects as $oObj) {
|
||||||
$aKeys[] = $oObj->GetKey();
|
$aKeys[] = $oObj->GetKey();
|
||||||
|
|||||||
@@ -219,6 +219,7 @@ return array(
|
|||||||
'Combodo\\iTop\\Application\\UI\\Base\\Component\\QuickCreate\\QuickCreateHelper' => $baseDir . '/sources/application/UI/Base/Component/QuickCreate/QuickCreateHelper.php',
|
'Combodo\\iTop\\Application\\UI\\Base\\Component\\QuickCreate\\QuickCreateHelper' => $baseDir . '/sources/application/UI/Base/Component/QuickCreate/QuickCreateHelper.php',
|
||||||
'Combodo\\iTop\\Application\\UI\\Base\\Component\\Spinner\\Spinner' => $baseDir . '/sources/application/UI/Base/Component/Spinner/Spinner.php',
|
'Combodo\\iTop\\Application\\UI\\Base\\Component\\Spinner\\Spinner' => $baseDir . '/sources/application/UI/Base/Component/Spinner/Spinner.php',
|
||||||
'Combodo\\iTop\\Application\\UI\\Base\\Component\\Spinner\\SpinnerUIBlockFactory' => $baseDir . '/sources/application/UI/Base/Component/Spinner/SpinnerUIBlockFactory.php',
|
'Combodo\\iTop\\Application\\UI\\Base\\Component\\Spinner\\SpinnerUIBlockFactory' => $baseDir . '/sources/application/UI/Base/Component/Spinner/SpinnerUIBlockFactory.php',
|
||||||
|
'Combodo\\iTop\\Application\\UI\\Base\\Component\\Text\\Text' => $baseDir . '/sources/application/UI/Base/Component/Text/Text.php',
|
||||||
'Combodo\\iTop\\Application\\UI\\Base\\Component\\Title\\Title' => $baseDir . '/sources/application/UI/Base/Component/Title/Title.php',
|
'Combodo\\iTop\\Application\\UI\\Base\\Component\\Title\\Title' => $baseDir . '/sources/application/UI/Base/Component/Title/Title.php',
|
||||||
'Combodo\\iTop\\Application\\UI\\Base\\Component\\Title\\TitleUIBlockFactory' => $baseDir . '/sources/application/UI/Base/Component/Title/TitleUIBlockFactory.php',
|
'Combodo\\iTop\\Application\\UI\\Base\\Component\\Title\\TitleUIBlockFactory' => $baseDir . '/sources/application/UI/Base/Component/Title/TitleUIBlockFactory.php',
|
||||||
'Combodo\\iTop\\Application\\UI\\Base\\Component\\Toolbar\\Toolbar' => $baseDir . '/sources/application/UI/Base/Component/Toolbar/Toolbar.php',
|
'Combodo\\iTop\\Application\\UI\\Base\\Component\\Toolbar\\Toolbar' => $baseDir . '/sources/application/UI/Base/Component/Toolbar/Toolbar.php',
|
||||||
|
|||||||
@@ -449,6 +449,7 @@ class ComposerStaticInit0018331147de7601e7552f7da8e3bb8b
|
|||||||
'Combodo\\iTop\\Application\\UI\\Base\\Component\\QuickCreate\\QuickCreateHelper' => __DIR__ . '/../..' . '/sources/application/UI/Base/Component/QuickCreate/QuickCreateHelper.php',
|
'Combodo\\iTop\\Application\\UI\\Base\\Component\\QuickCreate\\QuickCreateHelper' => __DIR__ . '/../..' . '/sources/application/UI/Base/Component/QuickCreate/QuickCreateHelper.php',
|
||||||
'Combodo\\iTop\\Application\\UI\\Base\\Component\\Spinner\\Spinner' => __DIR__ . '/../..' . '/sources/application/UI/Base/Component/Spinner/Spinner.php',
|
'Combodo\\iTop\\Application\\UI\\Base\\Component\\Spinner\\Spinner' => __DIR__ . '/../..' . '/sources/application/UI/Base/Component/Spinner/Spinner.php',
|
||||||
'Combodo\\iTop\\Application\\UI\\Base\\Component\\Spinner\\SpinnerUIBlockFactory' => __DIR__ . '/../..' . '/sources/application/UI/Base/Component/Spinner/SpinnerUIBlockFactory.php',
|
'Combodo\\iTop\\Application\\UI\\Base\\Component\\Spinner\\SpinnerUIBlockFactory' => __DIR__ . '/../..' . '/sources/application/UI/Base/Component/Spinner/SpinnerUIBlockFactory.php',
|
||||||
|
'Combodo\\iTop\\Application\\UI\\Base\\Component\\Text\\Text' => __DIR__ . '/../..' . '/sources/application/UI/Base/Component/Text/Text.php',
|
||||||
'Combodo\\iTop\\Application\\UI\\Base\\Component\\Title\\Title' => __DIR__ . '/../..' . '/sources/application/UI/Base/Component/Title/Title.php',
|
'Combodo\\iTop\\Application\\UI\\Base\\Component\\Title\\Title' => __DIR__ . '/../..' . '/sources/application/UI/Base/Component/Title/Title.php',
|
||||||
'Combodo\\iTop\\Application\\UI\\Base\\Component\\Title\\TitleUIBlockFactory' => __DIR__ . '/../..' . '/sources/application/UI/Base/Component/Title/TitleUIBlockFactory.php',
|
'Combodo\\iTop\\Application\\UI\\Base\\Component\\Title\\TitleUIBlockFactory' => __DIR__ . '/../..' . '/sources/application/UI/Base/Component/Title/TitleUIBlockFactory.php',
|
||||||
'Combodo\\iTop\\Application\\UI\\Base\\Component\\Toolbar\\Toolbar' => __DIR__ . '/../..' . '/sources/application/UI/Base/Component/Toolbar/Toolbar.php',
|
'Combodo\\iTop\\Application\\UI\\Base\\Component\\Toolbar\\Toolbar' => __DIR__ . '/../..' . '/sources/application/UI/Base/Component/Toolbar/Toolbar.php',
|
||||||
|
|||||||
@@ -1,20 +1,7 @@
|
|||||||
<?php
|
<?php
|
||||||
/**
|
/*
|
||||||
* Copyright (C) 2013-2021 Combodo SARL
|
* @copyright Copyright (C) 2010-2021 Combodo SARL
|
||||||
*
|
* @license http://opensource.org/licenses/AGPL-3.0
|
||||||
* This file is part of iTop.
|
|
||||||
*
|
|
||||||
* iTop is free software; you can redistribute it and/or modify
|
|
||||||
* it under the terms of the GNU Affero General Public License as published by
|
|
||||||
* the Free Software Foundation, either version 3 of the License, or
|
|
||||||
* (at your option) any later version.
|
|
||||||
*
|
|
||||||
* iTop is distributed in the hope that it will be useful,
|
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
* GNU Affero General Public License for more details.
|
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU Affero General Public License
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
use Combodo\iTop\Application\UI\Base\Component\Alert\AlertUIBlockFactory;
|
use Combodo\iTop\Application\UI\Base\Component\Alert\AlertUIBlockFactory;
|
||||||
@@ -23,7 +10,7 @@ use Combodo\iTop\Application\UI\Base\Component\Dashlet\DashletContainer;
|
|||||||
use Combodo\iTop\Application\UI\Base\Component\Dashlet\DashletFactory;
|
use Combodo\iTop\Application\UI\Base\Component\Dashlet\DashletFactory;
|
||||||
use Combodo\iTop\Application\UI\Base\Component\DataTable\DataTableUIBlockFactory;
|
use Combodo\iTop\Application\UI\Base\Component\DataTable\DataTableUIBlockFactory;
|
||||||
use Combodo\iTop\Application\UI\Base\Component\Panel\Panel;
|
use Combodo\iTop\Application\UI\Base\Component\Panel\Panel;
|
||||||
use Combodo\iTop\Application\UI\Base\Component\Title\Title;
|
use Combodo\iTop\Application\UI\Base\Component\Title\TitleUIBlockFactory;
|
||||||
use Combodo\iTop\Application\UI\Base\Layout\Dashboard\DashboardColumn;
|
use Combodo\iTop\Application\UI\Base\Layout\Dashboard\DashboardColumn;
|
||||||
use Combodo\iTop\Application\UI\Base\Layout\Dashboard\DashboardRow;
|
use Combodo\iTop\Application\UI\Base\Layout\Dashboard\DashboardRow;
|
||||||
|
|
||||||
@@ -233,21 +220,19 @@ try
|
|||||||
$oP->TrashUnexpectedOutput();
|
$oP->TrashUnexpectedOutput();
|
||||||
$oP->output();
|
$oP->output();
|
||||||
exit;
|
exit;
|
||||||
}
|
} else {
|
||||||
else
|
|
||||||
{
|
|
||||||
$sTitle = Dict::S('UI:Audit:AuditErrors');
|
$sTitle = Dict::S('UI:Audit:AuditErrors');
|
||||||
$oP->SetBreadCrumbEntry('ui-tool-auditerrors', $sTitle, '', '', 'fas fa-stethoscope', iTopWebPage::ENUM_BREADCRUMB_ENTRY_ICON_TYPE_CSS_CLASSES);
|
$oP->SetBreadCrumbEntry('ui-tool-auditerrors', $sTitle, '', '', 'fas fa-stethoscope', iTopWebPage::ENUM_BREADCRUMB_ENTRY_ICON_TYPE_CSS_CLASSES);
|
||||||
|
|
||||||
$oBackButton = ButtonUIBlockFactory::MakeIconLink('fas fa-chevron-left', Dict::S('Back to audit results'), "./audit.php?".$oAppContext->GetForLink());
|
$oBackButton = ButtonUIBlockFactory::MakeIconLink('fas fa-chevron-left', Dict::S('Back to audit results'), "./audit.php?".$oAppContext->GetForLink());
|
||||||
$oP->AddUiBlock($oBackButton);
|
$oP->AddUiBlock($oBackButton);
|
||||||
$oP->AddUiBlock(new Title($sTitle . $oAuditRule->Get('description')));
|
$oP->AddUiBlock(TitleUIBlockFactory::MakeForPage($sTitle.$oAuditRule->Get('description')));
|
||||||
|
|
||||||
$sBlockId = 'audit_errors';
|
$sBlockId = 'audit_errors';
|
||||||
$oP->p("<div id=\"$sBlockId\">");
|
$oP->p("<div id=\"$sBlockId\">");
|
||||||
$oBlock = DisplayBlock::FromObjectSet($oErrorObjectSet, 'csv', array('show_obsolete_data' => true));
|
$oBlock = DisplayBlock::FromObjectSet($oErrorObjectSet, 'csv', array('show_obsolete_data' => true));
|
||||||
$oBlock->Display($oP, 1);
|
$oBlock->Display($oP, 1);
|
||||||
$oP->p("</div>");
|
$oP->p("</div>");
|
||||||
// Adjust the size of the Textarea containing the CSV to fit almost all the remaining space
|
// Adjust the size of the Textarea containing the CSV to fit almost all the remaining space
|
||||||
$oP->add_ready_script(" $('#1>textarea').height(400);"); // adjust the size of the block
|
$oP->add_ready_script(" $('#1>textarea').height(400);"); // adjust the size of the block
|
||||||
$sExportUrl = utils::GetAbsoluteUrlAppRoot()."pages/audit.php?operation=csv&category=".$oAuditCategory->GetKey()."&rule=".$oAuditRule->GetKey();
|
$sExportUrl = utils::GetAbsoluteUrlAppRoot()."pages/audit.php?operation=csv&category=".$oAuditCategory->GetKey()."&rule=".$oAuditRule->GetKey();
|
||||||
@@ -259,49 +244,49 @@ try
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case 'errors':
|
case 'errors':
|
||||||
$sTitle = Dict::S('UI:Audit:AuditErrors');
|
$sTitle = Dict::S('UI:Audit:AuditErrors');
|
||||||
$oP->SetBreadCrumbEntry('ui-tool-auditerrors', $sTitle, '', '', 'fas fa-stethoscope', iTopWebPage::ENUM_BREADCRUMB_ENTRY_ICON_TYPE_CSS_CLASSES);
|
$oP->SetBreadCrumbEntry('ui-tool-auditerrors', $sTitle, '', '', 'fas fa-stethoscope', iTopWebPage::ENUM_BREADCRUMB_ENTRY_ICON_TYPE_CSS_CLASSES);
|
||||||
$iCategory = utils::ReadParam('category', '');
|
$iCategory = utils::ReadParam('category', '');
|
||||||
$iRuleIndex = utils::ReadParam('rule', 0);
|
$iRuleIndex = utils::ReadParam('rule', 0);
|
||||||
|
|
||||||
$oAuditCategory = MetaModel::GetObject('AuditCategory', $iCategory);
|
$oAuditCategory = MetaModel::GetObject('AuditCategory', $iCategory);
|
||||||
$oDefinitionFilter = DBObjectSearch::FromOQL($oAuditCategory->Get('definition_set'));
|
$oDefinitionFilter = DBObjectSearch::FromOQL($oAuditCategory->Get('definition_set'));
|
||||||
$oDefinitionFilter->UpdateContextFromUser();
|
$oDefinitionFilter->UpdateContextFromUser();
|
||||||
FilterByContext($oDefinitionFilter, $oAppContext);
|
FilterByContext($oDefinitionFilter, $oAppContext);
|
||||||
$oDefinitionSet = new CMDBObjectSet($oDefinitionFilter);
|
$oDefinitionSet = new CMDBObjectSet($oDefinitionFilter);
|
||||||
$oFilter = GetRuleResultFilter($iRuleIndex, $oDefinitionFilter, $oAppContext);
|
$oFilter = GetRuleResultFilter($iRuleIndex, $oDefinitionFilter, $oAppContext);
|
||||||
$oErrorObjectSet = new CMDBObjectSet($oFilter);
|
$oErrorObjectSet = new CMDBObjectSet($oFilter);
|
||||||
$oAuditRule = MetaModel::GetObject('AuditRule', $iRuleIndex);
|
$oAuditRule = MetaModel::GetObject('AuditRule', $iRuleIndex);
|
||||||
$oBackButton = ButtonUIBlockFactory::MakeIconLink('fas fa-chevron-left', Dict::S('Back to audit results'), "./audit.php?".$oAppContext->GetForLink());
|
$oBackButton = ButtonUIBlockFactory::MakeIconLink('fas fa-chevron-left', Dict::S('Back to audit results'), "./audit.php?".$oAppContext->GetForLink());
|
||||||
$oP->AddUiBlock($oBackButton);
|
$oP->AddUiBlock($oBackButton);
|
||||||
$oP->AddUiBlock(new Title($sTitle . $oAuditRule->Get('description')));
|
$oP->AddUiBlock(TitleUIBlockFactory::MakeForPage($sTitle.$oAuditRule->Get('description')));
|
||||||
$sBlockId = 'audit_errors';
|
$sBlockId = 'audit_errors';
|
||||||
$oP->p("<div id=\"$sBlockId\">");
|
$oP->p("<div id=\"$sBlockId\">");
|
||||||
$oBlock = DisplayBlock::FromObjectSet($oErrorObjectSet, 'list', array('show_obsolete_data' => true));
|
$oBlock = DisplayBlock::FromObjectSet($oErrorObjectSet, 'list', array('show_obsolete_data' => true));
|
||||||
$oBlock->Display($oP, 1);
|
$oBlock->Display($oP, 1);
|
||||||
$oP->p("</div>");
|
$oP->p("</div>");
|
||||||
$sExportUrl = utils::GetAbsoluteUrlAppRoot()."pages/audit.php?operation=csv&category=".$oAuditCategory->GetKey()."&rule=".$oAuditRule->GetKey();
|
$sExportUrl = utils::GetAbsoluteUrlAppRoot()."pages/audit.php?operation=csv&category=".$oAuditCategory->GetKey()."&rule=".$oAuditRule->GetKey();
|
||||||
$oP->add_ready_script("$('a[href*=\"pages/UI.php?operation=search\"]').attr('href', '".$sExportUrl."')");
|
$oP->add_ready_script("$('a[href*=\"pages/UI.php?operation=search\"]').attr('href', '".$sExportUrl."')");
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'audit':
|
case 'audit':
|
||||||
default:
|
default:
|
||||||
$oP->SetBreadCrumbEntry('ui-tool-audit', Dict::S('Menu:Audit'), Dict::S('UI:Audit:InteractiveAudit'), '', 'fas fa-stethoscope', iTopWebPage::ENUM_BREADCRUMB_ENTRY_ICON_TYPE_CSS_CLASSES);
|
$oP->SetBreadCrumbEntry('ui-tool-audit', Dict::S('Menu:Audit'), Dict::S('UI:Audit:InteractiveAudit'), '', 'fas fa-stethoscope', iTopWebPage::ENUM_BREADCRUMB_ENTRY_ICON_TYPE_CSS_CLASSES);
|
||||||
$oP->AddUiBlock(new Title(Dict::S('UI:Audit:InteractiveAudit')));
|
$oP->AddUiBlock(TitleUIBlockFactory::MakeForPage(Dict::S('UI:Audit:InteractiveAudit')));
|
||||||
$oTotalBlock = DashletFactory::MakeForDashletBadge('../images/icons/icons8-audit.svg', '#', 0, Dict::S('UI:Audit:Dashboard:ObjectsAudited'));
|
$oTotalBlock = DashletFactory::MakeForDashletBadge('../images/icons/icons8-audit.svg', '#', 0, Dict::S('UI:Audit:Dashboard:ObjectsAudited'));
|
||||||
$oErrorBlock = DashletFactory::MakeForDashletBadge('../images/icons/icons8-delete.svg', '#', 0, Dict::S('UI:Audit:Dashboard:ObjectsInError'));
|
$oErrorBlock = DashletFactory::MakeForDashletBadge('../images/icons/icons8-delete.svg', '#', 0, Dict::S('UI:Audit:Dashboard:ObjectsInError'));
|
||||||
$oWorkingBlock = DashletFactory::MakeForDashletBadge('../images/icons/icons8-checkmark.svg', '#', 0, Dict::S('UI:Audit:Dashboard:ObjectsValidated'));
|
$oWorkingBlock = DashletFactory::MakeForDashletBadge('../images/icons/icons8-checkmark.svg', '#', 0, Dict::S('UI:Audit:Dashboard:ObjectsValidated'));
|
||||||
|
|
||||||
$aCSSClasses = ['ibo-dashlet--is-inline','ibo-dashlet-badge'];
|
$aCSSClasses = ['ibo-dashlet--is-inline', 'ibo-dashlet-badge'];
|
||||||
|
|
||||||
$oDashletContainerTotal = new DashletContainer();
|
$oDashletContainerTotal = new DashletContainer();
|
||||||
$oDashletContainerError = new DashletContainer();
|
$oDashletContainerError = new DashletContainer();
|
||||||
$oDashletContainerWorking = new DashletContainer();
|
$oDashletContainerWorking = new DashletContainer();
|
||||||
|
|
||||||
$oDashletContainerTotal->AddSubBlock($oTotalBlock)->AddCSSClasses($aCSSClasses);
|
$oDashletContainerTotal->AddSubBlock($oTotalBlock)->AddCSSClasses($aCSSClasses);
|
||||||
$oDashletContainerError->AddSubBlock($oErrorBlock)->AddCSSClasses($aCSSClasses);
|
$oDashletContainerError->AddSubBlock($oErrorBlock)->AddCSSClasses($aCSSClasses);
|
||||||
$oDashletContainerWorking->AddSubBlock($oWorkingBlock)->AddCSSClasses($aCSSClasses);
|
$oDashletContainerWorking->AddSubBlock($oWorkingBlock)->AddCSSClasses($aCSSClasses);
|
||||||
|
|
||||||
$oDashboardRow = new DashboardRow();
|
$oDashboardRow = new DashboardRow();
|
||||||
|
|
||||||
$oDashboardColumnTotal = new DashboardColumn(false, true);
|
$oDashboardColumnTotal = new DashboardColumn(false, true);
|
||||||
|
|||||||
@@ -1,20 +1,7 @@
|
|||||||
<?php
|
<?php
|
||||||
/**
|
/*
|
||||||
* Copyright (C) 2013-2021 Combodo SARL
|
* @copyright Copyright (C) 2010-2021 Combodo SARL
|
||||||
*
|
* @license http://opensource.org/licenses/AGPL-3.0
|
||||||
* This file is part of iTop.
|
|
||||||
*
|
|
||||||
* iTop is free software; you can redistribute it and/or modify
|
|
||||||
* it under the terms of the GNU Affero General Public License as published by
|
|
||||||
* the Free Software Foundation, either version 3 of the License, or
|
|
||||||
* (at your option) any later version.
|
|
||||||
*
|
|
||||||
* iTop is distributed in the hope that it will be useful,
|
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
* GNU Affero General Public License for more details.
|
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU Affero General Public License
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
use Combodo\iTop\Application\UI\Base\Component\Button\ButtonUIBlockFactory;
|
use Combodo\iTop\Application\UI\Base\Component\Button\ButtonUIBlockFactory;
|
||||||
@@ -22,7 +9,6 @@ use Combodo\iTop\Application\UI\Base\Component\DataTable\DataTableUIBlockFactory
|
|||||||
use Combodo\iTop\Application\UI\Base\Component\Input\Select\Select;
|
use Combodo\iTop\Application\UI\Base\Component\Input\Select\Select;
|
||||||
use Combodo\iTop\Application\UI\Base\Component\Input\Select\SelectOptionUIBlockFactory;
|
use Combodo\iTop\Application\UI\Base\Component\Input\Select\SelectOptionUIBlockFactory;
|
||||||
use Combodo\iTop\Application\UI\Base\Component\Panel\PanelUIBlockFactory;
|
use Combodo\iTop\Application\UI\Base\Component\Panel\PanelUIBlockFactory;
|
||||||
use Combodo\iTop\Application\UI\Base\Component\Title\Title;
|
|
||||||
use Combodo\iTop\Application\UI\Base\Layout\PageContent\PageContentWithSideContent;
|
use Combodo\iTop\Application\UI\Base\Layout\PageContent\PageContentWithSideContent;
|
||||||
|
|
||||||
require_once('../approot.inc.php');
|
require_once('../approot.inc.php');
|
||||||
@@ -1053,7 +1039,7 @@ $oPage->no_cache();
|
|||||||
$oPage->SetBreadCrumbEntry('ui-tool-datamodel', Dict::S('Menu:DataModelMenu'), Dict::S('Menu:DataModelMenu+'), '',
|
$oPage->SetBreadCrumbEntry('ui-tool-datamodel', Dict::S('Menu:DataModelMenu'), Dict::S('Menu:DataModelMenu+'), '',
|
||||||
'fas fa-book', iTopWebPage::ENUM_BREADCRUMB_ENTRY_ICON_TYPE_CSS_CLASSES);
|
'fas fa-book', iTopWebPage::ENUM_BREADCRUMB_ENTRY_ICON_TYPE_CSS_CLASSES);
|
||||||
|
|
||||||
$oTitle = new Title(Dict::S('UI:Schema:Title'));
|
$oTitle = TitleUIBlockFactory::MakeForPage(Dict::S('UI:Schema:Title'));
|
||||||
$oPage->AddUiBlock($oTitle);
|
$oPage->AddUiBlock($oTitle);
|
||||||
$oLayout->AddSideHtml("<div class='ibo-datamodel-viewer--classes-list'> ");
|
$oLayout->AddSideHtml("<div class='ibo-datamodel-viewer--classes-list'> ");
|
||||||
DisplayClassesList($oPage, $oLayout, $sContext);
|
DisplayClassesList($oPage, $oLayout, $sContext);
|
||||||
|
|||||||
46
sources/application/UI/Base/Component/Text/Text.php
Normal file
46
sources/application/UI/Base/Component/Text/Text.php
Normal file
@@ -0,0 +1,46 @@
|
|||||||
|
<?php
|
||||||
|
/*
|
||||||
|
* @copyright Copyright (C) 2010-2021 Combodo SARL
|
||||||
|
* @license http://opensource.org/licenses/AGPL-3.0
|
||||||
|
*/
|
||||||
|
|
||||||
|
namespace Combodo\iTop\Application\UI\Base\Component\Text;
|
||||||
|
|
||||||
|
|
||||||
|
use Combodo\iTop\Application\UI\Base\UIBlock;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Class Text
|
||||||
|
*
|
||||||
|
* @package Combodo\iTop\Application\UI\Base\Component\Text
|
||||||
|
*/
|
||||||
|
class Text extends UIBlock
|
||||||
|
{
|
||||||
|
// Overloaded constants
|
||||||
|
public const BLOCK_CODE = 'ibo-text';
|
||||||
|
public const DEFAULT_HTML_TEMPLATE_REL_PATH = 'base/components/text/layout';
|
||||||
|
|
||||||
|
/**@var string */
|
||||||
|
protected $sText;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Text constructor.
|
||||||
|
*
|
||||||
|
* @param string $sText
|
||||||
|
*/
|
||||||
|
public function __construct(string $sText, ?string $sId = null)
|
||||||
|
{
|
||||||
|
$this->sText = $sText;
|
||||||
|
parent::__construct($sId);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return string
|
||||||
|
*/
|
||||||
|
public function GetText(): string
|
||||||
|
{
|
||||||
|
return $this->sText;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -1,5 +1,5 @@
|
|||||||
<?php
|
<?php
|
||||||
/**
|
/*
|
||||||
* @copyright Copyright (C) 2010-2021 Combodo SARL
|
* @copyright Copyright (C) 2010-2021 Combodo SARL
|
||||||
* @license http://opensource.org/licenses/AGPL-3.0
|
* @license http://opensource.org/licenses/AGPL-3.0
|
||||||
*/
|
*/
|
||||||
@@ -7,6 +7,7 @@
|
|||||||
namespace Combodo\iTop\Application\UI\Base\Component\Title;
|
namespace Combodo\iTop\Application\UI\Base\Component\Title;
|
||||||
|
|
||||||
|
|
||||||
|
use Combodo\iTop\Application\UI\Base\Layout\UIContentBlock;
|
||||||
use Combodo\iTop\Application\UI\Base\UIBlock;
|
use Combodo\iTop\Application\UI\Base\UIBlock;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -14,7 +15,7 @@ use Combodo\iTop\Application\UI\Base\UIBlock;
|
|||||||
*
|
*
|
||||||
* @package Combodo\iTop\Application\UI\Base\Component\Title
|
* @package Combodo\iTop\Application\UI\Base\Component\Title
|
||||||
*/
|
*/
|
||||||
class Title extends UIBlock
|
class Title extends UIContentBlock
|
||||||
{
|
{
|
||||||
// Overloaded constants
|
// Overloaded constants
|
||||||
/** @inheritDoc */
|
/** @inheritDoc */
|
||||||
@@ -31,8 +32,6 @@ class Title extends UIBlock
|
|||||||
/** @var string */
|
/** @var string */
|
||||||
public const DEFAULT_ICON_COVER_METHOD = self::ENUM_ICON_COVER_METHOD_CONTAIN;
|
public const DEFAULT_ICON_COVER_METHOD = self::ENUM_ICON_COVER_METHOD_CONTAIN;
|
||||||
|
|
||||||
/** @var string */
|
|
||||||
protected $sTitle;
|
|
||||||
/** @var int */
|
/** @var int */
|
||||||
protected $iLevel;
|
protected $iLevel;
|
||||||
/** @var string */
|
/** @var string */
|
||||||
@@ -44,22 +43,14 @@ class Title extends UIBlock
|
|||||||
/**
|
/**
|
||||||
* @inheritDoc
|
* @inheritDoc
|
||||||
*/
|
*/
|
||||||
public function __construct(string $sTitle = '', int $iLevel = 1, ?string $sId = null)
|
public function __construct(UIBlock $oTitle, int $iLevel = 1, ?string $sId = null)
|
||||||
{
|
{
|
||||||
parent::__construct($sId);
|
parent::__construct($sId);
|
||||||
$this->sTitle = $sTitle;
|
|
||||||
$this->iLevel = $iLevel;
|
$this->iLevel = $iLevel;
|
||||||
$this->sIconUrl = null;
|
$this->sIconUrl = null;
|
||||||
$this->sIconCoverMethod = static::DEFAULT_ICON_COVER_METHOD;
|
$this->sIconCoverMethod = static::DEFAULT_ICON_COVER_METHOD;
|
||||||
$this->bIsMedallion = true;
|
$this->bIsMedallion = true;
|
||||||
}
|
$this->AddSubBlock($oTitle);
|
||||||
|
|
||||||
/**
|
|
||||||
* @return string
|
|
||||||
*/
|
|
||||||
public function GetTitle(): string
|
|
||||||
{
|
|
||||||
return $this->sTitle;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
<?php
|
<?php
|
||||||
/**
|
/*
|
||||||
* @copyright Copyright (C) 2010-2021 Combodo SARL
|
* @copyright Copyright (C) 2010-2021 Combodo SARL
|
||||||
* @license http://opensource.org/licenses/AGPL-3.0
|
* @license http://opensource.org/licenses/AGPL-3.0
|
||||||
*/
|
*/
|
||||||
@@ -9,6 +9,8 @@ namespace Combodo\iTop\Application\UI\Base\Component\Title;
|
|||||||
|
|
||||||
|
|
||||||
use Combodo\iTop\Application\UI\Base\AbstractUIBlockFactory;
|
use Combodo\iTop\Application\UI\Base\AbstractUIBlockFactory;
|
||||||
|
use Combodo\iTop\Application\UI\Base\Component\Text\Text;
|
||||||
|
use Combodo\iTop\Application\UI\Base\UIBlock;
|
||||||
|
|
||||||
class TitleUIBlockFactory extends AbstractUIBlockFactory
|
class TitleUIBlockFactory extends AbstractUIBlockFactory
|
||||||
{
|
{
|
||||||
@@ -17,7 +19,7 @@ class TitleUIBlockFactory extends AbstractUIBlockFactory
|
|||||||
|
|
||||||
public static function MakeForPage(string $sTitle, ?string $sId = null)
|
public static function MakeForPage(string $sTitle, ?string $sId = null)
|
||||||
{
|
{
|
||||||
return new Title($sTitle, 1, $sId);
|
return new Title(new Text($sTitle), 1, $sId);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function MakeForPageWithIcon(
|
public static function MakeForPageWithIcon(
|
||||||
@@ -25,7 +27,7 @@ class TitleUIBlockFactory extends AbstractUIBlockFactory
|
|||||||
?string $sId = null
|
?string $sId = null
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
$oTitle = new Title($sTitle, 1, $sId);
|
$oTitle = new Title(new Text($sTitle), 1, $sId);
|
||||||
$oTitle->SetIcon($sIconUrl, $sIconCoverMethod, $bIsMedallion);
|
$oTitle->SetIcon($sIconUrl, $sIconCoverMethod, $bIsMedallion);
|
||||||
|
|
||||||
return $oTitle;
|
return $oTitle;
|
||||||
@@ -33,6 +35,11 @@ class TitleUIBlockFactory extends AbstractUIBlockFactory
|
|||||||
|
|
||||||
public static function MakeNeutral(string $sTitle, int $iLevel = 1, ?string $sId = null)
|
public static function MakeNeutral(string $sTitle, int $iLevel = 1, ?string $sId = null)
|
||||||
{
|
{
|
||||||
return new Title($sTitle, $iLevel, $sId);
|
return new Title(new Text($sTitle), $iLevel, $sId);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static function MakeStandard(UIBlock $oTitle, int $iLevel = 1, ?string $sId = null)
|
||||||
|
{
|
||||||
|
return new Title($oTitle, $iLevel, $sId);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
5
templates/base/components/text/layout.html.twig
Normal file
5
templates/base/components/text/layout.html.twig
Normal file
@@ -0,0 +1,5 @@
|
|||||||
|
{# @copyright Copyright (C) 2010-2021 Combodo SARL #}
|
||||||
|
{# @license http://opensource.org/licenses/AGPL-3.0 #}
|
||||||
|
{% apply spaceless %}
|
||||||
|
{{ oUIBlock.GetText() }}
|
||||||
|
{% endapply %}
|
||||||
@@ -8,7 +8,9 @@
|
|||||||
<div class="ibo-title--content">
|
<div class="ibo-title--content">
|
||||||
{% block iboPageTitleText %}
|
{% block iboPageTitleText %}
|
||||||
<h{{ oUIBlock.GetLevel() }} class="ibo-title--text title is-size-{{ oUIBlock.GetLevel() + 2 }}">
|
<h{{ oUIBlock.GetLevel() }} class="ibo-title--text title is-size-{{ oUIBlock.GetLevel() + 2 }}">
|
||||||
{{ oUIBlock.GetTitle() }}
|
{% for oSubBlock in oUIBlock.GetSubBlocks() %}
|
||||||
|
{{ render_block(oSubBlock, {aPage: aPage}) }}
|
||||||
|
{% endfor %}
|
||||||
</h{{ oUIBlock.GetLevel() }}>
|
</h{{ oUIBlock.GetLevel() }}>
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
Reference in New Issue
Block a user