From 0d2a8fb209782b72d3618a6066ac971dce67cf08 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A9rome=20Perrin?= <jerome@nexedi.com> Date: Fri, 26 Oct 2007 12:04:48 +0000 Subject: [PATCH] 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 --- product/ERP5Form/ScribusUtils.py | 40 +++++++++++++++++--------------- 1 file changed, 21 insertions(+), 19 deletions(-) diff --git a/product/ERP5Form/ScribusUtils.py b/product/ERP5Form/ScribusUtils.py index c8867d619b..186f6c857b 100644 --- a/product/ERP5Form/ScribusUtils.py +++ b/product/ERP5Form/ScribusUtils.py @@ -43,6 +43,7 @@ from urllib import quote from Products.ERP5.ERP5Site import ERP5Site from Products.Formulator.TALESField import TALESMethod +from Products.Formulator.MethodField import Method # defining global variables # ANFLAG tag # these values can be found in the Scribus document format @@ -146,20 +147,19 @@ class ManageModule: form_list_id = form_view_list_object.id form_list = form_view_list_object.restrictedTraverse(form_list_id) # defining groups for objects listing - form_view_list_object.rename_group('Default','bottom') - default_groups = [] - # adding groups - for group in default_groups: - form_view_list_object.add_group(group) + form_view_list_object.add_group('bottom') # defining module title - title_module = '' + title_module = '' # XXX use module title provided by user for word in module_title.split(): title_module += str(word.capitalize() + ' ') # add listbox field to list the created objects id = 'listbox' title = title_module 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 values_settings = {} values_settings['pt'] = "form_list" @@ -168,18 +168,20 @@ class ManageModule: for key, value in values_settings.items(): setattr(form_view_list_object, key, value) # manage edit property of ListBox - field_attributes = getattr(form_view_list_object,id) - field_attributes.values['lines'] = def_lineNumberInList - # adding field columns - field_attributes.values['columns'] = [('id','ID'), - ('title','Title'), - ('description','Description'), - ('translated_simulation_state','State')] - field_attributes.values['list_action'] = 'list' - field_attributes.values['search'] = 1 - field_attributes.values['select'] = 1 - field_attributes.values['list_method'] = 'searchFolder' - field_attributes.values['selection_name'] = '%s_selection' % module_id + listbox = getattr(form_view_list_object, id) + listbox.manage_edit_xmlrpc( + dict(lines=def_lineNumberInList, + columns=[('id', 'ID'), + ('title', 'Title'), + ('description','Description'), + ('translated_simulation_state','State')], + list_action='list', + search=1, + select=1, + list_method=Method('searchFolder'), + count_method=Method('countFolder'), + selection_name='%s_selection' % module_id)) + security.declarePublic('setObjectForm') def setObjectForm(self, -- 2.30.9