Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
A
ADITO_Update_Upgrade
Manage
Activity
Members
Labels
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Model registry
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
xrm
ADITO_Update_Upgrade
Commits
a9845917
Commit
a9845917
authored
5 years ago
by
Johannes Hörmann
Browse files
Options
Downloads
Patches
Plain Diff
bugfixes in replacement logic
parent
78817caa
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
process/DocumentTemplate_lib/process.js
+12
-29
12 additions, 29 deletions
process/DocumentTemplate_lib/process.js
with
12 additions
and
29 deletions
process/DocumentTemplate_lib/process.js
+
12
−
29
View file @
a9845917
...
...
@@ -55,12 +55,12 @@ function DocumentTemplate(pTemplateContent, pType, pFilename, pResolveSubtemplat
/**
* @return {String} the text of the content
*/
DocumentTemplate
.
prototype
.
toString
=
function
()
DocumentTemplate
.
prototype
.
toString
=
function
(
pWithSubtemplates
)
{
if
(
this
.
_stringCache
==
null
)
{
var
content
=
this
.
_getTemplatedContent
();
var
content
=
this
.
_getTemplatedContent
(
pWithSubtemplates
);
logging
.
log
(
JSON
.
stringify
([
content
],
null
,
"
\t
"
))
if
(
this
.
type
==
DocumentTemplate
.
types
.
PLAIN
)
this
.
_stringCache
=
content
;
else
...
...
@@ -71,21 +71,13 @@ DocumentTemplate.prototype.toString = function ()
DocumentTemplate
.
prototype
.
_resolveEmbeddedTemplate
=
function
()
{
if
(
this
.
content
!=
null
&&
(
this
.
type
==
DocumentTemplate
.
types
.
PLAIN
||
this
.
type
==
DocumentTemplate
.
types
.
TXT
||
this
.
type
==
DocumentTemplate
.
types
.
HTML
))
// currently we support only txt and html as others would need special caution.
if
(
this
.
content
!=
null
&&
(
this
.
type
==
DocumentTemplate
.
types
.
TXT
||
this
.
type
==
DocumentTemplate
.
types
.
HTML
))
{
var
replacedContent
=
""
;
if
(
this
.
type
==
DocumentTemplate
.
types
.
PLAIN
)
{
replacedContent
=
this
.
content
;
}
else
{
replacedContent
=
util
.
decodeBase64String
(
this
.
content
);
}
var
replacedContent
=
util
.
decodeBase64String
(
this
.
content
);
var
templates
=
[];
// then load the possible replacement names
// currently we support only txt and html as others would need special caution.
if
(
this
.
type
==
DocumentTemplate
.
types
.
TXT
||
this
.
type
==
DocumentTemplate
.
types
.
HTML
)
{
templates
=
db
.
table
(
SqlCondition
.
begin
()
...
...
@@ -120,24 +112,15 @@ DocumentTemplate.prototype._resolveEmbeddedTemplate = function ()
replacedContent
=
replacedContent
.
replace
(
"
{@
"
+
pPlaceholder
[
0
]
+
"
@}
"
,
pPlaceholder
[
1
],
"
g
"
)
},
this
);
if
(
this
.
type
==
DocumentTemplate
.
types
.
PLAIN
)
this
.
_subtemplatedContent
=
replacedContent
;
else
this
.
_subtemplatedContent
=
util
.
encodeBase64String
(
replacedContent
);
this
.
_subtemplatedContent
=
util
.
encodeBase64String
(
replacedContent
);
}
}
DocumentTemplate
.
prototype
.
_getTemplatedContent
=
function
()
{
var
content
;
DocumentTemplate
.
prototype
.
_getTemplatedContent
=
function
(
pWithSubtemplates
)
{
if
(
this
.
_subtemplatedContent
!=
null
&&
pWithSubtemplates
)
content
=
this
.
_subtemplatedContent
;
else
content
=
this
.
content
;
if
(
this
.
type
==
DocumentTemplate
.
types
.
PLAIN
)
return
content
;
return
this
.
_subtemplatedContent
;
else
return
util
.
decodeBase64String
(
content
)
;
return
this
.
content
;
}
...
...
@@ -473,9 +456,9 @@ TemplateHelper._getRequiredPlaceholders = function (pTemplate)
var
content
=
""
;
// for eml search the whole file not just the body text as placeholders could be anywhere (e.g. subject)
if
(
pTemplate
.
type
==
DocumentTemplate
.
types
.
EML
)
content
=
pTemplate
.
_getTemplatedContent
();
content
=
pTemplate
.
_getTemplatedContent
(
true
);
else
content
=
pTemplate
.
toString
();
content
=
pTemplate
.
toString
(
true
);
// get special regexp (e.g. to filter '=' in emls)
var
filterRegexpPart
=
TemplateHelper
.
_getSpecialRegexp
(
pTemplate
);
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment