Merge branch 'gerges-issue/toolbar-config'

This commit is contained in:
hristoterezov 2015-09-11 15:42:36 -05:00
commit 694fe83fc9
6 changed files with 61 additions and 18 deletions

View File

@ -19,8 +19,8 @@
<script src="libs/tooltip.js?v=1"></script><!-- bootstrap tooltip lib -->
<script src="libs/popover.js?v=1"></script><!-- bootstrap tooltip lib -->
<script src="libs/toastr.js?v=1"></script><!-- notifications lib -->
<script src="interface_config.js?v=5"></script>
<script src="libs/app.bundle.js?v=131"></script>
<script src="interface_config.js?v=6"></script>
<script src="libs/app.bundle.js?v=138"></script>
<script src="analytics.js?v=1"></script><!-- google analytics plugin -->
<link rel="stylesheet" href="css/font.css?v=7"/>
<link rel="stylesheet" href="css/toastr.css?v=1">

View File

@ -16,6 +16,8 @@ var interfaceConfig = {
APP_NAME: "Jitsi Meet",
INVITATION_POWERED_BY: true,
ACTIVE_SPEAKER_AVATAR_SIZE: 100,
TOOLBAR_BUTTONS: ['authentication', 'microphone', 'camera', 'desktop', 'recording', 'security', 'invite',
'chat', 'prezi', 'etherpad', 'fullscreen', 'sip', 'dialpad', 'settings', 'hangup', 'filmstrip', 'contacts'],
/**
* Whether to only show the filmstrip (and hide the toolbar).
*/

View File

@ -1,5 +1,6 @@
/* global $ */
var PanelToggler = require("../side_pannels/SidePanelToggler");
var UIUtil = require("../util/UIUtil");
var buttonHandlers = {
"bottom_toolbar_contact_list": function () {
@ -13,8 +14,18 @@ var buttonHandlers = {
}
};
var defaultBottomToolbarButtons = {
'chat': '#bottom_toolbar_chat',
'contacts': '#bottom_toolbar_contact_list',
'filmstrip': '#bottom_toolbar_film_strip'
};
var BottomToolbar = (function (my) {
my.init = function () {
UIUtil.hideDisabledButtons(defaultBottomToolbarButtons);
for(var k in buttonHandlers)
$("#" + k).click(buttonHandlers[k]);
};

View File

@ -87,6 +87,19 @@ var buttonHandlers = {
});
}
};
var defaultToolbarButtons = {
'microphone': '#toolbar_button_mute',
'camera': '#toolbar_button_camera',
'desktop': '#toolbar_button_desktopsharing',
'security': '#toolbar_button_security',
'invite': '#toolbar_button_link',
'chat': '#toolbar_button_chat',
'prezi': '#toolbar_button_prezi',
'ethherpad': '#toolbar_button_etherpad',
'fullscreen': '#toolbar_button_fullScreen',
'settings': '#toolbar_button_settings',
'hangup': '#toolbar_button_hangup'
};
function hangup() {
APP.xmpp.disposeConference();
@ -255,6 +268,8 @@ function callSipButtonClicked() {
var Toolbar = (function (my) {
my.init = function (ui) {
UIUtil.hideDisabledButtons(defaultToolbarButtons);
for(var k in buttonHandlers)
$("#" + k).click(buttonHandlers[k]);
UI = ui;
@ -339,7 +354,7 @@ var Toolbar = (function (my) {
* Disables and enables some of the buttons.
*/
my.setupButtonsFromConfig = function () {
if (config.disablePrezi) {
if (UIUtil.isButtonEnabled('prezi')) {
$("#toolbar_button_prezi").css({display: "none"});
}
};
@ -531,7 +546,7 @@ var Toolbar = (function (my) {
* @param show <tt>true</tt> to show or <tt>false</tt> to hide
*/
my.showAuthenticateButton = function (show) {
if (show) {
if (UIUtil.isButtonEnabled('authentication') && show) {
$('#authentication').css({display: "inline"});
}
else {
@ -541,11 +556,7 @@ var Toolbar = (function (my) {
// Shows or hides the 'recording' button.
my.showRecordingButton = function (show) {
if (!config.enableRecording) {
return;
}
if (show) {
if (UIUtil.isButtonEnabled('recording') && show) {
$('#toolbar_button_record').css({display: "inline-block"});
}
else {
@ -597,14 +608,14 @@ var Toolbar = (function (my) {
// checks whether recording is enabled and whether we have params to start automatically recording
my.checkAutoRecord = function () {
if (config.enableRecording && config.autoRecord) {
if (UIUtil.isButtonEnabled('recording') && config.autoRecord) {
toggleRecording(config.autoRecordToken);
}
}
// Shows or hides SIP calls button
my.showSipCallButton = function (show) {
if (APP.xmpp.isSipGatewayEnabled() && show) {
if (APP.xmpp.isSipGatewayEnabled() && UIUtil.isButtonEnabled('sip') && show) {
$('#toolbar_button_sip').css({display: "inline-block"});
} else {
$('#toolbar_button_sip').css({display: "none"});
@ -613,7 +624,7 @@ var Toolbar = (function (my) {
// Shows or hides the dialpad button
my.showDialPadButton = function (show) {
if (show) {
if (UIUtil.isButtonEnabled('dialpad') && show) {
$('#toolbar_button_dialpad').css({display: "inline-block"});
} else {
$('#toolbar_button_dialpad').css({display: "none"});
@ -639,7 +650,7 @@ var Toolbar = (function (my) {
* @param show <tt>true</tt> to show
*/
my.showLoginButton = function (show) {
if (show) {
if (UIUtil.isButtonEnabled('authentication') && show) {
$('#toolbar_button_login').css({display: "list-item"});
} else {
$('#toolbar_button_login').css({display: "none"});
@ -651,7 +662,7 @@ var Toolbar = (function (my) {
* @param show <tt>true</tt> to show
*/
my.showLogoutButton = function (show) {
if (show) {
if (UIUtil.isButtonEnabled('authentication') && show) {
$('#toolbar_button_logout').css({display: "list-item"});
} else {
$('#toolbar_button_logout').css({display: "none"});

View File

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

View File

@ -1,8 +1,8 @@
/* global $ */
/* global $, config, interfaceConfig */
/**
* Created by hristo on 12/22/14.
*/
module.exports = {
var UIUtil = module.exports = {
/**
* Returns the available video width.
*/
@ -92,5 +92,23 @@ module.exports = {
} else {
container.appendChild(newChild);
}
},
isButtonEnabled: function (name) {
var isEnabled = interfaceConfig.TOOLBAR_BUTTONS.indexOf(name) !== -1;
if (name === 'prezi') {
return isEnabled && !config.disablePrezi;
} else if (name === 'recording') {
return isEnabled && config.enableRecording;
}
return isEnabled;
},
hideDisabledButtons: function (mappings) {
var selector = Object.keys(mappings)
.map(function (buttonName) { return UIUtil.isButtonEnabled(buttonName) ? null : mappings[buttonName]; })
.filter(function (item) { return item; })
.join(',');
$(selector).hide();
}
};