Commit 8ee02b59 authored by Charles's avatar Charles

Add Data Descriptors to the listbox

parent 9ea10e11
Pipeline #1153 skipped
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="ERP5 Form" module="erp5.portal_type"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>_objects</string> </key>
<value>
<tuple/>
</value>
</item>
<item>
<key> <string>action</string> </key>
<value> <string>Base_doSelect</string> </value>
</item>
<item>
<key> <string>description</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>edit_order</string> </key>
<value>
<list/>
</value>
</item>
<item>
<key> <string>encoding</string> </key>
<value> <string>UTF-8</string> </value>
</item>
<item>
<key> <string>enctype</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>group_list</string> </key>
<value>
<list>
<string>left</string>
<string>right</string>
<string>center</string>
<string>bottom</string>
<string>hidden</string>
</list>
</value>
</item>
<item>
<key> <string>groups</string> </key>
<value>
<dictionary>
<item>
<key> <string>bottom</string> </key>
<value>
<list>
<string>listbox</string>
</list>
</value>
</item>
<item>
<key> <string>center</string> </key>
<value>
<list/>
</value>
</item>
<item>
<key> <string>hidden</string> </key>
<value>
<list/>
</value>
</item>
<item>
<key> <string>left</string> </key>
<value>
<list/>
</value>
</item>
<item>
<key> <string>right</string> </key>
<value>
<list/>
</value>
</item>
</dictionary>
</value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>DataDescriptorModule_viewDataDescriptorList</string> </value>
</item>
<item>
<key> <string>method</string> </key>
<value> <string>POST</string> </value>
</item>
<item>
<key> <string>name</string> </key>
<value> <string>DataDescriptorModule_viewMedaDataDescriptorList</string> </value>
</item>
<item>
<key> <string>pt</string> </key>
<value> <string>form_list</string> </value>
</item>
<item>
<key> <string>row_length</string> </key>
<value> <int>4</int> </value>
</item>
<item>
<key> <string>stored_encoding</string> </key>
<value> <string>UTF-8</string> </value>
</item>
<item>
<key> <string>title</string> </key>
<value> <string>Data Descriptors</string> </value>
</item>
<item>
<key> <string>unicode_mode</string> </key>
<value> <int>0</int> </value>
</item>
<item>
<key> <string>update_action</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>update_action_title</string> </key>
<value> <string></string> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="ProxyField" module="Products.ERP5Form.ProxyField"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>delegated_list</string> </key>
<value>
<list>
<string>all_columns</string>
<string>columns</string>
<string>selection_name</string>
<string>title</string>
</list>
</value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>listbox</string> </value>
</item>
<item>
<key> <string>message_values</string> </key>
<value>
<dictionary>
<item>
<key> <string>external_validator_failed</string> </key>
<value> <string>The input failed the external validator.</string> </value>
</item>
</dictionary>
</value>
</item>
<item>
<key> <string>overrides</string> </key>
<value>
<dictionary>
<item>
<key> <string>field_id</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>form_id</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>target</string> </key>
<value> <string></string> </value>
</item>
</dictionary>
</value>
</item>
<item>
<key> <string>tales</string> </key>
<value>
<dictionary>
<item>
<key> <string>field_id</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>form_id</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>target</string> </key>
<value> <string></string> </value>
</item>
</dictionary>
</value>
</item>
<item>
<key> <string>values</string> </key>
<value>
<dictionary>
<item>
<key> <string>all_columns</string> </key>
<value>
<list>
<tuple>
<string>channel_count</string>
<string>Channel Count</string>
</tuple>
<tuple>
<string>one</string>
<string>two</string>
</tuple>
<tuple>
<string>e1</string>
<string>E1</string>
</tuple>
</list>
</value>
</item>
<item>
<key> <string>columns</string> </key>
<value>
<list>
<tuple>
<string>title</string>
<string>Title</string>
</tuple>
<tuple>
<string>portal_type</string>
<string>Type</string>
</tuple>
<tuple>
<string>date</string>
<string>Date</string>
</tuple>
</list>
</value>
</item>
<item>
<key> <string>field_id</string> </key>
<value> <string>my_list_mode_listbox</string> </value>
</item>
<item>
<key> <string>form_id</string> </key>
<value> <string>Base_viewFieldLibrary</string> </value>
</item>
<item>
<key> <string>portal_type</string> </key>
<value>
<list>
<tuple>
<string>Meda Data Descriptor</string>
<string>Meda Data Descriptor</string>
</tuple>
</list>
</value>
</item>
<item>
<key> <string>selection_name</string> </key>
<value> <string>data_descriptor_module_selection</string> </value>
</item>
<item>
<key> <string>target</string> </key>
<value> <string>Click to edit the target</string> </value>
</item>
<item>
<key> <string>title</string> </key>
<value> <string>listbox</string> </value>
</item>
</dictionary>
</value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
......@@ -13,8 +13,14 @@ fields_ = [field_1, field_2, field_3, field_4, field_5,
field_6, field_7, field_8, field_9, field_10]
field_types_ = [field_1_type, field_2_type, field_3_type, field_4_type, field_5_type,
field_6_type, field_7_type, field_8_type, field_9_type, field_10_type]
ele_types = {'integer':'int', 'string':'string', 'float':'float'}
field_names_ = {'integer':'IntegerField', 'string':'StringField', 'float': 'FloatField'}
#visibility_ = [kw['field_1_visibility'], kw['field_2_visibility'], kw['field_3_visibility'], kw['field_4_visibility'], kw['field_5_visibility'],
# kw['field_6_visibility'], kw['field_7_visibility'], kw['field_8_visibility'], kw['field_9_visibility'], kw['field_10_visibility']]
visibility_ = [field_1_visibility, field_2_visibility, field_3_visibility, field_4_visibility, field_5_visibility,
field_6_visibility, field_7_visibility, field_8_visibility, field_9_visibility, field_10_visibility]
ele_types = {'integer':'int', 'string':'string', 'float':'float', 'date':'date'}
field_names_ = {'integer':'my_integer_field', 'string':'my_string_field', 'float': 'my_float_field', 'date': 'my_date_time_field'}
property_sheets = portal.portal_property_sheets
......@@ -59,9 +65,13 @@ else:
action="string:${object_url}/%s" % module_list_form_id,
action_type="object_list")
#create form
portal_skins_folder_name = "woelfel_viblab_meda"
# Create the skin folder if does not exist yet
portal_skins_folder_name = portal_skins_folder
portal_skins = portal.portal_skins
if not portal_skins_folder_name in portal.portal_skins.objectIds():
portal_skins.manage_addFolder(portal_skins_folder_name)
#create form in the skin folder
skin_folder = portal.portal_skins[portal_skins_folder_name]
factory = skin_folder.manage_addProduct['ERP5Form']
factory.addERP5Form(module_list_form_id, title=data_type_name)
......@@ -86,13 +96,33 @@ else:
field_pt='form_view',
field_edit_order=[]))
#listbox folder
listbox_folder = portal_skins['woelfel_viblab_meda']
view = listbox_folder['DataDescriptorModule_viewDataDescriptorList']
v_listbox = view['listbox']
for i, field_name in enumerate(fields_):
if field_name == "None":
break;
form.manage_addField(
new_field = form.manage_addField(
id='my_' + field_name.lower(),
fieldname= field_names_[field_types_[i]],
title= field_name)
fieldname= 'ProxyField',
title='')
form['my_'+field_name.lower()].manage_edit_xmlrpc(
dict(form_id='Base_viewFieldLibrary',
field_id=field_names_[field_types_[i]]))
form['my_'+field_name.lower()].manage_edit_surcharged_xmlrpc(dict(title=fields_[i]))
new_entry = (field_name.lower(),field_name)
if visibility_[i] == 'column':
column_list = v_listbox.get_value('columns')
elif visibility_[i] == 'm_column':
column_list = v_listbox.get_value('all_columns')
else:
continue
if new_entry not in column_list:
column_list.append(new_entry)
data_descriptor_module=portal_types["Data Descriptor Module"]
data_descriptor_module.setDefaultTypeAllowedContentType(data_type_name)
......@@ -111,3 +141,33 @@ else:
request[ 'RESPONSE' ].redirect( redirect_url )
# portal_skins=portal.portal_skins
# listbox_folder = portal_skins['woelfel_viblab_meda']
# view = listbox_folder['DataDescriptorModule_viewDataDescriptorList']
# v_listbox = view['listbox']
# v_listbox.manage_edit_xmlrpc(dict(title='test title'))
# for i, field_name in enumerate(fields_):
# if field_name == "None":
# break;
# new_entry = (field_name.lower(),field_name)
# if visibility_[i] == 'column':
# column_list = v_listbox.get_value('columns')
# elif visibility_[i] == 'm_column':
# column_list = v_listbox.get_value('all_columns')
# else:
# break;
# if new_entry not in column_list:
# print visibility_[i]
# column_list.append(new_entry)
# else:
# print 'error'
# print 'success'
# print column_list
# return printed
......@@ -50,7 +50,7 @@
</item>
<item>
<key> <string>_params</string> </key>
<value> <string>data_type_name, descriptor_id, property_sheet_name, field_1, field_1_type, field_2, field_2_type, field_3, field_3_type, field_4, field_4_type, field_5, field_5_type, field_6, field_6_type, field_7, field_7_type, field_8, field_8_type, field_9, field_9_type, field_10, field_10_type, form_id=\'\', **kw</string> </value>
<value> <string>data_type_name, descriptor_id, property_sheet_name, portal_skins_folder, field_1, field_1_type, field_2, field_2_type, field_3, field_3_type, field_4, field_4_type, field_5, field_5_type, field_6, field_6_type, field_7, field_7_type, field_8, field_8_type, field_9, field_9_type, field_10, field_10_type, field_1_visibility, field_2_visibility, field_3_visibility, field_4_visibility, field_5_visibility, field_6_visibility, field_7_visibility, field_8_visibility, field_9_visibility, field_10_visibility, form_id=\'\', **kw</string> </value>
</item>
<item>
<key> <string>id</string> </key>
......
......@@ -39,8 +39,8 @@
<value>
<list>
<string>left</string>
<string>right</string>
<string>center</string>
<string>right</string>
<string>bottom</string>
<string>bottom R</string>
</list>
......@@ -72,9 +72,11 @@
<key> <string>left</string> </key>
<value>
<list>
<string>your_description</string>
<string>your_data_type_name</string>
<string>your_descriptor_id</string>
<string>your_property_sheet_name</string>
<string>your_portal_skins_folder</string>
</list>
</value>
</item>
......@@ -82,26 +84,37 @@
<key> <string>right</string> </key>
<value>
<list>
<string>your_description2</string>
<string>your_field_1</string>
<string>your_field_1_type</string>
<string>your_field_1_visibility</string>
<string>your_field_2</string>
<string>your_field_2_type</string>
<string>your_field_2_visibility</string>
<string>your_field_3</string>
<string>your_field_3_type</string>
<string>your_field_3_visibility</string>
<string>your_field_4</string>
<string>your_field_4_type</string>
<string>your_field_4_visibility</string>
<string>your_field_5</string>
<string>your_field_5_type</string>
<string>your_field_5_visibility</string>
<string>your_field_6</string>
<string>your_field_6_type</string>
<string>your_field_6_visibility</string>
<string>your_field_7</string>
<string>your_field_7_type</string>
<string>your_field_7_visibility</string>
<string>your_field_8</string>
<string>your_field_8_type</string>
<string>your_field_8_visibility</string>
<string>your_field_9</string>
<string>your_field_9_type</string>
<string>your_field_9_visibility</string>
<string>your_field_10</string>
<string>your_field_10_type</string>
<string>your_field_10_visibility</string>
</list>
</value>
</item>
......
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="LabelField" module="Products.Formulator.StandardFields"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>id</string> </key>
<value> <string>your_description</string> </value>
</item>
<item>
<key> <string>message_values</string> </key>
<value>
<dictionary/>
</value>
</item>
<item>
<key> <string>overrides</string> </key>
<value>
<dictionary>
<item>
<key> <string>css_class</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>default</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>description</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>editable</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>enabled</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>extra</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>hidden</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>title</string> </key>
<value> <string></string> </value>
</item>
</dictionary>
</value>
</item>
<item>
<key> <string>tales</string> </key>
<value>
<dictionary>
<item>
<key> <string>css_class</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>default</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>description</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>editable</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>enabled</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>extra</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>hidden</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>title</string> </key>
<value> <string></string> </value>
</item>
</dictionary>
</value>
</item>
<item>
<key> <string>values</string> </key>
<value>
<dictionary>
<item>
<key> <string>css_class</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>default</string> </key>
<value> <string>Name a new data descriptor type and property sheet.</string> </value>
</item>
<item>
<key> <string>description</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>editable</string> </key>
<value> <int>1</int> </value>
</item>
<item>
<key> <string>enabled</string> </key>
<value> <int>1</int> </value>
</item>
<item>
<key> <string>extra</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>hidden</string> </key>
<value> <int>0</int> </value>
</item>
<item>
<key> <string>title</string> </key>
<value> <string>Instructions</string> </value>
</item>
</dictionary>
</value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="ProxyField" module="Products.ERP5Form.ProxyField"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>delegated_list</string> </key>
<value>
<list>
<string>default</string>
<string>title</string>
</list>
</value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>your_description2</string> </value>
</item>
<item>
<key> <string>message_values</string> </key>
<value>
<dictionary>
<item>
<key> <string>external_validator_failed</string> </key>
<value> <string>The input failed the external validator.</string> </value>
</item>
</dictionary>
</value>
</item>
<item>
<key> <string>overrides</string> </key>
<value>
<dictionary>
<item>
<key> <string>field_id</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>form_id</string> </key>
<value> <string></string> </value>
</item>
</dictionary>
</value>
</item>
<item>
<key> <string>tales</string> </key>
<value>
<dictionary>
<item>
<key> <string>field_id</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>form_id</string> </key>
<value> <string></string> </value>
</item>
</dictionary>
</value>
</item>
<item>
<key> <string>values</string> </key>
<value>
<dictionary>
<item>
<key> <string>default</string> </key>
<value> <string>Name the fields and their respective types that will be used for the new data descriptor type.\n
\n
Leave the name as "None" to leave the fields blank.\n
\n
Mark the visibility if you would like to see the values in the \'Data Descriptors\' listbox.</string> </value>
</item>
<item>
<key> <string>field_id</string> </key>
<value> <string>my_label_field</string> </value>
</item>
<item>
<key> <string>form_id</string> </key>
<value> <string>Base_viewFieldLibrary</string> </value>
</item>
<item>
<key> <string>title</string> </key>
<value> <string>Data Descriptor Fields</string> </value>
</item>
</dictionary>
</value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
......@@ -243,6 +243,10 @@
<string>String</string>
<string>string</string>
</tuple>
<tuple>
<string>Date</string>
<string>date</string>
</tuple>
</list>
</value>
</item>
......
......@@ -243,6 +243,10 @@
<string>String</string>
<string>string</string>
</tuple>
<tuple>
<string>Date</string>
<string>date</string>
</tuple>
</list>
</value>
</item>
......
......@@ -243,6 +243,10 @@
<string>String</string>
<string>string</string>
</tuple>
<tuple>
<string>Date</string>
<string>date</string>
</tuple>
</list>
</value>
</item>
......
......@@ -243,6 +243,10 @@
<string>String</string>
<string>string</string>
</tuple>
<tuple>
<string>Date</string>
<string>date</string>
</tuple>
</list>
</value>
</item>
......
......@@ -243,6 +243,10 @@
<string>String</string>
<string>string</string>
</tuple>
<tuple>
<string>Date</string>
<string>date</string>
</tuple>
</list>
</value>
</item>
......
......@@ -243,6 +243,10 @@
<string>String</string>
<string>string</string>
</tuple>
<tuple>
<string>Date</string>
<string>date</string>
</tuple>
</list>
</value>
</item>
......
......@@ -243,6 +243,10 @@
<string>String</string>
<string>string</string>
</tuple>
<tuple>
<string>Date</string>
<string>date</string>
</tuple>
</list>
</value>
</item>
......
......@@ -243,6 +243,10 @@
<string>String</string>
<string>string</string>
</tuple>
<tuple>
<string>Date</string>
<string>date</string>
</tuple>
</list>
</value>
</item>
......
......@@ -243,6 +243,10 @@
<string>String</string>
<string>string</string>
</tuple>
<tuple>
<string>Date</string>
<string>date</string>
</tuple>
</list>
</value>
</item>
......
......@@ -243,6 +243,10 @@
<string>String</string>
<string>string</string>
</tuple>
<tuple>
<string>Date</string>
<string>date</string>
</tuple>
</list>
</value>
</item>
......
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="ProxyField" module="Products.ERP5Form.ProxyField"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>delegated_list</string> </key>
<value>
<list>
<string>default</string>
<string>items</string>
<string>required</string>
<string>title</string>
</list>
</value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>your_portal_skins_folder</string> </value>
</item>
<item>
<key> <string>message_values</string> </key>
<value>
<dictionary>
<item>
<key> <string>external_validator_failed</string> </key>
<value> <string>The input failed the external validator.</string> </value>
</item>
</dictionary>
</value>
</item>
<item>
<key> <string>overrides</string> </key>
<value>
<dictionary>
<item>
<key> <string>field_id</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>form_id</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>target</string> </key>
<value> <string></string> </value>
</item>
</dictionary>
</value>
</item>
<item>
<key> <string>tales</string> </key>
<value>
<dictionary>
<item>
<key> <string>field_id</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>form_id</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>items</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAI=</string> </persistent>
</value>
</item>
<item>
<key> <string>target</string> </key>
<value> <string></string> </value>
</item>
</dictionary>
</value>
</item>
<item>
<key> <string>values</string> </key>
<value>
<dictionary>
<item>
<key> <string>default</string> </key>
<value> <string>data_descriptors</string> </value>
</item>
<item>
<key> <string>field_id</string> </key>
<value> <string>my_list_field</string> </value>
</item>
<item>
<key> <string>form_id</string> </key>
<value> <string>Base_viewFieldLibrary</string> </value>
</item>
<item>
<key> <string>items</string> </key>
<value>
<list/>
</value>
</item>
<item>
<key> <string>required</string> </key>
<value> <int>1</int> </value>
</item>
<item>
<key> <string>target</string> </key>
<value> <string>Click to edit the target</string> </value>
</item>
<item>
<key> <string>title</string> </key>
<value> <string>Portal Skin Folder</string> </value>
</item>
</dictionary>
</value>
</item>
</dictionary>
</pickle>
</record>
<record id="2" aka="AAAAAAAAAAI=">
<pickle>
<global name="TALESMethod" module="Products.Formulator.TALESField"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>_text</string> </key>
<value> <string>python: sorted([(x, x) for x in here.getPortalObject().portal_skins.objectIds(spec=\'Folder\')])</string> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
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