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