Commit a2ba08b7 authored by Romain Courteaud's avatar Romain Courteaud

[erp5_web_renderjs_ui] Merge launcher gadget with officeJS launcher

This deprecates many methods to simplify the API.
This launcher should be considered as generic and reusable without forking it.

Stop using the old jIO API.

Start deprecating the custom renderJS version and its custom API (whoWantToXXX, pleaseXXX).
parent 3b1f76e5
......@@ -75,7 +75,7 @@
</item>
<item>
<key> <string>default_reference</string> </key>
<value> <string>gadget_erp5.html</string> </value>
<value> <string>erp5_launcher.html</string> </value>
</item>
<item>
<key> <string>description</string> </key>
......@@ -108,49 +108,59 @@
<head>\n
<meta charset="utf-8">\n
<meta name="viewport" content="width=device-width, initial-scale=1">\n
<title>${application_title}</title>\n
<link rel="shortcut icon" href="favicon.ico">\n
\n
<title>${application_title}</title>\n
\n
<link href="//netdna.bootstrapcdn.com/font-awesome/4.2.0/css/font-awesome.min.css" rel="stylesheet" type="text/css" />\n
<link rel="stylesheet" href="jquerymobile.css">\n
<link rel="stylesheet" href="gadget_erp5.css">\n
\n
<script data-renderjs-configuration="application_title" type="text/x-renderjs-configuration">${application_title}</script>\n
<script data-renderjs-configuration="frontpage_gadget" type="text/x-renderjs-configuration">${frontpage_gadget}</script>\n
<script data-renderjs-configuration="panel_gadget" type="text/x-renderjs-configuration">${panel_gadget}</script>\n
<script data-renderjs-configuration="action_view" type="text/x-renderjs-configuration">${action_view}</script>\n
<script data-renderjs-configuration="default_view_reference" type="text/x-renderjs-configuration">${default_view_reference}</script>\n
<script data-renderjs-configuration="hateoas_url" type="text/x-renderjs-configuration">${hateoas_url}</script>\n
\n
<script src="rsvp.js" type="text/javascript"></script>\n
<script src="renderjs.js" type="text/javascript"></script>\n
<script src="URI.js" type="text/javascript"></script>\n
<script src="jquery.js" type="text/javascript"></script>\n
<script src="jquerymobile.js" type="text/javascript"></script>\n
<script src="gadget_global.js" type="text/javascript"></script>\n
<script src="gadget_erp5.js" type="text/javascript"></script>\n
<script src="jquery.js"></script>\n
<script src="jquerymobile.js"></script>\n
<script src="rsvp.js"></script>\n
<script src="renderjs.js"></script>\n
<script src="gadget_global.js" ></script>\n
<script src="erp5_launcher.js"></script>\n
\n
</head>\n
\n
<body>\n
<div data-role="page">\n
\n
<div data-gadget-url="gadget_jio.html"\n
data-gadget-scope="jio_gadget"\n
<div data-gadget-url="gadget_jio.html"\n
data-gadget-scope="setting_gadget"\n
data-gadget-sandbox="public"></div>\n
\n
<div data-gadget-url="${router_gadget}"\n
data-gadget-scope="router"\n
data-gadget-sandbox="public"></div>\n
\n
<div data-gadget-url="${translation_gadget}"\n
data-gadget-scope="translation_gadget"\n
data-gadget-sandbox="public"></div>\n
\n
<div data-gadget-url="gadget_erp5_header.html"\n
<div data-gadget-url="${header_gadget}"\n
data-gadget-scope="header"\n
data-gadget-sandbox="public"></div>\n
\n
<div data-gadget-url="${panel_gadget}"\n
data-gadget-scope="panel"\n
\n
<div data-gadget-url="${jio_gadget}"\n
data-gadget-scope="jio_gadget"\n
data-gadget-sandbox="public"></div>\n
\n
<div data-gadget-url="gadget_erp5_panel_configuration.html"\n
data-gadget-scope="configuration"\n
\n
<div data-gadget-url="${panel_gadget}"\n
data-gadget-scope="panel"\n
data-gadget-sandbox="public"></div>\n
\n
<article></article>\n
\n
\n
<div role="main" class="ui-content gadget-content"></div>\n
</div>\n
\n
</body>\n
</html>
......@@ -162,7 +172,7 @@
</item>
<item>
<key> <string>title</string> </key>
<value> <string>RenderJS Gadget ERP5</string> </value>
<value> <string>ERP5 Application Launcher</string> </value>
</item>
<item>
<key> <string>version</string> </key>
......@@ -279,7 +289,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>
......@@ -293,7 +303,7 @@
</item>
<item>
<key> <string>serial</string> </key>
<value> <string>944.36243.11855.44902</string> </value>
<value> <string>945.54056.18010.56797</string> </value>
</item>
<item>
<key> <string>state</string> </key>
......@@ -311,7 +321,7 @@
</tuple>
<state>
<tuple>
<float>1437641105.38</float>
<float>1442581000.11</float>
<string>GMT</string>
</tuple>
</state>
......
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="Web Page" module="erp5.portal_type"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>_Access_contents_information_Permission</string> </key>
<value>
<tuple>
<string>Anonymous</string>
<string>Assignee</string>
<string>Assignor</string>
<string>Associate</string>
<string>Auditor</string>
<string>Manager</string>
<string>Owner</string>
</tuple>
</value>
</item>
<item>
<key> <string>_Add_portal_content_Permission</string> </key>
<value>
<tuple>
<string>Assignee</string>
<string>Assignor</string>
<string>Manager</string>
</tuple>
</value>
</item>
<item>
<key> <string>_Change_local_roles_Permission</string> </key>
<value>
<tuple>
<string>Assignor</string>
<string>Manager</string>
</tuple>
</value>
</item>
<item>
<key> <string>_Modify_portal_content_Permission</string> </key>
<value>
<tuple>
<string>Assignee</string>
<string>Assignor</string>
<string>Manager</string>
</tuple>
</value>
</item>
<item>
<key> <string>_View_Permission</string> </key>
<value>
<tuple>
<string>Anonymous</string>
<string>Assignee</string>
<string>Assignor</string>
<string>Associate</string>
<string>Auditor</string>
<string>Manager</string>
<string>Owner</string>
</tuple>
</value>
</item>
<item>
<key> <string>content_md5</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>content_type</string> </key>
<value> <string>text/html</string> </value>
</item>
<item>
<key> <string>default_reference</string> </key>
<value> <string>gadget_erp5_jio.html</string> </value>
</item>
<item>
<key> <string>description</string> </key>
<value> <string>Jio access</string> </value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>rjs_gadget_erp5_jio_html</string> </value>
</item>
<item>
<key> <string>language</string> </key>
<value> <string>en</string> </value>
</item>
<item>
<key> <string>portal_type</string> </key>
<value> <string>Web Page</string> </value>
</item>
<item>
<key> <string>short_title</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>text_content</string> </key>
<value> <string encoding="cdata"><![CDATA[
<!DOCTYPE html>\n
<html>\n
<head>\n
<meta http-equiv="Content-type" content="text/html; charset=utf-8" />\n
<meta name="viewport" content="width=device-width, user-scalable=no" />\n
<title>Jio Gadget</title>\n
\n
<!-- renderjs -->\n
<script src="rsvp.js" type="text/javascript"></script>\n
<script src="renderjs.js" type="text/javascript"></script>\n
\n
<script src="jiodev.js" type="text/javascript"></script>\n
\n
<!-- custom script -->\n
<script src="gadget_erp5_jio.js" type="text/javascript"></script>\n
\n
</head>\n
<body>\n
<div data-gadget-url=\'gadget_jio.html\' data-gadget-scope=\'jio\'></div>\n
</body>\n
</html>
]]></string> </value>
</item>
<item>
<key> <string>title</string> </key>
<value> <string>Jio Gadget for ERP5</string> </value>
</item>
<item>
<key> <string>version</string> </key>
<value> <string>001</string> </value>
</item>
<item>
<key> <string>workflow_history</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAI=</string> </persistent>
</value>
</item>
</dictionary>
</pickle>
</record>
<record id="2" aka="AAAAAAAAAAI=">
<pickle>
<global name="PersistentMapping" module="Persistence.mapping"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>data</string> </key>
<value>
<dictionary>
<item>
<key> <string>document_publication_workflow</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAM=</string> </persistent>
</value>
</item>
<item>
<key> <string>edit_workflow</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAQ=</string> </persistent>
</value>
</item>
<item>
<key> <string>processing_status_workflow</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAU=</string> </persistent>
</value>
</item>
</dictionary>
</value>
</item>
</dictionary>
</pickle>
</record>
<record id="3" aka="AAAAAAAAAAM=">
<pickle>
<global name="WorkflowHistoryList" module="Products.ERP5Type.patches.WorkflowTool"/>
</pickle>
<pickle>
<tuple>
<none/>
<list>
<dictionary>
<item>
<key> <string>action</string> </key>
<value> <string>publish_alive</string> </value>
</item>
<item>
<key> <string>actor</string> </key>
<value> <string>romain</string> </value>
</item>
<item>
<key> <string>comment</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>error_message</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>time</string> </key>
<value>
<object>
<klass>
<global name="DateTime" module="DateTime.DateTime"/>
</klass>
<tuple>
<none/>
</tuple>
<state>
<tuple>
<float>1442234562.23</float>
<string>GMT</string>
</tuple>
</state>
</object>
</value>
</item>
<item>
<key> <string>validation_state</string> </key>
<value> <string>published_alive</string> </value>
</item>
</dictionary>
</list>
</tuple>
</pickle>
</record>
<record id="4" aka="AAAAAAAAAAQ=">
<pickle>
<global name="WorkflowHistoryList" module="Products.ERP5Type.patches.WorkflowTool"/>
</pickle>
<pickle>
<tuple>
<none/>
<list>
<dictionary>
<item>
<key> <string>action</string> </key>
<value> <string>edit</string> </value>
</item>
<item>
<key> <string>actor</string> </key>
<value> <string>romain</string> </value>
</item>
<item>
<key> <string>comment</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>error_message</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>serial</string> </key>
<value> <string>945.48282.46154.19763</string> </value>
</item>
<item>
<key> <string>state</string> </key>
<value> <string>current</string> </value>
</item>
<item>
<key> <string>time</string> </key>
<value>
<object>
<klass>
<global name="DateTime" module="DateTime.DateTime"/>
</klass>
<tuple>
<none/>
</tuple>
<state>
<tuple>
<float>1442234793.88</float>
<string>GMT</string>
</tuple>
</state>
</object>
</value>
</item>
</dictionary>
</list>
</tuple>
</pickle>
</record>
<record id="5" aka="AAAAAAAAAAU=">
<pickle>
<global name="WorkflowHistoryList" module="Products.ERP5Type.patches.WorkflowTool"/>
</pickle>
<pickle>
<tuple>
<none/>
<list>
<dictionary>
<item>
<key> <string>action</string> </key>
<value> <string>detect_converted_file</string> </value>
</item>
<item>
<key> <string>actor</string> </key>
<value> <string>romain</string> </value>
</item>
<item>
<key> <string>comment</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>error_message</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>external_processing_state</string> </key>
<value> <string>converted</string> </value>
</item>
<item>
<key> <string>serial</string> </key>
<value> <string>0.0.0.0</string> </value>
</item>
<item>
<key> <string>time</string> </key>
<value>
<object>
<klass>
<global name="DateTime" module="DateTime.DateTime"/>
</klass>
<tuple>
<none/>
</tuple>
<state>
<tuple>
<float>1442234436.94</float>
<string>GMT</string>
</tuple>
</state>
</object>
</value>
</item>
</dictionary>
</list>
</tuple>
</pickle>
</record>
</ZopeData>
......@@ -63,27 +63,15 @@
</tuple>
</value>
</item>
<item>
<key> <string>categories</string> </key>
<value>
<tuple/>
</value>
</item>
<item>
<key> <string>content_md5</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>contributors</string> </key>
<value>
<tuple/>
</value>
</item>
<item>
<key> <string>default_reference</string> </key>
<value> <string>officejs_launcher.js</string> </value>
<value> <string>gadget_erp5_jio.js</string> </value>
</item>
<item>
<key> <string>description</string> </key>
......@@ -93,7 +81,7 @@
</item>
<item>
<key> <string>id</string> </key>
<value> <string>officejs_launcher_js</string> </value>
<value> <string>rjs_gadget_erp5_jio_js</string> </value>
</item>
<item>
<key> <string>language</string> </key>
......@@ -111,536 +99,57 @@
</item>
<item>
<key> <string>text_content</string> </key>
<value> <string encoding="cdata"><![CDATA[
/*globals window, document, RSVP, rJS,\n
loopEventListener, jQuery, URI, location, XMLHttpRequest, console*/\n
/*jslint indent: 2, maxlen: 80*/\n
(function (window, document, RSVP, rJS, loopEventListener,\n
$, XMLHttpRequest, location, console) {\n
<value> <string>/*global window, rJS, RSVP */\n
/*jslint indent: 2, maxerr: 3 */\n
(function (window, rJS, RSVP) {\n
"use strict";\n
\n
$.mobile.ajaxEnabled = false;\n
$.mobile.linkBindingEnabled = false;\n
$.mobile.hashListeningEnabled = false;\n
$.mobile.pushStateEnabled = false;\n
\n
var MAIN_SCOPE = "m";\n
\n
function renderMainGadget(gadget, url, options) {\n
return gadget.declareGadget(url, {\n
scope: MAIN_SCOPE\n
})\n
.push(function (page_gadget) {\n
if (page_gadget.render === undefined) {\n
return [page_gadget];\n
}\n
return RSVP.all([\n
page_gadget,\n
page_gadget.render(options)\n
]);\n
})\n
.push(function (all_result) {\n
return all_result[0];\n
});\n
}\n
\n
function initHeaderOptions(gadget) {\n
gadget.props.header_argument_list = {\n
panel_action: true,\n
title: gadget.props.application_title || "OfficeJS"\n
};\n
}\n
\n
function route(my_root_gadget, my_scope, my_method, my_param_list) {\n
return RSVP.Queue()\n
.push(function () {\n
return my_root_gadget.getDeclaredGadget(my_scope);\n
})\n
.push(function (my_gadget) {\n
if (my_param_list) {\n
return my_gadget[my_method].apply(my_gadget, my_param_list);\n
}\n
return my_gadget[my_method]();\n
});\n
}\n
\n
function updateHeader(gadget) {\n
return gadget.getDeclaredGadget("header")\n
.push(function (header_gadget) {\n
return header_gadget.render(gadget.props.header_argument_list);\n
});\n
}\n
\n
function increaseLoadingCounter(gadget) {\n
return new RSVP.Queue()\n
.push(function () {\n
gadget.props.loading_counter += 1;\n
if (gadget.props.loading_counter === 1) {\n
return gadget.getDeclaredGadget("header")\n
.push(function (header_gadget) {\n
return header_gadget.notifyLoading();\n
});\n
}\n
});\n
}\n
\n
function decreaseLoadingCounter(gadget) {\n
return new RSVP.Queue()\n
.push(function () {\n
gadget.props.loading_counter -= 1;\n
if (gadget.props.loading_counter < 0) {\n
gadget.props.loading_counter = 0;\n
// throw new Error("Unexpected negative loading counter");\n
}\n
if (gadget.props.loading_counter === 0) {\n
return gadget.getDeclaredGadget("header")\n
.push(function (header_gadget) {\n
return header_gadget.notifyLoaded();\n
});\n
}\n
});\n
}\n
\n
function callJioGadget(gadget, method, param_list) {\n
var called = false;\n
return new RSVP.Queue()\n
.push(function () {\n
called = true;\n
return increaseLoadingCounter(gadget);\n
})\n
.push(function () {\n
return gadget.getDeclaredGadget("jio_gadget");\n
})\n
.push(function (jio_gadget) {\n
return jio_gadget[method].apply(jio_gadget, param_list);\n
})\n
.push(function (result) {\n
return decreaseLoadingCounter(gadget)\n
.push(function () {\n
return result;\n
});\n
}, function (error) {\n
if (called) {\n
return decreaseLoadingCounter(gadget)\n
.push(function () {\n
throw error;\n
});\n
}\n
throw error;\n
});\n
}\n
\n
function displayErrorContent(gadget, error) {\n
// Do not break the application in case of errors.\n
// Display it to the user for now,\n
// and allow user to go back to the frontpage\n
var error_text = "";\n
if (error instanceof RSVP.CancellationError) {\n
return;\n
}\n
\n
if (error instanceof XMLHttpRequest) {\n
error_text = error.toString() + " " +\n
error.status + " " +\n
error.statusText;\n
} else if (error instanceof Error) {\n
error_text = error.toString();\n
} else {\n
error_text = JSON.stringify(error);\n
}\n
\n
console.error(error);\n
if (error instanceof Error) {\n
console.error(error.stack);\n
}\n
// XXX Improve error rendering\n
gadget.props.content_element.innerHTML = "<br/><br/><br/><pre></pre>";\n
gadget.props.content_element.querySelector(\'pre\').textContent =\n
"Error: " + error_text;\n
// XXX Notify error\n
}\n
\n
function displayError(gadget, error) {\n
return new RSVP.Queue()\n
.push(function () {\n
return displayErrorContent(gadget, error);\n
})\n
.push(function () {\n
return gadget.dropGadget(MAIN_SCOPE)\n
.push(undefined, function () {\n
// Do not crash the app if the pg gadget in not defined\n
// ie, keep the original error on screen\n
return;\n
});\n
});\n
}\n
\n
function getSetting(gadget, key, default_value) {\n
return gadget.getDeclaredGadget("setting_gadget")\n
.push(function (jio_gadget) {\n
return jio_gadget.get("setting");\n
})\n
.push(function (doc) {\n
return doc[key] || default_value;\n
}, function (error) {\n
if (error.status_code === 404) {\n
return default_value;\n
}\n
throw error;\n
});\n
}\n
\n
function setSetting(gadget, key, value) {\n
var jio_gadget;\n
return gadget.getDeclaredGadget("setting_gadget")\n
.push(function (result) {\n
jio_gadget = result;\n
return jio_gadget.get("setting");\n
})\n
.push(undefined, function (error) {\n
if (error.status_code === 404) {\n
return {};\n
}\n
throw error;\n
})\n
.push(function (doc) {\n
doc[key] = value;\n
return jio_gadget.put(\'setting\', doc);\n
});\n
}\n
\n
//////////////////////////////////////////\n
// Page rendering\n
//////////////////////////////////////////\n
/*\n
function redirectToDefaultPage(gadget) {\n
return gadget.pleaseRedirectMyHash(\'#\');\n
}\n
*/\n
rJS(window)\n
.ready(function (g) {\n
g.props = {};\n
return g.getElement()\n
.push(function (element) {\n
$(element).trigger("create");\n
g.props.loading_counter = 0;\n
g.props.element = element;\n
g.props.content_element = element.querySelector(\'.gadget-content\');\n
});\n
})\n
// Configure setting storage\n
.ready(function (g) {\n
return g.getDeclaredGadget("setting_gadget")\n
.push(function (jio_gadget) {\n
return jio_gadget.createJio({\n
type: "indexeddb",\n
database: "setting"\n
});\n
});\n
})\n
.ready(function (g) {\n
// Extract configuration parameters stored in HTML\n
// XXX Will work only if top gadget...\n
var element_list =\n
document.querySelectorAll("[data-renderjs-configuration]"),\n
len = element_list.length,\n
key,\n
value,\n
i,\n
queue = new RSVP.Queue();\n
\n
function push(a, b) {\n
queue.push(function () {\n
return setSetting(g, a, b);\n
});\n
}\n
\n
for (i = 0; i < len; i += 1) {\n
key = element_list[i].getAttribute(\'data-renderjs-configuration\');\n
value = element_list[i].textContent;\n
if (value !== "") {\n
g.props[key] = value;\n
push(key, value);\n
}\n
}\n
return queue;\n
})\n
.ready(function (g) {\n
return setSetting(g, \'hateoas_url\',\n
(new URI(g.props.hateoas_url))\n
.absoluteTo(location.href)\n
.toString()\n
);\n
})\n
// Configure jIO storage\n
.ready(function (g) {\n
var jio_gadget;\n
return g.getDeclaredGadget("jio_gadget")\n
.push(function (result) {\n
jio_gadget = result;\n
return getSetting(g, \'jio_storage_description\');\n
})\n
.push(function (result) {\n
return jio_gadget.createJio(result);\n
});\n
})\n
.ready(function (g) {\n
return g.getDeclaredGadget(\'panel\')\n
.push(function (panel_gadget) {\n
return panel_gadget.render();\n
});\n
})\n
\n
//////////////////////////////////////////\n
// Acquired method\n
//////////////////////////////////////////\n
.declareAcquiredMethod(\'pleaseRedirectMyHash\', \'pleaseRedirectMyHash\')\n
\n
//////////////////////////////////////////\n
// Allow Acquisition\n
//////////////////////////////////////////\n
.allowPublicAcquisition("getSetting", function (argument_list) {\n
return getSetting(this, argument_list[0], argument_list[1]);\n
})\n
.allowPublicAcquisition("setSetting", function (argument_list) {\n
return setSetting(this, argument_list[0], argument_list[1]);\n
})\n
.allowPublicAcquisition("translateHtml", function (argument_list) {\n
return this.getDeclaredGadget("translation_gadget")\n
.push(function (translation_gadget) {\n
return translation_gadget.translateHtml(argument_list[0]);\n
});\n
})\n
\n
// XXX Those methods may be directly integrated into the header,\n
// as it handles the submit triggering\n
.allowPublicAcquisition(\'notifySubmitting\', function () {\n
return route(this, "header", \'notifySubmitting\');\n
})\n
.allowPublicAcquisition(\'notifySubmitted\', function () {\n
return route(this, "header", "notifySubmitted");\n
})\n
.allowPublicAcquisition(\'notifyChange\', function () {\n
return route(this, "header", \'notifyChange\');\n
})\n
\n
.allowPublicAcquisition("translate", function (argument_list) {\n
return this.getDeclaredGadget("translation_gadget")\n
.push(function (translation_gadget) {\n
return translation_gadget.translate(argument_list[0]);\n
});\n
})\n
.allowPublicAcquisition("redirect", function (param_list) {\n
var gadget = this;\n
return gadget.aq_pleasePublishMyState.apply(gadget, param_list)\n
.push(gadget.pleaseRedirectMyHash.bind(gadget));\n
})\n
.allowPublicAcquisition(\'reload\', function () {\n
return location.reload();\n
})\n
.allowPublicAcquisition("getUrlFor", function (param_list) {\n
return this.aq_pleasePublishMyState(param_list[0]);\n
})\n
\n
.allowPublicAcquisition("updateHeader", function (param_list) {\n
var gadget = this;\n
initHeaderOptions(gadget);\n
return this.getDeclaredGadget("translation_gadget")\n
.push(function (translation_gadget) {\n
var promise_list = [],\n
key;\n
for (key in param_list[0]) {\n
if (param_list[0].hasOwnProperty(key)) {\n
gadget.props.header_argument_list[key] = param_list[0][key];\n
}\n
}\n
\n
promise_list.push(translation_gadget.translate(\n
gadget.props.header_argument_list.title\n
));\n
if (gadget.props.header_argument_list.hasOwnProperty(\'right_title\')) {\n
promise_list.push(translation_gadget.translate(\n
gadget.props.header_argument_list.right_title\n
));\n
}\n
return RSVP.all(promise_list);\n
})\n
.push(function (result_list) {\n
gadget.props.header_argument_list.title = result_list[0];\n
if (result_list.length === 2) {\n
gadget.props.header_argument_list.right_title = result_list[1];\n
}\n
\n
// XXX Sven hack: number of _url determine padding for\n
// subheader on ui-content\n
var key,\n
count = 0;\n
for (key in gadget.props.header_argument_list) {\n
if (gadget.props.header_argument_list.hasOwnProperty(key)) {\n
if (key.indexOf(\'_url\') > -1) {\n
count += 1;\n
}\n
}\n
}\n
if (count > 2) {\n
console.log(\'Has subheader\');\n
gadget.props.sub_header_class = "ui-has-subheader";\n
}\n
.ready(function (gadget) {\n
return gadget.getDeclaredGadget(\'jio\')\n
.push(function (jio_gadget) {\n
// Initialize the gadget local parameters\n
gadget.state_parameter_dict = {jio_storage: jio_gadget};\n
});\n
})\n
\n
.allowPublicAcquisition(\'triggerPanel\', function () {\n
return route(this, "panel", "toggle");\n
})\n
.declareAcquiredMethod(\'getSetting\', \'getSetting\')\n
\n
.allowPublicAcquisition("jio_allDocs", function (param_list) {\n
return callJioGadget(this, "allDocs", param_list);\n
})\n
.allowPublicAcquisition("jio_post", function (param_list) {\n
return callJioGadget(this, "post", param_list);\n
})\n
.allowPublicAcquisition("jio_put", function (param_list) {\n
return callJioGadget(this, "put", param_list);\n
})\n
.allowPublicAcquisition("jio_get", function (param_list) {\n
return callJioGadget(this, "get", param_list);\n
})\n
.allowPublicAcquisition("jio_getAttachment", function (param_list) {\n
return callJioGadget(this, "getAttachment", param_list);\n
})\n
.allowPublicAcquisition("jio_putAttachment", function (param_list) {\n
return callJioGadget(this, "putAttachment", param_list);\n
})\n
.allowPublicAcquisition("jio_repair", function (param_list) {\n
return callJioGadget(this, "repair", param_list);\n
})\n
.allowPublicAcquisition("triggerSubmit", function (param_list) {\n
return this.getDeclaredGadget(MAIN_SCOPE)\n
.push(function (main_gadget) {\n
return main_gadget.triggerSubmit(param_list);\n
});\n
})\n
/////////////////////////////////////////////////////////////////\n
// declared methods\n
/////////////////////////////////////////////////////////////////\n
// Render the page\n
.declareMethod(\'render\', function (options) {\n
.declareMethod(\'createJio\', function () {\n
var gadget = this;\n
\n
gadget.props.options = options;\n
// Reinitialize the loading counter\n
gadget.props.loading_counter = 0;\n
// By default, init the header options to be empty\n
// (ERP5 title by default + sidebar)\n
initHeaderOptions(gadget);\n
return new RSVP.Queue()\n
.push(function () {\n
return increaseLoadingCounter(gadget);\n
})\n
.push(function () {\n
return gadget.getDeclaredGadget(\'router\');\n
})\n
.push(function (router_gadget) {\n
return router_gadget.route(options);\n
})\n
.push(function (route_result) {\n
return renderMainGadget(\n
gadget,\n
route_result.url,\n
route_result.options\n
);\n
return RSVP.all([\n
gadget.getSetting(\'hateoas_url\'),\n
gadget.getSetting(\'default_view_reference\')\n
]);\n
})\n
.push(function (main_gadget) {\n
var input;\n
// Append loaded gadget in the page\n
if (main_gadget !== undefined) {\n
return main_gadget.getElement()\n
.push(function (fragment) {\n
var element = gadget.props.content_element,\n
content_container = document.createElement("div");\n
content_container.className = "ui-content " +\n
(gadget.props.sub_header_class || "");\n
// reset subheader indicator\n
delete gadget.props.sub_header_class;\n
\n
// go to the top of the page\n
window.scrollTo(0, 0);\n
\n
updateHeader(gadget);\n
\n
// Clear first to DOM, append after to reduce flickering/manip\n
while (element.firstChild) {\n
element.removeChild(element.firstChild);\n
}\n
content_container.appendChild(fragment);\n
element.appendChild(content_container);\n
\n
$(element).trigger("create");\n
\n
input = element.querySelector("input");\n
if (input !== null) {\n
input.focus();\n
input.select();\n
}\n
// XXX Drop notification\n
// return header_gadget.notifyLoaded();\n
});\n
}\n
})\n
.push(function () {\n
return decreaseLoadingCounter(gadget);\n
}, function (error) {\n
return decreaseLoadingCounter(gadget)\n
.push(function () {\n
throw error;\n
});\n
})\n
.push(undefined, function (error) {\n
return displayError(gadget, error);\n
.push(function (setting_list) {\n
return gadget.state_parameter_dict.jio_storage.createJio({\n
type: "erp5",\n
url: setting_list[0],\n
default_view_reference: setting_list[1]\n
});\n
});\n
})\n
\n
/////////////////////////////////\n
// Handle sub gadgets services\n
/////////////////////////////////\n
.allowPublicAcquisition(\'reportServiceError\', function (param_list,\n
gadget_scope) {\n
if (gadget_scope === undefined) {\n
// don\'t fail in case of dropped subgadget (like previous page)\n
return;\n
}\n
return displayError(this, param_list[0]);\n
.declareMethod(\'allDocs\', function () {\n
var storage = this.state_parameter_dict.jio_storage;\n
return storage.allDocs.apply(storage, arguments);\n
})\n
\n
.declareService(function () {\n
////////////////////////////////////\n
// Form submit listening. Prevent browser to automatically\n
// handle the form submit in case of a bug\n
////////////////////////////////////\n
var gadget = this;\n
\n
function catchFormSubmit() {\n
return displayError(gadget, new Error("Unexpected form submit"));\n
}\n
\n
// Listen to form submit\n
return loopEventListener(\n
gadget.props.element,\n
\'submit\',\n
false,\n
catchFormSubmit\n
);\n
.declareMethod(\'getAttachment\', function (id, name) {\n
return this.state_parameter_dict.jio_storage.getAttachment(id, name, {format: "json"});\n
})\n
.declareMethod(\'putAttachment\', function (id, name, json) {\n
return this.state_parameter_dict.jio_storage.putAttachment(id, name, JSON.stringify(json));\n
});\n
\n
}(window, document, RSVP, rJS, loopEventListener, jQuery,\n
XMLHttpRequest, location, console));
]]></string> </value>
}(window, rJS, RSVP));</string> </value>
</item>
<item>
<key> <string>title</string> </key>
<value> <string>OfficeJS Application Launcher JS</string> </value>
<value> <string>Jio Gadget JS</string> </value>
</item>
<item>
<key> <string>version</string> </key>
......@@ -726,7 +235,7 @@
</tuple>
<state>
<tuple>
<float>1440771133.94</float>
<float>1442234815.56</float>
<string>GMT</string>
</tuple>
</state>
......@@ -771,7 +280,7 @@
</item>
<item>
<key> <string>serial</string> </key>
<value> <string>945.52706.38062.18636</string> </value>
<value> <string>945.54088.9321.61678</string> </value>
</item>
<item>
<key> <string>state</string> </key>
......@@ -789,7 +298,7 @@
</tuple>
<state>
<tuple>
<float>1442500011.1</float>
<float>1442582911.35</float>
<string>GMT</string>
</tuple>
</state>
......@@ -846,7 +355,7 @@
</tuple>
<state>
<tuple>
<float>1440770776.62</float>
<float>1442234436.93</float>
<string>GMT</string>
</tuple>
</state>
......
......@@ -71,7 +71,7 @@
</item>
<item>
<key> <string>default_reference</string> </key>
<value> <string>gadget_erp5.js</string> </value>
<value> <string>erp5_launcher.js</string> </value>
</item>
<item>
<key> <string>description</string> </key>
......@@ -101,12 +101,12 @@
<key> <string>text_content</string> </key>
<value> <string encoding="cdata"><![CDATA[
/*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, location) {\n
/*globals window, document, RSVP, rJS,\n
loopEventListener, jQuery, URI, location, XMLHttpRequest, console*/\n
/*jslint indent: 2, maxlen: 80*/\n
(function (window, document, RSVP, rJS, loopEventListener,\n
$, XMLHttpRequest, location, console) {\n
"use strict";\n
\n
var DEFAULT_VIEW_REFERENCE = "view";\n
\n
/////////////////////////////////////////////////////////////////\n
// Desactivate jQuery Mobile URL management\n
......@@ -116,9 +116,33 @@
$.mobile.hashListeningEnabled = false;\n
$.mobile.pushStateEnabled = false;\n
\n
/////////////////////////////////////////////////////////////////\n
// Some functions\n
/////////////////////////////////////////////////////////////////\n
var MAIN_SCOPE = "m";\n
\n
function renderMainGadget(gadget, url, options) {\n
return gadget.declareGadget(url, {\n
scope: MAIN_SCOPE\n
})\n
.push(function (page_gadget) {\n
if (page_gadget.render === undefined) {\n
return [page_gadget];\n
}\n
return RSVP.all([\n
page_gadget,\n
page_gadget.render(options)\n
]);\n
})\n
.push(function (all_result) {\n
return all_result[0];\n
});\n
}\n
\n
function initHeaderOptions(gadget) {\n
gadget.props.header_argument_list = {\n
panel_action: true,\n
title: gadget.props.application_title || "OfficeJS"\n
};\n
}\n
\n
function route(my_root_gadget, my_scope, my_method, my_param_list) {\n
return RSVP.Queue()\n
.push(function () {\n
......@@ -132,58 +156,77 @@
});\n
}\n
\n
function createJio(gadget) {\n
return gadget.getDeclaredGadget("jio_gadget")\n
.push(function (jio_gadget) {\n
return jio_gadget.createJio({\n
type: "erp5",\n
url: (new URI(gadget.props.hateoas_url)).absoluteTo(location.href).toString(),\n
default_view_reference: gadget.props.default_view_reference\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
function updateHeader(gadget) {\n
return gadget.getDeclaredGadget("header")\n
.push(function (header_gadget) {\n
return header_gadget.render(gadget.props.header_argument_list);\n
});\n
}\n
\n
function renderPage(gadget, page_name, options) {\n
return gadget.declareGadget(page_name, {\n
scope: "pg"\n
})\n
.push(function (page_gadget) {\n
var sub_options = options.pg || {},\n
key;\n
delete options.pg;\n
for (key in options) {\n
if (options.hasOwnProperty(key)) {\n
sub_options[key] = options[key];\n
}\n
function increaseLoadingCounter(gadget) {\n
return new RSVP.Queue()\n
.push(function () {\n
gadget.props.loading_counter += 1;\n
if (gadget.props.loading_counter === 1) {\n
return gadget.getDeclaredGadget("header")\n
.push(function (header_gadget) {\n
return header_gadget.notifyLoading();\n
});\n
}\n
return RSVP.all([\n
page_gadget,\n
page_gadget.render(sub_options)\n
]);\n
});\n
}\n
\n
function decreaseLoadingCounter(gadget) {\n
return new RSVP.Queue()\n
.push(function () {\n
gadget.props.loading_counter -= 1;\n
if (gadget.props.loading_counter < 0) {\n
gadget.props.loading_counter = 0;\n
// throw new Error("Unexpected negative loading counter");\n
}\n
if (gadget.props.loading_counter === 0) {\n
return gadget.getDeclaredGadget("header")\n
.push(function (header_gadget) {\n
return header_gadget.notifyLoaded();\n
});\n
}\n
});\n
}\n
\n
function callJioGadget(gadget, method, param_list) {\n
var called = false;\n
return new RSVP.Queue()\n
.push(function () {\n
called = true;\n
return increaseLoadingCounter(gadget);\n
})\n
.push(function (all_result) {\n
return all_result[0];\n
.push(function () {\n
return gadget.getDeclaredGadget("jio_gadget");\n
})\n
.push(function (jio_gadget) {\n
return jio_gadget[method].apply(jio_gadget, param_list);\n
})\n
.push(function (result) {\n
return decreaseLoadingCounter(gadget)\n
.push(function () {\n
return result;\n
});\n
}, function (error) {\n
if (called) {\n
return decreaseLoadingCounter(gadget)\n
.push(function () {\n
throw error;\n
});\n
}\n
throw error;\n
});\n
}\n
\n
function displayErrorContent(gadget, error) {\n
// 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
// Display it to the user for now,\n
// and allow user to go back to the frontpage\n
var error_text = "";\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
}\n
if (error instanceof RSVP.CancellationError) {\n
return;\n
}\n
......@@ -199,22 +242,23 @@
}\n
\n
console.error(error);\n
console.error(error.stack);\n
if (error instanceof Error) {\n
console.error(error.stack);\n
}\n
// XXX Improve error rendering\n
gadget.props.article.innerHTML = "<br/><br/><br/><pre></pre>";\n
gadget.props.article.querySelector(\'pre\').textContent = "Error: " + error_text;\n
gadget.props.content_element.innerHTML = "<br/><br/><br/><pre></pre>";\n
gadget.props.content_element.querySelector(\'pre\').textContent =\n
"Error: " + error_text;\n
// XXX Notify error\n
}\n
\n
function displayError(gadget, error) {\n
return gadget.getDeclaredGadget("header")\n
.push(function (g) {\n
return g.notifyError();\n
})\n
return new RSVP.Queue()\n
.push(function () {\n
return displayErrorContent(gadget, error);\n
})\n
.push(function () {\n
return gadget.dropGadget("pg")\n
return gadget.dropGadget(MAIN_SCOPE)\n
.push(undefined, function () {\n
// Do not crash the app if the pg gadget in not defined\n
// ie, keep the original error on screen\n
......@@ -223,357 +267,298 @@
});\n
}\n
\n
/////////////////////////////////////////////////////////////////\n
// Gadget behaviour\n
/////////////////////////////////////////////////////////////////\n
function getSetting(gadget, key, default_value) {\n
return gadget.getDeclaredGadget("setting_gadget")\n
.push(function (jio_gadget) {\n
return jio_gadget.get("setting");\n
})\n
.push(function (doc) {\n
return doc[key] || default_value;\n
}, function (error) {\n
if (error.status_code === 404) {\n
return default_value;\n
}\n
throw error;\n
});\n
}\n
\n
rJS(window)\n
/////////////////////////////////////////////////////////////////\n
// ready\n
/////////////////////////////////////////////////////////////////\n
// Init local properties\n
.ready(function (g) {\n
g.props = {\n
translation_lookup: ""\n
};\n
// return g.getDeclaredGadget("breadcrumb")\n
// .push(function (sub_gadget) {\n
// g.props.breadcrumb_gadget = sub_gadget;\n
// });\n
})\n
function setSetting(gadget, key, value) {\n
var jio_gadget;\n
return gadget.getDeclaredGadget("setting_gadget")\n
.push(function (result) {\n
jio_gadget = result;\n
return jio_gadget.get("setting");\n
})\n
.push(undefined, function (error) {\n
if (error.status_code === 404) {\n
return {};\n
}\n
throw error;\n
})\n
.push(function (doc) {\n
doc[key] = value;\n
return jio_gadget.put(\'setting\', doc);\n
});\n
}\n
\n
//////////////////////////////////////////\n
// Page rendering\n
//////////////////////////////////////////\n
/*\n
function redirectToDefaultPage(gadget) {\n
return gadget.pleaseRedirectMyHash(\'#\');\n
}\n
*/\n
rJS(window)\n
.ready(function (g) {\n
g.props = {};\n
return g.getElement()\n
.push(function (element) {\n
$(element).trigger("create");\n
g.props.loading_counter = 0;\n
g.props.element = element;\n
g.props.article = element.querySelector("article");\n
\n
// XXX Will work only if top gadget...\n
var element_list = document.querySelectorAll("[data-renderjs-configuration]"),\n
len = element_list.length,\n
key,\n
value,\n
i;\n
\n
for (i = 0; i < len; i += 1) {\n
key = element_list[i].getAttribute(\'data-renderjs-configuration\');\n
value = element_list[i].textContent;\n
if (value !== "") {\n
g.props[key] = value;\n
}\n
}\n
g.props.content_element = element.querySelector(\'.gadget-content\');\n
});\n
})\n
// Configure jIO to use localstorage\n
// And load configuration from server\n
// Configure setting storage\n
.ready(function (g) {\n
return createJio(g);\n
return g.getDeclaredGadget("setting_gadget")\n
.push(function (jio_gadget) {\n
return jio_gadget.createJio({\n
type: "indexeddb",\n
database: "setting"\n
});\n
});\n
})\n
.ready(function (g) {\n
return g.getDeclaredGadget("header")\n
.push(function (header_gadget) {\n
return header_gadget.getElement();\n
})\n
.push(function (element) {\n
$(element).trigger("create");\n
// Extract configuration parameters stored in HTML\n
// XXX Will work only if top gadget...\n
var element_list =\n
document.querySelectorAll("[data-renderjs-configuration]"),\n
len = element_list.length,\n
key,\n
value,\n
i,\n
queue = new RSVP.Queue();\n
\n
function push(a, b) {\n
queue.push(function () {\n
return setSetting(g, a, b);\n
});\n
})\n
/////////////////////////////////////////////////////////////////\n
// handle acquisition\n
/////////////////////////////////////////////////////////////////\n
.declareAcquiredMethod("pleaseRedirectMyHash", "pleaseRedirectMyHash")\n
\n
/////////////////////////////////////////////////////////////////\n
// published methods\n
/////////////////////////////////////////////////////////////////\n
// bridge translation gadget\n
// XXX: fix translations, getTranslationMethod not used, no?\n
.allowPublicAcquisition("getTranslationMethod", function () {\n
var root = (new URI(this.props.hateoas_url)).absoluteTo(location.href).toString();\n
return root + this.props.translation_lookup;\n
})\n
.allowPublicAcquisition("changeLanguage", function (param_list) {\n
if (this.setLanguage) {\n
return route(this, "translate", "changeLanguage", param_list);\n
}\n
})\n
.allowPublicAcquisition("getLanguageList", function (param_list) {\n
if (this.setLanguage) {\n
return route(this, "translate", "getLanguageList", param_list);\n
}\n
return JSON.stringify([]);\n
})\n
.allowPublicAcquisition("translateHtml", function (param_list) {\n
if (this.setLanguage) {\n
return route(this, "translate", "translateHtml", param_list);\n
\n
for (i = 0; i < len; i += 1) {\n
key = element_list[i].getAttribute(\'data-renderjs-configuration\');\n
value = element_list[i].textContent;\n
if (value !== "") {\n
g.props[key] = value;\n
push(key, value);\n
}\n
}\n
return param_list;\n
return queue;\n
})\n
// Bridge to jio gadget\n
.allowPublicAcquisition("jio_allDocs", function (param_list) {\n
return this.getDeclaredGadget("jio_gadget")\n
.push(function (jio_gadget) {\n
return jio_gadget.allDocs.apply(jio_gadget, param_list);\n
});\n
})\n
.allowPublicAcquisition("aq_putAttachment", function (param_list) {\n
return this.getDeclaredGadget("jio_gadget")\n
.push(function (jio_gadget) {\n
return jio_gadget.putAttachment(\n
param_list[0]._id,\n
param_list[0]._attachment,\n
JSON.stringify(param_list[0]._data)\n
);\n
});\n
.ready(function (g) {\n
return setSetting(g, \'hateoas_url\',\n
(new URI(g.props.hateoas_url))\n
.absoluteTo(location.href)\n
.toString()\n
);\n
})\n
.allowPublicAcquisition("jio_get", function (param_list) {\n
return this.getDeclaredGadget("jio_gadget")\n
.push(function (jio_gadget) {\n
return jio_gadget.get(param_list[0]._id);\n
// Configure jIO storage\n
.ready(function (g) {\n
var jio_gadget;\n
return g.getDeclaredGadget("jio_gadget")\n
.push(function (result) {\n
jio_gadget = result;\n
return getSetting(g, \'jio_storage_description\');\n
})\n
.push(function (result) {\n
return {data: result};\n
return jio_gadget.createJio(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(\n
param_list[0]._id,\n
param_list[0]._attachment,\n
{format: "json"}\n
);\n
})\n
.push(function (json) {\n
return {data: json};\n
.ready(function (g) {\n
return g.getDeclaredGadget(\'panel\')\n
.push(function (panel_gadget) {\n
return panel_gadget.render();\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: DEFAULT_VIEW_REFERENCE\n
};\n
if (param_list[1] !== undefined) {\n
if (param_list[1].editable !== undefined) {\n
options.editable = param_list[1].editable;\n
}\n
}\n
return this.aq_pleasePublishMyState(options);\n
})\n
.allowPublicAcquisition("whoWantToDisplayThisPage", function (param_list) {\n
// 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 || DEFAULT_VIEW_REFERENCE\n
};\n
if (param_list[0].editable !== undefined) {\n
options.editable = param_list[0].editable;\n
}\n
if (param_list[0].page !== undefined) {\n
options.page = param_list[0].page;\n
}\n
return this.aq_pleasePublishMyState(options);\n
})\n
.allowPublicAcquisition("whoWantToDisplayThisFrontPage", function (param_list) {\n
// Hey, I want to display some URL\n
var options = {\n
page: param_list[0]\n
};\n
return this.aq_pleasePublishMyState(options);\n
})\n
\n
.allowPublicAcquisition("renderPageHeader", function (param_list) {\n
// XXX Sven hack: number of _url determine padding for subheader on ui-content \n
function hasSubNavigation(my_param_dict) {\n
var i,\n
count = 0;\n
for (i in my_param_dict) {\n
if (my_param_dict.hasOwnProperty(i) && i.indexOf("_url") > -1) {\n
count += 1;\n
}\n
}\n
return count;\n
}\n
//////////////////////////////////////////\n
// Acquired method\n
//////////////////////////////////////////\n
.declareAcquiredMethod(\'pleaseRedirectMyHash\', \'pleaseRedirectMyHash\')\n
\n
if (hasSubNavigation(param_list[0]) > 2) {\n
this.props.sub_header_class = "ui-has-subheader";\n
}\n
this.props.header_argument_list = param_list;\n
//////////////////////////////////////////\n
// Allow Acquisition\n
//////////////////////////////////////////\n
.allowPublicAcquisition("getSetting", function (argument_list) {\n
return getSetting(this, argument_list[0], argument_list[1]);\n
})\n
\n
.allowPublicAcquisition(\'reportServiceError\', function (param_list, gadget_scope) {\n
if (gadget_scope === undefined) {\n
// don\'t fail in case of dropped subgadget (like previous page)\n
// only accept errors from header, panel and displayed page\n
return;\n
}\n
return displayError(this, param_list[0]);\n
.allowPublicAcquisition("setSetting", function (argument_list) {\n
return setSetting(this, argument_list[0], argument_list[1]);\n
})\n
\n
// bridge notifications\n
// XXX: called twice, 2nd time after header loaded to translate header\n
.allowPublicAcquisition(\'notifyUpdate\', function () {\n
return route(this, "header", \'notifyUpdate\');\n
.allowPublicAcquisition("translateHtml", function (argument_list) {\n
return this.getDeclaredGadget("translation_gadget")\n
.push(function (translation_gadget) {\n
return translation_gadget.translateHtml(argument_list[0]);\n
});\n
})\n
\n
// XXX Those methods may be directly integrated into the header,\n
// as it handles the submit triggering\n
.allowPublicAcquisition(\'notifySubmitting\', function () {\n
return route(this, "header", \'notifySubmitting\');\n
})\n
\n
.allowPublicAcquisition(\'notifySubmitted\', function () {\n
return route(this, "header", "notifySubmitted");\n
})\n
.allowPublicAcquisition(\'notifyChange\', function () {\n
return route(this, "header", \'notifyChange\');\n
})\n
.allowPublicAcquisition(\'notifyLoading\', function () {\n
return route(this, "pg", "notifyLoading");\n
\n
.allowPublicAcquisition("translate", function (argument_list) {\n
return this.getDeclaredGadget("translation_gadget")\n
.push(function (translation_gadget) {\n
return translation_gadget.translate(argument_list[0]);\n
});\n
})\n
.allowPublicAcquisition("redirect", function (param_list) {\n
var gadget = this;\n
return gadget.aq_pleasePublishMyState.apply(gadget, param_list)\n
.push(gadget.pleaseRedirectMyHash.bind(gadget));\n
})\n
.allowPublicAcquisition(\'reload\', function () {\n
return location.reload();\n
})\n
.allowPublicAcquisition(\'notifyLoaded\', function () {\n
return route(this, "pg", "notifyLoaded");\n
.allowPublicAcquisition("getUrlFor", function (param_list) {\n
return this.aq_pleasePublishMyState(param_list[0]);\n
})\n
.allowPublicAcquisition(\'triggerSubmit\', function () {\n
return route(this, "pg", "triggerSubmit");\n
\n
.allowPublicAcquisition("updateHeader", function (param_list) {\n
var gadget = this;\n
initHeaderOptions(gadget);\n
return this.getDeclaredGadget("translation_gadget")\n
.push(function (translation_gadget) {\n
var promise_list = [],\n
key;\n
for (key in param_list[0]) {\n
if (param_list[0].hasOwnProperty(key)) {\n
gadget.props.header_argument_list[key] = param_list[0][key];\n
}\n
}\n
\n
promise_list.push(translation_gadget.translate(\n
gadget.props.header_argument_list.title\n
));\n
if (gadget.props.header_argument_list.hasOwnProperty(\'right_title\')) {\n
promise_list.push(translation_gadget.translate(\n
gadget.props.header_argument_list.right_title\n
));\n
}\n
return RSVP.all(promise_list);\n
})\n
.push(function (result_list) {\n
gadget.props.header_argument_list.title = result_list[0];\n
if (result_list.length === 2) {\n
gadget.props.header_argument_list.right_title = result_list[1];\n
}\n
\n
// XXX Sven hack: number of _url determine padding for\n
// subheader on ui-content\n
var key,\n
count = 0;\n
for (key in gadget.props.header_argument_list) {\n
if (gadget.props.header_argument_list.hasOwnProperty(key)) {\n
if (key.indexOf(\'_url\') > -1) {\n
count += 1;\n
}\n
}\n
}\n
if (count > 2) {\n
console.log(\'Has subheader\');\n
gadget.props.sub_header_class = "ui-has-subheader";\n
}\n
});\n
})\n
\n
// bridge panel\n
.allowPublicAcquisition(\'triggerPanel\', function () {\n
return route(this, "panel", "toggle");\n
})\n
\n
// bridge configuration panel\n
.allowPublicAcquisition(\'setPanelContent\', function (param_list) {\n
return route(this, "configuration", "setPanelContent", param_list);\n
.allowPublicAcquisition("jio_allDocs", function (param_list) {\n
return callJioGadget(this, "allDocs", param_list);\n
})\n
.allowPublicAcquisition(\'setPanelHeader\', function (param_list) {\n
return route(this, "configuration", "setPanelHeader", param_list);\n
.allowPublicAcquisition("jio_post", function (param_list) {\n
return callJioGadget(this, "post", param_list);\n
})\n
.allowPublicAcquisition(\'togglePanel\', function () {\n
return route(this, "configuration", "togglePanel");\n
.allowPublicAcquisition("jio_put", function (param_list) {\n
return callJioGadget(this, "put", param_list);\n
})\n
// root\n
.allowPublicAcquisition(\'getSiteRoot\', function () {\n
return this.getSiteRoot();\n
.allowPublicAcquisition("jio_get", function (param_list) {\n
return callJioGadget(this, "get", param_list);\n
})\n
.allowPublicAcquisition("jio_getAttachment", function (param_list) {\n
return callJioGadget(this, "getAttachment", param_list);\n
})\n
.allowPublicAcquisition("jio_putAttachment", function (param_list) {\n
return callJioGadget(this, "putAttachment", param_list);\n
})\n
.allowPublicAcquisition("jio_repair", function (param_list) {\n
return callJioGadget(this, "repair", param_list);\n
})\n
.allowPublicAcquisition("triggerSubmit", function (param_list) {\n
return this.getDeclaredGadget(MAIN_SCOPE)\n
.push(function (main_gadget) {\n
return main_gadget.triggerSubmit(param_list);\n
});\n
})\n
\n
/////////////////////////////////////////////////////////////////\n
// declared methods\n
/////////////////////////////////////////////////////////////////\n
\n
// XXX translate: called before ready(), so props is not available.\n
// Needed to lookup to retrieve HAL to fetch site module/runner languages \n
.declareMethod(\'getSiteRoot\', function () {\n
return (new URI(this.props.hateoas_url)).absoluteTo(location.href).toString();\n
})\n
\n
// Render the page\n
.declareMethod(\'configure\', function (options) {\n
var gadget = this,\n
elements,\n
div,\n
key;\n
for (key in options) {\n
if (options.hasOwnProperty(key)) {\n
if (key === "translation_lookup") {\n
gadget.setLanguage = true;\n
}\n
gadget.props[key] = options[key];\n
}\n
}\n
if (gadget.setLanguage) {\n
elements = gadget.props.element;\n
div = document.createElement("div");\n
elements.appendChild(div);\n
return new RSVP.Queue()\n
.push(function () {\n
return gadget.declareGadget("gadget_translate.html",\n
{scope: "translate"});\n
})\n
.push(function () {\n
return gadget.dropGadget("panel");\n
})\n
.push(function () {\n
return gadget.declareGadget(gadget.props.panel_gadget,\n
{scope: "panel",\n
element: div});\n
})\n
.push(function () {\n
return createJio(gadget);\n
});\n
}\n
})\n
\n
// Render the page\n
.declareMethod(\'render\', function (options) {\n
var gadget = this,\n
header_gadget,\n
main_gadget;\n
var gadget = this;\n
\n
gadget.props.options = options;\n
// Reinitialize the loading counter\n
gadget.props.loading_counter = 0;\n
// By default, init the header options to be empty\n
// (ERP5 title by default + sidebar)\n
initHeaderOptions(gadget);\n
return new RSVP.Queue()\n
.push(function () {\n
return RSVP.all([\n
gadget.getDeclaredGadget("header"),\n
gadget.getDeclaredGadget("panel"),\n
gadget.getDeclaredGadget("configuration")\n
]);\n
})\n
.push(function (my_gadget_list) {\n
header_gadget = my_gadget_list[0];\n
return RSVP.all([\n
header_gadget.notifyLoading(),\n
my_gadget_list[1].render({}),\n
my_gadget_list[2].render({})\n
]);\n
return increaseLoadingCounter(gadget);\n
})\n
.push(function () {\n
// By default, init the header options to be empty (ERP5 title by default + sidebar)\n
gadget.props.header_argument_list = [{\n
panel_action: true,\n
page_title: gadget.props.application_title || "ERP5"\n
}];\n
\n
gadget.state_parameter_dict = {\n
jio_key: options.jio_key,\n
view: options.view\n
};\n
\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
// URL is probably empty: redirect to the frontpage\n
// Check if a custom frontpage is defined\n
if (!gadget.props.frontpage_gadget) {\n
return gadget.aq_pleasePublishMyState({page: \'front\'})\n
.push(gadget.pleaseRedirectMyHash.bind(gadget));\n
}\n
return renderPage(gadget, gadget.props.frontpage_gadget, options);\n
}\n
\n
return renderPage(gadget, "gadget_erp5_page_" + options.page + ".html", options);\n
return gadget.getDeclaredGadget(\'router\');\n
})\n
\n
.push(function (result) {\n
main_gadget = result;\n
\n
return header_gadget.render.apply(header_gadget, gadget.props.header_argument_list);\n
.push(function (router_gadget) {\n
return router_gadget.route(options);\n
})\n
.push(function () {\n
.push(function (route_result) {\n
return renderMainGadget(\n
gadget,\n
route_result.url,\n
route_result.options\n
);\n
})\n
.push(function (main_gadget) {\n
var input;\n
// Append loaded gadget in the page\n
if (main_gadget !== undefined) {\n
return main_gadget.getElement()\n
.push(function (fragment) {\n
var element = gadget.props.article,\n
var element = gadget.props.content_element,\n
content_container = document.createElement("div");\n
content_container.className = "ui-content " + (gadget.props.sub_header_class || "");\n
content_container.className = "ui-content " +\n
(gadget.props.sub_header_class || "");\n
// reset subheader indicator\n
delete gadget.props.sub_header_class;\n
\n
// go to the top of the page\n
window.scrollTo(0, 0);\n
\n
updateHeader(gadget);\n
\n
// Clear first to DOM, append after to reduce flickering/manip\n
while (element.firstChild) {\n
......@@ -583,24 +568,51 @@
element.appendChild(content_container);\n
\n
$(element).trigger("create");\n
return header_gadget.notifyLoaded();\n
\n
input = element.querySelector("input");\n
if (input !== null) {\n
input.focus();\n
input.select();\n
}\n
// XXX Drop notification\n
// return header_gadget.notifyLoaded();\n
});\n
}\n
})\n
\n
.push(function () {\n
return decreaseLoadingCounter(gadget);\n
}, function (error) {\n
return decreaseLoadingCounter(gadget)\n
.push(function () {\n
throw error;\n
});\n
})\n
.push(undefined, function (error) {\n
return displayError(gadget, error);\n
});\n
})\n
\n
/////////////////////////////////\n
// Handle sub gadgets services\n
/////////////////////////////////\n
.allowPublicAcquisition(\'reportServiceError\', function (param_list,\n
gadget_scope) {\n
if (gadget_scope === undefined) {\n
// don\'t fail in case of dropped subgadget (like previous page)\n
return;\n
}\n
return displayError(this, param_list[0]);\n
})\n
\n
.declareService(function () {\n
////////////////////////////////////\n
// Form submit listening. Prevent browser to automatically handle the form submit in case of a bug\n
// Form submit listening. Prevent browser to automatically\n
// handle the form submit in case of a bug\n
////////////////////////////////////\n
var gadget = this;\n
\n
function catchFormSubmit() {\n
return displayError(new Error("Unexpected form submit"));\n
return displayError(gadget, new Error("Unexpected form submit"));\n
}\n
\n
// Listen to form submit\n
......@@ -612,13 +624,14 @@
);\n
});\n
\n
}(window, document, rJS, RSVP, jQuery, XMLHttpRequest, console, loopEventListener, location));
}(window, document, RSVP, rJS, loopEventListener, jQuery,\n
XMLHttpRequest, location, console));
]]></string> </value>
</item>
<item>
<key> <string>title</string> </key>
<value> <string>RenderJS Gadget ERP5 JS</string> </value>
<value> <string>ERP5 Launcher JS</string> </value>
</item>
<item>
<key> <string>version</string> </key>
......@@ -749,7 +762,7 @@
</item>
<item>
<key> <string>serial</string> </key>
<value> <string>943.18121.53382.40174</string> </value>
<value> <string>945.54027.26221.22152</string> </value>
</item>
<item>
<key> <string>state</string> </key>
......@@ -767,7 +780,7 @@
</tuple>
<state>
<tuple>
<float>1432647072.98</float>
<float>1442581058.21</float>
<string>GMT</string>
</tuple>
</state>
......
......@@ -138,7 +138,7 @@
.declareAcquiredMethod("jio_allDocs", "jio_allDocs")\n
.declareAcquiredMethod("jio_getAttachment", "jio_getAttachment")\n
.declareAcquiredMethod("translateHtml", "translateHtml")\n
.declareAcquiredMethod("whoWantToDisplayThis", "whoWantToDisplayThis")\n
.declareAcquiredMethod("getUrlFor", "getUrlFor")\n
.declareAcquiredMethod("pleasePublishMyState", "pleasePublishMyState")\n
.declareAcquiredMethod("getFieldTypeGadgetUrl", "getFieldTypeGadgetUrl")\n
//////////////////////////////////////////////\n
......@@ -219,14 +219,13 @@
\n
if (field_json.list_method_template !== undefined) {\n
list_method_promise = function (option_dict) {\n
return gadget.jio_getAttachment({\n
return gadget.jio_getAttachment(\n
// XXX Ugly hardcoded meaningless id...\n
"_id": "erp5",\n
"_attachment": new UriTemplate.parse(field_json.list_method_template)\n
.expand(option_dict)\n
})\n
"erp5",\n
new UriTemplate.parse(field_json.list_method_template)\n
.expand(option_dict)\n
)\n
.push(function (catalog_json) {\n
catalog_json = catalog_json.data;\n
var data = catalog_json._embedded.contents,\n
count = data.length,\n
k,\n
......@@ -262,7 +261,7 @@
counter = Math.min(result.data.total_rows, lines);\n
for (i = 0; i < counter; i += 1) {\n
promise_list.push(\n
gadget.whoWantToDisplayThis(result.data.rows[i].id)\n
gadget.getUrlFor({jio_key: result.data.rows[i].id})\n
);\n
}\n
return RSVP.all(promise_list);\n
......@@ -613,7 +612,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>
......@@ -627,7 +626,7 @@
</item>
<item>
<key> <string>serial</string> </key>
<value> <string>944.12333.61899.20616</string> </value>
<value> <string>945.52783.20655.48793</string> </value>
</item>
<item>
<key> <string>state</string> </key>
......@@ -645,8 +644,8 @@
</tuple>
<state>
<tuple>
<float>1436145492.07</float>
<string>GMT+2</string>
<float>1442504640.91</float>
<string>GMT</string>
</tuple>
</state>
</object>
......
......@@ -292,7 +292,7 @@ promiseEventListener */\n
if (field_json.allow_jump && allow_jump) {\n
return new RSVP.Queue()\n
.push(function () {\n
return gadget.whoWantToDisplayThis(field_json.relation_item_relative_url[i]);\n
return gadget.getUrlFor({jio_key: field_json.relation_item_relative_url[i]});\n
})\n
.push(function (my_url) {\n
a2.href = my_url;\n
......@@ -325,8 +325,7 @@ promiseEventListener */\n
.declareAcquiredMethod("notifyChange", "notifyChange")\n
.declareAcquiredMethod("jio_allDocs", "jio_allDocs")\n
.declareAcquiredMethod("translateHtml", "translateHtml")\n
.declareAcquiredMethod("whoWantToDisplayThis", "whoWantToDisplayThis")\n
.declareAcquiredMethod("pleasePublishMyState", "pleasePublishMyState")\n
.declareAcquiredMethod("getUrlFor", "getUrlFor")\n
/////////////////////////////////////////////////////////////////\n
// declared methods\n
/////////////////////////////////////////////////////////////////\n
......@@ -476,7 +475,7 @@ promiseEventListener */\n
props.select_uid_list[i] = element.getAttribute("name");\n
wrapper.querySelector("input").value = element.textContent;\n
clearResults(wrapper, "skip");\n
return my_gadget.whoWantToDisplayThis(jump_url);\n
return my_gadget.getUrlFor({jio_key: jump_url});\n
}\n
}).push(function (my_url) {\n
if (my_url !== undefined) {\n
......@@ -670,7 +669,7 @@ promiseEventListener */\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>
......@@ -684,7 +683,7 @@ promiseEventListener */\n
</item>
<item>
<key> <string>serial</string> </key>
<value> <string>943.32225.48051.5563</string> </value>
<value> <string>945.52422.65165.14080</string> </value>
</item>
<item>
<key> <string>state</string> </key>
......@@ -702,8 +701,8 @@ promiseEventListener */\n
</tuple>
<state>
<tuple>
<float>1434097633.56</float>
<string>UTC</string>
<float>1442502322.12</float>
<string>GMT</string>
</tuple>
</state>
</object>
......
......@@ -144,7 +144,8 @@
<li class="ui-first-child"><a href="{{module_href}}" class="ui-btn ui-btn-icon-left ui-icon-puzzle-piece" data-i18n="Modules">Modules</a></li>\n
<li><a class="ui-btn ui-btn-icon-left ui-icon-clipboard" data-i18n="Worklists">Worklists</a></li>\n
<li><a href="{{history_href}}" class="ui-btn ui-btn-icon-left ui-icon-history" data-i18n="History">History</a></li>\n
<li><a class="ui-btn ui-btn-icon-left ui-icon-gear" data-i18n="Preference">Preferences</a></li>\n
<li><a href="{{preference_href}}" class="ui-btn ui-btn-icon-left ui-icon-gear" data-i18n="Preference">Preferences</a></li>\n
<!--div>\n
{{#if language_list}}\n
<li data-role="collapsible" data-enhanced="true" data-collapsed="true" data-collapsed-icon="comment-o" class="ui-collapsible ui-collapsible-collapsed">\n
<h4 class="ui-collapsible-heading ui-collapsible-heading-collapsed ui-li-divider ui-li-has-icon">\n
......@@ -168,6 +169,7 @@
</div>\n
</li>\n
{{/if}}\n
<div-->\n
<li class="ui-last-child"><a href="{{logout_href}}" class="ui-btn ui-btn-icon-left ui-icon-power-off" data-i18n="Logout">Logout</a></li>\n
</ul>\n
</div>\n
......@@ -305,7 +307,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>
......@@ -319,7 +321,7 @@
</item>
<item>
<key> <string>serial</string> </key>
<value> <string>944.36243.6132.18568</string> </value>
<value> <string>945.53847.62160.33314</string> </value>
</item>
<item>
<key> <string>state</string> </key>
......@@ -337,7 +339,7 @@
</tuple>
<state>
<tuple>
<float>1437641090.96</float>
<float>1442568863.26</float>
<string>GMT</string>
</tuple>
</state>
......
......@@ -99,9 +99,7 @@
</item>
<item>
<key> <string>text_content</string> </key>
<value> <string encoding="cdata"><![CDATA[
/*jslint nomen: true, indent: 2, maxerr: 3 */\n
<value> <string>/*jslint nomen: true, indent: 2, maxerr: 3 */\n
/*global window, rJS, Handlebars, jQuery, RSVP, loopEventListener */\n
(function (window, rJS, Handlebars, $, RSVP, loopEventListener) {\n
"use strict";\n
......@@ -133,12 +131,7 @@
// acquired method\n
//////////////////////////////////////////////\n
.declareAcquiredMethod("translateHtml", "translateHtml")\n
.declareAcquiredMethod("changeLanguage", "changeLanguage")\n
.declareAcquiredMethod("getLanguageList", "getLanguageList")\n
.declareAcquiredMethod(\n
"whoWantToDisplayThisFrontPage",\n
"whoWantToDisplayThisFrontPage"\n
)\n
.declareAcquiredMethod("getUrlFor", "getUrlFor")\n
\n
// Assign the element to a variable\n
.ready(function (g) {\n
......@@ -162,41 +155,22 @@
return new RSVP.Queue()\n
.push(function () {\n
return RSVP.all([\n
g.whoWantToDisplayThisFrontPage("front"),\n
g.whoWantToDisplayThisFrontPage("history"),\n
g.getLanguageList(),\n
g.whoWantToDisplayThisFrontPage("logout")\n
g.getUrlFor({page: "front"}),\n
g.getUrlFor({page: "history"}),\n
g.getUrlFor({page: "preference"}),\n
g.getUrlFor({page: "logout"})\n
]);\n
})\n
.push(function (all_result) {\n
var raw_language_list = JSON.parse(all_result[2]),\n
len = raw_language_list.length,\n
i,\n
i_len,\n
language_list,\n
tmp;\n
\n
// XXX: Customize panel header!\n
tmp = panel_template_header();\n
\n
// languages\n
if (len > 0) {\n
language_list = [];\n
for (i = 0, i_len = len; i < i_len; i += 1) {\n
language_list.push({"count": i, "lang": raw_language_list[i]});\n
}\n
}\n
\n
var tmp = panel_template_header();\n
tmp += panel_template_body({\n
"module_href": all_result[0],\n
"history_href": all_result[1],\n
"language_list": language_list,\n
"preference_href": all_result[2],\n
// "language_list": language_list,\n
"logout_href": all_result[3]\n
});\n
\n
if (len > 0) {\n
return g.translateHtml(tmp);\n
}\n
return tmp;\n
})\n
.push(function (my_translated_or_plain_html) {\n
......@@ -220,45 +194,22 @@
// declared services\n
/////////////////////////////////////////////////////////////////\n
.declareService(function () {\n
var panel_gadget,\n
form_list,\n
event_list,\n
handler,\n
i,\n
len;\n
\n
function translate(my_event) {\n
return panel_gadget.changeLanguage(my_event.target.lang.value);\n
}\n
var panel_gadget = this;\n
\n
function formSubmit() {\n
panel_gadget.toggle();\n
}\n
\n
panel_gadget = this;\n
form_list = panel_gadget.props.element.querySelectorAll(\'form\');\n
event_list = [];\n
handler = [formSubmit];\n
return loopEventListener(\n
panel_gadget.props.element.querySelector(\'form\'),\n
\'submit\',\n
false,\n
formSubmit\n
);\n
\n
// XXX: not robust - Will break when search field is active\n
for (i = 0, len = form_list.length; i < len; i += 1) {\n
event_list[i] = loopEventListener(\n
form_list[i],\n
\'submit\',\n
false,\n
handler[i] || translate\n
);\n
}\n
\n
return new RSVP.Queue()\n
.push(function () {\n
return RSVP.all(event_list);\n
});\n
});\n
\n
}(window, rJS, Handlebars, jQuery, RSVP, loopEventListener));
]]></string> </value>
}(window, rJS, Handlebars, jQuery, RSVP, loopEventListener));</string> </value>
</item>
<item>
<key> <string>title</string> </key>
......@@ -379,7 +330,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>
......@@ -393,7 +344,7 @@
</item>
<item>
<key> <string>serial</string> </key>
<value> <string>943.36081.11434.7048</string> </value>
<value> <string>945.53861.25077.18602</string> </value>
</item>
<item>
<key> <string>state</string> </key>
......@@ -411,8 +362,8 @@
</tuple>
<state>
<tuple>
<float>1433732853.87</float>
<string>UTC</string>
<float>1442569620.96</float>
<string>GMT</string>
</tuple>
</state>
</object>
......
......@@ -138,8 +138,8 @@
/////////////////////////////////////////////////////////////////\n
.declareAcquiredMethod("jio_getAttachment", "jio_getAttachment")\n
.declareAcquiredMethod("translateHtml", "translateHtml")\n
.declareAcquiredMethod("whoWantToDisplayThisPage", "whoWantToDisplayThisPage")\n
.declareAcquiredMethod("renderPageHeader", "renderPageHeader")\n
.declareAcquiredMethod("getUrlFor", "getUrlFor")\n
.declareAcquiredMethod("updateHeader", "updateHeader")\n
\n
/////////////////////////////////////////////////////////////////\n
// declared methods\n
......@@ -150,14 +150,14 @@
result_list,\n
view_list;\n
\n
return gadget.jio_getAttachment({"_id": options.jio_key, "_attachment": "links"})\n
return gadget.jio_getAttachment(options.jio_key, "links")\n
.push(function (result) {\n
var i,\n
promise_list = [\n
gadget.whoWantToDisplayThisPage({name: options.view, editable: options.editable}),\n
gadget.whoWantToDisplayThisPage({name: options.view, editable: options.editable, page: "breadcrumb"})\n
gadget.getUrlFor({jio_key: options.jio_key, view: options.view, editable: options.editable}),\n
gadget.getUrlFor({jio_key: options.jio_key, view: options.view, editable: options.editable, page: "breadcrumb"})\n
];\n
erp5_document = result.data;\n
erp5_document = result;\n
view_list = erp5_document._links.action_workflow || [];\n
\n
if (view_list.constructor !== Array) {\n
......@@ -165,8 +165,9 @@
}\n
\n
for (i = 0; i < view_list.length; i += 1) {\n
promise_list.push(gadget.whoWantToDisplayThisPage({\n
name: view_list[i].href\n
promise_list.push(gadget.getUrlFor({\n
jio_key: options.jio_key,\n
view: view_list[i].href\n
}));\n
}\n
return RSVP.all(promise_list);\n
......@@ -194,7 +195,7 @@
.push(function (my_translated_html) {\n
gadget.props.element.innerHTML = my_translated_html;\n
\n
return gadget.renderPageHeader({\n
return gadget.updateHeader({\n
back_url: result_list[0],\n
page_title: erp5_document.title,\n
breadcrumb_url: result_list[1]\n
......@@ -339,7 +340,7 @@
</item>
<item>
<key> <string>serial</string> </key>
<value> <string>940.49126.4849.49664</string> </value>
<value> <string>945.52786.43920.26777</string> </value>
</item>
<item>
<key> <string>state</string> </key>
......@@ -357,7 +358,7 @@
</tuple>
<state>
<tuple>
<float>1423066988.75</float>
<float>1442504825.27</float>
<string>GMT</string>
</tuple>
</state>
......
......@@ -135,10 +135,9 @@
// Acquired methods\n
/////////////////////////////////////////////////////////////////\n
.declareAcquiredMethod("jio_getAttachment", "jio_getAttachment")\n
.declareAcquiredMethod("whoWantToDisplayThisPage", "whoWantToDisplayThisPage")\n
.declareAcquiredMethod("whoWantToDisplayThis", "whoWantToDisplayThis")\n
.declareAcquiredMethod("getUrlFor", "getUrlFor")\n
.declareAcquiredMethod("updateHeader", "updateHeader")\n
.declareAcquiredMethod("translateHtml", "translateHtml")\n
.declareAcquiredMethod("renderPageHeader", "renderPageHeader")\n
\n
/////////////////////////////////////////////////////////////////\n
// declared methods\n
......@@ -166,16 +165,16 @@
});\n
} else {\n
// Parent is an ERP5 document\n
return gadget.whoWantToDisplayThis(jio_key)\n
return gadget.getUrlFor({jio_key: jio_key})\n
.push(function (parent_href) {\n
parent_list.unshift({\n
title: parent_link.name,\n
link: parent_href\n
});\n
return gadget.jio_getAttachment({"_id": jio_key, "_attachment": "links"});\n
return gadget.jio_getAttachment(jio_key, "links");\n
})\n
.push(function (result) {\n
handleParent(result.data._links.parent || "#");\n
handleParent(result._links.parent || "#");\n
});\n
}\n
\n
......@@ -183,13 +182,13 @@
});\n
}\n
\n
return gadget.whoWantToDisplayThisPage({name: options.view, editable: options.editable})\n
return gadget.getUrlFor({jio_key: options.jio_key, view: options.view, editable: options.editable})\n
.push(function (back_url) {\n
header_options.back_url = back_url;\n
return gadget.jio_getAttachment({"_id": options.jio_key, "_attachment": "links"});\n
return gadget.jio_getAttachment(options.jio_key, "links");\n
})\n
.push(function (result) {\n
erp5_document = result.data;\n
erp5_document = result;\n
header_options.page_title = erp5_document.title;\n
parent_queue = new RSVP.Queue();\n
\n
......@@ -205,7 +204,7 @@
})\n
.push(function (my_translated_html) {\n
gadget.props.element.innerHTML = my_translated_html;\n
return gadget.renderPageHeader(header_options);\n
return gadget.updateHeader(header_options);\n
});\n
});\n
\n
......@@ -344,7 +343,7 @@
</item>
<item>
<key> <string>serial</string> </key>
<value> <string>940.49124.20596.60757</string> </value>
<value> <string>945.52768.52090.60757</string> </value>
</item>
<item>
<key> <string>state</string> </key>
......@@ -362,7 +361,7 @@
</tuple>
<state>
<tuple>
<float>1423066901.42</float>
<float>1442504878.86</float>
<string>GMT</string>
</tuple>
</state>
......
......@@ -132,11 +132,10 @@
/////////////////////////////////////////////////////////////////\n
// acquisition\n
/////////////////////////////////////////////////////////////////\n
.declareAcquiredMethod("aq_putAttachment", "aq_putAttachment")\n
.declareAcquiredMethod("pleaseRedirectMyHash", "pleaseRedirectMyHash")\n
.declareAcquiredMethod("whoWantToDisplayThisPage", "whoWantToDisplayThisPage")\n
.declareAcquiredMethod("whoWantToDisplayThis", "whoWantToDisplayThis")\n
.declareAcquiredMethod("renderPageHeader", "renderPageHeader")\n
.declareAcquiredMethod("jio_putAttachment", "jio_putAttachment")\n
.declareAcquiredMethod("redirect", "redirect")\n
.declareAcquiredMethod("getUrlFor", "getUrlFor")\n
.declareAcquiredMethod("updateHeader", "updateHeader")\n
.declareAcquiredMethod("notifySubmitting", "notifySubmitting")\n
.declareAcquiredMethod("notifySubmitted", "notifySubmitted")\n
.declareAcquiredMethod("translateHtml", "translateHtml")\n
......@@ -213,12 +212,12 @@
section.innerHTML = my_translation_html;\n
return RSVP.all([\n
erp5_form.render(form_options),\n
form_gadget.whoWantToDisplayThis(options.jio_key),\n
form_gadget.whoWantToDisplayThisPage({page: "breadcrumb"})\n
form_gadget.getUrlFor({jio_key: form_gadget.props.id}),\n
form_gadget.getUrlFor({jio_key: form_gadget.props.id, page: "breadcrumb"})\n
]);\n
})\n
.push(function (all_result) {\n
return form_gadget.renderPageHeader({\n
return form_gadget.updateHeader({\n
cancel_url: all_result[1],\n
page_title: options.erp5_document.title,\n
breadcrumb_url: all_result[2],\n
......@@ -247,35 +246,30 @@
data[form_gadget.props.form_id.key] =\n
form_gadget.props.form_id[\'default\'];\n
// XXX Hardcoded\n
data.dialog_id =\n
form_gadget.props.form_id[\'default\'];\n
data.dialog_method = \n
form_gadget.props.action.action;\n
data.dialog_id = form_gadget.props.form_id[\'default\'];\n
data.dialog_method = form_gadget.props.action.action;\n
for (key in content_dict) {\n
if (content_dict.hasOwnProperty(key)) {\n
data[key] = content_dict[key];\n
}\n
}\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
return form_gadget.jio_putAttachment(\n
form_gadget.props.id,\n
form_gadget.props.action.href,\n
data\n
);\n
\n
})\n
.push(function (evt) {\n
var location = evt.target.getResponseHeader("X-Location");\n
if (location === undefined || location === null) {\n
// No redirection, stay on the same document\n
return form_gadget.whoWantToDisplayThisPage({name: "view"});\n
return form_gadget.getUrlFor({jio_key: form_gadget.props.id, view: "view"});\n
}\n
return form_gadget.whoWantToDisplayThis(new URI(location).segment(2), {editable: form_gadget.props.editable});\n
})\n
.push(function (url) {\n
return RSVP.all([\n
form_gadget.notifySubmitted(),\n
form_gadget.pleaseRedirectMyHash(url)\n
form_gadget.redirect({jio_key: new URI(location).segment(2), editable: form_gadget.props.editable})\n
]);\n
});\n
}\n
......@@ -412,7 +406,7 @@
</item>
<item>
<key> <string>actor</string> </key>
<value> <string>xiaowu</string> </value>
<value> <string>romain</string> </value>
</item>
<item>
<key> <string>comment</string> </key>
......@@ -426,7 +420,7 @@
</item>
<item>
<key> <string>serial</string> </key>
<value> <string>942.54421.21287.62378</string> </value>
<value> <string>945.54063.48707.15940</string> </value>
</item>
<item>
<key> <string>state</string> </key>
......@@ -444,8 +438,8 @@
</tuple>
<state>
<tuple>
<float>1430897308.57</float>
<string>UTC</string>
<float>1442581458.69</float>
<string>GMT</string>
</tuple>
</state>
</object>
......
......@@ -109,8 +109,8 @@
/////////////////////////////////////////////////////////////////\n
// Acquired methods\n
/////////////////////////////////////////////////////////////////\n
.declareAcquiredMethod("renderPageHeader", "renderPageHeader")\n
.declareAcquiredMethod("whoWantToDisplayThisPage", "whoWantToDisplayThisPage")\n
.declareAcquiredMethod("updateHeader", "updateHeader")\n
.declareAcquiredMethod("getUrlFor", "getUrlFor")\n
\n
/////////////////////////////////////////////////////////////////\n
// declared methods\n
......@@ -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.href, editable: true});\n
new_content_action = gadget.getUrlFor({jio_key: options.jio_key, view: new_content_action.href, editable: true});\n
} else {\n
new_content_action = "";\n
}\n
......@@ -141,16 +141,16 @@
return RSVP.all([\n
gadget.getDeclaredGadget("erp5_searchfield"),\n
gadget.getDeclaredGadget("erp5_form"),\n
gadget.whoWantToDisplayThisPage({name: options.view, page: "breadcrumb"}),\n
gadget.getUrlFor({jio_key: options.jio_key, view: options.view, page: "breadcrumb"}),\n
new_content_action,\n
gadget.whoWantToDisplayThisPage({page: "action", name: options.view})\n
gadget.getUrlFor({jio_key: options.jio_key, page: "action", view: options.view})\n
]);\n
})\n
.push(function (all_gadget) {\n
return RSVP.all([\n
all_gadget[0].render(search_options),\n
all_gadget[1].render(form_options),\n
gadget.renderPageHeader({\n
gadget.updateHeader({\n
panel_action: true,\n
jump_url: "",\n
cut_url: "",\n
......@@ -301,7 +301,7 @@
</item>
<item>
<key> <string>serial</string> </key>
<value> <string>940.49123.7425.11349</string> </value>
<value> <string>945.52360.36060.34423</string> </value>
</item>
<item>
<key> <string>state</string> </key>
......@@ -319,7 +319,7 @@
</tuple>
<state>
<tuple>
<float>1423066273.81</float>
<float>1442480580.57</float>
<string>GMT</string>
</tuple>
</state>
......
......@@ -128,11 +128,10 @@
});\n
})\n
\n
.declareAcquiredMethod("aq_putAttachment", "aq_putAttachment")\n
.declareAcquiredMethod("jio_putAttachment", "jio_putAttachment")\n
.declareAcquiredMethod("translateHtml", "translateHtml")\n
.declareAcquiredMethod("whoWantToDisplayThisPage", "whoWantToDisplayThisPage")\n
.declareAcquiredMethod("whoWantToDisplayThis", "whoWantToDisplayThis")\n
.declareAcquiredMethod("renderPageHeader", "renderPageHeader")\n
.declareAcquiredMethod("getUrlFor", "getUrlFor")\n
.declareAcquiredMethod("updateHeader", "updateHeader")\n
.declareAcquiredMethod("notifySubmitting", "notifySubmitting")\n
.declareAcquiredMethod("notifySubmitted", "notifySubmitted")\n
\n
......@@ -162,24 +161,24 @@
\n
new_content_action = options.erp5_document._links.action_object_new_content_action;\n
if (new_content_action !== undefined) {\n
new_content_action = form_gadget.whoWantToDisplayThisPage({name: new_content_action.href, editable: true});\n
new_content_action = form_gadget.getUrlFor({jio_key: options.jio_key, view: new_content_action.href, editable: true});\n
} else {\n
new_content_action = "";\n
}\n
\n
return RSVP.all([\n
erp5_form.render(form_options),\n
form_gadget.whoWantToDisplayThis(options.jio_key),\n
form_gadget.whoWantToDisplayThisPage({page: "tab", name: options.view}),\n
form_gadget.whoWantToDisplayThisPage({page: "action", name: options.view, editable: true}),\n
form_gadget.whoWantToDisplayThisPage({page: "breadcrumb", name: options.view, editable: true}),\n
form_gadget.getUrlFor({jio_key: options.jio_key}),\n
form_gadget.getUrlFor({jio_key: options.jio_key, page: "tab", view: options.view}),\n
form_gadget.getUrlFor({jio_key: options.jio_key, page: "action", view: options.view, editable: true}),\n
form_gadget.getUrlFor({jio_key: options.jio_key, page: "breadcrumb", view: options.view, editable: true}),\n
new_content_action,\n
form_gadget.whoWantToDisplayThis((new URI(options.erp5_document._links.parent.href)).segment(2))\n
form_gadget.getUrlFor({jio_key: (new URI(options.erp5_document._links.parent.href)).segment(2)})\n
]);\n
})\n
.push(function (all_result) {\n
\n
return form_gadget.renderPageHeader({\n
return form_gadget.updateHeader({\n
tab_url: all_result[2],\n
cut_url: "",\n
actions_url: all_result[3],\n
......@@ -218,11 +217,11 @@
\n
return RSVP.all([\n
form_gadget.notifySubmitting(),\n
form_gadget.aq_putAttachment({\n
"_id": form_gadget.props.id,\n
"_attachment": form_gadget.props.action.href,\n
"_data": data\n
})\n
form_gadget.jio_putAttachment(\n
form_gadget.props.id,\n
form_gadget.props.action.href,\n
data\n
)\n
]);\n
})\n
.push(form_gadget.notifySubmitted.bind(form_gadget));\n
......@@ -360,7 +359,7 @@
</item>
<item>
<key> <string>actor</string> </key>
<value> <string>xiaowu</string> </value>
<value> <string>romain</string> </value>
</item>
<item>
<key> <string>comment</string> </key>
......@@ -374,7 +373,7 @@
</item>
<item>
<key> <string>serial</string> </key>
<value> <string>943.1808.36899.34116</string> </value>
<value> <string>945.52387.43932.904</string> </value>
</item>
<item>
<key> <string>state</string> </key>
......@@ -392,8 +391,8 @@
</tuple>
<state>
<tuple>
<float>1433215251.09</float>
<string>UTC</string>
<float>1442505369.77</float>
<string>GMT</string>
</tuple>
</state>
</object>
......
......@@ -121,9 +121,8 @@
/////////////////////////////////////////////////////////////////\n
// Acquired methods\n
/////////////////////////////////////////////////////////////////\n
.declareAcquiredMethod("renderPageHeader", "renderPageHeader")\n
.declareAcquiredMethod("whoWantToDisplayThisPage", "whoWantToDisplayThisPage")\n
.declareAcquiredMethod("whoWantToDisplayThis", "whoWantToDisplayThis")\n
.declareAcquiredMethod("updateHeader", "updateHeader")\n
.declareAcquiredMethod("getUrlFor", "getUrlFor")\n
\n
/////////////////////////////////////////////////////////////////\n
// declared methods\n
......@@ -155,15 +154,15 @@
\n
return RSVP.all([\n
form_gadget.render(form_options),\n
gadget.whoWantToDisplayThisPage({name: options.view, editable: true}),\n
gadget.whoWantToDisplayThisPage({page: "action", name: options.view}),\n
gadget.whoWantToDisplayThisPage({page: "breadcrumb", name: options.view}),\n
gadget.whoWantToDisplayThis((new URI(options.erp5_document._links.parent.href)).segment(2))\n
gadget.getUrlFor({jio_key: options.jio_key, view: options.view, editable: true}),\n
gadget.getUrlFor({jio_key: options.jio_key, page: "action", view: options.view}),\n
gadget.getUrlFor({jio_key: options.jio_key, page: "breadcrumb", view: options.view}),\n
gadget.getUrlFor({jio_key: (new URI(options.erp5_document._links.parent.href)).segment(2)})\n
]);\n
})\n
.push(function (all_result) {\n
\n
return gadget.renderPageHeader({\n
return gadget.updateHeader({\n
jump_url: "",\n
actions_url: all_result[2],\n
previous_url: "",\n
......@@ -300,7 +299,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>
......@@ -314,7 +313,7 @@
</item>
<item>
<key> <string>serial</string> </key>
<value> <string>940.21776.61223.15274</string> </value>
<value> <string>945.52385.13762.21094</string> </value>
</item>
<item>
<key> <string>state</string> </key>
......@@ -332,7 +331,7 @@
</tuple>
<state>
<tuple>
<float>1421415462.01</float>
<float>1442481653.09</float>
<string>GMT</string>
</tuple>
</state>
......
......@@ -107,6 +107,8 @@
"use strict";\n
\n
var gadget_klass = rJS(window);\n
// DEFAULT_VIEW_REFERENCE = "view";\n
\n
gadget_klass\n
/////////////////////////////////////////////////////////////////\n
// ready\n
......@@ -128,6 +130,8 @@
// Acquired methods\n
/////////////////////////////////////////////////////////////////\n
.declareAcquiredMethod("jio_getAttachment", "jio_getAttachment")\n
.declareAcquiredMethod("updateHeader", "updateHeader")\n
.declareAcquiredMethod("getUrlFor", "getUrlFor")\n
\n
/////////////////////////////////////////////////////////////////\n
// declared methods\n
......@@ -145,14 +149,16 @@
erp5_form,\n
form_gadget;\n
\n
return gadget.jio_getAttachment({"_id": options.jio_key, "_attachment": options.view})\n
gadget.props.jio_key = options.jio_key;\n
\n
return gadget.jio_getAttachment(options.jio_key, 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_getAttachment({"_id": uri.segment(2), "_attachment": "view"});\n
var uri = new URI(result._embedded._view._links.form_definition.href);\n
erp5_document = result;\n
return gadget.jio_getAttachment(uri.segment(2), "view");\n
})\n
.push(function (result) {\n
erp5_form = result.data;\n
erp5_form = result;\n
\n
var url = "gadget_erp5_pt_" + erp5_form.pt;\n
// XXX Hardcoded specific behaviour for form_view\n
......@@ -312,7 +318,7 @@
</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 +332,7 @@
</item>
<item>
<key> <string>serial</string> </key>
<value> <string>943.5835.57925.8345</string> </value>
<value> <string>945.52795.14466.59955</string> </value>
</item>
<item>
<key> <string>state</string> </key>
......@@ -344,8 +350,8 @@
</tuple>
<state>
<tuple>
<float>1433215427.98</float>
<string>UTC</string>
<float>1442581661.41</float>
<string>GMT</string>
</tuple>
</state>
</object>
......
......@@ -138,8 +138,7 @@
/////////////////////////////////////////////////////////////////\n
.declareAcquiredMethod("jio_allDocs", "jio_allDocs")\n
.declareAcquiredMethod("translateHtml", "translateHtml")\n
.declareAcquiredMethod("whoWantToDisplayThis",\n
"whoWantToDisplayThis")\n
.declareAcquiredMethod("getUrlFor", "getUrlFor")\n
\n
/////////////////////////////////////////////////////////////////\n
// declared methods\n
......@@ -157,7 +156,7 @@
i;\n
for (i = 0; i < result.data.rows.length; i += 1) {\n
result_list.push(RSVP.all([\n
gadget.whoWantToDisplayThis(result.data.rows[i].id),\n
gadget.getUrlFor({jio_key: result.data.rows[i].id}),\n
result.data.rows[i].value.title || result.data.rows[i].id,\n
result.data.rows[i].value.business_application_title\n
]));\n
......@@ -370,7 +369,7 @@
</item>
<item>
<key> <string>serial</string> </key>
<value> <string>940.11553.26313.55261</string> </value>
<value> <string>945.49517.32009.34013</string> </value>
</item>
<item>
<key> <string>state</string> </key>
......@@ -388,7 +387,7 @@
</tuple>
<state>
<tuple>
<float>1425475569.42</float>
<float>1442308668.56</float>
<string>GMT</string>
</tuple>
</state>
......
......@@ -124,7 +124,7 @@
/////////////////////////////////////////////////////////////////\n
// handle acquisition\n
/////////////////////////////////////////////////////////////////\n
.declareAcquiredMethod("pleaseRedirectMyHash", "pleaseRedirectMyHash")\n
.declareAcquiredMethod("redirect", "redirect")\n
.declareAcquiredMethod("translateHtml", "translateHtml")\n
\n
/////////////////////////////////////////////////////////////////\n
......@@ -161,7 +161,7 @@
\n
document.cookie = "__ac=" + window.btoa(login + ":" + passwd);\n
// XXX Hardcoded non generic redirection to the frontpage\n
return form_gadget.pleaseRedirectMyHash("#");\n
return form_gadget.redirect({});\n
});\n
\n
});\n
......@@ -286,7 +286,7 @@
</item>
<item>
<key> <string>actor</string> </key>
<value> <string>xiaowu</string> </value>
<value> <string>romain</string> </value>
</item>
<item>
<key> <string>comment</string> </key>
......@@ -300,7 +300,7 @@
</item>
<item>
<key> <string>serial</string> </key>
<value> <string>942.35810.36101.14694</string> </value>
<value> <string>945.43780.3884.33979</string> </value>
</item>
<item>
<key> <string>state</string> </key>
......@@ -318,8 +318,8 @@
</tuple>
<state>
<tuple>
<float>1430143960.53</float>
<string>UTC</string>
<float>1442484467.19</float>
<string>GMT</string>
</tuple>
</state>
</object>
......
......@@ -123,17 +123,15 @@
/////////////////////////////////////////////////////////////////\n
// handle acquisition\n
/////////////////////////////////////////////////////////////////\n
.declareAcquiredMethod("pleaseRedirectMyHash", "pleaseRedirectMyHash")\n
.declareAcquiredMethod("redirect", "redirect")\n
.declareAcquiredMethod("translateHtml", "translateHtml")\n
.declareAcquiredMethod("whoWantToDisplayThisFrontPage",\n
"whoWantToDisplayThisFrontPage")\n
.declareAcquiredMethod("getUrlFor", "getUrlFor")\n
\n
/////////////////////////////////////////////////////////////////\n
// declared methods\n
/////////////////////////////////////////////////////////////////\n
.declareMethod("render", function () {\n
var gadget = this,\n
a;\n
var gadget = this;\n
return new RSVP.Queue()\n
.push(function () {\n
return gadget.translateHtml(gadget.props.element.innerHTML);\n
......@@ -153,12 +151,9 @@
false\n
);\n
})\n
.push(function (evt) {\n
.push(function () {\n
document.cookie = "__ac=" + "=;expires=Thu, 01 Jan 1970 00:00:01 GMT;";\n
return form_gadget.whoWantToDisplayThisFrontPage("login");\n
})\n
.push(function (url) {\n
return form_gadget.pleaseRedirectMyHash(url);\n
return form_gadget.redirect({page: "login"});\n
});\n
});\n
}(window, document, rJS, RSVP, promiseEventListener));</string> </value>
......@@ -282,7 +277,7 @@
</item>
<item>
<key> <string>actor</string> </key>
<value> <string>xiaowu</string> </value>
<value> <string>romain</string> </value>
</item>
<item>
<key> <string>comment</string> </key>
......@@ -296,7 +291,7 @@
</item>
<item>
<key> <string>serial</string> </key>
<value> <string>942.40612.39127.41710</string> </value>
<value> <string>945.52448.28806.29303</string> </value>
</item>
<item>
<key> <string>state</string> </key>
......@@ -314,8 +309,8 @@
</tuple>
<state>
<tuple>
<float>1430152079.87</float>
<string>UTC</string>
<float>1442581739.77</float>
<string>GMT</string>
</tuple>
</state>
</object>
......
......@@ -137,9 +137,9 @@
// Acquired methods\n
/////////////////////////////////////////////////////////////////\n
.declareAcquiredMethod("jio_getAttachment", "jio_getAttachment")\n
.declareAcquiredMethod("whoWantToDisplayThisPage", "whoWantToDisplayThisPage")\n
.declareAcquiredMethod("getUrlFor", "getUrlFor")\n
.declareAcquiredMethod("translateHtml", "translateHtml")\n
.declareAcquiredMethod("renderPageHeader", "renderPageHeader")\n
.declareAcquiredMethod("updateHeader", "updateHeader")\n
\n
/////////////////////////////////////////////////////////////////\n
// declared methods\n
......@@ -150,9 +150,9 @@
tab_list = [],\n
gadget = this;\n
\n
return gadget.jio_getAttachment({"_id": options.jio_key, "_attachment": "links"})\n
return gadget.jio_getAttachment(options.jio_key, "links")\n
.push(function (result) {\n
var erp5_document = result.data,\n
var erp5_document = result,\n
i,\n
promise_list = [];\n
view_list = erp5_document._links.view;\n
......@@ -167,13 +167,15 @@
if (options.view === view_list[i].href) {\n
matching = i;\n
}\n
promise_list.push(gadget.whoWantToDisplayThisPage({\n
name: view_list[i].href,\n
promise_list.push(gadget.getUrlFor({\n
jio_key: options.jio_key,\n
view: view_list[i].href,\n
editable: true\n
}));\n
}\n
promise_list.push(gadget.whoWantToDisplayThisPage({\n
name: "view"\n
promise_list.push(gadget.getUrlFor({\n
jio_key: options.jio_key,\n
view: "view"\n
}));\n
return RSVP.all(promise_list);\n
})\n
......@@ -207,16 +209,17 @@
gadget.props.element.innerHTML = my_translated_html;\n
\n
if (matching !== undefined) {\n
return gadget.renderPageHeader({\n
return gadget.updateHeader({\n
cancel_url: tab_list[matching].link\n
});\n
}\n
return gadget.whoWantToDisplayThisPage({\n
name: "view",\n
return gadget.getUrlFor({\n
jio_key: options.jio_key,\n
view: "view",\n
editable: true\n
})\n
.push(function (url) {\n
return gadget.renderPageHeader({cancel_url: url});\n
return gadget.updateHeader({cancel_url: url});\n
});\n
\n
});\n
......@@ -359,7 +362,7 @@
</item>
<item>
<key> <string>serial</string> </key>
<value> <string>940.49264.57640.4352</string> </value>
<value> <string>945.52770.44221.26572</string> </value>
</item>
<item>
<key> <string>state</string> </key>
......@@ -377,7 +380,7 @@
</tuple>
<state>
<tuple>
<float>1423065230.54</float>
<float>1442504976.31</float>
<string>GMT</string>
</tuple>
</state>
......
......@@ -279,7 +279,7 @@ promiseEventListener */\n
if (target_url && field_json.allow_jump) {\n
return new RSVP.Queue()\n
.push(function () {\n
return my_gadget.whoWantToDisplayThis(target_url);\n
return my_gadget.getUrlFor({jio_key: target_url});\n
})\n
.push(function (my_url) {\n
var plane = props.plane;\n
......@@ -425,8 +425,7 @@ promiseEventListener */\n
.declareAcquiredMethod("notifyChange", "notifyChange")\n
.declareAcquiredMethod("jio_allDocs", "jio_allDocs")\n
.declareAcquiredMethod("translateHtml", "translateHtml")\n
.declareAcquiredMethod("whoWantToDisplayThis", "whoWantToDisplayThis")\n
.declareAcquiredMethod("pleasePublishMyState", "pleasePublishMyState")\n
.declareAcquiredMethod("getUrlFor", "getUrlFor")\n
\n
/////////////////////////////////////////////////////////////////\n
// declared methods\n
......@@ -746,7 +745,7 @@ promiseEventListener */\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>
......@@ -760,7 +759,7 @@ promiseEventListener */\n
</item>
<item>
<key> <string>serial</string> </key>
<value> <string>943.42133.40166.22033</string> </value>
<value> <string>945.52421.57221.18466</string> </value>
</item>
<item>
<key> <string>state</string> </key>
......@@ -778,8 +777,8 @@ promiseEventListener */\n
</tuple>
<state>
<tuple>
<float>1434088187.82</float>
<string>UTC</string>
<float>1442502350.67</float>
<string>GMT</string>
</tuple>
</state>
</object>
......
......@@ -66,7 +66,9 @@
<item>
<key> <string>categories</string> </key>
<value>
<tuple/>
<tuple>
<string>classification/collaborative/team</string>
</tuple>
</value>
</item>
<item>
......@@ -79,15 +81,9 @@
<key> <string>content_type</string> </key>
<value> <string>text/html</string> </value>
</item>
<item>
<key> <string>contributors</string> </key>
<value>
<tuple/>
</value>
</item>
<item>
<key> <string>default_reference</string> </key>
<value> <string>officejs_launcher.html</string> </value>
<value> <string>gadget_erp5_router.html</string> </value>
</item>
<item>
<key> <string>description</string> </key>
......@@ -97,7 +93,7 @@
</item>
<item>
<key> <string>id</string> </key>
<value> <string>officejs_launcher_html</string> </value>
<value> <string>rjs_gadget_erp5_router_html</string> </value>
</item>
<item>
<key> <string>language</string> </key>
......@@ -117,85 +113,30 @@
<key> <string>text_content</string> </key>
<value> <string encoding="cdata"><![CDATA[
<!doctype html>\n
<html manifest="${manifest_url}">\n
<!DOCTYPE html>\n
<html>\n
<head>\n
<meta charset="utf-8">\n
<meta name="viewport" content="width=device-width, initial-scale=1">\n
<link rel="shortcut icon" href="favicon.ico">\n
<meta charset="utf-8" />\n
<meta name="viewport" content="width=device-width, user-scalable=no" />\n
<title>Router Gadget</title>\n
\n
<title>${application_title}</title>\n
<!-- renderjs -->\n
<script src="rsvp.js" type="text/javascript"></script>\n
<script src="renderjs.js" type="text/javascript"></script>\n
\n
<link href="//netdna.bootstrapcdn.com/font-awesome/4.2.0/css/font-awesome.min.css" rel="stylesheet" type="text/css" />\n
<link rel="stylesheet" href="jquerymobile.css">\n
<link rel="stylesheet" href="gadget_erp5.css">\n
\n
<script data-renderjs-configuration="application_title" type="text/x-renderjs-configuration">${application_title}</script>\n
<script data-renderjs-configuration="panel_gadget" type="text/x-renderjs-configuration">${panel_gadget}</script>\n
<script data-renderjs-configuration="action_view" type="text/x-renderjs-configuration">${action_view}</script>\n
<script data-renderjs-configuration="default_view_reference" type="text/x-renderjs-configuration">${default_view_reference}</script>\n
<script data-renderjs-configuration="hateoas_url" type="text/x-renderjs-configuration">${hateoas_url}</script>\n
\n
<script src="jquery.js"></script>\n
<script src="jquerymobile.js"></script>\n
<script src="rsvp.js"></script>\n
<script src="renderjs.js"></script>\n
<script src="gadget_global.js" ></script>\n
<script src="officejs_launcher.js"></script>\n
<script src="gadget_erp5_router.js" type="text/javascript"></script>\n
\n
</head>\n
\n
<body>\n
<div data-role="page">\n
\n
<!--div data-role="panel" id="mypanel" data-position="left" data-display="overlay" data-theme="d">\n
</div-->\n
\n
<!--div data-role="header" class="gadget-header" data-theme="a">\n
<a href="#mypanel" class="ui-btn-left ui-btn ui-btn-inline ui-mini ui-corner-all"></a>\n
<div><h1 class="ui-title"></h1></div>\n
</div-->\n
\n
<div data-gadget-url="gadget_jio.html"\n
data-gadget-scope="setting_gadget"\n
data-gadget-sandbox="public"></div>\n
\n
<div data-gadget-url="${router_gadget}"\n
data-gadget-scope="router"\n
data-gadget-sandbox="public"></div>\n
\n
<div data-gadget-url="${translation_gadget}"\n
data-gadget-scope="translation_gadget"\n
data-gadget-sandbox="public"></div>\n
\n
<div data-gadget-url="${header_gadget}"\n
data-gadget-scope="header"\n
data-gadget-sandbox="public"></div>\n
\n
<div data-gadget-url="${jio_gadget}"\n
data-gadget-scope="jio_gadget"\n
data-gadget-sandbox="public"></div>\n
\n
<div data-gadget-url="${panel_gadget}"\n
data-gadget-scope="panel"\n
data-gadget-sandbox="public"></div>\n
\n
<div role="main" class="ui-content gadget-content"></div>\n
</div>\n
\n
</body>\n
</html>\n
]]></string> </value>
</item>
<item>
<key> <string>text_content_substitution_mapping_method_id</string> </key>
<value> <string>WebPage_getRenderJSSubstitutionMappingDict</string> </value>
</item>
<item>
<key> <string>title</string> </key>
<value> <string>OfficeJS Application Launcher</string> </value>
<value> <string>ERP5 Gadget Router</string> </value>
</item>
<item>
<key> <string>version</string> </key>
......@@ -281,7 +222,7 @@
</tuple>
<state>
<tuple>
<float>1440771124.2</float>
<float>1441962282.18</float>
<string>GMT</string>
</tuple>
</state>
......@@ -326,7 +267,7 @@
</item>
<item>
<key> <string>serial</string> </key>
<value> <string>945.51278.32202.51865</string> </value>
<value> <string>945.43744.60869.2304</string> </value>
</item>
<item>
<key> <string>state</string> </key>
......@@ -344,7 +285,7 @@
</tuple>
<state>
<tuple>
<float>1442414326.94</float>
<float>1442582305.38</float>
<string>GMT</string>
</tuple>
</state>
......@@ -401,7 +342,7 @@
</tuple>
<state>
<tuple>
<float>1440770776.61</float>
<float>1441962223.79</float>
<string>GMT</string>
</tuple>
</state>
......
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="Web Script" module="erp5.portal_type"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>_Access_contents_information_Permission</string> </key>
<value>
<tuple>
<string>Anonymous</string>
<string>Assignee</string>
<string>Assignor</string>
<string>Associate</string>
<string>Auditor</string>
<string>Manager</string>
<string>Owner</string>
</tuple>
</value>
</item>
<item>
<key> <string>_Add_portal_content_Permission</string> </key>
<value>
<tuple>
<string>Assignee</string>
<string>Assignor</string>
<string>Manager</string>
</tuple>
</value>
</item>
<item>
<key> <string>_Change_local_roles_Permission</string> </key>
<value>
<tuple>
<string>Assignor</string>
<string>Manager</string>
</tuple>
</value>
</item>
<item>
<key> <string>_Modify_portal_content_Permission</string> </key>
<value>
<tuple>
<string>Assignee</string>
<string>Assignor</string>
<string>Manager</string>
</tuple>
</value>
</item>
<item>
<key> <string>_View_Permission</string> </key>
<value>
<tuple>
<string>Anonymous</string>
<string>Assignee</string>
<string>Assignor</string>
<string>Associate</string>
<string>Auditor</string>
<string>Manager</string>
<string>Owner</string>
</tuple>
</value>
</item>
<item>
<key> <string>categories</string> </key>
<value>
<tuple>
<string>classification/collaborative/team</string>
</tuple>
</value>
</item>
<item>
<key> <string>content_md5</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>default_reference</string> </key>
<value> <string>gadget_erp5_router.js</string> </value>
</item>
<item>
<key> <string>description</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>rjs_gadget_erp5_router_js</string> </value>
</item>
<item>
<key> <string>language</string> </key>
<value> <string>en</string> </value>
</item>
<item>
<key> <string>portal_type</string> </key>
<value> <string>Web Script</string> </value>
</item>
<item>
<key> <string>short_title</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>text_content</string> </key>
<value> <string encoding="cdata"><![CDATA[
/*global window, rJS */\n
/*jslint nomen: true, indent: 2 */\n
(function (window, rJS) {\n
"use strict";\n
\n
rJS(window)\n
\n
.declareMethod(\'route\', function (options) {\n
\n
if ((options.jio_key !== undefined) && (options.page === undefined)) {\n
options.page = "form";\n
// XXX Hardcoded default \'view\'\n
options.view = options.view || \'view\';\n
}\n
if (options.page === undefined) {\n
options.page = \'front\';\n
}\n
return {\n
url: "gadget_erp5_page_" + options.page + ".html",\n
options: options\n
};\n
});\n
\n
}(window, rJS));\n
]]></string> </value>
</item>
<item>
<key> <string>title</string> </key>
<value> <string>ERP5 Gadget Router JS</string> </value>
</item>
<item>
<key> <string>version</string> </key>
<value> <string>001</string> </value>
</item>
<item>
<key> <string>workflow_history</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAI=</string> </persistent>
</value>
</item>
</dictionary>
</pickle>
</record>
<record id="2" aka="AAAAAAAAAAI=">
<pickle>
<global name="PersistentMapping" module="Persistence.mapping"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>data</string> </key>
<value>
<dictionary>
<item>
<key> <string>document_publication_workflow</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAM=</string> </persistent>
</value>
</item>
<item>
<key> <string>edit_workflow</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAQ=</string> </persistent>
</value>
</item>
<item>
<key> <string>processing_status_workflow</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAU=</string> </persistent>
</value>
</item>
</dictionary>
</value>
</item>
</dictionary>
</pickle>
</record>
<record id="3" aka="AAAAAAAAAAM=">
<pickle>
<global name="WorkflowHistoryList" module="Products.ERP5Type.patches.WorkflowTool"/>
</pickle>
<pickle>
<tuple>
<none/>
<list>
<dictionary>
<item>
<key> <string>action</string> </key>
<value> <string>publish_alive</string> </value>
</item>
<item>
<key> <string>actor</string> </key>
<value> <string>romain</string> </value>
</item>
<item>
<key> <string>comment</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>error_message</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>time</string> </key>
<value>
<object>
<klass>
<global name="DateTime" module="DateTime.DateTime"/>
</klass>
<tuple>
<none/>
</tuple>
<state>
<tuple>
<float>1441962261.87</float>
<string>GMT</string>
</tuple>
</state>
</object>
</value>
</item>
<item>
<key> <string>validation_state</string> </key>
<value> <string>published_alive</string> </value>
</item>
</dictionary>
</list>
</tuple>
</pickle>
</record>
<record id="4" aka="AAAAAAAAAAQ=">
<pickle>
<global name="WorkflowHistoryList" module="Products.ERP5Type.patches.WorkflowTool"/>
</pickle>
<pickle>
<tuple>
<none/>
<list>
<dictionary>
<item>
<key> <string>action</string> </key>
<value> <string>edit</string> </value>
</item>
<item>
<key> <string>actor</string> </key>
<value> <string>romain</string> </value>
</item>
<item>
<key> <string>comment</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>error_message</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>serial</string> </key>
<value> <string>945.54079.55977.57258</string> </value>
</item>
<item>
<key> <string>state</string> </key>
<value> <string>current</string> </value>
</item>
<item>
<key> <string>time</string> </key>
<value>
<object>
<klass>
<global name="DateTime" module="DateTime.DateTime"/>
</klass>
<tuple>
<none/>
</tuple>
<state>
<tuple>
<float>1442582410.13</float>
<string>GMT</string>
</tuple>
</state>
</object>
</value>
</item>
</dictionary>
</list>
</tuple>
</pickle>
</record>
<record id="5" aka="AAAAAAAAAAU=">
<pickle>
<global name="WorkflowHistoryList" module="Products.ERP5Type.patches.WorkflowTool"/>
</pickle>
<pickle>
<tuple>
<none/>
<list>
<dictionary>
<item>
<key> <string>action</string> </key>
<value> <string>detect_converted_file</string> </value>
</item>
<item>
<key> <string>actor</string> </key>
<value> <string>romain</string> </value>
</item>
<item>
<key> <string>comment</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>error_message</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>external_processing_state</string> </key>
<value> <string>converted</string> </value>
</item>
<item>
<key> <string>serial</string> </key>
<value> <string>0.0.0.0</string> </value>
</item>
<item>
<key> <string>time</string> </key>
<value>
<object>
<klass>
<global name="DateTime" module="DateTime.DateTime"/>
</klass>
<tuple>
<none/>
</tuple>
<state>
<tuple>
<float>1441962223.77</float>
<string>GMT</string>
</tuple>
</state>
</object>
</value>
</item>
</dictionary>
</list>
</tuple>
</pickle>
</record>
</ZopeData>
......@@ -199,6 +199,46 @@
<value> <string>string</string> </value>
</item>
</dictionary>
<dictionary>
<item>
<key> <string>id</string> </key>
<value> <string>configuration_translation_gadget_url</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>configuration_jio_gadget_url</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>configuration_panel_gadget_url</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>configuration_header_gadget_url</string> </value>
</item>
<item>
<key> <string>type</string> </key>
<value> <string>string</string> </value>
</item>
</dictionary>
</tuple>
</value>
</item>
......@@ -232,8 +272,8 @@
<key> <string>categories</string> </key>
<value>
<tuple>
<string>aggregate/web_page_module/rjs_gadget_erp5_html</string>
<string>caching_policy/hateoas</string>
<string>aggregate/web_page_module/rjs_gadget_erp5_html</string>
</tuple>
</value>
</item>
......@@ -249,6 +289,24 @@
<key> <string>configuration_hateoas_url</string> </key>
<value> <string>hateoas/</string> </value>
</item>
<item>
<key> <string>configuration_header_gadget_url</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>configuration_jio_gadget_url</string> </key>
<value> <string>gadget_erp5_jio.html</string> </value>
</item>
<item>
<key> <string>configuration_panel_gadget_url</string> </key>
<value> <string>gadget_erp5_panel.html</string> </value>
</item>
<item>
<key> <string>configuration_translation_gadget_url</string> </key>
<value> <string>gadget_officejs_translation.html</string> </value>
</item>
<item>
<key> <string>configuration_view_action_category</string> </key>
<value> <string>object_view</string> </value>
......@@ -267,9 +325,7 @@
</item>
<item>
<key> <string>description</string> </key>
<value>
<none/>
</value>
<value> <string>RenderJS Gadget ERP5</string> </value>
</item>
<item>
<key> <string>id</string> </key>
......@@ -470,7 +526,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>
......@@ -484,7 +540,7 @@
</item>
<item>
<key> <string>serial</string> </key>
<value> <string>944.53459.40487.3686</string> </value>
<value> <string>945.49893.7308.27852</string> </value>
</item>
<item>
<key> <string>state</string> </key>
......@@ -502,8 +558,8 @@
</tuple>
<state>
<tuple>
<float>1439219895.9</float>
<string>UTC</string>
<float>1442331571.5</float>
<string>GMT</string>
</tuple>
</state>
</object>
......
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