Commit e55339ae authored by Romain Courteaud's avatar Romain Courteaud

Make the jIO gadget generic.

Move all ERP5 custom code into gadget_erp5.js.
The jIO gadget can now be used by any renderJS application.
parent 64789246
......@@ -315,14 +315,23 @@
.allowPublicAcquisition("jio_get", function (param_list) {\n
return this.getDeclaredGadget("jio_gadget")\n
.push(function (jio_gadget) {\n
return jio_gadget.get.apply(jio_gadget, param_list);\n
return jio_gadget.get.apply(jio_gadget, param_list)\n
})\n
.push(function (result) {\n
return {data: result};\n
});\n
})\n
.allowPublicAcquisition("jio_getAttachment", function (param_list) {\n
return this.getDeclaredGadget("jio_gadget")\n
.push(function (jio_gadget) {\n
return jio_gadget.getAttachment.apply(jio_gadget, param_list);\n
});\n
})\n
.push(function (response) {\n
return jIO.util.readBlobAsText(response);\n
})\n
.push(function (event) {\n
return {data: JSON.parse(event.target.result)};\n
})\n
})\n
.allowPublicAcquisition("whoWantToDisplayThis", function (param_list) {\n
// Hey, I want to display some URL\n
......@@ -717,7 +726,7 @@
</item>
<item>
<key> <string>serial</string> </key>
<value> <string>940.50639.33715.55517</string> </value>
<value> <string>941.25415.51811.22323</string> </value>
</item>
<item>
<key> <string>state</string> </key>
......@@ -735,8 +744,8 @@
</tuple>
<state>
<tuple>
<float>1423147262.73</float>
<string>UTC</string>
<float>1425307454.32</float>
<string>GMT</string>
</tuple>
</state>
</object>
......
......@@ -99,9 +99,7 @@
</item>
<item>
<key> <string>text_content</string> </key>
<value> <string encoding="cdata"><![CDATA[
/*global window, rJS, jIO, FormData */\n
<value> <string>/*global window, rJS, jIO, FormData */\n
/*jslint indent: 2, maxerr: 3 */\n
(function (window, rJS, jIO) {\n
"use strict";\n
......@@ -122,30 +120,34 @@
})\n
.declareMethod(\'get\', function () {\n
var storage = this.state_parameter_dict.jio_storage;\n
return storage.get.apply(storage, arguments)\n
.push(function (result) {\n
return {data: result};\n
});\n
return storage.get.apply(storage, arguments);\n
})\n
.declareMethod(\'put\', function () {\n
var storage = this.state_parameter_dict.jio_storage;\n
return storage.put.apply(storage, arguments);\n
})\n
.declareMethod(\'post\', function () {\n
var storage = this.state_parameter_dict.jio_storage;\n
return storage.post.apply(storage, arguments);\n
})\n
.declareMethod(\'remove\', function () {\n
var storage = this.state_parameter_dict.jio_storage;\n
return storage.remove.apply(storage, arguments);\n
})\n
.declareMethod(\'getAttachment\', function () {\n
var storage = this.state_parameter_dict.jio_storage;\n
return storage.getAttachment.apply(storage, arguments)\n
// XXX Where to put this &@! blob reading\n
.then(function (response) {\n
return jIO.util.readBlobAsText(response);\n
})\n
.then(function (evt) {\n
return {data: JSON.parse(evt.target.result)};\n
});\n
return storage.getAttachment.apply(storage, arguments);\n
})\n
.declareMethod(\'putAttachment\', function () {\n
var storage = this.state_parameter_dict.jio_storage;\n
return storage.putAttachment.apply(storage, arguments);\n
})\n
.declareMethod(\'removeAttachment\', function () {\n
var storage = this.state_parameter_dict.jio_storage;\n
return storage.removeAttachment.apply(storage, arguments);\n
});\n
\n
}(window, rJS, jIO));
]]></string> </value>
}(window, rJS, jIO));</string> </value>
</item>
<item>
<key> <string>title</string> </key>
......@@ -266,7 +268,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>
......@@ -280,7 +282,7 @@
</item>
<item>
<key> <string>serial</string> </key>
<value> <string>940.46046.3030.52343</string> </value>
<value> <string>940.52129.46198.31044</string> </value>
</item>
<item>
<key> <string>state</string> </key>
......@@ -298,7 +300,7 @@
</tuple>
<state>
<tuple>
<float>1423064556.21</float>
<float>1425049350.7</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