comparison OrthancExplorer/explorer.js @ 344:cd6749e53a03

anonymization from orthanc explorer
author Sebastien Jodogne <s.jodogne@gmail.com>
date Mon, 21 Jan 2013 13:23:26 +0100
parents f2286c741109
children a9752f88400c
comparison
equal deleted inserted replaced
343:b1edbd636cb8 344:cd6749e53a03
142 var resource = null; 142 var resource = null;
143 $.ajax({ 143 $.ajax({
144 url: '../' + type + '/' + uuid, 144 url: '../' + type + '/' + uuid,
145 dataType: 'json', 145 dataType: 'json',
146 async: false, 146 async: false,
147 cache: false,
147 success: function(s) { 148 success: function(s) {
148 callback(s); 149 callback(s);
149 } 150 }
150 }); 151 });
151 } 152 }
157 { 158 {
158 $.ajax({ 159 $.ajax({
159 url: '../' + type, 160 url: '../' + type,
160 dataType: 'json', 161 dataType: 'json',
161 async: false, 162 async: false,
163 cache: false,
162 success: function(s) { 164 success: function(s) {
163 uuids = s; 165 uuids = s;
164 } 166 }
165 }); 167 });
166 } 168 }
169 var ajaxRequests = uuids.map(function(uuid) { 171 var ajaxRequests = uuids.map(function(uuid) {
170 return $.ajax({ 172 return $.ajax({
171 url: '../' + type + '/' + uuid, 173 url: '../' + type + '/' + uuid,
172 dataType: 'json', 174 dataType: 'json',
173 async: true, 175 async: true,
176 cache: false,
174 success: function(s) { 177 success: function(s) {
175 resources.push(s); 178 resources.push(s);
176 } 179 }
177 }); 180 });
178 }); 181 });
322 $('[data-role="page"]').live('pagebeforeshow', function() { 325 $('[data-role="page"]').live('pagebeforeshow', function() {
323 $.ajax({ 326 $.ajax({
324 url: '../system', 327 url: '../system',
325 dataType: 'json', 328 dataType: 'json',
326 async: false, 329 async: false,
330 cache: false,
327 success: function(s) { 331 success: function(s) {
328 if (s.Name != "") { 332 if (s.Name != "") {
329 $('.orthanc-name').html('<a class="ui-link" href="explorer.html">' + s.Name + '</a> &raquo; '); 333 $('.orthanc-name').html('<a class="ui-link" href="explorer.html">' + s.Name + '</a> &raquo; ');
330 } 334 }
331 } 335 }
383 $.ajax({ 387 $.ajax({
384 url: '../patients/' + $.mobile.pageData.uuid + '/protected', 388 url: '../patients/' + $.mobile.pageData.uuid + '/protected',
385 type: 'GET', 389 type: 'GET',
386 dataType: 'text', 390 dataType: 'text',
387 async: false, 391 async: false,
392 cache: false,
388 success: function (s) { 393 success: function (s) {
389 var v = (s == '1') ? 'on' : 'off'; 394 var v = (s == '1') ? 'on' : 'off';
390 $('#protection').val(v).slider('refresh'); 395 $('#protection').val(v).slider('refresh');
391 } 396 }
392 }); 397 });
540 .append(FormatInstance(instance)) 545 .append(FormatInstance(instance))
541 .listview('refresh'); 546 .listview('refresh');
542 547
543 $.ajax({ 548 $.ajax({
544 url: '../instances/' + instance.ID + '/tags', 549 url: '../instances/' + instance.ID + '/tags',
550 cache: false,
545 dataType: 'json', 551 dataType: 'json',
546 success: function(s) { 552 success: function(s) {
547 $('#dicom-tree').tree('loadData', ConvertForTree(s)); 553 $('#dicom-tree').tree('loadData', ConvertForTree(s));
548 } 554 }
549 }); 555 });
705 $.ajax({ 711 $.ajax({
706 url: '../modalities', 712 url: '../modalities',
707 type: 'GET', 713 type: 'GET',
708 dataType: 'json', 714 dataType: 'json',
709 async: false, 715 async: false,
716 cache: false,
710 success: function(modalities) { 717 success: function(modalities) {
711 var clickedModality = ''; 718 var clickedModality = '';
712 var items = $('<ul>') 719 var items = $('<ul>')
713 .attr('data-role', 'listview'); 720 .attr('data-role', 'listview');
714 721
806 dataType: 'text', 813 dataType: 'text',
807 data: isProtected ? '1' : '0', 814 data: isProtected ? '1' : '0',
808 async: false 815 async: false
809 }); 816 });
810 }); 817 });
818
819
820
821 function OpenAnonymizeResourceDialog(path, title)
822 {
823 $(document).simpledialog2({
824 mode: 'button',
825 animate: false,
826 headerText: title,
827 headerClose: true,
828 width: '500px',
829 buttons : {
830 'OK': {
831 click: function () {
832 $.ajax({
833 url: path + '/anonymize',
834 type: 'POST',
835 data: '{}',
836 dataType: 'json',
837 async: false,
838 cache: false,
839 success: function(s) {
840 $.mobile.changePage('#patient?uuid=' + s.PatientID);
841 }
842 });
843 },
844 icon: "delete",
845 theme: "c"
846 },
847 'Cancel': {
848 click: function () {
849 }
850 }
851 }
852 });
853 }
854
855 $('#instance-anonymize').live('click', function() {
856 OpenAnonymizeResourceDialog('../instances/' + $.mobile.pageData.uuid,
857 'Anonymize this instance?');
858 });
859
860 $('#study-anonymize').live('click', function() {
861 OpenAnonymizeResourceDialog('../studies/' + $.mobile.pageData.uuid,
862 'Anonymize this study?');
863 });
864
865 $('#series-anonymize').live('click', function() {
866 OpenAnonymizeResourceDialog('../series/' + $.mobile.pageData.uuid,
867 'Anonymize this series?');
868 });