SHARE
TWEET

Untitled

a guest Nov 6th, 2018 127 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. <%@ page language="java"
  2.    contentType="text/html;
  3.    charset=windows-1256"
  4.    pageEncoding="windows-1256"
  5.    import="java.net.URL"
  6.    import="javax.net.ssl.HttpsURLConnection"
  7.    import="java.net.HttpURLConnection"
  8.    import="java.io.InputStream"
  9.    import="java.io.InputStreamReader"
  10.    import="java.io.BufferedReader"
  11.    import="com.fasterxml.jackson.databind.JsonNode"
  12.    import="com.fasterxml.jackson.databind.ObjectMapper"
  13.    import="com.fasterxml.jackson.core.type.TypeReference"
  14.    import="java.util.List"
  15.    import="java.util.Iterator"
  16.     import="java.util.HashMap"
  17.     import= "java.util.TreeSet"
  18.     import= "java.util.ArrayList"
  19. %>
  20.  
  21. <%
  22.        request.setCharacterEncoding("UTF-8");
  23.        response.setCharacterEncoding("UTF-8");
  24. %>
  25.  
  26. <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
  27. <html>
  28. <head>
  29.  
  30.    <meta charset="utf-8">
  31.    <meta http-equiv="X-UA-Compatible" content="IE=edge">
  32.    <meta name="viewport" content="width=device-width, initial-scale=1">
  33.  
  34.    <title>LMS Webinar</title>
  35.        <link rel="shortcut icon" href="assets/images/favicon.png" />
  36.        <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.2.0/css/bootstrap.min.css">
  37.        <link rel="stylesheet" href="https://use.fontawesome.com/releases/v5.0.13/css/all.css">
  38.       <link rel="stylesheet" href="assets/css/style.css">
  39.  
  40. </head>
  41. <body>
  42.  
  43.  
  44. <%@ include file="bbb_api.jsp"%>
  45.  
  46. <%!
  47.  
  48. public static class User {
  49.  
  50.  private int webinar_id;
  51.  private String nama_session;
  52.  private String start_date;
  53.  private String start_time;
  54.  private String end_time;
  55.  private String password_tutor;
  56.  private String password_student;
  57.  private int status;
  58.  private String create_date;
  59.  private String modifield_date;
  60.  
  61.  
  62.  public int getWebinar_id() {
  63.    return webinar_id;
  64.  }
  65.  public void setWebinar_id(int webinar_id) {
  66.    this.webinar_id = webinar_id;
  67.  }
  68.  public String getNama_session() {
  69.    return nama_session;
  70.  }
  71.  public void setNama_session(String nama_session) {
  72.    this.nama_session = nama_session;
  73.  }
  74.  public String getStart_date() {
  75.    return start_date;
  76.  }
  77.  public void setStart_date(String start_date) {
  78.    this.start_date = start_date;
  79.  }
  80.  public String getStart_time() {
  81.    return start_time;
  82.  }
  83.  public void setStart_time(String start_time) {
  84.    this.start_time = start_time;
  85.  }
  86.  public String getEnd_time() {
  87.    return end_time;
  88.  }
  89.  public void setEnd_time(String end_time) {
  90.    this.end_time = end_time;
  91.  }
  92.  public String getPassword_tutor() {
  93.    return password_tutor;
  94.  }
  95.  public void setPassword_tutor(String password_tutor) {
  96.    this.password_tutor = password_tutor;
  97.  }
  98.  public String getPassword_student() {
  99.    return password_student;
  100.  }
  101.  public void setPassword_student(String password_student) {
  102.    this.password_student = password_student;
  103.  }
  104.  public int getStatus() {
  105.    return status;
  106.  }
  107.  public void setStatus(int status) {
  108.    this.status = status;
  109.  }
  110.  public String getCreate_date() {
  111.    return create_date;
  112.  }
  113.  public void setCreate_date(String create_date) {
  114.    this.create_date = create_date;
  115.  }
  116.  public String getModifield_date() {
  117.    return modifield_date;
  118.  }
  119.  public void setModifield_date(String modifield_date) {
  120.    this.modifield_date = modifield_date;
  121.  }
  122.  
  123.  public String toString(){
  124.    return getWebinar_id() + ", "+getNama_session()+", "+getStart_date()+","+getStart_time()+", "+getEnd_time()+", "+getPassword_tutor()+", "+getPassword_student()+","
  125.    + " "+getStatus()+", "+getCreate_date()+", "+getModifield_date();
  126.  }
  127. }
  128.  
  129. %>
  130. <%
  131.        URL url = new URL("https://client.sibertama.com/lms-web/services");
  132.        HttpURLConnection urlConnection = (HttpURLConnection) url.openConnection();
  133.        InputStream is = urlConnection.getInputStream();
  134.        InputStreamReader isr = new InputStreamReader(is);
  135.        BufferedReader br = new BufferedReader(isr);
  136.  
  137.        String inputLine;
  138.        String jsonText="";
  139.  
  140.        while ((inputLine = br.readLine()) != null) {
  141.          jsonText = jsonText + inputLine;
  142.       }
  143.  
  144. br.close();
  145.  
  146. ObjectMapper mapper = new ObjectMapper();
  147. List<User> list = mapper.readValue(jsonText, new TypeReference<List<User>>() { });
  148.  
  149. Iterator<String> meetingIterator;
  150. //HashMap<String,HashMap> allMeetings;
  151. HashMap<String,String> meeting;
  152.  
  153. List<String> _session = new ArrayList<>();
  154.  
  155. for(User item : list){
  156.  
  157.      String Nama = item.getNama_session();
  158.      _session.add(Nama);
  159.   String password_tutor = item.getPassword_tutor();
  160.      String password_student = item.getPassword_student();
  161.      
  162.       //allMeetings =  new HashMap<String,HashMap>();
  163.  
  164.    HashMap<String,HashMap> allMeetings = new HashMap<String,HashMap>();
  165.  
  166.      
  167.      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$";
  168.      
  169.      meeting = new HashMap<String, String>();
  170.      allMeetings.put(Nama, meeting);
  171.      meeting.put("welcomeMsg",welcome);
  172.      meeting.put("moderatorPW",password_tutor);
  173.      meeting.put("viewerPW",password_student);
  174.      meeting.put("voiceBridge","72013");
  175.      meeting.put("logoutURL","https://webinar.dhooki.com/class/join.jsp");
  176.  
  177.     meeting = null;
  178.  
  179.     meetingIterator = new TreeSet<String>(allMeetings.keySet()).iterator();
  180. }
  181.  
  182.  
  183. if (request.getParameterMap().isEmpty()) {
  184.  
  185. %>
  186.  
  187. <div class="container">
  188.     <div class="row">
  189.         <div class="col-sm-offset-4 col-sm-4">
  190.             <div class="wrapper-form">
  191.                 <div class="form-top">
  192.                     <div class="form-top-left">
  193.                         <h3>LMS Webinar</h3>
  194.                         <p>Tell us who you are:</p>
  195.                     </div>
  196.                     <div class="form-top-right">
  197.                         <!-- <i class="fa fa-user"></i> -->
  198.                         <img src="assets/images/logo2.png" />
  199.                     </div>
  200.                 </div>
  201.                 <div class="form-bottom">
  202.                     <form name="form1" METHOD="GET">
  203.                         <div class="form-group">
  204.                             <label for="fullname">Fullname</label>
  205.                             <input type="text" class="form-control" id="username" name="username" required>
  206.                         </div>
  207.  
  208.                         <div class="form-group">
  209.                             <label for="session">Session</label>
  210.     <select class="form-control" name="meetingID" required>
  211.                          <option selected="true" value="">-= Please Chooice =-</option>
  212.     <%
  213.     for(String key : _session){
  214.         out.println("<option value=\"" + key + "\">" + key + "</option>");
  215.     }
  216.     %>
  217.     </select>
  218.                         </div>
  219.  
  220.  
  221.                         <div class="form-group">
  222.                             <label for="password">Password</label>
  223.                             <input type="password" class="form-control" id="password" name="password" required>
  224.                         </div>
  225.                         <button type="submit" class="btn btn-login" value="join">Join</button>
  226.                         <INPUT TYPE=hidden NAME=action VALUE="create">
  227.                     </form>
  228.                 </div>
  229.             </div>
  230.             <div class="link">
  231.                 <a href="#" title="Go to LMS Website">Go to LMS Website</a>
  232.             </div>
  233.         </div>
  234.     </div>
  235. </div>
  236.  
  237. <%
  238. } else if (request.getParameter("action").equals("create")) {
  239.  
  240. String username = request.getParameter("username");
  241. String meetingID = request.getParameter("meetingID");
  242. String password = request.getParameter("password");
  243.  
  244. meeting = allMeetings.get(meetingID);
  245.  
  246. String welcomeMsg = meeting.get("welcomeMsg");
  247. String logoutURL = meeting.get("logoutURL");
  248. Integer voiceBridge = Integer.parseInt( meeting.get("voiceBridge").trim() );
  249.  
  250. String viewerPW = meeting.get("viewerPW");
  251. String moderatorPW = meeting.get("moderatorPW");
  252.  
  253. if ( ! password.equals(viewerPW) && ! password.equals(moderatorPW) ) {
  254. %>
  255.  
  256.  
  257. <div class="container">
  258.     <div class="row">
  259.         <div class="col-sm-offset-4 col-sm-4">
  260.             <div class="wrapper-form">
  261.                 <div class="form-top">
  262.                     <div class="form-top-left">
  263.                         <h3>LMS Webinar</h3>
  264.                         <p>Tell us who you are:</p>
  265.                     </div>
  266.                     <div class="form-top-right">
  267.                         <img src="assets/images/logo2.png" />
  268.                     </div>
  269.                 </div>
  270.                 <div class="form-bottom">
  271.                         <div class="form-group">
  272.                             <div style="text-align:center; color:red;"> Invalid Password  </div>
  273.                         </div>
  274.                  <a class="btn btn-danger" href="javascript:history.go(-1)">try again</a>
  275.                 </div>
  276.             </div>
  277.         </div>
  278.     </div>
  279. </div>
  280.  
  281.  
  282. <script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js"></script>
  283. <script type="text/javascript" src="https://maxcdn.bootstrapcdn.com/bootstrap/3.2.0/js/bootstrap.min.js"></script>
  284. <script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/jquery-backstretch/2.0.4/jquery.backstretch.min.js"></script>
  285. <script src="assets/js/vendor.js"></script>
  286.  
  287.  
  288. <%
  289.   return;
  290. }
  291.  
  292. String meeting_ID = createMeeting( meetingID, welcomeMsg, moderatorPW, "Welcome moderator! (moderator only message)", viewerPW, voiceBridge, logoutURL );
  293.  
  294. if( meeting_ID.startsWith("Error ")) {
  295. %>
  296.  
  297.  
  298. <div class="container">
  299.     <div class="row">
  300.         <div class="col-sm-offset-4 col-sm-4">
  301.             <div class="wrapper-form">
  302.                 <div class="form-top">
  303.                     <div class="form-top-left">
  304.                         <h3>LMS Webinar</h3>
  305.                         <p>Tell us who you are:</p>
  306.                     </div>
  307.                     <div class="form-top-right">
  308.                         <img src="assets/images/logo2.png" />
  309.                     </div>
  310.                 </div>
  311.                 <div class="form-bottom">
  312.                         <div class="form-group">
  313.                             <div style="text-align:center; color:red;"> Error: createMeeting() failed  </div>
  314.                         </div>
  315.                  <a class="btn btn-danger" href="javascript:history.go(-1)">try again</a>
  316.                 </div>
  317.             </div>
  318.         </div>
  319.     </div>
  320. </div>
  321.  
  322.  
  323. <%
  324.   return;
  325. }
  326.  
  327. String joinURL = getJoinMeetingURL(username, meeting_ID, password, null, request.getParameter("guest") != null);
  328. %>
  329.  
  330. <script language="javascript" type="text/javascript">
  331. window.location.href="<%=joinURL%>";
  332. </script>
  333.  
  334. <%
  335. }
  336. %>
  337.  
  338. <script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js"></script>
  339. <script type="text/javascript" src="https://maxcdn.bootstrapcdn.com/bootstrap/3.2.0/js/bootstrap.min.js"></script>
  340. <script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/jquery-backstretch/2.0.4/jquery.backstretch.min.js"></script>
  341. <script src="assets/js/vendor.js"></script>
  342.  
  343. </body>
  344. </html>
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top