Maven structure for bbb-api-demo. Copied jsp files from last bbb-api-demo and

bigbluebutton-web in different folders. Both has repeated names for jsp.
This commit is contained in:
root 2011-05-26 10:17:59 +00:00
parent 12c5b34cea
commit bf4b0d2bf0
42 changed files with 5969 additions and 0 deletions

21
bbb-api-demo/pom.xml Normal file
View File

@ -0,0 +1,21 @@
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>bigbluebutton</groupId>
<artifactId>bbb-api-demo</artifactId>
<packaging>war</packaging>
<version>0.8-PRE</version>
<name>bbb-api-demo Maven Webapp</name>
<url>http://maven.apache.org</url>
<dependencies>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>3.8.1</version>
<scope>test</scope>
</dependency>
</dependencies>
<build>
<finalName>bbb-api-demo</finalName>
</build>
</project>

View File

@ -0,0 +1,7 @@
<!DOCTYPE web-app PUBLIC
"-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN"
"http://java.sun.com/dtd/web-app_2_3.dtd" >
<web-app>
<display-name>Archetype Created Web Application</display-name>
</web-app>

View File

@ -0,0 +1,579 @@
<%/*
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>
*/%>
<%@page import="javax.xml.transform.dom.DOMSource"%>
<%@page import="javax.xml.transform.stream.StreamResult"%>
<%@page import="javax.xml.transform.OutputKeys"%>
<%@page import="javax.xml.transform.TransformerFactory"%>
<%@page import="javax.xml.transform.Transformer"%>
<%@page import="org.w3c.dom.Element"%>
<%@page import="com.sun.org.apache.xerces.internal.dom.ChildNode"%>
<%@page import="org.w3c.dom.Node"%>
<%@page import="org.w3c.dom.NodeList"%>
<%@page import="java.util.*,java.io.*,java.net.*,javax.crypto.*,javax.xml.parsers.*,org.w3c.dom.Document,org.xml.sax.*" errorPage="error.jsp"%>
<%@ page import="org.apache.commons.codec.digest.*"%>
<%@ page import="java.io.*"%>
<%@ page import="java.nio.channels.FileChannel"%>
<%@ include file="bbb_api_conf.jsp"%>
<%!//
// Create a meeting with specific
// - meetingID
// - welcome message
// - moderator password
// - viewer password
// - voiceBridge
// - logoutURL
//
public String createMeeting(String meetingID, String welcome,
String moderatorPassword, String viewerPassword,
Integer voiceBridge, String logoutURL) {
String base_url_create = BigBlueButtonURL + "api/create?";
String base_url_join = BigBlueButtonURL + "api/join?";
String welcome_param = "";
String checksum = "";
String attendee_password_param = "&attendeePW=ap";
String moderator_password_param = "&moderatorPW=mp";
String voice_bridge_param = "";
String logoutURL_param = "";
if ((welcome != null) && !welcome.equals("")) {
welcome_param = "&welcome=" + urlEncode(welcome);
}
if ((moderatorPassword != null) && !moderatorPassword.equals("")) {
moderator_password_param = "&moderatorPW="
+ urlEncode(moderatorPassword);
}
if ((viewerPassword != null) && !viewerPassword.equals("")) {
attendee_password_param = "&attendeePW="
+ urlEncode(viewerPassword);
}
if ((voiceBridge != null) && voiceBridge > 0) {
voice_bridge_param = "&voiceBridge="
+ urlEncode(voiceBridge.toString());
} else {
// No voice bridge number passed, so we'll generate a random one for this meeting
Random random = new Random();
Integer n = 70000 + random.nextInt(9999);
voice_bridge_param = "&voiceBridge=" + n;
}
if ((logoutURL != null) && !logoutURL.equals("")) {
logoutURL_param = "&logoutURL=" + urlEncode(logoutURL);
}
//
// Now create the URL
//
String create_parameters = "name=" + urlEncode(meetingID)
+ "&meetingID=" + urlEncode(meetingID) + welcome_param
+ attendee_password_param + moderator_password_param
+ voice_bridge_param + logoutURL_param;
Document doc = null;
try {
// Attempt to create a meeting using meetingID
String xml = getURL(base_url_create + create_parameters
+ "&checksum="
+ checksum("create" + create_parameters + salt));
doc = parseXml(xml);
} catch (Exception e) {
e.printStackTrace();
}
if (doc.getElementsByTagName("returncode").item(0).getTextContent()
.trim().equals("SUCCESS")) {
return meetingID;
}
return "Error "
+ doc.getElementsByTagName("messageKey").item(0)
.getTextContent().trim()
+ ": "
+ doc.getElementsByTagName("message").item(0).getTextContent()
.trim();
}
//
// getJoinMeetingURL() -- get join meeting URL for both viewer and moderator
//
public String getJoinMeetingURL(String username, String meetingID,
String password) {
String base_url_join = BigBlueButtonURL + "api/join?";
String join_parameters = "meetingID=" + urlEncode(meetingID)
+ "&fullName=" + urlEncode(username) + "&password="
+ urlEncode(password);
return base_url_join + join_parameters + "&checksum="
+ checksum("join" + join_parameters + salt);
}
//
// Create a meeting and return a URL to join it as moderator
//
public String getJoinURL(String username, String meetingID, String welcome) {
String base_url_create = BigBlueButtonURL + "api/create?";
String base_url_join = BigBlueButtonURL + "api/join?";
String welcome_param = "";
String good_url = "xxx";
Random random = new Random();
Integer voiceBridge = 70000 + random.nextInt(9999);
if ((welcome != null) && !welcome.equals("")) {
welcome_param = "&welcome=" + urlEncode(welcome);
}
//
// When creating a meeting, the 'name' parameter is the name of the meeting (not to be confused with
// the username). For example, the name could be "Fred's meeting" and the meetingID could be "ID-1234312".
//
// While name and meetinID could be different, we'll keep them the same. Why? Because calling api/create?
// with a previously used meetingID will return same meetingToken (regardless if the meeting is running or not).
//
// This means the first person to call getJoinURL with meetingID="Demo Meeting" will actually create the
// meeting. Subsequent calls will return the same meetingToken and thus subsequent users will join the same
// meeting.
//
// Note: We're hard-coding the password for moderator and attendee (viewer) for purposes of demo.
//
String create_parameters = "name=" + urlEncode(meetingID)
+ "&meetingID=" + urlEncode(meetingID) + welcome_param
+ "&attendeePW=ap&moderatorPW=mp&voiceBridge=" + voiceBridge;
Document doc = null;
try {
// Attempt to create a meeting using meetingID
good_url = base_url_create + create_parameters
+ "&checksum="
+ checksum("create" + create_parameters + salt);
String xml = getURL( good_url );
//String xml = getURL(base_url_create + create_parameters
/// + "&checksum="
// + checksum("create" + create_parameters + salt));
doc = parseXml(xml);
} catch (Exception e) {
e.printStackTrace();
}
if (doc.getElementsByTagName("returncode").item(0).getTextContent()
.trim().equals("SUCCESS")) {
//
// Now create a URL to join that meeting
//
String join_parameters = "meetingID=" + urlEncode(meetingID)
+ "&fullName=" + urlEncode(username) + "&password=mp";
return base_url_join + join_parameters + "&checksum="
+ checksum("join" + join_parameters + salt);
}
return doc.getElementsByTagName("messageKey").item(0).getTextContent()
.trim()
+ ": "
+ doc.getElementsByTagName("message").item(0).getTextContent()
.trim();
}
//
//Create a meeting and return a URL to join it as moderator
//
public String getJoinURLXML(String username, String meetingID,
String welcome, String xml_param) {
String base_url_create = BigBlueButtonURL + "api/create?";
String base_url_join = BigBlueButtonURL + "api/join?";
String welcome_param = "";
Random random = new Random();
Integer voiceBridge = 70000 + random.nextInt(9999);
if ((welcome != null) && !welcome.equals("")) {
welcome_param = "&welcome=" + urlEncode(welcome);
}
String create_parameters = "name=" + urlEncode(meetingID)
+ "&meetingID=" + urlEncode(meetingID) + welcome_param
+ "&attendeePW=ap&moderatorPW=mp&voiceBridge=" + voiceBridge;
Document doc = null;
try {
// Attempt to create a meeting using meetingID
String xml = excutePost(base_url_create + create_parameters
+ "&checksum="
+ checksum("create" + create_parameters + salt), xml_param);
doc = parseXml(xml);
} catch (Exception e) {
e.printStackTrace();
}
if (doc.getElementsByTagName("returncode").item(0).getTextContent()
.trim().equals("SUCCESS")) {
String join_parameters = "meetingID=" + urlEncode(meetingID)
+ "&fullName=" + urlEncode(username) + "&password=mp";
return base_url_join + join_parameters + "&checksum="
+ checksum("join" + join_parameters + salt);
}
return doc.getElementsByTagName("messageKey").item(0).getTextContent()
.trim()
+ ": "
+ doc.getElementsByTagName("message").item(0).getTextContent()
.trim();
}
//
// getJoinURLViewer() -- Get the URL to join a meeting as viewer
//
public String getJoinURLViewer(String username, String meetingID) {
String base_url_join = BigBlueButtonURL + "api/join?";
String join_parameters = "meetingID=" + urlEncode(meetingID)
+ "&fullName=" + urlEncode(username) + "&password=ap";
return base_url_join + join_parameters + "&checksum="
+ checksum("join" + join_parameters + salt);
}
//
// checksum() -- create a hash based on the shared salt (located in bbb_api_conf.jsp)
//
public static String checksum(String s) {
String checksum = "";
try {
checksum = org.apache.commons.codec.digest.DigestUtils.shaHex(s);
} catch (Exception e) {
e.printStackTrace();
}
return checksum;
}
//
// getURL() -- fetch a URL and return its contents as a String
//
public static String getURL(String url) {
StringBuffer response = null;
try {
URL u = new URL(url);
HttpURLConnection httpConnection = (HttpURLConnection) u
.openConnection();
httpConnection.setUseCaches(false);
httpConnection.setDoOutput(true);
httpConnection.setRequestMethod("GET");
httpConnection.connect();
int responseCode = httpConnection.getResponseCode();
if (responseCode == HttpURLConnection.HTTP_OK) {
InputStream input = httpConnection.getInputStream();
// Read server's response.
response = new StringBuffer();
Reader reader = new InputStreamReader(input, "UTF-8");
reader = new BufferedReader(reader);
char[] buffer = new char[1024];
for (int n = 0; n >= 0;) {
n = reader.read(buffer, 0, buffer.length);
if (n > 0)
response.append(buffer, 0, n);
}
input.close();
httpConnection.disconnect();
}
} catch (Exception e) {
e.printStackTrace();
}
if (response != null) {
return response.toString();
} else {
return "";
}
}
public static String excutePost(String targetURL, String urlParameters)
{
URL url;
HttpURLConnection connection = null;
int responseCode = 0;
try {
//Create connection
url = new URL(targetURL);
connection = (HttpURLConnection)url.openConnection();
connection.setRequestMethod("POST");
connection.setRequestProperty("Content-Type",
"text/xml");
connection.setRequestProperty("Content-Length", "" +
Integer.toString(urlParameters.getBytes().length));
connection.setRequestProperty("Content-Language", "en-US");
connection.setUseCaches (false);
connection.setDoInput(true);
connection.setDoOutput(true);
//Send request
DataOutputStream wr = new DataOutputStream (
connection.getOutputStream ());
wr.writeBytes (urlParameters);
wr.flush ();
wr.close ();
//Get Response
InputStream is = connection.getInputStream();
BufferedReader rd = new BufferedReader(new InputStreamReader(is));
String line;
StringBuffer response = new StringBuffer();
while((line = rd.readLine()) != null) {
response.append(line);
response.append('\r');
}
rd.close();
return response.toString();
} catch (Exception e) {
e.printStackTrace();
return null;
} finally {
if(connection != null) {
connection.disconnect();
}
}
}
//
// getURLisMeetingRunning() -- return a URL that the client can use to poll for whether the given meeting is running
//
public String getURLisMeetingRunning(String meetingID) {
String base_main = "&meetingID=" + urlEncode(meetingID);
String base_url = BigBlueButtonURL + "api/isMeetingRunning?";
String checksum = "";
try {
checksum = DigestUtils
.shaHex("isMeetingRunning" + base_main + salt);
} catch (Exception e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
return base_url + base_main + "&checksum=" + checksum;
}
//
// isMeetingRunning() -- check the BigBlueButton server to see if the meeting is running (i.e. there is someone in the meeting)
//
public String isMeetingRunning(String meetingID) {
String base_main = "&meetingID=" + urlEncode(meetingID);
String base_url = BigBlueButtonURL + "api/isMeetingRunning?";
String checksum = "";
try {
checksum = DigestUtils
.shaHex("isMeetingRunning" + base_main + salt);
} catch (Exception e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
String xml = getURL(base_url + base_main + "&checksum=" + checksum);
Document doc = null;
try {
doc = parseXml(xml);
} catch (Exception e) {
e.printStackTrace();
}
if (doc.getElementsByTagName("returncode").item(0).getTextContent()
.trim().equals("SUCCESS")) {
return doc.getElementsByTagName("running").item(0).getTextContent()
.trim();
}
return "false";
}
public String getMeetingInfoURL(String meetingID, String password) {
String meetingParameters = "meetingID=" + urlEncode(meetingID)
+ "&password=" + password;
return BigBlueButtonURL + "api/getMeetingInfo?" + meetingParameters
+ "&checksum="
+ checksum("getMeetingInfo" + meetingParameters + salt);
}
public String getMeetingInfo(String meetingID, String password) {
try {
URLConnection hpCon = new URL(
getMeetingInfoURL(meetingID, password)).openConnection();
InputStreamReader isr = new InputStreamReader(
hpCon.getInputStream());
BufferedReader br = new BufferedReader(isr);
String data = br.readLine();
return data;
} catch (Exception e) {
e.printStackTrace(System.out);
return "";
}
}
public String getMeetingsURL() {
String meetingParameters = "random=" + new Random().nextInt(9999);
return BigBlueButtonURL + "api/getMeetings?" + meetingParameters
+ "&checksum="
+ checksum("getMeetings" + meetingParameters + salt);
}
//
// Calls getMeetings to obtain the list of meetings, then calls getMeetingInfo for each meeting
// and concatenates the result.
//
public String getMeetings() {
try {
// Call the API and get the result
URLConnection hpCon = new URL(getMeetingsURL()).openConnection();
InputStreamReader isr = new InputStreamReader(
hpCon.getInputStream());
BufferedReader br = new BufferedReader(isr);
String data = br.readLine();
Document doc = parseXml(data);
// tags needed for parsing xml documents
final String startTag = "<meetings>";
final String endTag = "</meetings>";
final String startResponse = "<response>";
final String endResponse = "</response>";
// if the request succeeded, then calculate the checksum of each meeting and insert it into the document
NodeList meetingsList = doc.getElementsByTagName("meeting");
String newXMldocument = startTag;
for (int i = 0; i < meetingsList.getLength(); i++) {
Element meeting = (Element) meetingsList.item(i);
String meetingID = meeting.getElementsByTagName("meetingID")
.item(0).getTextContent();
String password = meeting.getElementsByTagName("moderatorPW")
.item(0).getTextContent();
data = getMeetingInfo(meetingID, password);
if (data.indexOf("<response>") != -1) {
int startIndex = data.indexOf(startResponse)
+ startTag.length();
int endIndex = data.indexOf(endResponse);
newXMldocument += "<meeting>"
+ data.substring(startIndex, endIndex)
+ "</meeting>";
}
}
newXMldocument += endTag;
return newXMldocument;
} catch (Exception e) {
e.printStackTrace(System.out);
return null;
}
}
//
public String endMeeting(String meetingID, String moderatorPassword) {
String base_main = "meetingID=" + urlEncode(meetingID) + "&password="
+ urlEncode(moderatorPassword);
String base_url = BigBlueButtonURL + "api/end?";
String checksum = "";
try {
checksum = DigestUtils.shaHex("end" + base_main + salt);
} catch (Exception e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
String xml = getURL(base_url + base_main + "&checksum=" + checksum);
Document doc = null;
try {
doc = parseXml(xml);
} catch (Exception e) {
e.printStackTrace();
}
if (doc.getElementsByTagName("returncode").item(0).getTextContent()
.trim().equals("SUCCESS")) {
return "true";
}
return "Error "
+ doc.getElementsByTagName("messageKey").item(0)
.getTextContent().trim()
+ ": "
+ doc.getElementsByTagName("message").item(0).getTextContent()
.trim();
}
//
// parseXml() -- return a DOM of the XML
//
public static Document parseXml(String xml)
throws ParserConfigurationException, IOException, SAXException {
DocumentBuilderFactory docFactory = DocumentBuilderFactory
.newInstance();
DocumentBuilder docBuilder = docFactory.newDocumentBuilder();
Document doc = docBuilder.parse(new InputSource(new StringReader(xml)));
return doc;
}
//
// urlEncode() -- URL encode the string
//
public static String urlEncode(String s) {
try {
return URLEncoder.encode(s, "UTF-8");
} catch (Exception e) {
e.printStackTrace();
}
return "";
}
%>

View File

@ -0,0 +1,14 @@
<%!
// This is the security salt that must match the value set in the BigBlueButton server
//String salt = "4951c2aea43e5af6d9598610b9e0b6c7";
//String salt = "5e5ff0968546b8aaacce0462a99bca30";
String salt = "5e5ff0968546b8aaacce0462a99bca30";
// This is the URL for the BigBlueButton server 4951c2aea43e5af6d9598610b9e0b6c7
String BigBlueButtonURL = "http://192.168.0.217/bigbluebutton/";
%>

View File

@ -0,0 +1,120 @@
<html>
<head><title>Preupload Presentation</title></head></p> <p>
<body>
<%@ include file="bbb_api.jsp"%>
<%@ include file="demo_header.jsp"%>
<h2>Demo #5: Upload a presentation before joining a Course...</h2>
<form action="demo5.jsp" method="post" enctype
="multipart/form-data" name="form1" id="form1">
<table cellpadding="5" cellspacing="5" style="width: 400px;">
<tbody>
<tr>
<td>&nbsp;</td>
<td style="text-align: right;">Full Name:</td>
<td style="width: 5px;">&nbsp;</td>
<td style="text-align: left"><input type="text"
name="username" />
</td>
</tr>
<tr>
<td>&nbsp;</td>
<td style="text-align: left">Upload File:</td>
<td style="width: 5px;">&nbsp;</td>
<td style="text-align: left"><input type="file"
name="filename" /><!-- <input type="submit" />-->
</td>
</tr>
<tr>
<td>&nbsp;</td>
<td>&nbsp;</td>
<td>&nbsp;</td>
<td><input type="submit" value="Join" />
</td>
</tr>
</tbody>
</table>
<INPUT TYPE=hidden NAME=action VALUE="create">
</form>
</body>
</html>
<%@ page import="java.util.List" %>
<%@ page import="java.util.Iterator" %>
<%@ page import="java.io.File" %>
<%@ page import="org.apache.commons.fileupload.servlet.ServletFileUpload"%>
<%@ page import="org.apache.commons.fileupload.disk.DiskFileItemFactory"%>
<%@ page import="org.apache.commons.fileupload.*"%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@page import="sun.security.provider.SHA"%>
<%@page import="org.apache.commons.codec.binary.Base64"%>
<%@page import="java.security.MessageDigest"%>
<%
String uname="";
boolean isMultipart = ServletFileUpload.isMultipartContent(request);
if (!isMultipart) {
}
else {
FileItemFactory factory = new DiskFileItemFactory();
ServletFileUpload upload = new ServletFileUpload(factory);
List<FileItem> items = null;
try {
items = upload.parseRequest(request);
} catch (FileUploadException e) {
e.printStackTrace();
}
out.print(items.size());
Iterator<FileItem> itr = items.iterator();
while (itr.hasNext()) {
FileItem item = (FileItem) itr.next();
String xml = null;
xml = "<?xml version='1.0' encoding='UTF-8'?> <modules> <module name='presentation'> <document url='http://www.samplepdf.com/sample.pdf' /> </module></modules>";
if (item.isFormField())
{
String name = item.getFieldName();
String value = item.getString();
if(name.equals("username"))
{
uname=value;
}
} else {
try {
String itemName = item.getName();
if(itemName==""){
xml = "<?xml version='1.0' encoding='UTF-8'?> <modules> <module name='presentation'> <document url='http://www.samplepdf.com/sample.pdf' /> </module></modules>";
}
else {
byte[] b = item.get();
String encoded = Base64.encodeBase64String(b);
xml = "<?xml version='1.0' encoding='UTF-8'?> <modules> <module name=\"presentation\"> <document name=\""+itemName+"\">"+encoded+"\"</document> </module></modules>";
}
} catch (Exception e) {
e.printStackTrace();
}
String joinURL = getJoinURLXML(uname, "Demo Meeting", "Presentation should be uploaded. It was uploaded as an encoded file", xml );
if (joinURL.startsWith("http://")) {
%>
<center><h1>Your presentation has been Uploaded</h1></center>
<script language="javascript" type="text/javascript">
window.location.href="<%=joinURL%>";
</script>
<%
} else {
%>
Error: getJoinURL() failed
<p />
<%=joinURL %>
<%
}
}
}
}
%>

View File

@ -0,0 +1,112 @@
<html>
<head><title>Preupload Presentation</title></head></p> <p>
<body>
<%@ include file="bbb_api.jsp"%>
<%@ include file="demo_header.jsp"%>
<%
String fileURL = BigBlueButtonURL.replace("/bigbluebutton",":8080/demo");
String name1="Demo123.pdf";
String name2="Demo456.pdf";
String name3="Demo789.pdf";
%>
<h2>Demo #6: Send a presentation URL before joining a Course...</h2>
<form action="demo6.jsp" method="post" enctype
="multipart/form-data" name="form1" id="form1">
<table cellpadding="5" cellspacing="5" style="width: 400px;">
<tbody>
<tr>
<td>&nbsp;</td>
<td style="text-align: right;">Full Name:</td>
<td style="width: 5px;">&nbsp;</td>
<td style="text-align: left"><input type="text"
name="username" />
</td>
</tr>
<tr>
<td>&nbsp;</td>
<td style="text-align: right">File Name:</td>
<td style="width: 5px;">&nbsp;</td>
<td><select name=filename>
<option value=<%=name1%>><%=name1.substring(0,name1.length()-4)%></option>
<option value=<%=name2%>><%=name2.substring(0,name2.length()-4)%></option>
<option value=<%=name3%>><%=name3.substring(0,name3.length()-4)%></option>
</select>
</td>
</tr>
<tr>
<td>&nbsp;</td>
<td>&nbsp;</td>
<td>&nbsp;</td>
<td><input type="submit" value="Join" />
</td>
</tr>
</tbody>
</table>
<INPUT TYPE=hidden NAME=action VALUE="create">
</form>
</body>
</html>
<%@ page import="java.util.List" %>
<%@ page import="java.util.Iterator" %>
<%@ page import="java.io.File" %>
<%@ page import="org.apache.commons.fileupload.servlet.ServletFileUpload"%>
<%@ page import="org.apache.commons.fileupload.disk.DiskFileItemFactory"%>
<%@ page import="org.apache.commons.fileupload.*"%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@page import="sun.security.provider.SHA"%>
<%@page import="org.apache.commons.codec.binary.Base64"%>
<%@page import="java.security.MessageDigest"%>
<%
String uname="";
String fname="";
boolean isMultipart = ServletFileUpload.isMultipartContent(request);
if (!isMultipart) {
}
else {
FileItemFactory factory = new DiskFileItemFactory();
ServletFileUpload upload = new ServletFileUpload(factory);
List<FileItem> items = null;
try {
items = upload.parseRequest(request);
} catch (FileUploadException e) {
e.printStackTrace();
}
Iterator<FileItem> itr = items.iterator();
String xml = null;
while (itr.hasNext()) {
FileItem item = (FileItem) itr.next();
String name = item.getFieldName();
String value = item.getString();
if(name.equals("username")) {
uname=value;
}
if(name.equals("filename")) {
fname=value;
}
}
xml = "<?xml version='1.0' encoding='UTF-8'?> <modules> <module name='presentation'> <document url='"+fileURL+fname+"' /> </module></modules>";
String joinURL = getJoinURLXML(uname, "Demo Meeting", "Presentation URL should be passed.", xml );
if (joinURL.startsWith("http://")) {
%>
<center><h1>Your presentation URL has been passed</h1></center>
<script language="javascript" type="text/javascript">
window.location.href="<%=joinURL%>";
</script>
<%
} else {
%>
Error: getJoinURL() failed
<p />
<%=joinURL %>
<%
}
}
%>

View File

@ -0,0 +1 @@
<img src="/bigbluebutton/images/bbb_banner.jpg" /><br><a href="demo5.jsp">Auto Upload File</a> | <a href="demo6.jsp">Auto Upload File URL</a>

View File

@ -0,0 +1,448 @@
<%
/*
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>
*/
%>
<%@page import="javax.xml.transform.dom.DOMSource"%>
<%@page import="javax.xml.transform.stream.StreamResult"%>
<%@page import="javax.xml.transform.OutputKeys"%>
<%@page import="javax.xml.transform.TransformerFactory"%>
<%@page import="javax.xml.transform.Transformer"%>
<%@page import="org.w3c.dom.Element"%>
<%@page import="com.sun.org.apache.xerces.internal.dom.ChildNode"%>
<%@page import="org.w3c.dom.Node"%>
<%@page import="org.w3c.dom.NodeList"%>
<%@ page
import="java.util.*,java.io.*,java.net.*,javax.crypto.*,javax.xml.parsers.*,org.w3c.dom.Document,org.xml.sax.*"
errorPage="error.jsp" %>
<%@ page import="org.apache.commons.codec.digest.*"%>
<%@ include file="bbb_api_conf.jsp"%>
<%!
//
// Create a meeting with specific
// - meetingID
// - welcome message
// - moderator password
// - viewer password
// - voiceBridge
// - logoutURL
//
public String createMeeting(String meetingID, String welcome, String moderatorPassword, String viewerPassword, Integer voiceBridge, String logoutURL) {
String base_url_create = BigBlueButtonURL + "api/create?";
String base_url_join = BigBlueButtonURL + "api/join?";
String welcome_param = "";
String checksum = "";
String attendee_password_param = "&attendeePW=ap";
String moderator_password_param = "&moderatorPW=mp";
String voice_bridge_param = "";
String logoutURL_param = "";
if ( (welcome != null) && ! welcome.equals("")) {
welcome_param = "&welcome=" + urlEncode(welcome);
}
if ( (moderatorPassword != null) && ! moderatorPassword.equals("")) {
moderator_password_param = "&moderatorPW=" + urlEncode(moderatorPassword);
}
if ( (viewerPassword != null) && ! viewerPassword.equals("")) {
attendee_password_param = "&attendeePW=" + urlEncode(viewerPassword);
}
if ( (voiceBridge != null) && voiceBridge > 0 ) {
voice_bridge_param = "&voiceBridge=" + urlEncode(voiceBridge.toString());
} else {
// No voice bridge number passed, so we'll generate a random one for this meeting
Random random = new Random();
Integer n = 70000 + random.nextInt(9999);
voice_bridge_param = "&voiceBridge=" + n;
}
if ( (logoutURL != null) && ! logoutURL.equals("")) {
logoutURL_param = "&logoutURL=" + urlEncode(logoutURL);
}
//
// Now create the URL
//
String create_parameters = "name=" + urlEncode(meetingID) + "&meetingID=" + urlEncode(meetingID)
+ welcome_param + attendee_password_param + moderator_password_param
+ voice_bridge_param + logoutURL_param;
Document doc = null;
try {
// Attempt to create a meeting using meetingID
String xml = getURL(base_url_create + create_parameters + "&checksum=" + checksum("create" + create_parameters + salt) );
doc = parseXml(xml);
} catch (Exception e) {
e.printStackTrace();
}
if (doc.getElementsByTagName("returncode").item(0).getTextContent()
.trim().equals("SUCCESS")) {
return meetingID;
}
return "Error " + doc.getElementsByTagName("messageKey").item(0).getTextContent().trim()
+ ": " + doc.getElementsByTagName("message").item(0).getTextContent().trim();
}
//
// getJoinMeetingURL() -- get join meeting URL for both viewer and moderator
//
public String getJoinMeetingURL(String username, String meetingID, String password) {
String base_url_join = BigBlueButtonURL + "api/join?";
String join_parameters = "meetingID=" + urlEncode(meetingID) + "&fullName=" + urlEncode(username)
+ "&password=" + urlEncode(password);
return base_url_join + join_parameters + "&checksum=" + checksum("join" + join_parameters + salt);
}
//
// Create a meeting and return a URL to join it as moderator
//
public String getJoinURL(String username, String meetingID, String record, String welcome, Map<String, String> metadata) {
String base_url_create = BigBlueButtonURL + "api/create?";
String base_url_join = BigBlueButtonURL + "api/join?";
String welcome_param = "";
Random random = new Random();
Integer voiceBridge = 70000 + random.nextInt(9999);
if ( (welcome != null) && ! welcome.equals("")) {
welcome_param = "&welcome=" + urlEncode(welcome);
}
//
// When creating a meeting, the 'name' parameter is the name of the meeting (not to be confused with
// the username). For example, the name could be "Fred's meeting" and the meetingID could be "ID-1234312".
//
// While name and meetinID could be different, we'll keep them the same. Why? Because calling api/create?
// with a previously used meetingID will return same meetingToken (regardless if the meeting is running or not).
//
// This means the first person to call getJoinURL with meetingID="Demo Meeting" will actually create the
// meeting. Subsequent calls will return the same meetingToken and thus subsequent users will join the same
// meeting.
//
// Note: We're hard-coding the password for moderator and attendee (viewer) for purposes of demo.
//
String create_parameters = "name=" + urlEncode(meetingID) + "&meetingID=" + urlEncode(meetingID)
+ welcome_param + "&attendeePW=ap&moderatorPW=mp&voiceBridge="
+ voiceBridge + "&record=" + record;
if(metadata!=null){
String metadata_params="";
for(String metakey : metadata.keySet()){
metadata_params = metadata_params + "&meta_" + urlEncode(metakey) + "=" + urlEncode(metadata.get(metakey));
}
create_parameters = create_parameters + metadata_params;
}
Document doc = null;
try {
// Attempt to create a meeting using meetingID
String xml = getURL(base_url_create + create_parameters + "&checksum=" + checksum("create" + create_parameters + salt) );
doc = parseXml(xml);
} catch (Exception e) {
e.printStackTrace();
}
if (doc.getElementsByTagName("returncode").item(0).getTextContent()
.trim().equals("SUCCESS")) {
//
// Now create a URL to join that meeting
//
String join_parameters = "meetingID=" + urlEncode(meetingID) + "&fullName=" + urlEncode(username) + "&password=mp";
return base_url_join + join_parameters + "&checksum=" + checksum("join" + join_parameters + salt);
}
return doc.getElementsByTagName("messageKey").item(0).getTextContent().trim()
+ ": " + doc.getElementsByTagName("message").item(0).getTextContent().trim();
}
//
// getJoinURLViewer() -- Get the URL to join a meeting as viewer
//
public String getJoinURLViewer(String username, String meetingID) {
String base_url_join = BigBlueButtonURL + "api/join?";
String join_parameters = "meetingID=" + urlEncode(meetingID) + "&fullName=" + urlEncode(username)
+ "&password=ap";
return base_url_join + join_parameters + "&checksum=" + checksum("join" + join_parameters + salt);
}
//
// checksum() -- create a hash based on the shared salt (located in bbb_api_conf.jsp)
//
public static String checksum(String s) {
String checksum = "";
try {
checksum = org.apache.commons.codec.digest.DigestUtils.shaHex(s);
} catch (Exception e) {
e.printStackTrace();
}
return checksum;
}
//
// getURL() -- fetch a URL and return its contents as a String
//
public static String getURL(String url) {
StringBuffer response = null;
try {
URL u = new URL(url);
HttpURLConnection httpConnection = (HttpURLConnection) u
.openConnection();
httpConnection.setUseCaches(false);
httpConnection.setDoOutput(true);
httpConnection.setRequestMethod("GET");
httpConnection.connect();
int responseCode = httpConnection.getResponseCode();
if (responseCode == HttpURLConnection.HTTP_OK) {
InputStream input = httpConnection.getInputStream();
// Read server's response.
response = new StringBuffer();
Reader reader = new InputStreamReader(input, "UTF-8");
reader = new BufferedReader(reader);
char[] buffer = new char[1024];
for (int n = 0; n >= 0;) {
n = reader.read(buffer, 0, buffer.length);
if (n > 0)
response.append(buffer, 0, n);
}
input.close();
httpConnection.disconnect();
}
} catch (Exception e) {
e.printStackTrace();
}
if (response != null) {
return response.toString();
} else {
return "";
}
}
//
// getURLisMeetingRunning() -- return a URL that the client can use to poll for whether the given meeting is running
//
public String getURLisMeetingRunning(String meetingID) {
String base_main = "&meetingID=" + urlEncode(meetingID);
String base_url = BigBlueButtonURL + "api/isMeetingRunning?";
String checksum ="";
try {
checksum = DigestUtils.shaHex("isMeetingRunning" + base_main + salt);
} catch (Exception e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
return base_url + base_main + "&checksum=" + checksum;
}
//
// isMeetingRunning() -- check the BigBlueButton server to see if the meeting is running (i.e. there is someone in the meeting)
//
public String isMeetingRunning(String meetingID) {
String base_main = "&meetingID=" + urlEncode(meetingID);
String base_url = BigBlueButtonURL + "api/isMeetingRunning?";
String checksum ="";
try {
checksum = DigestUtils.shaHex("isMeetingRunning" + base_main + salt);
} catch (Exception e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
String xml = getURL(base_url + base_main + "&checksum=" + checksum);
Document doc = null;
try {
doc = parseXml(xml);
} catch (Exception e) {
e.printStackTrace();
}
if (doc.getElementsByTagName("returncode").item(0).getTextContent()
.trim().equals("SUCCESS")) {
return doc.getElementsByTagName("running").item(0).getTextContent().trim();
}
return "false";
}
public String getMeetingInfoURL(String meetingID, String password) {
String meetingParameters = "meetingID=" + urlEncode(meetingID) + "&password=" + password;
return BigBlueButtonURL + "api/getMeetingInfo?" + meetingParameters + "&checksum=" + checksum("getMeetingInfo" + meetingParameters + salt);
}
public String getMeetingInfo(String meetingID, String password) {
try {
URLConnection hpCon = new URL(getMeetingInfoURL(meetingID, password)).openConnection();
InputStreamReader isr = new InputStreamReader(hpCon.getInputStream());
BufferedReader br = new BufferedReader(isr);
String data = br.readLine();
return data;
} catch (Exception e) {
e.printStackTrace(System.out);
return "";
}
}
public String getMeetingsURL() {
String meetingParameters = "random=" + new Random().nextInt(9999);
return BigBlueButtonURL + "api/getMeetings?" + meetingParameters + "&checksum=" + checksum("getMeetings" + meetingParameters + salt);
}
//
// Calls getMeetings to obtain the list of meetings, then calls getMeetingInfo for each meeting
// and concatenates the result.
//
public String getMeetings() {
try {
// Call the API and get the result
URLConnection hpCon = new URL(getMeetingsURL()).openConnection();
InputStreamReader isr = new InputStreamReader(hpCon.getInputStream());
BufferedReader br = new BufferedReader(isr);
String data = br.readLine();
Document doc = parseXml(data);
// tags needed for parsing xml documents
final String startTag = "<meetings>";
final String endTag = "</meetings>";
final String startResponse = "<response>";
final String endResponse = "</response>";
// if the request succeeded, then calculate the checksum of each meeting and insert it into the document
NodeList meetingsList = doc.getElementsByTagName("meeting");
String newXMldocument = startTag;
for (int i = 0; i < meetingsList.getLength(); i++) {
Element meeting = (Element) meetingsList.item(i);
String meetingID = meeting.getElementsByTagName("meetingID").item(0).getTextContent();
String password = meeting.getElementsByTagName("moderatorPW").item(0).getTextContent();
data = getMeetingInfo(meetingID, password);
if (data.indexOf("<response>") != -1) {
int startIndex = data.indexOf(startResponse) + startTag.length();
int endIndex = data.indexOf(endResponse);
newXMldocument += "<meeting>" + data.substring(startIndex, endIndex) + "</meeting>";
}
}
newXMldocument += endTag;
return newXMldocument;
} catch (Exception e) {
e.printStackTrace(System.out);
return null;
}
}
//
public String endMeeting(String meetingID, String moderatorPassword) {
String base_main = "meetingID=" + urlEncode(meetingID) + "&password=" + urlEncode(moderatorPassword);
String base_url = BigBlueButtonURL + "api/end?";
String checksum ="";
try {
checksum = DigestUtils.shaHex("end" + base_main + salt);
} catch (Exception e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
String xml = getURL(base_url + base_main + "&checksum=" + checksum);
Document doc = null;
try {
doc = parseXml(xml);
} catch (Exception e) {
e.printStackTrace();
}
if (doc.getElementsByTagName("returncode").item(0).getTextContent()
.trim().equals("SUCCESS")) {
return "true";
}
return "Error " + doc.getElementsByTagName("messageKey").item(0).getTextContent().trim()
+ ": " + doc.getElementsByTagName("message").item(0).getTextContent().trim();
}
//
// parseXml() -- return a DOM of the XML
//
public static Document parseXml(String xml) throws ParserConfigurationException, IOException, SAXException {
DocumentBuilderFactory docFactory = DocumentBuilderFactory.newInstance();
DocumentBuilder docBuilder = docFactory.newDocumentBuilder();
Document doc = docBuilder.parse(new InputSource(new StringReader(xml)));
return doc;
}
//
// urlEncode() -- URL encode the string
//
public static String urlEncode(String s) {
try {
return URLEncoder.encode(s, "UTF-8");
} catch (Exception e) {
e.printStackTrace();
}
return "";
}
%>

View File

@ -0,0 +1,308 @@
<!--
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>
-->
<%@ page language="java" contentType="text/html; charset=UTF-8"
pageEncoding="UTF-8"%>
<%
request.setCharacterEncoding("UTF-8");
response.setCharacterEncoding("UTF-8");
%>
<!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=UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=EmulateIE7" />
<title>Create Your Own Meeting</title>
<script type="text/javascript"
src="http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.min.js"></script>
<script type="text/javascript" src="heartbeat.js"></script>
</head>
<body>
<%@ include file="bbb_api.jsp"%>
<%@ page import="java.util.regex.*"%>
<br>
<%
if (request.getParameterMap().isEmpty()) {
//
// Assume we want to create a meeting
//
%>
<%@ include file="demo_header.jsp"%>
<h2>Create Your Own Meeting</h2>
<p />
<FORM NAME="form1" METHOD="GET">
<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%">Create your own meeting.
<p />
</td>
<td width="50%">Step 1. Enter your name: <input type="text"
name="username1" /> <br />
<label for="crecord">record? </label>
<select id="crecord" name="record1">
<option value="true">yes</option>
<option value="false" selected>no</option>
</select>
<INPUT TYPE=hidden NAME=action VALUE="create"> <br />
<input id="submit-button" type="submit" value="Create meeting" /></td>
</tr>
</tbody>
</table>
</FORM>
<script>
//
// We could have asked the user for both their name and a meeting title, but we'll just use their name to create a title
// We'll use JQuery to dynamically update the button
//
$(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>
<%
} else if (request.getParameter("action").equals("create")) {
//
// User has requested to create a meeting
//
String username = request.getParameter("username1");
String meetingID = username + "'s meeting";
String record = request.getParameter("record1");
String meeting_ID = "";
//
// This is the URL for to join the meeting as moderator
//
String joinURL = getJoinURL(username, meetingID, record, "<br>Welcome to %%CONFNAME%%.<br>", null);
String inviteURL = BigBlueButtonURL + "demo/create.jsp?action=invite&meetingID=" + URLEncoder.encode(meetingID, "UTF-8");
%>
<hr />
<h2>Meeting Created</h2>
<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>
<td width="50%">
<p>&nbsp;</p>
Step 2. Invite others using the following <a href="<%=inviteURL%>">link</a> (shown below):
<form name="form2" method="POST">
<textarea cols="62" rows="5" name="myname" style="overflow: hidden">
<%=inviteURL%>
</textarea>
</form>
<p>&nbsp;
<p />Step 3. Click the following link to start your meeting:
<p>&nbsp;</p>
<center><a href="<%=joinURL%>">Start Meeting</a></center>
<p>&nbsp;</p>
</td>
</tr>
</tbody>
</table>
<%
} else if (request.getParameter("action").equals("enter")) {
//
// The user is now attempting to joing the meeting
//
String meetingID = request.getParameter("meetingID");
String username = request.getParameter("username");
String enterURL = BigBlueButtonURL
+ "demo/create.jsp?action=join&username="
+ URLEncoder.encode(username, "UTF-8") + "&meetingID="
+ URLEncoder.encode(meetingID, "UTF-8");
if (isMeetingRunning(meetingID).equals("true")) {
//
// The meeting has started -- bring the user into the meeting.
//
%>
<script type="text/javascript">
window.location = "<%=enterURL%>";
</script>
<%
} else {
//
// The meeting has not yet started, so check until we get back the status that the meeting is running
//
String checkMeetingStatus = getURLisMeetingRunning(meetingID);
%>
<script type="text/javascript">
$(document).ready(function(){
$.jheartbeat.set({
url: "<%=checkMeetingStatus%>",
delay: 5000
}, function () {
mycallback();
});
});
function mycallback() {
// Not elegant, but works around a bug in IE8
var isMeetingRunning = ($("#HeartBeatDIV").text().search("true") > 0 );
if (isMeetingRunning) {
window.location = "<%=enterURL%>";
}
}
</script>
<hr />
<h2><strong><%=meetingID%></strong> has not yet started.</h2>
<hr />
<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%">
<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>
</td>
<td width="50%"><img src="polling.gif"></img></td>
</tr>
</tbody>
</table>
<%
}
} else if (request.getParameter("action").equals("invite")) {
//
// We have an invite to an active meeting. Ask the person for their name
// so they can join.
//
String meetingID = request.getParameter("meetingID");
%>
<hr />
<h2>Invite</h2>
<hr />
<FORM NAME="form3" METHOD="GET">
<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%">
<p />You have been invited to join<br />
<strong><%=meetingID%></strong>.
</td>
<td width="50%">Enter your name: <input type="text"
name="username" /> <br />
<INPUT TYPE=hidden NAME=meetingID VALUE="<%=meetingID%>"> <INPUT
TYPE=hidden NAME=action VALUE="enter"> <br />
<input type="submit" value="Join" /></td>
</tr>
</tbody>
</table>
</FORM>
<%
} else if (request.getParameter("action").equals("join")) {
//
// We have an invite request to join an existing meeting and the meeting is running
//
// We don't need to pass a meeting descritpion as it's already been set by the first time
// the meeting was created.
String joinURL = getJoinURLViewer(request.getParameter("username"), request.getParameter("meetingID"));
if (joinURL.startsWith("http://")) {
%>
<script language="javascript" type="text/javascript">
window.location.href="<%=joinURL%>";
</script>
<%
} else {
%>
Error: getJoinURL() failed
<p /><%=joinURL%>
<%
}
}
%>
<%@ include file="demo_footer.jsp"%>
</body>
</html>

View File

@ -0,0 +1,119 @@
<!--
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>
-->
<%@ page language="java" contentType="text/html; charset=UTF-8"
pageEncoding="UTF-8"%>
<%
request.setCharacterEncoding("UTF-8");
response.setCharacterEncoding("UTF-8");
%>
<!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=UTF-8">
<title>Join a Course</title>
</head>
<body>
<%@ include file="bbb_api.jsp"%>
<br>
<%
if (request.getParameterMap().isEmpty()) {
//
// Assume we want to create a meeting
//
%>
<%@ include file="demo_header.jsp"%>
<h2>Demo #1: Join a Course</h2>
<FORM NAME="form1" METHOD="GET">
<table cellpadding="5" cellspacing="5" style="width: 400px; ">
<tbody>
<tr>
<td>
&nbsp;</td>
<td style="text-align: right; ">
Full Name:</td>
<td style="width: 5px; ">
&nbsp;</td>
<td style="text-align: left ">
<input type="text" name="username" /></td>
</tr>
<tr>
<td>
&nbsp;</td>
<td>
&nbsp;</td>
<td>
&nbsp;</td>
<td>
<input type="submit" value="Join" /></td>
</tr>
</tbody>
</table>
<INPUT TYPE=hidden NAME=action VALUE="create">
</FORM>
<%
} else if (request.getParameter("action").equals("create")) {
//
// Got an action=create
//
//
// Request a URL to join a meeting called "Demo Meeting"
// Pass null for welcome message to use the default message (see defaultWelcomeMessage in bigbluebutton.properties)
// Update: Added record parameter, default: false
//
String joinURL = getJoinURL(request.getParameter("username"), "Demo Meeting", "false", null, null);
if (joinURL.startsWith("http://")) {
%>
<script language="javascript" type="text/javascript">
window.location.href="<%=joinURL%>";
</script>
<%
} else {
%>
Error: getJoinURL() failed
<p/>
<%=joinURL %>
<%
}
}
%>
<%@ include file="demo_footer.jsp"%>
</body>
</html>

View File

@ -0,0 +1,130 @@
<!--
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>
-->
<%@ page language="java" contentType="text/html; charset=UTF-8"
pageEncoding="UTF-8"%>
<%
request.setCharacterEncoding("UTF-8");
response.setCharacterEncoding("UTF-8");
%>
<!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=UTF-8">
<title>Join a Selected Course</title>
</head>
<body>
<%@ include file="bbb_api.jsp"%>
<br>
<%
if (request.getParameterMap().isEmpty()) {
//
// Assume we want to create a meeting
//
%>
<%@ include file="demo_header.jsp"%>
<h2>Demo #2: Join a Selected Course</h2>
<FORM NAME="form1" METHOD="GET">
<table cellpadding="5" cellspacing="5" style="width: 400px; ">
<tbody>
<tr>
<td>
&nbsp;</td>
<td style="text-align: right; ">
Full Name:</td>
<td style="width: 5px; ">
&nbsp;</td>
<td style="text-align: left ">
<input type="text" name="username" /></td>
</tr>
<tr>
<td>
&nbsp;</td>
<td style="text-align: right; ">
Course:</td>
<td>
&nbsp;
</td>
<td style="text-align: left ">
<select name="meetingID">
<option value="English 232">English 232</option>
<option value="English 300">English 300</option>
<option value="English 402">English 402</option>
<option value="Demo Meeting">Demo Meeting</option>
</select>
</td>
</tr>
<tr>
<td>
&nbsp;</td>
<td>
&nbsp;</td>
<td>
&nbsp;</td>
<td>
<input type="submit" value="Join" /></td>
</tr>
</tbody>
</table>
<INPUT TYPE=hidden NAME=action VALUE="create">
</FORM>
<%
} else if (request.getParameter("action").equals("create")) {
//
// Got an action=create
//
String username = request.getParameter("username");
String meetingID = request.getParameter("meetingID");
// String joinURL = getJoinURL(username, meetingID, "Welcome to " + meetingID );
// Update: added record parameter, default false
String joinURL = getJoinURL(username, meetingID,"false", "<br>Welcome to course: %%CONFNAME%%.<br>", null );
if (joinURL.startsWith("http://")) {
%>
<script language="javascript" type="text/javascript">
window.location.href="<%=joinURL%>";
</script>
<%
} else {
%>
Error: getJoinURL() failed
<p /><%=joinURL%> <%
}
}
%> <%@ include file="demo_footer.jsp"%>
</body>
</html>

View File

@ -0,0 +1,293 @@
<!--
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>
-->
<%@ page language="java" contentType="text/html; charset=UTF-8"
pageEncoding="UTF-8"%>
<%
request.setCharacterEncoding("UTF-8");
response.setCharacterEncoding("UTF-8");
%>
<!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=UTF-8">
<title>Join a Course (Password Required)</title>
</head>
<body>
<%@ include file="bbb_api.jsp"%>
<br>
<%
//
// We're going to define some sample courses (meetings) below. This API exampe shows how you can create a login page for a course.
// The password below are not available to users as they are compiled on the server.
//
HashMap<String, HashMap> allMeetings = new HashMap<String, HashMap>();
HashMap<String, String> meeting;
String welcome = "<br>Welcome to %%CONFNAME%%!<br><br>For help see our <a href=\"event:http://www.bigbluebutton.org/content/videos\"><u>tutorial videos</u></a>.<br><br>To join the voice bridge for this meeting:<br> (1) click the headset icon in the upper-left, or<br> (2) dial xxx-xxx-xxxx (toll free:1-xxx-xxx-xxxx) and enter conference ID: %%CONFNUM%%.<br><br>";
//
// English courses
//
meeting = new HashMap<String, String>();
allMeetings.put( "ENGL-2013: Research Methods in English", meeting ); // The title that will appear in the drop-down menu
meeting.put("welcomeMsg", welcome); // The welcome mesage
meeting.put("moderatorPW", "prof123"); // The password for moderator
meeting.put("viewerPW", "student123"); // The password for viewer
meeting.put("voiceBridge", "72013"); // The extension number for the voice bridge (use if connected to phone system)
meeting.put("logoutURL", "/bigbluebutton/demo/demo3.jsp"); // The logout URL (use if you want to return to your pages)
meeting = new HashMap<String, String>();
allMeetings.put( "ENGL-2213: Drama Production I", meeting );
meeting.put("welcomeMsg", welcome);
meeting.put("moderatorPW", "prof123");
meeting.put("viewerPW", "student123");
meeting.put("voiceBridge", "72213");
meeting.put("logoutURL", "/bigbluebutton/demo/demo3.jsp");
meeting = new HashMap<String, String>();
allMeetings.put( "ENGL-2023: Survey of English Literature", meeting );
meeting.put("welcomeMsg", welcome);
meeting.put("moderatorPW", "prof123");
meeting.put("viewerPW", "student123");
meeting.put("voiceBridge", "72023");
meeting.put("logoutURL", "/bigbluebutton/demo/demo3.jsp");
//
// Law Courses
//
meeting = new HashMap<String, String>();
allMeetings.put( "LAW-1323: Fundamentals of Advocacy ", meeting );
meeting.put("welcomeMsg", welcome);
meeting.put("moderatorPW", "prof123");
meeting.put("viewerPW", "student123");
meeting.put("voiceBridge", "71232");
meeting.put("logoutURL", "/bigbluebutton/demo/demo3.jsp");
meeting = new HashMap<String, String>();
allMeetings.put( "LAW-2273: Business Organizations", meeting );
meeting.put("welcomeMsg", welcome);
meeting.put("moderatorPW", "prof123");
meeting.put("viewerPW", "student123");
meeting.put("voiceBridge", "72273");
meeting.put("logoutURL", "/bigbluebutton/demo/demo3.jsp");
meeting = new HashMap<String, String>();
allMeetings.put( "LAW-3113: Corporate Finance", meeting );
meeting.put("welcomeMsg", welcome);
meeting.put("moderatorPW", "theprof");
meeting.put("viewerPW", "student123");
meeting.put("voiceBridge", "71642");
meeting.put("logoutURL", "/bigbluebutton/demo/demo3.jsp");
//
// Professor's Virtaul Office Hours
//
meeting = new HashMap<String, String>();
allMeetings.put( "Virtual Office Hours - Steve Stoyan", meeting );
meeting.put("welcomeMsg", welcome);
meeting.put("moderatorPW", "prof123");
meeting.put("viewerPW", "student123");
meeting.put("voiceBridge", "70001");
meeting.put("logoutURL", "/bigbluebutton/demo/demo3.jsp");
meeting = new HashMap<String, String>();
allMeetings.put( "Virtual Office Hours - Michael Bailetti", meeting );
meeting.put("welcomeMsg", welcome);
meeting.put("moderatorPW", "prof123");
meeting.put("viewerPW", "student123");
meeting.put("voiceBridge", "70002");
meeting.put("logoutURL", "/bigbluebutton/demo/demo3.jsp");
meeting = new HashMap<String, String>();
allMeetings.put( "Virtual Office Hours - Tony Weiss", meeting );
meeting.put("welcomeMsg", welcome);
meeting.put("moderatorPW", "prof123");
meeting.put("viewerPW", "student123");
meeting.put("voiceBridge", "70003");
meeting.put("logoutURL", "/bigbluebutton/demo/demo3.jsp");
meeting = null;
Iterator<String> meetingIterator = new TreeSet<String>(allMeetings.keySet()).iterator();
if (request.getParameterMap().isEmpty()) {
//
// Assume we want to join a course
//
%>
<%@ include file="demo_header.jsp"%>
<h2>Demo #3: Join a Course (password required)</h2>
<FORM NAME="form1" METHOD="GET">
<table cellpadding="5" cellspacing="5" style="width: 400px; ">
<tbody>
<tr>
<td>
&nbsp;</td>
<td style="text-align: right; ">
Full&nbsp;Name:</td>
<td style="width: 5px; ">
&nbsp;</td>
<td style="text-align: left ">
<input type="text" name="username" /></td>
</tr>
<tr>
<td>
&nbsp;</td>
<td style="text-align: right; ">
Course:</td>
<td>
&nbsp;
</td>
<td style="text-align: left ">
<select name="meetingID">
<%
String key;
while (meetingIterator.hasNext()) {
key = meetingIterator.next();
out.println("<option value=\"" + key + "\">" + key + "</option>");
}
%>
</select>
</td>
</tr>
<tr>
<td>
&nbsp;</td>
<td style="text-align: right; ">
Password:</td>
<td>
&nbsp;</td>
<td>
<input type="password" name="password" /></td>
</tr>
<tr>
<td>
&nbsp;</td>
<td>
&nbsp;</td>
<td>
&nbsp;</td>
<td>
<input type="submit" value="Join" /></td>
</tr>
</tbody>
</table>
<INPUT TYPE=hidden NAME=action VALUE="create">
</FORM>
Passwords:
<ul>
<li>prof123 - login as professor (moderator privlidges)</li>
<li>student123 - login as student (viewer privlidges)</li>
</ul>
<%
} else if (request.getParameter("action").equals("create")) {
//
// Got an action=create
//
String username = request.getParameter("username");
String meetingID = request.getParameter("meetingID");
String password = request.getParameter("password");
meeting = allMeetings.get( meetingID );
String welcomeMsg = meeting.get( "welcomeMsg" );
String logoutURL = meeting.get( "logoutURL" );
Integer voiceBridge = Integer.parseInt( meeting.get( "voiceBridge" ).trim() );
String viewerPW = meeting.get( "viewerPW" );
String moderatorPW = meeting.get( "moderatorPW" );
//
// Check if we have a valid password
//
if ( ! password.equals(viewerPW) && ! password.equals(moderatorPW) ) {
%>
Invalid Password, please <a href="javascript:history.go(-1)">try again</a>.
<%
return;
}
//
// Looks good, let's create the meeting
//
String meeting_ID = createMeeting( meetingID, welcomeMsg, moderatorPW, viewerPW, voiceBridge, logoutURL );
//
// Check if we have an error.
//
if( meeting_ID.startsWith("Error ")) {
%>
Error: createMeeting() failed
<p /><%=meeting_ID%>
<%
return;
}
//
// We've got a valid meeting_ID and passoword -- let's join!
//
String joinURL = getJoinMeetingURL(username, meeting_ID, password);
%>
<script language="javascript" type="text/javascript">
window.location.href="<%=joinURL%>";
</script>
<%
}
%>
<%@ include file="demo_footer.jsp"%>
</body>
</html>

View File

@ -0,0 +1,106 @@
<!--
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, see <http://www.gnu.org/licenses/>.
Author: Islam El-Ashi <ielashi@gmail.com>
-->
<%@ page language="java" contentType="text/html; charset=UTF-8"
pageEncoding="UTF-8"%>
<%
request.setCharacterEncoding("UTF-8");
response.setCharacterEncoding("UTF-8");
%>
<%@page import="org.w3c.dom.*"%>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Activity Monitor</title>
<link href="http://ajax.googleapis.com/ajax/libs/jqueryui/1.8/themes/base/jquery-ui.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.4/jquery.min.js"></script>
<script src="http://ajax.googleapis.com/ajax/libs/jqueryui/1.8/jquery-ui.min.js"></script>
<script type="text/javascript" src="demo4.js"></script>
<script src="md5.js"></script>
<script type="text/javascript" src="jquery.xml2json.js"></script>
<style type="text/css">
.hiddenDiv {display:none;}
.hor-minimalist-b{font-family:"Lucida Sans Unicode", "Lucida Grande", Sans-Serif;font-size:12px;background:#fff;width:480px;border-collapse:collapse;text-align:left;margin:20px;}.hor-minimalist-b th{font-size:14px;font-weight:normal;color:#039;border-bottom:2px solid #6678b1;padding:10px 8px;}.hor-minimalist-b td{border-bottom:1px solid #ccc;color:#669;padding:6px 8px;width:100px;}.hor-minimalist-b tbody tr:hover td{color:#009;}</style>
</head>
<body>
<%@ include file="bbb_api.jsp"%>
<br>
<%@ include file="demo_header.jsp"%>
<%
if (request.getParameterMap().isEmpty()) {
%>
<h2>Demo #4: Activity Monitor</h2>
<p id="no_meetings"></p>
<div id="meetings"></div>
<%
} else if (request.getParameter("action").equals("end")) {
String mp = request.getParameter("moderatorPW");
String meetingID = request.getParameter("meetingID");
String result = endMeeting(meetingID, mp);
if ( result.equals("true") ){
%>
<h2>Demo #4: Activity Monitor</h2>
<%=meetingID%> has been terminated.
<p id="no_meetings"></p>
<div id="meetings"></div>
<% } else { %>
<h2>Demo #4: Activity Monitor</h2>
Unable to end meeting: <%=meetingID%>
<%=result%>
<% }
}%>
<%@ include file="demo_footer.jsp"%>
</body>
</html>

View File

@ -0,0 +1,6 @@
<?xml version="1.0" ?>
<%= getMeetings() %>
<%@ include file="bbb_api.jsp" %>
<%@ page contentType="text/xml" %>

View File

@ -0,0 +1,308 @@
<!--
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>
-->
<%@ page language="java" contentType="text/html; charset=UTF-8"
pageEncoding="UTF-8"%>
<%
request.setCharacterEncoding("UTF-8");
response.setCharacterEncoding("UTF-8");
%>
<!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=UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=EmulateIE7" />
<title>Create Your Own Meeting</title>
<script type="text/javascript"
src="http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.min.js"></script>
<script type="text/javascript" src="heartbeat.js"></script>
</head>
<body>
<%@ include file="bbb_api.jsp"%>
<%@ page import="java.util.regex.*"%>
<br>
<%
if (request.getParameterMap().isEmpty()) {
//
// Assume we want to create a meeting
//
%>
<%@ include file="demo_header.jsp"%>
<h2>Create Your Own Meeting</h2>
<p />
<FORM NAME="form1" METHOD="GET">
<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%">Create your own meeting.
<p />
</td>
<td width="50%">Step 1. Enter your name: <input type="text"
name="username1" /> <br />
<label for="crecord">record? </label>
<select id="crecord" name="record1">
<option value="true">yes</option>
<option value="false" selected>no</option>
</select>
<INPUT TYPE=hidden NAME=action VALUE="create"> <br />
<input id="submit-button" type="submit" value="Create meeting" /></td>
</tr>
</tbody>
</table>
</FORM>
<script>
//
// We could have asked the user for both their name and a meeting title, but we'll just use their name to create a title
// We'll use JQuery to dynamically update the button
//
$(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>
<%
} else if (request.getParameter("action").equals("create")) {
//
// User has requested to create a meeting
//
String username = request.getParameter("username1");
String meetingID = username + "'s meeting";
String record = request.getParameter("record1");
String meeting_ID = "";
//
// This is the URL for to join the meeting as moderator
//
String joinURL = getJoinURL(username, meetingID, record, "<br>Welcome to %%CONFNAME%%.<br>", null);
String inviteURL = BigBlueButtonURL + "demo/demo5.jsp?action=invite&meetingID=" + URLEncoder.encode(meetingID, "UTF-8");
%>
<hr />
<h2>Meeting Created</h2>
<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>
<td width="50%">
<p>&nbsp;</p>
Step 2. Invite others using the following <a href="<%=inviteURL%>">link</a> (shown below):
<form name="form2" method="POST">
<textarea cols="62" rows="5" name="myname" style="overflow: hidden">
<%=inviteURL%>
</textarea>
</form>
<p>&nbsp;
<p />Step 3. Click the following link to start your meeting:
<p>&nbsp;</p>
<center><a href="<%=joinURL%>">Start Meeting</a></center>
<p>&nbsp;</p>
</td>
</tr>
</tbody>
</table>
<%
} else if (request.getParameter("action").equals("enter")) {
//
// The user is now attempting to joing the meeting
//
String meetingID = request.getParameter("meetingID");
String username = request.getParameter("username");
String enterURL = BigBlueButtonURL
+ "demo/demo5.jsp?action=join&username="
+ URLEncoder.encode(username, "UTF-8") + "&meetingID="
+ URLEncoder.encode(meetingID, "UTF-8");
if (isMeetingRunning(meetingID).equals("true")) {
//
// The meeting has started -- bring the user into the meeting.
//
%>
<script type="text/javascript">
window.location = "<%=enterURL%>";
</script>
<%
} else {
//
// The meeting has not yet started, so check until we get back the status that the meeting is running
//
String checkMeetingStatus = getURLisMeetingRunning(meetingID);
%>
<script type="text/javascript">
$(document).ready(function(){
$.jheartbeat.set({
url: "<%=checkMeetingStatus%>",
delay: 5000
}, function () {
mycallback();
});
});
function mycallback() {
// Not elegant, but works around a bug in IE8
var isMeetingRunning = ($("#HeartBeatDIV").text().search("true") > 0 );
if (isMeetingRunning) {
window.location = "<%=enterURL%>";
}
}
</script>
<hr />
<h2><strong><%=meetingID%></strong> has not yet started.</h2>
<hr />
<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%">
<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>
</td>
<td width="50%"><img src="polling.gif"></img></td>
</tr>
</tbody>
</table>
<%
}
} else if (request.getParameter("action").equals("invite")) {
//
// We have an invite to an active meeting. Ask the person for their name
// so they can join.
//
String meetingID = request.getParameter("meetingID");
%>
<hr />
<h2>Invite</h2>
<hr />
<FORM NAME="form3" METHOD="GET">
<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%">
<p />You have been invited to join<br />
<strong><%=meetingID%></strong>.
</td>
<td width="50%">Enter your name: <input type="text"
name="username" /> <br />
<INPUT TYPE=hidden NAME=meetingID VALUE="<%=meetingID%>"> <INPUT
TYPE=hidden NAME=action VALUE="enter"> <br />
<input type="submit" value="Join" /></td>
</tr>
</tbody>
</table>
</FORM>
<%
} else if (request.getParameter("action").equals("join")) {
//
// We have an invite request to join an existing meeting and the meeting is running
//
// We don't need to pass a meeting descritpion as it's already been set by the first time
// the meeting was created.
String joinURL = getJoinURLViewer(request.getParameter("username"), request.getParameter("meetingID"));
if (joinURL.startsWith("http://")) {
%>
<script language="javascript" type="text/javascript">
window.location.href="<%=joinURL%>";
</script>
<%
} else {
%>
Error: getJoinURL() failed
<p /><%=joinURL%>
<%
}
}
%>
<%@ include file="demo_footer.jsp"%>
</body>
</html>

View File

@ -0,0 +1,263 @@
<!--
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>
-->
<%@ page language="java" contentType="text/html; charset=UTF-8"
pageEncoding="UTF-8"%>
<%
request.setCharacterEncoding("UTF-8");
response.setCharacterEncoding("UTF-8");
%>
<!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=UTF-8">
<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.6.1/jquery.min.js"></script>
<script type="text/javascript" src="heartbeat.js"></script>
<title>Recording Meeting Demo</title>
<style type="text/css">
#formcreate{
width:500px;
height:500px;
}
#formcreate ul{
list-style:none;
}
#formcreate li{
display:block;
width:400px;
margin-bottom:5px;
}
#formcreate label{
display:block;
float:left;
width:150px;
text-align:right;
}
#labdescription{
vertical-align:top;
}
</style>
</head>
<body>
<%@ include file="bbb_api.jsp"%>
<%@ page import="java.util.regex.*"%>
<%@ include file="demo_header.jsp"%>
<%
if (request.getParameterMap().isEmpty()) {
//
// Assume we want to create a meeting
//
%>
<h2>Demo Recording</h2>
<form id="formcreate" name="formcreate" method="get" action="">
<fieldset>
<legend>Meeting Information</legend>
<ul>
<li>
<label for="confname">Meeting Name:</label>
<input id="confname" name="confname" type="text" />
</li>
<li>
<label for="username1">Your Name:</label>
<input id="username1" name="username1" type="text" />
</li>
</ul>
</fieldset>
<fieldset>
<legend>Metadata Details</legend>
<ul>
<li>
<label for="meta_title">Title:</label>
<input type="text" id="meta_title" name="meta_title" />
</li>
<li>
<label for="meta_subject">Subject:</label>
<input type="text" id="meta_subject" name="meta_subject" />
</li>
<li>
<label id="labdescription" for="meta_description">Description:</label>
<textarea id="meta_description" name="meta_description" cols="17" rows="3"></textarea>
</li>
<li>
<label for="meta_creator">Creator:</label>
<input type="text" id="meta_creator" name="meta_creator" />
</li>
<li>
<label for="meta_contributor">Contributor:</label>
<input type="text" id="meta_contributor" name="meta_contributor" />
</li>
<li>
<label for="meta_language">Language:</label>
<input type="text" id="meta_language" name="meta_language" />
</li>
<li>
<label for="meta_identifier">Identifier:</label>
<input type="text" id="meta_identifier" name="meta_identifier" />
</li>
</ul>
</fieldset>
<input type="submit" value="Create" >
<input type="hidden" name="action" value="create" />
</form>
<%
} else if (request.getParameter("action").equals("create")) {
String confname=request.getParameter("confname");
String username = request.getParameter("username1");
//metadata
Map<String,String> metadata=new HashMap<String,String>();
metadata.put("title",request.getParameter("meta_title"));
metadata.put("subject",request.getParameter("meta_subject"));
metadata.put("description",request.getParameter("meta_description"));
metadata.put("creator",request.getParameter("meta_creator"));
metadata.put("contributor",request.getParameter("meta_contributor"));
metadata.put("language",request.getParameter("meta_language"));
metadata.put("identifier",request.getParameter("meta_identifier"));
//
// This is the URL for to join the meeting as moderator
//
String joinURL = getJoinURL(username, confname, "true", null, metadata);
String inviteURL = BigBlueButtonURL + "demo/demo6.jsp?action=invite&confname=" + URLEncoder.encode(confname, "UTF-8");
%>
<h2>Session Created</h2>
<label style="display:block;">Use the following link to invite others:</label>
<textarea cols="50" rows="6" style="overflow:hidden; display:block;" readonly="readonly">
<%=inviteURL%>
</textarea>
<a href="<%=joinURL%>">Start Session</a>
<%
} else if (request.getParameter("action").equals("enter")) {
//
// The user is now attempting to joing the meeting
//
String confname = request.getParameter("confname");
String username = request.getParameter("username");
String enterURL = BigBlueButtonURL
+ "demo/demo6.jsp?action=join&username="
+ URLEncoder.encode(username, "UTF-8") + "&confname="
+ URLEncoder.encode(confname, "UTF-8");
if (isMeetingRunning(confname).equals("true")) {
%>
<script type="text/javascript">
window.location = "<%=enterURL%>";
</script>
<%
} else {
String checkMeetingStatus = getURLisMeetingRunning(confname);
%>
<script type="text/javascript">
$(document).ready(function(){
$.jheartbeat.set({
url: "<%=checkMeetingStatus%>",
delay: 5000
}, function () {
mycallback();
});
});
function mycallback() {
// Not elegant, but works around a bug in IE8
var isMeetingRunning = ($("#HeartBeatDIV").text().search("true") > 0 );
if (isMeetingRunning) {
window.location = "<%=enterURL%>";
}
}
</script>
<h2><%=confname%> has not yet started.</h2>
<label style="display:block;">Hi <%=username%>, Now waiting for the moderator to start <%=confname%>.</label>
<label style="display:block;">(Your browser will automatically refresh and join the meeting when it starts.)</label>
<%
}
} else if (request.getParameter("action").equals("invite")) {
String meetingID = request.getParameter("confname");
%>
<h2>Invite</h2>
<form name="inviteform" method="get" action="">
<label style="display:block; font-weight:bold;">You have been invited to join <%=meetingID%></label>
<label for="username">Enter your name: </label>
<input type="text" name="username" id="username" />
<input type="hidden" name="confname" value="<%=meetingID%>" />
<input type="hidden" name="action" value="enter" />
<input type="submit" value="Join" />
</form>
<%
} else if (request.getParameter("action").equals("join")) {
String joinURL = getJoinURLViewer(request.getParameter("username"), request.getParameter("confname"));
if (joinURL.startsWith("http://")) {
%>
<script language="javascript" type="text/javascript">
window.location.href="<%=joinURL%>";
</script>
<%
} else {
%>
Error: getJoinURL() failed
<p /><%=joinURL%>
<%
}
}
%>
<%@ include file="demo_footer.jsp"%>
</body>
</html>

View File

@ -0,0 +1,2 @@
<p/>
<small>These demos use the <a href="http://code.google.com/p/bigbluebutton/wiki/API">BigBlueButton API</a>. The source code for these demos is available <a href="http://github.com/bigbluebutton/bigbluebutton/tree/master/bigbluebutton-web/web-app/demo/"> here</a>.</small>

View File

@ -0,0 +1 @@
<img src="/bigbluebutton/images/bbb_banner.jpg" /><br><a href="demo1.jsp">Join a Course</a> | <a href="demo2.jsp">Join a Selected Course</a> | <a href="demo3.jsp">Join a Course (password required)</a> | <a href="demo4.jsp">Activity Monitor</a> | <a href="create.jsp">Create Your Own Meeting</a> | <a href="demo6.jsp">Record Meeting</a>

View File

@ -0,0 +1,128 @@
<%@ page language="java" contentType="text/html; charset=UTF-8"
pageEncoding="UTF-8"%>
<%@ page isErrorPage="true" %>
<%@ page language="java" %>
<%@ page import="java.util.*" %>
<%@ page import="java.io.*" %>
<%
request.setCharacterEncoding("UTF-8");
response.setCharacterEncoding("UTF-8");
Object statusCode = request.getAttribute("javax.servlet.error.status_code");
Object exceptionType = request.getAttribute("javax.servlet.error.exception_type");
Object message = request.getAttribute("javax.servlet.error.message");
%>
<html>
<head>
<title>Error Page</title>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
</head>
<body bgcolor="#FFFFFF">
<P><A href="<%=response.encodeURL(request.getContextPath()) %>">Home</A></P>
<hr>
<H2>An Error has occured:</H2>
<TABLE CELLPADDING="2" CELLSPACING="2" BORDER="1" WIDTH="100%">
<TR>
<TD WIDTH="20%"><B>Status Code</B></TD>
<TD WIDTH="80%"><%= statusCode %></TD>
</TR>
<TR>
<TD WIDTH="20%"><B>Exception Type</B></TD>
<TD WIDTH="80%"><%= exceptionType %></TD>
</TR>
<TR>
<TD WIDTH="20%"><B>Message</B></TD>
<TD WIDTH="80%"><%= message %></TD>
</TR>
<TR>
<TD WIDTH="20%"><B>Exception</B></TD>
<TD WIDTH="80%">
<%
if( exception != null )
{
out.print("<PRE>");
exception.printStackTrace(new PrintWriter(out));
out.print("</PRE>");
}
%>
</TD>
</TR>
<TR>
<TD WIDTH="20%"><B>Root Cause</B></TD>
<TD>
<%
if( (exception != null) && (exception instanceof ServletException) )
{
Throwable cause = ((ServletException)exception).getRootCause();
if( cause != null )
{
out.print("<PRE>");
cause.printStackTrace(new PrintWriter(out));
out.print("</PRE>");
}
}
%>
</TD>
</TR>
</TABLE>
<hr>
Header List
<table border=3>
<tr>
<td>Name</td>
<td>Value</td>
</tr>
<%
String name = "";
String value = "";
java.util.Enumeration headers = request.getHeaderNames();
while(headers.hasMoreElements())
{
name = (String) headers.nextElement();
value = request.getHeader(name);
%>
<tr>
<td><%=name%></td>
<td><%=value%></td>
</tr>
<%
}
%>
</table>
Attribute List
<!-- "javax.servlet.jsp.jspException" for getting an Exception -->
<table border=3>
<%
java.util.Enumeration attributes = request.getAttributeNames();
while(attributes.hasMoreElements())
{
name = (String) attributes.nextElement();
if (request.getAttribute(name) == null)
{
value = "null";
}
else
{
value = request.getAttribute(name).toString();
}
%>
<tr>
<td><%=name%></td>
<td><%=value%></td>
</tr>
<%
}
%>
</table>
</body>
</html>

View File

@ -0,0 +1,5 @@
<html>
<body>
<h2>Hello World!</h2>
</body>
</html>

Binary file not shown.

View File

@ -0,0 +1,7 @@
<!DOCTYPE web-app PUBLIC
"-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN"
"http://java.sun.com/dtd/web-app_2_3.dtd" >
<web-app>
<display-name>Archetype Created Web Application</display-name>
</web-app>

View File

@ -0,0 +1,579 @@
<%/*
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>
*/%>
<%@page import="javax.xml.transform.dom.DOMSource"%>
<%@page import="javax.xml.transform.stream.StreamResult"%>
<%@page import="javax.xml.transform.OutputKeys"%>
<%@page import="javax.xml.transform.TransformerFactory"%>
<%@page import="javax.xml.transform.Transformer"%>
<%@page import="org.w3c.dom.Element"%>
<%@page import="com.sun.org.apache.xerces.internal.dom.ChildNode"%>
<%@page import="org.w3c.dom.Node"%>
<%@page import="org.w3c.dom.NodeList"%>
<%@page import="java.util.*,java.io.*,java.net.*,javax.crypto.*,javax.xml.parsers.*,org.w3c.dom.Document,org.xml.sax.*" errorPage="error.jsp"%>
<%@ page import="org.apache.commons.codec.digest.*"%>
<%@ page import="java.io.*"%>
<%@ page import="java.nio.channels.FileChannel"%>
<%@ include file="bbb_api_conf.jsp"%>
<%!//
// Create a meeting with specific
// - meetingID
// - welcome message
// - moderator password
// - viewer password
// - voiceBridge
// - logoutURL
//
public String createMeeting(String meetingID, String welcome,
String moderatorPassword, String viewerPassword,
Integer voiceBridge, String logoutURL) {
String base_url_create = BigBlueButtonURL + "api/create?";
String base_url_join = BigBlueButtonURL + "api/join?";
String welcome_param = "";
String checksum = "";
String attendee_password_param = "&attendeePW=ap";
String moderator_password_param = "&moderatorPW=mp";
String voice_bridge_param = "";
String logoutURL_param = "";
if ((welcome != null) && !welcome.equals("")) {
welcome_param = "&welcome=" + urlEncode(welcome);
}
if ((moderatorPassword != null) && !moderatorPassword.equals("")) {
moderator_password_param = "&moderatorPW="
+ urlEncode(moderatorPassword);
}
if ((viewerPassword != null) && !viewerPassword.equals("")) {
attendee_password_param = "&attendeePW="
+ urlEncode(viewerPassword);
}
if ((voiceBridge != null) && voiceBridge > 0) {
voice_bridge_param = "&voiceBridge="
+ urlEncode(voiceBridge.toString());
} else {
// No voice bridge number passed, so we'll generate a random one for this meeting
Random random = new Random();
Integer n = 70000 + random.nextInt(9999);
voice_bridge_param = "&voiceBridge=" + n;
}
if ((logoutURL != null) && !logoutURL.equals("")) {
logoutURL_param = "&logoutURL=" + urlEncode(logoutURL);
}
//
// Now create the URL
//
String create_parameters = "name=" + urlEncode(meetingID)
+ "&meetingID=" + urlEncode(meetingID) + welcome_param
+ attendee_password_param + moderator_password_param
+ voice_bridge_param + logoutURL_param;
Document doc = null;
try {
// Attempt to create a meeting using meetingID
String xml = getURL(base_url_create + create_parameters
+ "&checksum="
+ checksum("create" + create_parameters + salt));
doc = parseXml(xml);
} catch (Exception e) {
e.printStackTrace();
}
if (doc.getElementsByTagName("returncode").item(0).getTextContent()
.trim().equals("SUCCESS")) {
return meetingID;
}
return "Error "
+ doc.getElementsByTagName("messageKey").item(0)
.getTextContent().trim()
+ ": "
+ doc.getElementsByTagName("message").item(0).getTextContent()
.trim();
}
//
// getJoinMeetingURL() -- get join meeting URL for both viewer and moderator
//
public String getJoinMeetingURL(String username, String meetingID,
String password) {
String base_url_join = BigBlueButtonURL + "api/join?";
String join_parameters = "meetingID=" + urlEncode(meetingID)
+ "&fullName=" + urlEncode(username) + "&password="
+ urlEncode(password);
return base_url_join + join_parameters + "&checksum="
+ checksum("join" + join_parameters + salt);
}
//
// Create a meeting and return a URL to join it as moderator
//
public String getJoinURL(String username, String meetingID, String welcome) {
String base_url_create = BigBlueButtonURL + "api/create?";
String base_url_join = BigBlueButtonURL + "api/join?";
String welcome_param = "";
String good_url = "xxx";
Random random = new Random();
Integer voiceBridge = 70000 + random.nextInt(9999);
if ((welcome != null) && !welcome.equals("")) {
welcome_param = "&welcome=" + urlEncode(welcome);
}
//
// When creating a meeting, the 'name' parameter is the name of the meeting (not to be confused with
// the username). For example, the name could be "Fred's meeting" and the meetingID could be "ID-1234312".
//
// While name and meetinID could be different, we'll keep them the same. Why? Because calling api/create?
// with a previously used meetingID will return same meetingToken (regardless if the meeting is running or not).
//
// This means the first person to call getJoinURL with meetingID="Demo Meeting" will actually create the
// meeting. Subsequent calls will return the same meetingToken and thus subsequent users will join the same
// meeting.
//
// Note: We're hard-coding the password for moderator and attendee (viewer) for purposes of demo.
//
String create_parameters = "name=" + urlEncode(meetingID)
+ "&meetingID=" + urlEncode(meetingID) + welcome_param
+ "&attendeePW=ap&moderatorPW=mp&voiceBridge=" + voiceBridge;
Document doc = null;
try {
// Attempt to create a meeting using meetingID
good_url = base_url_create + create_parameters
+ "&checksum="
+ checksum("create" + create_parameters + salt);
String xml = getURL( good_url );
//String xml = getURL(base_url_create + create_parameters
/// + "&checksum="
// + checksum("create" + create_parameters + salt));
doc = parseXml(xml);
} catch (Exception e) {
e.printStackTrace();
}
if (doc.getElementsByTagName("returncode").item(0).getTextContent()
.trim().equals("SUCCESS")) {
//
// Now create a URL to join that meeting
//
String join_parameters = "meetingID=" + urlEncode(meetingID)
+ "&fullName=" + urlEncode(username) + "&password=mp";
return base_url_join + join_parameters + "&checksum="
+ checksum("join" + join_parameters + salt);
}
return doc.getElementsByTagName("messageKey").item(0).getTextContent()
.trim()
+ ": "
+ doc.getElementsByTagName("message").item(0).getTextContent()
.trim();
}
//
//Create a meeting and return a URL to join it as moderator
//
public String getJoinURLXML(String username, String meetingID,
String welcome, String xml_param) {
String base_url_create = BigBlueButtonURL + "api/create?";
String base_url_join = BigBlueButtonURL + "api/join?";
String welcome_param = "";
Random random = new Random();
Integer voiceBridge = 70000 + random.nextInt(9999);
if ((welcome != null) && !welcome.equals("")) {
welcome_param = "&welcome=" + urlEncode(welcome);
}
String create_parameters = "name=" + urlEncode(meetingID)
+ "&meetingID=" + urlEncode(meetingID) + welcome_param
+ "&attendeePW=ap&moderatorPW=mp&voiceBridge=" + voiceBridge;
Document doc = null;
try {
// Attempt to create a meeting using meetingID
String xml = excutePost(base_url_create + create_parameters
+ "&checksum="
+ checksum("create" + create_parameters + salt), xml_param);
doc = parseXml(xml);
} catch (Exception e) {
e.printStackTrace();
}
if (doc.getElementsByTagName("returncode").item(0).getTextContent()
.trim().equals("SUCCESS")) {
String join_parameters = "meetingID=" + urlEncode(meetingID)
+ "&fullName=" + urlEncode(username) + "&password=mp";
return base_url_join + join_parameters + "&checksum="
+ checksum("join" + join_parameters + salt);
}
return doc.getElementsByTagName("messageKey").item(0).getTextContent()
.trim()
+ ": "
+ doc.getElementsByTagName("message").item(0).getTextContent()
.trim();
}
//
// getJoinURLViewer() -- Get the URL to join a meeting as viewer
//
public String getJoinURLViewer(String username, String meetingID) {
String base_url_join = BigBlueButtonURL + "api/join?";
String join_parameters = "meetingID=" + urlEncode(meetingID)
+ "&fullName=" + urlEncode(username) + "&password=ap";
return base_url_join + join_parameters + "&checksum="
+ checksum("join" + join_parameters + salt);
}
//
// checksum() -- create a hash based on the shared salt (located in bbb_api_conf.jsp)
//
public static String checksum(String s) {
String checksum = "";
try {
checksum = org.apache.commons.codec.digest.DigestUtils.shaHex(s);
} catch (Exception e) {
e.printStackTrace();
}
return checksum;
}
//
// getURL() -- fetch a URL and return its contents as a String
//
public static String getURL(String url) {
StringBuffer response = null;
try {
URL u = new URL(url);
HttpURLConnection httpConnection = (HttpURLConnection) u
.openConnection();
httpConnection.setUseCaches(false);
httpConnection.setDoOutput(true);
httpConnection.setRequestMethod("GET");
httpConnection.connect();
int responseCode = httpConnection.getResponseCode();
if (responseCode == HttpURLConnection.HTTP_OK) {
InputStream input = httpConnection.getInputStream();
// Read server's response.
response = new StringBuffer();
Reader reader = new InputStreamReader(input, "UTF-8");
reader = new BufferedReader(reader);
char[] buffer = new char[1024];
for (int n = 0; n >= 0;) {
n = reader.read(buffer, 0, buffer.length);
if (n > 0)
response.append(buffer, 0, n);
}
input.close();
httpConnection.disconnect();
}
} catch (Exception e) {
e.printStackTrace();
}
if (response != null) {
return response.toString();
} else {
return "";
}
}
public static String excutePost(String targetURL, String urlParameters)
{
URL url;
HttpURLConnection connection = null;
int responseCode = 0;
try {
//Create connection
url = new URL(targetURL);
connection = (HttpURLConnection)url.openConnection();
connection.setRequestMethod("POST");
connection.setRequestProperty("Content-Type",
"text/xml");
connection.setRequestProperty("Content-Length", "" +
Integer.toString(urlParameters.getBytes().length));
connection.setRequestProperty("Content-Language", "en-US");
connection.setUseCaches (false);
connection.setDoInput(true);
connection.setDoOutput(true);
//Send request
DataOutputStream wr = new DataOutputStream (
connection.getOutputStream ());
wr.writeBytes (urlParameters);
wr.flush ();
wr.close ();
//Get Response
InputStream is = connection.getInputStream();
BufferedReader rd = new BufferedReader(new InputStreamReader(is));
String line;
StringBuffer response = new StringBuffer();
while((line = rd.readLine()) != null) {
response.append(line);
response.append('\r');
}
rd.close();
return response.toString();
} catch (Exception e) {
e.printStackTrace();
return null;
} finally {
if(connection != null) {
connection.disconnect();
}
}
}
//
// getURLisMeetingRunning() -- return a URL that the client can use to poll for whether the given meeting is running
//
public String getURLisMeetingRunning(String meetingID) {
String base_main = "&meetingID=" + urlEncode(meetingID);
String base_url = BigBlueButtonURL + "api/isMeetingRunning?";
String checksum = "";
try {
checksum = DigestUtils
.shaHex("isMeetingRunning" + base_main + salt);
} catch (Exception e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
return base_url + base_main + "&checksum=" + checksum;
}
//
// isMeetingRunning() -- check the BigBlueButton server to see if the meeting is running (i.e. there is someone in the meeting)
//
public String isMeetingRunning(String meetingID) {
String base_main = "&meetingID=" + urlEncode(meetingID);
String base_url = BigBlueButtonURL + "api/isMeetingRunning?";
String checksum = "";
try {
checksum = DigestUtils
.shaHex("isMeetingRunning" + base_main + salt);
} catch (Exception e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
String xml = getURL(base_url + base_main + "&checksum=" + checksum);
Document doc = null;
try {
doc = parseXml(xml);
} catch (Exception e) {
e.printStackTrace();
}
if (doc.getElementsByTagName("returncode").item(0).getTextContent()
.trim().equals("SUCCESS")) {
return doc.getElementsByTagName("running").item(0).getTextContent()
.trim();
}
return "false";
}
public String getMeetingInfoURL(String meetingID, String password) {
String meetingParameters = "meetingID=" + urlEncode(meetingID)
+ "&password=" + password;
return BigBlueButtonURL + "api/getMeetingInfo?" + meetingParameters
+ "&checksum="
+ checksum("getMeetingInfo" + meetingParameters + salt);
}
public String getMeetingInfo(String meetingID, String password) {
try {
URLConnection hpCon = new URL(
getMeetingInfoURL(meetingID, password)).openConnection();
InputStreamReader isr = new InputStreamReader(
hpCon.getInputStream());
BufferedReader br = new BufferedReader(isr);
String data = br.readLine();
return data;
} catch (Exception e) {
e.printStackTrace(System.out);
return "";
}
}
public String getMeetingsURL() {
String meetingParameters = "random=" + new Random().nextInt(9999);
return BigBlueButtonURL + "api/getMeetings?" + meetingParameters
+ "&checksum="
+ checksum("getMeetings" + meetingParameters + salt);
}
//
// Calls getMeetings to obtain the list of meetings, then calls getMeetingInfo for each meeting
// and concatenates the result.
//
public String getMeetings() {
try {
// Call the API and get the result
URLConnection hpCon = new URL(getMeetingsURL()).openConnection();
InputStreamReader isr = new InputStreamReader(
hpCon.getInputStream());
BufferedReader br = new BufferedReader(isr);
String data = br.readLine();
Document doc = parseXml(data);
// tags needed for parsing xml documents
final String startTag = "<meetings>";
final String endTag = "</meetings>";
final String startResponse = "<response>";
final String endResponse = "</response>";
// if the request succeeded, then calculate the checksum of each meeting and insert it into the document
NodeList meetingsList = doc.getElementsByTagName("meeting");
String newXMldocument = startTag;
for (int i = 0; i < meetingsList.getLength(); i++) {
Element meeting = (Element) meetingsList.item(i);
String meetingID = meeting.getElementsByTagName("meetingID")
.item(0).getTextContent();
String password = meeting.getElementsByTagName("moderatorPW")
.item(0).getTextContent();
data = getMeetingInfo(meetingID, password);
if (data.indexOf("<response>") != -1) {
int startIndex = data.indexOf(startResponse)
+ startTag.length();
int endIndex = data.indexOf(endResponse);
newXMldocument += "<meeting>"
+ data.substring(startIndex, endIndex)
+ "</meeting>";
}
}
newXMldocument += endTag;
return newXMldocument;
} catch (Exception e) {
e.printStackTrace(System.out);
return null;
}
}
//
public String endMeeting(String meetingID, String moderatorPassword) {
String base_main = "meetingID=" + urlEncode(meetingID) + "&password="
+ urlEncode(moderatorPassword);
String base_url = BigBlueButtonURL + "api/end?";
String checksum = "";
try {
checksum = DigestUtils.shaHex("end" + base_main + salt);
} catch (Exception e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
String xml = getURL(base_url + base_main + "&checksum=" + checksum);
Document doc = null;
try {
doc = parseXml(xml);
} catch (Exception e) {
e.printStackTrace();
}
if (doc.getElementsByTagName("returncode").item(0).getTextContent()
.trim().equals("SUCCESS")) {
return "true";
}
return "Error "
+ doc.getElementsByTagName("messageKey").item(0)
.getTextContent().trim()
+ ": "
+ doc.getElementsByTagName("message").item(0).getTextContent()
.trim();
}
//
// parseXml() -- return a DOM of the XML
//
public static Document parseXml(String xml)
throws ParserConfigurationException, IOException, SAXException {
DocumentBuilderFactory docFactory = DocumentBuilderFactory
.newInstance();
DocumentBuilder docBuilder = docFactory.newDocumentBuilder();
Document doc = docBuilder.parse(new InputSource(new StringReader(xml)));
return doc;
}
//
// urlEncode() -- URL encode the string
//
public static String urlEncode(String s) {
try {
return URLEncoder.encode(s, "UTF-8");
} catch (Exception e) {
e.printStackTrace();
}
return "";
}
%>

View File

@ -0,0 +1,14 @@
<%!
// This is the security salt that must match the value set in the BigBlueButton server
//String salt = "4951c2aea43e5af6d9598610b9e0b6c7";
//String salt = "5e5ff0968546b8aaacce0462a99bca30";
String salt = "5e5ff0968546b8aaacce0462a99bca30";
// This is the URL for the BigBlueButton server 4951c2aea43e5af6d9598610b9e0b6c7
String BigBlueButtonURL = "http://192.168.0.217/bigbluebutton/";
%>

View File

@ -0,0 +1,120 @@
<html>
<head><title>Preupload Presentation</title></head></p> <p>
<body>
<%@ include file="bbb_api.jsp"%>
<%@ include file="demo_header.jsp"%>
<h2>Demo #5: Upload a presentation before joining a Course...</h2>
<form action="demo5.jsp" method="post" enctype
="multipart/form-data" name="form1" id="form1">
<table cellpadding="5" cellspacing="5" style="width: 400px;">
<tbody>
<tr>
<td>&nbsp;</td>
<td style="text-align: right;">Full Name:</td>
<td style="width: 5px;">&nbsp;</td>
<td style="text-align: left"><input type="text"
name="username" />
</td>
</tr>
<tr>
<td>&nbsp;</td>
<td style="text-align: left">Upload File:</td>
<td style="width: 5px;">&nbsp;</td>
<td style="text-align: left"><input type="file"
name="filename" /><!-- <input type="submit" />-->
</td>
</tr>
<tr>
<td>&nbsp;</td>
<td>&nbsp;</td>
<td>&nbsp;</td>
<td><input type="submit" value="Join" />
</td>
</tr>
</tbody>
</table>
<INPUT TYPE=hidden NAME=action VALUE="create">
</form>
</body>
</html>
<%@ page import="java.util.List" %>
<%@ page import="java.util.Iterator" %>
<%@ page import="java.io.File" %>
<%@ page import="org.apache.commons.fileupload.servlet.ServletFileUpload"%>
<%@ page import="org.apache.commons.fileupload.disk.DiskFileItemFactory"%>
<%@ page import="org.apache.commons.fileupload.*"%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@page import="sun.security.provider.SHA"%>
<%@page import="org.apache.commons.codec.binary.Base64"%>
<%@page import="java.security.MessageDigest"%>
<%
String uname="";
boolean isMultipart = ServletFileUpload.isMultipartContent(request);
if (!isMultipart) {
}
else {
FileItemFactory factory = new DiskFileItemFactory();
ServletFileUpload upload = new ServletFileUpload(factory);
List<FileItem> items = null;
try {
items = upload.parseRequest(request);
} catch (FileUploadException e) {
e.printStackTrace();
}
out.print(items.size());
Iterator<FileItem> itr = items.iterator();
while (itr.hasNext()) {
FileItem item = (FileItem) itr.next();
String xml = null;
xml = "<?xml version='1.0' encoding='UTF-8'?> <modules> <module name='presentation'> <document url='http://www.samplepdf.com/sample.pdf' /> </module></modules>";
if (item.isFormField())
{
String name = item.getFieldName();
String value = item.getString();
if(name.equals("username"))
{
uname=value;
}
} else {
try {
String itemName = item.getName();
if(itemName==""){
xml = "<?xml version='1.0' encoding='UTF-8'?> <modules> <module name='presentation'> <document url='http://www.samplepdf.com/sample.pdf' /> </module></modules>";
}
else {
byte[] b = item.get();
String encoded = Base64.encodeBase64String(b);
xml = "<?xml version='1.0' encoding='UTF-8'?> <modules> <module name=\"presentation\"> <document name=\""+itemName+"\">"+encoded+"\"</document> </module></modules>";
}
} catch (Exception e) {
e.printStackTrace();
}
String joinURL = getJoinURLXML(uname, "Demo Meeting", "Presentation should be uploaded. It was uploaded as an encoded file", xml );
if (joinURL.startsWith("http://")) {
%>
<center><h1>Your presentation has been Uploaded</h1></center>
<script language="javascript" type="text/javascript">
window.location.href="<%=joinURL%>";
</script>
<%
} else {
%>
Error: getJoinURL() failed
<p />
<%=joinURL %>
<%
}
}
}
}
%>

View File

@ -0,0 +1,112 @@
<html>
<head><title>Preupload Presentation</title></head></p> <p>
<body>
<%@ include file="bbb_api.jsp"%>
<%@ include file="demo_header.jsp"%>
<%
String fileURL = BigBlueButtonURL.replace("/bigbluebutton",":8080/demo");
String name1="Demo123.pdf";
String name2="Demo456.pdf";
String name3="Demo789.pdf";
%>
<h2>Demo #6: Send a presentation URL before joining a Course...</h2>
<form action="demo6.jsp" method="post" enctype
="multipart/form-data" name="form1" id="form1">
<table cellpadding="5" cellspacing="5" style="width: 400px;">
<tbody>
<tr>
<td>&nbsp;</td>
<td style="text-align: right;">Full Name:</td>
<td style="width: 5px;">&nbsp;</td>
<td style="text-align: left"><input type="text"
name="username" />
</td>
</tr>
<tr>
<td>&nbsp;</td>
<td style="text-align: right">File Name:</td>
<td style="width: 5px;">&nbsp;</td>
<td><select name=filename>
<option value=<%=name1%>><%=name1.substring(0,name1.length()-4)%></option>
<option value=<%=name2%>><%=name2.substring(0,name2.length()-4)%></option>
<option value=<%=name3%>><%=name3.substring(0,name3.length()-4)%></option>
</select>
</td>
</tr>
<tr>
<td>&nbsp;</td>
<td>&nbsp;</td>
<td>&nbsp;</td>
<td><input type="submit" value="Join" />
</td>
</tr>
</tbody>
</table>
<INPUT TYPE=hidden NAME=action VALUE="create">
</form>
</body>
</html>
<%@ page import="java.util.List" %>
<%@ page import="java.util.Iterator" %>
<%@ page import="java.io.File" %>
<%@ page import="org.apache.commons.fileupload.servlet.ServletFileUpload"%>
<%@ page import="org.apache.commons.fileupload.disk.DiskFileItemFactory"%>
<%@ page import="org.apache.commons.fileupload.*"%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@page import="sun.security.provider.SHA"%>
<%@page import="org.apache.commons.codec.binary.Base64"%>
<%@page import="java.security.MessageDigest"%>
<%
String uname="";
String fname="";
boolean isMultipart = ServletFileUpload.isMultipartContent(request);
if (!isMultipart) {
}
else {
FileItemFactory factory = new DiskFileItemFactory();
ServletFileUpload upload = new ServletFileUpload(factory);
List<FileItem> items = null;
try {
items = upload.parseRequest(request);
} catch (FileUploadException e) {
e.printStackTrace();
}
Iterator<FileItem> itr = items.iterator();
String xml = null;
while (itr.hasNext()) {
FileItem item = (FileItem) itr.next();
String name = item.getFieldName();
String value = item.getString();
if(name.equals("username")) {
uname=value;
}
if(name.equals("filename")) {
fname=value;
}
}
xml = "<?xml version='1.0' encoding='UTF-8'?> <modules> <module name='presentation'> <document url='"+fileURL+fname+"' /> </module></modules>";
String joinURL = getJoinURLXML(uname, "Demo Meeting", "Presentation URL should be passed.", xml );
if (joinURL.startsWith("http://")) {
%>
<center><h1>Your presentation URL has been passed</h1></center>
<script language="javascript" type="text/javascript">
window.location.href="<%=joinURL%>";
</script>
<%
} else {
%>
Error: getJoinURL() failed
<p />
<%=joinURL %>
<%
}
}
%>

View File

@ -0,0 +1 @@
<img src="/bigbluebutton/images/bbb_banner.jpg" /><br><a href="demo5.jsp">Auto Upload File</a> | <a href="demo6.jsp">Auto Upload File URL</a>

View File

@ -0,0 +1,448 @@
<%
/*
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>
*/
%>
<%@page import="javax.xml.transform.dom.DOMSource"%>
<%@page import="javax.xml.transform.stream.StreamResult"%>
<%@page import="javax.xml.transform.OutputKeys"%>
<%@page import="javax.xml.transform.TransformerFactory"%>
<%@page import="javax.xml.transform.Transformer"%>
<%@page import="org.w3c.dom.Element"%>
<%@page import="com.sun.org.apache.xerces.internal.dom.ChildNode"%>
<%@page import="org.w3c.dom.Node"%>
<%@page import="org.w3c.dom.NodeList"%>
<%@ page
import="java.util.*,java.io.*,java.net.*,javax.crypto.*,javax.xml.parsers.*,org.w3c.dom.Document,org.xml.sax.*"
errorPage="error.jsp" %>
<%@ page import="org.apache.commons.codec.digest.*"%>
<%@ include file="bbb_api_conf.jsp"%>
<%!
//
// Create a meeting with specific
// - meetingID
// - welcome message
// - moderator password
// - viewer password
// - voiceBridge
// - logoutURL
//
public String createMeeting(String meetingID, String welcome, String moderatorPassword, String viewerPassword, Integer voiceBridge, String logoutURL) {
String base_url_create = BigBlueButtonURL + "api/create?";
String base_url_join = BigBlueButtonURL + "api/join?";
String welcome_param = "";
String checksum = "";
String attendee_password_param = "&attendeePW=ap";
String moderator_password_param = "&moderatorPW=mp";
String voice_bridge_param = "";
String logoutURL_param = "";
if ( (welcome != null) && ! welcome.equals("")) {
welcome_param = "&welcome=" + urlEncode(welcome);
}
if ( (moderatorPassword != null) && ! moderatorPassword.equals("")) {
moderator_password_param = "&moderatorPW=" + urlEncode(moderatorPassword);
}
if ( (viewerPassword != null) && ! viewerPassword.equals("")) {
attendee_password_param = "&attendeePW=" + urlEncode(viewerPassword);
}
if ( (voiceBridge != null) && voiceBridge > 0 ) {
voice_bridge_param = "&voiceBridge=" + urlEncode(voiceBridge.toString());
} else {
// No voice bridge number passed, so we'll generate a random one for this meeting
Random random = new Random();
Integer n = 70000 + random.nextInt(9999);
voice_bridge_param = "&voiceBridge=" + n;
}
if ( (logoutURL != null) && ! logoutURL.equals("")) {
logoutURL_param = "&logoutURL=" + urlEncode(logoutURL);
}
//
// Now create the URL
//
String create_parameters = "name=" + urlEncode(meetingID) + "&meetingID=" + urlEncode(meetingID)
+ welcome_param + attendee_password_param + moderator_password_param
+ voice_bridge_param + logoutURL_param;
Document doc = null;
try {
// Attempt to create a meeting using meetingID
String xml = getURL(base_url_create + create_parameters + "&checksum=" + checksum("create" + create_parameters + salt) );
doc = parseXml(xml);
} catch (Exception e) {
e.printStackTrace();
}
if (doc.getElementsByTagName("returncode").item(0).getTextContent()
.trim().equals("SUCCESS")) {
return meetingID;
}
return "Error " + doc.getElementsByTagName("messageKey").item(0).getTextContent().trim()
+ ": " + doc.getElementsByTagName("message").item(0).getTextContent().trim();
}
//
// getJoinMeetingURL() -- get join meeting URL for both viewer and moderator
//
public String getJoinMeetingURL(String username, String meetingID, String password) {
String base_url_join = BigBlueButtonURL + "api/join?";
String join_parameters = "meetingID=" + urlEncode(meetingID) + "&fullName=" + urlEncode(username)
+ "&password=" + urlEncode(password);
return base_url_join + join_parameters + "&checksum=" + checksum("join" + join_parameters + salt);
}
//
// Create a meeting and return a URL to join it as moderator
//
public String getJoinURL(String username, String meetingID, String record, String welcome, Map<String, String> metadata) {
String base_url_create = BigBlueButtonURL + "api/create?";
String base_url_join = BigBlueButtonURL + "api/join?";
String welcome_param = "";
Random random = new Random();
Integer voiceBridge = 70000 + random.nextInt(9999);
if ( (welcome != null) && ! welcome.equals("")) {
welcome_param = "&welcome=" + urlEncode(welcome);
}
//
// When creating a meeting, the 'name' parameter is the name of the meeting (not to be confused with
// the username). For example, the name could be "Fred's meeting" and the meetingID could be "ID-1234312".
//
// While name and meetinID could be different, we'll keep them the same. Why? Because calling api/create?
// with a previously used meetingID will return same meetingToken (regardless if the meeting is running or not).
//
// This means the first person to call getJoinURL with meetingID="Demo Meeting" will actually create the
// meeting. Subsequent calls will return the same meetingToken and thus subsequent users will join the same
// meeting.
//
// Note: We're hard-coding the password for moderator and attendee (viewer) for purposes of demo.
//
String create_parameters = "name=" + urlEncode(meetingID) + "&meetingID=" + urlEncode(meetingID)
+ welcome_param + "&attendeePW=ap&moderatorPW=mp&voiceBridge="
+ voiceBridge + "&record=" + record;
if(metadata!=null){
String metadata_params="";
for(String metakey : metadata.keySet()){
metadata_params = metadata_params + "&meta_" + urlEncode(metakey) + "=" + urlEncode(metadata.get(metakey));
}
create_parameters = create_parameters + metadata_params;
}
Document doc = null;
try {
// Attempt to create a meeting using meetingID
String xml = getURL(base_url_create + create_parameters + "&checksum=" + checksum("create" + create_parameters + salt) );
doc = parseXml(xml);
} catch (Exception e) {
e.printStackTrace();
}
if (doc.getElementsByTagName("returncode").item(0).getTextContent()
.trim().equals("SUCCESS")) {
//
// Now create a URL to join that meeting
//
String join_parameters = "meetingID=" + urlEncode(meetingID) + "&fullName=" + urlEncode(username) + "&password=mp";
return base_url_join + join_parameters + "&checksum=" + checksum("join" + join_parameters + salt);
}
return doc.getElementsByTagName("messageKey").item(0).getTextContent().trim()
+ ": " + doc.getElementsByTagName("message").item(0).getTextContent().trim();
}
//
// getJoinURLViewer() -- Get the URL to join a meeting as viewer
//
public String getJoinURLViewer(String username, String meetingID) {
String base_url_join = BigBlueButtonURL + "api/join?";
String join_parameters = "meetingID=" + urlEncode(meetingID) + "&fullName=" + urlEncode(username)
+ "&password=ap";
return base_url_join + join_parameters + "&checksum=" + checksum("join" + join_parameters + salt);
}
//
// checksum() -- create a hash based on the shared salt (located in bbb_api_conf.jsp)
//
public static String checksum(String s) {
String checksum = "";
try {
checksum = org.apache.commons.codec.digest.DigestUtils.shaHex(s);
} catch (Exception e) {
e.printStackTrace();
}
return checksum;
}
//
// getURL() -- fetch a URL and return its contents as a String
//
public static String getURL(String url) {
StringBuffer response = null;
try {
URL u = new URL(url);
HttpURLConnection httpConnection = (HttpURLConnection) u
.openConnection();
httpConnection.setUseCaches(false);
httpConnection.setDoOutput(true);
httpConnection.setRequestMethod("GET");
httpConnection.connect();
int responseCode = httpConnection.getResponseCode();
if (responseCode == HttpURLConnection.HTTP_OK) {
InputStream input = httpConnection.getInputStream();
// Read server's response.
response = new StringBuffer();
Reader reader = new InputStreamReader(input, "UTF-8");
reader = new BufferedReader(reader);
char[] buffer = new char[1024];
for (int n = 0; n >= 0;) {
n = reader.read(buffer, 0, buffer.length);
if (n > 0)
response.append(buffer, 0, n);
}
input.close();
httpConnection.disconnect();
}
} catch (Exception e) {
e.printStackTrace();
}
if (response != null) {
return response.toString();
} else {
return "";
}
}
//
// getURLisMeetingRunning() -- return a URL that the client can use to poll for whether the given meeting is running
//
public String getURLisMeetingRunning(String meetingID) {
String base_main = "&meetingID=" + urlEncode(meetingID);
String base_url = BigBlueButtonURL + "api/isMeetingRunning?";
String checksum ="";
try {
checksum = DigestUtils.shaHex("isMeetingRunning" + base_main + salt);
} catch (Exception e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
return base_url + base_main + "&checksum=" + checksum;
}
//
// isMeetingRunning() -- check the BigBlueButton server to see if the meeting is running (i.e. there is someone in the meeting)
//
public String isMeetingRunning(String meetingID) {
String base_main = "&meetingID=" + urlEncode(meetingID);
String base_url = BigBlueButtonURL + "api/isMeetingRunning?";
String checksum ="";
try {
checksum = DigestUtils.shaHex("isMeetingRunning" + base_main + salt);
} catch (Exception e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
String xml = getURL(base_url + base_main + "&checksum=" + checksum);
Document doc = null;
try {
doc = parseXml(xml);
} catch (Exception e) {
e.printStackTrace();
}
if (doc.getElementsByTagName("returncode").item(0).getTextContent()
.trim().equals("SUCCESS")) {
return doc.getElementsByTagName("running").item(0).getTextContent().trim();
}
return "false";
}
public String getMeetingInfoURL(String meetingID, String password) {
String meetingParameters = "meetingID=" + urlEncode(meetingID) + "&password=" + password;
return BigBlueButtonURL + "api/getMeetingInfo?" + meetingParameters + "&checksum=" + checksum("getMeetingInfo" + meetingParameters + salt);
}
public String getMeetingInfo(String meetingID, String password) {
try {
URLConnection hpCon = new URL(getMeetingInfoURL(meetingID, password)).openConnection();
InputStreamReader isr = new InputStreamReader(hpCon.getInputStream());
BufferedReader br = new BufferedReader(isr);
String data = br.readLine();
return data;
} catch (Exception e) {
e.printStackTrace(System.out);
return "";
}
}
public String getMeetingsURL() {
String meetingParameters = "random=" + new Random().nextInt(9999);
return BigBlueButtonURL + "api/getMeetings?" + meetingParameters + "&checksum=" + checksum("getMeetings" + meetingParameters + salt);
}
//
// Calls getMeetings to obtain the list of meetings, then calls getMeetingInfo for each meeting
// and concatenates the result.
//
public String getMeetings() {
try {
// Call the API and get the result
URLConnection hpCon = new URL(getMeetingsURL()).openConnection();
InputStreamReader isr = new InputStreamReader(hpCon.getInputStream());
BufferedReader br = new BufferedReader(isr);
String data = br.readLine();
Document doc = parseXml(data);
// tags needed for parsing xml documents
final String startTag = "<meetings>";
final String endTag = "</meetings>";
final String startResponse = "<response>";
final String endResponse = "</response>";
// if the request succeeded, then calculate the checksum of each meeting and insert it into the document
NodeList meetingsList = doc.getElementsByTagName("meeting");
String newXMldocument = startTag;
for (int i = 0; i < meetingsList.getLength(); i++) {
Element meeting = (Element) meetingsList.item(i);
String meetingID = meeting.getElementsByTagName("meetingID").item(0).getTextContent();
String password = meeting.getElementsByTagName("moderatorPW").item(0).getTextContent();
data = getMeetingInfo(meetingID, password);
if (data.indexOf("<response>") != -1) {
int startIndex = data.indexOf(startResponse) + startTag.length();
int endIndex = data.indexOf(endResponse);
newXMldocument += "<meeting>" + data.substring(startIndex, endIndex) + "</meeting>";
}
}
newXMldocument += endTag;
return newXMldocument;
} catch (Exception e) {
e.printStackTrace(System.out);
return null;
}
}
//
public String endMeeting(String meetingID, String moderatorPassword) {
String base_main = "meetingID=" + urlEncode(meetingID) + "&password=" + urlEncode(moderatorPassword);
String base_url = BigBlueButtonURL + "api/end?";
String checksum ="";
try {
checksum = DigestUtils.shaHex("end" + base_main + salt);
} catch (Exception e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
String xml = getURL(base_url + base_main + "&checksum=" + checksum);
Document doc = null;
try {
doc = parseXml(xml);
} catch (Exception e) {
e.printStackTrace();
}
if (doc.getElementsByTagName("returncode").item(0).getTextContent()
.trim().equals("SUCCESS")) {
return "true";
}
return "Error " + doc.getElementsByTagName("messageKey").item(0).getTextContent().trim()
+ ": " + doc.getElementsByTagName("message").item(0).getTextContent().trim();
}
//
// parseXml() -- return a DOM of the XML
//
public static Document parseXml(String xml) throws ParserConfigurationException, IOException, SAXException {
DocumentBuilderFactory docFactory = DocumentBuilderFactory.newInstance();
DocumentBuilder docBuilder = docFactory.newDocumentBuilder();
Document doc = docBuilder.parse(new InputSource(new StringReader(xml)));
return doc;
}
//
// urlEncode() -- URL encode the string
//
public static String urlEncode(String s) {
try {
return URLEncoder.encode(s, "UTF-8");
} catch (Exception e) {
e.printStackTrace();
}
return "";
}
%>

View File

@ -0,0 +1,308 @@
<!--
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>
-->
<%@ page language="java" contentType="text/html; charset=UTF-8"
pageEncoding="UTF-8"%>
<%
request.setCharacterEncoding("UTF-8");
response.setCharacterEncoding("UTF-8");
%>
<!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=UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=EmulateIE7" />
<title>Create Your Own Meeting</title>
<script type="text/javascript"
src="http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.min.js"></script>
<script type="text/javascript" src="heartbeat.js"></script>
</head>
<body>
<%@ include file="bbb_api.jsp"%>
<%@ page import="java.util.regex.*"%>
<br>
<%
if (request.getParameterMap().isEmpty()) {
//
// Assume we want to create a meeting
//
%>
<%@ include file="demo_header.jsp"%>
<h2>Create Your Own Meeting</h2>
<p />
<FORM NAME="form1" METHOD="GET">
<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%">Create your own meeting.
<p />
</td>
<td width="50%">Step 1. Enter your name: <input type="text"
name="username1" /> <br />
<label for="crecord">record? </label>
<select id="crecord" name="record1">
<option value="true">yes</option>
<option value="false" selected>no</option>
</select>
<INPUT TYPE=hidden NAME=action VALUE="create"> <br />
<input id="submit-button" type="submit" value="Create meeting" /></td>
</tr>
</tbody>
</table>
</FORM>
<script>
//
// We could have asked the user for both their name and a meeting title, but we'll just use their name to create a title
// We'll use JQuery to dynamically update the button
//
$(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>
<%
} else if (request.getParameter("action").equals("create")) {
//
// User has requested to create a meeting
//
String username = request.getParameter("username1");
String meetingID = username + "'s meeting";
String record = request.getParameter("record1");
String meeting_ID = "";
//
// This is the URL for to join the meeting as moderator
//
String joinURL = getJoinURL(username, meetingID, record, "<br>Welcome to %%CONFNAME%%.<br>", null);
String inviteURL = BigBlueButtonURL + "demo/create.jsp?action=invite&meetingID=" + URLEncoder.encode(meetingID, "UTF-8");
%>
<hr />
<h2>Meeting Created</h2>
<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>
<td width="50%">
<p>&nbsp;</p>
Step 2. Invite others using the following <a href="<%=inviteURL%>">link</a> (shown below):
<form name="form2" method="POST">
<textarea cols="62" rows="5" name="myname" style="overflow: hidden">
<%=inviteURL%>
</textarea>
</form>
<p>&nbsp;
<p />Step 3. Click the following link to start your meeting:
<p>&nbsp;</p>
<center><a href="<%=joinURL%>">Start Meeting</a></center>
<p>&nbsp;</p>
</td>
</tr>
</tbody>
</table>
<%
} else if (request.getParameter("action").equals("enter")) {
//
// The user is now attempting to joing the meeting
//
String meetingID = request.getParameter("meetingID");
String username = request.getParameter("username");
String enterURL = BigBlueButtonURL
+ "demo/create.jsp?action=join&username="
+ URLEncoder.encode(username, "UTF-8") + "&meetingID="
+ URLEncoder.encode(meetingID, "UTF-8");
if (isMeetingRunning(meetingID).equals("true")) {
//
// The meeting has started -- bring the user into the meeting.
//
%>
<script type="text/javascript">
window.location = "<%=enterURL%>";
</script>
<%
} else {
//
// The meeting has not yet started, so check until we get back the status that the meeting is running
//
String checkMeetingStatus = getURLisMeetingRunning(meetingID);
%>
<script type="text/javascript">
$(document).ready(function(){
$.jheartbeat.set({
url: "<%=checkMeetingStatus%>",
delay: 5000
}, function () {
mycallback();
});
});
function mycallback() {
// Not elegant, but works around a bug in IE8
var isMeetingRunning = ($("#HeartBeatDIV").text().search("true") > 0 );
if (isMeetingRunning) {
window.location = "<%=enterURL%>";
}
}
</script>
<hr />
<h2><strong><%=meetingID%></strong> has not yet started.</h2>
<hr />
<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%">
<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>
</td>
<td width="50%"><img src="polling.gif"></img></td>
</tr>
</tbody>
</table>
<%
}
} else if (request.getParameter("action").equals("invite")) {
//
// We have an invite to an active meeting. Ask the person for their name
// so they can join.
//
String meetingID = request.getParameter("meetingID");
%>
<hr />
<h2>Invite</h2>
<hr />
<FORM NAME="form3" METHOD="GET">
<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%">
<p />You have been invited to join<br />
<strong><%=meetingID%></strong>.
</td>
<td width="50%">Enter your name: <input type="text"
name="username" /> <br />
<INPUT TYPE=hidden NAME=meetingID VALUE="<%=meetingID%>"> <INPUT
TYPE=hidden NAME=action VALUE="enter"> <br />
<input type="submit" value="Join" /></td>
</tr>
</tbody>
</table>
</FORM>
<%
} else if (request.getParameter("action").equals("join")) {
//
// We have an invite request to join an existing meeting and the meeting is running
//
// We don't need to pass a meeting descritpion as it's already been set by the first time
// the meeting was created.
String joinURL = getJoinURLViewer(request.getParameter("username"), request.getParameter("meetingID"));
if (joinURL.startsWith("http://")) {
%>
<script language="javascript" type="text/javascript">
window.location.href="<%=joinURL%>";
</script>
<%
} else {
%>
Error: getJoinURL() failed
<p /><%=joinURL%>
<%
}
}
%>
<%@ include file="demo_footer.jsp"%>
</body>
</html>

View File

@ -0,0 +1,119 @@
<!--
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>
-->
<%@ page language="java" contentType="text/html; charset=UTF-8"
pageEncoding="UTF-8"%>
<%
request.setCharacterEncoding("UTF-8");
response.setCharacterEncoding("UTF-8");
%>
<!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=UTF-8">
<title>Join a Course</title>
</head>
<body>
<%@ include file="bbb_api.jsp"%>
<br>
<%
if (request.getParameterMap().isEmpty()) {
//
// Assume we want to create a meeting
//
%>
<%@ include file="demo_header.jsp"%>
<h2>Demo #1: Join a Course</h2>
<FORM NAME="form1" METHOD="GET">
<table cellpadding="5" cellspacing="5" style="width: 400px; ">
<tbody>
<tr>
<td>
&nbsp;</td>
<td style="text-align: right; ">
Full Name:</td>
<td style="width: 5px; ">
&nbsp;</td>
<td style="text-align: left ">
<input type="text" name="username" /></td>
</tr>
<tr>
<td>
&nbsp;</td>
<td>
&nbsp;</td>
<td>
&nbsp;</td>
<td>
<input type="submit" value="Join" /></td>
</tr>
</tbody>
</table>
<INPUT TYPE=hidden NAME=action VALUE="create">
</FORM>
<%
} else if (request.getParameter("action").equals("create")) {
//
// Got an action=create
//
//
// Request a URL to join a meeting called "Demo Meeting"
// Pass null for welcome message to use the default message (see defaultWelcomeMessage in bigbluebutton.properties)
// Update: Added record parameter, default: false
//
String joinURL = getJoinURL(request.getParameter("username"), "Demo Meeting", "false", null, null);
if (joinURL.startsWith("http://")) {
%>
<script language="javascript" type="text/javascript">
window.location.href="<%=joinURL%>";
</script>
<%
} else {
%>
Error: getJoinURL() failed
<p/>
<%=joinURL %>
<%
}
}
%>
<%@ include file="demo_footer.jsp"%>
</body>
</html>

View File

@ -0,0 +1,130 @@
<!--
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>
-->
<%@ page language="java" contentType="text/html; charset=UTF-8"
pageEncoding="UTF-8"%>
<%
request.setCharacterEncoding("UTF-8");
response.setCharacterEncoding("UTF-8");
%>
<!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=UTF-8">
<title>Join a Selected Course</title>
</head>
<body>
<%@ include file="bbb_api.jsp"%>
<br>
<%
if (request.getParameterMap().isEmpty()) {
//
// Assume we want to create a meeting
//
%>
<%@ include file="demo_header.jsp"%>
<h2>Demo #2: Join a Selected Course</h2>
<FORM NAME="form1" METHOD="GET">
<table cellpadding="5" cellspacing="5" style="width: 400px; ">
<tbody>
<tr>
<td>
&nbsp;</td>
<td style="text-align: right; ">
Full Name:</td>
<td style="width: 5px; ">
&nbsp;</td>
<td style="text-align: left ">
<input type="text" name="username" /></td>
</tr>
<tr>
<td>
&nbsp;</td>
<td style="text-align: right; ">
Course:</td>
<td>
&nbsp;
</td>
<td style="text-align: left ">
<select name="meetingID">
<option value="English 232">English 232</option>
<option value="English 300">English 300</option>
<option value="English 402">English 402</option>
<option value="Demo Meeting">Demo Meeting</option>
</select>
</td>
</tr>
<tr>
<td>
&nbsp;</td>
<td>
&nbsp;</td>
<td>
&nbsp;</td>
<td>
<input type="submit" value="Join" /></td>
</tr>
</tbody>
</table>
<INPUT TYPE=hidden NAME=action VALUE="create">
</FORM>
<%
} else if (request.getParameter("action").equals("create")) {
//
// Got an action=create
//
String username = request.getParameter("username");
String meetingID = request.getParameter("meetingID");
// String joinURL = getJoinURL(username, meetingID, "Welcome to " + meetingID );
// Update: added record parameter, default false
String joinURL = getJoinURL(username, meetingID,"false", "<br>Welcome to course: %%CONFNAME%%.<br>", null );
if (joinURL.startsWith("http://")) {
%>
<script language="javascript" type="text/javascript">
window.location.href="<%=joinURL%>";
</script>
<%
} else {
%>
Error: getJoinURL() failed
<p /><%=joinURL%> <%
}
}
%> <%@ include file="demo_footer.jsp"%>
</body>
</html>

View File

@ -0,0 +1,293 @@
<!--
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>
-->
<%@ page language="java" contentType="text/html; charset=UTF-8"
pageEncoding="UTF-8"%>
<%
request.setCharacterEncoding("UTF-8");
response.setCharacterEncoding("UTF-8");
%>
<!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=UTF-8">
<title>Join a Course (Password Required)</title>
</head>
<body>
<%@ include file="bbb_api.jsp"%>
<br>
<%
//
// We're going to define some sample courses (meetings) below. This API exampe shows how you can create a login page for a course.
// The password below are not available to users as they are compiled on the server.
//
HashMap<String, HashMap> allMeetings = new HashMap<String, HashMap>();
HashMap<String, String> meeting;
String welcome = "<br>Welcome to %%CONFNAME%%!<br><br>For help see our <a href=\"event:http://www.bigbluebutton.org/content/videos\"><u>tutorial videos</u></a>.<br><br>To join the voice bridge for this meeting:<br> (1) click the headset icon in the upper-left, or<br> (2) dial xxx-xxx-xxxx (toll free:1-xxx-xxx-xxxx) and enter conference ID: %%CONFNUM%%.<br><br>";
//
// English courses
//
meeting = new HashMap<String, String>();
allMeetings.put( "ENGL-2013: Research Methods in English", meeting ); // The title that will appear in the drop-down menu
meeting.put("welcomeMsg", welcome); // The welcome mesage
meeting.put("moderatorPW", "prof123"); // The password for moderator
meeting.put("viewerPW", "student123"); // The password for viewer
meeting.put("voiceBridge", "72013"); // The extension number for the voice bridge (use if connected to phone system)
meeting.put("logoutURL", "/bigbluebutton/demo/demo3.jsp"); // The logout URL (use if you want to return to your pages)
meeting = new HashMap<String, String>();
allMeetings.put( "ENGL-2213: Drama Production I", meeting );
meeting.put("welcomeMsg", welcome);
meeting.put("moderatorPW", "prof123");
meeting.put("viewerPW", "student123");
meeting.put("voiceBridge", "72213");
meeting.put("logoutURL", "/bigbluebutton/demo/demo3.jsp");
meeting = new HashMap<String, String>();
allMeetings.put( "ENGL-2023: Survey of English Literature", meeting );
meeting.put("welcomeMsg", welcome);
meeting.put("moderatorPW", "prof123");
meeting.put("viewerPW", "student123");
meeting.put("voiceBridge", "72023");
meeting.put("logoutURL", "/bigbluebutton/demo/demo3.jsp");
//
// Law Courses
//
meeting = new HashMap<String, String>();
allMeetings.put( "LAW-1323: Fundamentals of Advocacy ", meeting );
meeting.put("welcomeMsg", welcome);
meeting.put("moderatorPW", "prof123");
meeting.put("viewerPW", "student123");
meeting.put("voiceBridge", "71232");
meeting.put("logoutURL", "/bigbluebutton/demo/demo3.jsp");
meeting = new HashMap<String, String>();
allMeetings.put( "LAW-2273: Business Organizations", meeting );
meeting.put("welcomeMsg", welcome);
meeting.put("moderatorPW", "prof123");
meeting.put("viewerPW", "student123");
meeting.put("voiceBridge", "72273");
meeting.put("logoutURL", "/bigbluebutton/demo/demo3.jsp");
meeting = new HashMap<String, String>();
allMeetings.put( "LAW-3113: Corporate Finance", meeting );
meeting.put("welcomeMsg", welcome);
meeting.put("moderatorPW", "theprof");
meeting.put("viewerPW", "student123");
meeting.put("voiceBridge", "71642");
meeting.put("logoutURL", "/bigbluebutton/demo/demo3.jsp");
//
// Professor's Virtaul Office Hours
//
meeting = new HashMap<String, String>();
allMeetings.put( "Virtual Office Hours - Steve Stoyan", meeting );
meeting.put("welcomeMsg", welcome);
meeting.put("moderatorPW", "prof123");
meeting.put("viewerPW", "student123");
meeting.put("voiceBridge", "70001");
meeting.put("logoutURL", "/bigbluebutton/demo/demo3.jsp");
meeting = new HashMap<String, String>();
allMeetings.put( "Virtual Office Hours - Michael Bailetti", meeting );
meeting.put("welcomeMsg", welcome);
meeting.put("moderatorPW", "prof123");
meeting.put("viewerPW", "student123");
meeting.put("voiceBridge", "70002");
meeting.put("logoutURL", "/bigbluebutton/demo/demo3.jsp");
meeting = new HashMap<String, String>();
allMeetings.put( "Virtual Office Hours - Tony Weiss", meeting );
meeting.put("welcomeMsg", welcome);
meeting.put("moderatorPW", "prof123");
meeting.put("viewerPW", "student123");
meeting.put("voiceBridge", "70003");
meeting.put("logoutURL", "/bigbluebutton/demo/demo3.jsp");
meeting = null;
Iterator<String> meetingIterator = new TreeSet<String>(allMeetings.keySet()).iterator();
if (request.getParameterMap().isEmpty()) {
//
// Assume we want to join a course
//
%>
<%@ include file="demo_header.jsp"%>
<h2>Demo #3: Join a Course (password required)</h2>
<FORM NAME="form1" METHOD="GET">
<table cellpadding="5" cellspacing="5" style="width: 400px; ">
<tbody>
<tr>
<td>
&nbsp;</td>
<td style="text-align: right; ">
Full&nbsp;Name:</td>
<td style="width: 5px; ">
&nbsp;</td>
<td style="text-align: left ">
<input type="text" name="username" /></td>
</tr>
<tr>
<td>
&nbsp;</td>
<td style="text-align: right; ">
Course:</td>
<td>
&nbsp;
</td>
<td style="text-align: left ">
<select name="meetingID">
<%
String key;
while (meetingIterator.hasNext()) {
key = meetingIterator.next();
out.println("<option value=\"" + key + "\">" + key + "</option>");
}
%>
</select>
</td>
</tr>
<tr>
<td>
&nbsp;</td>
<td style="text-align: right; ">
Password:</td>
<td>
&nbsp;</td>
<td>
<input type="password" name="password" /></td>
</tr>
<tr>
<td>
&nbsp;</td>
<td>
&nbsp;</td>
<td>
&nbsp;</td>
<td>
<input type="submit" value="Join" /></td>
</tr>
</tbody>
</table>
<INPUT TYPE=hidden NAME=action VALUE="create">
</FORM>
Passwords:
<ul>
<li>prof123 - login as professor (moderator privlidges)</li>
<li>student123 - login as student (viewer privlidges)</li>
</ul>
<%
} else if (request.getParameter("action").equals("create")) {
//
// Got an action=create
//
String username = request.getParameter("username");
String meetingID = request.getParameter("meetingID");
String password = request.getParameter("password");
meeting = allMeetings.get( meetingID );
String welcomeMsg = meeting.get( "welcomeMsg" );
String logoutURL = meeting.get( "logoutURL" );
Integer voiceBridge = Integer.parseInt( meeting.get( "voiceBridge" ).trim() );
String viewerPW = meeting.get( "viewerPW" );
String moderatorPW = meeting.get( "moderatorPW" );
//
// Check if we have a valid password
//
if ( ! password.equals(viewerPW) && ! password.equals(moderatorPW) ) {
%>
Invalid Password, please <a href="javascript:history.go(-1)">try again</a>.
<%
return;
}
//
// Looks good, let's create the meeting
//
String meeting_ID = createMeeting( meetingID, welcomeMsg, moderatorPW, viewerPW, voiceBridge, logoutURL );
//
// Check if we have an error.
//
if( meeting_ID.startsWith("Error ")) {
%>
Error: createMeeting() failed
<p /><%=meeting_ID%>
<%
return;
}
//
// We've got a valid meeting_ID and passoword -- let's join!
//
String joinURL = getJoinMeetingURL(username, meeting_ID, password);
%>
<script language="javascript" type="text/javascript">
window.location.href="<%=joinURL%>";
</script>
<%
}
%>
<%@ include file="demo_footer.jsp"%>
</body>
</html>

View File

@ -0,0 +1,106 @@
<!--
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, see <http://www.gnu.org/licenses/>.
Author: Islam El-Ashi <ielashi@gmail.com>
-->
<%@ page language="java" contentType="text/html; charset=UTF-8"
pageEncoding="UTF-8"%>
<%
request.setCharacterEncoding("UTF-8");
response.setCharacterEncoding("UTF-8");
%>
<%@page import="org.w3c.dom.*"%>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Activity Monitor</title>
<link href="http://ajax.googleapis.com/ajax/libs/jqueryui/1.8/themes/base/jquery-ui.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.4/jquery.min.js"></script>
<script src="http://ajax.googleapis.com/ajax/libs/jqueryui/1.8/jquery-ui.min.js"></script>
<script type="text/javascript" src="demo4.js"></script>
<script src="md5.js"></script>
<script type="text/javascript" src="jquery.xml2json.js"></script>
<style type="text/css">
.hiddenDiv {display:none;}
.hor-minimalist-b{font-family:"Lucida Sans Unicode", "Lucida Grande", Sans-Serif;font-size:12px;background:#fff;width:480px;border-collapse:collapse;text-align:left;margin:20px;}.hor-minimalist-b th{font-size:14px;font-weight:normal;color:#039;border-bottom:2px solid #6678b1;padding:10px 8px;}.hor-minimalist-b td{border-bottom:1px solid #ccc;color:#669;padding:6px 8px;width:100px;}.hor-minimalist-b tbody tr:hover td{color:#009;}</style>
</head>
<body>
<%@ include file="bbb_api.jsp"%>
<br>
<%@ include file="demo_header.jsp"%>
<%
if (request.getParameterMap().isEmpty()) {
%>
<h2>Demo #4: Activity Monitor</h2>
<p id="no_meetings"></p>
<div id="meetings"></div>
<%
} else if (request.getParameter("action").equals("end")) {
String mp = request.getParameter("moderatorPW");
String meetingID = request.getParameter("meetingID");
String result = endMeeting(meetingID, mp);
if ( result.equals("true") ){
%>
<h2>Demo #4: Activity Monitor</h2>
<%=meetingID%> has been terminated.
<p id="no_meetings"></p>
<div id="meetings"></div>
<% } else { %>
<h2>Demo #4: Activity Monitor</h2>
Unable to end meeting: <%=meetingID%>
<%=result%>
<% }
}%>
<%@ include file="demo_footer.jsp"%>
</body>
</html>

View File

@ -0,0 +1,6 @@
<?xml version="1.0" ?>
<%= getMeetings() %>
<%@ include file="bbb_api.jsp" %>
<%@ page contentType="text/xml" %>

View File

@ -0,0 +1,308 @@
<!--
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>
-->
<%@ page language="java" contentType="text/html; charset=UTF-8"
pageEncoding="UTF-8"%>
<%
request.setCharacterEncoding("UTF-8");
response.setCharacterEncoding("UTF-8");
%>
<!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=UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=EmulateIE7" />
<title>Create Your Own Meeting</title>
<script type="text/javascript"
src="http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.min.js"></script>
<script type="text/javascript" src="heartbeat.js"></script>
</head>
<body>
<%@ include file="bbb_api.jsp"%>
<%@ page import="java.util.regex.*"%>
<br>
<%
if (request.getParameterMap().isEmpty()) {
//
// Assume we want to create a meeting
//
%>
<%@ include file="demo_header.jsp"%>
<h2>Create Your Own Meeting</h2>
<p />
<FORM NAME="form1" METHOD="GET">
<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%">Create your own meeting.
<p />
</td>
<td width="50%">Step 1. Enter your name: <input type="text"
name="username1" /> <br />
<label for="crecord">record? </label>
<select id="crecord" name="record1">
<option value="true">yes</option>
<option value="false" selected>no</option>
</select>
<INPUT TYPE=hidden NAME=action VALUE="create"> <br />
<input id="submit-button" type="submit" value="Create meeting" /></td>
</tr>
</tbody>
</table>
</FORM>
<script>
//
// We could have asked the user for both their name and a meeting title, but we'll just use their name to create a title
// We'll use JQuery to dynamically update the button
//
$(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>
<%
} else if (request.getParameter("action").equals("create")) {
//
// User has requested to create a meeting
//
String username = request.getParameter("username1");
String meetingID = username + "'s meeting";
String record = request.getParameter("record1");
String meeting_ID = "";
//
// This is the URL for to join the meeting as moderator
//
String joinURL = getJoinURL(username, meetingID, record, "<br>Welcome to %%CONFNAME%%.<br>", null);
String inviteURL = BigBlueButtonURL + "demo/demo5.jsp?action=invite&meetingID=" + URLEncoder.encode(meetingID, "UTF-8");
%>
<hr />
<h2>Meeting Created</h2>
<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>
<td width="50%">
<p>&nbsp;</p>
Step 2. Invite others using the following <a href="<%=inviteURL%>">link</a> (shown below):
<form name="form2" method="POST">
<textarea cols="62" rows="5" name="myname" style="overflow: hidden">
<%=inviteURL%>
</textarea>
</form>
<p>&nbsp;
<p />Step 3. Click the following link to start your meeting:
<p>&nbsp;</p>
<center><a href="<%=joinURL%>">Start Meeting</a></center>
<p>&nbsp;</p>
</td>
</tr>
</tbody>
</table>
<%
} else if (request.getParameter("action").equals("enter")) {
//
// The user is now attempting to joing the meeting
//
String meetingID = request.getParameter("meetingID");
String username = request.getParameter("username");
String enterURL = BigBlueButtonURL
+ "demo/demo5.jsp?action=join&username="
+ URLEncoder.encode(username, "UTF-8") + "&meetingID="
+ URLEncoder.encode(meetingID, "UTF-8");
if (isMeetingRunning(meetingID).equals("true")) {
//
// The meeting has started -- bring the user into the meeting.
//
%>
<script type="text/javascript">
window.location = "<%=enterURL%>";
</script>
<%
} else {
//
// The meeting has not yet started, so check until we get back the status that the meeting is running
//
String checkMeetingStatus = getURLisMeetingRunning(meetingID);
%>
<script type="text/javascript">
$(document).ready(function(){
$.jheartbeat.set({
url: "<%=checkMeetingStatus%>",
delay: 5000
}, function () {
mycallback();
});
});
function mycallback() {
// Not elegant, but works around a bug in IE8
var isMeetingRunning = ($("#HeartBeatDIV").text().search("true") > 0 );
if (isMeetingRunning) {
window.location = "<%=enterURL%>";
}
}
</script>
<hr />
<h2><strong><%=meetingID%></strong> has not yet started.</h2>
<hr />
<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%">
<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>
</td>
<td width="50%"><img src="polling.gif"></img></td>
</tr>
</tbody>
</table>
<%
}
} else if (request.getParameter("action").equals("invite")) {
//
// We have an invite to an active meeting. Ask the person for their name
// so they can join.
//
String meetingID = request.getParameter("meetingID");
%>
<hr />
<h2>Invite</h2>
<hr />
<FORM NAME="form3" METHOD="GET">
<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%">
<p />You have been invited to join<br />
<strong><%=meetingID%></strong>.
</td>
<td width="50%">Enter your name: <input type="text"
name="username" /> <br />
<INPUT TYPE=hidden NAME=meetingID VALUE="<%=meetingID%>"> <INPUT
TYPE=hidden NAME=action VALUE="enter"> <br />
<input type="submit" value="Join" /></td>
</tr>
</tbody>
</table>
</FORM>
<%
} else if (request.getParameter("action").equals("join")) {
//
// We have an invite request to join an existing meeting and the meeting is running
//
// We don't need to pass a meeting descritpion as it's already been set by the first time
// the meeting was created.
String joinURL = getJoinURLViewer(request.getParameter("username"), request.getParameter("meetingID"));
if (joinURL.startsWith("http://")) {
%>
<script language="javascript" type="text/javascript">
window.location.href="<%=joinURL%>";
</script>
<%
} else {
%>
Error: getJoinURL() failed
<p /><%=joinURL%>
<%
}
}
%>
<%@ include file="demo_footer.jsp"%>
</body>
</html>

View File

@ -0,0 +1,263 @@
<!--
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>
-->
<%@ page language="java" contentType="text/html; charset=UTF-8"
pageEncoding="UTF-8"%>
<%
request.setCharacterEncoding("UTF-8");
response.setCharacterEncoding("UTF-8");
%>
<!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=UTF-8">
<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.6.1/jquery.min.js"></script>
<script type="text/javascript" src="heartbeat.js"></script>
<title>Recording Meeting Demo</title>
<style type="text/css">
#formcreate{
width:500px;
height:500px;
}
#formcreate ul{
list-style:none;
}
#formcreate li{
display:block;
width:400px;
margin-bottom:5px;
}
#formcreate label{
display:block;
float:left;
width:150px;
text-align:right;
}
#labdescription{
vertical-align:top;
}
</style>
</head>
<body>
<%@ include file="bbb_api.jsp"%>
<%@ page import="java.util.regex.*"%>
<%@ include file="demo_header.jsp"%>
<%
if (request.getParameterMap().isEmpty()) {
//
// Assume we want to create a meeting
//
%>
<h2>Demo Recording</h2>
<form id="formcreate" name="formcreate" method="get" action="">
<fieldset>
<legend>Meeting Information</legend>
<ul>
<li>
<label for="confname">Meeting Name:</label>
<input id="confname" name="confname" type="text" />
</li>
<li>
<label for="username1">Your Name:</label>
<input id="username1" name="username1" type="text" />
</li>
</ul>
</fieldset>
<fieldset>
<legend>Metadata Details</legend>
<ul>
<li>
<label for="meta_title">Title:</label>
<input type="text" id="meta_title" name="meta_title" />
</li>
<li>
<label for="meta_subject">Subject:</label>
<input type="text" id="meta_subject" name="meta_subject" />
</li>
<li>
<label id="labdescription" for="meta_description">Description:</label>
<textarea id="meta_description" name="meta_description" cols="17" rows="3"></textarea>
</li>
<li>
<label for="meta_creator">Creator:</label>
<input type="text" id="meta_creator" name="meta_creator" />
</li>
<li>
<label for="meta_contributor">Contributor:</label>
<input type="text" id="meta_contributor" name="meta_contributor" />
</li>
<li>
<label for="meta_language">Language:</label>
<input type="text" id="meta_language" name="meta_language" />
</li>
<li>
<label for="meta_identifier">Identifier:</label>
<input type="text" id="meta_identifier" name="meta_identifier" />
</li>
</ul>
</fieldset>
<input type="submit" value="Create" >
<input type="hidden" name="action" value="create" />
</form>
<%
} else if (request.getParameter("action").equals("create")) {
String confname=request.getParameter("confname");
String username = request.getParameter("username1");
//metadata
Map<String,String> metadata=new HashMap<String,String>();
metadata.put("title",request.getParameter("meta_title"));
metadata.put("subject",request.getParameter("meta_subject"));
metadata.put("description",request.getParameter("meta_description"));
metadata.put("creator",request.getParameter("meta_creator"));
metadata.put("contributor",request.getParameter("meta_contributor"));
metadata.put("language",request.getParameter("meta_language"));
metadata.put("identifier",request.getParameter("meta_identifier"));
//
// This is the URL for to join the meeting as moderator
//
String joinURL = getJoinURL(username, confname, "true", null, metadata);
String inviteURL = BigBlueButtonURL + "demo/demo6.jsp?action=invite&confname=" + URLEncoder.encode(confname, "UTF-8");
%>
<h2>Session Created</h2>
<label style="display:block;">Use the following link to invite others:</label>
<textarea cols="50" rows="6" style="overflow:hidden; display:block;" readonly="readonly">
<%=inviteURL%>
</textarea>
<a href="<%=joinURL%>">Start Session</a>
<%
} else if (request.getParameter("action").equals("enter")) {
//
// The user is now attempting to joing the meeting
//
String confname = request.getParameter("confname");
String username = request.getParameter("username");
String enterURL = BigBlueButtonURL
+ "demo/demo6.jsp?action=join&username="
+ URLEncoder.encode(username, "UTF-8") + "&confname="
+ URLEncoder.encode(confname, "UTF-8");
if (isMeetingRunning(confname).equals("true")) {
%>
<script type="text/javascript">
window.location = "<%=enterURL%>";
</script>
<%
} else {
String checkMeetingStatus = getURLisMeetingRunning(confname);
%>
<script type="text/javascript">
$(document).ready(function(){
$.jheartbeat.set({
url: "<%=checkMeetingStatus%>",
delay: 5000
}, function () {
mycallback();
});
});
function mycallback() {
// Not elegant, but works around a bug in IE8
var isMeetingRunning = ($("#HeartBeatDIV").text().search("true") > 0 );
if (isMeetingRunning) {
window.location = "<%=enterURL%>";
}
}
</script>
<h2><%=confname%> has not yet started.</h2>
<label style="display:block;">Hi <%=username%>, Now waiting for the moderator to start <%=confname%>.</label>
<label style="display:block;">(Your browser will automatically refresh and join the meeting when it starts.)</label>
<%
}
} else if (request.getParameter("action").equals("invite")) {
String meetingID = request.getParameter("confname");
%>
<h2>Invite</h2>
<form name="inviteform" method="get" action="">
<label style="display:block; font-weight:bold;">You have been invited to join <%=meetingID%></label>
<label for="username">Enter your name: </label>
<input type="text" name="username" id="username" />
<input type="hidden" name="confname" value="<%=meetingID%>" />
<input type="hidden" name="action" value="enter" />
<input type="submit" value="Join" />
</form>
<%
} else if (request.getParameter("action").equals("join")) {
String joinURL = getJoinURLViewer(request.getParameter("username"), request.getParameter("confname"));
if (joinURL.startsWith("http://")) {
%>
<script language="javascript" type="text/javascript">
window.location.href="<%=joinURL%>";
</script>
<%
} else {
%>
Error: getJoinURL() failed
<p /><%=joinURL%>
<%
}
}
%>
<%@ include file="demo_footer.jsp"%>
</body>
</html>

View File

@ -0,0 +1,2 @@
<p/>
<small>These demos use the <a href="http://code.google.com/p/bigbluebutton/wiki/API">BigBlueButton API</a>. The source code for these demos is available <a href="http://github.com/bigbluebutton/bigbluebutton/tree/master/bigbluebutton-web/web-app/demo/"> here</a>.</small>

View File

@ -0,0 +1 @@
<img src="/bigbluebutton/images/bbb_banner.jpg" /><br><a href="demo1.jsp">Join a Course</a> | <a href="demo2.jsp">Join a Selected Course</a> | <a href="demo3.jsp">Join a Course (password required)</a> | <a href="demo4.jsp">Activity Monitor</a> | <a href="create.jsp">Create Your Own Meeting</a> | <a href="demo6.jsp">Record Meeting</a>

View File

@ -0,0 +1,128 @@
<%@ page language="java" contentType="text/html; charset=UTF-8"
pageEncoding="UTF-8"%>
<%@ page isErrorPage="true" %>
<%@ page language="java" %>
<%@ page import="java.util.*" %>
<%@ page import="java.io.*" %>
<%
request.setCharacterEncoding("UTF-8");
response.setCharacterEncoding("UTF-8");
Object statusCode = request.getAttribute("javax.servlet.error.status_code");
Object exceptionType = request.getAttribute("javax.servlet.error.exception_type");
Object message = request.getAttribute("javax.servlet.error.message");
%>
<html>
<head>
<title>Error Page</title>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
</head>
<body bgcolor="#FFFFFF">
<P><A href="<%=response.encodeURL(request.getContextPath()) %>">Home</A></P>
<hr>
<H2>An Error has occured:</H2>
<TABLE CELLPADDING="2" CELLSPACING="2" BORDER="1" WIDTH="100%">
<TR>
<TD WIDTH="20%"><B>Status Code</B></TD>
<TD WIDTH="80%"><%= statusCode %></TD>
</TR>
<TR>
<TD WIDTH="20%"><B>Exception Type</B></TD>
<TD WIDTH="80%"><%= exceptionType %></TD>
</TR>
<TR>
<TD WIDTH="20%"><B>Message</B></TD>
<TD WIDTH="80%"><%= message %></TD>
</TR>
<TR>
<TD WIDTH="20%"><B>Exception</B></TD>
<TD WIDTH="80%">
<%
if( exception != null )
{
out.print("<PRE>");
exception.printStackTrace(new PrintWriter(out));
out.print("</PRE>");
}
%>
</TD>
</TR>
<TR>
<TD WIDTH="20%"><B>Root Cause</B></TD>
<TD>
<%
if( (exception != null) && (exception instanceof ServletException) )
{
Throwable cause = ((ServletException)exception).getRootCause();
if( cause != null )
{
out.print("<PRE>");
cause.printStackTrace(new PrintWriter(out));
out.print("</PRE>");
}
}
%>
</TD>
</TR>
</TABLE>
<hr>
Header List
<table border=3>
<tr>
<td>Name</td>
<td>Value</td>
</tr>
<%
String name = "";
String value = "";
java.util.Enumeration headers = request.getHeaderNames();
while(headers.hasMoreElements())
{
name = (String) headers.nextElement();
value = request.getHeader(name);
%>
<tr>
<td><%=name%></td>
<td><%=value%></td>
</tr>
<%
}
%>
</table>
Attribute List
<!-- "javax.servlet.jsp.jspException" for getting an Exception -->
<table border=3>
<%
java.util.Enumeration attributes = request.getAttributeNames();
while(attributes.hasMoreElements())
{
name = (String) attributes.nextElement();
if (request.getAttribute(name) == null)
{
value = "null";
}
else
{
value = request.getAttribute(name).toString();
}
%>
<tr>
<td><%=name%></td>
<td><%=value%></td>
</tr>
<%
}
%>
</table>
</body>
</html>

View File

@ -0,0 +1,5 @@
<html>
<body>
<h2>Hello World!</h2>
</body>
</html>

View File

@ -0,0 +1,5 @@
#Generated by Maven
#Thu May 26 08:22:04 UTC 2011
version=0.8-PRE
groupId=bigbluebutton
artifactId=bbb-api-demo

View File

@ -0,0 +1,43 @@
<webapp-structure>
<registeredFiles>
<entry>
<string>currentBuild</string>
<path-set>
<pathsSet class="linked-hash-set">
<string>bbb-web/demo6.jsp</string>
<string>bbb-web/create.jsp</string>
<string>bbb-web/demo_header.jsp</string>
<string>bbb-web/error.jsp</string>
<string>bbb-web/demo1.jsp</string>
<string>bbb-web/demo4_helper.jsp</string>
<string>bbb-web/demo3.jsp</string>
<string>bbb-web/demo4.jsp</string>
<string>bbb-web/demo2.jsp</string>
<string>bbb-web/bbb_api.jsp</string>
<string>bbb-web/demo5.jsp</string>
<string>bbb-web/demo_footer.jsp</string>
<string>index.jsp</string>
<string>WEB-INF/web.xml</string>
<string>api-demo/demo6.jsp</string>
<string>api-demo/demo_header.jsp</string>
<string>api-demo/bbb_api_conf.jsp</string>
<string>api-demo/bbb_api.jsp</string>
<string>api-demo/demo5.jsp</string>
</pathsSet>
</path-set>
</entry>
</registeredFiles>
<dependenciesInfo>
<org.apache.maven.plugin.war.util.DependencyInfo>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>3.8.1</version>
<type>jar</type>
<scope>test</scope>
<exclusions/>
<optional>false</optional>
</dependency>
</org.apache.maven.plugin.war.util.DependencyInfo>
</dependenciesInfo>
</webapp-structure>