Commit 08c6fddc authored by Ivan Tyagov's avatar Ivan Tyagov

Use field_prefix concept introduced in r43459

git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@43460 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 7f23b152
...@@ -65,8 +65,8 @@ if editable_mode:\n ...@@ -65,8 +65,8 @@ if editable_mode:\n
else:\n else:\n
editable_mode = 0\n editable_mode = 0\n
\n \n
js_update_code = """updater(\'%s\', \'%s\', \'%s\', \'%s\', %s);""" %(url, box_relative_url, dom_id, \n js_update_code = """updater(\'%s\', \'%s\', \'%s\', \'%s\', %s, field_prefix=\'%s\');""" %(url, box_relative_url, dom_id, \n
editable_mode, encodeInJson(params))\n editable_mode, encodeInJson(params), field_prefix)\n
if box.getValidationState()==\'invisible\':\n if box.getValidationState()==\'invisible\':\n
# we can generate \n # we can generate \n
javascript_code = """invisible_gadgets["%s"]="%s";""" %(dom_id, js_update_code)\n javascript_code = """invisible_gadgets["%s"]="%s";""" %(dom_id, js_update_code)\n
...@@ -78,7 +78,7 @@ return javascript_code\n ...@@ -78,7 +78,7 @@ return javascript_code\n
</item> </item>
<item> <item>
<key> <string>_params</string> </key> <key> <string>_params</string> </key>
<value> <string>url, box, dom_id, params={}, ignore_security_check=0</string> </value> <value> <string>url, box, dom_id, params={}, ignore_security_check=0, field_prefix=\'\'</string> </value>
</item> </item>
<item> <item>
<key> <string>id</string> </key> <key> <string>id</string> </key>
......
...@@ -12,7 +12,7 @@ ...@@ -12,7 +12,7 @@
</item> </item>
<item> <item>
<key> <string>_EtagSupport__etag</string> </key> <key> <string>_EtagSupport__etag</string> </key>
<value> <string>ts97860745.08</string> </value> <value> <string>ts98018584.53</string> </value>
</item> </item>
<item> <item>
<key> <string>__name__</string> </key> <key> <string>__name__</string> </key>
...@@ -76,7 +76,7 @@ function createCookie(name, value, days, path) {\n ...@@ -76,7 +76,7 @@ function createCookie(name, value, days, path) {\n
}\n }\n
\n \n
function updater(url, box_relative_url, dom_id, \n function updater(url, box_relative_url, dom_id, \n
editable_mode, additionnal_request_params){\n editable_mode, additionnal_request_params, field_prefix){\n
/* Get content from server */\n /* Get content from server */\n
request_params = {};\n request_params = {};\n
additionnal_request_params = typeof(additionnal_request_params) != \'undefined\' ? additionnal_request_params : [];\n additionnal_request_params = typeof(additionnal_request_params) != \'undefined\' ? additionnal_request_params : [];\n
...@@ -105,6 +105,16 @@ function updater(url, box_relative_url, dom_id, \n ...@@ -105,6 +105,16 @@ function updater(url, box_relative_url, dom_id, \n
\n \n
input_list.each(extractHiddenInputs);\n input_list.each(extractHiddenInputs);\n
\n \n
// we can have a field_prefix which allows multiple gadgets within same HTML form\n
if (field_prefix){\n
$.each(request_params, \n
function (key, value){\n
if (key.match("^"+field_prefix)){\n
delete request_params[key];\n
request_params[key.replace(field_prefix,\'\')] = value;\n
}});\n
}\n
\n
// getting parameters for request from the parameter additionnal_request_params\n // getting parameters for request from the parameter additionnal_request_params\n
$.each(additionnal_request_params, \n $.each(additionnal_request_params, \n
function (key, value){request_params[key] = additionnal_request_params[key];});\n function (key, value){request_params[key] = additionnal_request_params[key];});\n
...@@ -112,7 +122,7 @@ function updater(url, box_relative_url, dom_id, \n ...@@ -112,7 +122,7 @@ function updater(url, box_relative_url, dom_id, \n
request_params["box_relative_url"] = box_relative_url;\n request_params["box_relative_url"] = box_relative_url;\n
request_params["is_gadget_mode:int"] = 1; \n request_params["is_gadget_mode:int"] = 1; \n
request_params["editable_mode:int"] = editable_mode; \n request_params["editable_mode:int"] = editable_mode; \n
\n \n
// set transperancy to show an activity is going on\n // set transperancy to show an activity is going on\n
$("#" + dom_id).css("opacity", 0.5);\n $("#" + dom_id).css("opacity", 0.5);\n
$.ajax({url:url,\n $.ajax({url:url,\n
...@@ -487,7 +497,7 @@ $(document).ready(initialize);\n ...@@ -487,7 +497,7 @@ $(document).ready(initialize);\n
</item> </item>
<item> <item>
<key> <string>size</string> </key> <key> <string>size</string> </key>
<value> <int>18091</int> </value> <value> <int>18445</int> </value>
</item> </item>
<item> <item>
<key> <string>title</string> </key> <key> <string>title</string> </key>
......
694 696
\ No newline at end of file \ No newline at end of file
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