122 lines
2.9 KiB
Perl
122 lines
2.9 KiB
Perl
=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
|