-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathmoxtra.html
178 lines (169 loc) · 7.9 KB
/
moxtra.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8" />
<!-- Include Moxtra JavaScript Library -->
<script src="js/jquery-2.1.4.min.js"></script>
<script type="text/javascript" src="https://www.moxtra.com/api/js/moxtra-latest.js" id="moxtrajs" data-client-id="jVvRPHlk5nQ"></script>
<!-- Authenticate/Initialize and get the "Access Token" for the user -->
<!-- Refer to the doc at https://developer.moxtra.com/docs/docs-oauth/#uniqueid to authenticate user based on UniqueID Method -->
<!-- For other authentication methods and overview refer to the doc at https://developer.moxtra.com/docs/docs-authentication/ -->
<!-- In this example user is authenticated and access token is passed as a URL parameter -->
<!-- JS function to get access token from the URL parameter -->
<script type="text/javascript" >
function getAccessToken(unique_id) {
var timestamp = new Date().getTime();
$.ajax({
type: 'POST',
url: 'https://apisandbox.moxtra.com/oauth/token',
data: 'client_id=jVvRPHlk5nQ&client_secret=h4HCfKL9mqc&grant_type=http://www.moxtra.com/auth_uniqueid&uniqueid='+unique_id+'×tamp='+timestamp+'&firstname=John&lastname=Doe',
contentType: 'application/x-www-form-urlencoded',
success: function(data){
response = JSON.stringify(data);
var obj = JSON.parse(response);
var access_t = (obj.access_token);
console.log(access_t);
// console.log(response);
return access_t;
}
});
}
access_token=getAccessToken('u001');//'4zMgAAAVCaymINAACowFViYlplVE52OWZURjJlZDZick51dGYzIAAAAANUdHNDeWFmTmxuUERxOTVEZUxSV1BSQmpWdlJQSGxrNW5R';//getAccessToken("u001");
console.log(access_token);
if (access_token) {
// Initialize Moxtra SDK Object
var options = {
mode: "production",
client_id: "jVvRPHlk5nQ", //
access_token: access_token,
invalid_token: function(event) {
//Triggered when the access token is expired or invalid
alert("Access Token expired for session id: " + event.session_id);
}
};
Moxtra.init(options);
}
else {
//Authenticate and get access token for the user before proceeding further
console.log ("No access token found");
}
</script>
<!-- Start Chat Function -->
<script type="text/javascript">
function start_chat () {
var chat_options = {
//unique id of the users who will be part of the chat. These users should already exist in Moxtra.
//unique_id: "unique_user_id_2,unique_user_id_3",
iframe: true,
//ID of the HTML tag within which the chat window will show up. Refer https://developer.grouphour.com/moxo/docs-js-sdk/#conversation
tagid4iframe: "chat-container",
iframewidth: "1000px",
iframeheight: "750px",
//autostart_meet: true,
//autostart_note: true,
extension: { "show_dialogs": { "member_invite": true } },
start_chat: function(event) {
console.log("Chat started binder ID: " + event.binder_id);
//Your application server can upload files to draw using the binder_id and access_token
},
start_meet: function(event) {
console.log("Meet started session key: " + event.session_key + " session id: " + event.session_id);
},
end_meet: function(event) {
console.log("Meet end event");
},
invite_member: function(event) {
console.log("Invite member into binder Id: " + event.binder_id);
},
request_note: function(event) {
console.log("Note start request");
},
error: function(event) {
console.log("Chat error code: " + event.error_code + " error message: " + event.error_message);
}
};
Moxtra.chat(chat_options);
}
<<<<<<< HEAD
function start_timeline(){
var options = {
iframe: true,
tagid4iframe: "timeline",
iframewidth: "350px",
iframeheight: "650px",
start_timeline: function(event) {
alert("TimelineView started session Id: " + event.session_id);
},
request_view_binder: function(event) {
alert("Request to view binder Id " + event.binder_id);
},
error: function(event) {
alert("TimelineView error code: " + event.error_code + " error message: " + event.error_message);
}
};
Moxtra.timelineView(options);
//start_timeline();
}
//start_timeline();
=======
<<<<<<< HEAD
function start_timeline(){
var options = {
binder_id: binderid.value,
iframe: true,
tagid4iframe: "container",
iframewidth: "920px",
iframeheight: "650px",
autostart_meet: true,
autostart_note: true,
extension: { "show_dialogs": { "meet_invite": true } },
start_timeline: function(event) {
alert("Timeline started session Id: " + event.session_id + " binder id: " + event.binder_id);
},
view_binder: function(event) {
alert("Binder switched session Id: " + event.session_id + " binder id: " + event.binder_id);
},
invite_member: function(event) {
alert("Invite member into binder Id: " + event.binder_id);
},
start_meet: function(event) {
alert("Meet started session key: " + event.session_key + " session id: " + event.session_id);
},
end_meet: function(event) {
alert("Meet end event");
},
save_meet: function(event) {
alert("Meet saved on binder: " + event.binder_id);
},
start_note: function(event) {
alert("session key: " + event.session_key + " session id: " + event.session_id);
},
save_note: function(event) {
alert("Note saved on binder: " + event.destination_binder_id);
},
cancel_note: function(event) {
alert("Note cancelled");
},
error: function(event) {
alert("Timeline error code: " + event.error_code + " error message: " + event.error_message);
}
};
Moxtra.timeline(options);
}
</script>
=======
>>>>>>> 57e819c3943e1631a8108b3fa112b291efd59069
</script>
>>>>>>> 537f52593dd45914b5bfc1c15c9a3ae14e487932
</head>
<body>
<h3><a id="getToken" href="javascript:start_timeline();">timeline</a></h3>
<div id="timeline"></div>
<div id="chat-container"></div>
<<<<<<< HEAD
<h3><a id="getToken" href="javascript:start_timeline();">Timeline</a></h3>
<div id="container"></div>
=======
>>>>>>> 537f52593dd45914b5bfc1c15c9a3ae14e487932
</body>
</html>