include form parameters in sql report download link
This commit is contained in:
parent
3dbde9ff3f
commit
29f2018b6f
3 changed files with 188 additions and 3 deletions
|
|
@ -477,10 +477,12 @@ sub view {
|
|||
#use Data::Dumper; return '<pre>'.Dumper($var).'</pre>';
|
||||
|
||||
# Add the "Download data" link if the user is allowed to download
|
||||
$var->{'canDownload'} = 1
|
||||
if ($self->getValue("downloadType") ne "none"
|
||||
if ($self->getValue("downloadType") ne "none"
|
||||
&& $self->session->user->isInGroup($self->getValue("downloadUserGroup"))
|
||||
);
|
||||
) {
|
||||
$var->{'canDownload'} = 1;
|
||||
$var->{'downloadLink'} = $self->_getDownloadLink($self);
|
||||
}
|
||||
|
||||
my $out = $self->processTemplate($var,undef,$self->{_viewTemplate});
|
||||
if (!$self->session->var->isAdminOn && $self->get("cacheTimeout") > 10) {
|
||||
|
|
@ -489,6 +491,27 @@ sub view {
|
|||
return $out;
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
# Create download link be adding all the passed in parameters and values to the url
|
||||
sub _getDownloadLink {
|
||||
my $self = shift;
|
||||
my %params;
|
||||
for my $nr (1 .. 5) {
|
||||
foreach my $row (split(/\n/,$self->{_query}{$nr}{placeholderParams})) {
|
||||
$row =~ s/^\s+//;
|
||||
$row =~ s/\s+$//;
|
||||
if ($row =~ /^form:(.*)/) {
|
||||
$params{$1} ||= $self->session->form->param($1);
|
||||
}
|
||||
}
|
||||
}
|
||||
my $url = "func=download";
|
||||
for my $param (sort keys %params) {
|
||||
$url .= ";$param=" . $self->session->url->escape($params{$param});
|
||||
}
|
||||
return $self->getUrl($url);
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
sub _storeQueries {
|
||||
my $self = shift;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue