Initial commit

This commit is contained in:
Manuel Cillero 2020-04-10 12:48:19 +02:00
commit f4bfb0e367
71 changed files with 10399 additions and 0 deletions

View file

@ -0,0 +1,127 @@
=head1 NAME
App::api::controls::Control_Check
=head1 SYNOPSIS
my $check = Component__Get(CONTROL_CHECK, ['check']);
=head1 DESCRIPTION
Control para marcar/desmarcar una opción.
=head1 ARGUMENTS
(
TYPE => 'Check',
ID => 'check' (default),
INFO => 1 (show info in header; default) or 0 (don't show),
LABEL => 'Check' (default),
LABEL_INFO => Same as LABEL (default),
DEFAULT => 0 (unchecked; default) or 1 (checked)
)
=cut
use strict;
use warnings;
use utf8;
package Dam::Components::Controls::Check;
use Exporter qw(import);
our @EXPORT = qw(
Control__html Control__js Get
);
use Dam::Util;
use Dam::DamLogic;
my $ID_DEFAULT = 'check';
sub __arguments {
my $arg_ref = shift;
$$arg_ref{LABEL} = 'Check' if is_empty($$arg_ref{LABEL});
$$arg_ref{LABEL_INFO} = $$arg_ref{LABEL} if is_empty($$arg_ref{LABEL_INFO});
check_arguments($arg_ref,
TYPE => [ ARG_REQUIRED ],
ID => [ ARG_DEFAULT, $ID_DEFAULT ],
INFO => [ ARG_DEFAULT, 1, 0 ],
LABEL => [ ARG_REQUIRED ],
LABEL_INFO => [ ARG_REQUIRED ],
DEFAULT => [ ARG_DEFAULT, 0, 1 ]
);
}
sub Control__html {
my ($self, $arg_ref, $info_ref) = @_;
__arguments($arg_ref);
my $check_value = !is_report() ? $$arg_ref{DEFAULT} : is_empty(cgiapp_param($$arg_ref{ID})) ? 0 : 1;
push(@{$info_ref}, { DATA => _t('Option'), VALUE => $$arg_ref{LABEL_INFO} }) if $$arg_ref{INFO} && $check_value;
return strval('
<div class="form-group form-group-', $ID_DEFAULT, ' input-lg">
<label for="', $$arg_ref{ID}, '"><input type="checkbox" id="', $$arg_ref{ID}, '" name="', $$arg_ref{ID}, '" value="check"', $check_value ? ' checked ' : ' ', '/>&nbsp;&nbsp;', $$arg_ref{LABEL}, '</label>
</div>
');
}
sub Control__js {
}
sub Get {
my ($self, $id) = @_;
$id = $ID_DEFAULT if is_empty($id);
return is_empty(cgiapp_param($id)) ? 0 : 1;
}
1;
=head1 AUTHOR
Manuel Cillero C<< <manuel@cillero.es> >>
=head1 COPYRIGHT
The MIT License (MIT)
Copyright (c) 2004-2020 Manuel Cillero. All rights reserved.
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
=cut

View file

@ -0,0 +1,158 @@
=head1 NAME
Dam::Components::Controls::Date
=head1 SYNOPSIS
my $date = Component__Get(CONTROL_DATE, ['date']);
=head1 DESCRIPTION
Control para seleccionar una fecha.
=head1 ARGUMENTS
(
TYPE => 'Date',
ID => 'date' (default),
INFO => 1 (show info in header; default) or 0 (don't show),
LABEL => 'Date' (default),
LABEL_INFO => Same as LABEL (default),
REQUIRED => 1 (control required; default) or 0 (not required)
)
=cut
use strict;
use warnings;
use utf8;
package Dam::Components::Controls::Date;
use Exporter qw(import);
our @EXPORT = qw(
Control__html Control__js Get
);
use Date::Calc qw(Today Add_Delta_Days);
use Dam::Util;
use Dam::DamLogic;
my $ID_DEFAULT = 'date';
sub __arguments {
my $arg_ref = shift;
$$arg_ref{LABEL} = _t('Date') if is_empty($$arg_ref{LABEL});
$$arg_ref{LABEL_INFO} = $$arg_ref{LABEL} if is_empty($$arg_ref{LABEL_INFO});
check_arguments($arg_ref,
TYPE => [ ARG_REQUIRED ],
ID => [ ARG_DEFAULT, $ID_DEFAULT ],
INFO => [ ARG_DEFAULT, 1, 0 ],
LABEL => [ ARG_REQUIRED ],
LABEL_INFO => [ ARG_REQUIRED ],
REQUIRED => [ ARG_DEFAULT, 1, 0 ]
);
}
sub Control__html {
my ($self, $arg_ref, $info_ref) = @_;
__arguments($arg_ref);
my $date_value = cgiapp_param($$arg_ref{ID});
if (!is_report()) {
my @previous = Add_Delta_Days(Today(), -1);
$date_value = strval(sprintf("%02d", $previous[2]), '/', sprintf("%02d", $previous[1]), '/', $previous[0]);
}
push(@{$info_ref}, { DATA => $$arg_ref{LABEL_INFO}, VALUE => $date_value }) if $$arg_ref{INFO};
# Required stylesheets:
Component__Header(ADD => 'CSS', RESOURCE => PACK_DATEPICKER);
return strval('
<div class="form-group form-group-', $ID_DEFAULT, '">
<label for="', $$arg_ref{ID}, $$arg_ref{REQUIRED} ? '" class="required">' : '">', $$arg_ref{LABEL}, '</label>
<input type="text" class="form-control input-lg input-date-date" data-provide="datepicker" id="', $$arg_ref{ID}, '" name="', $$arg_ref{ID}, '" value="', $date_value, '" autocomplete="off" size=4', $$arg_ref{REQUIRED} ? ' required="required"' : '', ' />
</div>
');
}
sub Control__js {
my ($self, $arg_ref) = @_;
__arguments($arg_ref);
# Required javascripts:
Component__Header(ADD => 'JS', RESOURCE => PACK_DATEPICKER);
return strval('
$(function(){
$("#', $$arg_ref{ID}, '").datepicker({
language: "', _t('LANGUAGE_CODE'), '",
autoclose: true,
todayHighlight: true,
disableTouchKeyboard: true,
endDate: "0d"
});
});
');
}
sub Get {
my ($self, $id) = @_;
$id = $ID_DEFAULT if is_empty($id);
my @date_value = split('/', cgiapp_param($id));
my $date_value = "$date_value[2]-$date_value[1]-$date_value[0]";
return $date_value;
}
1;
=head1 AUTHOR
Manuel Cillero C<< <manuel@cillero.es> >>
=head1 COPYRIGHT
The MIT License (MIT)
Copyright (c) 2004-2020 Manuel Cillero. All rights reserved.
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
=cut

View file

@ -0,0 +1,221 @@
=head1 NAME
Dam::Components::Controls::DateRange
=head1 SYNOPSIS
my ($ini, $end) = Component__Get(CONTROL_DATERANGE, ['range']);
=head1 DESCRIPTION
Control para obtener un rango de fechas.
=head1 ARGUMENTS
(
TYPE => 'DateRange',
ID => 'range' (default),
INFO => 1 (show info in header; default) or 0 (don't show),
LABEL => 'Date range' (default),
LABEL_INFO => Same as LABEL (default),
REQUIRED => 1 (control required; default) or 0 (not required)
MAXDAYS => 1095 (default) or maximum number of days for range
)
=cut
use strict;
use warnings;
use utf8;
package Dam::Components::Controls::DateRange;
use Exporter qw(import);
our @EXPORT = qw(
Control__html Control__js Get
);
use Date::Calc qw(Today Add_Delta_YM Days_in_Month);
use Dam::Util;
use Dam::DamLogic;
use Dam::Var;
my $ID_DEFAULT = 'range';
sub __arguments {
my $arg_ref = shift;
$$arg_ref{LABEL} = _t('Date range') if is_empty($$arg_ref{LABEL});
$$arg_ref{LABEL_INFO} = $$arg_ref{LABEL} if is_empty($$arg_ref{LABEL_INFO});
check_arguments($arg_ref,
TYPE => [ ARG_REQUIRED ],
ID => [ ARG_DEFAULT, $ID_DEFAULT ],
INFO => [ ARG_DEFAULT, 1, 0 ],
LABEL => [ ARG_REQUIRED ],
LABEL_INFO => [ ARG_REQUIRED ],
REQUIRED => [ ARG_DEFAULT, 1, 0 ],
MAXDAYS => [ ARG_DEFAULT, 1095 ]
);
}
sub Control__html {
my ($self, $arg_ref, $info_ref) = @_;
__arguments($arg_ref);
my $ini_value = cgiapp_param($$arg_ref{ID});
my $end_value = cgiapp_param(strval($$arg_ref{ID}, '_end'));
if (!is_report()) {
my @previous = Add_Delta_YM(Today(), 0, -1);
$ini_value = strval('01/', sprintf("%02d", $previous[1]), '/', $previous[0]);
$end_value = strval(Days_in_Month($previous[0], $previous[1]), '/', sprintf("%02d", $previous[1]), '/', $previous[0]);
}
my @ini = split(/\//, $ini_value);
my @end = split(/\//, $end_value);
my $range = strval($ini_value, ' al ', $end_value);
if (($ini[0] == 1) && ($ini[2] == $end[2])) {
if (($end[0] == Days_in_Month($ini[2],$ini[1])) && ($ini[1] == $end[1])) {
$range = strval($range, ' (', uc(_t('MONTHS', $ini[1])), ' ', $ini[2], ')');
}
elsif (($ini[1] == 1) && ($end[0] == 31) && ($end[1] == 12)) {
$range = strval($range, ' (', _t('YEAR'), ' ', $ini[2], ')');
}
elsif (($ini[1] == 1) && ($end[0] == 30) && ($end[1] == 6)) {
$range = strval($range, ' (', _t('FIRST SEMESTER'), ' ', $ini[2], ')');
}
elsif (($ini[1] == 7) && ($end[0] == 31) && ($end[1] == 12)) {
$range = strval($range, ' (', _t('SECOND SEMESTER'), ' ', $ini[2], ')');
}
elsif (($ini[1] == 1) && ($end[0] == 30) && ($end[1] == 4)) {
$range = strval($range, ' (', _t('FIRST QUARTER'), ' ', $ini[2], ')');
}
elsif (($ini[1] == 5) && ($end[0] == 31) && ($end[1] == 8)) {
$range = strval($range, ' (', _t('SECOND QUARTER'), ' ', $ini[2], ')');
}
elsif (($ini[1] == 9) && ($end[0] == 31) && ($end[1] == 12)) {
$range = strval($range, ' (', _t('THIRD QUARTER'), ' ', $ini[2], ')');
}
elsif (($ini[1] == 1) && ($end[0] == 31) && ($end[1] == 3)) {
$range = strval($range, ' (', _t('FIRST TRIMESTER'), ' ', $ini[2], ')');
}
elsif (($ini[1] == 4) && ($end[0] == 30) && ($end[1] == 6)) {
$range = strval($range, ' (', _t('SECOND TRIMESTER'), ' ', $ini[2], ')');
}
elsif (($ini[1] == 7) && ($end[0] == 30) && ($end[1] == 9)) {
$range = strval($range, ' (', _t('THIRD TRIMESTER'), ' ', $ini[2], ')');
}
elsif (($ini[1] == 10) && ($end[0] == 31) && ($end[1] == 12)) {
$range = strval($range, ' (', _t('FOURTH TRIMESTER'), ' ', $ini[2], ')');
}
}
push(@{$info_ref}, { DATA => $$arg_ref{LABEL_INFO}, VALUE => $range }) if $$arg_ref{INFO};
# Required stylesheets:
Component__Header(ADD => 'CSS', RESOURCE => PACK_DATEPICKER);
return strval('
<div class="form-group form-group-', $ID_DEFAULT, '">
<label for="', $$arg_ref{ID}, $$arg_ref{REQUIRED} ? '" class="required">' : '">', $$arg_ref{LABEL}, '</label>
<div class="input-group input-daterange" data-provide="datepicker">
<input type="text" class="form-control input-lg" id="', $$arg_ref{ID}, '" name="', $$arg_ref{ID}, '" value="', $ini_value, '" autocomplete="off" size=10', $$arg_ref{REQUIRED} ? ' required="required"' : '', ' />
<span class="input-group-addon">al</span>
<input type="text" class="form-control input-lg" id="', $$arg_ref{ID}, '_end" name="', $$arg_ref{ID}, '_end" value="', $end_value, '" autocomplete="off" size=10', $$arg_ref{REQUIRED} ? ' required="required"' : '', ' />
</div>
</div>
');
}
sub Control__js {
my ($self, $arg_ref) = @_;
__arguments($arg_ref);
# Required javascripts:
Component__Header(ADD => 'JS', RESOURCE => PACK_DATEPICKER);
return strval('
$(function(){
$(".input-group.input-daterange").datepicker({
language: "', _t('LANGUAGE_CODE'), '",
autoclose: true,
todayHighlight: true,
disableTouchKeyboard: true,
// endDate: "0d",
startDate: "01/01/1900" // https://github.com/uxsolutions/bootstrap-datepicker/issues/721#issuecomment-86275874 (workaround)
});
$("#filter").on("submit", function(e) {
if ($("#filter").valid()) {
var range = ', $$arg_ref{MAXDAYS}, ';
if (Math.round(($("#', $$arg_ref{ID}, '_end").datepicker("getDate") - $("#', $$arg_ref{ID}, '").datepicker("getDate")) / (1000 * 60 * 60 * 24)) > range) {
$("#nv").val(1);
$("#filter-message").text("', _t('Date ranges greater than <--max--> are not allowed.', max => $$arg_ref{MAXDAYS} % 365 ? strval($$arg_ref{MAXDAYS}, ' ', _t('day(s)')) : strval($$arg_ref{MAXDAYS} / 365, ' ', _t('year(s)'))), '");
$("#filter-error").modal();
e.preventDefault();
return false;
}
}
});
});
');
}
sub Get {
my ($self, $id) = @_;
$id = $ID_DEFAULT if is_empty($id);
my @ini_value = split('/', cgiapp_param($id));
my $ini_value = "$ini_value[2]-$ini_value[1]-$ini_value[0]";
my @end_value = split('/', cgiapp_param(strval($id, '_end')));
my $end_value = "$end_value[2]-$end_value[1]-$end_value[0]";
return ($ini_value, $end_value);
}
1;
=head1 AUTHOR
Manuel Cillero C<< <manuel@cillero.es> >>
=head1 COPYRIGHT
The MIT License (MIT)
Copyright (c) 2004-2020 Manuel Cillero. All rights reserved.
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
=cut

View file

@ -0,0 +1,153 @@
=head1 NAME
Dam::Components::Controls::Input
=head1 SYNOPSIS
my $input = Component__Get(CONTROL_INPUT, ['input']);
=head1 DESCRIPTION
Control para introducir un texto.
=head1 ARGUMENTS
(
TYPE => 'Input',
ID => 'input' (default),
INFO => 1 (show info in header; default) or 0 (don't show),
LABEL => 'Enter text' (default),
LABEL_INFO => 'Input text' (default),
REQUIRED => 1 (control required; default) or 0 (not required)
ONLY => 'All' (allows any alphanumeric character; default) ó 'Digits'
(allow only numbers)
)
=cut
use strict;
use warnings;
use utf8;
package Dam::Components::Controls::Input;
use Exporter qw(import);
our @EXPORT = qw(
Control__html Control__js Get
);
use Dam::Util;
use Dam::DamLogic;
my $ID_DEFAULT = 'input';
sub __arguments {
my $arg_ref = shift;
check_arguments($arg_ref,
TYPE => [ ARG_REQUIRED ],
ID => [ ARG_DEFAULT, $ID_DEFAULT ],
INFO => [ ARG_DEFAULT, 1, 0 ],
LABEL => [ ARG_DEFAULT, _t('Enter text') ],
LABEL_INFO => [ ARG_DEFAULT, _t('Input text') ],
REQUIRED => [ ARG_DEFAULT, 1, 0 ],
ONLY => [ ARG_DEFAULT, 'All', 'Digits' ]
);
}
sub Control__html {
my ($self, $arg_ref, $info_ref) = @_;
__arguments($arg_ref);
my $input_value = cgiapp_param($$arg_ref{ID});
push(@{$info_ref}, { DATA => $$arg_ref{LABEL_INFO}, VALUE => $input_value }) if !is_empty($input_value);
return strval('
<div class="form-group form-group-', $ID_DEFAULT, '">
<label for="', $$arg_ref{ID}, $$arg_ref{REQUIRED} ? '" class="required">' : '">', $$arg_ref{LABEL}, '</label>
<div class="form-div form-control-', $ID_DEFAULT, '">
<input type="input" class="form-control input-lg" id="', $$arg_ref{ID}, '" name="', $$arg_ref{ID}, '"', !is_empty($input_value) ? strval(' value = "', $input_value, '"') : '', $$arg_ref{REQUIRED} ? ' required="required"' : '', ' />
</div>
</div>
');
}
sub Control__js {
my ($self, $arg_ref) = @_;
__arguments($arg_ref);
return is_eq($$arg_ref{ONLY}, 'Digits') ? strval('
$(function(){
$.fn.inputFilter = function(inputFilter) {
return this.on("input keydown keyup mousedown mouseup select contextmenu drop", function() {
if (inputFilter(this.value)) {
this.oldValue = this.value;
this.oldSelectionStart = this.selectionStart;
this.oldSelectionEnd = this.selectionEnd;
} else if (this.hasOwnProperty("oldValue")) {
this.value = this.oldValue;
this.setSelectionRange(this.oldSelectionStart, this.oldSelectionEnd);
}
});
};
$("#', $$arg_ref{ID}, '").inputFilter(function(value) {
return /^\d*$/.test(value);
});
});
') : '';
}
sub Get {
my ($self, $id) = @_;
$id = $ID_DEFAULT if is_empty($id);
return cgiapp_param($id);
}
1;
=head1 AUTHOR
Manuel Cillero C<< <manuel@cillero.es> >>
=head1 COPYRIGHT
The MIT License (MIT)
Copyright (c) 2004-2020 Manuel Cillero. All rights reserved.
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
=cut

View file

@ -0,0 +1,177 @@
=head1 NAME
Dam::Components::Controls::Month
=head1 SYNOPSIS
my ($year, $month) = Component__Get(CONTROL_MONTH, ['month']);
=head1 DESCRIPTION
Control para seleccionar un mes del año.
=head1 ARGUMENTS
(
TYPE => 'Month',
ID => 'month' (default),
INFO => 1 (show info in header; default) or 0 (don't show),
LABEL => 'Month' (default),
LABEL_INFO => Same as LABEL (default),
REQUIRED => 1 (control required; default) or 0 (not required)
)
=cut
use strict;
use warnings;
use utf8;
package Dam::Components::Controls::Month;
use Exporter qw(import);
our @EXPORT = qw(
Control__html Control__js Get
);
use Date::Calc qw(Today);
use Dam::Util;
use Dam::DamLogic;
use Dam::Var;
my $ID_DEFAULT = 'month';
sub __arguments {
my $arg_ref = shift;
$$arg_ref{LABEL} = _t('Month') if is_empty($$arg_ref{LABEL});
$$arg_ref{LABEL_INFO} = $$arg_ref{LABEL} if is_empty($$arg_ref{LABEL_INFO});
check_arguments($arg_ref,
TYPE => [ ARG_REQUIRED ],
ID => [ ARG_DEFAULT, $ID_DEFAULT ],
INFO => [ ARG_DEFAULT, 1, 0 ],
LABEL => [ ARG_REQUIRED ],
LABEL_INFO => [ ARG_REQUIRED ],
REQUIRED => [ ARG_DEFAULT, 1, 0 ]
);
}
sub Control__html {
my ($self, $arg_ref, $info_ref) = @_;
__arguments($arg_ref);
my $value = cgiapp_param($$arg_ref{ID});
my @today = Today();
my ($month_name, $month_value, $year_value) = ('', $today[1], $today[0]);
if (!is_report() || is_empty($value)) {
if ($month_value == 1) {
$month_value = 12;
$year_value--;
}
else {
$month_value--;
}
$month_name = _t('MONTHS', $month_value);
}
else {
($month_name, $year_value) = split(/ /, $value);
$month_value = _t('MONTHS', $month_name);
}
push(@{$info_ref}, { DATA => $$arg_ref{LABEL_INFO}, VALUE => "$month_name $year_value" }) if $$arg_ref{INFO};
# Required stylesheets:
Component__Header(ADD => 'CSS', RESOURCE => PACK_DATEPICKER);
return strval('
<div class="form-group form-group-', $ID_DEFAULT, '">
<label for="', $$arg_ref{ID}, $$arg_ref{REQUIRED} ? '" class="required">' : '">', $$arg_ref{LABEL}, '</label>
<input type="text" class="form-control input-lg input-date-month" data-provide="datepicker" id="', $$arg_ref{ID}, '" name="', $$arg_ref{ID}, '" value="', $month_name, ' ', $year_value, '" autocomplete="off" size=4', $$arg_ref{REQUIRED} ? ' required="required"' : '', ' />
</div>
');
}
sub Control__js {
my ($self, $arg_ref) = @_;
__arguments($arg_ref);
my @today = Today();
# Required javascripts:
Component__Header(ADD => 'JS', RESOURCE => PACK_DATEPICKER);
return strval('
$(function(){
$("#', $$arg_ref{ID}, '").datepicker({
language: "', _t('LANGUAGE_CODE'), '",
autoclose: true,
todayHighlight: true,
disableTouchKeyboard: true,
minViewMode: "months",
format: "MM yyyy",
endDate: "', $today[1] - 1, '-', $today[0], '"
});
});
');
}
sub Get {
my ($self, $id) = @_;
$id = $ID_DEFAULT if is_empty($id);
my $value = cgiapp_param($id);
return (undef, undef) if is_empty($value);
my ($month_name, $year_value) = split(/ /, $value);
my $month_value = _t('MONTHS', $month_name);
return ($year_value, $month_value);
}
1;
=head1 AUTHOR
Manuel Cillero C<< <manuel@cillero.es> >>
=head1 COPYRIGHT
The MIT License (MIT)
Copyright (c) 2004-2020 Manuel Cillero. All rights reserved.
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
=cut

View file

@ -0,0 +1,161 @@
=head1 NAME
Dam::Components::Controls::MultiCheck
=head1 SYNOPSIS
my ($check_1, $check_2, ...) = Component__Get(CONTROL_MULTICHECK, ['multicheck']);
=head1 DESCRIPTION
Control para seleccionar una o más opciones de una lista.
=head1 ARGUMENTS
(
TYPE => 'MultiCheck',
ID => 'multicheck' (default),
INFO => 1 (show info in header; default) or 0 (don't show),
LABEL => 'MultiCheck' (default),
LABEL_INFO => Same as LABEL (default),
REQUIRED => 1 (control required; default) or 0 (not required)
MULTIPLE => 1 (allows to select any number of options; default) or 0 (allows
to select only one option),
OPTIONS => { 'op1' => 'Option 1', 'op2' => 'Option 2' } (default); you can
use { ..., 'opN' => _DIVIDER_, ... } to include separators
between the options according to order,
DEFAULT => Default option(s), e.g. "'op1'" or "'op1','op3'"
)
=cut
use strict;
use warnings;
use utf8;
package Dam::Components::Controls::MultiCheck;
use Exporter qw(import);
our @EXPORT = qw(
Control__html Control__js Get
);
use Dam::Util;
use Dam::DamLogic;
my $ID_DEFAULT = 'multicheck';
sub __arguments {
my $arg_ref = shift;
$$arg_ref{LABEL} = 'MultiCheck' if is_empty($$arg_ref{LABEL});
$$arg_ref{LABEL_INFO} = $$arg_ref{LABEL} if is_empty($$arg_ref{LABEL_INFO});
check_arguments($arg_ref,
TYPE => [ ARG_REQUIRED ],
ID => [ ARG_DEFAULT, $ID_DEFAULT ],
INFO => [ ARG_DEFAULT, 1, 0 ],
LABEL => [ ARG_REQUIRED ],
LABEL_INFO => [ ARG_REQUIRED ],
REQUIRED => [ ARG_DEFAULT, 1, 0 ],
MULTIPLE => [ ARG_DEFAULT, 1, 0 ],
OPTIONS => [ ARG_DEFAULT, { 'op1' => strval(_t('Option'), ' 1'), 'op2' => strval(_t('Option'), ' 2') } ],
DEFAULT => [ ARG_OPTIONAL ]
);
}
sub Control__html {
my ($self, $arg_ref, $info_ref) = @_;
__arguments($arg_ref);
my $multicheck_value = !is_report() && !is_empty($$arg_ref{DEFAULT}) ? $$arg_ref{DEFAULT} : strval_join(',', cgiapp_param($$arg_ref{ID}));
my $form_group = 'form-group';
my $list_opts = '';
my $info_opts = '';
my $count_opts = 0;
for my $key (sort keys(%{$$arg_ref{OPTIONS}})) {
if (is_eq(${$$arg_ref{OPTIONS}}{$key}, _DIVIDER_)) {
$list_opts .= '<option data-divider="true"></option>';
}
else {
my $checked = defined($multicheck_value) && index($multicheck_value, $key) >= 0;
my $selected = $checked ? '" selected="selected">' : '">';
$list_opts .= strval('<option value="\'', $key, '\'" title="', ${$$arg_ref{OPTIONS}}{$key}, $selected, ${$$arg_ref{OPTIONS}}{$key}, '</option>');
$form_group .= ' form-group-smaller' if $count_opts++ == 14;
$info_opts .= ' ' if $checked && !is_empty($info_opts);
$info_opts .= strval(${$$arg_ref{OPTIONS}}{$key}, ',') if $checked;
}
}
chop($info_opts) if !is_empty($info_opts);
push(@{$info_ref}, { DATA => $$arg_ref{LABEL_INFO}, VALUE => $info_opts }) if $$arg_ref{INFO} && length($info_opts);
# Required stylesheets:
Component__Header(ADD => 'CSS', RESOURCE => PACK_SELECT);
return strval('
<div class="', $form_group, ' form-group-', $ID_DEFAULT, ' form-selectpicker">
<label for="', $$arg_ref{ID}, $$arg_ref{REQUIRED} ? '" class="required">' : '">', $$arg_ref{LABEL}, '</label>
<select class="form-control input-lg selectpicker" id="', $$arg_ref{ID}, '" name="', $$arg_ref{ID}, '" multiple="multiple"', !$$arg_ref{MULTIPLE} ? ' data-max-options="1"' : '', ' data-selected-text-format="count > 2"', $$arg_ref{REQUIRED} ? ' required="required">' : '>', $list_opts, '</select>
</div>
');
}
sub Control__js {
# Required javascripts:
Component__Header(ADD => 'JS', RESOURCE => PACK_SELECT);
}
sub Get {
my ($self, $id) = @_;
$id = $ID_DEFAULT if is_empty($id);
return strval_join(',', cgiapp_param($id));
}
1;
=head1 AUTHOR
Manuel Cillero C<< <manuel@cillero.es> >>
=head1 COPYRIGHT
The MIT License (MIT)
Copyright (c) 2004-2020 Manuel Cillero. All rights reserved.
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
=cut

View file

@ -0,0 +1,138 @@
=head1 NAME
Dam::Components::Controls::Option
=head1 SYNOPSIS
my $option = Component__Get(CONTROL_OPTION, ['option']);
=head1 DESCRIPTION
Control para seleccionar una opción de una lista sencilla.
=head1 ARGUMENTS
(
TYPE => 'Option',
ID => 'opt' (default),
INFO => 1 (show info in header; default) or 0 (don't show),
LABEL => 'Options' (default),
LABEL_INFO => Same as LABEL (default),
REQUIRED => 1 (control required; default) or 0 (not required)
OPTIONS => { 'op1' => 'Option 1', 'op2' => 'Option 2' } (default)
)
=cut
use strict;
use warnings;
use utf8;
package Dam::Components::Controls::Option;
use Exporter qw(import);
our @EXPORT = qw(
Control__html Control__js Get
);
use Dam::Util;
use Dam::DamLogic;
my $ID_DEFAULT = 'option';
sub __arguments {
my $arg_ref = shift;
$$arg_ref{LABEL} = _t('Options') if is_empty($$arg_ref{LABEL});
$$arg_ref{LABEL_INFO} = $$arg_ref{LABEL} if is_empty($$arg_ref{LABEL_INFO});
check_arguments($arg_ref,
TYPE => [ ARG_REQUIRED ],
ID => [ ARG_DEFAULT, $ID_DEFAULT ],
INFO => [ ARG_DEFAULT, 1, 0 ],
LABEL => [ ARG_REQUIRED ],
LABEL_INFO => [ ARG_REQUIRED ],
REQUIRED => [ ARG_DEFAULT, 1, 0 ],
OPTIONS => [ ARG_DEFAULT, { 'op1' => strval(_t('Option'), ' 1'), 'op2' => strval(_t('Option'), ' 2') } ]
);
}
sub Control__html {
my ($self, $arg_ref, $info_ref) = @_;
__arguments($arg_ref);
my $opt_value = cgiapp_param($$arg_ref{ID});
my $list_opts = $$arg_ref{REQUIRED} ? '' : strval('<option value="" title=""></option>');
for my $key (sort keys(%{$$arg_ref{OPTIONS}})) {
my $selected = '">';
if (is_eq($opt_value, $key)) {
$selected = '" selected="selected">';
push(@{$info_ref}, { DATA => $$arg_ref{LABEL_INFO}, VALUE => ${$$arg_ref{OPTIONS}}{$key} }) if $$arg_ref{INFO};
}
$list_opts .= strval('<option value="', $key, '" title="', ${$$arg_ref{OPTIONS}}{$key}, $selected, ${$$arg_ref{OPTIONS}}{$key}, '</option>');
}
return strval('
<div class="form-group form-group-', $ID_DEFAULT, '">
<label for="', $$arg_ref{ID}, $$arg_ref{REQUIRED} ? '" class="required">' : '">', $$arg_ref{LABEL}, '</label>
<select class="form-control input-lg" id="', $$arg_ref{ID}, '" name="', $$arg_ref{ID}, '"', $$arg_ref{REQUIRED} ? ' required="required">' : '>', $list_opts, '</select>
</div>
');
}
sub Control__js {
}
sub Get {
my ($self, $id) = @_;
$id = $ID_DEFAULT if is_empty($id);
return cgiapp_param($id);
}
1;
=head1 AUTHOR
Manuel Cillero C<< <manuel@cillero.es> >>
=head1 COPYRIGHT
The MIT License (MIT)
Copyright (c) 2004-2020 Manuel Cillero. All rights reserved.
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
=cut

View file

@ -0,0 +1,184 @@
=head1 NAME
Dam::Components::Controls::Upload
=head1 SYNOPSIS
my ($filehandle, $filename, $filetype) = Component__Get(CONTROL_UPLOAD, ['upload']);
=head1 DESCRIPTION
Control para subir un archivo al servidor.
=head1 ARGUMENTS
(
TYPE => 'Upload',
ID => 'upload' (default),
INFO => 1 (show info in header; default) or 0 (don't show),
LABEL => 'Upload file' (default),
LABEL_INFO => 'File' (default),
REQUIRED => 1 (control required; default) or 0 (not required)
)
=cut
use strict;
use warnings;
use utf8;
package Dam::Components::Controls::Upload;
use Exporter qw(import);
our @EXPORT = qw(
Control__html Control__js Get
);
use File::Copy qw(copy);
use Dam::Util;
use Dam::Debug;
use Dam::DamLogic;
use Dam::Var;
my $ID_DEFAULT = 'upload';
sub __arguments {
my $arg_ref = shift;
check_arguments($arg_ref,
TYPE => [ ARG_REQUIRED ],
ID => [ ARG_DEFAULT, $ID_DEFAULT ],
INFO => [ ARG_DEFAULT, 1, 0 ],
LABEL => [ ARG_DEFAULT, _t('Upload file') ],
LABEL_INFO => [ ARG_DEFAULT, _t('File') ],
REQUIRED => [ ARG_DEFAULT, 1, 0 ]
);
}
sub Control__html {
my ($self, $arg_ref, $info_ref) = @_;
__arguments($arg_ref);
# Previous file info:
my $filename = cgiapp_param(strval($$arg_ref{ID}, '_name')) || '';
my $filesafe = cgiapp_param(strval($$arg_ref{ID}, '_safe')) || '';
my $filetype = cgiapp_param(strval($$arg_ref{ID}, '_type')) || '';
if (!is_empty($filename)) {
report_info(_t('If no other file is selected, then <--file--> previously uploaded will be used.', file => strval('<strong>', $filename, '</strong>')));
}
push(@{$info_ref}, { DATA => $$arg_ref{LABEL_INFO}, VALUE => $filename }) if $$arg_ref{INFO} && !is_empty($filename);
return strval('
<div class="form-group form-group-', $ID_DEFAULT, '">
<label for="', $$arg_ref{ID}, $$arg_ref{REQUIRED} ? '" class="required">' : '">', $$arg_ref{LABEL}, '</label>
<div class="form-div form-control-', $ID_DEFAULT, '">
<input type="file" class="form-control input-lg" id="', $$arg_ref{ID}, '" name="', $$arg_ref{ID}, '"', $$arg_ref{REQUIRED} ? ' required="required"' : '', ' />
<input type="hidden" id="', $$arg_ref{ID}, '_name" name="', $$arg_ref{ID}, '_name" value="', $filename, '" />
<input type="hidden" id="', $$arg_ref{ID}, '_safe" name="', $$arg_ref{ID}, '_safe" value="', $filesafe, '" />
<input type="hidden" id="', $$arg_ref{ID}, '_type" name="', $$arg_ref{ID}, '_type" value="', $filetype, '" />
</div>
</div>
');
}
sub Control__js {
my ($self, $arg_ref) = @_;
__arguments($arg_ref);
return strval('
$(function(){
if ($("#', $$arg_ref{ID}, '_name").val()) {
$("#', $$arg_ref{ID}, '").prop("required", false);
}
});
');
}
sub Get {
my ($self, $id) = @_;
$id = $ID_DEFAULT if is_empty($id);
# File handler:
my $filehandle = cgiapp_upload($id);
# File name:
my $filename = cgiapp_param($id);
my $filesafe = $filename;
# File type:
my $filetype = !is_empty($filename) ? cgiapp_uploadInfo($filename)->{'Content-Type'} : undef;
if ($filehandle) {
my $safe_characters = "a-zA-Z0-9_.-";
$filesafe =~ tr/ /_/;
$filesafe =~ s/[^$safe_characters]//g;
if ($filesafe =~ /^([$safe_characters]+)$/) {
$filesafe = strval('file-', time(), '_', $1);
if (copy($filehandle, strval(CONFIG('DIR_UPLOADS'), '/', $filesafe)) && open($filehandle, '<', strval(CONFIG('DIR_UPLOADS'), '/', $filesafe))) {
cgiapp_param(strval($id, '_name'), $filename);
cgiapp_param(strval($id, '_safe'), $filesafe);
cgiapp_param(strval($id, '_type'), $filetype);
return ($filehandle, $filename, $filetype);
}
}
}
else {
$filename = cgiapp_param(strval($id, '_name'));
$filesafe = cgiapp_param(strval($id, '_safe'));
$filetype = cgiapp_param(strval($id, '_type'));
if (!is_empty($filesafe) && open($filehandle, '<', strval(CONFIG('DIR_UPLOADS'), '/', $filesafe))) {
return ($filehandle, $filename, $filetype);
}
}
return (undef, undef, undef);
}
1;
=head1 AUTHOR
Manuel Cillero C<< <manuel@cillero.es> >>
=head1 COPYRIGHT
The MIT License (MIT)
Copyright (c) 2004-2020 Manuel Cillero. All rights reserved.
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
=cut

View file

@ -0,0 +1,160 @@
=head1 NAME
Dam::Components::Controls::Year
=head1 SYNOPSIS
my $year = Component__Get(CONTROL_YEAR, ['year']);
=head1 DESCRIPTION
Control para seleccionar un año.
=head1 ARGUMENTS
(
TYPE => 'Year',
ID => 'year' (default),
INFO => 1 (show info in header; default) or 0 (don't show),
LABEL => 'Year' (default),
LABEL_INFO => Same as LABEL (default),
REQUIRED => 1 (control required; default) or 0 (not required)
)
=cut
use strict;
use warnings;
use utf8;
package Dam::Components::Controls::Year;
use Exporter qw(import);
our @EXPORT = qw(
Control__html Control__js Get
);
use Date::Calc qw(Today);
use Dam::Util;
use Dam::DamLogic;
my $ID_DEFAULT = 'year';
sub __arguments {
my $arg_ref = shift;
$$arg_ref{LABEL} = _t('Year') if is_empty($$arg_ref{LABEL});
$$arg_ref{LABEL_INFO} = $$arg_ref{LABEL} if is_empty($$arg_ref{LABEL_INFO});
check_arguments($arg_ref,
TYPE => [ ARG_REQUIRED ],
ID => [ ARG_DEFAULT, $ID_DEFAULT ],
INFO => [ ARG_DEFAULT, 1, 0 ],
LABEL => [ ARG_REQUIRED ],
LABEL_INFO => [ ARG_REQUIRED ],
REQUIRED => [ ARG_DEFAULT, 1, 0 ]
);
}
sub Control__html {
my ($self, $arg_ref, $info_ref) = @_;
__arguments($arg_ref);
my $year_value = cgiapp_param($$arg_ref{ID});
if (!is_report()) {
my @today = Today();
$year_value = $today[0];
}
push(@{$info_ref}, { DATA => $$arg_ref{LABEL_INFO}, VALUE => $year_value }) if $$arg_ref{INFO};
# Required stylesheets:
Component__Header(ADD => 'CSS', RESOURCE => PACK_DATEPICKER);
return strval('
<div class="form-group form-group-', $ID_DEFAULT, '">
<label for="', $$arg_ref{ID}, $$arg_ref{REQUIRED} ? '" class="required">' : '">', $$arg_ref{LABEL}, '</label>
<input type="text" class="form-control input-lg input-date-year" data-provide="datepicker" id="', $$arg_ref{ID}, '" name="', $$arg_ref{ID}, '" value="', $year_value, '" autocomplete="off" size=4', $$arg_ref{REQUIRED} ? ' required="required"' : '', ' />
</div>
');
}
sub Control__js {
my ($self, $arg_ref) = @_;
__arguments($arg_ref);
my @today = Today();
# Required javascripts:
Component__Header(ADD => 'JS', RESOURCE => PACK_DATEPICKER);
return strval('
$(function(){
$("#', $$arg_ref{ID}, '").datepicker({
language: "', _t('LANGUAGE_CODE'), '",
autoclose: true,
todayHighlight: true,
disableTouchKeyboard: true,
minViewMode: "years",
format: "yyyy",
endDate: "', $today[0], '"
});
});
');
}
sub Get {
my ($self, $id) = @_;
$id = $ID_DEFAULT if is_empty($id);
my $value = cgiapp_param($id);
return !is_empty($value) ? $value : undef;
}
1;
=head1 AUTHOR
Manuel Cillero C<< <manuel@cillero.es> >>
=head1 COPYRIGHT
The MIT License (MIT)
Copyright (c) 2004-2020 Manuel Cillero. All rights reserved.
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
=cut