-
Notifications
You must be signed in to change notification settings - Fork 28
/
Copy pathindex.php
executable file
·2422 lines (2308 loc) · 169 KB
/
index.php
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
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
<?php
/* * **************************************************************
i2b2 webclient v.1.7.13
* Client Contributors:
* Nick Benik
* Griffin Weber, MD, PhD
* Mike Mendis
* Shawn Murphy MD, PhD
* David Wang
* Hannah Murphy
* Nich Wattanasin
* Bhaswati Ghosh
* Jeffrey Klann, PhD
* Kevin Bui
PHP components:
* PHP-BASED I2B2 PROXY "CELL"
(does not use SimpleXML library)
Author: Nick Benik
Contributors: Nich Wattanasin
Mike Mendis
Last Revised: 03-06-19
* SAML Authentication and session management:
Author: Kevin Bui
Contributors: Michele Morris, Justin Prosser, Mike Mendis, Jeff Klann
Last Revised: 05-22
**********************************************************************/
session_start();
$_SESSION["shib-session-id"] = filter_input(INPUT_SERVER, 'AJP_Shib-Session-ID', FILTER_UNSAFE_RAW);
$_SESSION["eppn"] = filter_input(INPUT_SERVER, 'AJP_eduPersonPrincipalName', FILTER_UNSAFE_RAW);
$error_msg;
if (isset($_SESSION['error_msg'])) {
$error_msg = $_SESSION['error_msg'];
unset($_SESSION['error_msg']);
}
$success_msg;
if (isset($_SESSION['success_msg'])) {
$success_msg = $_SESSION['success_msg'];
unset($_SESSION['success_msg']);
}
/* * ****************************************************************
This section acts as a simple i2b2 proxy cell. If no variables have been sent it is assumed that the request is from a
user's Web browser requesting the default page for the current directory. In this case, this file will read the
contents of the default.htm file and return its contents to the browser via the current HTTP connection.
New Feature: 01-27-16 (nw096):
- the $WHITELIST has been reworked to read i2b2_config_data.js and detect the hostname of where i2b2 lives
- the hostname that the web client is running on is also added to the $WHITELIST, in case i2b2 lives there
* * If there are other cells/URLs that you connect to that is not where your PM Cell lives, you will need
to add that server's hostname to the $WHITELIST array below.
Update: 05-03-17 (nw096):
- the automatic detection of $WHITELIST URLs from i2b2_config_data.js now supports ports (bug fix)
*/
$pmURL = "http://127.0.0.1:8080/i2b2/rest/PMService/getServices";
$pmCheckAllRequests = false;
$WHITELIST = array(
"http" . (($_SERVER['SERVER_PORT'] == '443') ? 's' : '' ) . "://" . $_SERVER['HTTP_HOST'],
"http://services.i2b2.org",
"http://127.0.0.1:9090",
"http://127.0.0.1:8080",
"http://127.0.0.1",
"http://localhost:8080",
"http://localhost:9090",
"http://localhost",
"http://i2b2-core-server-saml-demo:8080",
"http://i2b2-core-server-saml-demo:9090",
"http://i2b2-core-server-saml-demo"
);
$BLACKLIST = array(
"http://127.0.0.1:9090/test",
"http://localhost:9090/test",
"http://i2b2-core-server-saml-demo:9090/test"
);
// There is nothing to configure below this line
$matches = array();
$config_file = fopen("i2b2_config_data.js", "r");
if ($config_file) {
while (($line = fgets($config_file)) !== false) {
if (strpos($line, "urlCellPM:") !== false)
$matches[] = $line;
}
fclose($config_file);
}
foreach ($matches as $match) {
$match = preg_replace('/\s+/', '', $match); // remove all whitespace
$match = rtrim($match, ','); // remove trailing comma, if any
$regex = "/(http|https)\:\/\/[a-zA-Z0-9\-\.]+\.[a-zA-Z]{2,5}(\:[0-9]{2,5})*\/?/";
if (preg_match($regex, $match, $url)) { // match hostname
array_push($WHITELIST, $url[0]);
}
}
$PostBody = file_get_contents("php://input");
if (!empty($PostBody)) {
// Process the POST for proxy redirection
// Validate that POST data is XML and extract <proxy> tag
$startPos = strpos($PostBody, "<redirect_url>") + 14;
$endPos = strpos($PostBody, "</redirect_url>", $startPos);
$proxyURL = substr($PostBody, $startPos, ($endPos - $startPos));
$newXML = $PostBody;
// Do not allow DOCTYPE declarations
$replace_match = '/^.*(?:!DOCTYPE).*$(?:\r\n|\n)?/m';
if (preg_match($replace_match, $newXML)) {
exit('DOCTYPE not allowed to be proxied');
}
if ($pmCheckAllRequests) {
error_log("Searhing for Security in " . $PostBody);
//Validate that user is valid against known PM
preg_match("/<security(.*)?>(.*)?<\/security>/", $PostBody, $proxySecurity);
error_log("My Security is " . $proxySecurity[1]);
preg_match("/<domain(.*)?>(.*)?<\/domain>/", $proxySecurity[0], $proxyDomain);
preg_match("/<username(.*)?>(.*)?<\/username>/", $proxySecurity[0], $proxyUsername);
preg_match("/<password(.*)?>(.*)?<\/password>/", $proxySecurity[0], $proxyPassword);
$checkPMXML = "<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?><i2b2:request xmlns:i2b2=\"http://www.i2b2.org/xsd/hive/msg/1.1/\" xmlns:pm=\"http://www.i2b2.org/xsd/cell/pm/1.1/\"> <message_header> <i2b2_version_compatible>1.1</i2b2_version_compatible> <hl7_version_compatible>2.4</hl7_version_compatible> <sending_application> <application_name>i2b2 Project Management</application_name> <application_version>1.1</application_version> </sending_application> <sending_facility> <facility_name>i2b2 Hive</facility_name> </sending_facility> <receiving_application> <application_name>Project Management Cell</application_name> <application_version>1.1</application_version> </receiving_application> <receiving_facility> <facility_name>i2b2 Hive</facility_name> </receiving_facility> <datetime_of_message>2007-04-09T15:19:18.906-04:00</datetime_of_message> <security> " . $proxyDomain[0] . $proxyUsername[0] . $proxyPassword[0] . " </security> <message_control_id> <message_num>0qazI4rX6SDlQlk46wqQ3</message_num> <instance_num>0</instance_num> </message_control_id> <processing_id> <processing_id>P</processing_id> <processing_mode>I</processing_mode> </processing_id> <accept_acknowledgement_type>AL</accept_acknowledgement_type> <application_acknowledgement_type>AL</application_acknowledgement_type> <country_code>US</country_code> <project_id>undefined</project_id> </message_header> <request_header> <result_waittime_ms>180000</result_waittime_ms> </request_header> <message_body> <pm:get_user_configuration> <project>undefined</project> </pm:get_user_configuration> </message_body></i2b2:request>";
// Process the POST for proxy redirection
error_log($checkPMXML, 0);
error_log("My proxy: " . $proxyURL, 0);
}
// ---------------------------------------------------
// white-list processing on the URL
// ---------------------------------------------------
$isAllowed = false;
$requestedURL = strtoupper($proxyURL);
foreach ($WHITELIST as $entryValue) {
$checkValue = strtoupper(substr($requestedURL, 0, strlen($entryValue)));
if ($checkValue == strtoupper($entryValue)) {
$isAllowed = true;
break;
}
}
if (!$isAllowed) {
// security as failed - exit here and don't allow one more line of execution the opportunity to reverse this
die("The proxy has refused to relay your request.");
}
// ---------------------------------------------------
// black-list processing on the URL
// ---------------------------------------------------
foreach ($BLACKLIST as $entryValue) {
$checkValue = strtoupper(substr($requestedURL, 0, strlen($entryValue)));
if ($checkValue == strtoupper($entryValue)) {
// security as failed - exit here and don't allow one more line of execution the opportunity to reverse this
die("The proxy has refused to relay your request.");
}
}
if ($pmCheckAllRequests) {
// open the URL and forward the new XML in the POST body
$proxyRequest = curl_init($pmURL);
// these options are set for hyper-vigilance purposes
curl_setopt($proxyRequest, CURLOPT_COOKIESESSION, 0);
curl_setopt($proxyRequest, CURLOPT_FORBID_REUSE, 1);
curl_setopt($proxyRequest, CURLOPT_FRESH_CONNECT, 0);
// Specify NIC to use for outgoing connection, fixes firewall+DMZ headaches
// curl_setopt($proxyRequest, CURLOPT_INTERFACE, "XXX.XXX.XXX.XXX");
// other options
curl_setopt($proxyRequest, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($proxyRequest, CURLOPT_CONNECTTIMEOUT, 900); // wait 15 minutes
// data to proxy thru
curl_setopt($proxyRequest, CURLOPT_POST, 1);
curl_setopt($proxyRequest, CURLOPT_POSTFIELDS, $checkPMXML);
// SEND REQUEST!!!
curl_setopt($proxyRequest, CURLOPT_HTTPHEADER, array('Expect:', 'Content-Type: text/xml'));
$proxyResult = curl_exec($proxyRequest);
// cleanup cURL connection
curl_close($proxyRequest);
error_log("My PM Result " . $proxyResult);
$pattern = "/<status type=\"ERROR\">/i";
//Check if request is valid
if (preg_match($pattern, $proxyResult)) {
error_log("Local PM denied request");
die("Local PM server could not validate the request.");
}
}
// open the URL and forward the new XML in the POST body
$proxyRequest = curl_init($proxyURL);
curl_setopt($proxyRequest, CURLOPT_SSL_VERIFYPEER, FALSE);
// these options are set for hyper-vigilance purposes
curl_setopt($proxyRequest, CURLOPT_COOKIESESSION, 0);
curl_setopt($proxyRequest, CURLOPT_FORBID_REUSE, 1);
curl_setopt($proxyRequest, CURLOPT_FRESH_CONNECT, 0);
// Specify NIC to use for outgoing connection, fixes firewall+DMZ headaches
// curl_setopt($proxyRequest, CURLOPT_INTERFACE, "XXX.XXX.XXX.XXX");
// other options
curl_setopt($proxyRequest, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($proxyRequest, CURLOPT_CONNECTTIMEOUT, 900); // wait 15 minutes
// data to proxy thru
curl_setopt($proxyRequest, CURLOPT_POST, 1);
curl_setopt($proxyRequest, CURLOPT_POSTFIELDS, $newXML);
// SEND REQUEST!!!
$headers = array('Expect:', 'Content-Type: text/xml');
foreach ($_SERVER as $key => $value) {
if (substr($key, 0, 4) === "AJP_") {
$header = str_replace('AJP_', 'X-', $key) . ": " . $value;
array_push($headers, $header);
}
}
curl_setopt($proxyRequest, CURLOPT_HTTPHEADER, $headers);
// curl_setopt($proxyRequest, CURLOPT_HTTPHEADER, array('Expect:', 'Content-Type: text/xml'));
$proxyResult = curl_exec($proxyRequest);
// cleanup cURL connection
curl_close($proxyRequest);
// perform any analysis or processing on the returned result here
header("Content-Type: text/xml", true);
print($proxyResult);
} else {
?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<meta http-equiv="X-UA-Compatible" content="IE=8,11"/>
<title>i2b2 Web Client</title>
<!--
* *************************
* i2b2 Web Client
* v1.7.13
* *************************
* Contributors:
* Nick Benik
* Griffin Weber, MD, PhD
* Mike Mendis
* Shawn Murphy MD, PhD
* David Wang
* Hannah Murphy
* Nich Wattanasin
* Bhaswati Ghosh
* Jeffrey Klann, PhD
*
*/-->
<link rel="stylesheet" href="assets/bootstrap/css/bootstrap.min.css" />
<script type="text/javascript">
var i2b2build = "1.7.13 [6/5/22 12:00 PM] ";
function handleAgreeChbx(chbx) {
let selectOpt = document.getElementById("logindomain");
let domain = i2b2.PM.model.Domains[selectOpt.value];
let authMethod = domain.registrationMethod.toLowerCase();
let registerBtns = document.getElementsByClassName('register_btn');
if (authMethod === 'saml') {
for (let i = 0; i < registerBtns.length; i++) {
registerBtns[i].disabled = false;
}
} else {
for (let i = 0; i < registerBtns.length; i++) {
registerBtns[i].disabled = !chbx.checked;
}
}
}
function showAlert(msg) {
if (msg.length > 0) {
alert(msg);
}
}
</script>
<!-- This turns off debugging messages. Developers - comment this out to turn them back on! -->
<script type="text/javascript" src="js-ext/firebug/firebugx.js"></script>
<!-- LOAD YUI FROM Yahoo's CDN
<script type="text/javascript" src="http://yui.yahooapis.com/2.5.2/build/yahoo/yahoo.js" ></script>
<script type="text/javascript" src="http://yui.yahooapis.com/2.5.2/build/event/event.js" ></script>
<script type="text/javascript" src="http://yui.yahooapis.com/2.5.2/build/dom/dom.js"></script>
... etc ...
-->
<!-- LOAD YUI FROM local server -->
<script type="text/javascript" src="js-ext/yui/build/yahoo/yahoo.js" ></script>
<script type="text/javascript" src="js-ext/yui/build/event/event.js" ></script>
<script type="text/javascript" src="js-ext/yui/build/dom/dom.js"></script>
<script type="text/javascript" src="js-ext/yui/build/yuiloader/yuiloader.js"></script>
<script type="text/javascript" src="js-ext/yui/build/dragdrop/dragdrop.js" ></script>
<script type="text/javascript" src="js-ext/yui/build/element/element.js"></script>
<script type="text/javascript" src="js-ext/yui/build/container/container_core.js"></script>
<script type="text/javascript" src="js-ext/yui/build/container/container.js"></script>
<script type="text/javascript" src="js-ext/yui/build/resize/resize.js"></script>
<script type="text/javascript" src="js-ext/yui/build/utilities/utilities.js"></script>
<script type="text/javascript" src="js-ext/yui/build/menu/menu.js" ></script>
<script type="text/javascript" src="js-ext/yui/build/calendar/calendar.js"></script>
<script type="text/javascript" src="js-ext/yui/build/treeview/treeview.js" ></script>
<script type="text/javascript" src="js-ext/yui/build/tabview/tabview.js"></script>
<script type="text/javascript" src="js-ext/yui/build/animation/animation.js"></script>
<script type="text/javascript" src="js-ext/yui/build/datasource/datasource.js"></script>
<script type="text/javascript" src="js-ext/yui/build/yahoo-dom-event/yahoo-dom-event.js"></script>
<script type="text/javascript" src="js-ext/yui/build/json/json-min.js"></script>
<script type="text/javascript" src="js-ext/yui/build/datatable/datatable.js"></script>
<script type="text/javascript" src="js-ext/yui/build/button/button.js"></script>
<script type="text/javascript" src="js-ext/yui/build/paginator/paginator-min.js"></script>
<script type="text/javascript" src="js-ext/yui/build/slider/slider-min.js"></script>
<!--
<link rel="stylesheet" type="text/css" href="http://yui.yahooapis.com/combo?2.6.0/build/assets/skins/sam/skin.css">
-->
<link rel="stylesheet" type="text/css" href="js-ext/yui/build/assets/skins/sam/skin.css">
<link rel="stylesheet" type="text/css" href="js-i2b2/ui.styles/ui.styles.css">
<!-- Load Moment.js for parsing and formatting date/time -->
<script type="text/javascript" src="js-ext/moment.min.js"></script>
<link type="text/css" href="js-i2b2/cells/CRC/assets/query_report.css" rel="stylesheet" />
<!-- Bug in IE - use MINIMUM number of LINK and STYLE tags in the DOM as possible: http://support.microsoft.com/kb/262161 -->
<style>
@import url(js-ext/yui/build/fonts/fonts-min.css);
@import url(js-ext/yui/build/tabview/assets/skins/sam/tabview.css);
@import url(js-ext/yui/build/menu/assets/skins/sam/menu.css);
@import url(js-ext/yui/build/button/assets/skins/sam/button.css);
@import url(js-ext/yui/build/container/assets/skins/sam/container.css);
@import url(js-ext/yui/build/container/assets/container.css);
@import url(js-ext/yui/build/calendar/assets/calendar.css);
@import url(js-ext/yui/build/treeview/assets/treeview-core.css);
@import url(js-ext/yui/build/resize/assets/skins/sam/resize.css);
@import url(assets/mod-treeview.css);
@import url(assets/help_viewer.css);
@import url(assets/msg_sniffer.css);
*,
*::before,
*::after {
box-sizing: content-box;
}
#i2b2_login_modal_dialog *,#signup * {
box-sizing: border-box;
}
textarea#terms {
width:100%!important;
border: 1px solid #000;
background: #f2f2f2;
font: normal arial;
color: #333;
resize: none;
}
.btn-local {
color: #fff;
background-color: #6887aa;
border-color: #6887aa;
}
.btn-local:hover {
color: #fff;
background-color: #677cab;
border-color: #6887aa;
}
.btn-idp {
color: #fff;
background-color: #d54736;
border-color: #d54736;
}
.btn-idp:hover {
color: #fff;
background-color: #bb3c2e;
border-color: #d54736;
}
.fw-bold {
font-weight: 700 !important;
}
</style>
<script type="text/javascript" src="js-ext/idle-timer.js"></script>
<script type="text/javascript" src="js-ext/YUI_DataTable_PasswordCellEditor.js"></script>
<script type="text/javascript" src="js-ext/YUI_DataTable_MD5CellEditor.js"></script>
<!-- External libraries -->
<script type="text/javascript" src="js-ext/prototype.js"></script>
<script type="text/javascript" src="js-ext/excanvas.js"></script>
<script type="text/javascript" src="js-ext/bubbling-min.js"></script>
<script type="text/javascript" src="js-ext/accordion-min.js"></script>
<style type="text/css">
.myAccordion {
float: left;
width: 260px;
float: left;
}
.myAccordion .yui-cms-accordion {
width: 230px;
position: relative;
z-index: 10000;
}
.myAccordion .moreinfo {
padding-left: 30px;
}
.myAccordion .yui-cms-accordion .yui-cms-item {
list-style-type: none;
float: left;
display: inline;
width: auto;
}
.myAccordion .yui-cms-accordion .yui-cms-item .accordionToggleItem {
width: 1px;
height: 1px;
display: block;
background: url(assets/images/accordion.gif) no-repeat 0px -200px;
text-decoration: none;
float: left;
}
.myAccordion .yui-cms-accordion .yui-cms-item.selected .accordionToggleItem {
background: url(assets/images/accordion.gif) no-repeat 0px -300px;
}
.myAccordion .yui-cms-accordion .yui-cms-item .bd {
width: 0px;
overflow: hidden;
}
.myAccordion .yui-cms-accordion .yui-cms-item .bd .fixed {
background: none repeat scroll 0 50% #BBCCEE;
padding: 5px;
border: 1px solid #667788;
overflow: hidden;
width: 200px;
height: 250px;
}
.myAccordion .yui-cms-accordion .yui-cms-item .bd .fixedbody {
background: none repeat scroll 0 0 #FFFFFF;
border: 1px solid #667788;
padding: 1px 5px;
height: 245px;
}
</style>
<!-- Graphics Libraries (only work in IE9 and above) -->
<!-- Load d3.js -->
<script type="text/javascript" src="js-ext/d3code/d3.v3.js"></script>
<!-- Load c3.js and stylesheet -->
<link href="js-ext/c3code/c3.css" rel="stylesheet" type="text/css" />
<script src="js-ext/c3code/c3.js"></script>
<!-- Load jquery code and turn off $ -->
<link rel="stylesheet" type="text/css" href="assets/jquery.qtip.min.css" />
<script type="text/javascript" src="js-ext/jquerycode/jquery-1.11.3.min.js"></script>
<script type="text/javascript" src="js-ext/jquery.qtip.min.js"></script>
<script type="text/javascript" src="js-ext/jquerycode/jquery-ui.min.js"></script>
<script type="text/javascript" src="js-ext/jquerycode/multiple-select.js"></script>
<link type="text/css" href="js-ext/jquerycode/multiple-select.css" rel="stylesheet" />
<script>
var $j = $.noConflict();
// Code that uses other library's $ can follow here.
</script>
<!-- load i2b2 framework -->
<script type="text/javascript" src="js-i2b2/i2b2_loader.js"></script>
<script type="text/javascript" src="js-i2b2/i2b2_ui_config.js"></script>
<link type="text/css" href="assets/i2b2.css" rel="stylesheet" />
<link type="text/css" href="assets/i2b2-NEW.css" rel="stylesheet" />
<!-- other auxiliary javascript source files -->
<script type="text/javascript" src="js-i2b2/hive/hive.ui.js"></script>
<script type="text/javascript">
/****************************************************/
/******************** INITIALIZE ********************/
/****************************************************/
// declare and obtain the dimension of the initial browser viewport and initialize screen width division
var rightSideProportion = 0.65;
var leftSideMinimum = 510;
var initBrowserViewPortDim = document.viewport.getDimensions();
var rightSideWidth = initBrowserViewPortDim.width * rightSideProportion; // this component will take up 65% of the screen
if (initBrowserViewPortDim.width - rightSideWidth < leftSideMinimum)
rightSideWidth = initBrowserViewPortDim.width - leftSideMinimum; // Correction if not enough screen is available
// following added to support webclient plugin manager / installer only
var i2b2Admin = "";
function invokeWCPinstaller() {
var mapForm = document.createElement("form");
mapForm.target = "_blank";
mapForm.method = "POST";
mapForm.action = i2b2.PM.model.installer_path + "admin.php";
var mapInput1 = document.createElement("input");
mapInput1.type = "hidden";
mapInput1.name = "rul";
mapInput1.value = i2b2.PM.model.url;
mapForm.appendChild(mapInput1); // Add it to the form
var mapInput2 = document.createElement("input");
mapInput2.type = "hidden";
mapInput2.name = "noisreVcw";
mapInput2.value = i2b2.ClientVersion;
mapForm.appendChild(mapInput2); // Add it to the form
var mapInput3 = document.createElement("input");
mapInput3.type = "hidden";
mapInput3.name = "niamod";
mapInput3.value = i2b2.PM.model.login_domain;
mapForm.appendChild(mapInput3); // Add it to the form
var mapInput4 = document.createElement("input");
mapInput4.type = "hidden";
mapInput4.name = "esur";
mapInput4.value = i2b2.PM.model.login_username;
mapForm.appendChild(mapInput4); // Add it to the form
var mapInput5 = document.createElement("input");
mapInput5.type = "hidden";
mapInput5.name = "yek";
mapInput5.value = i2b2.PM.model.login_password;
mapForm.appendChild(mapInput5); // Add it to the form
document.body.appendChild(mapForm);
mapForm.submit();
}
// polyfill for Object.entries in IE11
if (!Object.entries)
Object.entries = function (obj) {
var ownProps = Object.keys(obj),
i = ownProps.length,
resArray = new Array(i); // preallocate the Array
while (i--)
resArray[i] = [ownProps[i], obj[ownProps[i]]];
return resArray;
};
function initI2B2()
{
//debugOnScreen("default.htm.initI2B2: browserViewPort = " + initBrowserViewPortDim.width + " " + initBrowserViewPortDim.height );
i2b2.events.afterCellInit.subscribe(
(function (en, co, a) {
var cellObj = co[0];
var cellCode = cellObj.cellCode;
switch (cellCode) {
case "PM":
// This i2b2 design implementation uses a prebuild login DIV we connect the Project Management cell to
// handle this method of login, the other method used for login is the PM Cell's built in floating
// modal dialog box to prompt for login credentials. You can edit the look and feel of this dialog box
// by editing the CSS file. You can remark out the lines below with no ill effect. Use the following
// javascript function to display the modal login form: i2b2.hive.PM.doLoginDialog();
//cellObj.doConnectForm($('loginusr'),$('loginpass'),$('logindomain'), $('loginsubmit'));
<?php
if (empty($_SESSION["shib-session-id"])) {
?>
i2b2.PM.doLoginDialog();
showAlert("<?php echo isset($success_msg) ? $success_msg : ''; ?>");
showAlert("<?php echo isset($error_msg) ? $error_msg : ''; ?>");
document.getElementById('terms').innerHTML = i2b2.UI.cfg.termsCondition;
document.getElementById('loginIdp').innerHTML = i2b2.UI.cfg.loginIdp;
document.getElementById('loginIdpIcon').src = i2b2.UI.cfg.loginIdpIcon;
document.getElementById('loginIdpIcon').alt = i2b2.UI.cfg.loginIdp;
document.getElementById('logindomain').onchange();
<?php
} else {
?>
i2b2.PM.isSaml = true;
i2b2.PM.doLoginDialog();
$('i2b2_login_modal_dialog').hide();
$('loginusr').value = '<?php echo $_SESSION["eppn"]; ?>';
$('loginpass').value = '<?php echo $_SESSION["shib-session-id"]; ?>';
$('loginButton').click();
<?php
}
?>
break;
}
})
);
i2b2.events.afterHiveInit.subscribe(
(function (ename) {
// Misc GUI actions that need to be done after loading
$('QPD1').style.background = '#FFFFFF';
$('queryBalloon1').style.display = 'block';
})
);
i2b2.events.afterLogin.subscribe(
(function ()
{
// after successful login hide the login box and display the application GUI
$('menuLogin').style.display = 'none';
$('menuMain').style.display = 'block';
$('topBar').style.display = 'block';
$('screenQueryData').style.display = 'block';
var splitterName = 'main.splitter';
// update dimension values
initBrowserViewPortDim = document.viewport.getDimensions();
rightSideWidth = initBrowserViewPortDim.width * rightSideProportion; // this component will take up 60% of the screen
if (initBrowserViewPortDim.width - rightSideWidth < leftSideMinimum)
rightSideWidth = initBrowserViewPortDim.width - leftSideMinimum; // Correction if not enough screen is available
if (i2b2.PM.model.admin_only)
{
i2b2.hive.MasterView.setViewMode('Admin');
$('viewMode-Patients').style.display = 'none';
$('viewMode-Analysis').style.display = 'none';
if (typeof i2b2.PM.model.installer_path !== "undefined") {
$('adminPlugins').show();
}
// hide the splitter from view since we don't need it in admin-only mode
var splitter = $(splitterName);
splitter.style.visibility = "hidden";
} else
{
// create the splitter object only after login and not in admin-only mode
i2b2.hive.mySplitter = new Splitter(splitterName, {cont: 'screenQueryData'});
i2b2.hive.MasterView.initViewMode(); //tdw9
jQuery('#pluginsMenu').qtip({
content: {
text: jQuery('#PluginListBox')
},
style: {
width: 500
},
show: 'click',
position: {
my: 'top right', // Position my top left...
at: 'bottom left', // at the bottom right of...
},
hide: 'unfocus click'
});
i2b2.PLUGINMGR.view.list.BuildCategories();
i2b2.PLUGINMGR.view.list.Render();
// Drag the splitter to get the right labels on the left panel (jgk 12/19)
i2b2.ONT.view.main.splitterDragged();
i2b2.WORK.view.main.splitterDragged();
i2b2.CRC.view.history.splitterDragged();
}
$('viewMode-Project').innerHTML = "Project: " + i2b2.PM.model.login_projectname;
$('viewMode-User').innerHTML = "User: " + i2b2.PM.model.login_fullname;
$('viewMode-User').title = i2b2.PM.model.userRoles;
if (i2b2.PM.model.otherAuthMethod) {
$('changePasswordLink').hide();
}
if (i2b2.PM.model.login_debugging) {
$('debugMsgSniffer').show();
}
if (typeof i2b2.PM.model.installer_path !== "undefined") {
$('PluginGalleryFooter').show();
}
if (i2b2.PM.model.isAdmin) {
$('PluginsGalleryLink').innerHTML = "Click here to install plugins from i2b2 Gallery...";
}
}), i2b2
);
// start the i2b2 framework
i2b2.Init();
}
function init() {
// ------------------------------------------------------
// put any pre-i2b2 initialization code here
// ------------------------------------------------------
// initialize the i2b2 framework
initI2B2();
initI2B2_UI();
}
YAHOO.util.Event.addListener(window, "load", init);
/********************************************************/
/******************** JAVASCRIPT END ********************/
/********************************************************/
function handleHostSelectChange(selectOpt) {
let domain = i2b2.PM.model.Domains[selectOpt.value];
let authMethod = domain.registrationMethod ? domain.registrationMethod.toLowerCase() : '';
let hostName = domain.name;
let loginType = domain.loginType;
let showUserReg = domain.showRegistration;
let isFederated = loginType === 'federated';
let isSamlSignUp = authMethod === 'saml';
let isLocal = !isFederated;
let classElements = document.getElementsByClassName('local_login');
for (let i = 0; i < classElements.length; i++) {
classElements[i].style.display = isLocal ? 'block' : 'none';
}
classElements = document.getElementsByClassName('federated_login');
for (let i = 0; i < classElements.length; i++) {
classElements[i].style.display = isFederated ? 'block' : 'none';
}
classElements = document.getElementsByClassName('local_signup');
for (let i = 0; i < classElements.length; i++) {
classElements[i].style.display = isSamlSignUp ? 'none' : 'block';
}
classElements = document.getElementsByClassName('saml_signup');
for (let i = 0; i < classElements.length; i++) {
classElements[i].style.display = isSamlSignUp ? 'block' : 'none';
}
classElements = document.getElementsByClassName('user_reg');
for (let i = 0; i < classElements.length; i++) {
classElements[i].style.display = showUserReg ? 'block' : 'none';
}
document.getElementById("term_conditions").style.display = isSamlSignUp ? 'none' : 'block';
document.getElementById("hostName").value = hostName;
document.cookie="hostName=" + hostName;
if (isSamlSignUp) {
document.getElementById("signup-dialog").classList.remove("modal-lg");
document.getElementById("terms-registration").classList.remove("col-6");
document.getElementById("terms-registration").classList.add("col-12");
classElements = document.getElementsByClassName('register_btn');
for (let i = 0; i < classElements.length; i++) {
classElements[i].disabled = false;
}
} else {
document.getElementById("signup-dialog").classList.add("modal-lg");
document.getElementById("terms-registration").classList.remove("col-12");
document.getElementById("terms-registration").classList.add("col-6");
let chbx = document.getElementById("agree-local");
classElements = document.getElementsByClassName('register_btn');
for (let i = 0; i < classElements.length; i++) {
classElements[i].disabled = !chbx.checked;
}
}
// hide password field for LDAP, NTLM, OKTA
if (authMethod) {
document.getElementById("password").value = '';
document.getElementById("confirmPassword").value = '';
document.getElementById("terms").rows = isSamlSignUp ? "16" : "8";
classElements = document.getElementsByClassName('password_field');
for (let i = 0; i < classElements.length; i++) {
classElements[i].style.display = 'none';
}
} else {
document.getElementById("password").value = '';
document.getElementById("confirmPassword").value = '';
document.getElementById("terms").rows = "16";
classElements = document.getElementsByClassName('password_field');
for (let i = 0; i < classElements.length; i++) {
classElements[i].style.display = 'block';
}
}
}
jQuery(document).ready(function ($) {
$("#registration").validate({
rules: {
firstName: "required",
lastName: "required",
email: {
required: true,
email: true
},
username: {
required: true,
minlength: 2
},
password: {
required: true,
minlength: 5
},
confirmPassword: {
required: true,
minlength: 5,
equalTo: "#password"
},
agree: "required"
},
messages: {
firstName: "Please provide your first name.",
lastName: "Please provide your last name.",
email: "Please provide a valid email.",
username: {
required: "Please provide your username.",
minlength: "Your username must consist of at least 4 characters."
},
password: {
required: "Please provide a password.",
minlength: "Your password must be at least 5 characters long."
},
confirmPassword: {
required: "Please reenter your password.",
minlength: "Your password must be at least 5 characters long.",
equalTo: "Please enter the same password as above."
},
agree: "You must agree to the terms and conditions.",
},
errorPlacement: function (error, element) {
error.addClass("invalid-feedback");
if (element.prop("type") === "checkbox") {
error.insertAfter(element.parent("label"));
} else {
error.insertAfter(element);
}
},
highlight: function (element, errorClass, validClass) {
$(element).addClass("is-invalid").removeClass("is-valid");
},
unhighlight: function (element, errorClass, validClass) {
$(element).addClass("is-valid").removeClass("is-invalid");
}
});
});
</script>
</head>
<body class="yui-skin-sam">
<div id="title-back"></div>
<div class="pageMask" id="topMask" style="display:none;"> </div>
<div id="project-request-viewer-panel" style="display:none;">
<div class="hd">i2b2 Web Client Project Request</div>
<div class="bd" id="project-request-viewer-body">
<p>Lorem Ipsum...</p>
</div>
<div class="ft"></div>
</div>
<?php if (empty($_SESSION["shib-session-id"])) { ?>
<div id="changepassword-viewer-panel" style="display:none;">
<div class="hd">i2b2 Change Password</div>
<div class="bd" id="modifier-viewer-body">
<table>
<tr>
<td>Current Password</td>
<td><input type="password" name="curpass" id="curpass"></td>
</tr>
<tr>
<td>New Password</td>
<td><input type="password" name="newpass" id="newpass"></td>
</tr>
<tr>
<td>Confirm New Password</td>
<td><input type="password" name="retypepass" id="retypepass"></td>
</tr>
</table>
<center>
<input type="submit" id="changePassword" name="changePassword" value="OK" onClick="i2b2.PM.changePassword.run();">
<input type="submit" id="changePassword" name="changePassword" value="Cancel" onClick="i2b2.PM.changePassword.hide();">
</center>
</div>
<div class="ft"></div>
</div>
<?php } ?>
<div id="modifier-viewer-panel" style="display:none;">
<div class="hd">i2b2 Web Client Modifier</div>
<div class="bd" id="modifier-viewer-body">
<p>Lorem Ipsum...</p>
</div>
<div class="ft"></div>
</div>
<div id="help-viewer-panel" style="display:none;">
<div class="hd">i2b2 Web Client Help</div>
<div class="bd" id="help-viewer-body">
<iframe width="23%" frameborder="0" height="98%" src="help/toc.html" name="left"></iframe>
<iframe width="75%" frameborder="0" height="98%" src="help/content.html" style="overflow-x:hidden;" name="right"></iframe>
</div>
<div class="ft"></div>
</div>
<div id="queryReport-viewer-panel" style="display:none;">
<div class="hd">Query Report</div>
<div class="bd" id="queryReport-viewer-body">
</div>
<div class="ft"></div>
</div>
<div id="commViewerSingleMsg-panel" style="display:none;">
<div class="hd">XML Message</div>
<div class="bd" id="commViewerSingleMsg-body">
<div class="xmlMsg"></div>
</div>
<div class="ft"></div>
</div>
<div id="PM-announcement-panel" style="display:none;">
<div class="hd" id="PM-announcement-title">Announcements</div>
<div class="bd" id="PM-announcement-body">
<p>Lorem Ipsum...</p>
</div>
<div class="ft"></div>
</div>
<div id="SHRINE-info-panel" style="display:none;">
<div class="hd" id="SHRINE-info-title">Topic</div>
<div class="bd" id="SHRINE-info-body">
<p>Lorem Ipsum...</p>
</div>
<div class="ft"></div>
</div>
<table border="0" cellspacing="0" cellpadding="0" width="100%" id="topBarTable">
<tr>
<td align="left" valign="middle"><img id="topBarTitle" border="0" alt="" /></td>
<td align="left" valign="middle"><div id="viewMode-Project"></div></td>
<td align="right" valign="middle"><div id="viewMode-User"></div></td>
<td align="right" valign="middle">
<div id="topBar">
<span id="menuLogin">
WebClient v1.7.13 | <a id="helpLink" href="Javascript:void(0)" onClick="i2b2.hive.HelpViewer.show();">Help</a>
</span>
<!-- <form name="projectsForm" style="margin: 0pt; padding: 0pt;" onSubmit="i2b2.PM.selectProject(); return false;">
<select style="font-size:11px;float:left;" onChange="i2b2.PM.view.modal.projectDialog.loadProject()" name="projects" id="loginProjs2"></select>
<input type="hidden" value="" name="i2b2_projects_modal_dialog"/>
</form>
-->
<div id="menuMain" style="display:none;">
<span id="viewMode-Patients"> <a href="Javascript:void(0)" onClick="i2b2.hive.MasterView.setViewMode('Patients');">Find Patients</a> | </span>
<!-- <span id="viewMode-Admin">
<a href="Javascript:void(0)" onClick="i2b2.hive.MasterView.setViewMode('Admin');">Admin</a>
|
</span>
-->
<span id="viewMode-Analysis">
<a href="Javascript:void(0)" onClick="i2b2.hive.MasterView.setViewMode('Analysis');">Analysis Tools</a>
<a href="#" onclick="return false;" id="pluginsMenu"><img src="assets/images/p_dropdown.png" align="absbottom" border="0"/></a> |
</span>
<span id="adminPlugins" style="display:none">
<a href="#" onClick="invokeWCPinstaller();
return false;" target="_blank">Install Plugins from i2b2 Gallery</a> |
</span>
<span id="debugMsgSniffer" style="display:none">
<a href="Javascript:void(0)" onClick="i2b2.hive.MsgSniffer.show();">Message Log</a> |
</span>
<a id="helpLink" href="Javascript:void(0)" onClick="i2b2.hive.HelpViewer.show();">Help</a> |
<?php if (empty($_SESSION["shib-session-id"])) { ?>
<span id="changePasswordLink">
<a id="helpLink" href="Javascript:void(0)" onClick="i2b2.PM.changePassword.show();">Change Password</a> |
</span>
<?php } ?>
<a href="Javascript:void(0);" onClick="i2b2.PM.doLogout();">Logout</a>
</div>
</div>
</td>
</tr>
</table>
<div id="screenQueryData" style="display:none">
<!-- ############### <ONT View> ############### -->
<div id="ontMainBox" style="display:none">
<div id="ontTopTabs">
<div style="z-index:200;">
<div id="tabNavigate" class="tabBox active" onClick="i2b2.ONT.view.main.selectTab('nav')">
<div>Terms</div>
</div>
<div id="tabFind" class="tabBox" onClick="i2b2.ONT.view.main.selectTab('find')">
<div>Find Trm</div>
</div>
<div id="tabInfo" class="tabBox" onClick="i2b2.ONT.view.main.selectTab('info')">
<div>Info</div>
</div>
<div id="guestTabWorkplace" class="tabBox" style="display:None" onClick="i2b2.ONT.view.main.ZoomView();
i2b2.WORK.view.main.ZoomView();">
<div>Workplace</div>
</div>
<div id="guestTabQueries" class="tabBox" style="display:None" onClick="i2b2.ONT.view.main.ZoomView();
i2b2.CRC.view.history.ZoomView();
i2b2.CRC.view.history.selectTab('nav');" >
<div>Queries</div>
</div>
<div id="guestTabQuerySearch" class="tabBox" style="display:None" onClick="i2b2.ONT.view.main.ZoomView();
i2b2.CRC.view.history.ZoomView();
i2b2.CRC.view.history.selectTab('find');" >
<div>Find Qry</div>
</div>
</div>
<div class="opXML">
<!-- <a href="JavaScript:showXML('ONT',i2b2.ONT.view.main.currentTab,'Request');" class="debug"><img src="assets/images/msg_request.gif" border="0" width="16" height="16" alt="Show XML Request" title="Show XML Request" /></a> -->
<!-- <a href="JavaScript:showXML('ONT',i2b2.ONT.view.main.currentTab,'Response');" class="debug"><img src="assets/images/msg_response.gif" border="0" width="16" height="16" alt="Show XML Response" title="Show XML Response" /></a> -->
<a href="JavaScript:showXML('ONT',i2b2.ONT.view.main.currentTab,'Stack');" class="debug"><img src="assets/images/msg_stack.gif" border="0" width="16" height="16" alt="Show XML Message Stack" title="Show XML Message Stack" /></a> <a href="JavaScript:i2b2.ONT.view.main.showOptions();"><img src="assets/images/options.gif" border="0" width="16" height="16" alt="Show Options" title="Show Options" /></a> <a href="JavaScript:i2b2.ONT.view.main.ZoomView();"><img id="ontZoomImg" width="16" height="16" border="0" src="js-i2b2/cells/ONT/assets/zoom_icon.gif" alt="Resize Workspace" title="Resize Workspace" /></a> </div>
</div>
<div id="ontMainDisp">
<div id="ontNavDisp">
<!--<div id="standardQuery">Standard Query Items</div>-->
<div id="ontNavResults"></div>
</div>
<div id="ontFindDisp" style="display:none"> <a id="ontFindTabName" href="Javascript:i2b2.ONT.view.find.selectSubTab('names')" class="findSubTabSelected" >Search by Names</a> <a id="ontFindTabCode" href="Javascript:i2b2.ONT.view.find.selectSubTab('codes')" class="findSubTab" >Search by Codes</a>
<div id="ontFindFrameName" class="findSubFrame">
<form id="ontFormFindName" method="post" action="JavaScript:i2b2.ONT.ctrlr.FindBy.clickSearchName();" style="margin:0px; padding:0px;">