|
|
@@ -1,9 +1,6 @@
|
|
1
|
1
|
/* global APP, $, config, interfaceConfig */
|
|
2
|
2
|
/* jshint -W101 */
|
|
3
|
3
|
var messageHandler = require("../util/MessageHandler");
|
|
4
|
|
-var BottomToolbar = require("./BottomToolbar");
|
|
5
|
|
-var PanelToggler = require("../side_pannels/SidePanelToggler");
|
|
6
|
|
-var Authentication = require("../authentication/Authentication");
|
|
7
|
4
|
var UIUtil = require("../util/UIUtil");
|
|
8
|
5
|
var AnalyticsAdapter = require("../../statistics/AnalyticsAdapter");
|
|
9
|
6
|
var Feedback = require("../Feedback");
|
|
|
@@ -13,7 +10,86 @@ var roomUrl = null;
|
|
13
|
10
|
var recordingToaster = null;
|
|
14
|
11
|
var emitter = null;
|
|
15
|
12
|
|
|
16
|
|
-var buttonHandlers = {
|
|
|
13
|
+
|
|
|
14
|
+/**
|
|
|
15
|
+ * Opens the invite link dialog.
|
|
|
16
|
+ */
|
|
|
17
|
+function openLinkDialog () {
|
|
|
18
|
+ var inviteAttributes;
|
|
|
19
|
+
|
|
|
20
|
+ if (roomUrl === null) {
|
|
|
21
|
+ inviteAttributes = 'data-i18n="[value]roomUrlDefaultMsg" value="' +
|
|
|
22
|
+ APP.translation.translateString("roomUrlDefaultMsg") + '"';
|
|
|
23
|
+ } else {
|
|
|
24
|
+ inviteAttributes = "value=\"" + encodeURI(roomUrl) + "\"";
|
|
|
25
|
+ }
|
|
|
26
|
+ messageHandler.openTwoButtonDialog(
|
|
|
27
|
+ "dialog.shareLink", null, null,
|
|
|
28
|
+ `<input id="inviteLinkRef" type="text" ${inviteAttributes} onclick="this.select();" readonly>`,
|
|
|
29
|
+ false, "dialog.Invite",
|
|
|
30
|
+ function (e, v) {
|
|
|
31
|
+ if (v && roomUrl) {
|
|
|
32
|
+ emitter.emit(UIEvents.USER_INVITED, roomUrl);
|
|
|
33
|
+ }
|
|
|
34
|
+ },
|
|
|
35
|
+ function (event) {
|
|
|
36
|
+ if (roomUrl) {
|
|
|
37
|
+ document.getElementById('inviteLinkRef').select();
|
|
|
38
|
+ } else {
|
|
|
39
|
+ if (event && event.target) {
|
|
|
40
|
+ $(event.target).find('button[value=true]').prop('disabled', true);
|
|
|
41
|
+ }
|
|
|
42
|
+ }
|
|
|
43
|
+ }
|
|
|
44
|
+ );
|
|
|
45
|
+}
|
|
|
46
|
+
|
|
|
47
|
+// Sets the state of the recording button
|
|
|
48
|
+function setRecordingButtonState (recordingState) {
|
|
|
49
|
+ let selector = $('#toolbar_button_record');
|
|
|
50
|
+
|
|
|
51
|
+ if (recordingState === 'on') {
|
|
|
52
|
+ selector.removeClass("icon-recEnable");
|
|
|
53
|
+ selector.addClass("icon-recEnable active");
|
|
|
54
|
+
|
|
|
55
|
+ $("#largeVideo").toggleClass("videoMessageFilter", true);
|
|
|
56
|
+ let recordOnKey = "recording.on";
|
|
|
57
|
+ $('#videoConnectionMessage').attr("data-i18n", recordOnKey);
|
|
|
58
|
+ $('#videoConnectionMessage').text(APP.translation.translateString(recordOnKey));
|
|
|
59
|
+
|
|
|
60
|
+ setTimeout(function(){
|
|
|
61
|
+ $("#largeVideo").toggleClass("videoMessageFilter", false);
|
|
|
62
|
+ $('#videoConnectionMessage').css({display: "none"});
|
|
|
63
|
+ }, 1500);
|
|
|
64
|
+
|
|
|
65
|
+ recordingToaster = messageHandler.notify(
|
|
|
66
|
+ null, "recording.toaster", null,
|
|
|
67
|
+ null, null,
|
|
|
68
|
+ {timeOut: 0, closeButton: null, tapToDismiss: false}
|
|
|
69
|
+ );
|
|
|
70
|
+ } else if (recordingState === 'off') {
|
|
|
71
|
+ selector.removeClass("icon-recEnable active");
|
|
|
72
|
+ selector.addClass("icon-recEnable");
|
|
|
73
|
+
|
|
|
74
|
+ $("#largeVideo").toggleClass("videoMessageFilter", false);
|
|
|
75
|
+ $('#videoConnectionMessage').css({display: "none"});
|
|
|
76
|
+
|
|
|
77
|
+ if (recordingToaster) {
|
|
|
78
|
+ messageHandler.remove(recordingToaster);
|
|
|
79
|
+ }
|
|
|
80
|
+ } else if (recordingState === 'pending') {
|
|
|
81
|
+ selector.removeClass("icon-recEnable active");
|
|
|
82
|
+ selector.addClass("icon-recEnable");
|
|
|
83
|
+
|
|
|
84
|
+ $("#largeVideo").toggleClass("videoMessageFilter", true);
|
|
|
85
|
+ let recordPendingKey = "recording.pending";
|
|
|
86
|
+ $('#videoConnectionMessage').attr("data-i18n", recordPendingKey);
|
|
|
87
|
+ $('#videoConnectionMessage').text(APP.translation.translateString(recordPendingKey));
|
|
|
88
|
+ $('#videoConnectionMessage').css({display: "block"});
|
|
|
89
|
+ }
|
|
|
90
|
+}
|
|
|
91
|
+
|
|
|
92
|
+const buttonHandlers = {
|
|
17
|
93
|
"toolbar_button_mute": function () {
|
|
18
|
94
|
if (APP.conference.audioMuted) {
|
|
19
|
95
|
AnalyticsAdapter.sendEvent('toolbar.audio.unmuted');
|
|
|
@@ -34,18 +110,18 @@ var buttonHandlers = {
|
|
34
|
110
|
},
|
|
35
|
111
|
"toolbar_button_record": function () {
|
|
36
|
112
|
AnalyticsAdapter.sendEvent('toolbar.recording.toggled');
|
|
37
|
|
- return toggleRecording();
|
|
|
113
|
+ toggleRecording();
|
|
38
|
114
|
},
|
|
39
|
115
|
"toolbar_button_security": function () {
|
|
40
|
116
|
emitter.emit(UIEvents.ROOM_LOCK_CLICKED);
|
|
41
|
117
|
},
|
|
42
|
118
|
"toolbar_button_link": function () {
|
|
43
|
119
|
AnalyticsAdapter.sendEvent('toolbar.invite.clicked');
|
|
44
|
|
- return Toolbar.openLinkDialog();
|
|
|
120
|
+ openLinkDialog();
|
|
45
|
121
|
},
|
|
46
|
122
|
"toolbar_button_chat": function () {
|
|
47
|
123
|
AnalyticsAdapter.sendEvent('toolbar.chat.toggled');
|
|
48
|
|
- return BottomToolbar.toggleChat();
|
|
|
124
|
+ emitter.emit(UIEvents.TOGGLE_CHAT);
|
|
49
|
125
|
},
|
|
50
|
126
|
"toolbar_button_prezi": function () {
|
|
51
|
127
|
AnalyticsAdapter.sendEvent('toolbar.prezi.clicked');
|
|
|
@@ -61,32 +137,32 @@ var buttonHandlers = {
|
|
61
|
137
|
} else {
|
|
62
|
138
|
AnalyticsAdapter.sendEvent('toolbar.screen.enabled');
|
|
63
|
139
|
}
|
|
64
|
|
- return APP.desktopsharing.toggleScreenSharing();
|
|
|
140
|
+ APP.desktopsharing.toggleScreenSharing();
|
|
65
|
141
|
},
|
|
66
|
142
|
"toolbar_button_fullScreen": function() {
|
|
67
|
143
|
AnalyticsAdapter.sendEvent('toolbar.fullscreen.enabled');
|
|
68
|
144
|
UIUtil.buttonClick("#toolbar_button_fullScreen", "icon-full-screen icon-exit-full-screen");
|
|
69
|
|
- return Toolbar.toggleFullScreen();
|
|
|
145
|
+ emitter.emit(UIEvents.FULLSCREEN_TOGGLE);
|
|
70
|
146
|
},
|
|
71
|
147
|
"toolbar_button_sip": function () {
|
|
72
|
148
|
AnalyticsAdapter.sendEvent('toolbar.sip.clicked');
|
|
73
|
|
- return callSipButtonClicked();
|
|
|
149
|
+ callSipButtonClicked();
|
|
74
|
150
|
},
|
|
75
|
151
|
"toolbar_button_dialpad": function () {
|
|
76
|
152
|
AnalyticsAdapter.sendEvent('toolbar.sip.dialpad.clicked');
|
|
77
|
|
- return dialpadButtonClicked();
|
|
|
153
|
+ dialpadButtonClicked();
|
|
78
|
154
|
},
|
|
79
|
155
|
"toolbar_button_settings": function () {
|
|
80
|
156
|
AnalyticsAdapter.sendEvent('toolbar.settings.toggled');
|
|
81
|
|
- PanelToggler.toggleSettingsMenu();
|
|
|
157
|
+ emitter.emit(UIEvents.TOGGLE_SETTINGS);
|
|
82
|
158
|
},
|
|
83
|
159
|
"toolbar_button_hangup": function () {
|
|
84
|
160
|
AnalyticsAdapter.sendEvent('toolbar.hangup');
|
|
85
|
|
- return hangup();
|
|
|
161
|
+ hangup();
|
|
86
|
162
|
},
|
|
87
|
163
|
"toolbar_button_login": function () {
|
|
88
|
164
|
AnalyticsAdapter.sendEvent('toolbar.authenticate.login.clicked');
|
|
89
|
|
- Toolbar.authenticateClicked();
|
|
|
165
|
+ emitter.emit(UIEvents.AUTH_CLICKED);
|
|
90
|
166
|
},
|
|
91
|
167
|
"toolbar_button_logout": function () {
|
|
92
|
168
|
AnalyticsAdapter.sendEvent('toolbar.authenticate.logout.clicked');
|
|
|
@@ -140,8 +216,7 @@ function hangup() {
|
|
140
|
216
|
}
|
|
141
|
217
|
};
|
|
142
|
218
|
|
|
143
|
|
- if (Feedback.isEnabled())
|
|
144
|
|
- {
|
|
|
219
|
+ if (Feedback.isEnabled()) {
|
|
145
|
220
|
// If the user has already entered feedback, we'll show the window and
|
|
146
|
221
|
// immidiately start the conference dispose timeout.
|
|
147
|
222
|
if (Feedback.feedbackScore > 0) {
|
|
|
@@ -158,7 +233,7 @@ function hangup() {
|
|
158
|
233
|
|
|
159
|
234
|
// If the feedback functionality isn't enabled we show a thank you
|
|
160
|
235
|
// dialog.
|
|
161
|
|
- APP.UI.messageHandler.openMessageDialog(null, null, null,
|
|
|
236
|
+ messageHandler.openMessageDialog(null, null, null,
|
|
162
|
237
|
APP.translation.translateString("dialog.thankYou",
|
|
163
|
238
|
{appName:interfaceConfig.APP_NAME}));
|
|
164
|
239
|
}
|
|
|
@@ -177,7 +252,7 @@ function toggleRecording(predefinedToken) {
|
|
177
|
252
|
var msg = APP.translation.generateTranslationHTML(
|
|
178
|
253
|
"dialog.recordingToken");
|
|
179
|
254
|
var token = APP.translation.translateString("dialog.token");
|
|
180
|
|
- APP.UI.messageHandler.openTwoButtonDialog(null, null, null,
|
|
|
255
|
+ messageHandler.openTwoButtonDialog(null, null, null,
|
|
181
|
256
|
'<h2>' + msg + '</h2>' +
|
|
182
|
257
|
'<input name="recordingToken" type="text" ' +
|
|
183
|
258
|
' data-i18n="[placeholder]dialog.token" ' +
|
|
|
@@ -197,7 +272,7 @@ function toggleRecording(predefinedToken) {
|
|
197
|
272
|
function () { },
|
|
198
|
273
|
':input:first'
|
|
199
|
274
|
);
|
|
200
|
|
- }, Toolbar.setRecordingButtonState);
|
|
|
275
|
+ }, setRecordingButtonState);
|
|
201
|
276
|
}
|
|
202
|
277
|
|
|
203
|
278
|
function dialpadButtonClicked() {
|
|
|
@@ -205,17 +280,16 @@ function dialpadButtonClicked() {
|
|
205
|
280
|
}
|
|
206
|
281
|
|
|
207
|
282
|
function callSipButtonClicked() {
|
|
208
|
|
- var defaultNumber
|
|
209
|
|
- = config.defaultSipNumber ? config.defaultSipNumber : '';
|
|
210
|
|
-
|
|
211
|
|
- var sipMsg = APP.translation.generateTranslationHTML(
|
|
212
|
|
- "dialog.sipMsg");
|
|
213
|
|
- messageHandler.openTwoButtonDialog(null, null, null,
|
|
214
|
|
- '<h2>' + sipMsg + '</h2>' +
|
|
215
|
|
- '<input name="sipNumber" type="text"' +
|
|
216
|
|
- ' value="' + defaultNumber + '" autofocus>',
|
|
217
|
|
- false,
|
|
218
|
|
- "dialog.Dial",
|
|
|
283
|
+ let defaultNumber = config.defaultSipNumber
|
|
|
284
|
+ ? config.defaultSipNumber
|
|
|
285
|
+ : '';
|
|
|
286
|
+
|
|
|
287
|
+ let sipMsg = APP.translation.generateTranslationHTML("dialog.sipMsg");
|
|
|
288
|
+ messageHandler.openTwoButtonDialog(
|
|
|
289
|
+ null, null, null,
|
|
|
290
|
+ `<h2>${sipMsg}</h2>
|
|
|
291
|
+ <input name="sipNumber" type="text" value="${defaultNumber}" autofocus>`,
|
|
|
292
|
+ false, "dialog.Dial",
|
|
219
|
293
|
function (e, v, m, f) {
|
|
220
|
294
|
if (v) {
|
|
221
|
295
|
var numberInput = f.sipNumber;
|
|
|
@@ -228,7 +302,7 @@ function callSipButtonClicked() {
|
|
228
|
302
|
);
|
|
229
|
303
|
}
|
|
230
|
304
|
|
|
231
|
|
-var Toolbar = {
|
|
|
305
|
+const Toolbar = {
|
|
232
|
306
|
init (eventEmitter) {
|
|
233
|
307
|
emitter = eventEmitter;
|
|
234
|
308
|
UIUtil.hideDisabledButtons(defaultToolbarButtons);
|
|
|
@@ -237,37 +311,6 @@ var Toolbar = {
|
|
237
|
311
|
$("#" + k).click(buttonHandlers[k]);
|
|
238
|
312
|
},
|
|
239
|
313
|
|
|
240
|
|
- authenticateClicked () {
|
|
241
|
|
- Authentication.focusAuthenticationWindow();
|
|
242
|
|
- if (!APP.xmpp.isExternalAuthEnabled()) {
|
|
243
|
|
- Authentication.xmppAuthenticate();
|
|
244
|
|
- return;
|
|
245
|
|
- }
|
|
246
|
|
- // Get authentication URL
|
|
247
|
|
- if (!APP.xmpp.isMUCJoined()) {
|
|
248
|
|
- APP.xmpp.getLoginUrl(APP.conference.roomName, function (url) {
|
|
249
|
|
- // If conference has not been started yet - redirect to login page
|
|
250
|
|
- window.location.href = url;
|
|
251
|
|
- });
|
|
252
|
|
- } else {
|
|
253
|
|
- APP.xmpp.getPopupLoginUrl(APP.conference.roomName, function (url) {
|
|
254
|
|
- // Otherwise - open popup with authentication URL
|
|
255
|
|
- var authenticationWindow = Authentication.createAuthenticationWindow(
|
|
256
|
|
- function () {
|
|
257
|
|
- // On popup closed - retry room allocation
|
|
258
|
|
- APP.xmpp.allocateConferenceFocus(
|
|
259
|
|
- APP.conference.roomName,
|
|
260
|
|
- function () { console.info("AUTH DONE"); }
|
|
261
|
|
- );
|
|
262
|
|
- }, url);
|
|
263
|
|
- if (!authenticationWindow) {
|
|
264
|
|
- messageHandler.openMessageDialog(
|
|
265
|
|
- null, "dialog.popupError");
|
|
266
|
|
- }
|
|
267
|
|
- });
|
|
268
|
|
- }
|
|
269
|
|
- },
|
|
270
|
|
-
|
|
271
|
314
|
/**
|
|
272
|
315
|
* Updates the room invite url.
|
|
273
|
316
|
*/
|
|
|
@@ -293,66 +336,6 @@ var Toolbar = {
|
|
293
|
336
|
}
|
|
294
|
337
|
},
|
|
295
|
338
|
|
|
296
|
|
- /**
|
|
297
|
|
- * Opens the invite link dialog.
|
|
298
|
|
- */
|
|
299
|
|
- openLinkDialog () {
|
|
300
|
|
- var inviteAttributes;
|
|
301
|
|
-
|
|
302
|
|
- if (roomUrl === null) {
|
|
303
|
|
- inviteAttributes = 'data-i18n="[value]roomUrlDefaultMsg" value="' +
|
|
304
|
|
- APP.translation.translateString("roomUrlDefaultMsg") + '"';
|
|
305
|
|
- } else {
|
|
306
|
|
- inviteAttributes = "value=\"" + encodeURI(roomUrl) + "\"";
|
|
307
|
|
- }
|
|
308
|
|
- messageHandler.openTwoButtonDialog("dialog.shareLink",
|
|
309
|
|
- null, null,
|
|
310
|
|
- '<input id="inviteLinkRef" type="text" ' +
|
|
311
|
|
- inviteAttributes + ' onclick="this.select();" readonly>',
|
|
312
|
|
- false,
|
|
313
|
|
- "dialog.Invite",
|
|
314
|
|
- function (e, v) {
|
|
315
|
|
- if (v && roomUrl) {
|
|
316
|
|
- emitter.emit(UIEvents.USER_INVITED, roomUrl);
|
|
317
|
|
- }
|
|
318
|
|
- },
|
|
319
|
|
- function (event) {
|
|
320
|
|
- if (roomUrl) {
|
|
321
|
|
- document.getElementById('inviteLinkRef').select();
|
|
322
|
|
- } else {
|
|
323
|
|
- if (event && event.target)
|
|
324
|
|
- $(event.target)
|
|
325
|
|
- .find('button[value=true]').prop('disabled', true);
|
|
326
|
|
- }
|
|
327
|
|
- }
|
|
328
|
|
- );
|
|
329
|
|
- },
|
|
330
|
|
-
|
|
331
|
|
- /**
|
|
332
|
|
- * Toggles the application in and out of full screen mode
|
|
333
|
|
- * (a.k.a. presentation mode in Chrome).
|
|
334
|
|
- */
|
|
335
|
|
- toggleFullScreen () {
|
|
336
|
|
- var fsElement = document.documentElement;
|
|
337
|
|
-
|
|
338
|
|
- if (!document.mozFullScreen && !document.webkitIsFullScreen) {
|
|
339
|
|
- //Enter Full Screen
|
|
340
|
|
- if (fsElement.mozRequestFullScreen) {
|
|
341
|
|
- fsElement.mozRequestFullScreen();
|
|
342
|
|
- }
|
|
343
|
|
- else {
|
|
344
|
|
- fsElement.webkitRequestFullScreen(Element.ALLOW_KEYBOARD_INPUT);
|
|
345
|
|
- }
|
|
346
|
|
- } else {
|
|
347
|
|
- //Exit Full Screen
|
|
348
|
|
- if (document.mozCancelFullScreen) {
|
|
349
|
|
- document.mozCancelFullScreen();
|
|
350
|
|
- } else {
|
|
351
|
|
- document.webkitCancelFullScreen();
|
|
352
|
|
- }
|
|
353
|
|
- }
|
|
354
|
|
- },
|
|
355
|
|
-
|
|
356
|
339
|
/**
|
|
357
|
340
|
* Unlocks the lock button state.
|
|
358
|
341
|
*/
|
|
|
@@ -392,48 +375,6 @@ var Toolbar = {
|
|
392
|
375
|
}
|
|
393
|
376
|
},
|
|
394
|
377
|
|
|
395
|
|
- // Sets the state of the recording button
|
|
396
|
|
- setRecordingButtonState (recordingState) {
|
|
397
|
|
- var selector = $('#toolbar_button_record');
|
|
398
|
|
-
|
|
399
|
|
- if (recordingState === 'on') {
|
|
400
|
|
- selector.removeClass("icon-recEnable");
|
|
401
|
|
- selector.addClass("icon-recEnable active");
|
|
402
|
|
-
|
|
403
|
|
- $("#largeVideo").toggleClass("videoMessageFilter", true);
|
|
404
|
|
- var recordOnKey = "recording.on";
|
|
405
|
|
- $('#videoConnectionMessage').attr("data-i18n", recordOnKey);
|
|
406
|
|
- $('#videoConnectionMessage').text(APP.translation.translateString(recordOnKey));
|
|
407
|
|
-
|
|
408
|
|
- setTimeout(function(){
|
|
409
|
|
- $("#largeVideo").toggleClass("videoMessageFilter", false);
|
|
410
|
|
- $('#videoConnectionMessage').css({display: "none"});
|
|
411
|
|
- }, 1500);
|
|
412
|
|
-
|
|
413
|
|
- recordingToaster = messageHandler.notify(null, "recording.toaster", null,
|
|
414
|
|
- null, null, {timeOut: 0, closeButton: null, tapToDismiss: false});
|
|
415
|
|
- } else if (recordingState === 'off') {
|
|
416
|
|
- selector.removeClass("icon-recEnable active");
|
|
417
|
|
- selector.addClass("icon-recEnable");
|
|
418
|
|
-
|
|
419
|
|
- $("#largeVideo").toggleClass("videoMessageFilter", false);
|
|
420
|
|
- $('#videoConnectionMessage').css({display: "none"});
|
|
421
|
|
-
|
|
422
|
|
- if (recordingToaster)
|
|
423
|
|
- messageHandler.remove(recordingToaster);
|
|
424
|
|
-
|
|
425
|
|
- } else if (recordingState === 'pending') {
|
|
426
|
|
- selector.removeClass("icon-recEnable active");
|
|
427
|
|
- selector.addClass("icon-recEnable");
|
|
428
|
|
-
|
|
429
|
|
- $("#largeVideo").toggleClass("videoMessageFilter", true);
|
|
430
|
|
- var recordPendingKey = "recording.pending";
|
|
431
|
|
- $('#videoConnectionMessage').attr("data-i18n", recordPendingKey);
|
|
432
|
|
- $('#videoConnectionMessage').text(APP.translation.translateString(recordPendingKey));
|
|
433
|
|
- $('#videoConnectionMessage').css({display: "block"});
|
|
434
|
|
- }
|
|
435
|
|
- },
|
|
436
|
|
-
|
|
437
|
378
|
// checks whether recording is enabled and whether we have params
|
|
438
|
379
|
// to start automatically recording
|
|
439
|
380
|
checkAutoRecord () {
|