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