Commit ee37a095 authored by Xiaowu Zhang's avatar Xiaowu Zhang

erp5_web_renderjs_ui: add support for multirelationfield

parent 7ce7c30c
...@@ -189,8 +189,7 @@ def renderField(field, form_relative_url, meta_type=None, key=None):\n ...@@ -189,8 +189,7 @@ def renderField(field, form_relative_url, meta_type=None, key=None):\n
for subkey in ("year", "month", "day", "hour", "minute", "ampm", "timezone"):\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 result["subfield_%s_key" % subkey] = traversed_document.Field_getSubFieldKeyDict(field, subkey, key=result["key"])\n
\n \n
\n elif meta_type in ("RelationStringField", "MultiRelationStringField"):\n
elif meta_type in ("RelationStringField"):\n
portal_type_list = field.get_value(\'portal_type\')\n portal_type_list = field.get_value(\'portal_type\')\n
if portal_type_list:\n if portal_type_list:\n
portal_type_list = [x[0] for x in portal_type_list]\n portal_type_list = [x[0] for x in portal_type_list]\n
...@@ -201,13 +200,13 @@ def renderField(field, form_relative_url, meta_type=None, key=None):\n ...@@ -201,13 +200,13 @@ def renderField(field, form_relative_url, meta_type=None, key=None):\n
for k, v in field.get_value(\'parameter_list\'):\n for k, v in field.get_value(\'parameter_list\'):\n
kw[k] = v\n kw[k] = v\n
\n \n
accessor_name = \'get%sValue\' % \\\n accessor_name = \'get%sValueList\' % \\\n
\'\'.join([part.capitalize() for part in base_category.split(\'_\')])\n \'\'.join([part.capitalize() for part in base_category.split(\'_\')])\n
jump_reference = getattr(traversed_document, accessor_name)(\n jump_reference_list = getattr(traversed_document, accessor_name)(\n
portal_type=[x[0] for x in field.get_value(\'portal_type\')],\n portal_type=[x[0] for x in field.get_value(\'portal_type\')],\n
\n
filter=kw\n filter=kw\n
)\n )\n
\n
query = url_template_dict["jio_search_template"] % {\n query = url_template_dict["jio_search_template"] % {\n
"query": make_query({"query": sql_catalog.buildQuery(\n "query": make_query({"query": sql_catalog.buildQuery(\n
{"portal_type": portal_type_list}\n {"portal_type": portal_type_list}\n
...@@ -239,8 +238,11 @@ def renderField(field, form_relative_url, meta_type=None, key=None):\n ...@@ -239,8 +238,11 @@ def renderField(field, form_relative_url, meta_type=None, key=None):\n
"item", key=result["key"]\n "item", key=result["key"]\n
)\n )\n
\n \n
if jump_reference:\n if jump_reference_list:\n
result["relation_item_relative_url"] = jump_reference.getRelativeUrl()\n url = [jump_reference.getRelativeUrl() for jump_reference in jump_reference_list]\n
uid = [jump_reference.getUid() for jump_reference in jump_reference_list]\n
result["relation_item_relative_url"] = url\n
result["relation_item_uid"] = uid\n
\n \n
elif meta_type == "CheckBoxField":\n elif meta_type == "CheckBoxField":\n
result = {\n result = {\n
......
...@@ -125,6 +125,8 @@ ...@@ -125,6 +125,8 @@
field_url = \'gadget_erp5_field_string.html\';\n field_url = \'gadget_erp5_field_string.html\';\n
} else if (type === \'RelationStringField\') {\n } else if (type === \'RelationStringField\') {\n
field_url = \'gadget_erp5_field_relationstring.html\';\n field_url = \'gadget_erp5_field_relationstring.html\';\n
} else if (type === \'MultiRelationStringField\') {\n
field_url = \'gadget_erp5_field_multirelationfield.html\';\n
} else if (type === \'TextAreaField\') {\n } else if (type === \'TextAreaField\') {\n
field_url = \'gadget_erp5_field_textarea.html\';\n field_url = \'gadget_erp5_field_textarea.html\';\n
} else if (type === \'DateTimeField\') {\n } else if (type === \'DateTimeField\') {\n
...@@ -251,6 +253,7 @@ ...@@ -251,6 +253,7 @@
if (group[0] !== "bottom") {\n if (group[0] !== "bottom") {\n
field_element.appendChild(label_element);\n field_element.appendChild(label_element);\n
}\n }\n
\n \n
field_url = getFieldTypeGadgetUrl(renderered_field.type);\n field_url = getFieldTypeGadgetUrl(renderered_field.type);\n
\n \n
...@@ -585,7 +588,7 @@ ...@@ -585,7 +588,7 @@
</item> </item>
<item> <item>
<key> <string>serial</string> </key> <key> <string>serial</string> </key>
<value> <string>942.57027.49275.7236</string> </value> <value> <string>943.1808.36899.34116</string> </value>
</item> </item>
<item> <item>
<key> <string>state</string> </key> <key> <string>state</string> </key>
...@@ -603,7 +606,7 @@ ...@@ -603,7 +606,7 @@
</tuple> </tuple>
<state> <state>
<tuple> <tuple>
<float>1431049784.59</float> <float>1432174400.48</float>
<string>UTC</string> <string>UTC</string>
</tuple> </tuple>
</state> </state>
......
...@@ -266,7 +266,7 @@ promiseEventListener */\n ...@@ -266,7 +266,7 @@ promiseEventListener */\n
function setRelationJump(my_gadget, my_initial_call, my_selected_value) {\n function setRelationJump(my_gadget, my_initial_call, my_selected_value) {\n
var props = my_gadget.property_dict,\n var props = my_gadget.property_dict,\n
field_json = props.field_json,\n field_json = props.field_json,\n
target_url = my_selected_value || field_json.relation_item_relative_url,\n target_url = my_selected_value || field_json.relation_item_relative_url[0],\n
is_init = my_initial_call === true;\n is_init = my_initial_call === true;\n
\n \n
if (target_url && field_json.allow_jump) {\n if (target_url && field_json.allow_jump) {\n
...@@ -767,7 +767,7 @@ promiseEventListener */\n ...@@ -767,7 +767,7 @@ promiseEventListener */\n
</item> </item>
<item> <item>
<key> <string>serial</string> </key> <key> <string>serial</string> </key>
<value> <string>942.57468.41646.29286</string> </value> <value> <string>943.11588.15892.23876</string> </value>
</item> </item>
<item> <item>
<key> <string>state</string> </key> <key> <string>state</string> </key>
...@@ -785,7 +785,7 @@ promiseEventListener */\n ...@@ -785,7 +785,7 @@ promiseEventListener */\n
</tuple> </tuple>
<state> <state>
<tuple> <tuple>
<float>1431075656.16</float> <float>1432255062.93</float>
<string>UTC</string> <string>UTC</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