Add UIBlocks to twig (generic parser and node)

# Conflicts:
#	pages/run_query.php
#	test/VisualTest/Backoffice/RenderAllUiBlocks.php
This commit is contained in:
Eric
2021-01-18 12:09:07 +01:00
parent 2aae6cd744
commit 21740123f4
59 changed files with 712 additions and 1182 deletions

View File

@@ -24,7 +24,7 @@
* @license http://opensource.org/licenses/AGPL-3.0
*/
use Combodo\iTop\Application\UI\Base\Component\Input\InputFactory;
use Combodo\iTop\Application\UI\Base\Component\Input\InputUIBlockFactory;
use Combodo\iTop\Application\UI\Base\Layout\UIContentBlock;
use Combodo\iTop\Application\UI\Base\UIBlock;
@@ -236,7 +236,7 @@ class ApplicationContext
{
$oContext = new UIContentBlock();
foreach ($this->aValues as $sName => $sValue) {
$oContext->AddSubBlock(InputFactory::MakeForHidden('c[$sName]', utils::HtmlEntities($sValue)));
$oContext->AddSubBlock(InputUIBlockFactory::MakeForHidden('c[$sName]', utils::HtmlEntities($sValue)));
}
return $oContext;
}

View File

@@ -18,18 +18,18 @@
*/
use Combodo\iTop\Application\Search\SearchForm;
use Combodo\iTop\Application\UI\Base\Component\Alert\AlertFactory;
use Combodo\iTop\Application\UI\Base\Component\Alert\AlertUIBlockFactory;
use Combodo\iTop\Application\UI\Base\Component\Button\Button;
use Combodo\iTop\Application\UI\Base\Component\Button\ButtonFactory;
use Combodo\iTop\Application\UI\Base\Component\DataTable\DataTableFactory;
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\DataTable\DataTableUIBlockFactory;
use Combodo\iTop\Application\UI\Base\Component\Field\Field;
use Combodo\iTop\Application\UI\Base\Component\Field\FieldFactory;
use Combodo\iTop\Application\UI\Base\Component\Field\FieldUIBlockFactory;
use Combodo\iTop\Application\UI\Base\Component\FieldSet\FieldSet;
use Combodo\iTop\Application\UI\Base\Component\Form\Form;
use Combodo\iTop\Application\UI\Base\Component\Input\InputFactory;
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\TitleFactory;
use Combodo\iTop\Application\UI\Base\Component\Title\TitleUIBlockFactory;
use Combodo\iTop\Application\UI\Base\Component\Toolbar\Toolbar;
use Combodo\iTop\Application\UI\Base\Layout\MultiColumn\Column\Column;
use Combodo\iTop\Application\UI\Base\Layout\MultiColumn\MultiColumn;
@@ -268,7 +268,7 @@ EOF
$sName .= ' ('.$aLockInfo['owner']->Get('contactid_friendlyname').')';
}
$aResult['message'] = Dict::Format('UI:CurrentObjectIsLockedBy_User', $sName);
$aMessages[] = AlertFactory::MakeForDanger('', Dict::Format('UI:CurrentObjectIsLockedBy_User', $sName));
$aMessages[] = AlertUIBlockFactory::MakeForDanger('', Dict::Format('UI:CurrentObjectIsLockedBy_User', $sName));
}
}
$sMessageKey = get_class($this).'::'.$this->GetKey();
@@ -281,16 +281,16 @@ EOF
$aRanks[] = $aMessageData['rank'];
switch ($aMessageData['severity']) {
case 'info':
$aMessages[] = AlertFactory::MakeForInformation('', $aMessageData['message']);
$aMessages[] = AlertUIBlockFactory::MakeForInformation('', $aMessageData['message']);
break;
case 'ok':
$aMessages[] = AlertFactory::MakeForSuccess('', $aMessageData['message']);
$aMessages[] = AlertUIBlockFactory::MakeForSuccess('', $aMessageData['message']);
break;
case 'warning':
$aMessages[] = AlertFactory::MakeForWarning('', $aMessageData['message']);
$aMessages[] = AlertUIBlockFactory::MakeForWarning('', $aMessageData['message']);
break;
case 'error':
$aMessages[] = AlertFactory::MakeForDanger('', $aMessageData['message']);
$aMessages[] = AlertUIBlockFactory::MakeForDanger('', $aMessageData['message']);
break;
}
}
@@ -424,7 +424,7 @@ EOF
// $sTags = '';
// }
$oPage->AddUiBlock(TitleFactory::MakeForObjectDetails($this));
$oPage->AddUiBlock(TitleUIBlockFactory::MakeForObjectDetails($this));
}
/**
@@ -973,7 +973,7 @@ EOF
$val['value_raw'] = ($bExcludeRawValue === false) ? $this->Get($sAttCode) : '';
// The field is visible, add it to the current column
$oField = FieldFactory::MakeFromParams($val);
$oField = FieldUIBlockFactory::MakeFromParams($val);
if ($sFieldsetName[0] != '_') {
$oFieldSet->AddSubBlock($oField);
} else {
@@ -1140,7 +1140,7 @@ HTML
$iListId = $aExtraParams['currentId'];
}
return DataTableFactory::MakeForResult($oPage, $iListId, $oSet, $aExtraParams);
return DataTableUIBlockFactory::MakeForResult($oPage, $iListId, $oSet, $aExtraParams);
}
/**
* @param \WebPage $oPage
@@ -1886,7 +1886,7 @@ HTML
// predefined queries N°3227
$sPredefinedBtnId = 'predef_btn_'.$sFieldPrefix.$sAttCode.$sNameSuffix;
$sSearchQueryLbl = Dict::S('UI:Edit:SearchQuery');
$oPredefQueryButton = ButtonFactory::MakeIconLink(
$oPredefQueryButton = ButtonUIBlockFactory::MakeIconLink(
'fas fa-search',
$sSearchQueryLbl,
null,
@@ -1926,7 +1926,7 @@ JS
$sTestResId = 'query_res_'.$sFieldPrefix.$sAttCode.$sNameSuffix; //$oPage->GetUniqueId();
$sBaseUrl = utils::GetAbsoluteUrlAppRoot().'pages/run_query.php?expression=';
$sTestQueryLbl = Dict::S('UI:Edit:TestQuery');
$oTestQueryButton = ButtonFactory::MakeIconLink(
$oTestQueryButton = ButtonUIBlockFactory::MakeIconLink(
'fas fa-play',
$sTestQueryLbl,
null,
@@ -2489,7 +2489,7 @@ JS
$oPage->set_title(Dict::Format('UI:ModificationPageTitle_Object_Class', $this->GetRawName(),
$sClassLabel)); // Set title will take care of the encoding
//$oContentBlock->AddSubBlock(TitleFactory::MakeForObjectDetails($this));
//$oContentBlock->AddSubBlock(TitleUIBlockFactory::MakeForObjectDetails($this));
// $oPage->add(<<<HTML
//<!-- Beginning of object-details -->
@@ -2551,15 +2551,15 @@ JS
if ($sMode === static::ENUM_OBJECT_MODE_EDIT) {
// The object already exists in the database, it's a modification
$oForm->AddSubBlock(InputFactory::MakeForHidden('id', $iKey, "{$sPrefix}_id"));
$oForm->AddSubBlock(InputUIBlockFactory::MakeForHidden('id', $iKey, "{$sPrefix}_id"));
}
$oForm->AddSubBlock(InputFactory::MakeForHidden('operation', $sOperation));
$oForm->AddSubBlock(InputFactory::MakeForHidden('class', $sClass));
$oForm->AddSubBlock(InputUIBlockFactory::MakeForHidden('operation', $sOperation));
$oForm->AddSubBlock(InputUIBlockFactory::MakeForHidden('class', $sClass));
// Add transaction ID
$iTransactionId = isset($aExtraParams['transaction_id']) ? $aExtraParams['transaction_id'] : utils::GetNewTransactionId();
$oPage->SetTransactionId($iTransactionId);
$oForm->AddSubBlock(InputFactory::MakeForHidden('transaction_id', $iTransactionId));
$oForm->AddSubBlock(InputUIBlockFactory::MakeForHidden('transaction_id', $iTransactionId));
// TODO 3.0.0: Is this (the if condition, not the code inside) still necessary?
if (isset($aExtraParams['wizard_container']) && $aExtraParams['wizard_container']) {
@@ -2570,7 +2570,7 @@ JS
$oPage->set_title(Dict::Format('UI:ModificationPageTitle_Object_Class', $this->GetRawName(),
$sClassLabel)); // Set title will take care of the encoding
$oForm->AddSubBlock(TitleFactory::MakeForObjectDetails($this));
$oForm->AddSubBlock(TitleUIBlockFactory::MakeForObjectDetails($this));
// TODO 3.0.0: Refactor DisplayBareHeader and call it here
}
@@ -2589,10 +2589,10 @@ CSS
$oToolbarTop = new Toolbar();
$oToolbarTop->SetCSSClasses('ibo-toolbar ibo-toolbar-top');
$oCancelButton = ButtonFactory::MakeForSecondaryAction(Dict::S('UI:Button:Cancel'));
$oCancelButton = ButtonUIBlockFactory::MakeForSecondaryAction(Dict::S('UI:Button:Cancel'));
$oCancelButton->AddCSSClasses('action cancel');
$oToolbarTop->AddSubBlock($oCancelButton);
$oApplyButton = ButtonFactory::MakeForPrimaryAction($sApplyButton, null, null, true);
$oApplyButton = ButtonUIBlockFactory::MakeForPrimaryAction($sApplyButton, null, null, true);
$oApplyButton->AddCSSClasses('action');
$oToolbarTop->AddSubBlock($oApplyButton);
@@ -2606,7 +2606,7 @@ CSS
$sStimulusCode, $oSetToCheckRights) : UR_ALLOWED_NO;
switch ($iActionAllowed) {
case UR_ALLOWED_YES:
$oButton = ButtonFactory::MakeForPrimaryAction($aStimuli[$sStimulusCode]->GetLabel(), 'next_action', $sStimulusCode, true);
$oButton = ButtonUIBlockFactory::MakeForPrimaryAction($aStimuli[$sStimulusCode]->GetLabel(), 'next_action', $sStimulusCode, true);
$oButton->AddCSSClasses('action');
$oButton->SetColor(Button::ENUM_COLOR_NEUTRAL);
$oToolbarTop->AddSubBlock($oButton);
@@ -2699,15 +2699,15 @@ EOF
}
$oPage->SetCurrentTab('');
$oForm->AddSubBlock(InputFactory::MakeForHidden('class', $sClass));
$oForm->AddSubBlock(InputFactory::MakeForHidden('transaction_id', $iTransactionId));
$oForm->AddSubBlock(InputUIBlockFactory::MakeForHidden('class', $sClass));
$oForm->AddSubBlock(InputUIBlockFactory::MakeForHidden('transaction_id', $iTransactionId));
foreach ($aExtraParams as $sName => $value) {
if (is_scalar($value)) {
$oForm->AddSubBlock(InputFactory::MakeForHidden($sName, $value));
$oForm->AddSubBlock(InputUIBlockFactory::MakeForHidden($sName, $value));
}
}
if ($sOwnershipToken !== null) {
$oForm->AddSubBlock(InputFactory::MakeForHidden('ownership_token', utils::HtmlEntities($sOwnershipToken)));
$oForm->AddSubBlock(InputUIBlockFactory::MakeForHidden('ownership_token', utils::HtmlEntities($sOwnershipToken)));
}
$oPage->add($oAppContext->GetForForm());
if ($sButtonsPosition != 'top') {
@@ -3035,15 +3035,14 @@ HTML
);
// Page title and subtitles
$oPage->AddUiBlock(TitleFactory::MakeForPage($sActionLabel.' - '.$this->GetName()));
if(!empty($sActionDetails)) {
$oPage->AddUiBlock(TitleFactory::MakeForPage($sActionDetails));
$oPage->AddUiBlock(TitleUIBlockFactory::MakeForPage($sActionLabel.' - '.$this->GetName()));
if (!empty($sActionDetails)) {
$oPage->AddUiBlock(TitleUIBlockFactory::MakeForPage($sActionDetails));
}
$sButtonsPosition = MetaModel::GetConfig()->Get('buttons_position');
// Display object detail above if buttons must be displayed on the bottom
if ($sButtonsPosition == 'bottom' && $bDisplayBareProperties)
{
if ($sButtonsPosition == 'bottom' && $bDisplayBareProperties) {
// bottom: Displays the ticket details BEFORE the actions
$this->DisplayDetails($oPage, false, $sMode);
}
@@ -3054,15 +3053,14 @@ HTML
$oFormContainer->AddSubBlock($oForm);
$oForm->SetOnSubmitJsCode("return OnSubmit('apply_stimulus');")
->AddSubBlock(InputFactory::MakeForHidden('id', $this->GetKey(), 'id'))
->AddSubBlock(InputFactory::MakeForHidden('class', $sClass))
->AddSubBlock(InputFactory::MakeForHidden('operation', 'apply_stimulus'))
->AddSubBlock(InputFactory::MakeForHidden('stimulus', $sStimulus))
->AddSubBlock(InputFactory::MakeForHidden('transaction_id', $iTransactionId));
->AddSubBlock(InputUIBlockFactory::MakeForHidden('id', $this->GetKey(), 'id'))
->AddSubBlock(InputUIBlockFactory::MakeForHidden('class', $sClass))
->AddSubBlock(InputUIBlockFactory::MakeForHidden('operation', 'apply_stimulus'))
->AddSubBlock(InputUIBlockFactory::MakeForHidden('stimulus', $sStimulus))
->AddSubBlock(InputUIBlockFactory::MakeForHidden('transaction_id', $iTransactionId));
if ($sOwnershipToken !== null)
{
$oForm->AddSubBlock(InputFactory::MakeForHidden('ownership_token', utils::HtmlEntities($sOwnershipToken)));
if ($sOwnershipToken !== null) {
$oForm->AddSubBlock(InputUIBlockFactory::MakeForHidden('ownership_token', utils::HtmlEntities($sOwnershipToken)));
}
// Note: Remove the table is we want fields to occupy the whole width of the container
@@ -3073,11 +3071,11 @@ HTML
$oAppContext = new ApplicationContext();
$oForm->AddHtml($oAppContext->GetForForm());
$oCancelButton = ButtonFactory::MakeForSecondaryAction(Dict::S('UI:Button:Cancel'), 'cancel', 'cancel');
$oCancelButton = ButtonUIBlockFactory::MakeForSecondaryAction(Dict::S('UI:Button:Cancel'), 'cancel', 'cancel');
$oCancelButton->SetOnClickJsCode("BackToDetails('{$sClass}', '{$this->GetKey()}', '', '{$sOwnershipToken}');");
$oForm->AddSubBlock($oCancelButton);
$oSubmitButton = ButtonFactory::MakeForPrimaryAction($sActionLabel, 'submit', 'submit', true);
$oSubmitButton = ButtonUIBlockFactory::MakeForPrimaryAction($sActionLabel, 'submit', 'submit', true);
$oForm->AddSubBlock($oSubmitButton);
$oPage->add(<<<HTML

View File

@@ -17,7 +17,7 @@
* You should have received a copy of the GNU Affero General Public License
*/
use Combodo\iTop\Application\UI\Base\Component\Button\ButtonFactory;
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;
@@ -1089,7 +1089,7 @@ JS
$sPopoverMenuId = "ibo-dashboard-menu-popover-{$sId}";
$sName = 'UI:Dashboard:Actions';
$oToolbar = $oPage->GetTopBarLayout()->GetToolbar();
$oActionButton = ButtonFactory::MakeLinkNeutral('', '', 'fas fa-ellipsis-v', $sName, '', $sMenuTogglerId);
$oActionButton = ButtonUIBlockFactory::MakeLinkNeutral('', '', 'fas fa-ellipsis-v', $sName, '', $sMenuTogglerId);
$oActionButton->AddCSSClasses("ibo-top-bar--toolbar-dashboard-menu-toggler");
$oToolbar->AddSubBlock($oActionButton);

View File

@@ -18,11 +18,11 @@
*/
use Combodo\iTop\Application\Search\SearchForm;
use Combodo\iTop\Application\UI\Base\Component\Alert\AlertFactory;
use Combodo\iTop\Application\UI\Base\Component\Alert\AlertUIBlockFactory;
use Combodo\iTop\Application\UI\Base\Component\Badge\BadgeFactory;
use Combodo\iTop\Application\UI\Base\Component\Button\ButtonFactory;
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\DataTableFactory;
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\iUIBlock;
@@ -133,51 +133,84 @@ class DisplayBlock
'group_by', /** string group by att code */
'group_by_expr', /** string group by expression */
'group_by_label', /** string aggregation column name */
'aggregation_function', /** string aggregation function ('count', 'sum', 'avg', 'min', 'max', ...) */
'aggregation_attribute', /** string att code used for aggregation */
'limit', /** int limit the chart results */
'order_by', /** string either 'attribute' group_by attcode or 'function' aggregation_function value */
'order_direction', /** string order direction 'asc' or 'desc' */
'aggregation_function',
/** string aggregation function ('count', 'sum', 'avg', 'min', 'max', ...) */
'aggregation_attribute',
/** string att code used for aggregation */
'limit',
/** int limit the chart results */
'order_by',
/** string either 'attribute' group_by attcode or 'function' aggregation_function value */
'order_direction',
/** string order direction 'asc' or 'desc' */
],
'csv' => [],
'join' => array_merge([
'display_aliases', /** string comma separated list of class aliases to display */
'group_by', /** string group by att code */
], DataTableFactory::GetAllowedParams()),
'links' => DataTableFactory::GetAllowedParams(),
'display_aliases',
/** string comma separated list of class aliases to display */
'group_by',
/** string group by att code */
], DataTableUIBlockFactory::GetAllowedParams()),
'links' => DataTableUIBlockFactory::GetAllowedParams(),
'list' => array_merge([
'update_history', /** bool add breadcrumb entry */
'default', /** array of default attribute values */
'menu_actions_target', /** string html link target */
'toolkit_menu', /** bool add toolkit menu */
], DataTableFactory::GetAllowedParams()),
'update_history',
/** bool add breadcrumb entry */
'default',
/** array of default attribute values */
'menu_actions_target',
/** string html link target */
'toolkit_menu',
/** bool add toolkit menu */
], DataTableUIBlockFactory::GetAllowedParams()),
'list_search' => array_merge([
'update_history', /** bool add breadcrumb entry */
'result_list_outer_selector', /** string js selector of the search result display */
'table_inner_id', /** string html id of the results table */
'json', /** string */
'hidden_criteria', /** string search criteria not visible */
'baseClass', /** string base class */
'action', /** string */
'open', /** bool open by default the search */
], DataTableFactory::GetAllowedParams()),
'update_history',
/** bool add breadcrumb entry */
'result_list_outer_selector',
/** string js selector of the search result display */
'table_inner_id',
/** string html id of the results table */
'json',
/** string */
'hidden_criteria',
/** string search criteria not visible */
'baseClass',
/** string base class */
'action',
/** string */
'open',
/** bool open by default the search */
], DataTableUIBlockFactory::GetAllowedParams()),
'search' => array_merge([
'baseClass', /** string search root class */
'open', /** bool open the search panel by default */
'result_list_outer_selector', /** string js selector of the search result display */
'search_header_force_dropdown', /** string Search class selection dropdown html code */
'action', /** string search URL */
'table_inner_id', /** string html id of the results table */
'json', /** string */
'hidden_criteria', /** string search criteria not visible */
'class', /** string class searched */
], DataTableFactory::GetAllowedParams()),
'baseClass',
/** string search root class */
'open',
/** bool open the search panel by default */
'result_list_outer_selector',
/** string js selector of the search result display */
'search_header_force_dropdown',
/** string Search class selection dropdown html code */
'action',
/** string search URL */
'table_inner_id',
/** string html id of the results table */
'json',
/** string */
'hidden_criteria',
/** string search criteria not visible */
'class',
/** string class searched */
], DataTableUIBlockFactory::GetAllowedParams()),
'summary' => [
'status[block]', /** string object 'status' att code */
'status_codes[block]', /** string comma separated list of object states */
'title[block]', /** string title */
'label[block]', /** string label */
'context_filter', /** int if != 0 filter with user context */
'status[block]',
/** string object 'status' att code */
'status_codes[block]',
/** string comma separated list of object states */
'title[block]',
/** string title */
'label[block]',
/** string label */
'context_filter',
/** int if != 0 filter with user context */
],
];
@@ -390,7 +423,7 @@ class DisplayBlock
Exception thrown:<br>
<code>{$e->getMessage()}</code>
HTML;
$oExceptionAlert = AlertFactory::MakeForFailure('Cannot display results', $sExceptionContent);
$oExceptionAlert = AlertUIBlockFactory::MakeForFailure('Cannot display results', $sExceptionContent);
$oHtml->AddSubBlock($oExceptionAlert);
}
IssueLog::Error('Exception during GetDisplay: '.$e->getMessage());
@@ -1077,7 +1110,7 @@ JS
);
$sFormat = isset($aExtraParams['format']) ? $aExtraParams['format'] : 'UI:Pagination:HeaderNoSelection';
$sTitle = Dict::Format($sFormat, $iTotalCount);
$oBlock = DataTableFactory::MakeForStaticData($sTitle, $aAttribs, $aData);
$oBlock = DataTableUIBlockFactory::MakeForStaticData($sTitle, $aAttribs, $aData);
} else {
// Simply count the number of elements in the set
@@ -1159,7 +1192,7 @@ JS
} else {
$iListId = $aExtraParams['currentId'];
}
$oBlock->AddSubBlock(DataTableFactory::MakeForObject($oPage, $iListId, $this->m_oSet, $aExtraParams));
$oBlock->AddSubBlock(DataTableUIBlockFactory::MakeForObject($oPage, $iListId, $this->m_oSet, $aExtraParams));
} else {
// Empty set
$oBlock->bEmptySet = true;
@@ -1310,7 +1343,7 @@ JS
} else {
$iListId = $aExtraParams['currentId'];
}
$oBlock = DataTableFactory::MakeForRendering($iListId, $oSet, $aExtraParams);
$oBlock = DataTableUIBlockFactory::MakeForRendering($iListId, $oSet, $aExtraParams);
$oHtml->AddHtml("<tr><td>");
$oContentBlock->AddSubBlock($oBlock);
$oHtml = new Html();
@@ -2048,7 +2081,7 @@ class MenuBlock extends DisplayBlock
} else {
$sName = 'UI:Menu:Actions';
}
$oActionButton = ButtonFactory::MakeLinkNeutral('', '', 'fas fa-ellipsis-v', $sName, '', $sMenuTogglerId);
$oActionButton = ButtonUIBlockFactory::MakeLinkNeutral('', '', 'fas fa-ellipsis-v', $sName, '', $sMenuTogglerId);
// TODO Add Js
$oActionsBlock->AddSubBlock($oActionButton)
->AddSubBlock($oPage->GetPopoverMenu($sPopoverMenuId, $aActions));
@@ -2072,14 +2105,14 @@ JS
}
if ($this->m_sStyle == 'details') {
$oActionButton = ButtonFactory::MakeLinkNeutral("{$sRootUrl}pages/UI.php?operation=search_form&do_search=0&class=$sClass{$sContext}", '', 'fas fa-search', 'UI:SearchFor_Class');
$oActionButton = ButtonUIBlockFactory::MakeLinkNeutral("{$sRootUrl}pages/UI.php?operation=search_form&do_search=0&class=$sClass{$sContext}", '', 'fas fa-search', 'UI:SearchFor_Class');
$oActionButton->SetTooltip(Dict::Format('UI:SearchFor_Class', MetaModel::GetName($sClass)))
->AddCSSClasses('ibo-action-button');
$oActionsBlock->AddSubBlock($oActionButton);
}
if (!$oPage->IsPrintableVersion() && ($sRefreshAction != '')) {
$oActionButton = ButtonFactory::MakeAlternativeNeutral('', 'UI:Button:Refresh');
$oActionButton = ButtonUIBlockFactory::MakeAlternativeNeutral('', 'UI:Button:Refresh');
$oActionButton->SetIconClass('fas fa-sync')
->SetOnClickJsCode($sRefreshAction)
->SetTooltip(Dict::S('UI:Button:Refresh'))
@@ -2122,7 +2155,7 @@ JS
}
$sTarget = isset($aAction['target']) ? $aAction['target'] : '';
$oActionButton = ButtonFactory::MakeLinkNeutral($sUrl, $sLabel, $sIconClass, $sActionId, $sTarget);
$oActionButton = ButtonUIBlockFactory::MakeLinkNeutral($sUrl, $sLabel, $sIconClass, $sActionId, $sTarget);
$oActionButton->AddCSSClasses('ibo-action-button');
$oActionsBlock->AddSubBlock($oActionButton);
}

View File

@@ -17,7 +17,7 @@
* You should have received a copy of the GNU Affero General Public License
*/
use Combodo\iTop\Application\UI\Base\Component\Title\TitleFactory;
use Combodo\iTop\Application\UI\Base\Component\Title\TitleUIBlockFactory;
require_once(APPROOT.'/application/utils.inc.php');
require_once(APPROOT.'/application/template.class.inc.php');
@@ -1131,7 +1131,7 @@ class OQLMenuNode extends MenuNode
//$oPage->add("<p class=\"page-header\">$sIcon ".utils::HtmlEntities(Dict::S($sTitle))."</p>");
$oPage->add("<div class='sf_results_area' data-target='search_results'>");
$oTitle = TitleFactory::MakeForPage($sTitle);
$oTitle = TitleUIBlockFactory::MakeForPage($sTitle);
$oPage->AddUiBlock($oTitle);
$aParams = array_merge(array('table_id' => $sUsageId), $aExtraParams);
@@ -1139,7 +1139,7 @@ class OQLMenuNode extends MenuNode
$oBlock->Display($oPage, $sUsageId);
$oPage->add("</div>");
if ($bEnableBreadcrumb && ($oPage instanceof iTopWebPage)) {
// Breadcrumb
//$iCount = $oBlock->GetDisplayedCount();

View File

@@ -24,7 +24,7 @@
* @license http://opensource.org/licenses/AGPL-3.0
*/
use Combodo\iTop\Application\UI\Base\Component\DataTable\DataTableFactory;
use Combodo\iTop\Application\UI\Base\Component\DataTable\DataTableUIBlockFactory;
use Combodo\iTop\Application\UI\Base\Component\DataTable\StaticTable\FormTableRow\FormTableRow;
use Combodo\iTop\Application\UI\Links\Indirect\BlockIndirectLinksEdit\BlockIndirectLinksEdit;
use Combodo\iTop\Application\UI\Links\Indirect\BlockObjectPickerDialog\BlockObjectPickerDialog;
@@ -351,7 +351,7 @@ JS
*/
protected function GetFormTableBlock($aConfig, $aData)
{
return DataTableFactory::MakeForForm("{$this->m_sAttCode}{$this->m_sNameSuffix}", $aConfig, $aData);
return DataTableUIBlockFactory::MakeForForm("{$this->m_sAttCode}{$this->m_sNameSuffix}", $aConfig, $aData);
}

View File

@@ -24,12 +24,12 @@
* @license http://opensource.org/licenses/AGPL-3.0
*/
use Combodo\iTop\Application\UI\Base\Component\Alert\AlertFactory;
use Combodo\iTop\Application\UI\Base\Component\Button\ButtonFactory;
use Combodo\iTop\Application\UI\Base\Component\Alert\AlertUIBlockFactory;
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\Html\Html;
use Combodo\iTop\Application\UI\Base\Component\Input\InputFactory;
use Combodo\iTop\Application\UI\Base\Component\Title\TitleFactory;
use Combodo\iTop\Application\UI\Base\Component\Input\InputUIBlockFactory;
use Combodo\iTop\Application\UI\Base\Component\Title\TitleUIBlockFactory;
use Combodo\iTop\Config\Validator\iTopConfigAstValidator;
use Combodo\iTop\Config\Validator\iTopConfigSyntaxValidator;
@@ -91,14 +91,14 @@ try {
$sOperation = utils::ReadParam('operation', '');
$iEditorTopMargin = 2;
$oP->AddUiBlock(TitleFactory::MakeForPage(Dict::S('config-edit-title')));
$oP->AddUiBlock(TitleUIBlockFactory::MakeForPage(Dict::S('config-edit-title')));
if (MetaModel::GetConfig()->Get('demo_mode')) {
$oAlert = AlertFactory::MakeForInformation('', "Sorry, iTop is in <b>demonstration mode</b>: the configuration file cannot be edited.");
$oAlert = AlertUIBlockFactory::MakeForInformation('', "Sorry, iTop is in <b>demonstration mode</b>: the configuration file cannot be edited.");
$oP->AddUiBlock($oAlert);
} else {
if (MetaModel::GetModuleSetting('itop-config', 'config_editor', '') == 'disabled') {
$oAlert = AlertFactory::MakeForWarning('', "iTop interactive edition of the configuration as been disabled. See <tt>'config_editor' => 'disabled'</tt> in the configuration file.");
$oAlert = AlertUIBlockFactory::MakeForWarning('', "iTop interactive edition of the configuration as been disabled. See <tt>'config_editor' => 'disabled'</tt> in the configuration file.");
$oP->AddUiBlock($oAlert);
} else {
$sConfigFile = APPROOT.'conf/'.utils::GetCurrentEnvironment().'/config-itop.php';
@@ -114,17 +114,17 @@ try {
}
if ($sOperation == 'revert') {
$oAlert = AlertFactory::MakeForWarning('', Dict::S('config-reverted'));
$oAlert = AlertUIBlockFactory::MakeForWarning('', Dict::S('config-reverted'));
$oP->AddUiBlock($oAlert);
}
if ($sOperation == 'save') {
$sTransactionId = utils::ReadParam('transaction_id', '', false, 'transaction_id');
if (!utils::IsTransactionValid($sTransactionId, true)) {
$oAlert = AlertFactory::MakeForFailure('', 'Error: invalid Transaction ID. The configuration was <b>NOT</b> modified.');
$oAlert = AlertUIBlockFactory::MakeForFailure('', 'Error: invalid Transaction ID. The configuration was <b>NOT</b> modified.');
$oP->AddUiBlock($oAlert);
} else {
if ($sConfig == $sOriginalConfig) {
$oAlert = AlertFactory::MakeForInformation('', Dict::S('config-no-change'));
$oAlert = AlertUIBlockFactory::MakeForInformation('', Dict::S('config-no-change'));
$oP->AddUiBlock($oAlert);
} else {
try {
@@ -150,14 +150,14 @@ try {
@chmod($sConfigFile, 0440); // Read-only
if (DBPasswordInNewConfigIsOk($sConfig)) {
$oAlert = AlertFactory::MakeForSuccess('', Dict::S('config-saved'));
$oAlert = AlertUIBlockFactory::MakeForSuccess('', Dict::S('config-saved'));
} else {
$oAlert = AlertFactory::MakeForInformation('', Dict::S('config-saved-warning-db-password'));
$oAlert = AlertUIBlockFactory::MakeForInformation('', Dict::S('config-saved-warning-db-password'));
}
$oP->AddUiBlock($oAlert);
$sOriginalConfig = str_replace("\r\n", "\n", file_get_contents($sConfigFile));
} catch (Exception $e) {
$oAlert = AlertFactory::MakeForDanger('', $e->getMessage());
$oAlert = AlertUIBlockFactory::MakeForDanger('', $e->getMessage());
$oP->AddUiBlock($oAlert);
}
}
@@ -170,19 +170,19 @@ try {
$oP->AddUiBlock(new Html('<p>'.Dict::S('config-edit-intro').'</p>'));
$oForm = new Form();
$oForm->AddSubBlock(InputFactory::MakeForHidden('operation', 'save'));
$oForm->AddSubBlock(InputFactory::MakeForHidden('transaction_id', utils::GetNewTransactionId()));
$oForm->AddSubBlock(InputUIBlockFactory::MakeForHidden('operation', 'save'));
$oForm->AddSubBlock(InputUIBlockFactory::MakeForHidden('transaction_id', utils::GetNewTransactionId()));
// - Cancel button
$oCancelButton = ButtonFactory::MakeForSecondaryAction(Dict::S('config-cancel'), 'cancel_button', null, true, 'cancel_button');
$oCancelButton = ButtonUIBlockFactory::MakeForSecondaryAction(Dict::S('config-cancel'), 'cancel_button', null, true, 'cancel_button');
$oCancelButton->SetOnClickJsCode("return ResetConfig();");
$oForm->AddSubBlock($oCancelButton);
// - Submit button
$oSubmitButton = ButtonFactory::MakeForPrimaryAction(Dict::S('config-apply'), null, Dict::S('config-apply'), true, 'submit_button');
$oSubmitButton = ButtonUIBlockFactory::MakeForPrimaryAction(Dict::S('config-apply'), null, Dict::S('config-apply'), true, 'submit_button');
$oForm->AddSubBlock($oSubmitButton);
$oForm->AddSubBlock(InputFactory::MakeForHidden('prev_config', $sOriginalConfigEscaped, 'prev_config'));
$oForm->AddSubBlock(InputFactory::MakeForHidden('new_config', $sConfigEscaped));
$oForm->AddSubBlock(InputUIBlockFactory::MakeForHidden('prev_config', $sOriginalConfigEscaped, 'prev_config'));
$oForm->AddSubBlock(InputUIBlockFactory::MakeForHidden('new_config', $sConfigEscaped));
$oForm->AddHtml("<div id =\"new_config\" style=\"position: absolute; top: ".$iEditorTopMargin."em; bottom: 0; left: 5px; right: 5px;\"></div>");
$oP->AddUiBlock($oForm);

View File

@@ -2,50 +2,48 @@
{# @license http://opensource.org/licenses/AGPL-3.0 #}
{% apply spaceless %}
{% UIContentBlock {'container_class':'ibo-update-core'} %}
{% UIContentBlock Standard {'sContainerClass':'ibo-update-core'} %}
{% UITitle ForPage {'title':'iTopUpdate:UI:PageTitle'|dict_s} %}
{% UITitle ForPage {'sTitle':'iTopUpdate:UI:PageTitle'|dict_s} %}
{% UIHtml %}
<div class="ibo-v-spacer">&nbsp;</div>
{% EndUIHtml %}
{% UIContentBlock {'container_class':'display_block display-files'} %}
{% UIFieldSet {'legend':'iTopUpdate:UI:Status'|dict_s} %}
{% UIContentBlock Standard {'sContainerClass':'display_block display-files'} %}
{% UIFieldSet Standard {'sLegend':'iTopUpdate:UI:Status'|dict_s} %}
{% UIAlert ForInformation {'title':'', 'id':'header-requirements', 'is_collapsible':false, 'is_closable':false} %}
{% UIAlert ForInformation {'sId':'header-requirements', 'IsCollapsible':false, 'IsClosable':false} %}
{% UIHtml %}
<span id="can-core-update">{{ 'iTopUpdate:UI:CanCoreUpdate:Loading'|dict_s }} <i class="ajax-spin fas fa-spinner fa-spin" aria-hidden="true"></i></span>
{% EndUIHtml %}
{% EndUIAlert %}
{% set sVersion = 'UI:iTopVersion:Long'|dict_format(constant('ITOP_APPLICATION'), constant('ITOP_VERSION'), constant('ITOP_REVISION'), constant('ITOP_BUILD_DATE')) %}
{% UIField Small {'label':'iTopUpdate:UI:CurrentVersion'|dict_s} %}
{% UIField Standard {'sLabel':'iTopUpdate:UI:CurrentVersion'|dict_s} %}
{% UIHtml %}
{{ sVersion }}
{{ 'UI:iTopVersion:Long'|dict_format(constant('ITOP_APPLICATION'), constant('ITOP_VERSION'), constant('ITOP_REVISION'), constant('ITOP_BUILD_DATE')) }}
{% EndUIHtml %}
{% EndUIField %}
{% UIField Small {'label':'iTopUpdate:UI:DiskFreeSpace'|dict_s} %}
{% UIField Standard {'sLabel':'iTopUpdate:UI:DiskFreeSpace'|dict_s} %}
{% UIHtml %}
{{ sDiskFreeSpace }}
{% EndUIHtml %}
{% EndUIField %}
{% UIField Small {'label':'iTopUpdate:UI:ItopDiskSpace'|dict_s, 'value_id':'itop-disk-space'} %}
{% UIField Standard {'sLabel':'iTopUpdate:UI:ItopDiskSpace'|dict_s, 'ValueId':'itop-disk-space'} %}
{% UIHtml %}
<i class="ajax-spin fas fa-spinner fa-spin" aria-hidden="true"></i>
{% EndUIHtml %}
{% EndUIField %}
{% UIField Small {'label':'iTopUpdate:UI:DBDiskSpace'|dict_s, 'value_id':'db-disk-space'} %}
{% UIField Standard {'sLabel':'iTopUpdate:UI:DBDiskSpace'|dict_s, 'ValueId':'db-disk-space'} %}
{% UIHtml %}
<i class="ajax-spin fas fa-spinner fa-spin" aria-hidden="true"></i>
{% EndUIHtml %}
{% EndUIField %}
{% UIField Small {'label':'iTopUpdate:UI:FileUploadMaxSize'|dict_s} %}
{% UIField Standard {'sLabel':'iTopUpdate:UI:FileUploadMaxSize'|dict_s} %}
{% UIHtml %}
{{ sFileUploadMaxSize }}
{% EndUIHtml %}
@@ -53,15 +51,15 @@
{% EndUIFieldSet %}
{% UIFieldSet {'legend':'iTopUpdate:UI:SelectUpdateFile'|dict_s} %}
{% UIForm {} %}
{% UIInput ForHidden {'name':'operation', 'value':'ConfirmUpdate'} %}
{% UIInput ForHidden {'name':'transaction_id', 'value':sTransactionId} %}
{% UIFieldSet Standard {'sLegend':'iTopUpdate:UI:SelectUpdateFile'|dict_s} %}
{% UIForm Standard {} %}
{% UIInput ForHidden {'sName':'operation', 'sValue':'ConfirmUpdate'} %}
{% UIInput ForHidden {'sName':'transaction_id', 'sValue':sTransactionId} %}
{% UIHtml %}
<div id="header-file-size" class="header_message message_error" style="display: none">
<div>
<span>{{ 'iTopUpdate:Error:FileUploadMaxSizeTooSmall'|dict_s }}</span>
<span>{{ 'iTopUpdate:Error:FileUploadMaxSizeTooStandard'|dict_s }}</span>
</div>
<div>
<span>{{ 'iTopUpdate:UI:PostMaxSize'|dict_format(sPostMaxSize) }}</span>
@@ -72,32 +70,37 @@
</div>
{% EndUIHtml %}
{% UIContentBlock {'container_class':'upload_container'} %}
{% UIInput Standard {'type':'file', 'id':'file', 'name':'file'} %}
{% UIContentBlock Standard {'sContainerClass':'upload_container'} %}
{% UIInput Standard {'sType':'file', 'sId':'file', 'sName':'file', 'sValue':''} %}
{% EndUIContentBlock %}
{% UIHtml %}
<div id="dobackup-warning" class="header_message message_info" style="display: none">{{ 'iTopUpdate:UI:DoBackup:Warning'|dict_s }}</div>
{% EndUIHtml %}
{% UIField Large {'label':'iTopUpdate:UI:DoBackup:Label'|dict_s} %}
{% UIInput Standard {'type':'checkbox', 'id':'doBackup', 'name':'doBackup', 'value':'1', 'checked':true} %}
{% UIField Standard {'sLabel':'iTopUpdate:UI:DoBackup:Label'|dict_s, 'sLayout':'large'} %}
{% UIInput Standard {'sType':'checkbox', 'sId':'doBackup', 'sName':'doBackup', 'sValue':'1', 'Checked':true} %}
{% EndUIField %}
{% UIField Large {'label':'iTopUpdate:UI:DoFilesArchive'|dict_s} %}
{% UIInput Standard {'type':'checkbox', 'id':'doFilesArchive', 'name':'doFilesArchive', 'value':'1', 'checked':true} %}
{% UIField Standard {'sLabel':'iTopUpdate:UI:DoFilesArchive'|dict_s, 'sLayout':'large'} %}
{% UIInput Standard {'sType':'checkbox', 'sId':'doFilesArchive', 'sName':'doFilesArchive', 'sValue':'1', 'Checked':true} %}
{% EndUIField %}
{% UIContentBlock Standard {'sContainerClass':'ibo_check_update_submit'} %}
{% UIButton ForPrimaryAction {'sLabel':'iTopUpdate:UI:CheckUpdate'|dict_s, 'sId':'check-update', 'bIsSubmit':true, 'IsDisabled':true} %}
{% UIHtml %}
<p><input id="check-update" type="submit" value="{{ 'iTopUpdate:UI:CheckUpdate'|dict_s }}" disabled="disabled"/> <i id="submit-wait" style="display: none" class="fas fa-spinner fa-spin" aria-hidden="true"></i></p>
<i id="submit-wait" style="display: none" class="fas fa-spinner fa-spin" aria-hidden="true"></i>
{% EndUIHtml %}
{% EndUIContentBlock %}
{% EndUIForm %}
{% EndUIFieldSet %}
{% UIFieldSet {'legend':'iTopUpdate:UI:History'|dict_s} %}
{% UIDataTable ForResult {'list_id':'iboupdatehistory', 'object_set':oSet} %}
{% UIFieldSet Standard {'sLegend':'iTopUpdate:UI:History'|dict_s} %}
{% UIDataTable ForResult {'oPage':oPage, 'sListId':'iboupdatehistory', 'oSet':oSet} %}
{% EndUIDataTable %}
{% EndUIFieldSet %}
{% EndUIContentBlock %}

View File

@@ -151,50 +151,38 @@ return array(
'Combodo\\iTop\\Application\\TwigBase\\Controller\\PageNotFoundException' => $baseDir . '/sources/application/TwigBase/Controller/Controller.php',
'Combodo\\iTop\\Application\\TwigBase\\Twig\\Extension' => $baseDir . '/sources/application/TwigBase/Twig/Extension.php',
'Combodo\\iTop\\Application\\TwigBase\\Twig\\TwigHelper' => $baseDir . '/sources/application/TwigBase/Twig/TwigHelper.php',
'Combodo\\iTop\\Application\\TwigBase\\UI\\Component\\UIAlertNode' => $baseDir . '/sources/application/TwigBase/UI/Component/Alert/UIAlertNode.php',
'Combodo\\iTop\\Application\\TwigBase\\UI\\Component\\UIAlertParser' => $baseDir . '/sources/application/TwigBase/UI/Component/Alert/UIAlertParser.php',
'Combodo\\iTop\\Application\\TwigBase\\UI\\Component\\UIContentBlockNode' => $baseDir . '/sources/application/TwigBase/UI/Layout/UIContentBlockNode.php',
'Combodo\\iTop\\Application\\TwigBase\\UI\\Component\\UIContentBlockParser' => $baseDir . '/sources/application/TwigBase/UI/Layout/UIContentBlockParser.php',
'Combodo\\iTop\\Application\\TwigBase\\UI\\Component\\UIDataTableNode' => $baseDir . '/sources/application/TwigBase/UI/Component/DataTable/UIDataTableNode.php',
'Combodo\\iTop\\Application\\TwigBase\\UI\\Component\\UIDataTableParser' => $baseDir . '/sources/application/TwigBase/UI/Component/DataTable/UIDataTableParser.php',
'Combodo\\iTop\\Application\\TwigBase\\UI\\Component\\UIFieldNode' => $baseDir . '/sources/application/TwigBase/UI/Component/Field/UIFieldNode.php',
'Combodo\\iTop\\Application\\TwigBase\\UI\\Component\\UIFieldParser' => $baseDir . '/sources/application/TwigBase/UI/Component/Field/UIFieldParser.php',
'Combodo\\iTop\\Application\\TwigBase\\UI\\Component\\UIFieldSetNode' => $baseDir . '/sources/application/TwigBase/UI/Component/FieldSet/UIFieldSetNode.php',
'Combodo\\iTop\\Application\\TwigBase\\UI\\Component\\UIFieldSetParser' => $baseDir . '/sources/application/TwigBase/UI/Component/FieldSet/UIFieldSetParser.php',
'Combodo\\iTop\\Application\\TwigBase\\UI\\Component\\UIFormNode' => $baseDir . '/sources/application/TwigBase/UI/Component/Form/UIFormNode.php',
'Combodo\\iTop\\Application\\TwigBase\\UI\\Component\\UIFormParser' => $baseDir . '/sources/application/TwigBase/UI/Component/Form/UIFormParser.php',
'Combodo\\iTop\\Application\\TwigBase\\UI\\Component\\UIHtmlNode' => $baseDir . '/sources/application/TwigBase/UI/Component/Html/UIHtmlNode.php',
'Combodo\\iTop\\Application\\TwigBase\\UI\\Component\\UIHtmlParser' => $baseDir . '/sources/application/TwigBase/UI/Component/Html/UIHtmlParser.php',
'Combodo\\iTop\\Application\\TwigBase\\UI\\Component\\UIInputNode' => $baseDir . '/sources/application/TwigBase/UI/Component/Input/UIInputNode.php',
'Combodo\\iTop\\Application\\TwigBase\\UI\\Component\\UIInputParser' => $baseDir . '/sources/application/TwigBase/UI/Component/Input/UIInputParser.php',
'Combodo\\iTop\\Application\\TwigBase\\UI\\Component\\UITitleNode' => $baseDir . '/sources/application/TwigBase/UI/Component/Title/UITitleNode.php',
'Combodo\\iTop\\Application\\TwigBase\\UI\\Component\\UITitleParser' => $baseDir . '/sources/application/TwigBase/UI/Component/Title/UITitleParser.php',
'Combodo\\iTop\\Application\\TwigBase\\UI\\UIBlockExtension' => $baseDir . '/sources/application/TwigBase/UI/UIBlockExtension.php',
'Combodo\\iTop\\Application\\TwigBase\\UI\\UIBlockHelper' => $baseDir . '/sources/application/TwigBase/UI/UIBlockHelper.php',
'Combodo\\iTop\\Application\\TwigBase\\UI\\UIBlockNode' => $baseDir . '/sources/application/TwigBase/UI/UIBlockNode.php',
'Combodo\\iTop\\Application\\TwigBase\\UI\\UIBlockParser' => $baseDir . '/sources/application/TwigBase/UI/UIBlockParser.php',
'Combodo\\iTop\\Application\\UI\\Base\\AbstractUIBlockFactory' => $baseDir . '/sources/application/UI/Base/AbstractUIBlockFactory.php',
'Combodo\\iTop\\Application\\UI\\Base\\Component\\Alert\\Alert' => $baseDir . '/sources/application/UI/Base/Component/Alert/Alert.php',
'Combodo\\iTop\\Application\\UI\\Base\\Component\\Alert\\AlertFactory' => $baseDir . '/sources/application/UI/Base/Component/Alert/AlertFactory.php',
'Combodo\\iTop\\Application\\UI\\Base\\Component\\Alert\\AlertUIBlockFactory' => $baseDir . '/sources/application/UI/Base/Component/Alert/AlertUIBlockFactory.php',
'Combodo\\iTop\\Application\\UI\\Base\\Component\\Badge\\Badge' => $baseDir . '/sources/application/UI/Base/Component/Badge/Badge.php',
'Combodo\\iTop\\Application\\UI\\Base\\Component\\Badge\\BadgeFactory' => $baseDir . '/sources/application/UI/Base/Component/Badge/BadgeFactory.php',
'Combodo\\iTop\\Application\\UI\\Base\\Component\\Breadcrumbs\\Breadcrumbs' => $baseDir . '/sources/application/UI/Base/Component/Breadcrumbs/Breadcrumbs.php',
'Combodo\\iTop\\Application\\UI\\Base\\Component\\Button\\Button' => $baseDir . '/sources/application/UI/Base/Component/Button/Button.php',
'Combodo\\iTop\\Application\\UI\\Base\\Component\\Button\\ButtonFactory' => $baseDir . '/sources/application/UI/Base/Component/Button/ButtonFactory.php',
'Combodo\\iTop\\Application\\UI\\Base\\Component\\Button\\ButtonUIBlockFactory' => $baseDir . '/sources/application/UI/Base/Component/Button/ButtonUIBlockFactory.php',
'Combodo\\iTop\\Application\\UI\\Base\\Component\\CollapsibleSection\\CollapsibleSection' => $baseDir . '/sources/application/UI/Base/Component/CollapsibleSection/CollapsibleSection.php',
'Combodo\\iTop\\Application\\UI\\Base\\Component\\Dashlet\\DashletBadge' => $baseDir . '/sources/application/UI/Base/Component/Dashlet/DashletBadge.php',
'Combodo\\iTop\\Application\\UI\\Base\\Component\\Dashlet\\DashletContainer' => $baseDir . '/sources/application/UI/Base/Component/Dashlet/DashletContainer.php',
'Combodo\\iTop\\Application\\UI\\Base\\Component\\Dashlet\\DashletFactory' => $baseDir . '/sources/application/UI/Base/Component/Dashlet/DashletFactory.php',
'Combodo\\iTop\\Application\\UI\\Base\\Component\\Dashlet\\DashletHeaderStatic' => $baseDir . '/sources/application/UI/Base/Component/Dashlet/DashletHeaderStatic.php',
'Combodo\\iTop\\Application\\UI\\Base\\Component\\DataTable\\DataTable' => $baseDir . '/sources/application/UI/Base/Component/DataTable/DataTable.php',
'Combodo\\iTop\\Application\\UI\\Base\\Component\\DataTable\\DataTableFactory' => $baseDir . '/sources/application/UI/Base/Component/DataTable/DataTableFactory.php',
'Combodo\\iTop\\Application\\UI\\Base\\Component\\DataTable\\DataTableSettings' => $baseDir . '/sources/application/UI/Base/Component/DataTable/DataTableSettings.php',
'Combodo\\iTop\\Application\\UI\\Base\\Component\\DataTable\\DataTableUIBlockFactory' => $baseDir . '/sources/application/UI/Base/Component/DataTable/DataTableUIBlockFactory.php',
'Combodo\\iTop\\Application\\UI\\Base\\Component\\DataTable\\StaticTable\\FormTableRow\\FormTableRow' => $baseDir . '/sources/application/UI/Base/Component/DataTable/StaticTable/FormTableRow/FormTableRow.php',
'Combodo\\iTop\\Application\\UI\\Base\\Component\\DataTable\\StaticTable\\FormTable\\FormTable' => $baseDir . '/sources/application/UI/Base/Component/DataTable/StaticTable/FormTable/FormTable.php',
'Combodo\\iTop\\Application\\UI\\Base\\Component\\DataTable\\StaticTable\\StaticTable' => $baseDir . '/sources/application/UI/Base/Component/DataTable/StaticTable/StaticTable.php',
'Combodo\\iTop\\Application\\UI\\Base\\Component\\FieldBadge\\FieldBadge' => $baseDir . '/sources/application/UI/Base/Component/FieldBadge/FieldBadge.php',
'Combodo\\iTop\\Application\\UI\\Base\\Component\\FieldBadge\\FieldBadgeFactory' => $baseDir . '/sources/application/UI/Base/Component/FieldBadge/FieldBadgeFactory.php',
'Combodo\\iTop\\Application\\UI\\Base\\Component\\FieldSet\\FieldSet' => $baseDir . '/sources/application/UI/Base/Component/FieldSet/FieldSet.php',
'Combodo\\iTop\\Application\\UI\\Base\\Component\\FieldSet\\FieldSetUIBlockFactory' => $baseDir . '/sources/application/UI/Base/Component/FieldSet/FieldSetUIBlockFactory.php',
'Combodo\\iTop\\Application\\UI\\Base\\Component\\Field\\Field' => $baseDir . '/sources/application/UI/Base/Component/Field/Field.php',
'Combodo\\iTop\\Application\\UI\\Base\\Component\\Field\\FieldFactory' => $baseDir . '/sources/application/UI/Base/Component/Field/FieldFactory.php',
'Combodo\\iTop\\Application\\UI\\Base\\Component\\Field\\FieldUIBlockFactory' => $baseDir . '/sources/application/UI/Base/Component/Field/FieldUIBlockFactory.php',
'Combodo\\iTop\\Application\\UI\\Base\\Component\\Form\\Form' => $baseDir . '/sources/application/UI/Base/Component/Form/Form.php',
'Combodo\\iTop\\Application\\UI\\Base\\Component\\Form\\FormUIBlockFactory' => $baseDir . '/sources/application/UI/Base/Component/Form/FormUIBlockFactory.php',
'Combodo\\iTop\\Application\\UI\\Base\\Component\\GlobalSearch\\GlobalSearch' => $baseDir . '/sources/application/UI/Base/Component/GlobalSearch/GlobalSearch.php',
'Combodo\\iTop\\Application\\UI\\Base\\Component\\GlobalSearch\\GlobalSearchFactory' => $baseDir . '/sources/application/UI/Base/Component/GlobalSearch/GlobalSearchFactory.php',
'Combodo\\iTop\\Application\\UI\\Base\\Component\\GlobalSearch\\GlobalSearchHelper' => $baseDir . '/sources/application/UI/Base/Component/GlobalSearch/GlobalSearchHelper.php',
@@ -202,7 +190,7 @@ return array(
'Combodo\\iTop\\Application\\UI\\Base\\Component\\Html\\HtmlFactory' => $baseDir . '/sources/application/UI/Base/Component/Html/HtmlFactory.php',
'Combodo\\iTop\\Application\\UI\\Base\\Component\\Input\\AbstractInput' => $baseDir . '/sources/application/UI/Base/Component/Input/AbstractInput.php',
'Combodo\\iTop\\Application\\UI\\Base\\Component\\Input\\Input' => $baseDir . '/sources/application/UI/Base/Component/Input/Input.php',
'Combodo\\iTop\\Application\\UI\\Base\\Component\\Input\\InputFactory' => $baseDir . '/sources/application/UI/Base/Component/Input/InputFactory.php',
'Combodo\\iTop\\Application\\UI\\Base\\Component\\Input\\InputUIBlockFactory' => $baseDir . '/sources/application/UI/Base/Component/Input/InputUIBlockFactory.php',
'Combodo\\iTop\\Application\\UI\\Base\\Component\\Input\\InputWithLabel' => $baseDir . '/sources/application/UI/Base/Component/Input/InputWithLabel.php',
'Combodo\\iTop\\Application\\UI\\Base\\Component\\Input\\RichText\\RichText' => $baseDir . '/sources/application/UI/Base/Component/Input/RichText/RichText.php',
'Combodo\\iTop\\Application\\UI\\Base\\Component\\Input\\Select\\Select' => $baseDir . '/sources/application/UI/Base/Component/Input/Select/Select.php',
@@ -224,8 +212,8 @@ return array(
'Combodo\\iTop\\Application\\UI\\Base\\Component\\QuickCreate\\QuickCreateFactory' => $baseDir . '/sources/application/UI/Base/Component/QuickCreate/QuickCreateFactory.php',
'Combodo\\iTop\\Application\\UI\\Base\\Component\\QuickCreate\\QuickCreateHelper' => $baseDir . '/sources/application/UI/Base/Component/QuickCreate/QuickCreateHelper.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\\TitleFactory' => $baseDir . '/sources/application/UI/Base/Component/Title/TitleFactory.php',
'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\\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',
@@ -262,10 +250,12 @@ return array(
'Combodo\\iTop\\Application\\UI\\Base\\Layout\\TopBar\\TopBar' => $baseDir . '/sources/application/UI/Base/Layout/TopBar/TopBar.php',
'Combodo\\iTop\\Application\\UI\\Base\\Layout\\TopBar\\TopBarFactory' => $baseDir . '/sources/application/UI/Base/Layout/TopBar/TopBarFactory.php',
'Combodo\\iTop\\Application\\UI\\Base\\Layout\\UIContentBlock' => $baseDir . '/sources/application/UI/Base/Layout/UIContentBlock.php',
'Combodo\\iTop\\Application\\UI\\Base\\Layout\\UIContentBlockUIBlockFactory' => $baseDir . '/sources/application/UI/Base/Layout/UIContentBlockUIBlockFactory.php',
'Combodo\\iTop\\Application\\UI\\Base\\Layout\\iUIContentBlock' => $baseDir . '/sources/application/UI/Base/Layout/iUIContentBlock.php',
'Combodo\\iTop\\Application\\UI\\Base\\UIBlock' => $baseDir . '/sources/application/UI/Base/UIBlock.php',
'Combodo\\iTop\\Application\\UI\\Base\\UIException' => $baseDir . '/sources/application/UI/Base/UIException.php',
'Combodo\\iTop\\Application\\UI\\Base\\iUIBlock' => $baseDir . '/sources/application/UI/Base/iUIBlock.php',
'Combodo\\iTop\\Application\\UI\\Base\\iUIBlockFactory' => $baseDir . '/sources/application/UI/Base/iUIBlockFactory.php',
'Combodo\\iTop\\Application\\UI\\Base\\tUIContentAreas' => $baseDir . '/sources/application/UI/Base/tUIContentAreas.php',
'Combodo\\iTop\\Application\\UI\\DisplayBlock\\BlockChartAjaxBars\\BlockChartAjaxBars' => $baseDir . '/sources/application/UI/DisplayBlock/BlockChartAjaxBars/BlockChartAjaxBars.php',
'Combodo\\iTop\\Application\\UI\\DisplayBlock\\BlockChartAjaxPie\\BlockChartAjaxPie' => $baseDir . '/sources/application/UI/DisplayBlock/BlockChartAjaxPie/BlockChartAjaxPie.php',

View File

@@ -381,50 +381,38 @@ class ComposerStaticInit0018331147de7601e7552f7da8e3bb8b
'Combodo\\iTop\\Application\\TwigBase\\Controller\\PageNotFoundException' => __DIR__ . '/../..' . '/sources/application/TwigBase/Controller/Controller.php',
'Combodo\\iTop\\Application\\TwigBase\\Twig\\Extension' => __DIR__ . '/../..' . '/sources/application/TwigBase/Twig/Extension.php',
'Combodo\\iTop\\Application\\TwigBase\\Twig\\TwigHelper' => __DIR__ . '/../..' . '/sources/application/TwigBase/Twig/TwigHelper.php',
'Combodo\\iTop\\Application\\TwigBase\\UI\\Component\\UIAlertNode' => __DIR__ . '/../..' . '/sources/application/TwigBase/UI/Component/Alert/UIAlertNode.php',
'Combodo\\iTop\\Application\\TwigBase\\UI\\Component\\UIAlertParser' => __DIR__ . '/../..' . '/sources/application/TwigBase/UI/Component/Alert/UIAlertParser.php',
'Combodo\\iTop\\Application\\TwigBase\\UI\\Component\\UIContentBlockNode' => __DIR__ . '/../..' . '/sources/application/TwigBase/UI/Layout/UIContentBlockNode.php',
'Combodo\\iTop\\Application\\TwigBase\\UI\\Component\\UIContentBlockParser' => __DIR__ . '/../..' . '/sources/application/TwigBase/UI/Layout/UIContentBlockParser.php',
'Combodo\\iTop\\Application\\TwigBase\\UI\\Component\\UIDataTableNode' => __DIR__ . '/../..' . '/sources/application/TwigBase/UI/Component/DataTable/UIDataTableNode.php',
'Combodo\\iTop\\Application\\TwigBase\\UI\\Component\\UIDataTableParser' => __DIR__ . '/../..' . '/sources/application/TwigBase/UI/Component/DataTable/UIDataTableParser.php',
'Combodo\\iTop\\Application\\TwigBase\\UI\\Component\\UIFieldNode' => __DIR__ . '/../..' . '/sources/application/TwigBase/UI/Component/Field/UIFieldNode.php',
'Combodo\\iTop\\Application\\TwigBase\\UI\\Component\\UIFieldParser' => __DIR__ . '/../..' . '/sources/application/TwigBase/UI/Component/Field/UIFieldParser.php',
'Combodo\\iTop\\Application\\TwigBase\\UI\\Component\\UIFieldSetNode' => __DIR__ . '/../..' . '/sources/application/TwigBase/UI/Component/FieldSet/UIFieldSetNode.php',
'Combodo\\iTop\\Application\\TwigBase\\UI\\Component\\UIFieldSetParser' => __DIR__ . '/../..' . '/sources/application/TwigBase/UI/Component/FieldSet/UIFieldSetParser.php',
'Combodo\\iTop\\Application\\TwigBase\\UI\\Component\\UIFormNode' => __DIR__ . '/../..' . '/sources/application/TwigBase/UI/Component/Form/UIFormNode.php',
'Combodo\\iTop\\Application\\TwigBase\\UI\\Component\\UIFormParser' => __DIR__ . '/../..' . '/sources/application/TwigBase/UI/Component/Form/UIFormParser.php',
'Combodo\\iTop\\Application\\TwigBase\\UI\\Component\\UIHtmlNode' => __DIR__ . '/../..' . '/sources/application/TwigBase/UI/Component/Html/UIHtmlNode.php',
'Combodo\\iTop\\Application\\TwigBase\\UI\\Component\\UIHtmlParser' => __DIR__ . '/../..' . '/sources/application/TwigBase/UI/Component/Html/UIHtmlParser.php',
'Combodo\\iTop\\Application\\TwigBase\\UI\\Component\\UIInputNode' => __DIR__ . '/../..' . '/sources/application/TwigBase/UI/Component/Input/UIInputNode.php',
'Combodo\\iTop\\Application\\TwigBase\\UI\\Component\\UIInputParser' => __DIR__ . '/../..' . '/sources/application/TwigBase/UI/Component/Input/UIInputParser.php',
'Combodo\\iTop\\Application\\TwigBase\\UI\\Component\\UITitleNode' => __DIR__ . '/../..' . '/sources/application/TwigBase/UI/Component/Title/UITitleNode.php',
'Combodo\\iTop\\Application\\TwigBase\\UI\\Component\\UITitleParser' => __DIR__ . '/../..' . '/sources/application/TwigBase/UI/Component/Title/UITitleParser.php',
'Combodo\\iTop\\Application\\TwigBase\\UI\\UIBlockExtension' => __DIR__ . '/../..' . '/sources/application/TwigBase/UI/UIBlockExtension.php',
'Combodo\\iTop\\Application\\TwigBase\\UI\\UIBlockHelper' => __DIR__ . '/../..' . '/sources/application/TwigBase/UI/UIBlockHelper.php',
'Combodo\\iTop\\Application\\TwigBase\\UI\\UIBlockNode' => __DIR__ . '/../..' . '/sources/application/TwigBase/UI/UIBlockNode.php',
'Combodo\\iTop\\Application\\TwigBase\\UI\\UIBlockParser' => __DIR__ . '/../..' . '/sources/application/TwigBase/UI/UIBlockParser.php',
'Combodo\\iTop\\Application\\UI\\Base\\AbstractUIBlockFactory' => __DIR__ . '/../..' . '/sources/application/UI/Base/AbstractUIBlockFactory.php',
'Combodo\\iTop\\Application\\UI\\Base\\Component\\Alert\\Alert' => __DIR__ . '/../..' . '/sources/application/UI/Base/Component/Alert/Alert.php',
'Combodo\\iTop\\Application\\UI\\Base\\Component\\Alert\\AlertFactory' => __DIR__ . '/../..' . '/sources/application/UI/Base/Component/Alert/AlertFactory.php',
'Combodo\\iTop\\Application\\UI\\Base\\Component\\Alert\\AlertUIBlockFactory' => __DIR__ . '/../..' . '/sources/application/UI/Base/Component/Alert/AlertUIBlockFactory.php',
'Combodo\\iTop\\Application\\UI\\Base\\Component\\Badge\\Badge' => __DIR__ . '/../..' . '/sources/application/UI/Base/Component/Badge/Badge.php',
'Combodo\\iTop\\Application\\UI\\Base\\Component\\Badge\\BadgeFactory' => __DIR__ . '/../..' . '/sources/application/UI/Base/Component/Badge/BadgeFactory.php',
'Combodo\\iTop\\Application\\UI\\Base\\Component\\Breadcrumbs\\Breadcrumbs' => __DIR__ . '/../..' . '/sources/application/UI/Base/Component/Breadcrumbs/Breadcrumbs.php',
'Combodo\\iTop\\Application\\UI\\Base\\Component\\Button\\Button' => __DIR__ . '/../..' . '/sources/application/UI/Base/Component/Button/Button.php',
'Combodo\\iTop\\Application\\UI\\Base\\Component\\Button\\ButtonFactory' => __DIR__ . '/../..' . '/sources/application/UI/Base/Component/Button/ButtonFactory.php',
'Combodo\\iTop\\Application\\UI\\Base\\Component\\Button\\ButtonUIBlockFactory' => __DIR__ . '/../..' . '/sources/application/UI/Base/Component/Button/ButtonUIBlockFactory.php',
'Combodo\\iTop\\Application\\UI\\Base\\Component\\CollapsibleSection\\CollapsibleSection' => __DIR__ . '/../..' . '/sources/application/UI/Base/Component/CollapsibleSection/CollapsibleSection.php',
'Combodo\\iTop\\Application\\UI\\Base\\Component\\Dashlet\\DashletBadge' => __DIR__ . '/../..' . '/sources/application/UI/Base/Component/Dashlet/DashletBadge.php',
'Combodo\\iTop\\Application\\UI\\Base\\Component\\Dashlet\\DashletContainer' => __DIR__ . '/../..' . '/sources/application/UI/Base/Component/Dashlet/DashletContainer.php',
'Combodo\\iTop\\Application\\UI\\Base\\Component\\Dashlet\\DashletFactory' => __DIR__ . '/../..' . '/sources/application/UI/Base/Component/Dashlet/DashletFactory.php',
'Combodo\\iTop\\Application\\UI\\Base\\Component\\Dashlet\\DashletHeaderStatic' => __DIR__ . '/../..' . '/sources/application/UI/Base/Component/Dashlet/DashletHeaderStatic.php',
'Combodo\\iTop\\Application\\UI\\Base\\Component\\DataTable\\DataTable' => __DIR__ . '/../..' . '/sources/application/UI/Base/Component/DataTable/DataTable.php',
'Combodo\\iTop\\Application\\UI\\Base\\Component\\DataTable\\DataTableFactory' => __DIR__ . '/../..' . '/sources/application/UI/Base/Component/DataTable/DataTableFactory.php',
'Combodo\\iTop\\Application\\UI\\Base\\Component\\DataTable\\DataTableSettings' => __DIR__ . '/../..' . '/sources/application/UI/Base/Component/DataTable/DataTableSettings.php',
'Combodo\\iTop\\Application\\UI\\Base\\Component\\DataTable\\DataTableUIBlockFactory' => __DIR__ . '/../..' . '/sources/application/UI/Base/Component/DataTable/DataTableUIBlockFactory.php',
'Combodo\\iTop\\Application\\UI\\Base\\Component\\DataTable\\StaticTable\\FormTableRow\\FormTableRow' => __DIR__ . '/../..' . '/sources/application/UI/Base/Component/DataTable/StaticTable/FormTableRow/FormTableRow.php',
'Combodo\\iTop\\Application\\UI\\Base\\Component\\DataTable\\StaticTable\\FormTable\\FormTable' => __DIR__ . '/../..' . '/sources/application/UI/Base/Component/DataTable/StaticTable/FormTable/FormTable.php',
'Combodo\\iTop\\Application\\UI\\Base\\Component\\DataTable\\StaticTable\\StaticTable' => __DIR__ . '/../..' . '/sources/application/UI/Base/Component/DataTable/StaticTable/StaticTable.php',
'Combodo\\iTop\\Application\\UI\\Base\\Component\\FieldBadge\\FieldBadge' => __DIR__ . '/../..' . '/sources/application/UI/Base/Component/FieldBadge/FieldBadge.php',
'Combodo\\iTop\\Application\\UI\\Base\\Component\\FieldBadge\\FieldBadgeFactory' => __DIR__ . '/../..' . '/sources/application/UI/Base/Component/FieldBadge/FieldBadgeFactory.php',
'Combodo\\iTop\\Application\\UI\\Base\\Component\\FieldSet\\FieldSet' => __DIR__ . '/../..' . '/sources/application/UI/Base/Component/FieldSet/FieldSet.php',
'Combodo\\iTop\\Application\\UI\\Base\\Component\\FieldSet\\FieldSetUIBlockFactory' => __DIR__ . '/../..' . '/sources/application/UI/Base/Component/FieldSet/FieldSetUIBlockFactory.php',
'Combodo\\iTop\\Application\\UI\\Base\\Component\\Field\\Field' => __DIR__ . '/../..' . '/sources/application/UI/Base/Component/Field/Field.php',
'Combodo\\iTop\\Application\\UI\\Base\\Component\\Field\\FieldFactory' => __DIR__ . '/../..' . '/sources/application/UI/Base/Component/Field/FieldFactory.php',
'Combodo\\iTop\\Application\\UI\\Base\\Component\\Field\\FieldUIBlockFactory' => __DIR__ . '/../..' . '/sources/application/UI/Base/Component/Field/FieldUIBlockFactory.php',
'Combodo\\iTop\\Application\\UI\\Base\\Component\\Form\\Form' => __DIR__ . '/../..' . '/sources/application/UI/Base/Component/Form/Form.php',
'Combodo\\iTop\\Application\\UI\\Base\\Component\\Form\\FormUIBlockFactory' => __DIR__ . '/../..' . '/sources/application/UI/Base/Component/Form/FormUIBlockFactory.php',
'Combodo\\iTop\\Application\\UI\\Base\\Component\\GlobalSearch\\GlobalSearch' => __DIR__ . '/../..' . '/sources/application/UI/Base/Component/GlobalSearch/GlobalSearch.php',
'Combodo\\iTop\\Application\\UI\\Base\\Component\\GlobalSearch\\GlobalSearchFactory' => __DIR__ . '/../..' . '/sources/application/UI/Base/Component/GlobalSearch/GlobalSearchFactory.php',
'Combodo\\iTop\\Application\\UI\\Base\\Component\\GlobalSearch\\GlobalSearchHelper' => __DIR__ . '/../..' . '/sources/application/UI/Base/Component/GlobalSearch/GlobalSearchHelper.php',
@@ -432,7 +420,7 @@ class ComposerStaticInit0018331147de7601e7552f7da8e3bb8b
'Combodo\\iTop\\Application\\UI\\Base\\Component\\Html\\HtmlFactory' => __DIR__ . '/../..' . '/sources/application/UI/Base/Component/Html/HtmlFactory.php',
'Combodo\\iTop\\Application\\UI\\Base\\Component\\Input\\AbstractInput' => __DIR__ . '/../..' . '/sources/application/UI/Base/Component/Input/AbstractInput.php',
'Combodo\\iTop\\Application\\UI\\Base\\Component\\Input\\Input' => __DIR__ . '/../..' . '/sources/application/UI/Base/Component/Input/Input.php',
'Combodo\\iTop\\Application\\UI\\Base\\Component\\Input\\InputFactory' => __DIR__ . '/../..' . '/sources/application/UI/Base/Component/Input/InputFactory.php',
'Combodo\\iTop\\Application\\UI\\Base\\Component\\Input\\InputUIBlockFactory' => __DIR__ . '/../..' . '/sources/application/UI/Base/Component/Input/InputUIBlockFactory.php',
'Combodo\\iTop\\Application\\UI\\Base\\Component\\Input\\InputWithLabel' => __DIR__ . '/../..' . '/sources/application/UI/Base/Component/Input/InputWithLabel.php',
'Combodo\\iTop\\Application\\UI\\Base\\Component\\Input\\RichText\\RichText' => __DIR__ . '/../..' . '/sources/application/UI/Base/Component/Input/RichText/RichText.php',
'Combodo\\iTop\\Application\\UI\\Base\\Component\\Input\\Select\\Select' => __DIR__ . '/../..' . '/sources/application/UI/Base/Component/Input/Select/Select.php',
@@ -454,8 +442,8 @@ class ComposerStaticInit0018331147de7601e7552f7da8e3bb8b
'Combodo\\iTop\\Application\\UI\\Base\\Component\\QuickCreate\\QuickCreateFactory' => __DIR__ . '/../..' . '/sources/application/UI/Base/Component/QuickCreate/QuickCreateFactory.php',
'Combodo\\iTop\\Application\\UI\\Base\\Component\\QuickCreate\\QuickCreateHelper' => __DIR__ . '/../..' . '/sources/application/UI/Base/Component/QuickCreate/QuickCreateHelper.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\\TitleFactory' => __DIR__ . '/../..' . '/sources/application/UI/Base/Component/Title/TitleFactory.php',
'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\\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',
@@ -492,10 +480,12 @@ class ComposerStaticInit0018331147de7601e7552f7da8e3bb8b
'Combodo\\iTop\\Application\\UI\\Base\\Layout\\TopBar\\TopBar' => __DIR__ . '/../..' . '/sources/application/UI/Base/Layout/TopBar/TopBar.php',
'Combodo\\iTop\\Application\\UI\\Base\\Layout\\TopBar\\TopBarFactory' => __DIR__ . '/../..' . '/sources/application/UI/Base/Layout/TopBar/TopBarFactory.php',
'Combodo\\iTop\\Application\\UI\\Base\\Layout\\UIContentBlock' => __DIR__ . '/../..' . '/sources/application/UI/Base/Layout/UIContentBlock.php',
'Combodo\\iTop\\Application\\UI\\Base\\Layout\\UIContentBlockUIBlockFactory' => __DIR__ . '/../..' . '/sources/application/UI/Base/Layout/UIContentBlockUIBlockFactory.php',
'Combodo\\iTop\\Application\\UI\\Base\\Layout\\iUIContentBlock' => __DIR__ . '/../..' . '/sources/application/UI/Base/Layout/iUIContentBlock.php',
'Combodo\\iTop\\Application\\UI\\Base\\UIBlock' => __DIR__ . '/../..' . '/sources/application/UI/Base/UIBlock.php',
'Combodo\\iTop\\Application\\UI\\Base\\UIException' => __DIR__ . '/../..' . '/sources/application/UI/Base/UIException.php',
'Combodo\\iTop\\Application\\UI\\Base\\iUIBlock' => __DIR__ . '/../..' . '/sources/application/UI/Base/iUIBlock.php',
'Combodo\\iTop\\Application\\UI\\Base\\iUIBlockFactory' => __DIR__ . '/../..' . '/sources/application/UI/Base/iUIBlockFactory.php',
'Combodo\\iTop\\Application\\UI\\Base\\tUIContentAreas' => __DIR__ . '/../..' . '/sources/application/UI/Base/tUIContentAreas.php',
'Combodo\\iTop\\Application\\UI\\DisplayBlock\\BlockChartAjaxBars\\BlockChartAjaxBars' => __DIR__ . '/../..' . '/sources/application/UI/DisplayBlock/BlockChartAjaxBars/BlockChartAjaxBars.php',
'Combodo\\iTop\\Application\\UI\\DisplayBlock\\BlockChartAjaxPie\\BlockChartAjaxPie' => __DIR__ . '/../..' . '/sources/application/UI/DisplayBlock/BlockChartAjaxPie/BlockChartAjaxPie.php',

View File

@@ -17,10 +17,10 @@
* You should have received a copy of the GNU Affero General Public License
*/
use Combodo\iTop\Application\UI\Base\Component\Button\ButtonFactory;
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\GlobalSearch\GlobalSearchHelper;
use Combodo\iTop\Application\UI\Base\Component\Input\InputFactory;
use Combodo\iTop\Application\UI\Base\Component\Input\InputUIBlockFactory;
use Combodo\iTop\Application\UI\Base\Component\QuickCreate\QuickCreateHelper;
use Combodo\iTop\Application\UI\Base\Layout\PageContent\PageContentFactory;
@@ -288,18 +288,18 @@ function DisplayMultipleSelectionForm(WebPage $oP, DBSearch $oFilter, string $sN
$oForm = new Form();
$oForm->SetAction('./UI.php');
$oForm->AddSubBlock(InputFactory::MakeForHidden('operation', $sNextOperation));
$oForm->AddSubBlock(InputFactory::MakeForHidden('class', $oFilter->GetClass()));
$oForm->AddSubBlock(InputFactory::MakeForHidden('filter', utils::HtmlEntities($oFilter->Serialize())));
$oForm->AddSubBlock(InputFactory::MakeForHidden('transaction_id', utils::GetNewTransactionId()));
$oForm->AddSubBlock(InputUIBlockFactory::MakeForHidden('operation', $sNextOperation));
$oForm->AddSubBlock(InputUIBlockFactory::MakeForHidden('class', $oFilter->GetClass()));
$oForm->AddSubBlock(InputUIBlockFactory::MakeForHidden('filter', utils::HtmlEntities($oFilter->Serialize())));
$oForm->AddSubBlock(InputUIBlockFactory::MakeForHidden('transaction_id', utils::GetNewTransactionId()));
foreach ($aExtraFormParams as $sName => $sValue) {
$oForm->AddSubBlock(InputFactory::MakeForHidden($sName, $sValue));
$oForm->AddSubBlock(InputUIBlockFactory::MakeForHidden($sName, $sValue));
}
$oForm->AddSubBlock($oAppContext->GetForFormBlock());
$oDisplayBlock = new DisplayBlock($oFilter, 'list', false);
$oForm->AddSubBlock($oDisplayBlock->GetDisplay($oP, 1, $aExtraParams));
$oForm->AddSubBlock(ButtonFactory::MakeNeutral(Dict::S('UI:Button:Cancel'), 'cancel')->SetOnClickJsCode('window.history.back()'));
$oForm->AddSubBlock(ButtonFactory::MakeForPrimaryAction(Dict::S('UI:Button:Next'), 'next', Dict::S('UI:Button:Next'), true));
$oForm->AddSubBlock(ButtonUIBlockFactory::MakeNeutral(Dict::S('UI:Button:Cancel'), 'cancel')->SetOnClickJsCode('window.history.back()'));
$oForm->AddSubBlock(ButtonUIBlockFactory::MakeForPrimaryAction(Dict::S('UI:Button:Next'), 'next', Dict::S('UI:Button:Next'), true));
$oP->AddUiBlock($oForm);
$oP->add_ready_script("$('#1 table.listResults').trigger('check_all');");

View File

@@ -17,12 +17,12 @@
* You should have received a copy of the GNU Affero General Public License
*/
use Combodo\iTop\Application\UI\Base\Component\Button\ButtonFactory;
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\Html\Html;
use Combodo\iTop\Application\UI\Base\Component\Input\InputFactory;
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\TitleFactory;
use Combodo\iTop\Application\UI\Base\Component\Title\TitleUIBlockFactory;
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;
@@ -41,7 +41,7 @@ function DisplayPreferences($oP)
$oAppContext = new ApplicationContext();
$sURL = utils::GetAbsoluteUrlAppRoot().'pages/UI.php?'.$oAppContext->GetForLink();
$oContentLayout->AddMainBlock(TitleFactory::MakeForPage(Dict::S('UI:Preferences:Title')));
$oContentLayout->AddMainBlock(TitleUIBlockFactory::MakeForPage(Dict::S('UI:Preferences:Title')));
//////////////////////////////////////////////////////////////////////////
//
@@ -84,10 +84,10 @@ HTML;
$oMiscSettingsHtml = new Html($sMiscSettingsHtml);
// - Cancel button
$oMiscSettingsCancelButton = ButtonFactory::MakeForSecondaryAction(Dict::S('UI:Button:Cancel'));
$oMiscSettingsCancelButton = ButtonUIBlockFactory::MakeForSecondaryAction(Dict::S('UI:Button:Cancel'));
$oMiscSettingsCancelButton->SetOnClickJsCode("window.location.href = '$sURL'");
// - Submit button
$oMiscSettingsSubmitButton = ButtonFactory::MakeForPrimaryAction(Dict::S('UI:Button:Apply'), 'operation', 'apply_others', true);
$oMiscSettingsSubmitButton = ButtonUIBlockFactory::MakeForPrimaryAction(Dict::S('UI:Button:Apply'), 'operation', 'apply_others', true);
$oMiscSettingsEndHtmlBlock = new Html('</form>');
@@ -145,22 +145,21 @@ JS
'selection_type' => 'multiple',
'table_id' => 'user_prefs',
'surround_with_panel' => false,
'selected_rows'=>$aFavoriteOrgs
'selected_rows' => $aFavoriteOrgs
]));
$oFavoriteOrganizationsForm->AddSubBlock($oAppContext->GetForFormBlock());
$oFavoriteOrganizationsToolBar = new UIContentBlock(null, 'ibo-datatable--selection-validation-buttons-toolbar');
$oFavoriteOrganizationsForm->AddSubBlock($oFavoriteOrganizationsToolBar);
// - Cancel button
$oFavoriteOrganizationsCancelButton = ButtonFactory::MakeForSecondaryAction(Dict::S('UI:Button:Cancel'));
$oFavoriteOrganizationsCancelButton = ButtonUIBlockFactory::MakeForSecondaryAction(Dict::S('UI:Button:Cancel'));
$oFavoriteOrganizationsToolBar->AddSubBlock($oFavoriteOrganizationsCancelButton);
$oFavoriteOrganizationsCancelButton->SetOnClickJsCode("window.location.href = '$sURL'");
// - Submit button
$oFavoriteOrganizationsSubmitButton = ButtonFactory::MakeForPrimaryAction(Dict::S('UI:Button:Apply'), 'operation', 'apply', true);
$oFavoriteOrganizationsSubmitButton = ButtonUIBlockFactory::MakeForPrimaryAction(Dict::S('UI:Button:Apply'), 'operation', 'apply', true);
$oFavoriteOrganizationsToolBar->AddSubBlock($oFavoriteOrganizationsSubmitButton);
if ($aFavoriteOrgs == null)
{
if ($aFavoriteOrgs == null) {
// All checked
$oP->add_ready_script(
<<<JS
@@ -200,11 +199,11 @@ JS
$oShortcutsToolBar = new UIContentBlock(null, 'ibo-datatable--selection-validation-buttons-toolbar');
$oShortcutsBlock->AddSubBlock($oShortcutsToolBar);
// - Rename button
$oShortcutsRenameButton = ButtonFactory::MakeForSecondaryAction(Dict::S('UI:Button:Rename'), null, null, false,
$oShortcutsRenameButton = ButtonUIBlockFactory::MakeForSecondaryAction(Dict::S('UI:Button:Rename'), null, null, false,
"shortcut_btn_rename");
$oShortcutsToolBar->AddSubBlock($oShortcutsRenameButton);
// - Delete button
$oShortcutsDeleteButton = ButtonFactory::MakeForSecondaryAction(Dict::S('UI:Button:Delete'), null, null, false,
$oShortcutsDeleteButton = ButtonUIBlockFactory::MakeForSecondaryAction(Dict::S('UI:Button:Delete'), null, null, false,
"shortcut_btn_delete");
$oShortcutsToolBar->AddSubBlock($oShortcutsDeleteButton);
}
@@ -273,13 +272,13 @@ JS
$sNewsroomHtml .= $oAppContext->GetForForm();
// - Reset button
$oNewsroomResetCacheButton = ButtonFactory::MakeForAlternativeDestructiveAction(Dict::S('UI:Newsroom:ResetCache'));
$oNewsroomResetCacheButton = ButtonUIBlockFactory::MakeForAlternativeDestructiveAction(Dict::S('UI:Newsroom:ResetCache'));
$oNewsroomResetCacheButton->SetOnClickJsCode("$('#ibo-navigation-menu--notifications-menu').newsroom_menu('clearCache')");
// - Cancel button
$oNewsroomCancelButton = ButtonFactory::MakeForSecondaryAction(Dict::S('UI:Button:Cancel'));
$oNewsroomCancelButton = ButtonUIBlockFactory::MakeForSecondaryAction(Dict::S('UI:Button:Cancel'));
$oNewsroomCancelButton->SetOnClickJsCode("window.location.href = '$sURL'");
// - Submit button
$oNewsroomSubmitButton = ButtonFactory::MakeForPrimaryAction(Dict::S('UI:Button:Apply'), 'operation',
$oNewsroomSubmitButton = ButtonUIBlockFactory::MakeForPrimaryAction(Dict::S('UI:Button:Apply'), 'operation',
'apply_newsroom_preferences', true);
@@ -302,20 +301,20 @@ JS
$oRichTextBlock = new Panel(Dict::S('UI:RichText:Preferences'), array(), 'grey', 'ibo-richtext');
$oRichTextForm = new Form();
$oRichTextForm->AddSubBlock(InputFactory::MakeForHidden('operation', 'apply_richtext_config'));
$oRichTextForm->AddSubBlock(InputUIBlockFactory::MakeForHidden('operation', 'apply_richtext_config'));
$sRichTextToolbarDefaultState = isset(utils::GetCkeditorPref()['toolbarStartupExpanded']) ? (bool)utils::GetCkeditorPref()['toolbarStartupExpanded'] : false;
$oRichTextToolbarDefaultStateInput = InputFactory::MakeForSelectWithLabel('toolbarexpanded', Dict::S('UI:RichText:ToolbarState'));
$oRichTextToolbarDefaultStateInput->GetInput()->AddOption(InputFactory::MakeForSelectOption('true', Dict::S('UI:RichText:ToolbarState:Expanded'), $sRichTextToolbarDefaultState));
$oRichTextToolbarDefaultStateInput->GetInput()->AddOption(InputFactory::MakeForSelectOption('false', Dict::S('UI:RichText:ToolbarState:Collapsed'), !$sRichTextToolbarDefaultState));
$oRichTextToolbarDefaultStateInput = InputUIBlockFactory::MakeForSelectWithLabel('toolbarexpanded', Dict::S('UI:RichText:ToolbarState'));
$oRichTextToolbarDefaultStateInput->GetInput()->AddOption(InputUIBlockFactory::MakeForSelectOption('true', Dict::S('UI:RichText:ToolbarState:Expanded'), $sRichTextToolbarDefaultState));
$oRichTextToolbarDefaultStateInput->GetInput()->AddOption(InputUIBlockFactory::MakeForSelectOption('false', Dict::S('UI:RichText:ToolbarState:Collapsed'), !$sRichTextToolbarDefaultState));
$oRichTextForm->AddSubBlock($oRichTextToolbarDefaultStateInput);
// - Cancel button
$oRichTextCancelButton = ButtonFactory::MakeForSecondaryAction(Dict::S('UI:Button:Cancel'));
$oRichTextCancelButton = ButtonUIBlockFactory::MakeForSecondaryAction(Dict::S('UI:Button:Cancel'));
$oRichTextCancelButton->SetOnClickJsCode("window.location.href = '$sURL'");
$oRichTextForm->AddSubBlock($oRichTextCancelButton);
// - Submit button
$oRichTextSubmitButton = ButtonFactory::MakeForPrimaryAction(Dict::S('UI:Button:Apply'), null, null, true);
$oRichTextSubmitButton = ButtonUIBlockFactory::MakeForPrimaryAction(Dict::S('UI:Button:Apply'), null, null, true);
$oRichTextForm->AddSubBlock($oRichTextSubmitButton);
$oRichTextBlock->AddSubBlock($oRichTextForm);
@@ -415,7 +414,7 @@ HTML
function GetUserLanguageForm(ApplicationContext $oAppContext, string $sURL): Form
{
$oUserLanguageForm = new Form();
$oUserLanguageForm->AddSubBlock(InputFactory::MakeForHidden('operation', 'apply_language'));
$oUserLanguageForm->AddSubBlock(InputUIBlockFactory::MakeForHidden('operation', 'apply_language'));
// Lang selector
$aLanguages = Dict::GetLanguages();
@@ -430,22 +429,22 @@ function GetUserLanguageForm(ApplicationContext $oAppContext, string $sURL): For
$aSortedLang[$aLang['description']] = $sCode;
}
ksort($aSortedLang);
$oUserLanguageBlockSelect = InputFactory::MakeForSelectWithLabel('language', Dict::S('UI:Favorites:SelectYourLanguage'));
$oUserLanguageBlockSelect = InputUIBlockFactory::MakeForSelectWithLabel('language', Dict::S('UI:Favorites:SelectYourLanguage'));
/** @var \Combodo\iTop\Application\UI\Base\Component\Input\Select $oUserLanguageBlockSelectInput */
$oUserLanguageBlockSelectInput = $oUserLanguageBlockSelect->GetInput();
foreach ($aSortedLang as $sCode) {
$bSelected = ($sCode == Dict::GetUserLanguage());
$oUserLanguageBlockSelectInput->AddOption(InputFactory::MakeForSelectOption($sCode, $aLanguages[$sCode]['description'].' ('.$aLanguages[$sCode]['localized_description'].')', $bSelected));
$oUserLanguageBlockSelectInput->AddOption(InputUIBlockFactory::MakeForSelectOption($sCode, $aLanguages[$sCode]['description'].' ('.$aLanguages[$sCode]['localized_description'].')', $bSelected));
}
$oUserLanguageForm->AddSubBlock($oUserLanguageBlockSelect);
$oUserLanguageForm->AddSubBlock($oAppContext->GetForFormBlock());
// - Cancel button
$oUserLanguageCancelButton = ButtonFactory::MakeForSecondaryAction(Dict::S('UI:Button:Cancel'));
$oUserLanguageCancelButton = ButtonUIBlockFactory::MakeForSecondaryAction(Dict::S('UI:Button:Cancel'));
$oUserLanguageCancelButton->SetOnClickJsCode("window.location.href = '$sURL'");
$oUserLanguageForm->AddSubBlock($oUserLanguageCancelButton);
// - Submit button
$oUserLanguageSubmitButton = ButtonFactory::MakeForPrimaryAction(Dict::S('UI:Button:Apply'), null, null, true);
$oUserLanguageSubmitButton = ButtonUIBlockFactory::MakeForPrimaryAction(Dict::S('UI:Button:Apply'), null, null, true);
$oUserLanguageForm->AddSubBlock($oUserLanguageSubmitButton);
return $oUserLanguageForm;
}

View File

@@ -17,8 +17,8 @@
* You should have received a copy of the GNU Affero General Public License
*/
use Combodo\iTop\Application\UI\Base\Component\Alert\AlertFactory;
use Combodo\iTop\Application\UI\Base\Component\Button\ButtonFactory;
use Combodo\iTop\Application\UI\Base\Component\Alert\AlertUIBlockFactory;
use Combodo\iTop\Application\UI\Base\Component\Button\ButtonUIBlockFactory;
use Combodo\iTop\Application\UI\Base\Component\CollapsibleSection\CollapsibleSection;
use Combodo\iTop\Application\UI\Base\Component\FieldSet\FieldSet;
use Combodo\iTop\Application\UI\Base\Component\Form\Form;
@@ -343,7 +343,7 @@ JS
}
}
catch (Exception $e) {
$oErrorAlert = AlertFactory::MakeForFailure(
$oErrorAlert = AlertUIBlockFactory::MakeForFailure(
Dict::Format('UI:RunQuery:Error', $e->getMessage()),
'<pre>'.$e->getTraceAsString().'</pre>'
);

View File

@@ -11,8 +11,8 @@ use ApplicationMenu;
use AttributeLinkedSet;
use BulkExport;
use BulkExportException;
use Combodo\iTop\Application\UI\Base\Component\DataTable\DataTableFactory;
use Combodo\iTop\Application\UI\Base\Component\DataTable\DataTableSettings;
use Combodo\iTop\Application\UI\Base\Component\DataTable\DataTableUIBlockFactory;
use DBObjectSearch;
use DBObjectSet;
use DBSearch;
@@ -161,7 +161,7 @@ class AjaxRenderController
$aColumns = utils::ReadParam('columns', array(), false, 'raw_data');
$sSelectMode = utils::ReadParam('select_mode', '');
$aClassAliases = utils::ReadParam('class_aliases', array());
$aResult = DataTableFactory::GetOptionsForRendering($aColumns, $sSelectMode, $sFilter, $iLength, $aClassAliases, $aExtraParams);
$aResult = DataTableUIBlockFactory::GetOptionsForRendering($aColumns, $sSelectMode, $sFilter, $iLength, $aClassAliases, $aExtraParams);
return $aResult;
}

View File

@@ -568,6 +568,7 @@ abstract class Controller
break;
}
$this->m_oTwig->addGlobal('UIBlockParent', [$this->m_oPage]);
$this->m_oTwig->addGlobal('oPage', $this->m_oPage);
}
/**

View File

@@ -1,72 +0,0 @@
<?php
/**
* @copyright Copyright (C) 2010-2021 Combodo SARL
* @license http://opensource.org/licenses/AGPL-3.0
*/
namespace Combodo\iTop\Application\TwigBase\UI\Component;
use Combodo\iTop\Application\TwigBase\UI\UIBlockHelper;
use Twig\Compiler;
use Twig\Error\SyntaxError;
use Twig\Node\Node;
class UIAlertNode extends Node
{
public function __construct($sType, $oParams, $oBody, $lineno = 0, $tag = null)
{
parent::__construct(['body' => $oBody], ['type' => $sType, 'params' => $oParams], $lineno, $tag);
}
public function compile(Compiler $compiler)
{
$sBlockVar = UIBlockHelper::GetBlockVarName('oAlert');
$oParams = $this->getAttribute('params');
$compiler
->addDebugInfo($this)
->write("\$aParams = ")
->subcompile($oParams)
->raw(";\n")
->write("\$sTitle = \$aParams['title'] ?? '';\n")
->write("\$sContent = \$aParams['content'] ?? '';\n")
->write("\$sId = \$aParams['id'] ?? null;\n");
$sType = $this->getAttribute('type');
switch ($sType) {
case 'ForInformation':
case 'Neutral':
case 'ForSuccess':
case 'ForWarning':
case 'ForDanger':
case 'ForFailure':
case 'WithBrandingPrimaryColor':
case 'WithBrandingSecondaryColor':
$compiler
->write("\${$sBlockVar} = Combodo\\iTop\\Application\\UI\\Base\\Component\\Alert\\AlertFactory::Make{$sType}(\$sTitle, \$sContent, \$sId);\n")
->write("if (!\$aParams['is_collapsible'] ?? true) {\n")
->indent()
->write("\${$sBlockVar}->SetIsCollapsible(false);\n")
->outdent()
->write("}\n")
->write("if (!\$aParams['is_closable'] ?? true) {\n")
->indent()
->write("\${$sBlockVar}->SetIsClosable(false);\n")
->outdent()
->write("}\n");
break;
// TODO 3.0 add other Factory methods
default:
throw new SyntaxError(sprintf('%s: Bad type "%s" for %s at line %d', $this->getTemplateName(), $sType, $this->tag, $this->lineno), $this->lineno, $this->getSourceContext());
}
$compiler
->write(UIBlockHelper::AddToParentBlock($sBlockVar))
->write(UIBlockHelper::PushParentBlock($sBlockVar))
->subcompile($this->getNode('body'))
->write(UIBlockHelper::PopParentBlock());
}
}

View File

@@ -1,50 +0,0 @@
<?php
/**
* @copyright Copyright (C) 2010-2021 Combodo SARL
* @license http://opensource.org/licenses/AGPL-3.0
*/
namespace Combodo\iTop\Application\TwigBase\UI\Component;
use Twig\Token;
use Twig\TokenParser\AbstractTokenParser;
class UIAlertParser extends AbstractTokenParser
{
/**
* @inheritDoc
*/
public function parse(Token $token)
{
$iLineno = $token->getLine();
$oStream = $this->parser->getStream();
$sType = $oStream->expect(Token::NAME_TYPE)->getValue();
$oParams = $this->parser->getExpressionParser()->parseExpression();
$oStream->expect(Token::BLOCK_END_TYPE);
$oBody = $this->parser->subparse([$this, 'decideForEnd'], true);
$oStream->expect(Token::BLOCK_END_TYPE);
return new UIAlertNode($sType, $oParams, $oBody, $iLineno, $this->getTag());
}
/**
* @inheritDoc
*/
public function getTag()
{
return 'UIAlert';
}
public function decideForEnd(Token $token)
{
return $token->test('EndUIAlert');
}
}

View File

@@ -1,48 +0,0 @@
<?php
/**
* @copyright Copyright (C) 2010-2021 Combodo SARL
* @license http://opensource.org/licenses/AGPL-3.0
*/
namespace Combodo\iTop\Application\TwigBase\UI\Component;
use Combodo\iTop\Application\TwigBase\UI\UIBlockHelper;
use Twig\Compiler;
use Twig\Error\SyntaxError;
use Twig\Node\Node;
class UIDataTableNode extends Node
{
public function __construct($sType, $oParams, $lineno = 0, $tag = null)
{
parent::__construct([], ['type' => $sType, 'params' => $oParams], $lineno, $tag);
}
public function compile(Compiler $compiler)
{
$sBlockVar = UIBlockHelper::GetBlockVarName('oDataTable');
$oParams = $this->getAttribute('params');
$sType = $this->getAttribute('type');
$compiler
->addDebugInfo($this)
->write("\$aParams = ")
->subcompile($oParams)
->raw(";\n");
switch ($sType) {
case 'ForResult':
$compiler
->write("\$sListId = \$aParams['list_id'] ?? '';\n")
->write("\$oSet = \$aParams['object_set'] ?? null;\n")
->write("\${$sBlockVar} = Combodo\\iTop\\Application\\UI\\Base\\Component\\DataTable\\DataTableFactory::Make{$sType}(\$context['UIBlockParent'][0], \$sListId, \$oSet);\n")
->write(UIBlockHelper::AddToParentBlock($sBlockVar));
break;
// TODO 3.0 add other Factory methods
default:
throw new SyntaxError(sprintf('%s: Bad type "%s" for %s at line %d', $this->getTemplateName(), $sType, $this->tag, $this->lineno), $this->lineno, $this->getSourceContext());
}
}
}

View File

@@ -1,41 +0,0 @@
<?php
/**
* @copyright Copyright (C) 2010-2021 Combodo SARL
* @license http://opensource.org/licenses/AGPL-3.0
*/
namespace Combodo\iTop\Application\TwigBase\UI\Component;
use Twig\Token;
use Twig\TokenParser\AbstractTokenParser;
class UIDataTableParser extends AbstractTokenParser
{
/**
* @inheritDoc
*/
public function parse(Token $token)
{
$iLineno = $token->getLine();
$oStream = $this->parser->getStream();
$sType = $oStream->expect(Token::NAME_TYPE)->getValue();
$oParams = $this->parser->getExpressionParser()->parseExpression();
$oStream->expect(Token::BLOCK_END_TYPE);
return new UIDataTableNode($sType, $oParams, $iLineno, $this->getTag());
}
/**
* @inheritDoc
*/
public function getTag()
{
return 'UIDataTable';
}
}

View File

@@ -1,57 +0,0 @@
<?php
/**
* @copyright Copyright (C) 2010-2021 Combodo SARL
* @license http://opensource.org/licenses/AGPL-3.0
*/
namespace Combodo\iTop\Application\TwigBase\UI\Component;
use Combodo\iTop\Application\TwigBase\UI\UIBlockHelper;
use Twig\Compiler;
use Twig\Error\SyntaxError;
use Twig\Node\Node;
class UIFieldNode extends Node
{
public function __construct($sType, $oParams, $oBody, $lineno = 0, $tag = null)
{
parent::__construct(['body' => $oBody], ['type' => $sType, 'params' => $oParams], $lineno, $tag);
}
public function compile(Compiler $compiler)
{
$sBlockVar = UIBlockHelper::GetBlockVarName('oField');
$oParams = $this->getAttribute('params');
$compiler
->addDebugInfo($this)
->write("\$aParams = ")
->subcompile($oParams)
->raw(";\n");
$sType = $this->getAttribute('type');
switch ($sType) {
case 'Small':
case 'Large':
$compiler
->write("\$sLabel = \$aParams['label'] ?? '';\n")
->write("\$sValue = \$aParams['value'] ?? '';\n")
->write("\$sValueId = \$aParams['value_id'] ?? null;\n")
->write("\${$sBlockVar} = Combodo\\iTop\\Application\\UI\\Base\\Component\\Field\\FieldFactory::Make{$sType}(\$sLabel, \$sValue);\n")
->write("\${$sBlockVar}->SetValueId(\$sValueId);\n");
break;
// TODO 3.0 add other Factory methods
default:
throw new SyntaxError(sprintf('%s: Bad type "%s" for %s at line %d', $this->getTemplateName(), $sType, $this->tag, $this->lineno), $this->lineno, $this->getSourceContext());
}
$compiler
->write(UIBlockHelper::AddToParentBlock($sBlockVar))
->write(UIBlockHelper::PushParentBlock($sBlockVar))
->subcompile($this->getNode('body'))
->write(UIBlockHelper::PopParentBlock());
}
}

View File

@@ -1,50 +0,0 @@
<?php
/**
* @copyright Copyright (C) 2010-2021 Combodo SARL
* @license http://opensource.org/licenses/AGPL-3.0
*/
namespace Combodo\iTop\Application\TwigBase\UI\Component;
use Twig\Token;
use Twig\TokenParser\AbstractTokenParser;
class UIFieldParser extends AbstractTokenParser
{
/**
* @inheritDoc
*/
public function parse(Token $token)
{
$iLineno = $token->getLine();
$oStream = $this->parser->getStream();
$sType = $oStream->expect(Token::NAME_TYPE)->getValue();
$oParams = $this->parser->getExpressionParser()->parseExpression();
$oStream->expect(Token::BLOCK_END_TYPE);
$oBody = $this->parser->subparse([$this, 'decideForEnd'], true);
$oStream->expect(Token::BLOCK_END_TYPE);
return new UIFieldNode($sType, $oParams, $oBody, $iLineno, $this->getTag());
}
/**
* @inheritDoc
*/
public function getTag()
{
return 'UIField';
}
public function decideForEnd(Token $token)
{
return $token->test('EndUIField');
}
}

View File

@@ -1,39 +0,0 @@
<?php
/**
* @copyright Copyright (C) 2010-2021 Combodo SARL
* @license http://opensource.org/licenses/AGPL-3.0
*/
namespace Combodo\iTop\Application\TwigBase\UI\Component;
use Combodo\iTop\Application\TwigBase\UI\UIBlockHelper;
use Twig\Compiler;
use Twig\Node\Node;
class UIFieldSetNode extends Node
{
public function __construct($oParams, $oBody, $lineno = 0, $tag = null)
{
parent::__construct(['body' => $oBody], ['params' => $oParams], $lineno, $tag);
}
public function compile(Compiler $compiler)
{
$sBlockVar = UIBlockHelper::GetBlockVarName('oFieldSet');
$oParams = $this->getAttribute('params');
$compiler
->addDebugInfo($this)
->write("\$aParams = ")
->subcompile($oParams)
->raw(";\n")
->write("\$sLegend = \$aParams['legend'] ?? '';\n")
->write("\$sId = \$aParams['id'] ?? null;\n")
->write("\${$sBlockVar} = new Combodo\\iTop\\Application\\UI\\Base\\Component\\FieldSet\\FieldSet(\$sLegend, \$sId);\n")
->write(UIBlockHelper::AddToParentBlock($sBlockVar))
->write(UIBlockHelper::PushParentBlock($sBlockVar))
->subcompile($this->getNode('body'))
->write(UIBlockHelper::PopParentBlock());
}
}

View File

@@ -1,47 +0,0 @@
<?php
/**
* @copyright Copyright (C) 2010-2021 Combodo SARL
* @license http://opensource.org/licenses/AGPL-3.0
*/
namespace Combodo\iTop\Application\TwigBase\UI\Component;
use Twig\Token;
use Twig\TokenParser\AbstractTokenParser;
class UIFieldSetParser extends AbstractTokenParser
{
/**
* @inheritDoc
*/
public function parse(Token $token)
{
$iLineno = $token->getLine();
$oStream = $this->parser->getStream();
$oParams = $this->parser->getExpressionParser()->parseExpression();
$oStream->expect(Token::BLOCK_END_TYPE);
$oBody = $this->parser->subparse([$this, 'decideForEnd'], true);
$oStream->expect(Token::BLOCK_END_TYPE);
return new UIFieldSetNode($oParams, $oBody, $iLineno, $this->getTag());
}
/**
* @inheritDoc
*/
public function getTag()
{
return 'UIFieldSet';
}
public function decideForEnd(Token $token)
{
return $token->test('EndUIFieldSet');
}
}

View File

@@ -1,39 +0,0 @@
<?php
/**
* @copyright Copyright (C) 2010-2021 Combodo SARL
* @license http://opensource.org/licenses/AGPL-3.0
*/
namespace Combodo\iTop\Application\TwigBase\UI\Component;
use Combodo\iTop\Application\TwigBase\UI\UIBlockHelper;
use Twig\Compiler;
use Twig\Node\Node;
class UIFormNode extends Node
{
public function __construct($oParams, $oBody, $lineno = 0, $tag = null)
{
parent::__construct(['body' => $oBody], ['params' => $oParams], $lineno, $tag);
}
public function compile(Compiler $compiler)
{
$sBlockVar = UIBlockHelper::GetBlockVarName('oForm');
$oParams = $this->getAttribute('params');
$compiler
->addDebugInfo($this)
->write("\$aParams = ")
->subcompile($oParams)
->raw(";\n")
->write("\$sId = \$aParams['id'] ?? null;\n")
->write("\${$sBlockVar} = new Combodo\\iTop\\Application\\UI\\Base\\Component\\Form\\Form(\$sId);\n")
->write(UIBlockHelper::AddToParentBlock($sBlockVar))
->write(UIBlockHelper::PushParentBlock($sBlockVar))
->subcompile($this->getNode('body'))
->write(UIBlockHelper::PopParentBlock());
}
}

View File

@@ -1,47 +0,0 @@
<?php
/**
* @copyright Copyright (C) 2010-2021 Combodo SARL
* @license http://opensource.org/licenses/AGPL-3.0
*/
namespace Combodo\iTop\Application\TwigBase\UI\Component;
use Twig\Token;
use Twig\TokenParser\AbstractTokenParser;
class UIFormParser extends AbstractTokenParser
{
/**
* @inheritDoc
*/
public function parse(Token $token)
{
$iLineno = $token->getLine();
$oStream = $this->parser->getStream();
$oParams = $this->parser->getExpressionParser()->parseExpression();
$oStream->expect(Token::BLOCK_END_TYPE);
$oBody = $this->parser->subparse([$this, 'decideForEnd'], true);
$oStream->expect(Token::BLOCK_END_TYPE);
return new UIFormNode($oParams, $oBody, $iLineno, $this->getTag());
}
/**
* @inheritDoc
*/
public function getTag()
{
return 'UIForm';
}
public function decideForEnd(Token $token)
{
return $token->test('EndUIForm');
}
}

View File

@@ -7,7 +7,6 @@
namespace Combodo\iTop\Application\TwigBase\UI\Component;
use Combodo\iTop\Application\TwigBase\UI\UIBlockHelper;
use Twig\Compiler;
use Twig\Node\Node;
@@ -26,6 +25,6 @@ class UIHtmlNode extends Node
->subcompile($this->getNode('body'))
->write("\$sHtml = ob_get_contents();\n")
->write("ob_end_clean();\n")
->write(UIBlockHelper::GetParentBlock()."->AddSubBlock(new Combodo\\iTop\\Application\\UI\\Base\\Component\\Html\\Html(\$sHtml));\n");
->write("end(\$context['UIBlockParent'])->AddSubBlock(new Combodo\\iTop\\Application\\UI\\Base\\Component\\Html\\Html(\$sHtml));\n");
}
}

View File

@@ -1,65 +0,0 @@
<?php
/**
* @copyright Copyright (C) 2010-2021 Combodo SARL
* @license http://opensource.org/licenses/AGPL-3.0
*/
namespace Combodo\iTop\Application\TwigBase\UI\Component;
use Combodo\iTop\Application\TwigBase\UI\UIBlockHelper;
use Twig\Compiler;
use Twig\Error\SyntaxError;
use Twig\Node\Node;
class UIInputNode extends Node
{
public function __construct($sType, $oParams, $lineno = 0, $tag = null)
{
parent::__construct([], ['type' => $sType, 'params' => $oParams], $lineno, $tag);
}
public function compile(Compiler $compiler)
{
$sBlockVar = UIBlockHelper::GetBlockVarName('oInput');
$oParams = $this->getAttribute('params');
$compiler
->addDebugInfo($this)
->write("\$aParams = ")
->subcompile($oParams)
->raw(";\n");
$sFactoryType = $this->getAttribute('type');
switch ($sFactoryType) {
case 'ForHidden':
$compiler
->write("\$sName = \$aParams['name'] ?? '';\n")
->write("\$sValue = \$aParams['value'] ?? '';\n")
->write("\$sId = \$aParams['id'] ?? null;\n")
->write("\${$sBlockVar} = Combodo\\iTop\\Application\\UI\\Base\\Component\\Input\\InputFactory::MakeForHidden(\$sName, \$sValue, \$sId);\n");
break;
case 'Standard':
$compiler
->write("\$sType = \$aParams['type'] ?? '';\n")
->write("\$sName = \$aParams['name'] ?? '';\n")
->write("\$sValue = \$aParams['value'] ?? '';\n")
->write("\$sId = \$aParams['id'] ?? null;\n")
->write("\${$sBlockVar} = Combodo\\iTop\\Application\\UI\\Base\\Component\\Input\\InputFactory::MakeStandard(\$sType, \$sName, \$sValue, \$sId);\n")
->write("if (\$aParams['checked'] ?? false) {\n")
->indent()
->write("\${$sBlockVar}->SetChecked(true);\n")
->outdent()
->write("}\n");
break;
// TODO 3.0 add other Factory methods
default:
throw new SyntaxError(sprintf('%s: Bad type "%s" for %s at line %d', $this->getTemplateName(), $sFactoryType, $this->tag, $this->lineno), $this->lineno, $this->getSourceContext());
}
$compiler->write(UIBlockHelper::AddToParentBlock($sBlockVar));
}
}

View File

@@ -1,43 +0,0 @@
<?php
/**
* @copyright Copyright (C) 2010-2021 Combodo SARL
* @license http://opensource.org/licenses/AGPL-3.0
*/
namespace Combodo\iTop\Application\TwigBase\UI\Component;
use Twig\Token;
use Twig\TokenParser\AbstractTokenParser;
class UIInputParser extends AbstractTokenParser
{
/**
* @inheritDoc
*/
public function parse(Token $token)
{
$iLineno = $token->getLine();
$oStream = $this->parser->getStream();
$sType = $oStream->expect(Token::NAME_TYPE)->getValue();
$oParams = $this->parser->getExpressionParser()->parseExpression();
$oStream->expect(Token::BLOCK_END_TYPE);
return new UIInputNode($sType, $oParams, $iLineno, $this->getTag());
}
/**
* @inheritDoc
*/
public function getTag()
{
return 'UIInput';
}
}

View File

@@ -1,50 +0,0 @@
<?php
/**
* @copyright Copyright (C) 2010-2021 Combodo SARL
* @license http://opensource.org/licenses/AGPL-3.0
*/
namespace Combodo\iTop\Application\TwigBase\UI\Component;
use Combodo\iTop\Application\TwigBase\UI\UIBlockHelper;
use Twig\Compiler;
use Twig\Error\SyntaxError;
use Twig\Node\Node;
class UITitleNode extends Node
{
public function __construct($sType, $oParams, $lineno = 0, $tag = null)
{
parent::__construct([], ['type' => $sType, 'params' => $oParams], $lineno, $tag);
}
public function compile(Compiler $compiler)
{
$sBlockVar = UIBlockHelper::GetBlockVarName('oTitle');
$oParams = $this->getAttribute('params');
$compiler
->addDebugInfo($this)
->write("\$aParams = ")
->subcompile($oParams)
->raw(";\n");
$sType = $this->getAttribute('type');
switch ($sType) {
case 'ForPage':
$compiler
->write("\$sTitle = \$aParams['title'] ?? '';\n")
->write("\$sId = \$aParams['id'] ?? null;\n")
->write("\${$sBlockVar} = Combodo\\iTop\\Application\\UI\\Base\\Component\\Title\\TitleFactory::Make{$sType}(\$sTitle, \$sId);\n");
break;
// TODO 3.0 add other Factory methods
default:
throw new SyntaxError(sprintf('%s: Bad type "%s" for %s at line %d', $this->getTemplateName(), $sType, $this->tag, $this->lineno), $this->lineno, $this->getSourceContext());
}
$compiler->write(UIBlockHelper::AddToParentBlock($sBlockVar));
}
}

View File

@@ -1,41 +0,0 @@
<?php
/**
* @copyright Copyright (C) 2010-2021 Combodo SARL
* @license http://opensource.org/licenses/AGPL-3.0
*/
namespace Combodo\iTop\Application\TwigBase\UI\Component;
use Twig\Token;
use Twig\TokenParser\AbstractTokenParser;
class UITitleParser extends AbstractTokenParser
{
/**
* @inheritDoc
*/
public function parse(Token $token)
{
$iLineno = $token->getLine();
$oStream = $this->parser->getStream();
$sType = $oStream->expect(Token::NAME_TYPE)->getValue();
$oParams = $this->parser->getExpressionParser()->parseExpression();
$oStream->expect(Token::BLOCK_END_TYPE);
return new UITitleNode($sType, $oParams, $iLineno, $this->getTag());
}
/**
* @inheritDoc
*/
public function getTag()
{
return 'UITitle';
}
}

View File

@@ -1,40 +0,0 @@
<?php
/**
* @copyright Copyright (C) 2010-2021 Combodo SARL
* @license http://opensource.org/licenses/AGPL-3.0
*/
namespace Combodo\iTop\Application\TwigBase\UI\Component;
use Combodo\iTop\Application\TwigBase\UI\UIBlockHelper;
use Twig\Compiler;
use Twig\Node\Node;
class UIContentBlockNode extends Node
{
public function __construct($oParams, $oBody, $lineno = 0, $tag = null)
{
parent::__construct(['body' => $oBody], ['params' => $oParams], $lineno, $tag);
}
public function compile(Compiler $compiler)
{
$sBlockVar = UIBlockHelper::GetBlockVarName('oContentBlock');
$oParams = $this->getAttribute('params');
$compiler
->addDebugInfo($this)
->write("\$aParams = ")
->subcompile($oParams)
->raw(";\n")
->write("\$sId = \$aParams['id'] ?? null;\n")
->write("\$sContainerClass = \$aParams['container_class'] ?? '';\n")
->write("\${$sBlockVar} = new Combodo\\iTop\\Application\\UI\\Base\\Layout\\UIContentBlock(\$sId, \$sContainerClass);\n")
->write(UIBlockHelper::AddToParentBlock($sBlockVar))
->write(UIBlockHelper::PushParentBlock($sBlockVar))
->subcompile($this->getNode('body'))
->write(UIBlockHelper::PopParentBlock());
}
}

View File

@@ -1,47 +0,0 @@
<?php
/**
* @copyright Copyright (C) 2010-2021 Combodo SARL
* @license http://opensource.org/licenses/AGPL-3.0
*/
namespace Combodo\iTop\Application\TwigBase\UI\Component;
use Twig\Token;
use Twig\TokenParser\AbstractTokenParser;
class UIContentBlockParser extends AbstractTokenParser
{
/**
* @inheritDoc
*/
public function parse(Token $token)
{
$iLineno = $token->getLine();
$oStream = $this->parser->getStream();
$oParams = $this->parser->getExpressionParser()->parseExpression();
$oStream->expect(Token::BLOCK_END_TYPE);
$oBody = $this->parser->subparse([$this, 'decideForEnd'], true);
$oStream->expect(Token::BLOCK_END_TYPE);
return new UIContentBlockNode($oParams, $oBody, $iLineno, $this->getTag());
}
/**
* @inheritDoc
*/
public function getTag()
{
return 'UIContentBlock';
}
public function decideForEnd(Token $token)
{
return $token->test('EndUIContentBlock');
}
}

View File

@@ -8,31 +8,40 @@
namespace Combodo\iTop\Application\TwigBase\UI;
use Combodo\iTop\Application\TwigBase\UI\Component\UIAlertParser;
use Combodo\iTop\Application\TwigBase\UI\Component\UIContentBlockParser;
use Combodo\iTop\Application\TwigBase\UI\Component\UIDataTableParser;
use Combodo\iTop\Application\TwigBase\UI\Component\UIFieldParser;
use Combodo\iTop\Application\TwigBase\UI\Component\UIFieldSetParser;
use Combodo\iTop\Application\TwigBase\UI\Component\UIFormParser;
use Combodo\iTop\Application\TwigBase\UI\Component\UIHtmlParser;
use Combodo\iTop\Application\TwigBase\UI\Component\UIInputParser;
use Combodo\iTop\Application\TwigBase\UI\Component\UITitleParser;
use Exception;
use ReflectionClass;
use Twig\Extension\AbstractExtension;
class UIBlockExtension extends AbstractExtension
{
private static $aFactoryClasses = null;
public function getTokenParsers()
{
return [
new UIHtmlParser(),
new UIContentBlockParser(),
new UIFieldSetParser(),
new UIFieldParser(),
new UIAlertParser(),
new UITitleParser(),
new UIDataTableParser(),
new UIFormParser(),
new UIInputParser(),
];
$aParsers = [new UIHtmlParser()];
$aClassMap = include APPROOT.'lib/composer/autoload_classmap.php';
if (is_null(self::$aFactoryClasses)) {
self::$aFactoryClasses = [];
$sInterface = "Combodo\\iTop\\Application\\UI\\Base\\iUIBlockFactory";
foreach ($aClassMap as $sPHPClass => $sPHPFile) {
if (strpos($sPHPClass, 'UIBlockFactory') !== false) {
try {
$oRefClass = new ReflectionClass($sPHPClass);
if ($oRefClass->implementsInterface($sInterface) && $oRefClass->isInstantiable()) {
self::$aFactoryClasses[] = $sPHPClass;
}
} catch (Exception $e) {
}
}
}
}
foreach (self::$aFactoryClasses as $sFactoryClass) {
$aParsers[] = new UIBlockParser($sFactoryClass);
}
return $aParsers;
}
}

View File

@@ -1,37 +0,0 @@
<?php
/**
* @copyright Copyright (C) 2010-2021 Combodo SARL
* @license http://opensource.org/licenses/AGPL-3.0
*/
namespace Combodo\iTop\Application\TwigBase\UI;
class UIBlockHelper
{
public static function PushParentBlock($sBlockVarName)
{
return "array_push(\$context['UIBlockParent'], \${$sBlockVarName});\n";
}
public static function PopParentBlock()
{
return "array_pop(\$context['UIBlockParent']);\n";
}
public static function GetParentBlock()
{
return "end(\$context['UIBlockParent'])";
}
public static function AddToParentBlock($sBlockVarName)
{
return "end(\$context['UIBlockParent'])->AddSubBlock(\${$sBlockVarName});\n";
}
public static function GetBlockVarName($sPrefix)
{
return str_replace('.', '', uniqid($sPrefix.'_', true));
}
}

View File

@@ -0,0 +1,114 @@
<?php
/**
* @copyright Copyright (C) 2010-2021 Combodo SARL
* @license http://opensource.org/licenses/AGPL-3.0
*/
namespace Combodo\iTop\Application\TwigBase\UI;
use ReflectionClass;
use ReflectionException;
use ReflectionMethod;
use Twig\Compiler;
use Twig\Error\SyntaxError;
use Twig\Node\Node;
use utils;
class UIBlockNode extends Node
{
/** @var string */
protected $sFactoryClass;
/** @var string */
protected $sBlockClass;
public function __construct($sFactoryClass, $sBlockClass, $sType, $oParams, $oBody, $lineno = 0, $tag = null)
{
parent::__construct(['body' => $oBody], ['type' => $sType, 'params' => $oParams], $lineno, $tag);
$this->sFactoryClass = $sFactoryClass;
$this->sBlockClass = $sBlockClass;
}
public function compile(Compiler $compiler)
{
$aClassPath = explode("\\", $this->sBlockClass);
$sClassName = end($aClassPath);
$sBlockVar = str_replace('.', '', uniqid('o'.$sClassName.'_', true));
$oParams = $this->getAttribute('params');
$compiler
->addDebugInfo($this)
->write("\$aParams = ")
->subcompile($oParams)
->raw(";\n");
// Get factory and method to call
$sType = $this->getAttribute('type');
$oReflectionClass = new ReflectionClass($this->sFactoryClass);
try {
$oMethod = $oReflectionClass->getMethod("Make{$sType}");
} catch (ReflectionException $e) {
throw new SyntaxError(sprintf('%s: Bad type "%s" for %s at line %d', $this->getTemplateName(), $sType, $this->getNodeTag(), $this->getTemplateLine()), $this->getTemplateLine(), $this->getSourceContext());
}
if (!$oMethod->isPublic() || !$oMethod->isStatic()) {
throw new SyntaxError(sprintf('%s: Bad type "%s" for %s at line %d', $this->getTemplateName(), $sType, $this->getNodeTag(), $this->getTemplateLine()), $this->getTemplateLine(), $this->getSourceContext());
}
$aParameters = $oMethod->getParameters();
foreach ($aParameters as $oParameter) {
$sName = $oParameter->getName();
if ($oParameter->isOptional()) {
$sDefault = $oParameter->getDefaultValue();
$sDefault = var_export($sDefault, true);
$compiler->write("\${$sName} = \$aParams['{$sName}'] ?? {$sDefault};\n");
} else {
$compiler
->write("if (!isset(\$aParams['{$sName}'])) {\n")
->indent()->write("throw new Exception('{$this->getTemplateName()}: Missing parameter {$sName} for {$this->getNodeTag()} at line {$this->getTemplateLine()}');\n")->outdent()
->write("}\n")
->write("\${$sName} = \$aParams['{$sName}'];\n");
}
}
// Call the factory
$compiler->write("\${$sBlockVar} = {$this->sFactoryClass}::Make{$sType}(");
$bIsFirst = true;
foreach ($aParameters as $oParameter) {
$sName = $oParameter->getName();
if ($bIsFirst) {
$bIsFirst = false;
} else {
$compiler->write(", ");
}
$compiler->write("\${$sName}");
}
$compiler->write(");\n");
// Call the setters if exists
$aSetters = [];
$oRefClass = new ReflectionClass($this->sBlockClass);
$aMethods = $oRefClass->getMethods(ReflectionMethod::IS_PUBLIC);
foreach ($aMethods as $oMethod) {
if (!$oMethod->isStatic() && utils::StartsWith($oMethod->getName(), 'Set')) {
$aSetters[] = substr($oMethod->getName(), 3); // remove 'Set' to get the variable name
}
}
foreach ($aSetters as $sSetter) {
$compiler
->write("if (isset(\$aParams['{$sSetter}'])) {\n")
->indent()->write("\${$sBlockVar}->Set{$sSetter}(\$aParams['{$sSetter}']);\n")->outdent()
->write("}\n");
}
// Attach to parent UIBlock
$compiler->write("end(\$context['UIBlockParent'])->AddSubBlock(\${$sBlockVar});\n");
// Add sub UIBlocks
$oSubNode = $this->getNode('body');
if ($oSubNode) {
$compiler
->write("array_push(\$context['UIBlockParent'], \${$sBlockVar});\n")
->subcompile($oSubNode)
->write("array_pop(\$context['UIBlockParent']);\n");
}
}
}

View File

@@ -0,0 +1,77 @@
<?php
/**
* @copyright Copyright (C) 2010-2021 Combodo SARL
* @license http://opensource.org/licenses/AGPL-3.0
*/
namespace Combodo\iTop\Application\TwigBase\UI;
use Twig\Token;
use Twig\TokenParser\AbstractTokenParser;
class UIBlockParser extends AbstractTokenParser
{
/** @var string */
protected $sTag;
/** @var string */
protected $sFactoryClass;
/** @var bool */
protected $bHasSubBlocks;
/** @var string */
protected $sBlockClassName;
/**
* UIBlockParser constructor.
*
* @param string $sFactoryClass
*/
public function __construct(string $sFactoryClass)
{
$this->sFactoryClass = $sFactoryClass;
$this->sTag = call_user_func([$sFactoryClass, 'GetTwigTagName']);
$this->sBlockClassName = call_user_func([$sFactoryClass, 'GetUIBlockClassName']);
$this->bHasSubBlocks = is_subclass_of($this->sBlockClassName, "Combodo\\iTop\\Application\\UI\\Base\\Layout\\UIContentBlock") || $this->sBlockClassName == "Combodo\\iTop\\Application\\UI\\Base\\Layout\\UIContentBlock";
}
/**
* @inheritDoc
*/
public function parse(Token $token)
{
$iLineno = $token->getLine();
$oStream = $this->parser->getStream();
$sType = $oStream->expect(Token::NAME_TYPE)->getValue();
$oParams = $this->parser->getExpressionParser()->parseExpression();
$oStream->expect(Token::BLOCK_END_TYPE);
if ($this->bHasSubBlocks) {
$oBody = $this->parser->subparse([$this, 'decideForEnd'], true);
$oStream->expect(Token::BLOCK_END_TYPE);
} else {
$oBody = null;
}
return new UIBlockNode($this->sFactoryClass, $this->sBlockClassName, $sType, $oParams, $oBody, $iLineno, $this->getTag());
}
/**
* @inheritDoc
*/
public function getTag()
{
return $this->sTag;
}
public function decideForEnd(Token $token)
{
return $token->test('End'.$this->sTag);
}
}

View File

@@ -0,0 +1,25 @@
<?php
/**
* @copyright Copyright (C) 2010-2021 Combodo SARL
* @license http://opensource.org/licenses/AGPL-3.0
*/
namespace Combodo\iTop\Application\UI\Base;
abstract class AbstractUIBlockFactory implements iUIBlockFactory
{
public const TWIG_TAG_NAME = 'UIBlock';
public const UI_BLOCK_CLASS_NAME = "Combodo\\iTop\\Application\\UI\\Base\\UIBlock";
public static function GetTwigTagName(): string
{
return static::TWIG_TAG_NAME;
}
public static function GetUIBlockClassName(): string
{
return static::UI_BLOCK_CLASS_NAME;
}
}

View File

@@ -19,8 +19,10 @@
namespace Combodo\iTop\Application\UI\Base\Component\Alert;
use Combodo\iTop\Application\UI\Base\AbstractUIBlockFactory;
/**
* Class AlertFactory
* Class AlertUIBlockFactory
*
* @author Guillaume Lajarige <guillaume.lajarige@combodo.com>
* @package Combodo\iTop\Application\UI\Base\Component\Alert
@@ -28,8 +30,11 @@ namespace Combodo\iTop\Application\UI\Base\Component\Alert;
*
* @link <itop_url>/test/VisualTest/Backoffice/RenderAllUiBlocks.php#title-alerts to see live examples
*/
class AlertFactory
class AlertUIBlockFactory extends AbstractUIBlockFactory
{
public const TWIG_TAG_NAME = 'UIAlert';
public const UI_BLOCK_CLASS_NAME = "Combodo\\iTop\\Application\\UI\\Base\\Component\\Alert\\Alert";
/**
* Make a basis Alert component
*
@@ -39,7 +44,7 @@ class AlertFactory
*
* @return \Combodo\iTop\Application\UI\Base\Component\Alert\Alert
*/
public static function MakeNeutral(string $sTitle, string $sContent, ?string $sId = null)
public static function MakeNeutral(string $sTitle = '', string $sContent = '', ?string $sId = null)
{
return new Alert($sTitle, $sContent, Alert::ENUM_COLOR_NEUTRAL, $sId);
}
@@ -53,7 +58,7 @@ class AlertFactory
*
* @return \Combodo\iTop\Application\UI\Base\Component\Alert\Alert
*/
public static function MakeForInformation(string $sTitle, string $sContent, ?string $sId = null)
public static function MakeForInformation(string $sTitle = '', string $sContent = '', ?string $sId = null)
{
return new Alert($sTitle, $sContent, Alert::ENUM_COLOR_INFORMATION, $sId);
@@ -68,7 +73,7 @@ class AlertFactory
*
* @return \Combodo\iTop\Application\UI\Base\Component\Alert\Alert
*/
public static function MakeForSuccess(string $sTitle, string $sContent, ?string $sId = null)
public static function MakeForSuccess(string $sTitle = '', string $sContent = '', ?string $sId = null)
{
return new Alert($sTitle, $sContent, Alert::ENUM_COLOR_SUCCESS, $sId);
}
@@ -82,7 +87,7 @@ class AlertFactory
*
* @return \Combodo\iTop\Application\UI\Base\Component\Alert\Alert
*/
public static function MakeForWarning(string $sTitle, string $sContent, ?string $sId = null)
public static function MakeForWarning(string $sTitle = '', string $sContent = '', ?string $sId = null)
{
return new Alert($sTitle, $sContent, Alert::ENUM_COLOR_WARNING, $sId);
}
@@ -96,7 +101,7 @@ class AlertFactory
*
* @return \Combodo\iTop\Application\UI\Base\Component\Alert\Alert
*/
public static function MakeForDanger(string $sTitle, string $sContent, ?string $sId = null)
public static function MakeForDanger(string $sTitle = '', string $sContent = '', ?string $sId = null)
{
return new Alert($sTitle, $sContent, Alert::ENUM_COLOR_DANGER, $sId);
}
@@ -110,7 +115,7 @@ class AlertFactory
*
* @return \Combodo\iTop\Application\UI\Base\Component\Alert\Alert
*/
public static function MakeForFailure(string $sTitle, string $sContent, ?string $sId = null)
public static function MakeForFailure(string $sTitle = '', string $sContent = '', ?string $sId = null)
{
return new Alert($sTitle, $sContent, Alert::ENUM_COLOR_FAILURE, $sId);
}
@@ -124,7 +129,7 @@ class AlertFactory
*
* @return \Combodo\iTop\Application\UI\Base\Component\Alert\Alert
*/
public static function MakeWithBrandingPrimaryColor(string $sTitle, string $sContent, ?string $sId = null)
public static function MakeWithBrandingPrimaryColor(string $sTitle = '', string $sContent = '', ?string $sId = null)
{
return new Alert($sTitle, $sContent, Alert::ENUM_COLOR_PRIMARY, $sId);
}
@@ -138,7 +143,7 @@ class AlertFactory
*
* @return \Combodo\iTop\Application\UI\Base\Component\Alert\Alert
*/
public static function MakeWithBrandingSecondaryColor(string $sTitle, string $sContent, ?string $sId = null)
public static function MakeWithBrandingSecondaryColor(string $sTitle = '', string $sContent = '', ?string $sId = null)
{
return new Alert($sTitle, $sContent, Alert::ENUM_COLOR_SECONDARY, $sId);
}

View File

@@ -19,8 +19,10 @@
namespace Combodo\iTop\Application\UI\Base\Component\Button;
use Combodo\iTop\Application\UI\Base\AbstractUIBlockFactory;
/**
* Class ButtonFactory
* Class ButtonUIBlockFactory
*
* @internal
* @author Guillaume Lajarige <guillaume.lajarige@combodo.com>
@@ -29,8 +31,11 @@ namespace Combodo\iTop\Application\UI\Base\Component\Button;
*
* @link <itop_url>/test/VisualTest/Backoffice/RenderAllUiBlocks.php#title-buttons to see live examples
*/
class ButtonFactory
class ButtonUIBlockFactory extends AbstractUIBlockFactory
{
public const TWIG_TAG_NAME = 'UIButton';
public const UI_BLOCK_CLASS_NAME = "Combodo\\iTop\\Application\\UI\\Base\\Component\\Button\\Button";
//---------------------------------------------
// Regular action buttons, mostly used in forms
//---------------------------------------------
@@ -273,8 +278,7 @@ class ButtonFactory
public static function MakeLinkNeutral(
string $sURL, ?string $sLabel = null, ?string $sIconClasses = null, ?string $sName = null, ?string $sTarget = null,
?string $sId = null
): Button
{
): Button {
$sType = empty($sIconClasses) ? Button::ENUM_ACTION_TYPE_REGULAR : Button::ENUM_ACTION_TYPE_ALTERNATIVE;
$oButton = static::MakeForAction($sLabel, Button::ENUM_COLOR_NEUTRAL, $sType, null, $sName, false, $sId);
@@ -305,8 +309,7 @@ class ButtonFactory
public static function MakeIconLink(
string $sIconClasses, string $sTooltipText, ?string $sURL = null, ?string $sName = null, ?string $sTarget = null,
?string $sId = null
)
{
) {
$oButton = static::MakeForAction('', Button::ENUM_COLOR_NEUTRAL, Button::ENUM_ACTION_TYPE_ALTERNATIVE, null, $sName, false, $sId);
$oButton->SetIconClass($sIconClasses);
$oButton->SetTooltip($sTooltipText);

View File

@@ -10,11 +10,12 @@ use ApplicationException;
use appUserPreferences;
use AttributeLinkedSet;
use cmdbAbstractObject;
use Combodo\iTop\Application\UI\Base\AbstractUIBlockFactory;
use Combodo\iTop\Application\UI\Base\Component\DataTable\StaticTable\FormTable\FormTable;
use Combodo\iTop\Application\UI\Base\Component\DataTable\StaticTable\FormTableRow\FormTableRow;
use Combodo\iTop\Application\UI\Base\Component\DataTable\StaticTable\StaticTable;
use Combodo\iTop\Application\UI\Base\Component\Panel\PanelFactory;
use Combodo\iTop\Application\UI\Base\Component\Title\TitleFactory;
use Combodo\iTop\Application\UI\Base\Component\Title\TitleUIBlockFactory;
use Combodo\iTop\Application\UI\Base\Component\Toolbar\Toolbar;
use Combodo\iTop\Application\UI\Base\Layout\UIContentBlock;
use DBObjectSet;
@@ -26,15 +27,17 @@ use utils;
use WebPage;
/**
* Class DataTableFactory
* Class DataTableUIBlockFactory
*
* @internal
* @package Combodo\iTop\Application\UI\Base\Component\DataTable
* @since 3.0.0
*/
class DataTableFactory
class DataTableUIBlockFactory extends AbstractUIBlockFactory
{
public const TWIG_TAG_NAME = 'UIDataTable';
public const UI_BLOCK_CLASS_NAME = "Combodo\\iTop\\Application\\UI\\Base\\Component\\DataTable\\DataTable";
/**
* @param \WebPage $oPage
* @param string $sListId
@@ -55,7 +58,7 @@ class DataTableFactory
*/
public static function MakeForResult(WebPage $oPage, string $sListId, DBObjectSet $oSet, $aExtraParams = array())
{
$oDataTable = DataTableFactory::MakeForRendering($sListId, $oSet, $aExtraParams);
$oDataTable = DataTableUIBlockFactory::MakeForRendering($sListId, $oSet, $aExtraParams);
return self::RenderDataTable($oDataTable, 'list', $oPage, $sListId, $oSet, $aExtraParams);
}
@@ -78,7 +81,7 @@ class DataTableFactory
*/
public static function MakeForObject(WebPage $oPage, string $sListId, DBObjectSet $oSet, $aExtraParams = array())
{
$oDataTable = DataTableFactory::MakeForRenderingObject($sListId, $oSet, $aExtraParams);
$oDataTable = DataTableUIBlockFactory::MakeForRenderingObject($sListId, $oSet, $aExtraParams);
return self::RenderDataTable($oDataTable, 'listInObject', $oPage, $sListId, $oSet, $aExtraParams);
}
@@ -750,7 +753,7 @@ class DataTableFactory
public static function MakeForStaticData(string $sTitle, array $aColumns, array $aData, ?string $sId = null)
{
$oBlock = new UIContentBlock();
$oTitle = TitleFactory::MakeNeutral($sTitle, 3);
$oTitle = TitleUIBlockFactory::MakeNeutral($sTitle, 3);
$oBlock->AddSubBlock($oTitle);
$oTable = new StaticTable($sId);
$oTable->SetColumns($aColumns);

View File

@@ -7,14 +7,18 @@
namespace Combodo\iTop\Application\UI\Base\Component\Field;
use Combodo\iTop\Application\UI\Base\AbstractUIBlockFactory;
use Combodo\iTop\Application\UI\Base\Component\Html\Html;
use Combodo\iTop\Application\UI\Base\UIBlock;
/**
* @since 3.0.0
*/
class FieldFactory
class FieldUIBlockFactory extends AbstractUIBlockFactory
{
public const TWIG_TAG_NAME = 'UIField';
public const UI_BLOCK_CLASS_NAME = "Combodo\\iTop\\Application\\UI\\Base\\Component\\Field\\Field";
public static function MakeFromParams($aParams)
{
$oValue = new Html($aParams['value']);
@@ -86,5 +90,11 @@ class FieldFactory
return $oField;
}
public static function MakeStandard(string $sLabel = '', string $sLayout = Field::ENUM_FIELD_LAYOUT_SMALL, ?string $sId = null)
{
$oField = new Field($sLabel, null, $sId);
$oField->SetLayout($sLayout);
return $oField;
}
}

View File

@@ -19,8 +19,8 @@ class FieldBadge extends UIContentBlock
// Overloaded constants
public const BLOCK_CODE = 'ibo-field-badge';
public function __construct(string $sName = null, string $sContainerClass = '')
public function __construct(string $sId = null, string $sContainerClass = '')
{
parent::__construct($sName, $sContainerClass);
parent::__construct($sId, $sContainerClass);
}
}

View File

@@ -0,0 +1,22 @@
<?php
/**
* @copyright Copyright (C) 2010-2021 Combodo SARL
* @license http://opensource.org/licenses/AGPL-3.0
*/
namespace Combodo\iTop\Application\UI\Base\Component\FieldSet;
use Combodo\iTop\Application\UI\Base\AbstractUIBlockFactory;
class FieldSetUIBlockFactory extends AbstractUIBlockFactory
{
public const UI_BLOCK_CLASS_NAME = "Combodo\\iTop\\Application\\UI\\Base\\Component\\FieldSet\\FieldSet";
public const TWIG_TAG_NAME = 'UIFieldSet';
public static function MakeStandard(string $sLegend, ?string $sId = null): FieldSet
{
return new FieldSet($sLegend, $sId);
}
}

View File

@@ -25,9 +25,9 @@ class Form extends UIContentBlock
/** @var string */
protected $sAction;
public function __construct(string $sName = null)
public function __construct(string $sId = null)
{
parent::__construct($sName);
parent::__construct($sId);
$this->sOnSubmitJsCode = null;
$this->sAction = null;
}

View File

@@ -0,0 +1,22 @@
<?php
/**
* @copyright Copyright (C) 2010-2021 Combodo SARL
* @license http://opensource.org/licenses/AGPL-3.0
*/
namespace Combodo\iTop\Application\UI\Base\Component\Form;
use Combodo\iTop\Application\UI\Base\AbstractUIBlockFactory;
class FormUIBlockFactory extends AbstractUIBlockFactory
{
public const UI_BLOCK_CLASS_NAME = "Combodo\\iTop\\Application\\UI\\Base\\Component\\Form\\Form";
public const TWIG_TAG_NAME = 'UIForm';
public static function MakeStandard(string $sId = null)
{
return new Form($sId);
}
}

View File

@@ -8,12 +8,15 @@
namespace Combodo\iTop\Application\UI\Base\Component\Input;
use Combodo\iTop\Application\UI\Base\AbstractUIBlockFactory;
use Combodo\iTop\Application\UI\Base\Component\Field\Field;
use Combodo\iTop\Application\UI\Base\Component\Input\Select\Select;
use Combodo\iTop\Application\UI\Base\Component\Input\Select\SelectOption;
class InputFactory
class InputUIBlockFactory extends AbstractUIBlockFactory
{
public const TWIG_TAG_NAME = 'UIInput';
public const UI_BLOCK_CLASS_NAME = "Combodo\\iTop\\Application\\UI\\Base\\Component\\Input\\Input";
public static function MakeForHidden(string $sName, string $sValue, ?string $sId = null): Input
{

View File

@@ -8,12 +8,15 @@
namespace Combodo\iTop\Application\UI\Base\Component\Title;
use Combodo\iTop\Application\UI\Base\AbstractUIBlockFactory;
use Combodo\iTop\Application\UI\Helper\UIHelper;
use DBObject;
use MetaModel;
class TitleFactory
class TitleUIBlockFactory extends AbstractUIBlockFactory
{
public const UI_BLOCK_CLASS_NAME = "Combodo\\iTop\\Application\\UI\\Base\\Component\\Title\\Title";
public const TWIG_TAG_NAME = 'UITitle';
public static function MakeForPage(string $sTitle, ?string $sId = null)
{

View File

@@ -62,11 +62,11 @@ class CaseLogEntryForm extends UIContentBlock
/**
* CaseLogEntryForm constructor.
*
* @param null $sName
* @param null $sId
*/
public function __construct($sName = null)
public function __construct($sId = null)
{
parent::__construct($sName);
parent::__construct($sId);
$this->sSubmitMode = static::DEFAULT_SUBMIT_MODE;
$this->sContainerTabType = static::DEFAULT_CONTAINER_TAB_TYPE;
$this->SetTextInput(new RichText());

View File

@@ -10,7 +10,7 @@ namespace Combodo\iTop\Application\UI\Base\Layout\ActivityPanel\CaseLogEntryForm
use cmdbAbstractObject;
use Combodo\iTop\Application\UI\Base\Component\Button\Button;
use Combodo\iTop\Application\UI\Base\Component\Button\ButtonFactory;
use Combodo\iTop\Application\UI\Base\Component\Button\ButtonUIBlockFactory;
use Combodo\iTop\Application\UI\Base\Component\PopoverMenu\PopoverMenu;
use Combodo\iTop\Application\UI\Base\Component\PopoverMenu\PopoverMenuItem\PopoverMenuItemFactory;
use Combodo\iTop\Application\UI\Base\Layout\ActivityPanel\CaseLogEntryForm\CaseLogEntryForm;
@@ -60,7 +60,7 @@ class CaseLogEntryFormFactory
*/
protected static function PrepareCancelButton(): Button
{
return ButtonFactory::MakeForSecondaryAction(Dict::S('UI:Button:Cancel'), 'cancel', 'cancel');
return ButtonUIBlockFactory::MakeForSecondaryAction(Dict::S('UI:Button:Cancel'), 'cancel', 'cancel');
}
/**
@@ -68,7 +68,7 @@ class CaseLogEntryFormFactory
*/
protected static function PrepareSendButton(): Button
{
$oButton = ButtonFactory::MakeForPrimaryAction(Dict::S('UI:Button:Send'), 'send', 'send');
$oButton = ButtonUIBlockFactory::MakeForPrimaryAction(Dict::S('UI:Button:Send'), 'send', 'send');
$oButton->SetIconClass('fas fa-paper-plane');
return $oButton;

View File

@@ -68,22 +68,22 @@ class TabContainer extends UIContentBlock
/**
* TabContainer constructor.
*
* @param string $sName
* @param string $sId
* @param string $sPrefix
*
* @throws \CoreException
* @throws \CoreUnexpectedValue
* @throws \MySQLException
*/
public function __construct($sName, $sPrefix)
public function __construct($sId, $sPrefix)
{
$sId = null;
if (!empty($sName) || !empty($sPrefix)) {
$sId = "{$sName}".((!empty($sPrefix)) ? "-{$sPrefix}" : "");
if (!empty($sId) || !empty($sPrefix)) {
$sId = "{$sId}".((!empty($sPrefix)) ? "-{$sPrefix}" : "");
}
parent::__construct($sId);
$this->sName = $sName;
$this->sName = $sId;
$this->sPrefix = $sPrefix;
$this->sLayout = appUserPreferences::GetPref('tab_layout', static::DEFAULT_LAYOUT);
$this->bIsScrollable = appUserPreferences::GetPref('tab_scrollable', static::DEFAULT_SCROLLABLE);

View File

@@ -39,12 +39,12 @@ class UIContentBlock extends UIBlock implements iUIContentBlock
* UIContentBlock constructor.
* Generates a <div> only if $sContainerClass if not empty or block has data attributes
*
* @param string|null $sName
* @param string|null $sId
* @param string $sContainerClass
*/
public function __construct(string $sName = null, string $sContainerClass = '')
public function __construct(string $sId = null, string $sContainerClass = '')
{
parent::__construct($sName);
parent::__construct($sId);
$this->aSubBlocks = [];
$this->aDeferredBlocks = [];

View File

@@ -0,0 +1,22 @@
<?php
/**
* @copyright Copyright (C) 2010-2021 Combodo SARL
* @license http://opensource.org/licenses/AGPL-3.0
*/
namespace Combodo\iTop\Application\UI\Base\Layout;
use Combodo\iTop\Application\UI\Base\AbstractUIBlockFactory;
class UIContentBlockUIBlockFactory extends AbstractUIBlockFactory
{
public const UI_BLOCK_CLASS_NAME = "Combodo\\iTop\\Application\\UI\\Base\\Layout\\UIContentBlock";
public const TWIG_TAG_NAME = 'UIContentBlock';
public static function MakeStandard(string $sId = null, string $sContainerClass = '')
{
return new UIContentBlock($sId, $sContainerClass);
}
}

View File

@@ -0,0 +1,16 @@
<?php
/**
* @copyright Copyright (C) 2010-2021 Combodo SARL
* @license http://opensource.org/licenses/AGPL-3.0
*/
namespace Combodo\iTop\Application\UI\Base;
interface iUIBlockFactory
{
public static function GetTwigTagName(): string;
public static function GetUIBlockClassName(): string;
}

View File

@@ -7,8 +7,8 @@
namespace Combodo\iTop\Application\UI\Links\Indirect\BlockIndirectLinksEdit;
use Combodo\iTop\Application\UI\Base\Component\Button\ButtonFactory;
use Combodo\iTop\Application\UI\Base\Component\Input\InputFactory;
use Combodo\iTop\Application\UI\Base\Component\Button\ButtonUIBlockFactory;
use Combodo\iTop\Application\UI\Base\Component\Input\InputUIBlockFactory;
use Combodo\iTop\Application\UI\Base\Component\Toolbar\Toolbar;
use Combodo\iTop\Application\UI\Base\Layout\UIContentBlock;
use Dict;
@@ -52,15 +52,15 @@ class BlockIndirectLinksEdit extends UIContentBlock
public function AddControls()
{
$this->AddSubBlock(InputFactory::MakeForHidden("{$this->sFormPrefix}{$this->iInputId}", '', "{$this->sFormPrefix}{$this->iInputId}"));
$this->AddSubBlock(InputUIBlockFactory::MakeForHidden("{$this->sFormPrefix}{$this->iInputId}", '', "{$this->sFormPrefix}{$this->iInputId}"));
$oToolbar = new Toolbar(null, 'ibo-datatable--selection-validation-buttons-toolbar');
$this->AddSubBlock($oToolbar);
$oRemoveButton = ButtonFactory::MakeForSecondaryAction(Dict::S('UI:RemoveLinkedObjectsOf_Class'), null, null, false, "{$this->sLinkedSetId}_btnRemove");
$oRemoveButton = ButtonUIBlockFactory::MakeForSecondaryAction(Dict::S('UI:RemoveLinkedObjectsOf_Class'), null, null, false, "{$this->sLinkedSetId}_btnRemove");
$oRemoveButton->SetOnClickJsCode("oWidget{$this->iInputId}.RemoveSelected();");
$oToolbar->AddSubBlock($oRemoveButton);
$oAddButton = ButtonFactory::MakeForSecondaryAction(Dict::Format('UI:AddLinkedObjectsOf_Class', MetaModel::GetName($this->sRemoteClass)), null, null, false, "{$this->sLinkedSetId}_btnAdd");
$oAddButton = ButtonUIBlockFactory::MakeForSecondaryAction(Dict::Format('UI:AddLinkedObjectsOf_Class', MetaModel::GetName($this->sRemoteClass)), null, null, false, "{$this->sLinkedSetId}_btnAdd");
$oAddButton->SetOnClickJsCode("oWidget{$this->iInputId}.AddObjects();");
$oToolbar->AddSubBlock($oAddButton);

View File

@@ -7,9 +7,9 @@
namespace Combodo\iTop\Application\UI\Links\Indirect\BlockObjectPickerDialog;
use Combodo\iTop\Application\UI\Base\Component\Button\ButtonFactory;
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\InputFactory;
use Combodo\iTop\Application\UI\Base\Component\Input\InputUIBlockFactory;
use Combodo\iTop\Application\UI\Base\Component\Toolbar\Toolbar;
use Combodo\iTop\Application\UI\Base\Layout\UIContentBlock;
use Dict;
@@ -42,15 +42,15 @@ class BlockObjectPickerDialog extends UIContentBlock
$oForm->AddSubBlock($oBlock);
$oBlock->AddHtml("<p>{$sEmptyList}</p>");
$oForm->AddSubBlock(InputFactory::MakeForHidden("count_{$this->sLinkedSetId}", '0', "count_{$this->sLinkedSetId}"));
$oForm->AddSubBlock(InputUIBlockFactory::MakeForHidden("count_{$this->sLinkedSetId}", '0', "count_{$this->sLinkedSetId}"));
$oToolbar = new Toolbar(null, 'ibo-datatable--selection-validation-buttons-toolbar');
$this->AddSubBlock($oToolbar);
$oRemoveButton = ButtonFactory::MakeForSecondaryAction($sCancel, null, null, false);
$oRemoveButton = ButtonUIBlockFactory::MakeForSecondaryAction($sCancel, null, null, false);
$oRemoveButton->SetOnClickJsCode("$('#dlg_{$this->sLinkedSetId}').dialog('close');");
$oToolbar->AddSubBlock($oRemoveButton);
$oAddButton = ButtonFactory::MakeForSecondaryAction($sAdd, null, null, false, "btn_ok_{$this->sLinkedSetId}");
$oAddButton = ButtonUIBlockFactory::MakeForSecondaryAction($sAdd, null, null, false, "btn_ok_{$this->sLinkedSetId}");
$oAddButton->SetIsDisabled(true)
->SetOnClickJsCode("return oWidget{$this->iInputId}.DoAddObjects(this.id);");
$oToolbar->AddSubBlock($oAddButton);

View File

@@ -18,7 +18,7 @@
*/
use Combodo\iTop\Application\TwigBase\Twig\TwigHelper;
use Combodo\iTop\Application\UI\Base\Component\DataTable\DataTableFactory;
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\PopoverMenu\PopoverMenu;
use Combodo\iTop\Application\UI\Base\Component\PopoverMenu\PopoverMenuFactory;
@@ -239,7 +239,7 @@ class WebPage implements Page
public function GetTableBlock($aColumns, $aData)
{
return DataTableFactory::MakeForForm(uniqid('form_', true), $aColumns, $aData);
return DataTableUIBlockFactory::MakeForForm(uniqid('form_', true), $aColumns, $aData);
}
/**

View File

@@ -19,7 +19,7 @@
use Combodo\iTop\Application\TwigBase\Twig\TwigHelper;
use Combodo\iTop\Application\UI\Base\Component\Alert\AlertFactory;
use Combodo\iTop\Application\UI\Base\Component\Alert\AlertUIBlockFactory;
use Combodo\iTop\Application\UI\Base\Component\Breadcrumbs\Breadcrumbs;
use Combodo\iTop\Application\UI\Base\Component\Panel\PanelFactory;
use Combodo\iTop\Application\UI\Base\iUIBlock;
@@ -726,8 +726,8 @@ JS
$oHeader = new UIContentBlock();
// Log KPIs
if (UserRights::IsAdministrator() && ExecutionKPI::IsEnabled()){
$oKPIAlert = AlertFactory::MakeForInformation('KPIs', ExecutionKPI::GetDescription())
if (UserRights::IsAdministrator() && ExecutionKPI::IsEnabled()) {
$oKPIAlert = AlertUIBlockFactory::MakeForInformation('KPIs', ExecutionKPI::GetDescription())
->SetIsClosable(false)
->SetIsCollapsible(false);
$oHeader->AddSubBlock($oKPIAlert);
@@ -735,7 +735,7 @@ JS
// Archive mode
if (utils::IsArchiveMode()) {
$oArchiveAlert = AlertFactory::MakeForInformation(Dict::S('UI:ArchiveMode:Banner'), '')
$oArchiveAlert = AlertUIBlockFactory::MakeForInformation(Dict::S('UI:ArchiveMode:Banner'), '')
->SetIsClosable(false)
->SetIsCollapsible(false);
$oHeader->AddSubBlock($oArchiveAlert);
@@ -754,24 +754,23 @@ JS
$sAdminMessage = trim(MetaModel::GetConfig()->Get('access_message'));
$sRestrictionTitle = empty($sAdminMessage) ? '' : $sAdminMessage;
$oRestrictionAlert = AlertFactory::MakeForWarning($sRestrictionTitle, $sRestrictionMessage)
$oRestrictionAlert = AlertUIBlockFactory::MakeForWarning($sRestrictionTitle, $sRestrictionMessage)
->SetIsClosable(false)
->SetIsCollapsible(false);
$oHeader->AddSubBlock($oRestrictionAlert);
}
// Misc. app. messages
foreach ($this->m_aMessages as $aMessage)
{
foreach ($this->m_aMessages as $aMessage) {
$sMessageForHtml = $aMessage['message'];
if($aMessage['tip']) {
if ($aMessage['tip']) {
$sTooltipForHtml = utils::HtmlEntities($aMessage['tip']);
$sMessageForHtml = <<<HTML
<div data-tooltip-content="$sTooltipForHtml">$sMessageForHtml</div>
HTML;
}
// Note: Message icon has been ignored during 3.0 migration. If we want them back, we should find a proper way to integrate them, not just putting an <img /> tag
$oAppMessageAlert = AlertFactory::MakeForInformation('', $sMessageForHtml);
$oAppMessageAlert = AlertUIBlockFactory::MakeForInformation('', $sMessageForHtml);
$oHeader->AddSubBlock($oAppMessageAlert);
}

View File

@@ -33,7 +33,7 @@ use CMDBObjectSet;
use Combodo\iTop\Application\Search\CriterionConversion\CriterionToSearchForm;
use Combodo\iTop\Application\UI\Base\Component\Form\Form;
use Combodo\iTop\Application\UI\Base\Component\Html\Html;
use Combodo\iTop\Application\UI\Base\Component\Input\InputFactory;
use Combodo\iTop\Application\UI\Base\Component\Input\InputUIBlockFactory;
use Combodo\iTop\Application\UI\Base\Component\Panel\Panel;
use Combodo\iTop\Application\UI\Base\Layout\UIContentBlock;
use CoreException;
@@ -201,22 +201,19 @@ class SearchForm
$oUiSearchBlock->AddToolbarBlock(new Html($sHtml));
$oFormSearch=new Form("fs_".$sSearchFormId);
$oFormSearch = new Form("fs_".$sSearchFormId);
$oFormSearch->SetAction($sAction)
->AddCSSClasses($sStyle);
$oUiSearchBlock->AddSubBlock($oFormSearch);
$oFormSearch->AddSubBlock(InputFactory::MakeForHidden("class", $sClassName));
$oFormSearch->AddHtml( "<div id=\"fs_{$sSearchFormId}_message\" class=\"sf_message header_message\"></div>");//class sf_message header_message
$oFormSearch->AddSubBlock(InputUIBlockFactory::MakeForHidden("class", $sClassName));
$oFormSearch->AddHtml("<div id=\"fs_{$sSearchFormId}_message\" class=\"sf_message header_message\"></div>");//class sf_message header_message
$oCriterionBlock = new UIContentBlock("fs_{$sSearchFormId}_criterion_outer","sf_criterion_area ibo-criterion-area");
$oCriterionBlock = new UIContentBlock("fs_{$sSearchFormId}_criterion_outer", "sf_criterion_area ibo-criterion-area");
$oFormSearch->AddSubBlock($oCriterionBlock);
if (isset($aExtraParams['query_params']))
{
if (isset($aExtraParams['query_params'])) {
$aArgs = $aExtraParams['query_params'];
}
else
} else
{
$aArgs = array();
}

View File

@@ -22,8 +22,8 @@
namespace Combodo\iTop\Test\VisualTest\Backoffice;
use Combodo\iTop\Application\UI\Base\Component\Alert\AlertFactory;
use Combodo\iTop\Application\UI\Base\Component\Button\ButtonFactory;
use Combodo\iTop\Application\UI\Base\Component\Alert\AlertUIBlockFactory;
use Combodo\iTop\Application\UI\Base\Component\Button\ButtonUIBlockFactory;
use Combodo\iTop\Application\UI\Base\Component\CollapsibleSection\CollapsibleSection;
use Combodo\iTop\Application\UI\Base\Component\Html\Html;
use Combodo\iTop\Application\UI\Base\Component\Panel\PanelFactory;
@@ -73,20 +73,20 @@ $sContent = <<<HTML
<div>Here we put an hyperlink (<a href="#">link</a>) and a smiley (😻), just to see if it renders correctly</div>
HTML;
$oPageContentLayout->AddMainBlock(AlertFactory::MakeNeutral('Neutral alert', $sContent));
$oPageContentLayout->AddMainBlock(AlertFactory::MakeForInformation('Alert for information', $sContent));
$oPageContentLayout->AddMainBlock(AlertFactory::MakeForSuccess('Alert for success', $sContent));
$oPageContentLayout->AddMainBlock(AlertFactory::MakeForWarning('Alert for warning', $sContent));
$oPageContentLayout->AddMainBlock(AlertFactory::MakeForDanger('Alert for danger', $sContent));
$oPageContentLayout->AddMainBlock(AlertFactory::MakeForFailure('Alert for failure', $sContent));
$oPageContentLayout->AddMainBlock(AlertFactory::MakeWithBrandingPrimaryColor('Alert with branding primary color', $sContent));
$oPageContentLayout->AddMainBlock(AlertFactory::MakeWithBrandingSecondaryColor('Alert with branding secondary color', $sContent));
$oAlertNonClosable = AlertFactory::MakeNeutral('Alert not closable, not collapsable', $sContent)
$oPageContentLayout->AddMainBlock(AlertUIBlockFactory::MakeNeutral('Neutral alert', $sContent));
$oPageContentLayout->AddMainBlock(AlertUIBlockFactory::MakeForInformation('Alert for information', $sContent));
$oPageContentLayout->AddMainBlock(AlertUIBlockFactory::MakeForSuccess('Alert for success', $sContent));
$oPageContentLayout->AddMainBlock(AlertUIBlockFactory::MakeForWarning('Alert for warning', $sContent));
$oPageContentLayout->AddMainBlock(AlertUIBlockFactory::MakeForDanger('Alert for danger', $sContent));
$oPageContentLayout->AddMainBlock(AlertUIBlockFactory::MakeForFailure('Alert for failure', $sContent));
$oPageContentLayout->AddMainBlock(AlertUIBlockFactory::MakeWithBrandingPrimaryColor('Alert with branding primary color', $sContent));
$oPageContentLayout->AddMainBlock(AlertUIBlockFactory::MakeWithBrandingSecondaryColor('Alert with branding secondary color', $sContent));
$oAlertNonClosable = AlertUIBlockFactory::MakeNeutral('Alert not closable, not collapsable', $sContent)
->SetIsClosable(false)
->SetIsCollapsible(false);
$oPageContentLayout->AddMainBlock($oAlertNonClosable);
$oAlertSaveCollapsibleState = AlertFactory::MakeNeutral('Alert with collapsible state saving', $sContent)
->EnableSaveCollapsibleState('RenderAllUiBlocks__alert');
$oAlertSaveCollapsibleState = AlertUIBlockFactory::MakeNeutral('Alert with collapsible state saving', $sContent)
->EnableSaveCollapsibleState('RenderAllUiBlocks-alert');
$oPageContentLayout->AddMainBlock($oAlertSaveCollapsibleState);
$oPageContentLayout->AddMainBlock(new Html('<hr/>'));
@@ -96,29 +96,29 @@ $oPageContentLayout->AddMainBlock(new Html('<hr/>'));
//////////
$oButtonsTitle = new Html('<h2 id="title-buttons">Buttons examples</h2>');
$oPage->AddUiBlock($oButtonsTitle);
$oPageContentLayout->AddMainBlock(ButtonFactory::MakeNeutral('Neutral', 'neutral'));
$oPageContentLayout->AddMainBlock(ButtonFactory::MakeNeutral('Neutral dis.', 'neutral')->SetIsDisabled(true));
$oPageContentLayout->AddMainBlock(ButtonFactory::MakeForPrimaryAction('Primary'));
$oPageContentLayout->AddMainBlock(ButtonFactory::MakeForPrimaryAction('Primary dis.')->SetIsDisabled(true));
$oPageContentLayout->AddMainBlock(ButtonFactory::MakeForSecondaryAction('Secondary'));
$oPageContentLayout->AddMainBlock(ButtonFactory::MakeForSecondaryAction('Secondary dis.')->SetIsDisabled(true));
$oPageContentLayout->AddMainBlock(ButtonFactory::MakeForPositiveAction('Validation'));
$oPageContentLayout->AddMainBlock(ButtonFactory::MakeForPositiveAction('Validation dis.')->SetIsDisabled(true));
$oPageContentLayout->AddMainBlock(ButtonFactory::MakeForDestructiveAction('Destructive'));
$oPageContentLayout->AddMainBlock(ButtonFactory::MakeForDestructiveAction('Destructive dis.')->SetIsDisabled(true));
$oPageContentLayout->AddMainBlock(ButtonFactory::MakeAlternativeNeutral('Alt. neutral', 'alt-neutral'));
$oPageContentLayout->AddMainBlock(ButtonFactory::MakeAlternativeNeutral('Alt. neutral dis.', 'alt-neutral')->SetIsDisabled(true));
$oPageContentLayout->AddMainBlock(ButtonFactory::MakeForAlternativePrimaryAction('Alt. primary'));
$oPageContentLayout->AddMainBlock(ButtonFactory::MakeForAlternativePrimaryAction('Alt. primary dis.')->SetIsDisabled(true));
$oPageContentLayout->AddMainBlock(ButtonFactory::MakeForAlternativeSecondaryAction('Alt. secondary'));
$oPageContentLayout->AddMainBlock(ButtonFactory::MakeForAlternativeSecondaryAction('Alt. secondary dis.')->SetIsDisabled(true));
$oPageContentLayout->AddMainBlock(ButtonFactory::MakeForAlternativeValidationAction('Alt. validation'));
$oPageContentLayout->AddMainBlock(ButtonFactory::MakeForAlternativeValidationAction('Alt. validation dis.')->SetIsDisabled(true));
$oPageContentLayout->AddMainBlock(ButtonFactory::MakeForAlternativeDestructiveAction('Alt. destructive'));
$oPageContentLayout->AddMainBlock(ButtonFactory::MakeForAlternativeDestructiveAction('Alt. destructive dis.')->SetIsDisabled(true));
$oPageContentLayout->AddMainBlock(ButtonFactory::MakeLinkNeutral(utils::GetAbsoluteUrlAppRoot(), 'Link neutral'));
$oPageContentLayout->AddMainBlock(ButtonFactory::MakeLinkNeutral(utils::GetAbsoluteUrlAppRoot(), 'Link neutral dis.')->SetIsDisabled(true));
$oPageContentLayout->AddMainBlock(ButtonFactory::MakeIconLink('fas fa-thumbs-up', 'Icon link button'));
$oPageContentLayout->AddMainBlock(ButtonUIBlockFactory::MakeNeutral('Neutral', 'neutral'));
$oPageContentLayout->AddMainBlock(ButtonUIBlockFactory::MakeNeutral('Neutral dis.', 'neutral')->SetIsDisabled(true));
$oPageContentLayout->AddMainBlock(ButtonUIBlockFactory::MakeForPrimaryAction('Primary'));
$oPageContentLayout->AddMainBlock(ButtonUIBlockFactory::MakeForPrimaryAction('Primary dis.')->SetIsDisabled(true));
$oPageContentLayout->AddMainBlock(ButtonUIBlockFactory::MakeForSecondaryAction('Secondary'));
$oPageContentLayout->AddMainBlock(ButtonUIBlockFactory::MakeForSecondaryAction('Secondary dis.')->SetIsDisabled(true));
$oPageContentLayout->AddMainBlock(ButtonUIBlockFactory::MakeForPositiveAction('Validation'));
$oPageContentLayout->AddMainBlock(ButtonUIBlockFactory::MakeForPositiveAction('Validation dis.')->SetIsDisabled(true));
$oPageContentLayout->AddMainBlock(ButtonUIBlockFactory::MakeForDestructiveAction('Destructive'));
$oPageContentLayout->AddMainBlock(ButtonUIBlockFactory::MakeForDestructiveAction('Destructive dis.')->SetIsDisabled(true));
$oPageContentLayout->AddMainBlock(ButtonUIBlockFactory::MakeAlternativeNeutral('Alt. neutral', 'alt-neutral'));
$oPageContentLayout->AddMainBlock(ButtonUIBlockFactory::MakeAlternativeNeutral('Alt. neutral dis.', 'alt-neutral')->SetIsDisabled(true));
$oPageContentLayout->AddMainBlock(ButtonUIBlockFactory::MakeForAlternativePrimaryAction('Alt. primary'));
$oPageContentLayout->AddMainBlock(ButtonUIBlockFactory::MakeForAlternativePrimaryAction('Alt. primary dis.')->SetIsDisabled(true));
$oPageContentLayout->AddMainBlock(ButtonUIBlockFactory::MakeForAlternativeSecondaryAction('Alt. secondary'));
$oPageContentLayout->AddMainBlock(ButtonUIBlockFactory::MakeForAlternativeSecondaryAction('Alt. secondary dis.')->SetIsDisabled(true));
$oPageContentLayout->AddMainBlock(ButtonUIBlockFactory::MakeForAlternativeValidationAction('Alt. validation'));
$oPageContentLayout->AddMainBlock(ButtonUIBlockFactory::MakeForAlternativeValidationAction('Alt. validation dis.')->SetIsDisabled(true));
$oPageContentLayout->AddMainBlock(ButtonUIBlockFactory::MakeForAlternativeDestructiveAction('Alt. destructive'));
$oPageContentLayout->AddMainBlock(ButtonUIBlockFactory::MakeForAlternativeDestructiveAction('Alt. destructive dis.')->SetIsDisabled(true));
$oPageContentLayout->AddMainBlock(ButtonUIBlockFactory::MakeLinkNeutral(utils::GetAbsoluteUrlAppRoot(), 'Link neutral'));
$oPageContentLayout->AddMainBlock(ButtonUIBlockFactory::MakeLinkNeutral(utils::GetAbsoluteUrlAppRoot(), 'Link neutral dis.')->SetIsDisabled(true));
$oPageContentLayout->AddMainBlock(ButtonUIBlockFactory::MakeIconLink('fas fa-thumbs-up', 'Icon link button'));
$oPageContentLayout->AddMainBlock(new Html('<hr/>'));