Commit 0d2a8fb2 authored by Jérome Perrin's avatar Jérome Perrin

Use manage_edit_xmlrpc to setup listbox properties correctly, and set some...

Use manage_edit_xmlrpc to setup listbox properties correctly, and set some MethodField.Method manually for list_method and count_method.
Create the ListBox in 'bottom' group



git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@17203 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent aa6478af
...@@ -43,6 +43,7 @@ from urllib import quote ...@@ -43,6 +43,7 @@ from urllib import quote
from Products.ERP5.ERP5Site import ERP5Site from Products.ERP5.ERP5Site import ERP5Site
from Products.Formulator.TALESField import TALESMethod from Products.Formulator.TALESField import TALESMethod
from Products.Formulator.MethodField import Method
# defining global variables # defining global variables
# ANFLAG tag # ANFLAG tag
# these values can be found in the Scribus document format # these values can be found in the Scribus document format
...@@ -146,20 +147,19 @@ class ManageModule: ...@@ -146,20 +147,19 @@ class ManageModule:
form_list_id = form_view_list_object.id form_list_id = form_view_list_object.id
form_list = form_view_list_object.restrictedTraverse(form_list_id) form_list = form_view_list_object.restrictedTraverse(form_list_id)
# defining groups for objects listing # defining groups for objects listing
form_view_list_object.rename_group('Default','bottom') form_view_list_object.add_group('bottom')
default_groups = []
# adding groups
for group in default_groups:
form_view_list_object.add_group(group)
# defining module title # defining module title
title_module = '' title_module = '' # XXX use module title provided by user
for word in module_title.split(): for word in module_title.split():
title_module += str(word.capitalize() + ' ') title_module += str(word.capitalize() + ' ')
# add listbox field to list the created objects # add listbox field to list the created objects
id = 'listbox' id = 'listbox'
title = title_module title = title_module
field_type = 'ListBox' field_type = 'ListBox'
form_view_list_object.manage_addField(id,title,field_type) form_view_list_object.manage_addField(id, title, field_type)
form_view_list_object.move_field_group(['listbox'],
form_view_list_object.group_list[0], 'bottom')
# manage ListBox settings # manage ListBox settings
values_settings = {} values_settings = {}
values_settings['pt'] = "form_list" values_settings['pt'] = "form_list"
...@@ -168,18 +168,20 @@ class ManageModule: ...@@ -168,18 +168,20 @@ class ManageModule:
for key, value in values_settings.items(): for key, value in values_settings.items():
setattr(form_view_list_object, key, value) setattr(form_view_list_object, key, value)
# manage edit property of ListBox # manage edit property of ListBox
field_attributes = getattr(form_view_list_object,id) listbox = getattr(form_view_list_object, id)
field_attributes.values['lines'] = def_lineNumberInList listbox.manage_edit_xmlrpc(
# adding field columns dict(lines=def_lineNumberInList,
field_attributes.values['columns'] = [('id','ID'), columns=[('id', 'ID'),
('title','Title'), ('title', 'Title'),
('description','Description'), ('description','Description'),
('translated_simulation_state','State')] ('translated_simulation_state','State')],
field_attributes.values['list_action'] = 'list' list_action='list',
field_attributes.values['search'] = 1 search=1,
field_attributes.values['select'] = 1 select=1,
field_attributes.values['list_method'] = 'searchFolder' list_method=Method('searchFolder'),
field_attributes.values['selection_name'] = '%s_selection' % module_id count_method=Method('countFolder'),
selection_name='%s_selection' % module_id))
security.declarePublic('setObjectForm') security.declarePublic('setObjectForm')
def setObjectForm(self, def setObjectForm(self,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment