Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
O
officejs-appstore
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
Łukasz Nowak
officejs-appstore
Commits
3995af49
Commit
3995af49
authored
Apr 06, 2017
by
Cédric Le Ninivin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
officejs_base: Add dedicated Static get Document Value to include base reference
parent
842e04c3
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
124 additions
and
0 deletions
+124
-0
bt5/officejs_base/SkinTemplateItem/portal_skins/officejs_base/StaticWebSection_getDocumentValue.py
..._skins/officejs_base/StaticWebSection_getDocumentValue.py
+62
-0
bt5/officejs_base/SkinTemplateItem/portal_skins/officejs_base/StaticWebSection_getDocumentValue.xml
...skins/officejs_base/StaticWebSection_getDocumentValue.xml
+62
-0
No files found.
bt5/officejs_base/SkinTemplateItem/portal_skins/officejs_base/StaticWebSection_getDocumentValue.py
0 → 100644
View file @
3995af49
"""
This script is part of ERP5 Web
ERP5 Web is a business template of ERP5 which provides a way
to create web sites which can display selected
ERP5 contents through multiple custom web layouts.
The default implementation searches for
documents which are in the user language if any
and which reference is equal to the name parameter.
Other implementations are possible: ex. display the last
version in the closest language rather than
the latest version in the user language.
NOTE:
- the portal parameter was introduced to
fix acquisition issues within the _aq_dynamic
lookup from WebSection class.
"""
from
Products.ZSQLCatalog.SQLCatalog
import
SimpleQuery
,
ComplexQuery
if
portal
is
None
:
portal
=
context
.
getPortalObject
()
if
effective_date
is
None
:
if
now
is
None
:
now
=
DateTime
()
effective_date
=
ComplexQuery
(
SimpleQuery
(
effective_date
=
None
),
SimpleQuery
(
effective_date
=
now
,
comparison_operator
=
'<='
),
logical_operator
=
'or'
,
)
# Note: In sorts, NULL is considered lesser than non-NULL. So in descending
# sort, NULLs will be listed after non-NULLs, which is perfect for
# effective_date, which defines the date at which content becomes effective.
# None (NULL) effective date hence means "effective since infinite in te past".
base_sort
=
((
'effective_date'
,
'descending'
),
)
# A list is provided for the default page, in this case no need to add
# the current id
if
isinstance
(
name
,
list
):
name
=
name
[
0
]
else
:
name
=
context
.
getLayoutProperty
(
"configuration_base_reference"
,
""
)
+
name
document_list
=
context
.
searchResults
(
reference
=
name
,
effective_date
=
effective_date
,
sort_on
=
base_sort
,
limit
=
1
,
**
kw
)
if
len
(
document_list
)
==
0
:
# Default returns None
document
=
None
else
:
# Try to get the first page on the list
document
=
document_list
[
0
]
document
=
document
.
getObject
()
# return the web page
return
document
bt5/officejs_base/SkinTemplateItem/portal_skins/officejs_base/StaticWebSection_getDocumentValue.xml
0 → 100644
View file @
3995af49
<?xml version="1.0"?>
<ZopeData>
<record
id=
"1"
aka=
"AAAAAAAAAAE="
>
<pickle>
<global
name=
"PythonScript"
module=
"Products.PythonScripts.PythonScript"
/>
</pickle>
<pickle>
<dictionary>
<item>
<key>
<string>
Script_magic
</string>
</key>
<value>
<int>
3
</int>
</value>
</item>
<item>
<key>
<string>
_bind_names
</string>
</key>
<value>
<object>
<klass>
<global
name=
"NameAssignments"
module=
"Shared.DC.Scripts.Bindings"
/>
</klass>
<tuple/>
<state>
<dictionary>
<item>
<key>
<string>
_asgns
</string>
</key>
<value>
<dictionary>
<item>
<key>
<string>
name_container
</string>
</key>
<value>
<string>
container
</string>
</value>
</item>
<item>
<key>
<string>
name_context
</string>
</key>
<value>
<string>
context
</string>
</value>
</item>
<item>
<key>
<string>
name_m_self
</string>
</key>
<value>
<string>
script
</string>
</value>
</item>
<item>
<key>
<string>
name_subpath
</string>
</key>
<value>
<string>
traverse_subpath
</string>
</value>
</item>
</dictionary>
</value>
</item>
</dictionary>
</state>
</object>
</value>
</item>
<item>
<key>
<string>
_params
</string>
</key>
<value>
<string>
name, portal=None, language=None, validation_state=None, effective_date=None, now=None, **kw
</string>
</value>
</item>
<item>
<key>
<string>
id
</string>
</key>
<value>
<string>
StaticWebSection_getDocumentValue
</string>
</value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
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