Commit 0a597949 authored by Romain Courteaud's avatar Romain Courteaud

Upgrade renderJS UI to development version of jIO.

Ensure only jIO API is used.
Allow to access all ERP5 functionnality with getAttachment.
Improve IE support.
parent dd25d0b8
......@@ -10,6 +10,12 @@
<key> <string>Script_magic</string> </key>
<value> <int>3</int> </value>
</item>
<item>
<key> <string>_Cacheable__manager_id</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>_bind_names</string> </key>
<value>
......@@ -52,10 +58,7 @@
<key> <string>_body</string> </key>
<value> <string encoding="cdata"><![CDATA[
from zExceptions import Unauthorized\n
from AccessControl import getSecurityManager\n
from ZTUtils import make_query\n
from Products.ZSQLCatalog.SQLCatalog import Query, NegatedQuery\n
import json\n
from DateTime import DateTime\n
if REQUEST is None:\n
......@@ -66,6 +69,8 @@ if response is None:\n
\n
url_template_dict = {\n
"form_action": "%(traversed_document_url)s/%(action_id)s",\n
"traverse_generator": "%(root_url)s/%(script_id)s?mode=traverse" + \\\n
"&relative_url=%(relative_url)s&view=%(view)s",\n
"traverse_template": "%(root_url)s/%(script_id)s?mode=traverse" + \\\n
"{&relative_url,view}",\n
"search_template": "%(root_url)s/%(script_id)s?mode=search" + \\\n
......@@ -269,7 +274,6 @@ def renderForm(form, response_dict):\n
\'name\': form.id\n
}\n
\n
group_list = []\n
for group in form.Form_getGroupTitleAndId():\n
\n
if group[\'gid\'].find(\'hidden\') < 0:\n
......@@ -379,8 +383,10 @@ is_web_mode = (context.REQUEST.get(\'current_web_section\', None) is not None) o
# is_web_mode = traversed_document.isWebMode()\n
if is_web_mode:\n
site_root = context.getWebSectionValue()\n
view_action_type = site_root.getLayoutProperty("view_action_category", default=\'object_view\')\n
else:\n
site_root = portal\n
view_action_type = "object_view"\n
\n
# Check if traversed_document is the site_root\n
if relative_url:\n
......@@ -471,7 +477,6 @@ elif (mode == \'root\') or (mode == \'traverse\'):\n
portal.portal_actions.listFilteredActionsFor(traversed_document))\n
\n
embedded_url = None\n
embedded_action_key = None\n
# XXX See ERP5Type.getDefaultViewFor\n
for erp5_action_key in erp5_action_dict.keys():\n
erp5_action_list = []\n
......@@ -485,11 +490,23 @@ elif (mode == \'root\') or (mode == \'traverse\'):\n
# Try to embed the form in the result\n
if (view == view_action[\'id\']):\n
embedded_url = \'%s\' % view_action[\'url\']\n
embedded_action_key = "action_" + erp5_action_key\n
\n
if (erp5_action_key in (view_action_type, "view", "workflow", "object_new_content_action")):\n
erp5_action_list[-1][\'href\'] = url_template_dict["traverse_generator"] % {\n
"root_url": site_root.absolute_url(),\n
"script_id": script.id,\n
"relative_url": traversed_document.getRelativeUrl().replace("/", "%2F"),\n
"view": erp5_action_list[-1][\'name\']\n
}\n
\n
if erp5_action_list:\n
if len(erp5_action_list) == 1:\n
erp5_action_list = erp5_action_list[0]\n
\n
if erp5_action_key == view_action_type:\n
# Configure view tabs on server level\n
result_dict[\'_links\']["view"] = erp5_action_list\n
\n
# XXX Put a prefix to prevent conflict\n
result_dict[\'_links\']["action_" + erp5_action_key] = erp5_action_list\n
\n
......@@ -564,6 +581,7 @@ elif (mode == \'root\') or (mode == \'traverse\'):\n
##############\n
if is_site_root:\n
\n
result_dict[\'default_view\'] = \'view\'\n
# XXX Hardcoded cache for 30 minutes. Should only bother developers but speed up Jio access\n
response.setHeader("Cache-Control", "public, max-age=1800")\n
response.setHeader("Vary", "Cookie")\n
......@@ -773,7 +791,7 @@ elif mode == \'form\':\n
# renderFormDefinition(form, result_dict)\n
\n
else:\n
raise NotImplementedError, "Unsupported mode %s" % mode\n
raise NotImplementedError("Unsupported mode %s" % mode)\n
\n
response.setHeader(\'Content-Type\', mime_type)\n
return json.dumps(result_dict, indent=2)\n
......
......@@ -102,7 +102,7 @@
<value> <string encoding="cdata"><![CDATA[
CACHE MANIFEST\n
# generated on Mon, 06 Oct 2014 15:03:33 +0000\n
# generated on Wed, 04 Feb 2015 16:31:07 +0000\n
# XXX + fonts\n
# images/ajax-loader.gif\n
CACHE:\n
......@@ -112,8 +112,6 @@ https://netdna.bootstrapcdn.com/font-awesome/4.0.3/fonts/fontawesome-webfont.eot
https://netdna.bootstrapcdn.com/font-awesome/4.0.3/fonts/fontawesome-webfont.woff?v=4.0.3\n
https://netdna.bootstrapcdn.com/font-awesome/4.0.3/fonts/fontawesome-webfont.ttf?v=4.0.3\n
https://netdna.bootstrapcdn.com/font-awesome/4.0.3/fonts/fontawesome-webfont.svg?v=4.0.3#fontawesomeregular\n
rsvp.js\n
URI.js\n
codemirror.css\n
codemirror.js\n
codemirror_addon_dialog.css\n
......@@ -138,6 +136,8 @@ gadget_erp5.html\n
gadget_erp5.js\n
gadget_erp5_field_float.html\n
gadget_erp5_field_float.js\n
gadget_erp5_field_gadget.html\n
gadget_erp5_field_gadget.js\n
gadget_erp5_field_list.html\n
gadget_erp5_field_list.js\n
gadget_erp5_field_listbox.html\n
......@@ -148,8 +148,6 @@ gadget_erp5_field_string.html\n
gadget_erp5_field_string.js\n
gadget_erp5_field_textarea.html\n
gadget_erp5_field_textarea.js\n
gadget_erp5_field_gadget.html\n
gadget_erp5_field_gadget.js\n
gadget_erp5_form.html\n
gadget_erp5_form.js\n
gadget_erp5_header.html\n
......@@ -182,18 +180,16 @@ gadget_erp5_searchfield.js\n
gadget_global.js\n
gadget_jio.html\n
gadget_jio.js\n
gadget_translate.html\n
gadget_translate.js\n
handlebars.js\n
jio.js\n
jio_complex_queries.js\n
jio_sha1.amd.js\n
jio_sha2.amd.js\n
jio_sha256.amd.js\n
jio_storage_erp5.js\n
i18next.js\n
jiodev.js\n
jquery.js\n
jquerymobile.css\n
jquerymobile.js\n
renderjs.js\n
uritemplate.js\n
rsvp.js\n
NETWORK:\n
*
......@@ -259,7 +255,7 @@ NETWORK:\n
</item>
<item>
<key> <string>actor</string> </key>
<value> <string>romain</string> </value>
<value> <string>zope</string> </value>
</item>
<item>
<key> <string>comment</string> </key>
......@@ -281,7 +277,7 @@ NETWORK:\n
</tuple>
<state>
<tuple>
<float>1406898405.77</float>
<float>1421252934.14</float>
<string>GMT</string>
</tuple>
</state>
......@@ -312,7 +308,7 @@ NETWORK:\n
</item>
<item>
<key> <string>actor</string> </key>
<value> <string>xiaowu</string> </value>
<value> <string>romain</string> </value>
</item>
<item>
<key> <string>comment</string> </key>
......@@ -326,7 +322,7 @@ NETWORK:\n
</item>
<item>
<key> <string>serial</string> </key>
<value> <string>940.17441.54956.1450</string> </value>
<value> <string>940.30209.53658.33979</string> </value>
</item>
<item>
<key> <string>state</string> </key>
......@@ -344,8 +340,8 @@ NETWORK:\n
</tuple>
<state>
<tuple>
<float>1421155553.4</float>
<string>UTC</string>
<float>1423067467.33</float>
<string>GMT</string>
</tuple>
</state>
</object>
......
......@@ -129,7 +129,6 @@
});\n
})\n
\n
.declareAcquiredMethod("aq_put", "jio_put")\n
.declareAcquiredMethod("translateHtml", "translateHtml")\n
.allowPublicAcquisition("notifyInvalid", function (param_list, scope) {\n
return this.getDeclaredGadget(scope)\n
......@@ -474,7 +473,7 @@
</item>
<item>
<key> <string>actor</string> </key>
<value> <string>super_sven</string> </value>
<value> <string>romain</string> </value>
</item>
<item>
<key> <string>comment</string> </key>
......@@ -488,7 +487,7 @@
</item>
<item>
<key> <string>serial</string> </key>
<value> <string>940.28668.29547.7765</string> </value>
<value> <string>940.21870.34932.42444</string> </value>
</item>
<item>
<key> <string>state</string> </key>
......@@ -506,7 +505,7 @@
</tuple>
<state>
<tuple>
<float>1421829262.31</float>
<float>1423061410.81</float>
<string>GMT</string>
</tuple>
</state>
......
......@@ -174,7 +174,6 @@
//////////////////////////////////////////////\n
.declareAcquiredMethod("translateHtml", "translateHtml")\n
.declareAcquiredMethod("whoWantToDisplayThis", "whoWantToDisplayThis")\n
.declareAcquiredMethod("jio_get", "jio_get")\n
.declareAcquiredMethod("triggerSubmit", "triggerSubmit")\n
.declareAcquiredMethod("triggerPanel", "triggerPanel")\n
\n
......@@ -581,7 +580,7 @@
</item>
<item>
<key> <string>serial</string> </key>
<value> <string>940.10099.40468.62378</string> </value>
<value> <string>940.17574.28685.15906</string> </value>
</item>
<item>
<key> <string>state</string> </key>
......@@ -599,7 +598,7 @@
</tuple>
<state>
<tuple>
<float>1421080897.75</float>
<float>1421681794.02</float>
<string>GMT</string>
</tuple>
</state>
......
......@@ -101,10 +101,12 @@
<key> <string>text_content</string> </key>
<value> <string encoding="cdata"><![CDATA[
/*global window, document, rJS, RSVP, jQuery, console, jQuery, XMLHttpRequest, loopEventListener */\n
/*global window, document, rJS, RSVP, jQuery, console, jQuery, XMLHttpRequest, loopEventListener, URI, location */\n
/*jslint nomen: true, indent: 2, maxerr: 3 */\n
(function (window, document, rJS, RSVP, $, XMLHttpRequest, console, loopEventListener) {\n
(function (window, document, rJS, RSVP, $, XMLHttpRequest, console, loopEventListener, URI, location) {\n
"use strict";\n
\n
var DEFAULT_VIEW_REFERENCE = "view";\n
\n
/////////////////////////////////////////////////////////////////\n
// Desactivate jQuery Mobile URL management\n
......@@ -122,8 +124,17 @@
.push(function (jio_gadget) {\n
return jio_gadget.createJio({\n
type: "erp5",\n
url: gadget.props.hateoas_url\n
url: (new URI("hateoas/")).absoluteTo(location.href).toString()\n
});\n
/*\n
return jio_gadget.createJio({\n
type: "restattachment",\n
sub_storage: {\n
type: "erp5",\n
url: (new URI("hateoas/")).absoluteTo(location.href).toString()\n
}\n
});\n
*/\n
});\n
}\n
\n
......@@ -154,7 +165,7 @@
// Do not break the application in case of errors.\n
// Display it to the user for now, and allow user to go back to the frontpage\n
var error_text = "";\n
if (error.status === 401) {\n
if ((error.target !== undefined) && (error.target.status === 401)) {\n
// Redirect to the login view\n
return gadget.aq_pleasePublishMyState({page: "login"})\n
.push(gadget.pleaseRedirectMyHash.bind(gadget));\n
......@@ -210,9 +221,7 @@
.ready(function (g) {\n
g.props = {\n
translation_lookup: "",\n
hateoas_url: "hateoas/",\n
action_view: "action_object_view",\n
default_view_reference: "view"\n
hateoas_url: "hateoas/"\n
};\n
// return g.getDeclaredGadget("breadcrumb")\n
// .push(function (sub_gadget) {\n
......@@ -292,29 +301,33 @@
return jio_gadget.allDocs.apply(jio_gadget, param_list);\n
});\n
})\n
.allowPublicAcquisition("jio_ajax", function (param_list) {\n
.allowPublicAcquisition("aq_putAttachment", function (param_list) {\n
return this.getDeclaredGadget("jio_gadget")\n
.push(function (jio_gadget) {\n
return jio_gadget.ajax.apply(jio_gadget, param_list);\n
return jio_gadget.putAttachment({\n
"_id": param_list[0]._id,\n
"_attachment": param_list[0]._attachment,\n
"_data": JSON.stringify(param_list[0]._data)\n
});\n
});\n
})\n
.allowPublicAcquisition("jio_put", function (param_list) {\n
.allowPublicAcquisition("jio_get", function (param_list) {\n
return this.getDeclaredGadget("jio_gadget")\n
.push(function (jio_gadget) {\n
return jio_gadget.put.apply(jio_gadget, param_list);\n
return jio_gadget.get.apply(jio_gadget, param_list);\n
});\n
})\n
.allowPublicAcquisition("jio_get", function (param_list) {\n
.allowPublicAcquisition("jio_getAttachment", 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.getAttachment.apply(jio_gadget, param_list);\n
});\n
})\n
.allowPublicAcquisition("whoWantToDisplayThis", function (param_list) {\n
// Hey, I want to display some URL\n
var options = {\n
jio_key: param_list[0],\n
view: this.props.default_view_reference\n
view: DEFAULT_VIEW_REFERENCE\n
};\n
if (param_list[1] !== undefined) {\n
if (param_list[1].editable !== undefined) {\n
......@@ -327,7 +340,7 @@
// Hey, I want to display some URL\n
var options = {\n
jio_key: this.state_parameter_dict.jio_key,\n
view: param_list[0].name || this.props.default_view_reference\n
view: param_list[0].name || DEFAULT_VIEW_REFERENCE\n
};\n
if (param_list[0].editable !== undefined) {\n
options.editable = param_list[0].editable;\n
......@@ -491,7 +504,6 @@
panel_action: true\n
}];\n
\n
options.action_view = gadget.props.action_view;\n
gadget.state_parameter_dict = {\n
jio_key: options.jio_key,\n
view: options.view\n
......@@ -499,6 +511,7 @@
\n
if ((options.jio_key !== undefined) && (options.page === undefined)) {\n
options.page = "form";\n
options.view = options.view || DEFAULT_VIEW_REFERENCE;\n
}\n
if (options.page === undefined) {\n
// Not rendering a jio document and not page requested.\n
......@@ -566,7 +579,7 @@
);\n
});\n
\n
}(window, document, rJS, RSVP, jQuery, XMLHttpRequest, console, loopEventListener));
}(window, document, rJS, RSVP, jQuery, XMLHttpRequest, console, loopEventListener, URI, location));
]]></string> </value>
</item>
......@@ -689,7 +702,7 @@
</item>
<item>
<key> <string>actor</string> </key>
<value> <string>zope</string> </value>
<value> <string>romain</string> </value>
</item>
<item>
<key> <string>comment</string> </key>
......@@ -703,7 +716,7 @@
</item>
<item>
<key> <string>serial</string> </key>
<value> <string>940.10219.33899.48998</string> </value>
<value> <string>940.49304.32028.23995</string> </value>
</item>
<item>
<key> <string>state</string> </key>
......@@ -721,8 +734,8 @@
</tuple>
<state>
<tuple>
<float>1420722838.8</float>
<string>UTC</string>
<float>1423067269.03</float>
<string>GMT</string>
</tuple>
</state>
</object>
......
......@@ -136,7 +136,7 @@
/////////////////////////////////////////////////////////////////\n
// Acquired methods\n
/////////////////////////////////////////////////////////////////\n
.declareAcquiredMethod("jio_get", "jio_get")\n
.declareAcquiredMethod("jio_getAttachment", "jio_getAttachment")\n
.declareAcquiredMethod("translateHtml", "translateHtml")\n
.declareAcquiredMethod("whoWantToDisplayThisPage", "whoWantToDisplayThisPage")\n
.declareAcquiredMethod("renderPageHeader", "renderPageHeader")\n
......@@ -150,7 +150,7 @@
result_list,\n
view_list;\n
\n
return gadget.jio_get({"_id": options.jio_key})\n
return gadget.jio_getAttachment({"_id": options.jio_key, "_attachment": "links"})\n
.push(function (result) {\n
var i,\n
promise_list = [\n
......@@ -166,7 +166,7 @@
\n
for (i = 0; i < view_list.length; i += 1) {\n
promise_list.push(gadget.whoWantToDisplayThisPage({\n
name: view_list[i].name\n
name: view_list[i].href\n
}));\n
}\n
return RSVP.all(promise_list);\n
......@@ -325,7 +325,7 @@
</item>
<item>
<key> <string>actor</string> </key>
<value> <string>zope</string> </value>
<value> <string>romain</string> </value>
</item>
<item>
<key> <string>comment</string> </key>
......@@ -339,7 +339,7 @@
</item>
<item>
<key> <string>serial</string> </key>
<value> <string>940.11553.26313.55261</string> </value>
<value> <string>940.49126.4849.49664</string> </value>
</item>
<item>
<key> <string>state</string> </key>
......@@ -357,7 +357,7 @@
</tuple>
<state>
<tuple>
<float>1421080866.35</float>
<float>1423066988.75</float>
<string>GMT</string>
</tuple>
</state>
......
......@@ -134,7 +134,7 @@
/////////////////////////////////////////////////////////////////\n
// Acquired methods\n
/////////////////////////////////////////////////////////////////\n
.declareAcquiredMethod("jio_get", "jio_get")\n
.declareAcquiredMethod("jio_getAttachment", "jio_getAttachment")\n
.declareAcquiredMethod("whoWantToDisplayThisPage", "whoWantToDisplayThisPage")\n
.declareAcquiredMethod("whoWantToDisplayThis", "whoWantToDisplayThis")\n
.declareAcquiredMethod("translateHtml", "translateHtml")\n
......@@ -172,7 +172,7 @@
title: parent_link.name,\n
link: parent_href\n
});\n
return gadget.jio_get({"_id": jio_key});\n
return gadget.jio_getAttachment({"_id": jio_key, "_attachment": "links"});\n
})\n
.push(function (result) {\n
handleParent(result.data._links.parent || "#");\n
......@@ -186,7 +186,7 @@
return gadget.whoWantToDisplayThisPage({name: options.view, editable: options.editable})\n
.push(function (back_url) {\n
header_options.back_url = back_url;\n
return gadget.jio_get({"_id": options.jio_key});\n
return gadget.jio_getAttachment({"_id": options.jio_key, "_attachment": "links"});\n
})\n
.push(function (result) {\n
erp5_document = result.data;\n
......@@ -330,7 +330,7 @@
</item>
<item>
<key> <string>actor</string> </key>
<value> <string>super_sven</string> </value>
<value> <string>romain</string> </value>
</item>
<item>
<key> <string>comment</string> </key>
......@@ -344,7 +344,7 @@
</item>
<item>
<key> <string>serial</string> </key>
<value> <string>940.1898.34631.55091</string> </value>
<value> <string>940.49124.20596.60757</string> </value>
</item>
<item>
<key> <string>state</string> </key>
......@@ -362,7 +362,7 @@
</tuple>
<state>
<tuple>
<float>1420236895.39</float>
<float>1423066901.42</float>
<string>GMT</string>
</tuple>
</state>
......
......@@ -132,7 +132,7 @@
/////////////////////////////////////////////////////////////////\n
// acquisition\n
/////////////////////////////////////////////////////////////////\n
.declareAcquiredMethod("jio_ajax", "jio_ajax")\n
.declareAcquiredMethod("aq_putAttachment", "aq_putAttachment")\n
.declareAcquiredMethod("pleaseRedirectMyHash", "pleaseRedirectMyHash")\n
.declareAcquiredMethod("whoWantToDisplayThisPage", "whoWantToDisplayThisPage")\n
.declareAcquiredMethod("whoWantToDisplayThis", "whoWantToDisplayThis")\n
......@@ -256,14 +256,12 @@
}\n
}\n
\n
return form_gadget.jio_ajax({\n
"type": form_gadget.props.action.method,\n
"url": form_gadget.props.action.href,\n
"data": data,\n
"xhrFields": {\n
withCredentials: true\n
}\n
return form_gadget.aq_putAttachment({\n
"_id": form_gadget.props.id,\n
"_attachment": form_gadget.props.action.href,\n
"_data": data\n
});\n
\n
})\n
.push(function (evt) {\n
var location = evt.target.getResponseHeader("X-Location");\n
......@@ -413,7 +411,7 @@
</item>
<item>
<key> <string>actor</string> </key>
<value> <string>zope</string> </value>
<value> <string>romain</string> </value>
</item>
<item>
<key> <string>comment</string> </key>
......@@ -427,7 +425,7 @@
</item>
<item>
<key> <string>serial</string> </key>
<value> <string>940.17478.1208.10666</string> </value>
<value> <string>940.49292.16784.61849</string> </value>
</item>
<item>
<key> <string>state</string> </key>
......@@ -445,7 +443,7 @@
</tuple>
<state>
<tuple>
<float>1421157982.02</float>
<float>1423066365.58</float>
<string>GMT</string>
</tuple>
</state>
......
......@@ -133,7 +133,7 @@
.push(function () {\n
var new_content_action = options.erp5_document._links.action_object_new_content_action;\n
if (new_content_action !== undefined) {\n
new_content_action = gadget.whoWantToDisplayThisPage({name: new_content_action.name, editable: true});\n
new_content_action = gadget.whoWantToDisplayThisPage({name: new_content_action.href, editable: true});\n
} else {\n
new_content_action = "";\n
}\n
......@@ -301,7 +301,7 @@
</item>
<item>
<key> <string>serial</string> </key>
<value> <string>937.65471.52542.37171</string> </value>
<value> <string>940.49123.7425.11349</string> </value>
</item>
<item>
<key> <string>state</string> </key>
......@@ -319,7 +319,7 @@
</tuple>
<state>
<tuple>
<float>1412596633.53</float>
<float>1423066273.81</float>
<string>GMT</string>
</tuple>
</state>
......
......@@ -128,7 +128,7 @@
});\n
})\n
\n
.declareAcquiredMethod("aq_put", "jio_put")\n
.declareAcquiredMethod("aq_putAttachment", "aq_putAttachment")\n
.declareAcquiredMethod("translateHtml", "translateHtml")\n
.declareAcquiredMethod("whoWantToDisplayThisPage", "whoWantToDisplayThisPage")\n
.declareAcquiredMethod("whoWantToDisplayThis", "whoWantToDisplayThis")\n
......@@ -148,6 +148,8 @@
\n
form_gadget.props.id = erp5_document._id;\n
form_gadget.props.view = options.view;\n
form_gadget.props.action = erp5_document._embedded._view._actions.put;\n
form_gadget.props.form_id = erp5_document._embedded._view.form_id;\n
\n
return form_gadget.getDeclaredGadget("erp5_form")\n
.push(function (erp5_form) {\n
......@@ -210,10 +212,17 @@
if (validity) {\n
return erp5_form.getContent()\n
.push(function (data) {\n
data._id = form_gadget.props.id;\n
\n
data[form_gadget.props.form_id.key] =\n
form_gadget.props.form_id[\'default\'];\n
\n
return RSVP.all([\n
form_gadget.notifySubmitting(),\n
form_gadget.aq_put(data, {"_view": form_gadget.props.view})\n
form_gadget.aq_putAttachment({\n
"_id": form_gadget.props.id,\n
"_attachment": form_gadget.props.action.href,\n
"_data": data\n
})\n
]);\n
})\n
.push(form_gadget.notifySubmitted.bind(form_gadget));\n
......@@ -351,7 +360,7 @@
</item>
<item>
<key> <string>actor</string> </key>
<value> <string>zope</string> </value>
<value> <string>romain</string> </value>
</item>
<item>
<key> <string>comment</string> </key>
......@@ -365,7 +374,7 @@
</item>
<item>
<key> <string>serial</string> </key>
<value> <string>940.10421.7831.40686</string> </value>
<value> <string>940.49128.62667.58914</string> </value>
</item>
<item>
<key> <string>state</string> </key>
......@@ -383,8 +392,8 @@
</tuple>
<state>
<tuple>
<float>1420736076.72</float>
<string>UTC</string>
<float>1423066195.91</float>
<string>GMT</string>
</tuple>
</state>
</object>
......
......@@ -300,7 +300,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>
......@@ -314,7 +314,7 @@
</item>
<item>
<key> <string>serial</string> </key>
<value> <string>938.194.24732.3993</string> </value>
<value> <string>940.21776.61223.15274</string> </value>
</item>
<item>
<key> <string>state</string> </key>
......@@ -332,7 +332,7 @@
</tuple>
<state>
<tuple>
<float>1412343893.37</float>
<float>1421415462.01</float>
<string>GMT</string>
</tuple>
</state>
......
......@@ -127,7 +127,7 @@
/////////////////////////////////////////////////////////////////\n
// Acquired methods\n
/////////////////////////////////////////////////////////////////\n
.declareAcquiredMethod("jio_get", "jio_get")\n
.declareAcquiredMethod("jio_getAttachment", "jio_getAttachment")\n
\n
/////////////////////////////////////////////////////////////////\n
// declared methods\n
......@@ -145,11 +145,11 @@
erp5_form,\n
form_gadget;\n
\n
return gadget.jio_get({"_id": options.jio_key}, {"_view": options.view})\n
return gadget.jio_getAttachment({"_id": options.jio_key, "_attachment": options.view})\n
.push(function (result) {\n
var uri = new URI(result.data._embedded._view._links.form_definition.href);\n
erp5_document = result.data;\n
return gadget.jio_get({"_id": uri.segment(2)}, {"_view": "view"});\n
return gadget.jio_getAttachment({"_id": uri.segment(2), "_attachment": "view"});\n
})\n
.push(function (result) {\n
erp5_form = result.data;\n
......@@ -312,7 +312,7 @@
</item>
<item>
<key> <string>actor</string> </key>
<value> <string>sven</string> </value>
<value> <string>romain</string> </value>
</item>
<item>
<key> <string>comment</string> </key>
......@@ -326,7 +326,7 @@
</item>
<item>
<key> <string>serial</string> </key>
<value> <string>938.19043.60684.21452</string> </value>
<value> <string>940.49122.12001.41540</string> </value>
</item>
<item>
<key> <string>state</string> </key>
......@@ -344,7 +344,7 @@
</tuple>
<state>
<tuple>
<float>1413473559.42</float>
<float>1423065965.58</float>
<string>GMT</string>
</tuple>
</state>
......
......@@ -136,7 +136,7 @@
/////////////////////////////////////////////////////////////////\n
// Acquired methods\n
/////////////////////////////////////////////////////////////////\n
.declareAcquiredMethod("jio_get", "jio_get")\n
.declareAcquiredMethod("jio_getAttachment", "jio_getAttachment")\n
.declareAcquiredMethod("whoWantToDisplayThisPage", "whoWantToDisplayThisPage")\n
.declareAcquiredMethod("translateHtml", "translateHtml")\n
.declareAcquiredMethod("renderPageHeader", "renderPageHeader")\n
......@@ -150,12 +150,12 @@
tab_list = [],\n
gadget = this;\n
\n
return gadget.jio_get({"_id": options.jio_key})\n
return gadget.jio_getAttachment({"_id": options.jio_key, "_attachment": "links"})\n
.push(function (result) {\n
var erp5_document = result.data,\n
i,\n
promise_list = [];\n
view_list = erp5_document._links[options.action_view];\n
view_list = erp5_document._links.view;\n
\n
// All ERP5 document should at least have one view.\n
// So, no need normally to test undefined\n
......@@ -164,16 +164,16 @@
}\n
\n
for (i = 0; i < view_list.length; i += 1) {\n
if (options.view === view_list[i].name) {\n
if (options.view === view_list[i].href) {\n
matching = i;\n
}\n
promise_list.push(gadget.whoWantToDisplayThisPage({\n
name: view_list[i].name,\n
name: view_list[i].href,\n
editable: true\n
}));\n
}\n
promise_list.push(gadget.whoWantToDisplayThisPage({\n
name: view_list[0].name\n
name: "view"\n
}));\n
return RSVP.all(promise_list);\n
})\n
......@@ -206,9 +206,19 @@
.push(function (my_translated_html) {\n
gadget.props.element.innerHTML = my_translated_html;\n
\n
return gadget.renderPageHeader({\n
cancel_url: tab_list[matching].link\n
});\n
if (matching !== undefined) {\n
return gadget.renderPageHeader({\n
cancel_url: tab_list[matching].link\n
});\n
}\n
return gadget.whoWantToDisplayThisPage({\n
name: "view",\n
editable: true\n
})\n
.push(function (url) {\n
return gadget.renderPageHeader({cancel_url: url});\n
});\n
\n
});\n
});\n
\n
......@@ -335,7 +345,7 @@
</item>
<item>
<key> <string>actor</string> </key>
<value> <string>zope</string> </value>
<value> <string>romain</string> </value>
</item>
<item>
<key> <string>comment</string> </key>
......@@ -349,7 +359,7 @@
</item>
<item>
<key> <string>serial</string> </key>
<value> <string>940.11553.26313.55261</string> </value>
<value> <string>940.49264.57640.4352</string> </value>
</item>
<item>
<key> <string>state</string> </key>
......@@ -367,7 +377,7 @@
</tuple>
<state>
<tuple>
<float>1421080804.4</float>
<float>1423065230.54</float>
<string>GMT</string>
</tuple>
</state>
......
......@@ -114,17 +114,7 @@
<script src="rsvp.js" type="text/javascript"></script>\n
<script src="renderjs.js" type="text/javascript"></script>\n
\n
<script src="uritemplate.js" type="text/javascript"></script>\n
<script src="URI.js" type="text/javascript"></script>\n
\n
<script src="jio_sha1.amd.js" type="text/javascript"></script>\n
<script src="jio_sha2.amd.js" type="text/javascript"></script>\n
<script src="jio_sha256.amd.js" type="text/javascript"></script>\n
<script src="jio.js" type="text/javascript"></script>\n
<script src="jio_complex_queries.js" type="text/javascript"></script>\n
<script src="jio_storage_erp5.js" type="text/javascript"></script>\n
\n
\n
<script src="jiodev.js" type="text/javascript"></script>\n
\n
<!-- custom script -->\n
<script src="gadget_jio.js" type="text/javascript"></script>\n
......@@ -255,7 +245,7 @@
</item>
<item>
<key> <string>actor</string> </key>
<value> <string>tb</string> </value>
<value> <string>romain</string> </value>
</item>
<item>
<key> <string>comment</string> </key>
......@@ -269,7 +259,7 @@
</item>
<item>
<key> <string>serial</string> </key>
<value> <string>936.39262.40401.22254</string> </value>
<value> <string>940.49251.5828.61098</string> </value>
</item>
<item>
<key> <string>state</string> </key>
......@@ -287,7 +277,7 @@
</tuple>
<state>
<tuple>
<float>1406908734.53</float>
<float>1423064264.23</float>
<string>GMT</string>
</tuple>
</state>
......
......@@ -103,7 +103,7 @@
/*global window, rJS, jIO, FormData */\n
/*jslint indent: 2, maxerr: 3 */\n
(function (window, rJS, jIO, FormData) {\n
(function (window, rJS, jIO) {\n
"use strict";\n
\n
rJS(window)\n
......@@ -116,58 +116,34 @@
.declareMethod(\'createJio\', function (jio_options) {\n
this.state_parameter_dict.jio_storage = jIO.createJIO(jio_options);\n
})\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
return storage.allDocs.apply(storage, arguments);\n
})\n
.declareMethod(\'get\', function () {\n
var storage = this.state_parameter_dict.jio_storage;\n
return storage.get.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
return storage.get.apply(storage, arguments)\n
.push(function (result) {\n
return {data: result};\n
});\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.data);\n
return jIO.util.readBlobAsText(response);\n
})\n
.then(function (lala) {\n
return lala.target.result;\n
.then(function (evt) {\n
return {data: JSON.parse(evt.target.result)};\n
});\n
})\n
.declareMethod(\'putAttachment\', function () {\n
var storage = this.state_parameter_dict.jio_storage;\n
return storage.putAttachment.apply(storage, arguments);\n
})\n
.declareMethod(\'put\', function () {\n
// XXX set modified value\n
var storage = this.state_parameter_dict.jio_storage;\n
return storage.put.apply(storage, arguments);\n
})\n
.declareMethod(\'post\', function () {\n
// XXX set modified value\n
var storage = this.state_parameter_dict.jio_storage;\n
return storage.post.apply(storage, arguments);\n
});\n
\n
}(window, rJS, jIO, FormData));
}(window, rJS, jIO));
]]></string> </value>
</item>
......@@ -290,7 +266,7 @@
</item>
<item>
<key> <string>actor</string> </key>
<value> <string>zope</string> </value>
<value> <string>romain</string> </value>
</item>
<item>
<key> <string>comment</string> </key>
......@@ -304,7 +280,7 @@
</item>
<item>
<key> <string>serial</string> </key>
<value> <string>940.17512.23099.38434</string> </value>
<value> <string>940.46046.3030.52343</string> </value>
</item>
<item>
<key> <string>state</string> </key>
......@@ -322,7 +298,7 @@
</tuple>
<state>
<tuple>
<float>1421162230.18</float>
<float>1423064556.21</float>
<string>GMT</string>
</tuple>
</state>
......
......@@ -114,6 +114,33 @@
<persistent> <string encoding="base64">AAAAAAAAAAM=</string> </persistent>
</value>
</item>
<item>
<key> <string>_local_properties</string> </key>
<value>
<tuple>
<dictionary>
<item>
<key> <string>id</string> </key>
<value> <string>default_view_action_reference</string> </value>
</item>
<item>
<key> <string>type</string> </key>
<value> <string>string</string> </value>
</item>
</dictionary>
<dictionary>
<item>
<key> <string>id</string> </key>
<value> <string>view_action_category</string> </value>
</item>
<item>
<key> <string>type</string> </key>
<value> <string>string</string> </value>
</item>
</dictionary>
</tuple>
</value>
</item>
<item>
<key> <string>_range_criterion</string> </key>
<value>
......@@ -132,6 +159,10 @@
<key> <string>custom_render_method_id</string> </key>
<value> <string>ERP5Document_getHateoas</string> </value>
</item>
<item>
<key> <string>default_view_action_reference</string> </key>
<value> <string>view</string> </value>
</item>
<item>
<key> <string>description</string> </key>
<value>
......@@ -146,6 +177,10 @@
<key> <string>id</string> </key>
<value> <string>hateoas</string> </value>
</item>
<item>
<key> <string>layout_configuration_form_id</string> </key>
<value> <string>WebSection_viewHateoasPreference</string> </value>
</item>
<item>
<key> <string>portal_type</string> </key>
<value> <string>Web Section</string> </value>
......@@ -164,6 +199,10 @@
<key> <string>title</string> </key>
<value> <string>Restricted Hateoas</string> </value>
</item>
<item>
<key> <string>view_action_category</string> </key>
<value> <string>object_view</string> </value>
</item>
<item>
<key> <string>visible</string> </key>
<value> <int>1</int> </value>
......
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="ERP5 Form" module="erp5.portal_type"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>_bind_names</string> </key>
<value>
<object>
<klass>
<global name="NameAssignments" module="Shared.DC.Scripts.Bindings"/>
</klass>
<tuple/>
<state>
<dictionary>
<item>
<key> <string>_asgns</string> </key>
<value>
<dictionary/>
</value>
</item>
</dictionary>
</state>
</object>
</value>
</item>
<item>
<key> <string>_objects</string> </key>
<value>
<tuple/>
</value>
</item>
<item>
<key> <string>action</string> </key>
<value> <string>Base_edit</string> </value>
</item>
<item>
<key> <string>description</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>edit_order</string> </key>
<value>
<list/>
</value>
</item>
<item>
<key> <string>encoding</string> </key>
<value> <string>UTF-8</string> </value>
</item>
<item>
<key> <string>enctype</string> </key>
<value> <string>multipart/form-data</string> </value>
</item>
<item>
<key> <string>group_list</string> </key>
<value>
<list>
<string>left</string>
<string>right</string>
</list>
</value>
</item>
<item>
<key> <string>groups</string> </key>
<value>
<dictionary>
<item>
<key> <string>left</string> </key>
<value>
<list>
<string>my_default_view_action_reference</string>
<string>my_view_action_category</string>
</list>
</value>
</item>
<item>
<key> <string>right</string> </key>
<value>
<list/>
</value>
</item>
</dictionary>
</value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>WebSection_viewHateoasPreference</string> </value>
</item>
<item>
<key> <string>method</string> </key>
<value> <string>POST</string> </value>
</item>
<item>
<key> <string>name</string> </key>
<value> <string>WebSection_viewHateoasPreference</string> </value>
</item>
<item>
<key> <string>pt</string> </key>
<value> <string>form_view</string> </value>
</item>
<item>
<key> <string>row_length</string> </key>
<value> <int>4</int> </value>
</item>
<item>
<key> <string>stored_encoding</string> </key>
<value> <string>UTF-8</string> </value>
</item>
<item>
<key> <string>title</string> </key>
<value> <string>Web Section Preference</string> </value>
</item>
<item>
<key> <string>unicode_mode</string> </key>
<value> <int>0</int> </value>
</item>
<item>
<key> <string>update_action</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>update_action_title</string> </key>
<value> <string></string> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="ProxyField" module="Products.ERP5Form.ProxyField"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>delegated_list</string> </key>
<value>
<list>
<string>title</string>
</list>
</value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>my_default_view_action_reference</string> </value>
</item>
<item>
<key> <string>message_values</string> </key>
<value>
<dictionary>
<item>
<key> <string>external_validator_failed</string> </key>
<value> <string>The input failed the external validator.</string> </value>
</item>
</dictionary>
</value>
</item>
<item>
<key> <string>overrides</string> </key>
<value>
<dictionary>
<item>
<key> <string>field_id</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>form_id</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>target</string> </key>
<value> <string></string> </value>
</item>
</dictionary>
</value>
</item>
<item>
<key> <string>tales</string> </key>
<value>
<dictionary>
<item>
<key> <string>field_id</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>form_id</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>target</string> </key>
<value> <string></string> </value>
</item>
</dictionary>
</value>
</item>
<item>
<key> <string>values</string> </key>
<value>
<dictionary>
<item>
<key> <string>field_id</string> </key>
<value> <string>my_view_mode_reference</string> </value>
</item>
<item>
<key> <string>form_id</string> </key>
<value> <string>Base_viewFieldLibrary</string> </value>
</item>
<item>
<key> <string>target</string> </key>
<value> <string>Click to edit the target</string> </value>
</item>
<item>
<key> <string>title</string> </key>
<value> <string>Default View Action Reference</string> </value>
</item>
</dictionary>
</value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="ProxyField" module="Products.ERP5Form.ProxyField"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>delegated_list</string> </key>
<value>
<list>
<string>title</string>
</list>
</value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>my_view_action_category</string> </value>
</item>
<item>
<key> <string>message_values</string> </key>
<value>
<dictionary>
<item>
<key> <string>external_validator_failed</string> </key>
<value> <string>The input failed the external validator.</string> </value>
</item>
</dictionary>
</value>
</item>
<item>
<key> <string>overrides</string> </key>
<value>
<dictionary>
<item>
<key> <string>field_id</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>form_id</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>target</string> </key>
<value> <string></string> </value>
</item>
</dictionary>
</value>
</item>
<item>
<key> <string>tales</string> </key>
<value>
<dictionary>
<item>
<key> <string>field_id</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>form_id</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>target</string> </key>
<value> <string></string> </value>
</item>
</dictionary>
</value>
</item>
<item>
<key> <string>values</string> </key>
<value>
<dictionary>
<item>
<key> <string>field_id</string> </key>
<value> <string>my_view_mode_reference</string> </value>
</item>
<item>
<key> <string>form_id</string> </key>
<value> <string>Base_viewFieldLibrary</string> </value>
</item>
<item>
<key> <string>target</string> </key>
<value> <string>Click to edit the target</string> </value>
</item>
<item>
<key> <string>title</string> </key>
<value> <string>View Action Category</string> </value>
</item>
</dictionary>
</value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
erp5_hal_json_style
erp5_dms
erp5_dms
\ 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