annotate OrthancServer/OrthancExplorer/explorer.js @ 4831:7053502fbf97

added copyright UCLouvain
author Sebastien Jodogne <s.jodogne@gmail.com>
date Thu, 25 Nov 2021 19:01:11 +0100
parents ae643f664628
children 2e71a08eea15 b3d0a3a4d890
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
4122
4bb7522a63e0 do not enforce openssl exception in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4044
diff changeset
1 /**
4bb7522a63e0 do not enforce openssl exception in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4044
diff changeset
2 * Orthanc - A Lightweight, RESTful DICOM Store
4bb7522a63e0 do not enforce openssl exception in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4044
diff changeset
3 * Copyright (C) 2012-2016 Sebastien Jodogne, Medical Physics
4bb7522a63e0 do not enforce openssl exception in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4044
diff changeset
4 * Department, University Hospital of Liege, Belgium
4437
d9473bd5ed43 upgrade to year 2021
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4122
diff changeset
5 * Copyright (C) 2017-2021 Osimis S.A., Belgium
4831
7053502fbf97 added copyright UCLouvain
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4804
diff changeset
6 * Copyright (C) 2021-2021 Sebastien Jodogne, ICTEAM UCLouvain, Belgium
4122
4bb7522a63e0 do not enforce openssl exception in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4044
diff changeset
7 *
4bb7522a63e0 do not enforce openssl exception in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4044
diff changeset
8 * This program is free software: you can redistribute it and/or
4bb7522a63e0 do not enforce openssl exception in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4044
diff changeset
9 * modify it under the terms of the GNU General Public License as
4bb7522a63e0 do not enforce openssl exception in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4044
diff changeset
10 * published by the Free Software Foundation, either version 3 of the
4bb7522a63e0 do not enforce openssl exception in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4044
diff changeset
11 * License, or (at your option) any later version.
4bb7522a63e0 do not enforce openssl exception in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4044
diff changeset
12 *
4bb7522a63e0 do not enforce openssl exception in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4044
diff changeset
13 * In addition, as a special exception, the copyright holders of this
4bb7522a63e0 do not enforce openssl exception in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4044
diff changeset
14 * program give permission to link the code of its release with the
4bb7522a63e0 do not enforce openssl exception in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4044
diff changeset
15 * OpenSSL project's "OpenSSL" library (or with modified versions of it
4bb7522a63e0 do not enforce openssl exception in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4044
diff changeset
16 * that use the same license as the "OpenSSL" library), and distribute
4bb7522a63e0 do not enforce openssl exception in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4044
diff changeset
17 * the linked executables. You must obey the GNU General Public License
4bb7522a63e0 do not enforce openssl exception in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4044
diff changeset
18 * in all respects for all of the code used other than "OpenSSL". If you
4bb7522a63e0 do not enforce openssl exception in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4044
diff changeset
19 * modify file(s) with this exception, you may extend this exception to
4bb7522a63e0 do not enforce openssl exception in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4044
diff changeset
20 * your version of the file(s), but you are not obligated to do so. If
4bb7522a63e0 do not enforce openssl exception in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4044
diff changeset
21 * you do not wish to do so, delete this exception statement from your
4bb7522a63e0 do not enforce openssl exception in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4044
diff changeset
22 * version. If you delete this exception statement from all source files
4bb7522a63e0 do not enforce openssl exception in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4044
diff changeset
23 * in the program, then also delete it here.
4bb7522a63e0 do not enforce openssl exception in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4044
diff changeset
24 *
4bb7522a63e0 do not enforce openssl exception in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4044
diff changeset
25 * This program is distributed in the hope that it will be useful, but
4bb7522a63e0 do not enforce openssl exception in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4044
diff changeset
26 * WITHOUT ANY WARRANTY; without even the implied warranty of
4bb7522a63e0 do not enforce openssl exception in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4044
diff changeset
27 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
4bb7522a63e0 do not enforce openssl exception in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4044
diff changeset
28 * General Public License for more details.
4bb7522a63e0 do not enforce openssl exception in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4044
diff changeset
29 *
4bb7522a63e0 do not enforce openssl exception in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4044
diff changeset
30 * You should have received a copy of the GNU General Public License
4bb7522a63e0 do not enforce openssl exception in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4044
diff changeset
31 * along with this program. If not, see <http://www.gnu.org/licenses/>.
4bb7522a63e0 do not enforce openssl exception in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4044
diff changeset
32 **/
4bb7522a63e0 do not enforce openssl exception in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4044
diff changeset
33
4bb7522a63e0 do not enforce openssl exception in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4044
diff changeset
34
0
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
35 // http://stackoverflow.com/questions/1663741/is-there-a-good-jquery-drag-and-drop-file-upload-plugin
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
36
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
37
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
38 // Forbid the access to IE
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
39 if ($.browser.msie)
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
40 {
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
41 alert("Please use Mozilla Firefox or Google Chrome. Microsoft Internet Explorer is not supported.");
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
42 }
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
43
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
44 // http://jquerymobile.com/demos/1.1.0/docs/api/globalconfig.html
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
45 //$.mobile.ajaxEnabled = false;
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
46 //$.mobile.page.prototype.options.addBackBtn = true;
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
47 //$.mobile.defaultPageTransition = 'slide';
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
48
482
b05eb8708aee fix history in Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 443
diff changeset
49
2873
703d1e848907 Orthanc Explorer: Lookup and limit the results to 100 patients/studies
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2647
diff changeset
50 var LIMIT_RESOURCES = 100;
703d1e848907 Orthanc Explorer: Lookup and limit the results to 100 patients/studies
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2647
diff changeset
51
482
b05eb8708aee fix history in Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 443
diff changeset
52 var currentPage = '';
b05eb8708aee fix history in Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 443
diff changeset
53 var currentUuid = '';
b05eb8708aee fix history in Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 443
diff changeset
54
4697
569d9ef165b1 Added "short", "simplify" and/or "full" options to control the format of DICOM tags wherever possible
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4525
diff changeset
55 var ACQUISITION_NUMBER = '0020,0012';
569d9ef165b1 Added "short", "simplify" and/or "full" options to control the format of DICOM tags wherever possible
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4525
diff changeset
56 var IMAGES_IN_ACQUISITION = '0020,1002';
569d9ef165b1 Added "short", "simplify" and/or "full" options to control the format of DICOM tags wherever possible
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4525
diff changeset
57 var IMAGE_ORIENTATION_PATIENT = '0020,0037';
569d9ef165b1 Added "short", "simplify" and/or "full" options to control the format of DICOM tags wherever possible
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4525
diff changeset
58 var IMAGE_POSITION_PATIENT = '0020,0032';
569d9ef165b1 Added "short", "simplify" and/or "full" options to control the format of DICOM tags wherever possible
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4525
diff changeset
59 var INSTANCE_CREATION_DATE = '0008,0012';
569d9ef165b1 Added "short", "simplify" and/or "full" options to control the format of DICOM tags wherever possible
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4525
diff changeset
60 var INSTANCE_CREATION_TIME = '0008,0013';
569d9ef165b1 Added "short", "simplify" and/or "full" options to control the format of DICOM tags wherever possible
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4525
diff changeset
61 var INSTANCE_NUMBER = '0020,0013';
569d9ef165b1 Added "short", "simplify" and/or "full" options to control the format of DICOM tags wherever possible
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4525
diff changeset
62 var MANUFACTURER = '0008,0070';
569d9ef165b1 Added "short", "simplify" and/or "full" options to control the format of DICOM tags wherever possible
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4525
diff changeset
63 var OTHER_PATIENT_IDS = '0010,1000';
569d9ef165b1 Added "short", "simplify" and/or "full" options to control the format of DICOM tags wherever possible
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4525
diff changeset
64 var PATIENT_BIRTH_DATE = '0010,0030';
569d9ef165b1 Added "short", "simplify" and/or "full" options to control the format of DICOM tags wherever possible
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4525
diff changeset
65 var PATIENT_NAME = '0010,0010';
569d9ef165b1 Added "short", "simplify" and/or "full" options to control the format of DICOM tags wherever possible
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4525
diff changeset
66 var SERIES_DATE = '0008,0021';
569d9ef165b1 Added "short", "simplify" and/or "full" options to control the format of DICOM tags wherever possible
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4525
diff changeset
67 var SERIES_DESCRIPTION = '0008,103e';
569d9ef165b1 Added "short", "simplify" and/or "full" options to control the format of DICOM tags wherever possible
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4525
diff changeset
68 var SERIES_INSTANCE_UID = '0020,000e';
569d9ef165b1 Added "short", "simplify" and/or "full" options to control the format of DICOM tags wherever possible
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4525
diff changeset
69 var SERIES_TIME = '0008,0031';
569d9ef165b1 Added "short", "simplify" and/or "full" options to control the format of DICOM tags wherever possible
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4525
diff changeset
70 var SOP_INSTANCE_UID = '0008,0018';
569d9ef165b1 Added "short", "simplify" and/or "full" options to control the format of DICOM tags wherever possible
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4525
diff changeset
71 var STUDY_DATE = '0008,0020';
569d9ef165b1 Added "short", "simplify" and/or "full" options to control the format of DICOM tags wherever possible
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4525
diff changeset
72 var STUDY_DESCRIPTION = '0008,1030';
569d9ef165b1 Added "short", "simplify" and/or "full" options to control the format of DICOM tags wherever possible
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4525
diff changeset
73 var STUDY_INSTANCE_UID = '0020,000d';
569d9ef165b1 Added "short", "simplify" and/or "full" options to control the format of DICOM tags wherever possible
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4525
diff changeset
74 var STUDY_TIME = '0008,0030';
569d9ef165b1 Added "short", "simplify" and/or "full" options to control the format of DICOM tags wherever possible
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4525
diff changeset
75
569d9ef165b1 Added "short", "simplify" and/or "full" options to control the format of DICOM tags wherever possible
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4525
diff changeset
76 var ANONYMIZED_FROM = 'AnonymizedFrom';
569d9ef165b1 Added "short", "simplify" and/or "full" options to control the format of DICOM tags wherever possible
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4525
diff changeset
77 var MODIFIED_FROM = 'ModifiedFrom';
569d9ef165b1 Added "short", "simplify" and/or "full" options to control the format of DICOM tags wherever possible
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4525
diff changeset
78
482
b05eb8708aee fix history in Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 443
diff changeset
79
2119
e0517f25919e Improved robustness of Orthanc Explorer wrt. query/retrieve (maybe fix issue 24)
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1732
diff changeset
80 function DeepCopy(obj)
e0517f25919e Improved robustness of Orthanc Explorer wrt. query/retrieve (maybe fix issue 24)
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1732
diff changeset
81 {
e0517f25919e Improved robustness of Orthanc Explorer wrt. query/retrieve (maybe fix issue 24)
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1732
diff changeset
82 return jQuery.extend(true, {}, obj);
e0517f25919e Improved robustness of Orthanc Explorer wrt. query/retrieve (maybe fix issue 24)
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1732
diff changeset
83 }
e0517f25919e Improved robustness of Orthanc Explorer wrt. query/retrieve (maybe fix issue 24)
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1732
diff changeset
84
e0517f25919e Improved robustness of Orthanc Explorer wrt. query/retrieve (maybe fix issue 24)
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1732
diff changeset
85
e0517f25919e Improved robustness of Orthanc Explorer wrt. query/retrieve (maybe fix issue 24)
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1732
diff changeset
86 function ChangePage(page, options)
e0517f25919e Improved robustness of Orthanc Explorer wrt. query/retrieve (maybe fix issue 24)
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1732
diff changeset
87 {
3103
81b58b549845 back to using 'var' instead of 'let' since let is not supported by many old browsers. All variables declaration have been moved to the top of the function to better show that their scope is the function
Alain Mazy <alain@mazy.be>
parents: 3065
diff changeset
88 var first = true;
81b58b549845 back to using 'var' instead of 'let' since let is not supported by many old browsers. All variables declaration have been moved to the top of the function to better show that their scope is the function
Alain Mazy <alain@mazy.be>
parents: 3065
diff changeset
89 var value;
81b58b549845 back to using 'var' instead of 'let' since let is not supported by many old browsers. All variables declaration have been moved to the top of the function to better show that their scope is the function
Alain Mazy <alain@mazy.be>
parents: 3065
diff changeset
90
2119
e0517f25919e Improved robustness of Orthanc Explorer wrt. query/retrieve (maybe fix issue 24)
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1732
diff changeset
91 if (options) {
3103
81b58b549845 back to using 'var' instead of 'let' since let is not supported by many old browsers. All variables declaration have been moved to the top of the function to better show that their scope is the function
Alain Mazy <alain@mazy.be>
parents: 3065
diff changeset
92 for (var key in options) {
81b58b549845 back to using 'var' instead of 'let' since let is not supported by many old browsers. All variables declaration have been moved to the top of the function to better show that their scope is the function
Alain Mazy <alain@mazy.be>
parents: 3065
diff changeset
93 value = options[key];
2119
e0517f25919e Improved robustness of Orthanc Explorer wrt. query/retrieve (maybe fix issue 24)
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1732
diff changeset
94 if (first) {
e0517f25919e Improved robustness of Orthanc Explorer wrt. query/retrieve (maybe fix issue 24)
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1732
diff changeset
95 page += '?';
e0517f25919e Improved robustness of Orthanc Explorer wrt. query/retrieve (maybe fix issue 24)
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1732
diff changeset
96 first = false;
e0517f25919e Improved robustness of Orthanc Explorer wrt. query/retrieve (maybe fix issue 24)
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1732
diff changeset
97 } else {
e0517f25919e Improved robustness of Orthanc Explorer wrt. query/retrieve (maybe fix issue 24)
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1732
diff changeset
98 page += '&';
e0517f25919e Improved robustness of Orthanc Explorer wrt. query/retrieve (maybe fix issue 24)
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1732
diff changeset
99 }
e0517f25919e Improved robustness of Orthanc Explorer wrt. query/retrieve (maybe fix issue 24)
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1732
diff changeset
100
e0517f25919e Improved robustness of Orthanc Explorer wrt. query/retrieve (maybe fix issue 24)
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1732
diff changeset
101 page += key + '=' + value;
e0517f25919e Improved robustness of Orthanc Explorer wrt. query/retrieve (maybe fix issue 24)
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1732
diff changeset
102 }
e0517f25919e Improved robustness of Orthanc Explorer wrt. query/retrieve (maybe fix issue 24)
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1732
diff changeset
103 }
e0517f25919e Improved robustness of Orthanc Explorer wrt. query/retrieve (maybe fix issue 24)
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1732
diff changeset
104
e0517f25919e Improved robustness of Orthanc Explorer wrt. query/retrieve (maybe fix issue 24)
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1732
diff changeset
105 window.location.replace('explorer.html#' + page);
e0517f25919e Improved robustness of Orthanc Explorer wrt. query/retrieve (maybe fix issue 24)
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1732
diff changeset
106 /*$.mobile.changePage('#' + page, {
e0517f25919e Improved robustness of Orthanc Explorer wrt. query/retrieve (maybe fix issue 24)
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1732
diff changeset
107 changeHash: true
e0517f25919e Improved robustness of Orthanc Explorer wrt. query/retrieve (maybe fix issue 24)
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1732
diff changeset
108 });*/
e0517f25919e Improved robustness of Orthanc Explorer wrt. query/retrieve (maybe fix issue 24)
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1732
diff changeset
109 }
e0517f25919e Improved robustness of Orthanc Explorer wrt. query/retrieve (maybe fix issue 24)
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1732
diff changeset
110
e0517f25919e Improved robustness of Orthanc Explorer wrt. query/retrieve (maybe fix issue 24)
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1732
diff changeset
111
1556
b8dc2f855a83 Preview of PDF files encapsulated in DICOM from Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1345
diff changeset
112 function Refresh()
b8dc2f855a83 Preview of PDF files encapsulated in DICOM from Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1345
diff changeset
113 {
b8dc2f855a83 Preview of PDF files encapsulated in DICOM from Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1345
diff changeset
114 if (currentPage == 'patient')
b8dc2f855a83 Preview of PDF files encapsulated in DICOM from Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1345
diff changeset
115 RefreshPatient();
b8dc2f855a83 Preview of PDF files encapsulated in DICOM from Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1345
diff changeset
116 else if (currentPage == 'study')
b8dc2f855a83 Preview of PDF files encapsulated in DICOM from Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1345
diff changeset
117 RefreshStudy();
b8dc2f855a83 Preview of PDF files encapsulated in DICOM from Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1345
diff changeset
118 else if (currentPage == 'series')
b8dc2f855a83 Preview of PDF files encapsulated in DICOM from Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1345
diff changeset
119 RefreshSeries();
b8dc2f855a83 Preview of PDF files encapsulated in DICOM from Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1345
diff changeset
120 else if (currentPage == 'instance')
b8dc2f855a83 Preview of PDF files encapsulated in DICOM from Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1345
diff changeset
121 RefreshInstance();
b8dc2f855a83 Preview of PDF files encapsulated in DICOM from Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1345
diff changeset
122 }
b8dc2f855a83 Preview of PDF files encapsulated in DICOM from Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1345
diff changeset
123
b8dc2f855a83 Preview of PDF files encapsulated in DICOM from Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1345
diff changeset
124
0
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
125 $(document).ready(function() {
4461
22abc6851191 The DICOM meta-header and the transfer syntax are displayed at the "Instance" level
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4437
diff changeset
126 var trees = [ '#dicom-tree', '#dicom-metaheader' ];
0
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
127
4461
22abc6851191 The DICOM meta-header and the transfer syntax are displayed at the "Instance" level
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4437
diff changeset
128 for (var i = 0; i < trees.length; i++) {
22abc6851191 The DICOM meta-header and the transfer syntax are displayed at the "Instance" level
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4437
diff changeset
129 $(trees[i]).tree({
22abc6851191 The DICOM meta-header and the transfer syntax are displayed at the "Instance" level
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4437
diff changeset
130 autoEscape: false
22abc6851191 The DICOM meta-header and the transfer syntax are displayed at the "Instance" level
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4437
diff changeset
131 });
22abc6851191 The DICOM meta-header and the transfer syntax are displayed at the "Instance" level
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4437
diff changeset
132
22abc6851191 The DICOM meta-header and the transfer syntax are displayed at the "Instance" level
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4437
diff changeset
133 $(trees[i]).bind(
22abc6851191 The DICOM meta-header and the transfer syntax are displayed at the "Instance" level
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4437
diff changeset
134 'tree.click',
22abc6851191 The DICOM meta-header and the transfer syntax are displayed at the "Instance" level
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4437
diff changeset
135 function(event) {
22abc6851191 The DICOM meta-header and the transfer syntax are displayed at the "Instance" level
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4437
diff changeset
136 if (event.node.is_open)
22abc6851191 The DICOM meta-header and the transfer syntax are displayed at the "Instance" level
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4437
diff changeset
137 $(trees[i]).tree('closeNode', event.node, true);
22abc6851191 The DICOM meta-header and the transfer syntax are displayed at the "Instance" level
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4437
diff changeset
138 else
22abc6851191 The DICOM meta-header and the transfer syntax are displayed at the "Instance" level
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4437
diff changeset
139 $(trees[i]).tree('openNode', event.node, true);
22abc6851191 The DICOM meta-header and the transfer syntax are displayed at the "Instance" level
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4437
diff changeset
140 }
22abc6851191 The DICOM meta-header and the transfer syntax are displayed at the "Instance" level
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4437
diff changeset
141 );
22abc6851191 The DICOM meta-header and the transfer syntax are displayed at the "Instance" level
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4437
diff changeset
142 }
3533
2090ec6a83a5 create a default user if none is provided, while issuing a warning in Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3510
diff changeset
143
2090ec6a83a5 create a default user if none is provided, while issuing a warning in Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3510
diff changeset
144 // Inject the template of the warning about insecure setup as the
2090ec6a83a5 create a default user if none is provided, while issuing a warning in Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3510
diff changeset
145 // first child of each page
2090ec6a83a5 create a default user if none is provided, while issuing a warning in Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3510
diff changeset
146 var insecure = $('#template-insecure').html();
2090ec6a83a5 create a default user if none is provided, while issuing a warning in Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3510
diff changeset
147 $('[data-role="page"]>[data-role="content"]').prepend(insecure);
1556
b8dc2f855a83 Preview of PDF files encapsulated in DICOM from Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1345
diff changeset
148
b8dc2f855a83 Preview of PDF files encapsulated in DICOM from Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1345
diff changeset
149 currentPage = $.mobile.pageData.active;
b8dc2f855a83 Preview of PDF files encapsulated in DICOM from Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1345
diff changeset
150 currentUuid = $.mobile.pageData.uuid;
1591
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1556
diff changeset
151 if (!(typeof currentPage === 'undefined') &&
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1556
diff changeset
152 !(typeof currentUuid === 'undefined') &&
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1556
diff changeset
153 currentPage.length > 0 &&
1556
b8dc2f855a83 Preview of PDF files encapsulated in DICOM from Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1345
diff changeset
154 currentUuid.length > 0)
b8dc2f855a83 Preview of PDF files encapsulated in DICOM from Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1345
diff changeset
155 {
b8dc2f855a83 Preview of PDF files encapsulated in DICOM from Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1345
diff changeset
156 Refresh();
b8dc2f855a83 Preview of PDF files encapsulated in DICOM from Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1345
diff changeset
157 }
0
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
158 });
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
159
3510
1a65beb5e52f allow only 'token', 'auth-token' and 'authorization' as url params that are included in HTTP headers
Alain Mazy <alain@mazy.be>
parents: 3509
diff changeset
160 function GetAuthorizationTokensFromUrl() {
3509
5405d51e040d Orthanc Explorer: include the url search params into HTTP headers to the Rest API to ease usage of the Authorization plugin
Alain Mazy <alain@mazy.be>
parents: 3321
diff changeset
161 var urlVariables = window.location.search.substring(1).split('&');
5405d51e040d Orthanc Explorer: include the url search params into HTTP headers to the Rest API to ease usage of the Authorization plugin
Alain Mazy <alain@mazy.be>
parents: 3321
diff changeset
162 var dict = {};
5405d51e040d Orthanc Explorer: include the url search params into HTTP headers to the Rest API to ease usage of the Authorization plugin
Alain Mazy <alain@mazy.be>
parents: 3321
diff changeset
163
5405d51e040d Orthanc Explorer: include the url search params into HTTP headers to the Rest API to ease usage of the Authorization plugin
Alain Mazy <alain@mazy.be>
parents: 3321
diff changeset
164 for (var i = 0; i < urlVariables.length; i++) {
5405d51e040d Orthanc Explorer: include the url search params into HTTP headers to the Rest API to ease usage of the Authorization plugin
Alain Mazy <alain@mazy.be>
parents: 3321
diff changeset
165 var split = urlVariables[i].split('=');
5405d51e040d Orthanc Explorer: include the url search params into HTTP headers to the Rest API to ease usage of the Authorization plugin
Alain Mazy <alain@mazy.be>
parents: 3321
diff changeset
166
3510
1a65beb5e52f allow only 'token', 'auth-token' and 'authorization' as url params that are included in HTTP headers
Alain Mazy <alain@mazy.be>
parents: 3509
diff changeset
167 if (split.length == 2 && (split[0] == "token" || split[0] == "auth-token" || split[0] == "authorization")) {
3509
5405d51e040d Orthanc Explorer: include the url search params into HTTP headers to the Rest API to ease usage of the Authorization plugin
Alain Mazy <alain@mazy.be>
parents: 3321
diff changeset
168 dict[split[0]] = split[1];
5405d51e040d Orthanc Explorer: include the url search params into HTTP headers to the Rest API to ease usage of the Authorization plugin
Alain Mazy <alain@mazy.be>
parents: 3321
diff changeset
169 }
5405d51e040d Orthanc Explorer: include the url search params into HTTP headers to the Rest API to ease usage of the Authorization plugin
Alain Mazy <alain@mazy.be>
parents: 3321
diff changeset
170 }
5405d51e040d Orthanc Explorer: include the url search params into HTTP headers to the Rest API to ease usage of the Authorization plugin
Alain Mazy <alain@mazy.be>
parents: 3321
diff changeset
171 return dict;
5405d51e040d Orthanc Explorer: include the url search params into HTTP headers to the Rest API to ease usage of the Authorization plugin
Alain Mazy <alain@mazy.be>
parents: 3321
diff changeset
172 };
5405d51e040d Orthanc Explorer: include the url search params into HTTP headers to the Rest API to ease usage of the Authorization plugin
Alain Mazy <alain@mazy.be>
parents: 3321
diff changeset
173
3510
1a65beb5e52f allow only 'token', 'auth-token' and 'authorization' as url params that are included in HTTP headers
Alain Mazy <alain@mazy.be>
parents: 3509
diff changeset
174 var authorizationTokens = GetAuthorizationTokensFromUrl();
3509
5405d51e040d Orthanc Explorer: include the url search params into HTTP headers to the Rest API to ease usage of the Authorization plugin
Alain Mazy <alain@mazy.be>
parents: 3321
diff changeset
175
3510
1a65beb5e52f allow only 'token', 'auth-token' and 'authorization' as url params that are included in HTTP headers
Alain Mazy <alain@mazy.be>
parents: 3509
diff changeset
176 /* Copy the authoziation toekn from the url search parameters into HTTP headers in every request to the Rest API.
3509
5405d51e040d Orthanc Explorer: include the url search params into HTTP headers to the Rest API to ease usage of the Authorization plugin
Alain Mazy <alain@mazy.be>
parents: 3321
diff changeset
177 Thanks to this behaviour, you may specify a ?token=xxx in your url and this will be passed
5405d51e040d Orthanc Explorer: include the url search params into HTTP headers to the Rest API to ease usage of the Authorization plugin
Alain Mazy <alain@mazy.be>
parents: 3321
diff changeset
178 as the "token" header in every request to the API allowing you to use the authorization plugin */
5405d51e040d Orthanc Explorer: include the url search params into HTTP headers to the Rest API to ease usage of the Authorization plugin
Alain Mazy <alain@mazy.be>
parents: 3321
diff changeset
179 $.ajaxSetup(
5405d51e040d Orthanc Explorer: include the url search params into HTTP headers to the Rest API to ease usage of the Authorization plugin
Alain Mazy <alain@mazy.be>
parents: 3321
diff changeset
180 {
3510
1a65beb5e52f allow only 'token', 'auth-token' and 'authorization' as url params that are included in HTTP headers
Alain Mazy <alain@mazy.be>
parents: 3509
diff changeset
181 headers : authorizationTokens
3509
5405d51e040d Orthanc Explorer: include the url search params into HTTP headers to the Rest API to ease usage of the Authorization plugin
Alain Mazy <alain@mazy.be>
parents: 3321
diff changeset
182 }
5405d51e040d Orthanc Explorer: include the url search params into HTTP headers to the Rest API to ease usage of the Authorization plugin
Alain Mazy <alain@mazy.be>
parents: 3321
diff changeset
183 );
5405d51e040d Orthanc Explorer: include the url search params into HTTP headers to the Rest API to ease usage of the Authorization plugin
Alain Mazy <alain@mazy.be>
parents: 3321
diff changeset
184
0
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
185
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
186 function ParseDicomDate(s)
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
187 {
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
188 y = parseInt(s.substr(0, 4), 10);
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
189 m = parseInt(s.substr(4, 2), 10) - 1;
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
190 d = parseInt(s.substr(6, 2), 10);
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
191
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
192 if (y == null || m == null || d == null ||
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
193 !isFinite(y) || !isFinite(m) || !isFinite(d))
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
194 {
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
195 return null;
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
196 }
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
197
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
198 if (y < 1900 || y > 2100 ||
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
199 m < 0 || m >= 12 ||
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
200 d <= 0 || d >= 32)
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
201 {
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
202 return null;
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
203 }
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
204
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
205 return new Date(y, m, d);
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
206 }
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
207
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
208
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
209 function FormatDicomDate(s)
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
210 {
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
211 if (s == undefined)
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
212 return "No date";
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
213
3103
81b58b549845 back to using 'var' instead of 'let' since let is not supported by many old browsers. All variables declaration have been moved to the top of the function to better show that their scope is the function
Alain Mazy <alain@mazy.be>
parents: 3065
diff changeset
214 var d = ParseDicomDate(s);
0
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
215 if (d == null)
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
216 return '?';
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
217 else
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
218 return d.toString('dddd, MMMM d, yyyy');
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
219 }
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
220
3576
35b4d56664a6 Explorer: display ImagePositionPatient (only ImageOrientationPatient was displayed) + format it to make it more readable
Alain Mazy <alain@mazy.be>
parents: 3534
diff changeset
221 function FormatFloatSequence(s)
35b4d56664a6 Explorer: display ImagePositionPatient (only ImageOrientationPatient was displayed) + format it to make it more readable
Alain Mazy <alain@mazy.be>
parents: 3534
diff changeset
222 {
35b4d56664a6 Explorer: display ImagePositionPatient (only ImageOrientationPatient was displayed) + format it to make it more readable
Alain Mazy <alain@mazy.be>
parents: 3534
diff changeset
223 if (s == undefined || s.length == 0)
35b4d56664a6 Explorer: display ImagePositionPatient (only ImageOrientationPatient was displayed) + format it to make it more readable
Alain Mazy <alain@mazy.be>
parents: 3534
diff changeset
224 return "-";
35b4d56664a6 Explorer: display ImagePositionPatient (only ImageOrientationPatient was displayed) + format it to make it more readable
Alain Mazy <alain@mazy.be>
parents: 3534
diff changeset
225
35b4d56664a6 Explorer: display ImagePositionPatient (only ImageOrientationPatient was displayed) + format it to make it more readable
Alain Mazy <alain@mazy.be>
parents: 3534
diff changeset
226 if (s.indexOf("\\") == -1)
35b4d56664a6 Explorer: display ImagePositionPatient (only ImageOrientationPatient was displayed) + format it to make it more readable
Alain Mazy <alain@mazy.be>
parents: 3534
diff changeset
227 return s;
35b4d56664a6 Explorer: display ImagePositionPatient (only ImageOrientationPatient was displayed) + format it to make it more readable
Alain Mazy <alain@mazy.be>
parents: 3534
diff changeset
228
35b4d56664a6 Explorer: display ImagePositionPatient (only ImageOrientationPatient was displayed) + format it to make it more readable
Alain Mazy <alain@mazy.be>
parents: 3534
diff changeset
229 var oldValues = s.split("\\");
35b4d56664a6 Explorer: display ImagePositionPatient (only ImageOrientationPatient was displayed) + format it to make it more readable
Alain Mazy <alain@mazy.be>
parents: 3534
diff changeset
230 var newValues = [];
35b4d56664a6 Explorer: display ImagePositionPatient (only ImageOrientationPatient was displayed) + format it to make it more readable
Alain Mazy <alain@mazy.be>
parents: 3534
diff changeset
231 for (var i = 0; i < oldValues.length; i++)
35b4d56664a6 Explorer: display ImagePositionPatient (only ImageOrientationPatient was displayed) + format it to make it more readable
Alain Mazy <alain@mazy.be>
parents: 3534
diff changeset
232 {
35b4d56664a6 Explorer: display ImagePositionPatient (only ImageOrientationPatient was displayed) + format it to make it more readable
Alain Mazy <alain@mazy.be>
parents: 3534
diff changeset
233 newValues.push(parseFloat(oldValues[i]).toFixed(3));
35b4d56664a6 Explorer: display ImagePositionPatient (only ImageOrientationPatient was displayed) + format it to make it more readable
Alain Mazy <alain@mazy.be>
parents: 3534
diff changeset
234 }
35b4d56664a6 Explorer: display ImagePositionPatient (only ImageOrientationPatient was displayed) + format it to make it more readable
Alain Mazy <alain@mazy.be>
parents: 3534
diff changeset
235 return newValues.join("\\");
35b4d56664a6 Explorer: display ImagePositionPatient (only ImageOrientationPatient was displayed) + format it to make it more readable
Alain Mazy <alain@mazy.be>
parents: 3534
diff changeset
236 }
0
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
237
80
6212bf978584 status of series
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 57
diff changeset
238 function Sort(arr, fieldExtractor, isInteger, reverse)
0
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
239 {
3103
81b58b549845 back to using 'var' instead of 'let' since let is not supported by many old browsers. All variables declaration have been moved to the top of the function to better show that their scope is the function
Alain Mazy <alain@mazy.be>
parents: 3065
diff changeset
240 var defaultValue;
33
de56f3951fad fix sort
jodogne
parents: 0
diff changeset
241 if (isInteger)
de56f3951fad fix sort
jodogne
parents: 0
diff changeset
242 defaultValue = 0;
de56f3951fad fix sort
jodogne
parents: 0
diff changeset
243 else
de56f3951fad fix sort
jodogne
parents: 0
diff changeset
244 defaultValue = '';
de56f3951fad fix sort
jodogne
parents: 0
diff changeset
245
0
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
246 arr.sort(function(a, b) {
3103
81b58b549845 back to using 'var' instead of 'let' since let is not supported by many old browsers. All variables declaration have been moved to the top of the function to better show that their scope is the function
Alain Mazy <alain@mazy.be>
parents: 3065
diff changeset
247 var ta = fieldExtractor(a);
81b58b549845 back to using 'var' instead of 'let' since let is not supported by many old browsers. All variables declaration have been moved to the top of the function to better show that their scope is the function
Alain Mazy <alain@mazy.be>
parents: 3065
diff changeset
248 var tb = fieldExtractor(b);
81b58b549845 back to using 'var' instead of 'let' since let is not supported by many old browsers. All variables declaration have been moved to the top of the function to better show that their scope is the function
Alain Mazy <alain@mazy.be>
parents: 3065
diff changeset
249 var order;
0
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
250
33
de56f3951fad fix sort
jodogne
parents: 0
diff changeset
251 if (ta == undefined)
de56f3951fad fix sort
jodogne
parents: 0
diff changeset
252 ta = defaultValue;
de56f3951fad fix sort
jodogne
parents: 0
diff changeset
253
de56f3951fad fix sort
jodogne
parents: 0
diff changeset
254 if (tb == undefined)
de56f3951fad fix sort
jodogne
parents: 0
diff changeset
255 tb = defaultValue;
de56f3951fad fix sort
jodogne
parents: 0
diff changeset
256
0
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
257 if (isInteger)
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
258 {
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
259 ta = parseInt(ta, 10);
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
260 tb = parseInt(tb, 10);
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
261 order = ta - tb;
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
262 }
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
263 else
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
264 {
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
265 if (ta < tb)
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
266 order = -1;
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
267 else if (ta > tb)
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
268 order = 1;
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
269 else
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
270 order = 0;
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
271 }
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
272
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
273 if (reverse)
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
274 return -order;
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
275 else
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
276 return order;
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
277 });
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
278 }
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
279
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
280
4697
569d9ef165b1 Added "short", "simplify" and/or "full" options to control the format of DICOM tags wherever possible
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4525
diff changeset
281 function GetMainDicomTag(mainDicomTags, tag)
569d9ef165b1 Added "short", "simplify" and/or "full" options to control the format of DICOM tags wherever possible
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4525
diff changeset
282 {
569d9ef165b1 Added "short", "simplify" and/or "full" options to control the format of DICOM tags wherever possible
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4525
diff changeset
283 if (tag in mainDicomTags) {
569d9ef165b1 Added "short", "simplify" and/or "full" options to control the format of DICOM tags wherever possible
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4525
diff changeset
284 return mainDicomTags[tag].Value;
569d9ef165b1 Added "short", "simplify" and/or "full" options to control the format of DICOM tags wherever possible
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4525
diff changeset
285 } else {
569d9ef165b1 Added "short", "simplify" and/or "full" options to control the format of DICOM tags wherever possible
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4525
diff changeset
286 return '';
569d9ef165b1 Added "short", "simplify" and/or "full" options to control the format of DICOM tags wherever possible
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4525
diff changeset
287 }
569d9ef165b1 Added "short", "simplify" and/or "full" options to control the format of DICOM tags wherever possible
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4525
diff changeset
288 }
569d9ef165b1 Added "short", "simplify" and/or "full" options to control the format of DICOM tags wherever possible
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4525
diff changeset
289
569d9ef165b1 Added "short", "simplify" and/or "full" options to control the format of DICOM tags wherever possible
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4525
diff changeset
290
80
6212bf978584 status of series
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 57
diff changeset
291 function SortOnDicomTag(arr, tag, isInteger, reverse)
6212bf978584 status of series
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 57
diff changeset
292 {
6212bf978584 status of series
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 57
diff changeset
293 return Sort(arr, function(a) {
4697
569d9ef165b1 Added "short", "simplify" and/or "full" options to control the format of DICOM tags wherever possible
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4525
diff changeset
294 return GetMainDicomTag(a.MainDicomTags, tag);
80
6212bf978584 status of series
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 57
diff changeset
295 }, isInteger, reverse);
6212bf978584 status of series
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 57
diff changeset
296 }
6212bf978584 status of series
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 57
diff changeset
297
6212bf978584 status of series
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 57
diff changeset
298
0
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
299
1345
c90a4a42a3f2 simplification
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1343
diff changeset
300 function GetResource(uri, callback)
0
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
301 {
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
302 $.ajax({
1345
c90a4a42a3f2 simplification
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1343
diff changeset
303 url: '..' + uri,
0
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
304 dataType: 'json',
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
305 async: false,
344
cd6749e53a03 anonymization from orthanc explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 274
diff changeset
306 cache: false,
0
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
307 success: function(s) {
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
308 callback(s);
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
309 }
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
310 });
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
311 }
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
312
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
313
2292
ccd44d546b47 Fix XSS inside DICOM in Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2119
diff changeset
314 function CompleteFormatting(node, link, isReverse, count)
0
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
315 {
2292
ccd44d546b47 Fix XSS inside DICOM in Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2119
diff changeset
316 if (count != null)
ccd44d546b47 Fix XSS inside DICOM in Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2119
diff changeset
317 {
ccd44d546b47 Fix XSS inside DICOM in Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2119
diff changeset
318 node = node.add($('<span>')
ccd44d546b47 Fix XSS inside DICOM in Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2119
diff changeset
319 .addClass('ui-li-count')
ccd44d546b47 Fix XSS inside DICOM in Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2119
diff changeset
320 .text(count));
ccd44d546b47 Fix XSS inside DICOM in Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2119
diff changeset
321 }
ccd44d546b47 Fix XSS inside DICOM in Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2119
diff changeset
322
4697
569d9ef165b1 Added "short", "simplify" and/or "full" options to control the format of DICOM tags wherever possible
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4525
diff changeset
323 if (link != null &&
569d9ef165b1 Added "short", "simplify" and/or "full" options to control the format of DICOM tags wherever possible
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4525
diff changeset
324 link)
0
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
325 {
2292
ccd44d546b47 Fix XSS inside DICOM in Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2119
diff changeset
326 node = $('<a>').attr('href', link).append(node);
ccd44d546b47 Fix XSS inside DICOM in Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2119
diff changeset
327
0
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
328 if (isReverse)
2292
ccd44d546b47 Fix XSS inside DICOM in Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2119
diff changeset
329 node.attr('data-direction', 'reverse')
0
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
330 }
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
331
2292
ccd44d546b47 Fix XSS inside DICOM in Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2119
diff changeset
332 node = $('<li>').append(node);
ccd44d546b47 Fix XSS inside DICOM in Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2119
diff changeset
333
0
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
334 if (isReverse)
2292
ccd44d546b47 Fix XSS inside DICOM in Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2119
diff changeset
335 node.attr('data-icon', 'back');
ccd44d546b47 Fix XSS inside DICOM in Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2119
diff changeset
336
ccd44d546b47 Fix XSS inside DICOM in Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2119
diff changeset
337 return node;
0
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
338 }
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
339
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
340
2292
ccd44d546b47 Fix XSS inside DICOM in Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2119
diff changeset
341 function FormatMainDicomTags(target, tags, tagsToIgnore)
38
2cefaf5b3c2e improvements
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 36
diff changeset
342 {
3103
81b58b549845 back to using 'var' instead of 'let' since let is not supported by many old browsers. All variables declaration have been moved to the top of the function to better show that their scope is the function
Alain Mazy <alain@mazy.be>
parents: 3065
diff changeset
343 var v;
81b58b549845 back to using 'var' instead of 'let' since let is not supported by many old browsers. All variables declaration have been moved to the top of the function to better show that their scope is the function
Alain Mazy <alain@mazy.be>
parents: 3065
diff changeset
344
81b58b549845 back to using 'var' instead of 'let' since let is not supported by many old browsers. All variables declaration have been moved to the top of the function to better show that their scope is the function
Alain Mazy <alain@mazy.be>
parents: 3065
diff changeset
345 for (var i in tags)
38
2cefaf5b3c2e improvements
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 36
diff changeset
346 {
2cefaf5b3c2e improvements
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 36
diff changeset
347 if (tagsToIgnore.indexOf(i) == -1)
2cefaf5b3c2e improvements
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 36
diff changeset
348 {
4697
569d9ef165b1 Added "short", "simplify" and/or "full" options to control the format of DICOM tags wherever possible
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4525
diff changeset
349 v = GetMainDicomTag(tags, i);
38
2cefaf5b3c2e improvements
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 36
diff changeset
350
4697
569d9ef165b1 Added "short", "simplify" and/or "full" options to control the format of DICOM tags wherever possible
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4525
diff changeset
351 if (i == PATIENT_BIRTH_DATE ||
569d9ef165b1 Added "short", "simplify" and/or "full" options to control the format of DICOM tags wherever possible
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4525
diff changeset
352 i == STUDY_DATE ||
569d9ef165b1 Added "short", "simplify" and/or "full" options to control the format of DICOM tags wherever possible
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4525
diff changeset
353 i == SERIES_DATE ||
569d9ef165b1 Added "short", "simplify" and/or "full" options to control the format of DICOM tags wherever possible
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4525
diff changeset
354 i == INSTANCE_CREATION_DATE)
38
2cefaf5b3c2e improvements
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 36
diff changeset
355 {
2cefaf5b3c2e improvements
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 36
diff changeset
356 v = FormatDicomDate(v);
2cefaf5b3c2e improvements
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 36
diff changeset
357 }
4697
569d9ef165b1 Added "short", "simplify" and/or "full" options to control the format of DICOM tags wherever possible
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4525
diff changeset
358 else if (i == STUDY_INSTANCE_UID ||
569d9ef165b1 Added "short", "simplify" and/or "full" options to control the format of DICOM tags wherever possible
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4525
diff changeset
359 i == SERIES_INSTANCE_UID ||
569d9ef165b1 Added "short", "simplify" and/or "full" options to control the format of DICOM tags wherever possible
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4525
diff changeset
360 i == SOP_INSTANCE_UID)
38
2cefaf5b3c2e improvements
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 36
diff changeset
361 {
4697
569d9ef165b1 Added "short", "simplify" and/or "full" options to control the format of DICOM tags wherever possible
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4525
diff changeset
362 // Possibly split a long UID
569d9ef165b1 Added "short", "simplify" and/or "full" options to control the format of DICOM tags wherever possible
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4525
diff changeset
363 // v = '<span>' + s.substr(0, s.length / 2) + '</span><span>' + s.substr(s.length / 2, s.length - s.length / 2) + '</span>';
38
2cefaf5b3c2e improvements
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 36
diff changeset
364 }
4697
569d9ef165b1 Added "short", "simplify" and/or "full" options to control the format of DICOM tags wherever possible
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4525
diff changeset
365 else if (i == IMAGE_POSITION_PATIENT ||
569d9ef165b1 Added "short", "simplify" and/or "full" options to control the format of DICOM tags wherever possible
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4525
diff changeset
366 i == IMAGE_ORIENTATION_PATIENT)
3576
35b4d56664a6 Explorer: display ImagePositionPatient (only ImageOrientationPatient was displayed) + format it to make it more readable
Alain Mazy <alain@mazy.be>
parents: 3534
diff changeset
367 {
35b4d56664a6 Explorer: display ImagePositionPatient (only ImageOrientationPatient was displayed) + format it to make it more readable
Alain Mazy <alain@mazy.be>
parents: 3534
diff changeset
368 v = FormatFloatSequence(v);
35b4d56664a6 Explorer: display ImagePositionPatient (only ImageOrientationPatient was displayed) + format it to make it more readable
Alain Mazy <alain@mazy.be>
parents: 3534
diff changeset
369 }
38
2cefaf5b3c2e improvements
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 36
diff changeset
370
2292
ccd44d546b47 Fix XSS inside DICOM in Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2119
diff changeset
371 target.append($('<p>')
4697
569d9ef165b1 Added "short", "simplify" and/or "full" options to control the format of DICOM tags wherever possible
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4525
diff changeset
372 .text(tags[i].Name + ': ')
569d9ef165b1 Added "short", "simplify" and/or "full" options to control the format of DICOM tags wherever possible
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4525
diff changeset
373 .append($('<strong>').html(v)));
38
2cefaf5b3c2e improvements
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 36
diff changeset
374 }
2cefaf5b3c2e improvements
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 36
diff changeset
375 }
2cefaf5b3c2e improvements
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 36
diff changeset
376 }
2cefaf5b3c2e improvements
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 36
diff changeset
377
0
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
378
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
379 function FormatPatient(patient, link, isReverse)
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
380 {
4697
569d9ef165b1 Added "short", "simplify" and/or "full" options to control the format of DICOM tags wherever possible
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4525
diff changeset
381 var node = $('<div>').append($('<h3>').text(GetMainDicomTag(patient.MainDicomTags, PATIENT_NAME)));
0
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
382
2292
ccd44d546b47 Fix XSS inside DICOM in Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2119
diff changeset
383 FormatMainDicomTags(node, patient.MainDicomTags, [
4697
569d9ef165b1 Added "short", "simplify" and/or "full" options to control the format of DICOM tags wherever possible
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4525
diff changeset
384 PATIENT_NAME
569d9ef165b1 Added "short", "simplify" and/or "full" options to control the format of DICOM tags wherever possible
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4525
diff changeset
385 //, OTHER_PATIENT_IDS
2292
ccd44d546b47 Fix XSS inside DICOM in Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2119
diff changeset
386 ]);
ccd44d546b47 Fix XSS inside DICOM in Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2119
diff changeset
387
ccd44d546b47 Fix XSS inside DICOM in Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2119
diff changeset
388 return CompleteFormatting(node, link, isReverse, patient.Studies.length);
0
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
389 }
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
390
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
391
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
392
2594
7fbe3f024ac9 new screen in OrthancExplorer to list studies
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2336
diff changeset
393 function FormatStudy(study, link, isReverse, includePatient)
0
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
394 {
3103
81b58b549845 back to using 'var' instead of 'let' since let is not supported by many old browsers. All variables declaration have been moved to the top of the function to better show that their scope is the function
Alain Mazy <alain@mazy.be>
parents: 3065
diff changeset
395 var label;
81b58b549845 back to using 'var' instead of 'let' since let is not supported by many old browsers. All variables declaration have been moved to the top of the function to better show that their scope is the function
Alain Mazy <alain@mazy.be>
parents: 3065
diff changeset
396 var node;
2594
7fbe3f024ac9 new screen in OrthancExplorer to list studies
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2336
diff changeset
397
7fbe3f024ac9 new screen in OrthancExplorer to list studies
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2336
diff changeset
398 if (includePatient) {
7fbe3f024ac9 new screen in OrthancExplorer to list studies
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2336
diff changeset
399 label = study.Label;
7fbe3f024ac9 new screen in OrthancExplorer to list studies
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2336
diff changeset
400 } else {
4697
569d9ef165b1 Added "short", "simplify" and/or "full" options to control the format of DICOM tags wherever possible
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4525
diff changeset
401 label = GetMainDicomTag(study.MainDicomTags, STUDY_DESCRIPTION);
2594
7fbe3f024ac9 new screen in OrthancExplorer to list studies
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2336
diff changeset
402 }
2292
ccd44d546b47 Fix XSS inside DICOM in Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2119
diff changeset
403
3103
81b58b549845 back to using 'var' instead of 'let' since let is not supported by many old browsers. All variables declaration have been moved to the top of the function to better show that their scope is the function
Alain Mazy <alain@mazy.be>
parents: 3065
diff changeset
404 node = $('<div>').append($('<h3>').text(label));
2594
7fbe3f024ac9 new screen in OrthancExplorer to list studies
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2336
diff changeset
405
7fbe3f024ac9 new screen in OrthancExplorer to list studies
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2336
diff changeset
406 if (includePatient) {
7fbe3f024ac9 new screen in OrthancExplorer to list studies
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2336
diff changeset
407 FormatMainDicomTags(node, study.PatientMainDicomTags, [
4697
569d9ef165b1 Added "short", "simplify" and/or "full" options to control the format of DICOM tags wherever possible
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4525
diff changeset
408 PATIENT_NAME
2594
7fbe3f024ac9 new screen in OrthancExplorer to list studies
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2336
diff changeset
409 ]);
7fbe3f024ac9 new screen in OrthancExplorer to list studies
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2336
diff changeset
410 }
7fbe3f024ac9 new screen in OrthancExplorer to list studies
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2336
diff changeset
411
2292
ccd44d546b47 Fix XSS inside DICOM in Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2119
diff changeset
412 FormatMainDicomTags(node, study.MainDicomTags, [
4697
569d9ef165b1 Added "short", "simplify" and/or "full" options to control the format of DICOM tags wherever possible
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4525
diff changeset
413 STUDY_DESCRIPTION,
569d9ef165b1 Added "short", "simplify" and/or "full" options to control the format of DICOM tags wherever possible
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4525
diff changeset
414 STUDY_TIME
2292
ccd44d546b47 Fix XSS inside DICOM in Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2119
diff changeset
415 ]);
2594
7fbe3f024ac9 new screen in OrthancExplorer to list studies
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2336
diff changeset
416
2292
ccd44d546b47 Fix XSS inside DICOM in Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2119
diff changeset
417 return CompleteFormatting(node, link, isReverse, study.Series.length);
0
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
418 }
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
419
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
420
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
421
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
422 function FormatSeries(series, link, isReverse)
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
423 {
3103
81b58b549845 back to using 'var' instead of 'let' since let is not supported by many old browsers. All variables declaration have been moved to the top of the function to better show that their scope is the function
Alain Mazy <alain@mazy.be>
parents: 3065
diff changeset
424 var c;
81b58b549845 back to using 'var' instead of 'let' since let is not supported by many old browsers. All variables declaration have been moved to the top of the function to better show that their scope is the function
Alain Mazy <alain@mazy.be>
parents: 3065
diff changeset
425 var node;
81b58b549845 back to using 'var' instead of 'let' since let is not supported by many old browsers. All variables declaration have been moved to the top of the function to better show that their scope is the function
Alain Mazy <alain@mazy.be>
parents: 3065
diff changeset
426
82
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 80
diff changeset
427 if (series.ExpectedNumberOfInstances == null ||
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 80
diff changeset
428 series.Instances.length == series.ExpectedNumberOfInstances)
80
6212bf978584 status of series
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 57
diff changeset
429 {
82
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 80
diff changeset
430 c = series.Instances.length;
80
6212bf978584 status of series
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 57
diff changeset
431 }
6212bf978584 status of series
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 57
diff changeset
432 else
6212bf978584 status of series
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 57
diff changeset
433 {
6212bf978584 status of series
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 57
diff changeset
434 c = series.Instances.length + '/' + series.ExpectedNumberOfInstances;
6212bf978584 status of series
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 57
diff changeset
435 }
2292
ccd44d546b47 Fix XSS inside DICOM in Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2119
diff changeset
436
3103
81b58b549845 back to using 'var' instead of 'let' since let is not supported by many old browsers. All variables declaration have been moved to the top of the function to better show that their scope is the function
Alain Mazy <alain@mazy.be>
parents: 3065
diff changeset
437 node = $('<div>')
4697
569d9ef165b1 Added "short", "simplify" and/or "full" options to control the format of DICOM tags wherever possible
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4525
diff changeset
438 .append($('<h3>').text(GetMainDicomTag(series.MainDicomTags, SERIES_DESCRIPTION)))
569d9ef165b1 Added "short", "simplify" and/or "full" options to control the format of DICOM tags wherever possible
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4525
diff changeset
439 .append($('<p>').append($('<em>')
569d9ef165b1 Added "short", "simplify" and/or "full" options to control the format of DICOM tags wherever possible
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4525
diff changeset
440 .text('Status: ')
569d9ef165b1 Added "short", "simplify" and/or "full" options to control the format of DICOM tags wherever possible
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4525
diff changeset
441 .append($('<strong>').text(series.Status))));
569d9ef165b1 Added "short", "simplify" and/or "full" options to control the format of DICOM tags wherever possible
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4525
diff changeset
442
2292
ccd44d546b47 Fix XSS inside DICOM in Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2119
diff changeset
443 FormatMainDicomTags(node, series.MainDicomTags, [
4697
569d9ef165b1 Added "short", "simplify" and/or "full" options to control the format of DICOM tags wherever possible
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4525
diff changeset
444 SERIES_DESCRIPTION,
569d9ef165b1 Added "short", "simplify" and/or "full" options to control the format of DICOM tags wherever possible
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4525
diff changeset
445 SERIES_TIME,
569d9ef165b1 Added "short", "simplify" and/or "full" options to control the format of DICOM tags wherever possible
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4525
diff changeset
446 MANUFACTURER,
569d9ef165b1 Added "short", "simplify" and/or "full" options to control the format of DICOM tags wherever possible
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4525
diff changeset
447 IMAGES_IN_ACQUISITION,
569d9ef165b1 Added "short", "simplify" and/or "full" options to control the format of DICOM tags wherever possible
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4525
diff changeset
448 SERIES_DATE,
569d9ef165b1 Added "short", "simplify" and/or "full" options to control the format of DICOM tags wherever possible
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4525
diff changeset
449 IMAGE_ORIENTATION_PATIENT
2292
ccd44d546b47 Fix XSS inside DICOM in Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2119
diff changeset
450 ]);
ccd44d546b47 Fix XSS inside DICOM in Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2119
diff changeset
451
ccd44d546b47 Fix XSS inside DICOM in Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2119
diff changeset
452 return CompleteFormatting(node, link, isReverse, c);
0
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
453 }
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
454
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
455
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
456 function FormatInstance(instance, link, isReverse)
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
457 {
3103
81b58b549845 back to using 'var' instead of 'let' since let is not supported by many old browsers. All variables declaration have been moved to the top of the function to better show that their scope is the function
Alain Mazy <alain@mazy.be>
parents: 3065
diff changeset
458 var node = $('<div>').append($('<h3>').text('Instance: ' + instance.IndexInSeries));
0
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
459
2292
ccd44d546b47 Fix XSS inside DICOM in Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2119
diff changeset
460 FormatMainDicomTags(node, instance.MainDicomTags, [
4697
569d9ef165b1 Added "short", "simplify" and/or "full" options to control the format of DICOM tags wherever possible
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4525
diff changeset
461 ACQUISITION_NUMBER,
569d9ef165b1 Added "short", "simplify" and/or "full" options to control the format of DICOM tags wherever possible
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4525
diff changeset
462 INSTANCE_NUMBER,
569d9ef165b1 Added "short", "simplify" and/or "full" options to control the format of DICOM tags wherever possible
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4525
diff changeset
463 INSTANCE_CREATION_DATE,
569d9ef165b1 Added "short", "simplify" and/or "full" options to control the format of DICOM tags wherever possible
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4525
diff changeset
464 INSTANCE_CREATION_TIME,
2292
ccd44d546b47 Fix XSS inside DICOM in Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2119
diff changeset
465 ]);
ccd44d546b47 Fix XSS inside DICOM in Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2119
diff changeset
466
ccd44d546b47 Fix XSS inside DICOM in Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2119
diff changeset
467 return CompleteFormatting(node, link, isReverse);
0
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
468 }
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
469
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
470
152
4829c054751a improved navigation in Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 151
diff changeset
471 $('[data-role="page"]').live('pagebeforeshow', function() {
4829c054751a improved navigation in Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 151
diff changeset
472 $.ajax({
153
5b6b5c9f280f fix path
jodogne
parents: 152
diff changeset
473 url: '../system',
152
4829c054751a improved navigation in Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 151
diff changeset
474 dataType: 'json',
4829c054751a improved navigation in Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 151
diff changeset
475 async: false,
344
cd6749e53a03 anonymization from orthanc explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 274
diff changeset
476 cache: false,
152
4829c054751a improved navigation in Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 151
diff changeset
477 success: function(s) {
165
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 153
diff changeset
478 if (s.Name != "") {
2336
a95beca72e99 fix header and query/retrieve in Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2292
diff changeset
479 $('.orthanc-name').html($('<a>')
a95beca72e99 fix header and query/retrieve in Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2292
diff changeset
480 .addClass('ui-link')
a95beca72e99 fix header and query/retrieve in Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2292
diff changeset
481 .attr('href', 'explorer.html')
a95beca72e99 fix header and query/retrieve in Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2292
diff changeset
482 .text(s.Name)
a95beca72e99 fix header and query/retrieve in Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2292
diff changeset
483 .append(' &raquo; '));
165
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 153
diff changeset
484 }
3533
2090ec6a83a5 create a default user if none is provided, while issuing a warning in Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3510
diff changeset
485
2090ec6a83a5 create a default user if none is provided, while issuing a warning in Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3510
diff changeset
486 // New in Orthanc 1.5.8
3534
cac8ffcb9cef forcing AuthenticationEnabled to false is considered as insecure if remote access is allowed
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3533
diff changeset
487 if ('IsHttpServerSecure' in s &&
cac8ffcb9cef forcing AuthenticationEnabled to false is considered as insecure if remote access is allowed
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3533
diff changeset
488 !s.IsHttpServerSecure) {
3533
2090ec6a83a5 create a default user if none is provided, while issuing a warning in Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3510
diff changeset
489 $('.warning-insecure').show();
2090ec6a83a5 create a default user if none is provided, while issuing a warning in Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3510
diff changeset
490 } else {
2090ec6a83a5 create a default user if none is provided, while issuing a warning in Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3510
diff changeset
491 $('.warning-insecure').hide();
2090ec6a83a5 create a default user if none is provided, while issuing a warning in Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3510
diff changeset
492 }
152
4829c054751a improved navigation in Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 151
diff changeset
493 }
4829c054751a improved navigation in Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 151
diff changeset
494 });
4829c054751a improved navigation in Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 151
diff changeset
495 });
4829c054751a improved navigation in Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 151
diff changeset
496
0
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
497
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
498
2873
703d1e848907 Orthanc Explorer: Lookup and limit the results to 100 patients/studies
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2647
diff changeset
499 $('#lookup').live('pagebeforeshow', function() {
703d1e848907 Orthanc Explorer: Lookup and limit the results to 100 patients/studies
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2647
diff changeset
500 // NB: "GenerateDicomDate()" is defined in "query-retrieve.js"
3103
81b58b549845 back to using 'var' instead of 'let' since let is not supported by many old browsers. All variables declaration have been moved to the top of the function to better show that their scope is the function
Alain Mazy <alain@mazy.be>
parents: 3065
diff changeset
501 var target = $('#lookup-study-date');
2873
703d1e848907 Orthanc Explorer: Lookup and limit the results to 100 patients/studies
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2647
diff changeset
502 $('option', target).remove();
3792
6dba4fa8a6cb remove universal wildcard on StudyDate in OrthancExplorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3576
diff changeset
503 target.append($('<option>').attr('value', '').text('Any date'));
2873
703d1e848907 Orthanc Explorer: Lookup and limit the results to 100 patients/studies
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2647
diff changeset
504 target.append($('<option>').attr('value', GenerateDicomDate(0)).text('Today'));
703d1e848907 Orthanc Explorer: Lookup and limit the results to 100 patients/studies
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2647
diff changeset
505 target.append($('<option>').attr('value', GenerateDicomDate(-1)).text('Yesterday'));
703d1e848907 Orthanc Explorer: Lookup and limit the results to 100 patients/studies
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2647
diff changeset
506 target.append($('<option>').attr('value', GenerateDicomDate(-7) + '-').text('Last 7 days'));
703d1e848907 Orthanc Explorer: Lookup and limit the results to 100 patients/studies
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2647
diff changeset
507 target.append($('<option>').attr('value', GenerateDicomDate(-31) + '-').text('Last 31 days'));
703d1e848907 Orthanc Explorer: Lookup and limit the results to 100 patients/studies
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2647
diff changeset
508 target.append($('<option>').attr('value', GenerateDicomDate(-31 * 3) + '-').text('Last 3 months'));
703d1e848907 Orthanc Explorer: Lookup and limit the results to 100 patients/studies
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2647
diff changeset
509 target.append($('<option>').attr('value', GenerateDicomDate(-365) + '-').text('Last year'));
4757
72a850947b11 In lookup and query/retrieve, possibility to provide a specific study date
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4749
diff changeset
510 target.append($('<option>').attr('value', 'specific').text('Specific date'));
2873
703d1e848907 Orthanc Explorer: Lookup and limit the results to 100 patients/studies
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2647
diff changeset
511 target.selectmenu('refresh');
703d1e848907 Orthanc Explorer: Lookup and limit the results to 100 patients/studies
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2647
diff changeset
512
703d1e848907 Orthanc Explorer: Lookup and limit the results to 100 patients/studies
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2647
diff changeset
513 $('#lookup-result').hide();
4757
72a850947b11 In lookup and query/retrieve, possibility to provide a specific study date
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4749
diff changeset
514 $('#lookup-study-date-specific').hide();
72a850947b11 In lookup and query/retrieve, possibility to provide a specific study date
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4749
diff changeset
515 });
72a850947b11 In lookup and query/retrieve, possibility to provide a specific study date
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4749
diff changeset
516
72a850947b11 In lookup and query/retrieve, possibility to provide a specific study date
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4749
diff changeset
517
72a850947b11 In lookup and query/retrieve, possibility to provide a specific study date
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4749
diff changeset
518 $('#lookup-study-date').live('change', function() {
72a850947b11 In lookup and query/retrieve, possibility to provide a specific study date
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4749
diff changeset
519 if ($(this).val() == 'specific') {
72a850947b11 In lookup and query/retrieve, possibility to provide a specific study date
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4749
diff changeset
520 $('#lookup-study-date-specific').show();
72a850947b11 In lookup and query/retrieve, possibility to provide a specific study date
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4749
diff changeset
521 } else {
72a850947b11 In lookup and query/retrieve, possibility to provide a specific study date
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4749
diff changeset
522 $('#lookup-study-date-specific').hide();
72a850947b11 In lookup and query/retrieve, possibility to provide a specific study date
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4749
diff changeset
523 }
2873
703d1e848907 Orthanc Explorer: Lookup and limit the results to 100 patients/studies
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2647
diff changeset
524 });
703d1e848907 Orthanc Explorer: Lookup and limit the results to 100 patients/studies
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2647
diff changeset
525
703d1e848907 Orthanc Explorer: Lookup and limit the results to 100 patients/studies
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2647
diff changeset
526
703d1e848907 Orthanc Explorer: Lookup and limit the results to 100 patients/studies
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2647
diff changeset
527 $('#lookup-submit').live('click', function() {
4757
72a850947b11 In lookup and query/retrieve, possibility to provide a specific study date
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4749
diff changeset
528 var lookup, studyDate;
3103
81b58b549845 back to using 'var' instead of 'let' since let is not supported by many old browsers. All variables declaration have been moved to the top of the function to better show that their scope is the function
Alain Mazy <alain@mazy.be>
parents: 3065
diff changeset
529
2873
703d1e848907 Orthanc Explorer: Lookup and limit the results to 100 patients/studies
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2647
diff changeset
530 $('#lookup-result').hide();
703d1e848907 Orthanc Explorer: Lookup and limit the results to 100 patients/studies
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2647
diff changeset
531
4757
72a850947b11 In lookup and query/retrieve, possibility to provide a specific study date
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4749
diff changeset
532 studyDate = $('#lookup-study-date').val();
72a850947b11 In lookup and query/retrieve, possibility to provide a specific study date
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4749
diff changeset
533 if (studyDate == 'specific') {
72a850947b11 In lookup and query/retrieve, possibility to provide a specific study date
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4749
diff changeset
534 studyDate = IsoToDicomDate($('#lookup-study-date-specific').val());
72a850947b11 In lookup and query/retrieve, possibility to provide a specific study date
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4749
diff changeset
535 }
72a850947b11 In lookup and query/retrieve, possibility to provide a specific study date
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4749
diff changeset
536
3103
81b58b549845 back to using 'var' instead of 'let' since let is not supported by many old browsers. All variables declaration have been moved to the top of the function to better show that their scope is the function
Alain Mazy <alain@mazy.be>
parents: 3065
diff changeset
537 lookup = {
2873
703d1e848907 Orthanc Explorer: Lookup and limit the results to 100 patients/studies
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2647
diff changeset
538 'Level' : 'Study',
703d1e848907 Orthanc Explorer: Lookup and limit the results to 100 patients/studies
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2647
diff changeset
539 'Expand' : true,
703d1e848907 Orthanc Explorer: Lookup and limit the results to 100 patients/studies
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2647
diff changeset
540 'Limit' : LIMIT_RESOURCES + 1,
703d1e848907 Orthanc Explorer: Lookup and limit the results to 100 patients/studies
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2647
diff changeset
541 'Query' : {
4757
72a850947b11 In lookup and query/retrieve, possibility to provide a specific study date
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4749
diff changeset
542 'StudyDate' : studyDate
4731
283d246fafdb fix broken "Do lookup" button in Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4697
diff changeset
543 },
283d246fafdb fix broken "Do lookup" button in Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4697
diff changeset
544 'Full' : true
2873
703d1e848907 Orthanc Explorer: Lookup and limit the results to 100 patients/studies
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2647
diff changeset
545 };
703d1e848907 Orthanc Explorer: Lookup and limit the results to 100 patients/studies
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2647
diff changeset
546
703d1e848907 Orthanc Explorer: Lookup and limit the results to 100 patients/studies
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2647
diff changeset
547 $('#lookup-form input').each(function(index, input) {
703d1e848907 Orthanc Explorer: Lookup and limit the results to 100 patients/studies
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2647
diff changeset
548 if (input.value.length != 0) {
703d1e848907 Orthanc Explorer: Lookup and limit the results to 100 patients/studies
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2647
diff changeset
549 if (input.id == 'lookup-patient-id') {
703d1e848907 Orthanc Explorer: Lookup and limit the results to 100 patients/studies
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2647
diff changeset
550 lookup['Query']['PatientID'] = input.value;
703d1e848907 Orthanc Explorer: Lookup and limit the results to 100 patients/studies
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2647
diff changeset
551 }
703d1e848907 Orthanc Explorer: Lookup and limit the results to 100 patients/studies
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2647
diff changeset
552 else if (input.id == 'lookup-patient-name') {
703d1e848907 Orthanc Explorer: Lookup and limit the results to 100 patients/studies
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2647
diff changeset
553 lookup['Query']['PatientName'] = input.value;
703d1e848907 Orthanc Explorer: Lookup and limit the results to 100 patients/studies
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2647
diff changeset
554 }
703d1e848907 Orthanc Explorer: Lookup and limit the results to 100 patients/studies
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2647
diff changeset
555 else if (input.id == 'lookup-accession-number') {
703d1e848907 Orthanc Explorer: Lookup and limit the results to 100 patients/studies
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2647
diff changeset
556 lookup['Query']['AccessionNumber'] = input.value;
703d1e848907 Orthanc Explorer: Lookup and limit the results to 100 patients/studies
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2647
diff changeset
557 }
703d1e848907 Orthanc Explorer: Lookup and limit the results to 100 patients/studies
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2647
diff changeset
558 else if (input.id == 'lookup-study-description') {
703d1e848907 Orthanc Explorer: Lookup and limit the results to 100 patients/studies
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2647
diff changeset
559 lookup['Query']['StudyDescription'] = input.value;
703d1e848907 Orthanc Explorer: Lookup and limit the results to 100 patients/studies
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2647
diff changeset
560 }
4757
72a850947b11 In lookup and query/retrieve, possibility to provide a specific study date
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4749
diff changeset
561 else if (input.id == 'lookup-study-date-specific') {
72a850947b11 In lookup and query/retrieve, possibility to provide a specific study date
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4749
diff changeset
562 // Ignore
72a850947b11 In lookup and query/retrieve, possibility to provide a specific study date
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4749
diff changeset
563 }
2873
703d1e848907 Orthanc Explorer: Lookup and limit the results to 100 patients/studies
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2647
diff changeset
564 else {
703d1e848907 Orthanc Explorer: Lookup and limit the results to 100 patients/studies
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2647
diff changeset
565 console.error('Unknown lookup field: ' + input.id);
703d1e848907 Orthanc Explorer: Lookup and limit the results to 100 patients/studies
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2647
diff changeset
566 }
703d1e848907 Orthanc Explorer: Lookup and limit the results to 100 patients/studies
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2647
diff changeset
567 }
703d1e848907 Orthanc Explorer: Lookup and limit the results to 100 patients/studies
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2647
diff changeset
568 });
703d1e848907 Orthanc Explorer: Lookup and limit the results to 100 patients/studies
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2647
diff changeset
569
703d1e848907 Orthanc Explorer: Lookup and limit the results to 100 patients/studies
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2647
diff changeset
570 $.ajax({
703d1e848907 Orthanc Explorer: Lookup and limit the results to 100 patients/studies
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2647
diff changeset
571 url: '../tools/find',
703d1e848907 Orthanc Explorer: Lookup and limit the results to 100 patients/studies
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2647
diff changeset
572 type: 'POST',
703d1e848907 Orthanc Explorer: Lookup and limit the results to 100 patients/studies
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2647
diff changeset
573 data: JSON.stringify(lookup),
703d1e848907 Orthanc Explorer: Lookup and limit the results to 100 patients/studies
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2647
diff changeset
574 dataType: 'json',
703d1e848907 Orthanc Explorer: Lookup and limit the results to 100 patients/studies
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2647
diff changeset
575 async: false,
703d1e848907 Orthanc Explorer: Lookup and limit the results to 100 patients/studies
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2647
diff changeset
576 error: function() {
703d1e848907 Orthanc Explorer: Lookup and limit the results to 100 patients/studies
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2647
diff changeset
577 alert('Error during lookup');
703d1e848907 Orthanc Explorer: Lookup and limit the results to 100 patients/studies
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2647
diff changeset
578 },
703d1e848907 Orthanc Explorer: Lookup and limit the results to 100 patients/studies
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2647
diff changeset
579 success: function(studies) {
703d1e848907 Orthanc Explorer: Lookup and limit the results to 100 patients/studies
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2647
diff changeset
580 FormatListOfStudies('#lookup-result ul', '#lookup-alert', '#lookup-count', studies);
703d1e848907 Orthanc Explorer: Lookup and limit the results to 100 patients/studies
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2647
diff changeset
581 $('#lookup-result').show();
703d1e848907 Orthanc Explorer: Lookup and limit the results to 100 patients/studies
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2647
diff changeset
582 }
703d1e848907 Orthanc Explorer: Lookup and limit the results to 100 patients/studies
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2647
diff changeset
583 });
703d1e848907 Orthanc Explorer: Lookup and limit the results to 100 patients/studies
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2647
diff changeset
584
703d1e848907 Orthanc Explorer: Lookup and limit the results to 100 patients/studies
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2647
diff changeset
585 return false;
703d1e848907 Orthanc Explorer: Lookup and limit the results to 100 patients/studies
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2647
diff changeset
586 });
703d1e848907 Orthanc Explorer: Lookup and limit the results to 100 patients/studies
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2647
diff changeset
587
703d1e848907 Orthanc Explorer: Lookup and limit the results to 100 patients/studies
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2647
diff changeset
588
0
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
589 $('#find-patients').live('pagebeforeshow', function() {
4697
569d9ef165b1 Added "short", "simplify" and/or "full" options to control the format of DICOM tags wherever possible
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4525
diff changeset
590 GetResource('/patients?expand&since=0&limit=' + (LIMIT_RESOURCES + 1) + '&full', function(patients) {
3103
81b58b549845 back to using 'var' instead of 'let' since let is not supported by many old browsers. All variables declaration have been moved to the top of the function to better show that their scope is the function
Alain Mazy <alain@mazy.be>
parents: 3065
diff changeset
591 var target = $('#all-patients');
81b58b549845 back to using 'var' instead of 'let' since let is not supported by many old browsers. All variables declaration have been moved to the top of the function to better show that their scope is the function
Alain Mazy <alain@mazy.be>
parents: 3065
diff changeset
592 var count, showAlert, p;
81b58b549845 back to using 'var' instead of 'let' since let is not supported by many old browsers. All variables declaration have been moved to the top of the function to better show that their scope is the function
Alain Mazy <alain@mazy.be>
parents: 3065
diff changeset
593
81b58b549845 back to using 'var' instead of 'let' since let is not supported by many old browsers. All variables declaration have been moved to the top of the function to better show that their scope is the function
Alain Mazy <alain@mazy.be>
parents: 3065
diff changeset
594
2594
7fbe3f024ac9 new screen in OrthancExplorer to list studies
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2336
diff changeset
595 $('li', target).remove();
0
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
596
4697
569d9ef165b1 Added "short", "simplify" and/or "full" options to control the format of DICOM tags wherever possible
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4525
diff changeset
597 SortOnDicomTag(patients, PATIENT_NAME, false, false);
2594
7fbe3f024ac9 new screen in OrthancExplorer to list studies
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2336
diff changeset
598
2873
703d1e848907 Orthanc Explorer: Lookup and limit the results to 100 patients/studies
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2647
diff changeset
599 if (patients.length <= LIMIT_RESOURCES) {
703d1e848907 Orthanc Explorer: Lookup and limit the results to 100 patients/studies
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2647
diff changeset
600 count = patients.length;
703d1e848907 Orthanc Explorer: Lookup and limit the results to 100 patients/studies
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2647
diff changeset
601 showAlert = false;
703d1e848907 Orthanc Explorer: Lookup and limit the results to 100 patients/studies
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2647
diff changeset
602 }
703d1e848907 Orthanc Explorer: Lookup and limit the results to 100 patients/studies
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2647
diff changeset
603 else {
703d1e848907 Orthanc Explorer: Lookup and limit the results to 100 patients/studies
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2647
diff changeset
604 count = LIMIT_RESOURCES;
703d1e848907 Orthanc Explorer: Lookup and limit the results to 100 patients/studies
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2647
diff changeset
605 showAlert = true;
703d1e848907 Orthanc Explorer: Lookup and limit the results to 100 patients/studies
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2647
diff changeset
606 }
703d1e848907 Orthanc Explorer: Lookup and limit the results to 100 patients/studies
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2647
diff changeset
607
3103
81b58b549845 back to using 'var' instead of 'let' since let is not supported by many old browsers. All variables declaration have been moved to the top of the function to better show that their scope is the function
Alain Mazy <alain@mazy.be>
parents: 3065
diff changeset
608 for (var i = 0; i < count; i++) {
81b58b549845 back to using 'var' instead of 'let' since let is not supported by many old browsers. All variables declaration have been moved to the top of the function to better show that their scope is the function
Alain Mazy <alain@mazy.be>
parents: 3065
diff changeset
609 p = FormatPatient(patients[i], '#patient?uuid=' + patients[i].ID);
2594
7fbe3f024ac9 new screen in OrthancExplorer to list studies
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2336
diff changeset
610 target.append(p);
7fbe3f024ac9 new screen in OrthancExplorer to list studies
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2336
diff changeset
611 }
7fbe3f024ac9 new screen in OrthancExplorer to list studies
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2336
diff changeset
612
2873
703d1e848907 Orthanc Explorer: Lookup and limit the results to 100 patients/studies
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2647
diff changeset
613 target.listview('refresh');
703d1e848907 Orthanc Explorer: Lookup and limit the results to 100 patients/studies
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2647
diff changeset
614
703d1e848907 Orthanc Explorer: Lookup and limit the results to 100 patients/studies
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2647
diff changeset
615 if (showAlert) {
703d1e848907 Orthanc Explorer: Lookup and limit the results to 100 patients/studies
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2647
diff changeset
616 $('#count-patients').text(LIMIT_RESOURCES);
703d1e848907 Orthanc Explorer: Lookup and limit the results to 100 patients/studies
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2647
diff changeset
617 $('#alert-patients').show();
703d1e848907 Orthanc Explorer: Lookup and limit the results to 100 patients/studies
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2647
diff changeset
618 } else {
703d1e848907 Orthanc Explorer: Lookup and limit the results to 100 patients/studies
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2647
diff changeset
619 $('#alert-patients').hide();
703d1e848907 Orthanc Explorer: Lookup and limit the results to 100 patients/studies
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2647
diff changeset
620 }
2594
7fbe3f024ac9 new screen in OrthancExplorer to list studies
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2336
diff changeset
621 });
7fbe3f024ac9 new screen in OrthancExplorer to list studies
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2336
diff changeset
622 });
7fbe3f024ac9 new screen in OrthancExplorer to list studies
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2336
diff changeset
623
7fbe3f024ac9 new screen in OrthancExplorer to list studies
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2336
diff changeset
624
0
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
625
2873
703d1e848907 Orthanc Explorer: Lookup and limit the results to 100 patients/studies
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2647
diff changeset
626 function FormatListOfStudies(targetId, alertId, countId, studies)
703d1e848907 Orthanc Explorer: Lookup and limit the results to 100 patients/studies
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2647
diff changeset
627 {
3103
81b58b549845 back to using 'var' instead of 'let' since let is not supported by many old browsers. All variables declaration have been moved to the top of the function to better show that their scope is the function
Alain Mazy <alain@mazy.be>
parents: 3065
diff changeset
628 var target = $(targetId);
81b58b549845 back to using 'var' instead of 'let' since let is not supported by many old browsers. All variables declaration have been moved to the top of the function to better show that their scope is the function
Alain Mazy <alain@mazy.be>
parents: 3065
diff changeset
629 var patient, study, s;
81b58b549845 back to using 'var' instead of 'let' since let is not supported by many old browsers. All variables declaration have been moved to the top of the function to better show that their scope is the function
Alain Mazy <alain@mazy.be>
parents: 3065
diff changeset
630 var count, showAlert;
81b58b549845 back to using 'var' instead of 'let' since let is not supported by many old browsers. All variables declaration have been moved to the top of the function to better show that their scope is the function
Alain Mazy <alain@mazy.be>
parents: 3065
diff changeset
631
2873
703d1e848907 Orthanc Explorer: Lookup and limit the results to 100 patients/studies
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2647
diff changeset
632 $('li', target).remove();
703d1e848907 Orthanc Explorer: Lookup and limit the results to 100 patients/studies
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2647
diff changeset
633
3103
81b58b549845 back to using 'var' instead of 'let' since let is not supported by many old browsers. All variables declaration have been moved to the top of the function to better show that their scope is the function
Alain Mazy <alain@mazy.be>
parents: 3065
diff changeset
634 for (var i = 0; i < studies.length; i++) {
4697
569d9ef165b1 Added "short", "simplify" and/or "full" options to control the format of DICOM tags wherever possible
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4525
diff changeset
635 patient = GetMainDicomTag(studies[i].PatientMainDicomTags, PATIENT_NAME);
569d9ef165b1 Added "short", "simplify" and/or "full" options to control the format of DICOM tags wherever possible
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4525
diff changeset
636 study = GetMainDicomTag(studies[i].MainDicomTags, STUDY_DESCRIPTION);
2594
7fbe3f024ac9 new screen in OrthancExplorer to list studies
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2336
diff changeset
637
3103
81b58b549845 back to using 'var' instead of 'let' since let is not supported by many old browsers. All variables declaration have been moved to the top of the function to better show that their scope is the function
Alain Mazy <alain@mazy.be>
parents: 3065
diff changeset
638 s = "";
2873
703d1e848907 Orthanc Explorer: Lookup and limit the results to 100 patients/studies
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2647
diff changeset
639 if (typeof patient === 'string') {
703d1e848907 Orthanc Explorer: Lookup and limit the results to 100 patients/studies
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2647
diff changeset
640 s = patient;
703d1e848907 Orthanc Explorer: Lookup and limit the results to 100 patients/studies
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2647
diff changeset
641 }
2594
7fbe3f024ac9 new screen in OrthancExplorer to list studies
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2336
diff changeset
642
2873
703d1e848907 Orthanc Explorer: Lookup and limit the results to 100 patients/studies
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2647
diff changeset
643 if (typeof study === 'string') {
703d1e848907 Orthanc Explorer: Lookup and limit the results to 100 patients/studies
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2647
diff changeset
644 if (s.length > 0) {
703d1e848907 Orthanc Explorer: Lookup and limit the results to 100 patients/studies
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2647
diff changeset
645 s += ' - ';
1343
72d1c2fc0edb Huge speed-up in Orthanc Explorer for large amount of images
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1232
diff changeset
646 }
72d1c2fc0edb Huge speed-up in Orthanc Explorer for large amount of images
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1232
diff changeset
647
2873
703d1e848907 Orthanc Explorer: Lookup and limit the results to 100 patients/studies
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2647
diff changeset
648 s += study;
2594
7fbe3f024ac9 new screen in OrthancExplorer to list studies
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2336
diff changeset
649 }
7fbe3f024ac9 new screen in OrthancExplorer to list studies
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2336
diff changeset
650
2873
703d1e848907 Orthanc Explorer: Lookup and limit the results to 100 patients/studies
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2647
diff changeset
651 studies[i]['Label'] = s;
703d1e848907 Orthanc Explorer: Lookup and limit the results to 100 patients/studies
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2647
diff changeset
652 }
703d1e848907 Orthanc Explorer: Lookup and limit the results to 100 patients/studies
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2647
diff changeset
653
703d1e848907 Orthanc Explorer: Lookup and limit the results to 100 patients/studies
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2647
diff changeset
654 Sort(studies, function(a) { return a.Label }, false, false);
703d1e848907 Orthanc Explorer: Lookup and limit the results to 100 patients/studies
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2647
diff changeset
655
703d1e848907 Orthanc Explorer: Lookup and limit the results to 100 patients/studies
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2647
diff changeset
656 if (studies.length <= LIMIT_RESOURCES) {
703d1e848907 Orthanc Explorer: Lookup and limit the results to 100 patients/studies
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2647
diff changeset
657 count = studies.length;
703d1e848907 Orthanc Explorer: Lookup and limit the results to 100 patients/studies
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2647
diff changeset
658 showAlert = false;
703d1e848907 Orthanc Explorer: Lookup and limit the results to 100 patients/studies
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2647
diff changeset
659 }
703d1e848907 Orthanc Explorer: Lookup and limit the results to 100 patients/studies
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2647
diff changeset
660 else {
703d1e848907 Orthanc Explorer: Lookup and limit the results to 100 patients/studies
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2647
diff changeset
661 count = LIMIT_RESOURCES;
703d1e848907 Orthanc Explorer: Lookup and limit the results to 100 patients/studies
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2647
diff changeset
662 showAlert = true;
703d1e848907 Orthanc Explorer: Lookup and limit the results to 100 patients/studies
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2647
diff changeset
663 }
2594
7fbe3f024ac9 new screen in OrthancExplorer to list studies
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2336
diff changeset
664
3103
81b58b549845 back to using 'var' instead of 'let' since let is not supported by many old browsers. All variables declaration have been moved to the top of the function to better show that their scope is the function
Alain Mazy <alain@mazy.be>
parents: 3065
diff changeset
665 for (var i = 0; i < count; i++) {
81b58b549845 back to using 'var' instead of 'let' since let is not supported by many old browsers. All variables declaration have been moved to the top of the function to better show that their scope is the function
Alain Mazy <alain@mazy.be>
parents: 3065
diff changeset
666 s = FormatStudy(studies[i], '#study?uuid=' + studies[i].ID, false, true);
81b58b549845 back to using 'var' instead of 'let' since let is not supported by many old browsers. All variables declaration have been moved to the top of the function to better show that their scope is the function
Alain Mazy <alain@mazy.be>
parents: 3065
diff changeset
667 target.append(s);
2873
703d1e848907 Orthanc Explorer: Lookup and limit the results to 100 patients/studies
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2647
diff changeset
668 }
703d1e848907 Orthanc Explorer: Lookup and limit the results to 100 patients/studies
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2647
diff changeset
669
703d1e848907 Orthanc Explorer: Lookup and limit the results to 100 patients/studies
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2647
diff changeset
670 target.listview('refresh');
2594
7fbe3f024ac9 new screen in OrthancExplorer to list studies
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2336
diff changeset
671
2873
703d1e848907 Orthanc Explorer: Lookup and limit the results to 100 patients/studies
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2647
diff changeset
672 if (showAlert) {
703d1e848907 Orthanc Explorer: Lookup and limit the results to 100 patients/studies
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2647
diff changeset
673 $(countId).text(LIMIT_RESOURCES);
703d1e848907 Orthanc Explorer: Lookup and limit the results to 100 patients/studies
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2647
diff changeset
674 $(alertId).show();
703d1e848907 Orthanc Explorer: Lookup and limit the results to 100 patients/studies
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2647
diff changeset
675 } else {
703d1e848907 Orthanc Explorer: Lookup and limit the results to 100 patients/studies
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2647
diff changeset
676 $(alertId).hide();
703d1e848907 Orthanc Explorer: Lookup and limit the results to 100 patients/studies
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2647
diff changeset
677 }
703d1e848907 Orthanc Explorer: Lookup and limit the results to 100 patients/studies
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2647
diff changeset
678 }
703d1e848907 Orthanc Explorer: Lookup and limit the results to 100 patients/studies
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2647
diff changeset
679
703d1e848907 Orthanc Explorer: Lookup and limit the results to 100 patients/studies
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2647
diff changeset
680
703d1e848907 Orthanc Explorer: Lookup and limit the results to 100 patients/studies
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2647
diff changeset
681 $('#find-studies').live('pagebeforeshow', function() {
4697
569d9ef165b1 Added "short", "simplify" and/or "full" options to control the format of DICOM tags wherever possible
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4525
diff changeset
682 GetResource('/studies?expand&since=0&limit=' + (LIMIT_RESOURCES + 1) + '&full', function(studies) {
2873
703d1e848907 Orthanc Explorer: Lookup and limit the results to 100 patients/studies
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2647
diff changeset
683 FormatListOfStudies('#all-studies', '#alert-studies', '#count-studies', studies);
1345
c90a4a42a3f2 simplification
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1343
diff changeset
684 });
0
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
685 });
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
686
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
687
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
688
515
a8be42bcf2bb Link from modified to original resource in Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 485
diff changeset
689 function SetupAnonymizedOrModifiedFrom(buttonSelector, resource, resourceType, field)
443
be93b666ed79 link anonymized to original resource in OrthancExplorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 405
diff changeset
690 {
515
a8be42bcf2bb Link from modified to original resource in Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 485
diff changeset
691 if (field in resource)
443
be93b666ed79 link anonymized to original resource in OrthancExplorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 405
diff changeset
692 {
be93b666ed79 link anonymized to original resource in OrthancExplorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 405
diff changeset
693 $(buttonSelector).closest('li').show();
be93b666ed79 link anonymized to original resource in OrthancExplorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 405
diff changeset
694 $(buttonSelector).click(function(e) {
515
a8be42bcf2bb Link from modified to original resource in Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 485
diff changeset
695 window.location.assign('explorer.html#' + resourceType + '?uuid=' + resource[field]);
443
be93b666ed79 link anonymized to original resource in OrthancExplorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 405
diff changeset
696 });
be93b666ed79 link anonymized to original resource in OrthancExplorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 405
diff changeset
697 }
be93b666ed79 link anonymized to original resource in OrthancExplorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 405
diff changeset
698 else
be93b666ed79 link anonymized to original resource in OrthancExplorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 405
diff changeset
699 {
be93b666ed79 link anonymized to original resource in OrthancExplorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 405
diff changeset
700 $(buttonSelector).closest('li').hide();
be93b666ed79 link anonymized to original resource in OrthancExplorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 405
diff changeset
701 }
be93b666ed79 link anonymized to original resource in OrthancExplorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 405
diff changeset
702 }
be93b666ed79 link anonymized to original resource in OrthancExplorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 405
diff changeset
703
be93b666ed79 link anonymized to original resource in OrthancExplorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 405
diff changeset
704
515
a8be42bcf2bb Link from modified to original resource in Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 485
diff changeset
705
482
b05eb8708aee fix history in Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 443
diff changeset
706 function RefreshPatient()
b05eb8708aee fix history in Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 443
diff changeset
707 {
3103
81b58b549845 back to using 'var' instead of 'let' since let is not supported by many old browsers. All variables declaration have been moved to the top of the function to better show that their scope is the function
Alain Mazy <alain@mazy.be>
parents: 3065
diff changeset
708 var pageData, target, v;
81b58b549845 back to using 'var' instead of 'let' since let is not supported by many old browsers. All variables declaration have been moved to the top of the function to better show that their scope is the function
Alain Mazy <alain@mazy.be>
parents: 3065
diff changeset
709
0
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
710 if ($.mobile.pageData) {
3103
81b58b549845 back to using 'var' instead of 'let' since let is not supported by many old browsers. All variables declaration have been moved to the top of the function to better show that their scope is the function
Alain Mazy <alain@mazy.be>
parents: 3065
diff changeset
711 pageData = DeepCopy($.mobile.pageData);
2119
e0517f25919e Improved robustness of Orthanc Explorer wrt. query/retrieve (maybe fix issue 24)
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1732
diff changeset
712
4697
569d9ef165b1 Added "short", "simplify" and/or "full" options to control the format of DICOM tags wherever possible
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4525
diff changeset
713 GetResource('/patients/' + pageData.uuid + '?full', function(patient) {
569d9ef165b1 Added "short", "simplify" and/or "full" options to control the format of DICOM tags wherever possible
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4525
diff changeset
714 GetResource('/patients/' + pageData.uuid + '/studies?full', function(studies) {
569d9ef165b1 Added "short", "simplify" and/or "full" options to control the format of DICOM tags wherever possible
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4525
diff changeset
715 SortOnDicomTag(studies, STUDY_DATE, false, true);
0
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
716
1345
c90a4a42a3f2 simplification
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1343
diff changeset
717 $('#patient-info li').remove();
c90a4a42a3f2 simplification
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1343
diff changeset
718 $('#patient-info')
c90a4a42a3f2 simplification
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1343
diff changeset
719 .append('<li data-role="list-divider">Patient</li>')
c90a4a42a3f2 simplification
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1343
diff changeset
720 .append(FormatPatient(patient))
c90a4a42a3f2 simplification
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1343
diff changeset
721 .listview('refresh');
1343
72d1c2fc0edb Huge speed-up in Orthanc Explorer for large amount of images
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1232
diff changeset
722
3103
81b58b549845 back to using 'var' instead of 'let' since let is not supported by many old browsers. All variables declaration have been moved to the top of the function to better show that their scope is the function
Alain Mazy <alain@mazy.be>
parents: 3065
diff changeset
723 target = $('#list-studies');
1345
c90a4a42a3f2 simplification
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1343
diff changeset
724 $('li', target).remove();
c90a4a42a3f2 simplification
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1343
diff changeset
725
3103
81b58b549845 back to using 'var' instead of 'let' since let is not supported by many old browsers. All variables declaration have been moved to the top of the function to better show that their scope is the function
Alain Mazy <alain@mazy.be>
parents: 3065
diff changeset
726 for (var i = 0; i < studies.length; i++) {
4697
569d9ef165b1 Added "short", "simplify" and/or "full" options to control the format of DICOM tags wherever possible
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4525
diff changeset
727 if (i == 0 ||
569d9ef165b1 Added "short", "simplify" and/or "full" options to control the format of DICOM tags wherever possible
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4525
diff changeset
728 GetMainDicomTag(studies[i].MainDicomTags, STUDY_DATE) !=
569d9ef165b1 Added "short", "simplify" and/or "full" options to control the format of DICOM tags wherever possible
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4525
diff changeset
729 GetMainDicomTag(studies[i - 1].MainDicomTags, STUDY_DATE))
1345
c90a4a42a3f2 simplification
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1343
diff changeset
730 {
2292
ccd44d546b47 Fix XSS inside DICOM in Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2119
diff changeset
731 target.append($('<li>')
ccd44d546b47 Fix XSS inside DICOM in Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2119
diff changeset
732 .attr('data-role', 'list-divider')
4697
569d9ef165b1 Added "short", "simplify" and/or "full" options to control the format of DICOM tags wherever possible
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4525
diff changeset
733 .text(FormatDicomDate(GetMainDicomTag(studies[i].MainDicomTags, STUDY_DATE))));
0
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
734 }
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
735
1345
c90a4a42a3f2 simplification
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1343
diff changeset
736 target.append(FormatStudy(studies[i], '#study?uuid=' + studies[i].ID));
c90a4a42a3f2 simplification
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1343
diff changeset
737 }
0
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
738
4697
569d9ef165b1 Added "short", "simplify" and/or "full" options to control the format of DICOM tags wherever possible
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4525
diff changeset
739 SetupAnonymizedOrModifiedFrom('#patient-anonymized-from', patient, 'patient', ANONYMIZED_FROM);
569d9ef165b1 Added "short", "simplify" and/or "full" options to control the format of DICOM tags wherever possible
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4525
diff changeset
740 SetupAnonymizedOrModifiedFrom('#patient-modified-from', patient, 'patient', MODIFIED_FROM);
1345
c90a4a42a3f2 simplification
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1343
diff changeset
741
c90a4a42a3f2 simplification
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1343
diff changeset
742 target.listview('refresh');
274
f2286c741109 patient protection in Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 250
diff changeset
743
1345
c90a4a42a3f2 simplification
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1343
diff changeset
744 // Check whether this patient is protected
c90a4a42a3f2 simplification
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1343
diff changeset
745 $.ajax({
2119
e0517f25919e Improved robustness of Orthanc Explorer wrt. query/retrieve (maybe fix issue 24)
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1732
diff changeset
746 url: '../patients/' + pageData.uuid + '/protected',
1345
c90a4a42a3f2 simplification
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1343
diff changeset
747 type: 'GET',
c90a4a42a3f2 simplification
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1343
diff changeset
748 dataType: 'text',
c90a4a42a3f2 simplification
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1343
diff changeset
749 async: false,
c90a4a42a3f2 simplification
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1343
diff changeset
750 cache: false,
c90a4a42a3f2 simplification
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1343
diff changeset
751 success: function (s) {
3103
81b58b549845 back to using 'var' instead of 'let' since let is not supported by many old browsers. All variables declaration have been moved to the top of the function to better show that their scope is the function
Alain Mazy <alain@mazy.be>
parents: 3065
diff changeset
752 v = (s == '1') ? 'on' : 'off';
1345
c90a4a42a3f2 simplification
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1343
diff changeset
753 $('#protection').val(v).slider('refresh');
c90a4a42a3f2 simplification
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1343
diff changeset
754 }
c90a4a42a3f2 simplification
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1343
diff changeset
755 });
482
b05eb8708aee fix history in Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 443
diff changeset
756
1345
c90a4a42a3f2 simplification
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1343
diff changeset
757 currentPage = 'patient';
2119
e0517f25919e Improved robustness of Orthanc Explorer wrt. query/retrieve (maybe fix issue 24)
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1732
diff changeset
758 currentUuid = pageData.uuid;
0
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
759 });
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
760 });
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
761 }
482
b05eb8708aee fix history in Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 443
diff changeset
762 }
0
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
763
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
764
482
b05eb8708aee fix history in Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 443
diff changeset
765 function RefreshStudy()
b05eb8708aee fix history in Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 443
diff changeset
766 {
3103
81b58b549845 back to using 'var' instead of 'let' since let is not supported by many old browsers. All variables declaration have been moved to the top of the function to better show that their scope is the function
Alain Mazy <alain@mazy.be>
parents: 3065
diff changeset
767 var pageData, target;
81b58b549845 back to using 'var' instead of 'let' since let is not supported by many old browsers. All variables declaration have been moved to the top of the function to better show that their scope is the function
Alain Mazy <alain@mazy.be>
parents: 3065
diff changeset
768
0
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
769 if ($.mobile.pageData) {
3103
81b58b549845 back to using 'var' instead of 'let' since let is not supported by many old browsers. All variables declaration have been moved to the top of the function to better show that their scope is the function
Alain Mazy <alain@mazy.be>
parents: 3065
diff changeset
770 pageData = DeepCopy($.mobile.pageData);
2119
e0517f25919e Improved robustness of Orthanc Explorer wrt. query/retrieve (maybe fix issue 24)
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1732
diff changeset
771
4697
569d9ef165b1 Added "short", "simplify" and/or "full" options to control the format of DICOM tags wherever possible
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4525
diff changeset
772 GetResource('/studies/' + pageData.uuid + '?full', function(study) {
569d9ef165b1 Added "short", "simplify" and/or "full" options to control the format of DICOM tags wherever possible
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4525
diff changeset
773 GetResource('/patients/' + study.ParentPatient + '?full', function(patient) {
569d9ef165b1 Added "short", "simplify" and/or "full" options to control the format of DICOM tags wherever possible
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4525
diff changeset
774 GetResource('/studies/' + pageData.uuid + '/series?full', function(series) {
569d9ef165b1 Added "short", "simplify" and/or "full" options to control the format of DICOM tags wherever possible
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4525
diff changeset
775 SortOnDicomTag(series, SERIES_DATE, false, true);
0
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
776
1345
c90a4a42a3f2 simplification
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1343
diff changeset
777 $('#study .patient-link').attr('href', '#patient?uuid=' + patient.ID);
c90a4a42a3f2 simplification
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1343
diff changeset
778 $('#study-info li').remove();
c90a4a42a3f2 simplification
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1343
diff changeset
779 $('#study-info')
c90a4a42a3f2 simplification
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1343
diff changeset
780 .append('<li data-role="list-divider">Patient</li>')
c90a4a42a3f2 simplification
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1343
diff changeset
781 .append(FormatPatient(patient, '#patient?uuid=' + patient.ID, true))
c90a4a42a3f2 simplification
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1343
diff changeset
782 .append('<li data-role="list-divider">Study</li>')
c90a4a42a3f2 simplification
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1343
diff changeset
783 .append(FormatStudy(study))
c90a4a42a3f2 simplification
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1343
diff changeset
784 .listview('refresh');
443
be93b666ed79 link anonymized to original resource in OrthancExplorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 405
diff changeset
785
4697
569d9ef165b1 Added "short", "simplify" and/or "full" options to control the format of DICOM tags wherever possible
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4525
diff changeset
786 SetupAnonymizedOrModifiedFrom('#study-anonymized-from', study, 'study', ANONYMIZED_FROM);
569d9ef165b1 Added "short", "simplify" and/or "full" options to control the format of DICOM tags wherever possible
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4525
diff changeset
787 SetupAnonymizedOrModifiedFrom('#study-modified-from', study, 'study', MODIFIED_FROM);
1343
72d1c2fc0edb Huge speed-up in Orthanc Explorer for large amount of images
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1232
diff changeset
788
3103
81b58b549845 back to using 'var' instead of 'let' since let is not supported by many old browsers. All variables declaration have been moved to the top of the function to better show that their scope is the function
Alain Mazy <alain@mazy.be>
parents: 3065
diff changeset
789 target = $('#list-series');
1345
c90a4a42a3f2 simplification
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1343
diff changeset
790 $('li', target).remove();
3103
81b58b549845 back to using 'var' instead of 'let' since let is not supported by many old browsers. All variables declaration have been moved to the top of the function to better show that their scope is the function
Alain Mazy <alain@mazy.be>
parents: 3065
diff changeset
791 for (var i = 0; i < series.length; i++) {
4697
569d9ef165b1 Added "short", "simplify" and/or "full" options to control the format of DICOM tags wherever possible
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4525
diff changeset
792 if (i == 0 ||
569d9ef165b1 Added "short", "simplify" and/or "full" options to control the format of DICOM tags wherever possible
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4525
diff changeset
793 GetMainDicomTag(series[i].MainDicomTags, SERIES_DATE) !=
569d9ef165b1 Added "short", "simplify" and/or "full" options to control the format of DICOM tags wherever possible
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4525
diff changeset
794 GetMainDicomTag(series[i - 1].MainDicomTags, SERIES_DATE))
1345
c90a4a42a3f2 simplification
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1343
diff changeset
795 {
2292
ccd44d546b47 Fix XSS inside DICOM in Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2119
diff changeset
796 target.append($('<li>')
ccd44d546b47 Fix XSS inside DICOM in Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2119
diff changeset
797 .attr('data-role', 'list-divider')
4697
569d9ef165b1 Added "short", "simplify" and/or "full" options to control the format of DICOM tags wherever possible
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4525
diff changeset
798 .text(FormatDicomDate(GetMainDicomTag(series[i].MainDicomTags, SERIES_DATE))));
0
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
799 }
2292
ccd44d546b47 Fix XSS inside DICOM in Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2119
diff changeset
800
1345
c90a4a42a3f2 simplification
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1343
diff changeset
801 target.append(FormatSeries(series[i], '#series?uuid=' + series[i].ID));
c90a4a42a3f2 simplification
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1343
diff changeset
802 }
c90a4a42a3f2 simplification
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1343
diff changeset
803 target.listview('refresh');
482
b05eb8708aee fix history in Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 443
diff changeset
804
1345
c90a4a42a3f2 simplification
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1343
diff changeset
805 currentPage = 'study';
2119
e0517f25919e Improved robustness of Orthanc Explorer wrt. query/retrieve (maybe fix issue 24)
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1732
diff changeset
806 currentUuid = pageData.uuid;
0
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
807 });
1343
72d1c2fc0edb Huge speed-up in Orthanc Explorer for large amount of images
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1232
diff changeset
808 });
0
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
809 });
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
810 }
482
b05eb8708aee fix history in Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 443
diff changeset
811 }
0
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
812
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
813
482
b05eb8708aee fix history in Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 443
diff changeset
814 function RefreshSeries()
b05eb8708aee fix history in Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 443
diff changeset
815 {
3103
81b58b549845 back to using 'var' instead of 'let' since let is not supported by many old browsers. All variables declaration have been moved to the top of the function to better show that their scope is the function
Alain Mazy <alain@mazy.be>
parents: 3065
diff changeset
816 var pageData, target;
81b58b549845 back to using 'var' instead of 'let' since let is not supported by many old browsers. All variables declaration have been moved to the top of the function to better show that their scope is the function
Alain Mazy <alain@mazy.be>
parents: 3065
diff changeset
817
0
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
818 if ($.mobile.pageData) {
3103
81b58b549845 back to using 'var' instead of 'let' since let is not supported by many old browsers. All variables declaration have been moved to the top of the function to better show that their scope is the function
Alain Mazy <alain@mazy.be>
parents: 3065
diff changeset
819 pageData = DeepCopy($.mobile.pageData);
2119
e0517f25919e Improved robustness of Orthanc Explorer wrt. query/retrieve (maybe fix issue 24)
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1732
diff changeset
820
4697
569d9ef165b1 Added "short", "simplify" and/or "full" options to control the format of DICOM tags wherever possible
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4525
diff changeset
821 GetResource('/series/' + pageData.uuid + '?full', function(series) {
569d9ef165b1 Added "short", "simplify" and/or "full" options to control the format of DICOM tags wherever possible
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4525
diff changeset
822 GetResource('/studies/' + series.ParentStudy + '?full', function(study) {
569d9ef165b1 Added "short", "simplify" and/or "full" options to control the format of DICOM tags wherever possible
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4525
diff changeset
823 GetResource('/patients/' + study.ParentPatient + '?full', function(patient) {
569d9ef165b1 Added "short", "simplify" and/or "full" options to control the format of DICOM tags wherever possible
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4525
diff changeset
824 GetResource('/series/' + pageData.uuid + '/instances?full', function(instances) {
1345
c90a4a42a3f2 simplification
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1343
diff changeset
825 Sort(instances, function(x) { return x.IndexInSeries; }, true, false);
0
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
826
1345
c90a4a42a3f2 simplification
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1343
diff changeset
827 $('#series .patient-link').attr('href', '#patient?uuid=' + patient.ID);
c90a4a42a3f2 simplification
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1343
diff changeset
828 $('#series .study-link').attr('href', '#study?uuid=' + study.ID);
152
4829c054751a improved navigation in Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 151
diff changeset
829
1345
c90a4a42a3f2 simplification
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1343
diff changeset
830 $('#series-info li').remove();
c90a4a42a3f2 simplification
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1343
diff changeset
831 $('#series-info')
c90a4a42a3f2 simplification
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1343
diff changeset
832 .append('<li data-role="list-divider">Patient</li>')
c90a4a42a3f2 simplification
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1343
diff changeset
833 .append(FormatPatient(patient, '#patient?uuid=' + patient.ID, true))
c90a4a42a3f2 simplification
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1343
diff changeset
834 .append('<li data-role="list-divider">Study</li>')
c90a4a42a3f2 simplification
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1343
diff changeset
835 .append(FormatStudy(study, '#study?uuid=' + study.ID, true))
c90a4a42a3f2 simplification
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1343
diff changeset
836 .append('<li data-role="list-divider">Series</li>')
c90a4a42a3f2 simplification
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1343
diff changeset
837 .append(FormatSeries(series))
c90a4a42a3f2 simplification
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1343
diff changeset
838 .listview('refresh');
0
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
839
4697
569d9ef165b1 Added "short", "simplify" and/or "full" options to control the format of DICOM tags wherever possible
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4525
diff changeset
840 SetupAnonymizedOrModifiedFrom('#series-anonymized-from', series, 'series', ANONYMIZED_FROM);
569d9ef165b1 Added "short", "simplify" and/or "full" options to control the format of DICOM tags wherever possible
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4525
diff changeset
841 SetupAnonymizedOrModifiedFrom('#series-modified-from', series, 'series', MODIFIED_FROM);
443
be93b666ed79 link anonymized to original resource in OrthancExplorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 405
diff changeset
842
3103
81b58b549845 back to using 'var' instead of 'let' since let is not supported by many old browsers. All variables declaration have been moved to the top of the function to better show that their scope is the function
Alain Mazy <alain@mazy.be>
parents: 3065
diff changeset
843 target = $('#list-instances');
1345
c90a4a42a3f2 simplification
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1343
diff changeset
844 $('li', target).remove();
3103
81b58b549845 back to using 'var' instead of 'let' since let is not supported by many old browsers. All variables declaration have been moved to the top of the function to better show that their scope is the function
Alain Mazy <alain@mazy.be>
parents: 3065
diff changeset
845 for (var i = 0; i < instances.length; i++) {
1345
c90a4a42a3f2 simplification
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1343
diff changeset
846 target.append(FormatInstance(instances[i], '#instance?uuid=' + instances[i].ID));
c90a4a42a3f2 simplification
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1343
diff changeset
847 }
c90a4a42a3f2 simplification
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1343
diff changeset
848 target.listview('refresh');
1343
72d1c2fc0edb Huge speed-up in Orthanc Explorer for large amount of images
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1232
diff changeset
849
1345
c90a4a42a3f2 simplification
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1343
diff changeset
850 currentPage = 'series';
2119
e0517f25919e Improved robustness of Orthanc Explorer wrt. query/retrieve (maybe fix issue 24)
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1732
diff changeset
851 currentUuid = pageData.uuid;
0
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
852 });
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
853 });
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
854 });
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
855 });
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
856 }
482
b05eb8708aee fix history in Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 443
diff changeset
857 }
0
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
858
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
859
2292
ccd44d546b47 Fix XSS inside DICOM in Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2119
diff changeset
860 function EscapeHtml(value)
ccd44d546b47 Fix XSS inside DICOM in Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2119
diff changeset
861 {
3103
81b58b549845 back to using 'var' instead of 'let' since let is not supported by many old browsers. All variables declaration have been moved to the top of the function to better show that their scope is the function
Alain Mazy <alain@mazy.be>
parents: 3065
diff changeset
862 var ENTITY_MAP = {
2292
ccd44d546b47 Fix XSS inside DICOM in Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2119
diff changeset
863 '&': '&amp;',
ccd44d546b47 Fix XSS inside DICOM in Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2119
diff changeset
864 '<': '&lt;',
ccd44d546b47 Fix XSS inside DICOM in Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2119
diff changeset
865 '>': '&gt;',
ccd44d546b47 Fix XSS inside DICOM in Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2119
diff changeset
866 '"': '&quot;',
ccd44d546b47 Fix XSS inside DICOM in Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2119
diff changeset
867 "'": '&#39;',
ccd44d546b47 Fix XSS inside DICOM in Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2119
diff changeset
868 '/': '&#x2F;',
ccd44d546b47 Fix XSS inside DICOM in Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2119
diff changeset
869 '`': '&#x60;',
ccd44d546b47 Fix XSS inside DICOM in Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2119
diff changeset
870 '=': '&#x3D;'
ccd44d546b47 Fix XSS inside DICOM in Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2119
diff changeset
871 };
ccd44d546b47 Fix XSS inside DICOM in Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2119
diff changeset
872
ccd44d546b47 Fix XSS inside DICOM in Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2119
diff changeset
873 return String(value).replace(/[&<>"'`=\/]/g, function (s) {
ccd44d546b47 Fix XSS inside DICOM in Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2119
diff changeset
874 return ENTITY_MAP[s];
ccd44d546b47 Fix XSS inside DICOM in Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2119
diff changeset
875 });
ccd44d546b47 Fix XSS inside DICOM in Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2119
diff changeset
876 }
ccd44d546b47 Fix XSS inside DICOM in Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2119
diff changeset
877
0
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
878
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
879 function ConvertForTree(dicom)
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
880 {
3103
81b58b549845 back to using 'var' instead of 'let' since let is not supported by many old browsers. All variables declaration have been moved to the top of the function to better show that their scope is the function
Alain Mazy <alain@mazy.be>
parents: 3065
diff changeset
881 var result = [];
81b58b549845 back to using 'var' instead of 'let' since let is not supported by many old browsers. All variables declaration have been moved to the top of the function to better show that their scope is the function
Alain Mazy <alain@mazy.be>
parents: 3065
diff changeset
882 var label, c;
0
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
883
3103
81b58b549845 back to using 'var' instead of 'let' since let is not supported by many old browsers. All variables declaration have been moved to the top of the function to better show that their scope is the function
Alain Mazy <alain@mazy.be>
parents: 3065
diff changeset
884 for (var i in dicom) {
35
f6d12037f886 full json vs. simplified json
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 0
diff changeset
885 if (dicom[i] != null) {
3103
81b58b549845 back to using 'var' instead of 'let' since let is not supported by many old browsers. All variables declaration have been moved to the top of the function to better show that their scope is the function
Alain Mazy <alain@mazy.be>
parents: 3065
diff changeset
886 label = (i + '<span class="tag-name"> (<i>' +
2292
ccd44d546b47 Fix XSS inside DICOM in Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2119
diff changeset
887 EscapeHtml(dicom[i]["Name"]) +
ccd44d546b47 Fix XSS inside DICOM in Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2119
diff changeset
888 '</i>)</span>: ');
35
f6d12037f886 full json vs. simplified json
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 0
diff changeset
889
f6d12037f886 full json vs. simplified json
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 0
diff changeset
890 if (dicom[i]["Type"] == 'String')
0
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
891 {
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
892 result.push({
2292
ccd44d546b47 Fix XSS inside DICOM in Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2119
diff changeset
893 label: label + '<strong>' + EscapeHtml(dicom[i]["Value"]) + '</strong>',
0
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
894 children: []
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
895 });
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
896 }
35
f6d12037f886 full json vs. simplified json
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 0
diff changeset
897 else if (dicom[i]["Type"] == 'TooLong')
0
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
898 {
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
899 result.push({
35
f6d12037f886 full json vs. simplified json
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 0
diff changeset
900 label: label + '<i>Too long</i>',
0
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
901 children: []
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
902 });
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
903 }
35
f6d12037f886 full json vs. simplified json
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 0
diff changeset
904 else if (dicom[i]["Type"] == 'Null')
f6d12037f886 full json vs. simplified json
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 0
diff changeset
905 {
f6d12037f886 full json vs. simplified json
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 0
diff changeset
906 result.push({
f6d12037f886 full json vs. simplified json
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 0
diff changeset
907 label: label + '<i>Null</i>',
f6d12037f886 full json vs. simplified json
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 0
diff changeset
908 children: []
f6d12037f886 full json vs. simplified json
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 0
diff changeset
909 });
f6d12037f886 full json vs. simplified json
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 0
diff changeset
910 }
f6d12037f886 full json vs. simplified json
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 0
diff changeset
911 else if (dicom[i]["Type"] == 'Sequence')
0
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
912 {
3103
81b58b549845 back to using 'var' instead of 'let' since let is not supported by many old browsers. All variables declaration have been moved to the top of the function to better show that their scope is the function
Alain Mazy <alain@mazy.be>
parents: 3065
diff changeset
913 c = [];
81b58b549845 back to using 'var' instead of 'let' since let is not supported by many old browsers. All variables declaration have been moved to the top of the function to better show that their scope is the function
Alain Mazy <alain@mazy.be>
parents: 3065
diff changeset
914 for (var j = 0; j < dicom[i]["Value"].length; j++) {
0
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
915 c.push({
4525
8262ffb393ff The numbering of sequences in Orthanc Explorer now uses the DICOM convention (starts at 1)
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4461
diff changeset
916 label: 'Item ' + (j + 1),
35
f6d12037f886 full json vs. simplified json
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 0
diff changeset
917 children: ConvertForTree(dicom[i]["Value"][j])
0
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
918 });
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
919 }
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
920
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
921 result.push({
35
f6d12037f886 full json vs. simplified json
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 0
diff changeset
922 label: label + '[]',
0
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
923 children: c
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
924 });
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
925 }
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
926 }
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
927 }
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
928
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
929 return result;
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
930 }
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
931
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
932
482
b05eb8708aee fix history in Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 443
diff changeset
933 function RefreshInstance()
b05eb8708aee fix history in Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 443
diff changeset
934 {
3103
81b58b549845 back to using 'var' instead of 'let' since let is not supported by many old browsers. All variables declaration have been moved to the top of the function to better show that their scope is the function
Alain Mazy <alain@mazy.be>
parents: 3065
diff changeset
935 var pageData;
81b58b549845 back to using 'var' instead of 'let' since let is not supported by many old browsers. All variables declaration have been moved to the top of the function to better show that their scope is the function
Alain Mazy <alain@mazy.be>
parents: 3065
diff changeset
936
0
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
937 if ($.mobile.pageData) {
3103
81b58b549845 back to using 'var' instead of 'let' since let is not supported by many old browsers. All variables declaration have been moved to the top of the function to better show that their scope is the function
Alain Mazy <alain@mazy.be>
parents: 3065
diff changeset
938 pageData = DeepCopy($.mobile.pageData);
2119
e0517f25919e Improved robustness of Orthanc Explorer wrt. query/retrieve (maybe fix issue 24)
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1732
diff changeset
939
4697
569d9ef165b1 Added "short", "simplify" and/or "full" options to control the format of DICOM tags wherever possible
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4525
diff changeset
940 GetResource('/instances/' + pageData.uuid + '?full', function(instance) {
569d9ef165b1 Added "short", "simplify" and/or "full" options to control the format of DICOM tags wherever possible
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4525
diff changeset
941 GetResource('/series/' + instance.ParentSeries + '?full', function(series) {
569d9ef165b1 Added "short", "simplify" and/or "full" options to control the format of DICOM tags wherever possible
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4525
diff changeset
942 GetResource('/studies/' + series.ParentStudy + '?full', function(study) {
569d9ef165b1 Added "short", "simplify" and/or "full" options to control the format of DICOM tags wherever possible
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4525
diff changeset
943 GetResource('/patients/' + study.ParentPatient + '?full', function(patient) {
152
4829c054751a improved navigation in Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 151
diff changeset
944
4829c054751a improved navigation in Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 151
diff changeset
945 $('#instance .patient-link').attr('href', '#patient?uuid=' + patient.ID);
4829c054751a improved navigation in Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 151
diff changeset
946 $('#instance .study-link').attr('href', '#study?uuid=' + study.ID);
4829c054751a improved navigation in Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 151
diff changeset
947 $('#instance .series-link').attr('href', '#series?uuid=' + series.ID);
0
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
948
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
949 $('#instance-info li').remove();
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
950 $('#instance-info')
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
951 .append('<li data-role="list-divider">Patient</li>')
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
952 .append(FormatPatient(patient, '#patient?uuid=' + patient.ID, true))
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
953 .append('<li data-role="list-divider">Study</li>')
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
954 .append(FormatStudy(study, '#study?uuid=' + study.ID, true))
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
955 .append('<li data-role="list-divider">Series</li>')
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
956 .append(FormatSeries(series, '#series?uuid=' + series.ID, true))
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
957 .append('<li data-role="list-divider">Instance</li>')
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
958 .append(FormatInstance(instance))
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
959 .listview('refresh');
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
960
1345
c90a4a42a3f2 simplification
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1343
diff changeset
961 GetResource('/instances/' + instance.ID + '/tags', function(s) {
c90a4a42a3f2 simplification
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1343
diff changeset
962 $('#dicom-tree').tree('loadData', ConvertForTree(s));
0
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
963 });
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
964
4461
22abc6851191 The DICOM meta-header and the transfer syntax are displayed at the "Instance" level
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4437
diff changeset
965 GetResource('/instances/' + instance.ID + '/header', function(s) {
22abc6851191 The DICOM meta-header and the transfer syntax are displayed at the "Instance" level
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4437
diff changeset
966 $('#dicom-metaheader').tree('loadData', ConvertForTree(s));
22abc6851191 The DICOM meta-header and the transfer syntax are displayed at the "Instance" level
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4437
diff changeset
967 });
22abc6851191 The DICOM meta-header and the transfer syntax are displayed at the "Instance" level
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4437
diff changeset
968
22abc6851191 The DICOM meta-header and the transfer syntax are displayed at the "Instance" level
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4437
diff changeset
969 $('#transfer-syntax').hide();
22abc6851191 The DICOM meta-header and the transfer syntax are displayed at the "Instance" level
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4437
diff changeset
970 GetResource('/instances/' + instance.ID + '/metadata?expand', function(s) {
22abc6851191 The DICOM meta-header and the transfer syntax are displayed at the "Instance" level
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4437
diff changeset
971 transferSyntax = s['TransferSyntax'];
22abc6851191 The DICOM meta-header and the transfer syntax are displayed at the "Instance" level
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4437
diff changeset
972 if (transferSyntax !== undefined) {
22abc6851191 The DICOM meta-header and the transfer syntax are displayed at the "Instance" level
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4437
diff changeset
973 $('#transfer-syntax').show();
22abc6851191 The DICOM meta-header and the transfer syntax are displayed at the "Instance" level
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4437
diff changeset
974 $('#transfer-syntax-text').text(transferSyntax);
22abc6851191 The DICOM meta-header and the transfer syntax are displayed at the "Instance" level
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4437
diff changeset
975 }
22abc6851191 The DICOM meta-header and the transfer syntax are displayed at the "Instance" level
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4437
diff changeset
976 });
22abc6851191 The DICOM meta-header and the transfer syntax are displayed at the "Instance" level
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4437
diff changeset
977
4697
569d9ef165b1 Added "short", "simplify" and/or "full" options to control the format of DICOM tags wherever possible
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4525
diff changeset
978 SetupAnonymizedOrModifiedFrom('#instance-anonymized-from', instance, 'instance', ANONYMIZED_FROM);
569d9ef165b1 Added "short", "simplify" and/or "full" options to control the format of DICOM tags wherever possible
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4525
diff changeset
979 SetupAnonymizedOrModifiedFrom('#instance-modified-from', instance, 'instance', MODIFIED_FROM);
515
a8be42bcf2bb Link from modified to original resource in Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 485
diff changeset
980
482
b05eb8708aee fix history in Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 443
diff changeset
981 currentPage = 'instance';
2119
e0517f25919e Improved robustness of Orthanc Explorer wrt. query/retrieve (maybe fix issue 24)
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1732
diff changeset
982 currentUuid = pageData.uuid;
0
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
983 });
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
984 });
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
985 });
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
986 });
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
987 }
482
b05eb8708aee fix history in Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 443
diff changeset
988 }
b05eb8708aee fix history in Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 443
diff changeset
989
b05eb8708aee fix history in Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 443
diff changeset
990 $(document).live('pagebeforehide', function() {
b05eb8708aee fix history in Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 443
diff changeset
991 currentPage = '';
b05eb8708aee fix history in Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 443
diff changeset
992 currentUuid = '';
0
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
993 });
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
994
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
995
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
996
482
b05eb8708aee fix history in Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 443
diff changeset
997 $('#patient').live('pagebeforeshow', RefreshPatient);
b05eb8708aee fix history in Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 443
diff changeset
998 $('#study').live('pagebeforeshow', RefreshStudy);
b05eb8708aee fix history in Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 443
diff changeset
999 $('#series').live('pagebeforeshow', RefreshSeries);
b05eb8708aee fix history in Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 443
diff changeset
1000 $('#instance').live('pagebeforeshow', RefreshInstance);
b05eb8708aee fix history in Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 443
diff changeset
1001
b05eb8708aee fix history in Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 443
diff changeset
1002 $(function() {
b05eb8708aee fix history in Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 443
diff changeset
1003 $(window).hashchange(function(e, data) {
b05eb8708aee fix history in Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 443
diff changeset
1004 // This fixes the navigation with the back button and with the anonymization
b05eb8708aee fix history in Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 443
diff changeset
1005 if ('uuid' in $.mobile.pageData &&
b05eb8708aee fix history in Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 443
diff changeset
1006 currentPage == $.mobile.pageData.active &&
b05eb8708aee fix history in Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 443
diff changeset
1007 currentUuid != $.mobile.pageData.uuid) {
1556
b8dc2f855a83 Preview of PDF files encapsulated in DICOM from Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1345
diff changeset
1008 Refresh();
482
b05eb8708aee fix history in Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 443
diff changeset
1009 }
b05eb8708aee fix history in Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 443
diff changeset
1010 });
b05eb8708aee fix history in Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 443
diff changeset
1011 });
b05eb8708aee fix history in Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 443
diff changeset
1012
b05eb8708aee fix history in Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 443
diff changeset
1013
b05eb8708aee fix history in Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 443
diff changeset
1014
b05eb8708aee fix history in Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 443
diff changeset
1015
b05eb8708aee fix history in Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 443
diff changeset
1016
0
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1017 function DeleteResource(path)
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1018 {
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1019 $.ajax({
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1020 url: path,
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1021 type: 'DELETE',
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1022 dataType: 'json',
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1023 async: false,
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1024 success: function(s) {
3103
81b58b549845 back to using 'var' instead of 'let' since let is not supported by many old browsers. All variables declaration have been moved to the top of the function to better show that their scope is the function
Alain Mazy <alain@mazy.be>
parents: 3065
diff changeset
1025 var ancestor = s.RemainingAncestor;
0
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1026 if (ancestor == null)
2929
e0c620f964e5 Go back to lookup if deleting a resource without an ancestor
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2874
diff changeset
1027 $.mobile.changePage('#lookup');
0
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1028 else
201
bee20e978835 refactoring of delete
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 165
diff changeset
1029 $.mobile.changePage('#' + ancestor.Type.toLowerCase() + '?uuid=' + ancestor.ID);
0
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1030 }
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1031 });
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1032 }
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1033
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1034
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1035
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1036 function OpenDeleteResourceDialog(path, title)
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1037 {
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1038 $(document).simpledialog2({
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1039 // http://dev.jtsage.com/jQM-SimpleDialog/demos2/
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1040 // http://dev.jtsage.com/jQM-SimpleDialog/demos2/options.html
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1041 mode: 'button',
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1042 animate: false,
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1043 headerText: title,
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1044 headerClose: true,
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1045 width: '500px',
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1046 buttons : {
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1047 'OK': {
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1048 click: function () {
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1049 DeleteResource(path);
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1050 },
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1051 icon: "delete",
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1052 theme: "c"
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1053 },
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1054 'Cancel': {
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1055 click: function () {
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1056 }
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1057 }
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1058 }
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1059 });
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1060 }
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1061
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1062
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1063
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1064 $('#instance-delete').live('click', function() {
83
a7bffca29031 relative paths
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 82
diff changeset
1065 OpenDeleteResourceDialog('../instances/' + $.mobile.pageData.uuid,
0
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1066 'Delete this instance?');
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1067 });
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1068
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1069 $('#study-delete').live('click', function() {
83
a7bffca29031 relative paths
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 82
diff changeset
1070 OpenDeleteResourceDialog('../studies/' + $.mobile.pageData.uuid,
0
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1071 'Delete this study?');
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1072 });
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1073
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1074 $('#series-delete').live('click', function() {
83
a7bffca29031 relative paths
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 82
diff changeset
1075 OpenDeleteResourceDialog('../series/' + $.mobile.pageData.uuid,
0
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1076 'Delete this series?');
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1077 });
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1078
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1079 $('#patient-delete').live('click', function() {
83
a7bffca29031 relative paths
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 82
diff changeset
1080 OpenDeleteResourceDialog('../patients/' + $.mobile.pageData.uuid,
0
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1081 'Delete this patient?');
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1082 });
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1083
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1084
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1085 $('#instance-download-dicom').live('click', function(e) {
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1086 // http://stackoverflow.com/a/1296101
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1087 e.preventDefault(); //stop the browser from following
83
a7bffca29031 relative paths
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 82
diff changeset
1088 window.location.href = '../instances/' + $.mobile.pageData.uuid + '/file';
0
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1089 });
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1090
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1091 $('#instance-download-json').live('click', function(e) {
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1092 // http://stackoverflow.com/a/1296101
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1093 e.preventDefault(); //stop the browser from following
83
a7bffca29031 relative paths
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 82
diff changeset
1094 window.location.href = '../instances/' + $.mobile.pageData.uuid + '/tags';
0
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1095 });
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1096
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1097
250
f23318b11b39 creation of zip files
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 201
diff changeset
1098
0
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1099 $('#instance-preview').live('click', function(e) {
3103
81b58b549845 back to using 'var' instead of 'let' since let is not supported by many old browsers. All variables declaration have been moved to the top of the function to better show that their scope is the function
Alain Mazy <alain@mazy.be>
parents: 3065
diff changeset
1100 var pageData, pdf, images;
81b58b549845 back to using 'var' instead of 'let' since let is not supported by many old browsers. All variables declaration have been moved to the top of the function to better show that their scope is the function
Alain Mazy <alain@mazy.be>
parents: 3065
diff changeset
1101
54
42a449dac415 multi-frame images in the explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 45
diff changeset
1102 if ($.mobile.pageData) {
3103
81b58b549845 back to using 'var' instead of 'let' since let is not supported by many old browsers. All variables declaration have been moved to the top of the function to better show that their scope is the function
Alain Mazy <alain@mazy.be>
parents: 3065
diff changeset
1103 pageData = DeepCopy($.mobile.pageData);
2119
e0517f25919e Improved robustness of Orthanc Explorer wrt. query/retrieve (maybe fix issue 24)
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1732
diff changeset
1104
3103
81b58b549845 back to using 'var' instead of 'let' since let is not supported by many old browsers. All variables declaration have been moved to the top of the function to better show that their scope is the function
Alain Mazy <alain@mazy.be>
parents: 3065
diff changeset
1105 pdf = '../instances/' + pageData.uuid + '/pdf';
1556
b8dc2f855a83 Preview of PDF files encapsulated in DICOM from Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1345
diff changeset
1106 $.ajax({
b8dc2f855a83 Preview of PDF files encapsulated in DICOM from Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1345
diff changeset
1107 url: pdf,
b8dc2f855a83 Preview of PDF files encapsulated in DICOM from Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1345
diff changeset
1108 cache: false,
b8dc2f855a83 Preview of PDF files encapsulated in DICOM from Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1345
diff changeset
1109 success: function(s) {
b8dc2f855a83 Preview of PDF files encapsulated in DICOM from Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1345
diff changeset
1110 window.location.assign(pdf);
b8dc2f855a83 Preview of PDF files encapsulated in DICOM from Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1345
diff changeset
1111 },
b8dc2f855a83 Preview of PDF files encapsulated in DICOM from Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1345
diff changeset
1112 error: function() {
2119
e0517f25919e Improved robustness of Orthanc Explorer wrt. query/retrieve (maybe fix issue 24)
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1732
diff changeset
1113 GetResource('/instances/' + pageData.uuid + '/frames', function(frames) {
1556
b8dc2f855a83 Preview of PDF files encapsulated in DICOM from Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1345
diff changeset
1114 if (frames.length == 1)
b8dc2f855a83 Preview of PDF files encapsulated in DICOM from Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1345
diff changeset
1115 {
b8dc2f855a83 Preview of PDF files encapsulated in DICOM from Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1345
diff changeset
1116 // Viewing a single-frame image
4804
ae643f664628 new option returnUnsupportedImage for /preview & /rendered routes
Alain Mazy <am@osimis.io>
parents: 4757
diff changeset
1117 jQuery.slimbox('../instances/' + pageData.uuid + '/preview?returnUnsupportedImage', '', {
1556
b8dc2f855a83 Preview of PDF files encapsulated in DICOM from Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1345
diff changeset
1118 overlayFadeDuration : 1,
b8dc2f855a83 Preview of PDF files encapsulated in DICOM from Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1345
diff changeset
1119 resizeDuration : 1,
b8dc2f855a83 Preview of PDF files encapsulated in DICOM from Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1345
diff changeset
1120 imageFadeDuration : 1
b8dc2f855a83 Preview of PDF files encapsulated in DICOM from Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1345
diff changeset
1121 });
b8dc2f855a83 Preview of PDF files encapsulated in DICOM from Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1345
diff changeset
1122 }
b8dc2f855a83 Preview of PDF files encapsulated in DICOM from Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1345
diff changeset
1123 else
b8dc2f855a83 Preview of PDF files encapsulated in DICOM from Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1345
diff changeset
1124 {
b8dc2f855a83 Preview of PDF files encapsulated in DICOM from Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1345
diff changeset
1125 // Viewing a multi-frame image
54
42a449dac415 multi-frame images in the explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 45
diff changeset
1126
3103
81b58b549845 back to using 'var' instead of 'let' since let is not supported by many old browsers. All variables declaration have been moved to the top of the function to better show that their scope is the function
Alain Mazy <alain@mazy.be>
parents: 3065
diff changeset
1127 images = [];
81b58b549845 back to using 'var' instead of 'let' since let is not supported by many old browsers. All variables declaration have been moved to the top of the function to better show that their scope is the function
Alain Mazy <alain@mazy.be>
parents: 3065
diff changeset
1128 for (var i = 0; i < frames.length; i++) {
4804
ae643f664628 new option returnUnsupportedImage for /preview & /rendered routes
Alain Mazy <am@osimis.io>
parents: 4757
diff changeset
1129 images.push([ '../instances/' + pageData.uuid + '/frames/' + i + '/preview?returnUnsupportedImage' ]);
1556
b8dc2f855a83 Preview of PDF files encapsulated in DICOM from Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1345
diff changeset
1130 }
54
42a449dac415 multi-frame images in the explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 45
diff changeset
1131
1556
b8dc2f855a83 Preview of PDF files encapsulated in DICOM from Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1345
diff changeset
1132 jQuery.slimbox(images, 0, {
b8dc2f855a83 Preview of PDF files encapsulated in DICOM from Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1345
diff changeset
1133 overlayFadeDuration : 1,
b8dc2f855a83 Preview of PDF files encapsulated in DICOM from Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1345
diff changeset
1134 resizeDuration : 1,
b8dc2f855a83 Preview of PDF files encapsulated in DICOM from Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1345
diff changeset
1135 imageFadeDuration : 1,
b8dc2f855a83 Preview of PDF files encapsulated in DICOM from Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1345
diff changeset
1136 loop : true
b8dc2f855a83 Preview of PDF files encapsulated in DICOM from Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1345
diff changeset
1137 });
b8dc2f855a83 Preview of PDF files encapsulated in DICOM from Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1345
diff changeset
1138 }
54
42a449dac415 multi-frame images in the explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 45
diff changeset
1139 });
42a449dac415 multi-frame images in the explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 45
diff changeset
1140 }
42a449dac415 multi-frame images in the explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 45
diff changeset
1141 });
42a449dac415 multi-frame images in the explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 45
diff changeset
1142 }
0
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1143 });
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1144
1343
72d1c2fc0edb Huge speed-up in Orthanc Explorer for large amount of images
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1232
diff changeset
1145
1345
c90a4a42a3f2 simplification
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1343
diff changeset
1146
0
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1147 $('#series-preview').live('click', function(e) {
3103
81b58b549845 back to using 'var' instead of 'let' since let is not supported by many old browsers. All variables declaration have been moved to the top of the function to better show that their scope is the function
Alain Mazy <alain@mazy.be>
parents: 3065
diff changeset
1148 var pageData, images;
81b58b549845 back to using 'var' instead of 'let' since let is not supported by many old browsers. All variables declaration have been moved to the top of the function to better show that their scope is the function
Alain Mazy <alain@mazy.be>
parents: 3065
diff changeset
1149
0
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1150 if ($.mobile.pageData) {
3103
81b58b549845 back to using 'var' instead of 'let' since let is not supported by many old browsers. All variables declaration have been moved to the top of the function to better show that their scope is the function
Alain Mazy <alain@mazy.be>
parents: 3065
diff changeset
1151 pageData = DeepCopy($.mobile.pageData);
2119
e0517f25919e Improved robustness of Orthanc Explorer wrt. query/retrieve (maybe fix issue 24)
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1732
diff changeset
1152
e0517f25919e Improved robustness of Orthanc Explorer wrt. query/retrieve (maybe fix issue 24)
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1732
diff changeset
1153 GetResource('/series/' + pageData.uuid, function(series) {
e0517f25919e Improved robustness of Orthanc Explorer wrt. query/retrieve (maybe fix issue 24)
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1732
diff changeset
1154 GetResource('/series/' + pageData.uuid + '/instances', function(instances) {
1345
c90a4a42a3f2 simplification
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1343
diff changeset
1155 Sort(instances, function(x) { return x.IndexInSeries; }, true, false);
0
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1156
3103
81b58b549845 back to using 'var' instead of 'let' since let is not supported by many old browsers. All variables declaration have been moved to the top of the function to better show that their scope is the function
Alain Mazy <alain@mazy.be>
parents: 3065
diff changeset
1157 images = [];
81b58b549845 back to using 'var' instead of 'let' since let is not supported by many old browsers. All variables declaration have been moved to the top of the function to better show that their scope is the function
Alain Mazy <alain@mazy.be>
parents: 3065
diff changeset
1158 for (var i = 0; i < instances.length; i++) {
4804
ae643f664628 new option returnUnsupportedImage for /preview & /rendered routes
Alain Mazy <am@osimis.io>
parents: 4757
diff changeset
1159 images.push([ '../instances/' + instances[i].ID + '/preview?returnUnsupportedImage',
2292
ccd44d546b47 Fix XSS inside DICOM in Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2119
diff changeset
1160 (i + 1).toString() + '/' + instances.length.toString() ])
1345
c90a4a42a3f2 simplification
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1343
diff changeset
1161 }
1343
72d1c2fc0edb Huge speed-up in Orthanc Explorer for large amount of images
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1232
diff changeset
1162
1345
c90a4a42a3f2 simplification
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1343
diff changeset
1163 jQuery.slimbox(images, 0, {
c90a4a42a3f2 simplification
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1343
diff changeset
1164 overlayFadeDuration : 1,
c90a4a42a3f2 simplification
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1343
diff changeset
1165 resizeDuration : 1,
c90a4a42a3f2 simplification
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1343
diff changeset
1166 imageFadeDuration : 1,
c90a4a42a3f2 simplification
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1343
diff changeset
1167 loop : true
c90a4a42a3f2 simplification
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1343
diff changeset
1168 });
1343
72d1c2fc0edb Huge speed-up in Orthanc Explorer for large amount of images
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1232
diff changeset
1169 });
0
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1170 });
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1171 }
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1172 });
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1173
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1174
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1175
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1176
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1177
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1178 function ChooseDicomModality(callback)
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1179 {
3103
81b58b549845 back to using 'var' instead of 'let' since let is not supported by many old browsers. All variables declaration have been moved to the top of the function to better show that their scope is the function
Alain Mazy <alain@mazy.be>
parents: 3065
diff changeset
1180 var clickedModality = '';
81b58b549845 back to using 'var' instead of 'let' since let is not supported by many old browsers. All variables declaration have been moved to the top of the function to better show that their scope is the function
Alain Mazy <alain@mazy.be>
parents: 3065
diff changeset
1181 var clickedPeer = '';
81b58b549845 back to using 'var' instead of 'let' since let is not supported by many old browsers. All variables declaration have been moved to the top of the function to better show that their scope is the function
Alain Mazy <alain@mazy.be>
parents: 3065
diff changeset
1182 var items = $('<ul>')
485
bdbde1fbfab3 send resources through HTTP
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 484
diff changeset
1183 .attr('data-divider-theme', 'd')
bdbde1fbfab3 send resources through HTTP
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 484
diff changeset
1184 .attr('data-role', 'listview');
bdbde1fbfab3 send resources through HTTP
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 484
diff changeset
1185
bdbde1fbfab3 send resources through HTTP
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 484
diff changeset
1186 // Retrieve the list of the known DICOM modalities
0
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1187 $.ajax({
83
a7bffca29031 relative paths
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 82
diff changeset
1188 url: '../modalities',
0
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1189 type: 'GET',
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1190 dataType: 'json',
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1191 async: false,
344
cd6749e53a03 anonymization from orthanc explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 274
diff changeset
1192 cache: false,
0
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1193 success: function(modalities) {
3103
81b58b549845 back to using 'var' instead of 'let' since let is not supported by many old browsers. All variables declaration have been moved to the top of the function to better show that their scope is the function
Alain Mazy <alain@mazy.be>
parents: 3065
diff changeset
1194 var name, item;
81b58b549845 back to using 'var' instead of 'let' since let is not supported by many old browsers. All variables declaration have been moved to the top of the function to better show that their scope is the function
Alain Mazy <alain@mazy.be>
parents: 3065
diff changeset
1195
485
bdbde1fbfab3 send resources through HTTP
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 484
diff changeset
1196 if (modalities.length > 0)
bdbde1fbfab3 send resources through HTTP
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 484
diff changeset
1197 {
bdbde1fbfab3 send resources through HTTP
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 484
diff changeset
1198 items.append('<li data-role="list-divider">DICOM modalities</li>');
484
b8ace6fc1d1f preparation for handling Orthanc peers
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 482
diff changeset
1199
3103
81b58b549845 back to using 'var' instead of 'let' since let is not supported by many old browsers. All variables declaration have been moved to the top of the function to better show that their scope is the function
Alain Mazy <alain@mazy.be>
parents: 3065
diff changeset
1200 for (var i = 0; i < modalities.length; i++) {
81b58b549845 back to using 'var' instead of 'let' since let is not supported by many old browsers. All variables declaration have been moved to the top of the function to better show that their scope is the function
Alain Mazy <alain@mazy.be>
parents: 3065
diff changeset
1201 name = modalities[i];
81b58b549845 back to using 'var' instead of 'let' since let is not supported by many old browsers. All variables declaration have been moved to the top of the function to better show that their scope is the function
Alain Mazy <alain@mazy.be>
parents: 3065
diff changeset
1202 item = $('<li>')
485
bdbde1fbfab3 send resources through HTTP
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 484
diff changeset
1203 .html('<a href="#" rel="close">' + name + '</a>')
bdbde1fbfab3 send resources through HTTP
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 484
diff changeset
1204 .attr('name', name)
bdbde1fbfab3 send resources through HTTP
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 484
diff changeset
1205 .click(function() {
bdbde1fbfab3 send resources through HTTP
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 484
diff changeset
1206 clickedModality = $(this).attr('name');
bdbde1fbfab3 send resources through HTTP
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 484
diff changeset
1207 });
bdbde1fbfab3 send resources through HTTP
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 484
diff changeset
1208 items.append(item);
bdbde1fbfab3 send resources through HTTP
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 484
diff changeset
1209 }
0
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1210 }
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1211
485
bdbde1fbfab3 send resources through HTTP
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 484
diff changeset
1212 // Retrieve the list of the known Orthanc peers
bdbde1fbfab3 send resources through HTTP
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 484
diff changeset
1213 $.ajax({
bdbde1fbfab3 send resources through HTTP
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 484
diff changeset
1214 url: '../peers',
bdbde1fbfab3 send resources through HTTP
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 484
diff changeset
1215 type: 'GET',
bdbde1fbfab3 send resources through HTTP
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 484
diff changeset
1216 dataType: 'json',
bdbde1fbfab3 send resources through HTTP
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 484
diff changeset
1217 async: false,
bdbde1fbfab3 send resources through HTTP
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 484
diff changeset
1218 cache: false,
bdbde1fbfab3 send resources through HTTP
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 484
diff changeset
1219 success: function(peers) {
3103
81b58b549845 back to using 'var' instead of 'let' since let is not supported by many old browsers. All variables declaration have been moved to the top of the function to better show that their scope is the function
Alain Mazy <alain@mazy.be>
parents: 3065
diff changeset
1220 var name, item;
81b58b549845 back to using 'var' instead of 'let' since let is not supported by many old browsers. All variables declaration have been moved to the top of the function to better show that their scope is the function
Alain Mazy <alain@mazy.be>
parents: 3065
diff changeset
1221
485
bdbde1fbfab3 send resources through HTTP
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 484
diff changeset
1222 if (peers.length > 0)
bdbde1fbfab3 send resources through HTTP
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 484
diff changeset
1223 {
bdbde1fbfab3 send resources through HTTP
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 484
diff changeset
1224 items.append('<li data-role="list-divider">Orthanc peers</li>');
484
b8ace6fc1d1f preparation for handling Orthanc peers
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 482
diff changeset
1225
3103
81b58b549845 back to using 'var' instead of 'let' since let is not supported by many old browsers. All variables declaration have been moved to the top of the function to better show that their scope is the function
Alain Mazy <alain@mazy.be>
parents: 3065
diff changeset
1226 for (var i = 0; i < peers.length; i++) {
81b58b549845 back to using 'var' instead of 'let' since let is not supported by many old browsers. All variables declaration have been moved to the top of the function to better show that their scope is the function
Alain Mazy <alain@mazy.be>
parents: 3065
diff changeset
1227 name = peers[i];
81b58b549845 back to using 'var' instead of 'let' since let is not supported by many old browsers. All variables declaration have been moved to the top of the function to better show that their scope is the function
Alain Mazy <alain@mazy.be>
parents: 3065
diff changeset
1228 item = $('<li>')
485
bdbde1fbfab3 send resources through HTTP
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 484
diff changeset
1229 .html('<a href="#" rel="close">' + name + '</a>')
bdbde1fbfab3 send resources through HTTP
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 484
diff changeset
1230 .attr('name', name)
bdbde1fbfab3 send resources through HTTP
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 484
diff changeset
1231 .click(function() {
bdbde1fbfab3 send resources through HTTP
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 484
diff changeset
1232 clickedPeer = $(this).attr('name');
bdbde1fbfab3 send resources through HTTP
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 484
diff changeset
1233 });
bdbde1fbfab3 send resources through HTTP
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 484
diff changeset
1234 items.append(item);
0
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1235 }
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1236 }
485
bdbde1fbfab3 send resources through HTTP
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 484
diff changeset
1237
bdbde1fbfab3 send resources through HTTP
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 484
diff changeset
1238 // Launch the dialog
bdbde1fbfab3 send resources through HTTP
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 484
diff changeset
1239 $('#dialog').simpledialog2({
bdbde1fbfab3 send resources through HTTP
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 484
diff changeset
1240 mode: 'blank',
bdbde1fbfab3 send resources through HTTP
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 484
diff changeset
1241 animate: false,
bdbde1fbfab3 send resources through HTTP
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 484
diff changeset
1242 headerText: 'Choose target',
bdbde1fbfab3 send resources through HTTP
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 484
diff changeset
1243 headerClose: true,
bdbde1fbfab3 send resources through HTTP
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 484
diff changeset
1244 forceInput: false,
bdbde1fbfab3 send resources through HTTP
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 484
diff changeset
1245 width: '100%',
bdbde1fbfab3 send resources through HTTP
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 484
diff changeset
1246 blankContent: items,
bdbde1fbfab3 send resources through HTTP
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 484
diff changeset
1247 callbackClose: function() {
3103
81b58b549845 back to using 'var' instead of 'let' since let is not supported by many old browsers. All variables declaration have been moved to the top of the function to better show that their scope is the function
Alain Mazy <alain@mazy.be>
parents: 3065
diff changeset
1248 var timer;
485
bdbde1fbfab3 send resources through HTTP
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 484
diff changeset
1249 function WaitForDialogToClose() {
bdbde1fbfab3 send resources through HTTP
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 484
diff changeset
1250 if (!$('#dialog').is(':visible')) {
bdbde1fbfab3 send resources through HTTP
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 484
diff changeset
1251 clearInterval(timer);
bdbde1fbfab3 send resources through HTTP
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 484
diff changeset
1252 callback(clickedModality, clickedPeer);
bdbde1fbfab3 send resources through HTTP
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 484
diff changeset
1253 }
bdbde1fbfab3 send resources through HTTP
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 484
diff changeset
1254 }
bdbde1fbfab3 send resources through HTTP
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 484
diff changeset
1255 timer = setInterval(WaitForDialogToClose, 100);
bdbde1fbfab3 send resources through HTTP
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 484
diff changeset
1256 }
bdbde1fbfab3 send resources through HTTP
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 484
diff changeset
1257 });
0
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1258 }
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1259 });
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1260 }
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1261 });
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1262 }
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1263
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1264
405
97a00b30abcc sending of studies and patients with orthanc explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 354
diff changeset
1265 $('#instance-store,#series-store,#study-store,#patient-store').live('click', function(e) {
485
bdbde1fbfab3 send resources through HTTP
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 484
diff changeset
1266 ChooseDicomModality(function(modality, peer) {
3103
81b58b549845 back to using 'var' instead of 'let' since let is not supported by many old browsers. All variables declaration have been moved to the top of the function to better show that their scope is the function
Alain Mazy <alain@mazy.be>
parents: 3065
diff changeset
1267 var pageData = DeepCopy($.mobile.pageData);
81b58b549845 back to using 'var' instead of 'let' since let is not supported by many old browsers. All variables declaration have been moved to the top of the function to better show that their scope is the function
Alain Mazy <alain@mazy.be>
parents: 3065
diff changeset
1268 var url, loading;
485
bdbde1fbfab3 send resources through HTTP
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 484
diff changeset
1269
bdbde1fbfab3 send resources through HTTP
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 484
diff changeset
1270 if (modality != '')
bdbde1fbfab3 send resources through HTTP
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 484
diff changeset
1271 {
bdbde1fbfab3 send resources through HTTP
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 484
diff changeset
1272 url = '../modalities/' + modality + '/store';
bdbde1fbfab3 send resources through HTTP
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 484
diff changeset
1273 loading = '#dicom-store';
bdbde1fbfab3 send resources through HTTP
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 484
diff changeset
1274 }
bdbde1fbfab3 send resources through HTTP
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 484
diff changeset
1275
bdbde1fbfab3 send resources through HTTP
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 484
diff changeset
1276 if (peer != '')
bdbde1fbfab3 send resources through HTTP
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 484
diff changeset
1277 {
bdbde1fbfab3 send resources through HTTP
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 484
diff changeset
1278 url = '../peers/' + peer + '/store';
bdbde1fbfab3 send resources through HTTP
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 484
diff changeset
1279 loading = '#peer-store';
bdbde1fbfab3 send resources through HTTP
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 484
diff changeset
1280 }
bdbde1fbfab3 send resources through HTTP
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 484
diff changeset
1281
bdbde1fbfab3 send resources through HTTP
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 484
diff changeset
1282 if (url != '') {
4749
1a061bc2d6ca Clicking on "Send to remote modality" displays the job information to monitor progress
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4731
diff changeset
1283 /**
1a061bc2d6ca Clicking on "Send to remote modality" displays the job information to monitor progress
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4731
diff changeset
1284 * In Orthanc <= 1.9.5, synchronous job was used, which caused a
1a061bc2d6ca Clicking on "Send to remote modality" displays the job information to monitor progress
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4731
diff changeset
1285 * non-intuitive behavior because of AJAX timeouts on large
1a061bc2d6ca Clicking on "Send to remote modality" displays the job information to monitor progress
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4731
diff changeset
1286 * studies. We now use an asynchronous call.
1a061bc2d6ca Clicking on "Send to remote modality" displays the job information to monitor progress
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4731
diff changeset
1287 * https://groups.google.com/g/orthanc-users/c/r2LoAp72AWI/m/cVaFXopUBAAJ
1a061bc2d6ca Clicking on "Send to remote modality" displays the job information to monitor progress
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4731
diff changeset
1288 **/
0
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1289 $.ajax({
485
bdbde1fbfab3 send resources through HTTP
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 484
diff changeset
1290 url: url,
0
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1291 type: 'POST',
4749
1a061bc2d6ca Clicking on "Send to remote modality" displays the job information to monitor progress
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4731
diff changeset
1292 data: JSON.stringify({
1a061bc2d6ca Clicking on "Send to remote modality" displays the job information to monitor progress
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4731
diff changeset
1293 'Synchronous' : false,
1a061bc2d6ca Clicking on "Send to remote modality" displays the job information to monitor progress
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4731
diff changeset
1294 'Resources' : [ pageData.uuid ]
1a061bc2d6ca Clicking on "Send to remote modality" displays the job information to monitor progress
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4731
diff changeset
1295 }),
1a061bc2d6ca Clicking on "Send to remote modality" displays the job information to monitor progress
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4731
diff changeset
1296 dataType: 'json',
1a061bc2d6ca Clicking on "Send to remote modality" displays the job information to monitor progress
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4731
diff changeset
1297 async: false,
1a061bc2d6ca Clicking on "Send to remote modality" displays the job information to monitor progress
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4731
diff changeset
1298 success: function(job) {
1a061bc2d6ca Clicking on "Send to remote modality" displays the job information to monitor progress
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4731
diff changeset
1299 window.location.assign('explorer.html#job?uuid=' + job.ID);
0
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1300 },
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1301 error: function() {
485
bdbde1fbfab3 send resources through HTTP
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 484
diff changeset
1302 alert('Error during store');
0
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1303 }
485
bdbde1fbfab3 send resources through HTTP
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 484
diff changeset
1304 });
0
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1305 }
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1306 });
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1307 });
35
f6d12037f886 full json vs. simplified json
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 0
diff changeset
1308
f6d12037f886 full json vs. simplified json
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 0
diff changeset
1309
f6d12037f886 full json vs. simplified json
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 0
diff changeset
1310 $('#show-tag-name').live('change', function(e) {
3103
81b58b549845 back to using 'var' instead of 'let' since let is not supported by many old browsers. All variables declaration have been moved to the top of the function to better show that their scope is the function
Alain Mazy <alain@mazy.be>
parents: 3065
diff changeset
1311 var checked = e.currentTarget.checked;
35
f6d12037f886 full json vs. simplified json
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 0
diff changeset
1312 if (checked)
f6d12037f886 full json vs. simplified json
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 0
diff changeset
1313 $('.tag-name').show();
f6d12037f886 full json vs. simplified json
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 0
diff changeset
1314 else
f6d12037f886 full json vs. simplified json
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 0
diff changeset
1315 $('.tag-name').hide();
f6d12037f886 full json vs. simplified json
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 0
diff changeset
1316 });
250
f23318b11b39 creation of zip files
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 201
diff changeset
1317
f23318b11b39 creation of zip files
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 201
diff changeset
1318
f23318b11b39 creation of zip files
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 201
diff changeset
1319 $('#patient-archive').live('click', function(e) {
f23318b11b39 creation of zip files
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 201
diff changeset
1320 e.preventDefault(); //stop the browser from following
f23318b11b39 creation of zip files
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 201
diff changeset
1321 window.location.href = '../patients/' + $.mobile.pageData.uuid + '/archive';
f23318b11b39 creation of zip files
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 201
diff changeset
1322 });
f23318b11b39 creation of zip files
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 201
diff changeset
1323
f23318b11b39 creation of zip files
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 201
diff changeset
1324 $('#study-archive').live('click', function(e) {
f23318b11b39 creation of zip files
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 201
diff changeset
1325 e.preventDefault(); //stop the browser from following
f23318b11b39 creation of zip files
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 201
diff changeset
1326 window.location.href = '../studies/' + $.mobile.pageData.uuid + '/archive';
f23318b11b39 creation of zip files
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 201
diff changeset
1327 });
f23318b11b39 creation of zip files
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 201
diff changeset
1328
f23318b11b39 creation of zip files
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 201
diff changeset
1329 $('#series-archive').live('click', function(e) {
f23318b11b39 creation of zip files
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 201
diff changeset
1330 e.preventDefault(); //stop the browser from following
f23318b11b39 creation of zip files
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 201
diff changeset
1331 window.location.href = '../series/' + $.mobile.pageData.uuid + '/archive';
f23318b11b39 creation of zip files
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 201
diff changeset
1332 });
f23318b11b39 creation of zip files
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 201
diff changeset
1333
1188
2e11c3353356 download dicomdir in Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 515
diff changeset
1334
2e11c3353356 download dicomdir in Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 515
diff changeset
1335 $('#patient-media').live('click', function(e) {
2e11c3353356 download dicomdir in Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 515
diff changeset
1336 e.preventDefault(); //stop the browser from following
2e11c3353356 download dicomdir in Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 515
diff changeset
1337 window.location.href = '../patients/' + $.mobile.pageData.uuid + '/media';
2e11c3353356 download dicomdir in Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 515
diff changeset
1338 });
2e11c3353356 download dicomdir in Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 515
diff changeset
1339
2e11c3353356 download dicomdir in Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 515
diff changeset
1340 $('#study-media').live('click', function(e) {
2e11c3353356 download dicomdir in Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 515
diff changeset
1341 e.preventDefault(); //stop the browser from following
2e11c3353356 download dicomdir in Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 515
diff changeset
1342 window.location.href = '../studies/' + $.mobile.pageData.uuid + '/media';
2e11c3353356 download dicomdir in Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 515
diff changeset
1343 });
2e11c3353356 download dicomdir in Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 515
diff changeset
1344
2e11c3353356 download dicomdir in Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 515
diff changeset
1345 $('#series-media').live('click', function(e) {
2e11c3353356 download dicomdir in Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 515
diff changeset
1346 e.preventDefault(); //stop the browser from following
2e11c3353356 download dicomdir in Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 515
diff changeset
1347 window.location.href = '../series/' + $.mobile.pageData.uuid + '/media';
2e11c3353356 download dicomdir in Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 515
diff changeset
1348 });
2e11c3353356 download dicomdir in Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 515
diff changeset
1349
2e11c3353356 download dicomdir in Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 515
diff changeset
1350
2e11c3353356 download dicomdir in Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 515
diff changeset
1351
274
f2286c741109 patient protection in Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 250
diff changeset
1352 $('#protection').live('change', function(e) {
3103
81b58b549845 back to using 'var' instead of 'let' since let is not supported by many old browsers. All variables declaration have been moved to the top of the function to better show that their scope is the function
Alain Mazy <alain@mazy.be>
parents: 3065
diff changeset
1353 var isProtected = e.target.value == "on";
274
f2286c741109 patient protection in Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 250
diff changeset
1354 $.ajax({
f2286c741109 patient protection in Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 250
diff changeset
1355 url: '../patients/' + $.mobile.pageData.uuid + '/protected',
f2286c741109 patient protection in Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 250
diff changeset
1356 type: 'PUT',
f2286c741109 patient protection in Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 250
diff changeset
1357 dataType: 'text',
f2286c741109 patient protection in Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 250
diff changeset
1358 data: isProtected ? '1' : '0',
f2286c741109 patient protection in Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 250
diff changeset
1359 async: false
f2286c741109 patient protection in Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 250
diff changeset
1360 });
f2286c741109 patient protection in Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 250
diff changeset
1361 });
344
cd6749e53a03 anonymization from orthanc explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 274
diff changeset
1362
cd6749e53a03 anonymization from orthanc explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 274
diff changeset
1363
cd6749e53a03 anonymization from orthanc explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 274
diff changeset
1364
cd6749e53a03 anonymization from orthanc explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 274
diff changeset
1365 function OpenAnonymizeResourceDialog(path, title)
cd6749e53a03 anonymization from orthanc explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 274
diff changeset
1366 {
cd6749e53a03 anonymization from orthanc explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 274
diff changeset
1367 $(document).simpledialog2({
cd6749e53a03 anonymization from orthanc explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 274
diff changeset
1368 mode: 'button',
cd6749e53a03 anonymization from orthanc explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 274
diff changeset
1369 animate: false,
cd6749e53a03 anonymization from orthanc explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 274
diff changeset
1370 headerText: title,
cd6749e53a03 anonymization from orthanc explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 274
diff changeset
1371 headerClose: true,
cd6749e53a03 anonymization from orthanc explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 274
diff changeset
1372 width: '500px',
cd6749e53a03 anonymization from orthanc explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 274
diff changeset
1373 buttons : {
cd6749e53a03 anonymization from orthanc explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 274
diff changeset
1374 'OK': {
cd6749e53a03 anonymization from orthanc explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 274
diff changeset
1375 click: function () {
cd6749e53a03 anonymization from orthanc explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 274
diff changeset
1376 $.ajax({
cd6749e53a03 anonymization from orthanc explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 274
diff changeset
1377 url: path + '/anonymize',
cd6749e53a03 anonymization from orthanc explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 274
diff changeset
1378 type: 'POST',
354
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 351
diff changeset
1379 data: '{ "Keep" : [ "SeriesDescription", "StudyDescription" ] }',
344
cd6749e53a03 anonymization from orthanc explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 274
diff changeset
1380 dataType: 'json',
cd6749e53a03 anonymization from orthanc explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 274
diff changeset
1381 async: false,
cd6749e53a03 anonymization from orthanc explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 274
diff changeset
1382 cache: false,
cd6749e53a03 anonymization from orthanc explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 274
diff changeset
1383 success: function(s) {
351
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 347
diff changeset
1384 // The following line does not work...
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 347
diff changeset
1385 //$.mobile.changePage('explorer.html#patient?uuid=' + s.PatientID);
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 347
diff changeset
1386
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 347
diff changeset
1387 window.location.assign('explorer.html#patient?uuid=' + s.PatientID);
482
b05eb8708aee fix history in Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 443
diff changeset
1388 //window.location.reload();
344
cd6749e53a03 anonymization from orthanc explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 274
diff changeset
1389 }
cd6749e53a03 anonymization from orthanc explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 274
diff changeset
1390 });
cd6749e53a03 anonymization from orthanc explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 274
diff changeset
1391 },
cd6749e53a03 anonymization from orthanc explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 274
diff changeset
1392 icon: "delete",
cd6749e53a03 anonymization from orthanc explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 274
diff changeset
1393 theme: "c"
cd6749e53a03 anonymization from orthanc explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 274
diff changeset
1394 },
cd6749e53a03 anonymization from orthanc explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 274
diff changeset
1395 'Cancel': {
cd6749e53a03 anonymization from orthanc explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 274
diff changeset
1396 click: function () {
cd6749e53a03 anonymization from orthanc explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 274
diff changeset
1397 }
cd6749e53a03 anonymization from orthanc explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 274
diff changeset
1398 }
cd6749e53a03 anonymization from orthanc explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 274
diff changeset
1399 }
cd6749e53a03 anonymization from orthanc explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 274
diff changeset
1400 });
cd6749e53a03 anonymization from orthanc explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 274
diff changeset
1401 }
cd6749e53a03 anonymization from orthanc explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 274
diff changeset
1402
cd6749e53a03 anonymization from orthanc explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 274
diff changeset
1403 $('#instance-anonymize').live('click', function() {
cd6749e53a03 anonymization from orthanc explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 274
diff changeset
1404 OpenAnonymizeResourceDialog('../instances/' + $.mobile.pageData.uuid,
cd6749e53a03 anonymization from orthanc explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 274
diff changeset
1405 'Anonymize this instance?');
cd6749e53a03 anonymization from orthanc explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 274
diff changeset
1406 });
cd6749e53a03 anonymization from orthanc explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 274
diff changeset
1407
cd6749e53a03 anonymization from orthanc explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 274
diff changeset
1408 $('#study-anonymize').live('click', function() {
cd6749e53a03 anonymization from orthanc explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 274
diff changeset
1409 OpenAnonymizeResourceDialog('../studies/' + $.mobile.pageData.uuid,
cd6749e53a03 anonymization from orthanc explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 274
diff changeset
1410 'Anonymize this study?');
cd6749e53a03 anonymization from orthanc explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 274
diff changeset
1411 });
cd6749e53a03 anonymization from orthanc explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 274
diff changeset
1412
cd6749e53a03 anonymization from orthanc explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 274
diff changeset
1413 $('#series-anonymize').live('click', function() {
cd6749e53a03 anonymization from orthanc explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 274
diff changeset
1414 OpenAnonymizeResourceDialog('../series/' + $.mobile.pageData.uuid,
cd6749e53a03 anonymization from orthanc explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 274
diff changeset
1415 'Anonymize this series?');
cd6749e53a03 anonymization from orthanc explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 274
diff changeset
1416 });
351
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 347
diff changeset
1417
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 347
diff changeset
1418 $('#patient-anonymize').live('click', function() {
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 347
diff changeset
1419 OpenAnonymizeResourceDialog('../patients/' + $.mobile.pageData.uuid,
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 347
diff changeset
1420 'Anonymize this patient?');
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 347
diff changeset
1421 });
1232
f1c01451a8ee Introspection of plugins, Plugins can extend Orthanc Explorer with custom JavaScript
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1188
diff changeset
1422
f1c01451a8ee Introspection of plugins, Plugins can extend Orthanc Explorer with custom JavaScript
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1188
diff changeset
1423
f1c01451a8ee Introspection of plugins, Plugins can extend Orthanc Explorer with custom JavaScript
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1188
diff changeset
1424 $('#plugins').live('pagebeforeshow', function() {
f1c01451a8ee Introspection of plugins, Plugins can extend Orthanc Explorer with custom JavaScript
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1188
diff changeset
1425 $.ajax({
f1c01451a8ee Introspection of plugins, Plugins can extend Orthanc Explorer with custom JavaScript
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1188
diff changeset
1426 url: '../plugins',
f1c01451a8ee Introspection of plugins, Plugins can extend Orthanc Explorer with custom JavaScript
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1188
diff changeset
1427 dataType: 'json',
f1c01451a8ee Introspection of plugins, Plugins can extend Orthanc Explorer with custom JavaScript
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1188
diff changeset
1428 async: false,
f1c01451a8ee Introspection of plugins, Plugins can extend Orthanc Explorer with custom JavaScript
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1188
diff changeset
1429 cache: false,
f1c01451a8ee Introspection of plugins, Plugins can extend Orthanc Explorer with custom JavaScript
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1188
diff changeset
1430 success: function(plugins) {
3103
81b58b549845 back to using 'var' instead of 'let' since let is not supported by many old browsers. All variables declaration have been moved to the top of the function to better show that their scope is the function
Alain Mazy <alain@mazy.be>
parents: 3065
diff changeset
1431 var target = $('#all-plugins');
1232
f1c01451a8ee Introspection of plugins, Plugins can extend Orthanc Explorer with custom JavaScript
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1188
diff changeset
1432 $('li', target).remove();
f1c01451a8ee Introspection of plugins, Plugins can extend Orthanc Explorer with custom JavaScript
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1188
diff changeset
1433
f1c01451a8ee Introspection of plugins, Plugins can extend Orthanc Explorer with custom JavaScript
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1188
diff changeset
1434 plugins.map(function(id) {
f1c01451a8ee Introspection of plugins, Plugins can extend Orthanc Explorer with custom JavaScript
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1188
diff changeset
1435 return $.ajax({
f1c01451a8ee Introspection of plugins, Plugins can extend Orthanc Explorer with custom JavaScript
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1188
diff changeset
1436 url: '../plugins/' + id,
f1c01451a8ee Introspection of plugins, Plugins can extend Orthanc Explorer with custom JavaScript
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1188
diff changeset
1437 dataType: 'json',
f1c01451a8ee Introspection of plugins, Plugins can extend Orthanc Explorer with custom JavaScript
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1188
diff changeset
1438 async: false,
f1c01451a8ee Introspection of plugins, Plugins can extend Orthanc Explorer with custom JavaScript
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1188
diff changeset
1439 cache: false,
f1c01451a8ee Introspection of plugins, Plugins can extend Orthanc Explorer with custom JavaScript
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1188
diff changeset
1440 success: function(plugin) {
3103
81b58b549845 back to using 'var' instead of 'let' since let is not supported by many old browsers. All variables declaration have been moved to the top of the function to better show that their scope is the function
Alain Mazy <alain@mazy.be>
parents: 3065
diff changeset
1441 var li = $('<li>');
81b58b549845 back to using 'var' instead of 'let' since let is not supported by many old browsers. All variables declaration have been moved to the top of the function to better show that their scope is the function
Alain Mazy <alain@mazy.be>
parents: 3065
diff changeset
1442 var item = li;
1232
f1c01451a8ee Introspection of plugins, Plugins can extend Orthanc Explorer with custom JavaScript
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1188
diff changeset
1443
f1c01451a8ee Introspection of plugins, Plugins can extend Orthanc Explorer with custom JavaScript
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1188
diff changeset
1444 if ('RootUri' in plugin)
f1c01451a8ee Introspection of plugins, Plugins can extend Orthanc Explorer with custom JavaScript
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1188
diff changeset
1445 {
f1c01451a8ee Introspection of plugins, Plugins can extend Orthanc Explorer with custom JavaScript
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1188
diff changeset
1446 item = $('<a>');
f1c01451a8ee Introspection of plugins, Plugins can extend Orthanc Explorer with custom JavaScript
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1188
diff changeset
1447 li.append(item);
f1c01451a8ee Introspection of plugins, Plugins can extend Orthanc Explorer with custom JavaScript
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1188
diff changeset
1448 item.click(function() {
f1c01451a8ee Introspection of plugins, Plugins can extend Orthanc Explorer with custom JavaScript
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1188
diff changeset
1449 window.open(plugin.RootUri);
f1c01451a8ee Introspection of plugins, Plugins can extend Orthanc Explorer with custom JavaScript
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1188
diff changeset
1450 });
f1c01451a8ee Introspection of plugins, Plugins can extend Orthanc Explorer with custom JavaScript
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1188
diff changeset
1451 }
f1c01451a8ee Introspection of plugins, Plugins can extend Orthanc Explorer with custom JavaScript
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1188
diff changeset
1452
f1c01451a8ee Introspection of plugins, Plugins can extend Orthanc Explorer with custom JavaScript
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1188
diff changeset
1453 item.append($('<h1>').text(plugin.ID));
f1c01451a8ee Introspection of plugins, Plugins can extend Orthanc Explorer with custom JavaScript
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1188
diff changeset
1454 item.append($('<p>').text(plugin.Description));
f1c01451a8ee Introspection of plugins, Plugins can extend Orthanc Explorer with custom JavaScript
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1188
diff changeset
1455 item.append($('<span>').addClass('ui-li-count').text(plugin.Version));
f1c01451a8ee Introspection of plugins, Plugins can extend Orthanc Explorer with custom JavaScript
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1188
diff changeset
1456 target.append(li);
f1c01451a8ee Introspection of plugins, Plugins can extend Orthanc Explorer with custom JavaScript
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1188
diff changeset
1457 }
f1c01451a8ee Introspection of plugins, Plugins can extend Orthanc Explorer with custom JavaScript
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1188
diff changeset
1458 });
f1c01451a8ee Introspection of plugins, Plugins can extend Orthanc Explorer with custom JavaScript
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1188
diff changeset
1459 });
f1c01451a8ee Introspection of plugins, Plugins can extend Orthanc Explorer with custom JavaScript
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1188
diff changeset
1460
f1c01451a8ee Introspection of plugins, Plugins can extend Orthanc Explorer with custom JavaScript
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1188
diff changeset
1461 target.listview('refresh');
f1c01451a8ee Introspection of plugins, Plugins can extend Orthanc Explorer with custom JavaScript
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1188
diff changeset
1462 }
f1c01451a8ee Introspection of plugins, Plugins can extend Orthanc Explorer with custom JavaScript
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1188
diff changeset
1463 });
f1c01451a8ee Introspection of plugins, Plugins can extend Orthanc Explorer with custom JavaScript
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1188
diff changeset
1464 });
2573
3372c5255333 StoreScuJob, Orthanc Explorer for jobs
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2336
diff changeset
1465
3372c5255333 StoreScuJob, Orthanc Explorer for jobs
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2336
diff changeset
1466
3372c5255333 StoreScuJob, Orthanc Explorer for jobs
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2336
diff changeset
1467
3372c5255333 StoreScuJob, Orthanc Explorer for jobs
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2336
diff changeset
1468 function ParseJobTime(s)
3372c5255333 StoreScuJob, Orthanc Explorer for jobs
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2336
diff changeset
1469 {
3103
81b58b549845 back to using 'var' instead of 'let' since let is not supported by many old browsers. All variables declaration have been moved to the top of the function to better show that their scope is the function
Alain Mazy <alain@mazy.be>
parents: 3065
diff changeset
1470 var t = (s.substr(0, 4) + '-' +
2573
3372c5255333 StoreScuJob, Orthanc Explorer for jobs
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2336
diff changeset
1471 s.substr(4, 2) + '-' +
3372c5255333 StoreScuJob, Orthanc Explorer for jobs
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2336
diff changeset
1472 s.substr(6, 5) + ':' +
3372c5255333 StoreScuJob, Orthanc Explorer for jobs
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2336
diff changeset
1473 s.substr(11, 2) + ':' +
3372c5255333 StoreScuJob, Orthanc Explorer for jobs
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2336
diff changeset
1474 s.substr(13));
3103
81b58b549845 back to using 'var' instead of 'let' since let is not supported by many old browsers. All variables declaration have been moved to the top of the function to better show that their scope is the function
Alain Mazy <alain@mazy.be>
parents: 3065
diff changeset
1475 var utc = new Date(t);
2573
3372c5255333 StoreScuJob, Orthanc Explorer for jobs
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2336
diff changeset
1476
3372c5255333 StoreScuJob, Orthanc Explorer for jobs
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2336
diff changeset
1477 // Convert from UTC to local time
3372c5255333 StoreScuJob, Orthanc Explorer for jobs
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2336
diff changeset
1478 return new Date(utc.getTime() - utc.getTimezoneOffset() * 60000);
3372c5255333 StoreScuJob, Orthanc Explorer for jobs
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2336
diff changeset
1479 }
3372c5255333 StoreScuJob, Orthanc Explorer for jobs
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2336
diff changeset
1480
3372c5255333 StoreScuJob, Orthanc Explorer for jobs
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2336
diff changeset
1481
3372c5255333 StoreScuJob, Orthanc Explorer for jobs
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2336
diff changeset
1482 function AddJobField(target, description, field)
3372c5255333 StoreScuJob, Orthanc Explorer for jobs
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2336
diff changeset
1483 {
3372c5255333 StoreScuJob, Orthanc Explorer for jobs
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2336
diff changeset
1484 if (!(typeof field === 'undefined')) {
3372c5255333 StoreScuJob, Orthanc Explorer for jobs
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2336
diff changeset
1485 target.append($('<p>')
3372c5255333 StoreScuJob, Orthanc Explorer for jobs
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2336
diff changeset
1486 .text(description)
3372c5255333 StoreScuJob, Orthanc Explorer for jobs
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2336
diff changeset
1487 .append($('<strong>').text(field)));
3372c5255333 StoreScuJob, Orthanc Explorer for jobs
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2336
diff changeset
1488 }
3372c5255333 StoreScuJob, Orthanc Explorer for jobs
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2336
diff changeset
1489 }
3372c5255333 StoreScuJob, Orthanc Explorer for jobs
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2336
diff changeset
1490
3372c5255333 StoreScuJob, Orthanc Explorer for jobs
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2336
diff changeset
1491
3372c5255333 StoreScuJob, Orthanc Explorer for jobs
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2336
diff changeset
1492 function AddJobDateField(target, description, field)
3372c5255333 StoreScuJob, Orthanc Explorer for jobs
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2336
diff changeset
1493 {
3372c5255333 StoreScuJob, Orthanc Explorer for jobs
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2336
diff changeset
1494 if (!(typeof field === 'undefined')) {
3372c5255333 StoreScuJob, Orthanc Explorer for jobs
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2336
diff changeset
1495 target.append($('<p>')
3372c5255333 StoreScuJob, Orthanc Explorer for jobs
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2336
diff changeset
1496 .text(description)
3372c5255333 StoreScuJob, Orthanc Explorer for jobs
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2336
diff changeset
1497 .append($('<strong>').text(ParseJobTime(field))));
3372c5255333 StoreScuJob, Orthanc Explorer for jobs
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2336
diff changeset
1498 }
3372c5255333 StoreScuJob, Orthanc Explorer for jobs
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2336
diff changeset
1499 }
3372c5255333 StoreScuJob, Orthanc Explorer for jobs
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2336
diff changeset
1500
3372c5255333 StoreScuJob, Orthanc Explorer for jobs
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2336
diff changeset
1501
3372c5255333 StoreScuJob, Orthanc Explorer for jobs
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2336
diff changeset
1502 $('#jobs').live('pagebeforeshow', function() {
3372c5255333 StoreScuJob, Orthanc Explorer for jobs
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2336
diff changeset
1503 $.ajax({
3372c5255333 StoreScuJob, Orthanc Explorer for jobs
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2336
diff changeset
1504 url: '../jobs?expand',
3372c5255333 StoreScuJob, Orthanc Explorer for jobs
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2336
diff changeset
1505 dataType: 'json',
3372c5255333 StoreScuJob, Orthanc Explorer for jobs
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2336
diff changeset
1506 async: false,
3372c5255333 StoreScuJob, Orthanc Explorer for jobs
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2336
diff changeset
1507 cache: false,
3372c5255333 StoreScuJob, Orthanc Explorer for jobs
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2336
diff changeset
1508 success: function(jobs) {
3103
81b58b549845 back to using 'var' instead of 'let' since let is not supported by many old browsers. All variables declaration have been moved to the top of the function to better show that their scope is the function
Alain Mazy <alain@mazy.be>
parents: 3065
diff changeset
1509 var target = $('#all-jobs');
81b58b549845 back to using 'var' instead of 'let' since let is not supported by many old browsers. All variables declaration have been moved to the top of the function to better show that their scope is the function
Alain Mazy <alain@mazy.be>
parents: 3065
diff changeset
1510 var running, pending, inactive;
81b58b549845 back to using 'var' instead of 'let' since let is not supported by many old browsers. All variables declaration have been moved to the top of the function to better show that their scope is the function
Alain Mazy <alain@mazy.be>
parents: 3065
diff changeset
1511
2573
3372c5255333 StoreScuJob, Orthanc Explorer for jobs
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2336
diff changeset
1512 $('li', target).remove();
3372c5255333 StoreScuJob, Orthanc Explorer for jobs
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2336
diff changeset
1513
3103
81b58b549845 back to using 'var' instead of 'let' since let is not supported by many old browsers. All variables declaration have been moved to the top of the function to better show that their scope is the function
Alain Mazy <alain@mazy.be>
parents: 3065
diff changeset
1514 running = $('<li>')
2583
1b6a6d80b6f2 OrthancPeerStoreJob
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2582
diff changeset
1515 .attr('data-role', 'list-divider')
1b6a6d80b6f2 OrthancPeerStoreJob
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2582
diff changeset
1516 .text('Currently running');
1b6a6d80b6f2 OrthancPeerStoreJob
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2582
diff changeset
1517
3103
81b58b549845 back to using 'var' instead of 'let' since let is not supported by many old browsers. All variables declaration have been moved to the top of the function to better show that their scope is the function
Alain Mazy <alain@mazy.be>
parents: 3065
diff changeset
1518 pending = $('<li>')
2583
1b6a6d80b6f2 OrthancPeerStoreJob
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2582
diff changeset
1519 .attr('data-role', 'list-divider')
1b6a6d80b6f2 OrthancPeerStoreJob
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2582
diff changeset
1520 .text('Pending jobs');
1b6a6d80b6f2 OrthancPeerStoreJob
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2582
diff changeset
1521
3103
81b58b549845 back to using 'var' instead of 'let' since let is not supported by many old browsers. All variables declaration have been moved to the top of the function to better show that their scope is the function
Alain Mazy <alain@mazy.be>
parents: 3065
diff changeset
1522 inactive = $('<li>')
2583
1b6a6d80b6f2 OrthancPeerStoreJob
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2582
diff changeset
1523 .attr('data-role', 'list-divider')
1b6a6d80b6f2 OrthancPeerStoreJob
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2582
diff changeset
1524 .text('Inactive jobs');
1b6a6d80b6f2 OrthancPeerStoreJob
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2582
diff changeset
1525
1b6a6d80b6f2 OrthancPeerStoreJob
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2582
diff changeset
1526 target.append(running);
1b6a6d80b6f2 OrthancPeerStoreJob
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2582
diff changeset
1527 target.append(pending);
1b6a6d80b6f2 OrthancPeerStoreJob
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2582
diff changeset
1528 target.append(inactive);
1b6a6d80b6f2 OrthancPeerStoreJob
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2582
diff changeset
1529
2573
3372c5255333 StoreScuJob, Orthanc Explorer for jobs
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2336
diff changeset
1530 jobs.map(function(job) {
3103
81b58b549845 back to using 'var' instead of 'let' since let is not supported by many old browsers. All variables declaration have been moved to the top of the function to better show that their scope is the function
Alain Mazy <alain@mazy.be>
parents: 3065
diff changeset
1531 var li = $('<li>');
81b58b549845 back to using 'var' instead of 'let' since let is not supported by many old browsers. All variables declaration have been moved to the top of the function to better show that their scope is the function
Alain Mazy <alain@mazy.be>
parents: 3065
diff changeset
1532 var item = $('<a>');
81b58b549845 back to using 'var' instead of 'let' since let is not supported by many old browsers. All variables declaration have been moved to the top of the function to better show that their scope is the function
Alain Mazy <alain@mazy.be>
parents: 3065
diff changeset
1533
2573
3372c5255333 StoreScuJob, Orthanc Explorer for jobs
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2336
diff changeset
1534 li.append(item);
3372c5255333 StoreScuJob, Orthanc Explorer for jobs
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2336
diff changeset
1535 item.attr('href', '#job?uuid=' + job.ID);
3372c5255333 StoreScuJob, Orthanc Explorer for jobs
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2336
diff changeset
1536 item.append($('<h1>').text(job.Type));
3372c5255333 StoreScuJob, Orthanc Explorer for jobs
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2336
diff changeset
1537 item.append($('<span>').addClass('ui-li-count').text(job.State));
3372c5255333 StoreScuJob, Orthanc Explorer for jobs
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2336
diff changeset
1538 AddJobField(item, 'ID: ', job.ID);
2647
73d7d95dd75e removal of internal job information
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2597
diff changeset
1539 AddJobField(item, 'Local AET: ', job.Content.LocalAet);
73d7d95dd75e removal of internal job information
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2597
diff changeset
1540 AddJobField(item, 'Remote AET: ', job.Content.RemoteAet);
2573
3372c5255333 StoreScuJob, Orthanc Explorer for jobs
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2336
diff changeset
1541 AddJobDateField(item, 'Creation time: ', job.CreationTime);
3372c5255333 StoreScuJob, Orthanc Explorer for jobs
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2336
diff changeset
1542 AddJobDateField(item, 'Completion time: ', job.CompletionTime);
3372c5255333 StoreScuJob, Orthanc Explorer for jobs
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2336
diff changeset
1543 AddJobDateField(item, 'ETA: ', job.EstimatedTimeOfArrival);
2583
1b6a6d80b6f2 OrthancPeerStoreJob
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2582
diff changeset
1544
2589
a3fdfb6979ed getting rid of ReusableDicomConnection in REST API
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2583
diff changeset
1545 if (job.State == 'Running' ||
a3fdfb6979ed getting rid of ReusableDicomConnection in REST API
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2583
diff changeset
1546 job.State == 'Pending' ||
a3fdfb6979ed getting rid of ReusableDicomConnection in REST API
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2583
diff changeset
1547 job.State == 'Paused') {
a3fdfb6979ed getting rid of ReusableDicomConnection in REST API
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2583
diff changeset
1548 AddJobField(item, 'Priority: ', job.Priority);
a3fdfb6979ed getting rid of ReusableDicomConnection in REST API
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2583
diff changeset
1549 AddJobField(item, 'Progress: ', job.Progress);
a3fdfb6979ed getting rid of ReusableDicomConnection in REST API
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2583
diff changeset
1550 }
a3fdfb6979ed getting rid of ReusableDicomConnection in REST API
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2583
diff changeset
1551
2583
1b6a6d80b6f2 OrthancPeerStoreJob
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2582
diff changeset
1552 if (job.State == 'Running') {
1b6a6d80b6f2 OrthancPeerStoreJob
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2582
diff changeset
1553 li.insertAfter(running);
1b6a6d80b6f2 OrthancPeerStoreJob
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2582
diff changeset
1554 } else if (job.State == 'Pending' ||
1b6a6d80b6f2 OrthancPeerStoreJob
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2582
diff changeset
1555 job.State == 'Paused') {
1b6a6d80b6f2 OrthancPeerStoreJob
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2582
diff changeset
1556 li.insertAfter(pending);
1b6a6d80b6f2 OrthancPeerStoreJob
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2582
diff changeset
1557 } else {
1b6a6d80b6f2 OrthancPeerStoreJob
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2582
diff changeset
1558 li.insertAfter(inactive);
1b6a6d80b6f2 OrthancPeerStoreJob
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2582
diff changeset
1559 }
2573
3372c5255333 StoreScuJob, Orthanc Explorer for jobs
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2336
diff changeset
1560 });
3372c5255333 StoreScuJob, Orthanc Explorer for jobs
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2336
diff changeset
1561
3372c5255333 StoreScuJob, Orthanc Explorer for jobs
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2336
diff changeset
1562 target.listview('refresh');
3372c5255333 StoreScuJob, Orthanc Explorer for jobs
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2336
diff changeset
1563 }
3372c5255333 StoreScuJob, Orthanc Explorer for jobs
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2336
diff changeset
1564 });
3372c5255333 StoreScuJob, Orthanc Explorer for jobs
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2336
diff changeset
1565 });
3372c5255333 StoreScuJob, Orthanc Explorer for jobs
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2336
diff changeset
1566
3372c5255333 StoreScuJob, Orthanc Explorer for jobs
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2336
diff changeset
1567
3372c5255333 StoreScuJob, Orthanc Explorer for jobs
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2336
diff changeset
1568 $('#job').live('pagebeforeshow', function() {
3103
81b58b549845 back to using 'var' instead of 'let' since let is not supported by many old browsers. All variables declaration have been moved to the top of the function to better show that their scope is the function
Alain Mazy <alain@mazy.be>
parents: 3065
diff changeset
1569 var pageData, target;
81b58b549845 back to using 'var' instead of 'let' since let is not supported by many old browsers. All variables declaration have been moved to the top of the function to better show that their scope is the function
Alain Mazy <alain@mazy.be>
parents: 3065
diff changeset
1570
2573
3372c5255333 StoreScuJob, Orthanc Explorer for jobs
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2336
diff changeset
1571 if ($.mobile.pageData) {
3103
81b58b549845 back to using 'var' instead of 'let' since let is not supported by many old browsers. All variables declaration have been moved to the top of the function to better show that their scope is the function
Alain Mazy <alain@mazy.be>
parents: 3065
diff changeset
1572 pageData = DeepCopy($.mobile.pageData);
2573
3372c5255333 StoreScuJob, Orthanc Explorer for jobs
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2336
diff changeset
1573
3372c5255333 StoreScuJob, Orthanc Explorer for jobs
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2336
diff changeset
1574 $.ajax({
3372c5255333 StoreScuJob, Orthanc Explorer for jobs
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2336
diff changeset
1575 url: '../jobs/' + pageData.uuid,
3372c5255333 StoreScuJob, Orthanc Explorer for jobs
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2336
diff changeset
1576 dataType: 'json',
3372c5255333 StoreScuJob, Orthanc Explorer for jobs
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2336
diff changeset
1577 async: false,
3372c5255333 StoreScuJob, Orthanc Explorer for jobs
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2336
diff changeset
1578 cache: false,
3372c5255333 StoreScuJob, Orthanc Explorer for jobs
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2336
diff changeset
1579 success: function(job) {
3103
81b58b549845 back to using 'var' instead of 'let' since let is not supported by many old browsers. All variables declaration have been moved to the top of the function to better show that their scope is the function
Alain Mazy <alain@mazy.be>
parents: 3065
diff changeset
1580 var block, value;
81b58b549845 back to using 'var' instead of 'let' since let is not supported by many old browsers. All variables declaration have been moved to the top of the function to better show that their scope is the function
Alain Mazy <alain@mazy.be>
parents: 3065
diff changeset
1581
81b58b549845 back to using 'var' instead of 'let' since let is not supported by many old browsers. All variables declaration have been moved to the top of the function to better show that their scope is the function
Alain Mazy <alain@mazy.be>
parents: 3065
diff changeset
1582 target = $('#job-info');
2573
3372c5255333 StoreScuJob, Orthanc Explorer for jobs
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2336
diff changeset
1583 $('li', target).remove();
3372c5255333 StoreScuJob, Orthanc Explorer for jobs
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2336
diff changeset
1584
3372c5255333 StoreScuJob, Orthanc Explorer for jobs
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2336
diff changeset
1585 target.append($('<li>')
3372c5255333 StoreScuJob, Orthanc Explorer for jobs
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2336
diff changeset
1586 .attr('data-role', 'list-divider')
3372c5255333 StoreScuJob, Orthanc Explorer for jobs
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2336
diff changeset
1587 .text('General information about the job'));
3372c5255333 StoreScuJob, Orthanc Explorer for jobs
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2336
diff changeset
1588
3065
b89a4288d605 Fixed Orthanc Explorer on IE and Firefox: Explorer always show 'to many results'
am@osimis.io
parents: 3023
diff changeset
1589 {
3103
81b58b549845 back to using 'var' instead of 'let' since let is not supported by many old browsers. All variables declaration have been moved to the top of the function to better show that their scope is the function
Alain Mazy <alain@mazy.be>
parents: 3065
diff changeset
1590 block = $('<li>');
81b58b549845 back to using 'var' instead of 'let' since let is not supported by many old browsers. All variables declaration have been moved to the top of the function to better show that their scope is the function
Alain Mazy <alain@mazy.be>
parents: 3065
diff changeset
1591 for (var i in job) {
3065
b89a4288d605 Fixed Orthanc Explorer on IE and Firefox: Explorer always show 'to many results'
am@osimis.io
parents: 3023
diff changeset
1592 if (i == 'CreationTime' ||
b89a4288d605 Fixed Orthanc Explorer on IE and Firefox: Explorer always show 'to many results'
am@osimis.io
parents: 3023
diff changeset
1593 i == 'CompletionTime' ||
b89a4288d605 Fixed Orthanc Explorer on IE and Firefox: Explorer always show 'to many results'
am@osimis.io
parents: 3023
diff changeset
1594 i == 'EstimatedTimeOfArrival') {
b89a4288d605 Fixed Orthanc Explorer on IE and Firefox: Explorer always show 'to many results'
am@osimis.io
parents: 3023
diff changeset
1595 AddJobDateField(block, i + ': ', job[i]);
b89a4288d605 Fixed Orthanc Explorer on IE and Firefox: Explorer always show 'to many results'
am@osimis.io
parents: 3023
diff changeset
1596 } else if (i != 'InternalContent' &&
b89a4288d605 Fixed Orthanc Explorer on IE and Firefox: Explorer always show 'to many results'
am@osimis.io
parents: 3023
diff changeset
1597 i != 'Content' &&
b89a4288d605 Fixed Orthanc Explorer on IE and Firefox: Explorer always show 'to many results'
am@osimis.io
parents: 3023
diff changeset
1598 i != 'Timestamp') {
b89a4288d605 Fixed Orthanc Explorer on IE and Firefox: Explorer always show 'to many results'
am@osimis.io
parents: 3023
diff changeset
1599 AddJobField(block, i + ': ', job[i]);
b89a4288d605 Fixed Orthanc Explorer on IE and Firefox: Explorer always show 'to many results'
am@osimis.io
parents: 3023
diff changeset
1600 }
2573
3372c5255333 StoreScuJob, Orthanc Explorer for jobs
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2336
diff changeset
1601 }
3372c5255333 StoreScuJob, Orthanc Explorer for jobs
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2336
diff changeset
1602 }
3372c5255333 StoreScuJob, Orthanc Explorer for jobs
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2336
diff changeset
1603
3372c5255333 StoreScuJob, Orthanc Explorer for jobs
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2336
diff changeset
1604 target.append(block);
3372c5255333 StoreScuJob, Orthanc Explorer for jobs
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2336
diff changeset
1605
3372c5255333 StoreScuJob, Orthanc Explorer for jobs
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2336
diff changeset
1606 target.append($('<li>')
3372c5255333 StoreScuJob, Orthanc Explorer for jobs
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2336
diff changeset
1607 .attr('data-role', 'list-divider')
3372c5255333 StoreScuJob, Orthanc Explorer for jobs
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2336
diff changeset
1608 .text('Detailed information'));
3372c5255333 StoreScuJob, Orthanc Explorer for jobs
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2336
diff changeset
1609
3065
b89a4288d605 Fixed Orthanc Explorer on IE and Firefox: Explorer always show 'to many results'
am@osimis.io
parents: 3023
diff changeset
1610 {
3103
81b58b549845 back to using 'var' instead of 'let' since let is not supported by many old browsers. All variables declaration have been moved to the top of the function to better show that their scope is the function
Alain Mazy <alain@mazy.be>
parents: 3065
diff changeset
1611 block = $('<li>');
2583
1b6a6d80b6f2 OrthancPeerStoreJob
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2582
diff changeset
1612
3103
81b58b549845 back to using 'var' instead of 'let' since let is not supported by many old browsers. All variables declaration have been moved to the top of the function to better show that their scope is the function
Alain Mazy <alain@mazy.be>
parents: 3065
diff changeset
1613 for (var item in job.Content) {
81b58b549845 back to using 'var' instead of 'let' since let is not supported by many old browsers. All variables declaration have been moved to the top of the function to better show that their scope is the function
Alain Mazy <alain@mazy.be>
parents: 3065
diff changeset
1614 var value = job.Content[item];
3065
b89a4288d605 Fixed Orthanc Explorer on IE and Firefox: Explorer always show 'to many results'
am@osimis.io
parents: 3023
diff changeset
1615 if (typeof value !== 'string') {
b89a4288d605 Fixed Orthanc Explorer on IE and Firefox: Explorer always show 'to many results'
am@osimis.io
parents: 3023
diff changeset
1616 value = JSON.stringify(value);
b89a4288d605 Fixed Orthanc Explorer on IE and Firefox: Explorer always show 'to many results'
am@osimis.io
parents: 3023
diff changeset
1617 }
b89a4288d605 Fixed Orthanc Explorer on IE and Firefox: Explorer always show 'to many results'
am@osimis.io
parents: 3023
diff changeset
1618
b89a4288d605 Fixed Orthanc Explorer on IE and Firefox: Explorer always show 'to many results'
am@osimis.io
parents: 3023
diff changeset
1619 AddJobField(block, item + ': ', value);
2583
1b6a6d80b6f2 OrthancPeerStoreJob
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2582
diff changeset
1620 }
2573
3372c5255333 StoreScuJob, Orthanc Explorer for jobs
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2336
diff changeset
1621 }
3065
b89a4288d605 Fixed Orthanc Explorer on IE and Firefox: Explorer always show 'to many results'
am@osimis.io
parents: 3023
diff changeset
1622
2573
3372c5255333 StoreScuJob, Orthanc Explorer for jobs
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2336
diff changeset
1623 target.append(block);
3372c5255333 StoreScuJob, Orthanc Explorer for jobs
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2336
diff changeset
1624
3372c5255333 StoreScuJob, Orthanc Explorer for jobs
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2336
diff changeset
1625 target.listview('refresh');
3372c5255333 StoreScuJob, Orthanc Explorer for jobs
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2336
diff changeset
1626
2582
b3da733d984c job actions in Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2573
diff changeset
1627 $('#job-cancel').closest('.ui-btn').hide();
2573
3372c5255333 StoreScuJob, Orthanc Explorer for jobs
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2336
diff changeset
1628 $('#job-resubmit').closest('.ui-btn').hide();
3372c5255333 StoreScuJob, Orthanc Explorer for jobs
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2336
diff changeset
1629 $('#job-pause').closest('.ui-btn').hide();
3372c5255333 StoreScuJob, Orthanc Explorer for jobs
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2336
diff changeset
1630 $('#job-resume').closest('.ui-btn').hide();
3372c5255333 StoreScuJob, Orthanc Explorer for jobs
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2336
diff changeset
1631
3372c5255333 StoreScuJob, Orthanc Explorer for jobs
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2336
diff changeset
1632 if (job.State == 'Running' ||
3372c5255333 StoreScuJob, Orthanc Explorer for jobs
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2336
diff changeset
1633 job.State == 'Pending' ||
3372c5255333 StoreScuJob, Orthanc Explorer for jobs
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2336
diff changeset
1634 job.State == 'Retry') {
2582
b3da733d984c job actions in Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2573
diff changeset
1635 $('#job-cancel').closest('.ui-btn').show();
2573
3372c5255333 StoreScuJob, Orthanc Explorer for jobs
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2336
diff changeset
1636 $('#job-pause').closest('.ui-btn').show();
3372c5255333 StoreScuJob, Orthanc Explorer for jobs
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2336
diff changeset
1637 }
3372c5255333 StoreScuJob, Orthanc Explorer for jobs
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2336
diff changeset
1638 else if (job.State == 'Success') {
3372c5255333 StoreScuJob, Orthanc Explorer for jobs
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2336
diff changeset
1639 }
3372c5255333 StoreScuJob, Orthanc Explorer for jobs
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2336
diff changeset
1640 else if (job.State == 'Failure') {
3372c5255333 StoreScuJob, Orthanc Explorer for jobs
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2336
diff changeset
1641 $('#job-resubmit').closest('.ui-btn').show();
3372c5255333 StoreScuJob, Orthanc Explorer for jobs
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2336
diff changeset
1642 }
3372c5255333 StoreScuJob, Orthanc Explorer for jobs
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2336
diff changeset
1643 else if (job.State == 'Paused') {
3372c5255333 StoreScuJob, Orthanc Explorer for jobs
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2336
diff changeset
1644 $('#job-resume').closest('.ui-btn').show();
3372c5255333 StoreScuJob, Orthanc Explorer for jobs
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2336
diff changeset
1645 }
3372c5255333 StoreScuJob, Orthanc Explorer for jobs
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2336
diff changeset
1646 }
3372c5255333 StoreScuJob, Orthanc Explorer for jobs
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2336
diff changeset
1647 });
3372c5255333 StoreScuJob, Orthanc Explorer for jobs
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2336
diff changeset
1648 }
3372c5255333 StoreScuJob, Orthanc Explorer for jobs
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2336
diff changeset
1649 });
2582
b3da733d984c job actions in Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2573
diff changeset
1650
b3da733d984c job actions in Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2573
diff changeset
1651
b3da733d984c job actions in Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2573
diff changeset
1652
b3da733d984c job actions in Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2573
diff changeset
1653 function TriggerJobAction(action)
b3da733d984c job actions in Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2573
diff changeset
1654 {
b3da733d984c job actions in Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2573
diff changeset
1655 $.ajax({
b3da733d984c job actions in Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2573
diff changeset
1656 url: '../jobs/' + $.mobile.pageData.uuid + '/' + action,
b3da733d984c job actions in Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2573
diff changeset
1657 type: 'POST',
b3da733d984c job actions in Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2573
diff changeset
1658 async: false,
2583
1b6a6d80b6f2 OrthancPeerStoreJob
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2582
diff changeset
1659 cache: false,
2582
b3da733d984c job actions in Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2573
diff changeset
1660 complete: function(s) {
b3da733d984c job actions in Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2573
diff changeset
1661 window.location.reload();
b3da733d984c job actions in Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2573
diff changeset
1662 }
b3da733d984c job actions in Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2573
diff changeset
1663 });
b3da733d984c job actions in Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2573
diff changeset
1664 }
b3da733d984c job actions in Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2573
diff changeset
1665
b3da733d984c job actions in Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2573
diff changeset
1666 $('#job-cancel').live('click', function() {
b3da733d984c job actions in Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2573
diff changeset
1667 TriggerJobAction('cancel');
b3da733d984c job actions in Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2573
diff changeset
1668 });
b3da733d984c job actions in Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2573
diff changeset
1669
b3da733d984c job actions in Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2573
diff changeset
1670 $('#job-resubmit').live('click', function() {
b3da733d984c job actions in Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2573
diff changeset
1671 TriggerJobAction('resubmit');
b3da733d984c job actions in Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2573
diff changeset
1672 });
b3da733d984c job actions in Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2573
diff changeset
1673
b3da733d984c job actions in Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2573
diff changeset
1674 $('#job-pause').live('click', function() {
b3da733d984c job actions in Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2573
diff changeset
1675 TriggerJobAction('pause');
b3da733d984c job actions in Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2573
diff changeset
1676 });
b3da733d984c job actions in Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2573
diff changeset
1677
b3da733d984c job actions in Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2573
diff changeset
1678 $('#job-resume').live('click', function() {
b3da733d984c job actions in Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2573
diff changeset
1679 TriggerJobAction('resume');
b3da733d984c job actions in Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2573
diff changeset
1680 });