|
@@ -3,7 +3,6 @@
|
3
|
3
|
var messageHandler = require("../util/MessageHandler");
|
4
|
4
|
var UIUtil = require("../util/UIUtil");
|
5
|
5
|
var AnalyticsAdapter = require("../../statistics/AnalyticsAdapter");
|
6
|
|
-var Feedback = require("../Feedback");
|
7
|
6
|
var UIEvents = require("../../../service/UI/UIEvents");
|
8
|
7
|
|
9
|
8
|
var roomUrl = null;
|
|
@@ -110,7 +109,7 @@ const buttonHandlers = {
|
110
|
109
|
},
|
111
|
110
|
"toolbar_button_record": function () {
|
112
|
111
|
AnalyticsAdapter.sendEvent('toolbar.recording.toggled');
|
113
|
|
- toggleRecording();
|
|
112
|
+ emitter.emit(UIEvents.RECORDING_TOGGLE);
|
114
|
113
|
},
|
115
|
114
|
"toolbar_button_security": function () {
|
116
|
115
|
emitter.emit(UIEvents.ROOM_LOCK_CLICKED);
|
|
@@ -146,7 +145,7 @@ const buttonHandlers = {
|
146
|
145
|
},
|
147
|
146
|
"toolbar_button_sip": function () {
|
148
|
147
|
AnalyticsAdapter.sendEvent('toolbar.sip.clicked');
|
149
|
|
- callSipButtonClicked();
|
|
148
|
+ showSipNumberInput();
|
150
|
149
|
},
|
151
|
150
|
"toolbar_button_dialpad": function () {
|
152
|
151
|
AnalyticsAdapter.sendEvent('toolbar.sip.dialpad.clicked');
|
|
@@ -158,7 +157,7 @@ const buttonHandlers = {
|
158
|
157
|
},
|
159
|
158
|
"toolbar_button_hangup": function () {
|
160
|
159
|
AnalyticsAdapter.sendEvent('toolbar.hangup');
|
161
|
|
- hangup();
|
|
160
|
+ emitter.emit(UIEvents.HANGUP);
|
162
|
161
|
},
|
163
|
162
|
"toolbar_button_login": function () {
|
164
|
163
|
AnalyticsAdapter.sendEvent('toolbar.authenticate.login.clicked');
|
|
@@ -176,15 +175,10 @@ const buttonHandlers = {
|
176
|
175
|
"dialog.Yes",
|
177
|
176
|
function (evt, yes) {
|
178
|
177
|
if (yes) {
|
179
|
|
- APP.xmpp.logout(function (url) {
|
180
|
|
- if (url) {
|
181
|
|
- window.location.href = url;
|
182
|
|
- } else {
|
183
|
|
- hangup();
|
184
|
|
- }
|
185
|
|
- });
|
|
178
|
+ emitter.emit(UIEvents.LOGOUT);
|
186
|
179
|
}
|
187
|
|
- });
|
|
180
|
+ }
|
|
181
|
+ );
|
188
|
182
|
}
|
189
|
183
|
};
|
190
|
184
|
var defaultToolbarButtons = {
|
|
@@ -201,85 +195,11 @@ var defaultToolbarButtons = {
|
201
|
195
|
'hangup': '#toolbar_button_hangup'
|
202
|
196
|
};
|
203
|
197
|
|
204
|
|
-/**
|
205
|
|
- * Hangs up this call.
|
206
|
|
- */
|
207
|
|
-function hangup() {
|
208
|
|
- var conferenceDispose = function () {
|
209
|
|
- APP.xmpp.disposeConference();
|
210
|
|
-
|
211
|
|
- if (config.enableWelcomePage) {
|
212
|
|
- setTimeout(function() {
|
213
|
|
- window.localStorage.welcomePageDisabled = false;
|
214
|
|
- window.location.pathname = "/";
|
215
|
|
- }, 3000);
|
216
|
|
- }
|
217
|
|
- };
|
218
|
|
-
|
219
|
|
- if (Feedback.isEnabled()) {
|
220
|
|
- // If the user has already entered feedback, we'll show the window and
|
221
|
|
- // immidiately start the conference dispose timeout.
|
222
|
|
- if (Feedback.feedbackScore > 0) {
|
223
|
|
- Feedback.openFeedbackWindow();
|
224
|
|
- conferenceDispose();
|
225
|
|
-
|
226
|
|
- }
|
227
|
|
- // Otherwise we'll wait for user's feedback.
|
228
|
|
- else
|
229
|
|
- Feedback.openFeedbackWindow(conferenceDispose);
|
230
|
|
- }
|
231
|
|
- else {
|
232
|
|
- conferenceDispose();
|
233
|
|
-
|
234
|
|
- // If the feedback functionality isn't enabled we show a thank you
|
235
|
|
- // dialog.
|
236
|
|
- messageHandler.openMessageDialog(null, null, null,
|
237
|
|
- APP.translation.translateString("dialog.thankYou",
|
238
|
|
- {appName:interfaceConfig.APP_NAME}));
|
239
|
|
- }
|
240
|
|
-}
|
241
|
|
-
|
242
|
|
-/**
|
243
|
|
- * Starts or stops the recording for the conference.
|
244
|
|
- */
|
245
|
|
-function toggleRecording(predefinedToken) {
|
246
|
|
- APP.xmpp.toggleRecording(function (callback) {
|
247
|
|
- if (predefinedToken) {
|
248
|
|
- callback(UIUtil.escapeHtml(predefinedToken));
|
249
|
|
- return;
|
250
|
|
- }
|
251
|
|
-
|
252
|
|
- var msg = APP.translation.generateTranslationHTML(
|
253
|
|
- "dialog.recordingToken");
|
254
|
|
- var token = APP.translation.translateString("dialog.token");
|
255
|
|
- messageHandler.openTwoButtonDialog(null, null, null,
|
256
|
|
- '<h2>' + msg + '</h2>' +
|
257
|
|
- '<input name="recordingToken" type="text" ' +
|
258
|
|
- ' data-i18n="[placeholder]dialog.token" ' +
|
259
|
|
- 'placeholder="' + token + '" autofocus>',
|
260
|
|
- false,
|
261
|
|
- "dialog.Save",
|
262
|
|
- function (e, v, m, f) {
|
263
|
|
- if (v) {
|
264
|
|
- var token = f.recordingToken;
|
265
|
|
-
|
266
|
|
- if (token) {
|
267
|
|
- callback(UIUtil.escapeHtml(token));
|
268
|
|
- }
|
269
|
|
- }
|
270
|
|
- },
|
271
|
|
- null,
|
272
|
|
- function () { },
|
273
|
|
- ':input:first'
|
274
|
|
- );
|
275
|
|
- }, setRecordingButtonState);
|
276
|
|
-}
|
277
|
|
-
|
278
|
198
|
function dialpadButtonClicked() {
|
279
|
199
|
//TODO show the dialpad box
|
280
|
200
|
}
|
281
|
201
|
|
282
|
|
-function callSipButtonClicked() {
|
|
202
|
+function showSipNumberInput () {
|
283
|
203
|
let defaultNumber = config.defaultSipNumber
|
284
|
204
|
? config.defaultSipNumber
|
285
|
205
|
: '';
|
|
@@ -291,11 +211,8 @@ function callSipButtonClicked() {
|
291
|
211
|
<input name="sipNumber" type="text" value="${defaultNumber}" autofocus>`,
|
292
|
212
|
false, "dialog.Dial",
|
293
|
213
|
function (e, v, m, f) {
|
294
|
|
- if (v) {
|
295
|
|
- var numberInput = f.sipNumber;
|
296
|
|
- if (numberInput) {
|
297
|
|
- APP.xmpp.dial(numberInput, 'fromnumber', APP.conference.roomName, APP.conference.sharedKey);
|
298
|
|
- }
|
|
214
|
+ if (v && f.sipNumber) {
|
|
215
|
+ emitter.emit(UIEvents.SIP_DIAL, f.sipNumber);
|
299
|
216
|
}
|
300
|
217
|
},
|
301
|
218
|
null, null, ':input:first'
|
|
@@ -379,7 +296,7 @@ const Toolbar = {
|
379
|
296
|
// to start automatically recording
|
380
|
297
|
checkAutoRecord () {
|
381
|
298
|
if (UIUtil.isButtonEnabled('recording') && config.autoRecord) {
|
382
|
|
- toggleRecording(config.autoRecordToken);
|
|
299
|
+ emitter.emit(UIEvents.RECORDING_TOGGLE, UIUtil.escapeHtml(config.autoRecordToken));
|
383
|
300
|
}
|
384
|
301
|
},
|
385
|
302
|
|
|
@@ -394,7 +311,7 @@ const Toolbar = {
|
394
|
311
|
|
395
|
312
|
// Shows or hides SIP calls button
|
396
|
313
|
showSipCallButton (show) {
|
397
|
|
- if (APP.xmpp.isSipGatewayEnabled() && UIUtil.isButtonEnabled('sip') && show) {
|
|
314
|
+ if (APP.conference.sipGatewayEnabled && UIUtil.isButtonEnabled('sip') && show) {
|
398
|
315
|
$('#toolbar_button_sip').css({display: "inline-block"});
|
399
|
316
|
} else {
|
400
|
317
|
$('#toolbar_button_sip').css({display: "none"});
|
|
@@ -460,6 +377,10 @@ const Toolbar = {
|
460
|
377
|
} else {
|
461
|
378
|
button.removeClass("glow");
|
462
|
379
|
}
|
|
380
|
+ },
|
|
381
|
+
|
|
382
|
+ updateRecordingState (state) {
|
|
383
|
+ setRecordingButtonState(state);
|
463
|
384
|
}
|
464
|
385
|
};
|
465
|
386
|
|