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,124 @@
=head1 NAME
Dam::Components::Actions::Download
=head1 SYNOPSIS
my $download_mode = Component__Get(ACTION_DOWNLOAD, ['csv']);
=head1 DESCRIPTION
Action to execute a download.
=head1 ARGUMENTS
(
TYPE => 'Download',
ID => 'csv' (default),
LABEL => 'CSV' (default),
TOOLTIP => 'Download the current report in CSV format' (default),
ICON => 'download-alt' (default),
MODE_EXT => 'CSV' (default),
FILE_EXT => 'csv' (default)
)
=cut
package Dam::Components::Actions::Download;
use Exporter qw(import);
our @EXPORT = qw(
Action__html Action__js
);
use Dam::Util;
use Dam::DamLogic;
my $ID_DEFAULT = 'csv';
sub __arguments {
my $arg_ref = shift;
check_arguments($arg_ref,
TYPE => [ ARG_REQUIRED ],
ID => [ ARG_DEFAULT, $ID_DEFAULT ],
LABEL => [ ARG_DEFAULT, 'CSV' ],
TOOLTIP => [ ARG_DEFAULT, _t('Download current report in CSV format') ],
ICON => [ ARG_DEFAULT, 'download-alt' ],
MODE_EXT => [ ARG_DEFAULT, 'CSV' ],
FILE_EXT => [ ARG_DEFAULT, 'csv' ]
);
}
sub Action__html {
my ($self, $arg_ref, $info_ref) = @_;
__arguments($arg_ref);
return is_report() ? strval('
<button type="button" class="btn btn-info input-lg" id="', $$arg_ref{ID}, '" data-toggle="tooltip" title="', $$arg_ref{TOOLTIP}, '"><span class="glyphicon glyphicon-', $$arg_ref{ICON}, '"></span> ', $$arg_ref{LABEL}, '</button>
') : '';
}
sub Action__js {
my ($self, $arg_ref) = @_;
__arguments($arg_ref);
return is_report() ? strval('
$("#', $$arg_ref{ID}, '").click(function(){
$("#xt").val(3);
$("#dm").val("', $$arg_ref{MODE_EXT}, ',', $$arg_ref{FILE_EXT}, '");
$("#submit").click();
});
') : '';
}
sub Get {
my ($download_mode, $filename_extension) = split(',', cgiapp_param('dm'));
return is_download() ? $download_mode : '';
}
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,107 @@
=head1 NAME
App::api::actions::Action_Print
=head1 DESCRIPTION
Action to print.
=head1 ARGUMENTS
(
TYPE => 'Print',
ID => 'print' (default),
LABEL => 'Print' (default)
)
=cut
use strict;
use warnings;
use utf8;
package Dam::Components::Actions::Print;
use Exporter qw(import);
our @EXPORT = qw(
Action__html Action__js
);
use Dam::Util;
use Dam::DamLogic;
my $ID_DEFAULT = 'print';
sub __arguments {
my $arg_ref = shift;
check_arguments($arg_ref,
TYPE => [ ARG_REQUIRED ],
ID => [ ARG_DEFAULT, $ID_DEFAULT ],
LABEL => [ ARG_DEFAULT, _t('Print') ]
);
}
sub Action__html {
my ($self, $arg_ref, $info_ref) = @_;
__arguments($arg_ref);
return is_report() ? strval('
<button type="button" class="btn btn-success input-lg" id="', $$arg_ref{ID},'"><span class="glyphicon glyphicon-print"></span> ', $$arg_ref{LABEL},'</button>
') : '';
}
sub Action__js {
my ($self, $arg_ref) = @_;
__arguments($arg_ref);
return is_report() ? strval('
$("#', $$arg_ref{ID},'").click(function(){
window.print();
});
') : '';
}
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,122 @@
=head1 NAME
Dam::Components::Actions::Run
=head1 DESCRIPTION
Action to run a report.
=head1 ARGUMENTS
(
TYPE => 'Run',
ID => 'submit' (default),
LABEL => 'Run' (default)
)
=cut
use strict;
use warnings;
use utf8;
package Dam::Components::Actions::Run;
use Exporter qw(import);
our @EXPORT = qw(
Action__html Action__js
);
use Dam::Util;
use Dam::DamLogic;
my $ID_DEFAULT = 'submit';
sub __arguments {
my $arg_ref = shift;
check_arguments($arg_ref,
TYPE => [ ARG_REQUIRED ],
ID => [ ARG_DEFAULT, $ID_DEFAULT ],
LABEL => [ ARG_DEFAULT, _t('Run') ]
);
}
sub Action__html {
my ($self, $arg_ref, $info_ref) = @_;
__arguments($arg_ref);
return strval('
<button type="submit" class="btn btn-primary input-lg" id="', $$arg_ref{ID}, '"><span class="glyphicon glyphicon-repeat"></span> ', $$arg_ref{LABEL},'</button>
');
}
sub Action__js {
my ($self, $arg_ref) = @_;
__arguments($arg_ref);
# Required javascripts:
Component__Header(ADD => 'JS', RESOURCE => '/dam/js/spin.min.js', VERSION => '2.3.2' );
return strval('
$(function(){
var middle = Math.floor($(window).height() / 2) + "px";
var spin = { lines: 10, length: 28, width: 25, radius: 40, scale: 0.5, corners: 1, color: "#000", opacity: 0.3, rotate: 0, direction: 1, speed: 1, trail: 60, fps: 20, zIndex: 2e9, className: "spinner", top: middle, left: "50%", shadow: false, hwaccel: false, position: "absolute" }
$("#filter").on("submit", function(e) {
if ($("#nv").val() != 1 && $("#filter").valid()) {
if ($("#xt").val() == 2) $("#xt").val(1);
if ($("#xt").val() == 3) $("#xt").val(2);
if ($("#xt").val() < 2) {
var spinner = new Spinner(spin).spin(document.getElementById("loading"));
$("#loading").show();
}
}
$("#nv").val(0);
});
});
');
}
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,216 @@
=head1 NAME
Dam::Components::Actions::Sort
=head1 SYNOPSIS
my $orderby = Component__Get(ACTION_SORT);
=head1 DESCRIPTION
Action to order a list by columns.
=head1 ARGUMENTS
(
TYPE => 'Sort',
COLUMNS => { 'col1' => 'Column 1', 'col2' => 'Column 2' } (default),
DEFAULT => 'col1' (default valus is undef)
)
=cut
use strict;
use warnings;
use utf8;
package Dam::Components::Actions::Sort;
use Exporter qw(import);
our @EXPORT = qw(
Action__html Action__js
);
use Dam::Util;
use Dam::DamLogic;
my $ID_DEFAULT = 'sort';
sub __arguments {
my $arg_ref = shift;
check_arguments($arg_ref,
TYPE => [ ARG_REQUIRED ],
ID => [ ARG_DEFAULT, $ID_DEFAULT ],
COLUMNS => [ ARG_DEFAULT, { 'col1' => 'Column 1', 'col2' => 'Column 2' } ],
DEFAULT => [ ARG_OPTIONAL ]
);
}
sub Action__html {
my ($self, $arg_ref, $info_ref) = @_;
__arguments($arg_ref);
my $default = undef;
my %list_columns = %{$$arg_ref{COLUMNS}};
if (!is_empty($$arg_ref{DEFAULT})) {
my @default = split(' ', $$arg_ref{DEFAULT});
if (defined($list_columns{$default[0]}) && !defined($default[2])) {
my $dir = in_array(uc($default[1]), 'ASC', 'DESC') ? uc($default[1]) : 'ASC';
$default = strval($default[0], ' ', $dir);
}
}
# Order value:
my $orderby_value = cgiapp_param('orderby');
$orderby_value = $default if is_empty($orderby_value) && defined($default);
if (defined($orderby_value)) {
my @orderby = split(' ', $orderby_value);
if (defined($orderby[0]) && defined($list_columns{$orderby[0]})) {
my $orderby = $list_columns{$orderby[0]};
if (defined($orderby[1])) {
$orderby = strval($orderby, is_eq($orderby[1], 'ASC') ? strval(' (', _t('ascendant'), ')') : is_eq($orderby[1], 'DESC') ? strval(' (', _t('descendent'), ')') : '');
}
push(@{$info_ref}, { DATA => _t('Order by'), VALUE => $orderby });
}
else {
$orderby_value = '';
}
}
else {
$orderby_value = '';
}
return strval('
<input type="hidden" name="orderby" id="orderby" value="', $orderby_value, '" />
');
}
sub Action__js {
my ($self, $arg_ref) = @_;
__arguments($arg_ref);
my $default = undef;
my %list_columns = %{$$arg_ref{COLUMNS}};
if (!is_empty($$arg_ref{DEFAULT})) {
my @default = split(' ', $$arg_ref{DEFAULT});
if (defined($list_columns{$default[0]}) && !defined($default[2])) {
my $dir = in_array(uc($default[1]), 'ASC', 'DESC') ? uc($default[1]) : 'ASC';
$default = strval($default[0], ' ', $dir);
}
}
my $columns_id = '';
my $columns_name = '';
foreach my $column (keys(%list_columns)) {
$columns_id .= strval('#', $column, ',');
$columns_name .= strval($list_columns{$column}, ',');
}
chop($columns_id);
chop($columns_name);
return strval('
$(function(){
var current_orderby = $("#orderby").val().split(" ");
var columns_id = ["', strval_join('","', split(',', $columns_id)), '"];
var columns_name = ["', strval_join('","', split(',', $columns_name)), '"];
columns_id.forEach(function(value,index,array){
var glypho = "sort";
if (current_orderby[0] == value.substring(1)) {
if (current_orderby[1] == "ASC") {
glypho = "triangle-bottom";
}
else if (current_orderby[1] == "DESC") {
glypho = "triangle-top";
}
}
$(value).css("white-space","nowrap");
$(value).prepend("<span style=\"font-size: medium; color: #999;\" class=\"minitip glyphicon glyphicon-" + glypho + " hidden-print\" data-toggle=\"tooltip\" title=\"', _t('Sort by'), ' " + columns_name[index] + "\"></span>");
$(value).hover(function(){
$(this).css("cursor","pointer");
});
$(value).click(function(){
var current_column = $(this).attr("id");
if (current_column == current_orderby[0]) {
if (current_orderby[1] == "ASC") {
current_column += " DESC";
}
else if (current_orderby[1] != "DESC") {
current_column += " ASC";
}
else {
current_column = "', $default, '";
}
}
else {
current_column += " ASC";
}
$("#orderby").val(current_column);
$("#submit").click();
});
});
$(".minitip").tooltip();
});
');
}
sub Get {
my $orderby_value = cgiapp_param('orderby');
return undef if is_empty($orderby_value);
return $orderby_value;
}
sub Set {
my ($self, $value, $id) = @_;
cgiapp_param('orderby', $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,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

View file

@ -0,0 +1,46 @@
<div class="jumbotron hemotron">
<div style="float: right;"><TMPL_VAR VERSION></div>
<h1><TMPL_VAR APP_NAME></h1>
<p><TMPL_VAR APP_SLOGAN></p>
<TMPL_IF GLOBAL_WARNING>
<br /><div class="alert alert-warning" role="alert"><TMPL_VAR GLOBAL_WARNING></div>
</TMPL_IF>
<TMPL_IF CHANGELOG_LAST>
<br />
<div class="panel panel-default">
<!-- Nav tabs -->
<ul id="changelog" class="nav nav-tabs" role="tablist">
<li role="presentation" class="active"><a href="#home" aria-controls="home" role="tab" data-toggle="tab"><TMPL_VAR T_VERSION_NEWS></a></li>
<li role="presentation"><a href="#profile" aria-controls="profile" role="tab" data-toggle="tab"><TMPL_VAR T_VERSION_PREV></a></li>
</ul>
<!-- Tab panes -->
<div class="tab-content">
<div role="tabpanel" class="tab-pane fade in active" id="home">
<div class="panel-body">
<ul class="changelog-list"><TMPL_LOOP CHANGELOG_LAST>
<TMPL_VAR ITEM></TMPL_LOOP>
</ul>
</div>
</div>
<TMPL_IF CHANGELOG_PREV>
<div role="tabpanel" class="tab-pane fade" id="profile">
<div class="panel-body">
<ul class="changelog-list"><TMPL_LOOP CHANGELOG_PREV>
<TMPL_VAR ITEM></TMPL_LOOP>
</ul>
</div>
</div>
</TMPL_IF>
</div>
<script type="text/javascript">
$('#changelog a').click(function (e) {
e.preventDefault();
$(this).tab('show');
});
</script>
</div>
</TMPL_IF>
</div>

View file

@ -0,0 +1,14 @@
<TMPL_IF DEBUG>
<div class="panel panel-default hidden-print">
<div class="panel-heading">
<h4 class="panel-title">
<strong><span class="glyphicon glyphicon-wrench"></span> <a data-toggle="collapse" data-target="#debug-info" onClick="return false;" style="cursor: pointer;">DEBUG</a></strong>
</h4>
</div>
<div id="debug-info" class="panel-collapse collapse">
<div class="panel-body">
<TMPL_VAR DEBUG>
</div>
</div>
</div>
</TMPL_IF>

View file

@ -0,0 +1,5 @@
<div class="jumbotron hemotron">
<h1><TMPL_VAR APP_NAME></h1>
<h2><span class="glyphicon glyphicon-eye-close"></span> <TMPL_VAR T_ATTENTION> <TMPL_VAR T_UNAUTHORIZED_ACCESS> </h2>
<p><TMPL_VAR T_REPORT_WITHOUT_ACCESS> <TMPL_VAR T_CONTACT_ADMINISTRATOR></p>
</div>

View file

@ -0,0 +1,5 @@
<div class="jumbotron hemotron">
<h1><TMPL_VAR APP_NAME></h1>
<h2><span class="glyphicon glyphicon-eye-close"></span> <TMPL_VAR T_ATTENTION> <TMPL_VAR T_UNEXPECTED_ERROR></h2>
<p><TMPL_VAR T_ERROR_DURING_EXECUTION> <TMPL_VAR T_CONTACT_ADMINISTRATOR></p>
</div>

View file

@ -0,0 +1,72 @@
<input type="hidden" name="xt" id="xt" value="<TMPL_VAR FIRSTTIME>" />
<input type="hidden" name="rm" id="rm" value="<TMPL_VAR RUN_MODE>" />
<input type="hidden" name="dm" id="dm" value="" />
<input type="hidden" name="nv" id="nv" value="" />
<div class="panel panel-info panel-filter hidden-print">
<div class="panel-heading"><TMPL_VAR FILTER_TITLE></div>
<div class="panel-body">
<div class="modal fade" tabindex="-1" id="filter-error">
<div class="modal-dialog"><div class="modal-content"><div class="modal-body">
<button type="button" class="close" data-dismiss="modal"><span>&times;</span></button>
<h3><strong><TMPL_VAR T_WATCH_OUT></strong></h3><h4 id="filter-message"></h4>
<p class="text-right"><button type="button" class="btn btn-default" data-dismiss="modal"><TMPL_VAR T_CLOSE></button></p>
</div></div></div>
</div>
<TMPL_IF DESCRIPTION><p class="description"><TMPL_VAR DESCRIPTION></p></TMPL_IF>
<TMPL_LOOP FILTER_CONTROLS><TMPL_VAR CONTROL></TMPL_LOOP>
<div class="form-group filter-buttons"><TMPL_LOOP FILTER_ACTIONS><TMPL_VAR ACTION></TMPL_LOOP>
</div>
<TMPL_IF REPORT_ERROR>
<div class="alert alert-danger hidden-print" role="alert"><TMPL_VAR REPORT_ERROR></div>
</TMPL_IF>
<TMPL_IF REPORT_WARNING>
<div class="alert alert-warning hidden-print" role="alert"><TMPL_VAR REPORT_WARNING></div>
</TMPL_IF>
<TMPL_IF REPORT_INFO>
<div class="alert alert-info hidden-print" role="alert"><TMPL_VAR REPORT_INFO></div>
</TMPL_IF>
</div>
</div>
<script type="text/javascript">
$(function(){
$("#filter").validate();
});
<TMPL_LOOP FILTER_JS><TMPL_VAR JAVASCRIPT></TMPL_LOOP>
</script>
<div class="panel panel-default panel-informa visible-print-block">
<div class="panel-heading"><TMPL_VAR APP_NAME></div>
<table class="table table-bordered table-condensed">
<tbody>
<tr>
<td style="width: 20%;"> <TMPL_VAR T_REPORT>: </td>
<td> <TMPL_VAR REPORT> </td>
</tr><TMPL_IF DESCRIPTION><tr>
<td> <TMPL_VAR T_DESCRIPTION>: </td>
<td> <TMPL_VAR DESCRIPTION> </td>
</tr></TMPL_IF><tr>
<td> <TMPL_VAR T_EDITION_DATE>: </td>
<td> <TMPL_VAR TODAY> </td>
</tr><tr>
<td> <TMPL_VAR T_REQUESTED_BY>: </td>
<td> <TMPL_VAR USER> </td>
<TMPL_LOOP FILTER_OPTIONS>
</tr><tr>
<td> <TMPL_VAR DATA>: </td>
<td> <TMPL_VAR VALUE> </td>
</TMPL_LOOP>
</tr>
</tbody>
</table>
</div>

View file

@ -0,0 +1,39 @@
<TMPL_IF DEBUG_MODE>
<div class="container hidden-print">
<div class="alert alert-info" role="alert" style="text-align: center;">
<strong><TMPL_VAR T_ATTENTION> <TMPL_VAR T_WARNING_MODE></strong>
</div>
</div>
</TMPL_IF>
<a href="#" class="scrollup">Arriba</a>
<footer>
<div class="container">
<p class="copyright"> <TMPL_VAR FOOTER_COPYRIGHT> </p>
<p class="today"> <TMPL_VAR TODAY> </p>
</div>
</footer>
<TMPL_IF CHECK_BROWSER>
<div id="outdated">
<h6><TMPL_VAR T_OLD_BROWSER></h6>
<p><TMPL_VAR T_UPDATE_BROWSER> <a id="btnUpdateBrowser" href="http://outdatedbrowser.com/es"><TMPL_VAR T_UPDATE_NOW></a>.</p>
<p class="last"><a href="#" id="btnCloseUpdateBrowser" title="<TMPL_VAR T_CLOSE>">&times;</a></p>
</div>
<script type="text/javascript">
<!--
outdatedBrowser({
bgColor: '#f25648',
color: '#ffffff',
lowerThan: 'boxShadow',
languagePath: ''
});
// -->
</script>
</TMPL_IF>
</body>
</html>

View file

@ -0,0 +1,34 @@
<!DOCTYPE html>
<html lang="<TMPL_VAR LANGUAGE_CODE>" dir="ltr">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<link rel="shortcut icon" href="<TMPL_VAR ROOT_WWW>/favicon.ico" type="image/x-icon" />
<title><TMPL_VAR TITLE></title>
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1" />
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<TMPL_LOOP STYLESHEETS>
<link rel="stylesheet" href="<TMPL_VAR ROOT_WWW><TMPL_VAR RESOURCE><TMPL_IF VERSION>?v=<TMPL_VAR VERSION></TMPL_IF>" type="text/css" /><TMPL_IF DEBUG_MODE> <!-- Priority <TMPL_VAR PRIORITY> --></TMPL_IF></TMPL_LOOP>
<TMPL_LOOP JAVASCRIPTS>
<script src="<TMPL_VAR ROOT_WWW><TMPL_VAR RESOURCE><TMPL_IF VERSION>?v=<TMPL_VAR VERSION></TMPL_IF>"<TMPL_IF CHARSET> charset="<TMPL_VAR CHARSET>"</TMPL_IF>></script><TMPL_IF DEBUG_MODE> <!-- Priority <TMPL_VAR PRIORITY> --></TMPL_IF></TMPL_LOOP>
<TMPL_IF CHECK_BROWSER>
<link rel="stylesheet" href="<TMPL_VAR ROOT_WWW>/dam/css/outdatedbrowser.min.css?v=1.1.5" type="text/css" />
<script src="<TMPL_VAR ROOT_WWW>/dam/js/outdatedbrowser.min.js?v=1.1.5"></script>
</TMPL_IF>
<!--[if lt IE 9]>
<link rel="stylesheet" media="all" href="<TMPL_VAR ROOT_WWW>/dam/css/ie8.css" type="text/css" />
<script src="<TMPL_VAR ROOT_WWW>/dam/js/respond.min.js"></script>
<script src="<TMPL_VAR ROOT_WWW>/dam/js/html5shiv.min.js"></script>
<![endif]-->
</head>
<body<TMPL_IF BODY_CLASSES> class="<TMPL_VAR BODY_CLASSES>"</TMPL_IF>>
<div id="loading"></div>
<TMPL_IF GLOBAL_ERROR>
<div class="container fatal-error">
<div class="alert alert-danger" role="alert"><TMPL_VAR GLOBAL_ERROR></div>
</div>
</TMPL_IF>

View file

@ -0,0 +1,26 @@
<h1 class="login-heading"><TMPL_VAR APP_NAME></h1>
<form name="login" method="post" class="form-login" onsubmit="
document.login.pass.value=encrypt(document.login.hide.value,document.login.key.value);
document.login.hide.value=document.login.pass.value.substr(0,document.login.hide.value.length);
">
<input type="hidden" name="rm" value="APP_confirm" />
<input type="hidden" name="key" value="<TMPL_VAR KEY>" />
<input type="hidden" name="pass" value="" />
<label for="user" class="sr-only"> <TMPL_VAR T_USERNAME> </label>
<input type="text" class="form-control" name="user" placeholder="<TMPL_VAR T_USERNAME>" maxlength="20" value="<TMPL_VAR LOGIN>" required autofocus />
<label for="pass" class="sr-only"> <TMPL_VAR T_PASSWORD> </label>
<input type="password" class="form-control" name="hide" placeholder="<TMPL_VAR T_PASSWORD>" maxlength="20" required />
<button type="submit" class="btn btn-lg btn-primary btn-block"> <TMPL_VAR T_LOGIN> </button>
<TMPL_IF ERROR>
<br /><br /><div class="alert alert-danger" role="alert">
<h4> <TMPL_VAR ERROR_TITLE> </h4>
<p> <TMPL_VAR ERROR_MESSAGE> (Error <TMPL_VAR ERROR>). </p>
</div>
</TMPL_IF>
</form>
<TMPL_VAR CRYPT_TEA>

View file

@ -0,0 +1,23 @@
<TMPL_IF ROUTES>
<form id="naviga" method="post"><input type="hidden" name="rm" />
<nav class="navbar navbar-default navbar-inverse navbar-fixed-top">
<div class="container">
<div class="navbar-header">
<button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target=".navbar-collapse">
<span class="sr-only"><TMPL_VAR T_NAVIGATION></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
<a href="#" class="navbar-brand option" id="RUN_home" title="<TMPL_VAR APP_NAME>"><TMPL_VAR APP_MNEMO></a>
</div>
<TMPL_VAR ROUTES>
</div>
</nav>
</form>
</TMPL_IF>

View file

@ -0,0 +1,152 @@
=head1 NAME
Dam::Components::Translations::ES_es
=head1 DESCRIPTION
Traducciones a español.
=head1 FUNCTIONS
=cut
use strict;
use warnings;
use utf8;
package Dam::Components::Translations::ES_es;
use Exporter qw(import);
our @EXPORT = qw(
Get
);
my %T = (
LANGUAGE_CODE => 'es',
MONTHS => [ 'Enero', 'Febrero', 'Marzo', 'Abril', 'Mayo', 'Junio', 'Julio', 'Agosto', 'Septiembre', 'Octubre', 'Noviembre', 'Diciembre' ],
'Username' => 'Nombre de usuario',
'Password' => 'Contraseña',
'Login' => 'Entrar',
'User not active!' => '¡Usuario no activo!',
'Consult with your systems manager to activate your user' => 'Consulte con el responsable de sistemas para activar su usuario',
'Access error!' => '¡Error de acceso!',
'Verify username and retype password' => 'Verifique el nombre de usuario y vuelva a teclear la contraseña',
'Close' => 'Cerrar',
'Close session' => 'Cerrar sesión',
'Navigation' => 'Navegación',
'alpha' => 'alfa',
'beta' => 'beta',
'Original access' => 'Acceso original',
'Assigned access' => 'Acceso asignado',
'ERROR!' => '¡ERROR!',
'ERRORS!' => '¡ERRORES!',
'WARNING!' => '¡ADVERTENCIA!',
'WARNINGS!' => '¡ADVERTENCIAS!',
'ATTENTION!' => '¡ATENCIÓN!',
'Unauthorized Access' => 'Acceso No Autorizado',
'You are trying to run a report without sufficient access privileges.' => 'Está intentando ejecutar un informe sin suficientes privilegios de acceso.',
'Unexpected Error' => 'Error Inesperado',
'An unexpected error occurred during execution.' => 'Se ha producido un error inesperado durante la ejecución.',
'Please contact the administrator to resolve it.' => 'Por favor, contacte con el administrador para resolverlo.',
'Report' => 'Informe',
'Description' => 'Descripción',
'Edition date' => 'Fecha de edición',
'Requested by' => 'Solicitado por',
'Reports in <--alpha--> status are under development and may show errors or not give the expected results.' => 'Los informes en estado <--alpha--> están en desarrollo y pueden mostrar errores o no dar los resultados esperados.',
'Reports in <--beta--> status are in validation process.' => 'Los informes en estado <--beta--> están en proceso de validación.',
'WATCH OUT!' => '¡CUIDADO!',
'NO DATA!' => '¡SIN DATOS!',
'There is no data to apply the selection form filter.' => 'No hay registros que cumplan los criterios del filtro de selección.',
'Check the filter conditions.' => 'Compruebe las condiciones del filtro.',
'Filter fields marked with <--required--> are required.' => 'Los campos del filtro marcados con <--required--> son obligatorios.',
'This browser is out of date' => 'Este navegador es antiguo',
'You must update to use <--app--> correctly.' => 'Hay que actualizar para usar <--app--> correctamente.',
'Update my browser now' => 'Actualizar mi navegador ahora',
'You are running <--app--> in <--mode-->.' => 'Está ejecutando <--app--> en <--mode-->.',
'develop mode' => 'modo de desarrollo',
'testing mode' => 'modo de pruebas',
'About <--app-->' => 'Sobre <--app-->',
'What\'s new' => 'Novedades',
'Previous version' => 'Versión anterior',
# ACTIONS:
'Run' => 'Calcular',
'Print' => 'Imprimir',
'Download current report in CSV format' => 'Descarga el informe actual en formato CSV',
'Order by' => 'Ordenado por',
'Sort by' => 'Ordenar por',
'ascendant' => 'ascendente',
'descendent' => 'descendente',
# CONTROLS:
'Date' => 'Fecha',
'Date range' => 'Período',
'Month' => 'Mes',
'Year' => 'Año',
'YEAR' => 'AÑO',
'FIRST SEMESTER' => 'PRIMER SEMESTRE',
'SECOND SEMESTER' => 'SEGUNDO SEMESTRE',
'FIRST QUARTER' => 'PRIMER CUATRIMESTRE',
'SECOND QUARTER' => 'SEGUNDO CUATRIMESTRE',
'THIRD QUARTER' => 'TERCER CUATRIMESTRE',
'FIRST TRIMESTER' => 'PRIMER TRIMESTRE',
'SECOND TRIMESTER' => 'SEGUNDO TRIMESTRE',
'THIRD TRIMESTER' => 'TERCER TRIMESTRE',
'FOURTH TRIMESTER' => 'CUARTO TRIMESTRE',
'Date ranges greater than <--max--> are not allowed.' => 'No se admiten rangos de fechas superiores a <--max-->.',
'day(s)' => 'día(s)',
'year(s)' => 'año(s)',
'Option' => 'Opción',
'Options' => 'Opciones',
'Enter text' => 'Introducir texto',
'Input text' => 'Texto de entrada',
'Upload file' => 'Subir archivo',
'File' => 'Archivo',
'If no other file is selected, then <--file--> previously uploaded will be used.' => 'Si no se selecciona otro archivo, entonces se usará el mismo <--file--> subido anteriormente.'
);
sub Get { return \%T; }
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