annotate OrthancServer/OrthancExplorer/explorer.js @ 4819:70d2a97ca8cb openssl-3.x

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