From ec0c98bb0faefa22bc6500ee1cb4f1b50e82cf27 Mon Sep 17 00:00:00 2001 From: acognet Date: Thu, 13 Jan 2022 10:52:18 +0100 Subject: [PATCH] =?UTF-8?q?N=C2=B04482=20-=20Polishing=20:=20Export=20page?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- core/csvbulkexport.class.inc.php | 3 +-- core/excelbulkexport.class.inc.php | 3 +-- core/pdfbulkexport.class.inc.php | 3 +-- core/spreadsheetbulkexport.class.inc.php | 3 +-- .../input/_input-with-label.scss | 12 +++++++++ pages/csvimport.php | 3 +-- .../Base/Component/Input/InputWithLabel.php | 27 +++++++++++++++++++ .../UI/Base/Component/Input/tInputLabel.php | 25 +++++++++++++++++ .../components/input/inputlabel.html.twig | 2 +- .../components/input/inputwithlabel.html.twig | 4 +-- webservices/export-v2.php | 23 ++++------------ 11 files changed, 77 insertions(+), 31 deletions(-) diff --git a/core/csvbulkexport.class.inc.php b/core/csvbulkexport.class.inc.php index 36eb3cf71..50a92f8f0 100644 --- a/core/csvbulkexport.class.inc.php +++ b/core/csvbulkexport.class.inc.php @@ -220,16 +220,15 @@ class CSVBulkExport extends TabularBulkExport $sFormatInput = ''; $oRadioCustom = InputUIBlockFactory::MakeForInputWithLabel(Dict::Format('Core:BulkExport:DateTimeFormatCustom_Format', $sFormatInput), "csv_date_format_radio", "custom", "csv_date_time_format_custom", "radio"); + $oRadioCustom->SetDescription(Dict::S('UI:CSVImport:CustomDateTimeFormatTooltip')); $oRadioCustom->GetInput()->SetIsChecked($sDateTimeFormat !== (string)AttributeDateTime::GetFormat()); $oRadioCustom->SetBeforeInput(false); $oRadioCustom->GetInput()->AddCSSClass('ibo-input-checkbox'); $oFieldSetDate->AddSubBlock($oRadioCustom); - $sJSTooltip = json_encode('
'.Dict::S('UI:CSVImport:CustomDateTimeFormatTooltip').'
'); $oP->add_ready_script( <<'; $oRadioCustom = InputUIBlockFactory::MakeForInputWithLabel(Dict::Format('Core:BulkExport:DateTimeFormatCustom_Format', $sFormatInput), "excel_date_format_radio", "custom", "excel_date_time_format_custom", "radio"); + $oRadioCustom->SetDescription(Dict::S('UI:CSVImport:CustomDateTimeFormatTooltip')); $oRadioCustom->GetInput()->SetIsChecked($sDateTimeFormat !== (string)AttributeDateTime::GetFormat()); $oRadioCustom->SetBeforeInput(false); $oRadioCustom->GetInput()->AddCSSClass('ibo-input-checkbox'); $oFieldSetDate->AddSubBlock($oRadioCustom); - $sJSTooltip = json_encode('
'.Dict::S('UI:CSVImport:CustomDateTimeFormatTooltip').'
'); $oP->add_ready_script( <<'; $oRadioCustom = InputUIBlockFactory::MakeForInputWithLabel(Dict::Format('Core:BulkExport:DateTimeFormatCustom_Format', $sFormatInput), "pdf_date_format_radio", "custom", "pdf_date_time_format_custom", "radio"); + $oRadioCustom->SetDescription(Dict::S('UI:CSVImport:CustomDateTimeFormatTooltip')); $oRadioCustom->GetInput()->SetIsChecked($sDateTimeFormat !== (string)AttributeDateTime::GetFormat()); $oRadioCustom->SetBeforeInput(false); $oRadioCustom->GetInput()->AddCSSClass('ibo-input-checkbox'); $oFieldSetDate->AddSubBlock($oRadioCustom); - $sJSTooltip = json_encode('
'.Dict::S('UI:CSVImport:CustomDateTimeFormatTooltip').'
'); $oP->add_ready_script( <<'; $oRadioCustom = InputUIBlockFactory::MakeForInputWithLabel(Dict::Format('Core:BulkExport:DateTimeFormatCustom_Format', $sFormatInput), "spreadsheet_date_format_radio", "custom", "spreadsheet_date_time_format_custom", "radio"); + $oRadioCustom->SetDescription(Dict::S('UI:CSVImport:CustomDateTimeFormatTooltip')); $oRadioCustom->GetInput()->SetIsChecked($sDateTimeFormat !== (string)AttributeDateTime::GetFormat()); $oRadioCustom->GetInput()->AddCSSClass('ibo-input-checkbox'); $oRadioCustom->SetBeforeInput(false); $oFieldSetDate->AddSubBlock($oRadioCustom); - $sJSTooltip = json_encode('
'.Dict::S('UI:CSVImport:CustomDateTimeFormatTooltip').'
'); $oP->add_ready_script( << select, input + label, label + input, label > input { margin-left: $ibo-input--spacing-left--with-label; +} + +label.ibo-has-description { + &::after { + content: $ibo-field--label--description--content; + padding-left: $ibo-field--label--description--padding-left; + vertical-align: top; + + cursor: pointer; + color: $ibo-field--label--description--color; + @extend %ibo-font-ral-bol-50; + } } \ No newline at end of file diff --git a/pages/csvimport.php b/pages/csvimport.php index 70c2ba262..886c16352 100644 --- a/pages/csvimport.php +++ b/pages/csvimport.php @@ -1328,6 +1328,7 @@ EOF $sFormatInput = ''; $oRadioCustom = InputUIBlockFactory::MakeForInputWithLabel(Dict::Format('UI:CSVImport:CustomDateTimeFormat', $sFormatInput), "date_time_format", "custom", "radio_date_time_custom", "radio"); + $oRadioCustom->SetDescription(Dict::S('UI:CSVImport:CustomDateTimeFormatTooltip')); $oRadioCustom->GetInput()->SetIsChecked($sDateTimeFormat !== (string)AttributeDateTime::GetFormat()); $oRadioCustom->SetBeforeInput(false); $oRadioCustom->GetInput()->AddCSSClass('ibo-input-checkbox'); @@ -1424,11 +1425,9 @@ EOF } EOF ); - $sJSTooltip = json_encode('
'.Dict::S('UI:CSVImport:CustomDateTimeFormatTooltip').'
'); $oPage->add_ready_script( <<sLabel = $sLabel; return $this; } + + /** + * @return mixed + */ + public function GetDescription() + { + return $this->sDescription; + } + + /** + * @param mixed $sDescription + */ + public function SetDescription($sDescription) + { + $this->sDescription = $sDescription; + return $this; + } + /** + * @return bool + */ + public function HasDescription(): bool + { + return $this->sDescription != null; + } + } \ No newline at end of file diff --git a/sources/application/UI/Base/Component/Input/tInputLabel.php b/sources/application/UI/Base/Component/Input/tInputLabel.php index 7e92bcdff..afb08a13e 100644 --- a/sources/application/UI/Base/Component/Input/tInputLabel.php +++ b/sources/application/UI/Base/Component/Input/tInputLabel.php @@ -18,6 +18,8 @@ trait tInputLabel protected $bIsLabelBefore = true; /** @var string|null Label to display with the input (null for no label) */ protected $sLabel = null; + /**@String $sDescription for tooltip*/ + protected $sDescription; /** * @return bool @@ -85,4 +87,27 @@ trait tInputLabel { return $this->sLabel != null; } + /** + * @return mixed + */ + public function GetDescription() + { + return $this->sDescription; + } + + /** + * @param mixed $sDescription + */ + public function SetDescription($sDescription) + { + $this->sDescription = $sDescription; + return $this; + } + /** + * @return bool + */ + public function HasDescription(): bool + { + return $this->sDescription != null; + } } \ No newline at end of file diff --git a/templates/base/components/input/inputlabel.html.twig b/templates/base/components/input/inputlabel.html.twig index 6045bc7f2..b9d557ed2 100644 --- a/templates/base/components/input/inputlabel.html.twig +++ b/templates/base/components/input/inputlabel.html.twig @@ -1,3 +1,3 @@ {# @copyright Copyright (C) 2010-2021 Combodo SARL #} {# @license http://opensource.org/licenses/AGPL-3.0 #} - \ No newline at end of file + \ No newline at end of file diff --git a/templates/base/components/input/inputwithlabel.html.twig b/templates/base/components/input/inputwithlabel.html.twig index de770a7ef..147ab1cba 100644 --- a/templates/base/components/input/inputwithlabel.html.twig +++ b/templates/base/components/input/inputwithlabel.html.twig @@ -1,10 +1,10 @@ {% block iboInputLabel %} {% if oUIBlock.IsLabelBefore() %} - + {{ render_block(oUIBlock.GetInput()) }} {% else %} {{ render_block(oUIBlock.GetInput()) }} - + {% endif %} {% endblock %} diff --git a/webservices/export-v2.php b/webservices/export-v2.php index 1ba005da2..4e50a44b2 100644 --- a/webservices/export-v2.php +++ b/webservices/export-v2.php @@ -13,6 +13,7 @@ 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\Input\SelectUIBlockFactory; use Combodo\iTop\Application\UI\Base\Component\Input\TextArea; +use Combodo\iTop\Application\UI\Base\Component\Panel\PanelUIBlockFactory; use Combodo\iTop\Application\UI\Base\Component\Title\TitleUIBlockFactory; use Combodo\iTop\Application\UI\Base\Layout\UIContentBlockUIBlockFactory; @@ -122,10 +123,11 @@ function Usage(Page $oP) function DisplayExpressionForm(WebPage $oP, $sAction, $sExpression = '', $sExceptionMessage = '') { - $oP->AddSubBlock(TitleUIBlockFactory::MakeForPage(Dict::S('Core:BulkExport:ScopeDefinition'))); + $oPanel = PanelUIBlockFactory::MakeNeutral(Dict::S('Core:BulkExport:ScopeDefinition')); + $oP->AddSubBlock($oPanel); $oForm = FormUIBlockFactory::MakeStandard('form'); $oForm->SetAction($sAction); - $oP->AddSubBlock($oForm); + $oPanel->AddSubBlock($oForm); $oForm->AddSubBlock(InputUIBlockFactory::MakeForHidden('interactive', '1')); @@ -149,26 +151,11 @@ function DisplayExpressionForm(WebPage $oP, $sAction, $sExpression = '', $sExcep $oSearch->UpdateContextFromUser(); $oQueries = new DBObjectSet($oSearch); while ($oQuery = $oQueries->Fetch()) { - $oSelect->AddSubBlock(SelectOptionUIBlockFactory::MakeForSelectOption($oQuery->GetKey(), htmlentities($oQuery->Get('name'), ENT_QUOTES, 'UTF-8'), false)); + $oSelect->AddSubBlock(SelectOptionUIBlockFactory::MakeForSelectOption($oQuery->GetKey(), $oQuery->Get('name'), false)); } $oFieldPhraseBook->AddSubBlock($oSelect); $oForm->AddSubBlock($oFieldPhraseBook); - /*oP->add(''); - $sExpressionHint = empty($sExceptionMessage) ? '' : ''; - $oP->add(''); - $oP->add(''); - $oP->add($sExpressionHint); - $oP->add(''); - $oP->add('');*/ $oForm->AddSubBlock(ButtonUIBlockFactory::MakeForPrimaryAction(Dict::S('UI:Button:Next'), "", "", true, "next-btn")); $oP->p(''.Dict::S('Core:BulkExportCanRunNonInteractive').''); $oP->p(''.Dict::S('Core:BulkExportLegacyExport').'');
'.htmlentities($sExceptionMessage, ENT_QUOTES, 'UTF-8').'