|
@@ -10,7 +10,6 @@ var Feedback = require("../Feedback");
|
10
|
10
|
var UIEvents = require("../../../service/UI/UIEvents");
|
11
|
11
|
|
12
|
12
|
var roomUrl = null;
|
13
|
|
-var sharedKey = '';
|
14
|
13
|
var recordingToaster = null;
|
15
|
14
|
var emitter = null;
|
16
|
15
|
|
|
@@ -33,20 +32,12 @@ var buttonHandlers = {
|
33
|
32
|
emitter.emit(UIEvents.VIDEO_MUTED, true);
|
34
|
33
|
}
|
35
|
34
|
},
|
36
|
|
- /*"toolbar_button_authentication": function () {
|
37
|
|
- return Toolbar.authenticateClicked();
|
38
|
|
- },*/
|
39
|
35
|
"toolbar_button_record": function () {
|
40
|
36
|
AnalyticsAdapter.sendEvent('toolbar.recording.toggled');
|
41
|
37
|
return toggleRecording();
|
42
|
38
|
},
|
43
|
39
|
"toolbar_button_security": function () {
|
44
|
|
- if (sharedKey) {
|
45
|
|
- AnalyticsAdapter.sendEvent('toolbar.lock.disabled');
|
46
|
|
- } else {
|
47
|
|
- AnalyticsAdapter.sendEvent('toolbar.lock.enabled');
|
48
|
|
- }
|
49
|
|
- return Toolbar.openLockDialog();
|
|
40
|
+ emitter.emit(UIEvents.ROOM_LOCK_CLICKED);
|
50
|
41
|
},
|
51
|
42
|
"toolbar_button_link": function () {
|
52
|
43
|
AnalyticsAdapter.sendEvent('toolbar.invite.clicked');
|
|
@@ -209,73 +200,6 @@ function toggleRecording(predefinedToken) {
|
209
|
200
|
}, Toolbar.setRecordingButtonState);
|
210
|
201
|
}
|
211
|
202
|
|
212
|
|
-/**
|
213
|
|
- * Locks / unlocks the room.
|
214
|
|
- */
|
215
|
|
-function lockRoom(lock) {
|
216
|
|
- var currentSharedKey = '';
|
217
|
|
- if (lock)
|
218
|
|
- currentSharedKey = sharedKey;
|
219
|
|
-
|
220
|
|
- APP.xmpp.lockRoom(currentSharedKey, function (res) {
|
221
|
|
- // password is required
|
222
|
|
- if (sharedKey) {
|
223
|
|
- console.log('set room password');
|
224
|
|
- Toolbar.lockLockButton();
|
225
|
|
- }
|
226
|
|
- else {
|
227
|
|
- console.log('removed room password');
|
228
|
|
- Toolbar.unlockLockButton();
|
229
|
|
- }
|
230
|
|
- }, function (err) {
|
231
|
|
- console.warn('setting password failed', err);
|
232
|
|
- messageHandler.showError("dialog.lockTitle",
|
233
|
|
- "dialog.lockMessage");
|
234
|
|
- Toolbar.setSharedKey('');
|
235
|
|
- }, function () {
|
236
|
|
- console.warn('room passwords not supported');
|
237
|
|
- messageHandler.showError("dialog.warning",
|
238
|
|
- "dialog.passwordNotSupported");
|
239
|
|
- Toolbar.setSharedKey('');
|
240
|
|
- });
|
241
|
|
-}
|
242
|
|
-
|
243
|
|
-/**
|
244
|
|
- * Invite participants to conference.
|
245
|
|
- */
|
246
|
|
-function inviteParticipants() {
|
247
|
|
- if (roomUrl === null)
|
248
|
|
- return;
|
249
|
|
-
|
250
|
|
- var sharedKeyText = "";
|
251
|
|
- if (sharedKey && sharedKey.length > 0) {
|
252
|
|
- sharedKeyText =
|
253
|
|
- APP.translation.translateString("email.sharedKey",
|
254
|
|
- {sharedKey: sharedKey});
|
255
|
|
- sharedKeyText = sharedKeyText.replace(/\n/g, "%0D%0A");
|
256
|
|
- }
|
257
|
|
-
|
258
|
|
- var supportedBrowsers = "Chromium, Google Chrome " +
|
259
|
|
- APP.translation.translateString("email.and") + " Opera";
|
260
|
|
- var conferenceName = roomUrl.substring(roomUrl.lastIndexOf('/') + 1);
|
261
|
|
- var subject = APP.translation.translateString("email.subject",
|
262
|
|
- {appName:interfaceConfig.APP_NAME, conferenceName: conferenceName});
|
263
|
|
- var body = APP.translation.translateString("email.body",
|
264
|
|
- {appName:interfaceConfig.APP_NAME, sharedKeyText: sharedKeyText,
|
265
|
|
- roomUrl: roomUrl, supportedBrowsers: supportedBrowsers});
|
266
|
|
- body = body.replace(/\n/g, "%0D%0A");
|
267
|
|
-
|
268
|
|
- if (window.localStorage.displayname) {
|
269
|
|
- body += "%0D%0A%0D%0A" + window.localStorage.displayname;
|
270
|
|
- }
|
271
|
|
-
|
272
|
|
- if (interfaceConfig.INVITATION_POWERED_BY) {
|
273
|
|
- body += "%0D%0A%0D%0A--%0D%0Apowered by jitsi.org";
|
274
|
|
- }
|
275
|
|
-
|
276
|
|
- window.open("mailto:?subject=" + subject + "&body=" + body, '_blank');
|
277
|
|
-}
|
278
|
|
-
|
279
|
203
|
function dialpadButtonClicked() {
|
280
|
204
|
//TODO show the dialpad box
|
281
|
205
|
}
|
|
@@ -296,8 +220,7 @@ function callSipButtonClicked() {
|
296
|
220
|
if (v) {
|
297
|
221
|
var numberInput = f.sipNumber;
|
298
|
222
|
if (numberInput) {
|
299
|
|
- APP.xmpp.dial(
|
300
|
|
- numberInput, 'fromnumber', APP.conference.roomName, sharedKey);
|
|
223
|
+ APP.xmpp.dial(numberInput, 'fromnumber', APP.conference.roomName, APP.conference.sharedKey);
|
301
|
224
|
}
|
302
|
225
|
}
|
303
|
226
|
},
|
|
@@ -305,25 +228,16 @@ function callSipButtonClicked() {
|
305
|
228
|
);
|
306
|
229
|
}
|
307
|
230
|
|
308
|
|
-var Toolbar = (function (my) {
|
309
|
|
-
|
310
|
|
- my.init = function (eventEmitter) {
|
|
231
|
+var Toolbar = {
|
|
232
|
+ init (eventEmitter) {
|
311
|
233
|
emitter = eventEmitter;
|
312
|
234
|
UIUtil.hideDisabledButtons(defaultToolbarButtons);
|
313
|
235
|
|
314
|
236
|
for(var k in buttonHandlers)
|
315
|
237
|
$("#" + k).click(buttonHandlers[k]);
|
316
|
|
- };
|
317
|
|
-
|
318
|
|
- /**
|
319
|
|
- * Sets shared key
|
320
|
|
- * @param sKey the shared key
|
321
|
|
- */
|
322
|
|
- my.setSharedKey = function (sKey) {
|
323
|
|
- sharedKey = sKey;
|
324
|
|
- };
|
|
238
|
+ },
|
325
|
239
|
|
326
|
|
- my.authenticateClicked = function () {
|
|
240
|
+ authenticateClicked () {
|
327
|
241
|
Authentication.focusAuthenticationWindow();
|
328
|
242
|
if (!APP.xmpp.isExternalAuthEnabled()) {
|
329
|
243
|
Authentication.xmppAuthenticate();
|
|
@@ -352,12 +266,12 @@ var Toolbar = (function (my) {
|
352
|
266
|
}
|
353
|
267
|
});
|
354
|
268
|
}
|
355
|
|
- };
|
|
269
|
+ },
|
356
|
270
|
|
357
|
271
|
/**
|
358
|
272
|
* Updates the room invite url.
|
359
|
273
|
*/
|
360
|
|
- my.updateRoomUrl = function (newRoomUrl) {
|
|
274
|
+ updateRoomUrl (newRoomUrl) {
|
361
|
275
|
roomUrl = newRoomUrl;
|
362
|
276
|
|
363
|
277
|
// If the invite dialog has been already opened we update the information.
|
|
@@ -368,75 +282,21 @@ var Toolbar = (function (my) {
|
368
|
282
|
$('#inviteLinkRef').parent()
|
369
|
283
|
.find('button[value=true]').prop('disabled', false);
|
370
|
284
|
}
|
371
|
|
- };
|
|
285
|
+ },
|
372
|
286
|
|
373
|
287
|
/**
|
374
|
288
|
* Disables and enables some of the buttons.
|
375
|
289
|
*/
|
376
|
|
- my.setupButtonsFromConfig = function () {
|
|
290
|
+ setupButtonsFromConfig () {
|
377
|
291
|
if (UIUtil.isButtonEnabled('prezi')) {
|
378
|
292
|
$("#toolbar_button_prezi").css({display: "none"});
|
379
|
293
|
}
|
380
|
|
- };
|
381
|
|
-
|
382
|
|
- /**
|
383
|
|
- * Opens the lock room dialog.
|
384
|
|
- */
|
385
|
|
- my.openLockDialog = function () {
|
386
|
|
- // Only the focus is able to set a shared key.
|
387
|
|
- if (!APP.xmpp.isModerator()) {
|
388
|
|
- if (sharedKey) {
|
389
|
|
- messageHandler.openMessageDialog(null,
|
390
|
|
- "dialog.passwordError");
|
391
|
|
- } else {
|
392
|
|
- messageHandler.openMessageDialog(null, "dialog.passwordError2");
|
393
|
|
- }
|
394
|
|
- } else {
|
395
|
|
- if (sharedKey) {
|
396
|
|
- messageHandler.openTwoButtonDialog(null, null,
|
397
|
|
- "dialog.passwordCheck",
|
398
|
|
- null,
|
399
|
|
- false,
|
400
|
|
- "dialog.Remove",
|
401
|
|
- function (e, v) {
|
402
|
|
- if (v) {
|
403
|
|
- Toolbar.setSharedKey('');
|
404
|
|
- lockRoom(false);
|
405
|
|
- }
|
406
|
|
- });
|
407
|
|
- } else {
|
408
|
|
- var msg = APP.translation.generateTranslationHTML(
|
409
|
|
- "dialog.passwordMsg");
|
410
|
|
- var yourPassword = APP.translation.translateString(
|
411
|
|
- "dialog.yourPassword");
|
412
|
|
- messageHandler.openTwoButtonDialog(null, null, null,
|
413
|
|
- '<h2>' + msg + '</h2>' +
|
414
|
|
- '<input name="lockKey" type="text"' +
|
415
|
|
- ' data-i18n="[placeholder]dialog.yourPassword" ' +
|
416
|
|
- 'placeholder="' + yourPassword + '" autofocus>',
|
417
|
|
- false,
|
418
|
|
- "dialog.Save",
|
419
|
|
- function (e, v, m, f) {
|
420
|
|
- if (v) {
|
421
|
|
- var lockKey = f.lockKey;
|
422
|
|
-
|
423
|
|
- if (lockKey) {
|
424
|
|
- Toolbar.setSharedKey(
|
425
|
|
- UIUtil.escapeHtml(lockKey));
|
426
|
|
- lockRoom(true);
|
427
|
|
- }
|
428
|
|
- }
|
429
|
|
- },
|
430
|
|
- null, null, 'input:first'
|
431
|
|
- );
|
432
|
|
- }
|
433
|
|
- }
|
434
|
|
- };
|
|
294
|
+ },
|
435
|
295
|
|
436
|
296
|
/**
|
437
|
297
|
* Opens the invite link dialog.
|
438
|
298
|
*/
|
439
|
|
- my.openLinkDialog = function () {
|
|
299
|
+ openLinkDialog () {
|
440
|
300
|
var inviteAttributes;
|
441
|
301
|
|
442
|
302
|
if (roomUrl === null) {
|
|
@@ -452,10 +312,8 @@ var Toolbar = (function (my) {
|
452
|
312
|
false,
|
453
|
313
|
"dialog.Invite",
|
454
|
314
|
function (e, v) {
|
455
|
|
- if (v) {
|
456
|
|
- if (roomUrl) {
|
457
|
|
- inviteParticipants();
|
458
|
|
- }
|
|
315
|
+ if (v && roomUrl) {
|
|
316
|
+ emitter.emit(UIEvents.USER_INVITED, roomUrl);
|
459
|
317
|
}
|
460
|
318
|
},
|
461
|
319
|
function (event) {
|
|
@@ -468,65 +326,13 @@ var Toolbar = (function (my) {
|
468
|
326
|
}
|
469
|
327
|
}
|
470
|
328
|
);
|
471
|
|
- };
|
472
|
|
-
|
473
|
|
- /**
|
474
|
|
- * Opens the settings dialog.
|
475
|
|
- * FIXME: not used ?
|
476
|
|
- */
|
477
|
|
- my.openSettingsDialog = function () {
|
478
|
|
- var settings1 = APP.translation.generateTranslationHTML(
|
479
|
|
- "dialog.settings1");
|
480
|
|
- var settings2 = APP.translation.generateTranslationHTML(
|
481
|
|
- "dialog.settings2");
|
482
|
|
- var settings3 = APP.translation.generateTranslationHTML(
|
483
|
|
- "dialog.settings3");
|
484
|
|
-
|
485
|
|
- var yourPassword = APP.translation.translateString(
|
486
|
|
- "dialog.yourPassword");
|
487
|
|
-
|
488
|
|
- messageHandler.openTwoButtonDialog(null,
|
489
|
|
- '<h2>' + settings1 + '</h2>' +
|
490
|
|
- '<input type="checkbox" id="initMuted">' +
|
491
|
|
- settings2 + '<br/>' +
|
492
|
|
- '<input type="checkbox" id="requireNicknames">' +
|
493
|
|
- settings3 +
|
494
|
|
- '<input id="lockKey" type="text" placeholder="' + yourPassword +
|
495
|
|
- '" data-i18n="[placeholder]dialog.yourPassword" autofocus>',
|
496
|
|
- null,
|
497
|
|
- null,
|
498
|
|
- false,
|
499
|
|
- "dialog.Save",
|
500
|
|
- function () {
|
501
|
|
- document.getElementById('lockKey').focus();
|
502
|
|
- },
|
503
|
|
- function (e, v) {
|
504
|
|
- if (v) {
|
505
|
|
- if ($('#initMuted').is(":checked")) {
|
506
|
|
- // it is checked
|
507
|
|
- }
|
508
|
|
-
|
509
|
|
- if ($('#requireNicknames').is(":checked")) {
|
510
|
|
- // it is checked
|
511
|
|
- }
|
512
|
|
- /*
|
513
|
|
- var lockKey = document.getElementById('lockKey');
|
514
|
|
-
|
515
|
|
- if (lockKey.value) {
|
516
|
|
- setSharedKey(lockKey.value);
|
517
|
|
- lockRoom(true);
|
518
|
|
- }
|
519
|
|
- */
|
520
|
|
- }
|
521
|
|
- }
|
522
|
|
- );
|
523
|
|
- };
|
|
329
|
+ },
|
524
|
330
|
|
525
|
331
|
/**
|
526
|
332
|
* Toggles the application in and out of full screen mode
|
527
|
333
|
* (a.k.a. presentation mode in Chrome).
|
528
|
334
|
*/
|
529
|
|
- my.toggleFullScreen = function () {
|
|
335
|
+ toggleFullScreen () {
|
530
|
336
|
var fsElement = document.documentElement;
|
531
|
337
|
|
532
|
338
|
if (!document.mozFullScreen && !document.webkitIsFullScreen) {
|
|
@@ -545,47 +351,49 @@ var Toolbar = (function (my) {
|
545
|
351
|
document.webkitCancelFullScreen();
|
546
|
352
|
}
|
547
|
353
|
}
|
548
|
|
- };
|
|
354
|
+ },
|
|
355
|
+
|
549
|
356
|
/**
|
550
|
357
|
* Unlocks the lock button state.
|
551
|
358
|
*/
|
552
|
|
- my.unlockLockButton = function () {
|
|
359
|
+ unlockLockButton () {
|
553
|
360
|
if ($("#toolbar_button_security").hasClass("icon-security-locked"))
|
554
|
361
|
UIUtil.buttonClick("#toolbar_button_security", "icon-security icon-security-locked");
|
555
|
|
- };
|
|
362
|
+ },
|
|
363
|
+
|
556
|
364
|
/**
|
557
|
365
|
* Updates the lock button state to locked.
|
558
|
366
|
*/
|
559
|
|
- my.lockLockButton = function () {
|
|
367
|
+ lockLockButton () {
|
560
|
368
|
if ($("#toolbar_button_security").hasClass("icon-security"))
|
561
|
369
|
UIUtil.buttonClick("#toolbar_button_security", "icon-security icon-security-locked");
|
562
|
|
- };
|
|
370
|
+ },
|
563
|
371
|
|
564
|
372
|
/**
|
565
|
373
|
* Shows or hides authentication button
|
566
|
374
|
* @param show <tt>true</tt> to show or <tt>false</tt> to hide
|
567
|
375
|
*/
|
568
|
|
- my.showAuthenticateButton = function (show) {
|
|
376
|
+ showAuthenticateButton (show) {
|
569
|
377
|
if (UIUtil.isButtonEnabled('authentication') && show) {
|
570
|
378
|
$('#authentication').css({display: "inline"});
|
571
|
379
|
}
|
572
|
380
|
else {
|
573
|
381
|
$('#authentication').css({display: "none"});
|
574
|
382
|
}
|
575
|
|
- };
|
|
383
|
+ },
|
576
|
384
|
|
577
|
385
|
// Shows or hides the 'recording' button.
|
578
|
|
- my.showRecordingButton = function (show) {
|
|
386
|
+ showRecordingButton (show) {
|
579
|
387
|
if (UIUtil.isButtonEnabled('recording') && show) {
|
580
|
388
|
$('#toolbar_button_record').css({display: "inline-block"});
|
581
|
389
|
}
|
582
|
390
|
else {
|
583
|
391
|
$('#toolbar_button_record').css({display: "none"});
|
584
|
392
|
}
|
585
|
|
- };
|
|
393
|
+ },
|
586
|
394
|
|
587
|
395
|
// Sets the state of the recording button
|
588
|
|
- my.setRecordingButtonState = function (recordingState) {
|
|
396
|
+ setRecordingButtonState (recordingState) {
|
589
|
397
|
var selector = $('#toolbar_button_record');
|
590
|
398
|
|
591
|
399
|
if (recordingState === 'on') {
|
|
@@ -624,48 +432,48 @@ var Toolbar = (function (my) {
|
624
|
432
|
$('#videoConnectionMessage').text(APP.translation.translateString(recordPendingKey));
|
625
|
433
|
$('#videoConnectionMessage').css({display: "block"});
|
626
|
434
|
}
|
627
|
|
- };
|
|
435
|
+ },
|
628
|
436
|
|
629
|
437
|
// checks whether recording is enabled and whether we have params
|
630
|
438
|
// to start automatically recording
|
631
|
|
- my.checkAutoRecord = function () {
|
|
439
|
+ checkAutoRecord () {
|
632
|
440
|
if (UIUtil.isButtonEnabled('recording') && config.autoRecord) {
|
633
|
441
|
toggleRecording(config.autoRecordToken);
|
634
|
442
|
}
|
635
|
|
- };
|
|
443
|
+ },
|
636
|
444
|
|
637
|
445
|
// checks whether desktop sharing is enabled and whether
|
638
|
446
|
// we have params to start automatically sharing
|
639
|
|
- my.checkAutoEnableDesktopSharing = function () {
|
|
447
|
+ checkAutoEnableDesktopSharing () {
|
640
|
448
|
if (UIUtil.isButtonEnabled('desktop')
|
641
|
449
|
&& config.autoEnableDesktopSharing) {
|
642
|
450
|
APP.desktopsharing.toggleScreenSharing();
|
643
|
451
|
}
|
644
|
|
- };
|
|
452
|
+ },
|
645
|
453
|
|
646
|
454
|
// Shows or hides SIP calls button
|
647
|
|
- my.showSipCallButton = function (show) {
|
|
455
|
+ showSipCallButton (show) {
|
648
|
456
|
if (APP.xmpp.isSipGatewayEnabled() && UIUtil.isButtonEnabled('sip') && show) {
|
649
|
457
|
$('#toolbar_button_sip').css({display: "inline-block"});
|
650
|
458
|
} else {
|
651
|
459
|
$('#toolbar_button_sip').css({display: "none"});
|
652
|
460
|
}
|
653
|
|
- };
|
|
461
|
+ },
|
654
|
462
|
|
655
|
463
|
// Shows or hides the dialpad button
|
656
|
|
- my.showDialPadButton = function (show) {
|
|
464
|
+ showDialPadButton (show) {
|
657
|
465
|
if (UIUtil.isButtonEnabled('dialpad') && show) {
|
658
|
466
|
$('#toolbar_button_dialpad').css({display: "inline-block"});
|
659
|
467
|
} else {
|
660
|
468
|
$('#toolbar_button_dialpad').css({display: "none"});
|
661
|
469
|
}
|
662
|
|
- };
|
|
470
|
+ },
|
663
|
471
|
|
664
|
472
|
/**
|
665
|
473
|
* Displays user authenticated identity name(login).
|
666
|
474
|
* @param authIdentity identity name to be displayed.
|
667
|
475
|
*/
|
668
|
|
- my.setAuthenticatedIdentity = function (authIdentity) {
|
|
476
|
+ setAuthenticatedIdentity (authIdentity) {
|
669
|
477
|
if (authIdentity) {
|
670
|
478
|
var selector = $('#toolbar_auth_identity');
|
671
|
479
|
selector.css({display: "list-item"});
|
|
@@ -673,47 +481,45 @@ var Toolbar = (function (my) {
|
673
|
481
|
} else {
|
674
|
482
|
$('#toolbar_auth_identity').css({display: "none"});
|
675
|
483
|
}
|
676
|
|
- };
|
|
484
|
+ },
|
677
|
485
|
|
678
|
486
|
/**
|
679
|
487
|
* Shows/hides login button.
|
680
|
488
|
* @param show <tt>true</tt> to show
|
681
|
489
|
*/
|
682
|
|
- my.showLoginButton = function (show) {
|
|
490
|
+ showLoginButton (show) {
|
683
|
491
|
if (UIUtil.isButtonEnabled('authentication') && show) {
|
684
|
492
|
$('#toolbar_button_login').css({display: "list-item"});
|
685
|
493
|
} else {
|
686
|
494
|
$('#toolbar_button_login').css({display: "none"});
|
687
|
495
|
}
|
688
|
|
- };
|
|
496
|
+ },
|
689
|
497
|
|
690
|
498
|
/**
|
691
|
499
|
* Shows/hides logout button.
|
692
|
500
|
* @param show <tt>true</tt> to show
|
693
|
501
|
*/
|
694
|
|
- my.showLogoutButton = function (show) {
|
|
502
|
+ showLogoutButton (show) {
|
695
|
503
|
if (UIUtil.isButtonEnabled('authentication') && show) {
|
696
|
504
|
$('#toolbar_button_logout').css({display: "list-item"});
|
697
|
505
|
} else {
|
698
|
506
|
$('#toolbar_button_logout').css({display: "none"});
|
699
|
507
|
}
|
700
|
|
- };
|
|
508
|
+ },
|
701
|
509
|
|
702
|
510
|
/**
|
703
|
511
|
* Sets the state of the button. The button has blue glow if desktop
|
704
|
512
|
* streaming is active.
|
705
|
513
|
* @param active the state of the desktop streaming.
|
706
|
514
|
*/
|
707
|
|
- my.changeDesktopSharingButtonState = function (active) {
|
|
515
|
+ changeDesktopSharingButtonState (active) {
|
708
|
516
|
var button = $("#toolbar_button_desktopsharing");
|
709
|
517
|
if (active) {
|
710
|
518
|
button.addClass("glow");
|
711
|
519
|
} else {
|
712
|
520
|
button.removeClass("glow");
|
713
|
521
|
}
|
714
|
|
- };
|
715
|
|
-
|
716
|
|
- return my;
|
717
|
|
-}(Toolbar || {}));
|
|
522
|
+ }
|
|
523
|
+};
|
718
|
524
|
|
719
|
|
-module.exports = Toolbar;
|
|
525
|
+export default Toolbar;
|