mirror of
https://github.com/Combodo/iTop.git
synced 2026-05-21 08:12:26 +02:00
Merge branch 'support/3.0' into saas/3.0
This commit is contained in:
@@ -45,25 +45,21 @@ class EMailLaminas extends Email
|
||||
// Did not work with attachements since their binary representation cannot be stored as a valid UTF-8 string
|
||||
const FORMAT_V2 = 2; // New format, only the raw data are serialized (base64 encoded if needed)
|
||||
|
||||
protected static $m_oConfig = null;
|
||||
protected $m_aData; // For storing data to serialize
|
||||
|
||||
public static function LoadConfig($sConfigFile = ITOP_DEFAULT_CONFIG_FILE)
|
||||
{
|
||||
if (is_null(self::$m_oConfig)) {
|
||||
self::$m_oConfig = new Config($sConfigFile);
|
||||
}
|
||||
}
|
||||
|
||||
protected $m_oMessage;
|
||||
|
||||
/** @noinspection PhpMissingParentConstructorInspection */
|
||||
/**
|
||||
* @noinspection PhpMissingParentConstructorInspection
|
||||
* @noinspection MagicMethodsValidityInspection
|
||||
*/
|
||||
public function __construct()
|
||||
{
|
||||
$this->m_aData = array();
|
||||
$this->m_oMessage = new Message();
|
||||
$this->m_oMessage->setEncoding('UTF-8');
|
||||
$this->SetRecipientFrom(MetaModel::GetConfig()->Get('email_default_sender_address'), MetaModel::GetConfig()->Get('email_default_sender_label'));
|
||||
|
||||
$this->InitRecipientFrom();
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -319,7 +315,8 @@ class EMailLaminas extends Email
|
||||
if ($bForceSynchronous) {
|
||||
return $this->SendSynchronous($aIssues, $oLog);
|
||||
} else {
|
||||
$bConfigASYNC = MetaModel::GetConfig()->Get('email_asynchronous');
|
||||
$oConfig = $this->LoadConfig();
|
||||
$bConfigASYNC = $oConfig->Get('email_asynchronous');
|
||||
if ($bConfigASYNC) {
|
||||
return $this->SendAsynchronous($aIssues, $oLog);
|
||||
} else {
|
||||
|
||||
@@ -32,25 +32,20 @@ Swift_Preferences::getInstance()->setCharset('UTF-8');
|
||||
|
||||
class EmailSwiftMailer extends EMail
|
||||
{
|
||||
protected static $m_oConfig = null;
|
||||
protected $m_aData; // For storing data to serialize
|
||||
|
||||
public function LoadConfig($sConfigFile = ITOP_DEFAULT_CONFIG_FILE)
|
||||
{
|
||||
if (is_null(self::$m_oConfig))
|
||||
{
|
||||
self::$m_oConfig = new Config($sConfigFile);
|
||||
}
|
||||
}
|
||||
|
||||
protected $m_oMessage;
|
||||
|
||||
/** @noinspection PhpMissingParentConstructorInspection */
|
||||
/**
|
||||
* @noinspection PhpMissingParentConstructorInspection
|
||||
* @noinspection MagicMethodsValidityInspection
|
||||
*/
|
||||
public function __construct()
|
||||
{
|
||||
$this->m_aData = array();
|
||||
$this->m_oMessage = new Swift_Message();
|
||||
$this->SetRecipientFrom(MetaModel::GetConfig()->Get('email_default_sender_address'), MetaModel::GetConfig()->Get('email_default_sender_label'));
|
||||
|
||||
$this->InitRecipientFrom();
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -63,7 +58,7 @@ class EmailSwiftMailer extends EMail
|
||||
{
|
||||
return serialize($this->m_aData);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Custom de-serialization method
|
||||
* @param string $sSerializedMessage The serialized representation of the message
|
||||
@@ -155,39 +150,38 @@ class EmailSwiftMailer extends EMail
|
||||
{
|
||||
// If the body of the message is in HTML, embed all images based on attachments
|
||||
$this->EmbedInlineImages();
|
||||
|
||||
$this->LoadConfig();
|
||||
|
||||
$sTransport = self::$m_oConfig->Get('email_transport');
|
||||
switch ($sTransport)
|
||||
{
|
||||
case 'SMTP':
|
||||
$sHost = self::$m_oConfig->Get('email_transport_smtp.host');
|
||||
$sPort = self::$m_oConfig->Get('email_transport_smtp.port');
|
||||
$sEncryption = self::$m_oConfig->Get('email_transport_smtp.encryption');
|
||||
$sUserName = self::$m_oConfig->Get('email_transport_smtp.username');
|
||||
$sPassword = self::$m_oConfig->Get('email_transport_smtp.password');
|
||||
$sTransport = static::$m_oConfig->Get('email_transport');
|
||||
switch ($sTransport) {
|
||||
case 'SMTP':
|
||||
$sHost = static::$m_oConfig->Get('email_transport_smtp.host');
|
||||
$sPort = static::$m_oConfig->Get('email_transport_smtp.port');
|
||||
$sEncryption = static::$m_oConfig->Get('email_transport_smtp.encryption');
|
||||
$sUserName = static::$m_oConfig->Get('email_transport_smtp.username');
|
||||
$sPassword = static::$m_oConfig->Get('email_transport_smtp.password');
|
||||
$bAllowSelfSigned = static::$m_oConfig->Get('email_transport_smtp.allow_self_signed');
|
||||
$bVerifyPeer = static::$m_oConfig->Get('email_transport_smtp.verify_peer');
|
||||
|
||||
$oTransport = new Swift_SmtpTransport($sHost, $sPort, $sEncryption);
|
||||
if (strlen($sUserName) > 0)
|
||||
{
|
||||
$oTransport->setUsername($sUserName);
|
||||
$oTransport->setPassword($sPassword);
|
||||
}
|
||||
break;
|
||||
$oTransport = new Swift_SmtpTransport($sHost, $sPort, $sEncryption);
|
||||
if (strlen($sUserName) > 0) {
|
||||
$oTransport->setUsername($sUserName);
|
||||
$oTransport->setPassword($sPassword);
|
||||
$oTransport->setStreamOptions(array('ssl' => array('allow_self_signed' => $bAllowSelfSigned, 'verify_peer' => $bVerifyPeer)));
|
||||
}
|
||||
break;
|
||||
|
||||
case 'Null':
|
||||
$oTransport = new Swift_NullTransport();
|
||||
break;
|
||||
|
||||
case 'LogFile':
|
||||
$oTransport = new Swift_LogFileTransport(new Swift_Events_SimpleEventDispatcher());
|
||||
$oTransport->setLogFile(APPROOT.'log/mail.log');
|
||||
break;
|
||||
|
||||
case 'PHPMail':
|
||||
default:
|
||||
$oTransport = new Swift_SendmailTransport();
|
||||
case 'Null':
|
||||
$oTransport = new Swift_NullTransport();
|
||||
break;
|
||||
|
||||
case 'LogFile':
|
||||
$oTransport = new Swift_LogFileTransport(new Swift_Events_SimpleEventDispatcher());
|
||||
$oTransport->setLogFile(APPROOT.'log/mail.log');
|
||||
break;
|
||||
|
||||
case 'PHPMail':
|
||||
default:
|
||||
$oTransport = new Swift_SendmailTransport();
|
||||
}
|
||||
|
||||
$oMailer = new Swift_Mailer($oTransport);
|
||||
@@ -279,13 +273,11 @@ class EmailSwiftMailer extends EMail
|
||||
}
|
||||
else
|
||||
{
|
||||
$bConfigASYNC = MetaModel::GetConfig()->Get('email_asynchronous');
|
||||
if ($bConfigASYNC)
|
||||
{
|
||||
$oConfig = $this->LoadConfig();
|
||||
$bConfigASYNC = $oConfig->Get('email_asynchronous');
|
||||
if ($bConfigASYNC) {
|
||||
return $this->SendAsynchronous($aIssues, $oLog);
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
return $this->SendSynchronous($aIssues, $oLog);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -123,6 +123,20 @@ class ConsoleSelectObjectFieldRenderer extends FieldRenderer
|
||||
{
|
||||
$oOutput->AddCssFile($sFile);
|
||||
}
|
||||
$oOutput->AddJs(
|
||||
<<<EOF
|
||||
$("#{$this->oField->GetGlobalId()}").off("change").on("change", function(){
|
||||
var me = this;
|
||||
|
||||
$(this).closest(".field_set").trigger("field_change", {
|
||||
id: $(me).attr("id"),
|
||||
name: $(me).closest(".form_field").attr("data-field-id"),
|
||||
value: $(me).val()
|
||||
})
|
||||
.closest('.form_handler').trigger('value_change');
|
||||
});
|
||||
EOF
|
||||
);
|
||||
}
|
||||
elseif($this->oField->GetControlType() == SelectObjectField::CONTROL_RADIO_VERTICAL)
|
||||
{
|
||||
@@ -226,9 +240,8 @@ EOF
|
||||
JS
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
$oOutput->AddHtml((BlockRenderer::RenderBlockTemplates($oBlock)));
|
||||
// JS Form field widget construct
|
||||
$aValidators = array();
|
||||
|
||||
@@ -59,8 +59,43 @@ class ConsoleSimpleFieldRenderer extends FieldRenderer
|
||||
else
|
||||
{
|
||||
$oBlock = FieldUIBlockFactory::MakeStandard($this->oField->GetLabel());
|
||||
$oBlock->AddDataAttribute("input-id",$this->oField->GetGlobalId());
|
||||
$oBlock->AddDataAttribute("input-type",$sFieldClass);
|
||||
$oBlock->SetAttLabel($this->oField->GetLabel())
|
||||
->AddDataAttribute("input-id",$this->oField->GetGlobalId())
|
||||
->AddDataAttribute("input-type",$sFieldClass);
|
||||
|
||||
// Propagate data attribute from Field to UIBlock
|
||||
// Note: This might no longer be necessary after the upcoming attributes rework project
|
||||
foreach ($this->oField->GetMetadata() as $sMetadataKey => $sMetadataValue) {
|
||||
switch ($sMetadataKey) {
|
||||
// Important: Only some data attributes can be overloaded, this is done on purpose (eg. "input-type" set previously by an AttributeCustomFields)
|
||||
case 'attribute-code':
|
||||
case 'attribute-type':
|
||||
case 'input-type':
|
||||
if (utils::IsNotNullOrEmptyString($sMetadataValue)) {
|
||||
switch ($sMetadataKey) {
|
||||
case 'attribute-code':
|
||||
$oBlock->SetAttCode($sMetadataValue);
|
||||
break;
|
||||
|
||||
case 'attribute-type':
|
||||
$oBlock->SetAttType($sMetadataValue ?? '');
|
||||
break;
|
||||
|
||||
case 'input-type':
|
||||
$oBlock->AddDataAttribute($sMetadataKey, $sMetadataValue ?? '');
|
||||
break;
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
if (false === $oBlock->HasDataAttribute($sMetadataKey)) {
|
||||
$oBlock->AddDataAttribute($sMetadataKey, $sMetadataValue ?? '');
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
switch ($sFieldClass)
|
||||
{
|
||||
case 'Combodo\\iTop\\Form\\Field\\DateTimeField':
|
||||
|
||||
@@ -7,6 +7,8 @@
|
||||
|
||||
namespace Combodo\iTop\Application\Helper;
|
||||
|
||||
use utils;
|
||||
|
||||
/**
|
||||
* Session management
|
||||
* Allow early session close to have multiple ajax calls in parallel
|
||||
@@ -22,17 +24,24 @@ class Session
|
||||
protected static $bIsInitialized = false;
|
||||
/** @var bool */
|
||||
protected static $bSessionStarted = false;
|
||||
/** @var bool */
|
||||
public static $bAllowCLI = false;
|
||||
|
||||
public static function Start()
|
||||
{
|
||||
if (self::IsModeCLI()) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (!self::$bIsInitialized) {
|
||||
session_name('itop-'.md5(APPROOT));
|
||||
}
|
||||
|
||||
self::$bIsInitialized = true;
|
||||
if (!self::$bSessionStarted) {
|
||||
if (!is_null(self::$iSessionId)) {
|
||||
if (session_id(self::$iSessionId) === false) {
|
||||
session_regenerate_id();
|
||||
session_regenerate_id(true);
|
||||
}
|
||||
}
|
||||
self::$bSessionStarted = session_start();
|
||||
@@ -40,8 +49,26 @@ class Session
|
||||
}
|
||||
}
|
||||
|
||||
public static function RegenerateId($bDeleteOldSession = false)
|
||||
{
|
||||
if (self::IsModeCLI()) {
|
||||
return;
|
||||
}
|
||||
|
||||
session_regenerate_id($bDeleteOldSession);
|
||||
if (self::$bSessionStarted) {
|
||||
self::WriteClose();
|
||||
}
|
||||
self::$bSessionStarted = session_start();
|
||||
self::$iSessionId = session_id();
|
||||
}
|
||||
|
||||
public static function WriteClose()
|
||||
{
|
||||
if (self::IsModeCLI()) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (self::$bSessionStarted) {
|
||||
session_write_close();
|
||||
self::$bSessionStarted = false;
|
||||
@@ -177,4 +204,14 @@ class Session
|
||||
{
|
||||
return print_r($_SESSION, true);
|
||||
}
|
||||
|
||||
private static function IsModeCLI(): bool
|
||||
{
|
||||
if (self::$bAllowCLI) {
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
return utils::IsModeCLI();
|
||||
}
|
||||
}
|
||||
@@ -14,7 +14,6 @@ use Combodo\iTop\Application\UI\Base\iUIBlock;
|
||||
use Combodo\iTop\Renderer\BlockRenderer;
|
||||
use Dict;
|
||||
use Exception;
|
||||
use MetaModel;
|
||||
use Twig_Environment;
|
||||
use Twig_SimpleFilter;
|
||||
use Twig_SimpleFunction;
|
||||
@@ -143,28 +142,6 @@ class Extension
|
||||
return utils::IsDevelopmentEnvironment();
|
||||
}));
|
||||
|
||||
// Function to get configuration parameter
|
||||
// Usage in twig: {{ get_config_parameter('foo') }}
|
||||
$oTwigEnv->addFunction(new Twig_SimpleFunction('get_config_parameter', function ($sParamName) {
|
||||
$oConfig = MetaModel::GetConfig();
|
||||
|
||||
return $oConfig->Get($sParamName);
|
||||
}));
|
||||
|
||||
/**
|
||||
* Function to get a module setting
|
||||
* Usage in twig: {{ get_module_setting(<MODULE_CODE>, <PROPERTY_CODE> [, <DEFAULT_VALUE>]) }}
|
||||
*
|
||||
* @uses Config::GetModuleSetting()
|
||||
* @since 3.0.0
|
||||
*/
|
||||
$oTwigEnv->addFunction(new Twig_SimpleFunction('get_module_setting',
|
||||
function (string $sModuleCode, string $sPropertyCode, $defaultValue = null) {
|
||||
$oConfig = MetaModel::GetConfig();
|
||||
|
||||
return $oConfig->GetModuleSetting($sModuleCode, $sPropertyCode, $defaultValue);
|
||||
}));
|
||||
|
||||
// Function to get iTop's app root absolute URL (eg. https://aaa.bbb.ccc/xxx/yyy/)
|
||||
// Usage in twig: {{ get_absolute_url_app_root() }}
|
||||
/** @since 3.0.0 */
|
||||
|
||||
@@ -8,9 +8,7 @@
|
||||
namespace Combodo\iTop\Application\TwigBase\UI;
|
||||
|
||||
|
||||
use Exception;
|
||||
use ReflectionClass;
|
||||
use SetupUtils;
|
||||
use Combodo\iTop\Application\UI\Base\iUIBlockFactory;
|
||||
use Twig\Extension\AbstractExtension;
|
||||
use utils;
|
||||
|
||||
@@ -30,7 +28,7 @@ class UIBlockExtension extends AbstractExtension
|
||||
{
|
||||
$aParsers = [];
|
||||
|
||||
$sInterface = "Combodo\\iTop\\Application\\UI\\Base\\iUIBlockFactory";
|
||||
$sInterface = iUIBlockFactory::class;
|
||||
$aFactoryClasses = utils::GetClassesForInterface($sInterface, 'UIBlockFactory');
|
||||
|
||||
foreach ($aFactoryClasses as $sFactoryClass) {
|
||||
|
||||
@@ -11,7 +11,7 @@ namespace Combodo\iTop\Application\UI\Base;
|
||||
/**
|
||||
* Class AbstractUIBlockFactory
|
||||
*
|
||||
* @package Combodo\iTop\Application\UI\Base
|
||||
* @package UIBlockExtensibilityAPI
|
||||
* @author Eric Espie <eric.espie@combodo.com>
|
||||
* @since 3.0.0
|
||||
* @api
|
||||
@@ -19,11 +19,13 @@ namespace Combodo\iTop\Application\UI\Base;
|
||||
abstract class AbstractUIBlockFactory implements iUIBlockFactory
|
||||
{
|
||||
/**
|
||||
* @api
|
||||
* @var string
|
||||
* @see static::GetTwigTagName()
|
||||
*/
|
||||
public const TWIG_TAG_NAME = 'UIBlock';
|
||||
/**
|
||||
* @api
|
||||
* @var string
|
||||
* @see static::GetUIBlockClassName()
|
||||
*/
|
||||
|
||||
@@ -25,7 +25,7 @@ use Combodo\iTop\Application\UI\Base\AbstractUIBlockFactory;
|
||||
* Class AlertUIBlockFactory
|
||||
*
|
||||
* @author Guillaume Lajarige <guillaume.lajarige@combodo.com>
|
||||
* @package Combodo\iTop\Application\UI\Base\Component\Alert
|
||||
* @package UIBlockExtensibilityAPI
|
||||
* @since 3.0.0
|
||||
* @api
|
||||
*
|
||||
@@ -41,6 +41,7 @@ class AlertUIBlockFactory extends AbstractUIBlockFactory
|
||||
/**
|
||||
* Make a basis Alert component
|
||||
*
|
||||
* @api
|
||||
* @param string $sTitle Title of the alert
|
||||
* @param string $sContent The raw HTML content, must be already sanitized
|
||||
* @param string|null $sId id of the html block
|
||||
@@ -55,6 +56,7 @@ class AlertUIBlockFactory extends AbstractUIBlockFactory
|
||||
/**
|
||||
* Make an Alert component for informational messages
|
||||
*
|
||||
* @api
|
||||
* @param string $sTitle Title of the alert
|
||||
* @param string $sContent The raw HTML content, must be already sanitized
|
||||
* @param string|null $sId id of the html block
|
||||
@@ -70,6 +72,7 @@ class AlertUIBlockFactory extends AbstractUIBlockFactory
|
||||
/**
|
||||
* Make an Alert component for successful messages
|
||||
*
|
||||
* @api
|
||||
* @param string $sTitle Title of the alert
|
||||
* @param string $sContent The raw HTML content, must be already sanitized
|
||||
* @param string|null $sId
|
||||
@@ -84,6 +87,7 @@ class AlertUIBlockFactory extends AbstractUIBlockFactory
|
||||
/**
|
||||
* Make an Alert component for warning messages
|
||||
*
|
||||
* @api
|
||||
* @param string $sTitle Title of the alert
|
||||
* @param string $sContent The raw HTML content, must be already sanitized
|
||||
* @param string|null $sId id of the html block
|
||||
@@ -98,6 +102,7 @@ class AlertUIBlockFactory extends AbstractUIBlockFactory
|
||||
/**
|
||||
* Make an Alert component for danger messages
|
||||
*
|
||||
* @api
|
||||
* @param string $sTitle Title of the alert
|
||||
* @param string $sContent The raw HTML content, must be already sanitized
|
||||
* @param string|null $sId id of the html block
|
||||
@@ -112,6 +117,7 @@ class AlertUIBlockFactory extends AbstractUIBlockFactory
|
||||
/**
|
||||
* Make an Alert component for failure messages
|
||||
*
|
||||
* @api
|
||||
* @param string $sTitle Title of the alert
|
||||
* @param string $sContent The raw HTML content, must be already sanitized
|
||||
* @param string|null $sId id of the html block
|
||||
@@ -126,6 +132,7 @@ class AlertUIBlockFactory extends AbstractUIBlockFactory
|
||||
/**
|
||||
* Make an Alert component with primary color scheme
|
||||
*
|
||||
* @api
|
||||
* @param string $sTitle Title of the alert
|
||||
* @param string $sContent The raw HTML content, must be already sanitized
|
||||
* @param string|null $sId id of the html block
|
||||
@@ -140,6 +147,7 @@ class AlertUIBlockFactory extends AbstractUIBlockFactory
|
||||
/**
|
||||
* Make an Alert component with secondary color scheme
|
||||
*
|
||||
* @api
|
||||
* @param string $sTitle Title of the alert
|
||||
* @param string $sContent The raw HTML content, must be already sanitized
|
||||
* @param string|null $sId id of the html block
|
||||
|
||||
@@ -27,9 +27,9 @@ use utils;
|
||||
* Class ButtonUIBlockFactory
|
||||
*
|
||||
* @author Guillaume Lajarige <guillaume.lajarige@combodo.com>
|
||||
* @package Combodo\iTop\Application\UI\Base\Component\Button
|
||||
* @since 3.0.0
|
||||
* @package UIBlockExtensibilityAPI
|
||||
* @api
|
||||
* @since 3.0.0
|
||||
*
|
||||
* @link <itop_url>/test/VisualTest/Backoffice/RenderAllUiBlocks.php#title-buttons to see live examples
|
||||
*/
|
||||
@@ -47,6 +47,7 @@ class ButtonUIBlockFactory extends AbstractUIBlockFactory
|
||||
/**
|
||||
* Make a basis Button component for any purpose
|
||||
*
|
||||
* @api
|
||||
* @param string $sLabel
|
||||
* @param string|null $sName See {@link Button::$sName}
|
||||
* @param string|null $sId
|
||||
|
||||
@@ -15,9 +15,9 @@ use Combodo\iTop\Application\UI\Base\Component\PopoverMenu\PopoverMenu;
|
||||
* Class ButtonGroupUIBlockFactory
|
||||
*
|
||||
* @author Guillaume Lajarige <guillaume.lajarige@combodo.com>
|
||||
* @package Combodo\iTop\Application\UI\Base\Component\Button
|
||||
* @since 3.0.0
|
||||
* @package UIBlockExtensibilityAPI
|
||||
* @api
|
||||
* @since 3.0.0
|
||||
*/
|
||||
class ButtonGroupUIBlockFactory extends AbstractUIBlockFactory
|
||||
{
|
||||
@@ -29,6 +29,7 @@ class ButtonGroupUIBlockFactory extends AbstractUIBlockFactory
|
||||
/**
|
||||
* Make a button that has a primary action ($oButton) but also an options menu ($oMenu) on the side
|
||||
*
|
||||
* @api
|
||||
* @param \Combodo\iTop\Application\UI\Base\Component\Button\Button $oButton
|
||||
* @param \Combodo\iTop\Application\UI\Base\Component\PopoverMenu\PopoverMenu $oMenu
|
||||
*
|
||||
|
||||
@@ -14,9 +14,9 @@ use Combodo\iTop\Application\UI\Base\AbstractUIBlockFactory;
|
||||
* Class CollapsibleSectionUIBlockFactory
|
||||
*
|
||||
* @author Pierre Goiffon <pierre.goiffon@combodo.com>
|
||||
* @package Combodo\iTop\Application\UI\Base\Component\CollapsibleSection
|
||||
* @since 3.0.0
|
||||
* @package UIBlockExtensibilityAPI
|
||||
* @api
|
||||
* @since 3.0.0
|
||||
*/
|
||||
class CollapsibleSectionUIBlockFactory extends AbstractUIBlockFactory
|
||||
{
|
||||
@@ -26,6 +26,7 @@ class CollapsibleSectionUIBlockFactory extends AbstractUIBlockFactory
|
||||
public const UI_BLOCK_CLASS_NAME = CollapsibleSection::class;
|
||||
|
||||
/**
|
||||
* @api
|
||||
* @param string $sTitle
|
||||
* @param string|null $sId
|
||||
*
|
||||
|
||||
@@ -6,8 +6,8 @@
|
||||
|
||||
namespace Combodo\iTop\Application\UI\Base\Component\DataTable;
|
||||
|
||||
use ApplicationException;
|
||||
use ApplicationContext;
|
||||
use ApplicationException;
|
||||
use appUserPreferences;
|
||||
use AttributeLinkedSet;
|
||||
use cmdbAbstractObject;
|
||||
@@ -35,9 +35,9 @@ use WebPage;
|
||||
* Class DataTableUIBlockFactory
|
||||
*
|
||||
* @author Anne-Catherine Cognet <anne-catherine.cognet@combodo.com>
|
||||
* @package Combodo\iTop\Application\UI\Base\Component\DataTable
|
||||
* @since 3.0.0
|
||||
* @package UIBlockExtensibilityAPI
|
||||
* @api
|
||||
* @since 3.0.0
|
||||
*/
|
||||
class DataTableUIBlockFactory extends AbstractUIBlockFactory
|
||||
{
|
||||
@@ -47,6 +47,7 @@ class DataTableUIBlockFactory extends AbstractUIBlockFactory
|
||||
public const UI_BLOCK_CLASS_NAME = DataTable::class;
|
||||
|
||||
/**
|
||||
* @api
|
||||
* @param \WebPage $oPage
|
||||
* @param string $sListId
|
||||
* @param \DBObjectSet $oSet
|
||||
@@ -71,6 +72,7 @@ class DataTableUIBlockFactory extends AbstractUIBlockFactory
|
||||
}
|
||||
|
||||
/**
|
||||
* @api
|
||||
* @param \WebPage $oPage
|
||||
* @param string $sListId
|
||||
* @param DBObjectSet $oSet
|
||||
@@ -183,6 +185,7 @@ class DataTableUIBlockFactory extends AbstractUIBlockFactory
|
||||
/**
|
||||
* Make a basis Panel component
|
||||
*
|
||||
* @api
|
||||
* @param string $sListId
|
||||
* @param \DBObjectSet $oSet
|
||||
* @param array $aExtraParams
|
||||
@@ -479,6 +482,7 @@ class DataTableUIBlockFactory extends AbstractUIBlockFactory
|
||||
}
|
||||
|
||||
/**
|
||||
* @api
|
||||
* @param string $sListId
|
||||
* @param DBObjectSet $oSet
|
||||
* @param array $aExtraParams
|
||||
@@ -721,7 +725,9 @@ class DataTableUIBlockFactory extends AbstractUIBlockFactory
|
||||
* @param string $sSelectMode
|
||||
* @param string $sFilter
|
||||
* @param int $iLength
|
||||
* @param array $aClassAliases
|
||||
* @param array $aExtraParams
|
||||
* @param string $sTableId
|
||||
*
|
||||
* @return array
|
||||
* @throws \Exception
|
||||
@@ -901,6 +907,7 @@ JS;
|
||||
}
|
||||
|
||||
/**
|
||||
* @api
|
||||
* @param string $sTitle
|
||||
* @param array $aColumns
|
||||
* @param array $aData
|
||||
@@ -936,6 +943,7 @@ JS;
|
||||
}
|
||||
|
||||
/**
|
||||
* @api
|
||||
* @param string $sRef
|
||||
* @param array $aColumns
|
||||
* @param array $aData
|
||||
|
||||
@@ -16,9 +16,10 @@ use Combodo\iTop\Application\UI\Base\UIBlock;
|
||||
*
|
||||
* Use it to make a "field" which is composed of a label and a value (which can be read-only or editable)
|
||||
*
|
||||
* @api
|
||||
* @package UIBlockExtensibilityAPI
|
||||
* @author Pierre Goiffon <pierre.goiffon@combodo.com>
|
||||
* @since 3.0.0
|
||||
* @internal
|
||||
*/
|
||||
class FieldUIBlockFactory extends AbstractUIBlockFactory
|
||||
{
|
||||
@@ -27,6 +28,12 @@ class FieldUIBlockFactory extends AbstractUIBlockFactory
|
||||
/** @inheritDoc */
|
||||
public const UI_BLOCK_CLASS_NAME = Field::class;
|
||||
|
||||
/**
|
||||
* @api
|
||||
* @param $aParams
|
||||
*
|
||||
* @return \Combodo\iTop\Application\UI\Base\Component\Field\Field
|
||||
*/
|
||||
public static function MakeFromParams($aParams)
|
||||
{
|
||||
$oValue = new Html($aParams['value']);
|
||||
@@ -75,6 +82,14 @@ class FieldUIBlockFactory extends AbstractUIBlockFactory
|
||||
$oField->$sMethodName((($iParamsFlags & $iConstant) === $iConstant));
|
||||
}
|
||||
|
||||
/**
|
||||
* @api
|
||||
* @param string $sLabel
|
||||
* @param \Combodo\iTop\Application\UI\Base\UIBlock $oInput
|
||||
* @param string|null $sLayout
|
||||
*
|
||||
* @return \Combodo\iTop\Application\UI\Base\Component\Field\Field
|
||||
*/
|
||||
public static function MakeFromObject(string $sLabel, UIBlock $oInput, ?string $sLayout = null)
|
||||
{
|
||||
$oField = new Field($sLabel, $oInput);
|
||||
@@ -135,4 +150,4 @@ class FieldUIBlockFactory extends AbstractUIBlockFactory
|
||||
return $oField;
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -16,7 +16,7 @@ use utils;
|
||||
* Class FieldBadgeUIBlockFactory
|
||||
*
|
||||
* @author Eric espie <eric.espie@combodo.com>
|
||||
* @package Combodo\iTop\Application\UI\Base\Component\FieldBadge
|
||||
* @package UIBlockExtensibilityAPI
|
||||
* @since 3.0.0
|
||||
* @internal
|
||||
*/
|
||||
|
||||
@@ -14,9 +14,9 @@ use Combodo\iTop\Application\UI\Base\AbstractUIBlockFactory;
|
||||
* Class FieldSetUIBlockFactory
|
||||
*
|
||||
* @author eric Espie <eric.espie@combodo.com>
|
||||
* @package Combodo\iTop\Application\UI\Base\Component\FieldSet
|
||||
* @since 3.0.0
|
||||
* @package UIBlockExtensibilityAPI
|
||||
* @api
|
||||
* @since 3.0.0
|
||||
*/
|
||||
class FieldSetUIBlockFactory extends AbstractUIBlockFactory
|
||||
{
|
||||
@@ -26,6 +26,7 @@ class FieldSetUIBlockFactory extends AbstractUIBlockFactory
|
||||
public const UI_BLOCK_CLASS_NAME = FieldSet::class;
|
||||
|
||||
/**
|
||||
* @api
|
||||
* @param string $sLegend
|
||||
* @param string|null $sId
|
||||
*
|
||||
|
||||
@@ -14,7 +14,7 @@ use Combodo\iTop\Application\UI\Base\AbstractUIBlockFactory;
|
||||
* Class FormUIBlockFactory
|
||||
*
|
||||
* @author Eric Espie <eric.espie@combodo.com>
|
||||
* @package Combodo\iTop\Application\UI\Base\Component\Form
|
||||
* @package UUIBlockExtensibilityAPI
|
||||
* @since 3.0.0
|
||||
* @api
|
||||
*/
|
||||
@@ -26,6 +26,7 @@ class FormUIBlockFactory extends AbstractUIBlockFactory
|
||||
public const UI_BLOCK_CLASS_NAME = Form::class;
|
||||
|
||||
/**
|
||||
* @api
|
||||
* @param string|null $sId
|
||||
*
|
||||
* @return \Combodo\iTop\Application\UI\Base\Component\Form\Form An HTML form in which you can add UIBlocks
|
||||
|
||||
@@ -14,9 +14,9 @@ use Combodo\iTop\Application\UI\Base\AbstractUIBlockFactory;
|
||||
* Class FileSelectUIBlockFactory
|
||||
*
|
||||
* @author Eric Espie <eric.espie@combodo.com>
|
||||
* @package Combodo\iTop\Application\UI\Base\Component\Input\FileSelect
|
||||
* @since 3.0.0
|
||||
* @package UIBlockExtensibilityAPI
|
||||
* @api
|
||||
* @since 3.0.0
|
||||
*/
|
||||
class FileSelectUIBlockFactory extends AbstractUIBlockFactory
|
||||
{
|
||||
@@ -26,6 +26,7 @@ class FileSelectUIBlockFactory extends AbstractUIBlockFactory
|
||||
public const UI_BLOCK_CLASS_NAME = FileSelect::class;
|
||||
|
||||
/**
|
||||
* @api
|
||||
* @param string $sName
|
||||
* @param string|null $sId
|
||||
*
|
||||
|
||||
@@ -15,9 +15,9 @@ use Combodo\iTop\Application\UI\Base\Component\Field\Field;
|
||||
* Class InputUIBlockFactory
|
||||
*
|
||||
* @author Eric Espie <eric.espie@combodo.com>
|
||||
* @package Combodo\iTop\Application\UI\Base\Component\Input
|
||||
* @package UIBlockExtensibilityAPI
|
||||
* @api
|
||||
* @since 3.0.0
|
||||
* @internal
|
||||
*/
|
||||
class InputUIBlockFactory extends AbstractUIBlockFactory
|
||||
{
|
||||
@@ -26,6 +26,14 @@ class InputUIBlockFactory extends AbstractUIBlockFactory
|
||||
/** @inheritDoc */
|
||||
public const UI_BLOCK_CLASS_NAME = Input::class;
|
||||
|
||||
/**
|
||||
* @api
|
||||
* @param string $sName
|
||||
* @param string $sValue
|
||||
* @param string|null $sId
|
||||
*
|
||||
* @return \Combodo\iTop\Application\UI\Base\Component\Input\Input
|
||||
*/
|
||||
public static function MakeForHidden(string $sName, string $sValue, ?string $sId = null)
|
||||
{
|
||||
$oInput = new Input($sId);
|
||||
@@ -37,6 +45,15 @@ class InputUIBlockFactory extends AbstractUIBlockFactory
|
||||
return $oInput;
|
||||
}
|
||||
|
||||
/**
|
||||
* @api
|
||||
* @param string $sType
|
||||
* @param string $sName
|
||||
* @param string $sValue
|
||||
* @param string|null $sId
|
||||
*
|
||||
* @return \Combodo\iTop\Application\UI\Base\Component\Input\Input
|
||||
*/
|
||||
public static function MakeStandard(string $sType, string $sName, string $sValue, ?string $sId = null)
|
||||
{
|
||||
$oInput = new Input($sId);
|
||||
@@ -49,6 +66,7 @@ class InputUIBlockFactory extends AbstractUIBlockFactory
|
||||
}
|
||||
|
||||
/**
|
||||
* @api
|
||||
* @see Field component that is better adapter when dealing with a standard iTop form
|
||||
*
|
||||
* @param string $sLabel
|
||||
@@ -71,6 +89,15 @@ class InputUIBlockFactory extends AbstractUIBlockFactory
|
||||
return static::MakeInputWithLabel($sInputName, $sLabel, $oInput, $sInputId);
|
||||
}
|
||||
|
||||
/**
|
||||
* @api
|
||||
* @param string $sName
|
||||
* @param string $sLabel
|
||||
* @param \Combodo\iTop\Application\UI\Base\Component\Input\Input $oInput
|
||||
* @param string|null $sId
|
||||
*
|
||||
* @return \Combodo\iTop\Application\UI\Base\Component\Input\InputWithLabel
|
||||
*/
|
||||
private static function MakeInputWithLabel(string $sName, string $sLabel, Input $oInput, ?string $sId = null)
|
||||
{
|
||||
$oInput->SetName($sName);
|
||||
|
||||
@@ -14,9 +14,9 @@ use Combodo\iTop\Application\UI\Base\AbstractUIBlockFactory;
|
||||
* Class SelectOptionUIBlockFactory
|
||||
*
|
||||
* @author Eric Espie <eric.espie@combodo.com>
|
||||
* @package Combodo\iTop\Application\UI\Base\Component\Input\Select
|
||||
* @package UIBlockExtensibilityAPI
|
||||
* @api
|
||||
* @since 3.0.0
|
||||
* @internal
|
||||
*/
|
||||
class SelectOptionUIBlockFactory extends AbstractUIBlockFactory
|
||||
{
|
||||
@@ -25,6 +25,15 @@ class SelectOptionUIBlockFactory extends AbstractUIBlockFactory
|
||||
/** @inheritDoc */
|
||||
public const UI_BLOCK_CLASS_NAME = SelectOption::class;
|
||||
|
||||
/**
|
||||
* @api
|
||||
* @param string $sValue
|
||||
* @param string $sLabel
|
||||
* @param bool $bSelected
|
||||
* @param string|null $sId
|
||||
*
|
||||
* @return \Combodo\iTop\Application\UI\Base\Component\Input\Select\SelectOption
|
||||
*/
|
||||
public static function MakeForSelectOption(string $sValue, string $sLabel, bool $bSelected, ?string $sId = null)
|
||||
{
|
||||
$oInput = new SelectOption($sId);
|
||||
|
||||
@@ -15,9 +15,9 @@ use Combodo\iTop\Application\UI\Base\Component\Input\Select\Select;
|
||||
* Class SelectUIBlockFactory
|
||||
*
|
||||
* @author Eric Espie <eric.espie@combodo.com>
|
||||
* @package Combodo\iTop\Application\UI\Base\Component\Input
|
||||
* @package UIBlockExtensibilityAPI
|
||||
* @api
|
||||
* @since 3.0.0
|
||||
* @internal
|
||||
*/
|
||||
class SelectUIBlockFactory extends AbstractUIBlockFactory
|
||||
{
|
||||
@@ -29,6 +29,7 @@ class SelectUIBlockFactory extends AbstractUIBlockFactory
|
||||
/**
|
||||
* Create a default Select input
|
||||
*
|
||||
* @api
|
||||
* @param string $sName {@see Select::$sName}
|
||||
* @param string|null $sId {@see UIBlock::$sId}
|
||||
*
|
||||
@@ -47,6 +48,7 @@ class SelectUIBlockFactory extends AbstractUIBlockFactory
|
||||
*
|
||||
* If you need to have a real field with a label, you might use a {@link Field} component instead
|
||||
*
|
||||
* @api
|
||||
* @param string $sName {@see Select::$sName}
|
||||
* @param string $sLabel {@see Select::$sLabel}
|
||||
* @param string|null $sId {@see UIBlock::$sId}
|
||||
|
||||
@@ -25,9 +25,9 @@ use Combodo\iTop\Application\UI\Base\AbstractUIBlockFactory;
|
||||
* Class PanelUIBlockFactory
|
||||
*
|
||||
* @author Guillaume Lajarige <guillaume.lajarige@combodo.com>
|
||||
* @package Combodo\iTop\Application\UI\Base\Component\Panel
|
||||
* @since 3.0.0
|
||||
* @package UIBlockExtensibilityAPI
|
||||
* @api
|
||||
* @since 3.0.0
|
||||
*
|
||||
* @link <itop_url>/test/VisualTest/Backoffice/RenderAllUiBlocks.php#title-panels to see live examples
|
||||
*/
|
||||
@@ -41,6 +41,7 @@ class PanelUIBlockFactory extends AbstractUIBlockFactory
|
||||
/**
|
||||
* Make a basis Panel component
|
||||
*
|
||||
* @api
|
||||
* @param string $sTitle
|
||||
* @param string|null $sSubTitle
|
||||
*
|
||||
@@ -60,6 +61,7 @@ class PanelUIBlockFactory extends AbstractUIBlockFactory
|
||||
/**
|
||||
* Make a Panel component for informational messages
|
||||
*
|
||||
* @api
|
||||
* @param string $sTitle
|
||||
* @param string|null $sSubTitle
|
||||
*
|
||||
@@ -79,6 +81,7 @@ class PanelUIBlockFactory extends AbstractUIBlockFactory
|
||||
/**
|
||||
* Make a Panel component for successful messages
|
||||
*
|
||||
* @api
|
||||
* @param string $sTitle
|
||||
* @param string|null $sSubTitle
|
||||
*
|
||||
@@ -98,6 +101,7 @@ class PanelUIBlockFactory extends AbstractUIBlockFactory
|
||||
/**
|
||||
* Make a Panel component for warning messages
|
||||
*
|
||||
* @api
|
||||
* @param string $sTitle
|
||||
* @param string|null $sSubTitle
|
||||
*
|
||||
@@ -117,6 +121,7 @@ class PanelUIBlockFactory extends AbstractUIBlockFactory
|
||||
/**
|
||||
* Make a Panel component for danger messages
|
||||
*
|
||||
* @api
|
||||
* @param string $sTitle
|
||||
* @param string|null $sSubTitle
|
||||
*
|
||||
@@ -136,6 +141,7 @@ class PanelUIBlockFactory extends AbstractUIBlockFactory
|
||||
/**
|
||||
* Make a Panel component for failure messages
|
||||
*
|
||||
* @api
|
||||
* @param string $sTitle
|
||||
* @param string|null $sSubTitle
|
||||
*
|
||||
@@ -155,6 +161,7 @@ class PanelUIBlockFactory extends AbstractUIBlockFactory
|
||||
/**
|
||||
* Make a Panel component with primary color scheme
|
||||
*
|
||||
* @api
|
||||
* @param string $sTitle
|
||||
* @param string|null $sSubTitle
|
||||
*
|
||||
@@ -174,6 +181,7 @@ class PanelUIBlockFactory extends AbstractUIBlockFactory
|
||||
/**
|
||||
* Make a Panel component with secondary color scheme
|
||||
*
|
||||
* @api
|
||||
* @param string $sTitle
|
||||
* @param string|null $sSubTitle
|
||||
*
|
||||
@@ -193,6 +201,7 @@ class PanelUIBlockFactory extends AbstractUIBlockFactory
|
||||
/**
|
||||
* Make a Panel component with the specific $sClass color scheme
|
||||
*
|
||||
* @api
|
||||
* @param string $sClass Class of the object the panel is for
|
||||
* @param string $sTitle
|
||||
* @param string|null $sSubTitle
|
||||
|
||||
@@ -14,9 +14,9 @@ use Combodo\iTop\Application\UI\Base\AbstractUIBlockFactory;
|
||||
* Class SpinnerUIBlockFactory
|
||||
*
|
||||
* @author Eric Espie <eric.espie@combodo.com>
|
||||
* @package Combodo\iTop\Application\UI\Base\Component\Spinner
|
||||
* @package UIBlockExtensibilityAPI
|
||||
* @api
|
||||
* @since 3.0.0
|
||||
* @internal
|
||||
*/
|
||||
class SpinnerUIBlockFactory extends AbstractUIBlockFactory
|
||||
{
|
||||
@@ -25,6 +25,12 @@ class SpinnerUIBlockFactory extends AbstractUIBlockFactory
|
||||
/** @inheritDoc */
|
||||
public const UI_BLOCK_CLASS_NAME = Spinner::class;
|
||||
|
||||
/**
|
||||
* @api
|
||||
* @param string|null $sId
|
||||
*
|
||||
* @return \Combodo\iTop\Application\UI\Base\Component\Spinner\Spinner
|
||||
*/
|
||||
public static function MakeStandard(?string $sId = null)
|
||||
{
|
||||
return new Spinner($sId);
|
||||
|
||||
@@ -16,9 +16,9 @@ use Combodo\iTop\Application\UI\Base\UIBlock;
|
||||
* Class TitleUIBlockFactory
|
||||
*
|
||||
* @author Eric Espie <eric.espie@combodo.com>
|
||||
* @package Combodo\iTop\Application\UI\Base\Component\Title
|
||||
* @package UIBlockExtensibilityAPI
|
||||
* @api
|
||||
* @since 3.0.0
|
||||
* @internal
|
||||
*/
|
||||
class TitleUIBlockFactory extends AbstractUIBlockFactory
|
||||
{
|
||||
@@ -27,11 +27,28 @@ class TitleUIBlockFactory extends AbstractUIBlockFactory
|
||||
/** @inheritDoc */
|
||||
public const UI_BLOCK_CLASS_NAME = Title::class;
|
||||
|
||||
/**
|
||||
* @api
|
||||
* @param string $sTitle
|
||||
* @param string|null $sId
|
||||
*
|
||||
* @return \Combodo\iTop\Application\UI\Base\Component\Title\Title
|
||||
*/
|
||||
public static function MakeForPage(string $sTitle, ?string $sId = null)
|
||||
{
|
||||
return new Title(new Text($sTitle), 1, $sId);
|
||||
}
|
||||
|
||||
/**
|
||||
* @api
|
||||
* @param string $sTitle
|
||||
* @param string $sIconUrl
|
||||
* @param string $sIconCoverMethod
|
||||
* @param bool $bIsMedallion
|
||||
* @param string|null $sId
|
||||
*
|
||||
* @return \Combodo\iTop\Application\UI\Base\Component\Title\Title
|
||||
*/
|
||||
public static function MakeForPageWithIcon(
|
||||
string $sTitle, string $sIconUrl, string $sIconCoverMethod = Title::DEFAULT_ICON_COVER_METHOD, bool $bIsMedallion = true,
|
||||
?string $sId = null
|
||||
@@ -43,11 +60,27 @@ class TitleUIBlockFactory extends AbstractUIBlockFactory
|
||||
return $oTitle;
|
||||
}
|
||||
|
||||
/**
|
||||
* @api
|
||||
* @param string $sTitle
|
||||
* @param int $iLevel
|
||||
* @param string|null $sId
|
||||
*
|
||||
* @return \Combodo\iTop\Application\UI\Base\Component\Title\Title
|
||||
*/
|
||||
public static function MakeNeutral(string $sTitle, int $iLevel = 1, ?string $sId = null)
|
||||
{
|
||||
return new Title(new Text($sTitle), $iLevel, $sId);
|
||||
}
|
||||
|
||||
/**
|
||||
* @api
|
||||
* @param \Combodo\iTop\Application\UI\Base\UIBlock $oTitle
|
||||
* @param int $iLevel
|
||||
* @param string|null $sId
|
||||
*
|
||||
* @return \Combodo\iTop\Application\UI\Base\Component\Title\Title
|
||||
*/
|
||||
public static function MakeStandard(UIBlock $oTitle, int $iLevel = 1, ?string $sId = null)
|
||||
{
|
||||
return new Title($oTitle, $iLevel, $sId);
|
||||
|
||||
@@ -9,14 +9,15 @@ namespace Combodo\iTop\Application\UI\Base\Component\Toolbar\Separator;
|
||||
|
||||
|
||||
use Combodo\iTop\Application\UI\Base\AbstractUIBlockFactory;
|
||||
use Combodo\iTop\Application\UI\Base\Component\Toolbar\Toolbar;
|
||||
|
||||
/**
|
||||
* Class ToolbarSeparatorUIBlockFactory
|
||||
*
|
||||
* @author Guillaume Lajarige <guillaume.lajarige@combodo.com>
|
||||
* @package Combodo\iTop\Application\UI\Base\Component\Toolbar\Separator
|
||||
* @since 3.0.0
|
||||
* @package UIBlockExtensibilityAPI
|
||||
* @api
|
||||
* @since 3.0.0
|
||||
*/
|
||||
class ToolbarSeparatorUIBlockFactory extends AbstractUIBlockFactory
|
||||
{
|
||||
@@ -26,6 +27,7 @@ class ToolbarSeparatorUIBlockFactory extends AbstractUIBlockFactory
|
||||
public const UI_BLOCK_CLASS_NAME = Toolbar::class;
|
||||
|
||||
/**
|
||||
* @api
|
||||
* @param string|null $sId
|
||||
*
|
||||
* @return \Combodo\iTop\Application\UI\Base\Component\Toolbar\Separator\VerticalSeparator
|
||||
|
||||
@@ -14,9 +14,9 @@ use Combodo\iTop\Application\UI\Base\AbstractUIBlockFactory;
|
||||
* Class ToolbarSpacerUIBlockFactory
|
||||
*
|
||||
* @author Eric Espie <eric.espie@combodo.com>
|
||||
* @package Combodo\iTop\Application\UI\Base\Component\Toolbar\ToolbarSpacer
|
||||
* @package UIBlockExtensibilityAPI
|
||||
* @api
|
||||
* @since 3.0.0
|
||||
* @internal
|
||||
*/
|
||||
class ToolbarSpacerUIBlockFactory extends AbstractUIBlockFactory
|
||||
{
|
||||
@@ -26,6 +26,7 @@ class ToolbarSpacerUIBlockFactory extends AbstractUIBlockFactory
|
||||
public const UI_BLOCK_CLASS_NAME = ToolbarSpacer::class;
|
||||
|
||||
/**
|
||||
* @api
|
||||
* @param string|null $sId
|
||||
*
|
||||
* @return \Combodo\iTop\Application\UI\Base\Component\Toolbar\ToolbarSpacer\ToolbarSpacer
|
||||
|
||||
@@ -14,9 +14,9 @@ use Combodo\iTop\Application\UI\Base\AbstractUIBlockFactory;
|
||||
* Class ToolbarUIBlockFactory
|
||||
*
|
||||
* @author Eric Espie <eric.espie@combodo.com>
|
||||
* @package Combodo\iTop\Application\UI\Base\Component\Toolbar
|
||||
* @package UIBlockExtensibilityAPI
|
||||
* @api
|
||||
* @since 3.0.0
|
||||
* @internal
|
||||
*/
|
||||
class ToolbarUIBlockFactory extends AbstractUIBlockFactory
|
||||
{
|
||||
@@ -25,16 +25,36 @@ class ToolbarUIBlockFactory extends AbstractUIBlockFactory
|
||||
/** @inheritDoc */
|
||||
public const UI_BLOCK_CLASS_NAME = Toolbar::class;
|
||||
|
||||
/**
|
||||
* @api
|
||||
* @param string|null $sId
|
||||
*
|
||||
* @return \Combodo\iTop\Application\UI\Base\Component\Toolbar\Toolbar
|
||||
*/
|
||||
public static function MakeForAction(string $sId = null)
|
||||
{
|
||||
return new Toolbar($sId, ['ibo-toolbar--action']);
|
||||
}
|
||||
|
||||
/**
|
||||
* @api
|
||||
* @param string|null $sId
|
||||
* @param array $aContainerClasses
|
||||
*
|
||||
* @return \Combodo\iTop\Application\UI\Base\Component\Toolbar\Toolbar
|
||||
*/
|
||||
public static function MakeStandard(string $sId = null, array $aContainerClasses = [])
|
||||
{
|
||||
return new Toolbar($sId, $aContainerClasses);
|
||||
}
|
||||
|
||||
/**
|
||||
* @api
|
||||
* @param string|null $sId
|
||||
* @param array $aContainerClasses
|
||||
*
|
||||
* @return \Combodo\iTop\Application\UI\Base\Component\Toolbar\Toolbar
|
||||
*/
|
||||
public static function MakeForButton(string $sId = null, array $aContainerClasses = [])
|
||||
{
|
||||
return new Toolbar($sId, array_merge($aContainerClasses, ['ibo-toolbar--button']));
|
||||
|
||||
@@ -24,6 +24,7 @@ use AttributeDateTime;
|
||||
use Combodo\iTop\Application\UI\Base\UIBlock;
|
||||
use Combodo\iTop\Core\CMDBChange\CMDBChangeOrigin;
|
||||
use DateTime;
|
||||
use MetaModel;
|
||||
use UserRights;
|
||||
use utils;
|
||||
|
||||
@@ -74,6 +75,8 @@ class ActivityEntry extends UIBlock
|
||||
*/
|
||||
protected $sOrigin;
|
||||
|
||||
protected $bShowAuthorNameBelowEntries;
|
||||
|
||||
/**
|
||||
* ActivityEntry constructor.
|
||||
*
|
||||
@@ -94,6 +97,7 @@ class ActivityEntry extends UIBlock
|
||||
$this->SetDateTime($oDateTime);
|
||||
$this->SetAuthor($sAuthorLogin);
|
||||
$this->SetOrigin(static::DEFAULT_ORIGIN);
|
||||
$this->SetShowAuthorNameBelowEntries(MetaModel::GetConfig()->Get('activity_panel.show_author_name_below_entries'));
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -306,6 +310,22 @@ class ActivityEntry extends UIBlock
|
||||
return $this->sOrigin;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return mixed
|
||||
*/
|
||||
public function ShowAuthorNameBelowEntries(): bool
|
||||
{
|
||||
return $this->bShowAuthorNameBelowEntries;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param bool $bShowAuthorNameBelowEntries
|
||||
*/
|
||||
public function SetShowAuthorNameBelowEntries($bShowAuthorNameBelowEntries): void
|
||||
{
|
||||
$this->bShowAuthorNameBelowEntries = $bShowAuthorNameBelowEntries;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string|null The CSS decoration classes for the origin of the entry
|
||||
* @see \CMDBChangeOrigin
|
||||
|
||||
@@ -90,6 +90,17 @@ class ActivityPanel extends UIBlock
|
||||
protected $oComposeMenu;
|
||||
/** @var bool Whether a confirmation dialog should be prompt when multiple entries are about to be submitted at once */
|
||||
protected $bShowMultipleEntriesSubmitConfirmation;
|
||||
/** @var int */
|
||||
protected $iDatetimesReformatLimit;
|
||||
/** @var int */
|
||||
protected $iLockWatcherPeriod;
|
||||
/** @var bool */
|
||||
protected $bPrefilterOnlyCurrentLog;
|
||||
/** @var bool */
|
||||
protected $bPrefilterStateChangesOnLogs;
|
||||
/** @var bool */
|
||||
protected $bPrefilterEditsOnLogs;
|
||||
|
||||
|
||||
/**
|
||||
* ActivityPanel constructor.
|
||||
@@ -105,12 +116,18 @@ class ActivityPanel extends UIBlock
|
||||
{
|
||||
parent::__construct($sId);
|
||||
|
||||
$oConfig = MetaModel::GetConfig();
|
||||
$this->InitializeCaseLogTabs();
|
||||
$this->InitializeCaseLogTabsEntryForms();
|
||||
$this->InitializeComposeMenu();
|
||||
$this->SetObjectMode(cmdbAbstractObject::DEFAULT_DISPLAY_MODE);
|
||||
$this->SetObject($oObject);
|
||||
$this->SetEntries($aEntries);
|
||||
$this->SetDatetimesReformatLimit($oConfig->Get('activity_panel.datetimes_reformat_limit'));
|
||||
$this->SetLockWatcherPeriod($oConfig->Get('activity_panel.lock_watcher_period'));
|
||||
$this->SetPrefilterOnlyCurrentLog($oConfig->Get('activity_panel.prefilter_only_current_log'));
|
||||
$this->SetPrefilterStateChangesOnLogs($oConfig->Get('activity_panel.prefilter_state_changes_on_logs'));
|
||||
$this->SetPrefilterEditsOnLogs($oConfig->Get('activity_panel.prefilter_edits_on_logs'));
|
||||
$this->bAreEntriesSorted = false;
|
||||
$this->bHasMoreEntriesToLoad = false;
|
||||
$this->aLastLoadedEntriesIds = [];
|
||||
@@ -780,7 +797,7 @@ class ActivityPanel extends UIBlock
|
||||
}
|
||||
|
||||
/**
|
||||
* @return bool True if the entry form shouldbe opened by default, false otherwise. Based on the user pref. or the config. param. by default.
|
||||
* @return bool True if the entry form should be opened by default, false otherwise. Based on the user pref. or the config. param. by default.
|
||||
* @throws \CoreException
|
||||
* @throws \CoreUnexpectedValue
|
||||
* @throws \MySQLException
|
||||
@@ -846,6 +863,86 @@ class ActivityPanel extends UIBlock
|
||||
return utils::GetAbsoluteUrlAppRoot().'pages/ajax.render.php';
|
||||
}
|
||||
|
||||
/**
|
||||
* @return int
|
||||
*/
|
||||
public function GetDatetimesReformatLimit(): int
|
||||
{
|
||||
return $this->iDatetimesReformatLimit;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param int $iDatetimesReformatLimit
|
||||
*/
|
||||
public function SetDatetimesReformatLimit(int $iDatetimesReformatLimit): void
|
||||
{
|
||||
$this->iDatetimesReformatLimit = $iDatetimesReformatLimit;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return int
|
||||
*/
|
||||
public function GetLockWatcherPeriod(): int
|
||||
{
|
||||
return $this->iLockWatcherPeriod;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param int $iLockWatcherPeriod
|
||||
*/
|
||||
public function SetLockWatcherPeriod(int $iLockWatcherPeriod): void
|
||||
{
|
||||
$this->iLockWatcherPeriod = $iLockWatcherPeriod;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return bool
|
||||
*/
|
||||
public function GetPrefilterOnlyCurrentLog(): bool
|
||||
{
|
||||
return $this->bPrefilterOnlyCurrentLog;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param bool $bPrefilterOnlyCurrentLog
|
||||
*/
|
||||
public function SetPrefilterOnlyCurrentLog(bool $bPrefilterOnlyCurrentLog): void
|
||||
{
|
||||
$this->bPrefilterOnlyCurrentLog = $bPrefilterOnlyCurrentLog;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return bool
|
||||
*/
|
||||
public function GetPrefilterStateChangesOnLogs(): bool
|
||||
{
|
||||
return $this->bPrefilterStateChangesOnLogs;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param bool $bPrefilterStateChangesOnLogs
|
||||
*/
|
||||
public function SetPrefilterStateChangesOnLogs(bool $bPrefilterStateChangesOnLogs): void
|
||||
{
|
||||
$this->bPrefilterStateChangesOnLogs = $bPrefilterStateChangesOnLogs;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return bool
|
||||
*/
|
||||
public function GetPrefilterEditsOnLogs(): bool
|
||||
{
|
||||
return $this->bPrefilterEditsOnLogs;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param bool $bPrefilterEditsOnLogs
|
||||
*/
|
||||
public function SetPrefilterEditsOnLogs(bool $bPrefilterEditsOnLogs): void
|
||||
{
|
||||
$this->bPrefilterEditsOnLogs = $bPrefilterEditsOnLogs;
|
||||
}
|
||||
|
||||
/**
|
||||
* @inheritdoc
|
||||
*/
|
||||
|
||||
@@ -5,6 +5,7 @@
|
||||
*/
|
||||
namespace Combodo\iTop\Application\UI\Base\Layout\ActivityPanel\CaseLogEntryForm;
|
||||
|
||||
use AttributeCaseLog;
|
||||
use cmdbAbstractObject;
|
||||
use Combodo\iTop\Application\UI\Base\Component\Input\RichText\RichText;
|
||||
use Combodo\iTop\Application\UI\Base\Layout\UIContentBlock;
|
||||
@@ -105,6 +106,15 @@ class CaseLogEntryForm extends UIContentBlock
|
||||
return $this->sAttCode;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
* @since 3.0.4 3.1.0 N°6139
|
||||
*/
|
||||
public function GetAttType(): string
|
||||
{
|
||||
return AttributeCaseLog::class;
|
||||
}
|
||||
|
||||
/**
|
||||
* @see static::$sAttCode
|
||||
* @return string
|
||||
|
||||
@@ -15,7 +15,7 @@ use Combodo\iTop\Application\UI\Base\UIBlock;
|
||||
* Class ColumnUIBlockFactory
|
||||
*
|
||||
* @author Eric Espie <eric.espie@combodo.com>
|
||||
* @package Combodo\iTop\Application\UI\Base\Layout\MultiColumn\Column
|
||||
* @package UIBlockExtensibilityAPI
|
||||
* @since 3.0.0
|
||||
* @api
|
||||
*/
|
||||
@@ -26,6 +26,12 @@ class ColumnUIBlockFactory extends AbstractUIBlockFactory
|
||||
/** @inheritDoc */
|
||||
public const UI_BLOCK_CLASS_NAME = Column::class;
|
||||
|
||||
/**
|
||||
* @api
|
||||
* @param string|null $sId
|
||||
*
|
||||
* @return \Combodo\iTop\Application\UI\Base\Layout\MultiColumn\Column\Column
|
||||
*/
|
||||
public static function MakeStandard(?string $sId = null)
|
||||
{
|
||||
$oInput = new Column($sId);
|
||||
@@ -33,6 +39,13 @@ class ColumnUIBlockFactory extends AbstractUIBlockFactory
|
||||
return $oInput;
|
||||
}
|
||||
|
||||
/**
|
||||
* @api
|
||||
* @param \Combodo\iTop\Application\UI\Base\UIBlock $oBlock
|
||||
* @param string|null $sId
|
||||
*
|
||||
* @return \Combodo\iTop\Application\UI\Base\Layout\MultiColumn\Column\Column
|
||||
*/
|
||||
public static function MakeForBlock(UIBlock $oBlock, ?string $sId = null)
|
||||
{
|
||||
$oInput = new Column($sId);
|
||||
|
||||
@@ -13,7 +13,7 @@ use Combodo\iTop\Application\UI\Base\AbstractUIBlockFactory;
|
||||
* Class MultiColumnUIBlockFactory
|
||||
*
|
||||
* @author Eric Espie <eric.espie@combodo.com>
|
||||
* @package Combodo\iTop\Application\UI\Base\Layout\MultiColumn
|
||||
* @package UIBlockExtensibilityAPI
|
||||
* @since 3.0.0
|
||||
* @api
|
||||
*/
|
||||
@@ -24,6 +24,12 @@ class MultiColumnUIBlockFactory extends AbstractUIBlockFactory
|
||||
/** @inheritDoc */
|
||||
public const UI_BLOCK_CLASS_NAME = MultiColumn::class;
|
||||
|
||||
/**
|
||||
* @api
|
||||
* @param string|null $sId
|
||||
*
|
||||
* @return \Combodo\iTop\Application\UI\Base\Layout\MultiColumn\MultiColumn
|
||||
*/
|
||||
public static function MakeStandard(?string $sId = null)
|
||||
{
|
||||
$oInput = new MultiColumn($sId);
|
||||
|
||||
@@ -86,6 +86,9 @@ class NavigationMenu extends UIBlock implements iKeyboardShortcut
|
||||
protected $bIsExpanded;
|
||||
/** @var bool Whether the hint on how the menu filter works shoudl be displayed or not */
|
||||
protected $bShowMenuFilterHint;
|
||||
/** @var bool */
|
||||
protected $bShowMenusCount;
|
||||
|
||||
|
||||
/**
|
||||
* NavigationMenu constructor.
|
||||
@@ -106,10 +109,13 @@ class NavigationMenu extends UIBlock implements iKeyboardShortcut
|
||||
) {
|
||||
parent::__construct($sId);
|
||||
|
||||
$oConfig = MetaModel::GetConfig();
|
||||
|
||||
$this->sAppRevisionNumber = utils::GetAppRevisionNumber();
|
||||
$this->sAppSquareIconUrl = Branding::GetCompactMainLogoAbsoluteUrl();
|
||||
$this->sAppFullIconUrl = Branding::GetFullMainLogoAbsoluteUrl();
|
||||
$this->sAppIconLink = MetaModel::GetConfig()->Get('app_icon_url');
|
||||
$this->sAppIconLink = $oConfig->Get('app_icon_url');
|
||||
$this->SetShowMenusCount($oConfig->Get('navigation_menu.show_menus_count'));
|
||||
$this->aSiloSelection = array();
|
||||
$this->aMenuGroups = ApplicationMenu::GetMenuGroups($oAppContext->GetAsHash());
|
||||
$this->oUserMenu = $oUserMenu;
|
||||
@@ -491,4 +497,21 @@ JS;
|
||||
{
|
||||
return "[data-role='".static::BLOCK_CODE."']";
|
||||
}
|
||||
|
||||
/**
|
||||
* @return bool
|
||||
*/
|
||||
public function GetShowMenusCount(): bool
|
||||
{
|
||||
return $this->bShowMenusCount;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param bool $bShowMenusCount
|
||||
*/
|
||||
public function SetShowMenusCount(bool $bShowMenusCount): void
|
||||
{
|
||||
$this->bShowMenusCount = $bShowMenusCount;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -15,7 +15,8 @@ use Combodo\iTop\Application\UI\Base\Component\Html\Html;
|
||||
* Class UIContentBlockUIBlockFactory
|
||||
*
|
||||
* @author Guillaume Lajarige <guillaume.lajarige@combodo.com>
|
||||
* @package Combodo\iTop\Application\UI\Base\Layout
|
||||
* @package UIBlockExtensibilityAPI
|
||||
* @api
|
||||
* @since 3.0.0
|
||||
*/
|
||||
class UIContentBlockUIBlockFactory extends AbstractUIBlockFactory
|
||||
@@ -28,6 +29,7 @@ class UIContentBlockUIBlockFactory extends AbstractUIBlockFactory
|
||||
/**
|
||||
* Make an empty UIContentBlock which can be used to embed anything or to surround another block with specific CSS classes.
|
||||
*
|
||||
* @api
|
||||
* @param string|null $sId
|
||||
* @param array $aContainerClasses
|
||||
*
|
||||
@@ -42,6 +44,7 @@ class UIContentBlockUIBlockFactory extends AbstractUIBlockFactory
|
||||
* Used to display a block of code like <pre> but allows line break.
|
||||
* The \n are replaced by <br>
|
||||
*
|
||||
* @api
|
||||
* @param string $sCode
|
||||
* @param string|null $sId
|
||||
*
|
||||
@@ -59,6 +62,7 @@ class UIContentBlockUIBlockFactory extends AbstractUIBlockFactory
|
||||
/**
|
||||
* Used to display a block of preformatted text in a <pre> tag.
|
||||
*
|
||||
* @api
|
||||
* @param string $sCode
|
||||
* @param string|null $sId
|
||||
*
|
||||
|
||||
@@ -599,6 +599,18 @@ abstract class UIBlock implements iUIBlock
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $sName Name of the data attribute
|
||||
*
|
||||
* @return bool True if $sName is already defined (even as a null value) in the UIBLock data attributes, false otherwise
|
||||
* @see static::$aDataAttributes
|
||||
* @since 3.0.4 3.1.0 N°6140
|
||||
*/
|
||||
public function HasDataAttribute(string $sName): bool
|
||||
{
|
||||
return array_key_exists($sName, $this->aDataAttributes);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return bool
|
||||
* @see static::$aDataAttributes
|
||||
|
||||
@@ -28,7 +28,9 @@ class BlockChartAjaxBars extends UIBlock
|
||||
public $sId;
|
||||
/** @var string */
|
||||
public $sJSURLs;
|
||||
|
||||
/** @var string */
|
||||
public $sURLForRefresh;
|
||||
/** @var int */
|
||||
public $iMaxNbCharsInLabel;
|
||||
|
||||
}
|
||||
@@ -28,6 +28,8 @@ class BlockChartAjaxPie extends UIBlock
|
||||
public $sJSURLs;
|
||||
/** @var string */
|
||||
public $sJSNames;
|
||||
|
||||
/** @var string */
|
||||
public $sURLForRefresh;
|
||||
/** @var int */
|
||||
public $iNbLinesToAddForName;
|
||||
}
|
||||
@@ -7,6 +7,7 @@
|
||||
|
||||
class CLILikeWebPage extends WebPage
|
||||
{
|
||||
const DEFAULT_PAGE_TEMPLATE_REL_PATH = 'pages/backoffice/clilikewebpage/layout';
|
||||
public function add_comment($sText)
|
||||
{
|
||||
$this->add('#'.$sText."<br/>\n");
|
||||
|
||||
@@ -1566,7 +1566,7 @@ JS;
|
||||
*/
|
||||
protected function output_dict_entries($bReturnOutput = false)
|
||||
{
|
||||
if ($this->sContentType != 'text/plain' && $this->sContentType != 'application/json') {
|
||||
if ($this->sContentType != 'text/plain' && $this->sContentType != 'application/json' && $this->sContentType != 'application/javascript') {
|
||||
/** @var \iBackofficeDictEntriesExtension $oExtensionInstance */
|
||||
foreach (MetaModel::EnumPlugins('iBackofficeDictEntriesExtension') as $oExtensionInstance) {
|
||||
foreach ($oExtensionInstance->GetDictEntries() as $sDictEntry) {
|
||||
|
||||
Reference in New Issue
Block a user