Skip to content

Commit

Permalink
Make exporting assets as HTML work when an export with mobile styling…
Browse files Browse the repository at this point in the history
… has been selected. Fixes bug #12364
  • Loading branch information
perlDreamer committed May 27, 2012
1 parent 70c9939 commit ee783e7
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 3 deletions.
1 change: 1 addition & 0 deletions docs/changelog/7.x.x.txt
Expand Up @@ -14,6 +14,7 @@
- fixed: Cache's setByHTTP method returns content, even when it gets an error in the request. This gives the SC asset fits.
- fixed #12349: Friends invitation error
- fixed #12353: Dataform List mode
- fixed #12364: Site export loses session info

7.10.24
- fixed #12318: asset error causes asset manager to fail
Expand Down
16 changes: 13 additions & 3 deletions lib/WebGUI/AssetExportHtml.pm
Expand Up @@ -311,8 +311,9 @@ sub exportAsHtml {

sub exportBranch {
my ($self, $options, $reportSession) = @_;
my $session = $self->session;
my $i18n = $reportSession &&
WebGUI::International->new($self->session, 'Asset');
WebGUI::International->new($session, 'Asset');

my $depth = $options->{depth};
my $indexFileName = $options->{indexFileName};
Expand Down Expand Up @@ -361,13 +362,22 @@ sub exportBranch {
my $exportAsset = sub {
my ( $assetId ) = @_;
# Must be created once for each asset, since session is supposed to only handle
# one main asset
my $outputSession = $self->session->duplicate;
# one main asset. It also cannot be a clone of the current session, since when
# this duplicate is closed it will overwrite the scratch from the original
my $outputSession = WebGUI::Session->open(
$session->config->getWebguiRoot,
$session->config->getFilename,
);
$outputSession->user( { userId => $session->user->getId } );
$outputSession->scratch->set('isExporting', 1);
$outputSession->scratch->set('exportUrl',$session->scratch->get('exportUrl'));
$outputSession->style->setMobileStyle($session->style->useMobileStyle?1:0);
my $osGuard = Scope::Guard->new(sub {
$outputSession->close;
$outputSession = undef;
});


my $asset = WebGUI::Asset->new($outputSession, $assetId);
my $fullPath = $asset->exportGetUrlAsPath;

Expand Down

0 comments on commit ee783e7

Please sign in to comment.