Commit c222dc58 authored by Romain Courteaud's avatar Romain Courteaud

[erp5_officejs] Add gadgets to share/access a jIO storage through WebRTC

parent d8629357
<?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>categories</string> </key>
<value>
<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>contributors</string> </key>
<value>
<tuple/>
</value>
</item>
<item>
<key> <string>default_reference</string> </key>
<value> <string>gadget_officejs_page_share_webrtc_jio.html</string> </value>
</item>
<item>
<key> <string>description</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>gadget_officejs_page_share_webrtc_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 charset="utf-8">\n
<meta name="viewport" content="width=device-width, initial-scale=1">\n
\n
<title>Share jIO</title>\n
\n
<script src="rsvp.js"></script>\n
<script src="renderjs.js"></script>\n
<script src="gadget_officejs_page_share_webrtc_jio.js"></script>\n
</head>\n
\n
<body>\n
<div class="ui-grid-b ui-responsive">\n
<div class="ui-block-a"></div>\n
<div class="ui-block-b">\n
<p data-i18n="This is a renderJS gadget which shares a jIO storage via WebRTC.">This is a renderJS gadget which shares a jIO storage via WebRTC.</p>\n
<h2 data-i18n="Peer list">Peer list</h2>\n
<p><span data-i18n="Connected peers:">Connected peers:</span> <span class="peer_count">0</span></p>\n
<pre class="info"></pre>\n
</div>\n
<div class="ui-block-c"></div>\n
</div>\n
\n
<div class="gadget_websocket">\n
<div data-gadget-url="gadget_websocket.html" data-gadget-scope="gadget_websocket.html">\n
</div>\n
</div>\n
<div class="gadget_webrtc_datachannel"></div>\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 Share jIO Page</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>1441024774.39</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.33680.60468.51660</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>1441358472.38</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>1440770697.61</float>
<string>GMT</string>
</tuple>
</state>
</object>
</value>
</item>
</dictionary>
</list>
</tuple>
</pickle>
</record>
</ZopeData>
<?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/>
</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>gadget_officejs_page_share_webrtc_jio.js</string> </value>
</item>
<item>
<key> <string>description</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>gadget_officejs_page_share_webrtc_jio_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, document, RSVP, console, DOMException */\n
/*jslint indent: 2, maxerr: 3 */\n
(function (window, rJS, document, RSVP, console, DOMException) {\n
"use strict";\n
\n
function dropSubGadget(gadget, scope) {\n
return gadget.getDeclaredGadget(scope)\n
.push(function (result) {\n
return result.getElement();\n
})\n
.push(function (element) {\n
if (element.parentElement) {\n
element.parentElement.removeChild(element);\n
}\n
delete gadget.state_parameter_dict.scope_ip[scope];\n
return gadget.dropGadget(scope);\n
});\n
}\n
\n
function getWebRTCScopeList(gadget) {\n
var result_list = [],\n
element_list = gadget.state_parameter_dict.element.querySelector(".gadget_webrtc_datachannel")\n
.childNodes,\n
i;\n
for (i = 0; i < element_list.length; i += 1) {\n
result_list.push(element_list[i].getAttribute("data-gadget-scope"));\n
}\n
return result_list;\n
}\n
\n
function updateInfo(gadget) {\n
var scope_list = getWebRTCScopeList(gadget),\n
i,\n
result = "";\n
for (i = 0; i < scope_list.length; i += 1) {\n
result += gadget.state_parameter_dict.scope_ip[scope_list[i]] + "\\n";\n
}\n
gadget.state_parameter_dict.element.querySelector(".info").textContent = result;\n
gadget.state_parameter_dict.element.querySelector(".peer_count").textContent = i;\n
}\n
\n
function sendWebRTC(gadget, rtc_gadget, scope, message) {\n
return rtc_gadget.send(message)\n
.push(undefined, function (error) {\n
if ((error instanceof DOMException) && (error.name === \'InvalidStateError\')) {\n
return dropSubGadget(gadget, scope)\n
.push(function () {\n
return updateInfo(gadget);\n
}, function (error) {\n
console.log("-- Can not drop remote subgadget " + scope);\n
console.log(error);\n
return;\n
});\n
}\n
throw error;\n
});\n
}\n
\n
rJS(window)\n
\n
.ready(function (gadget) {\n
// Initialize the gadget local parameters\n
gadget.state_parameter_dict = {\n
websocket_initialized: false,\n
counter: 0,\n
connecting: false,\n
scope_ip: {}\n
};\n
return gadget.getElement()\n
.push(function (element) {\n
gadget.state_parameter_dict.element = element;\n
})\n
.push(function () {\n
return updateInfo(gadget);\n
});\n
})\n
\n
.declareAcquiredMethod("jio_allDocs", "jio_allDocs")\n
.declareAcquiredMethod("jio_post", "jio_post")\n
.declareAcquiredMethod("jio_put", "jio_put")\n
.declareAcquiredMethod("jio_get", "jio_get")\n
.declareAcquiredMethod("jio_repair", "jio_repair")\n
\n
.allowPublicAcquisition(\'notifyDataChannelClosed\', function (argument_list, scope) {\n
/*jslint unparam:true*/\n
var gadget = this;\n
return dropSubGadget(this, scope)\n
.push(function () {\n
return updateInfo(gadget);\n
});\n
})\n
\n
.allowPublicAcquisition("notifyDataChannelMessage", function (argument_list, scope) {\n
var json = JSON.parse(argument_list[0]),\n
rtc_gadget,\n
context = this;\n
return context.getDeclaredGadget(scope)\n
.push(function (g) {\n
rtc_gadget = g;\n
// Call jio API\n
return context["jio_" + json.method_name].apply(context, json.argument_list);\n
})\n
.push(function (result) {\n
return sendWebRTC(context, rtc_gadget, scope, JSON.stringify({\n
id: json.id,\n
result: result,\n
type: "jio_response"\n
}));\n
}, function (error) {\n
return sendWebRTC(context, rtc_gadget, scope, JSON.stringify({\n
id: json.id,\n
result: error,\n
type: "error"\n
}));\n
});\n
})\n
/*\n
.allowPublicAcquisition("notifyWebSocketClosed", function () {\n
if (this.state_parameter_dict.user_type !== "user") {\n
throw new Error("Unexpected Web Socket connection close");\n
}\n
})\n
*/\n
.allowPublicAcquisition("notifyWebSocketMessage", function (argument_list) {\n
var json = JSON.parse(argument_list[0]),\n
scope,\n
rtc_gadget,\n
socket_gadget,\n
gadget = this;\n
\n
if (json.action === "offer") {\n
// XXX https://github.com/diafygi/webrtc-ips\n
return gadget.getDeclaredGadget("gadget_websocket.html")\n
.push(function (gg) {\n
gadget.state_parameter_dict.connecting = true;\n
gadget.state_parameter_dict.counter += 1;\n
socket_gadget = gg;\n
var new_element = document.createElement("div");\n
gadget.state_parameter_dict.element.querySelector(".gadget_webrtc_datachannel").appendChild(new_element);\n
scope = "webrtc" + gadget.state_parameter_dict.counter;\n
return gadget.declareGadget("gadget_webrtc_datachannel.html", {\n
scope: scope,\n
element: new_element\n
});\n
})\n
.push(function (gg) {\n
rtc_gadget = gg;\n
// https://github.com/diafygi/webrtc-ips\n
var ip_regex = /([0-9]{1,3}(\\.[0-9]{1,3}){3}|[a-f0-9]{1,4}(:[a-f0-9]{1,4}){7})/,\n
ip_list = [],\n
ip_dict = {},\n
ip_addr,\n
line_list = JSON.parse(json.data).sdp.split(\'\\n\'),\n
i;\n
for (i = 0; i < line_list.length; i += 1) {\n
if (line_list[i].indexOf(\'a=candidate:\') === 0) {\n
ip_addr = ip_regex.exec(line_list[i])[1];\n
if (!ip_addr.match(/^[a-f0-9]{1,4}(:[a-f0-9]{1,4}){7}$/)) {\n
// Hide ipv6\n
if (!ip_dict[ip_addr]) {\n
ip_list.push(ip_addr);\n
ip_dict[ip_addr] = true;\n
}\n
}\n
}\n
}\n
gadget.state_parameter_dict.scope_ip[scope] = ip_list;\n
return rtc_gadget.createAnswer(json.from, json.data);\n
})\n
.push(function (local_connection) {\n
return socket_gadget.send(JSON.stringify({to: json.from, action: "answer", data: local_connection}));\n
})\n
.push(function () {\n
return RSVP.any([\n
RSVP.Queue()\n
.push(function () {\n
return RSVP.delay(10000);\n
})\n
.push(function () {\n
console.info(\'-- webrtc client disappears...\');\n
return dropSubGadget(gadget, scope);\n
}),\n
rtc_gadget.waitForConnection()\n
]);\n
})\n
.push(function () {\n
gadget.state_parameter_dict.connecting = false;\n
return updateInfo(gadget);\n
});\n
}\n
})\n
\n
.declareService(function () {\n
var sgadget,\n
gadget = this;\n
return this.getDeclaredGadget(\'gadget_websocket.html\')\n
.push(function (socket_gadget) {\n
sgadget = socket_gadget;\n
return socket_gadget.createSocket("ws://127.0.0.1:9999/");\n
})\n
.push(function () {\n
// Wait for the gadget to be dropped from the page\n
// and close the socket/rtc connections\n
return RSVP.defer().promise;\n
})\n
.push(undefined, function (error) {\n
if (sgadget === undefined) {\n
return;\n
}\n
return sgadget.close()\n
.push(function () {\n
var scope_list = getWebRTCScopeList(gadget),\n
i,\n
promise_list = [];\n
\n
function close(scope) {\n
return gadget.getDeclaredGadget(scope)\n
.push(function (rtc_gadget) {\n
return rtc_gadget.close();\n
});\n
}\n
\n
for (i = 0; i < scope_list.length; i += 1) {\n
promise_list.push(close(scope_list[i]));\n
}\n
return RSVP.all(promise_list);\n
})\n
.push(function () {\n
throw error;\n
});\n
});\n
});\n
\n
}(window, rJS, document, RSVP, console, DOMException));
]]></string> </value>
</item>
<item>
<key> <string>title</string> </key>
<value> <string>OfficeJS Share jIO Page 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>1441026776.09</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.33680.49983.21452</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>1441358513.14</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>1440770697.62</float>
<string>GMT</string>
</tuple>
</state>
</object>
</value>
</item>
</dictionary>
</list>
</tuple>
</pickle>
</record>
</ZopeData>
<?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_officejs_webrtc_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>gadget_officejs_webrtc_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
<!-- custom script -->\n
<script src="gadget_officejs_webrtc_jio.js" type="text/javascript"></script>\n
</head>\n
<body>\n
<div data-gadget-url="gadget_jio.html"\n
data-gadget-scope="jio_gadget"\n
data-gadget-sandbox="public"></div>\n
\n
<div class="gadget_websocket"></div>\n
<div class="gadget_webrtc_datachannel"></div>\n
\n
</body>\n
</html>
]]></string> </value>
</item>
<item>
<key> <string>title</string> </key>
<value> <string>OfficeJS WebRTC Jio Gadget</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>1440000227.2</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.32246.38846.38144</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>1441283008.98</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>1439999508.12</float>
<string>GMT</string>
</tuple>
</state>
</object>
</value>
</item>
</dictionary>
</list>
</tuple>
</pickle>
</record>
</ZopeData>
<?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>content_md5</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>default_reference</string> </key>
<value> <string>gadget_officejs_webrtc_jio.js</string> </value>
</item>
<item>
<key> <string>description</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>gadget_officejs_webrtc_jio_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>/*global window, rJS, document, RSVP */\n
/*jslint indent: 2, maxerr: 3 */\n
(function (window, rJS, document, RSVP) {\n
"use strict";\n
\n
var timeout = 60000;\n
\n
function S4() {\n
return (\'0000\' + Math.floor(\n
Math.random() * 0x10000 /* 65536 */\n
).toString(16)).slice(-4);\n
}\n
\n
function UUID() {\n
return S4() + S4() + "-" +\n
S4() + "-" +\n
S4() + "-" +\n
S4() + "-" +\n
S4() + S4() + S4();\n
}\n
\n
function wrapJioAccess(gadget, method_name, argument_list) {\n
return gadget.getDeclaredGadget(\'gadget_webrtc_datachannel.html\')\n
.push(function (rtc_gadget) {\n
gadget.state_parameter_dict.message_count += 1;\n
gadget.state_parameter_dict.message_dict[gadget.state_parameter_dict.message_count] = RSVP.defer();\n
return RSVP.all([\n
rtc_gadget.send(JSON.stringify({\n
id: gadget.state_parameter_dict.message_count,\n
type: "jio_query",\n
method_name: method_name,\n
argument_list: Array.prototype.slice.call(argument_list)\n
})),\n
RSVP.any([\n
RSVP.timeout(timeout),\n
gadget.state_parameter_dict.message_dict[gadget.state_parameter_dict.message_count].promise\n
])\n
]);\n
})\n
.push(function (result_list) {\n
return result_list[1];\n
});\n
\n
}\n
\n
function declareSubGadget(gadget, url) {\n
var container_element = gadget.state_parameter_dict.element.querySelector("." + url.split(".")[0]),\n
element = document.createElement("div");\n
container_element.innerHTML = "";\n
container_element.appendChild(element);\n
return gadget.declareGadget(url, {\n
element: element,\n
scope: url,\n
sandbox: "public"\n
});\n
}\n
\n
rJS(window)\n
\n
.ready(function (gadget) {\n
// Initialize the gadget local parameters\n
gadget.state_parameter_dict = {};\n
return gadget.getElement()\n
.push(function (element) {\n
gadget.state_parameter_dict.element = element;\n
});\n
})\n
\n
.allowPublicAcquisition("notifyDataChannelMessage", function (argument_list) {\n
var json = JSON.parse(argument_list[0]),\n
context = this;\n
if (json.type === "jio_response") {\n
context.state_parameter_dict.message_dict[json.id].resolve(json.result);\n
} else if (json.type === "jio_error") {\n
context.state_parameter_dict.message_dict[json.id].reject(json.result);\n
}\n
// Drop all other kind of messages\n
})\n
\n
.allowPublicAcquisition("notifyWebSocketMessage", function (argument_list) {\n
\n
var json = JSON.parse(argument_list[0]),\n
gadget = this;\n
\n
if (json.action === "answer") {\n
if (json.to === gadget.state_parameter_dict.uuid) {\n
gadget.state_parameter_dict.answer_defer.resolve(json.data);\n
}\n
}\n
\n
})\n
\n
.allowPublicAcquisition("notifyWebSocketClosed", function () {\n
// WebSocket get closed as soon as webrtc connection is created\n
return;\n
})\n
\n
.declareMethod(\'createJio\', function (options) {\n
var context = this,\n
socket_gadget,\n
rtc_gadget;\n
\n
return declareSubGadget(context, \'gadget_websocket.html\')\n
.push(function (gadget) {\n
socket_gadget = gadget;\n
\n
context.state_parameter_dict.uuid = UUID();\n
context.state_parameter_dict.answer_defer = RSVP.defer();\n
context.state_parameter_dict.message_count = 0;\n
context.state_parameter_dict.message_dict = {};\n
return declareSubGadget(context, \'gadget_websocket.html\')\n
.push(function (gadget) {\n
socket_gadget = gadget;\n
// XXX Drop hardcoded URL\n
return socket_gadget.createSocket(options.socket_url);\n
})\n
.push(function () {\n
return declareSubGadget(context, \'gadget_webrtc_datachannel.html\');\n
})\n
.push(function (gadget) {\n
rtc_gadget = gadget;\n
return rtc_gadget.createOffer(context.state_parameter_dict.uuid);\n
})\n
.push(function (description) {\n
// Send offer and expect answer in less than XXXms (arbitrary value...)\n
return RSVP.any([\n
RSVP.Queue()\n
.push(function () {\n
return RSVP.timeout(timeout);\n
})\n
.push(undefined, function () {\n
throw new Error("No remote WebRTC connection available");\n
}),\n
RSVP.all([\n
socket_gadget.send(JSON.stringify({from: context.state_parameter_dict.uuid, action: "offer", data: description})),\n
context.state_parameter_dict.answer_defer.promise\n
])\n
]);\n
})\n
.push(function (response_list) {\n
return rtc_gadget.registerAnswer(response_list[1]);\n
})\n
.push(function () {\n
return socket_gadget.close();\n
});\n
});\n
})\n
.declareMethod(\'allDocs\', function () {\n
return wrapJioAccess(this, \'allDocs\', arguments);\n
})\n
.declareMethod(\'get\', function () {\n
return wrapJioAccess(this, \'get\', arguments);\n
})\n
.declareMethod(\'put\', function () {\n
return wrapJioAccess(this, \'put\', arguments);\n
})\n
.declareMethod(\'post\', function () {\n
return wrapJioAccess(this, \'post\', arguments);\n
})\n
.declareMethod(\'remove\', function () {\n
return wrapJioAccess(this, \'remove\', arguments);\n
});\n
\n
}(window, rJS, document, RSVP));</string> </value>
</item>
<item>
<key> <string>title</string> </key>
<value> <string>OfficeJS WebRTC Jio Gadget 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>1440000628.95</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.33670.33244.37512</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>1441357867.08</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>1439999508.1</float>
<string>GMT</string>
</tuple>
</state>
</object>
</value>
</item>
</dictionary>
</list>
</tuple>
</pickle>
</record>
</ZopeData>
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment