From afb722a0165a7f2e7c3337afa2ab09bc4000e504 Mon Sep 17 00:00:00 2001 From: Romain Courteaud <romain@nexedi.com> Date: Tue, 18 Aug 2015 14:47:43 +0000 Subject: [PATCH] [erp5_web_renderjs_ui] Add generic WebSocket/WebRTC gadgets. This converts the WebSocket/RTC APIs into renderJS methods. --- .../rjs_gadget_webrtc_datachannel_html.xml | 350 ++++++++++++ .../rjs_gadget_webrtc_datachannel_js.xml | 428 ++++++++++++++ .../rjs_gadget_webrtc_html.xml | 349 ++++++++++++ .../web_page_module/rjs_gadget_webrtc_js.xml | 537 ++++++++++++++++++ .../rjs_gadget_websocket_html.xml | 349 ++++++++++++ .../rjs_gadget_websocket_js.xml | 456 +++++++++++++++ 6 files changed, 2469 insertions(+) create mode 100644 bt5/erp5_web_renderjs_ui/PathTemplateItem/web_page_module/rjs_gadget_webrtc_datachannel_html.xml create mode 100644 bt5/erp5_web_renderjs_ui/PathTemplateItem/web_page_module/rjs_gadget_webrtc_datachannel_js.xml create mode 100644 bt5/erp5_web_renderjs_ui/PathTemplateItem/web_page_module/rjs_gadget_webrtc_html.xml create mode 100644 bt5/erp5_web_renderjs_ui/PathTemplateItem/web_page_module/rjs_gadget_webrtc_js.xml create mode 100644 bt5/erp5_web_renderjs_ui/PathTemplateItem/web_page_module/rjs_gadget_websocket_html.xml create mode 100644 bt5/erp5_web_renderjs_ui/PathTemplateItem/web_page_module/rjs_gadget_websocket_js.xml diff --git a/bt5/erp5_web_renderjs_ui/PathTemplateItem/web_page_module/rjs_gadget_webrtc_datachannel_html.xml b/bt5/erp5_web_renderjs_ui/PathTemplateItem/web_page_module/rjs_gadget_webrtc_datachannel_html.xml new file mode 100644 index 0000000000..498ba24d0b --- /dev/null +++ b/bt5/erp5_web_renderjs_ui/PathTemplateItem/web_page_module/rjs_gadget_webrtc_datachannel_html.xml @@ -0,0 +1,350 @@ +<?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_webrtc_datachannel.html</string> </value> + </item> + <item> + <key> <string>description</string> </key> + <value> + <none/> + </value> + </item> + <item> + <key> <string>id</string> </key> + <value> <string>rjs_gadget_webrtc_datachannel_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 +\n + <title>WebRTC DataChannel Gadget</title>\n +\n + <script src="rsvp.js" type="text/javascript"></script>\n + <script src="renderjs.js" type="text/javascript"></script>\n +\n + <script src="gadget_webrtc_datachannel.js"></script>\n + </head>\n +\n + <body>\n + <div data-gadget-url="gadget_webrtc.html" data-gadget-scope="webrtc"></div>\n + </body>\n +</html>\n + + +]]></string> </value> + </item> + <item> + <key> <string>title</string> </key> + <value> <string>WebRTC DataChannel 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>1439906802.7</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.9484.55850.22903</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>1439906783.27</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>1439906432.9</float> + <string>GMT</string> + </tuple> + </state> + </object> + </value> + </item> + </dictionary> + </list> + </tuple> + </pickle> + </record> +</ZopeData> diff --git a/bt5/erp5_web_renderjs_ui/PathTemplateItem/web_page_module/rjs_gadget_webrtc_datachannel_js.xml b/bt5/erp5_web_renderjs_ui/PathTemplateItem/web_page_module/rjs_gadget_webrtc_datachannel_js.xml new file mode 100644 index 0000000000..1c4c6e7709 --- /dev/null +++ b/bt5/erp5_web_renderjs_ui/PathTemplateItem/web_page_module/rjs_gadget_webrtc_datachannel_js.xml @@ -0,0 +1,428 @@ +<?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>Assignee</string> + <string>Assignor</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> + <string>Owner</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> + <string>Owner</string> + </tuple> + </value> + </item> + <item> + <key> <string>_View_Permission</string> </key> + <value> + <tuple> + <string>Assignee</string> + <string>Assignor</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_webrtc_datachannel.js</string> </value> + </item> + <item> + <key> <string>description</string> </key> + <value> + <none/> + </value> + </item> + <item> + <key> <string>id</string> </key> + <value> <string>rjs_gadget_webrtc_datachannel_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>/*jslint indent: 2*/\n +/*global rJS, RSVP, window*/\n +(function (rJS, window, RSVP) {\n + "use strict";\n +\n + var connection_options = [\n + {\n + // No need for stun server on the same lan / ipv6\n + iceServers: []\n + },\n + {\n + \'optional\': [{DtlsSrtpKeyAgreement: true},\n + {RtpDataChannels: true}]\n + }\n + ],\n + data_channel_options = {reliable: true},\n + offer_contraints = {\n + mandatory: {\n + OfferToReceiveAudio: false,\n + OfferToReceiveVideo: false\n + }\n + };\n +\n + rJS(window)\n + .ready(function (g) {\n + g.props = {};\n + return g.getDeclaredGadget(\'webrtc\')\n + .push(function (gadget) {\n + g.props.webrtc = gadget;\n + g.props.description_defer = RSVP.defer();\n + g.props.channel_defer = RSVP.defer();\n + });\n + })\n +\n + .allowPublicAcquisition("notifyDescriptionCalculated", function (args) {\n + this.props.description_defer.resolve(args[0]);\n + })\n +\n + .allowPublicAcquisition("notifyDataChannelOpened", function () {\n + this.props.channel_defer.resolve();\n + })\n +\n + .allowPublicAcquisition("notifyDataChannelMessage", function () {\n + this.props.channel_defer.resolve();\n + })\n +\n + .declareMethod(\'createOffer\', function (title) {\n + var gadget = this,\n + webrtc = this.props.webrtc;\n + return webrtc.createConnection.apply(webrtc, connection_options)\n + .push(function () {\n + return webrtc.createDataChannel(title, data_channel_options);\n + })\n + .push(function () {\n + return webrtc.createOffer(offer_contraints);\n + })\n + .push(function (local_description) {\n + return webrtc.setLocalDescription(local_description);\n + })\n + .push(function () {\n + return gadget.props.description_defer.promise;\n + });\n + })\n +\n + .declareMethod(\'registerAnswer\', function (description) {\n + var gadget = this;\n + return gadget.props.webrtc.setRemoteDescription(description)\n + .push(function () {\n + return gadget.props.channel_defer.promise;\n + });\n + })\n +\n + .declareMethod(\'createAnswer\', function (title, description) {\n + var gadget = this,\n + webrtc = this.props.webrtc;\n + return webrtc.createConnection.apply(webrtc, connection_options)\n + .push(function () {\n + return webrtc.createDataChannel(title, data_channel_options);\n + })\n + .push(function () {\n + return webrtc.setRemoteDescription(description);\n + })\n + .push(function () {\n + return webrtc.createAnswer(offer_contraints);\n + })\n + .push(function (local_description) {\n + return webrtc.setLocalDescription(local_description);\n + })\n + .push(function () {\n + return gadget.props.description_defer.promise;\n + });\n + })\n +\n + .declareMethod(\'waitForConnection\', function () {\n + return this.props.channel_defer.promise;\n + })\n +\n + .declareMethod(\'send\', function () {\n + var webrtc = this.props.webrtc;\n + return webrtc.send.apply(\n + webrtc,\n + arguments\n + );\n + });\n +\n +}(rJS, window, RSVP));\n +</string> </value> + </item> + <item> + <key> <string>title</string> </key> + <value> <string>WebRTC DataChannel 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> + <none/> + </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>1439906478.8</float> + <string>GMT</string> + </tuple> + </state> + </object> + </value> + </item> + <item> + <key> <string>validation_state</string> </key> + <value> <string>draft</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.9516.40380.20821</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>1439908875.61</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>1439906478.8</float> + <string>GMT</string> + </tuple> + </state> + </object> + </value> + </item> + </dictionary> + </list> + </tuple> + </pickle> + </record> +</ZopeData> diff --git a/bt5/erp5_web_renderjs_ui/PathTemplateItem/web_page_module/rjs_gadget_webrtc_html.xml b/bt5/erp5_web_renderjs_ui/PathTemplateItem/web_page_module/rjs_gadget_webrtc_html.xml new file mode 100644 index 0000000000..9166fbe32e --- /dev/null +++ b/bt5/erp5_web_renderjs_ui/PathTemplateItem/web_page_module/rjs_gadget_webrtc_html.xml @@ -0,0 +1,349 @@ +<?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_webrtc.html</string> </value> + </item> + <item> + <key> <string>description</string> </key> + <value> + <none/> + </value> + </item> + <item> + <key> <string>id</string> </key> + <value> <string>rjs_gadget_webrtc_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 +\n + <title>WebRTC Gadget</title>\n +\n + <script src="rsvp.js" type="text/javascript"></script>\n + <script src="renderjs.js" type="text/javascript"></script>\n +\n + <script src="gadget_webrtc.js"></script>\n + </head>\n +\n + <body>\n + </body>\n +</html>\n + + +]]></string> </value> + </item> + <item> + <key> <string>title</string> </key> + <value> <string>WebRTC 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>1439905385.08</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.9460.1047.5000</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>1439905271.96</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>1439905170.81</float> + <string>GMT</string> + </tuple> + </state> + </object> + </value> + </item> + </dictionary> + </list> + </tuple> + </pickle> + </record> +</ZopeData> diff --git a/bt5/erp5_web_renderjs_ui/PathTemplateItem/web_page_module/rjs_gadget_webrtc_js.xml b/bt5/erp5_web_renderjs_ui/PathTemplateItem/web_page_module/rjs_gadget_webrtc_js.xml new file mode 100644 index 0000000000..b97fdd5cfa --- /dev/null +++ b/bt5/erp5_web_renderjs_ui/PathTemplateItem/web_page_module/rjs_gadget_webrtc_js.xml @@ -0,0 +1,537 @@ +<?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_webrtc.js</string> </value> + </item> + <item> + <key> <string>description</string> </key> + <value> + <none/> + </value> + </item> + <item> + <key> <string>id</string> </key> + <value> <string>rjs_gadget_webrtc_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>/*jslint indent: 2*/\n +/*global rJS, RSVP, window*/\n +(function (rJS, RSVP, window) {\n + "use strict";\n +\n + var RTCPeerConnection = window.RTCPeerConnection || window.mozRTCPeerConnection ||\n + window.webkitRTCPeerConnection || window.msRTCPeerConnection,\n + RTCSessionDescription = window.RTCSessionDescription || window.mozRTCSessionDescription ||\n + window.webkitRTCSessionDescription || window.msRTCSessionDescription;\n +\n + function enqueueDefer(gadget, callback) {\n + var deferred = gadget.props.current_deferred;\n +\n + // Unblock queue\n + if (deferred !== undefined) {\n + deferred.resolve("Another event added");\n + }\n +\n + // Add next callback\n + try {\n + gadget.props.service_queue.push(callback);\n + } catch (error) {\n + throw new Error("Connection gadget already crashed... " +\n + gadget.props.service_queue.rejectedReason.toString());\n + }\n +\n + // Block the queue\n + deferred = RSVP.defer();\n + gadget.props.current_deferred = deferred;\n + gadget.props.service_queue.push(function () {\n + return deferred.promise;\n + });\n +\n + }\n +\n + function deferOnIceCandidate(candidate) {\n + var gadget = this;\n + enqueueDefer(gadget, function () {\n + // Firing this callback with a null candidate indicates that\n + // trickle ICE gathering has finished, and all the candidates\n + // are now present in pc.localDescription. Waiting until now\n + // to create the answer saves us from having to send offer +\n + // answer + iceCandidates separately.\n + if (candidate.candidate === null) {\n + return gadget.notifyDescriptionCalculated(JSON.stringify(gadget.props.connection.localDescription));\n + }\n + });\n + }\n +\n + function deferDataChannelOnOpen() {\n + var gadget = this;\n + enqueueDefer(gadget, function () {\n + return gadget.notifyDataChannelOpened();\n + });\n + }\n +\n + function deferDataChannelOnClose() {\n + var gadget = this;\n + enqueueDefer(gadget, function () {\n + return gadget.notifyDataChannelClosed();\n + });\n + }\n +\n + function deferDataChannelOnMessage(evt) {\n + var gadget = this;\n + enqueueDefer(gadget, function () {\n + return gadget.notifyDataChannelMessage(evt.data);\n +// var data = JSON.parse(evt.data);\n +// console.log(data.message);\n + });\n + }\n +\n + function deferServerDisconnection(gadget) {\n + enqueueDefer(gadget, function () {\n + // Try to auto connection\n + if (gadget.props.connection !== undefined) {\n + gadget.props.connection.disconnect();\n + delete gadget.props.connection;\n + }\n + });\n + }\n +\n +// function deferOfferSuccessCallback(description) {\n +// var gadget = this;\n +// enqueueDefer(gadget, function () {\n +// gadget.props.connection.setLocalDescription(description);\n +// });\n +// }\n +\n + function deferErrorHandler(error) {\n + enqueueDefer(this, function () {\n + throw error;\n + });\n + }\n +\n + function deferServerConnection(gadget) {\n + deferServerDisconnection(gadget);\n +\n + }\n +\n +\n + rJS(window)\n + .ready(function (g) {\n + g.props = {};\n + })\n +\n + .declareAcquiredMethod(\'notifyDescriptionCalculated\',\n + \'notifyDescriptionCalculated\')\n + .declareAcquiredMethod(\'notifyDataChannelOpened\',\n + \'notifyDataChannelOpened\')\n + .declareAcquiredMethod(\'notifyDataChannelMessage\',\n + \'notifyDataChannelMessage\')\n +\n + .declareService(function () {\n + /////////////////////////\n + // Handle WebRTC connection\n + /////////////////////////\n + var context = this;\n +\n + context.props.service_queue = new RSVP.Queue();\n + deferServerConnection(context);\n +\n + return new RSVP.Queue()\n + .push(function () {\n + return context.props.service_queue;\n + })\n + .push(function () {\n + // XXX Handle cancellation\n + throw new Error("Service should not have been stopped!");\n + })\n + .push(undefined, function (error) {\n + // Always disconnect in case of error\n + if (context.props.connection !== undefined) {\n + context.props.connection.close();\n + }\n + throw error;\n + });\n + })\n +\n +\n + .declareMethod(\'createConnection\', function (configuration, constraints) {\n + this.props.connection = new RTCPeerConnection(configuration, constraints);\n + this.props.connection.onicecandidate = deferOnIceCandidate.bind(this);\n + })\n +\n + .declareMethod(\'createDataChannel\', function (title, options) {\n + // XXX Improve to support multiple data channel\n + this.props.channel = this.props.connection.createDataChannel(title, options);\n +\n + this.props.channel.onopen = deferDataChannelOnOpen.bind(this);\n + this.props.channel.onclose = deferDataChannelOnClose.bind(this);\n + this.props.channel.onmessage = deferDataChannelOnMessage.bind(this);\n + this.props.channel.onerror = deferErrorHandler.bind(this);\n + // console.log("Channel type: " + this.props.channel.binarytype);\n + })\n +\n + .declareMethod(\'createOffer\', function (constraints) {\n + var gadget = this;\n + return new RSVP.Promise(function (resolve, reject) {\n + gadget.props.connection.createOffer(\n + resolve,\n + reject,\n + constraints\n + );\n + });\n + })\n +\n + .declareMethod(\'setRemoteDescription\', function (description) {\n + var gadget = this;\n + return new RSVP.Promise(function (resolve, reject) {\n + gadget.props.connection.setRemoteDescription(\n + new RTCSessionDescription(JSON.parse(description)),\n + resolve,\n + reject\n + );\n + });\n + })\n +\n + .declareMethod(\'setLocalDescription\', function (description) {\n + var gadget = this;\n + return new RSVP.Promise(function (resolve, reject) {\n + gadget.props.connection.setLocalDescription(\n + new RTCSessionDescription(description),\n + resolve,\n + reject\n + );\n + });\n + })\n +\n + .declareMethod(\'createAnswer\', function (constraints) {\n + var gadget = this;\n + return new RSVP.Promise(function (resolve, reject) {\n + gadget.props.connection.createAnswer(\n + resolve,\n + reject,\n + constraints\n + );\n + });\n + })\n +\n + .declareMethod(\'send\', function (message) {\n + this.props.channel.send(message);\n + })\n +\n + .declareMethod(\'close\', function () {\n + // XXX Of course, this will fail if connection is not open yet...\n + this.props.channel.close();\n + this.props.connection.close();\n + delete this.props.channel;\n + delete this.props.connection;\n + });\n +\n +}(rJS, RSVP, window));\n +</string> </value> + </item> + <item> + <key> <string>title</string> </key> + <value> <string>WebRTC 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>1439905919.9</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.9471.8579.37853</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>1439905903.84</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>1439905128.27</float> + <string>GMT</string> + </tuple> + </state> + </object> + </value> + </item> + </dictionary> + </list> + </tuple> + </pickle> + </record> +</ZopeData> diff --git a/bt5/erp5_web_renderjs_ui/PathTemplateItem/web_page_module/rjs_gadget_websocket_html.xml b/bt5/erp5_web_renderjs_ui/PathTemplateItem/web_page_module/rjs_gadget_websocket_html.xml new file mode 100644 index 0000000000..f77388256d --- /dev/null +++ b/bt5/erp5_web_renderjs_ui/PathTemplateItem/web_page_module/rjs_gadget_websocket_html.xml @@ -0,0 +1,349 @@ +<?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_websocket.html</string> </value> + </item> + <item> + <key> <string>description</string> </key> + <value> + <none/> + </value> + </item> + <item> + <key> <string>id</string> </key> + <value> <string>rjs_gadget_websocket_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 +\n + <title>WebSocket Gadget</title>\n +\n + <script src="rsvp.js" type="text/javascript"></script>\n + <script src="renderjs.js" type="text/javascript"></script>\n +\n + <script src="gadget_websocket.js"></script>\n + </head>\n +\n + <body>\n + </body>\n +</html>\n + + +]]></string> </value> + </item> + <item> + <key> <string>title</string> </key> + <value> <string>WebSocket 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>1439903489.98</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.9423.61573.11656</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>1439903424.9</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>1439903009.21</float> + <string>GMT</string> + </tuple> + </state> + </object> + </value> + </item> + </dictionary> + </list> + </tuple> + </pickle> + </record> +</ZopeData> diff --git a/bt5/erp5_web_renderjs_ui/PathTemplateItem/web_page_module/rjs_gadget_websocket_js.xml b/bt5/erp5_web_renderjs_ui/PathTemplateItem/web_page_module/rjs_gadget_websocket_js.xml new file mode 100644 index 0000000000..602ca21bfc --- /dev/null +++ b/bt5/erp5_web_renderjs_ui/PathTemplateItem/web_page_module/rjs_gadget_websocket_js.xml @@ -0,0 +1,456 @@ +<?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_websocket.js</string> </value> + </item> + <item> + <key> <string>description</string> </key> + <value> + <none/> + </value> + </item> + <item> + <key> <string>id</string> </key> + <value> <string>rjs_gadget_websocket_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>/*jslint indent: 2*/\n +/*global rJS, window, WebSocket, RSVP*/\n +(function (rJS, window, WebSocket, RSVP) {\n + "use strict";\n +\n + function enqueueDefer(gadget, callback) {\n + var deferred = gadget.props.current_deferred;\n +\n + // Unblock queue\n + if (deferred !== undefined) {\n + deferred.resolve("Another event added");\n + }\n +\n + // Add next callback\n + try {\n + gadget.props.service_queue.push(callback);\n + } catch (error) {\n + throw new Error("Connection gadget already crashed... " +\n + gadget.props.service_queue.rejectedReason.toString());\n + }\n +\n + // Block the queue\n + deferred = RSVP.defer();\n + gadget.props.current_deferred = deferred;\n + gadget.props.service_queue.push(function () {\n + return deferred.promise;\n + });\n +\n + }\n +\n + function deferOnClose() {\n + var gadget = this;\n + enqueueDefer(gadget, function () {\n + return gadget.notifyWebSocketClosed();\n + });\n + }\n +\n + function deferOnOpen() {\n + var gadget = this;\n + enqueueDefer(gadget, function () {\n + gadget.props.socket_defer.resolve();\n +// return gadget.notifyWebSocketOpened();\n + });\n + }\n +\n + function deferOnMessage(evt) {\n + var gadget = this;\n + enqueueDefer(gadget, function () {\n + return gadget.notifyWebSocketMessage(evt.data);\n + });\n + }\n +\n + function deferServerDisconnection(gadget) {\n + enqueueDefer(gadget, function () {\n + // Try to auto connection\n + if (gadget.props.connection !== undefined) {\n + gadget.props.connection.disconnect();\n + delete gadget.props.connection;\n + }\n + });\n + }\n +\n + function deferErrorHandler(error) {\n + enqueueDefer(this, function () {\n + throw error;\n + });\n + }\n +\n + function deferServerConnection(gadget) {\n + deferServerDisconnection(gadget);\n +\n + }\n +\n +\n + rJS(window)\n + .ready(function (g) {\n + g.props = {};\n + })\n +\n + .declareAcquiredMethod(\'notifyWebSocketClosed\',\n + \'notifyWebSocketClosed\')\n + .declareAcquiredMethod(\'notifyWebSocketMessage\',\n + \'notifyWebSocketMessage\')\n +\n + .declareService(function () {\n + /////////////////////////\n + // Handle WebSocket connection\n + /////////////////////////\n + var context = this;\n +\n + context.props.service_queue = new RSVP.Queue();\n + deferServerConnection(context);\n +\n + return new RSVP.Queue()\n + .push(function () {\n + return context.props.service_queue;\n + })\n + .push(function () {\n + // XXX Handle cancellation\n + throw new Error("Service should not have been stopped!");\n + })\n + .push(undefined, function (error) {\n + // Always disconnect in case of error\n + if (context.props.connection !== undefined) {\n + context.props.connection.close();\n + }\n + throw error;\n + });\n + })\n +\n + .declareMethod(\'createSocket\', function (address) {\n + // Improve to support multiple sockets?\n + this.props.socket = new WebSocket(address);\n + this.props.socket_defer = RSVP.defer();\n + this.props.socket.addEventListener(\'open\', deferOnOpen.bind(this));\n + this.props.socket.addEventListener(\'close\', deferOnClose.bind(this));\n + this.props.socket.addEventListener(\'message\', deferOnMessage.bind(this));\n + this.props.socket.addEventListener(\'error\', deferErrorHandler.bind(this));\n + return this.props.socket_defer.promise;\n + })\n +\n + .declareMethod(\'send\', function (message) {\n + this.props.socket.send(message);\n + })\n +\n + .declareMethod(\'close\', function () {\n + // XXX Of course, this will fail if connection is not open yet...\n + this.props.socket.close();\n + delete this.props.socket;\n + });\n +\n +}(rJS, window, WebSocket, RSVP));\n +</string> </value> + </item> + <item> + <key> <string>title</string> </key> + <value> <string>WebSocket 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>1439903737.59</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.9453.27218.15667</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>1439904827.73</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>1439903510.97</float> + <string>GMT</string> + </tuple> + </state> + </object> + </value> + </item> + </dictionary> + </list> + </tuple> + </pickle> + </record> +</ZopeData> -- 2.30.9