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
Laurent S
erp5
Commits
5ae7e594
Commit
5ae7e594
authored
Jan 08, 2015
by
Jérome Perrin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ods_style: use a script to properly get all editable fields
parent
eadfcdd2
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
99 additions
and
1 deletion
+99
-1
bt5/erp5_ods_style/SkinTemplateItem/portal_skins/erp5_ods_style/Listbox_getEditableFieldDict.xml
...tal_skins/erp5_ods_style/Listbox_getEditableFieldDict.xml
+98
-0
bt5/erp5_ods_style/SkinTemplateItem/portal_skins/erp5_ods_style/listbox_ods_macro.xml
...ateItem/portal_skins/erp5_ods_style/listbox_ods_macro.xml
+1
-1
No files found.
bt5/erp5_ods_style/SkinTemplateItem/portal_skins/erp5_ods_style/Listbox_getEditableFieldDict.xml
0 → 100644
View file @
5ae7e594
<?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>
_body
</string>
</key>
<value>
<string>
request = container.REQUEST\n
\n
# XXX this is a restricted environment available reimplementation of ListboxRenderer.getEditableField\n
editable_columns = set(context.get_value(\'columns\', REQUEST=request)\n
+ context.get_value(\'all_columns\', REQUEST=request))\n
\n
editable_fields = {}\n
\n
def getEditableField(alias):\n
"""Get an editable field for column, using column alias.\n
Return None if a field for this column does not exist.\n
"""\n
field = context\n
original_field_id = field.id\n
while True:\n
for field_id in {original_field_id, field.id}:\n
if field.aq_parent.has_field("%s_%s" % (field_id, alias), include_disabled=1):\n
return field.aq_parent.get_field("%s_%s" % (field_id, alias),\n
include_disabled=1)\n
if field.meta_type != \'ProxyField\':\n
return None\n
# if we are rendering a proxy field, also look for editable fields from\n
# the template field\'s form. This editable field can be prefixed either\n
# by the template field listbox id or by the proxy field listbox id.\n
field = field.getTemplateField().aq_inner\n
\n
for column, _ in editable_columns:\n
field = getEditableField(column)\n
if field is not None:\n
editable_fields[column] = field\n
\n
return editable_fields\n
</string>
</value>
</item>
<item>
<key>
<string>
_params
</string>
</key>
<value>
<string></string>
</value>
</item>
<item>
<key>
<string>
id
</string>
</key>
<value>
<string>
Listbox_getEditableFieldDict
</string>
</value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
bt5/erp5_ods_style/SkinTemplateItem/portal_skins/erp5_ods_style/listbox_ods_macro.xml
View file @
5ae7e594
...
...
@@ -54,7 +54,7 @@
selection_name python: listbox.get_value(\'selection_name\', REQUEST=request);\n
editable_columns python: listbox.get_value(\'editable_columns\', REQUEST=request);\n
untranslatable_columns python: [x[0] for x in listbox.get_value(\'untranslatable_columns\', REQUEST=request)];\n
editable_fields
python: dict([(column[0], getattr(listbox.aq_parent, \'listbox_%s\' % column[0], None)) for column in editable_columns])
;\n
editable_fields
listbox/Listbox_getEditableFieldDict
;\n
selection python: here.portal_selections.getSelectionFor(selection_name, REQUEST=request);\n
is_report_tree_mode selection/report_tree_mode | python: 0;\n
is_domain_tree_mode selection/domain_tree_mode | python: 0;\n
...
...
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