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
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Xiaowu Zhang
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
Hide 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 @@
...
@@ -50,14 +50,13 @@
</item>
</item>
<item>
<item>
<key>
<string>
_body
</string>
</key>
<key>
<string>
_body
</string>
</key>
<value>
<string>
selection_name = context.REQUEST.get(\'list_selection_name\', None
)\n
<value>
<string>
portal = context.getPortalObject(
)\n
listbox_uid =context.REQUEST.get(\'listbox_uid\', None)
\n
get = portal.REQUEST.get
\n
uids = context.REQUEST.get(\'uids\', None
)\n
selection_name = get(\'list_selection_name\'
)\n
\n
\n
if selection_name is not None:\n
if isinstance(selection_name, basestring):\n
context.portal_selections.updateSelectionCheckedUidList(listbox_uid = listbox_uid,\n
portal.portal_selections.updateSelectionCheckedUidList(\n
uids=uids,\n
selection_name, get(\'listbox_uid\'), get(\'uids\'))\n
selection_name=selection_name)\n
</string>
</value>
</string>
</value>
</item>
</item>
<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:
...
@@ -1072,8 +1072,10 @@ class ListBoxRenderer:
# Create a selection, if not present, with the default sort order.
# Create a selection, if not present, with the default sort order.
if
selection
is
None
:
if
selection
is
None
:
selection
=
Selection
(
params
=
dict
(
self
.
getDefaultParamList
()),
default_sort_on
=
self
.
getDefaultSortColumnList
())
selection
=
Selection
(
selection_name
,
selection
=
selection
.
__of__
(
selection_tool
)
params
=
dict
(
self
.
getDefaultParamList
()),
default_sort_on
=
self
.
getDefaultSortColumnList
(),
).
__of__
(
selection_tool
)
# Or make sure all sort arguments are valid.
# Or make sure all sort arguments are valid.
else
:
else
:
# Reset the selection, if specified.
# Reset the selection, if specified.
...
@@ -2605,8 +2607,8 @@ class ListBoxHTMLRenderer(ListBoxRenderer):
...
@@ -2605,8 +2607,8 @@ class ListBoxHTMLRenderer(ListBoxRenderer):
# Make it sure to store the current selection, only if a list method is defined.
# Make it sure to store the current selection, only if a list method is defined.
list_method
=
self
.
getListMethod
()
list_method
=
self
.
getListMethod
()
selection
=
self
.
getSelection
()
if
list_method
is
not
None
:
if
list_method
is
not
None
:
selection
=
self
.
getSelection
()
method_path
=
'%s/%s'
%
(
getPath
(
self
.
getContext
()),
self
.
getListMethodName
())
method_path
=
'%s/%s'
%
(
getPath
(
self
.
getContext
()),
self
.
getListMethodName
())
list_url
=
'%s?selection_name=%s'
%
(
self
.
getUrl
(),
self
.
getRequestedSelectionName
())
list_url
=
'%s?selection_name=%s'
%
(
self
.
getUrl
(),
self
.
getRequestedSelectionName
())
selection_index
=
self
.
getSelectionIndex
()
selection_index
=
self
.
getSelectionIndex
()
...
...
product/ERP5Form/PlanningBox.py
View file @
8df1f143
...
@@ -1063,7 +1063,8 @@ class BasicStructure:
...
@@ -1063,7 +1063,8 @@ class BasicStructure:
#recovering selection if necessary
#recovering selection if necessary
if
self
.
selection
is
None
:
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
.
selection
.
edit
(
default_sort_on
=
self
.
sort
)
self
.
getSelectionTool
().
setSelectionSortOrder
(
self
.
selection_name
,
\
self
.
getSelectionTool
().
setSelectionSortOrder
(
self
.
selection_name
,
\
...
...
product/ERP5Form/Report.py
View file @
8df1f143
...
@@ -338,7 +338,8 @@ class ReportSection:
...
@@ -338,7 +338,8 @@ class ReportSection:
portal_selections
.
pushSelection
(
selection_name
)
portal_selections
.
pushSelection
(
selection_name
)
else
:
else
:
if
portal_selections
.
getSelectionFor
(
selection_name
)
is
None
:
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
:
if
self
.
selection_report_list
is
not
None
:
selection
=
portal_selections
.
getSelectionFor
(
selection_name
,
selection
=
portal_selections
.
getSelectionFor
(
selection_name
,
...
...
product/ERP5Form/Selection.py
View file @
8df1f143
...
@@ -104,7 +104,6 @@ class Selection(Acquisition.Implicit, Traversable, Persistent):
...
@@ -104,7 +104,6 @@ class Selection(Acquisition.Implicit, Traversable, Persistent):
list_url
=
''
list_url
=
''
columns
=
()
columns
=
()
checked_uids
=
()
checked_uids
=
()
name
=
None
index
=
None
index
=
None
domain_path
=
(
'portal_categories'
,)
domain_path
=
(
'portal_categories'
,)
domain_list
=
((),)
domain_list
=
((),)
...
@@ -123,9 +122,10 @@ class Selection(Acquisition.Implicit, Traversable, Persistent):
...
@@ -123,9 +122,10 @@ class Selection(Acquisition.Implicit, Traversable, Persistent):
def
getId
(
self
):
def
getId
(
self
):
return
self
.
name
return
self
.
name
def
__init__
(
self
,
method_path
=
None
,
params
=
None
,
sort_on
=
None
,
default_sort_on
=
None
,
def
__init__
(
self
,
name
,
method_path
=
None
,
params
=
None
,
sort_on
=
None
,
uids
=
None
,
invert_mode
=
0
,
list_url
=
''
,
domain
=
None
,
report
=
None
,
default_sort_on
=
None
,
uids
=
None
,
invert_mode
=
0
,
list_url
=
''
,
columns
=
None
,
checked_uids
=
None
,
name
=
None
,
index
=
None
):
domain
=
None
,
report
=
None
,
columns
=
None
,
checked_uids
=
None
,
index
=
None
):
if
params
is
None
:
params
=
{}
if
params
is
None
:
params
=
{}
if
sort_on
is
None
:
sort_on
=
[]
if
sort_on
is
None
:
sort_on
=
[]
if
default_sort_on
is
None
:
default_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 ):
...
@@ -284,9 +284,7 @@ class SelectionTool( BaseTool, SimpleItem ):
if
anonymous_uid
is
not
None
:
if
anonymous_uid
is
not
None
:
self
.
REQUEST
.
response
.
setCookie
(
'anonymous_uid'
,
anonymous_uid
,
self
.
REQUEST
.
response
.
setCookie
(
'anonymous_uid'
,
anonymous_uid
,
path
=
'/'
)
path
=
'/'
)
if
selection_object
!=
None
:
assert
selection_object
is
None
or
selection_name
==
selection_object
.
name
# Set the name so that this selection itself can get its own name.
selection_object
.
edit
(
name
=
selection_name
)
if
self
.
getSelectionFor
(
selection_name
)
!=
selection_object
:
if
self
.
getSelectionFor
(
selection_name
)
!=
selection_object
:
self
.
_setSelectionToContainer
(
selection_name
,
selection_object
)
self
.
_setSelectionToContainer
(
selection_name
,
selection_object
)
...
@@ -317,7 +315,7 @@ class SelectionTool( BaseTool, SimpleItem ):
...
@@ -317,7 +315,7 @@ class SelectionTool( BaseTool, SimpleItem ):
if
selection_object
is
not
None
:
if
selection_object
is
not
None
:
selection_object
.
edit
(
params
=
params
)
selection_object
.
edit
(
params
=
params
)
else
:
else
:
selection_object
=
Selection
(
params
=
params
)
selection_object
=
Selection
(
selection_name
,
params
=
params
)
self
.
setSelectionFor
(
selection_name
,
selection_object
,
REQUEST
)
self
.
setSelectionFor
(
selection_name
,
selection_object
,
REQUEST
)
security
.
declareProtected
(
ERP5Permissions
.
View
,
'getSelectionDomainDictFor'
)
security
.
declareProtected
(
ERP5Permissions
.
View
,
'getSelectionDomainDictFor'
)
...
@@ -353,7 +351,7 @@ class SelectionTool( BaseTool, SimpleItem ):
...
@@ -353,7 +351,7 @@ class SelectionTool( BaseTool, SimpleItem ):
if
selection_object
:
if
selection_object
:
selection_object
.
edit
(
checked_uids
=
checked_uids
)
selection_object
.
edit
(
checked_uids
=
checked_uids
)
else
:
else
:
selection_object
=
Selection
(
checked_uids
=
checked_uids
)
selection_object
=
Selection
(
selection_name
,
checked_uids
=
checked_uids
)
self
.
setSelectionFor
(
selection_name
,
selection_object
,
REQUEST
)
self
.
setSelectionFor
(
selection_name
,
selection_object
,
REQUEST
)
security
.
declareProtected
(
ERP5Permissions
.
View
,
'updateSelectionCheckedUidList'
)
security
.
declareProtected
(
ERP5Permissions
.
View
,
'updateSelectionCheckedUidList'
)
...
@@ -1062,7 +1060,7 @@ class SelectionTool( BaseTool, SimpleItem ):
...
@@ -1062,7 +1060,7 @@ class SelectionTool( BaseTool, SimpleItem ):
# Get the selection
# Get the selection
selection
=
self
.
getSelectionFor
(
selection_name
,
REQUEST
)
selection
=
self
.
getSelectionFor
(
selection_name
,
REQUEST
)
if
selection
is
None
:
if
selection
is
None
:
selection
=
Selection
()
selection
=
Selection
(
selection_name
)
self
.
setSelectionFor
(
selection_name
,
selection
,
REQUEST
=
REQUEST
)
self
.
setSelectionFor
(
selection_name
,
selection
,
REQUEST
=
REQUEST
)
if
listbox_display_mode
==
'FlatListMode'
:
if
listbox_display_mode
==
'FlatListMode'
:
...
@@ -1443,7 +1441,7 @@ class SelectionTool( BaseTool, SimpleItem ):
...
@@ -1443,7 +1441,7 @@ class SelectionTool( BaseTool, SimpleItem ):
def
pushSelection
(
self
,
selection_name
):
def
pushSelection
(
self
,
selection_name
):
selection
=
self
.
getSelectionFor
(
selection_name
)
selection
=
self
.
getSelectionFor
(
selection_name
)
# a temporary selection is kept in transaction.
# a temporary selection is kept in transaction.
temp_selection
=
Selection
()
temp_selection
=
Selection
(
selection_name
)
if
selection
:
if
selection
:
temp_selection
.
__dict__
.
update
(
selection
.
__dict__
)
temp_selection
.
__dict__
.
update
(
selection
.
__dict__
)
self
.
getTemporarySelectionDict
()
\
self
.
getTemporarySelectionDict
()
\
...
...
product/ERP5Form/ZGDChart.py
View file @
8df1f143
...
@@ -139,7 +139,7 @@ class ZGDChartWidget(Widget.Widget):
...
@@ -139,7 +139,7 @@ class ZGDChartWidget(Widget.Widget):
# Creation selection if needed
# Creation selection if needed
if
selection
is
None
:
if
selection
is
None
:
selection
=
Selection
(
params
=
data
)
selection
=
Selection
(
selection_name
,
params
=
data
)
else
:
else
:
LOG
(
'ZGDChart.render'
,
0
,
'selection is not None'
)
LOG
(
'ZGDChart.render'
,
0
,
'selection is not None'
)
kw
=
{
'params'
:
data
}
kw
=
{
'params'
:
data
}
...
...
product/ERP5Form/ZPyChart.py
View file @
8df1f143
...
@@ -164,7 +164,7 @@ class ZPyChart(ZMIField, PythonScript):
...
@@ -164,7 +164,7 @@ class ZPyChart(ZMIField, PythonScript):
# If selection is None, create a new one
# If selection is None, create a new one
if
selection
is
None
:
if
selection
is
None
:
selection
=
Selection
()
selection
=
Selection
(
selection_name
)
# Get the data method if defined
# Get the data method if defined
if
data_method
is
not
None
:
if
data_method
is
not
None
:
...
...
product/ERP5Form/tests/testListBox.py
View file @
8df1f143
...
@@ -252,8 +252,8 @@ class TestListBox(ERP5TypeTestCase):
...
@@ -252,8 +252,8 @@ class TestListBox(ERP5TypeTestCase):
portal
.
ListBoxZuite_reset
()
portal
.
ListBoxZuite_reset
()
listbox
=
portal
.
FooModule_viewFooList
.
listbox
listbox
=
portal
.
FooModule_viewFooList
.
listbox
# XXX isn't Selection automatically created ?
# XXX isn't Selection automatically created ?
portal
.
portal_selections
.
setSelectionFor
(
name
=
listbox
.
get_value
(
'selection_name'
)
listbox
.
get_value
(
'selection_name'
),
Selection
(
))
portal
.
portal_selections
.
setSelectionFor
(
name
,
Selection
(
name
))
request
=
get_request
()
request
=
get_request
()
request
[
'here'
]
=
portal
.
foo_module
request
[
'here'
]
=
portal
.
foo_module
...
...
product/ERP5Form/tests/testSelectionTool.py
View file @
8df1f143
...
@@ -53,7 +53,8 @@ class TestSelectionTool(ERP5TypeTestCase):
...
@@ -53,7 +53,8 @@ class TestSelectionTool(ERP5TypeTestCase):
user
=
uf
.
getUserById
(
'manager'
).
__of__
(
uf
)
user
=
uf
.
getUserById
(
'manager'
).
__of__
(
uf
)
newSecurityManager
(
None
,
user
)
newSecurityManager
(
None
,
user
)
self
.
portal_selections
=
self
.
getPortal
().
portal_selections
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'
})
self
.
portal_selections
.
setSelectionParamsFor
(
'test_selection'
,
{
'key'
:
'value'
})
def
testGetSelectionContainer
(
self
):
def
testGetSelectionContainer
(
self
):
...
@@ -252,7 +253,8 @@ class TestSelectionPersistence(unittest.TestCase):
...
@@ -252,7 +253,8 @@ class TestSelectionPersistence(unittest.TestCase):
self
.
cnx
=
self
.
db
.
open
()
self
.
cnx
=
self
.
db
.
open
()
self
.
portal_selections
=
\
self
.
portal_selections
=
\
self
.
cnx
.
root
().
portal_selections
=
SelectionTool
()
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
()
transaction
.
commit
()
def
tearDown
(
self
):
def
tearDown
(
self
):
...
...
product/ERP5OOo/tests/testOOoStyle.py
View file @
8df1f143
...
@@ -82,8 +82,8 @@ class TestOOoStyle(ERP5TypeTestCase, ZopeTestCase.Functional):
...
@@ -82,8 +82,8 @@ class TestOOoStyle(ERP5TypeTestCase, ZopeTestCase.Functional):
self
.
portal
.
changeSkin
(
self
.
skin
)
self
.
portal
.
changeSkin
(
self
.
skin
)
self
.
validator
=
Validator
()
self
.
validator
=
Validator
()
# make sure selections are empty
# make sure selections are empty
self
.
portal
.
portal_selections
.
setSelectionFor
(
name
=
'person_module_selection'
'person_module_selection'
,
Selection
(
))
self
.
portal
.
portal_selections
.
setSelectionFor
(
name
,
Selection
(
name
))
def
setDefaultSitePreference
(
self
):
def
setDefaultSitePreference
(
self
):
default_pref
=
self
.
portal
.
portal_preferences
.
default_site_preference
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