Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
erp5
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Hardik Juneja
erp5
Commits
f1caf11c
Commit
f1caf11c
authored
Sep 20, 2016
by
Hardik Juneja
Committed by
hardikj
Sep 23, 2016
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
gadget_officejs: Add support for websocket
parent
637e2050
Changes
19
Show whitespace changes
Inline
Side-by-side
Showing
19 changed files
with
325 additions
and
398 deletions
+325
-398
bt5/erp5_officejs/PathTemplateItem/web_page_module/gadget_officejs_jio_web_page_view_html.html
...b_page_module/gadget_officejs_jio_web_page_view_html.html
+10
-7
bt5/erp5_officejs/PathTemplateItem/web_page_module/gadget_officejs_jio_web_page_view_html.xml
...eb_page_module/gadget_officejs_jio_web_page_view_html.xml
+2
-2
bt5/erp5_officejs/PathTemplateItem/web_page_module/gadget_officejs_jio_web_page_view_js.js
...m/web_page_module/gadget_officejs_jio_web_page_view_js.js
+75
-60
bt5/erp5_officejs/PathTemplateItem/web_page_module/gadget_officejs_jio_web_page_view_js.xml
.../web_page_module/gadget_officejs_jio_web_page_view_js.xml
+2
-2
bt5/erp5_officejs/PathTemplateItem/web_page_module/gadget_officejs_page_share_text_html.html
...web_page_module/gadget_officejs_page_share_text_html.html
+3
-1
bt5/erp5_officejs/PathTemplateItem/web_page_module/gadget_officejs_page_share_text_html.xml
.../web_page_module/gadget_officejs_page_share_text_html.xml
+2
-2
bt5/erp5_officejs/PathTemplateItem/web_page_module/gadget_officejs_page_share_text_js.js
...tem/web_page_module/gadget_officejs_page_share_text_js.js
+86
-148
bt5/erp5_officejs/PathTemplateItem/web_page_module/gadget_officejs_page_share_text_js.xml
...em/web_page_module/gadget_officejs_page_share_text_js.xml
+2
-2
bt5/erp5_officejs/PathTemplateItem/web_page_module/gadget_officejs_page_share_webrtc_jio_html.html
...ge_module/gadget_officejs_page_share_webrtc_jio_html.html
+4
-6
bt5/erp5_officejs/PathTemplateItem/web_page_module/gadget_officejs_page_share_webrtc_jio_html.xml
...age_module/gadget_officejs_page_share_webrtc_jio_html.xml
+4
-4
bt5/erp5_officejs/PathTemplateItem/web_page_module/gadget_officejs_page_share_webrtc_jio_js.js
...b_page_module/gadget_officejs_page_share_webrtc_jio_js.js
+79
-90
bt5/erp5_officejs/PathTemplateItem/web_page_module/gadget_officejs_page_share_webrtc_jio_js.xml
..._page_module/gadget_officejs_page_share_webrtc_jio_js.xml
+4
-4
bt5/erp5_officejs/PathTemplateItem/web_page_module/gadget_officejs_page_webrtc_viewer_html.xml
...b_page_module/gadget_officejs_page_webrtc_viewer_html.xml
+2
-2
bt5/erp5_officejs/PathTemplateItem/web_page_module/gadget_officejs_page_webrtc_viewer_js.js
.../web_page_module/gadget_officejs_page_webrtc_viewer_js.js
+1
-1
bt5/erp5_officejs/PathTemplateItem/web_page_module/gadget_officejs_page_webrtc_viewer_js.xml
...web_page_module/gadget_officejs_page_webrtc_viewer_js.xml
+2
-2
bt5/erp5_officejs/PathTemplateItem/web_page_module/gadget_officejs_webrtc_jio_html.html
...Item/web_page_module/gadget_officejs_webrtc_jio_html.html
+3
-3
bt5/erp5_officejs/PathTemplateItem/web_page_module/gadget_officejs_webrtc_jio_html.xml
...eItem/web_page_module/gadget_officejs_webrtc_jio_html.xml
+4
-4
bt5/erp5_officejs/PathTemplateItem/web_page_module/gadget_officejs_webrtc_jio_js.js
...lateItem/web_page_module/gadget_officejs_webrtc_jio_js.js
+36
-54
bt5/erp5_officejs/PathTemplateItem/web_page_module/gadget_officejs_webrtc_jio_js.xml
...ateItem/web_page_module/gadget_officejs_webrtc_jio_js.xml
+4
-4
No files found.
bt5/erp5_officejs/PathTemplateItem/web_page_module/gadget_officejs_jio_web_page_view_html.html
View file @
f1caf11c
...
@@ -11,19 +11,22 @@
...
@@ -11,19 +11,22 @@
<script
src=
"handlebars.js"
></script>
<script
src=
"handlebars.js"
></script>
<script
class=
"view-web-page-template"
type=
"text/x-handlebars-template"
>
<script
class=
"view-web-page-template"
type=
"text/x-handlebars-template"
>
<
form
class
=
"
select-share-type
"
>
<
div
class
=
"
center
"
>
<
div
class
=
"
ui-field-contain
"
>
<
label
data
-
i18n
=
"
Public Link:
"
>
Public
Link
:
<
/label
>
<
button
type
=
"
submit
"
id
=
"
generatelink
"
name
=
"
generatelink
"
data
-
i18n
=
"
Jio Link
"
style
=
"
display: inline-block; width: 34%;
"
>
Jio
Link
<
/button
>
<
button
type
=
"
submit
"
id
=
"
generatelink1
"
name
=
"
generatelink1
"
data
-
i18n
=
"
Websocket Link
"
style
=
"
display: inline-block; width: 34%;
"
>
Websocket
Link
<
/button
>
<
input
type
=
"
text
"
id
=
"
sharelink
"
name
=
"
share
"
style
=
"
display:none
"
value
=
""
/>
<
/div
>
<
/div
>
<
/form
>
<
form
class
=
"
view-web-page-form
"
>
<
form
class
=
"
view-web-page-form
"
>
<
div
class
=
"
center
"
>
<
div
class
=
"
center
"
>
<
div
class
=
"
ui-field-contain
"
>
<
div
class
=
"
ui-field-contain
"
>
<
label
data
-
i18n
=
"
Title:
"
>
Title
:
<
/label
>
<
label
data
-
i18n
=
"
Title:
"
>
Title
:
<
/label
>
<
input
type
=
"
text
"
name
=
"
title
"
value
=
"
{{title}}
"
>
<
input
type
=
"
text
"
name
=
"
title
"
value
=
"
{{title}}
"
>
<
/div
>
<
/div
>
<
div
class
=
"
ui-field-contain
"
>
<
label
data
-
i18n
=
"
Public Link:
"
>
Public
Link
:
<
/label
>
<
button
type
=
"
submit
"
id
=
"
generatelink
"
name
=
"
generatelink
"
data
-
i18n
=
"
Generate Link
"
style
=
"
display:block;
"
>
Generate
Link
<
/button
>
<
input
type
=
"
text
"
id
=
"
sharelink
"
name
=
"
share
"
style
=
"
display:none
"
value
=
""
/>
<
/div
>
<
button
type
=
"
submit
"
data
-
i18n
=
"
Save
"
style
=
"
display:none;
"
>
Save
<
/button
>
<
button
type
=
"
submit
"
data
-
i18n
=
"
Save
"
style
=
"
display:none;
"
>
Save
<
/button
>
<
/div
>
<
/div
>
...
...
bt5/erp5_officejs/PathTemplateItem/web_page_module/gadget_officejs_jio_web_page_view_html.xml
View file @
f1caf11c
...
@@ -232,7 +232,7 @@
...
@@ -232,7 +232,7 @@
</item>
</item>
<item>
<item>
<key>
<string>
serial
</string>
</key>
<key>
<string>
serial
</string>
</key>
<value>
<string>
95
3.27768.8271.35532
</string>
</value>
<value>
<string>
95
4.5706.38367.28381
</string>
</value>
</item>
</item>
<item>
<item>
<key>
<string>
state
</string>
</key>
<key>
<string>
state
</string>
</key>
...
@@ -250,7 +250,7 @@
...
@@ -250,7 +250,7 @@
</tuple>
</tuple>
<state>
<state>
<tuple>
<tuple>
<float>
147
1964256.1
8
</float>
<float>
147
4551059.2
8
</float>
<string>
UTC
</string>
<string>
UTC
</string>
</tuple>
</tuple>
</state>
</state>
...
...
bt5/erp5_officejs/PathTemplateItem/web_page_module/gadget_officejs_jio_web_page_view_js.js
View file @
f1caf11c
...
@@ -29,6 +29,60 @@
...
@@ -29,6 +29,60 @@
});
});
}
}
function
shareDoc
(
gadget
,
type
)
{
if
(
window
.
location
.
hash
)
{
var
index
=
window
.
location
.
hash
.
indexOf
(
'
room=
'
);
if
(
index
===
-
1
)
{
var
S4
=
function
()
{
return
(((
1
+
Math
.
random
())
*
0x10000
)
|
0
).
toString
(
16
).
substring
(
1
);
};
var
room
=
(
S4
()
+
S4
()
+
"
-
"
+
S4
()
+
S4
());
return
new
RSVP
.
Queue
()
.
push
(
function
()
{
return
gadget
.
declareGadget
(
"
gadget_officejs_page_share_text.html
"
,
{
scope
:
"
share_text_via_webrtc
"
,
element
:
gadget
.
props
.
element
.
querySelector
(
"
.webrtc-gadget
"
)
}
);
})
.
push
(
function
(
g
){
var
config
;
if
(
type
===
"
jio
"
)
{
config
=
{
type
:
"
query
"
,
sub_storage
:
{
type
:
"
uuid
"
,
sub_storage
:
{
"
type
"
:
"
dav
"
,
"
url
"
:
"
https://softinst67513.host.vifib.net/share/
"
,
"
basic_login
"
:
btoa
(
"
admin:vowhkida
"
)
}
}
};
}
else
{
config
=
{
url
:
"
ws://192.168.242.146:9999/
"
};
}
var
sharelink
=
window
.
location
.
origin
+
window
.
location
.
pathname
+
'
#page=webrtc_viewer&room=
'
+
room
+
'
&type=
'
+
type
+
'
&config=
'
+
encodeURIComponent
(
JSON
.
stringify
(
config
));
gadget
.
props
.
element
.
querySelector
(
'
#sharelink
'
).
value
=
sharelink
;
gadget
.
props
.
element
.
querySelector
(
'
#sharelink
'
).
style
.
display
=
'
block
'
;
gadget
.
props
.
element
.
querySelector
(
'
#generatelink
'
).
remove
();
gadget
.
props
.
element
.
querySelector
(
'
#generatelink1
'
).
remove
();
if
(
config
)
{
return
g
.
initiate
(
room
,
gadget
,
type
,
config
);
}
else
{
throw
new
Error
(
"
Share config is missing
"
);
}
})
}
}
}
function
maximize
(
gadget
)
{
function
maximize
(
gadget
)
{
var
iframe
=
gadget
.
props
.
element
.
querySelector
(
'
iframe
'
),
var
iframe
=
gadget
.
props
.
element
.
querySelector
(
'
iframe
'
),
iframe_class_string
=
iframe
.
getAttribute
(
'
class
'
)
||
""
,
iframe_class_string
=
iframe
.
getAttribute
(
'
class
'
)
||
""
,
...
@@ -111,55 +165,6 @@
...
@@ -111,55 +165,6 @@
});
});
})
})
.
declareMethod
(
"
shareDoc
"
,
function
()
{
var
gadget
=
this
;
if
(
window
.
location
.
hash
)
{
var
index
=
window
.
location
.
hash
.
indexOf
(
'
room=
'
);
if
(
index
===
-
1
)
{
var
S4
=
function
()
{
return
(((
1
+
Math
.
random
())
*
0x10000
)
|
0
).
toString
(
16
).
substring
(
1
);
};
var
room
=
(
S4
()
+
S4
()
+
"
-
"
+
S4
()
+
S4
());
return
new
RSVP
.
Queue
()
.
push
(
function
()
{
return
gadget
.
declareGadget
(
"
gadget_officejs_page_share_text.html
"
,
{
scope
:
"
share_text_via_webrtc
"
,
element
:
gadget
.
props
.
element
.
querySelector
(
"
.webrtc-gadget
"
)
}
);
})
.
push
(
function
(
g
){
var
config
=
{
type
:
"
query
"
,
sub_storage
:
{
type
:
"
uuid
"
,
sub_storage
:
{
//type: "indexeddb",
//"database": "handshake"
"
type
"
:
"
dav
"
,
"
url
"
:
"
https://softinst67513.host.vifib.net/share/
"
,
"
basic_login
"
:
btoa
(
"
admin:vowhkida
"
)
}
}
}
var
sharelink
=
window
.
location
.
origin
+
window
.
location
.
pathname
+
'
#page=webrtc_viewer&room=
'
+
room
+
'
&config=
'
+
encodeURIComponent
(
JSON
.
stringify
(
config
));
gadget
.
props
.
element
.
querySelector
(
'
#sharelink
'
).
value
=
sharelink
;
gadget
.
props
.
element
.
querySelector
(
'
#sharelink
'
).
style
.
display
=
'
block
'
;
gadget
.
props
.
element
.
querySelector
(
'
#generatelink
'
).
remove
();
if
(
config
)
{
return
g
.
initiate
(
room
,
gadget
,
config
);
}
else
{
return
g
.
initiate
(
room
,
gadget
);
}
})
}
}
})
/////////////////////////////////////////
/////////////////////////////////////////
// Render text content gadget
// Render text content gadget
/////////////////////////////////////////
/////////////////////////////////////////
...
@@ -209,18 +214,28 @@
...
@@ -209,18 +214,28 @@
return
gadget
.
props
.
deferred
.
promise
;
return
gadget
.
props
.
deferred
.
promise
;
})
})
.
push
(
function
()
{
.
push
(
function
()
{
return
loopEventListener
(
return
RSVP
.
all
([
gadget
.
props
.
element
.
querySelector
(
'
form
'
),
loopEventListener
(
gadget
.
props
.
element
.
querySelector
(
'
form.select-share-type
'
),
'
submit
'
,
'
submit
'
,
true
,
true
,
function
(
event
)
{
function
(
event
)
{
if
(
document
.
activeElement
.
name
===
"
generatelink
"
)
{
if
(
document
.
activeElement
.
name
===
"
generatelink
"
)
{
return
gadget
.
shareDoc
(
);
return
shareDoc
(
gadget
,
"
jio
"
);
}
else
{
}
else
if
(
document
.
activeElement
.
name
===
"
generatelink1
"
)
{
return
saveContent
(
gadget
,
event
);
return
shareDoc
(
gadget
,
"
websocket
"
);
}
}
}
}
);
),
loopEventListener
(
gadget
.
props
.
element
.
querySelector
(
'
form.view-web-page-form
'
),
'
submit
'
,
true
,
function
(
event
)
{
return
saveContent
(
gadget
,
event
);
}
)
]);
});
});
});
});
...
...
bt5/erp5_officejs/PathTemplateItem/web_page_module/gadget_officejs_jio_web_page_view_js.xml
View file @
f1caf11c
...
@@ -228,7 +228,7 @@
...
@@ -228,7 +228,7 @@
</item>
</item>
<item>
<item>
<key>
<string>
serial
</string>
</key>
<key>
<string>
serial
</string>
</key>
<value>
<string>
95
3.38231.58110.12526
</string>
</value>
<value>
<string>
95
4.5702.26020.8277
</string>
</value>
</item>
</item>
<item>
<item>
<key>
<string>
state
</string>
</key>
<key>
<string>
state
</string>
</key>
...
@@ -246,7 +246,7 @@
...
@@ -246,7 +246,7 @@
</tuple>
</tuple>
<state>
<state>
<tuple>
<tuple>
<float>
147
2570624.98
</float>
<float>
147
4550862.46
</float>
<string>
UTC
</string>
<string>
UTC
</string>
</tuple>
</tuple>
</state>
</state>
...
...
bt5/erp5_officejs/PathTemplateItem/web_page_module/gadget_officejs_page_share_text_html.html
View file @
f1caf11c
...
@@ -12,6 +12,8 @@
...
@@ -12,6 +12,8 @@
</head>
</head>
<body>
<body>
<div
class=
"gadget_webrtc_jio_bridge"
></div>
<div
data-gadget-url=
"gadget_webrtc_jio_bridge.html"
data-gadget-scope=
"gadget_webrtc_jio_bridge.html"
data-gadget-sandbox=
"public"
></div>
</body>
</body>
</html>
</html>
bt5/erp5_officejs/PathTemplateItem/web_page_module/gadget_officejs_page_share_text_html.xml
View file @
f1caf11c
...
@@ -234,7 +234,7 @@
...
@@ -234,7 +234,7 @@
</item>
</item>
<item>
<item>
<key>
<string>
serial
</string>
</key>
<key>
<string>
serial
</string>
</key>
<value>
<string>
953.
38184.65477.6085
9
</string>
</value>
<value>
<string>
953.
57026.12963.5346
9
</string>
</value>
</item>
</item>
<item>
<item>
<key>
<string>
state
</string>
</key>
<key>
<string>
state
</string>
</key>
...
@@ -252,7 +252,7 @@
...
@@ -252,7 +252,7 @@
</tuple>
</tuple>
<state>
<state>
<tuple>
<tuple>
<float>
147
2631749.27
</float>
<float>
147
3758929.92
</float>
<string>
UTC
</string>
<string>
UTC
</string>
</tuple>
</tuple>
</state>
</state>
...
...
bt5/erp5_officejs/PathTemplateItem/web_page_module/gadget_officejs_page_share_text_js.js
View file @
f1caf11c
...
@@ -19,41 +19,16 @@
...
@@ -19,41 +19,16 @@
S4
()
+
S4
()
+
S4
();
S4
()
+
S4
()
+
S4
();
}
}
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
dropSubGadget
(
gadget
,
scope
)
{
return
gadget
.
getDeclaredGadget
(
scope
)
.
push
(
function
(
result
)
{
return
result
.
getElement
();
})
.
push
(
function
(
element
)
{
if
(
element
.
parentElement
)
{
element
.
parentElement
.
removeChild
(
element
);
}
delete
gadget
.
state_parameter_dict
.
scope_ip
[
scope
];
return
gadget
.
dropGadget
(
scope
);
});
}
function
getWebRTCScopeList
(
gadget
)
{
function
getWebRTCScopeList
(
gadget
)
{
var
result_list
=
[],
var
result_list
=
[],
element_list
=
gadget
.
state_parameter_dict
.
element
.
querySelector
(
"
.gadget_webrtc
_jio_bridge
"
)
element_list
=
gadget
.
state_parameter_dict
.
element
.
querySelector
(
"
.gadget_webrtc
"
)
.
childNodes
,
.
childNodes
,
i
;
i
;
for
(
i
=
0
;
i
<
element_list
.
length
;
i
+=
1
)
{
for
(
i
=
0
;
i
<
element_list
.
length
;
i
+=
1
)
{
if
(
element_list
[
i
].
getAttribute
)
{
result_list
.
push
(
element_list
[
i
].
getAttribute
(
"
data-gadget-scope
"
));
result_list
.
push
(
element_list
[
i
].
getAttribute
(
"
data-gadget-scope
"
));
}
}
}
return
result_list
;
return
result_list
;
}
}
...
@@ -90,7 +65,7 @@
...
@@ -90,7 +65,7 @@
.
ready
(
function
(
gadget
)
{
.
ready
(
function
(
gadget
)
{
// Initialize the gadget local parameters
// Initialize the gadget local parameters
gadget
.
state_parameter_dict
=
{
gadget
.
state_parameter_dict
=
{
counter
:
0
,
counter
:
1
,
connecting
:
false
,
connecting
:
false
,
scope_ip
:
{}
scope_ip
:
{}
};
};
...
@@ -102,38 +77,14 @@
...
@@ -102,38 +77,14 @@
return
updateInfo
(
gadget
);
return
updateInfo
(
gadget
);
});
});
})
})
.
allowPublicAcquisition
(
'
notifyDataChannelClosed
'
,
function
(
argument_list
,
scope
)
{
/*jslint unparam:true*/
var
gadget
=
this
;
return
dropSubGadget
(
this
,
scope
)
.
push
(
function
()
{
return
updateInfo
(
gadget
);
});
})
.
declareMethod
(
'
connect
'
,
function
(
room_id
,
offer
,
parent_scope
,
config
)
{
.
declareMethod
(
'
onOffer
'
,
function
(
options
,
offer
)
{
var
gadget
=
this
,
var
gadget
=
this
;
scope
,
rtc_gadget
;
return
new
RSVP
.
Queue
()
return
new
RSVP
.
Queue
()
.
push
(
function
(
response
)
{
.
push
(
function
(
response
)
{
gadget
.
state_parameter_dict
.
connecting
=
true
;
gadget
.
connecting
=
true
;
gadget
.
state_parameter_dict
.
counter
+=
1
;
var
new_element
=
document
.
createElement
(
"
div
"
);
gadget
.
state_parameter_dict
.
element
.
querySelector
(
"
.gadget_webrtc_jio_bridge
"
).
appendChild
(
new_element
);
scope
=
"
webrtc
"
+
gadget
.
state_parameter_dict
.
counter
;
return
gadget
.
declareGadget
(
"
gadget_webrtc_jio_bridge.html
"
,
{
scope
:
scope
,
element
:
new_element
})
.
push
(
function
(
gg
){
rtc_gadget
=
gg
;
return
rtc_gadget
.
register
(
room_id
,
'
master
'
,
config
);
})
.
push
(
function
(){
// https://github.com/diafygi/webrtc-ips
// 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})
/
,
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_list
=
[],
...
@@ -154,99 +105,86 @@
...
@@ -154,99 +105,86 @@
}
}
}
}
}
}
gadget
.
state_parameter_dict
.
scope_ip
[
scope
]
=
ip_list
;
return
rtc_gadget
.
connect
({
gadget
.
state_parameter_dict
.
scope_ip
[
"
webrtc
"
+
gadget
.
state_parameter_dict
.
counter
]
=
ip_list
roomid
:
room_id
,
options
.
to
=
offer
.
from
;
peerid
:
'
master
'
,
return
;
to
:
offer
.
from
,
offer
:
JSON
.
stringify
(
offer
.
data
)
});
});
})
})
.
declareMethod
(
'
postConnection
'
,
function
(
options
,
offer
)
{
var
gadget
=
this
,
counter
;
return
new
RSVP
.
Queue
()
.
push
(
function
()
{
.
push
(
function
()
{
return
RSVP
.
any
([
gadget
.
connecting
=
false
;
RSVP
.
Queue
()
.
push
(
function
()
{
return
RSVP
.
delay
(
20000
);
})
.
push
(
function
()
{
console
.
info
(
'
-- webrtc client disappears...
'
);
return
dropSubGadget
(
gadget
,
scope
);
}),
rtc_gadget
.
waitForConnection
()
]);
})
.
push
(
function
()
{
gadget
.
state_parameter_dict
.
connecting
=
false
;
var
ckeditor
=
window
.
frames
[
0
].
CKEDITOR
;
var
ckeditor
=
window
.
frames
[
0
].
CKEDITOR
;
var
data
=
{
'
content
'
:
ckeditor
.
instances
.
editor1
.
getData
()};
var
data
=
{
'
content
'
:
ckeditor
.
instances
.
editor1
.
getData
()};
// Get all the extra properties and send it with data
// Get all the extra properties and send it with data
var
extraprops
=
parent_scope
.
props
.
element
.
querySelector
(
'
.ui-collapsible
'
).
outerHTML
;
var
extraprops
=
options
.
parent_scope
.
props
.
element
.
querySelector
(
'
.ui-collapsible
'
).
outerHTML
;
data
[
'
extra_props
'
]
=
extraprops
;
data
[
'
extra_props
'
]
=
extraprops
;
// Get title
// Get title
var
title
=
parent_scope
.
props
.
element
.
querySelector
(
'
.ui-field-contain
'
).
childNodes
[
3
].
firstChild
.
value
;
var
title
=
options
.
parent_scope
.
props
.
element
.
querySelector
(
"
.view-web-page-form
"
).
title
.
value
;
data
[
'
title
'
]
=
title
;
data
[
'
title
'
]
=
title
;
rtc_gadget
.
send
(
JSON
.
stringify
(
data
));
counter
=
gadget
.
state_parameter_dict
.
counter
;
options
.
rtc_gadget
.
send
(
JSON
.
stringify
(
data
),
"
webrtc
"
+
counter
);
ckeditor
.
instances
.
editor1
.
on
(
'
key
'
,
function
(
e
){
ckeditor
.
instances
.
editor1
.
on
(
'
key
'
,
function
(
e
){
rtc_gadget
.
send
(
JSON
.
stringify
({
'
content
'
:
ckeditor
.
instances
.
editor1
.
getData
()})
);
options
.
rtc_gadget
.
send
(
JSON
.
stringify
({
'
content
'
:
ckeditor
.
instances
.
editor1
.
getData
()}),
"
webrtc
"
+
counter
);
});
});
gadget
.
state_parameter_dict
.
counter
+=
1
;
return
updateInfo
(
gadget
);
return
updateInfo
(
gadget
);
});
});
})
})
})
.
declareMethod
(
'
initiate
'
,
function
(
roomid
,
scope
,
config
)
{
.
declareMethod
(
'
initiate
'
,
function
(
roomid
,
scope
,
type
,
config
)
{
var
gadget
=
this
,
var
gadget
=
this
,
rtc_gadget
,
options
=
{
blob
;
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
.
declareGadget
(
"
gadget_webrtc_jio_bridge.html
"
)
return
gadget
.
getDeclaredGadget
(
"
gadget_webrtc_jio_bridge.html
"
)
.
push
(
function
(
rg
)
{
.
push
(
function
(
rtc_gadget
)
{
// register peer
options
.
rtc_gadget
=
rtc_gadget
;
rtc_gadget
=
rg
;
return
rtc_gadget
.
connect
(
options
);
roomid
=
"
/
"
+
roomid
+
"
/
"
;
return
rtc_gadget
.
register
(
roomid
,
'
master
'
,
config
);
})
.
push
(
function
(
r
)
{
var
peerid
=
'
master
'
;
return
rtc_gadget
.
wait_until_available
(
roomid
,
peerid
+
'
_
'
,
function
(
offers
)
{
var
connections
=
[];
for
(
var
offer
in
offers
)
{
connections
.
push
(
gadget
.
connect
(
roomid
,
JSON
.
parse
(
offers
[
offer
].
target
.
result
),
scope
,
config
));
}
return
RSVP
.
all
(
connections
);
});
});
});
})
})
.
declareMethod
(
'
slaveInitiate
'
,
function
(
roomid
,
g
,
config
)
{
.
declareMethod
(
'
slaveInitiate
'
,
function
(
roomid
,
g
,
type
,
config
)
{
var
context
=
this
,
var
context
=
this
,
rtc_gadget
,
gadget
;
rtc_gadget
,
options
=
{
roomid
=
"
/
"
+
roomid
+
"
/
"
;
type
:
type
,
roomid
:
"
/
"
+
roomid
+
"
/
"
,
initiator
:
true
,
to
:
'
master
'
};
return
g
.
notifySubmitting
()
return
g
.
notifySubmitting
()
.
push
(
function
()
{
.
push
(
function
()
{
return
declareSubGadget
(
context
,
"
gadget_webrtc_jio_bridge.html
"
)
return
context
.
getDeclaredGadget
(
"
gadget_webrtc_jio_bridge.html
"
)
})
})
.
push
(
function
(
gadget
)
{
.
push
(
function
(
gadget
)
{
context
.
state_parameter_dict
.
uu
id
=
UUID
();
options
.
peer
id
=
UUID
();
context
.
state_parameter_dict
.
message_count
=
0
;
context
.
state_parameter_dict
.
message_count
=
0
;
context
.
state_parameter_dict
.
message_dict
=
{};
context
.
state_parameter_dict
.
message_dict
=
{};
rtc_gadget
=
gadget
;
rtc_gadget
=
gadget
;
// register peer
if
(
config
)
{
if
(
config
)
{
config
=
JSON
.
parse
(
config
)
config
=
JSON
.
parse
(
config
)
options
.
config
=
config
;
}
}
return
rtc_gadget
.
register
(
roomid
,
context
.
state_parameter_dict
.
uuid
,
config
);
})
.
push
(
function
(
peers
){
var
options
=
{
roomid
:
roomid
,
peerid
:
context
.
state_parameter_dict
.
uuid
,
initiator
:
true
,
to
:
'
master
'
}
return
rtc_gadget
.
connect
(
options
);
return
rtc_gadget
.
connect
(
options
);
})
})
.
push
(
null
,
function
(
error
){
.
push
(
null
,
function
(
error
){
...
...
bt5/erp5_officejs/PathTemplateItem/web_page_module/gadget_officejs_page_share_text_js.xml
View file @
f1caf11c
...
@@ -242,7 +242,7 @@
...
@@ -242,7 +242,7 @@
</item>
</item>
<item>
<item>
<key>
<string>
serial
</string>
</key>
<key>
<string>
serial
</string>
</key>
<value>
<string>
95
3.29508.22380.3764
9
</string>
</value>
<value>
<string>
95
4.5733.26518.2798
9
</string>
</value>
</item>
</item>
<item>
<item>
<key>
<string>
state
</string>
</key>
<key>
<string>
state
</string>
</key>
...
@@ -260,7 +260,7 @@
...
@@ -260,7 +260,7 @@
</tuple>
</tuple>
<state>
<state>
<tuple>
<tuple>
<float>
147
2047040.89
</float>
<float>
147
4552757.01
</float>
<string>
UTC
</string>
<string>
UTC
</string>
</tuple>
</tuple>
</state>
</state>
...
...
bt5/erp5_officejs/PathTemplateItem/web_page_module/gadget_officejs_page_share_webrtc_jio_html.html
View file @
f1caf11c
...
@@ -23,10 +23,8 @@
...
@@ -23,10 +23,8 @@
<div
class=
"ui-block-c"
></div>
<div
class=
"ui-block-c"
></div>
</div>
</div>
<div
class=
"gadget_websocket"
>
<div
data-gadget-url=
"gadget_webrtc_jio_bridge.html"
<div
data-gadget-url=
"gadget_websocket.html"
data-gadget-scope=
"gadget_websocket.html"
>
data-gadget-scope=
"gadget_webrtc_jio_bridge.html"
</div>
data-gadget-sandbox=
"public"
></div>
</div>
<div
class=
"gadget_webrtc_datachannel"
></div>
</body>
</body>
</html>
</html>
bt5/erp5_officejs/PathTemplateItem/web_page_module/gadget_officejs_page_share_webrtc_jio_html.xml
View file @
f1caf11c
...
@@ -236,7 +236,7 @@
...
@@ -236,7 +236,7 @@
</item>
</item>
<item>
<item>
<key>
<string>
actor
</string>
</key>
<key>
<string>
actor
</string>
</key>
<value>
<string>
romain
</string>
</value>
<value>
<string>
zope
</string>
</value>
</item>
</item>
<item>
<item>
<key>
<string>
comment
</string>
</key>
<key>
<string>
comment
</string>
</key>
...
@@ -250,7 +250,7 @@
...
@@ -250,7 +250,7 @@
</item>
</item>
<item>
<item>
<key>
<string>
serial
</string>
</key>
<key>
<string>
serial
</string>
</key>
<value>
<string>
9
45.33680.60468.51660
</string>
</value>
<value>
<string>
9
53.42397.2191.24098
</string>
</value>
</item>
</item>
<item>
<item>
<key>
<string>
state
</string>
</key>
<key>
<string>
state
</string>
</key>
...
@@ -268,8 +268,8 @@
...
@@ -268,8 +268,8 @@
</tuple>
</tuple>
<state>
<state>
<tuple>
<tuple>
<float>
14
41358472.38
</float>
<float>
14
74364886.77
</float>
<string>
GMT
</string>
<string>
UTC
</string>
</tuple>
</tuple>
</state>
</state>
</object>
</object>
...
...
bt5/erp5_officejs/PathTemplateItem/web_page_module/gadget_officejs_page_share_webrtc_jio_js.js
View file @
f1caf11c
...
@@ -17,14 +17,29 @@
...
@@ -17,14 +17,29 @@
});
});
}
}
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
)
{
function
getWebRTCScopeList
(
gadget
)
{
var
result_list
=
[],
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
,
.
childNodes
,
i
;
i
;
for
(
i
=
0
;
i
<
element_list
.
length
;
i
+=
1
)
{
for
(
i
=
0
;
i
<
element_list
.
length
;
i
+=
1
)
{
if
(
element_list
[
i
].
getAttribute
)
{
result_list
.
push
(
element_list
[
i
].
getAttribute
(
"
data-gadget-scope
"
));
result_list
.
push
(
element_list
[
i
].
getAttribute
(
"
data-gadget-scope
"
));
}
}
}
return
result_list
;
return
result_list
;
}
}
...
@@ -40,7 +55,7 @@
...
@@ -40,7 +55,7 @@
}
}
function
sendWebRTC
(
gadget
,
rtc_gadget
,
scope
,
message
)
{
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
)
{
.
push
(
undefined
,
function
(
error
)
{
if
((
error
instanceof
DOMException
)
&&
(
error
.
name
===
'
InvalidStateError
'
))
{
if
((
error
instanceof
DOMException
)
&&
(
error
.
name
===
'
InvalidStateError
'
))
{
return
dropSubGadget
(
gadget
,
scope
)
return
dropSubGadget
(
gadget
,
scope
)
...
@@ -114,44 +129,22 @@
...
@@ -114,44 +129,22 @@
}));
}));
});
});
})
})
/*
.allowPublicAcquisition("notifyWebSocketClosed", function () {
.
declareMethod
(
"
onOffer
"
,
function
(
options
,
offer
)
{
if (this.state_parameter_dict.user_type !== "user") {
var
gadget
=
this
;
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
;
gadget
.
state_parameter_dict
.
counter
+=
1
;
socket_gadget
=
gg
;
return
new
RSVP
.
Queue
()
var
new_element
=
document
.
createElement
(
"
div
"
);
.
push
(
function
(
response
)
{
gadget
.
state_parameter_dict
.
element
.
querySelector
(
"
.gadget_webrtc_datachannel
"
).
appendChild
(
new_element
);
gadget
.
connecting
=
true
;
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
// 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})
/
,
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_list
=
[],
ip_dict
=
{},
ip_dict
=
{},
ip_addr
,
ip_addr
,
line_list
=
JSON
.
parse
(
json
.
data
).
sdp
.
split
(
'
\n
'
),
line_list
=
JSON
.
parse
(
offer
.
data
).
sdp
.
split
(
'
\n
'
),
i
;
i
;
for
(
i
=
0
;
i
<
line_list
.
length
;
i
+=
1
)
{
for
(
i
=
0
;
i
<
line_list
.
length
;
i
+=
1
)
{
if
(
line_list
[
i
].
indexOf
(
'
a=candidate:
'
)
===
0
)
{
if
(
line_list
[
i
].
indexOf
(
'
a=candidate:
'
)
===
0
)
{
ip_addr
=
ip_regex
.
exec
(
line_list
[
i
])[
1
];
ip_addr
=
ip_regex
.
exec
(
line_list
[
i
])[
1
];
...
@@ -164,46 +157,42 @@
...
@@ -164,46 +157,42 @@
}
}
}
}
}
}
gadget
.
state_parameter_dict
.
scope_ip
[
scope
]
=
ip_list
;
return
rtc_gadget
.
createAnswer
(
json
.
from
,
json
.
data
);
gadget
.
state_parameter_dict
.
scope_ip
[
"
webrtc
"
+
gadget
.
state_parameter_dict
.
counter
]
=
ip_list
})
options
.
to
=
offer
.
from
;
.
push
(
function
(
local_connection
)
{
return
;
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
()
]);
})
})
.
declareMethod
(
'
postConnection
'
,
function
(
options
,
offer
)
{
var
gadget
=
this
;
return
new
RSVP
.
Queue
()
.
push
(
function
()
{
.
push
(
function
()
{
gadget
.
state_parameter_dict
.
connecting
=
false
;
gadget
.
state_parameter_dict
.
connecting
=
false
;
return
updateInfo
(
gadget
);
return
updateInfo
(
gadget
);
});
});
}
})
})
.
declareService
(
function
()
{
.
declareMethod
(
'
initiate
'
,
function
(
roomid
)
{
var
sgadget
,
var
gadget
=
this
,
gadget
=
this
;
options
=
{
return
this
.
getDeclaredGadget
(
'
gadget_websocket.html
'
)
peerid
:
"
master
"
,
.
push
(
function
(
socket_gadget
)
{
roomid
:
"
/
"
+
roomid
+
"
/
"
,
sgadget
=
socket_gadget
;
type
:
"
websocket
"
,
return
socket_gadget
.
createSocket
(
"
ws://127.0.0.1:9999/
"
);
config
:
{
'
url
'
:
"
ws://127.0.0.1:9999/
"
},
})
listner
:
true
,
.
push
(
function
()
{
preConnection
:
gadget
.
onOffer
.
bind
(
gadget
),
// Wait for the gadget to be dropped from the page
postConnection
:
gadget
.
postConnection
.
bind
(
gadget
),
// and close the socket/rtc connections
};
return
RSVP
.
defer
().
promise
;
})
return
gadget
.
getDeclaredGadget
(
"
gadget_webrtc_jio_bridge.html
"
)
.
push
(
undefined
,
function
(
error
)
{
.
push
(
function
(
rtc_gadget
)
{
options
.
rtc_gadget
=
rtc_gadget
;
return
rtc_gadget
.
connect
(
options
);
});
/*.push(undefined, function (error) {
if (sgadget === undefined) {
if (sgadget === undefined) {
return;
return;
}
}
...
@@ -228,7 +217,7 @@
...
@@ -228,7 +217,7 @@
.push(function () {
.push(function () {
throw error;
throw error;
});
});
});
});
*/
});
});
}(
window
,
rJS
,
document
,
RSVP
,
console
,
DOMException
));
}(
window
,
rJS
,
document
,
RSVP
,
console
,
DOMException
));
\ No newline at end of file
bt5/erp5_officejs/PathTemplateItem/web_page_module/gadget_officejs_page_share_webrtc_jio_js.xml
View file @
f1caf11c
...
@@ -228,7 +228,7 @@
...
@@ -228,7 +228,7 @@
</item>
</item>
<item>
<item>
<key>
<string>
actor
</string>
</key>
<key>
<string>
actor
</string>
</key>
<value>
<string>
romain
</string>
</value>
<value>
<string>
zope
</string>
</value>
</item>
</item>
<item>
<item>
<key>
<string>
comment
</string>
</key>
<key>
<string>
comment
</string>
</key>
...
@@ -242,7 +242,7 @@
...
@@ -242,7 +242,7 @@
</item>
</item>
<item>
<item>
<key>
<string>
serial
</string>
</key>
<key>
<string>
serial
</string>
</key>
<value>
<string>
9
45.33680.49983.21452
</string>
</value>
<value>
<string>
9
54.5724.21109.37529
</string>
</value>
</item>
</item>
<item>
<item>
<key>
<string>
state
</string>
</key>
<key>
<string>
state
</string>
</key>
...
@@ -260,8 +260,8 @@
...
@@ -260,8 +260,8 @@
</tuple>
</tuple>
<state>
<state>
<tuple>
<tuple>
<float>
14
41358513.14
</float>
<float>
14
74552150.73
</float>
<string>
GMT
</string>
<string>
UTC
</string>
</tuple>
</tuple>
</state>
</state>
</object>
</object>
...
...
bt5/erp5_officejs/PathTemplateItem/web_page_module/gadget_officejs_page_webrtc_viewer_html.xml
View file @
f1caf11c
...
@@ -271,7 +271,7 @@
...
@@ -271,7 +271,7 @@
</item>
</item>
<item>
<item>
<key>
<string>
serial
</string>
</key>
<key>
<string>
serial
</string>
</key>
<value>
<string>
953.
35402.46528.58316
</string>
</value>
<value>
<string>
953.
57025.36062.60552
</string>
</value>
</item>
</item>
<item>
<item>
<key>
<string>
state
</string>
</key>
<key>
<string>
state
</string>
</key>
...
@@ -289,7 +289,7 @@
...
@@ -289,7 +289,7 @@
</tuple>
</tuple>
<state>
<state>
<tuple>
<tuple>
<float>
147
2400667.43
</float>
<float>
147
3698013.89
</float>
<string>
UTC
</string>
<string>
UTC
</string>
</tuple>
</tuple>
</state>
</state>
...
...
bt5/erp5_officejs/PathTemplateItem/web_page_module/gadget_officejs_page_webrtc_viewer_js.js
View file @
f1caf11c
...
@@ -88,7 +88,7 @@
...
@@ -88,7 +88,7 @@
})
})
.
push
(
function
(
g
){
.
push
(
function
(
g
){
if
(
gadget
.
props
.
options
[
'
config
'
])
{
if
(
gadget
.
props
.
options
[
'
config
'
])
{
return
g
.
slaveInitiate
(
room
,
gadget
,
gadget
.
props
.
options
[
'
config
'
]);
return
g
.
slaveInitiate
(
room
,
gadget
,
gadget
.
props
.
options
[
'
type
'
],
gadget
.
props
.
options
[
'
config
'
]);
}
else
{
}
else
{
return
g
.
slaveInitiate
(
room
,
gadget
)
return
g
.
slaveInitiate
(
room
,
gadget
)
.
push
(
null
,
function
(
error
){
.
push
(
null
,
function
(
error
){
...
...
bt5/erp5_officejs/PathTemplateItem/web_page_module/gadget_officejs_page_webrtc_viewer_js.xml
View file @
f1caf11c
...
@@ -267,7 +267,7 @@
...
@@ -267,7 +267,7 @@
</item>
</item>
<item>
<item>
<key>
<string>
serial
</string>
</key>
<key>
<string>
serial
</string>
</key>
<value>
<string>
95
3.38233.8749.16844
</string>
</value>
<value>
<string>
95
4.5557.49354.23227
</string>
</value>
</item>
</item>
<item>
<item>
<key>
<string>
state
</string>
</key>
<key>
<string>
state
</string>
</key>
...
@@ -285,7 +285,7 @@
...
@@ -285,7 +285,7 @@
</tuple>
</tuple>
<state>
<state>
<tuple>
<tuple>
<float>
147
2570633.51
</float>
<float>
147
4542105.73
</float>
<string>
UTC
</string>
<string>
UTC
</string>
</tuple>
</tuple>
</state>
</state>
...
...
bt5/erp5_officejs/PathTemplateItem/web_page_module/gadget_officejs_webrtc_jio_html.html
View file @
f1caf11c
...
@@ -17,8 +17,8 @@
...
@@ -17,8 +17,8 @@
data-gadget-scope=
"jio_gadget"
data-gadget-scope=
"jio_gadget"
data-gadget-sandbox=
"public"
></div>
data-gadget-sandbox=
"public"
></div>
<div
class=
"gadget_websocket"
></div>
<div
data-gadget-url=
"gadget_webrtc_jio_bridge.html"
<div
class=
"gadget_webrtc_datachannel"
></div>
data-gadget-scope=
"gadget_webrtc_jio_bridge.html"
data-gadget-sandbox=
"public"
></div>
</body>
</body>
</html>
</html>
\ No newline at end of file
bt5/erp5_officejs/PathTemplateItem/web_page_module/gadget_officejs_webrtc_jio_html.xml
View file @
f1caf11c
...
@@ -218,7 +218,7 @@
...
@@ -218,7 +218,7 @@
</item>
</item>
<item>
<item>
<key>
<string>
actor
</string>
</key>
<key>
<string>
actor
</string>
</key>
<value>
<string>
romain
</string>
</value>
<value>
<string>
zope
</string>
</value>
</item>
</item>
<item>
<item>
<key>
<string>
comment
</string>
</key>
<key>
<string>
comment
</string>
</key>
...
@@ -232,7 +232,7 @@
...
@@ -232,7 +232,7 @@
</item>
</item>
<item>
<item>
<key>
<string>
serial
</string>
</key>
<key>
<string>
serial
</string>
</key>
<value>
<string>
9
45.32246.38846.3814
4
</string>
</value>
<value>
<string>
9
54.2812.41384.4698
4
</string>
</value>
</item>
</item>
<item>
<item>
<key>
<string>
state
</string>
</key>
<key>
<string>
state
</string>
</key>
...
@@ -250,8 +250,8 @@
...
@@ -250,8 +250,8 @@
</tuple>
</tuple>
<state>
<state>
<tuple>
<tuple>
<float>
14
41283008.98
</float>
<float>
14
74377398.17
</float>
<string>
GMT
</string>
<string>
UTC
</string>
</tuple>
</tuple>
</state>
</state>
</object>
</object>
...
...
bt5/erp5_officejs/PathTemplateItem/web_page_module/gadget_officejs_webrtc_jio_js.js
View file @
f1caf11c
...
@@ -4,7 +4,7 @@
...
@@ -4,7 +4,7 @@
"
use strict
"
;
"
use strict
"
;
var
timeout
=
60000
,
var
timeout
=
60000
,
websocket_timeout
=
5000
;
websocket_timeout
=
5000
00
;
function
S4
()
{
function
S4
()
{
return
(
'
0000
'
+
Math
.
floor
(
return
(
'
0000
'
+
Math
.
floor
(
...
@@ -24,7 +24,7 @@
...
@@ -24,7 +24,7 @@
if
(
!
gadget
.
state_parameter_dict
.
jio_created
)
{
if
(
!
gadget
.
state_parameter_dict
.
jio_created
)
{
return
gadget
.
redirect
({
page
:
'
setting
'
});
return
gadget
.
redirect
({
page
:
'
setting
'
});
}
}
return
gadget
.
getDeclaredGadget
(
'
gadget_webrtc_datachannel.html
'
)
return
gadget
.
getDeclaredGadget
(
"
gadget_webrtc_jio_bridge.html
"
)
.
push
(
function
(
rtc_gadget
)
{
.
push
(
function
(
rtc_gadget
)
{
gadget
.
state_parameter_dict
.
message_count
+=
1
;
gadget
.
state_parameter_dict
.
message_count
+=
1
;
gadget
.
state_parameter_dict
.
message_dict
[
gadget
.
state_parameter_dict
.
message_count
]
=
RSVP
.
defer
();
gadget
.
state_parameter_dict
.
message_dict
[
gadget
.
state_parameter_dict
.
message_count
]
=
RSVP
.
defer
();
...
@@ -34,7 +34,7 @@
...
@@ -34,7 +34,7 @@
type
:
"
jio_query
"
,
type
:
"
jio_query
"
,
method_name
:
method_name
,
method_name
:
method_name
,
argument_list
:
Array
.
prototype
.
slice
.
call
(
argument_list
)
argument_list
:
Array
.
prototype
.
slice
.
call
(
argument_list
)
})),
})
,
'
webrtc0
'
),
RSVP
.
any
([
RSVP
.
any
([
RSVP
.
timeout
(
timeout
),
RSVP
.
timeout
(
timeout
),
gadget
.
state_parameter_dict
.
message_dict
[
gadget
.
state_parameter_dict
.
message_count
].
promise
gadget
.
state_parameter_dict
.
message_dict
[
gadget
.
state_parameter_dict
.
message_count
].
promise
...
@@ -44,7 +44,6 @@
...
@@ -44,7 +44,6 @@
.
push
(
function
(
result_list
)
{
.
push
(
function
(
result_list
)
{
return
result_list
[
1
];
return
result_list
[
1
];
});
});
}
}
function
declareSubGadget
(
gadget
,
url
)
{
function
declareSubGadget
(
gadget
,
url
)
{
...
@@ -105,17 +104,20 @@
...
@@ -105,17 +104,20 @@
.
declareMethod
(
'
createJio
'
,
function
(
options
)
{
.
declareMethod
(
'
createJio
'
,
function
(
options
)
{
var
context
=
this
,
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
))
{
//if ((options === undefined) || (options.socket_url === undefined)) {
return
context
.
redirect
({
page
:
'
setting
'
});
// 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
.
jio_created
=
true
;
context
.
state_parameter_dict
.
uuid
=
UUID
();
context
.
state_parameter_dict
.
uuid
=
UUID
();
context
.
state_parameter_dict
.
answer_defer
=
RSVP
.
defer
();
context
.
state_parameter_dict
.
answer_defer
=
RSVP
.
defer
();
context
.
state_parameter_dict
.
message_count
=
0
;
context
.
state_parameter_dict
.
message_count
=
0
;
...
@@ -127,36 +129,16 @@
...
@@ -127,36 +129,16 @@
return
RSVP
.
timeout
(
websocket_timeout
);
return
RSVP
.
timeout
(
websocket_timeout
);
})
})
.
push
(
undefined
,
function
()
{
.
push
(
undefined
,
function
()
{
return
context
.
redirect
({
page
:
'
setting
'
});
//
return context.redirect({page: 'setting'});
// throw new Error("No remote WebRTC connection available");
// throw new Error("No remote WebRTC connection available");
}),
}),
declareSubGadget
(
context
,
'
gadget_websocket.html
'
)
context
.
getDeclaredGadget
(
"
gadget_webrtc_jio_bridge.html
"
)
.
push
(
function
(
gadget
)
{
.
push
(
function
(
rtc_gadget
)
{
socket_gadget
=
gadget
;
rtc_options
.
peerid
=
context
.
state_parameter_dict
.
uuid
;
// XXX Drop hardcoded URL
return
socket_gadget
.
createSocket
(
options
.
socket_url
);
return
rtc_gadget
.
connect
(
rtc_options
);
})
.
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
();
})
})
]);
]);
});
})
})
.
declareMethod
(
'
allDocs
'
,
function
()
{
.
declareMethod
(
'
allDocs
'
,
function
()
{
return
wrapJioAccess
(
this
,
'
allDocs
'
,
arguments
);
return
wrapJioAccess
(
this
,
'
allDocs
'
,
arguments
);
...
...
bt5/erp5_officejs/PathTemplateItem/web_page_module/gadget_officejs_webrtc_jio_js.xml
View file @
f1caf11c
...
@@ -216,7 +216,7 @@
...
@@ -216,7 +216,7 @@
</item>
</item>
<item>
<item>
<key>
<string>
actor
</string>
</key>
<key>
<string>
actor
</string>
</key>
<value>
<string>
romain
</string>
</value>
<value>
<string>
zope
</string>
</value>
</item>
</item>
<item>
<item>
<key>
<string>
comment
</string>
</key>
<key>
<string>
comment
</string>
</key>
...
@@ -230,7 +230,7 @@
...
@@ -230,7 +230,7 @@
</item>
</item>
<item>
<item>
<key>
<string>
serial
</string>
</key>
<key>
<string>
serial
</string>
</key>
<value>
<string>
9
45.39449.60302.38024
</string>
</value>
<value>
<string>
9
54.5720.33596.8260
</string>
</value>
</item>
</item>
<item>
<item>
<key>
<string>
state
</string>
</key>
<key>
<string>
state
</string>
</key>
...
@@ -248,8 +248,8 @@
...
@@ -248,8 +248,8 @@
</tuple>
</tuple>
<state>
<state>
<tuple>
<tuple>
<float>
14
41715721.23
</float>
<float>
14
74551874.29
</float>
<string>
GMT
</string>
<string>
UTC
</string>
</tuple>
</tuple>
</state>
</state>
</object>
</object>
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment