mirror of
https://github.com/Combodo/iTop.git
synced 2026-02-13 15:34:12 +01:00
Compare commits
3 Commits
support/3.
...
feature/13
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
2896357078 | ||
|
|
413a798510 | ||
|
|
6abf65bfb7 |
@@ -75,43 +75,38 @@ $(function()
|
||||
getCurrentValue: function()
|
||||
{
|
||||
var value = null;
|
||||
|
||||
this.element.find(':input').each(function(iIndex, oElem){
|
||||
if($(oElem).is(':hidden') || $(oElem).is(':text') || $(oElem).is(':password') || $(oElem).is('textarea'))
|
||||
{
|
||||
value = $(oElem).val();
|
||||
}
|
||||
else if($(oElem).is('select'))
|
||||
{
|
||||
if($(oElem).is('select[multiple]'))
|
||||
{
|
||||
value = [];
|
||||
$(oElem).find('option:selected').each(function(){
|
||||
value.push($(this).val());
|
||||
});
|
||||
}
|
||||
else
|
||||
{
|
||||
if (this.element.attr('data-input-type') == 'tagset') {
|
||||
value = [];
|
||||
|
||||
this.element.find('select').find('option:selected').each(function (iIndex, oElem) {
|
||||
value.push($(this).val());
|
||||
});
|
||||
} else {
|
||||
this.element.find(':input').each(function (iIndex, oElem) {
|
||||
if ($(oElem).is(':text') || $(oElem).is(':password') || $(oElem).is('textarea')) {
|
||||
value = $(oElem).val();
|
||||
} else if ($(oElem).is(':hidden') || $(oElem).is('select')) {
|
||||
if ($(oElem).is('select[multiple]')) {
|
||||
value = [];
|
||||
$(oElem).find('option:selected').each(function () {
|
||||
value.push($(this).val());
|
||||
});
|
||||
} else {
|
||||
value = $(oElem).val();
|
||||
}
|
||||
} else if ($(oElem).is(':checkbox') || $(oElem).is(':radio')) {
|
||||
if (value === null) {
|
||||
value = [];
|
||||
}
|
||||
if ($(oElem).is(':checked')) {
|
||||
value.push($(oElem).val());
|
||||
}
|
||||
} else {
|
||||
console.log('Form field : Input type not handle yet.');
|
||||
}
|
||||
}
|
||||
else if($(oElem).is(':checkbox') || $(oElem).is(':radio'))
|
||||
{
|
||||
if(value === null)
|
||||
{
|
||||
value = [];
|
||||
}
|
||||
if($(oElem).is(':checked'))
|
||||
{
|
||||
value.push($(oElem).val());
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
console.log('Form field : Input type not handle yet.');
|
||||
}
|
||||
});
|
||||
|
||||
});
|
||||
}
|
||||
|
||||
return value;
|
||||
},
|
||||
validate: function(oEvent, oData)
|
||||
|
||||
@@ -2,6 +2,11 @@
|
||||
|
||||
// autoload.php @generated by Composer
|
||||
|
||||
if (PHP_VERSION_ID < 50600) {
|
||||
echo 'Composer 2.3.0 dropped support for autoloading on PHP <5.6 and you are running '.PHP_VERSION.', please upgrade PHP or use Composer 2.2 LTS via "composer self-update --2.2". Aborting.'.PHP_EOL;
|
||||
exit(1);
|
||||
}
|
||||
|
||||
require_once __DIR__ . '/composer/autoload_real.php';
|
||||
|
||||
return ComposerAutoloaderInit7f81b4a2a468a061c306af5e447a9a9f::getLoader();
|
||||
|
||||
@@ -149,7 +149,7 @@ class ClassLoader
|
||||
|
||||
/**
|
||||
* @return string[] Array of classname => path
|
||||
* @psalm-var array<string, string>
|
||||
* @psalm-return array<string, string>
|
||||
*/
|
||||
public function getClassMap()
|
||||
{
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
// autoload_classmap.php @generated by Composer
|
||||
|
||||
$vendorDir = dirname(dirname(__FILE__));
|
||||
$vendorDir = dirname(__DIR__);
|
||||
$baseDir = dirname($vendorDir);
|
||||
|
||||
return array(
|
||||
@@ -401,6 +401,7 @@ return array(
|
||||
'Combodo\\iTop\\Form\\Field\\LinkedSetField' => $baseDir . '/sources/Form/Field/LinkedSetField.php',
|
||||
'Combodo\\iTop\\Form\\Field\\MultipleChoicesField' => $baseDir . '/sources/Form/Field/MultipleChoicesField.php',
|
||||
'Combodo\\iTop\\Form\\Field\\MultipleSelectField' => $baseDir . '/sources/Form/Field/MultipleSelectField.php',
|
||||
'Combodo\\iTop\\Form\\Field\\MultipleSelectObjectField' => $baseDir . '/sources/Form/Field/MultipleSelectObjectField.php',
|
||||
'Combodo\\iTop\\Form\\Field\\PasswordField' => $baseDir . '/sources/Form/Field/PasswordField.php',
|
||||
'Combodo\\iTop\\Form\\Field\\PhoneField' => $baseDir . '/sources/Form/Field/PhoneField.php',
|
||||
'Combodo\\iTop\\Form\\Field\\RadioField' => $baseDir . '/sources/Form/Field/RadioField.php',
|
||||
@@ -410,6 +411,7 @@ return array(
|
||||
'Combodo\\iTop\\Form\\Field\\StringField' => $baseDir . '/sources/Form/Field/StringField.php',
|
||||
'Combodo\\iTop\\Form\\Field\\SubFormField' => $baseDir . '/sources/Form/Field/SubFormField.php',
|
||||
'Combodo\\iTop\\Form\\Field\\TagSetField' => $baseDir . '/sources/Form/Field/TagSetField.php',
|
||||
'Combodo\\iTop\\Form\\Field\\TagSetObjectField' => $baseDir . '/sources/Form/Field/TagSetObjectField.php',
|
||||
'Combodo\\iTop\\Form\\Field\\TextAreaField' => $baseDir . '/sources/Form/Field/TextAreaField.php',
|
||||
'Combodo\\iTop\\Form\\Field\\TextField' => $baseDir . '/sources/Form/Field/TextField.php',
|
||||
'Combodo\\iTop\\Form\\Field\\UrlField' => $baseDir . '/sources/Form/Field/UrlField.php',
|
||||
@@ -449,7 +451,6 @@ return array(
|
||||
'Combodo\\iTop\\Service\\Events\\EventServiceLog' => $baseDir . '/sources/Service/Events/EventServiceLog.php',
|
||||
'Combodo\\iTop\\Service\\Events\\iEventServiceSetup' => $baseDir . '/sources/Service/Events/iEventServiceSetup.php',
|
||||
'Combodo\\iTop\\Service\\Links\\LinkSetDataTransformer' => $baseDir . '/sources/Service/Links/LinkSetDataTransformer.php',
|
||||
'Combodo\\iTop\\Service\\Links\\LinkSetHelper' => $baseDir . '/sources/Service/Links/LinkSetHelper.php',
|
||||
'Combodo\\iTop\\Service\\Links\\LinkSetModel' => $baseDir . '/sources/Service/Links/LinkSetModel.php',
|
||||
'Combodo\\iTop\\Service\\Links\\LinkSetRepository' => $baseDir . '/sources/Service/Links/LinkSetRepository.php',
|
||||
'Combodo\\iTop\\Service\\Links\\LinksBulkDataPostProcessor' => $baseDir . '/sources/Service/Links/LinksBulkDataPostProcessor.php',
|
||||
@@ -1702,17 +1703,6 @@ return array(
|
||||
'Symfony\\Bundle\\TwigBundle\\DependencyInjection\\TwigExtension' => $vendorDir . '/symfony/twig-bundle/DependencyInjection/TwigExtension.php',
|
||||
'Symfony\\Bundle\\TwigBundle\\TemplateIterator' => $vendorDir . '/symfony/twig-bundle/TemplateIterator.php',
|
||||
'Symfony\\Bundle\\TwigBundle\\TwigBundle' => $vendorDir . '/symfony/twig-bundle/TwigBundle.php',
|
||||
'Symfony\\Bundle\\WebProfilerBundle\\Controller\\ExceptionPanelController' => $vendorDir . '/symfony/web-profiler-bundle/Controller/ExceptionPanelController.php',
|
||||
'Symfony\\Bundle\\WebProfilerBundle\\Controller\\ProfilerController' => $vendorDir . '/symfony/web-profiler-bundle/Controller/ProfilerController.php',
|
||||
'Symfony\\Bundle\\WebProfilerBundle\\Controller\\RouterController' => $vendorDir . '/symfony/web-profiler-bundle/Controller/RouterController.php',
|
||||
'Symfony\\Bundle\\WebProfilerBundle\\Csp\\ContentSecurityPolicyHandler' => $vendorDir . '/symfony/web-profiler-bundle/Csp/ContentSecurityPolicyHandler.php',
|
||||
'Symfony\\Bundle\\WebProfilerBundle\\Csp\\NonceGenerator' => $vendorDir . '/symfony/web-profiler-bundle/Csp/NonceGenerator.php',
|
||||
'Symfony\\Bundle\\WebProfilerBundle\\DependencyInjection\\Configuration' => $vendorDir . '/symfony/web-profiler-bundle/DependencyInjection/Configuration.php',
|
||||
'Symfony\\Bundle\\WebProfilerBundle\\DependencyInjection\\WebProfilerExtension' => $vendorDir . '/symfony/web-profiler-bundle/DependencyInjection/WebProfilerExtension.php',
|
||||
'Symfony\\Bundle\\WebProfilerBundle\\EventListener\\WebDebugToolbarListener' => $vendorDir . '/symfony/web-profiler-bundle/EventListener/WebDebugToolbarListener.php',
|
||||
'Symfony\\Bundle\\WebProfilerBundle\\Profiler\\TemplateManager' => $vendorDir . '/symfony/web-profiler-bundle/Profiler/TemplateManager.php',
|
||||
'Symfony\\Bundle\\WebProfilerBundle\\Twig\\WebProfilerExtension' => $vendorDir . '/symfony/web-profiler-bundle/Twig/WebProfilerExtension.php',
|
||||
'Symfony\\Bundle\\WebProfilerBundle\\WebProfilerBundle' => $vendorDir . '/symfony/web-profiler-bundle/WebProfilerBundle.php',
|
||||
'Symfony\\Component\\Cache\\Adapter\\AbstractAdapter' => $vendorDir . '/symfony/cache/Adapter/AbstractAdapter.php',
|
||||
'Symfony\\Component\\Cache\\Adapter\\AbstractTagAwareAdapter' => $vendorDir . '/symfony/cache/Adapter/AbstractTagAwareAdapter.php',
|
||||
'Symfony\\Component\\Cache\\Adapter\\AdapterInterface' => $vendorDir . '/symfony/cache/Adapter/AdapterInterface.php',
|
||||
@@ -2532,10 +2522,6 @@ return array(
|
||||
'Symfony\\Component\\Routing\\RouteCompilerInterface' => $vendorDir . '/symfony/routing/RouteCompilerInterface.php',
|
||||
'Symfony\\Component\\Routing\\Router' => $vendorDir . '/symfony/routing/Router.php',
|
||||
'Symfony\\Component\\Routing\\RouterInterface' => $vendorDir . '/symfony/routing/RouterInterface.php',
|
||||
'Symfony\\Component\\Stopwatch\\Section' => $vendorDir . '/symfony/stopwatch/Section.php',
|
||||
'Symfony\\Component\\Stopwatch\\Stopwatch' => $vendorDir . '/symfony/stopwatch/Stopwatch.php',
|
||||
'Symfony\\Component\\Stopwatch\\StopwatchEvent' => $vendorDir . '/symfony/stopwatch/StopwatchEvent.php',
|
||||
'Symfony\\Component\\Stopwatch\\StopwatchPeriod' => $vendorDir . '/symfony/stopwatch/StopwatchPeriod.php',
|
||||
'Symfony\\Component\\String\\AbstractString' => $vendorDir . '/symfony/string/AbstractString.php',
|
||||
'Symfony\\Component\\String\\AbstractUnicodeString' => $vendorDir . '/symfony/string/AbstractUnicodeString.php',
|
||||
'Symfony\\Component\\String\\ByteString' => $vendorDir . '/symfony/string/ByteString.php',
|
||||
|
||||
@@ -2,24 +2,24 @@
|
||||
|
||||
// autoload_files.php @generated by Composer
|
||||
|
||||
$vendorDir = dirname(dirname(__FILE__));
|
||||
$vendorDir = dirname(__DIR__);
|
||||
$baseDir = dirname($vendorDir);
|
||||
|
||||
return array(
|
||||
'6e3fae29631ef280660b3cdad06f25a8' => $vendorDir . '/symfony/deprecation-contracts/function.php',
|
||||
'a4a119a56e50fbb293281d9a48007e0e' => $vendorDir . '/symfony/polyfill-php80/bootstrap.php',
|
||||
'6e3fae29631ef280660b3cdad06f25a8' => $vendorDir . '/symfony/deprecation-contracts/function.php',
|
||||
'0e6d7bf4a5811bfa5cf40c5ccd6fae6a' => $vendorDir . '/symfony/polyfill-mbstring/bootstrap.php',
|
||||
'320cde22f66dd4f5d3fd621d3e88b98f' => $vendorDir . '/symfony/polyfill-ctype/bootstrap.php',
|
||||
'0d59ee240a4cd96ddbb4ff164fccea4d' => $vendorDir . '/symfony/polyfill-php73/bootstrap.php',
|
||||
'23c18046f52bef3eea034657bafda50f' => $vendorDir . '/symfony/polyfill-php81/bootstrap.php',
|
||||
'667aeda72477189d0494fecd327c3641' => $vendorDir . '/symfony/var-dumper/Resources/functions/dump.php',
|
||||
'e69f7f6ee287b969198c3c9d6777bd38' => $vendorDir . '/symfony/polyfill-intl-normalizer/bootstrap.php',
|
||||
'c9d07b32a2e02bc0fc582d4f0c1b56cc' => $vendorDir . '/laminas/laminas-servicemanager/src/autoload.php',
|
||||
'7b11c4dc42b3b3023073cb14e519683c' => $vendorDir . '/ralouphie/getallheaders/src/getallheaders.php',
|
||||
'8825ede83f2f289127722d4e842cf7e8' => $vendorDir . '/symfony/polyfill-intl-grapheme/bootstrap.php',
|
||||
'667aeda72477189d0494fecd327c3641' => $vendorDir . '/symfony/var-dumper/Resources/functions/dump.php',
|
||||
'c964ee0ededf28c96ebd9db5099ef910' => $vendorDir . '/guzzlehttp/promises/src/functions_include.php',
|
||||
'b6b991a57620e2fb6b2f66f03fe9ddc2' => $vendorDir . '/symfony/string/Resources/functions.php',
|
||||
'e69f7f6ee287b969198c3c9d6777bd38' => $vendorDir . '/symfony/polyfill-intl-normalizer/bootstrap.php',
|
||||
'37a3dc5111fe8f707ab4c132ef1dbc62' => $vendorDir . '/guzzlehttp/guzzle/src/functions_include.php',
|
||||
'c9d07b32a2e02bc0fc582d4f0c1b56cc' => $vendorDir . '/laminas/laminas-servicemanager/src/autoload.php',
|
||||
'8825ede83f2f289127722d4e842cf7e8' => $vendorDir . '/symfony/polyfill-intl-grapheme/bootstrap.php',
|
||||
'25072dd6e2470089de65ae7bf11d3109' => $vendorDir . '/symfony/polyfill-php72/bootstrap.php',
|
||||
'f598d06aa772fa33d905e87be6398fb1' => $vendorDir . '/symfony/polyfill-intl-idn/bootstrap.php',
|
||||
'b6b991a57620e2fb6b2f66f03fe9ddc2' => $vendorDir . '/symfony/string/Resources/functions.php',
|
||||
);
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
// autoload_namespaces.php @generated by Composer
|
||||
|
||||
$vendorDir = dirname(dirname(__FILE__));
|
||||
$vendorDir = dirname(__DIR__);
|
||||
$baseDir = dirname($vendorDir);
|
||||
|
||||
return array(
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
// autoload_psr4.php @generated by Composer
|
||||
|
||||
$vendorDir = dirname(dirname(__FILE__));
|
||||
$vendorDir = dirname(__DIR__);
|
||||
$baseDir = dirname($vendorDir);
|
||||
|
||||
return array(
|
||||
@@ -26,7 +26,6 @@ return array(
|
||||
'Symfony\\Component\\VarExporter\\' => array($vendorDir . '/symfony/var-exporter'),
|
||||
'Symfony\\Component\\VarDumper\\' => array($vendorDir . '/symfony/var-dumper'),
|
||||
'Symfony\\Component\\String\\' => array($vendorDir . '/symfony/string'),
|
||||
'Symfony\\Component\\Stopwatch\\' => array($vendorDir . '/symfony/stopwatch'),
|
||||
'Symfony\\Component\\Routing\\' => array($vendorDir . '/symfony/routing'),
|
||||
'Symfony\\Component\\HttpKernel\\' => array($vendorDir . '/symfony/http-kernel'),
|
||||
'Symfony\\Component\\HttpFoundation\\' => array($vendorDir . '/symfony/http-foundation'),
|
||||
@@ -40,7 +39,6 @@ return array(
|
||||
'Symfony\\Component\\Console\\' => array($vendorDir . '/symfony/console'),
|
||||
'Symfony\\Component\\Config\\' => array($vendorDir . '/symfony/config'),
|
||||
'Symfony\\Component\\Cache\\' => array($vendorDir . '/symfony/cache'),
|
||||
'Symfony\\Bundle\\WebProfilerBundle\\' => array($vendorDir . '/symfony/web-profiler-bundle'),
|
||||
'Symfony\\Bundle\\TwigBundle\\' => array($vendorDir . '/symfony/twig-bundle'),
|
||||
'Symfony\\Bundle\\FrameworkBundle\\' => array($vendorDir . '/symfony/framework-bundle'),
|
||||
'Symfony\\Bridge\\Twig\\' => array($vendorDir . '/symfony/twig-bridge'),
|
||||
|
||||
@@ -25,33 +25,21 @@ class ComposerAutoloaderInit7f81b4a2a468a061c306af5e447a9a9f
|
||||
require __DIR__ . '/platform_check.php';
|
||||
|
||||
spl_autoload_register(array('ComposerAutoloaderInit7f81b4a2a468a061c306af5e447a9a9f', 'loadClassLoader'), true, true);
|
||||
self::$loader = $loader = new \Composer\Autoload\ClassLoader(\dirname(\dirname(__FILE__)));
|
||||
self::$loader = $loader = new \Composer\Autoload\ClassLoader(\dirname(__DIR__));
|
||||
spl_autoload_unregister(array('ComposerAutoloaderInit7f81b4a2a468a061c306af5e447a9a9f', 'loadClassLoader'));
|
||||
|
||||
$includePaths = require __DIR__ . '/include_paths.php';
|
||||
$includePaths[] = get_include_path();
|
||||
set_include_path(implode(PATH_SEPARATOR, $includePaths));
|
||||
|
||||
$useStaticLoader = PHP_VERSION_ID >= 50600 && !defined('HHVM_VERSION') && (!function_exists('zend_loader_file_encoded') || !zend_loader_file_encoded());
|
||||
if ($useStaticLoader) {
|
||||
require __DIR__ . '/autoload_static.php';
|
||||
|
||||
call_user_func(\Composer\Autoload\ComposerStaticInit7f81b4a2a468a061c306af5e447a9a9f::getInitializer($loader));
|
||||
} else {
|
||||
$classMap = require __DIR__ . '/autoload_classmap.php';
|
||||
if ($classMap) {
|
||||
$loader->addClassMap($classMap);
|
||||
}
|
||||
}
|
||||
require __DIR__ . '/autoload_static.php';
|
||||
call_user_func(\Composer\Autoload\ComposerStaticInit7f81b4a2a468a061c306af5e447a9a9f::getInitializer($loader));
|
||||
|
||||
$loader->setClassMapAuthoritative(true);
|
||||
$loader->setApcuPrefix('CfF4ZRXo3iRuTmM6Ha8Mj');
|
||||
$loader->register(true);
|
||||
|
||||
if ($useStaticLoader) {
|
||||
$includeFiles = Composer\Autoload\ComposerStaticInit7f81b4a2a468a061c306af5e447a9a9f::$files;
|
||||
} else {
|
||||
$includeFiles = require __DIR__ . '/autoload_files.php';
|
||||
}
|
||||
$includeFiles = \Composer\Autoload\ComposerStaticInit7f81b4a2a468a061c306af5e447a9a9f::$files;
|
||||
foreach ($includeFiles as $fileIdentifier => $file) {
|
||||
composerRequire7f81b4a2a468a061c306af5e447a9a9f($fileIdentifier, $file);
|
||||
}
|
||||
@@ -60,11 +48,16 @@ class ComposerAutoloaderInit7f81b4a2a468a061c306af5e447a9a9f
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $fileIdentifier
|
||||
* @param string $file
|
||||
* @return void
|
||||
*/
|
||||
function composerRequire7f81b4a2a468a061c306af5e447a9a9f($fileIdentifier, $file)
|
||||
{
|
||||
if (empty($GLOBALS['__composer_autoload_files'][$fileIdentifier])) {
|
||||
require $file;
|
||||
|
||||
$GLOBALS['__composer_autoload_files'][$fileIdentifier] = true;
|
||||
|
||||
require $file;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -7,22 +7,22 @@ namespace Composer\Autoload;
|
||||
class ComposerStaticInit7f81b4a2a468a061c306af5e447a9a9f
|
||||
{
|
||||
public static $files = array (
|
||||
'6e3fae29631ef280660b3cdad06f25a8' => __DIR__ . '/..' . '/symfony/deprecation-contracts/function.php',
|
||||
'a4a119a56e50fbb293281d9a48007e0e' => __DIR__ . '/..' . '/symfony/polyfill-php80/bootstrap.php',
|
||||
'6e3fae29631ef280660b3cdad06f25a8' => __DIR__ . '/..' . '/symfony/deprecation-contracts/function.php',
|
||||
'0e6d7bf4a5811bfa5cf40c5ccd6fae6a' => __DIR__ . '/..' . '/symfony/polyfill-mbstring/bootstrap.php',
|
||||
'320cde22f66dd4f5d3fd621d3e88b98f' => __DIR__ . '/..' . '/symfony/polyfill-ctype/bootstrap.php',
|
||||
'0d59ee240a4cd96ddbb4ff164fccea4d' => __DIR__ . '/..' . '/symfony/polyfill-php73/bootstrap.php',
|
||||
'23c18046f52bef3eea034657bafda50f' => __DIR__ . '/..' . '/symfony/polyfill-php81/bootstrap.php',
|
||||
'667aeda72477189d0494fecd327c3641' => __DIR__ . '/..' . '/symfony/var-dumper/Resources/functions/dump.php',
|
||||
'e69f7f6ee287b969198c3c9d6777bd38' => __DIR__ . '/..' . '/symfony/polyfill-intl-normalizer/bootstrap.php',
|
||||
'c9d07b32a2e02bc0fc582d4f0c1b56cc' => __DIR__ . '/..' . '/laminas/laminas-servicemanager/src/autoload.php',
|
||||
'7b11c4dc42b3b3023073cb14e519683c' => __DIR__ . '/..' . '/ralouphie/getallheaders/src/getallheaders.php',
|
||||
'8825ede83f2f289127722d4e842cf7e8' => __DIR__ . '/..' . '/symfony/polyfill-intl-grapheme/bootstrap.php',
|
||||
'667aeda72477189d0494fecd327c3641' => __DIR__ . '/..' . '/symfony/var-dumper/Resources/functions/dump.php',
|
||||
'c964ee0ededf28c96ebd9db5099ef910' => __DIR__ . '/..' . '/guzzlehttp/promises/src/functions_include.php',
|
||||
'b6b991a57620e2fb6b2f66f03fe9ddc2' => __DIR__ . '/..' . '/symfony/string/Resources/functions.php',
|
||||
'e69f7f6ee287b969198c3c9d6777bd38' => __DIR__ . '/..' . '/symfony/polyfill-intl-normalizer/bootstrap.php',
|
||||
'37a3dc5111fe8f707ab4c132ef1dbc62' => __DIR__ . '/..' . '/guzzlehttp/guzzle/src/functions_include.php',
|
||||
'c9d07b32a2e02bc0fc582d4f0c1b56cc' => __DIR__ . '/..' . '/laminas/laminas-servicemanager/src/autoload.php',
|
||||
'8825ede83f2f289127722d4e842cf7e8' => __DIR__ . '/..' . '/symfony/polyfill-intl-grapheme/bootstrap.php',
|
||||
'25072dd6e2470089de65ae7bf11d3109' => __DIR__ . '/..' . '/symfony/polyfill-php72/bootstrap.php',
|
||||
'f598d06aa772fa33d905e87be6398fb1' => __DIR__ . '/..' . '/symfony/polyfill-intl-idn/bootstrap.php',
|
||||
'b6b991a57620e2fb6b2f66f03fe9ddc2' => __DIR__ . '/..' . '/symfony/string/Resources/functions.php',
|
||||
);
|
||||
|
||||
public static $prefixLengthsPsr4 = array (
|
||||
@@ -54,7 +54,6 @@ class ComposerStaticInit7f81b4a2a468a061c306af5e447a9a9f
|
||||
'Symfony\\Component\\VarExporter\\' => 30,
|
||||
'Symfony\\Component\\VarDumper\\' => 28,
|
||||
'Symfony\\Component\\String\\' => 25,
|
||||
'Symfony\\Component\\Stopwatch\\' => 28,
|
||||
'Symfony\\Component\\Routing\\' => 26,
|
||||
'Symfony\\Component\\HttpKernel\\' => 29,
|
||||
'Symfony\\Component\\HttpFoundation\\' => 33,
|
||||
@@ -68,7 +67,6 @@ class ComposerStaticInit7f81b4a2a468a061c306af5e447a9a9f
|
||||
'Symfony\\Component\\Console\\' => 26,
|
||||
'Symfony\\Component\\Config\\' => 25,
|
||||
'Symfony\\Component\\Cache\\' => 24,
|
||||
'Symfony\\Bundle\\WebProfilerBundle\\' => 33,
|
||||
'Symfony\\Bundle\\TwigBundle\\' => 26,
|
||||
'Symfony\\Bundle\\FrameworkBundle\\' => 31,
|
||||
'Symfony\\Bridge\\Twig\\' => 20,
|
||||
@@ -189,10 +187,6 @@ class ComposerStaticInit7f81b4a2a468a061c306af5e447a9a9f
|
||||
array (
|
||||
0 => __DIR__ . '/..' . '/symfony/string',
|
||||
),
|
||||
'Symfony\\Component\\Stopwatch\\' =>
|
||||
array (
|
||||
0 => __DIR__ . '/..' . '/symfony/stopwatch',
|
||||
),
|
||||
'Symfony\\Component\\Routing\\' =>
|
||||
array (
|
||||
0 => __DIR__ . '/..' . '/symfony/routing',
|
||||
@@ -245,10 +239,6 @@ class ComposerStaticInit7f81b4a2a468a061c306af5e447a9a9f
|
||||
array (
|
||||
0 => __DIR__ . '/..' . '/symfony/cache',
|
||||
),
|
||||
'Symfony\\Bundle\\WebProfilerBundle\\' =>
|
||||
array (
|
||||
0 => __DIR__ . '/..' . '/symfony/web-profiler-bundle',
|
||||
),
|
||||
'Symfony\\Bundle\\TwigBundle\\' =>
|
||||
array (
|
||||
0 => __DIR__ . '/..' . '/symfony/twig-bundle',
|
||||
@@ -766,6 +756,7 @@ class ComposerStaticInit7f81b4a2a468a061c306af5e447a9a9f
|
||||
'Combodo\\iTop\\Form\\Field\\LinkedSetField' => __DIR__ . '/../..' . '/sources/Form/Field/LinkedSetField.php',
|
||||
'Combodo\\iTop\\Form\\Field\\MultipleChoicesField' => __DIR__ . '/../..' . '/sources/Form/Field/MultipleChoicesField.php',
|
||||
'Combodo\\iTop\\Form\\Field\\MultipleSelectField' => __DIR__ . '/../..' . '/sources/Form/Field/MultipleSelectField.php',
|
||||
'Combodo\\iTop\\Form\\Field\\MultipleSelectObjectField' => __DIR__ . '/../..' . '/sources/Form/Field/MultipleSelectObjectField.php',
|
||||
'Combodo\\iTop\\Form\\Field\\PasswordField' => __DIR__ . '/../..' . '/sources/Form/Field/PasswordField.php',
|
||||
'Combodo\\iTop\\Form\\Field\\PhoneField' => __DIR__ . '/../..' . '/sources/Form/Field/PhoneField.php',
|
||||
'Combodo\\iTop\\Form\\Field\\RadioField' => __DIR__ . '/../..' . '/sources/Form/Field/RadioField.php',
|
||||
@@ -775,6 +766,7 @@ class ComposerStaticInit7f81b4a2a468a061c306af5e447a9a9f
|
||||
'Combodo\\iTop\\Form\\Field\\StringField' => __DIR__ . '/../..' . '/sources/Form/Field/StringField.php',
|
||||
'Combodo\\iTop\\Form\\Field\\SubFormField' => __DIR__ . '/../..' . '/sources/Form/Field/SubFormField.php',
|
||||
'Combodo\\iTop\\Form\\Field\\TagSetField' => __DIR__ . '/../..' . '/sources/Form/Field/TagSetField.php',
|
||||
'Combodo\\iTop\\Form\\Field\\TagSetObjectField' => __DIR__ . '/../..' . '/sources/Form/Field/TagSetObjectField.php',
|
||||
'Combodo\\iTop\\Form\\Field\\TextAreaField' => __DIR__ . '/../..' . '/sources/Form/Field/TextAreaField.php',
|
||||
'Combodo\\iTop\\Form\\Field\\TextField' => __DIR__ . '/../..' . '/sources/Form/Field/TextField.php',
|
||||
'Combodo\\iTop\\Form\\Field\\UrlField' => __DIR__ . '/../..' . '/sources/Form/Field/UrlField.php',
|
||||
@@ -814,7 +806,6 @@ class ComposerStaticInit7f81b4a2a468a061c306af5e447a9a9f
|
||||
'Combodo\\iTop\\Service\\Events\\EventServiceLog' => __DIR__ . '/../..' . '/sources/Service/Events/EventServiceLog.php',
|
||||
'Combodo\\iTop\\Service\\Events\\iEventServiceSetup' => __DIR__ . '/../..' . '/sources/Service/Events/iEventServiceSetup.php',
|
||||
'Combodo\\iTop\\Service\\Links\\LinkSetDataTransformer' => __DIR__ . '/../..' . '/sources/Service/Links/LinkSetDataTransformer.php',
|
||||
'Combodo\\iTop\\Service\\Links\\LinkSetHelper' => __DIR__ . '/../..' . '/sources/Service/Links/LinkSetHelper.php',
|
||||
'Combodo\\iTop\\Service\\Links\\LinkSetModel' => __DIR__ . '/../..' . '/sources/Service/Links/LinkSetModel.php',
|
||||
'Combodo\\iTop\\Service\\Links\\LinkSetRepository' => __DIR__ . '/../..' . '/sources/Service/Links/LinkSetRepository.php',
|
||||
'Combodo\\iTop\\Service\\Links\\LinksBulkDataPostProcessor' => __DIR__ . '/../..' . '/sources/Service/Links/LinksBulkDataPostProcessor.php',
|
||||
@@ -2067,17 +2058,6 @@ class ComposerStaticInit7f81b4a2a468a061c306af5e447a9a9f
|
||||
'Symfony\\Bundle\\TwigBundle\\DependencyInjection\\TwigExtension' => __DIR__ . '/..' . '/symfony/twig-bundle/DependencyInjection/TwigExtension.php',
|
||||
'Symfony\\Bundle\\TwigBundle\\TemplateIterator' => __DIR__ . '/..' . '/symfony/twig-bundle/TemplateIterator.php',
|
||||
'Symfony\\Bundle\\TwigBundle\\TwigBundle' => __DIR__ . '/..' . '/symfony/twig-bundle/TwigBundle.php',
|
||||
'Symfony\\Bundle\\WebProfilerBundle\\Controller\\ExceptionPanelController' => __DIR__ . '/..' . '/symfony/web-profiler-bundle/Controller/ExceptionPanelController.php',
|
||||
'Symfony\\Bundle\\WebProfilerBundle\\Controller\\ProfilerController' => __DIR__ . '/..' . '/symfony/web-profiler-bundle/Controller/ProfilerController.php',
|
||||
'Symfony\\Bundle\\WebProfilerBundle\\Controller\\RouterController' => __DIR__ . '/..' . '/symfony/web-profiler-bundle/Controller/RouterController.php',
|
||||
'Symfony\\Bundle\\WebProfilerBundle\\Csp\\ContentSecurityPolicyHandler' => __DIR__ . '/..' . '/symfony/web-profiler-bundle/Csp/ContentSecurityPolicyHandler.php',
|
||||
'Symfony\\Bundle\\WebProfilerBundle\\Csp\\NonceGenerator' => __DIR__ . '/..' . '/symfony/web-profiler-bundle/Csp/NonceGenerator.php',
|
||||
'Symfony\\Bundle\\WebProfilerBundle\\DependencyInjection\\Configuration' => __DIR__ . '/..' . '/symfony/web-profiler-bundle/DependencyInjection/Configuration.php',
|
||||
'Symfony\\Bundle\\WebProfilerBundle\\DependencyInjection\\WebProfilerExtension' => __DIR__ . '/..' . '/symfony/web-profiler-bundle/DependencyInjection/WebProfilerExtension.php',
|
||||
'Symfony\\Bundle\\WebProfilerBundle\\EventListener\\WebDebugToolbarListener' => __DIR__ . '/..' . '/symfony/web-profiler-bundle/EventListener/WebDebugToolbarListener.php',
|
||||
'Symfony\\Bundle\\WebProfilerBundle\\Profiler\\TemplateManager' => __DIR__ . '/..' . '/symfony/web-profiler-bundle/Profiler/TemplateManager.php',
|
||||
'Symfony\\Bundle\\WebProfilerBundle\\Twig\\WebProfilerExtension' => __DIR__ . '/..' . '/symfony/web-profiler-bundle/Twig/WebProfilerExtension.php',
|
||||
'Symfony\\Bundle\\WebProfilerBundle\\WebProfilerBundle' => __DIR__ . '/..' . '/symfony/web-profiler-bundle/WebProfilerBundle.php',
|
||||
'Symfony\\Component\\Cache\\Adapter\\AbstractAdapter' => __DIR__ . '/..' . '/symfony/cache/Adapter/AbstractAdapter.php',
|
||||
'Symfony\\Component\\Cache\\Adapter\\AbstractTagAwareAdapter' => __DIR__ . '/..' . '/symfony/cache/Adapter/AbstractTagAwareAdapter.php',
|
||||
'Symfony\\Component\\Cache\\Adapter\\AdapterInterface' => __DIR__ . '/..' . '/symfony/cache/Adapter/AdapterInterface.php',
|
||||
@@ -2897,10 +2877,6 @@ class ComposerStaticInit7f81b4a2a468a061c306af5e447a9a9f
|
||||
'Symfony\\Component\\Routing\\RouteCompilerInterface' => __DIR__ . '/..' . '/symfony/routing/RouteCompilerInterface.php',
|
||||
'Symfony\\Component\\Routing\\Router' => __DIR__ . '/..' . '/symfony/routing/Router.php',
|
||||
'Symfony\\Component\\Routing\\RouterInterface' => __DIR__ . '/..' . '/symfony/routing/RouterInterface.php',
|
||||
'Symfony\\Component\\Stopwatch\\Section' => __DIR__ . '/..' . '/symfony/stopwatch/Section.php',
|
||||
'Symfony\\Component\\Stopwatch\\Stopwatch' => __DIR__ . '/..' . '/symfony/stopwatch/Stopwatch.php',
|
||||
'Symfony\\Component\\Stopwatch\\StopwatchEvent' => __DIR__ . '/..' . '/symfony/stopwatch/StopwatchEvent.php',
|
||||
'Symfony\\Component\\Stopwatch\\StopwatchPeriod' => __DIR__ . '/..' . '/symfony/stopwatch/StopwatchPeriod.php',
|
||||
'Symfony\\Component\\String\\AbstractString' => __DIR__ . '/..' . '/symfony/string/AbstractString.php',
|
||||
'Symfony\\Component\\String\\AbstractUnicodeString' => __DIR__ . '/..' . '/symfony/string/AbstractUnicodeString.php',
|
||||
'Symfony\\Component\\String\\ByteString' => __DIR__ . '/..' . '/symfony/string/ByteString.php',
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
// include_paths.php @generated by Composer
|
||||
|
||||
$vendorDir = dirname(dirname(__FILE__));
|
||||
$vendorDir = dirname(__DIR__);
|
||||
$baseDir = dirname($vendorDir);
|
||||
|
||||
return array(
|
||||
|
||||
@@ -82,16 +82,11 @@ abstract class MultipleChoicesField extends Field
|
||||
*/
|
||||
public function SetCurrentValue($currentValue)
|
||||
{
|
||||
if (is_array($currentValue))
|
||||
{
|
||||
if (is_array($currentValue)) {
|
||||
$this->currentValue = $currentValue;
|
||||
}
|
||||
elseif (is_null($currentValue))
|
||||
{
|
||||
} elseif (is_null($currentValue)) {
|
||||
$this->currentValue = array();
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
$this->currentValue = array($currentValue);
|
||||
}
|
||||
return $this;
|
||||
|
||||
@@ -28,5 +28,16 @@ class MultipleSelectField extends SelectField
|
||||
{
|
||||
/** @inheritDoc */
|
||||
const DEFAULT_MULTIPLE_VALUES_ENABLED = true;
|
||||
const DEFAULT_STARTS_WITH_NULL_CHOICE = false;
|
||||
|
||||
function SetCurrentValue($currentValue)
|
||||
{
|
||||
if ($currentValue != null) {
|
||||
$this->currentValue = $currentValue;
|
||||
} else {
|
||||
$this->currentValue = "";
|
||||
}
|
||||
|
||||
return $this;
|
||||
}
|
||||
}
|
||||
|
||||
106
sources/Form/Field/MultipleSelectObjectField.php
Normal file
106
sources/Form/Field/MultipleSelectObjectField.php
Normal file
@@ -0,0 +1,106 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
* @copyright Copyright (C) 2010-2023 Combodo SARL
|
||||
* @license http://opensource.org/licenses/AGPL-3.0
|
||||
*/
|
||||
|
||||
namespace Combodo\iTop\Form\Field;
|
||||
|
||||
|
||||
use BinaryExpression;
|
||||
use DBObjectSet;
|
||||
use FieldExpression;
|
||||
use ScalarExpression;
|
||||
use utils;
|
||||
|
||||
/**
|
||||
* Description of MultipleSelectObjectField
|
||||
*
|
||||
* @author Acc
|
||||
* @since 3.1.0
|
||||
*/
|
||||
class MultipleSelectObjectField extends SelectObjectField
|
||||
{
|
||||
const DEFAULT_MULTIPLE_VALUES_ENABLED = true;
|
||||
|
||||
function SetCurrentValue($currentValue)
|
||||
{
|
||||
if ($currentValue != null) {
|
||||
$this->currentValue = $currentValue;
|
||||
} else {
|
||||
$this->currentValue = "";
|
||||
}
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
|
||||
public function Validate()
|
||||
{
|
||||
$this->SetValid(true);
|
||||
$this->EmptyErrorMessages();
|
||||
|
||||
if ($this->GetReadOnly() === false) {
|
||||
if (count($this->currentValue) > 0) {
|
||||
foreach ($this->currentValue as $sCode => $value) {
|
||||
if (utils::IsNullOrEmptyString($value) || ($value == 0)) {
|
||||
continue;
|
||||
}
|
||||
$oSearchForExistingCurrentValue = $this->oSearch->DeepClone();
|
||||
$oSearchForExistingCurrentValue->AddCondition('id', $value, '=');
|
||||
$oCheckIdAgainstCurrentValueExpression = new BinaryExpression(
|
||||
new FieldExpression('id', $oSearchForExistingCurrentValue->GetClassAlias()), '=', new ScalarExpression($value)
|
||||
);
|
||||
$oSearchForExistingCurrentValue->AddConditionExpression($oCheckIdAgainstCurrentValueExpression);
|
||||
$oSetForExistingCurrentValue = new DBObjectSet($oSearchForExistingCurrentValue);
|
||||
$iObjectsCount = $oSetForExistingCurrentValue->CountWithLimit(1);
|
||||
|
||||
if ($iObjectsCount === 0) {
|
||||
$this->SetValid(false);
|
||||
$this->AddErrorMessage("Value $value does not match the corresponding filter set");
|
||||
|
||||
return $this->GetValid();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
foreach ($this->GetValidators() as $oValidator) {
|
||||
foreach ($this->currentValue as $value) {
|
||||
if (!preg_match($oValidator->GetRegExp(true), $value)) {
|
||||
$this->SetValid(false);
|
||||
$this->AddErrorMessage($oValidator->GetErrorMessage());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return $this->GetValid();
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Resets current value if not among allowed ones.
|
||||
* By default, reset is done ONLY when the field is not read-only.
|
||||
*
|
||||
* @param boolean $bAlways Set to true to verify even when the field is read-only.
|
||||
*
|
||||
* @throws \CoreException
|
||||
*/
|
||||
public function VerifyCurrentValue(bool $bAlways = false)
|
||||
{
|
||||
if (!$this->GetReadOnly() || $bAlways) {
|
||||
if (count($this->currentValue) > 0) {
|
||||
foreach ($this->currentValue as $sCode => $value) {
|
||||
$oValuesScope = $this->GetSearch()->DeepClone();
|
||||
$oBinaryExp = new BinaryExpression(new FieldExpression('id', $oValuesScope->GetClassAlias()), '=',
|
||||
new ScalarExpression($value));
|
||||
$oValuesScope->AddConditionExpression($oBinaryExp);
|
||||
$oValuesSet = new DBObjectSet($oValuesScope);
|
||||
}
|
||||
} else {
|
||||
$this->currentValue = [];
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -36,7 +36,7 @@ use utils;
|
||||
* @author Romain Quetiez <romain.quetiez@combodo.com>
|
||||
* @since 2.3.0
|
||||
*/
|
||||
class SelectObjectField extends Field
|
||||
class SelectObjectField extends MultipleChoicesField
|
||||
{
|
||||
/** @var int CONTROL_SELECT */
|
||||
const CONTROL_SELECT = 1;
|
||||
|
||||
@@ -24,7 +24,20 @@ namespace Combodo\iTop\Form\Field;
|
||||
*
|
||||
* @author Guillaume Lajarige <guillaume.lajarige@combodo.com>
|
||||
*/
|
||||
class TagSetField extends Field
|
||||
class TagSetField extends SelectField
|
||||
{
|
||||
/** @inheritDoc */
|
||||
const DEFAULT_MULTIPLE_VALUES_ENABLED = true;
|
||||
const DEFAULT_STARTS_WITH_NULL_CHOICE = false;
|
||||
|
||||
function SetCurrentValue($currentValue)
|
||||
{
|
||||
if ($currentValue != null) {
|
||||
$this->currentValue = $currentValue;
|
||||
} else {
|
||||
$this->currentValue = "";
|
||||
}
|
||||
|
||||
return $this;
|
||||
}
|
||||
}
|
||||
|
||||
41
sources/Form/Field/TagSetObjectField.php
Normal file
41
sources/Form/Field/TagSetObjectField.php
Normal file
@@ -0,0 +1,41 @@
|
||||
<?php
|
||||
|
||||
// Copyright (C) 2010-2023 Combodo SARL
|
||||
//
|
||||
// This file is part of iTop.
|
||||
//
|
||||
// iTop is free software; you can redistribute it and/or modify
|
||||
// it under the terms of the GNU Affero General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// iTop is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU Affero General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU Affero General Public License
|
||||
// along with iTop. If not, see <http://www.gnu.org/licenses/>
|
||||
|
||||
namespace Combodo\iTop\Form\Field;
|
||||
|
||||
/**
|
||||
* Description of TagSetField
|
||||
*
|
||||
* @author Guillaume Lajarige <guillaume.lajarige@combodo.com>
|
||||
*/
|
||||
class TagSetObjectField extends MultipleSelectObjectField
|
||||
{
|
||||
const DEFAULT_MULTIPLE_VALUES_ENABLED = true;
|
||||
|
||||
function SetCurrentValue($currentValue)
|
||||
{
|
||||
if ($currentValue != null) {
|
||||
$this->currentValue = $currentValue;
|
||||
} else {
|
||||
$this->currentValue = "";
|
||||
}
|
||||
|
||||
return $this;
|
||||
}
|
||||
}
|
||||
@@ -10,11 +10,15 @@ use Combodo\iTop\Form\Field\DateTimeField;
|
||||
use Combodo\iTop\Form\Field\DurationField;
|
||||
use Combodo\iTop\Form\Field\HiddenField;
|
||||
use Combodo\iTop\Form\Field\LabelField;
|
||||
use Combodo\iTop\Form\Field\MultipleSelectField;
|
||||
use Combodo\iTop\Form\Field\MultipleSelectObjectField;
|
||||
use Combodo\iTop\Form\Field\RadioField;
|
||||
use Combodo\iTop\Form\Field\SelectField;
|
||||
use Combodo\iTop\Form\Field\SelectObjectField;
|
||||
use Combodo\iTop\Form\Field\StringField;
|
||||
use Combodo\iTop\Form\Field\SubFormField;
|
||||
use Combodo\iTop\Form\Field\TagSetField;
|
||||
use Combodo\iTop\Form\Field\TagSetObjectField;
|
||||
use Combodo\iTop\Form\Field\TextAreaField;
|
||||
use Combodo\iTop\Renderer\Console\FieldRenderer\ConsoleSelectObjectFieldRenderer;
|
||||
use Combodo\iTop\Renderer\Console\FieldRenderer\ConsoleSimpleFieldRenderer;
|
||||
@@ -78,15 +82,35 @@ class ConsoleFieldRendererMappings implements iFieldRendererMappingsExtension
|
||||
'field_renderer' => ConsoleSelectObjectFieldRenderer::class,
|
||||
],
|
||||
[
|
||||
'field' => SubFormField::class,
|
||||
'form_renderer' => ConsoleFormRenderer::class,
|
||||
'field' => SubFormField::class,
|
||||
'form_renderer' => ConsoleFormRenderer::class,
|
||||
'field_renderer' => ConsoleSubFormFieldRenderer::class,
|
||||
],
|
||||
[
|
||||
'field' => DateTimeField::class,
|
||||
'form_renderer' => ConsoleFormRenderer::class,
|
||||
'field' => DateTimeField::class,
|
||||
'form_renderer' => ConsoleFormRenderer::class,
|
||||
'field_renderer' => ConsoleSimpleFieldRenderer::class,
|
||||
],
|
||||
[
|
||||
'field' => MultipleSelectField::class,
|
||||
'form_renderer' => ConsoleFormRenderer::class,
|
||||
'field_renderer' => ConsoleSimpleFieldRenderer::class,
|
||||
],
|
||||
[
|
||||
'field' => MultipleSelectObjectField::class,
|
||||
'form_renderer' => ConsoleFormRenderer::class,
|
||||
'field_renderer' => ConsoleSelectObjectFieldRenderer::class,
|
||||
],
|
||||
[
|
||||
'field' => TagSetField::class,
|
||||
'form_renderer' => ConsoleFormRenderer::class,
|
||||
'field_renderer' => ConsoleSimpleFieldRenderer::class,
|
||||
],
|
||||
[
|
||||
'field' => TagSetObjectField::class,
|
||||
'form_renderer' => ConsoleFormRenderer::class,
|
||||
'field_renderer' => ConsoleSelectObjectFieldRenderer::class,
|
||||
],
|
||||
];
|
||||
}
|
||||
}
|
||||
@@ -26,12 +26,14 @@ use Combodo\iTop\Application\UI\Base\Component\Input\InputUIBlockFactory;
|
||||
use Combodo\iTop\Application\UI\Base\Component\Input\Select\SelectOptionUIBlockFactory;
|
||||
use Combodo\iTop\Application\UI\Base\Component\Input\SelectUIBlockFactory;
|
||||
use Combodo\iTop\Application\UI\Base\Layout\UIContentBlockUIBlockFactory;
|
||||
use Combodo\iTop\Core\MetaModel\FriendlyNameType;
|
||||
use Combodo\iTop\Form\Field\SelectObjectField;
|
||||
use Combodo\iTop\Form\Validator\MandatoryValidator;
|
||||
use Combodo\iTop\Renderer\BlockRenderer;
|
||||
use Combodo\iTop\Renderer\FieldRenderer;
|
||||
use DBObjectSet;
|
||||
use Dict;
|
||||
use MetaModel;
|
||||
use UIExtKeyWidget;
|
||||
|
||||
/**
|
||||
@@ -51,29 +53,27 @@ class ConsoleSelectObjectFieldRenderer extends FieldRenderer
|
||||
$oBlock = FieldUIBlockFactory::MakeStandard($this->oField->GetLabel());
|
||||
$oBlock->AddDataAttribute("input-id", $this->oField->GetGlobalId());
|
||||
|
||||
$sFieldClass = get_class($this->oField);
|
||||
\IssueLog::Error($this->oField->GetLabel().':render select multi:'.$sFieldClass);
|
||||
$sEditType = 'none';
|
||||
if ($this->oField->GetReadOnly())
|
||||
{
|
||||
$oBlock->AddDataAttribute("input-type","Combodo\\iTop\\Form\\Field\\SelectObjectField\readonly");
|
||||
if ($this->oField->GetReadOnly()) {
|
||||
$oBlock->AddDataAttribute("input-type", "Combodo\\iTop\\Form\\Field\\SelectObjectField\readonly");
|
||||
$oSearch = $this->oField->GetSearch()->DeepClone();
|
||||
$oSearch->AddCondition('id', $this->oField->GetCurrentValue());
|
||||
$oSet = new DBObjectSet($oSearch);
|
||||
$oObject = $oSet->Fetch();
|
||||
if ($oObject)
|
||||
{
|
||||
if ($oObject) {
|
||||
$sCurrentLabel = $oObject->Get('friendlyname');
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
$sCurrentLabel = '';
|
||||
}
|
||||
$oValue = UIContentBlockUIBlockFactory::MakeStandard();
|
||||
$oValue->AddSubBlock(InputUIBlockFactory::MakeForHidden("",$this->oField->GetCurrentValue(),$this->oField->GetGlobalId()));
|
||||
$oValue->AddSubBlock(InputUIBlockFactory::MakeForHidden("", $this->oField->GetCurrentValue(), $this->oField->GetGlobalId()));
|
||||
$oValue->AddSubBlock(new Html($sCurrentLabel));
|
||||
$oBlock->SetValue($oValue);
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
|
||||
|
||||
$oSearch = $this->oField->GetSearch()->DeepClone();
|
||||
$oSearch->SetModifierProperty('UserRightsGetSelectFilter', 'bSearchMode', true);
|
||||
|
||||
@@ -86,110 +86,275 @@ class ConsoleSelectObjectFieldRenderer extends FieldRenderer
|
||||
|
||||
$iMaxComboLength = $this->oField->GetMaximumComboLength();
|
||||
$iCount = $oAllowedValues->Count();
|
||||
if ($iCount > $iMaxComboLength)
|
||||
{
|
||||
// Auto-complete
|
||||
//
|
||||
$oBlock->AddDataAttribute("input-type","Combodo\\iTop\\Form\\Field\\SelectObjectField\\Autocomplete");
|
||||
$sEditType = 'autocomplete';
|
||||
$aExtKeyParams = array();
|
||||
$aExtKeyParams['iFieldSize'] = 10;
|
||||
$aExtKeyParams['iMinChars'] = $this->oField->GetMinAutoCompleteChars();
|
||||
$sFieldName = $this->oField->GetGlobalId();
|
||||
$sFieldId = $sFieldName;
|
||||
$sFormPrefix = '';
|
||||
$oWidget = new UIExtKeyWidget($sTargetClass, $sFieldId, '', true);
|
||||
$aArgs = array();
|
||||
$sTitle = $this->oField->GetLabel();
|
||||
|
||||
$oPage = new CaptureWebPage();
|
||||
$sHTMLValue = $oWidget->DisplaySelect($oPage, $iMaxComboLength, false /* $bAllowTargetCreation */, $sTitle, $oSet, $this->oField->GetCurrentValue(), $this->oField->GetMandatory(), $sFieldName, $sFormPrefix, $aArgs);
|
||||
$oValue = UIContentBlockUIBlockFactory::MakeStandard();
|
||||
$oValue->AddSubBlock(new Html($sHTMLValue));
|
||||
$oValue->AddSubBlock(new Html($oPage->GetHtml()));
|
||||
$oBlock->AddSubBlock($oValue);
|
||||
switch ($sFieldClass) {
|
||||
case 'Combodo\\iTop\\Form\\Field\\MultipleSelectObjectField':
|
||||
$oValue = UIContentBlockUIBlockFactory::MakeStandard("", ["form-field-content"]);
|
||||
$bVertical = true;
|
||||
$idx = 0;
|
||||
$aValues = $this->oField->GetCurrentValue();
|
||||
$sId = $this->oField->GetGlobalId();
|
||||
|
||||
$oOutput->AddJs($oPage->GetJS());
|
||||
$oOutput->AddJs($oPage->GetReadyJS());
|
||||
foreach ($oPage->GetCSS() as $sCss)
|
||||
{
|
||||
$oOutput->AddCss($sCss);
|
||||
}
|
||||
foreach ($oPage->GetJSFiles() as $sFile)
|
||||
{
|
||||
$oOutput->AddJsFile($sFile);
|
||||
}
|
||||
foreach ($oPage->GetCSSFiles() as $sFile)
|
||||
{
|
||||
$oOutput->AddCssFile($sFile);
|
||||
}
|
||||
$oOutput->AddJs(
|
||||
<<<EOF
|
||||
$("#{$this->oField->GetGlobalId()}").off("change").on("change", function(){
|
||||
var me = this;
|
||||
// N°4792 - load only the required fields
|
||||
$aFieldsToLoad = [];
|
||||
|
||||
$(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');
|
||||
});
|
||||
$aComplementAttributeSpec = MetaModel::GetNameSpec($oAllowedValues->GetClass(), FriendlyNameType::COMPLEMENTARY);
|
||||
$sFormatAdditionalField = $aComplementAttributeSpec[0];
|
||||
$aAdditionalField = $aComplementAttributeSpec[1];
|
||||
$bAddingValue = false;
|
||||
|
||||
if (count($aAdditionalField) > 0) {
|
||||
$sClassAllowed = $oAllowedValues->GetClass();
|
||||
$bAddingValue = true;
|
||||
$aFieldsToLoad[$sClassAllowed] = $aAdditionalField;
|
||||
}
|
||||
$sObjectImageAttCode = MetaModel::GetImageAttributeCode($sClassAllowed);
|
||||
if (!empty($sObjectImageAttCode)) {
|
||||
$aFieldsToLoad[$sClassAllowed][] = $sObjectImageAttCode;
|
||||
}
|
||||
$aFieldsToLoad[$sClassAllowed][] = 'friendlyname';
|
||||
$oAllowedValues->OptimizeColumnLoad($aFieldsToLoad);
|
||||
$bInitValue = false;
|
||||
while ($oObj = $oAllowedValues->Fetch()) {
|
||||
/*$aOption = [];
|
||||
$aOption['value'] = $oObj->GetKey();
|
||||
$aOption['label'] = $oObj->GetName();
|
||||
$aOption['search_label'] = utils::HtmlEntityDecode($oObj->GetName());
|
||||
|
||||
if ($oObj->IsObsolete()) {
|
||||
$aOption['obsolescence_flag'] = "1";
|
||||
}
|
||||
if ($bAddingValue) {
|
||||
$aArguments = [];
|
||||
foreach ($aAdditionalField as $sAdditionalField) {
|
||||
array_push($aArguments, $oObj->Get($sAdditionalField));
|
||||
}
|
||||
$aOption['additional_field'] = utils::HtmlEntities(vsprintf($sFormatAdditionalField, $aArguments));
|
||||
}
|
||||
if (!empty($sObjectImageAttCode)) {
|
||||
// Try to retrieve image for contact
|
||||
// @var \ormDocument $oImage
|
||||
$oImage = $oObj->Get($sObjectImageAttCode);
|
||||
if (!$oImage->IsEmpty()) {
|
||||
$aOption['picture_url'] = $oImage->GetDisplayURL($sClassAllowed, $oObj->GetKey(), $sObjectImageAttCode);
|
||||
$aOption['initials'] = '';
|
||||
} else {
|
||||
$aOption['initials'] = utils::FormatInitialsForMedallion(utils::ToAcronym($oObj->Get('friendlyname')));
|
||||
}
|
||||
}*/
|
||||
$sLabel = $oObj->GetName();
|
||||
$oCheckBox = InputUIBlockFactory::MakeForInputWithLabel($sLabel, "checkbox_".$sId, $oObj->GetKey(), "{$sId}", "checkbox");
|
||||
if (in_array($oObj->GetKey(), $aValues, true)) {
|
||||
$oCheckBox->GetInput()->SetIsChecked(true);
|
||||
}
|
||||
$oCheckBox->SetBeforeInput(false);
|
||||
$oCheckBox->GetInput()->AddCSSClass('ibo-input-checkbox');
|
||||
$oValue->AddSubBlock($oCheckBox);
|
||||
if ($bVertical) {
|
||||
$oValue->AddSubBlock(new Html("<br>"));
|
||||
}
|
||||
$oOutput->AddJs(
|
||||
<<<EOF
|
||||
$("#{$sId}_{$idx}").off("change").on("change", function(){
|
||||
$('#{$sId}').val(this.value).trigger('change');
|
||||
});
|
||||
EOF
|
||||
);
|
||||
}
|
||||
elseif($this->oField->GetControlType() == SelectObjectField::CONTROL_RADIO_VERTICAL)
|
||||
{
|
||||
$oBlock->AddDataAttribute("input-type","Combodo\\iTop\\Form\\Field\\SelectObjectField\\Radio");
|
||||
// Radio buttons (vertical)
|
||||
//
|
||||
$sEditType = 'radio';
|
||||
$bVertical = true;
|
||||
$idx = 0;
|
||||
$bMandatory = $this->oField->GetMandatory();
|
||||
$value = $this->oField->GetCurrentValue();
|
||||
$sId = $this->oField->GetGlobalId();
|
||||
|
||||
$oValue = UIContentBlockUIBlockFactory::MakeStandard();
|
||||
|
||||
while ($oObject = $oSet->Fetch())
|
||||
{
|
||||
$iObject = $oObject->GetKey();
|
||||
$sLabel = $oObject->Get('friendlyname');
|
||||
if (($iCount == 1) && $bMandatory)
|
||||
{
|
||||
// When there is only once choice, select it by default
|
||||
$sSelected = 'checked';
|
||||
$value = $iObject;
|
||||
);
|
||||
$idx++;
|
||||
}
|
||||
else
|
||||
{
|
||||
$sSelected = ($value == $iObject) ? 'checked' : '';
|
||||
$oValue->AddSubBlock(InputUIBlockFactory::MakeForHidden("", json_encode($aValues), $sId));
|
||||
$oValue->AddSubBlock(new Html('<span class="form_validation"></span>'));
|
||||
$oBlock->AddSubBlock($oValue);
|
||||
break;
|
||||
case 'Combodo\\iTop\\Form\\Field\\TagSetObjectField':
|
||||
/** @var \ormSet $value code qui vient des tagset
|
||||
* $sJson = $oAttDef->GetJsonForWidget($value, $aArgs);
|
||||
* $sEscapedJson = utils::EscapeHtml($sJson);
|
||||
* $sSetInputName = "attr_{$sFormPrefix}{$sAttCode}";
|
||||
*
|
||||
* // handle form validation
|
||||
* $aEventsList[] = 'change';
|
||||
* $aEventsList[] = 'validate';
|
||||
* $sNullValue = '';
|
||||
* $sFieldToValidateId = $sFieldToValidateId.AttributeSet::EDITABLE_INPUT_ID_SUFFIX;
|
||||
*
|
||||
* // generate form HTML output
|
||||
* $sValidationSpan = "<span class=\"form_validation ibo-field-validation\" id=\"v_{$sFieldToValidateId}\"></span>";
|
||||
* $sHTMLValue = '<div class="field_input_zone field_input_set ibo-input-wrapper ibo-input-tagset-wrapper" data-validation="untouched"><input id="'.$iId.'" name="'.$sSetInputName.'" type="hidden" value="'.$sEscapedJson.'"></div>'.$sValidationSpan.$sReloadSpan;
|
||||
* $sScript = "$('#$iId').set_widget({inputWidgetIdSuffix: '".AttributeSet::EDITABLE_INPUT_ID_SUFFIX."'});";
|
||||
* $oPage->add_ready_script($sScript);*/
|
||||
|
||||
$oValue = UIContentBlockUIBlockFactory::MakeStandard("", ["form-field-content"]);
|
||||
$aValues = $this->oField->GetCurrentValue();
|
||||
|
||||
$aFieldsToLoad = [];
|
||||
$aComplementAttributeSpec = MetaModel::GetNameSpec($oAllowedValues->GetClass(), FriendlyNameType::COMPLEMENTARY);
|
||||
$sFormatAdditionalField = $aComplementAttributeSpec[0];
|
||||
$aAdditionalField = $aComplementAttributeSpec[1];
|
||||
$bAddingValue = false;
|
||||
|
||||
if (count($aAdditionalField) > 0) {
|
||||
$sClassAllowed = $oAllowedValues->GetClass();
|
||||
$bAddingValue = true;
|
||||
$aFieldsToLoad[$sClassAllowed] = $aAdditionalField;
|
||||
|
||||
$sObjectImageAttCode = MetaModel::GetImageAttributeCode($sClassAllowed);
|
||||
if (!empty($sObjectImageAttCode)) {
|
||||
$aFieldsToLoad[$sClassAllowed][] = $sObjectImageAttCode;
|
||||
}
|
||||
$aFieldsToLoad[$sClassAllowed][] = 'friendlyname';
|
||||
}
|
||||
$oRadioCustom = InputUIBlockFactory::MakeForInputWithLabel($sLabel, "radio_$sId", $iObject, "{$sId}_{$iObject}", "radio");
|
||||
$oRadioCustom->AddCSSClass('ibo-input-field-wrapper');
|
||||
$oRadioCustom->GetInput()->SetIsChecked($sSelected);
|
||||
$oRadioCustom->SetBeforeInput(false);
|
||||
$oRadioCustom->GetInput()->AddCSSClass('ibo-input-checkbox');
|
||||
$oValue->AddSubBlock($oRadioCustom);
|
||||
|
||||
$oAllowedValues->OptimizeColumnLoad($aFieldsToLoad);
|
||||
//MAYBE USE INPUT SET ?
|
||||
$oSelect = SelectUIBlockFactory::MakeForSelectWithLabel($this->oField->GetLabel(), $this->oField->GetDescription(), $this->oField->GetGlobalId());
|
||||
$oSelect->SetIsMultiple(true);
|
||||
while ($oObj = $oAllowedValues->Fetch()) {
|
||||
$oSelect->AddSubBlock(SelectOptionUIBlockFactory::MakeForSelectOption(
|
||||
$oObj->GetKey(),
|
||||
$oObj->GetName(),
|
||||
(is_null($aValues) || !is_array($aValues)) ? false : in_array($oObj->GetKey(), $aValues, true) === true)
|
||||
);
|
||||
}
|
||||
|
||||
$oOutput->AddJs(
|
||||
<<<EOF
|
||||
<<<JS
|
||||
$("#{$this->oField->GetGlobalId()}").selectize({
|
||||
maxItems: null,
|
||||
sortField: 'text',
|
||||
onChange: function(value){
|
||||
console.warn('chane');
|
||||
var me = this.\$input;
|
||||
me.trigger("field_change", {
|
||||
id: me.attr("id"),
|
||||
name: me.closest(".form_field").attr("data-field-id"),
|
||||
value: me.val()
|
||||
})
|
||||
.closest('.form_handler').trigger('change');
|
||||
|
||||
$(me).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');
|
||||
},
|
||||
loadingClass: '',
|
||||
itemClass: 'item attribute-set-item',
|
||||
inputClass: 'attribute-set ibo-input ibo-input-selectize',
|
||||
render: {
|
||||
option: function(option) {
|
||||
return CombodoGlobalToolbox.RenderTemplate('#{$this->oField->GetGlobalId()}_options_template', option, this.settings.optionClass)[0].outerHTML;
|
||||
},
|
||||
item: function (item) {
|
||||
return CombodoGlobalToolbox.RenderTemplate('#{$this->oField->GetGlobalId()}_items_template', item, this.settings.itemClass)[0].outerHTML;
|
||||
},
|
||||
},
|
||||
});
|
||||
$("#{$this->oField->GetGlobalId()}").closest('div').addClass('ibo-input-select-wrapper--with-buttons');
|
||||
$("#{$this->oField->GetGlobalId()}").off("change").on("change", function(){
|
||||
var me = this;
|
||||
|
||||
});
|
||||
JS
|
||||
);
|
||||
|
||||
$oValue->AddSubBlock($oSelect);
|
||||
$oValue->AddSubBlock(new Html('<span class="form_validation"></span>'));
|
||||
$oBlock->AddSubBlock($oValue);
|
||||
break;
|
||||
default:
|
||||
if ($iCount > $iMaxComboLength) {
|
||||
|
||||
// Auto-complete
|
||||
//
|
||||
$oBlock->AddDataAttribute("input-type", "Combodo\\iTop\\Form\\Field\\SelectObjectField\\Autocomplete");
|
||||
$sEditType = 'autocomplete';
|
||||
$sFieldName = $this->oField->GetGlobalId();
|
||||
$sFieldId = $sFieldName;
|
||||
$sFormPrefix = '';
|
||||
$oWidget = new UIExtKeyWidget($sTargetClass, $sFieldId, '', true);
|
||||
$aArgs = array();
|
||||
$sTitle = $this->oField->GetLabel();
|
||||
|
||||
$oPage = new CaptureWebPage();
|
||||
$sHTMLValue = $oWidget->DisplaySelect($oPage, $iMaxComboLength, false /* $bAllowTargetCreation */, $sTitle, $oSet, $this->oField->GetCurrentValue(), $this->oField->GetMandatory(), $sFieldName, $sFormPrefix, $aArgs);
|
||||
$oValue = UIContentBlockUIBlockFactory::MakeStandard();
|
||||
$oValue->AddSubBlock(new Html($sHTMLValue));
|
||||
$oValue->AddSubBlock(new Html($oPage->GetHtml()));
|
||||
$oBlock->AddSubBlock($oValue);
|
||||
|
||||
$oOutput->AddJs($oPage->GetJS());
|
||||
$oOutput->AddJs($oPage->GetReadyJS());
|
||||
foreach ($oPage->GetCSS() as $sCss) {
|
||||
$oOutput->AddCss($sCss);
|
||||
}
|
||||
foreach ($oPage->GetJSFiles() as $sFile) {
|
||||
$oOutput->AddJsFile($sFile);
|
||||
}
|
||||
foreach ($oPage->GetCSSFiles() as $sFile) {
|
||||
$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) {
|
||||
$oBlock->AddDataAttribute("input-type", "Combodo\\iTop\\Form\\Field\\SelectObjectField\\Radio");
|
||||
// Radio buttons (vertical)
|
||||
//
|
||||
$sEditType = 'radio';
|
||||
$bVertical = true;
|
||||
$idx = 0;
|
||||
$bMandatory = $this->oField->GetMandatory();
|
||||
$value = $this->oField->GetCurrentValue();
|
||||
$sId = $this->oField->GetGlobalId();
|
||||
|
||||
$oValue = UIContentBlockUIBlockFactory::MakeStandard();
|
||||
|
||||
while ($oObject = $oSet->Fetch()) {
|
||||
$iObject = $oObject->GetKey();
|
||||
$sLabel = $oObject->Get('friendlyname');
|
||||
if (($iCount == 1) && $bMandatory) {
|
||||
// When there is only once choice, select it by default
|
||||
$sSelected = 'checked';
|
||||
$value = $iObject;
|
||||
} else {
|
||||
$sSelected = ($value == $iObject) ? 'checked' : '';
|
||||
}
|
||||
$oRadioCustom = InputUIBlockFactory::MakeForInputWithLabel($sLabel, "radio_$sId", $iObject, "{$sId}_{$iObject}", "radio");
|
||||
$oRadioCustom->AddCSSClass('ibo-input-field-wrapper');
|
||||
$oRadioCustom->GetInput()->SetIsChecked($sSelected);
|
||||
$oRadioCustom->SetBeforeInput(false);
|
||||
$oRadioCustom->GetInput()->AddCSSClass('ibo-input-checkbox');
|
||||
$oValue->AddSubBlock($oRadioCustom);
|
||||
$oOutput->AddJs(
|
||||
<<<EOF
|
||||
$("#{$sId}_{$iObject}").off("change").on("change", function(){
|
||||
$('#{$sId}').val(this.value).trigger('change');
|
||||
});
|
||||
EOF
|
||||
);
|
||||
if ($bVertical)
|
||||
{
|
||||
$oValue->AddSubBlock(new Html("<br>"));
|
||||
}
|
||||
$idx++;
|
||||
}
|
||||
$oValue->AddSubBlock(InputUIBlockFactory::MakeForHidden($sId,$value,$sId));
|
||||
$oBlock->AddSubBlock($oValue);
|
||||
$oBlock->AddSubBlock(new Html('<span class="form_validation"></span>'));
|
||||
$oOutput->AddJs(
|
||||
<<<EOF
|
||||
);
|
||||
if ($bVertical) {
|
||||
$oValue->AddSubBlock(new Html("<br>"));
|
||||
}
|
||||
$idx++;
|
||||
}
|
||||
$oValue->AddSubBlock(InputUIBlockFactory::MakeForHidden($sId, $value, $sId));
|
||||
$oBlock->AddSubBlock($oValue);
|
||||
$oBlock->AddSubBlock(new Html('<span class="form_validation"></span>'));
|
||||
$oOutput->AddJs(
|
||||
<<<EOF
|
||||
$("#{$this->oField->GetGlobalId()}").off("change").on("change", function(){
|
||||
var me = this;
|
||||
|
||||
@@ -201,28 +366,25 @@ EOF
|
||||
.closest('.form_handler').trigger('value_change');
|
||||
});
|
||||
EOF
|
||||
);
|
||||
}
|
||||
else
|
||||
{
|
||||
// Drop-down select
|
||||
//
|
||||
$oBlock->AddDataAttribute("input-type","Combodo\\iTop\\Form\\Field\\SelectObjectField\\Select");
|
||||
$sEditType = 'select';
|
||||
$oSelect = SelectUIBlockFactory::MakeForSelect("",$this->oField->GetGlobalId());
|
||||
$oSelect->AddCSSClass('ibo-input-select-placeholder');
|
||||
$oBlock->AddSubBlock(UIContentBlockUIBlockFactory::MakeStandard(null,['ibo-input-field-wrapper'])->AddSubBlock($oSelect));
|
||||
$oSelect->AddOption(SelectOptionUIBlockFactory::MakeForSelectOption('',Dict::S('UI:SelectOne'), false ));
|
||||
while ($oObject = $oSet->Fetch())
|
||||
{
|
||||
$iObject = $oObject->GetKey();
|
||||
$sLabel = $oObject->Get('friendlyname');
|
||||
// Note : The test is a double equal on purpose as the type of the value received from the XHR is not always the same as the type of the allowed values. (eg : string vs int)
|
||||
$oSelect->AddOption(SelectOptionUIBlockFactory::MakeForSelectOption($iObject,$sLabel, ($this->oField->GetCurrentValue() == $iObject)));
|
||||
}
|
||||
$oBlock->AddSubBlock(new Html('<span class="form_validation"></span>'));
|
||||
$oOutput->AddJs(
|
||||
<<<JS
|
||||
);
|
||||
} else {
|
||||
// Drop-down select
|
||||
//
|
||||
$oBlock->AddDataAttribute("input-type", "Combodo\\iTop\\Form\\Field\\SelectObjectField\\Select");
|
||||
$sEditType = 'select';
|
||||
$oSelect = SelectUIBlockFactory::MakeForSelect("", $this->oField->GetGlobalId());
|
||||
$oSelect->AddCSSClass('ibo-input-select-placeholder');
|
||||
$oBlock->AddSubBlock(UIContentBlockUIBlockFactory::MakeStandard(null, ['ibo-input-field-wrapper'])->AddSubBlock($oSelect));
|
||||
$oSelect->AddOption(SelectOptionUIBlockFactory::MakeForSelectOption('', Dict::S('UI:SelectOne'), false));
|
||||
while ($oObject = $oSet->Fetch()) {
|
||||
$iObject = $oObject->GetKey();
|
||||
$sLabel = $oObject->Get('friendlyname');
|
||||
// Note : The test is a double equal on purpose as the type of the value received from the XHR is not always the same as the type of the allowed values. (eg : string vs int)
|
||||
$oSelect->AddOption(SelectOptionUIBlockFactory::MakeForSelectOption($iObject, $sLabel, ($this->oField->GetCurrentValue() == $iObject)));
|
||||
}
|
||||
$oBlock->AddSubBlock(new Html('<span class="form_validation"></span>'));
|
||||
$oOutput->AddJs(
|
||||
<<<JS
|
||||
$("#{$this->oField->GetGlobalId()}").selectize({
|
||||
sortField: 'text',
|
||||
onChange: function(value){
|
||||
@@ -233,33 +395,43 @@ EOF
|
||||
value: me.val()
|
||||
})
|
||||
.closest('.form_handler').trigger('value_change');
|
||||
},
|
||||
inputClass: 'ibo-input-vanilla ibo-input ibo-input-selectize',
|
||||
},
|
||||
loadingClass: '',
|
||||
itemClass: 'item attribute-set-item',
|
||||
inputClass: 'ibo-input-vanilla ibo-input ibo-input-selectize',
|
||||
plugins: {
|
||||
'combodo_update_operations' : {
|
||||
initial: ["5"],
|
||||
},
|
||||
'combodo_auto_position' : {
|
||||
maxDropDownHeight: 300,
|
||||
},
|
||||
'remove_button' : {},
|
||||
},
|
||||
});
|
||||
$("#{$this->oField->GetGlobalId()}").closest('div').addClass('ibo-input-select-wrapper--with-buttons');
|
||||
JS
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
$oBlock->AddDataAttribute("input-type", $sFieldClass);
|
||||
$oOutput->AddHtml((BlockRenderer::RenderBlockTemplates($oBlock)));
|
||||
// JS Form field widget construct
|
||||
$aValidators = array();
|
||||
foreach ($this->oField->GetValidators() as $oValidator) {
|
||||
if ($oValidator::GetName() == 'notemptyextkey') {
|
||||
// The autocomplete widget returns an empty string if the value is undefined (and the select has been aligned with this behavior)
|
||||
$oValidator = new MandatoryValidator();
|
||||
}
|
||||
$aValidators[$oValidator::GetName()] = array(
|
||||
'reg_exp' => $oValidator->GetRegExp(),
|
||||
'message' => Dict::S($oValidator->GetErrorMessage()),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
$oOutput->AddHtml((BlockRenderer::RenderBlockTemplates($oBlock)));
|
||||
// JS Form field widget construct
|
||||
$aValidators = array();
|
||||
foreach ($this->oField->GetValidators() as $oValidator)
|
||||
{
|
||||
if ($oValidator::GetName() == 'notemptyextkey')
|
||||
{
|
||||
// The autocomplete widget returns an empty string if the value is undefined (and the select has been aligned with this behavior)
|
||||
$oValidator = new MandatoryValidator();
|
||||
}
|
||||
$aValidators[$oValidator::GetName()] = array(
|
||||
'reg_exp' => $oValidator->GetRegExp(),
|
||||
'message' => Dict::S($oValidator->GetErrorMessage())
|
||||
);
|
||||
}
|
||||
$sValidators = json_encode($aValidators);
|
||||
$sFormFieldOptions =
|
||||
<<<EOF
|
||||
$sValidators = json_encode($aValidators);
|
||||
$sFormFieldOptions =
|
||||
<<<EOF
|
||||
{
|
||||
validators: $sValidators,
|
||||
on_validation_callback: function(me, oResult) {
|
||||
@@ -279,14 +451,14 @@ JS
|
||||
}
|
||||
}
|
||||
}
|
||||
EOF
|
||||
;
|
||||
EOF;
|
||||
|
||||
$oOutput->AddJs(
|
||||
<<<EOF
|
||||
$oOutput->AddJs(
|
||||
<<<EOF
|
||||
$("[data-field-id='{$this->oField->GetId()}'][data-form-path='{$this->oField->GetFormPath()}']").form_field($sFormFieldOptions);
|
||||
EOF
|
||||
);
|
||||
);
|
||||
}
|
||||
switch ($sEditType)
|
||||
{
|
||||
case 'autocomplete':
|
||||
|
||||
@@ -51,6 +51,7 @@ class ConsoleSimpleFieldRenderer extends FieldRenderer
|
||||
{
|
||||
$oOutput = parent::Render();
|
||||
$sFieldClass = get_class($this->oField);
|
||||
\IssueLog::Error($this->oField->GetLabel().':render simple:'.$sFieldClass);
|
||||
|
||||
if ($sFieldClass == 'Combodo\\iTop\\Form\\Field\\HiddenField')
|
||||
{
|
||||
@@ -99,29 +100,29 @@ class ConsoleSimpleFieldRenderer extends FieldRenderer
|
||||
switch ($sFieldClass)
|
||||
{
|
||||
case 'Combodo\\iTop\\Form\\Field\\DateTimeField':
|
||||
$oValue = UIContentBlockUIBlockFactory::MakeStandard("",["form-field-content"]);
|
||||
$oValue = UIContentBlockUIBlockFactory::MakeStandard("", ["form-field-content"]);
|
||||
|
||||
$sDateTimeFormat = $this->oField->GetPHPDateTimeFormat();
|
||||
$oFormat = new DateTimeFormat($sDateTimeFormat);
|
||||
$sPlaceHolder = $oFormat->ToPlaceholder();
|
||||
if ($this->oField->GetReadOnly())
|
||||
{
|
||||
$oValue->AddSubBlock(InputUIBlockFactory::MakeForHidden("",$this->oField->GetCurrentValue(),$this->oField->GetGlobalId()));
|
||||
if ($this->oField->GetReadOnly()) {
|
||||
$oValue->AddSubBlock(InputUIBlockFactory::MakeForHidden("", $this->oField->GetCurrentValue(), $this->oField->GetGlobalId()));
|
||||
$oValue->AddSubBlock(new Html($this->oField->GetCurrentValue()));
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
$oField = UIContentBlockUIBlockFactory::MakeStandard("", ["field_input_zone", "field_input_datetime", "ibo-input-field-wrapper", "ibo-input-datetime-wrapper"]);
|
||||
$oValue->AddSubBlock($oField);
|
||||
$oField->AddSubBlock(new Html('<input class="date-pick ibo-input ibo-input-date" type="text" placeholder="'.utils::EscapeHtml($sPlaceHolder).'" id="'.$this->oField->GetGlobalId().'" value="'.utils::EscapeHtml($this->oField->GetCurrentValue()).'" autocomplete="off"/>'));
|
||||
$oField->AddSubBlock(new Html('<span class="form_validation"></span>'));
|
||||
}
|
||||
$oBlock->AddSubBlock($oValue);
|
||||
break;
|
||||
break;
|
||||
|
||||
case 'Combodo\\iTop\\Form\\Field\\LabelField':
|
||||
$oValue = UIContentBlockUIBlockFactory::MakeStandard("",[""]);
|
||||
$oValue = UIContentBlockUIBlockFactory::MakeStandard("", [""]);
|
||||
$oBlock->AddSubBlock($oValue);
|
||||
$oValue->AddSubBlock(new Text($this->oField->GetCurrentValue()));
|
||||
if (utils::IsNotNullOrEmptyString($this->oField->GetCurrentValue())) {
|
||||
$oValue->AddSubBlock(new Text($this->oField->GetCurrentValue()));
|
||||
}
|
||||
$oValue->AddSubBlock(new Html('<span class="form_validation"></span>'));
|
||||
break;
|
||||
|
||||
@@ -175,8 +176,7 @@ class ConsoleSimpleFieldRenderer extends FieldRenderer
|
||||
$('#{$this->oField->GetGlobalId()}').ckeditor(function(){}, $sJsConfig);
|
||||
EOF
|
||||
);
|
||||
if (($this->oField->GetObject() !== null) && ($this->oField->GetTransactionId() !== null))
|
||||
{
|
||||
if (($this->oField->GetObject() !== null) && ($this->oField->GetTransactionId() !== null)) {
|
||||
$oOutput->AddJs(InlineImage::EnableCKEditorImageUpload($this->oField->GetObject(), utils::GetUploadTempId($this->oField->GetTransactionId())));
|
||||
}
|
||||
}
|
||||
@@ -186,25 +186,21 @@ EOF
|
||||
break;
|
||||
|
||||
case 'Combodo\\iTop\\Form\\Field\\SelectField':
|
||||
$oValue = UIContentBlockUIBlockFactory::MakeStandard("",["form-field-content","ibo-input-field-wrapper"]);
|
||||
if ($this->oField->GetReadOnly())
|
||||
{
|
||||
$oValue = UIContentBlockUIBlockFactory::MakeStandard("", ["form-field-content", "ibo-input-field-wrapper"]);
|
||||
if ($this->oField->GetReadOnly()) {
|
||||
$aChoices = $this->oField->GetChoices();
|
||||
$sCurrentLabel = isset($aChoices[$this->oField->GetCurrentValue()]) ? $aChoices[$this->oField->GetCurrentValue()] : '' ;
|
||||
$oValue->AddSubBlock(InputUIBlockFactory::MakeForHidden("",$this->oField->GetCurrentValue(),$this->oField->GetGlobalId()));
|
||||
$sCurrentLabel = isset($aChoices[$this->oField->GetCurrentValue()]) ? $aChoices[$this->oField->GetCurrentValue()] : '';
|
||||
$oValue->AddSubBlock(InputUIBlockFactory::MakeForHidden("", $this->oField->GetCurrentValue(), $this->oField->GetGlobalId()));
|
||||
$oValue->AddSubBlock(new Html($sCurrentLabel));
|
||||
}
|
||||
else
|
||||
{
|
||||
$oSelect = SelectUIBlockFactory::MakeForSelect("",$this->oField->GetGlobalId());
|
||||
} else {
|
||||
$oSelect = SelectUIBlockFactory::MakeForSelect("", $this->oField->GetGlobalId());
|
||||
$oSelect->AddCSSClass('ibo-input-field-wrapper');
|
||||
if ($this->oField->GetMultipleValuesEnabled()) {
|
||||
$oSelect->SetIsMultiple(true);
|
||||
}
|
||||
foreach ($this->oField->GetChoices() as $sChoice => $sLabel)
|
||||
{
|
||||
foreach ($this->oField->GetChoices() as $sChoice => $sLabel) {
|
||||
// Note : The test is a double equal on purpose as the type of the value received from the XHR is not always the same as the type of the allowed values. (eg : string vs int)
|
||||
$oSelect->AddOption(SelectOptionUIBlockFactory::MakeForSelectOption($sChoice,$sLabel, ($this->oField->GetCurrentValue() == $sChoice)));
|
||||
$oSelect->AddOption(SelectOptionUIBlockFactory::MakeForSelectOption($sChoice, $sLabel, ($this->oField->GetCurrentValue() == $sChoice)));
|
||||
}
|
||||
$oValue->AddSubBlock($oSelect);
|
||||
$oValue->AddSubBlock(new Html('<span class="form_validation"></span>'));
|
||||
@@ -212,25 +208,119 @@ EOF
|
||||
$oBlock->AddSubBlock($oValue);
|
||||
break;
|
||||
|
||||
case 'Combodo\\iTop\\Form\\Field\\RadioField':
|
||||
$oValue = UIContentBlockUIBlockFactory::MakeStandard("",["form-field-content"]);
|
||||
if ($this->oField->GetReadOnly())
|
||||
{
|
||||
case 'Combodo\\iTop\\Form\\Field\\TagSetField':
|
||||
$oValue = UIContentBlockUIBlockFactory::MakeStandard("", ["form-field-content", "ibo-input-field-wrapper"]);
|
||||
if ($this->oField->GetReadOnly()) {
|
||||
$aChoices = $this->oField->GetChoices();
|
||||
$sCurrentLabel = isset($aChoices[$this->oField->GetCurrentValue()]) ? $aChoices[$this->oField->GetCurrentValue()] : '' ;
|
||||
$oValue->AddSubBlock(InputUIBlockFactory::MakeForHidden("",$this->oField->GetCurrentValue(),$this->oField->GetGlobalId()));
|
||||
$sCurrentLabel = isset($aChoices[$this->oField->GetCurrentValue()]) ? $aChoices[$this->oField->GetCurrentValue()] : '';
|
||||
$oValue->AddSubBlock(InputUIBlockFactory::MakeForHidden("", $this->oField->GetCurrentValue(), $this->oField->GetGlobalId()));
|
||||
$oValue->AddSubBlock(new Html($sCurrentLabel));
|
||||
} else {
|
||||
$oSelect = SelectUIBlockFactory::MakeForSelect("", $this->oField->GetGlobalId());
|
||||
$oSelect->SetIsMultiple(true);
|
||||
$oSelect->AddCSSClass('ibo-input-field-wrapper');
|
||||
\IssueLog::Error('valeur:'.json_encode($this->oField->GetCurrentValue()));
|
||||
foreach ($this->oField->GetChoices() as $sChoice => $sLabel) {
|
||||
// Note : The test is a double equal on purpose as the type of the value received from the XHR is not always the same as the type of the allowed values. (eg : string vs int)
|
||||
$oSelect->AddOption(SelectOptionUIBlockFactory::MakeForSelectOption($sChoice, $sLabel, is_null($this->oField->GetCurrentValue()) ? false : in_array($sChoice, $this->oField->GetCurrentValue()) === true));
|
||||
}
|
||||
$oValue->AddSubBlock($oSelect);
|
||||
$oValue->AddSubBlock(new Html('<span class="form_validation"></span>'));
|
||||
}
|
||||
else
|
||||
{
|
||||
$oBlock->AddSubBlock($oValue);
|
||||
$oOutput->AddJs(
|
||||
<<<JS
|
||||
$("#{$this->oField->GetGlobalId()}").selectize({
|
||||
maxItems: null,
|
||||
sortField: 'text',
|
||||
onChange: function(value){
|
||||
var me = this.\$input;
|
||||
me.trigger("field_change", {
|
||||
id: me.attr("id"),
|
||||
name: me.closest(".form_field").attr("data-field-id"),
|
||||
value: JSON.stringify(me.val())
|
||||
})
|
||||
.closest('.form_handler').trigger('value_change');
|
||||
console.warn('chanegement');
|
||||
},
|
||||
itemClass: 'attribute-set-item',
|
||||
});
|
||||
$("#{$this->oField->GetGlobalId()}").closest('div').addClass('ibo-input-select-wrapper--with-buttons');
|
||||
JS
|
||||
);
|
||||
break;
|
||||
|
||||
case 'Combodo\\iTop\\Form\\Field\\MultipleSelectField':
|
||||
$oValue = UIContentBlockUIBlockFactory::MakeStandard("", ["form-field-content"]);
|
||||
if ($this->oField->GetReadOnly()) {
|
||||
$aChoices = $this->oField->GetChoices();
|
||||
$sCurrentLabel = isset($aChoices[$this->oField->GetCurrentValue()]) ? $aChoices[$this->oField->GetCurrentValue()] : '';
|
||||
$oValue->AddSubBlock(InputUIBlockFactory::MakeForHidden("", $this->oField->GetCurrentValue(), $this->oField->GetGlobalId()));
|
||||
$oValue->AddSubBlock(new Html($sCurrentLabel));
|
||||
} else {
|
||||
$aValues = $this->oField->GetCurrentValue();
|
||||
// $oValue->AddSubBlock(InputUIBlockFactory::MakeForHidden("", implode(',', $this->oField->GetCurrentValue()), $this->oField->GetGlobalId()));
|
||||
$iId = 1;
|
||||
foreach ($this->oField->GetChoices() as $sChoice => $sLabel) {
|
||||
$oCheckBox = InputUIBlockFactory::MakeForInputWithLabel($sLabel, ''.$this->oField->GetGlobalId(), $sChoice, $this->oField->GetGlobalId().'_'.$iId, "checkbox");
|
||||
$oCheckBox->GetInput()->SetIsChecked(is_null($aValues) ? false : in_array($sChoice, $aValues) === true);
|
||||
$oCheckBox->SetBeforeInput(false);
|
||||
$oCheckBox->GetInput()->AddCSSClass('ibo-input--label-right');
|
||||
$oCheckBox->GetInput()->AddCSSClass('ibo-input-checkbox');
|
||||
$oValue->AddSubBlock($oCheckBox);
|
||||
$iId++;
|
||||
}
|
||||
$oOutput->AddJs(
|
||||
<<<JS
|
||||
$("[name={$this->oField->GetGlobalId()}]").off("change").on("change", function(){
|
||||
|
||||
$("[name={$this->oField->GetGlobalId()}]").closest(".field_set").trigger("field_change", {
|
||||
id: $("[name={$this->oField->GetGlobalId()}]").attr("id"),
|
||||
name: $("[name={$this->oField->GetGlobalId()}]").closest(".form_field").attr("data-field-id"),
|
||||
value: $("[name={$this->oField->GetGlobalId()}]").val()
|
||||
})
|
||||
.closest('.form_handler').trigger('value_change');
|
||||
});
|
||||
JS
|
||||
);
|
||||
/* $oOutput->AddJs(
|
||||
<<<JS
|
||||
$("[name=checkbox_{$this->oField->GetGlobalId()}]").off("change").on("change", function(){
|
||||
var aValues = [];
|
||||
$("[name=checkbox_{$this->oField->GetGlobalId()}]").each(function(){ if (this.checked){ aValues.push($(this).val()); }});
|
||||
$("#{$this->oField->GetGlobalId()}").val(aValues.toString());
|
||||
|
||||
$("#{$this->oField->GetGlobalId()}").closest(".field_set").trigger("field_change", {
|
||||
id: $("{$this->oField->GetGlobalId()}").attr("id"),
|
||||
name: $("{$this->oField->GetGlobalId()}").closest(".form_field").attr("data-field-id"),
|
||||
value: $("{$this->oField->GetGlobalId()}").val()
|
||||
})
|
||||
.closest('.form_handler').trigger('value_change');
|
||||
});
|
||||
JS
|
||||
);*/
|
||||
|
||||
|
||||
$oValue->AddSubBlock(new Html('<span class="form_validation"></span>'));
|
||||
$oBlock->AddSubBlock($oValue);
|
||||
}
|
||||
break;
|
||||
|
||||
case 'Combodo\\iTop\\Form\\Field\\RadioField':
|
||||
$oValue = UIContentBlockUIBlockFactory::MakeStandard("", ["form-field-content"]);
|
||||
if ($this->oField->GetReadOnly()) {
|
||||
$aChoices = $this->oField->GetChoices();
|
||||
$sCurrentLabel = isset($aChoices[$this->oField->GetCurrentValue()]) ? $aChoices[$this->oField->GetCurrentValue()] : '';
|
||||
$oValue->AddSubBlock(InputUIBlockFactory::MakeForHidden("", $this->oField->GetCurrentValue(), $this->oField->GetGlobalId()));
|
||||
$oValue->AddSubBlock(new Html($sCurrentLabel));
|
||||
} else {
|
||||
$bVertical = true;
|
||||
$idx = 0;
|
||||
$bMandatory = $this->oField->GetMandatory();
|
||||
$value = $this->oField->GetCurrentValue();
|
||||
$sId = $this->oField->GetGlobalId();
|
||||
$aChoices = $this->oField->GetChoices();
|
||||
foreach ($aChoices as $sChoice => $sLabel)
|
||||
{
|
||||
foreach ($aChoices as $sChoice => $sLabel) {
|
||||
if ((count($aChoices) == 1) && $bMandatory) {
|
||||
// When there is only once choice, select it by default
|
||||
$sSelected = 'checked';
|
||||
@@ -398,16 +488,19 @@ EOF
|
||||
$oOutput->AddJs(
|
||||
<<<EOF
|
||||
$("#{$this->oField->GetGlobalId()}").selectize({
|
||||
sortField: 'text',
|
||||
onChange: function(value){
|
||||
var me = this.\$input;
|
||||
me.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');
|
||||
}
|
||||
sortField: 'text',
|
||||
onChange: function(value){
|
||||
|
||||
console.warn('lala');
|
||||
var me = this.\$input;
|
||||
me.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');
|
||||
},
|
||||
itemClass: 'attribute-set-item'
|
||||
});
|
||||
EOF
|
||||
);
|
||||
@@ -469,8 +562,7 @@ EOF
|
||||
$("[data-field-id='{$this->oField->GetId()}'][data-form-path='{$this->oField->GetFormPath()}']").form_field($sFormFieldOptions);
|
||||
EOF
|
||||
);
|
||||
switch ($sFieldClass)
|
||||
{
|
||||
switch ($sFieldClass) {
|
||||
case 'Combodo\\iTop\\Form\\Field\\SelectField':
|
||||
$oOutput->AddJs(
|
||||
<<<EOF
|
||||
@@ -478,6 +570,13 @@ EOF
|
||||
EOF
|
||||
);
|
||||
break;
|
||||
case 'Combodo\\iTop\\Form\\Field\\TagSetField':
|
||||
//case 'Combodo\\iTop\\Form\\Field\\MultipleSelectField':
|
||||
$oOutput->AddJs(
|
||||
<<<EOF
|
||||
$("[data-field-id='{$this->oField->GetId()}'][data-form-path='{$this->oField->GetFormPath()}']").form_field('option', 'get_current_value_callback', function(me){console.warn('bobb'); return $(me.element).find('select').val();});
|
||||
EOF
|
||||
);
|
||||
}
|
||||
|
||||
$oOutput->AddJs(
|
||||
|
||||
Reference in New Issue
Block a user