Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <%@page import="com.fasterxml.jackson.databind.DeserializationFeature"%>
- <%@page import="org.apache.commons.httpclient.params.HttpConnectionParams"%>
- <%@ page language="java"
- contentType="text/html;
- charset=windows-1256"
- pageEncoding="windows-1256"
- import="java.net.URL"
- import="javax.net.ssl.HttpsURLConnection"
- import="java.net.HttpURLConnection"
- import="java.io.InputStream"
- import="java.io.InputStreamReader"
- import="java.io.BufferedReader"
- import="com.fasterxml.jackson.databind.JsonNode"
- import="com.fasterxml.jackson.databind.ObjectMapper"
- import="com.fasterxml.jackson.core.type.TypeReference"
- import="java.util.List"
- import="java.util.Iterator"
- %>
- <%
- 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 charset="utf-8">
- <meta http-equiv="X-UA-Compatible" content="IE=edge">
- <meta name="viewport" content="width=device-width, initial-scale=1">
- <title>LMS Webinar</title>
- <link rel="shortcut icon" href="assets/images/favicon.png" />
- <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.2.0/css/bootstrap.min.css">
- <link rel="stylesheet" href="https://use.fontawesome.com/releases/v5.0.13/css/all.css">
- <link rel="stylesheet" href="assets/css/style.css">
- </head>
- <body>
- <%@ include file="bbb_api.jsp"%>
- <%!
- public static class User {
- private int webinar_id;
- private String nama_session;
- private String start_date;
- private String start_time;
- private String end_time;
- private String password_tutor;
- private String password_student;
- private int status;
- private String create_date;
- private String modifield_date;
- public int getWebinar_id() {
- return webinar_id;
- }
- public void setWebinar_id(int webinar_id) {
- this.webinar_id = webinar_id;
- }
- public String getNama_session() {
- return nama_session;
- }
- public void setNama_session(String nama_session) {
- this.nama_session = nama_session;
- }
- public String getStart_date() {
- return start_date;
- }
- public void setStart_date(String start_date) {
- this.start_date = start_date;
- }
- public String getStart_time() {
- return start_time;
- }
- public void setStart_time(String start_time) {
- this.start_time = start_time;
- }
- public String getEnd_time() {
- return end_time;
- }
- public void setEnd_time(String end_time) {
- this.end_time = end_time;
- }
- public String getPassword_tutor() {
- return password_tutor;
- }
- public void setPassword_tutor(String password_tutor) {
- this.password_tutor = password_tutor;
- }
- public String getPassword_student() {
- return password_student;
- }
- public void setPassword_student(String password_student) {
- this.password_student = password_student;
- }
- public int getStatus() {
- return status;
- }
- public void setStatus(int status) {
- this.status = status;
- }
- public String getCreate_date() {
- return create_date;
- }
- public void setCreate_date(String create_date) {
- this.create_date = create_date;
- }
- public String getModifield_date() {
- return modifield_date;
- }
- public void setModifield_date(String modifield_date) {
- this.modifield_date = modifield_date;
- }
- }
- %>
- <%
- URL url = new URL("https://client.sibertama.com/lms-web/services");
- HttpURLConnection urlConnection = (HttpURLConnection) url.openConnection();
- InputStream is = urlConnection.getInputStream();
- InputStreamReader isr = new InputStreamReader(is, "UTF-8");
- BufferedReader br = new BufferedReader(isr);
- String inputLine;
- String jsonText="";
- while ((inputLine = br.readLine()) != null) {
- jsonText = jsonText + inputLine;
- }
- br.close();
- ObjectMapper mapper = new ObjectMapper();
- mapper.disable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES);
- List<User> list = mapper.readValue(jsonText, new TypeReference<List<User>>() { });
- Iterator<String> meetingIterator = null;
- HashMap<String,HashMap> allMeetings = null;
- HashMap<String,String> meeting;
- for(User item : list){
- String Nama = item.getNama_session();
- String password_tutor = item.getPassword_tutor();
- String password_student = item.getPassword_student();
- allMeetings = new HashMap<String,HashMap>();
- // HashMap<String,HashMap> allMeetings = new HashMap<String,HashMap>();
- String welcome = "<br>Welcome to <b>%%CONFNAME%%</b>!<br><br>To understand how BigBlueButton works see our <a href=\"event:http://www.bigbluebutton.org/cont$";
- meeting = new HashMap<String, String>();
- allMeetings.put(Nama, meeting);
- meeting.put("welcomeMsg",welcome);
- meeting.put("moderatorPW",password_tutor);
- meeting.put("viewerPW",password_student);
- meeting.put("voiceBridge","72013");
- meeting.put("logoutURL","https://webinar.dhooki.com/class/join.jsp");
- meeting = null;
- meetingIterator = new TreeSet<String>(allMeetings.keySet()).iterator();
- }
- if (request.getParameterMap().isEmpty()) {
- %>
- <div class="container">
- <div class="row">
- <div class="col-sm-offset-4 col-sm-4">
- <div class="wrapper-form">
- <div class="form-top">
- <div class="form-top-left">
- <h3>LMS Webinar</h3>
- <p>Tell us who you are:</p>
- </div>
- <div class="form-top-right">
- <!-- <i class="fa fa-user"></i> -->
- <img src="assets/images/logo2.png" />
- </div>
- </div>
- <div class="form-bottom">
- <form name="form1" METHOD="GET">
- <div class="form-group">
- <label for="fullname">Fullname</label>
- <input type="text" class="form-control" id="username" name="username" required>
- </div>
- <div class="form-group">
- <label for="session">Session</label>
- <select class="form-control" name="meetingID" required>
- <option selected="true" value="">-= Please Chooice =-</option>
- <%
- String key;
- while (meetingIterator.hasNext()) {
- key = meetingIterator.next();
- out.println("<option value=\"" + key + "\">" + key + "</option>");
- }
- %>
- </select>
- </div>
- <div class="form-group">
- <label for="password">Password</label>
- <input type="password" class="form-control" id="password" name="password" required>
- </div>
- <button type="submit" class="btn btn-login" value="join">Join</button>
- <INPUT TYPE=hidden NAME=action VALUE="create">
- </form>
- </div>
- </div>
- <div class="link">
- <a href="#" title="Go to LMS Website">Go to LMS Website</a>
- </div>
- </div>
- </div>
- </div>
- <%
- } else if (request.getParameter("action").equals("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");
- if ( ! password.equals(viewerPW) && ! password.equals(moderatorPW) ) {
- %>
- <div class="container">
- <div class="row">
- <div class="col-sm-offset-4 col-sm-4">
- <div class="wrapper-form">
- <div class="form-top">
- <div class="form-top-left">
- <h3>LMS Webinar</h3>
- <p>Tell us who you are:</p>
- </div>
- <div class="form-top-right">
- <img src="assets/images/logo2.png" />
- </div>
- </div>
- <div class="form-bottom">
- <div class="form-group">
- <div style="text-align:center; color:red;"> Invalid Password </div>
- </div>
- <a class="btn btn-danger" href="javascript:history.go(-1)">try again</a>
- </div>
- </div>
- </div>
- </div>
- </div>
- <script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js"></script>
- <script type="text/javascript" src="https://maxcdn.bootstrapcdn.com/bootstrap/3.2.0/js/bootstrap.min.js"></script>
- <script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/jquery-backstretch/2.0.4/jquery.backstretch.min.js"></script>
- <script src="assets/js/vendor.js"></script>
- <%
- return;
- }
- String meeting_ID = createMeeting( meetingID, welcomeMsg, moderatorPW, "Welcome moderator! (moderator only message)", viewerPW, voiceBridge, logoutURL );
- if( meeting_ID.startsWith("Error ")) {
- %>
- <div class="container">
- <div class="row">
- <div class="col-sm-offset-4 col-sm-4">
- <div class="wrapper-form">
- <div class="form-top">
- <div class="form-top-left">
- <h3>LMS Webinar</h3>
- <p>Tell us who you are:</p>
- </div>
- <div class="form-top-right">
- <img src="assets/images/logo2.png" />
- </div>
- </div>
- <div class="form-bottom">
- <div class="form-group">
- <div style="text-align:center; color:red;"> Error: createMeeting() failed </div>
- </div>
- <a class="btn btn-danger" href="javascript:history.go(-1)">try again</a>
- </div>
- </div>
- </div>
- </div>
- </div>
- <%
- return;
- }
- String joinURL = getJoinMeetingURL(username, meeting_ID, password, null, request.getParameter("guest") != null);
- %>
- <script language="javascript" type="text/javascript">
- window.location.href="<%=joinURL%>";
- </script>
- <%
- }
- %>
- <script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js"></script>
- <script type="text/javascript" src="https://maxcdn.bootstrapcdn.com/bootstrap/3.2.0/js/bootstrap.min.js"></script>
- <script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/jquery-backstretch/2.0.4/jquery.backstretch.min.js"></script>
- <script src="assets/js/vendor.js"></script>
- </body>
- </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement