Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
erp5
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Nikola Balog
erp5
Commits
3a22b69d
Commit
3a22b69d
authored
Jan 22, 2024
by
Jérome Perrin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
corporate_identity: py3
parent
f876f537
Changes
7
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
43 additions
and
35 deletions
+43
-35
bt5/erp5_corporate_identity/SkinTemplateItem/portal_skins/erp5_corporate_identity/Base_viewAsLetter.py
...portal_skins/erp5_corporate_identity/Base_viewAsLetter.py
+2
-2
bt5/erp5_corporate_identity/SkinTemplateItem/portal_skins/erp5_corporate_identity/Base_viewAsReport.py
...portal_skins/erp5_corporate_identity/Base_viewAsReport.py
+3
-3
bt5/erp5_corporate_identity/SkinTemplateItem/portal_skins/erp5_corporate_identity/WebPage_viewAsBook.py
...ortal_skins/erp5_corporate_identity/WebPage_viewAsBook.py
+8
-8
bt5/erp5_corporate_identity/SkinTemplateItem/portal_skins/erp5_corporate_identity/WebPage_viewAsContract.py
...l_skins/erp5_corporate_identity/WebPage_viewAsContract.py
+8
-7
bt5/erp5_corporate_identity/SkinTemplateItem/portal_skins/erp5_corporate_identity/WebPage_viewAsLeaflet.py
...al_skins/erp5_corporate_identity/WebPage_viewAsLeaflet.py
+8
-6
bt5/erp5_corporate_identity/SkinTemplateItem/portal_skins/erp5_corporate_identity/WebPage_viewAsRelease.py
...al_skins/erp5_corporate_identity/WebPage_viewAsRelease.py
+8
-6
bt5/erp5_corporate_identity/SkinTemplateItem/portal_skins/erp5_corporate_identity/WebPage_viewAsSlideshow.py
..._skins/erp5_corporate_identity/WebPage_viewAsSlideshow.py
+6
-3
No files found.
bt5/erp5_corporate_identity/SkinTemplateItem/portal_skins/erp5_corporate_identity/Base_viewAsLetter.py
View file @
3a22b69d
...
@@ -266,8 +266,8 @@ if letter_format == "pdf":
...
@@ -266,8 +266,8 @@ if letter_format == "pdf":
margin_left
=
0
,
margin_left
=
0
,
margin_right
=
0
,
margin_right
=
0
,
header_spacing
=
1
,
header_spacing
=
1
,
header_html_data
=
b64encode
(
header_embedded_html_data
),
header_html_data
=
b64encode
(
header_embedded_html_data
)
.
decode
()
,
footer_html_data
=
b64encode
(
footer_embedded_html_data
),
footer_html_data
=
b64encode
(
footer_embedded_html_data
)
.
decode
()
,
)
)
)
)
...
...
bt5/erp5_corporate_identity/SkinTemplateItem/portal_skins/erp5_corporate_identity/Base_viewAsReport.py
View file @
3a22b69d
...
@@ -269,10 +269,10 @@ if doc_format == "pdf":
...
@@ -269,10 +269,10 @@ if doc_format == "pdf":
margin_bottom
=
20
,
margin_bottom
=
20
,
toc
=
False
,
toc
=
False
,
before_toc_data_list
=
before_toc_data_list
,
before_toc_data_list
=
before_toc_data_list
,
xsl_style_sheet_data
=
b64encode
(
xsl_style_sheet_data
),
xsl_style_sheet_data
=
b64encode
(
xsl_style_sheet_data
)
.
decode
()
,
header_html_data
=
b64encode
(
header_embedded_html_data
),
header_html_data
=
b64encode
(
header_embedded_html_data
)
.
decode
()
,
header_spacing
=
10
,
header_spacing
=
10
,
footer_html_data
=
b64encode
(
footer_embedded_html_data
),
footer_html_data
=
b64encode
(
footer_embedded_html_data
)
.
decode
()
,
footer_spacing
=
3
,
footer_spacing
=
3
,
)
)
default_conversion_kw
.
update
(
conversion_dict
)
default_conversion_kw
.
update
(
conversion_dict
)
...
...
bt5/erp5_corporate_identity/SkinTemplateItem/portal_skins/erp5_corporate_identity/WebPage_viewAsBook.py
View file @
3a22b69d
...
@@ -33,6 +33,7 @@ MAIN FILE: generate book in different output formats
...
@@ -33,6 +33,7 @@ MAIN FILE: generate book in different output formats
# display_svg format for svg images (svg, png*)
# display_svg format for svg images (svg, png*)
import
re
import
re
import
six
from
Products.PythonScripts.standard
import
html_quote
from
Products.PythonScripts.standard
import
html_quote
from
base64
import
b64encode
from
base64
import
b64encode
...
@@ -83,8 +84,7 @@ book_version = html_quote(override_document_version) if override_document_versio
...
@@ -83,8 +84,7 @@ book_version = html_quote(override_document_version) if override_document_versio
book_description
=
html_quote
(
override_document_description
)
if
override_document_description
else
book
.
getDescription
()
book_description
=
html_quote
(
override_document_description
)
if
override_document_description
else
book
.
getDescription
()
book_title
=
html_quote
(
override_document_title
)
if
override_document_title
else
book
.
getTitle
()
book_title
=
html_quote
(
override_document_title
)
if
override_document_title
else
book
.
getTitle
()
# unicode
if
six
.
PY2
and
isinstance
(
book_content
,
unicode
):
if
isinstance
(
book_content
,
unicode
):
book_content
=
book_content
.
encode
(
"UTF-8"
)
book_content
=
book_content
.
encode
(
"UTF-8"
)
# backcompat
# backcompat
...
@@ -359,16 +359,16 @@ elif book_format == "pdf":
...
@@ -359,16 +359,16 @@ elif book_format == "pdf":
# ================ encode and build cloudoo elements =========================
# ================ encode and build cloudoo elements =========================
header_embedded_html_data
=
book
.
Base_convertHtmlToSingleFile
(
book_head
,
allow_script
=
True
)
header_embedded_html_data
=
book
.
Base_convertHtmlToSingleFile
(
book_head
,
allow_script
=
True
)
before_toc_data_list
=
[
before_toc_data_list
=
[
b64encode
(
book
.
Base_convertHtmlToSingleFile
(
book_cover
,
allow_script
=
True
)),
b64encode
(
book
.
Base_convertHtmlToSingleFile
(
book_cover
,
allow_script
=
True
))
.
decode
()
,
]
]
after_toc_data_list
=
[]
after_toc_data_list
=
[]
if
book_include_history_table
:
if
book_include_history_table
:
before_toc_data_list
.
append
(
before_toc_data_list
.
append
(
b64encode
(
book
.
Base_convertHtmlToSingleFile
(
book_history
,
allow_script
=
True
))
b64encode
(
book
.
Base_convertHtmlToSingleFile
(
book_history
,
allow_script
=
True
))
.
decode
()
)
)
#if book_include_reference_table:
#if book_include_reference_table:
# after_toc_data_list.append(
# after_toc_data_list.append(
# b64encode(book.Base_convertHtmlToSingleFile(book_references, allow_script=True))
# b64encode(book.Base_convertHtmlToSingleFile(book_references, allow_script=True))
.decode()
# )
# )
xsl_style_sheet_data
=
book_table_of_content
xsl_style_sheet_data
=
book_table_of_content
embedded_html_data
=
book
.
Base_convertHtmlToSingleFile
(
book_content
,
allow_script
=
True
)
embedded_html_data
=
book
.
Base_convertHtmlToSingleFile
(
book_content
,
allow_script
=
True
)
...
@@ -385,11 +385,11 @@ elif book_format == "pdf":
...
@@ -385,11 +385,11 @@ elif book_format == "pdf":
margin_bottom
=
margin_bottom
,
margin_bottom
=
margin_bottom
,
toc
=
True
if
book_include_content_table
else
False
,
toc
=
True
if
book_include_content_table
else
False
,
before_toc_data_list
=
before_toc_data_list
,
before_toc_data_list
=
before_toc_data_list
,
xsl_style_sheet_data
=
b64encode
(
xsl_style_sheet_data
),
xsl_style_sheet_data
=
b64encode
(
xsl_style_sheet_data
)
.
decode
()
,
after_toc_data_list
=
after_toc_data_list
,
after_toc_data_list
=
after_toc_data_list
,
header_html_data
=
b64encode
(
header_embedded_html_data
),
header_html_data
=
b64encode
(
header_embedded_html_data
)
.
decode
()
,
header_spacing
=
10
,
header_spacing
=
10
,
footer_html_data
=
b64encode
(
footer_embedded_html_data
),
footer_html_data
=
b64encode
(
footer_embedded_html_data
)
.
decode
()
,
footer_spacing
=
3
,
footer_spacing
=
3
,
)
)
)
)
...
...
bt5/erp5_corporate_identity/SkinTemplateItem/portal_skins/erp5_corporate_identity/WebPage_viewAsContract.py
View file @
3a22b69d
import
re
import
re
import
six
from
base64
import
b64encode
from
base64
import
b64encode
...
@@ -35,7 +36,7 @@ contract_version = context.getVersion() or "001"
...
@@ -35,7 +36,7 @@ contract_version = context.getVersion() or "001"
contract_description
=
context
.
getDescription
()
contract_description
=
context
.
getDescription
()
contract_title
=
context
.
getTitle
()
contract_title
=
context
.
getTitle
()
if
isinstance
(
contract_content
,
unicode
):
if
six
.
PY2
and
isinstance
(
contract_content
,
unicode
):
contract_content
=
contract_content
.
encode
(
"UTF-8"
)
contract_content
=
contract_content
.
encode
(
"UTF-8"
)
contract_history_section_list
=
re
.
findall
(
'<section.+?>.+?</section>'
,
contract_content
,
re
.
S
)
contract_history_section_list
=
re
.
findall
(
'<section.+?>.+?</section>'
,
contract_content
,
re
.
S
)
...
@@ -291,16 +292,16 @@ elif contract_format == "pdf":
...
@@ -291,16 +292,16 @@ elif contract_format == "pdf":
# ================ encode and build cloudoo elements =========================
# ================ encode and build cloudoo elements =========================
header_embedded_html_data
=
context
.
Base_convertHtmlToSingleFile
(
contract_head
,
allow_script
=
True
)
header_embedded_html_data
=
context
.
Base_convertHtmlToSingleFile
(
contract_head
,
allow_script
=
True
)
before_toc_data_list
=
[
before_toc_data_list
=
[
b64encode
(
context
.
Base_convertHtmlToSingleFile
(
contract_cover
,
allow_script
=
True
)),
b64encode
(
context
.
Base_convertHtmlToSingleFile
(
contract_cover
,
allow_script
=
True
))
.
decode
()
,
]
]
after_toc_data_list
=
[]
after_toc_data_list
=
[]
if
contract_include_history_table
:
if
contract_include_history_table
:
before_toc_data_list
.
append
(
before_toc_data_list
.
append
(
b64encode
(
context
.
Base_convertHtmlToSingleFile
(
contract_history
,
allow_script
=
True
))
b64encode
(
context
.
Base_convertHtmlToSingleFile
(
contract_history
,
allow_script
=
True
))
.
decode
()
)
)
#if contract_include_reference_table:
#if contract_include_reference_table:
# after_toc_data_list.append(
# after_toc_data_list.append(
# b64encode(context.Base_convertHtmlToSingleFile(contract_references, allow_script=True))
# b64encode(context.Base_convertHtmlToSingleFile(contract_references, allow_script=True))
.decode()
# )
# )
xsl_style_sheet_data
=
contract_table_of_content
xsl_style_sheet_data
=
contract_table_of_content
embedded_html_data
=
context
.
Base_convertHtmlToSingleFile
(
contract_content
,
allow_script
=
True
)
embedded_html_data
=
context
.
Base_convertHtmlToSingleFile
(
contract_content
,
allow_script
=
True
)
...
@@ -313,11 +314,11 @@ elif contract_format == "pdf":
...
@@ -313,11 +314,11 @@ elif contract_format == "pdf":
margin_bottom
=
margin_bottom
,
margin_bottom
=
margin_bottom
,
toc
=
True
if
contract_include_content_table
else
False
,
toc
=
True
if
contract_include_content_table
else
False
,
before_toc_data_list
=
before_toc_data_list
,
before_toc_data_list
=
before_toc_data_list
,
xsl_style_sheet_data
=
b64encode
(
xsl_style_sheet_data
),
xsl_style_sheet_data
=
b64encode
(
xsl_style_sheet_data
)
.
decode
()
,
after_toc_data_list
=
after_toc_data_list
,
after_toc_data_list
=
after_toc_data_list
,
header_html_data
=
b64encode
(
header_embedded_html_data
),
header_html_data
=
b64encode
(
header_embedded_html_data
)
.
decode
()
,
header_spacing
=
10
,
header_spacing
=
10
,
footer_html_data
=
b64encode
(
footer_embedded_html_data
),
footer_html_data
=
b64encode
(
footer_embedded_html_data
)
.
decode
()
,
footer_spacing
=
3
,
footer_spacing
=
3
,
)
)
)
)
...
...
bt5/erp5_corporate_identity/SkinTemplateItem/portal_skins/erp5_corporate_identity/WebPage_viewAsLeaflet.py
View file @
3a22b69d
...
@@ -22,6 +22,7 @@ MAIN FILE: render two pager in different output formats
...
@@ -22,6 +22,7 @@ MAIN FILE: render two pager in different output formats
# document_save: save file in document module (default None)
# document_save: save file in document module (default None)
import
re
import
re
import
six
from
Products.PythonScripts.standard
import
html_quote
from
Products.PythonScripts.standard
import
html_quote
from
base64
import
b64encode
from
base64
import
b64encode
...
@@ -146,10 +147,11 @@ if leaflet_display_side:
...
@@ -146,10 +147,11 @@ if leaflet_display_side:
)
)
#leaflet_content = leaflet_legalese.decode() + leaflet_content.decode()
#leaflet_content = leaflet_legalese.decode() + leaflet_content.decode()
if
isinstance
(
leaflet_legalese
,
unicode
):
if
six
.
PY2
:
leaflet_legalese
=
leaflet_legalese
.
encode
(
"UTF-8"
)
if
isinstance
(
leaflet_legalese
,
unicode
):
if
isinstance
(
leaflet_content
,
unicode
):
leaflet_legalese
=
leaflet_legalese
.
encode
(
"UTF-8"
)
leaflet_content
=
leaflet_content
.
encode
(
"UTF-8"
)
if
isinstance
(
leaflet_content
,
unicode
):
leaflet_content
=
leaflet_content
.
encode
(
"UTF-8"
)
leaflet_content
=
leaflet_legalese
+
leaflet_content
leaflet_content
=
leaflet_legalese
+
leaflet_content
...
@@ -265,9 +267,9 @@ if leaflet_format == "pdf":
...
@@ -265,9 +267,9 @@ if leaflet_format == "pdf":
margin_bottom
=
20
,
margin_bottom
=
20
,
margin_left
=
0
,
margin_left
=
0
,
margin_right
=
0
,
margin_right
=
0
,
header_html_data
=
b64encode
(
header_embedded_html_data
),
header_html_data
=
b64encode
(
header_embedded_html_data
)
.
decode
()
,
header_spacing
=
10
,
header_spacing
=
10
,
footer_html_data
=
b64encode
(
footer_embedded_html_data
),
footer_html_data
=
b64encode
(
footer_embedded_html_data
)
.
decode
()
,
footer_spacing
=
3
footer_spacing
=
3
)
)
)
)
...
...
bt5/erp5_corporate_identity/SkinTemplateItem/portal_skins/erp5_corporate_identity/WebPage_viewAsRelease.py
View file @
3a22b69d
...
@@ -21,6 +21,7 @@ MAIN FILE: render press release in different output formats
...
@@ -21,6 +21,7 @@ MAIN FILE: render press release in different output formats
# document_save: save file in document module (default None)
# document_save: save file in document module (default None)
import
re
import
re
import
six
from
base64
import
b64encode
from
base64
import
b64encode
blank
=
''
blank
=
''
...
@@ -137,10 +138,11 @@ if release_display_about:
...
@@ -137,10 +138,11 @@ if release_display_about:
release_relative_url
=
release_relative_url
,
release_relative_url
=
release_relative_url
,
)
)
#release_content = release_content.decode() + release_about.decode()
#release_content = release_content.decode() + release_about.decode()
if
isinstance
(
release_content
,
unicode
):
if
six
.
PY2
:
release_content
=
release_content
.
encode
(
"UTF-8"
)
if
isinstance
(
release_content
,
unicode
):
if
isinstance
(
release_about
,
unicode
):
release_content
=
release_content
.
encode
(
"UTF-8"
)
release_about
=
release_about
.
encode
(
"UTF-8"
)
if
isinstance
(
release_about
,
unicode
):
release_about
=
release_about
.
encode
(
"UTF-8"
)
release_content
=
release_content
+
release_about
release_content
=
release_content
+
release_about
...
@@ -236,9 +238,9 @@ if release_format == "pdf":
...
@@ -236,9 +238,9 @@ if release_format == "pdf":
margin_bottom
=
20
,
margin_bottom
=
20
,
margin_left
=
0
,
margin_left
=
0
,
margin_right
=
0
,
margin_right
=
0
,
header_html_data
=
b64encode
(
header_embedded_html_data
),
header_html_data
=
b64encode
(
header_embedded_html_data
)
.
decode
()
,
header_spacing
=
10
,
header_spacing
=
10
,
footer_html_data
=
b64encode
(
footer_embedded_html_data
),
footer_html_data
=
b64encode
(
footer_embedded_html_data
)
.
decode
()
,
footer_spacing
=
3
footer_spacing
=
3
)
)
)
)
...
...
bt5/erp5_corporate_identity/SkinTemplateItem/portal_skins/erp5_corporate_identity/WebPage_viewAsSlideshow.py
View file @
3a22b69d
...
@@ -422,15 +422,18 @@ if doc_format == "pdf" or doc_format == "mhtml":
...
@@ -422,15 +422,18 @@ if doc_format == "pdf" or doc_format == "mhtml":
# ================ encode and build cloudoo elements =========================
# ================ encode and build cloudoo elements =========================
footer_embedded_html_data = doc.Base_convertHtmlToSingleFile(doc_slideshow_footer, allow_script=True)
footer_embedded_html_data = doc.Base_convertHtmlToSingleFile(doc_slideshow_footer, allow_script=True)
#embedded_html_data = doc.Base_convertHtmlToSingleFile(doc_slideshow_content, allow_script=True)
#embedded_html_data = doc.Base_convertHtmlToSingleFile(doc_slideshow_content, allow_script=True)
cover = doc.Base_convertHtmlToSingleFile(doc_slideshow_cover, allow_script=True)
if six.PY3:
cover = cover.encode()
before_body_data_list = [
before_body_data_list = [
b64encode(
doc.Base_convertHtmlToSingleFile(doc_slideshow_cover, allow_script=True)
),
b64encode(
cover).decode(
),
]
]
if doc_format == "
mhtml
":
if doc_format == "
mhtml
":
context.REQUEST.RESPONSE.setHeader("
Content
-
Type
", "
text
/
html
;
")
context.REQUEST.RESPONSE.setHeader("
Content
-
Type
", "
text
/
html
;
")
return doc.Base_convertHtmlToSingleFile(doc_slideshow_cover, allow_script=True)
return doc.Base_convertHtmlToSingleFile(doc_slideshow_cover, allow_script=True)
if doc_display_notes:
if doc_display_notes:
#after_body_data_list = [
#after_body_data_list = [
# b64encode(doc.Base_convertHtmlToSingleFile(doc_slideshow_notes, allow_script=True)),
# b64encode(doc.Base_convertHtmlToSingleFile(doc_slideshow_notes, allow_script=True))
.decode()
,
#]
#]
embedded_html_data = doc.Base_convertHtmlToSingleFile(doc_slideshow_notes, allow_script=True)
embedded_html_data = doc.Base_convertHtmlToSingleFile(doc_slideshow_notes, allow_script=True)
after_body_data_list = []
after_body_data_list = []
...
@@ -447,7 +450,7 @@ if doc_format == "pdf" or doc_format == "mhtml":
...
@@ -447,7 +450,7 @@ if doc_format == "pdf" or doc_format == "mhtml":
before_body_data_list=before_body_data_list,
before_body_data_list=before_body_data_list,
after_body_data_list=after_body_data_list,
after_body_data_list=after_body_data_list,
header_spacing=10,
header_spacing=10,
footer_html_data=b64encode(footer_embedded_html_data),
footer_html_data=b64encode(footer_embedded_html_data)
.decode()
,
footer_spacing=3
footer_spacing=3
)
)
)
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment