Commit 3872fb39 authored by Romain Courteaud's avatar Romain Courteaud

Never directly use FormData in erp5 gadget.

This allow the jio gadget to be sandboxed in an iframe.
parent 545f5d8f
......@@ -102,8 +102,8 @@
<value> <string encoding="cdata"><![CDATA[
/*jslint nomen: true, indent: 2, maxerr: 3 */\n
/*global window, rJS, RSVP, FormData, URI, loopEventListener, document */\n
(function (window, rJS, RSVP, FormData, URI, loopEventListener) {\n
/*global window, rJS, RSVP, URI, loopEventListener, document */\n
(function (window, rJS, RSVP, URI, loopEventListener) {\n
"use strict";\n
\n
/////////////////////////////////////////////////////////////////\n
......@@ -242,17 +242,17 @@
return erp5_form.getContent();\n
})\n
.push(function (content_dict) {\n
var data = new FormData(),\n
var data = {},\n
key;\n
\n
data.append(form_gadget.props.form_id.key,\n
form_gadget.props.form_id[\'default\']);\n
data[form_gadget.props.form_id.key] =\n
form_gadget.props.form_id[\'default\'];\n
// XXX Hardcoded\n
data.append("dialog_id",\n
form_gadget.props.form_id[\'default\']);\n
data.dialog_id =\n
form_gadget.props.form_id[\'default\'];\n
for (key in content_dict) {\n
if (content_dict.hasOwnProperty(key)) {\n
data.append(key, content_dict[key]);\n
data[key] = content_dict[key];\n
}\n
}\n
\n
......@@ -290,7 +290,7 @@
);\n
});\n
\n
}(window, rJS, RSVP, FormData, URI, loopEventListener));
}(window, rJS, RSVP, URI, loopEventListener));
]]></string> </value>
</item>
......@@ -427,7 +427,7 @@
</item>
<item>
<key> <string>serial</string> </key>
<value> <string>940.16195.40887.33757</string> </value>
<value> <string>940.17478.1208.10666</string> </value>
</item>
<item>
<key> <string>state</string> </key>
......@@ -445,7 +445,7 @@
</tuple>
<state>
<tuple>
<float>1421080553.89</float>
<float>1421157982.02</float>
<string>GMT</string>
</tuple>
</state>
......
......@@ -101,9 +101,9 @@
<key> <string>text_content</string> </key>
<value> <string encoding="cdata"><![CDATA[
/*global window, rJS, jIO */\n
/*global window, rJS, jIO, FormData */\n
/*jslint indent: 2, maxerr: 3 */\n
(function (window, rJS, jIO) {\n
(function (window, rJS, jIO, FormData) {\n
"use strict";\n
\n
rJS(window)\n
......@@ -116,8 +116,18 @@
.declareMethod(\'createJio\', function (jio_options) {\n
this.state_parameter_dict.jio_storage = jIO.createJIO(jio_options);\n
})\n
.declareMethod(\'ajax\', function () {\n
return jIO.util.ajax.apply(this, arguments);\n
.declareMethod(\'ajax\', function (options) {\n
var key,\n
form_data = new FormData();\n
if (options.data !== undefined) {\n
for (key in options.data) {\n
if (options.data.hasOwnProperty(key)) {\n
form_data.append(key, options.data[key]);\n
}\n
}\n
options.data = form_data;\n
}\n
return jIO.util.ajax(options);\n
})\n
.declareMethod(\'allDocs\', function () {\n
var storage = this.state_parameter_dict.jio_storage;\n
......@@ -157,7 +167,7 @@
return storage.post.apply(storage, arguments);\n
});\n
\n
}(window, rJS, jIO));
}(window, rJS, jIO, FormData));
]]></string> </value>
</item>
......@@ -280,7 +290,7 @@
</item>
<item>
<key> <string>actor</string> </key>
<value> <string>romain</string> </value>
<value> <string>zope</string> </value>
</item>
<item>
<key> <string>comment</string> </key>
......@@ -294,7 +304,7 @@
</item>
<item>
<key> <string>serial</string> </key>
<value> <string>937.42715.45132.18756</string> </value>
<value> <string>940.17512.23099.38434</string> </value>
</item>
<item>
<key> <string>state</string> </key>
......@@ -312,7 +322,7 @@
</tuple>
<state>
<tuple>
<float>1411056501.97</float>
<float>1421162230.18</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