Updates invite link if the window has been already opened before it was available (Closes issue #70). Adds an invite button, which generates an invite email to be sent to other participants.

This commit is contained in:
yanas 2014-05-22 18:56:09 +02:00
parent 4d0c74879a
commit d835887fa9
2 changed files with 64 additions and 12 deletions

72
app.js
View File

@ -677,7 +677,8 @@ $(document).bind('presence.muc', function (event, jid, info, pres) {
showDisplayName('localVideoContainer', info.displayName + ' (me)');
} else {
ensurePeerContainerExists(jid);
showDisplayName('participant_' + Strophe.getResourceFromJid(jid), info.displayName);
showDisplayName('participant_' + Strophe.getResourceFromJid(jid),
info.displayName);
}
}
});
@ -1287,22 +1288,61 @@ function openLockDialog() {
* Opens the invite link dialog.
*/
function openLinkDialog() {
var inviteLink;
if (roomUrl == null)
openMessageDialog( "Invite others",
"Your conference is currently being created."
+ " Please try again in a few seconds.");
inviteLink = "Your conference is currently being created...";
else
$.prompt('<input id="inviteLinkRef" type="text" value="' +
encodeURI(roomUrl) + '" onclick="this.select();" readonly>',
{
title: "Share this link with everyone you want to invite",
persistent: false,
buttons: { "Cancel": false},
loaded: function (event) {
inviteLink = encodeURI(roomUrl);
$.prompt('<input id="inviteLinkRef" type="text" value="' +
inviteLink + '" onclick="this.select();" readonly>',
{
title: "Share this link with everyone you want to invite",
persistent: false,
buttons: { "Invite": true, "Cancel": false},
defaultButton: 1,
loaded: function (event) {
if (roomUrl)
document.getElementById('inviteLinkRef').select();
else
document.getElementById('jqi_state0_buttonInvite')
.disabled = true;
},
submit: function (e, v, m, f) {
if (v) {
if (roomUrl) {
inviteParticipants();
}
}
}
);
}
);
}
/**
* Invite participants to conference.
*/
function inviteParticipants() {
if (roomUrl == null)
return;
var conferenceName = roomUrl.substring(roomUrl.lastIndexOf('/') + 1);
var subject = "Invitation to a Jitsi Meet (" + conferenceName + ")";
var body = "Hey there, I%27d like to invite you to a Jitsi Meet"
+ " conference I%27ve just set up.%0D%0A%0D%0A"
+ "Please click on the following link in order"
+ " to join the conference.%0D%0A%0D%0A"
+ roomUrl + "%0D%0A%0D%0A"
+ "Note that Jitsi Meet is currently only supported by Chromim,"
+ " Google Chrome and Opera, so you need"
+ " to be using one of these browsers.%0D%0A%0D%0A"
+ "Talk to you in a sec!";
if (window.localStorage.displayname)
body += "%0D%0A%0D%0A" + window.localStorage.displayname;
window.location.href
= "mailto:?subject=" + subject + "&body=" + body;
}
/**
@ -1448,6 +1488,14 @@ function dockToolbar(isDock) {
*/
function updateRoomUrl(newRoomUrl) {
roomUrl = newRoomUrl;
// If the invite dialog has been already opened we update the information.
var inviteLink = document.getElementById('inviteLinkRef');
if (inviteLink) {
inviteLink.value = roomUrl;
inviteLink.select();
document.getElementById('jqi_state0_buttonInvite').disabled = false;
}
}
/**

View File

@ -66,6 +66,10 @@ div.jqi .jqibuttons button{
div.jqi .jqibuttons button.jqidefaultbutton{
color: #489afe;
}
div.jqi .jqibuttons button:disabled {
color: #b6b6b6 !important;
}
div.jqi .jqibuttons button:hover,
div.jqi .jqibuttons button:focus{
color: #287ade;