Enabled the Activity Monitor (Demo 4) to end a meeting - This feature is off, to turn on uncomment line 115 in demo4.js

git-svn-id: http://bigbluebutton.googlecode.com/svn/trunk@4349 af16638f-c34d-0410-8cfa-b39d5352b314
This commit is contained in:
Omar Shammas 2010-05-21 18:19:03 +00:00
parent 143f41e2ff
commit 019a05578b
3 changed files with 93 additions and 2 deletions

View File

@ -201,6 +201,8 @@ public String getJoinURLViewer(String username, String meetingID) {
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)
//
@ -380,6 +382,39 @@ public String getMeetings() {
}
}
//
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
//

View File

@ -102,7 +102,20 @@ function getMeetingsInfoURL(meetingID, password, checksum) {
}
function createMeetingTable(meeting) {
var tableContent = '<table name="' + meeting.meetingID + '" class="hor-minimalist-b" cellspacing="0" summary="The current participants in a meeting"><caption>' + meeting.meetingID + '</caption><tr><th scope="col" abbr="Participants">Participants</th><th scope="col" abbr="Name">Name</th><th scope="col" abbr="Role">Role</th></tr>';
var form = '<th><FORM NAME="form1" METHOD="GET"><input type="hidden" name="meetingID" value="' + meeting.meetingID + '"/>';
form += '<input type="hidden" name="moderatorPW" value="' + meeting.moderatorPW + '"/>';
form += '<INPUT TYPE=hidden NAME=action VALUE="end">';
form += '<input type="submit" value="End"/></FORM>';
form += '</th>';
var tableContent = '<table name="' + meeting.meetingID + '" class="hor-minimalist-b" cellspacing="0" summary="The current participants in a meeting"><caption>' + meeting.meetingID + '<caption><tr><th scope="col" abbr="Participants">Participants</th><th scope="col" abbr="Name">Name</th><th scope="col" abbr="Role">Role</th>';
//uncomment below to add the ability to end meetings in the activity monitor
//tableContent += form;
tableContent += '</tr>';
var encodedMeetingID = encode(meeting.meetingID);
var tableRowId;
var newRows = new Array();
@ -112,7 +125,7 @@ function createMeetingTable(meeting) {
for (var i in meeting.attendees.attendee) {
var attendee = (meeting.attendees.attendee[i].userID != null) ? meeting.attendees.attendee[i] : meeting.attendees.attendee;
tableRowId = encodedMeetingID + '_' + attendee.userID;
tableContent += '<tr id="' + tableRowId + '"><td>' + attendee.userID + '<td>' + attendee.fullName + '</td><td>' + attendee.role + '</td></tr>'
tableContent += '<tr id="' + tableRowId + '"><td>' + attendee.userID + '<td>' + attendee.fullName + '</td><td>' + attendee.role + '</td></tr>';
// if there is a new row to be added, then add to the new rows array to display it with a flash effect.
if ($("#" + tableRowId).length == 0) {

View File

@ -51,13 +51,56 @@ Author: Islam El-Ashi <ielashi@gmail.com>
<%@ 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>