Fix the URL to the user after exporting a Thing in CSV format. The URL needs to contain the thingId to see non-default things. Fixes bug #12063

This commit is contained in:
Colin Kuskie 2011-02-28 20:33:29 -08:00
parent 7091cedc0a
commit 79ab978e49
2 changed files with 25 additions and 1 deletions

View file

@ -3,6 +3,7 @@
- fixed #12051: Prevent Proxy Caching Breaks Edit/Add Thing
- fixed #12053: Thingy: View Thing Data
- fixed #12062: Thingy: column headers missing from exported file
- fixed #12063: Return URL from export doesn't work on non-default Thingy's
7.10.10
- fixed #12035: Story Manager - make keywords from Story view work

View file

@ -1194,6 +1194,29 @@ sub getThing {
#-------------------------------------------------------------------
=head2 getThingUrl ( thingData )
Returns a the URL to view a Thing in this Thingy
=head3 thingData
A hashref of properties for the Thing, as returned by getThing. This is needed to extract the defaultView,
to get the right func, and the thingId.
=cut
sub getThingUrl {
my ($self, $thing) = @_;
if ($thing->{defaultView} eq "addThing") {
return 'func=editThingData;thingId='.$thing->{thingId}.';thingDataId=new';
}
else{
return 'func=search;thingId='.$thing->{thingId};
}
}
#-------------------------------------------------------------------
=head2 getViewThingVars ( )
Returns the field values of a thing instance and the title for its view screen in a tmpl var hashref.
@ -2773,7 +2796,7 @@ sub www_export {
}
close $CSV;
$pb->update(sprintf q|<a href="%s">%s</a>|, $self->getUrl, sprintf($i18n->get('Return to %s'), $thingProperties->{label}));
$pb->update(sprintf q|<a href="%s">%s</a>|, $self->getUrl($self->getThingUrl($thingProperties)), sprintf($i18n->get('Return to %s'), $thingProperties->{label}));
return $pb->finish($tempStorage->getUrl($csv_filename));
}