SysConfig#

NAME#

Kernel::Output::HTML::SysConfig - Manage HTML representation of SysConfig settings.

PUBLIC INTERFACE#

new()#

Create an object. Do not use it directly, instead use:

use Kernel::System::ObjectManager;
local $Kernel::OM = Kernel::System::ObjectManager->new();
my $SysConfigHTMLObject = $Kernel::OM->Get('Kernel::Output::HTML::SysConfig');

SettingRender()#

Returns the specific HTML for the setting.

my $HTMLStr = $SysConfigHTMLObject->SettingRender(
    Setting   => {
        Name             => 'Setting Name',
        XMLContentParsed => $XMLParsedToPerl,
        EffectiveValue   => "Product 6",        # or a complex structure
        DefaultValue     => "Product 5",        # or a complex structure
        IsAjax           => 1,                  # (optional) is ajax request. Default 0.
        # ...
    },
    RW     => 1,                                # (optional) Allow editing. Default 0.
    UserID => 1,                                # (required) UserID
);

Returns:

$HTMLStr = '<div class="Setting"><div class "Field"...</div></div>'        # or false in case of an error

SettingAddItem()#

Returns response that is sent when user adds new array/hash item.

my %Result = $SysConfigHTMLObject->SettingAddItem(
    SettingStructure  => [],         # (required) array that contains structure
                                     #  where a new item should be inserted (can be empty)
    Setting           => {           # (required) Setting hash (from SettingGet())
        'DefaultID' => '8905',
        'DefaultValue' => [ 'Item 1', 'Item 2' ],
        'Description' => 'Simple array item(Min 1, Max 3).',
        'Name' => 'TestArray',
        ...
    },
    Key               => 'HashKey',  # (optional) hash key
    IDSuffix          => '_Array3,   # (optional) suffix that will be added to all input/select fields
                                     #    (it is used in the JS on Update, during EffectiveValue calculation)
    Value             => [           # (optional) Perl structure
        {
            'Array' => [
                'Item' => [
                    {
                    'Content' => 'Item 1',
                    },
                    ...
                ],
            ],
        },
    ],
    AddSettingContent => 0,          # (optional) if enabled, result will be inside of div with class "SettingContent"
    UserID            => 1,          # (required) UserID
);

Returns:

    %Result = (
        'Item' => '<div class=\'SettingContent\'>
<input type=\'text\' id=\'TestArray_Array4\'
        value=\'Default value\' name=\'TestArray\' class=\' Entry\'/></div>',
    );

    or

    %Result = (
        'Error' => 'Error description',
    );

PRIVATE INTERFACE#

_SettingRender()#

Recursive helper for SettingRender().

my $HTMLStr = $SysConfigObject->_SettingRender(
    Name             => 'Setting Name',
    Value            => $XMLParsedToPerlValue,  # (required)
    EffectiveValue   => "Product 6",            # (required) or a complex structure
    DefaultValue     => "Product 5",            # (optional) or a complex structure
    ValueType        => "String",               # (optional)
    IsAjax           => 1,                      # (optional) Default 0.
    # ...
    RW => 1,                                    # (optional) Allow editing. Default 0.
    IsArray => 1,                               # (optional) Item is part of the array
    IsHash  => 1,                               # (optional) Item is part of the hash
    Key     => 'Key',                           # (optional) Hash key (if available)
    SkipEffectiveValueCheck => 1,               # (optional) If enabled, system will not perform effective value check.
                                                #            Default: 1.
    UserID => 1,                                # (required) UserID
);

Returns:

$HTMLStr = '<div class "Field"...</div>'        # or false in case of an error