annotate OrthancServer/OrthancExplorer/explorer.js @ 5675:2b65f25cb1c8 find-refactoring

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