-
Notifications
You must be signed in to change notification settings - Fork 9
/
elangotest.html
381 lines (345 loc) · 13.9 KB
/
elangotest.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<style>
.tableStyle
{
background-color: #cccccc;
}
.styleTable
{
border-width: 1px 1px 1px 1px;
border-spacing: 0;
border-collapse: collapse;
border-style: ridge;
border-color: black;
font-family: Verdana;
font-size: 8pt;
clear: both;
margin: 0;
padding: 0;
}
.textStyle
{
font-size: 8pt;
font-family: Verdana;
width: 345px;
}
.buttonStyle
{
width: 80px;
height: 30px;
font-weight: bold;
font-size: 8pt;
font-family: Verdana;
}
.trStyle
{
height: 30px;
}
.trStyleDiv
{
height: 20px;
}
.heading
{
background-color: #D7D8D2;
color: black;
font-size:12px;
font-weight:bold;
}
.txt_box
{
border:#666666 1px solid;
color:#333333;
font-family:Verdana;
font-size:8pt;
height:13pt;
}
</style>
</head>
<body>
<table>
<tr>
<td valign="top" style="background-color: #F0F1F3;">
<h4 bgcolor="#D7D8D2" style="color: black;" class="textStyle">
VISITOR PASS</h4>
<!-- First, include the JPEGCam JavaScript Library -->
<script type="text/javascript" src="webcam.js"></script>
<script type="text/javascript" src="yui/yahoo-min.js"></script>
<script type="text/javascript" src="yui/event-min.js"></script>
<script type="text/javascript" src="yui/connection-core.js"></script>
<script type="text/javascript" src="yui/connection-min.js"></script>
<!-- Configure a few settings -->
<script language="JavaScript">
webcam.set_api_url( 'test.php' );
webcam.set_quality( 90 ); // JPEG quality (1 - 100)
webcam.set_shutter_sound( true ); // play shutter click sound
</script>
<!-- Next, write the movie to the page at 320x240 -->
<script language="JavaScript">
document.write( webcam.get_html(320, 240) );
</script>
<!-- Some buttons for controlling things -->
<!-- Code to handle the server response (see test.php) -->
<script language="JavaScript">
webcam.set_hook( 'onComplete', 'my_completion_handler' );
//webcam.set_hook( 'onComplete', 'my_completion_handler' );
function mobileNoValidate()
{
var mobileDom = document.getElementById('mobileno');
if(mobileDom){
var x = mobileDom.value;
var re10digit=/^\d{10}$/;
if(x.search(re10digit)==-1){
alert("Invalid Mobile No");
return false;
};
};
return true;
}
function emailValidate(){
var emailPattern = /^[a-zA-Z0-9._-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,4}$/;
var emailDom = document.getElementById('email');
if(emailDom){
if(emailDom.value.search(emailPattern) == -1){
alert('Invalid Email Id');
return false;
};
};
return true;
}
function take_snapshot() {
if(!mobileNoValidate()){
return false;
};
if(!emailValidate()){
return false;
};
var formUI = document.getElementById('ui');
if(formUI){
var url = 'test.php?dt='+(new Date()).getTime();
if(formUI.uname && formUI.uname.value){
url += '&un='+escape(formUI.uname.value);
};
if(formUI.meet && formUI.meet.value){
url += '&mt='+escape(formUI.meet.value);
};
if(formUI.representinglist && formUI.representinglist.value){
url += '&ra='+escape(formUI.representinglist.value);
};
if(formUI.mobileno && formUI.mobileno.value){
url += '&mn='+escape(formUI.mobileno.value);
};
if(formUI.email && formUI.email.value){
url += '&em='+escape(formUI.email.value);
};
webcam.set_api_url( url );
};
webcam.snap();
}
clearLogin = function(){
var domLogin = document.getElementById('ui');
if(domLogin){
domLogin.reset();
}
}
function GetString(Str,startTagName,endTagName)
{
return Str.substring((Str.indexOf(startTagName) + startTagName.length),Str.indexOf(endTagName));
}
function my_completion_handler(msg) {
// extract URL out of PHP output
var output = msg;
var image_url = GetString(msg,'<urlsrc>','</urlsrc>');//"man.jpg"; //
var usrid = GetString(msg,'<id>','</id>');//"5432"; //
var fname = GetString(msg,'<fname>','</fname>');//"Dhanapal"; //
var tomeet = GetString(msg,'<tomeet>','</tomeet>');//"Easwar"; //
var comingfrom = GetString(msg,'<comingfrom>','</comingfrom>');//"Bangalore"; //
var mobile = GetString(msg,'<mobile>','</mobile>');//"99999999"; //
var email = GetString(msg,'<email>','</email>');//"dhana@gmail.com"; //
var checkin = GetString(msg,'<checkin>','</checkin>');//"12-Nov-2011"; //
var status = GetString(msg,'<status>','</status>');//"1"; //
webcam.reset();
clearLogin();
var myWindow=window.open('','','width=200,height=100');
myWindow.document.body.innerHTML =
"<table width='300px' class='styleTable'>" +
"<tr class='trStyleDiv'>" +
"<td align='center' valign='middle' colspan='2' class='heading' style='width: 300px;height:30px;font-size:15pt;font-weight:bold;background-color: #000000;color:#ffffff;'>" +
"VISITOR PASS</td></tr>" +
"<tr class='trStyleDiv'><td width='110px'> <img width='150' height='120' src='" + image_url + "'/></td>" +
"<td width='260px'>" +
"<table border='0' width='260px' bgcolor='#ffffff' >" +
"<tr class='trStyleDiv'>" +
"<td align='right' style='width: 100px;font-size:15pt;font-weight:bold;'>ID </td>" +
"<td style='width: 150px;font-size:15pt;font-weight:bold;'>" + usrid + "</td></tr>" +
"<tr class='trStyleDiv'>" +
"<td align='right' style='width: 100px;font-weight:bold;'>Name : </td>" +
"<td style='width: 150px;font-weight:bold;'>" + fname + "</td></tr>" +
"<tr class='trStyleDiv'>" +
"<td align='right' style='width: 100px;'>To Meet : </td>" +
"<td style='width: 150px;'>" + tomeet + "</td></tr>" +
"<tr class='trStyleDiv'>" +
"<td align='right' style='width: 100px;'>Coming From : </td>" +
"<td style='width: 150px;'>" + comingfrom + "</td></tr>" +
"<tr class='trStyleDiv'>" +
"<td align='right' style='width: 100px;'>Mobile No : </td>" +
"<td style='width: 150px;'>" + mobile + "</td></tr>" +
"<tr class='trStyleDiv'>" +
"<td align='right' style='width: 100px;'>Email-Id : </td>" +
"<td style='width: 150px;'>" + email + "</td></tr>" +
"<tr class='trStyleDiv'>" +
"<td align='right' style='width: 110px;'>CheckIn Time : </td>" +
"<td style='width: 150px;'>" + checkin + "</td></tr></table></td></tr>" +
"</table>";
myWindow.focus();
printContent = function(){
myWindow.focus();
myWindow.print();
closeCurWindow = function(){
myWindow.close();
};
window.setTimeout(closeCurWindow,3000);
};
window.setTimeout(printContent,3000);
}
clearSignoutPage = function(){
var logoutDom = document.getElementById('logout');
if(logoutDom){
logoutDom.reset();
};
};
succSignout = function(o){
var outputDom = document.getElementById('output');
if(outputDom){
outputDom.innerHTML = 'Visitor Id '+o.responseText+' succefully logged out';
};
};
failSignout = function(o){
};
var SignOutCallback = {
success:succSignout,
failure:failSignout
};
Signout = function(){
var sUrl = "signout.php?mk="+(new Date()).getTime();
var domVid = document.getElementById('vid');
if(domVid){
sUrl += '&vid='+domVid.value;
};
var request = YAHOO.util.Connect.asyncRequest('GET', sUrl, SignOutCallback);
}
</script>
</td>
<td valign="top">
<form id='ui'>
<table id='userinput' width="500px" bgcolor="#F0F1F3" class="textStyle">
<tr class="trStyle">
<td align='center' valign="middle" colspan="2" class="heading">
USER INFORMATION
</td>
</tr>
<tr class="trStyle">
<td align='right' style='width: 200px;'>
Name :
</td>
<td style='width: 300px;'>
<input style='width: 200px;' id='uname' name='uname' type='text' class="txt_box" />
</td>
</tr>
<tr class="trStyle">
<td align='right' style='width: 200px;'>
To Meet :
</td>
<td style='width: 300px;'>
<input style='width: 200px;' id='meet' name='meet' type='text' class="txt_box" />
</td>
</tr>
<tr class="trStyle">
<td align='right' style='width: 200px;'>
Representing :
</td>
<td style='width: 300px;'>
<select id='representinglist' name='representinglist' style='width: 200px; height:25px;' class="txt_box">
<option value='Vendor'>Vendor</option>
<option value='Friend'>Friend</option>
<option value='Family'>Family</option>
<option value='For Interview'>For Interview</option>
<option value='Customer'>Customer</option>
</select><!-- <input style='width:200px;' id='comingfrom' name='comingfrom' type='text'/>-->
</td>
</tr>
<tr class="trStyle">
<td align='right' style='width: 200px;'>
Mobile No :
</td>
<td style='width: 300px;'>
<input style='width: 200px;' id='mobileno' name='mobileno' type='text' class="txt_box" />
</td>
</tr>
<tr class="trStyle">
<td align='right' style='width: 200px;'>
Email-Id :
</td>
<td style='width: 300px;'>
<input style='width: 200px;' id='email' name='email' type='text' class="txt_box" />
</td>
</tr>
<tr style="height:50px;">
<td align='center' style='width: 200px;'>
<!-- <input type="button" value="Configure..." onclick="webcam.configure()" class="buttonStyle"
style="width: 100px;" />
-->
</td>
<td align="left" style='width: 300px;'>
<input type="button" value="Print" onclick="take_snapshot()" class="buttonStyle" />
<input type="button" value="Clear" onclick="clearLogin()" class="buttonStyle" />
</td>
</tr>
</table>
</form>
</td>
</tr>
<tr>
<td>
</td>
<td>
<form id='logout'>
<br /><br />
<table id='userlogout' width="500px" bgcolor="#F0F1F3" class="textStyle">
<tr class="trStyle">
<td align='center' valign="middle" colspan="2" class="heading">
LOG OUT
</td>
</tr>
<tr class="trStyle">
<td align='center' style='width: 200px;'>
Visitor Id :
</td>
<td style='width: 300px;'>
<input style='width: 200px;' id='vid' name='vid' type='text' class="txt_box" />
</td>
</tr>
<tr class="trStyle">
<td align='center'>
</td>
<td align='left'>
<input type='button' value='Submit' onclick='javascript:Signout();' class="buttonStyle" />
<input type='button' value='Clear' onclick='javascript:clearSignoutPage();' class="buttonStyle" />
</td>
</tr>
<tr>
<td colspan='2'>
<div id='output' style="width: 250px;" class="textStyle">
</div> <!--Enter the visitor id-->
</td>
</tr>
</table>
</form>
</td>
</tr>
</table>
</body>
</html>