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): ...@@ -8,3 +8,6 @@ def Listbox_getListMethodName(self, field):
return list_method_name 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 @@ ...@@ -6,10 +6,22 @@
</pickle> </pickle>
<pickle> <pickle>
<dictionary> <dictionary>
<item>
<key> <string>_recorded_property_dict</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAI=</string> </persistent>
</value>
</item>
<item> <item>
<key> <string>default_reference</string> </key> <key> <string>default_reference</string> </key>
<value> <string>HalStyle</string> </value> <value> <string>HalStyle</string> </value>
</item> </item>
<item>
<key> <string>description</string> </key>
<value>
<none/>
</value>
</item>
<item> <item>
<key> <string>id</string> </key> <key> <string>id</string> </key>
<value> <string>extension.erp5.HalStyle</string> </value> <value> <string>extension.erp5.HalStyle</string> </value>
...@@ -33,7 +45,9 @@ ...@@ -33,7 +45,9 @@
<item> <item>
<key> <string>text_content_warning_message</string> </key> <key> <string>text_content_warning_message</string> </key>
<value> <value>
<tuple/> <tuple>
<string>W: 11, 42: Redefining built-in \'id\' (redefined-builtin)</string>
</tuple>
</value> </value>
</item> </item>
<item> <item>
...@@ -43,13 +57,28 @@ ...@@ -43,13 +57,28 @@
<item> <item>
<key> <string>workflow_history</string> </key> <key> <string>workflow_history</string> </key>
<value> <value>
<persistent> <string encoding="base64">AAAAAAAAAAI=</string> </persistent> <persistent> <string encoding="base64">AAAAAAAAAAM=</string> </persistent>
</value> </value>
</item> </item>
</dictionary> </dictionary>
</pickle> </pickle>
</record> </record>
<record id="2" aka="AAAAAAAAAAI="> <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> <pickle>
<global name="PersistentMapping" module="Persistence.mapping"/> <global name="PersistentMapping" module="Persistence.mapping"/>
</pickle> </pickle>
...@@ -62,7 +91,7 @@ ...@@ -62,7 +91,7 @@
<item> <item>
<key> <string>component_validation_workflow</string> </key> <key> <string>component_validation_workflow</string> </key>
<value> <value>
<persistent> <string encoding="base64">AAAAAAAAAAM=</string> </persistent> <persistent> <string encoding="base64">AAAAAAAAAAQ=</string> </persistent>
</value> </value>
</item> </item>
</dictionary> </dictionary>
...@@ -71,7 +100,7 @@ ...@@ -71,7 +100,7 @@
</dictionary> </dictionary>
</pickle> </pickle>
</record> </record>
<record id="3" aka="AAAAAAAAAAM="> <record id="4" aka="AAAAAAAAAAQ=">
<pickle> <pickle>
<global name="WorkflowHistoryList" module="Products.ERP5Type.patches.WorkflowTool"/> <global name="WorkflowHistoryList" module="Products.ERP5Type.patches.WorkflowTool"/>
</pickle> </pickle>
......
...@@ -132,9 +132,33 @@ def renderField(field, meta_type=None):\n ...@@ -132,9 +132,33 @@ def renderField(field, meta_type=None):\n
"title": field.get_value("title"),\n "title": field.get_value("title"),\n
"required": field.get_value("required"),\n "required": field.get_value("required"),\n
}\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 elif meta_type in ("RelationStringField", "MultiRelationStringField"):\n
\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 if len(portal_type_list) > 0:\n
portal_types = portal_type_list[0]\n portal_types = portal_type_list[0]\n
else:\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 @@ ...@@ -102,7 +102,7 @@
<value> <string encoding="cdata"><![CDATA[ <value> <string encoding="cdata"><![CDATA[
CACHE MANIFEST\n 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 # XXX + fonts\n
# images/ajax-loader.gif\n # images/ajax-loader.gif\n
CACHE:\n CACHE:\n
...@@ -135,6 +135,8 @@ gadget_codemirror.js\n ...@@ -135,6 +135,8 @@ gadget_codemirror.js\n
gadget_erp5.css\n gadget_erp5.css\n
gadget_erp5.html\n gadget_erp5.html\n
gadget_erp5.js\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.html\n
gadget_erp5_field_float.js\n gadget_erp5_field_float.js\n
gadget_erp5_field_gadget.html\n gadget_erp5_field_gadget.html\n
...@@ -323,7 +325,7 @@ NETWORK:\n ...@@ -323,7 +325,7 @@ NETWORK:\n
</item> </item>
<item> <item>
<key> <string>serial</string> </key> <key> <string>serial</string> </key>
<value> <string>940.49311.8017.44834</string> </value> <value> <string>940.52129.46198.31044</string> </value>
</item> </item>
<item> <item>
<key> <string>state</string> </key> <key> <string>state</string> </key>
...@@ -341,7 +343,7 @@ NETWORK:\n ...@@ -341,7 +343,7 @@ NETWORK:\n
</tuple> </tuple>
<state> <state>
<tuple> <tuple>
<float>1423124678.61</float> <float>1423236693.75</float>
<string>GMT</string> <string>GMT</string>
</tuple> </tuple>
</state> </state>
......
...@@ -223,6 +223,8 @@ ...@@ -223,6 +223,8 @@
field_url = \'gadget_erp5_field_relationstring.html\';\n field_url = \'gadget_erp5_field_relationstring.html\';\n
} else if (renderered_field.type === \'TextAreaField\') {\n } else if (renderered_field.type === \'TextAreaField\') {\n
field_url = \'gadget_erp5_field_textarea.html\';\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 } else if (renderered_field.type === \'FloatField\') {\n
field_url = \'gadget_erp5_field_float.html\';\n field_url = \'gadget_erp5_field_float.html\';\n
} else if (renderered_field.type === \'ListBox\') {\n } else if (renderered_field.type === \'ListBox\') {\n
...@@ -487,7 +489,7 @@ ...@@ -487,7 +489,7 @@
</item> </item>
<item> <item>
<key> <string>serial</string> </key> <key> <string>serial</string> </key>
<value> <string>940.21870.34932.42444</string> </value> <value> <string>940.49210.11818.8857</string> </value>
</item> </item>
<item> <item>
<key> <string>state</string> </key> <key> <string>state</string> </key>
...@@ -505,7 +507,7 @@ ...@@ -505,7 +507,7 @@
</tuple> </tuple>
<state> <state>
<tuple> <tuple>
<float>1423061410.81</float> <float>1423153240.08</float>
<string>GMT</string> <string>GMT</string>
</tuple> </tuple>
</state> </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