mirror of
https://github.com/Combodo/iTop.git
synced 2026-04-23 02:28:44 +02:00
UIBlock: Change $aAdditionalCSSClasses methods to match app. conventions (parameters should be arrays, not space separated string)
Note: This had to be fixed on all calls to this, hence the number of modifications.
This commit is contained in:
@@ -1894,7 +1894,7 @@ HTML
|
||||
null,
|
||||
$sPredefinedBtnId
|
||||
);
|
||||
$oPredefQueryButton->AddCSSClasses('ibo-action-button');
|
||||
$oPredefQueryButton->AddCSSClass('ibo-action-button');
|
||||
$oPredefQueryRenderer = new BlockRenderer($oPredefQueryButton);
|
||||
$sAdditionalStuff = $oPredefQueryRenderer->RenderHtml();
|
||||
$oPage->add_ready_script(<<<JS
|
||||
@@ -1934,7 +1934,7 @@ JS
|
||||
null,
|
||||
$sTestResId
|
||||
);
|
||||
$oTestQueryButton->AddCSSClasses('ibo-action-button');
|
||||
$oTestQueryButton->AddCSSClass('ibo-action-button');
|
||||
$oPage->add_ready_script(<<<JS
|
||||
$("#$sTestResId").click(function () {
|
||||
var sQueryRaw = $("#$iId").val(),
|
||||
@@ -2476,7 +2476,7 @@ JS
|
||||
}
|
||||
|
||||
$oContentBlock = new UIContentBlock();
|
||||
$oContentBlock->SetCSSClasses("object-details")
|
||||
$oContentBlock->SetCSSClasses(['object-details'])
|
||||
->AddDataAttribute('object-class', $sClass)
|
||||
->AddDataAttribute('object-id', $iKey)
|
||||
->AddDataAttribute('object-mode', $sMode);
|
||||
@@ -2538,7 +2538,7 @@ JS
|
||||
}
|
||||
|
||||
$oContentBlock = new UIContentBlock();
|
||||
$oContentBlock->SetCSSClasses("object-details")
|
||||
$oContentBlock->SetCSSClasses(['object-details'])
|
||||
->AddDataAttribute('object-class', $sClass)
|
||||
->AddDataAttribute('object-id', $iKey)
|
||||
->AddDataAttribute('object-mode', $sMode);
|
||||
@@ -2587,13 +2587,13 @@ JS
|
||||
CSS
|
||||
);
|
||||
$oToolbarTop = new Toolbar();
|
||||
$oToolbarTop->SetCSSClasses('ibo-toolbar ibo-toolbar-top');
|
||||
$oToolbarTop->SetCSSClasses(['ibo-toolbar', 'ibo-toolbar-top']);
|
||||
|
||||
$oCancelButton = ButtonUIBlockFactory::MakeForSecondaryAction(Dict::S('UI:Button:Cancel'));
|
||||
$oCancelButton->AddCSSClasses('action cancel');
|
||||
$oCancelButton->AddCSSClasses(['action', 'cancel']);
|
||||
$oToolbarTop->AddSubBlock($oCancelButton);
|
||||
$oApplyButton = ButtonUIBlockFactory::MakeForPrimaryAction($sApplyButton, null, null, true);
|
||||
$oApplyButton->AddCSSClasses('action');
|
||||
$oApplyButton->AddCSSClass('action');
|
||||
$oToolbarTop->AddSubBlock($oApplyButton);
|
||||
|
||||
$aTransitions = $this->EnumTransitions();
|
||||
@@ -2607,7 +2607,7 @@ CSS
|
||||
switch ($iActionAllowed) {
|
||||
case UR_ALLOWED_YES:
|
||||
$oButton = ButtonUIBlockFactory::MakeForPrimaryAction($aStimuli[$sStimulusCode]->GetLabel(), 'next_action', $sStimulusCode, true);
|
||||
$oButton->AddCSSClasses('action');
|
||||
$oButton->AddCSSClass('action');
|
||||
$oButton->SetColor(Button::ENUM_COLOR_NEUTRAL);
|
||||
$oToolbarTop->AddSubBlock($oButton);
|
||||
break;
|
||||
@@ -2714,7 +2714,7 @@ EOF
|
||||
// bottom or both: display the buttons here
|
||||
$oPage->p($sStatesSelection);
|
||||
$oToolbarBottom = new Toolbar();
|
||||
$oToolbarBottom->SetCSSClasses('ibo-toolbar');
|
||||
$oToolbarBottom->SetCSSClasses(['ibo-toolbar']);
|
||||
foreach ($oToolbarTop->GetSubBlocks() as $oButton) {
|
||||
$oToolbarBottom->AddSubBlock($oButton);
|
||||
}
|
||||
@@ -3047,7 +3047,7 @@ HTML
|
||||
$this->DisplayDetails($oPage, false, $sMode);
|
||||
}
|
||||
|
||||
$oFormContainer = new UIContentBlock(null, 'ibo-wizard-container');
|
||||
$oFormContainer = new UIContentBlock(null, ['ibo-wizard-container']);
|
||||
$oPage->AddUiBlock($oFormContainer);
|
||||
$oForm = new Combodo\iTop\Application\UI\Base\Component\Form\Form('apply_stimulus');
|
||||
$oFormContainer->AddSubBlock($oForm);
|
||||
|
||||
@@ -1090,7 +1090,7 @@ JS
|
||||
$sName = 'UI:Dashboard:Actions';
|
||||
$oToolbar = $oPage->GetTopBarLayout()->GetToolbar();
|
||||
$oActionButton = ButtonUIBlockFactory::MakeLinkNeutral('', '', 'fas fa-ellipsis-v', $sName, '', $sMenuTogglerId);
|
||||
$oActionButton->AddCSSClasses("ibo-top-bar--toolbar-dashboard-menu-toggler");
|
||||
$oActionButton->AddCSSClass('ibo-top-bar--toolbar-dashboard-menu-toggler');
|
||||
|
||||
$oToolbar->AddSubBlock($oActionButton);
|
||||
|
||||
@@ -1115,7 +1115,7 @@ JS
|
||||
utils::GetPopupMenuItems($oPage, iPopupMenuExtension::MENU_DASHBOARD_ACTIONS, $this, $aActions);
|
||||
|
||||
$oToolbar->AddSubBlock($oPage->GetPopoverMenu($sPopoverMenuId, $aActions));
|
||||
$oActionButton->AddCSSClasses('ibo-action-button')
|
||||
$oActionButton->AddCSSClass('ibo-action-button')
|
||||
->SetJsCode(<<<JS
|
||||
$("#{$sPopoverMenuId}").popover_menu({toggler: "#{$sMenuTogglerId}"});
|
||||
$('#{$sMenuTogglerId}').on('click', function(oEvent) {
|
||||
|
||||
@@ -212,14 +212,13 @@ abstract class Dashlet
|
||||
{
|
||||
$sId = $this->GetID();
|
||||
|
||||
$sCSSClasses = implode(' ', $this->aCSSClasses);
|
||||
if ($bEnclosingDiv) {
|
||||
if ($bEditMode) {
|
||||
$oDashletContainer = new DashletContainer("dashlet_{$sId}");
|
||||
} else {
|
||||
$oDashletContainer = new DashletContainer();
|
||||
}
|
||||
$oDashletContainer->AddCSSClasses($sCSSClasses);
|
||||
$oDashletContainer->AddCSSClasses($this->aCSSClasses);
|
||||
} else {
|
||||
$oDashletContainer = new DashletContainer();
|
||||
|
||||
@@ -239,14 +238,14 @@ abstract class Dashlet
|
||||
// Maybe the class is part of a non-installed module, fail silently
|
||||
// Except in Edit mode
|
||||
if ($bEditMode) {
|
||||
$oDashletContainer->AddCSSClasses("dashlet-content");
|
||||
$oDashletContainer->AddCSSClass("dashlet-content");
|
||||
$oDashletContainer->AddHtml('<h2>'.$e->GetUserFriendlyDescription().'</h2>');
|
||||
}
|
||||
} catch (OqlException $e) {
|
||||
$oDashletContainer->AddCSSClasses("dashlet-content");
|
||||
$oDashletContainer->AddCSSClass("dashlet-content");
|
||||
$oDashletContainer->AddHtml('<p>'.$e->GetUserFriendlyDescription().'</p>');
|
||||
} catch (Exception $e) {
|
||||
$oDashletContainer->AddCSSClasses("dashlet-content");
|
||||
$oDashletContainer->AddCSSClass("dashlet-content");
|
||||
$oDashletContainer->AddHtml('<p>'.$e->getMessage().'</p>');
|
||||
}
|
||||
|
||||
@@ -602,7 +601,7 @@ class DashletUnknown extends Dashlet
|
||||
$sIconUrl = utils::HtmlEntities(utils::GetAbsoluteUrlAppRoot().$aInfos['icon']);
|
||||
$sExplainText = ($bEditMode) ? Dict::Format('UI:DashletUnknown:RenderText:Edit', $this->GetDashletType()) : Dict::S('UI:DashletUnknown:RenderText:View');
|
||||
|
||||
$oDashletContainer = new DashletContainer(null, 'dashlet-content');
|
||||
$oDashletContainer = new DashletContainer(null, ['dashlet-content']);
|
||||
|
||||
$oDashletContainer->AddHtml('<div class="dashlet-ukn-image"><img src="'.$sIconUrl.'" /></div>');
|
||||
$oDashletContainer->AddHtml('<div class="dashlet-ukn-text">'.$sExplainText.'</div>');
|
||||
@@ -622,7 +621,7 @@ class DashletUnknown extends Dashlet
|
||||
$sIconUrl = utils::HtmlEntities(utils::GetAbsoluteUrlAppRoot().$aInfos['icon']);
|
||||
$sExplainText = Dict::Format('UI:DashletUnknown:RenderNoDataText:Edit', $this->GetDashletType());
|
||||
|
||||
$oDashletContainer = new DashletContainer(null, 'dashlet-content');
|
||||
$oDashletContainer = new DashletContainer(null, ['dashlet-content']);
|
||||
|
||||
$oDashletContainer->AddHtml('<div class="dashlet-ukn-image"><img src="'.$sIconUrl.'" /></div>');
|
||||
$oDashletContainer->AddHtml('<div class="dashlet-ukn-text">'.$sExplainText.'</div>');
|
||||
@@ -746,7 +745,7 @@ class DashletProxy extends DashletUnknown
|
||||
public function Render($oPage, $bEditMode = false, $aExtraParams = array())
|
||||
{
|
||||
// This should never be called.
|
||||
$oDashletContainer = new DashletContainer(null, 'dashlet-content');
|
||||
$oDashletContainer = new DashletContainer(null, ['dashlet-content']);
|
||||
$oDashletContainer->AddHtml('<div>This dashlet is not supposed to be rendered as it is just a proxy for third-party widgets.</div>');
|
||||
return $oDashletContainer;
|
||||
}
|
||||
@@ -763,7 +762,7 @@ class DashletProxy extends DashletUnknown
|
||||
$sIconUrl = utils::HtmlEntities(utils::GetAbsoluteUrlAppRoot().$aInfos['icon']);
|
||||
$sExplainText = Dict::Format('UI:DashletProxy:RenderNoDataText:Edit', $this->GetDashletType());
|
||||
|
||||
$oDashletContainer = new DashletContainer(null, 'dashlet-content');
|
||||
$oDashletContainer = new DashletContainer(null, ['dashlet-content']);
|
||||
|
||||
$sHtml = '';
|
||||
$sHtml .= '<div class="dashlet-pxy-image"><img src="'.$sIconUrl.'" /></div>';
|
||||
@@ -1333,7 +1332,7 @@ abstract class DashletGroupBy extends Dashlet
|
||||
*/
|
||||
public function RenderNoData($oPage, $bEditMode = false, $aExtraParams = array())
|
||||
{
|
||||
$oDashletContainer = new DashletContainer(null, 'dashlet-content');
|
||||
$oDashletContainer = new DashletContainer(null, ['dashlet-content']);
|
||||
$oDashletContainer->AddHtml('error!');
|
||||
return $oDashletContainer;
|
||||
}
|
||||
@@ -1656,7 +1655,7 @@ class DashletGroupByPie extends DashletGroupBy
|
||||
*/
|
||||
public function RenderNoData($oPage, $bEditMode = false, $aExtraParams = array())
|
||||
{
|
||||
$oDashletContainer = new DashletContainer(null, 'dashlet-content');
|
||||
$oDashletContainer = new DashletContainer(null, ['dashlet-content']);
|
||||
|
||||
$sTitle = $this->aProperties['title'];
|
||||
|
||||
@@ -1731,7 +1730,7 @@ class DashletGroupByBars extends DashletGroupBy
|
||||
*/
|
||||
public function RenderNoData($oPage, $bEditMode = false, $aExtraParams = array())
|
||||
{
|
||||
$oDashletContainer = new DashletContainer(null, 'dashlet-content');
|
||||
$oDashletContainer = new DashletContainer(null, ['dashlet-content']);
|
||||
|
||||
$sTitle = $this->aProperties['title'];
|
||||
|
||||
@@ -2087,7 +2086,7 @@ class DashletHeaderDynamic extends Dashlet
|
||||
$oIconSelect = $this->oModelReflection->GetIconSelectionField('icon');
|
||||
$sIconPath = utils::HtmlEntities($oIconSelect->MakeFileUrl($sIcon));
|
||||
|
||||
$oDashletContainer = new DashletContainer(null, 'dashlet-content');
|
||||
$oDashletContainer = new DashletContainer(null, ['dashlet-content']);
|
||||
|
||||
$sHtml = '';
|
||||
$sHtml .= '<img src="'.$sIconPath.'">';
|
||||
@@ -2284,7 +2283,7 @@ class DashletBadge extends Dashlet
|
||||
*/
|
||||
public function Render($oPage, $bEditMode = false, $aExtraParams = array())
|
||||
{
|
||||
$oDashletContainer = new DashletContainer($this->sId, 'dashlet-content');
|
||||
$oDashletContainer = new DashletContainer($this->sId, ['dashlet-content']);
|
||||
|
||||
$sClass = $this->aProperties['class'];
|
||||
$oFilter = new DBObjectSearch($sClass);
|
||||
@@ -2301,7 +2300,7 @@ class DashletBadge extends Dashlet
|
||||
*/
|
||||
public function RenderNoData($oPage, $bEditMode = false, $aExtraParams = array())
|
||||
{
|
||||
$oDashletContainer = new DashletContainer($this->sId, 'dashlet-content');
|
||||
$oDashletContainer = new DashletContainer($this->sId, ['dashlet-content']);
|
||||
|
||||
$sClass = $this->aProperties['class'];
|
||||
$sIconUrl = $this->oModelReflection->GetClassIcon($sClass, false);
|
||||
|
||||
@@ -396,7 +396,7 @@ class DisplayBlock
|
||||
public function GetDisplay(WebPage $oPage, $sId, $aExtraParams = array()): UIContentBlock
|
||||
{
|
||||
$oHtml = new UIContentBlock($sId);
|
||||
$oHtml->AddCSSClasses("display_block");
|
||||
$oHtml->AddCSSClass("display_block");
|
||||
$aExtraParams = array_merge($aExtraParams, $this->m_aParams);
|
||||
$aExtraParams['currentId'] = $sId;
|
||||
$sExtraParams = addslashes(str_replace('"', "'", json_encode($aExtraParams))); // JSON encode, change the style of the quotes and escape them
|
||||
@@ -432,7 +432,7 @@ HTML;
|
||||
}
|
||||
} else {
|
||||
// render it as an Ajax (asynchronous) call
|
||||
$oHtml->AddCSSClasses("loading");
|
||||
$oHtml->AddCSSClass("loading");
|
||||
$oHtml->AddHtml("<p><img src=\"../images/indicator_arrows.gif\"> ".Dict::S('UI:Loading').'</p>');
|
||||
$oPage->add_script('
|
||||
$.post("ajax.render.php?style='.$this->m_sStyle.'",
|
||||
@@ -976,7 +976,7 @@ JS
|
||||
}
|
||||
}
|
||||
|
||||
$oBlock = new UIContentBlock(null, "ibo-dashlet-header-dynamic--container");
|
||||
$oBlock = new UIContentBlock(null, ["ibo-dashlet-header-dynamic--container"]);
|
||||
foreach ($aStateLabels as $sStateValue => $sStateLabel) {
|
||||
$aCount = $aCounts[$sStateValue];
|
||||
$oBadge = BadgeFactory::MakeForState($sClass, $sStateValue);
|
||||
@@ -2071,7 +2071,7 @@ class MenuBlock extends DisplayBlock
|
||||
}
|
||||
}
|
||||
|
||||
$oActionsBlock = new Toolbar("ibo-action-toolbar-{$sId}", 'ibo-action-toolbar');
|
||||
$oActionsBlock = new Toolbar("ibo-action-toolbar-{$sId}", ['ibo-action-toolbar']);
|
||||
$oRenderBlock->AddSubBlock($oActionsBlock);
|
||||
$sMenuTogglerId = "ibo-actions-menu-toggler-{$sId}";
|
||||
$sPopoverMenuId = "ibo-other-action-popover-{$sId}";
|
||||
@@ -2087,7 +2087,7 @@ class MenuBlock extends DisplayBlock
|
||||
// TODO Add Js
|
||||
$oActionsBlock->AddSubBlock($oActionButton)
|
||||
->AddSubBlock($oPage->GetPopoverMenu($sPopoverMenuId, $aActions));
|
||||
$oActionButton->AddCSSClasses('ibo-action-button')
|
||||
$oActionButton->AddCSSClass('ibo-action-button')
|
||||
->SetJsCode(<<<JS
|
||||
$("#{$sPopoverMenuId}").popover_menu({toggler: "#{$sMenuTogglerId}"});
|
||||
$('#{$sMenuTogglerId}').on('click', function(oEvent) {
|
||||
@@ -2109,7 +2109,7 @@ JS
|
||||
if ($this->m_sStyle == 'details') {
|
||||
$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');
|
||||
->AddCSSClass('ibo-action-button');
|
||||
$oActionsBlock->AddSubBlock($oActionButton);
|
||||
}
|
||||
|
||||
@@ -2118,7 +2118,7 @@ JS
|
||||
$oActionButton->SetIconClass('fas fa-sync')
|
||||
->SetOnClickJsCode($sRefreshAction)
|
||||
->SetTooltip(Dict::S('UI:Button:Refresh'))
|
||||
->AddCSSClasses('ibo-action-button');
|
||||
->AddCSSClass('ibo-action-button');
|
||||
$oActionsBlock->AddSubBlock($oActionButton);
|
||||
}
|
||||
|
||||
@@ -2158,7 +2158,7 @@ JS
|
||||
|
||||
$sTarget = isset($aAction['target']) ? $aAction['target'] : '';
|
||||
$oActionButton = ButtonUIBlockFactory::MakeLinkNeutral($sUrl, $sLabel, $sIconClass, $sActionId, $sTarget);
|
||||
$oActionButton->AddCSSClasses('ibo-action-button');
|
||||
$oActionButton->AddCSSClass('ibo-action-button');
|
||||
$oActionsBlock->AddSubBlock($oActionButton);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -379,7 +379,7 @@ JS
|
||||
{
|
||||
$sLinkedSetId = "{$this->m_sAttCode}{$this->m_sNameSuffix}";
|
||||
|
||||
$oBlock = new BlockIndirectLinksEdit("linkedset_{$sLinkedSetId}", "ibo-block-indirect-links--edit");
|
||||
$oBlock = new BlockIndirectLinksEdit("linkedset_{$sLinkedSetId}", ["ibo-block-indirect-links--edit"]);
|
||||
|
||||
$oBlock->sLinkedSetId = $sLinkedSetId;
|
||||
$oBlock->sClass = $this->m_sClass;
|
||||
|
||||
Reference in New Issue
Block a user