-
Notifications
You must be signed in to change notification settings - Fork 3
/
index.php
2210 lines (2022 loc) · 87.4 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
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="description" content="A front-end template that helps you build fast, modern mobile web apps.">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>FIONA SITE COMPUTER</title>
<!-- Add to homescreen for Chrome on Android -->
<meta name="mobile-web-app-capable" content="yes">
<link rel="icon" sizes="192x192" href="images/touch/chrome-touch-icon-192x192.png">
<!-- Add to homescreen for Safari on iOS -->
<meta name="apple-mobile-web-app-capable" content="yes">
<meta name="apple-mobile-web-app-status-bar-style" content="black">
<meta name="apple-mobile-web-app-title" content="Material Design Lite">
<link rel="apple-touch-icon-precomposed" href="apple-touch-icon-precomposed.png">
<!-- Tile icon for Win8 (144x144 + tile color) -->
<meta name="msapplication-TileImage" content="images/touch/ms-touch-icon-144x144-precomposed.png">
<meta name="msapplication-TileColor" content="#3372DF">
<!-- SEO: If your mobile URL is different from the desktop URL, add a canonical link to the desktop page https://developers.google.com/webmasters/smartphone-sites/feature-phones -->
<!--
<link rel="canonical" href="http://www.example.com/">
-->
<?php
session_start();
include("php/AC.php");
$user_name = check_logged();
echo('<script type="text/javascript"> user_name = "'.$user_name.'"; </script>'."\n");
// print out all the permissions
$permissions = list_permissions_for_user($user_name);
$p = '<script type="text/javascript"> permissions = [';
foreach($permissions as $perm) {
$p = $p."\"".$perm."\",";
}
echo ($p."]; </script>\n");
// what is the current project name?
$project = getUserVariable( $user_name, "project_name");
if ($project === FALSE) {
$project = "ABCD";
}
echo('<script type="text/javascript"> project_name = "' . $project . '";</script>');
$filter_pattern = "";
if (is_readable("php/config.json")) {
$config = json_decode(file_get_contents("php/config.json"),True);
if ( isset($config['HIDEPATTERN']) ) {
$filter_pattern = $config['HIDEPATTERN'];
echo('<script type="text/javascript"> hidepattern = "' . $filter_pattern . '";</script>');
}
}
// PCGC
// For each $permissions: "SiteABCD", "SitePCGC"
// get the site name: "ABCD", "PCGC"
// and create and array of $sites
$sites = array();
foreach ($permissions as $perm) {
$parts = explode("Site", $perm);
if (count($parts) > 1) {
$sites[] = $parts[1];
}
}
$p = '<script type="text/javascript"> sites = [';
foreach($sites as $s) {
$p = $p."\"".$s."\",";
}
echo ($p."]; </script>\n");
$admin = false;
if (check_role( "admin" )) {
$admin = true;
}
if (check_permission( "developer" )) {
$developer = true;
}
if (check_permission( "see-scanner" )) {
$seescanner = true;
}
?>
<style>
.study {
width: 72px;
height: auto;
border: 1px solid gray;
border-radius: 3px;
color: blue;
display: inline-flex;
margin: 2px;
}
.item {
width: 10px;
height: 10px;
border: 1px solid gray;
border-radius: 3px;
background-color: white;
margin: 0px;
margin-top: 2px;
margin-left: 2px;
}
.no-item {
width: 10px;
height: 10px;
border: 1px solid white;
background-color: white;
margin: 0px;
margin-top: 2px;
margin-left: 2px;
}
.group-archive .item {
background-color: rgba(226,87,30,.5);
}
.group-archive .item-heigh {
background-color: rgba(226,87,30,.5);
}
.raw.item {
background-color: rgba(255,255,0,.5);
}
.quarantine.item {
background-color: rgba(150,191,51,.5);
}
.outbox.item {
background-color: rgba(0,0,255,.5);
}
.DAIC.item {
background-color: rgba(139,0,255,.5);
}
.series-group {
font-size: 18px;
line-height: 12px;
margin-bottom: 2px;
}
.serie {
display: inline-flex;
}
#modal-data-flow {
width: 90%;
}
.item-heigh {
width: 10px;
height: 50%;
min-height: 10px;
border: 1px solid gray;
border-radius: 3px;
color: white;
margin: 2px;
}
.group-archive {
width: 14px;
height: auto;
}
.group-raw {
width: 16px;
height: auto;
}
.group-quarantine {
width: 16px;
height: auto;
}
.group-outbox {
width: 16px;
height: auto;
}
@font-face {
font-family: 'Roboto';
font-style: normal;
font-weight: 100;
src: local('Roboto Thin'), local('Roboto-Thin'), url(font/roboto/Jzo62I39jc0gQRrbndN6nfesZW2xOQ-xsNqO47m55DA.ttf) format('truetype');
}
@font-face {
font-family: 'Roboto';
font-style: normal;
font-weight: 300;
src: local('Roboto Light'), local('Roboto-Light'), url(font/roboto/Hgo13k-tfSpn0qi1SFdUfaCWcynf_cDxXwCLxiixG1c.ttf) format('truetype');
}
@font-face {
font-family: 'Roboto';
font-style: normal;
font-weight: 400;
src: local('Roboto'), local('Roboto-Regular'), url(font/roboto/zN7GBFwfMP4uA6AR0HCoLQ.ttf) format('truetype');
}
@font-face {
font-family: 'Roboto';
font-style: normal;
font-weight: 500;
src: local('Roboto Medium'), local('Roboto-Medium'), url(font/roboto/RxZJdnzeo3R5zSexge8UUaCWcynf_cDxXwCLxiixG1c.ttf) format('truetype');
}
@font-face {
font-family: 'Roboto';
font-style: normal;
font-weight: 700;
src: local('Roboto Bold'), local('Roboto-Bold'), url(font/roboto/d-6IYplOFocCacKzxwXSOKCWcynf_cDxXwCLxiixG1c.ttf) format('truetype');
}
@font-face {
font-family: 'Roboto';
font-style: normal;
font-weight: 900;
src: local('Roboto Black'), local('Roboto-Black'), url(font/roboto/mnpfi9pxYH-Go5UiibESIqCWcynf_cDxXwCLxiixG1c.ttf) format('truetype');
}
@font-face {
font-family: 'Roboto';
font-style: italic;
font-weight: 400;
src: local('Roboto Italic'), local('Roboto-Italic'), url(font/roboto/W4wDsBUluyw0tK3tykhXEfesZW2xOQ-xsNqO47m55DA.ttf) format('truetype');
}
@font-face {
font-family: 'Roboto';
font-style: italic;
font-weight: 700;
src: local('Roboto Bold Italic'), local('Roboto-BoldItalic'), url(font/t6Nd4cfPRhZP44Q5QAjcC50EAVxt0G0biEntp43Qt6E.ttf) format('truetype');
}
@font-face {
font-family: 'Material Icons';
font-style: normal;
font-weight: 400;
src: local('Material Icons'), local('MaterialIcons-Regular'), url(font/2fcrYFNaTjcS6g4U3t-Y5StnKWgpfO2iSkLzTz-AABg.ttf) format('truetype');
}
.material-icons {
font-family: 'Material Icons';
font-weight: normal;
font-style: normal;
font-size: 24px;
line-height: 1;
letter-spacing: normal;
text-transform: none;
display: inline-block;
white-space: nowrap;
word-wrap: normal;
direction: ltr;
}
.mark {
background-color: DarkSlateGray;
}
.detail-information {
font-size: 10px;
left: 10px;
bottom: 0px;
position: absolute;
color: white;
white-space: no-wrap;
}
.scan-date {
color: white;
font-size: 10px;
position: absolute;
right: 10px;
bottom: 15px;
white-space: no-wrap;
}
</style>
<!-- <link href="https://fonts.googleapis.com/css?family=Roboto:regular,bold,italic,thin,light,bolditalic,black,medium&lang=en" rel="stylesheet"> -->
<!-- <link href="https://fonts.googleapis.com/icon?family=Material+Icons" rel="stylesheet"> -->
<link rel="stylesheet" href="css/material.min.css">
<link rel="stylesheet" href="css/styles.css">
<link rel="stylesheet" href="css/fullcalendar.min.css">
<link rel="stylesheet" media="print" href="css/fullcalendar.print.css">
<link rel="stylesheet" href="css/jquery.bonsai.css">
<link rel="stylesheet" href="css/select2.min.css">
<style>
#view-source {
position: fixed;
display: block;
right: 0;
bottom: 0;
margin-right: 40px;
margin-bottom: 40px;
z-index: 900;
}
.green-background {
background-color: lightgreen;
}
.red-background {
background-color: red;
}
.drop-down-item{
}
.form-control {
width: 300px;
margin-bottom: 10px;
margin-top: 5px;
}
.control-label {
color: black;
font-size: 12pt;
}
.form-control option {
height: 25px;
background-color: white;
padding-top: 5px;
}
#detected-scans {
height: 300px;
overflow-y: scroll;
}
.SeriesName {
font-size: 20px;
font-weight: 500;
line-height: 1;
letter-spacing: .02em;
}
.select2-container {
margin-bottom: 10px;
margin-top: 5px;
}
#select2-session-participant-results li {
border-bottom: 0px;
margin-bottom: 0px;
padding: 0px;
}
li {
border-bottom: 1px solid gray;
margin-bottom: 5px;
list-style-type: none;
margin-left: 0px;
padding: 5px;
}
#detected-scans {
padding-left: 0px;
}
.send-series-button {
margin-bottom: 10px;
}
.status0 {
background: linear-gradient(to right, white, white 80%, red);
}
.status1 {
background: linear-gradient(to right, white, white 80%, green);
}
.unknown-type {
color: yellow !important;
}
.transferred-type {
color: 'rgba(255,255,255,0.56)';
}
.demo-drawer {
overflow-x: hidden;
}
</style>
<link rel="stylesheet" href="css/dialog-polyfill.min.css">
</head>
<body>
<div class="demo-layout mdl-layout mdl-js-layout mdl-layout--fixed-drawer mdl-layout--fixed-header">
<header class="demo-header mdl-layout__header mdl-color--white mdl-color--grey-100 mdl-color-text--grey-600">
<div class="mdl-layout__header-row">
<span class="mdl-layout-title hostname" title="Flash I/O Network Appliance"> ABCD's FIONA</span>
<nav class="mdl-navigation mdl-menu--top-right">
<a class="mdl-navigation__link" style="color: gray;">User: <?php echo($user_name); ?></a>
</nav>
<div class="mdl-layout-spacer"></div>
<div class="mdl-layout-spacer"></div>
<button class="mdl-button mdl-js-button mdl-js-ripple-effect mdl-button--icon" id="hdrbtn">
<i class="material-icons">more_vert</i>
</button>
<ul class="mdl-menu mdl-js-menu mdl-js-ripple-effect mdl-menu--bottom-right" for="hdrbtn">
<li class="mdl-menu__item" id="dialog-about-button">About</li>
<li class="mdl-menu__item"><a href="applications/viewer/" title="Image viewer for FIONA DICOM images">Image Viewer</a></li>
<?php if ($developer) : ?>
<li class="mdl-menu__item"><a href="invention.html">Development</a></li>
<li class="mdl-menu__item" id="dialog-data-flow-button">Data Flow</li>
<?php endif; ?>
<?php if ($admin) : ?>
<li class="mdl-menu__item" onclick="document.location.href = '/applications/User/admin.php';">Admin Interface</li>
<li class="mdl-menu__item" id="dialog-clean-quarantine-button">Quarantine Data</li>
<li class="mdl-menu__item" id="dialog-setup-button">Setup</li>
<?php endif; ?>
<li class="mdl-menu__item" id="dialog-change-password-button">Change Password</li>
<li class="mdl-menu__item" onclick="logout();">Logout</li>
</ul>
</div>
</header>
<div class="demo-drawer mdl-layout__drawer mdl-color--blue-grey-900 mdl-color-text--blue-grey-50">
<header class="demo-drawer-header" style="position: relative;">
<img src="images/user.jpg" class="demo-avatar">
<!-- PCGC -->
<!-- Dropdown selector to pick a project -->
<div style="position: absolute; right: 10px; top: 0px;" id="project-dropdown-section">
<div class="demo-avatar-dropdown" style="z-index: 99;">
<!-- <button id="projbtn" class="mdl-button mdl-js-button mdl-js-ripple-effect mdl-button--icon"> -->
<button id="projbtn" class="mdl-button mdl-js-button mdl-button--icon">
<i class="material-icons" role="presentation">arrow_drop_down</i>
</button>
<!--<ul class="mdl-menu mdl-menu--bottom-right mdl-js-menu mdl-js-ripple-effect" for="projbtn">-->
<ul class="mdl-menu mdl-menu--bottom-right mdl-js-menu" for="projbtn">
<!-- <li class="mdl-menu__item clickable-project-name" id="projAAAA"> </li>
<li class="mdl-menu__item clickable-project-name" id="projBBBB"> </li> -->
<?php
// Add a menu item for each project
foreach ($sites as $site) {
echo ("<li class=\"mdl-menu__item clickable-project-name\" id=\"proj".$site."\">".strtoupper($site)."</li>");
}
?>
</ul>
<div>
<h3 id="projname"></h3>
</div>
</div>
</div>
<div class="demo-avatar-dropdown">
<span>Data Views</span>
<div class="mdl-layout-spacer"></div>
<button id="accbtn" class="mdl-button mdl-js-button mdl-js-ripple-effect mdl-button--icon">
<i class="material-icons" role="presentation">arrow_drop_down</i>
<span class="visuallyhidden">Accounts</span>
</button>
<ul class="mdl-menu mdl-menu--bottom-right mdl-js-menu mdl-js-ripple-effect" for="accbtn">
<li class="mdl-menu__item" id="load-subjects">Subjects</li>
<li class="mdl-menu__item" id="load-studies">Studies</li>
<?php if ($seescanner) : ?>
<li class="mdl-menu__item" id="load-scanner">Scanner</li>
<?php endif; ?>
</ul>
</div>
</header>
<nav class="demo-navigation mdl-color--blue-grey-900 mdl-color-text--blue-grey-50">
<center><span id="view-name"></span></center>
<div class="mdl-layout-spacer"></div>
<div class="" style="color: white; width: 100%;">
<div class="mdh-expandable-search mdl-cell--hide-phone">
<i class="material-icons">search</i>
<form action="#">
<input id="search-list" type="text" placeholder="Search" size="1">
</form>
</div>
<!-- Displayed on mobile -->
<div class="mdl-layout-spacer mdl-cell--hide-tablet mdl-cell--hide-desktop"></div>
<!-- Search button -->
<button class="mdh-toggle-search mdl-button mdl-js-button mdl-button--icon mdl-cell--hide-tablet mdl-cell--hide-desktop">
<i class="material-icons">search</i>
</button>
</div>
</nav>
<nav id="list-of-subjects" class="demo-navigation mdl-navigation mdl-color--blue-grey-800">
<div class="mdl-layout-spacer"></div>
<a class="mdl-navigation__link" href=""><i class="mdl-color-text--blue-grey-400 material-icons" role="presentation">help_outline</i><span class="visuallyhidden">Help</span></a>
</nav>
</div>
<main class="mdl-layout__content mdl-color--grey-100">
<div class="mdl-grid demo-content">
<div class="demo-charts mdl-color--white mdl-shadow--2dp mdl-cell mdl-cell--12-col mdl-grid">
<div id="system-load" class="mdl-cell mdl-cell--2-col">
<div class="mdl-spinner mdl-js-spinner is-active" style="width: 110px; height: 110px;margin-left: 10px;"></div>
</div>
<div id="system-space" class="mdl-cell mdl-cell--2-col"></div>
<div id="system-memory" class="mdl-cell mdl-cell--2-col"></div>
<!-- <div class="mdl-cell mdl-cell--2-col"></div> --><div class="mdl-layout-spacer"></div>
<div class="mdl-cell mdl-cell--2-col minw">
<label for="receive-dicom" id="receive-dicom-label" class="mdl-checkbox mdl-js-checkbox mdl-js-ripple-effect">
<input type="checkbox" id="receive-dicom" class="mdl-checkbox__input" checked />
<span class="mdl-checkbox__label">receive DICOM</span>
</label>
<label for="receive-mpps" id="receive-mpps-label" class="mdl-checkbox mdl-js-checkbox mdl-js-ripple-effect">
<input type="checkbox" id="receive-mpps" class="mdl-checkbox__input" checked />
<span class="mdl-checkbox__label">auto-pull DICOM</span>
</label>
<label for="anonymize" id="anonymize-label" class="mdl-checkbox mdl-js-checkbox mdl-js-ripple-effect">
<input type="checkbox" id="anonymize" class="mdl-checkbox__input" disabled />
<span class="mdl-checkbox__label">anonymize files</span>
</label>
</div>
</div>
<div class="demo-graphs mdl-shadow--2dp mdl-color--white mdl-cell mdl-cell--12-col">
<div id="calendar-loc"></div>
</div>
<div class="demo-graphs mdl-shadow--2dp mdl-color--white mdl-cell mdl-cell--12-col" style="display: none;">
<div style="position: relative;">
<div style="font-size: 22pt; position: absolute; top: 20px;color: #757575; left: 10pt;">Studies present on this system</div>
<div id="circles"></div>
</div>
</div>
<div class="demo-graphs mdl-shadow--2dp mdl-color--white mdl-cell mdl-cell--12-col" style="display: none;">
<div style="position: relative;">
<div style="font-size: 22pt; position: absolute; bottom: 20px;color: #757575; left: 10pt;">Studies present on this system</div>
<div id="bars"></div>
</div>
</div>
</div>
</main>
</div>
<dialog class="mdl-dialog" id="modal-change-password">
<div class="mdl-dialog__content">
<div style="font-size: 32pt; margin-bottom: 25px;">
Change Password
</div>
<form>
<input class="mdl-textfield__input" type="password" id="password-field1" placeholder="*******" autofocus><br/>
<input class="mdl-textfield__input" type="password" id="password-field2" placeholder="type again">
</form>
</div>
<div class="mdl-dialog__actions mdl-dialog__actions--full-width">
<button type="button" class="mdl-button" id="change-password-cancel">Cancel</button>
<button type="button" class="mdl-button" id="change-password-save" onclick="changePassword();">Save</button>
</div>
</dialog>
<dialog class="mdl-dialog" id="modal-setup">
<div class="mdl-dialog__content">
<div style="font-size: 32pt; margin-bottom: 25px;">
Configuration
</div>
<div id="setup-text">
loading configuration file...
</div>
</div>
<div class="mdl-dialog__actions mdl-dialog__actions--full-width">
<button type="button" class="mdl-button" id="setup-dialog-cancel">Cancel</button>
<button type="button" class="mdl-button" id="setup-dialog-save">Save</button>
</div>
</dialog>
<dialog class="mdl-dialog" id="modal-clean-quarantine">
<div class="mdl-dialog__content">
<div style="position: absolute; right: 40px;">
<label for="show-suid-only">Show SUID entries only</label>
<input type="checkbox" id="show-suid-only">
</div>
<div style="font-size: 32pt; margin-bottom: 25px;">
Quarantine Data
</div>
<div style="height: 500px; overflow-y: scroll;">
<table class="mdl-data-table mdl-js-data-table mdl-shadow--2dp">
<thead><tr>
<th>#Files</th>
<th>Action</th>
<th style="mdl-data-table__cell--non-numeric">Name</th>
<th class="mdl-data-table__cell--non-numeric sort" data-sort="StudyDate">StudyDate</th>
<th>Size (MB)</th>
<th>parts pushed to DAIC as</th>
</tr>
</thead>
<tbody id="cleanQuarantine">
</tbody>
</table>
<div class="loading"><img style="position: absolute; top: 50%; left: 50%;" src="/images/loader.gif"></div>
</div>
</div>
<div class="mdl-dialog__actions mdl-dialog__actions--full-width">
<button type="button" class="mdl-button" id="clean-quarantine-close">Close</button>
</div>
</dialog>
<dialog class="mdl-dialog" id="modal-data-flow">
<div class="mdl-dialog__content">
<div style="font-size: 32pt; margin-bottom: 25px;">
Data Flow
</div>
<div>
<p style="line-height: 1.2em;">Experimental visualization of the data flow for each study. Studies are represented by rectangular regions, where each study region is filled with rows of smaller squares that represent image series. The color of each individual image series square indicates its current state. States are ordered according to the data flow in columns of archive (red), raw (yellow), quarantine (green), outbox (blue), and DAIC (violet).</p>
</div>
<div id="data-flow-container" style="position: relative;"></div>
</div>
<div class="mdl-dialog__actions mdl-dialog__actions--full-width">
<button type="button" class="mdl-button" id="data-flow-dialog-cancel">ok</button>
</div>
</dialog>
<dialog class="mdl-dialog" id="modal-study-info">
<div class="mdl-dialog__content">
<div style="font-size: 32pt; margin-bottom: 20px;">
Study Transfer
</div>
<div class="row">
<div class="mdl-cell mdl-cell--12-col" id="study-info-text"></div>
</div>
<div class="row">
<div class="mdl-cell mdl-cell--12-col">
<div id="header-section"></div>
</div>
</div>
<div class="row">
<div class="mdl-cell mdl-cell--12-col" id="identify-section">
<h4>Identify your imaging session</h4>
<div class="form-group">
<label for="session-participant" class="control-label">Participant (pGUID in REDCap)</label><br/>
<select class="form-control select2-list" id="session-participant">
<option></option>
</select>
</div>
<div class="form-group">
<label for="session-name" class="control-label">Event name (baseline or 2-year or 4-year)</label><br/>
<select class="form-control" id="session-name"></select>
</div>
<div class="form-group">
<label for="session-run" class="control-label">Imaging Session Type</label><br/>
<select class="form-control" id="session-run">
<option value="SessionA1" title="T1, rsFMRI (2 runs), DTI, T2, rsfMRI (up to 2 runs)">A1 (T1, rsFMRI (2 runs), DTI, T2, rsfMRI (up to 2 runs))</option>
<option value="SessionA2" title="3 fMRI tasks">A2 (3 fMRI tasks)</option>
<option value="SessionB1" title="T1, 3 fMRI tasks">B1 (T1, 3 fMRI tasks)</option>
<option value="SessionB2" title="rsfMRI (2 runs), DTI, T2, rsfMRI (up to 2 runs)">B2 (rsfMRI (2 runs), DTI, T2, rsfMRI (up to 2 runs))</option>
<option value="SessionC" title="Combined scan">C (Combined scan)</option>
<option value="SessionPHANTOM" title="Phantom scan">P (Phantom scan)</option>
</select>
</div>
</div>
</div>
<div class="row">
<div class="mdl-cell mdl-cell--12-col">
<div id="detected-scans-summary"></div>
<ul id="detected-scans">
</ul>
</div>
</div>
<div class="row">
<div class="mdl-cell mdl-cell--12-col" id="additional-scans"></div>
</div>
<div class="row">
<div class="mdl-dialog__actions mdl-dialog__actions--full-width">
<button type="button" class="mdl-button" id="study-info-dialog-cancel">Cancel</button>
<button type="button" class="mdl-button" id="study-info-dialog-sendall">Send All Series</button>
</div>
</div>
</div>
</dialog>
<div class="messagepop pop">
<div class="messagepop-title"></div>
<div class="messagepop-content"></div>
<!-- <form method="post" id="new_message" action="/messages">
<p><label for="email">Your email or name</label><input type="text" size="30" name="email" id="email" /></p>
<p><label for="body">Message</label><textarea rows="6" name="body" id="body" cols="35"></textarea></p>
<p><input type="submit" value="Send Message" name="commit" id="message_submit"/> or <a class="close" href="/">Cancel</a></p>
</form> -->
</div>
<dialog class="mdl-dialog" id="modal-series-info">
<div class="mdl-dialog__content">
<div style="font-size: 32pt; margin-bottom: 20px;">
Series Information
</div>
<div id="series-info-text">
loading information...
</div>
</div>
<div class="mdl-dialog__actions">
<button type="button" class="mdl-button" id="series-info-dialog-cancel">ok</button>
</div>
</dialog>
<dialog class="mdl-dialog" id="modal-repush">
<div class="mdl-dialog__content">
<div style="font-size: 24pt; margin-bottom: 20px;">
Recreate send buttons for this study
</div>
<div>
<p style="line-height: 1.1em;">Do you want to recreate the send buttons for this study?</p>
<p style="line-height: 1.1em;">Upon request from the central data repository you may use this functionality to re-create the data package for this participant. Once started this operation may take a long time - at most 1 hour depended on the load on the machine. Please be patient and wait until all the Send buttons appear again on the Study Transfer dialog before using the "Send all series" button.</p>
</div>
</div>
<div class="mdl-dialog__actions">
<button type="button" class="mdl-button" id="repush-cancel">cancel</button>
<button type="button" class="mdl-button" id="repush-ok">ok</button>
</div>
</dialog>
<dialog class="mdl-dialog" id="modal-about">
<div class="mdl-dialog__content">
<div style="font-size: 22pt; margin-bottom: 20px;">
Flash-based Input/Output Network Appliance
</div>
<div>
<p>
Learn more about this project by visiting <a href="https://abcd-workspace.ucsd.edu">abcd-workspace.ucsd.edu</a>.
</p>
</div>
</div>
<div class="mdl-dialog__actions mdl-dialog__actions--full-width">
<button type="button" class="mdl-button close-dialog">OK</button>
</div>
</dialog>
<div id="message-window" class="mdl-shadow--2dp mdl-color--white" style="display: none;">
<div id="message-window-header"></div>
<div id="message-window-body" style="height: 60px; overflow-y: scroll;"></div>
</div>
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" version="1.1" style="position: fixed; left: -1000px; height: -1000px;">
<defs>
<mask id="piemask" maskContentUnits="objectBoundingBox">
<circle cx=0.5 cy=0.5 r=0.49 fill="white"></circle>
<circle cx=0.5 cy=0.5 r=0.40 fill="black"></circle>
</mask>
<g id="piechart">
<circle cx=0.5 cy=0.5 r=0.5></circle>
<path d="M 0.5 0.5 0.5 0 A 0.5 0.5 0 0 1 0.95 0.28 z" stroke="none" fill="rgba(255, 255, 255, 0.75)"></path>
</g>
</defs>
</svg>
<script src="js/dialog-polyfill.min.js"></script>
<script src="js/material.min.js"></script>
<script src="js/d3.js"></script>
<script src="js/circles.js"></script>
<!-- <script src="js/sankey.js"></script>
<script src="js/d3.chart.min.js"></script>
<script src="js/d3.chart.sankey.min.js"></script> -->
<script src="js/bars.js"></script>
<script src="js/jquery-2.1.4.min.js"></script>
<script src="js/select2.min.js"></script>
<script src="js/wookmark.min.js"></script>
<script src="js/radialProgress.js"></script>
<script src="js/moment-with-locales.min.js"></script>
<script src="js/fullcalendar.min.js"></script>
<script src="js/ace-min-noconflict/ace.js" type="text/javascript" charset="utf-8"></script>
<script src="js/jquery.bonsai.js" type="text/javascript"></script>
<script src="js/md5-min.js" type="text/javascript"></script>
<script type="text/javascript">
// PCGC
// ABCD is the default project name
var projname = project_name;
// logout the current user
function logout() {
jQuery.get('/php/logout.php', function(data) {
if (data == "success") {
// user is logged out, reload this page
location.reload();
} else {
alert('something went terribly wrong during logout: ' + data);
}
});
}
// change the current user's password
function changePassword() {
var password = jQuery('#password-field1').val();
var password2 = jQuery('#password-field2').val();
if (password == "") {
alert("Error: Password cannot be empty.");
return; // no empty passwords
}
// minimum password length
if (password.length < 8) {
alert("Error: Password has to be at least 8 characters in length.");
return;
}
// user name should not be part of password
if (password.toLowerCase().indexOf(user_name.toLowerCase()) != -1) {
alert("Error: username should not be part of the password.");
return;
}
if (! /[a-z]+/.test(password) ) {
alert("Error: password should contain lower-case characters a-z");
return;
}
if (! /[A-Z]+/.test(password) ) {
alert("Error: password should contain upper case characters A-Z");
return;
}
if (! /[0-9]+/.test(password) ) {
alert("Error: password should contain number 0-9");
return;
}
if (! /[\! @#*+-:.,\?\^_\/\\\s]+/.test(password) ) {
alert("Error: password should contain punctuation or non-alphanumeric character");
return;
}
hash = hex_md5(password);
hash2 = hex_md5(password2);
if (hash !== hash2) {
alert("Error: The two passwords are not the same, please type again.");
return; // do nothing
}
jQuery.getJSON('/php/getUser.php?action=changePassword&value=' + user_name + '&value2=' + hash, function(data) {
alert("Success: you have changed the password for user " + user_name);
}).fail(function() {
alert("Error: an error was returned trying to set your new password (" + user_name + ")");
});
}
// make sure that we list if a scan has been send previously (when and under what pGUID)
// do this for all participants in the open-study-info that are currently visible on screen, cache the results
var sendInformationCache = {}; // use study instance uid as key in this cache
var sendInformationQueue = [];
function updateSendInformation() {
// get all currently visible entries
function checkVisible(elm) {
var style = window.getComputedStyle(elm);
if (style.display === 'none')
return false;
var rect = elm.getBoundingClientRect();
var viewHeight = Math.max(document.documentElement.clientHeight, window.innerHeight);
return !(rect.bottom < 0 || rect.top - viewHeight >= 0);
}
// todo: we get this call a lot, each time there we get values for another series. Would be better to delay the render - not a big issue
function renderResult(studyinstanceuid) {
if (sendInformationCache[studyinstanceuid].status == "transferred") {
// find the right entry on screen
var a = null;
jQuery('#list-of-subjects').children().each(function(i,v) {
if (jQuery(v).attr('studyinstanceuid') == studyinstanceuid) {
a = v;
}
});
if (a !== null) {
jQuery(a).find('a i.unknown-type').removeClass('unknown-type').addClass('transferred-type');
jQuery(a).find('a div.detail-information').remove();
jQuery(a).find('a').append("<div class='detail-information'>" + sendInformationCache[studyinstanceuid].event + " " + sendInformationCache[studyinstanceuid].pGUID + " (" + sendInformationCache[studyinstanceuid].date.format('MMM Do YYYY') + ")" );
}
}
}
jQuery.each(jQuery('.open-study-info'), function(i,a) {
if (checkVisible(jQuery(a)[0])) {
var studyinstanceuid = jQuery(a).attr('studyinstanceuid');
// do we have an entry in the cache for this already?
if (typeof sendInformationCache[studyinstanceuid] == 'undefined') {
// we will get a value for this at some point (don't request this a second time)
sendInformationCache[studyinstanceuid] = { 'status': 'fileNotFound' };
// get the data for this studyinstanceuid
(function(studyinstanceuid) { // make studyinstanceuid a local variable in the scope
var options = {
"action": "getStudy",
"study": studyinstanceuid,
"project": projname,
"skipComplianceReRun": 1
};
// get a list of the series for this study
jQuery.getJSON('/php/existingData.php', options, function(data) {
dataSec1 = {};
dataSec2 = {};
dataSec3 = {};
var keys = Object.keys(data);
for (var i = 0; i < keys.length; i++) {
var value = data[keys[i]];
if (Array.isArray(value)) {
dataSec3[keys[i]] = value;
} else if (typeof value === 'object') {
dataSec2[keys[i]] = value;
} else if (typeof value === 'string') {
dataSec1[keys[i]] = value;
} /* else {
alert("Error: No existing data, perhaps protocol compliance check was not run.");
} */
}
// we are looking for the data in dataSec2+dataSec3 (series that have been detected)
// we need to call fileStatus.php for them to find out which once are in DAIC
var allFilePaths = [];
for (var k in dataSec2) {
if (dataSec2[k] === null || typeof dataSec2[k]['file'] == 'undefined') {
// if there is no 'file' it can still be in a key one down
var keys = Object.keys(dataSec2[k]);
for (var j = 0; j < keys.length; j++) {
if (typeof dataSec2[k][keys[j]]['file'] !== 'undefined') {
for (var i = 0; i < dataSec2[k][keys[j]]['file'].length; i++) {
if (typeof dataSec2[k][keys[j]]['file'][i]['path'] !== 'undefined' && dataSec2[k][keys[j]]['file'][i]['path'] !== "") {
allFilePaths.push(dataSec2[k][keys[j]]['file'][i]['path']);
}
}
}
}
continue;
}
for (var i = 0; i < dataSec2[k]['file'].length; i++) {
if (typeof dataSec2[k]['file'][i]['path'] !== 'undefined' && dataSec2[k]['file'][i]['path'] !== "") {
allFilePaths.push(dataSec2[k]['file'][i]['path']);
}
}
}
if ( allFilePaths.length == 0 ) {
// don't ask for this studyinstanceuid again
sendInformationCache[studyinstanceuid] = { 'status': 'fileNotFound' };
}
for (var i = 0; i < allFilePaths.length; i++) {
filePath = allFilePaths[i]; // for each file path search and return if its transferred, in transit, or readyToSend, if its transferred extract the pGUID and date
jQuery.getJSON('/php/fileStatus.php?filename=' + filePath + '&project='+projname, (function(studyinstanceuid) {
// return a function that knows about our series Instance UID variable
return function(data) {
// now add the information returned to the sendInformationCache[studyinstanceuid]
// we get back data here that looks like this:
// $val[] = array( "ok" => 1, "message" => "readyToSend", "filename" => $qv[0], "filemtime" => $qv[1] );
// $val[] = array( "ok" => 1, "message" => "transit", "filename" => $qv[0], "filemtime" => $qv[1] );
// $val[] = array( "ok" => 1, "message" => "transferred", "filename" => $qv[0], "filemtime" => $qv[1] );
if (data.length == 0) {
sendInformationCache[studyinstanceuid] = { 'status': 'fileNotFound' };
return;
}
var sendAsGUID = "";
var sendWhen = "";
var sendWhat = "";
var sendEvent = "";
for (var i = 0; i < data.length; i++) {
// find the newest transferred dataset
if (data[i].message == "transferred") {
// found one!
if (sendWhen == "") { // first time
sendWhen = data[i].filemtime;
if (data[i].filename.split("/")[3].split("_")[0] == "NDAR") {
sendAsGUID = data[i].filename.split("/")[3].split("_").slice(0,2).join("_");
sendEvent = data[i].filename.split("/")[3].split("_").slice(2,4).join("_");
} else {
sendAsGUID = data[i].filename.split("/")[3].split("_").slice(0,1);
sendEvent = data[i].filename.split("/")[3].split("_").slice(1,3).join("_");
}
sendWhat = data[i].filename;
} else {
// not the first time, is this a later date? Use the latest data for all send operations ( January 21 2018 14:45:10 )
var date1 = moment(sendWhen, 'MMMM D YYYY H:m:s');
var date2 = moment(data[i].filemtime, 'MMMM D YYYY H:m:s');
if ( moment().diff(date1, 'minutes') > moment().diff(date2, 'minutes') ) {
sendWhen = data[i].filemtime;
if (data[i].filename.split("/")[3].split("_")[0] == "NDAR") {
sendAsGUID = data[i].filename.split("/")[3].split("_").slice(0,2).join("_");
sendEvent = data[i].filename.split("/")[3].split("_").slice(2,4).join("_");
} else {
sendAsGUID = data[i].filename.split("/")[3].split("_").slice(0,1);
sendEvent = data[i].filename.split("/")[3].split("_").slice(1,3).join("_");
}
sendWhat = data[i].filename;
} // otherwise we have an old send for this study
}
}
}
if (sendWhen !== "") {
var date = moment(sendWhen, 'MMMM D YYYY H:m:s');
sendInformationCache[studyinstanceuid] = { 'status': 'transferred', 'pGUID': sendAsGUID, 'date': date, 'filename': sendWhat, 'event': sendEvent };
renderResult(studyinstanceuid);
}
};
})(studyinstanceuid) );
}
});
})(studyinstanceuid);
} else {
// if we have an entry already show it
renderResult(studyinstanceuid);
}
}
});
}
var subjectData = [];
var scrollTimer, lastScrollFireTime = 0; // for handling the scroll event (throdle)
function loadSubjects() {
//
// hidepattern
//
console.log("loadSubjects");
jQuery('#list-of-subjects').find('.data').remove();
jQuery('#view-name').text('Subjects');
// PCGC
jQuery.getJSON('/php/subjects.php', {'project': projname }, function(data) {
// we should re-sort the participants list and have them first sorted by most recent and secondly by name
// use the initial sorting order for the participant names
// color the fields that belong together
var lightTag = false;
for (var i = data.length-1; i > 0; i--) {
lightTag = !lightTag;
var name1 = data[i].PatientName;
var name2 = data[i].PatientID;
data[i].lightTag = (lightTag?"1":"0");
if ((name1+name2).toLowerCase().indexOf('phantom') > -1 || (name1+name2).toLowerCase().indexOf('geservice') > -1 ||
(name1+name2).toLowerCase().indexOf('technical') > -1 ||
(name1+name2).toLowerCase().indexOf('qa') > -1 || (name1+name2).toLowerCase().indexOf('test') > -1)
continue; // don't resort Phantom scans
// get the indices for the same participant and add them here
var count = 0;
for (var j = i-1; j >= 0; j--) {
if ((data[j].PatientName.length > 0 && data[j].PatientName == name1) || (data[j].PatientID.length > 0 && data[j].PatientID == name2)) {
var tmp = data.splice(j,1);
tmp[0].lightTag = (lightTag?"1":"0");
data.splice(i-1, 0, tmp[0]);
count++;
}
}
i = i - count;
}