Skip to content

Commit ee783e7

Browse files
committedMay 27, 2012
Make exporting assets as HTML work when an export with mobile styling has been selected. Fixes bug #12364

File tree

2 files changed

+14
-3
lines changed

2 files changed

+14
-3
lines changed
 

‎docs/changelog/7.x.x.txt

+1
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
- fixed: Cache's setByHTTP method returns content, even when it gets an error in the request. This gives the SC asset fits.
1515
- fixed #12349: Friends invitation error
1616
- fixed #12353: Dataform List mode
17+
- fixed #12364: Site export loses session info
1718

1819
7.10.24
1920
- fixed #12318: asset error causes asset manager to fail

‎lib/WebGUI/AssetExportHtml.pm

+13-3
Original file line numberDiff line numberDiff line change
@@ -311,8 +311,9 @@ sub exportAsHtml {
311311

312312
sub exportBranch {
313313
my ($self, $options, $reportSession) = @_;
314+
my $session = $self->session;
314315
my $i18n = $reportSession &&
315-
WebGUI::International->new($self->session, 'Asset');
316+
WebGUI::International->new($session, 'Asset');
316317

317318
my $depth = $options->{depth};
318319
my $indexFileName = $options->{indexFileName};
@@ -361,13 +362,22 @@ sub exportBranch {
361362
my $exportAsset = sub {
362363
my ( $assetId ) = @_;
363364
# Must be created once for each asset, since session is supposed to only handle
364-
# one main asset
365-
my $outputSession = $self->session->duplicate;
365+
# one main asset. It also cannot be a clone of the current session, since when
366+
# this duplicate is closed it will overwrite the scratch from the original
367+
my $outputSession = WebGUI::Session->open(
368+
$session->config->getWebguiRoot,
369+
$session->config->getFilename,
370+
);
371+
$outputSession->user( { userId => $session->user->getId } );
372+
$outputSession->scratch->set('isExporting', 1);
373+
$outputSession->scratch->set('exportUrl',$session->scratch->get('exportUrl'));
374+
$outputSession->style->setMobileStyle($session->style->useMobileStyle?1:0);
366375
my $osGuard = Scope::Guard->new(sub {
367376
$outputSession->close;
368377
$outputSession = undef;
369378
});
370379

380+
371381
my $asset = WebGUI::Asset->new($outputSession, $assetId);
372382
my $fullPath = $asset->exportGetUrlAsPath;
373383

0 commit comments

Comments
 (0)
Please sign in to comment.