Browse Source

Allow for a list of enabled buttons to be passed as part of interfaceConfig

j8
Issac Gerges 9 years ago
parent
commit
bcccc58b2c

+ 1
- 1
index.html View File

20
     <script src="libs/popover.js?v=1"></script><!-- bootstrap tooltip lib -->
20
     <script src="libs/popover.js?v=1"></script><!-- bootstrap tooltip lib -->
21
     <script src="libs/toastr.js?v=1"></script><!-- notifications lib -->
21
     <script src="libs/toastr.js?v=1"></script><!-- notifications lib -->
22
     <script src="interface_config.js?v=5"></script>
22
     <script src="interface_config.js?v=5"></script>
23
-    <script src="libs/app.bundle.js?v=133"></script>
23
+    <script src="libs/app.bundle.js?v=138"></script>
24
     <script src="analytics.js?v=1"></script><!-- google analytics plugin -->
24
     <script src="analytics.js?v=1"></script><!-- google analytics plugin -->
25
     <link rel="stylesheet" href="css/font.css?v=7"/>
25
     <link rel="stylesheet" href="css/font.css?v=7"/>
26
     <link rel="stylesheet" href="css/toastr.css?v=1">
26
     <link rel="stylesheet" href="css/toastr.css?v=1">

+ 2
- 0
interface_config.js View File

16
     APP_NAME: "Jitsi Meet",
16
     APP_NAME: "Jitsi Meet",
17
     INVITATION_POWERED_BY: true,
17
     INVITATION_POWERED_BY: true,
18
     ACTIVE_SPEAKER_AVATAR_SIZE: 100,
18
     ACTIVE_SPEAKER_AVATAR_SIZE: 100,
19
+    TOOLBAR_BUTTONS: ['authentication', 'microphone', 'camera', 'desktop', 'record', 'security', 'invite',
20
+        'chat', 'prezi', 'etherpad', 'fullscreen', 'sip', 'dialpad', 'settings', 'hangup', 'filmstrip', 'contacts'],
19
     /**
21
     /**
20
      * Whether to only show the filmstrip (and hide the toolbar).
22
      * Whether to only show the filmstrip (and hide the toolbar).
21
      */
23
      */

+ 19663
- 19596
libs/app.bundle.js
File diff suppressed because it is too large
View File


+ 11
- 0
modules/UI/toolbars/BottomToolbar.js View File

1
 /* global $ */
1
 /* global $ */
2
 var PanelToggler = require("../side_pannels/SidePanelToggler");
2
 var PanelToggler = require("../side_pannels/SidePanelToggler");
3
+var UIUtil = require("../util/UIUtil");
3
 
4
 
4
 var buttonHandlers = {
5
 var buttonHandlers = {
5
     "bottom_toolbar_contact_list": function () {
6
     "bottom_toolbar_contact_list": function () {
13
     }
14
     }
14
 };
15
 };
15
 
16
 
17
+
18
+var defaultBottomToolbarButtons = {
19
+    'chat': '#bottom_toolbar_chat',
20
+    'contacts': '#bottom_toolbar_contact_list',
21
+    'filmstrip': '#bottom_toolbar_film_strip'
22
+};
23
+
24
+
16
 var BottomToolbar = (function (my) {
25
 var BottomToolbar = (function (my) {
17
     my.init = function () {
26
     my.init = function () {
27
+        UIUtil.hideDisabledButtons(defaultBottomToolbarButtons);
28
+
18
         for(var k in buttonHandlers)
29
         for(var k in buttonHandlers)
19
             $("#" + k).click(buttonHandlers[k]);
30
             $("#" + k).click(buttonHandlers[k]);
20
     };
31
     };

+ 23
- 12
modules/UI/toolbars/Toolbar.js View File

87
             });
87
             });
88
     }
88
     }
89
 };
89
 };
90
+var defaultToolbarButtons = {
91
+    'microphone': '#toolbar_button_mute',
92
+    'camera': '#toolbar_button_camera',
93
+    'desktop': '#toolbar_button_desktopsharing',
94
+    'security': '#toolbar_button_security',
95
+    'invite': '#toolbar_button_link',
96
+    'chat': '#toolbar_button_chat',
97
+    'prezi': '#toolbar_button_prezi',
98
+    'ethherpad': '#toolbar_button_etherpad',
99
+    'fullscreen': '#toolbar_button_fullScreen',
100
+    'settings': '#toolbar_button_settings',
101
+    'hangup': '#toolbar_button_hangup'
102
+};
90
 
103
 
91
 function hangup() {
104
 function hangup() {
92
     APP.xmpp.disposeConference();
105
     APP.xmpp.disposeConference();
255
 var Toolbar = (function (my) {
268
 var Toolbar = (function (my) {
256
 
269
 
257
     my.init = function (ui) {
270
     my.init = function (ui) {
271
+        UIUtil.hideDisabledButtons(defaultToolbarButtons);
272
+
258
         for(var k in buttonHandlers)
273
         for(var k in buttonHandlers)
259
             $("#" + k).click(buttonHandlers[k]);
274
             $("#" + k).click(buttonHandlers[k]);
260
         UI = ui;
275
         UI = ui;
339
      * Disables and enables some of the buttons.
354
      * Disables and enables some of the buttons.
340
      */
355
      */
341
     my.setupButtonsFromConfig = function () {
356
     my.setupButtonsFromConfig = function () {
342
-        if (config.disablePrezi) {
357
+        if (UIUtil.isButtonEnabled('prezi')) {
343
             $("#toolbar_button_prezi").css({display: "none"});
358
             $("#toolbar_button_prezi").css({display: "none"});
344
         }
359
         }
345
     };
360
     };
531
      * @param show <tt>true</tt> to show or <tt>false</tt> to hide
546
      * @param show <tt>true</tt> to show or <tt>false</tt> to hide
532
      */
547
      */
533
     my.showAuthenticateButton = function (show) {
548
     my.showAuthenticateButton = function (show) {
534
-        if (show) {
549
+        if (UIUtil.isButtonEnabled('authentication') && show) {
535
             $('#authentication').css({display: "inline"});
550
             $('#authentication').css({display: "inline"});
536
         }
551
         }
537
         else {
552
         else {
541
 
556
 
542
     // Shows or hides the 'recording' button.
557
     // Shows or hides the 'recording' button.
543
     my.showRecordingButton = function (show) {
558
     my.showRecordingButton = function (show) {
544
-        if (!config.enableRecording) {
545
-            return;
546
-        }
547
-
548
-        if (show) {
559
+        if (UIUtil.isButtonEnabled('recording') && show) {
549
             $('#toolbar_button_record').css({display: "inline-block"});
560
             $('#toolbar_button_record').css({display: "inline-block"});
550
         }
561
         }
551
         else {
562
         else {
597
 
608
 
598
     // checks whether recording is enabled and whether we have params to start automatically recording
609
     // checks whether recording is enabled and whether we have params to start automatically recording
599
     my.checkAutoRecord = function () {
610
     my.checkAutoRecord = function () {
600
-        if (config.enableRecording && config.autoRecord) {
611
+        if (UIUtil.isButtonEnabled('recording') && config.autoRecord) {
601
             toggleRecording(config.autoRecordToken);
612
             toggleRecording(config.autoRecordToken);
602
         }
613
         }
603
     }
614
     }
604
 
615
 
605
     // Shows or hides SIP calls button
616
     // Shows or hides SIP calls button
606
     my.showSipCallButton = function (show) {
617
     my.showSipCallButton = function (show) {
607
-        if (APP.xmpp.isSipGatewayEnabled() && show) {
618
+        if (APP.xmpp.isSipGatewayEnabled() && UIUtil.isButtonEnabled('sip') && show) {
608
             $('#toolbar_button_sip').css({display: "inline-block"});
619
             $('#toolbar_button_sip').css({display: "inline-block"});
609
         } else {
620
         } else {
610
             $('#toolbar_button_sip').css({display: "none"});
621
             $('#toolbar_button_sip').css({display: "none"});
613
 
624
 
614
     // Shows or hides the dialpad button
625
     // Shows or hides the dialpad button
615
     my.showDialPadButton = function (show) {
626
     my.showDialPadButton = function (show) {
616
-        if (show) {
627
+        if (UIUtil.isButtonEnabled('dialpad') && show) {
617
             $('#toolbar_button_dialpad').css({display: "inline-block"});
628
             $('#toolbar_button_dialpad').css({display: "inline-block"});
618
         } else {
629
         } else {
619
             $('#toolbar_button_dialpad').css({display: "none"});
630
             $('#toolbar_button_dialpad').css({display: "none"});
639
      * @param show <tt>true</tt> to show
650
      * @param show <tt>true</tt> to show
640
      */
651
      */
641
     my.showLoginButton = function (show) {
652
     my.showLoginButton = function (show) {
642
-        if (show) {
653
+        if (UIUtil.isButtonEnabled('authentication') && show) {
643
             $('#toolbar_button_login').css({display: "list-item"});
654
             $('#toolbar_button_login').css({display: "list-item"});
644
         } else {
655
         } else {
645
             $('#toolbar_button_login').css({display: "none"});
656
             $('#toolbar_button_login').css({display: "none"});
651
      * @param show <tt>true</tt> to show
662
      * @param show <tt>true</tt> to show
652
      */
663
      */
653
     my.showLogoutButton = function (show) {
664
     my.showLogoutButton = function (show) {
654
-        if (show) {
665
+        if (UIUtil.isButtonEnabled('authentication') && show) {
655
             $('#toolbar_button_logout').css({display: "list-item"});
666
             $('#toolbar_button_logout').css({display: "list-item"});
656
         } else {
667
         } else {
657
             $('#toolbar_button_logout').css({display: "none"});
668
             $('#toolbar_button_logout').css({display: "none"});

+ 3
- 2
modules/UI/toolbars/ToolbarToggler.js View File

2
  DesktopStreaming.showDesktopSharingButton */
2
  DesktopStreaming.showDesktopSharingButton */
3
 
3
 
4
 var toolbarTimeoutObject,
4
 var toolbarTimeoutObject,
5
-    toolbarTimeout = interfaceConfig.INITIAL_TOOLBAR_TIMEOUT;
5
+    toolbarTimeout = interfaceConfig.INITIAL_TOOLBAR_TIMEOUT,
6
+    UIUtil = require("../util/UIUtil");
6
 
7
 
7
 function showDesktopSharingButton() {
8
 function showDesktopSharingButton() {
8
-    if (APP.desktopsharing.isDesktopSharingEnabled()) {
9
+    if (APP.desktopsharing.isDesktopSharingEnabled() && UIUtil.isButtonEnabled('desktop')) {
9
         $('#toolbar_button_desktopsharing').css({display: "inline-block"});
10
         $('#toolbar_button_desktopsharing').css({display: "inline-block"});
10
     } else {
11
     } else {
11
         $('#toolbar_button_desktopsharing').css({display: "none"});
12
         $('#toolbar_button_desktopsharing').css({display: "none"});

+ 20
- 2
modules/UI/util/UIUtil.js View File

1
-/* global $ */
1
+/* global $, config, interfaceConfig */
2
 /**
2
 /**
3
  * Created by hristo on 12/22/14.
3
  * Created by hristo on 12/22/14.
4
  */
4
  */
5
-module.exports = {
5
+var UIUtil = module.exports = {
6
     /**
6
     /**
7
      * Returns the available video width.
7
      * Returns the available video width.
8
      */
8
      */
92
         } else {
92
         } else {
93
             container.appendChild(newChild);
93
             container.appendChild(newChild);
94
         }
94
         }
95
+    },
96
+
97
+    isButtonEnabled: function (name) {
98
+        var isEnabled = interfaceConfig.TOOLBAR_BUTTONS.indexOf(name) !== -1;
99
+        if (name === 'prezi') {
100
+            return isEnabled && !config.disablePrezi;
101
+        } else if (name === 'recording') {
102
+            return isEnabled && config.enableRecording;
103
+        }
104
+        return isEnabled;
105
+    },
106
+
107
+    hideDisabledButtons: function (mappings) {
108
+        var selector = Object.keys(mappings)
109
+          .map(function (buttonName) { return UIUtil.isButtonEnabled(buttonName) ? null : mappings[buttonName]; })
110
+          .filter(function (item) { return item; })
111
+          .join(',');
112
+        $(selector).hide();
95
     }
113
     }
96
 };
114
 };

Loading…
Cancel
Save