N°8772 - WIP dependencies - Does not work yet

This commit is contained in:
Eric Espie
2025-11-04 15:22:14 +01:00
parent 5a1f6ffde9
commit a092b65be7
14 changed files with 245 additions and 96 deletions

View File

@@ -0,0 +1,69 @@
<?php
/*
* @copyright Copyright (C) 2010-2025 Combodo SAS
* @license http://opensource.org/licenses/AGPL-3.0
*/
namespace Combodo\iTop\Application\UI\Base\Component\TurboForm;
use Combodo\iTop\Application\UI\Base\Layout\UIContentBlock;
use Symfony\Component\Form\FormView;
class TurboForm extends UIContentBlock
{
// Overloaded constants
public const BLOCK_CODE = 'ibo-form';
public const DEFAULT_HTML_TEMPLATE_REL_PATH = 'base/components/turbo-form/layout';
/** @var string */
protected $sOnSubmitJsCode;
/** @var string */
protected $sAction;
private FormView $oFormView;
public function __construct(FormView $oFormView, string $sId = null)
{
parent::__construct($sId);
$this->oFormView = $oFormView;
$this->sOnSubmitJsCode = null;
$this->sAction = null;
}
public function SetOnSubmitJsCode(string $sJsCode)
{
$this->sOnSubmitJsCode = $sJsCode;
return $this;
}
/**
* @return string
*/
public function GetOnSubmitJsCode(): ?string
{
return $this->sOnSubmitJsCode;
}
/**
* @return string
*/
public function GetAction(): ?string
{
return $this->sAction;
}
/**
* @param string $sAction
*
* @return TurboForm
*/
public function SetAction(string $sAction): TurboForm
{
$this->sAction = $sAction;
return $this;
}
public function GetFormView(): FormView
{
return $this->oFormView;
}
}

View File

@@ -0,0 +1,36 @@
<?php
/*
* @copyright Copyright (C) 2010-2025 Combodo SAS
* @license http://opensource.org/licenses/AGPL-3.0
*/
namespace Combodo\iTop\Application\UI\Base\Component\TurboForm;
use Combodo\iTop\Application\UI\Base\AbstractUIBlockFactory;
use Symfony\Component\Form\FormView;
/**
* Class TurboFormUIBlockFactory
*
* @api
* @since 3.3.0
* @package UIBlockAPI
*/
class TurboFormUIBlockFactory extends AbstractUIBlockFactory
{
/** @inheritDoc */
public const TWIG_TAG_NAME = 'UITurboForm';
/** @inheritDoc */
public const UI_BLOCK_CLASS_NAME = TurboForm::class;
/**
* @api
* @param string|null $sId
*
* @return \Combodo\iTop\Application\UI\Base\Component\TurboForm\TurboForm An HTML form in which you can add UIBlocks
*/
public static function MakeStandard(FormView $oFormView, string $sId = null): TurboForm
{
return new TurboForm($oFormView, $sId);
}
}

View File

@@ -0,0 +1,27 @@
<?php
/*
* @copyright Copyright (C) 2010-2025 Combodo SAS
* @license http://opensource.org/licenses/AGPL-3.0
*/
namespace Combodo\iTop\Application\UI\Base\Component\TurboUpdate;
use Combodo\iTop\Application\UI\Base\Layout\UIContentBlock;
class TurboUpdate extends UIContentBlock
{
// Overloaded constants
public const DEFAULT_HTML_TEMPLATE_REL_PATH = 'base/components/turbo-update/layout';
private string $sTarget;
public function __construct(string $sTarget, string $sId = null)
{
parent::__construct($sId);
$this->sTarget = $sTarget;
}
public function GetTarget(): string
{
return $this->sTarget;
}
}

View File

@@ -0,0 +1,37 @@
<?php
/*
* @copyright Copyright (C) 2010-2025 Combodo SAS
* @license http://opensource.org/licenses/AGPL-3.0
*/
namespace Combodo\iTop\Application\UI\Base\Component\TurboUpdate;
use Combodo\iTop\Application\UI\Base\AbstractUIBlockFactory;
/**
* Class TurboUpdateUIBlockFactory
*
* @api
* @since 3.3.0
* @package UIBlockAPI
*/
class TurboUpdateUIBlockFactory extends AbstractUIBlockFactory
{
/** @inheritDoc */
public const TWIG_TAG_NAME = 'UITurboUpdate';
/** @inheritDoc */
public const UI_BLOCK_CLASS_NAME = TurboUpdate::class;
/**
* @api
*
* @param string $sTarget Id of the block to update
* @param string|null $sId
*
* @return \Combodo\iTop\Application\UI\Base\Component\TurboUpdate\TurboUpdate An HTML form in which you can add UIBlocks
*/
public static function MakeStandard(string $sTarget, string $sId = null): TurboUpdate
{
return new TurboUpdate($sTarget, $sId);
}
}