2009-12-24 10:01:26 +08:00
|
|
|
<!--
|
|
|
|
|
|
|
|
BigBlueButton - http://www.bigbluebutton.org
|
|
|
|
|
|
|
|
Copyright (c) 2008-2009 by respective authors (see below). All rights reserved.
|
|
|
|
|
|
|
|
BigBlueButton is free software; you can redistribute it and/or modify it under the
|
|
|
|
terms of the GNU Lesser General Public License as published by the Free Software
|
|
|
|
Foundation; either version 3 of the License, or (at your option) any later
|
|
|
|
version.
|
|
|
|
|
|
|
|
BigBlueButton is distributed in the hope that it will be useful, but WITHOUT ANY
|
|
|
|
WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
|
|
|
|
PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
|
|
|
|
|
|
|
|
You should have received a copy of the GNU Lesser General Public License along
|
|
|
|
with BigBlueButton; if not, If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
|
|
|
|
Author: Fred Dixon <ffdixon@bigbluebutton.org>
|
2009-12-31 02:36:20 +08:00
|
|
|
|
2009-12-24 10:01:26 +08:00
|
|
|
-->
|
|
|
|
<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
|
|
|
|
pageEncoding="ISO-8859-1"%>
|
|
|
|
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
|
|
|
|
<html>
|
|
|
|
<head>
|
|
|
|
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
|
2010-01-02 07:08:21 +08:00
|
|
|
<meta http-equiv="X-UA-Compatible" content="IE=EmulateIE7" />
|
2009-12-31 02:36:20 +08:00
|
|
|
<title>API Demo - 3</title>
|
|
|
|
|
2010-01-01 05:07:22 +08:00
|
|
|
<script type="text/javascript"
|
|
|
|
src="http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.min.js"></script>
|
2009-12-31 02:36:20 +08:00
|
|
|
<script type="text/javascript" src="heartbeat.js"></script>
|
|
|
|
|
|
|
|
|
2009-12-24 10:01:26 +08:00
|
|
|
</head>
|
|
|
|
<body>
|
|
|
|
|
|
|
|
|
2009-12-31 02:36:20 +08:00
|
|
|
<%@ include file="bbb_api.jsp"%>
|
|
|
|
<%@ include file="demo_header.jsp"%>
|
2009-12-24 10:01:26 +08:00
|
|
|
|
2010-01-01 05:07:22 +08:00
|
|
|
<%@ page import="java.util.regex.*"%>
|
2009-12-31 02:36:20 +08:00
|
|
|
|
|
|
|
<br>
|
2009-12-24 10:01:26 +08:00
|
|
|
|
|
|
|
<%
|
|
|
|
if (request.getParameterMap().isEmpty()) {
|
|
|
|
//
|
|
|
|
// Assume we want to create a meeting
|
|
|
|
//
|
|
|
|
%>
|
|
|
|
|
2009-12-31 02:36:20 +08:00
|
|
|
<hr />
|
2010-01-01 05:48:15 +08:00
|
|
|
<h2>Demo #3: Create a You Own Meeting.</h2>
|
2009-12-31 02:36:20 +08:00
|
|
|
<hr />
|
2009-12-24 10:01:26 +08:00
|
|
|
|
2009-12-31 02:36:20 +08:00
|
|
|
<p />
|
|
|
|
<FORM NAME="form1" METHOD="GET">
|
2009-12-24 10:01:26 +08:00
|
|
|
|
2009-12-31 02:36:20 +08:00
|
|
|
<table width=600 cellspacing="20" cellpadding="20"
|
|
|
|
style="border-collapse: collapse; border-right-color: rgb(136, 136, 136);"
|
|
|
|
border=3>
|
|
|
|
<tbody>
|
|
|
|
<tr>
|
2010-01-01 06:17:06 +08:00
|
|
|
<td width="50%">Create your own meeting.
|
2009-12-31 02:36:20 +08:00
|
|
|
<p />
|
|
|
|
</td>
|
2010-01-01 06:17:06 +08:00
|
|
|
<td width="50%">Step 1. Enter your name: <input type="text"
|
2010-01-01 05:07:22 +08:00
|
|
|
name="username1" /> <br />
|
|
|
|
<INPUT TYPE=hidden NAME=action VALUE="create"> <br />
|
|
|
|
<input id="submit-button" type="submit" value="Create meeting" /></td>
|
2009-12-31 02:36:20 +08:00
|
|
|
</tr>
|
|
|
|
</tbody>
|
2009-12-24 10:01:26 +08:00
|
|
|
</table>
|
|
|
|
|
|
|
|
</FORM>
|
|
|
|
|
2010-01-01 05:07:22 +08:00
|
|
|
<script>
|
|
|
|
$(document).ready(function(){
|
|
|
|
$("input[name='username1']").keyup(function() {
|
|
|
|
if ($("input[name='username1']").val() == "") {
|
|
|
|
$("#submit-button").attr('value',"Create meeting" );
|
|
|
|
} else {
|
|
|
|
$("#submit-button").attr('value',"Create " +$("input[name='username1']").val()+ "'s meeting" );
|
|
|
|
}
|
|
|
|
});
|
|
|
|
});
|
|
|
|
</script>
|
2009-12-24 10:01:26 +08:00
|
|
|
|
2009-12-31 02:36:20 +08:00
|
|
|
<%
|
2009-12-24 10:01:26 +08:00
|
|
|
} else if (request.getParameter("action").equals("create")) {
|
|
|
|
//
|
2009-12-31 02:36:20 +08:00
|
|
|
// User has requested to create a meeting
|
2009-12-24 10:01:26 +08:00
|
|
|
//
|
|
|
|
|
2010-01-01 05:07:22 +08:00
|
|
|
String username = request.getParameter("username1");
|
2009-12-31 06:53:57 +08:00
|
|
|
String meetingID = URLEncoder.encode(username+"'s meeting","UTF-8");
|
2009-12-31 02:36:20 +08:00
|
|
|
|
|
|
|
String meetingToken = "";
|
|
|
|
|
2009-12-31 06:53:57 +08:00
|
|
|
String joinURL = getJoinURL(URLEncoder.encode(username,"UTF-8"), meetingID);
|
2009-12-31 02:36:20 +08:00
|
|
|
|
|
|
|
String p = "meetingToken=[^&]*";
|
|
|
|
Pattern pattern =
|
|
|
|
Pattern.compile( p );
|
|
|
|
|
|
|
|
Matcher matcher =
|
|
|
|
pattern.matcher( joinURL );
|
|
|
|
|
|
|
|
if (matcher.find()) {
|
|
|
|
meetingToken = joinURL.substring(matcher.start(), matcher.end());
|
|
|
|
} else {
|
|
|
|
out.print("Error: Did not find meeting token.");
|
|
|
|
}
|
|
|
|
//out.print ("Match : " + meetingToken );
|
|
|
|
String inviteURL = BigBlueButtonURL+"demo/demo3.jsp?action=invite&meetingID="+meetingID+"&"+meetingToken;
|
2009-12-24 10:01:26 +08:00
|
|
|
|
|
|
|
%>
|
2009-12-31 02:36:20 +08:00
|
|
|
|
|
|
|
<hr />
|
2010-01-01 06:17:06 +08:00
|
|
|
<h2>Meeting Created</h2>
|
2009-12-31 02:36:20 +08:00
|
|
|
<hr />
|
|
|
|
|
|
|
|
|
|
|
|
<table width="800" cellspacing="20" cellpadding="20"
|
|
|
|
style="border-collapse: collapse; border-right-color: rgb(136, 136, 136);"
|
|
|
|
border=3>
|
|
|
|
<tbody>
|
|
|
|
<tr>
|
|
|
|
<td width="50%">
|
|
|
|
<center><strong> <%=username %>'s meeting</strong> has been
|
|
|
|
created.</center>
|
|
|
|
</td>
|
|
|
|
|
2010-01-01 05:07:22 +08:00
|
|
|
<td width="50%">
|
2010-01-02 07:08:21 +08:00
|
|
|
<p> </p>
|
2010-01-01 05:07:22 +08:00
|
|
|
|
|
|
|
Step 2. Invite others using the following <a
|
2009-12-31 06:53:57 +08:00
|
|
|
href="<%=inviteURL%>">link</a>:
|
2010-01-01 05:07:22 +08:00
|
|
|
<form name="form2" method="POST"><textarea cols="60" rows="5"
|
2009-12-31 02:36:20 +08:00
|
|
|
name="myname" style="overflow: hidden">
|
2009-12-24 10:01:26 +08:00
|
|
|
<%=inviteURL%>
|
2009-12-31 02:36:20 +08:00
|
|
|
</textarea></form>
|
2010-01-02 07:08:21 +08:00
|
|
|
<p> <p />
|
2010-01-01 06:17:06 +08:00
|
|
|
Step 3. Click the following link to start your meeting:
|
2010-01-02 07:08:21 +08:00
|
|
|
<p> </p>
|
2010-01-01 05:07:22 +08:00
|
|
|
<center><a href="<%=joinURL%>">Start Meeting</a></center>
|
2010-01-02 07:08:21 +08:00
|
|
|
<p> </p>
|
2010-01-01 05:07:22 +08:00
|
|
|
|
2009-12-31 02:36:20 +08:00
|
|
|
</td>
|
|
|
|
</tr>
|
|
|
|
</tbody>
|
2009-12-24 10:01:26 +08:00
|
|
|
</table>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2009-12-31 02:36:20 +08:00
|
|
|
|
|
|
|
<%
|
2009-12-24 10:01:26 +08:00
|
|
|
|
2009-12-31 05:29:08 +08:00
|
|
|
} else if (request.getParameter("action").equals("enter")) {
|
2010-01-02 07:08:21 +08:00
|
|
|
//
|
|
|
|
// The user is now attempting to joing the meeting
|
|
|
|
//
|
2009-12-24 10:01:26 +08:00
|
|
|
String meetingID = request.getParameter("meetingID");
|
2009-12-31 05:29:08 +08:00
|
|
|
String username = request.getParameter("username");
|
2009-12-31 02:36:20 +08:00
|
|
|
String meetingToken = request.getParameter("meetingToken");
|
2009-12-31 06:53:57 +08:00
|
|
|
|
|
|
|
String enterURL = BigBlueButtonURL+"demo/demo3.jsp?action=join&username="+URLEncoder.encode(username,"UTF-8")+"&meetingID="+URLEncoder.encode(meetingID,"UTF-8");
|
2010-01-01 05:07:22 +08:00
|
|
|
|
2009-12-31 02:36:20 +08:00
|
|
|
|
2009-12-31 06:53:57 +08:00
|
|
|
if ( isMeetingRunning( meetingToken, URLEncoder.encode(meetingID,"UTF-8")).equals("true") ) {
|
2009-12-31 02:36:20 +08:00
|
|
|
//
|
2010-01-02 07:08:21 +08:00
|
|
|
// The meeting has started -- bring the user into the meeting.
|
2009-12-31 02:36:20 +08:00
|
|
|
//
|
2010-01-01 05:07:22 +08:00
|
|
|
%>
|
2009-12-31 02:36:20 +08:00
|
|
|
<script type="text/javascript">
|
|
|
|
window.location = "<%=enterURL %>";
|
|
|
|
</script>
|
|
|
|
<%
|
|
|
|
} else {
|
|
|
|
//
|
2010-01-02 07:08:21 +08:00
|
|
|
// The meeting has not yet started, so check until we get back the status that the meeting is running
|
2009-12-31 02:36:20 +08:00
|
|
|
//
|
2009-12-31 06:53:57 +08:00
|
|
|
String checkMeetingStatus = getURLisMeetingRunning(meetingToken, URLEncoder.encode(meetingID,"UTF-8") );
|
2009-12-31 02:36:20 +08:00
|
|
|
|
2009-12-24 10:01:26 +08:00
|
|
|
%>
|
2009-12-31 02:36:20 +08:00
|
|
|
|
|
|
|
<script type="text/javascript">
|
|
|
|
$(document).ready(function(){
|
|
|
|
$.jheartbeat.set({
|
|
|
|
url: "<%=checkMeetingStatus%>",
|
|
|
|
delay: 5000
|
|
|
|
}, function () {
|
|
|
|
mycallback();
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
function mycallback() {
|
2010-01-02 07:08:21 +08:00
|
|
|
// Not elegant, but works around a bug in IE8
|
|
|
|
var isMeetingRunning = ($("#HeartBeatDIV").text().search("true") > 0 );
|
|
|
|
|
|
|
|
if ( isMeetingRunning ) {
|
2009-12-31 02:36:20 +08:00
|
|
|
window.location = "<%=enterURL %>";
|
|
|
|
}
|
|
|
|
}
|
|
|
|
</script>
|
2009-12-24 10:01:26 +08:00
|
|
|
|
2009-12-31 02:36:20 +08:00
|
|
|
<hr />
|
2010-01-01 05:07:22 +08:00
|
|
|
<h2><strong><%=meetingID %></strong> has not yet started.</h2>
|
2009-12-31 02:36:20 +08:00
|
|
|
<hr />
|
2009-12-24 10:01:26 +08:00
|
|
|
|
|
|
|
|
2009-12-31 02:36:20 +08:00
|
|
|
<table width=600 cellspacing="20" cellpadding="20"
|
|
|
|
style="border-collapse: collapse; border-right-color: rgb(136, 136, 136);"
|
|
|
|
border=3>
|
|
|
|
<tbody>
|
|
|
|
<tr>
|
|
|
|
<td width="50%">
|
|
|
|
|
2010-01-01 05:07:22 +08:00
|
|
|
<p>Hi <%=username %>,</p>
|
|
|
|
<p>Now waiting for the moderator to start <strong><%=meetingID %></strong>.</p>
|
|
|
|
<br />
|
|
|
|
<p>(Your browser will automatically refresh and join the meeting when it starts.)</p>
|
2009-12-31 02:36:20 +08:00
|
|
|
</td>
|
2010-01-01 05:07:22 +08:00
|
|
|
<td width="50%"><img src="polling.gif"></img></td>
|
2009-12-31 02:36:20 +08:00
|
|
|
</tr>
|
|
|
|
</tbody>
|
|
|
|
</table>
|
|
|
|
|
|
|
|
|
|
|
|
<%
|
|
|
|
}
|
2009-12-31 05:29:08 +08:00
|
|
|
} else if (request.getParameter("action").equals("invite")) {
|
2009-12-31 02:36:20 +08:00
|
|
|
//
|
|
|
|
// We have an invite to an active meeting. Ask the person for their name
|
|
|
|
// so they can join.
|
|
|
|
//
|
|
|
|
String meetingID = request.getParameter("meetingID");
|
|
|
|
String meetingToken = request.getParameter("meetingToken");
|
2009-12-24 10:01:26 +08:00
|
|
|
|
|
|
|
|
2009-12-31 02:36:20 +08:00
|
|
|
%>
|
|
|
|
|
|
|
|
<hr />
|
2010-01-01 06:17:06 +08:00
|
|
|
<h2>Invite</h2>
|
2009-12-31 02:36:20 +08:00
|
|
|
<hr />
|
|
|
|
|
2010-01-01 05:07:22 +08:00
|
|
|
<FORM NAME="form3" METHOD="GET">
|
2009-12-31 02:36:20 +08:00
|
|
|
|
|
|
|
<table width=600 cellspacing="20" cellpadding="20"
|
|
|
|
style="border-collapse: collapse; border-right-color: rgb(136, 136, 136);"
|
|
|
|
border=3>
|
|
|
|
<tbody>
|
|
|
|
<tr>
|
2010-01-01 05:07:22 +08:00
|
|
|
<td width="50%">
|
|
|
|
|
2010-01-01 06:17:06 +08:00
|
|
|
<p />You have been invited to join<br/><strong><%=meetingID %></strong>.
|
2009-12-31 02:36:20 +08:00
|
|
|
</td>
|
2010-01-01 05:07:22 +08:00
|
|
|
|
|
|
|
<td width="50%">Enter your name: <input type="text"
|
|
|
|
name="username" /> <br />
|
|
|
|
<INPUT TYPE=hidden NAME=meetingID VALUE="<%=meetingID %>"> <INPUT
|
|
|
|
TYPE=hidden NAME=meetingToken VALUE="<%=meetingToken %>"> <INPUT
|
|
|
|
TYPE=hidden NAME=action VALUE="enter"> <br />
|
|
|
|
<input type="submit" value="Join" /></td>
|
2009-12-31 02:36:20 +08:00
|
|
|
</tr>
|
|
|
|
</tbody>
|
2009-12-24 10:01:26 +08:00
|
|
|
</table>
|
|
|
|
|
|
|
|
</FORM>
|
|
|
|
|
|
|
|
|
|
|
|
|
2009-12-31 02:36:20 +08:00
|
|
|
|
|
|
|
<%
|
2009-12-24 10:01:26 +08:00
|
|
|
} else if (request.getParameter("action").equals("join")) {
|
|
|
|
//
|
2009-12-31 05:29:08 +08:00
|
|
|
// We have an invite request to join an existing meeting and the meeting is running
|
2009-12-24 10:01:26 +08:00
|
|
|
//
|
2009-12-31 06:53:57 +08:00
|
|
|
String username = URLEncoder.encode(request.getParameter("username"),"UTF-8");
|
2009-12-24 10:01:26 +08:00
|
|
|
String meetingID = URLEncoder.encode(request.getParameter("meetingID"),"UTF-8");
|
2009-12-31 02:36:20 +08:00
|
|
|
String joinURL = getJoinURL(username, meetingID);
|
2009-12-24 10:01:26 +08:00
|
|
|
%>
|
2009-12-31 02:36:20 +08:00
|
|
|
|
2009-12-31 05:09:59 +08:00
|
|
|
<script language="javascript" type="text/javascript">
|
|
|
|
window.location.href="<%=joinURL%>";
|
|
|
|
</script>
|
2009-12-24 10:01:26 +08:00
|
|
|
|
2009-12-31 02:36:20 +08:00
|
|
|
<% } %>
|
|
|
|
|
|
|
|
<%@ include file="demo_footer.jsp"%>
|
2009-12-24 10:01:26 +08:00
|
|
|
|
|
|
|
</body>
|
|
|
|
</html>
|