Commit f1050443 authored by Romain Courteaud's avatar Romain Courteaud

erp5_web_renderjs_ui: add first support of datetimefield

parent 85f16dd2
......@@ -8,3 +8,6 @@ def Listbox_getListMethodName(self, field):
return list_method_name
def Field_getSubFieldKeyDict(self, field, id, key=None):
"""XXX"""
return field.generate_subfield_key(id, key=key)
\ No newline at end of file
......@@ -6,10 +6,22 @@
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>_recorded_property_dict</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAI=</string> </persistent>
</value>
</item>
<item>
<key> <string>default_reference</string> </key>
<value> <string>HalStyle</string> </value>
</item>
<item>
<key> <string>description</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>extension.erp5.HalStyle</string> </value>
......@@ -33,7 +45,9 @@
<item>
<key> <string>text_content_warning_message</string> </key>
<value>
<tuple/>
<tuple>
<string>W: 11, 42: Redefining built-in \'id\' (redefined-builtin)</string>
</tuple>
</value>
</item>
<item>
......@@ -43,13 +57,28 @@
<item>
<key> <string>workflow_history</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAI=</string> </persistent>
<persistent> <string encoding="base64">AAAAAAAAAAM=</string> </persistent>
</value>
</item>
</dictionary>
</pickle>
</record>
<record id="2" aka="AAAAAAAAAAI=">
<pickle>
<global name="PersistentMapping" module="Persistence.mapping"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>data</string> </key>
<value>
<dictionary/>
</value>
</item>
</dictionary>
</pickle>
</record>
<record id="3" aka="AAAAAAAAAAM=">
<pickle>
<global name="PersistentMapping" module="Persistence.mapping"/>
</pickle>
......@@ -62,7 +91,7 @@
<item>
<key> <string>component_validation_workflow</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAM=</string> </persistent>
<persistent> <string encoding="base64">AAAAAAAAAAQ=</string> </persistent>
</value>
</item>
</dictionary>
......@@ -71,7 +100,7 @@
</dictionary>
</pickle>
</record>
<record id="3" aka="AAAAAAAAAAM=">
<record id="4" aka="AAAAAAAAAAQ=">
<pickle>
<global name="WorkflowHistoryList" module="Products.ERP5Type.patches.WorkflowTool"/>
</pickle>
......
......@@ -132,9 +132,33 @@ def renderField(field, meta_type=None):\n
"title": field.get_value("title"),\n
"required": field.get_value("required"),\n
}\n
\n
elif meta_type == "DateTimeField":\n
result = {\n
"type": meta_type,\n
"key": field.generate_field_key(),\n
"editable": field.get_value("editable"),\n
"css_class": field.get_value("css_class"),\n
"hidden": field.get_value("hidden"),\n
"description": field.get_value("description"),\n
"title": field.get_value("title"),\n
"required": field.get_value("required"),\n
"date_only": field.get_value("date_only"),\n
"ampm_time_style": field.get_value("ampm_time_style"),\n
"timezone_style": field.get_value("timezone_style"),\n
}\n
date_value = field.get_value("default")\n
if same_type(date_value, DateTime()):\n
# Serialize DateTime\n
date_value = date_value.rfc822()\n
result["default"] = date_value\n
for subkey in ("year", "month", "day", "hour", "minute", "ampm", "timezone"):\n
result["subfield_%s_key" % subkey] = traversed_document.Field_getSubFieldKeyDict(field, subkey, key=result["key"])\n
\n
\n
elif meta_type in ("RelationStringField", "MultiRelationStringField"):\n
\n
portal_type_list = field.get_value(\'portal_type\');\n
portal_type_list = field.get_value(\'portal_type\')\n
if len(portal_type_list) > 0:\n
portal_types = portal_type_list[0]\n
else:\n
......
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="ExternalMethod" module="Products.ExternalMethod.ExternalMethod"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>_function</string> </key>
<value> <string>Field_getSubFieldKeyDict</string> </value>
</item>
<item>
<key> <string>_module</string> </key>
<value> <string>HalStyle</string> </value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>Field_getSubFieldKeyDict</string> </value>
</item>
<item>
<key> <string>title</string> </key>
<value> <string></string> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
......@@ -102,7 +102,7 @@
<value> <string encoding="cdata"><![CDATA[
CACHE MANIFEST\n
# generated on Thu, 05 Feb 2015 08:24:38 +0000\n
# generated on Fri, 06 Feb 2015 15:31:33 +0000\n
# XXX + fonts\n
# images/ajax-loader.gif\n
CACHE:\n
......@@ -135,6 +135,8 @@ gadget_codemirror.js\n
gadget_erp5.css\n
gadget_erp5.html\n
gadget_erp5.js\n
gadget_erp5_field_datetime.html\n
gadget_erp5_field_datetime.js\n
gadget_erp5_field_float.html\n
gadget_erp5_field_float.js\n
gadget_erp5_field_gadget.html\n
......@@ -323,7 +325,7 @@ NETWORK:\n
</item>
<item>
<key> <string>serial</string> </key>
<value> <string>940.49311.8017.44834</string> </value>
<value> <string>940.52129.46198.31044</string> </value>
</item>
<item>
<key> <string>state</string> </key>
......@@ -341,7 +343,7 @@ NETWORK:\n
</tuple>
<state>
<tuple>
<float>1423124678.61</float>
<float>1423236693.75</float>
<string>GMT</string>
</tuple>
</state>
......
......@@ -223,6 +223,8 @@
field_url = \'gadget_erp5_field_relationstring.html\';\n
} else if (renderered_field.type === \'TextAreaField\') {\n
field_url = \'gadget_erp5_field_textarea.html\';\n
} else if (renderered_field.type === \'DateTimeField\') {\n
field_url = \'gadget_erp5_field_datetime.html\';\n
} else if (renderered_field.type === \'FloatField\') {\n
field_url = \'gadget_erp5_field_float.html\';\n
} else if (renderered_field.type === \'ListBox\') {\n
......@@ -487,7 +489,7 @@
</item>
<item>
<key> <string>serial</string> </key>
<value> <string>940.21870.34932.42444</string> </value>
<value> <string>940.49210.11818.8857</string> </value>
</item>
<item>
<key> <string>state</string> </key>
......@@ -505,7 +507,7 @@
</tuple>
<state>
<tuple>
<float>1423061410.81</float>
<float>1423153240.08</float>
<string>GMT</string>
</tuple>
</state>
......
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