diff 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
line wrap: on
line diff
--- a/OrthancExplorer/explorer.js	Fri Jan 18 10:25:55 2013 +0100
+++ b/OrthancExplorer/explorer.js	Mon Jan 21 13:23:26 2013 +0100
@@ -144,6 +144,7 @@
     url: '../' + type + '/' + uuid,
     dataType: 'json',
     async: false,
+    cache: false,
     success: function(s) {
       callback(s);
     }
@@ -159,6 +160,7 @@
       url: '../' + type,
       dataType: 'json',
       async: false,
+      cache: false,
       success: function(s) {
         uuids = s;
       }
@@ -171,6 +173,7 @@
       url: '../' + type + '/' + uuid,
       dataType: 'json',
       async: true,
+      cache: false,
       success: function(s) {
         resources.push(s);
       }
@@ -324,6 +327,7 @@
     url: '../system',
     dataType: 'json',
     async: false,
+    cache: false,
     success: function(s) {
       if (s.Name != "") {
         $('.orthanc-name').html('<a class="ui-link" href="explorer.html">' + s.Name + '</a> &raquo; ');
@@ -385,6 +389,7 @@
           type: 'GET',
           dataType: 'text',
           async: false,
+          cache: false,
           success: function (s) {
             var v = (s == '1') ? 'on' : 'off';
             $('#protection').val(v).slider('refresh');
@@ -542,6 +547,7 @@
 
             $.ajax({
               url: '../instances/' + instance.ID + '/tags',
+              cache: false,
               dataType: 'json',
               success: function(s) {
                 $('#dicom-tree').tree('loadData', ConvertForTree(s));
@@ -707,6 +713,7 @@
     type: 'GET',
     dataType: 'json',
     async: false,
+    cache: false,
     success: function(modalities) {
       var clickedModality = '';
       var items = $('<ul>')
@@ -808,3 +815,54 @@
     async: false
   });
 });
+
+
+
+function OpenAnonymizeResourceDialog(path, title)
+{
+  $(document).simpledialog2({ 
+    mode: 'button',
+    animate: false,
+    headerText: title,
+    headerClose: true,
+    width: '500px',
+    buttons : {
+      'OK': {
+        click: function () { 
+          $.ajax({
+            url: path + '/anonymize',
+            type: 'POST',
+            data: '{}',
+            dataType: 'json',
+            async: false,
+            cache: false,
+            success: function(s) {
+              $.mobile.changePage('#patient?uuid=' + s.PatientID);
+            }
+          });
+        },
+        icon: "delete",
+        theme: "c"
+      },
+      'Cancel': {
+        click: function () { 
+        }
+      }
+    }
+  });
+}
+
+$('#instance-anonymize').live('click', function() {
+  OpenAnonymizeResourceDialog('../instances/' + $.mobile.pageData.uuid,
+                              'Anonymize this instance?');
+});
+
+$('#study-anonymize').live('click', function() {
+  OpenAnonymizeResourceDialog('../studies/' + $.mobile.pageData.uuid,
+                              'Anonymize this study?');
+});
+
+$('#series-anonymize').live('click', function() {
+  OpenAnonymizeResourceDialog('../series/' + $.mobile.pageData.uuid,
+                              'Anonymize this series?');
+});