Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
W
wendelin
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
Charles
wendelin
Commits
9ea10e11
Commit
9ea10e11
authored
Jul 08, 2016
by
Charles
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added checks for existing portal_type, property_sheet names
parent
1cd8b3cd
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
87 additions
and
153 deletions
+87
-153
bt5/erp5_wendelin_development/SkinTemplateItem/portal_skins/erp5_wendelin_development/DataDescriptor_createDataDescriptorType.py
...in_development/DataDescriptor_createDataDescriptorType.py
+86
-67
bt5/erp5_wendelin_development/SkinTemplateItem/portal_skins/erp5_wendelin_development/DataDescriptor_createDataDescriptorType.xml
...n_development/DataDescriptor_createDataDescriptorType.xml
+1
-1
bt5/erp5_wendelin_development/SkinTemplateItem/portal_skins/erp5_wendelin_development/DataDescriptor_viewCreateDataDescriptorTypeDialog.xml
...ent/DataDescriptor_viewCreateDataDescriptorTypeDialog.xml
+0
-1
bt5/erp5_wendelin_development/SkinTemplateItem/portal_skins/erp5_wendelin_development/DataDescriptor_viewCreateDataDescriptorTypeDialog/your_descriptor_portal_type.xml
...eDataDescriptorTypeDialog/your_descriptor_portal_type.xml
+0
-84
No files found.
bt5/erp5_wendelin_development/SkinTemplateItem/portal_skins/erp5_wendelin_development/DataDescriptor_createDataDescriptorType.py
View file @
9ea10e11
...
...
@@ -13,82 +13,101 @@ 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'
,
'F
loat'
:
'float'
}
field_names_
=
{
'
Integer'
:
'IntegerField'
,
'String'
:
'StringField'
,
'F
loat'
:
'FloatField'
}
ele_types
=
{
'
integer'
:
'int'
,
'string'
:
'string'
,
'f
loat'
:
'float'
}
field_names_
=
{
'
integer'
:
'IntegerField'
,
'string'
:
'StringField'
,
'f
loat'
:
'FloatField'
}
property_sheets
=
portal
.
portal_property_sheets
# Create new property sheet with fields
module_new_property_sheet
=
property_sheets
.
newContent
(
id
=
property_sheet_name
)
for
i
,
field_name
in
enumerate
(
fields_
):
if
field_name
==
"None"
:
break
;
module_new_property_sheet
.
newContent
(
portal_type
=
'Standard Property'
,
reference
=
field_name
,
elementary_type
=
ele_types
[
field_types_
[
i
]])
failed_message
=
""
failed
=
None
if
failed
or
property_sheet_name
in
property_sheets
:
failed_message
+=
"Property+sheet+name+already+taken. "
failed
=
1
else
:
module_new_property_sheet
=
property_sheets
.
newContent
(
id
=
property_sheet_name
)
for
i
,
field_name
in
enumerate
(
fields_
):
if
field_name
==
"None"
:
break
;
module_new_property_sheet
.
newContent
(
portal_type
=
'Standard Property'
,
reference
=
field_name
,
elementary_type
=
ele_types
[
field_types_
[
i
]])
#create new portal type
module_portal_type_value
=
portal_types
.
newContent
(
id
=
descriptor_portal_type
,
portal_type
=
'Base Type'
,
type_factory_method_id
=
'Item'
,
type_property_Sheet
=
property_sheet_name
)
#adding a view
module_portal_type_value
.
setTranslationDomain
(
'title'
,
'erp5_ui'
)
module_portal_type_value
.
setTranslationDomain
(
'short_title'
,
'erp5_ui'
)
module_list_form_id
=
(
'%s_view%s'
%
(
"DataDescriptor"
,
descriptor_portal_type
)).
replace
(
' '
,
''
)
module_portal_type_value
.
newContent
(
portal_type
=
'Action Information'
,
reference
=
"view"
,
title
=
"View"
,
action
=
"string:${object_url}/%s"
%
module_list_form_id
,
action_type
=
"object_list"
)
if
failed
or
descriptor_id
in
portal_types
:
failed_message
+=
"Property+type+name+already+taken
\
n
"
failed
=
1
else
:
module_portal_type_value
=
portal_types
.
newContent
(
id
=
descriptor_id
,
title
=
data_type_name
,
portal_type
=
'Base Type'
,
type_class
=
'Item'
,
type_property_Sheet
=
property_sheet_name
)
#adding a view
module_portal_type_value
.
setTranslationDomain
(
'title'
,
'erp5_ui'
)
module_portal_type_value
.
setTranslationDomain
(
'short_title'
,
'erp5_ui'
)
module_list_form_id
=
(
'%s_view%s'
%
(
"DataDescriptor"
,
data_type_name
)).
replace
(
' '
,
''
)
module_portal_type_value
.
newContent
(
portal_type
=
'Action Information'
,
reference
=
"view"
,
title
=
"View"
,
action
=
"string:${object_url}/%s"
%
module_list_form_id
,
action_type
=
"object_list"
)
#create form
portal_skins_folder_name
=
"woelfel_viblab_meda"
portal_skins
=
portal
.
portal_skins
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
)
form
=
skin_folder
[
module_list_form_id
]
default_groups
=
[
'bottom'
,
'hidden'
]
for
group
in
default_groups
:
form
.
add_group
(
group
)
portal_skins_folder_name
=
"woelfel_viblab_meda"
portal_skins
=
portal
.
portal_skins
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
)
form
=
skin_folder
[
module_list_form_id
]
default_groups
=
[
'bottom'
,
'hidden'
]
for
group
in
default_groups
:
form
.
add_group
(
group
)
form
.
manage_settings
(
dict
(
field_title
=
form
.
title
,
field_name
=
form
.
name
,
field_description
=
form
.
description
,
field_action
=
'Base_edit'
,
field_update_action
=
form
.
update_action
,
field_update_action_title
=
form
.
update_action_title
,
field_enctype
=
form
.
enctype
,
field_encoding
=
form
.
encoding
,
field_stored_encoding
=
form
.
stored_encoding
,
field_unicode_mode
=
form
.
unicode_mode
,
field_method
=
form
.
method
,
field_row_length
=
str
(
form
.
row_length
),
field_pt
=
'form_view'
,
field_edit_order
=
[]))
form
.
manage_settings
(
dict
(
field_title
=
form
.
title
,
field_name
=
form
.
name
,
field_description
=
form
.
description
,
field_action
=
'Base_edit'
,
field_update_action
=
form
.
update_action
,
field_update_action_title
=
form
.
update_action_title
,
field_enctype
=
form
.
enctype
,
field_encoding
=
form
.
encoding
,
field_stored_encoding
=
form
.
stored_encoding
,
field_unicode_mode
=
form
.
unicode_mode
,
field_method
=
form
.
method
,
field_row_length
=
str
(
form
.
row_length
),
field_pt
=
'form_view'
,
field_edit_order
=
[]))
for
i
,
field_name
in
enumerate
(
fields_
):
if
field_name
==
"None"
:
break
;
form
.
manage_addField
(
id
=
'my_'
+
field_name
.
lower
(),
fieldname
=
field_names_
[
field_types_
[
i
]],
title
=
field_name
)
for
i
,
field_name
in
enumerate
(
fields_
):
if
field_name
==
"None"
:
break
;
form
.
manage_addField
(
id
=
'my_'
+
field_name
.
lower
(),
fieldname
=
field_names_
[
field_types_
[
i
]],
title
=
field_name
)
data_descriptor_module
=
portal_types
[
"Data Descriptor Module"
]
data_descriptor_module
.
setDefaultTypeAllowedContentType
(
data_type_name
)
k
=
portal_types
[
"Data Descriptor Module"
]
p
=
k
.
setDefaultTypeAllowedContentType
(
descriptor_portal_type
)
p
=
"Property Sheet, {} created!
\
n
Portal type {} created!"
.
format
(
property_sheet_name
,
descriptor_portal_type
)
print
p
#editing stuff in the portal type
# redirect to page saying created
if
failed
:
redirect_url
=
'%s/%s?%s'
%
(
context
.
absolute_url
()
,
form_id
,
'portal_status_message='
+
failed_message
)
else
:
redirect_url
=
'%s/%s?%s'
%
(
context
.
absolute_url
()
,
form_id
,
'portal_status_message=Data+Descriptor+Created.'
)
# Return a string identifying this script.
return
printed
request
[
'RESPONSE'
].
redirect
(
redirect_url
)
bt5/erp5_wendelin_development/SkinTemplateItem/portal_skins/erp5_wendelin_development/DataDescriptor_createDataDescriptorType.xml
View file @
9ea10e11
...
...
@@ -50,7 +50,7 @@
</item>
<item>
<key>
<string>
_params
</string>
</key>
<value>
<string>
data_type_name, descriptor_id,
descriptor_portal_type,
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, 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>
</item>
<item>
<key>
<string>
id
</string>
</key>
...
...
bt5/erp5_wendelin_development/SkinTemplateItem/portal_skins/erp5_wendelin_development/DataDescriptor_viewCreateDataDescriptorTypeDialog.xml
View file @
9ea10e11
...
...
@@ -73,7 +73,6 @@
<value>
<list>
<string>
your_data_type_name
</string>
<string>
your_descriptor_portal_type
</string>
<string>
your_descriptor_id
</string>
<string>
your_property_sheet_name
</string>
</list>
...
...
bt5/erp5_wendelin_development/SkinTemplateItem/portal_skins/erp5_wendelin_development/DataDescriptor_viewCreateDataDescriptorTypeDialog/your_descriptor_portal_type.xml
deleted
100644 → 0
View file @
1cd8b3cd
<?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>
title
</string>
</list>
</value>
</item>
<item>
<key>
<string>
id
</string>
</key>
<value>
<string>
your_descriptor_portal_type
</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>
field_id
</string>
</key>
<value>
<string>
my_string_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>
Descriptor Portal Type
</string>
</value>
</item>
</dictionary>
</value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
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