diff --git a/application/cmdbabstract.class.inc.php b/application/cmdbabstract.class.inc.php index 0926d6d43..2f364198c 100644 --- a/application/cmdbabstract.class.inc.php +++ b/application/cmdbabstract.class.inc.php @@ -30,7 +30,7 @@ use Combodo\iTop\Application\UI\Base\Component\Form\Form; use Combodo\iTop\Application\UI\Base\Component\Input\InputUIBlockFactory; use Combodo\iTop\Application\UI\Base\Component\Panel\Panel; use Combodo\iTop\Application\UI\Base\Component\Title\TitleUIBlockFactory; -use Combodo\iTop\Application\UI\Base\Component\Toolbar\Toolbar; +use Combodo\iTop\Application\UI\Base\Component\Toolbar\ToolbarUIBlockFactory; use Combodo\iTop\Application\UI\Base\Layout\MultiColumn\Column\Column; use Combodo\iTop\Application\UI\Base\Layout\MultiColumn\MultiColumn; use Combodo\iTop\Application\UI\Base\Layout\Object\ObjectFactory; @@ -2575,19 +2575,7 @@ JS // TODO 3.0.0: Refactor DisplayBareHeader and call it here } - // TODO 3.0.0: Dehardcode this after object details are refactored - $oPage->add_style(<<SetCSSClasses(['ibo-toolbar', 'ibo-toolbar-top']); + $oToolbarTop = ToolbarUIBlockFactory::MakeStandard(null, ['ibo-toolbar-top']); $oCancelButton = ButtonUIBlockFactory::MakeForCancel(); $oCancelButton->AddCSSClasses(['action', 'cancel']); @@ -2713,8 +2701,7 @@ EOF if ($sButtonsPosition != 'top') { // bottom or both: display the buttons here $oPage->p($sStatesSelection); - $oToolbarBottom = new Toolbar(); - $oToolbarBottom->SetCSSClasses(['ibo-toolbar']); + $oToolbarBottom = ToolbarUIBlockFactory::MakeStandard(); foreach ($oToolbarTop->GetSubBlocks() as $oButton) { $oToolbarBottom->AddSubBlock($oButton); } @@ -3071,7 +3058,7 @@ HTML $oAppContext = new ApplicationContext(); $oForm->AddHtml($oAppContext->GetForForm()); - $oCancelButton = ButtonUIBlockFactory::MakeForSecondaryAction(Dict::S('UI:Button:Cancel'), 'cancel', 'cancel'); + $oCancelButton = ButtonUIBlockFactory::MakeForCancel(Dict::S('UI:Button:Cancel'), 'cancel', 'cancel'); $oCancelButton->SetOnClickJsCode("BackToDetails('{$sClass}', '{$this->GetKey()}', '', '{$sOwnershipToken}');"); $oForm->AddSubBlock($oCancelButton); diff --git a/application/dashboard.class.inc.php b/application/dashboard.class.inc.php index dc4173673..f7cd9025d 100644 --- a/application/dashboard.class.inc.php +++ b/application/dashboard.class.inc.php @@ -19,7 +19,7 @@ use Combodo\iTop\Application\UI\Base\Component\Button\ButtonUIBlockFactory; use Combodo\iTop\Application\UI\Base\Component\DataTable\DataTableSettings; -use Combodo\iTop\Application\UI\Base\Component\Toolbar\Toolbar; +use Combodo\iTop\Application\UI\Base\Component\Toolbar\ToolbarUIBlockFactory; require_once(APPROOT.'application/dashboardlayout.class.inc.php'); require_once(APPROOT.'application/dashlet.class.inc.php'); @@ -543,7 +543,7 @@ EOF $sHtml = "
{$sTitleForHTML}
"; if ($oPage instanceof iTopWebPage) { $oTopBar = $oPage->GetTopBarLayout(); - $oToolbar = new Toolbar(); + $oToolbar = ToolbarUIBlockFactory::MakeStandard(); $oTopBar->SetToolbar($oToolbar); $oToolbar->AddHtml($sHtml); } else { diff --git a/application/displayblock.class.inc.php b/application/displayblock.class.inc.php index 5d0b66529..2800a00d6 100644 --- a/application/displayblock.class.inc.php +++ b/application/displayblock.class.inc.php @@ -24,7 +24,7 @@ use Combodo\iTop\Application\UI\Base\Component\Button\ButtonUIBlockFactory; 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\Html\Html; -use Combodo\iTop\Application\UI\Base\Component\Toolbar\Toolbar; +use Combodo\iTop\Application\UI\Base\Component\Toolbar\ToolbarUIBlockFactory; use Combodo\iTop\Application\UI\Base\iUIBlock; use Combodo\iTop\Application\UI\Base\Layout\UIContentBlock; use Combodo\iTop\Application\UI\DisplayBlock\BlockChart\BlockChart; @@ -2072,7 +2072,7 @@ class MenuBlock extends DisplayBlock } } - $oActionsBlock = new Toolbar("ibo-action-toolbar-{$sId}", ['ibo-action-toolbar']); + $oActionsBlock = ToolbarUIBlockFactory::MakeForAction("ibo-action-toolbar-{$sId}"); $oRenderBlock->AddSubBlock($oActionsBlock); $sMenuTogglerId = "ibo-actions-menu-toggler-{$sId}"; $sPopoverMenuId = "ibo-other-action-popover-{$sId}"; diff --git a/css/backoffice/components/_all.scss b/css/backoffice/components/_all.scss index 0378b8493..5f55ccf3e 100644 --- a/css/backoffice/components/_all.scss +++ b/css/backoffice/components/_all.scss @@ -25,6 +25,7 @@ @import "fieldset"; @import "field"; @import "toolbar"; +@import "toolbar-spacer"; @import "richtext"; @import "formtable"; @import "formtablerow"; diff --git a/css/backoffice/components/_toolbar-spacer.scss b/css/backoffice/components/_toolbar-spacer.scss new file mode 100644 index 000000000..8c383d7a4 --- /dev/null +++ b/css/backoffice/components/_toolbar-spacer.scss @@ -0,0 +1,11 @@ +/*! + * copyright Copyright (C) 2010-2021 Combodo SARL + * license http://opensource.org/licenses/AGPL-3.0 + */ + + +.ibo-toolbar--button { + .ibo-toolbar-spacer { + flex-grow: 1; + } +} \ No newline at end of file diff --git a/css/backoffice/components/_toolbar.scss b/css/backoffice/components/_toolbar.scss index 21616526b..5ba69bd0f 100644 --- a/css/backoffice/components/_toolbar.scss +++ b/css/backoffice/components/_toolbar.scss @@ -3,6 +3,24 @@ * license http://opensource.org/licenses/AGPL-3.0 */ -.ibo-action-toolbar { - position: relative; -} \ No newline at end of file +$ibo-toolbar--button-margin-top: 16px !default; +$ibo-toolbar--margin: 6px 0 !default; + +.ibo-toolbar { + margin: $ibo-toolbar--margin; + + &.ibo-toolbar--action { + position: relative; + } + + &.ibo-toolbar--button { + @extend %ibo-vertically-centered-content; + margin-top: $ibo-toolbar--button-margin-top; + } + + &.ibo-toolbar-top{ + padding-left: calc(90px + 64px); + text-align: right; + } +} + diff --git a/css/backoffice/utils/helpers/_misc.scss b/css/backoffice/utils/helpers/_misc.scss index 2350a24e8..38aa7c095 100644 --- a/css/backoffice/utils/helpers/_misc.scss +++ b/css/backoffice/utils/helpers/_misc.scss @@ -23,7 +23,9 @@ .ibo-is-hidden{ display: none !important; /* Note: !important is necessary as it needs to overload any standard rules */ } - +.ibo-is-fullwidth { + width: 100%; +} /* Used on all ancestors when an element needs to be fullscreen (see .ibo-is-fullscreen) */ html.ibo-has-fullscreen-descendant{ position: fixed !important; diff --git a/css/errorpage.scss b/css/errorpage.scss deleted file mode 100644 index d899906ee..000000000 --- a/css/errorpage.scss +++ /dev/null @@ -1,8 +0,0 @@ -body{ - align-items: center; -} -#ibo-page-container{ - flex-grow: 0; - height: auto; - border: 3px solid #CBD2D9; -} \ No newline at end of file diff --git a/datamodels/2.x/itop-config/config.php b/datamodels/2.x/itop-config/config.php index 7d88685c7..47d91dd44 100644 --- a/datamodels/2.x/itop-config/config.php +++ b/datamodels/2.x/itop-config/config.php @@ -174,7 +174,7 @@ try { $oForm->AddSubBlock(InputUIBlockFactory::MakeForHidden('transaction_id', utils::GetNewTransactionId())); // - Cancel button - $oCancelButton = ButtonUIBlockFactory::MakeForSecondaryAction(Dict::S('config-cancel'), 'cancel_button', null, true, 'cancel_button'); + $oCancelButton = ButtonUIBlockFactory::MakeForCancel(Dict::S('config-cancel'), 'cancel_button', null, true, 'cancel_button'); $oCancelButton->SetOnClickJsCode("return ResetConfig();"); $oForm->AddSubBlock($oCancelButton); diff --git a/lib/composer/autoload_classmap.php b/lib/composer/autoload_classmap.php index 2502ec1ac..dd5f87515 100644 --- a/lib/composer/autoload_classmap.php +++ b/lib/composer/autoload_classmap.php @@ -218,6 +218,9 @@ return array( 'Combodo\\iTop\\Application\\UI\\Base\\Component\\Title\\TitleForObjectDetails' => $baseDir . '/sources/application/UI/Base/Component/Title/TitleForObjectDetails.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\\ToolbarSpacer\\ToolbarSpacer' => $baseDir . '/sources/application/UI/Base/Component/Toolbar/ToolbarSpacer/ToolbarSpacer.php', + 'Combodo\\iTop\\Application\\UI\\Base\\Component\\Toolbar\\ToolbarSpacer\\ToolbarSpacerUIBlockFactory' => $baseDir . '/sources/application/UI/Base/Component/Toolbar/ToolbarSpacer/ToolbarSpacerUIBlockFactory.php', + 'Combodo\\iTop\\Application\\UI\\Base\\Component\\Toolbar\\ToolbarUIBlockFactory' => $baseDir . '/sources/application/UI/Base/Component/Toolbar/ToolbarUIBlockFactory.php', 'Combodo\\iTop\\Application\\UI\\Base\\Layout\\ActivityPanel\\ActivityEntry\\ActivityEntry' => $baseDir . '/sources/application/UI/Base/Layout/ActivityPanel/ActivityEntry/ActivityEntry.php', 'Combodo\\iTop\\Application\\UI\\Base\\Layout\\ActivityPanel\\ActivityEntry\\ActivityEntryFactory' => $baseDir . '/sources/application/UI/Base/Layout/ActivityPanel/ActivityEntry/ActivityEntryFactory.php', 'Combodo\\iTop\\Application\\UI\\Base\\Layout\\ActivityPanel\\ActivityEntry\\CMDBChangeOp\\CMDBChangeOpAttachmentAddedFactory' => $baseDir . '/sources/application/UI/Base/Layout/ActivityPanel/ActivityEntry/CMDBChangeOp/CMDBChangeOpAttachmentAddedFactory.php', diff --git a/lib/composer/autoload_static.php b/lib/composer/autoload_static.php index dd90a7881..eeac1de05 100644 --- a/lib/composer/autoload_static.php +++ b/lib/composer/autoload_static.php @@ -448,6 +448,9 @@ class ComposerStaticInit0018331147de7601e7552f7da8e3bb8b 'Combodo\\iTop\\Application\\UI\\Base\\Component\\Title\\TitleForObjectDetails' => __DIR__ . '/../..' . '/sources/application/UI/Base/Component/Title/TitleForObjectDetails.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\\ToolbarSpacer\\ToolbarSpacer' => __DIR__ . '/../..' . '/sources/application/UI/Base/Component/Toolbar/ToolbarSpacer/ToolbarSpacer.php', + 'Combodo\\iTop\\Application\\UI\\Base\\Component\\Toolbar\\ToolbarSpacer\\ToolbarSpacerUIBlockFactory' => __DIR__ . '/../..' . '/sources/application/UI/Base/Component/Toolbar/ToolbarSpacer/ToolbarSpacerUIBlockFactory.php', + 'Combodo\\iTop\\Application\\UI\\Base\\Component\\Toolbar\\ToolbarUIBlockFactory' => __DIR__ . '/../..' . '/sources/application/UI/Base/Component/Toolbar/ToolbarUIBlockFactory.php', 'Combodo\\iTop\\Application\\UI\\Base\\Layout\\ActivityPanel\\ActivityEntry\\ActivityEntry' => __DIR__ . '/../..' . '/sources/application/UI/Base/Layout/ActivityPanel/ActivityEntry/ActivityEntry.php', 'Combodo\\iTop\\Application\\UI\\Base\\Layout\\ActivityPanel\\ActivityEntry\\ActivityEntryFactory' => __DIR__ . '/../..' . '/sources/application/UI/Base/Layout/ActivityPanel/ActivityEntry/ActivityEntryFactory.php', 'Combodo\\iTop\\Application\\UI\\Base\\Layout\\ActivityPanel\\ActivityEntry\\CMDBChangeOp\\CMDBChangeOpAttachmentAddedFactory' => __DIR__ . '/../..' . '/sources/application/UI/Base/Layout/ActivityPanel/ActivityEntry/CMDBChangeOp/CMDBChangeOpAttachmentAddedFactory.php', diff --git a/pages/preferences.php b/pages/preferences.php index f91c25a6d..8bc70e8c5 100644 --- a/pages/preferences.php +++ b/pages/preferences.php @@ -24,8 +24,8 @@ use Combodo\iTop\Application\UI\Base\Component\Input\InputUIBlockFactory; use Combodo\iTop\Application\UI\Base\Component\Input\Select\SelectOptionUIBlockFactory; use Combodo\iTop\Application\UI\Base\Component\Panel\Panel; use Combodo\iTop\Application\UI\Base\Component\Title\TitleUIBlockFactory; +use Combodo\iTop\Application\UI\Base\Component\Toolbar\ToolbarUIBlockFactory; use Combodo\iTop\Application\UI\Base\Layout\PageContent\PageContentFactory; -use Combodo\iTop\Application\UI\Base\Layout\UIContentBlock; use Combodo\iTop\Application\UI\Preferences\BlockShortcuts\BlockShortcuts; require_once('../approot.inc.php'); @@ -84,18 +84,20 @@ HTML; $sMiscSettingsHtml .= $oAppContext->GetForForm(); $oMiscSettingsHtml = new Html($sMiscSettingsHtml); + $oMiscSettingsButtonToolbar = ToolbarUIBlockFactory::MakeForButton(); // - Cancel button - $oMiscSettingsCancelButton = ButtonUIBlockFactory::MakeForSecondaryAction(Dict::S('UI:Button:Cancel')); + $oMiscSettingsCancelButton = ButtonUIBlockFactory::MakeForCancel(Dict::S('UI:Button:Cancel')); $oMiscSettingsCancelButton->SetOnClickJsCode("window.location.href = '$sURL'"); + $oMiscSettingsButtonToolbar->AddSubBlock($oMiscSettingsCancelButton); // - Submit button $oMiscSettingsSubmitButton = ButtonUIBlockFactory::MakeForPrimaryAction(Dict::S('UI:Button:Apply'), 'operation', 'apply_others', true); + $oMiscSettingsButtonToolbar->AddSubBlock($oMiscSettingsSubmitButton); $oMiscSettingsEndHtmlBlock = new Html(''); $oMiscSettingsBlock->AddSubBlock($oMiscSettingsStartForm); $oMiscSettingsBlock->AddSubBlock($oMiscSettingsHtml); - $oMiscSettingsBlock->AddSubBlock($oMiscSettingsCancelButton); - $oMiscSettingsBlock->AddSubBlock($oMiscSettingsSubmitButton); + $oMiscSettingsBlock->AddSubBlock($oMiscSettingsButtonToolbar); $oMiscSettingsBlock->AddSubBlock($oMiscSettingsEndHtmlBlock); $oContentLayout->AddMainBlock($oMiscSettingsBlock); @@ -150,10 +152,12 @@ JS ])); $oFavoriteOrganizationsForm->AddSubBlock($oAppContext->GetForFormBlock()); - $oFavoriteOrganizationsToolBar = new UIContentBlock(null, ['ibo-datatable--selection-validation-buttons-toolbar']); + // Button toolbar + $oFavoriteOrganizationsToolBar = ToolbarUIBlockFactory::MakeForButton(null, ['ibo-is-fullwidth']); $oFavoriteOrganizationsForm->AddSubBlock($oFavoriteOrganizationsToolBar); + // - Cancel button - $oFavoriteOrganizationsCancelButton = ButtonUIBlockFactory::MakeForSecondaryAction(Dict::S('UI:Button:Cancel')); + $oFavoriteOrganizationsCancelButton = ButtonUIBlockFactory::MakeForCancel(Dict::S('UI:Button:Cancel')); $oFavoriteOrganizationsToolBar->AddSubBlock($oFavoriteOrganizationsCancelButton); $oFavoriteOrganizationsCancelButton->SetOnClickJsCode("window.location.href = '$sURL'"); // - Submit button @@ -197,7 +201,7 @@ JS $oSet = new DBObjectSet($oShortcutsFilter); if ($oSet->Count() > 0) { - $oShortcutsToolBar = new UIContentBlock(null, ['ibo-datatable--selection-validation-buttons-toolbar']); + $oShortcutsToolBar = ToolbarUIBlockFactory::MakeForButton(); $oShortcutsBlock->AddSubBlock($oShortcutsToolBar); // - Rename button $oShortcutsRenameButton = ButtonUIBlockFactory::MakeForSecondaryAction(Dict::S('UI:Button:Rename'), null, null, false, @@ -272,15 +276,20 @@ JS $sNewsroomHtml .= $oAppContext->GetForForm(); + $oNewsroomToolbar = ToolbarUIBlockFactory::MakeForButton(); + // - Reset button $oNewsroomResetCacheButton = ButtonUIBlockFactory::MakeForAlternativeDestructiveAction(Dict::S('UI:Newsroom:ResetCache')); $oNewsroomResetCacheButton->SetOnClickJsCode("$('#ibo-navigation-menu--notifications-menu').newsroom_menu('clearCache')"); + $oNewsroomToolbar->AddSubBlock($oNewsroomResetCacheButton); // - Cancel button - $oNewsroomCancelButton = ButtonUIBlockFactory::MakeForSecondaryAction(Dict::S('UI:Button:Cancel')); + $oNewsroomCancelButton = ButtonUIBlockFactory::MakeForCancel(Dict::S('UI:Button:Cancel')); $oNewsroomCancelButton->SetOnClickJsCode("window.location.href = '$sURL'"); + $oNewsroomToolbar->AddSubBlock($oNewsroomCancelButton); // - Submit button $oNewsroomSubmitButton = ButtonUIBlockFactory::MakeForPrimaryAction(Dict::S('UI:Button:Apply'), 'operation', 'apply_newsroom_preferences', true); + $oNewsroomToolbar->AddSubBlock($oNewsroomSubmitButton); $sNewsroomEndHtml = ''; @@ -288,9 +297,7 @@ JS $oNewsroomHtmlBlock = new Html($sNewsroomHtml); $oNewsroomBlock->AddSubBlock($oNewsroomHtmlBlock); - $oNewsroomBlock->AddSubBlock($oNewsroomResetCacheButton); - $oNewsroomBlock->AddSubBlock($oNewsroomCancelButton); - $oNewsroomBlock->AddSubBlock($oNewsroomSubmitButton); + $oNewsroomBlock->AddSubBlock($oNewsroomToolbar); $oNewsroomBlock->AddSubBlock($oNewsroomEndHtmlBlock); $oContentLayout->AddMainBlock($oNewsroomBlock); } @@ -310,13 +317,16 @@ JS $oRichTextToolbarDefaultStateInput->GetInput()->AddOption(SelectOptionUIBlockFactory::MakeForSelectOption('false', Dict::S('UI:RichText:ToolbarState:Collapsed'), !$sRichTextToolbarDefaultState)); $oRichTextForm->AddSubBlock($oRichTextToolbarDefaultStateInput); + $oRichTextToolbar = ToolbarUIBlockFactory::MakeForButton(); + $oRichTextForm->AddSubBlock($oRichTextToolbar); + // - Cancel button - $oRichTextCancelButton = ButtonUIBlockFactory::MakeForSecondaryAction(Dict::S('UI:Button:Cancel')); + $oRichTextCancelButton = ButtonUIBlockFactory::MakeForCancel(Dict::S('UI:Button:Cancel')); $oRichTextCancelButton->SetOnClickJsCode("window.location.href = '$sURL'"); - $oRichTextForm->AddSubBlock($oRichTextCancelButton); + $oRichTextToolbar->AddSubBlock($oRichTextCancelButton); // - Submit button $oRichTextSubmitButton = ButtonUIBlockFactory::MakeForPrimaryAction(Dict::S('UI:Button:Apply'), null, null, true); - $oRichTextForm->AddSubBlock($oRichTextSubmitButton); + $oRichTextToolbar->AddSubBlock($oRichTextSubmitButton); $oRichTextBlock->AddSubBlock($oRichTextForm); $oContentLayout->AddMainBlock($oRichTextBlock); @@ -346,13 +356,16 @@ JS $oTabsScrollable->GetInput()->AddSubBlock(SelectOptionUIBlockFactory::MakeForSelectOption('false', Dict::S('UI:Tabs:Scrollable:Classic'), false === $sTabsScrollableValue)); $oTabsForm->AddSubBlock($oTabsScrollable); + $oTabsToolbar = ToolbarUIBlockFactory::MakeForButton(); + $oTabsForm->AddSubBlock($oTabsToolbar); + // - Cancel button - $oTabsCancelButton = ButtonUIBlockFactory::MakeForSecondaryAction(Dict::S('UI:Button:Cancel')); + $oTabsCancelButton = ButtonUIBlockFactory::MakeForCancel(Dict::S('UI:Button:Cancel')); $oTabsCancelButton->SetOnClickJsCode("window.location.href = '$sURL'"); - $oTabsForm->AddSubBlock($oTabsCancelButton); + $oTabsToolbar->AddSubBlock($oTabsCancelButton); // - Submit button $oTabsSubmitButton = ButtonUIBlockFactory::MakeForPrimaryAction(Dict::S('UI:Button:Apply'), null, null, true); - $oTabsForm->AddSubBlock($oTabsSubmitButton); + $oTabsToolbar->AddSubBlock($oTabsSubmitButton); $oTabsBlock->AddSubBlock($oTabsForm); $oContentLayout->AddMainBlock($oTabsBlock); @@ -448,13 +461,17 @@ function GetUserLanguageForm(ApplicationContext $oAppContext, string $sURL): For $oUserLanguageForm->AddSubBlock($oUserLanguageBlockSelect); $oUserLanguageForm->AddSubBlock($oAppContext->GetForFormBlock()); + + $oUserLanguageButtonToolbar = ToolbarUIBlockFactory::MakeForButton(); + $oUserLanguageForm->AddSubBlock($oUserLanguageButtonToolbar); + // - Cancel button - $oUserLanguageCancelButton = ButtonUIBlockFactory::MakeForSecondaryAction(Dict::S('UI:Button:Cancel')); + $oUserLanguageCancelButton = ButtonUIBlockFactory::MakeForCancel(Dict::S('UI:Button:Cancel')); $oUserLanguageCancelButton->SetOnClickJsCode("window.location.href = '$sURL'"); - $oUserLanguageForm->AddSubBlock($oUserLanguageCancelButton); + $oUserLanguageButtonToolbar->AddSubBlock($oUserLanguageCancelButton); // - Submit button $oUserLanguageSubmitButton = ButtonUIBlockFactory::MakeForPrimaryAction(Dict::S('UI:Button:Apply'), null, null, true); - $oUserLanguageForm->AddSubBlock($oUserLanguageSubmitButton); + $oUserLanguageButtonToolbar->AddSubBlock($oUserLanguageSubmitButton); return $oUserLanguageForm; } diff --git a/sources/application/TwigBase/Controller/Controller.php b/sources/application/TwigBase/Controller/Controller.php index f48970896..ba7bf9ca2 100644 --- a/sources/application/TwigBase/Controller/Controller.php +++ b/sources/application/TwigBase/Controller/Controller.php @@ -27,13 +27,14 @@ use ErrorPage; use Exception; use IssueLog; use iTopWebPage; -use WebPage; use LoginWebPage; use MetaModel; use ReflectionClass; use SetupPage; use SetupUtils; +use Twig\Error\Error; use utils; +use WebPage; use ZipArchive; abstract class Controller @@ -577,10 +578,8 @@ abstract class Controller { return $this->m_oTwig->render($sName.'.'.$sTemplateFileExtension.'.twig', $aParams); } - catch (Twig_Error $e) - { - // Ignore errors - if (!utils::StartsWith($e->getMessage(), 'Unable to find template')) + catch (Error $e) { + if (strpos($e->getMessage(), 'Unable to find template') === false) { IssueLog::Error($e->getMessage()); } diff --git a/sources/application/TwigBase/Twig/TwigHelper.php b/sources/application/TwigBase/Twig/TwigHelper.php index 1543efdc4..7160b8642 100644 --- a/sources/application/TwigBase/Twig/TwigHelper.php +++ b/sources/application/TwigBase/Twig/TwigHelper.php @@ -10,8 +10,8 @@ use Combodo\iTop\Application\TwigBase\UI\UIBlockExtension; use Exception; use IssueLog; use Twig\Environment; +use Twig\Error\Error; use Twig_Environment; -use Twig_Error; use Twig_Loader_Filesystem; use utils; use WebPage; @@ -114,7 +114,6 @@ class TwigHelper * @param bool $bLogMissingFile * * @return string - * @throws \Twig\Error\LoaderError * @throws \Twig\Error\RuntimeError * @throws \Twig\Error\SyntaxError * @throws \Exception @@ -123,13 +122,13 @@ class TwigHelper { try { return $oTwig->render($sName.'.'.$sTemplateFileExtension.'.twig', $aParams); - } catch (Twig_Error $e) { + } catch (Error $e) { $sPath = ''; if ($e->getSourceContext()) { $sPath = utils::LocalPath($e->getSourceContext()->getPath()).' ('.$e->getLine().') - '; } $sMessage = $sPath.$e->getMessage(); - if (!utils::StartsWith($e->getMessage(), 'Unable to find template')) { + if (strpos($e->getMessage(), 'Unable to find template') === false) { IssueLog::Error($sMessage); // Todo 3.0 Less violent message throw new Exception($sMessage); diff --git a/sources/application/UI/Base/Component/DataTable/DataTableUIBlockFactory.php b/sources/application/UI/Base/Component/DataTable/DataTableUIBlockFactory.php index 004d6125b..0c6f06f65 100644 --- a/sources/application/UI/Base/Component/DataTable/DataTableUIBlockFactory.php +++ b/sources/application/UI/Base/Component/DataTable/DataTableUIBlockFactory.php @@ -16,7 +16,7 @@ use Combodo\iTop\Application\UI\Base\Component\DataTable\StaticTable\FormTableRo use Combodo\iTop\Application\UI\Base\Component\DataTable\StaticTable\StaticTable; use Combodo\iTop\Application\UI\Base\Component\Panel\PanelUIBlockFactory; use Combodo\iTop\Application\UI\Base\Component\Title\TitleUIBlockFactory; -use Combodo\iTop\Application\UI\Base\Component\Toolbar\Toolbar; +use Combodo\iTop\Application\UI\Base\Component\Toolbar\ToolbarUIBlockFactory; use Combodo\iTop\Application\UI\Base\Layout\UIContentBlock; use DBObjectSet; use Dict; @@ -120,7 +120,7 @@ class DataTableUIBlockFactory extends AbstractUIBlockFactory $oContainer->AddMainBlock($oDataTable); } else { $oContainer = new UIContentBlock(); - $oToolbar = new Toolbar(); + $oToolbar = ToolbarUIBlockFactory::MakeStandard(); $oToolbar->AddSubBlock($oBlockMenu); $oContainer->AddSubBlock($oToolbar); $oContainer->AddSubBlock($oDataTable); diff --git a/sources/application/UI/Base/Component/Toolbar/Toolbar.php b/sources/application/UI/Base/Component/Toolbar/Toolbar.php index a031f7cd4..8d408efa0 100644 --- a/sources/application/UI/Base/Component/Toolbar/Toolbar.php +++ b/sources/application/UI/Base/Component/Toolbar/Toolbar.php @@ -19,4 +19,9 @@ class Toolbar extends UIContentBlock // Overloaded constants public const BLOCK_CODE = 'ibo-toolbar'; public const DEFAULT_HTML_TEMPLATE_REL_PATH = 'base/components/toolbar/layout'; + + public function __construct(string $sId = null, array $aContainerClasses = []) + { + parent::__construct($sId, $aContainerClasses); + } } \ No newline at end of file diff --git a/sources/application/UI/Base/Component/Toolbar/ToolbarSpacer/ToolbarSpacer.php b/sources/application/UI/Base/Component/Toolbar/ToolbarSpacer/ToolbarSpacer.php new file mode 100644 index 000000000..2d4520099 --- /dev/null +++ b/sources/application/UI/Base/Component/Toolbar/ToolbarSpacer/ToolbarSpacer.php @@ -0,0 +1,27 @@ +AddSubBlock(InputUIBlockFactory::MakeForHidden("{$this->sFormPrefix}{$this->iInputId}", '', "{$this->sFormPrefix}{$this->iInputId}")); - $oToolbar = new Toolbar(null, ['ibo-datatable--selection-validation-buttons-toolbar']); + $oToolbar = ToolbarUIBlockFactory::MakeStandard(null, ['ibo-datatable--selection-validation-buttons-toolbar']); $this->AddSubBlock($oToolbar); $oRemoveButton = ButtonUIBlockFactory::MakeForSecondaryAction(Dict::S('UI:RemoveLinkedObjectsOf_Class'), null, null, false, "{$this->sLinkedSetId}_btnRemove"); $oRemoveButton->SetOnClickJsCode("oWidget{$this->iInputId}.RemoveSelected();"); diff --git a/sources/application/UI/Links/Indirect/BlockObjectPickerDialog/BlockObjectPickerDialog.php b/sources/application/UI/Links/Indirect/BlockObjectPickerDialog/BlockObjectPickerDialog.php index 249dcdd6d..1194ce7c3 100644 --- a/sources/application/UI/Links/Indirect/BlockObjectPickerDialog/BlockObjectPickerDialog.php +++ b/sources/application/UI/Links/Indirect/BlockObjectPickerDialog/BlockObjectPickerDialog.php @@ -10,7 +10,7 @@ namespace Combodo\iTop\Application\UI\Links\Indirect\BlockObjectPickerDialog; use Combodo\iTop\Application\UI\Base\Component\Button\ButtonUIBlockFactory; use Combodo\iTop\Application\UI\Base\Component\Form\Form; use Combodo\iTop\Application\UI\Base\Component\Input\InputUIBlockFactory; -use Combodo\iTop\Application\UI\Base\Component\Toolbar\Toolbar; +use Combodo\iTop\Application\UI\Base\Component\Toolbar\ToolbarUIBlockFactory; use Combodo\iTop\Application\UI\Base\Layout\UIContentBlock; use Dict; @@ -44,9 +44,9 @@ class BlockObjectPickerDialog extends UIContentBlock $oForm->AddSubBlock(InputUIBlockFactory::MakeForHidden("count_{$this->sLinkedSetId}", '0', "count_{$this->sLinkedSetId}")); - $oToolbar = new Toolbar(null, ['ibo-datatable--selection-validation-buttons-toolbar']); + $oToolbar = ToolbarUIBlockFactory::MakeStandard(null, ['ibo-datatable--selection-validation-buttons-toolbar']); $this->AddSubBlock($oToolbar); - $oRemoveButton = ButtonUIBlockFactory::MakeForSecondaryAction($sCancel, null, null, false); + $oRemoveButton = ButtonUIBlockFactory::MakeForCancel($sCancel, null, null, false); $oRemoveButton->SetOnClickJsCode("$('#dlg_{$this->sLinkedSetId}').dialog('close');"); $oToolbar->AddSubBlock($oRemoveButton); diff --git a/sources/application/WebPage/ErrorPage.php b/sources/application/WebPage/ErrorPage.php index e7032f754..a68636f11 100644 --- a/sources/application/WebPage/ErrorPage.php +++ b/sources/application/WebPage/ErrorPage.php @@ -1,4 +1,9 @@ add_linked_script("../js/jquery.blockUI.js"); $this->add_linked_script("../setup/setup.js"); + $this->add_linked_stylesheet(utils::GetAbsoluteUrlAppRoot().'css/font-awesome/css/all.min.css'); + $this->add_linked_stylesheet(utils::GetAbsoluteUrlAppRoot().'css/font-combodo/font-combodo.css'); $this->add_saas("css/setup.scss"); - $this->add_saas("css/errorpage.scss"); } public function info($sText) @@ -48,17 +54,18 @@ class ErrorPage extends NiceWebPage public function output() { - $sLogo = utils::GetAbsoluteUrlAppRoot().'/images/itop-logo.png'; - $sTimeStamp = utils::GetCacheBusterTimestamp(); - $sTitle = utils::HtmlEntities($this->s_title); - $this->s_content = << -

  {$sTitle}

- -
- {$this->s_content} -
-HTML; + $sLogo = utils::GetAbsoluteUrlAppRoot(true).'/images/itop-logo.png?t='.utils::GetCacheBusterTimestamp(); + $oSetupPage = UIContentBlockUIBlockFactory::MakeStandard('ibo_setup_container', ['ibo-setup']); + $oHeader = UIContentBlockUIBlockFactory::MakeStandard('header', ['ibo-setup--header']); + $oSetupPage->AddSubBlock($oHeader); + $oTitle = TitleUIBlockFactory::MakeForPageWithIcon($this->s_title, $sLogo, Title::DEFAULT_ICON_COVER_METHOD, false); + $oHeader->AddSubBlock($oTitle); + $oSetup = UIContentBlockUIBlockFactory::MakeStandard('setup', ['ibo-setup--body']); + $oSetupPage->AddSubBlock($oSetup); + $oSetup->AddSubBlock($this->oContentLayout); + + $this->oContentLayout = $oSetupPage; + return parent::output(); } diff --git a/templates/base/components/toolbar/layout.html.twig b/templates/base/components/toolbar/layout.html.twig index ede9f2b49..f1ea18f2c 100644 --- a/templates/base/components/toolbar/layout.html.twig +++ b/templates/base/components/toolbar/layout.html.twig @@ -1 +1,13 @@ -{% extends 'base/layouts/content-block/layout.html.twig' %} \ No newline at end of file +{# @copyright Copyright (C) 2010-2020 Combodo SARL #} +{# @license http://opensource.org/licenses/AGPL-3.0 #} +{# Toolbar #} +{% apply spaceless %} +
+ + {% for oSubBlock in oUIBlock.GetSubBlocks() %} + {{ render_block(oSubBlock, {aPage: aPage}) }} + {% endfor %} +
+{% endapply %} \ No newline at end of file diff --git a/templates/base/components/toolbar/toolbar-spacer/layout.html.twig b/templates/base/components/toolbar/toolbar-spacer/layout.html.twig new file mode 100644 index 000000000..4b58e44ca --- /dev/null +++ b/templates/base/components/toolbar/toolbar-spacer/layout.html.twig @@ -0,0 +1,7 @@ +{# @copyright Copyright (C) 2010-2021 Combodo SARL #} +{# @license http://opensource.org/licenses/AGPL-3.0 #} +{% apply spaceless %} +
+
+{% endapply %} \ No newline at end of file