diff --git a/bt5/erp5_officejs/PathTemplateItem/web_page_module/gadget_officejs_application_panel_html.html b/bt5/erp5_officejs/PathTemplateItem/web_page_module/gadget_officejs_application_panel_html.html index 0398a0e7ad1ac66fa630e005d5d3a9b34c66ee34..f2743330c53dd97389d99430125294e4a7c6163c 100644 --- a/bt5/erp5_officejs/PathTemplateItem/web_page_module/gadget_officejs_application_panel_html.html +++ b/bt5/erp5_officejs/PathTemplateItem/web_page_module/gadget_officejs_application_panel_html.html @@ -37,6 +37,7 @@ diff --git a/bt5/erp5_officejs/PathTemplateItem/web_page_module/gadget_officejs_application_panel_html.xml b/bt5/erp5_officejs/PathTemplateItem/web_page_module/gadget_officejs_application_panel_html.xml index fb87dce02102cd056bf8f0e7cc00f04e5648b935..2bd167069c5d86937dcd91c674384239456e5fb6 100644 --- a/bt5/erp5_officejs/PathTemplateItem/web_page_module/gadget_officejs_application_panel_html.xml +++ b/bt5/erp5_officejs/PathTemplateItem/web_page_module/gadget_officejs_application_panel_html.xml @@ -255,7 +255,7 @@ actor - supercedriclen + zope comment @@ -269,7 +269,7 @@ serial - 951.28216.64976.63368 + 954.5775.37069.56541 state @@ -287,7 +287,7 @@ - 1464191586.4 + 1474555175.01 UTC diff --git a/bt5/erp5_officejs/PathTemplateItem/web_page_module/gadget_officejs_header_js.js b/bt5/erp5_officejs/PathTemplateItem/web_page_module/gadget_officejs_header_js.js index 6a0afc698d18230746d5b19bb777a61243bda888..e5db02bdbf6512d5566cf482dbcc7d37e5f4b8b6 100644 --- a/bt5/erp5_officejs/PathTemplateItem/web_page_module/gadget_officejs_header_js.js +++ b/bt5/erp5_officejs/PathTemplateItem/web_page_module/gadget_officejs_header_js.js @@ -103,13 +103,16 @@ this.stats.modified = true; return this.render(this.stats.options); } - }) + }) +*/ + .declareMethod('notifySubmitting', function () { if (this.stats.submitted) { this.stats.submitted = false; return this.render(this.stats.options); } }) + .declareMethod('notifySubmitted', function () { if (!this.stats.submitted) { this.stats.submitted = true; @@ -118,7 +121,7 @@ return this.render(this.stats.options); } }) -*/ + .declareMethod('render', function (options) { var gadget = this, possible_left_link_list = [ @@ -138,7 +141,8 @@ ], possible_right_button_list = [ ['save_action', 'Save', 'check', 'submit'], - ['submit_action', 'Proceed', 'check', 'submit'] + ['submit_action', 'Proceed', 'check', 'submit'], + ['refresh_action', 'Refresh', 'check', 'submit'] ], i, klass, diff --git a/bt5/erp5_officejs/PathTemplateItem/web_page_module/gadget_officejs_header_js.xml b/bt5/erp5_officejs/PathTemplateItem/web_page_module/gadget_officejs_header_js.xml index 75bad9191c62c957106b84f69f57535df91acfd1..b435534bad8b5138114142061b6ec8aa9b317c86 100644 --- a/bt5/erp5_officejs/PathTemplateItem/web_page_module/gadget_officejs_header_js.xml +++ b/bt5/erp5_officejs/PathTemplateItem/web_page_module/gadget_officejs_header_js.xml @@ -210,7 +210,7 @@ actor - cedric.le.ninivin + zope comment @@ -224,7 +224,7 @@ serial - 945.58607.14824.6775 + 953.35411.21474.17817 state @@ -242,7 +242,7 @@ - 1442857960.12 + 1472401645.81 UTC diff --git a/bt5/erp5_officejs/PathTemplateItem/web_page_module/gadget_officejs_jio_web_page_view_html.html b/bt5/erp5_officejs/PathTemplateItem/web_page_module/gadget_officejs_jio_web_page_view_html.html index e733b8489eb69e67076641ab936e3774de7ca513..31dbdd2fcb82406eb36aad47eb943fe4a133d2cf 100644 --- a/bt5/erp5_officejs/PathTemplateItem/web_page_module/gadget_officejs_jio_web_page_view_html.html +++ b/bt5/erp5_officejs/PathTemplateItem/web_page_module/gadget_officejs_jio_web_page_view_html.html @@ -11,19 +11,26 @@ + + + + + + + + + +
+
+

+   + Your Webrtc Page Share Choice +

+
+
+

Select a storage for Webrtc handshake

+ +
+
+
+ +
+
+
+
+ +
+
+
+
+ +
+
+
+ +
+
+
+
+

+   + Your Documents +

+
+
+
+ +
+
+
+ + \ No newline at end of file diff --git a/bt5/erp5_officejs/PathTemplateItem/web_page_module/gadget_officejs_page_share_configurator_html.xml b/bt5/erp5_officejs/PathTemplateItem/web_page_module/gadget_officejs_page_share_configurator_html.xml new file mode 100644 index 0000000000000000000000000000000000000000..09a024a2c895fea3cebe98cf92f67e657d3ac578 --- /dev/null +++ b/bt5/erp5_officejs/PathTemplateItem/web_page_module/gadget_officejs_page_share_configurator_html.xml @@ -0,0 +1,324 @@ + + + + + + + + + + _Access_contents_information_Permission + + + Anonymous + Assignee + Assignor + Associate + Auditor + Manager + Owner + + + + + _Add_portal_content_Permission + + + Assignee + Assignor + Manager + + + + + _Change_local_roles_Permission + + + Assignor + Manager + + + + + _Modify_portal_content_Permission + + + Assignee + Assignor + Manager + + + + + _View_Permission + + + Anonymous + Assignee + Assignor + Associate + Auditor + Manager + Owner + + + + + content_md5 + + + + + + content_type + text/html + + + default_reference + gadget_officejs_page_share_configurator.html + + + description + + + + + + id + gadget_officejs_page_share_configurator_html + + + language + en + + + portal_type + Web Page + + + short_title + + + + + + title + OfficeJS Webrtc Share Configurator Gadget + + + version + 001 + + + workflow_history + + AAAAAAAAAAI= + + + + + + + + + + + + + data + + + + document_publication_workflow + + AAAAAAAAAAM= + + + + edit_workflow + + AAAAAAAAAAQ= + + + + processing_status_workflow + + AAAAAAAAAAU= + + + + + + + + + + + + + + + + + + + action + publish_alive + + + actor + zope + + + comment + + + + error_message + + + + time + + + + + + + + + + + 1474555161.04 + UTC + + + + + + + validation_state + published_alive + + + + + + + + + + + + + + + + + action + edit + + + actor + zope + + + comment + + + + + + error_message + + + + serial + 954.17181.1723.6468 + + + state + current + + + time + + + + + + + + + + + 1475239502.36 + UTC + + + + + + + + + + + + + + + + + + + + + action + detect_converted_file + + + actor + zope + + + comment + + + + error_message + + + + external_processing_state + converted + + + serial + 0.0.0.0 + + + time + + + + + + + + + + + 1474554776.94 + UTC + + + + + + + + + + + diff --git a/bt5/erp5_officejs/PathTemplateItem/web_page_module/gadget_officejs_page_share_configurator_js.js b/bt5/erp5_officejs/PathTemplateItem/web_page_module/gadget_officejs_page_share_configurator_js.js new file mode 100644 index 0000000000000000000000000000000000000000..c74d826d75ec7c776491f119b47fda67f29f4040 --- /dev/null +++ b/bt5/erp5_officejs/PathTemplateItem/web_page_module/gadget_officejs_page_share_configurator_js.js @@ -0,0 +1,125 @@ +/*global window, document, rJS, RSVP, URI, location, + loopEventListener*/ +/*jslint nomen: true, indent: 2, maxerr: 3*/ +(function (window, rJS, RSVP) { + "use strict"; + + function setERP5Configuration(gadget) { + var configuration = { + remote_sub_storage: { + type: "erp5", + url: (new URI("hateoas")) + .absoluteTo(location.href) + .toString(), + default_view_reference: "view" + } + }; + + return gadget.setSetting('webrtc_share_description', configuration) + .push(function () { + return gadget.setSetting('webrtc_share_name', "ERP5"); + }) + .push(function () { + return gadget.reload(); + }); + } + + function setWebsocketConfiguration(gadget) { + return gadget.redirect({page: 'share_websocket_configurator'}); + } + + function setDAVConfiguration(gadget) { + return gadget.redirect({page: 'share_dav_configurator'}); + } + + var gadget_klass = rJS(window); + + gadget_klass + .ready(function (g) { + g.props = {}; + return g.getElement() + .push(function (element) { + g.props.element = element; + g.props.deferred = RSVP.defer(); + }); + }) + .declareAcquiredMethod("updateHeader", "updateHeader") + .declareAcquiredMethod("translateHtml", "translateHtml") + .declareAcquiredMethod("redirect", "redirect") + .declareAcquiredMethod("reload", "reload") + .declareAcquiredMethod("setSetting", "setSetting") + .declareAcquiredMethod("getSetting", "getSetting") + .declareMethod("render", function () { + var gadget = this; + return gadget.updateHeader({ + title: "Webrtc Page Share Configuration" + }).push(function () { + return RSVP.all([ + gadget.getSetting('webrtc_share_name'), + gadget.getSetting('application_title') + ]); + }).push(function (setting_list) { + switch (setting_list[0]) { + case "ERP5": + gadget.props.element.querySelector("form.select-erp5-form button").classList.add("ui-btn-active"); + break; + case "DAV": + gadget.props.element.querySelector("form.select-dav-form button").classList.add("ui-btn-active"); + break; + case "WEBSOCKET": + gadget.props.element.querySelector("form.select-websocket-form button").classList.add("ui-btn-active"); + break; + default: + gadget.props.element.querySelector(".message h3").appendChild(document.createTextNode("Welcome in OfficeJS " + setting_list[1] + ". Please start by choosing an option.")); + gadget.props.element.querySelector(".message").setAttribute("style", ""); + gadget.props.element.querySelector(".document-access").setAttribute("style", "display: none;"); + break; + } + return; + }).push(function () { + return gadget.props.deferred.resolve(); + }); + }) + + ///////////////////////////////////////// + // Form submit + ///////////////////////////////////////// + .declareService(function () { + var gadget = this; + + return new RSVP.Queue() + .push(function () { + return gadget.props.deferred.promise; + }) + .push(function () { + return RSVP.all([ + loopEventListener( + gadget.props.element.querySelector('form.select-erp5-form'), + 'submit', + true, + function () { + return setERP5Configuration(gadget); + } + ), + loopEventListener( + gadget.props.element.querySelector('form.select-websocket-form'), + 'submit', + true, + function () { + return setWebsocketConfiguration(gadget); + } + ), + loopEventListener( + gadget.props.element.querySelector('form.select-dav-form'), + 'submit', + true, + function () { + return setDAVConfiguration(gadget); + } + ) + ]); + }); + }); + + +}(window, rJS, RSVP)); \ No newline at end of file diff --git a/bt5/erp5_officejs/PathTemplateItem/web_page_module/gadget_officejs_page_share_configurator_js.xml b/bt5/erp5_officejs/PathTemplateItem/web_page_module/gadget_officejs_page_share_configurator_js.xml new file mode 100644 index 0000000000000000000000000000000000000000..a494435291fe6c56ced3807a3b40b82483d34c52 --- /dev/null +++ b/bt5/erp5_officejs/PathTemplateItem/web_page_module/gadget_officejs_page_share_configurator_js.xml @@ -0,0 +1,320 @@ + + + + + + + + + + _Access_contents_information_Permission + + + Anonymous + Assignee + Assignor + Associate + Auditor + Manager + Owner + + + + + _Add_portal_content_Permission + + + Assignee + Assignor + Manager + + + + + _Change_local_roles_Permission + + + Assignor + Manager + + + + + _Modify_portal_content_Permission + + + Assignee + Assignor + Manager + + + + + _View_Permission + + + Anonymous + Assignee + Assignor + Associate + Auditor + Manager + Owner + + + + + content_md5 + + + + + + default_reference + gadget_officejs_page_share_configurator.js + + + description + + + + + + id + gadget_officejs_page_share_configurator_js + + + language + en + + + portal_type + Web Script + + + short_title + + + + + + title + OfficeJS Webrtc Share Configurator Gadget JS + + + version + 001 + + + workflow_history + + AAAAAAAAAAI= + + + + + + + + + + + + + data + + + + document_publication_workflow + + AAAAAAAAAAM= + + + + edit_workflow + + AAAAAAAAAAQ= + + + + processing_status_workflow + + AAAAAAAAAAU= + + + + + + + + + + + + + + + + + + + action + publish_alive + + + actor + zope + + + comment + + + + error_message + + + + time + + + + + + + + + + + 1474555161.88 + UTC + + + + + + + validation_state + published_alive + + + + + + + + + + + + + + + + + action + edit + + + actor + zope + + + comment + + + + + + error_message + + + + serial + 954.35964.26780.28620 + + + state + current + + + time + + + + + + + + + + + 1476280104.88 + UTC + + + + + + + + + + + + + + + + + + + + + action + detect_converted_file + + + actor + zope + + + comment + + + + error_message + + + + external_processing_state + converted + + + serial + 0.0.0.0 + + + time + + + + + + + + + + + 1474554650.05 + UTC + + + + + + + + + + + diff --git a/bt5/erp5_officejs/PathTemplateItem/web_page_module/gadget_officejs_page_share_dav_configurator_html.html b/bt5/erp5_officejs/PathTemplateItem/web_page_module/gadget_officejs_page_share_dav_configurator_html.html new file mode 100644 index 0000000000000000000000000000000000000000..e4e6584d9535061b0273d7480d250db26ad55ffb --- /dev/null +++ b/bt5/erp5_officejs/PathTemplateItem/web_page_module/gadget_officejs_page_share_dav_configurator_html.html @@ -0,0 +1,71 @@ + + + + + + + OfficeJS jIO DAV Configurator Page + + + + + + + + + +
+
+

+   + Your WebDAV Connection parameters +

+
+
+
+ +
+
+ + +
+
+ + +
+
+ + +
+
+
+
+
+
+
+ +
+
+
+
+
+
+
+
+

+   + Your Text Documents +

+
+
+
+ +
+
+
+ + diff --git a/bt5/erp5_officejs/PathTemplateItem/web_page_module/gadget_officejs_page_share_dav_configurator_html.xml b/bt5/erp5_officejs/PathTemplateItem/web_page_module/gadget_officejs_page_share_dav_configurator_html.xml new file mode 100644 index 0000000000000000000000000000000000000000..1777de9d1f734650ea330d1e666c6b357abc8473 --- /dev/null +++ b/bt5/erp5_officejs/PathTemplateItem/web_page_module/gadget_officejs_page_share_dav_configurator_html.xml @@ -0,0 +1,328 @@ + + + + + + + + + + _Access_contents_information_Permission + + + Anonymous + Assignee + Assignor + Associate + Auditor + Manager + Owner + + + + + _Add_portal_content_Permission + + + Assignee + Assignor + Manager + + + + + _Change_local_roles_Permission + + + Assignor + Manager + + + + + _Modify_portal_content_Permission + + + Assignee + Assignor + Manager + + + + + _View_Permission + + + Anonymous + Assignee + Assignor + Associate + Auditor + Manager + Owner + + + + + content_md5 + + + + + + content_type + text/html + + + default_reference + gadget_officejs_page_share_dav_configurator.html + + + description + + + + + + id + gadget_officejs_page_share_dav_configurator_html + + + language + + + + + + portal_type + Web Page + + + short_title + + + + + + title + OfficeJS Page Share DAV Configurator Page + + + version + + + + + + workflow_history + + AAAAAAAAAAI= + + + + + + + + + + + + + data + + + + document_publication_workflow + + AAAAAAAAAAM= + + + + edit_workflow + + AAAAAAAAAAQ= + + + + processing_status_workflow + + AAAAAAAAAAU= + + + + + + + + + + + + + + + + + + + action + publish_alive + + + actor + zope + + + comment + + + + error_message + + + + time + + + + + + + + + + + 1474560284.66 + UTC + + + + + + + validation_state + published_alive + + + + + + + + + + + + + + + + + action + edit + + + actor + zope + + + comment + + + + + + error_message + + + + serial + 954.6881.61784.17937 + + + state + current + + + time + + + + + + + + + + + 1474621644.5 + UTC + + + + + + + + + + + + + + + + + + + + + action + detect_converted_file + + + actor + zope + + + comment + + + + error_message + + + + external_processing_state + converted + + + serial + 0.0.0.0 + + + time + + + + + + + + + + + 1474560021.82 + UTC + + + + + + + + + + + diff --git a/bt5/erp5_officejs/PathTemplateItem/web_page_module/gadget_officejs_page_share_dav_configurator_js.js b/bt5/erp5_officejs/PathTemplateItem/web_page_module/gadget_officejs_page_share_dav_configurator_js.js new file mode 100644 index 0000000000000000000000000000000000000000..2bb99dbc674236a7111996fbff23c85ad7e4d9ac --- /dev/null +++ b/bt5/erp5_officejs/PathTemplateItem/web_page_module/gadget_officejs_page_share_dav_configurator_js.js @@ -0,0 +1,95 @@ +/*global window, rJS, RSVP, URI, location, + loopEventListener, btoa */ +/*jslint nomen: true, indent: 2, maxerr: 3*/ +(function (window, rJS, RSVP) { + "use strict"; + + function setPageShareDAVConfiguration(gadget) { + return gadget.getSetting("portal_type") + .push(function (portal_type) { + var configuration = { + remote_sub_storage: { + type: "query", + sub_storage: { + type: "uuid", + sub_storage: { + type: "dav", + url: gadget.props.element.querySelector("input[name='dav_url']").value, + basic_login: btoa(gadget.props.element.querySelector("input[name='dav_username']").value + + ':' + gadget.props.element.querySelector("input[name='dav_password']").value), + //with_credentials: true + } + } + } + }; + return gadget.setSetting('webrtc_share_description', configuration); + }) + .push(function () { + return gadget.setSetting('webrtc_share_name', "DAV"); + }) + .push(function () { + return gadget.reload(); + }); + } + + var gadget_klass = rJS(window); + + gadget_klass + .ready(function (g) { + g.props = {}; + return g.getElement() + .push(function (element) { + g.props.element = element; + g.props.deferred = RSVP.defer(); + return g.getSetting('webrtc_share_name'); + }) + .push(function (webrtc_share_name) { + if (webrtc_share_name === "DAV") { + return g.getSetting('webrtc_share_description') + .push(function (webrtc_share_description) { + g.props.element.querySelector("input[name='dav_url']").value = + webrtc_share_description.remote_sub_storage.sub_storage.sub_storage.url; + }); + } + }); + }) + .declareAcquiredMethod("updateHeader", "updateHeader") + .declareAcquiredMethod("redirect", "redirect") + .declareAcquiredMethod("reload", "reload") + .declareAcquiredMethod("getSetting", "getSetting") + .declareAcquiredMethod("setSetting", "setSetting") + .declareMethod("render", function () { + var gadget = this; + return gadget.updateHeader({ + title: "Configure DAV Storage", + back_url: "#page=share_configurator", + panel_action: false + }).push(function () { + return gadget.props.deferred.resolve(); + }); + }) + + ///////////////////////////////////////// + // Form submit + ///////////////////////////////////////// + .declareService(function () { + var gadget = this; + + return new RSVP.Queue() + .push(function () { + return gadget.props.deferred.promise; + }) + .push(function () { + return loopEventListener( + gadget.props.element.querySelector('form'), + 'submit', + true, + function () { + return setPageShareDAVConfiguration(gadget); + } + ); + }); + }); + + +}(window, rJS, RSVP)); \ No newline at end of file diff --git a/bt5/erp5_officejs/PathTemplateItem/web_page_module/gadget_officejs_page_share_dav_configurator_js.xml b/bt5/erp5_officejs/PathTemplateItem/web_page_module/gadget_officejs_page_share_dav_configurator_js.xml new file mode 100644 index 0000000000000000000000000000000000000000..45e44c8cb70809c41789b7584655a6428f603786 --- /dev/null +++ b/bt5/erp5_officejs/PathTemplateItem/web_page_module/gadget_officejs_page_share_dav_configurator_js.xml @@ -0,0 +1,324 @@ + + + + + + + + + + _Access_contents_information_Permission + + + Anonymous + Assignee + Assignor + Associate + Auditor + Manager + Owner + + + + + _Add_portal_content_Permission + + + Assignee + Assignor + Manager + + + + + _Change_local_roles_Permission + + + Assignor + Manager + + + + + _Modify_portal_content_Permission + + + Assignee + Assignor + Manager + + + + + _View_Permission + + + Anonymous + Assignee + Assignor + Associate + Auditor + Manager + Owner + + + + + content_md5 + + + + + + default_reference + gadget_officejs_page_share_dav_configurator.js + + + description + + + + + + id + gadget_officejs_page_share_dav_configurator_js + + + language + + + + + + portal_type + Web Script + + + short_title + + + + + + title + OfficeJS Page Share DAV Configurator Page JS + + + version + + + + + + workflow_history + + AAAAAAAAAAI= + + + + + + + + + + + + + data + + + + document_publication_workflow + + AAAAAAAAAAM= + + + + edit_workflow + + AAAAAAAAAAQ= + + + + processing_status_workflow + + AAAAAAAAAAU= + + + + + + + + + + + + + + + + + + + action + publish_alive + + + actor + zope + + + comment + + + + error_message + + + + time + + + + + + + + + + + 1474560008.96 + UTC + + + + + + + validation_state + published_alive + + + + + + + + + + + + + + + + + action + edit + + + actor + zope + + + comment + + + + + + error_message + + + + serial + 954.15507.42714.29849 + + + state + current + + + time + + + + + + + + + + + 1475139117.07 + UTC + + + + + + + + + + + + + + + + + + + + + action + detect_converted_file + + + actor + zope + + + comment + + + + error_message + + + + external_processing_state + converted + + + serial + 0.0.0.0 + + + time + + + + + + + + + + + 1474559651.11 + UTC + + + + + + + + + + + diff --git a/bt5/erp5_officejs/PathTemplateItem/web_page_module/gadget_officejs_page_share_text_html.html b/bt5/erp5_officejs/PathTemplateItem/web_page_module/gadget_officejs_page_share_text_html.html new file mode 100644 index 0000000000000000000000000000000000000000..d3d6953c633641fb57e16db58f1ca42aa987e10b --- /dev/null +++ b/bt5/erp5_officejs/PathTemplateItem/web_page_module/gadget_officejs_page_share_text_html.html @@ -0,0 +1,19 @@ + + + + + + + Share jIO + + + + + + + +
+ + diff --git a/bt5/erp5_officejs/PathTemplateItem/web_page_module/gadget_officejs_page_share_text_html.xml b/bt5/erp5_officejs/PathTemplateItem/web_page_module/gadget_officejs_page_share_text_html.xml new file mode 100644 index 0000000000000000000000000000000000000000..17e53d00ee29c43d3a24e55e03f4c174e78124c4 --- /dev/null +++ b/bt5/erp5_officejs/PathTemplateItem/web_page_module/gadget_officejs_page_share_text_html.xml @@ -0,0 +1,324 @@ + + + + + + + + + + _Access_contents_information_Permission + + + Anonymous + Assignee + Assignor + Associate + Auditor + Manager + Owner + + + + + _Add_portal_content_Permission + + + Assignee + Assignor + Manager + + + + + _Change_local_roles_Permission + + + Assignor + Manager + + + + + _Modify_portal_content_Permission + + + Assignee + Assignor + Manager + + + + + _View_Permission + + + Anonymous + Assignee + Assignor + Associate + Auditor + Manager + Owner + + + + + content_md5 + + + + + + content_type + text/html + + + default_reference + gadget_officejs_page_share_text.html + + + description + + + + + + id + gadget_officejs_page_share_text_html + + + language + en + + + portal_type + Web Page + + + short_title + + + + + + title + Document viewer using webrtc + + + version + 001 + + + workflow_history + + AAAAAAAAAAI= + + + + + + + + + + + + + data + + + + document_publication_workflow + + AAAAAAAAAAM= + + + + edit_workflow + + AAAAAAAAAAQ= + + + + processing_status_workflow + + AAAAAAAAAAU= + + + + + + + + + + + + + + + + + + + action + publish_alive + + + actor + zope + + + comment + + + + error_message + + + + time + + + + + + + + + + + 1471521952.46 + UTC + + + + + + + validation_state + published_alive + + + + + + + + + + + + + + + + + action + edit + + + actor + zope + + + comment + + + + + + error_message + + + + serial + 953.57026.12963.53469 + + + state + current + + + time + + + + + + + + + + + 1473758929.92 + UTC + + + + + + + + + + + + + + + + + + + + + action + detect_converted_file + + + actor + zope + + + comment + + + + error_message + + + + external_processing_state + converted + + + serial + 0.0.0.0 + + + time + + + + + + + + + + + 1471513520.74 + UTC + + + + + + + + + + + diff --git a/bt5/erp5_officejs/PathTemplateItem/web_page_module/gadget_officejs_page_share_text_js.js b/bt5/erp5_officejs/PathTemplateItem/web_page_module/gadget_officejs_page_share_text_js.js new file mode 100644 index 0000000000000000000000000000000000000000..fd17892f9092bd6ecfe3855fa65f1fb291a3c1ce --- /dev/null +++ b/bt5/erp5_officejs/PathTemplateItem/web_page_module/gadget_officejs_page_share_text_js.js @@ -0,0 +1,198 @@ +/*global window, rJS, document, RSVP, console, DOMException */ +/*jslint indent: 2, maxerr: 3 */ +(function (window, rJS, document, RSVP, console, DOMException) { + "use strict"; + + var timeout = 600000; + + function S4() { + return ('0000' + Math.floor( + Math.random() * 0x10000 /* 65536 */ + ).toString(16)).slice(-4); + } + + function UUID() { + return S4() + S4() + "-" + + S4() + "-" + + S4() + "-" + + S4() + "-" + + S4() + S4() + S4(); + } + + function getWebRTCScopeList(gadget) { + var result_list = [], + element_list = gadget.state_parameter_dict.element.querySelector(".gadget_webrtc") + .childNodes, + i; + for (i = 0; i < element_list.length; i += 1) { + if (element_list[i].getAttribute) { + result_list.push(element_list[i].getAttribute("data-gadget-scope")); + } + } + return result_list; + } + + function updateInfo(gadget) { + var scope_list = getWebRTCScopeList(gadget), + i, + result = ""; + for (i = 0; i < scope_list.length; i += 1) { + result += gadget.state_parameter_dict.scope_ip[scope_list[i]] + "\n"; + } + console.log(result); + console.log("peer count", i); + } + + function sendWebRTC(gadget, rtc_gadget, scope, message) { + return rtc_gadget.send(message) + .push(undefined, function (error) { + if ((error instanceof DOMException) && (error.name === 'InvalidStateError')) { + return dropSubGadget(gadget, scope) + .push(function () { + return updateInfo(gadget); + }, function (error) { + console.log("-- Can not drop remote subgadget " + scope); + console.log(error); + return; + }); + } + throw error; + }); + } + + rJS(window) + + .ready(function (gadget) { + // Initialize the gadget local parameters + gadget.state_parameter_dict = { + counter: 1, + connecting: false, + scope_ip: {} + }; + return gadget.getElement() + .push(function (element) { + gadget.state_parameter_dict.element = element; + }) + .push(function () { + return updateInfo(gadget); + }); + }) + + .declareMethod('onOffer', function(options, offer) { + var gadget = this; + + return new RSVP.Queue() + .push(function(response) { + gadget.connecting = true; + + // https://github.com/diafygi/webrtc-ips + var ip_regex = /([0-9]{1,3}(\.[0-9]{1,3}){3}|[a-f0-9]{1,4}(:[a-f0-9]{1,4}){7})/, + ip_list = [], + ip_dict = {}, + ip_addr, + line_list = JSON.parse(offer.data).sdp.split('\n'), + i; + + for (i = 0; i < line_list.length; i += 1) { + if (line_list[i].indexOf('a=candidate:') === 0) { + ip_addr = ip_regex.exec(line_list[i])[1]; + if (!ip_addr.match(/^[a-f0-9]{1,4}(:[a-f0-9]{1,4}){7}$/)) { + // Hide ipv6 + if (!ip_dict[ip_addr]) { + ip_list.push(ip_addr); + ip_dict[ip_addr] = true; + } + } + } + } + + gadget.state_parameter_dict.scope_ip["webrtc"+gadget.state_parameter_dict.counter] = ip_list + options.to = offer.from; + return; + }); + }) + + .declareMethod('postConnection', function(options, offer) { + var gadget = this, + counter; + return new RSVP.Queue() + .push(function () { + gadget.connecting = false; + var ckeditor = window.frames[0].CKEDITOR; + + var data = {'content': ckeditor.instances.editor1.getData()}; + + // Get all the extra properties and send it with data + var extraprops = options.parent_scope.props.element.querySelector('.ui-collapsible').outerHTML; + data['extra_props'] = extraprops; + + // Get title + var title = options.parent_scope.props.element.querySelector(".view-web-page-form").title.value; + data['title'] = title; + + counter = gadget.state_parameter_dict.counter; + options.rtc_gadget.send(JSON.stringify(data), "webrtc"+counter); + ckeditor.instances.editor1.on('key',function(e){ + options.rtc_gadget.send(JSON.stringify({'content':ckeditor.instances.editor1.getData()}), "webrtc"+counter); + }); + gadget.state_parameter_dict.counter += 1; + return updateInfo(gadget); + }); + }) + + .declareMethod('initiate', function (roomid, scope, type, config) { + var gadget = this, + options = { + peerid: "master", + type: type, + config: config, + roomid: "/"+roomid+"/", + listner: true, // optional + preConnection: gadget.onOffer.bind(gadget), // optional + postConnection: gadget.postConnection.bind(gadget), // optional + parent_scope: scope, // custom + }, + rtc_gadget; + + return gadget.getDeclaredGadget("gadget_webrtc_jio_bridge.html") + .push(function (rtc_gadget) { + options.rtc_gadget = rtc_gadget; + return rtc_gadget.connect(options); + }); + }) + .declareMethod('slaveInitiate', function(roomid, g, type, config) { + var context = this, + rtc_gadget, + options = { + type: type, + roomid: "/"+roomid+"/", + initiator: true, + to: 'master' + }; + + return g.notifySubmitting() + .push(function() { + return context.getDeclaredGadget("gadget_webrtc_jio_bridge.html") + }) + .push(function (gadget) { + options.peerid = UUID(); + context.state_parameter_dict.message_count = 0; + context.state_parameter_dict.message_dict = {}; + rtc_gadget = gadget; + + if (config) { + config = JSON.parse(config) + options.config = config; + } + + return rtc_gadget.connect(options); + }) + .push(null, function(error){ + return g.notifySubmitted() + .push(function () { + throw error; + }); + }); + }) + +}(window, rJS, document, RSVP, console, DOMException)); \ No newline at end of file diff --git a/bt5/erp5_officejs/PathTemplateItem/web_page_module/gadget_officejs_page_share_text_js.xml b/bt5/erp5_officejs/PathTemplateItem/web_page_module/gadget_officejs_page_share_text_js.xml new file mode 100644 index 0000000000000000000000000000000000000000..7f1118bdc3ba55386f2e6aaa8fa613f50080dbad --- /dev/null +++ b/bt5/erp5_officejs/PathTemplateItem/web_page_module/gadget_officejs_page_share_text_js.xml @@ -0,0 +1,332 @@ + + + + + + + + + + _Access_contents_information_Permission + + + Anonymous + Assignee + Assignor + Associate + Auditor + Manager + Owner + + + + + _Add_portal_content_Permission + + + Assignee + Assignor + Manager + + + + + _Change_local_roles_Permission + + + Assignor + Manager + + + + + _Modify_portal_content_Permission + + + Assignee + Assignor + Manager + + + + + _View_Permission + + + Anonymous + Assignee + Assignor + Associate + Auditor + Manager + Owner + + + + + categories + + + + + + content_md5 + + + + + + contributors + + + + + + default_reference + gadget_officejs_page_share_text.js + + + description + + + + + + id + gadget_officejs_page_share_text_js + + + language + en + + + portal_type + Web Script + + + short_title + + + + + + title + Document viewer using webrtc + + + version + 001 + + + workflow_history + + AAAAAAAAAAI= + + + + + + + + + + + + + data + + + + document_publication_workflow + + AAAAAAAAAAM= + + + + edit_workflow + + AAAAAAAAAAQ= + + + + processing_status_workflow + + AAAAAAAAAAU= + + + + + + + + + + + + + + + + + + + action + publish_alive + + + actor + zope + + + comment + + + + error_message + + + + time + + + + + + + + + + + 1471522253.26 + UTC + + + + + + + validation_state + published_alive + + + + + + + + + + + + + + + + + action + edit + + + actor + zope + + + comment + + + + + + error_message + + + + serial + 954.5733.26518.27989 + + + state + current + + + time + + + + + + + + + + + 1474552757.01 + UTC + + + + + + + + + + + + + + + + + + + + + action + detect_converted_file + + + actor + zope + + + comment + + + + error_message + + + + external_processing_state + converted + + + serial + 0.0.0.0 + + + time + + + + + + + + + + + 1471513430.76 + UTC + + + + + + + + + + + diff --git a/bt5/erp5_officejs/PathTemplateItem/web_page_module/gadget_officejs_page_share_webrtc_jio_html.html b/bt5/erp5_officejs/PathTemplateItem/web_page_module/gadget_officejs_page_share_webrtc_jio_html.html index cd2cf1e3c3190b8f68c08f452b0d5fb8a13d10d8..2e56f37c479713749cdf21ee8cacf01ecad998d9 100644 --- a/bt5/erp5_officejs/PathTemplateItem/web_page_module/gadget_officejs_page_share_webrtc_jio_html.html +++ b/bt5/erp5_officejs/PathTemplateItem/web_page_module/gadget_officejs_page_share_webrtc_jio_html.html @@ -22,11 +22,9 @@
- -
-
-
-
-
+ +
diff --git a/bt5/erp5_officejs/PathTemplateItem/web_page_module/gadget_officejs_page_share_webrtc_jio_html.xml b/bt5/erp5_officejs/PathTemplateItem/web_page_module/gadget_officejs_page_share_webrtc_jio_html.xml index bc8e94ed1cbabaa8de782a50360b1e8382582a70..8bce911247df4e1475f6f7daf8e06d5104d18f0b 100644 --- a/bt5/erp5_officejs/PathTemplateItem/web_page_module/gadget_officejs_page_share_webrtc_jio_html.xml +++ b/bt5/erp5_officejs/PathTemplateItem/web_page_module/gadget_officejs_page_share_webrtc_jio_html.xml @@ -236,7 +236,7 @@
actor - romain + zope comment @@ -250,7 +250,7 @@ serial - 945.33680.60468.51660 + 953.42397.2191.24098 state @@ -268,8 +268,8 @@ - 1441358472.38 - GMT + 1474364886.77 + UTC diff --git a/bt5/erp5_officejs/PathTemplateItem/web_page_module/gadget_officejs_page_share_webrtc_jio_js.js b/bt5/erp5_officejs/PathTemplateItem/web_page_module/gadget_officejs_page_share_webrtc_jio_js.js index 1b6f66f5f6dfc39d8152dd367e54347f66cd8cb4..0d4687869febd8234186b0e0219776e14ee560b6 100644 --- a/bt5/erp5_officejs/PathTemplateItem/web_page_module/gadget_officejs_page_share_webrtc_jio_js.js +++ b/bt5/erp5_officejs/PathTemplateItem/web_page_module/gadget_officejs_page_share_webrtc_jio_js.js @@ -17,13 +17,28 @@ }); } + function declareSubGadget(gadget, url) { + var container_element = gadget.state_parameter_dict.element.querySelector("." + url.split(".")[0]), + element = document.createElement("div"); + + container_element.innerHTML = ""; + container_element.appendChild(element); + return gadget.declareGadget(url, { + element: element, + scope: url, + sandbox: "public" + }); + } + function getWebRTCScopeList(gadget) { var result_list = [], - element_list = gadget.state_parameter_dict.element.querySelector(".gadget_webrtc_datachannel") + element_list = gadget.state_parameter_dict.element.querySelector(".gadget_webrtc") .childNodes, i; for (i = 0; i < element_list.length; i += 1) { - result_list.push(element_list[i].getAttribute("data-gadget-scope")); + if (element_list[i].getAttribute) { + result_list.push(element_list[i].getAttribute("data-gadget-scope")); + } } return result_list; } @@ -40,7 +55,7 @@ } function sendWebRTC(gadget, rtc_gadget, scope, message) { - return rtc_gadget.send(message) + return rtc_gadget.send(message, "webrtc"+gadget.state_parameter_dict.counter) .push(undefined, function (error) { if ((error instanceof DOMException) && (error.name === 'InvalidStateError')) { return dropSubGadget(gadget, scope) @@ -114,96 +129,70 @@ })); }); }) -/* - .allowPublicAcquisition("notifyWebSocketClosed", function () { - if (this.state_parameter_dict.user_type !== "user") { - throw new Error("Unexpected Web Socket connection close"); - } - }) -*/ - .allowPublicAcquisition("notifyWebSocketMessage", function (argument_list) { - var json = JSON.parse(argument_list[0]), - scope, - rtc_gadget, - socket_gadget, - gadget = this; - - if (json.action === "offer") { - // XXX https://github.com/diafygi/webrtc-ips - return gadget.getDeclaredGadget("gadget_websocket.html") - .push(function (gg) { - gadget.state_parameter_dict.connecting = true; - gadget.state_parameter_dict.counter += 1; - socket_gadget = gg; - var new_element = document.createElement("div"); - gadget.state_parameter_dict.element.querySelector(".gadget_webrtc_datachannel").appendChild(new_element); - scope = "webrtc" + gadget.state_parameter_dict.counter; - return gadget.declareGadget("gadget_webrtc_datachannel.html", { - scope: scope, - element: new_element - }); - }) - .push(function (gg) { - rtc_gadget = gg; - // https://github.com/diafygi/webrtc-ips - var ip_regex = /([0-9]{1,3}(\.[0-9]{1,3}){3}|[a-f0-9]{1,4}(:[a-f0-9]{1,4}){7})/, - ip_list = [], - ip_dict = {}, - ip_addr, - line_list = JSON.parse(json.data).sdp.split('\n'), - i; - for (i = 0; i < line_list.length; i += 1) { - if (line_list[i].indexOf('a=candidate:') === 0) { - ip_addr = ip_regex.exec(line_list[i])[1]; - if (!ip_addr.match(/^[a-f0-9]{1,4}(:[a-f0-9]{1,4}){7}$/)) { - // Hide ipv6 - if (!ip_dict[ip_addr]) { - ip_list.push(ip_addr); - ip_dict[ip_addr] = true; - } - } + + .declareMethod("onOffer", function (options, offer) { + var gadget = this; + gadget.state_parameter_dict.counter += 1; + return new RSVP.Queue() + .push(function(response) { + gadget.connecting = true; + + // https://github.com/diafygi/webrtc-ips + var ip_regex = /([0-9]{1,3}(\.[0-9]{1,3}){3}|[a-f0-9]{1,4}(:[a-f0-9]{1,4}){7})/, + ip_list = [], + ip_dict = {}, + ip_addr, + line_list = JSON.parse(offer.data).sdp.split('\n'), + i; + + for (i = 0; i < line_list.length; i += 1) { + if (line_list[i].indexOf('a=candidate:') === 0) { + ip_addr = ip_regex.exec(line_list[i])[1]; + if (!ip_addr.match(/^[a-f0-9]{1,4}(:[a-f0-9]{1,4}){7}$/)) { + // Hide ipv6 + if (!ip_dict[ip_addr]) { + ip_list.push(ip_addr); + ip_dict[ip_addr] = true; } } - gadget.state_parameter_dict.scope_ip[scope] = ip_list; - return rtc_gadget.createAnswer(json.from, json.data); - }) - .push(function (local_connection) { - return socket_gadget.send(JSON.stringify({to: json.from, action: "answer", data: local_connection})); - }) - .push(function () { - return RSVP.any([ - RSVP.Queue() - .push(function () { - return RSVP.delay(10000); - }) - .push(function () { - console.info('-- webrtc client disappears...'); - return dropSubGadget(gadget, scope); - }), - rtc_gadget.waitForConnection() - ]); - }) - .push(function () { - gadget.state_parameter_dict.connecting = false; - return updateInfo(gadget); - }); - } + } + } + + gadget.state_parameter_dict.scope_ip["webrtc"+gadget.state_parameter_dict.counter] = ip_list + options.to = offer.from; + return; + }) }) + + .declareMethod('postConnection', function(options, offer) { + var gadget = this; - .declareService(function () { - var sgadget, - gadget = this; - return this.getDeclaredGadget('gadget_websocket.html') - .push(function (socket_gadget) { - sgadget = socket_gadget; - return socket_gadget.createSocket("ws://127.0.0.1:9999/"); - }) - .push(function () { - // Wait for the gadget to be dropped from the page - // and close the socket/rtc connections - return RSVP.defer().promise; - }) - .push(undefined, function (error) { + return new RSVP.Queue() + .push(function () { + gadget.state_parameter_dict.connecting = false; + return updateInfo(gadget); + }); + }) + + .declareMethod('initiate', function (roomid) { + var gadget = this, + options = { + peerid: "master", + roomid: "/"+roomid+"/", + type: "websocket", + config: {'url': "ws://127.0.0.1:9999/"}, + listner: true, + preConnection: gadget.onOffer.bind(gadget), + postConnection: gadget.postConnection.bind(gadget), + }; + + return gadget.getDeclaredGadget("gadget_webrtc_jio_bridge.html") + .push(function (rtc_gadget) { + options.rtc_gadget = rtc_gadget; + return rtc_gadget.connect(options); + }); + + /*.push(undefined, function (error) { if (sgadget === undefined) { return; } @@ -228,7 +217,7 @@ .push(function () { throw error; }); - }); + }); */ }); }(window, rJS, document, RSVP, console, DOMException)); \ No newline at end of file diff --git a/bt5/erp5_officejs/PathTemplateItem/web_page_module/gadget_officejs_page_share_webrtc_jio_js.xml b/bt5/erp5_officejs/PathTemplateItem/web_page_module/gadget_officejs_page_share_webrtc_jio_js.xml index 77f5f51cfb19c43134260c2e7f07f3087bde658e..5669b37852bcd87167706328795d8f369a2df4ac 100644 --- a/bt5/erp5_officejs/PathTemplateItem/web_page_module/gadget_officejs_page_share_webrtc_jio_js.xml +++ b/bt5/erp5_officejs/PathTemplateItem/web_page_module/gadget_officejs_page_share_webrtc_jio_js.xml @@ -228,7 +228,7 @@ actor - romain + zope comment @@ -242,7 +242,7 @@ serial - 945.33680.49983.21452 + 954.5724.21109.37529 state @@ -260,8 +260,8 @@ - 1441358513.14 - GMT + 1474552150.73 + UTC diff --git a/bt5/erp5_officejs/PathTemplateItem/web_page_module/gadget_officejs_page_share_websocket_configurator_html.html b/bt5/erp5_officejs/PathTemplateItem/web_page_module/gadget_officejs_page_share_websocket_configurator_html.html new file mode 100644 index 0000000000000000000000000000000000000000..8a58fd8f8868fad199d655aef6677828bcc48148 --- /dev/null +++ b/bt5/erp5_officejs/PathTemplateItem/web_page_module/gadget_officejs_page_share_websocket_configurator_html.html @@ -0,0 +1,63 @@ + + + + + + + OfficeJS Share Websocket Configurator Page + + + + + + + + + +
+
+

+   + Your Websocket Connection parameters +

+
+
+
+ +
+
+ + +
+
+
+
+
+
+
+ +
+
+
+
+
+
+
+
+

+   + Your Text Documents +

+
+
+
+ +
+
+
+ + diff --git a/bt5/erp5_officejs/PathTemplateItem/web_page_module/gadget_officejs_page_share_websocket_configurator_html.xml b/bt5/erp5_officejs/PathTemplateItem/web_page_module/gadget_officejs_page_share_websocket_configurator_html.xml new file mode 100644 index 0000000000000000000000000000000000000000..937c85a7112aa57f2a3ac994adf9f89de88d951d --- /dev/null +++ b/bt5/erp5_officejs/PathTemplateItem/web_page_module/gadget_officejs_page_share_websocket_configurator_html.xml @@ -0,0 +1,328 @@ + + + + + + + + + + _Access_contents_information_Permission + + + Anonymous + Assignee + Assignor + Associate + Auditor + Manager + Owner + + + + + _Add_portal_content_Permission + + + Assignee + Assignor + Manager + + + + + _Change_local_roles_Permission + + + Assignor + Manager + + + + + _Modify_portal_content_Permission + + + Assignee + Assignor + Manager + + + + + _View_Permission + + + Anonymous + Assignee + Assignor + Associate + Auditor + Manager + Owner + + + + + content_md5 + + + + + + content_type + text/html + + + default_reference + gadget_officejs_page_share_websocket_configurator.html + + + description + + + + + + id + gadget_officejs_page_share_websocket_configurator_html + + + language + + + + + + portal_type + Web Page + + + short_title + + + + + + title + OfficeJS Page Share Websocket Configurator Page + + + version + + + + + + workflow_history + + AAAAAAAAAAI= + + + + + + + + + + + + + data + + + + document_publication_workflow + + AAAAAAAAAAM= + + + + edit_workflow + + AAAAAAAAAAQ= + + + + processing_status_workflow + + AAAAAAAAAAU= + + + + + + + + + + + + + + + + + + + action + publish_alive + + + actor + zope + + + comment + + + + error_message + + + + time + + + + + + + + + + + 1474556132.86 + UTC + + + + + + + validation_state + published_alive + + + + + + + + + + + + + + + + + action + edit + + + actor + zope + + + comment + + + + + + error_message + + + + serial + 954.6882.11231.50705 + + + state + current + + + time + + + + + + + + + + + 1474621628.3 + UTC + + + + + + + + + + + + + + + + + + + + + action + detect_converted_file + + + actor + zope + + + comment + + + + error_message + + + + external_processing_state + converted + + + serial + 0.0.0.0 + + + time + + + + + + + + + + + 1474555855.94 + UTC + + + + + + + + + + + diff --git a/bt5/erp5_officejs/PathTemplateItem/web_page_module/gadget_officejs_page_share_websocket_configurator_js.js b/bt5/erp5_officejs/PathTemplateItem/web_page_module/gadget_officejs_page_share_websocket_configurator_js.js new file mode 100644 index 0000000000000000000000000000000000000000..9e87a8faef48b7046760afa71b8488e5c0e87fe0 --- /dev/null +++ b/bt5/erp5_officejs/PathTemplateItem/web_page_module/gadget_officejs_page_share_websocket_configurator_js.js @@ -0,0 +1,82 @@ +/*global window, rJS, RSVP, URI, location, + loopEventListener, btoa */ +/*jslint nomen: true, indent: 2, maxerr: 3*/ +(function (window, rJS, RSVP) { + "use strict"; + + function setPageShareConfiguration(gadget) { + return gadget.getSetting("portal_type") + .push(function (portal_type) { + var configuration = { + url: gadget.props.element.querySelector("input[name='websocket_url']").value + }; + return gadget.setSetting('webrtc_share_description', configuration); + }) + .push(function () { + return gadget.setSetting('webrtc_share_name', "WEBSOCKET"); + }) + .push(function () { + return gadget.reload(); + }); + } + + var gadget_klass = rJS(window); + + gadget_klass + .ready(function (g) { + g.props = {}; + return g.getElement() + .push(function (element) { + g.props.element = element; + g.props.deferred = RSVP.defer(); + return g.getSetting('webrtc_share_name'); + }) + .push(function (webrtc_share_name) { + if (webrtc_share_name === "WEBSOCKET") { + return g.getSetting('webrtc_share_description') + .push(function (webrtc_share_description) { + g.props.element.querySelector("input[name='websocket_url']").value = webrtc_share_description.url; + }); + } + }); + }) + .declareAcquiredMethod("updateHeader", "updateHeader") + .declareAcquiredMethod("redirect", "redirect") + .declareAcquiredMethod("reload", "reload") + .declareAcquiredMethod("getSetting", "getSetting") + .declareAcquiredMethod("setSetting", "setSetting") + .declareMethod("render", function () { + var gadget = this; + return gadget.updateHeader({ + title: "Handshake Using Websocket", + back_url: "#page=share_configurator", + panel_action: false + }).push(function () { + return gadget.props.deferred.resolve(); + }); + }) + + ///////////////////////////////////////// + // Form submit + ///////////////////////////////////////// + .declareService(function () { + var gadget = this; + + return new RSVP.Queue() + .push(function () { + return gadget.props.deferred.promise; + }) + .push(function () { + return loopEventListener( + gadget.props.element.querySelector('form'), + 'submit', + true, + function () { + return setPageShareConfiguration(gadget); + } + ); + }); + }); + + +}(window, rJS, RSVP)); \ No newline at end of file diff --git a/bt5/erp5_officejs/PathTemplateItem/web_page_module/gadget_officejs_page_share_websocket_configurator_js.xml b/bt5/erp5_officejs/PathTemplateItem/web_page_module/gadget_officejs_page_share_websocket_configurator_js.xml new file mode 100644 index 0000000000000000000000000000000000000000..e36208b7226576c2b6baa36044ad22c1248292a9 --- /dev/null +++ b/bt5/erp5_officejs/PathTemplateItem/web_page_module/gadget_officejs_page_share_websocket_configurator_js.xml @@ -0,0 +1,324 @@ + + + + + + + + + + _Access_contents_information_Permission + + + Anonymous + Assignee + Assignor + Associate + Auditor + Manager + Owner + + + + + _Add_portal_content_Permission + + + Assignee + Assignor + Manager + + + + + _Change_local_roles_Permission + + + Assignor + Manager + + + + + _Modify_portal_content_Permission + + + Assignee + Assignor + Manager + + + + + _View_Permission + + + Anonymous + Assignee + Assignor + Associate + Auditor + Manager + Owner + + + + + content_md5 + + + + + + default_reference + gadget_officejs_page_share_websocket_configurator.js + + + description + + + + + + id + gadget_officejs_page_share_websocket_configurator_js + + + language + + + + + + portal_type + Web Script + + + short_title + + + + + + title + OfficeJS Page Share Websocket Configurator Page JS + + + version + + + + + + workflow_history + + AAAAAAAAAAI= + + + + + + + + + + + + + data + + + + document_publication_workflow + + AAAAAAAAAAM= + + + + edit_workflow + + AAAAAAAAAAQ= + + + + processing_status_workflow + + AAAAAAAAAAU= + + + + + + + + + + + + + + + + + + + action + publish_alive + + + actor + zope + + + comment + + + + error_message + + + + time + + + + + + + + + + + 1474557770.65 + UTC + + + + + + + validation_state + published_alive + + + + + + + + + + + + + + + + + action + edit + + + actor + zope + + + comment + + + + + + error_message + + + + serial + 954.15506.53785.58248 + + + state + current + + + time + + + + + + + + + + + 1475139052.2 + UTC + + + + + + + + + + + + + + + + + + + + + action + detect_converted_file + + + actor + zope + + + comment + + + + error_message + + + + external_processing_state + converted + + + serial + 0.0.0.0 + + + time + + + + + + + + + + + 1474556265.19 + UTC + + + + + + + + + + + diff --git a/bt5/erp5_officejs/PathTemplateItem/web_page_module/gadget_officejs_page_webrtc_viewer_html.html b/bt5/erp5_officejs/PathTemplateItem/web_page_module/gadget_officejs_page_webrtc_viewer_html.html new file mode 100644 index 0000000000000000000000000000000000000000..f897a167ac5bd68ae4b8ac67b33bfb685e8c391a --- /dev/null +++ b/bt5/erp5_officejs/PathTemplateItem/web_page_module/gadget_officejs_page_webrtc_viewer_html.html @@ -0,0 +1,36 @@ + + + + + + + + OfficeJS Editor Remote Viewer + + + + + + + + + +
+
+ + +
+
+
+ +
+
+
+
+
+
+
+ + diff --git a/bt5/erp5_officejs/PathTemplateItem/web_page_module/gadget_officejs_page_webrtc_viewer_html.xml b/bt5/erp5_officejs/PathTemplateItem/web_page_module/gadget_officejs_page_webrtc_viewer_html.xml new file mode 100644 index 0000000000000000000000000000000000000000..33f8823433fac09c44b3db024e2a8e71b5fae02e --- /dev/null +++ b/bt5/erp5_officejs/PathTemplateItem/web_page_module/gadget_officejs_page_webrtc_viewer_html.xml @@ -0,0 +1,361 @@ + + + + + + + + + + _Access_contents_information_Permission + + + Anonymous + Assignee + Assignor + Associate + Auditor + Manager + Owner + + + + + _Add_portal_content_Permission + + + Assignee + Assignor + Manager + + + + + _Change_local_roles_Permission + + + Assignor + Manager + + + + + _Modify_portal_content_Permission + + + Assignee + Assignor + Manager + + + + + _View_Permission + + + Anonymous + Assignee + Assignor + Associate + Auditor + Manager + Owner + + + + + categories + + + + + + content_md5 + + + + + + content_type + text/html + + + creators + + + cedric.le.ninivin + + + + + default_reference + gadget_officejs_page_webrtc_viewer.html + + + description + + + + + + id + gadget_officejs_page_webrtc_viewer_html + + + language + + + + + + modification_date + + + + + + + + + + + 1455284352.14 + UTC + + + + + + + portal_type + Web Page + + + short_title + + + + + + title + OfficeJS Webrtc Viewer + + + version + + + + + + workflow_history + + AAAAAAAAAAI= + + + + + + + + + + + + + data + + + + document_publication_workflow + + AAAAAAAAAAM= + + + + edit_workflow + + AAAAAAAAAAQ= + + + + processing_status_workflow + + AAAAAAAAAAU= + + + + + + + + + + + + + + + + + + + action + publish_alive + + + actor + zope + + + comment + + + + error_message + + + + time + + + + + + + + + + + 1471511311.48 + UTC + + + + + + + validation_state + published_alive + + + + + + + + + + + + + + + + + action + edit + + + actor + zope + + + comment + + + + + + error_message + + + + serial + 953.57025.36062.60552 + + + state + current + + + time + + + + + + + + + + + 1473698013.89 + UTC + + + + + + + + + + + + + + + + + + + + + action + detect_converted_file + + + actor + zope + + + comment + + + + error_message + + + + external_processing_state + converted + + + serial + 0.0.0.0 + + + time + + + + + + + + + + + 1471510212.65 + UTC + + + + + + + + + + + diff --git a/bt5/erp5_officejs/PathTemplateItem/web_page_module/gadget_officejs_page_webrtc_viewer_js.js b/bt5/erp5_officejs/PathTemplateItem/web_page_module/gadget_officejs_page_webrtc_viewer_js.js new file mode 100644 index 0000000000000000000000000000000000000000..a96ac5982d21d3c4e60b46a40424d70b220d8eb8 --- /dev/null +++ b/bt5/erp5_officejs/PathTemplateItem/web_page_module/gadget_officejs_page_webrtc_viewer_js.js @@ -0,0 +1,133 @@ +/*globals window, RSVP, rJS*/ +/*jslint indent: 2, nomen: true, maxlen: 80*/ +(function (window, RSVP, rJS) { + "use strict"; + + function getMaxHeight(wrap_obj) { + var height; + if (wrap_obj) { + height = window.innerHeight - wrap_obj.offsetTop; + } else { + height = window.innerHeight; + } + if (height < 400) { + height = 400; + } + return height + "px"; + } + + function setFillStyle(gadget) { + var iframe = gadget.props.element.querySelector('iframe'), + height = getMaxHeight(iframe), + width = "100%"; + iframe.setAttribute( + 'style', + 'width: ' + width + '; border: 2px solid; height: ' + height + ); + return {height: height, width: width}; + } + + rJS(window) + .ready(function (g) { + g.props = {}; + return g.getElement() + .push(function (element) { + g.props.element = element; + g.props.deferred = RSVP.defer(); + g.props.content = ''; + }); + }) + + .declareAcquiredMethod("updateHeader", "updateHeader") + .declareAcquiredMethod("notifySubmitting", "notifySubmitting") + .declareAcquiredMethod("notifySubmitted", "notifySubmitted") + + .allowPublicAcquisition("notifyDataChannelMessage", function (argument_list, scope) { + var data = JSON.parse(argument_list[0]); + if (data.extra_props) { + this.props.element.querySelector("#extra").innerHTML = data.extra_props; + $('#extra').find('[data-role=collapsible]').collapsible({ enhanced: true }); + } + if (data.title) { + this.props.element.querySelector(".viewer-content").firstChild.contentDocument.body.innerHTML = data.content; + this.props.element.querySelector(".ui-field-contain").childNodes[3].firstChild.value = data.title; + this.props.title = data.title; + } + + this.props.content = data.content; + + }) + + .allowPublicAcquisition('triggerSubmit', function () { + return this.props.element.querySelector('button').click(); + }) + + .declareMethod('triggerSubmit', function () { + return this.props.element.querySelector('button').click(); + }) + + .declareMethod("render", function(options) { + var gadget = this; + gadget.props.options = options; + return new RSVP.Queue() + .push(function () { + return gadget.updateHeader({ + title: "Document Viewer", + refresh_action: true + }); + }); + }) + + .declareService(function () { + var gadget = this; + if(window.location.hash) { + var room = gadget.props.options["room"]; + return gadget.notifySubmitting() + .push(function() { + return gadget.getDeclaredGadget('share_text_via_webrtc') + }) + .push(function(g){ + if(gadget.props.options['config']) { + return g.slaveInitiate(room, gadget, gadget.props.options['type'], gadget.props.options['config']); + } else { + return g.slaveInitiate(room, gadget) + .push(null, function(error){ + return gadget.notifySubmitted() + .push(function () { + throw error; + }); + }); + } + }) + .push(function(){ + return gadget.notifySubmitted(); + }); + } + }) + + .declareService(function() { + var gadget = this; + var iframe = document.createElement("iframe"); + gadget.props.element.querySelector(".viewer-content").appendChild(iframe); + return setFillStyle(gadget); + }) + + ///////////////////////////////////////// + // Form submit + ///////////////////////////////////////// + .declareService(function () { + var gadget = this; + + return new RSVP.Queue() + .push(function () { + return loopEventListener( + gadget.props.element.querySelector('form'), + 'submit', + true, + function (event) { + gadget.props.element.querySelector(".viewer-content").firstChild.contentDocument.body.innerHTML = gadget.props.content; + } + ); + }); + }); +}(window, RSVP, rJS)); \ No newline at end of file diff --git a/bt5/erp5_officejs/PathTemplateItem/web_page_module/gadget_officejs_page_webrtc_viewer_js.xml b/bt5/erp5_officejs/PathTemplateItem/web_page_module/gadget_officejs_page_webrtc_viewer_js.xml new file mode 100644 index 0000000000000000000000000000000000000000..f53d2764b531bb0daf1f27337d001125f05c9675 --- /dev/null +++ b/bt5/erp5_officejs/PathTemplateItem/web_page_module/gadget_officejs_page_webrtc_viewer_js.xml @@ -0,0 +1,357 @@ + + + + + + + + + + _Access_contents_information_Permission + + + Anonymous + Assignee + Assignor + Associate + Auditor + Manager + Owner + + + + + _Add_portal_content_Permission + + + Assignee + Assignor + Manager + + + + + _Change_local_roles_Permission + + + Assignor + Manager + + + + + _Modify_portal_content_Permission + + + Assignee + Assignor + Manager + + + + + _View_Permission + + + Anonymous + Assignee + Assignor + Associate + Auditor + Manager + Owner + + + + + categories + + + + + + content_md5 + + + + + + creators + + + cedric.le.ninivin + + + + + default_reference + gadget_officejs_page_webrtc_viewer.js + + + description + + + + + + id + gadget_officejs_page_webrtc_viewer_js + + + language + + + + + + modification_date + + + + + + + + + + + 1455284352.18 + UTC + + + + + + + portal_type + Web Script + + + short_title + + + + + + title + OfficeJS Webrtc Viewer JS + + + version + + + + + + workflow_history + + AAAAAAAAAAI= + + + + + + + + + + + + + data + + + + document_publication_workflow + + AAAAAAAAAAM= + + + + edit_workflow + + AAAAAAAAAAQ= + + + + processing_status_workflow + + AAAAAAAAAAU= + + + + + + + + + + + + + + + + + + + action + publish_alive + + + actor + zope + + + comment + + + + error_message + + + + time + + + + + + + + + + + 1471537049.31 + UTC + + + + + + + validation_state + published_alive + + + + + + + + + + + + + + + + + action + edit + + + actor + zope + + + comment + + + + + + error_message + + + + serial + 954.5557.49354.23227 + + + state + current + + + time + + + + + + + + + + + 1474542105.73 + UTC + + + + + + + + + + + + + + + + + + + + + action + detect_converted_file + + + actor + zope + + + comment + + + + error_message + + + + external_processing_state + converted + + + serial + 0.0.0.0 + + + time + + + + + + + + + + + 1471535759.72 + UTC + + + + + + + + + + + diff --git a/bt5/erp5_officejs/PathTemplateItem/web_page_module/gadget_officejs_webrtc_jio_html.html b/bt5/erp5_officejs/PathTemplateItem/web_page_module/gadget_officejs_webrtc_jio_html.html index 4657a34d2f1c3e3ebe9a523d097cd8ae7ca14d9b..7cf15230ddb3666aa6e92140a8f5c38ca5d67209 100644 --- a/bt5/erp5_officejs/PathTemplateItem/web_page_module/gadget_officejs_webrtc_jio_html.html +++ b/bt5/erp5_officejs/PathTemplateItem/web_page_module/gadget_officejs_webrtc_jio_html.html @@ -17,8 +17,8 @@ data-gadget-scope="jio_gadget" data-gadget-sandbox="public"> -
-
- +
\ No newline at end of file diff --git a/bt5/erp5_officejs/PathTemplateItem/web_page_module/gadget_officejs_webrtc_jio_html.xml b/bt5/erp5_officejs/PathTemplateItem/web_page_module/gadget_officejs_webrtc_jio_html.xml index 9ce48b7c9872030d9663c96710c09383cf9c8a37..106d666c8366becb4cf34147da9a270c6c89188a 100644 --- a/bt5/erp5_officejs/PathTemplateItem/web_page_module/gadget_officejs_webrtc_jio_html.xml +++ b/bt5/erp5_officejs/PathTemplateItem/web_page_module/gadget_officejs_webrtc_jio_html.xml @@ -218,7 +218,7 @@
actor - romain + zope comment @@ -232,7 +232,7 @@ serial - 945.32246.38846.38144 + 954.2812.41384.46984 state @@ -250,8 +250,8 @@ - 1441283008.98 - GMT + 1474377398.17 + UTC diff --git a/bt5/erp5_officejs/PathTemplateItem/web_page_module/gadget_officejs_webrtc_jio_js.js b/bt5/erp5_officejs/PathTemplateItem/web_page_module/gadget_officejs_webrtc_jio_js.js index a8af7f0826a602cce0d64f882d70293ad06938b3..51a5b6b4966ce300ff2171cde2d8619b8bc4cc39 100644 --- a/bt5/erp5_officejs/PathTemplateItem/web_page_module/gadget_officejs_webrtc_jio_js.js +++ b/bt5/erp5_officejs/PathTemplateItem/web_page_module/gadget_officejs_webrtc_jio_js.js @@ -24,7 +24,7 @@ if (!gadget.state_parameter_dict.jio_created) { return gadget.redirect({page: 'setting'}); } - return gadget.getDeclaredGadget('gadget_webrtc_datachannel.html') + return gadget.getDeclaredGadget("gadget_webrtc_jio_bridge.html") .push(function (rtc_gadget) { gadget.state_parameter_dict.message_count += 1; gadget.state_parameter_dict.message_dict[gadget.state_parameter_dict.message_count] = RSVP.defer(); @@ -34,7 +34,7 @@ type: "jio_query", method_name: method_name, argument_list: Array.prototype.slice.call(argument_list) - })), + }), 'webrtc0'), RSVP.any([ RSVP.timeout(timeout), gadget.state_parameter_dict.message_dict[gadget.state_parameter_dict.message_count].promise @@ -44,7 +44,6 @@ .push(function (result_list) { return result_list[1]; }); - } function declareSubGadget(gadget, url) { @@ -105,58 +104,41 @@ .declareMethod('createJio', function (options) { var context = this, - socket_gadget, - rtc_gadget; + rtc_gadget, + rtc_options = { + type: "websocket", + roomid: "/ok/", + config: {url : options.socket_url}, + initiator: true, + to: 'master' + }; + + //if ((options === undefined) || (options.socket_url === undefined)) { + // return context.redirect({page: 'setting'}); + //} - if ((options === undefined) || (options.socket_url === undefined)) { - return context.redirect({page: 'setting'}); - } context.state_parameter_dict.jio_created = true; - return declareSubGadget(context, 'gadget_websocket.html') - .push(function (gadget) { - socket_gadget = gadget; - - context.state_parameter_dict.uuid = UUID(); - context.state_parameter_dict.answer_defer = RSVP.defer(); - context.state_parameter_dict.message_count = 0; - context.state_parameter_dict.message_dict = {}; - // Send offer and expect answer in less than XXXms (arbitrary value...) - return RSVP.any([ - RSVP.Queue() - .push(function () { - return RSVP.timeout(websocket_timeout); - }) - .push(undefined, function () { - return context.redirect({page: 'setting'}); - // throw new Error("No remote WebRTC connection available"); - }), - declareSubGadget(context, 'gadget_websocket.html') - .push(function (gadget) { - socket_gadget = gadget; - // XXX Drop hardcoded URL - return socket_gadget.createSocket(options.socket_url); - }) - .push(function () { - return declareSubGadget(context, 'gadget_webrtc_datachannel.html'); - }) - .push(function (gadget) { - rtc_gadget = gadget; - return rtc_gadget.createOffer(context.state_parameter_dict.uuid); - }) - .push(function (description) { - return RSVP.all([ - socket_gadget.send(JSON.stringify({from: context.state_parameter_dict.uuid, action: "offer", data: description})), - context.state_parameter_dict.answer_defer.promise - ]); - }) - .push(function (response_list) { - return rtc_gadget.registerAnswer(response_list[1]); - }) - .push(function () { - return socket_gadget.close(); - }) - ]); - }); + context.state_parameter_dict.uuid = UUID(); + context.state_parameter_dict.answer_defer = RSVP.defer(); + context.state_parameter_dict.message_count = 0; + context.state_parameter_dict.message_dict = {}; + // Send offer and expect answer in less than XXXms (arbitrary value...) + return RSVP.any([ + RSVP.Queue() + .push(function () { + return RSVP.timeout(websocket_timeout); + }) + .push(undefined, function () { + //return context.redirect({page: 'setting'}); + // throw new Error("No remote WebRTC connection available"); + }), + context.getDeclaredGadget("gadget_webrtc_jio_bridge.html") + .push(function (rtc_gadget) { + rtc_options.peerid = context.state_parameter_dict.uuid; + + return rtc_gadget.connect(rtc_options); + }) + ]); }) .declareMethod('allDocs', function () { return wrapJioAccess(this, 'allDocs', arguments); diff --git a/bt5/erp5_officejs/PathTemplateItem/web_page_module/gadget_officejs_webrtc_jio_js.xml b/bt5/erp5_officejs/PathTemplateItem/web_page_module/gadget_officejs_webrtc_jio_js.xml index 185e56d1f9c462870ae474fb2ae27fe17262de40..2211b15cc7b0e596bbff21442c657e17c0ced11e 100644 --- a/bt5/erp5_officejs/PathTemplateItem/web_page_module/gadget_officejs_webrtc_jio_js.xml +++ b/bt5/erp5_officejs/PathTemplateItem/web_page_module/gadget_officejs_webrtc_jio_js.xml @@ -216,7 +216,7 @@ actor - romain + zope comment @@ -230,7 +230,7 @@ serial - 945.39449.60302.38024 + 954.14471.14332.60706 state @@ -248,8 +248,8 @@ - 1441715721.23 - GMT + 1475077244.9 + UTC diff --git a/bt5/erp5_officejs/bt/dependency_list b/bt5/erp5_officejs/bt/dependency_list index 674fe978494795c83a1aff95f8e2a2184d62f0f9..86eaeef8bbd835f6fb31cfa084d818daae2ad1a3 100644 --- a/bt5/erp5_officejs/bt/dependency_list +++ b/bt5/erp5_officejs/bt/dependency_list @@ -1,2 +1,3 @@ erp5_web_renderjs_ui -erp5_web_ung_core \ No newline at end of file +erp5_web_ung_core +erp5_webrtc_gadget \ No newline at end of file