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
Carlos Ramos Carreño
erp5
Commits
8df1f143
Commit
8df1f143
authored
Apr 05, 2013
by
Julien Muchembled
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ERP5Form: fix name of newly-created selections for listboxes that are not rendered in HTML
parent
4327a7db
Changes
12
Show whitespace changes
Inline
Side-by-side
Showing
12 changed files
with
35 additions
and
32 deletions
+35
-32
product/ERP5/bootstrap/erp5_core/SkinTemplateItem/portal_skins/erp5_core/Base_updateListboxSelection.xml
...em/portal_skins/erp5_core/Base_updateListboxSelection.xml
+6
-7
product/ERP5/bootstrap/erp5_core/bt/revision
product/ERP5/bootstrap/erp5_core/bt/revision
+1
-1
product/ERP5Form/ListBox.py
product/ERP5Form/ListBox.py
+5
-3
product/ERP5Form/PlanningBox.py
product/ERP5Form/PlanningBox.py
+2
-1
product/ERP5Form/Report.py
product/ERP5Form/Report.py
+2
-1
product/ERP5Form/Selection.py
product/ERP5Form/Selection.py
+4
-4
product/ERP5Form/Tool/SelectionTool.py
product/ERP5Form/Tool/SelectionTool.py
+5
-7
product/ERP5Form/ZGDChart.py
product/ERP5Form/ZGDChart.py
+1
-1
product/ERP5Form/ZPyChart.py
product/ERP5Form/ZPyChart.py
+1
-1
product/ERP5Form/tests/testListBox.py
product/ERP5Form/tests/testListBox.py
+2
-2
product/ERP5Form/tests/testSelectionTool.py
product/ERP5Form/tests/testSelectionTool.py
+4
-2
product/ERP5OOo/tests/testOOoStyle.py
product/ERP5OOo/tests/testOOoStyle.py
+2
-2
No files found.
product/ERP5/bootstrap/erp5_core/SkinTemplateItem/portal_skins/erp5_core/Base_updateListboxSelection.xml
View file @
8df1f143
...
...
@@ -50,14 +50,13 @@
</item>
<item>
<key>
<string>
_body
</string>
</key>
<value>
<string>
selection_name = context.REQUEST.get(\'list_selection_name\', None
)\n
listbox_uid =context.REQUEST.get(\'listbox_uid\', None)
\n
uids = context.REQUEST.get(\'uids\', None
)\n
<value>
<string>
portal = context.getPortalObject(
)\n
get = portal.REQUEST.get
\n
selection_name = get(\'list_selection_name\'
)\n
\n
if selection_name is not None:\n
context.portal_selections.updateSelectionCheckedUidList(listbox_uid = listbox_uid,\n
uids=uids,\n
selection_name=selection_name)\n
if isinstance(selection_name, basestring):\n
portal.portal_selections.updateSelectionCheckedUidList(\n
selection_name, get(\'listbox_uid\'), get(\'uids\'))\n
</string>
</value>
</item>
<item>
...
...
product/ERP5/bootstrap/erp5_core/bt/revision
View file @
8df1f143
4107
7
4107
8
\ No newline at end of file
product/ERP5Form/ListBox.py
View file @
8df1f143
...
...
@@ -1072,8 +1072,10 @@ class ListBoxRenderer:
# Create a selection, if not present, with the default sort order.
if
selection
is
None
:
selection
=
Selection
(
params
=
dict
(
self
.
getDefaultParamList
()),
default_sort_on
=
self
.
getDefaultSortColumnList
())
selection
=
selection
.
__of__
(
selection_tool
)
selection
=
Selection
(
selection_name
,
params
=
dict
(
self
.
getDefaultParamList
()),
default_sort_on
=
self
.
getDefaultSortColumnList
(),
).
__of__
(
selection_tool
)
# Or make sure all sort arguments are valid.
else
:
# Reset the selection, if specified.
...
...
@@ -2605,8 +2607,8 @@ class ListBoxHTMLRenderer(ListBoxRenderer):
# Make it sure to store the current selection, only if a list method is defined.
list_method
=
self
.
getListMethod
()
selection
=
self
.
getSelection
()
if
list_method
is
not
None
:
selection
=
self
.
getSelection
()
method_path
=
'%s/%s'
%
(
getPath
(
self
.
getContext
()),
self
.
getListMethodName
())
list_url
=
'%s?selection_name=%s'
%
(
self
.
getUrl
(),
self
.
getRequestedSelectionName
())
selection_index
=
self
.
getSelectionIndex
()
...
...
product/ERP5Form/PlanningBox.py
View file @
8df1f143
...
...
@@ -1063,7 +1063,8 @@ class BasicStructure:
#recovering selection if necessary
if
self
.
selection
is
None
:
self
.
selection
=
Selection
(
params
=
{},
default_sort_on
=
self
.
sort
)
self
.
selection
=
Selection
(
self
.
selection_name
,
params
=
{},
default_sort_on
=
self
.
sort
)
self
.
selection
.
edit
(
default_sort_on
=
self
.
sort
)
self
.
getSelectionTool
().
setSelectionSortOrder
(
self
.
selection_name
,
\
...
...
product/ERP5Form/Report.py
View file @
8df1f143
...
...
@@ -338,7 +338,8 @@ class ReportSection:
portal_selections
.
pushSelection
(
selection_name
)
else
:
if
portal_selections
.
getSelectionFor
(
selection_name
)
is
None
:
portal_selections
.
setSelectionFor
(
selection_name
,
Selection
())
portal_selections
.
setSelectionFor
(
selection_name
,
Selection
(
selection_name
))
if
self
.
selection_report_list
is
not
None
:
selection
=
portal_selections
.
getSelectionFor
(
selection_name
,
...
...
product/ERP5Form/Selection.py
View file @
8df1f143
...
...
@@ -104,7 +104,6 @@ class Selection(Acquisition.Implicit, Traversable, Persistent):
list_url
=
''
columns
=
()
checked_uids
=
()
name
=
None
index
=
None
domain_path
=
(
'portal_categories'
,)
domain_list
=
((),)
...
...
@@ -123,9 +122,10 @@ class Selection(Acquisition.Implicit, Traversable, Persistent):
def
getId
(
self
):
return
self
.
name
def
__init__
(
self
,
method_path
=
None
,
params
=
None
,
sort_on
=
None
,
default_sort_on
=
None
,
uids
=
None
,
invert_mode
=
0
,
list_url
=
''
,
domain
=
None
,
report
=
None
,
columns
=
None
,
checked_uids
=
None
,
name
=
None
,
index
=
None
):
def
__init__
(
self
,
name
,
method_path
=
None
,
params
=
None
,
sort_on
=
None
,
default_sort_on
=
None
,
uids
=
None
,
invert_mode
=
0
,
list_url
=
''
,
domain
=
None
,
report
=
None
,
columns
=
None
,
checked_uids
=
None
,
index
=
None
):
if
params
is
None
:
params
=
{}
if
sort_on
is
None
:
sort_on
=
[]
if
default_sort_on
is
None
:
default_sort_on
=
[]
...
...
product/ERP5Form/Tool/SelectionTool.py
View file @
8df1f143
...
...
@@ -284,9 +284,7 @@ class SelectionTool( BaseTool, SimpleItem ):
if
anonymous_uid
is
not
None
:
self
.
REQUEST
.
response
.
setCookie
(
'anonymous_uid'
,
anonymous_uid
,
path
=
'/'
)
if
selection_object
!=
None
:
# Set the name so that this selection itself can get its own name.
selection_object
.
edit
(
name
=
selection_name
)
assert
selection_object
is
None
or
selection_name
==
selection_object
.
name
if
self
.
getSelectionFor
(
selection_name
)
!=
selection_object
:
self
.
_setSelectionToContainer
(
selection_name
,
selection_object
)
...
...
@@ -317,7 +315,7 @@ class SelectionTool( BaseTool, SimpleItem ):
if
selection_object
is
not
None
:
selection_object
.
edit
(
params
=
params
)
else
:
selection_object
=
Selection
(
params
=
params
)
selection_object
=
Selection
(
selection_name
,
params
=
params
)
self
.
setSelectionFor
(
selection_name
,
selection_object
,
REQUEST
)
security
.
declareProtected
(
ERP5Permissions
.
View
,
'getSelectionDomainDictFor'
)
...
...
@@ -353,7 +351,7 @@ class SelectionTool( BaseTool, SimpleItem ):
if
selection_object
:
selection_object
.
edit
(
checked_uids
=
checked_uids
)
else
:
selection_object
=
Selection
(
checked_uids
=
checked_uids
)
selection_object
=
Selection
(
selection_name
,
checked_uids
=
checked_uids
)
self
.
setSelectionFor
(
selection_name
,
selection_object
,
REQUEST
)
security
.
declareProtected
(
ERP5Permissions
.
View
,
'updateSelectionCheckedUidList'
)
...
...
@@ -1062,7 +1060,7 @@ class SelectionTool( BaseTool, SimpleItem ):
# Get the selection
selection
=
self
.
getSelectionFor
(
selection_name
,
REQUEST
)
if
selection
is
None
:
selection
=
Selection
()
selection
=
Selection
(
selection_name
)
self
.
setSelectionFor
(
selection_name
,
selection
,
REQUEST
=
REQUEST
)
if
listbox_display_mode
==
'FlatListMode'
:
...
...
@@ -1443,7 +1441,7 @@ class SelectionTool( BaseTool, SimpleItem ):
def
pushSelection
(
self
,
selection_name
):
selection
=
self
.
getSelectionFor
(
selection_name
)
# a temporary selection is kept in transaction.
temp_selection
=
Selection
()
temp_selection
=
Selection
(
selection_name
)
if
selection
:
temp_selection
.
__dict__
.
update
(
selection
.
__dict__
)
self
.
getTemporarySelectionDict
()
\
...
...
product/ERP5Form/ZGDChart.py
View file @
8df1f143
...
...
@@ -139,7 +139,7 @@ class ZGDChartWidget(Widget.Widget):
# Creation selection if needed
if
selection
is
None
:
selection
=
Selection
(
params
=
data
)
selection
=
Selection
(
selection_name
,
params
=
data
)
else
:
LOG
(
'ZGDChart.render'
,
0
,
'selection is not None'
)
kw
=
{
'params'
:
data
}
...
...
product/ERP5Form/ZPyChart.py
View file @
8df1f143
...
...
@@ -164,7 +164,7 @@ class ZPyChart(ZMIField, PythonScript):
# If selection is None, create a new one
if
selection
is
None
:
selection
=
Selection
()
selection
=
Selection
(
selection_name
)
# Get the data method if defined
if
data_method
is
not
None
:
...
...
product/ERP5Form/tests/testListBox.py
View file @
8df1f143
...
...
@@ -252,8 +252,8 @@ class TestListBox(ERP5TypeTestCase):
portal
.
ListBoxZuite_reset
()
listbox
=
portal
.
FooModule_viewFooList
.
listbox
# XXX isn't Selection automatically created ?
portal
.
portal_selections
.
setSelectionFor
(
listbox
.
get_value
(
'selection_name'
),
Selection
(
))
name
=
listbox
.
get_value
(
'selection_name'
)
portal
.
portal_selections
.
setSelectionFor
(
name
,
Selection
(
name
))
request
=
get_request
()
request
[
'here'
]
=
portal
.
foo_module
...
...
product/ERP5Form/tests/testSelectionTool.py
View file @
8df1f143
...
...
@@ -53,7 +53,8 @@ class TestSelectionTool(ERP5TypeTestCase):
user
=
uf
.
getUserById
(
'manager'
).
__of__
(
uf
)
newSecurityManager
(
None
,
user
)
self
.
portal_selections
=
self
.
getPortal
().
portal_selections
self
.
portal_selections
.
setSelectionFor
(
'test_selection'
,
Selection
())
name
=
'test_selection'
self
.
portal_selections
.
setSelectionFor
(
name
,
Selection
(
name
))
self
.
portal_selections
.
setSelectionParamsFor
(
'test_selection'
,
{
'key'
:
'value'
})
def
testGetSelectionContainer
(
self
):
...
...
@@ -252,7 +253,8 @@ class TestSelectionPersistence(unittest.TestCase):
self
.
cnx
=
self
.
db
.
open
()
self
.
portal_selections
=
\
self
.
cnx
.
root
().
portal_selections
=
SelectionTool
()
self
.
portal_selections
.
setSelectionFor
(
'test_selection'
,
Selection
())
name
=
'test_selection'
self
.
portal_selections
.
setSelectionFor
(
name
,
Selection
(
name
))
transaction
.
commit
()
def
tearDown
(
self
):
...
...
product/ERP5OOo/tests/testOOoStyle.py
View file @
8df1f143
...
...
@@ -82,8 +82,8 @@ class TestOOoStyle(ERP5TypeTestCase, ZopeTestCase.Functional):
self
.
portal
.
changeSkin
(
self
.
skin
)
self
.
validator
=
Validator
()
# make sure selections are empty
self
.
portal
.
portal_selections
.
setSelectionFor
(
'person_module_selection'
,
Selection
(
))
name
=
'person_module_selection'
self
.
portal
.
portal_selections
.
setSelectionFor
(
name
,
Selection
(
name
))
def
setDefaultSitePreference
(
self
):
default_pref
=
self
.
portal
.
portal_preferences
.
default_site_preference
...
...
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