Commit 58e3545e authored by Roque's avatar Roque

erp5_officejs_connector: new gadget for action gadget field

parent 5d19966a
......@@ -209,7 +209,7 @@
</item>
<item>
<key> <string>gadget_url</string> </key>
<value> <string></string> </value>
<value> <string>python: field.restrictedTraverse(\'gadget_reply.html\').absolute_url()</string> </value>
</item>
<item>
<key> <string>hidden</string> </key>
......
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>OfficeJS Reply Action</title>
<script src="rsvp.js"></script>
<script src="renderjs.js"></script>
<script src="gadget_reply.js"></script>
</head>
<body>
GADGET FIELD HTML!
</body>
</html>
\ No newline at end of file
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="File" module="OFS.Image"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>__name__</string> </key>
<value> <string>gadget_reply.html</string> </value>
</item>
<item>
<key> <string>content_type</string> </key>
<value> <string>text/html</string> </value>
</item>
<item>
<key> <string>precondition</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>title</string> </key>
<value> <string></string> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
/*global window, rJS */
/*jslint nomen: true, indent: 2, maxerr: 3 */
(function (window, rJS) {
"use strict";
var default_view = "jio_view",
gadget_utils;
rJS(window)
/////////////////////////////////////////////////////////////////
// Acquired methods
/////////////////////////////////////////////////////////////////
.declareAcquiredMethod("jio_get", "jio_get")
.declareAcquiredMethod("jio_put", "jio_put")
.declareAcquiredMethod("jio_post", "jio_post")
.declareAcquiredMethod("jio_allDocs", "jio_allDocs")
.declareAcquiredMethod("isDesktopMedia", "isDesktopMedia")
.declareAcquiredMethod("getSetting", "getSetting")
.declareAcquiredMethod("getUrlForList", "getUrlForList")
.declareAcquiredMethod('getUrlParameter', 'getUrlParameter')
.declareAcquiredMethod("updateHeader", "updateHeader")
.declareAcquiredMethod("notifySubmitted", 'notifySubmitted')
.declareAcquiredMethod("notifySubmitting", "notifySubmitting")
.declareAcquiredMethod("redirect", "redirect")
/////////////////////////////////////////////////////////////////
// declared methods
/////////////////////////////////////////////////////////////////
.declareMethod("render", function (options) {
console.log("GADGET FIELD RENDER METHOD!!!");
return;
var gadget = this,
child_gadget_url = 'gadget_erp5_pt_form_view_editable.html',
jio_document;
var erp5_storage = jIO.createJIO({
type: "erp5",
url: "https://softinst112382.host.vifib.net/erp5/web_site_module/officejs_discussion_tool/hateoas/",
default_view_reference: "jio_view"
});
console.log("JIO-GETTING action_result.action: portal_skins/erp5_post/PostModule_newHTMLPost");
console.log(erp5_storage.get("portal_skins/erp5_post/PostModule_newHTMLPost"));
return gadget.declareGadget("gadget_officejs_form_view.html")
.push(function (result) {
gadget_utils = result;
return gadget.jio_get(options.jio_key);
})
.push(function (result) {
jio_document = result;
if (jio_document.portal_type === undefined) {
throw new Error('Can not display document: ' + options.jio_key);
}
return gadget_utils.getFormDefinition(jio_document.portal_type, default_view);
})
.push(function (form_definition) {
return gadget.changeState({
jio_key: options.jio_key,
doc: jio_document,
child_gadget_url: child_gadget_url,
form_definition: form_definition,
editable: false,
view: options.view,
//HARDCODED: following fields should be indicated by the configuration
has_more_views: false,
has_more_actions: options.view === "view",
is_form_list: false
});
});
})
.onStateChange(function () {
return gadget_utils.renderGadget(this);
});
}(window, rJS));
\ No newline at end of file
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="File" module="OFS.Image"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>__name__</string> </key>
<value> <string>gadget_reply.js</string> </value>
</item>
<item>
<key> <string>content_type</string> </key>
<value> <string>application/javascript</string> </value>
</item>
<item>
<key> <string>precondition</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>title</string> </key>
<value> <string></string> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
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