Skip to content

Commit

Permalink
- setup demo for creating adhoc conf
Browse files Browse the repository at this point in the history
git-svn-id: http://bigbluebutton.googlecode.com/svn/trunk@2598 af16638f-c34d-0410-8cfa-b39d5352b314
  • Loading branch information
ritzalam committed Sep 23, 2009
1 parent 819d61e commit cbeb98c
Show file tree
Hide file tree
Showing 7 changed files with 242 additions and 13 deletions.
29 changes: 23 additions & 6 deletions bigbluebutton-web/grails-app/conf/UrlMappings.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -65,15 +65,32 @@ class UrlMappings {
* Beginning of BBB's REST -APIs
*/

"/api/conference"(controller:"adhoc", parseRequest:true) {
format = 'xml'
action = [GET:'showConference', POST:'createConference', DELETE:'deleteConference']
// "/api/conference"(controller:"adhoc", parseRequest:true) {
// format = 'xml'
// action = [GET:'showConference', POST:'createConference', DELETE:'deleteConference']
// }

// "/api/conference/session"(controller:"adhoc", parseRequest:true) {
// format = 'xml'
// action = [GET:'enterConference', POST:'joinConference']
// }

"/api/demo"(controller:"adhoc") {
action = [GET:'demoapi']
}

"/api/demo/join"(controller:"adhoc") {
action = [GET:'joindemoapi']
}

"/api/conference/session"(controller:"adhoc", parseRequest:true) {
format = 'xml'
"/api/conference"(controller:"adhoc") {
// format = 'xml'
action = [GET:'showConference', POST:'createConference', DELETE:'deleteConference']
}

"/api/conference/session"(controller:"adhoc") {
// format = 'xml'
action = [GET:'enterConference', POST:'joinConference']
}

}
}
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,14 @@ class AdhocController {
redirect(action:invalid)
}

def demoapi = {
render(view:'demo')
}

def joindemoapi = {
render(view:'joindemo')
}

def invalid = {
log.info "AdhocController#invalid"
response.addHeader("Cache-Control", "no-cache")
Expand All @@ -83,7 +91,7 @@ class AdhocController {

def createConference = {
println "AdhocController#create"
def voiceConf = params.conference.voiceBridge
def voiceConf = params.voiceBridge
println "Got voiceBridge ${voiceConf}"

/***
Expand All @@ -92,7 +100,7 @@ class AdhocController {
AdhocConference newConf = new AdhocConference(voiceConf, 'test-room', 'modToken', 'attToken')
adhocConferenceService.createConference(newConf)

AdhocConference conf = adhocConferenceService.getConferenceWithVoiceBridge(newConf)
AdhocConference conf = adhocConferenceService.getConferenceWithVoiceBridge(voiceConf)

response.addHeader("Cache-Control", "no-cache")
withFormat {
Expand All @@ -107,13 +115,24 @@ class AdhocController {
}
}
}
html {
render(view:'show', model:[voicebridge:conf.voiceBridge, modToken:conf.moderatorToken, viewerToken:conf.viewerToken])
}
json {
println "Rendering as json"
render(contentType:"text/json") {
returncode SUCCESS
voiceBridge conf.voiceBridge
moderatorToken conf.moderatorToken
viewerToken conf.viewerToken
}
}
}

}

def showConference = {
println "AdhocController#show"
def voiceConf = params.conference.voiceBridge
def voiceConf = params.voiceBridge
println "Got voiceBridge ${voiceConf}"
AdhocConference conf = adhocConferenceService.getConferenceWithVoiceBridge(voiceConf)

Expand All @@ -124,27 +143,32 @@ class AdhocController {
response() {
returncode(SUCCESS)
moderatorToken("${conf.moderatorToken}")
viewerToken("${conf.attendeeToken}")
viewerToken("${conf.viewerToken}")
}
}
}
html {
render(view:'joindemo')
}
}

}

def joinConference = {
String authToken = params.conference.authToken
String fullname = params.conference.fullname
String authToken = params.authToken
String fullname = params.fullname

println "AdhocController#join"

println "Joining as $fullname using token $authToken"
AdhocConference conf = adhocConferenceService.getConferenceWithViewerToken(authToken)

if (conf == null) {
conf = adhocConferenceService.getConferenceWithModeratorToken(authToken)
}

if (conf == null) {
println "Could not find any conference."
response.addHeader("Cache-Control", "no-cache")
withFormat {
xml {
Expand Down Expand Up @@ -180,6 +204,10 @@ class AdhocController {
}
}
}
html {
def hostUrl = getClientUrl()
redirect(url:"${hostUrl}/client/BigBlueButton.html")
}
}
}
}
Expand Down Expand Up @@ -223,4 +251,9 @@ class AdhocController {
}
}
}

private String getClientUrl() {
def config = ConfigurationHolder.config
return config.bigbluebutton.web.serverURL
}
}
26 changes: 26 additions & 0 deletions bigbluebutton-web/grails-app/views/adhoc/demo.gsp
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<meta name="layout" content="main" />
<title>Login</title>
</head>
<body>
<g:if test="${flash.message}">
<div class="message">${flash.message}</div>
</g:if>
<form action="/bigbluebutton/api/conference.html" method="post">
<table>
<tbody>
<tr>
<td>Conference Number:</td>
<td><input type="text" name="voiceBridge" value="85115" /></td>
</tr>
<tr>
<td />
<td><input type="submit" value="Create" /></td>
</tr>
</tbody>
</table>
</form>
</body>
</html>
30 changes: 30 additions & 0 deletions bigbluebutton-web/grails-app/views/adhoc/joindemo.gsp
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<meta name="layout" content="main" />
<title>Login</title>
</head>
<body>
<g:if test="${flash.message}">
<div class="message">${flash.message}</div>
</g:if>
<form action="/bigbluebutton/api/conference/session.xml" method="post">
<table>
<tbody>
<tr>
<td>Fullname:</td>
<td><input type="text" name="fullname" value="Richard" /></td>
</tr>
<tr>
<td>Auth Token:</td>
<td><input type="text" name="authToken" value="attToken" /></td>
</tr>
<tr>
<td />
<td><input type="submit" value="Join" /></td>
</tr>
</tbody>
</table>
</form>
</body>
</html>
46 changes: 46 additions & 0 deletions bigbluebutton-web/grails-app/views/adhoc/show.gsp
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<meta name="layout" content="main" />
<title>Login</title>
</head>
<body>
<g:if test="${flash.message}">
<div class="message">${flash.message}</div>
</g:if>
<table>
<tbody>
<tr>
<td>Voice Bridge Number:</td>
<td>${voicebridge}</td>
</tr>
<tr>
<td>Moderator Token</td>
<td>${modToken}</td>
</tr>
<tr>
<td>Viewer Token</td>
<td>${viewerToken}</td>
</tr>
</tbody>
</table>
<form action="/bigbluebutton/api/conference/session.html" method="post">
<table>
<tbody>
<tr>
<td>Enter your name Fullname:</td>
<td><input type="text" name="fullname" value="" /></td>
</tr>
<tr>
<td>Enter Token:</td>
<td><input type="text" name="authToken" value="" /></td>
</tr>
<tr>
<td />
<td><input type="submit" value="Join" /></td>
</tr>
</tbody>
</table>
</form>
</body>
</html>
58 changes: 58 additions & 0 deletions bigbluebutton-web/web-app/demo.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
<html>
<head>
<script type="text/javascript" src="/bigbluebutton/js/jquery-1.3.1.js"></script>
<script type="text/javascript">
$(document).ready(function() {
$.post("/bigbluebutton/api/conference.xml", { voiceBridge: "85115"},
function(data){
//alert("Data Loaded: " + data.voiceBridge + " " + data.moderatorToken + " " + data.viewerToken);

$("div:first").text(data.moderatorToken);
$("div:last").text(data.viewerToken);
$("input:first").val(data.moderatorToken);
$("input:last").val(data.viewerToken);
}, "json"
);
});


</script>
</head>
<body>
<form action="/bigbluebutton/api/conference/session.html" method="post">
<!-- IMPORTANT: Make this input the first one as script above relies on it's position to assign the moderatorToken value -->
<input type="hidden" name="authToken" value="" />
<table>
<tbody>
<tr>
<td>Enter your name:</td>
<td><input type="text" name="fullname" value="" /></td>
</tr>
<tr>
<td />
<td><input type="submit" value="Join as moderator" /></td>
</tr>
</tbody>
</table>
</form>
<form action="/bigbluebutton/api/conference/session.html" method="post">

<table>
<tbody>
<tr>
<td>Enter your name:</td>
<td><input type="text" name="fullname" value="" /></td>
</tr>
<tr>
<td />
<td><input type="submit" value="Join as viewer" /></td>
</tr>
</tbody>
</table>
<!-- IMPORTANT: Make this input the last one as script above relies on it's position to assign the viewerToken value -->
<input type="hidden" name="authToken" value="" />
</form>
<div></div>
<div></div>
</body>
</html>
19 changes: 19 additions & 0 deletions bigbluebutton-web/web-app/js/jquery-1.3.1.js

Large diffs are not rendered by default.

0 comments on commit cbeb98c

Please sign in to comment.