rendered paste body try {
$session->{store}->saveAttachment(
$webName, $topic, $fileName, $user,
{ dontlog => !$TWiki::cfg{Log}{upload},
comment => $fileComment,
hide => $hideFile,
createlink => $createLink,
stream => $stream,
filepath => $filePath,
filesize => $fileSize,
filedate => $fileDate,
} );
} catch Error::Simple with {
throw TWiki::OopsException( 'attention',
def => 'save_error',
web => $webName,
topic => $topic,
params => shift->{-text} );
};
close( $stream ) if $stream;
# ok lets convert the file
my $fullpath = "$TWiki::cfg{PubDir}/$webName/$topic/$filePath";
my $cnt = TWiki::Plugins::OODocConverter::OODoc2Twiki->new(file => $fullpath);
my @elements = $cnt->getTextElementList;
my $topicText = $cnt->transformElements(@elements);
#lets get all the images, extracted out of the document
my @imageTmpPaths = $cnt->exportAllImages($TWiki::cfg{TempfileDir});
# attache images
foreach my $image (@imageTmpPaths) {
try {
$session->{store}->saveAttachment(
$webName, $topic, $fileName, $user,
{ dontlog => 1,
comment => "document image",
hide => 0,
createlink => 0,
file => $image
} );
} catch Error::Simple with {
throw TWiki::OopsException( 'attention',
def => 'save_error',
web => $webName,
topic => $topic,
params => shift->{-text} );
};
}
# now set the new topic content
my( $meta, $old_text ) = $session->{store}->readTopic(undef, $webName, $topic );
$session->{store}->saveTopic( $session->{user}, $webName, $topic, $topicText, $meta , { dontlog => 1 } );