Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
E
erp5_rtl_support
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
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Romain Courteaud
erp5_rtl_support
Commits
53b1792a
Commit
53b1792a
authored
Dec 22, 2017
by
Sven Franck
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
erp5_corporate_identity: use portal-catalog for finding the magical missing image
parent
084ef66c
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
35 additions
and
22 deletions
+35
-22
bt5/erp5_corporate_identity/SkinTemplateItem/portal_skins/erp5_corporate_identity/Base_getThemeDict.py
...portal_skins/erp5_corporate_identity/Base_getThemeDict.py
+14
-22
bt5/erp5_corporate_identity/SkinTemplateItem/portal_skins/erp5_corporate_identity/WebPage_getCustomProxyParameter.py
...rp5_corporate_identity/WebPage_getCustomProxyParameter.py
+21
-0
No files found.
bt5/erp5_corporate_identity/SkinTemplateItem/portal_skins/erp5_corporate_identity/Base_getThemeDict.py
View file @
53b1792a
"""
================================================================================
Create a theme dict for filling templates
================================================================================
=====================================
r
===========================================
"""
# parameters:
# ------------------------------------------------------------------------------
...
...
@@ -20,39 +20,31 @@ font = "default_theme_font_css_url_list"
param
=
"?format=png"
theme_logo_alt
=
"Default Logo"
theme_logo
=
None
theme_logo_url
=
None
theme_logo_relative_url
=
None
theme_logo_description
=
blank
theme_logo_list
=
[]
theme_logo_dict
=
{}
theme_reference
=
None
theme
=
(
context
.
Base_getCustomTemplateProxyParameter
(
"theme"
)
or
context
.
Base_getCustomTemplateParameter
(
"theme"
)
or
context
.
Base_getCustomTemplateParameter
(
"default_company_title"
)
)
if
theme
is
not
None
:
logo_prefix
=
context
.
Base_getCustomTemplateParameter
(
"default_logo_prefix"
)
theme
=
theme
.
lower
()
if
logo_prefix
:
theme_logo_url
=
logo_prefix
+
theme
.
capitalize
()
try
:
theme_logo
=
context
.
restrictedTraverse
(
theme_logo_url
)
theme_logo_relative_url
=
theme_logo_url
# XXX does not work in test-environment
#theme_logo_relative_url = theme_logo.getRelativeUrl()
theme_logo_description
=
theme_logo
.
getDescription
()
except
LookupError
:
#__traceback_info__ = "theme_logo_url: %r" % (theme_logo_url,)
#raise Exception("%s and context: %r" % (theme_logo_url, context.restrictedTraverse(theme_logo_url),))
theme_logo
=
None
theme_logo_prefix
=
context
.
Base_getCustomTemplateParameter
(
"default_logo_prefix"
)
if
theme_logo_prefix
:
theme_reference
=
theme_logo_prefix
+
theme
.
capitalize
()
theme_logo_list
=
context
.
Base_getCustomTemplateProxyParameter
(
"logo"
,
theme_reference
)
if
len
(
theme_logo_list
)
>
0
:
theme_logo_dict
=
theme_logo_list
[
0
]
if
theme
is
None
:
theme
=
"default"
theme_dict
=
{}
theme_dict
[
"theme"
]
=
theme
theme_dict
[
"theme_logo_description"
]
=
theme_logo_description
theme_dict
[
"theme_logo_url"
]
=
(
theme_logo_relative_url
+
param
)
if
theme_logo_relative_url
is
not
None
else
context
.
Base_getCustomTemplateParameter
(
"fallback_image"
)
theme_dict
[
"theme_logo_description"
]
=
theme_logo_dict
.
get
(
"description"
,
blank
)
theme_dict
[
"theme_logo_url"
]
=
context
.
Base_getCustomTemplateParameter
(
"fallback_image"
)
if
theme_logo_dict
.
get
(
"relative_url"
,
None
)
is
not
None
:
theme_dict
[
"theme_logo_url"
]
=
theme_logo_dict
.
get
(
"relative_url"
)
+
param
theme_dict
[
"template_css_url"
]
=
css_path
+
pdf
+
".css"
theme_dict
[
"fallback_img_url"
]
=
context
.
Base_getCustomTemplateParameter
(
"fallback_image"
)
or
blank
theme_dict
[
"theme_css_font_list"
]
=
context
.
Base_getCustomTemplateParameter
(
font
)
or
[]
...
...
bt5/erp5_corporate_identity/SkinTemplateItem/portal_skins/erp5_corporate_identity/WebPage_getCustomProxyParameter.py
View file @
53b1792a
...
...
@@ -8,6 +8,8 @@ portal_type_valid_template_list = ["Web Site", "Web Section", "Web Page", "Lette
portal_type_valid_report_list
=
[
"Project"
,
"Sale Order"
,
"Sale Opportunity"
]
portal_type
=
context
.
getPortalType
()
portal_object
=
context
.
getPortalObject
()
validation_state
=
(
'released'
,
'released_alive'
,
'published'
,
'published_alive'
,
'shared'
,
'shared_alive'
,
'public'
,
'validated'
)
if
REQUEST
is
not
None
:
return
None
...
...
@@ -40,6 +42,16 @@ def populateProductDict(my_product_list):
result_list
.
append
(
output_dict
)
return
result_list
def
populateImageDict
(
my_image_list
):
result_list
=
[]
for
image
in
my_image_list
:
output_dict
=
{}
output_dict
[
"relative_url"
]
=
image
.
getRelativeUrl
()
output_dict
[
"reference"
]
=
image
.
getReference
()
or
err
(
"reference"
)
output_dict
[
"description"
]
=
image
.
getDescription
()
or
err
(
"description"
)
result_list
.
append
(
output_dict
)
return
result_list
def
populateBankDict
(
my_bank_list
):
result_list
=
[]
for
bank
in
my_bank_list
:
...
...
@@ -243,6 +255,15 @@ if pass_parameter is not None and pass_source_data is not None:
uid
=
pass_source_data
))
# ------------------ Theme Logo (Prefix + Theme) -----------------------------
# returns [{logo_dict}] used in themes
if
pass_parameter
==
"logo"
:
return
populateImageDict
(
portal_object
.
portal_catalog
(
portal_type
=
"Image"
,
validation_state
=
validation_state
,
reference
=
pass_source_data
))
# ------------------------- Product (Website) --------------------------------
if
pass_parameter
==
"product"
:
if
pass_flag_site
==
True
:
...
...
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