extract room locking out of Toolbar
This commit is contained in:
parent
5846a25fc3
commit
fc207ccf34
101
app.js
101
app.js
|
@ -17,6 +17,8 @@ import RoomnameGenerator from './modules/util/RoomnameGenerator';
|
|||
import CQEvents from './service/connectionquality/CQEvents';
|
||||
import UIEvents from './service/UI/UIEvents';
|
||||
|
||||
import createRoomLocker from './modules/RoomLocker';
|
||||
|
||||
const Commands = {
|
||||
CONNECTION_QUALITY: "connectionQuality",
|
||||
EMAIL: "email"
|
||||
|
@ -54,6 +56,7 @@ function buildRoomName () {
|
|||
return roomName;
|
||||
}
|
||||
|
||||
|
||||
const APP = {
|
||||
init () {
|
||||
let roomName = buildRoomName();
|
||||
|
@ -156,7 +159,7 @@ function connect() {
|
|||
var ConferenceEvents = JitsiMeetJS.events.conference;
|
||||
var ConferenceErrors = JitsiMeetJS.errors.conference;
|
||||
function initConference(localTracks, connection) {
|
||||
var room = connection.initJitsiConference(APP.conference.roomName, {
|
||||
let room = connection.initJitsiConference(APP.conference.roomName, {
|
||||
openSctp: config.openSctp,
|
||||
disableAudioLevels: config.disableAudioLevels
|
||||
});
|
||||
|
@ -183,14 +186,14 @@ function initConference(localTracks, connection) {
|
|||
room.on(ConferenceEvents.CONFERENCE_JOINED, function () {
|
||||
localTracks.forEach(function (track) {
|
||||
room.addTrack(track);
|
||||
APP.UI.addLocalStream(track);
|
||||
//APP.UI.addLocalStream(track);
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
room.on(ConferenceEvents.USER_JOINED, function (id) {
|
||||
// FIXME email???
|
||||
APP.UI.addUser(id);
|
||||
//APP.UI.addUser(id);
|
||||
});
|
||||
room.on(ConferenceEvents.USER_LEFT, function (id) {
|
||||
APP.UI.removeUser(id);
|
||||
|
@ -211,6 +214,21 @@ function initConference(localTracks, connection) {
|
|||
});
|
||||
|
||||
|
||||
let roomLocker = createRoomLocker(room);
|
||||
APP.UI.addListener(UIEvents.ROOM_LOCK_CLICKED, function () {
|
||||
if (room.isModerator()) {
|
||||
let promise = roomLocker.isLocked
|
||||
? roomLocker.askToUnlock()
|
||||
: roomLocker.askToLock();
|
||||
promise.then(function () {
|
||||
APP.UI.markRoomLocked(roomLocker.isLocked);
|
||||
});
|
||||
} else {
|
||||
roomLocker.notifyModeratorRequired();
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
room.on(ConferenceEvents.TRACK_MUTE_CHANGED, function (track) {
|
||||
// FIXME handle mute
|
||||
});
|
||||
|
@ -311,7 +329,12 @@ function initConference(localTracks, connection) {
|
|||
APP.UI.setUserAvatar(data.attributes.id, data.value);
|
||||
});
|
||||
|
||||
|
||||
let nick = APP.settings.getDisplayName();
|
||||
if (config.useNicks && !nick) {
|
||||
nick = APP.UI.askForNickname();
|
||||
APP.settings.setDisplayName(nick);
|
||||
}
|
||||
room.setDisplayName(nick);
|
||||
room.on(ConferenceEvents.DISPLAY_NAME_CHANGED, function (id, displayName) {
|
||||
APP.UI.changeDisplayName(id, displayName);
|
||||
});
|
||||
|
@ -334,18 +357,26 @@ function initConference(localTracks, connection) {
|
|||
}
|
||||
);
|
||||
|
||||
return new Promise(function (resolve, reject) {
|
||||
room.on(
|
||||
ConferenceEvents.CONFERENCE_JOINED,
|
||||
function () {
|
||||
resolve();
|
||||
}
|
||||
APP.UI.addListener(UIEvents.USER_INVITED, function (roomUrl) {
|
||||
inviteParticipants(
|
||||
roomUrl,
|
||||
APP.conference.roomName,
|
||||
roomLocker.password,
|
||||
APP.settings.getDisplayName()
|
||||
);
|
||||
});
|
||||
|
||||
return new Promise(function (resolve, reject) {
|
||||
room.on(ConferenceEvents.CONFERENCE_JOINED, resolve);
|
||||
|
||||
room.on(ConferenceErrors.ROOM_PASSWORD_REQUIRED, function () {
|
||||
APP.UI.markRoomLocked(true);
|
||||
roomLocker.requirePassword().then(function () {
|
||||
room.join(roomLocker.password);
|
||||
});
|
||||
});
|
||||
|
||||
APP.UI.closeAuthenticationDialog();
|
||||
if (config.useNicks) {
|
||||
// FIXME check this
|
||||
var nick = APP.UI.askForNickname();
|
||||
}
|
||||
room.join();
|
||||
}).catch(function (err) {
|
||||
if (err[0] === ConferenceErrors.PASSWORD_REQUIRED) {
|
||||
|
@ -450,4 +481,44 @@ $(window).bind('beforeunload', function () {
|
|||
}
|
||||
});
|
||||
|
||||
module.exports = APP;
|
||||
/**
|
||||
* Invite participants to conference.
|
||||
*/
|
||||
function inviteParticipants(roomUrl, conferenceName, key, nick) {
|
||||
let keyText = "";
|
||||
if (key) {
|
||||
keyText = APP.translation.translateString(
|
||||
"email.sharedKey", {sharedKey: key}
|
||||
);
|
||||
}
|
||||
|
||||
let and = APP.translation.translateString("email.and");
|
||||
let supportedBrowsers = `Chromium, Google Chrome ${and} Opera`;
|
||||
|
||||
let subject = APP.translation.translateString(
|
||||
"email.subject", {appName:interfaceConfig.APP_NAME, conferenceName}
|
||||
);
|
||||
|
||||
let body = APP.translation.translateString(
|
||||
"email.body", {
|
||||
appName:interfaceConfig.APP_NAME,
|
||||
sharedKeyText: keyText,
|
||||
roomUrl,
|
||||
supportedBrowsers
|
||||
}
|
||||
);
|
||||
|
||||
body = body.replace(/\n/g, "%0D%0A");
|
||||
|
||||
if (nick) {
|
||||
body += "%0D%0A%0D%0A" + nick;
|
||||
}
|
||||
|
||||
if (interfaceConfig.INVITATION_POWERED_BY) {
|
||||
body += "%0D%0A%0D%0A--%0D%0Apowered by jitsi.org";
|
||||
}
|
||||
|
||||
window.open(`mailto:?subject=${subject}&body=${body}`, '_blank');
|
||||
}
|
||||
|
||||
export default APP;
|
||||
|
|
|
@ -0,0 +1,143 @@
|
|||
/* global APP, JitsiMeetJS */
|
||||
import messageHandler from './UI/util/MessageHandler';
|
||||
import UIUtil from './UI/util/UIUtil';
|
||||
import AnalyticsAdapter from './statistics/AnalyticsAdapter';
|
||||
|
||||
function askForNewPassword () {
|
||||
let passMsg = APP.translation.generateTranslationHTML("dialog.passwordMsg");
|
||||
let yourPassMsg = APP.translation.translateString("dialog.yourPassword");
|
||||
let msg = `
|
||||
<h2>${passMsg}</h2>
|
||||
<input name="lockKey" type="text"
|
||||
data-i18n="[placeholder]dialog.yourPassword"
|
||||
placeholder="${yourPassMsg}" autofocus>
|
||||
`;
|
||||
|
||||
return new Promise(function (resolve, reject) {
|
||||
messageHandler.openTwoButtonDialog(
|
||||
null, null, null,
|
||||
msg, false, "dialog.Save",
|
||||
function (e, v, m, f) {
|
||||
if (v && f.lockKey) {
|
||||
resolve(UIUtil.escapeHtml(f.lockKey));
|
||||
} else {
|
||||
reject();
|
||||
}
|
||||
},
|
||||
null, null, 'input:first'
|
||||
);
|
||||
});
|
||||
}
|
||||
|
||||
function askForPassword () {
|
||||
let passRequiredMsg = APP.translation.translateString(
|
||||
"dialog.passwordRequired"
|
||||
);
|
||||
let passMsg = APP.translation.translateString("dialog.password");
|
||||
let msg = `
|
||||
<h2 data-i18n="dialog.passwordRequired">${passRequiredMsg}</h2>
|
||||
<input name="lockKey" type="text"
|
||||
data-i18n="[placeholder]dialog.password"
|
||||
placeholder="${passMsg}" autofocus>
|
||||
`;
|
||||
return new Promise(function (resolve, reject) {
|
||||
messageHandler.openTwoButtonDialog(
|
||||
null, null, null, msg,
|
||||
true, "dialog.Ok",
|
||||
function (e, v, m, f) {}, null,
|
||||
function (e, v, m, f) {
|
||||
if (v && f.lockKey) {
|
||||
resolve(UIUtil.escapeHtml(f.lockKey));
|
||||
} else {
|
||||
reject();
|
||||
}
|
||||
},
|
||||
':input:first'
|
||||
);
|
||||
});
|
||||
}
|
||||
|
||||
function askToUnlock () {
|
||||
return new Promise(function (resolve, reject) {
|
||||
messageHandler.openTwoButtonDialog(
|
||||
null, null, "dialog.passwordCheck",
|
||||
null, false, "dialog.Remove",
|
||||
function (e, v) {
|
||||
if (v) {
|
||||
resolve();
|
||||
} else {
|
||||
reject();
|
||||
}
|
||||
}
|
||||
);
|
||||
});
|
||||
}
|
||||
|
||||
function notifyPasswordNotSupported (err) {
|
||||
console.warn('setting password failed', err);
|
||||
messageHandler.showError("dialog.warning", "dialog.passwordNotSupported");
|
||||
}
|
||||
|
||||
function notifyPasswordFailed() {
|
||||
console.warn('room passwords not supported');
|
||||
messageHandler.showError("dialog.lockTitle", "dialog.lockMessage");
|
||||
}
|
||||
|
||||
const JitsiConferenceErrors = JitsiMeetJS.errors.conference;
|
||||
|
||||
export default function createRoomLocker (room) {
|
||||
let password;
|
||||
|
||||
function lock (newPass) {
|
||||
return room.lock(newPass).then(function () {
|
||||
password = newPass;
|
||||
}).catch(function (err) {
|
||||
if (err === JitsiConferenceErrors.PASSWORD_NOT_SUPPORTED) {
|
||||
notifyPasswordNotSupported();
|
||||
} else {
|
||||
notifyPasswordFailed(err);
|
||||
}
|
||||
throw err;
|
||||
});
|
||||
}
|
||||
|
||||
return {
|
||||
get isLocked () {
|
||||
return !!password;
|
||||
},
|
||||
|
||||
get password () {
|
||||
return password;
|
||||
},
|
||||
|
||||
askToUnlock () {
|
||||
askToUnlock().then(function () {
|
||||
return lock();
|
||||
}).then(function () {
|
||||
AnalyticsAdapter.sendEvent('toolbar.lock.disabled');
|
||||
});
|
||||
},
|
||||
|
||||
askToLock () {
|
||||
return askForNewPassword().then(function (newPass) {
|
||||
return lock(newPass);
|
||||
}).then(function () {
|
||||
AnalyticsAdapter.sendEvent('toolbar.lock.enabled');
|
||||
});
|
||||
},
|
||||
|
||||
requirePassword () {
|
||||
return askForPassword().then(function (newPass) {
|
||||
password = newPass;
|
||||
});
|
||||
},
|
||||
|
||||
notifyModeratorRequired () {
|
||||
if (password) {
|
||||
messageHandler.openMessageDialog(null, "dialog.passwordError");
|
||||
} else {
|
||||
messageHandler.openMessageDialog(null, "dialog.passwordError2");
|
||||
}
|
||||
}
|
||||
};
|
||||
}
|
|
@ -316,36 +316,6 @@ function initEtherpad(name) {
|
|||
Etherpad.init(name);
|
||||
}
|
||||
|
||||
UI.notifyPasswordRequired = function (callback) {
|
||||
// password is required
|
||||
Toolbar.lockLockButton();
|
||||
var message = '<h2 data-i18n="dialog.passwordRequired">';
|
||||
message += APP.translation.translateString(
|
||||
"dialog.passwordRequired");
|
||||
message += '</h2>' +
|
||||
'<input name="lockKey" type="text" data-i18n=' +
|
||||
'"[placeholder]dialog.password" placeholder="' +
|
||||
APP.translation.translateString("dialog.password") +
|
||||
'" autofocus>';
|
||||
|
||||
messageHandler.openTwoButtonDialog(null, null, null, message,
|
||||
true,
|
||||
"dialog.Ok",
|
||||
function (e, v, m, f) {},
|
||||
null,
|
||||
function (e, v, m, f) {
|
||||
if (v) {
|
||||
var lockKey = f.lockKey;
|
||||
if (lockKey) {
|
||||
Toolbar.setSharedKey(lockKey);
|
||||
callback(lockKey);
|
||||
}
|
||||
}
|
||||
},
|
||||
':input:first'
|
||||
);
|
||||
};
|
||||
|
||||
/**
|
||||
* The dialpad button is shown iff there is at least one member that supports
|
||||
* DTMF (e.g. jigasi).
|
||||
|
@ -639,6 +609,14 @@ UI.markVideoInterrupted = function (interrupted) {
|
|||
}
|
||||
};
|
||||
|
||||
UI.markRoomLocked = function (locked) {
|
||||
if (locked) {
|
||||
Toolbar.lockLockButton();
|
||||
} else {
|
||||
Toolbar.unlockLockButton();
|
||||
}
|
||||
};
|
||||
|
||||
UI.addMessage = function (from, displayName, message, stamp) {
|
||||
Chat.updateChatConversation(from, displayName, message, stamp);
|
||||
};
|
||||
|
|
|
@ -10,7 +10,6 @@ var Feedback = require("../Feedback");
|
|||
var UIEvents = require("../../../service/UI/UIEvents");
|
||||
|
||||
var roomUrl = null;
|
||||
var sharedKey = '';
|
||||
var recordingToaster = null;
|
||||
var emitter = null;
|
||||
|
||||
|
@ -33,20 +32,12 @@ var buttonHandlers = {
|
|||
emitter.emit(UIEvents.VIDEO_MUTED, true);
|
||||
}
|
||||
},
|
||||
/*"toolbar_button_authentication": function () {
|
||||
return Toolbar.authenticateClicked();
|
||||
},*/
|
||||
"toolbar_button_record": function () {
|
||||
AnalyticsAdapter.sendEvent('toolbar.recording.toggled');
|
||||
return toggleRecording();
|
||||
},
|
||||
"toolbar_button_security": function () {
|
||||
if (sharedKey) {
|
||||
AnalyticsAdapter.sendEvent('toolbar.lock.disabled');
|
||||
} else {
|
||||
AnalyticsAdapter.sendEvent('toolbar.lock.enabled');
|
||||
}
|
||||
return Toolbar.openLockDialog();
|
||||
emitter.emit(UIEvents.ROOM_LOCK_CLICKED);
|
||||
},
|
||||
"toolbar_button_link": function () {
|
||||
AnalyticsAdapter.sendEvent('toolbar.invite.clicked');
|
||||
|
@ -209,73 +200,6 @@ function toggleRecording(predefinedToken) {
|
|||
}, Toolbar.setRecordingButtonState);
|
||||
}
|
||||
|
||||
/**
|
||||
* Locks / unlocks the room.
|
||||
*/
|
||||
function lockRoom(lock) {
|
||||
var currentSharedKey = '';
|
||||
if (lock)
|
||||
currentSharedKey = sharedKey;
|
||||
|
||||
APP.xmpp.lockRoom(currentSharedKey, function (res) {
|
||||
// password is required
|
||||
if (sharedKey) {
|
||||
console.log('set room password');
|
||||
Toolbar.lockLockButton();
|
||||
}
|
||||
else {
|
||||
console.log('removed room password');
|
||||
Toolbar.unlockLockButton();
|
||||
}
|
||||
}, function (err) {
|
||||
console.warn('setting password failed', err);
|
||||
messageHandler.showError("dialog.lockTitle",
|
||||
"dialog.lockMessage");
|
||||
Toolbar.setSharedKey('');
|
||||
}, function () {
|
||||
console.warn('room passwords not supported');
|
||||
messageHandler.showError("dialog.warning",
|
||||
"dialog.passwordNotSupported");
|
||||
Toolbar.setSharedKey('');
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Invite participants to conference.
|
||||
*/
|
||||
function inviteParticipants() {
|
||||
if (roomUrl === null)
|
||||
return;
|
||||
|
||||
var sharedKeyText = "";
|
||||
if (sharedKey && sharedKey.length > 0) {
|
||||
sharedKeyText =
|
||||
APP.translation.translateString("email.sharedKey",
|
||||
{sharedKey: sharedKey});
|
||||
sharedKeyText = sharedKeyText.replace(/\n/g, "%0D%0A");
|
||||
}
|
||||
|
||||
var supportedBrowsers = "Chromium, Google Chrome " +
|
||||
APP.translation.translateString("email.and") + " Opera";
|
||||
var conferenceName = roomUrl.substring(roomUrl.lastIndexOf('/') + 1);
|
||||
var subject = APP.translation.translateString("email.subject",
|
||||
{appName:interfaceConfig.APP_NAME, conferenceName: conferenceName});
|
||||
var body = APP.translation.translateString("email.body",
|
||||
{appName:interfaceConfig.APP_NAME, sharedKeyText: sharedKeyText,
|
||||
roomUrl: roomUrl, supportedBrowsers: supportedBrowsers});
|
||||
body = body.replace(/\n/g, "%0D%0A");
|
||||
|
||||
if (window.localStorage.displayname) {
|
||||
body += "%0D%0A%0D%0A" + window.localStorage.displayname;
|
||||
}
|
||||
|
||||
if (interfaceConfig.INVITATION_POWERED_BY) {
|
||||
body += "%0D%0A%0D%0A--%0D%0Apowered by jitsi.org";
|
||||
}
|
||||
|
||||
window.open("mailto:?subject=" + subject + "&body=" + body, '_blank');
|
||||
}
|
||||
|
||||
function dialpadButtonClicked() {
|
||||
//TODO show the dialpad box
|
||||
}
|
||||
|
@ -296,8 +220,7 @@ function callSipButtonClicked() {
|
|||
if (v) {
|
||||
var numberInput = f.sipNumber;
|
||||
if (numberInput) {
|
||||
APP.xmpp.dial(
|
||||
numberInput, 'fromnumber', APP.conference.roomName, sharedKey);
|
||||
APP.xmpp.dial(numberInput, 'fromnumber', APP.conference.roomName, APP.conference.sharedKey);
|
||||
}
|
||||
}
|
||||
},
|
||||
|
@ -305,25 +228,16 @@ function callSipButtonClicked() {
|
|||
);
|
||||
}
|
||||
|
||||
var Toolbar = (function (my) {
|
||||
|
||||
my.init = function (eventEmitter) {
|
||||
var Toolbar = {
|
||||
init (eventEmitter) {
|
||||
emitter = eventEmitter;
|
||||
UIUtil.hideDisabledButtons(defaultToolbarButtons);
|
||||
|
||||
for(var k in buttonHandlers)
|
||||
$("#" + k).click(buttonHandlers[k]);
|
||||
};
|
||||
},
|
||||
|
||||
/**
|
||||
* Sets shared key
|
||||
* @param sKey the shared key
|
||||
*/
|
||||
my.setSharedKey = function (sKey) {
|
||||
sharedKey = sKey;
|
||||
};
|
||||
|
||||
my.authenticateClicked = function () {
|
||||
authenticateClicked () {
|
||||
Authentication.focusAuthenticationWindow();
|
||||
if (!APP.xmpp.isExternalAuthEnabled()) {
|
||||
Authentication.xmppAuthenticate();
|
||||
|
@ -352,12 +266,12 @@ var Toolbar = (function (my) {
|
|||
}
|
||||
});
|
||||
}
|
||||
};
|
||||
},
|
||||
|
||||
/**
|
||||
* Updates the room invite url.
|
||||
*/
|
||||
my.updateRoomUrl = function (newRoomUrl) {
|
||||
updateRoomUrl (newRoomUrl) {
|
||||
roomUrl = newRoomUrl;
|
||||
|
||||
// If the invite dialog has been already opened we update the information.
|
||||
|
@ -368,75 +282,21 @@ var Toolbar = (function (my) {
|
|||
$('#inviteLinkRef').parent()
|
||||
.find('button[value=true]').prop('disabled', false);
|
||||
}
|
||||
};
|
||||
},
|
||||
|
||||
/**
|
||||
* Disables and enables some of the buttons.
|
||||
*/
|
||||
my.setupButtonsFromConfig = function () {
|
||||
setupButtonsFromConfig () {
|
||||
if (UIUtil.isButtonEnabled('prezi')) {
|
||||
$("#toolbar_button_prezi").css({display: "none"});
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* Opens the lock room dialog.
|
||||
*/
|
||||
my.openLockDialog = function () {
|
||||
// Only the focus is able to set a shared key.
|
||||
if (!APP.xmpp.isModerator()) {
|
||||
if (sharedKey) {
|
||||
messageHandler.openMessageDialog(null,
|
||||
"dialog.passwordError");
|
||||
} else {
|
||||
messageHandler.openMessageDialog(null, "dialog.passwordError2");
|
||||
}
|
||||
} else {
|
||||
if (sharedKey) {
|
||||
messageHandler.openTwoButtonDialog(null, null,
|
||||
"dialog.passwordCheck",
|
||||
null,
|
||||
false,
|
||||
"dialog.Remove",
|
||||
function (e, v) {
|
||||
if (v) {
|
||||
Toolbar.setSharedKey('');
|
||||
lockRoom(false);
|
||||
}
|
||||
});
|
||||
} else {
|
||||
var msg = APP.translation.generateTranslationHTML(
|
||||
"dialog.passwordMsg");
|
||||
var yourPassword = APP.translation.translateString(
|
||||
"dialog.yourPassword");
|
||||
messageHandler.openTwoButtonDialog(null, null, null,
|
||||
'<h2>' + msg + '</h2>' +
|
||||
'<input name="lockKey" type="text"' +
|
||||
' data-i18n="[placeholder]dialog.yourPassword" ' +
|
||||
'placeholder="' + yourPassword + '" autofocus>',
|
||||
false,
|
||||
"dialog.Save",
|
||||
function (e, v, m, f) {
|
||||
if (v) {
|
||||
var lockKey = f.lockKey;
|
||||
|
||||
if (lockKey) {
|
||||
Toolbar.setSharedKey(
|
||||
UIUtil.escapeHtml(lockKey));
|
||||
lockRoom(true);
|
||||
}
|
||||
}
|
||||
},
|
||||
null, null, 'input:first'
|
||||
);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* Opens the invite link dialog.
|
||||
*/
|
||||
my.openLinkDialog = function () {
|
||||
openLinkDialog () {
|
||||
var inviteAttributes;
|
||||
|
||||
if (roomUrl === null) {
|
||||
|
@ -452,10 +312,8 @@ var Toolbar = (function (my) {
|
|||
false,
|
||||
"dialog.Invite",
|
||||
function (e, v) {
|
||||
if (v) {
|
||||
if (roomUrl) {
|
||||
inviteParticipants();
|
||||
}
|
||||
if (v && roomUrl) {
|
||||
emitter.emit(UIEvents.USER_INVITED, roomUrl);
|
||||
}
|
||||
},
|
||||
function (event) {
|
||||
|
@ -468,65 +326,13 @@ var Toolbar = (function (my) {
|
|||
}
|
||||
}
|
||||
);
|
||||
};
|
||||
|
||||
/**
|
||||
* Opens the settings dialog.
|
||||
* FIXME: not used ?
|
||||
*/
|
||||
my.openSettingsDialog = function () {
|
||||
var settings1 = APP.translation.generateTranslationHTML(
|
||||
"dialog.settings1");
|
||||
var settings2 = APP.translation.generateTranslationHTML(
|
||||
"dialog.settings2");
|
||||
var settings3 = APP.translation.generateTranslationHTML(
|
||||
"dialog.settings3");
|
||||
|
||||
var yourPassword = APP.translation.translateString(
|
||||
"dialog.yourPassword");
|
||||
|
||||
messageHandler.openTwoButtonDialog(null,
|
||||
'<h2>' + settings1 + '</h2>' +
|
||||
'<input type="checkbox" id="initMuted">' +
|
||||
settings2 + '<br/>' +
|
||||
'<input type="checkbox" id="requireNicknames">' +
|
||||
settings3 +
|
||||
'<input id="lockKey" type="text" placeholder="' + yourPassword +
|
||||
'" data-i18n="[placeholder]dialog.yourPassword" autofocus>',
|
||||
null,
|
||||
null,
|
||||
false,
|
||||
"dialog.Save",
|
||||
function () {
|
||||
document.getElementById('lockKey').focus();
|
||||
},
|
||||
function (e, v) {
|
||||
if (v) {
|
||||
if ($('#initMuted').is(":checked")) {
|
||||
// it is checked
|
||||
}
|
||||
|
||||
if ($('#requireNicknames').is(":checked")) {
|
||||
// it is checked
|
||||
}
|
||||
/*
|
||||
var lockKey = document.getElementById('lockKey');
|
||||
|
||||
if (lockKey.value) {
|
||||
setSharedKey(lockKey.value);
|
||||
lockRoom(true);
|
||||
}
|
||||
*/
|
||||
}
|
||||
}
|
||||
);
|
||||
};
|
||||
|
||||
/**
|
||||
* Toggles the application in and out of full screen mode
|
||||
* (a.k.a. presentation mode in Chrome).
|
||||
*/
|
||||
my.toggleFullScreen = function () {
|
||||
toggleFullScreen () {
|
||||
var fsElement = document.documentElement;
|
||||
|
||||
if (!document.mozFullScreen && !document.webkitIsFullScreen) {
|
||||
|
@ -545,47 +351,49 @@ var Toolbar = (function (my) {
|
|||
document.webkitCancelFullScreen();
|
||||
}
|
||||
}
|
||||
};
|
||||
},
|
||||
|
||||
/**
|
||||
* Unlocks the lock button state.
|
||||
*/
|
||||
my.unlockLockButton = function () {
|
||||
unlockLockButton () {
|
||||
if ($("#toolbar_button_security").hasClass("icon-security-locked"))
|
||||
UIUtil.buttonClick("#toolbar_button_security", "icon-security icon-security-locked");
|
||||
};
|
||||
},
|
||||
|
||||
/**
|
||||
* Updates the lock button state to locked.
|
||||
*/
|
||||
my.lockLockButton = function () {
|
||||
lockLockButton () {
|
||||
if ($("#toolbar_button_security").hasClass("icon-security"))
|
||||
UIUtil.buttonClick("#toolbar_button_security", "icon-security icon-security-locked");
|
||||
};
|
||||
},
|
||||
|
||||
/**
|
||||
* Shows or hides authentication button
|
||||
* @param show <tt>true</tt> to show or <tt>false</tt> to hide
|
||||
*/
|
||||
my.showAuthenticateButton = function (show) {
|
||||
showAuthenticateButton (show) {
|
||||
if (UIUtil.isButtonEnabled('authentication') && show) {
|
||||
$('#authentication').css({display: "inline"});
|
||||
}
|
||||
else {
|
||||
$('#authentication').css({display: "none"});
|
||||
}
|
||||
};
|
||||
},
|
||||
|
||||
// Shows or hides the 'recording' button.
|
||||
my.showRecordingButton = function (show) {
|
||||
showRecordingButton (show) {
|
||||
if (UIUtil.isButtonEnabled('recording') && show) {
|
||||
$('#toolbar_button_record').css({display: "inline-block"});
|
||||
}
|
||||
else {
|
||||
$('#toolbar_button_record').css({display: "none"});
|
||||
}
|
||||
};
|
||||
},
|
||||
|
||||
// Sets the state of the recording button
|
||||
my.setRecordingButtonState = function (recordingState) {
|
||||
setRecordingButtonState (recordingState) {
|
||||
var selector = $('#toolbar_button_record');
|
||||
|
||||
if (recordingState === 'on') {
|
||||
|
@ -624,48 +432,48 @@ var Toolbar = (function (my) {
|
|||
$('#videoConnectionMessage').text(APP.translation.translateString(recordPendingKey));
|
||||
$('#videoConnectionMessage').css({display: "block"});
|
||||
}
|
||||
};
|
||||
},
|
||||
|
||||
// checks whether recording is enabled and whether we have params
|
||||
// to start automatically recording
|
||||
my.checkAutoRecord = function () {
|
||||
checkAutoRecord () {
|
||||
if (UIUtil.isButtonEnabled('recording') && config.autoRecord) {
|
||||
toggleRecording(config.autoRecordToken);
|
||||
}
|
||||
};
|
||||
},
|
||||
|
||||
// checks whether desktop sharing is enabled and whether
|
||||
// we have params to start automatically sharing
|
||||
my.checkAutoEnableDesktopSharing = function () {
|
||||
checkAutoEnableDesktopSharing () {
|
||||
if (UIUtil.isButtonEnabled('desktop')
|
||||
&& config.autoEnableDesktopSharing) {
|
||||
APP.desktopsharing.toggleScreenSharing();
|
||||
}
|
||||
};
|
||||
},
|
||||
|
||||
// Shows or hides SIP calls button
|
||||
my.showSipCallButton = function (show) {
|
||||
showSipCallButton (show) {
|
||||
if (APP.xmpp.isSipGatewayEnabled() && UIUtil.isButtonEnabled('sip') && show) {
|
||||
$('#toolbar_button_sip').css({display: "inline-block"});
|
||||
} else {
|
||||
$('#toolbar_button_sip').css({display: "none"});
|
||||
}
|
||||
};
|
||||
},
|
||||
|
||||
// Shows or hides the dialpad button
|
||||
my.showDialPadButton = function (show) {
|
||||
showDialPadButton (show) {
|
||||
if (UIUtil.isButtonEnabled('dialpad') && show) {
|
||||
$('#toolbar_button_dialpad').css({display: "inline-block"});
|
||||
} else {
|
||||
$('#toolbar_button_dialpad').css({display: "none"});
|
||||
}
|
||||
};
|
||||
},
|
||||
|
||||
/**
|
||||
* Displays user authenticated identity name(login).
|
||||
* @param authIdentity identity name to be displayed.
|
||||
*/
|
||||
my.setAuthenticatedIdentity = function (authIdentity) {
|
||||
setAuthenticatedIdentity (authIdentity) {
|
||||
if (authIdentity) {
|
||||
var selector = $('#toolbar_auth_identity');
|
||||
selector.css({display: "list-item"});
|
||||
|
@ -673,47 +481,45 @@ var Toolbar = (function (my) {
|
|||
} else {
|
||||
$('#toolbar_auth_identity').css({display: "none"});
|
||||
}
|
||||
};
|
||||
},
|
||||
|
||||
/**
|
||||
* Shows/hides login button.
|
||||
* @param show <tt>true</tt> to show
|
||||
*/
|
||||
my.showLoginButton = function (show) {
|
||||
showLoginButton (show) {
|
||||
if (UIUtil.isButtonEnabled('authentication') && show) {
|
||||
$('#toolbar_button_login').css({display: "list-item"});
|
||||
} else {
|
||||
$('#toolbar_button_login').css({display: "none"});
|
||||
}
|
||||
};
|
||||
},
|
||||
|
||||
/**
|
||||
* Shows/hides logout button.
|
||||
* @param show <tt>true</tt> to show
|
||||
*/
|
||||
my.showLogoutButton = function (show) {
|
||||
showLogoutButton (show) {
|
||||
if (UIUtil.isButtonEnabled('authentication') && show) {
|
||||
$('#toolbar_button_logout').css({display: "list-item"});
|
||||
} else {
|
||||
$('#toolbar_button_logout').css({display: "none"});
|
||||
}
|
||||
};
|
||||
},
|
||||
|
||||
/**
|
||||
* Sets the state of the button. The button has blue glow if desktop
|
||||
* streaming is active.
|
||||
* @param active the state of the desktop streaming.
|
||||
*/
|
||||
my.changeDesktopSharingButtonState = function (active) {
|
||||
changeDesktopSharingButtonState (active) {
|
||||
var button = $("#toolbar_button_desktopsharing");
|
||||
if (active) {
|
||||
button.addClass("glow");
|
||||
} else {
|
||||
button.removeClass("glow");
|
||||
}
|
||||
};
|
||||
}
|
||||
};
|
||||
|
||||
return my;
|
||||
}(Toolbar || {}));
|
||||
|
||||
module.exports = Toolbar;
|
||||
export default Toolbar;
|
||||
|
|
|
@ -23,6 +23,8 @@ var UIEvents = {
|
|||
VIDEO_MUTED: "UI.video_muted",
|
||||
PREZI_CLICKED: "UI.prezi_clicked",
|
||||
ETHERPAD_CLICKED: "UI.etherpad_clicked",
|
||||
ROOM_LOCK_CLICKED: "UI.room_lock_clicked",
|
||||
USER_INVITED: "UI.user_invited",
|
||||
/**
|
||||
* Notifies interested parties when the film strip (remote video's panel)
|
||||
* is hidden (toggled) or shown (un-toggled).
|
||||
|
|
Loading…
Reference in New Issue