This commit is contained in:
2024-10-14 00:08:40 +02:00
parent dbfba56f66
commit 1462d52e13
4572 changed files with 2658864 additions and 0 deletions

View File

@@ -0,0 +1,124 @@
# --
# Copyright (C) 2001-2019 OTRS AG, https://otrs.com/
# --
# This software comes with ABSOLUTELY NO WARRANTY. For details, see
# the enclosed file COPYING for license information (GPL). If you
# did not receive this file, see https://www.gnu.org/licenses/gpl-3.0.txt.
# --
package Kernel::Output::HTML::ImportExport::LayoutCheckbox;
use strict;
use warnings;
our @ObjectDependencies = (
'Kernel::System::Log',
'Kernel::System::Web::Request',
);
=head1 NAME
Kernel::Output::HTML::ImportExport::LayoutCheckbox - layout backend module
=head1 DESCRIPTION
All layout functions for checkbox elements in import/export.
=cut
=head2 new()
Create an object
$BackendObject = Kernel::Output::HTML::ImportExport::LayoutCheckbox->new(
%Param,
);
=cut
sub new {
my ( $Type, %Param ) = @_;
# allocate new hash for object
my $Self = {};
bless( $Self, $Type );
return $Self;
}
=head2 FormInputCreate()
Create a input string
my $Value = $BackendObject->FormInputCreate(
Item => $ItemRef,
Prefix => 'Prefix::', # (optional)
Value => 'Value', # (optional)
);
=cut
sub FormInputCreate {
my ( $Self, %Param ) = @_;
# check needed stuff
if ( !$Param{Item} ) {
$Kernel::OM->Get('Kernel::System::Log')->Log(
Priority => 'error',
Message => 'Need Item!',
);
return;
}
$Param{Prefix} ||= '';
my $Checked = $Param{Value} ? 'checked="checked"' : '';
return
qq{<input id="$Param{Prefix}$Param{Item}->{Key}" type="checkbox" name="$Param{Prefix}$Param{Item}->{Key}" $Checked />};
}
=head2 FormDataGet()
Get form data
my $FormData = $BackendObject->FormDataGet(
Item => $ItemRef,
Prefix => 'Prefix::', # (optional)
);
=cut
sub FormDataGet {
my ( $Self, %Param ) = @_;
# check needed stuff
if ( !$Param{Item} ) {
$Kernel::OM->Get('Kernel::System::Log')->Log(
Priority => 'error',
Message => 'Need Item!',
);
return;
}
$Param{Prefix} ||= '';
# get form data
my $FormData = $Kernel::OM->Get('Kernel::System::Web::Request')->GetParam(
Param => $Param{Prefix} . $Param{Item}->{Key},
);
return $FormData;
}
1;
=head1 TERMS AND CONDITIONS
This software is part of the OTRS project (L<https://otrs.org/>).
This software comes with ABSOLUTELY NO WARRANTY. For details, see
the enclosed file COPYING for license information (GPL). If you
did not receive this file, see L<https://www.gnu.org/licenses/gpl-3.0.txt>.
=cut

View File

@@ -0,0 +1,152 @@
# --
# Copyright (C) 2001-2019 OTRS AG, https://otrs.com/
# --
# This software comes with ABSOLUTELY NO WARRANTY. For details, see
# the enclosed file COPYING for license information (GPL). If you
# did not receive this file, see https://www.gnu.org/licenses/gpl-3.0.txt.
# --
package Kernel::Output::HTML::ImportExport::LayoutSelection;
use strict;
use warnings;
our @ObjectDependencies = (
'Kernel::System::Log',
'Kernel::Output::HTML::Layout',
'Kernel::System::Web::Request',
);
=head1 NAME
Kernel::Output::HTML::ImportExport::LayoutSelection - layout backend module
=head1 DESCRIPTION
All layout functions for selection elements
=cut
=head2 new()
Create an object
$BackendObject = Kernel::Output::HTML::ImportExport::LayoutSelection->new(
%Param,
);
=cut
sub new {
my ( $Type, %Param ) = @_;
# allocate new hash for object
my $Self = {};
bless( $Self, $Type );
return $Self;
}
=head2 FormInputCreate()
Create a input string
my $Value = $BackendObject->FormInputCreate(
Item => $ItemRef,
Prefix => 'Prefix::', # (optional)
Value => 'Value', # (optional)
Class => 'Modernize' # (optional)
);
=cut
sub FormInputCreate {
my ( $Self, %Param ) = @_;
# check needed stuff
if ( !$Param{Item} ) {
$Kernel::OM->Get('Kernel::System::Log')->Log(
Priority => 'error',
Message => 'Need Item!'
);
return;
}
# set default value
$Param{Prefix} ||= '';
$Param{Value} ||= $Param{Item}->{Input}->{ValueDefault};
if ( $Param{Value} && $Param{Value} =~ m{ ##### }xms ) {
my @Values = split '#####', $Param{Value};
$Param{Value} = \@Values;
}
# generate option string
my $String = $Kernel::OM->Get('Kernel::Output::HTML::Layout')->BuildSelection(
ID => $Param{Prefix} . $Param{Item}->{Key},
Class => $Param{Class},
Name => $Param{Prefix} . $Param{Item}->{Key},
Data => $Param{Item}->{Input}->{Data} || {},
SelectedID => $Param{Value},
Translation => $Param{Item}->{Input}->{Translation},
TreeView => $Param{Item}->{Input}->{TreeView} || 0,
PossibleNone => $Param{Item}->{Input}->{PossibleNone},
Multiple => $Param{Item}->{Input}->{Multiple},
Size => $Param{Item}->{Input}->{Size},
);
return $String;
}
=head2 FormDataGet()
Get form data
my $FormData = $BackendObject->FormDataGet(
Item => $ItemRef,
Prefix => 'Prefix::', # (optional)
);
=cut
sub FormDataGet {
my ( $Self, %Param ) = @_;
# check needed stuff
if ( !$Param{Item} ) {
$Kernel::OM->Get('Kernel::System::Log')->Log(
Priority => 'error',
Message => 'Need Item!'
);
return;
}
$Param{Prefix} ||= '';
# get form data
my @FormDatas = $Kernel::OM->Get('Kernel::System::Web::Request')->GetArray(
Param => $Param{Prefix} . $Param{Item}->{Key},
);
my $FormData = join '#####', @FormDatas;
return $FormData if $FormData;
return $FormData if !$Param{Item}->{Input}->{Required};
# set invalid param
$Param{Item}->{Form}->{Invalid} = 1;
return $FormData;
}
1;
=head1 TERMS AND CONDITIONS
This software is part of the OTRS project (L<https://otrs.org/>).
This software comes with ABSOLUTELY NO WARRANTY. For details, see
the enclosed file COPYING for license information (GPL). If you
did not receive this file, see L<https://www.gnu.org/licenses/gpl-3.0.txt>.
=cut

View File

@@ -0,0 +1,97 @@
# --
# Copyright (C) 2001-2019 OTRS AG, https://otrs.com/
# --
# This software comes with ABSOLUTELY NO WARRANTY. For details, see
# the enclosed file COPYING for license information (GPL). If you
# did not receive this file, see https://www.gnu.org/licenses/gpl-3.0.txt.
# --
package Kernel::Output::HTML::ImportExport::LayoutTT;
use strict;
use warnings;
our @ObjectDependencies = (
'Kernel::System::Log',
);
=head1 NAME
Kernel::Output::HTML::ImportExport::LayoutTT - layout backend module
=head1 DESCRIPTION
All layout functions for display C<TT> code
=cut
=head2 new()
Create an object
$BackendObject = Kernel::Output::HTML::ImportExport::LayoutTT->new(
%Param,
);
=cut
sub new {
my ( $Type, %Param ) = @_;
# allocate new hash for object
my $Self = {};
bless( $Self, $Type );
return $Self;
}
=head2 FormInputCreate()
Create a input string
my $Value = $BackendObject->FormInputCreate(
Item => $ItemRef,
);
=cut
sub FormInputCreate {
my ( $Self, %Param ) = @_;
# check needed stuff
if ( !$Param{Item} ) {
$Kernel::OM->Get('Kernel::System::Log')->Log(
Priority => 'error',
Message => 'Need Item!'
);
return;
}
return $Param{Item}->{Input}->{Data};
}
=head2 FormDataGet()
Get form data
my $FormData = $BackendObject->FormDataGet();
=cut
sub FormDataGet {
my ( $Self, %Param ) = @_;
return;
}
1;
=head1 TERMS AND CONDITIONS
This software is part of the OTRS project (L<https://otrs.org/>).
This software comes with ABSOLUTELY NO WARRANTY. For details, see
the enclosed file COPYING for license information (GPL). If you
did not receive this file, see L<https://www.gnu.org/licenses/gpl-3.0.txt>.
=cut

View File

@@ -0,0 +1,190 @@
# --
# Copyright (C) 2001-2019 OTRS AG, https://otrs.com/
# --
# This software comes with ABSOLUTELY NO WARRANTY. For details, see
# the enclosed file COPYING for license information (GPL). If you
# did not receive this file, see https://www.gnu.org/licenses/gpl-3.0.txt.
# --
package Kernel::Output::HTML::ImportExport::LayoutText;
use strict;
use warnings;
our @ObjectDependencies = (
'Kernel::System::Log',
'Kernel::System::Web::Request',
'Kernel::Output::HTML::Layout',
);
=head1 NAME
Kernel::Output::HTML::ImportExport::LayoutText - layout backend module
=head1 DESCRIPTION
All layout functions for text elements
=cut
=head2 new()
Create an object
$BackendObject = Kernel::Output::HTML::ImportExport::LayoutText->new(
%Param,
);
=cut
sub new {
my ( $Type, %Param ) = @_;
# allocate new hash for object
my $Self = {};
bless( $Self, $Type );
return $Self;
}
=head2 FormInputCreate()
Create a input string
my $Value = $BackendObject->FormInputCreate(
Item => $ItemRef,
Prefix => 'Prefix::', # (optional)
Value => 'Value', # (optional)
Readonly => 1, # (optional)
);
=cut
sub FormInputCreate {
my ( $Self, %Param ) = @_;
# check needed stuff
if ( !$Param{Item} ) {
$Kernel::OM->Get('Kernel::System::Log')->Log(
Priority => 'error',
Message => 'Need Item!',
);
return;
}
$Param{Prefix} ||= '';
my $Value = $Param{Value} || $Param{Item}->{Input}->{ValueDefault};
my $Size = $Param{Item}->{Input}->{Size} || 40;
my $SizeClass;
if ( $Size < 15 ) {
$SizeClass = 'W10pc';
}
elsif ( $Size < 35 ) {
$SizeClass = 'W33pc';
}
elsif ( $Size < 50 ) {
$SizeClass = 'W50pc';
}
else {
$SizeClass = 'W75pc';
}
# prepare data
my $ID = ( $Param{Prefix} || '' ) . ( $Param{Item}->{Key} );
my $Name = ( $Param{Prefix} || '' ) . ( $Param{Name} || $ID );
my $Class = ( $SizeClass || '' ) . ( $Param{Class} || '' );
my $String = "<input id=\"$ID\" type=\"text\" name=\"$Name\" class=\"$Class\" ";
if ($Value) {
# get layout object
my $LayoutObject = $Kernel::OM->Get('Kernel::Output::HTML::Layout');
# translate
if ( $Param{Item}->{Input}->{Translation} ) {
$Value = $LayoutObject->{LanguageObject}->Translate($Value);
}
# transform ascii to html
$Value = $LayoutObject->Ascii2Html(
Text => $Value,
HTMLResultMode => 1,
);
$String .= "value=\"$Value\" ";
}
# add maximum length
if ( $Param{Item}->{Input}->{MaxLength} ) {
$String .= "maxlength=\"$Param{Item}->{Input}->{MaxLength}\" ";
}
# add readonly
if ( $Param{Item}->{Input}->{Readonly} ) {
$String .= 'readonly="readonly" ';
}
$String .= "/> ";
return $String;
}
=head2 FormDataGet()
Get form data
my $FormData = $BackendObject->FormDataGet(
Item => $ItemRef,
Prefix => 'Prefix::', # (optional)
);
=cut
sub FormDataGet {
my ( $Self, %Param ) = @_;
# check needed stuff
if ( !$Param{Item} ) {
$Kernel::OM->Get('Kernel::System::Log')->Log(
Priority => 'error',
Message => 'Need Item!'
);
return;
}
$Param{Prefix} ||= '';
# get form data
my $FormData = $Kernel::OM->Get('Kernel::System::Web::Request')->GetParam(
Param => $Param{Prefix} . $Param{Item}->{Key},
);
# regex check
if ( $Param{Item}->{Input}->{Regex} && $FormData !~ $Param{Item}->{Input}->{Regex} ) {
$Param{Item}->{Form}->{Invalid} = 1;
return $FormData;
}
return $FormData if $FormData;
return $FormData if !$Param{Item}->{Input}->{Required};
# set invalid param
$Param{Item}->{Form}->{Invalid} = 1;
return $FormData;
}
1;
=head1 TERMS AND CONDITIONS
This software is part of the OTRS project (L<https://otrs.org/>).
This software comes with ABSOLUTELY NO WARRANTY. For details, see
the enclosed file COPYING for license information (GPL). If you
did not receive this file, see L<https://www.gnu.org/licenses/gpl-3.0.txt>.
=cut