Skip to content

Commit

Permalink
Item14547: latest changes
Browse files Browse the repository at this point in the history
  • Loading branch information
MichaelDaum committed Aug 12, 2022
1 parent 4b8f4be commit 4453513
Show file tree
Hide file tree
Showing 6 changed files with 23 additions and 10 deletions.
6 changes: 3 additions & 3 deletions data/System/WebExportViewTemplate.txt
Expand Up @@ -6,15 +6,15 @@
%TMPL:DEF{"form"}%%TMPL:END%
%TMPL:DEF{"metadata"}%%TMPL:END%
%TMPL:DEF{"web"}%%WEB%%TMPL:END%
%TMPL:DEF{"filename"}%%WEB%%TMPL:END%
%TMPL:DEF{"filename"}%%WEBEXPORTFILENAME{default="%WEB%"}%%TMPL:END%

%TMPL:DEF{"webexport::columns"}%%WEBEXPORTCOLUMNS{default="index, TopicTitle, Summary, Tag, Changed, Author"}%%TMPL:END%

%TMPL:DEF{"webexport::rows"}%%WEBEXPORTROWS{default="10"}%%TMPL:END%

%TMPL:DEF{"webexport::titles"}%%WEBEXPORTTIITLES{default="TopicTitle_title=\"%MAKETEXT{"Title"}%\" Summary_title=\"%MAKETEXT{"Summary"}%\" Tag_title=\"%MAKETEXT{"Tags"}%\" Changed_title=\"%MAKETEXT{"Changed"}%\" Author_title=\"%MAKETEXT{"Author"}%\""}%%TMPL:END%
%TMPL:DEF{"webexport::titles"}%%WEBEXPORTTITLES{default="TopicTitle_title=\"%MAKETEXT{"Title"}%\" Summary_title=\"%MAKETEXT{"Summary"}%\" Tag_title=\"%MAKETEXT{"Tags"}%\" Changed_title=\"%MAKETEXT{"Changed"}%\" Author_title=\"%MAKETEXT{"Author"}%\""}%%TMPL:END%

%TMPL:DEF{"webexport::title"}%<h1>%WEBEXPORTTITLE{default="%TOPIC%"}%</h1>%TMPL:END%
%TMPL:DEF{"webexport::title"}%<h1>%WEBEXPORTTITLE{default="%TOPICTITLE%"}%</h1>%TMPL:END%

%TMPL:DEF{"webexport::formstart"}%%JQREQUIRE{"pdfexport, excelexport"}%
<form action="%SCRIPTURLPATH{"view"}%/%TMPL:P{"web"}%/%TOPIC%" class="jqExportForm">
Expand Down
17 changes: 15 additions & 2 deletions lib/Foswiki/Plugins/ExportPlugin/Excel.pm
Expand Up @@ -64,7 +64,9 @@ sub getTargetPath {
$path .= '/' . $web if defined $web;
$path .= '/' . $topic if defined $topic;

make_path($path);
make_path($path, {
mode => $Foswiki::cfg{Store}{dirPermission}
});
my $file = $path . '/' . $this->getFileName($web, $topic, $rev, $name);

return wantarray ? ($path, $file) : $file;
Expand Down Expand Up @@ -164,6 +166,13 @@ sub exportTopic {
size => 30,
_value => '',
};
} elsif ($fieldName eq 'qmstate') {
$fieldDef = {
name => 'qmstate',
title => 'Status',
size => 30,
_value => '',
};
} elsif ($fieldName eq 'author') {
my $val = Foswiki::Func::getWikiName($author);
$val = Foswiki::Func::getTopicTitle($Foswiki::cfg{UsersWebName}, $val) if $val;
Expand Down Expand Up @@ -271,7 +280,11 @@ sub exportTopic {
}
} else {
# virtual fields
if ($fieldDef->{name} eq 'workflowstate') {
if ($fieldDef->{name} eq 'qmstate') {
require Foswiki::Plugins::QMPlugin;
my $state = Foswiki::Plugins::QMPlugin->getCore->getState($web, $topic);
$fieldValue = $state ? $this->translate($state->getCurrentNode->prop("title")) : '';
} elsif ($fieldDef->{name} eq 'workflowstate') {
my $workflow = $meta->get("WORKFLOW");
$fieldValue = $workflow ? $this->translate($workflow->{name}) : '';
} else {
Expand Down
4 changes: 2 additions & 2 deletions lib/Foswiki/Plugins/ExportPlugin/Pdf.pm
Expand Up @@ -64,8 +64,8 @@ sub exportTopic {
my $result = $this->renderHTML($web, $topic, $meta, $text);

# rewrite some urls to use file://..
#$result =~ s/(<link[^>]+href=["'])([^"']+)(["'])/$1.$this->toFileUrl($2).$3/ge;
#$result =~ s/(<img[^>]+src=["'])([^"']+)(["'])/$1.$this->toFileUrl($2).$3/ge;
$result =~ s/(<link[^>]+href=["'])([^"']+)(["'])/$1.$this->toFileUrl($2).$3/ge;
$result =~ s/(<img[^>]+src=["'])([^"']+)(["'])/$1.$this->toFileUrl($2).$3/ge;

#$this->writeDebug($result);
my $path = $this->{htmlDir}.'/'.$web;
Expand Down
2 changes: 1 addition & 1 deletion locale/ExportPlugin/it.po
Expand Up @@ -848,7 +848,7 @@ msgstr "Titolo:"
#~ "password)"

#~ msgid "Cancel"
#~ msgstr "Rinuncia"
#~ msgstr "Annullare"

#~ msgid "Cancel editing and discard changes"
#~ msgstr "Annulla le modifiche e rinuncia ai cambiamenti"
Expand Down
2 changes: 1 addition & 1 deletion pub/System/ExportPlugin/jquery.excelexport.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion pub/System/ExportPlugin/jquery.excelexport.uncompressed.js
@@ -1,7 +1,7 @@
/*
* jQuery excel export plugin 1.0
*
* Copyright (c) 2020 Michael Daum http://michaeldaumconsulting.com
* Copyright (c) 2020-2022 Michael Daum http://michaeldaumconsulting.com
*
* Licensed under the GPL license http://www.gnu.org/licenses/gpl.html
*
Expand Down

0 comments on commit 4453513

Please sign in to comment.