changeset 351:64625960af22

fix
author Sebastien Jodogne <s.jodogne@gmail.com>
date Mon, 28 Jan 2013 15:58:09 +0100
parents 8031f9cfe7fe
children cc9eddbf07d3
files OrthancExplorer/explorer.html OrthancExplorer/explorer.js OrthancServer/OrthancRestApi.cpp
diffstat 3 files changed, 43 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/OrthancExplorer/explorer.html	Mon Jan 28 15:36:44 2013 +0100
+++ b/OrthancExplorer/explorer.html	Mon Jan 28 15:58:09 2013 +0100
@@ -91,6 +91,7 @@
                 <!--a href="#find-patients" data-role="button" data-icon="search">Go to patient finder</a-->
                 <a href="#" data-role="button" data-icon="delete" id="patient-delete">Delete this patient</a>
                 <a href="#" data-role="button" data-icon="gear" id="patient-archive">Download ZIP</a>
+                <a href="#" data-role="button" data-icon="star" id="patient-anonymize">Anonymize</a>
               </p>
             </div>
           </div>
--- a/OrthancExplorer/explorer.js	Mon Jan 28 15:36:44 2013 +0100
+++ b/OrthancExplorer/explorer.js	Mon Jan 28 15:58:09 2013 +0100
@@ -837,7 +837,11 @@
             async: false,
             cache: false,
             success: function(s) {
-              $.mobile.changePage('#patient?uuid=' + s.PatientID);
+              // The following line does not work...
+              //$.mobile.changePage('explorer.html#patient?uuid=' + s.PatientID);
+
+              window.location.assign('explorer.html#patient?uuid=' + s.PatientID);
+              window.location.reload();
             }
           });
         },
@@ -866,3 +870,8 @@
   OpenAnonymizeResourceDialog('../series/' + $.mobile.pageData.uuid,
                               'Anonymize this series?');
 });
+
+$('#patient-anonymize').live('click', function() {
+  OpenAnonymizeResourceDialog('../patients/' + $.mobile.pageData.uuid,
+                              'Anonymize this patient?');
+});
--- a/OrthancServer/OrthancRestApi.cpp	Mon Jan 28 15:36:44 2013 +0100
+++ b/OrthancServer/OrthancRestApi.cpp	Mon Jan 28 15:58:09 2013 +0100
@@ -1413,6 +1413,36 @@
   }
 
 
+  static void ModifyPatientInplace(RestApi::PostCall& call)
+  {
+    Removals removals;
+    Replacements replacements;
+    bool removePrivateTags;
+
+    if (ParseModifyRequest(removals, replacements, removePrivateTags, call))
+    {
+      AnonymizeOrModifyResource(removals, replacements, removePrivateTags, 
+                                MetadataType_ModifiedFrom, ChangeType_ModifiedPatient, 
+                                ResourceType_Patient, call);
+    }
+  }
+
+
+  static void AnonymizePatientInplace(RestApi::PostCall& call)
+  {
+    Removals removals;
+    Replacements replacements;
+    bool removePrivateTags;
+
+    if (ParseAnonymizationRequest(removals, replacements, removePrivateTags, call))
+    {
+      AnonymizeOrModifyResource(removals, replacements, removePrivateTags, 
+                                MetadataType_AnonymizedFrom, ChangeType_AnonymizedPatient, 
+                                ResourceType_Patient, call);
+    }
+  }
+
+
 
   // Registration of the various REST handlers --------------------------------
 
@@ -1472,10 +1502,12 @@
     Register("/instances/{id}/modify", ModifyInstance);
     Register("/series/{id}/modify", ModifySeriesInplace);
     Register("/studies/{id}/modify", ModifyStudyInplace);
+    Register("/patients/{id}/modify", ModifyPatientInplace);
 
     Register("/instances/{id}/anonymize", AnonymizeInstance);
     Register("/series/{id}/anonymize", AnonymizeSeriesInplace);
     Register("/studies/{id}/anonymize", AnonymizeStudyInplace);
+    Register("/patients/{id}/anonymize", AnonymizePatientInplace);
 
     Register("/tools/generate-uid", GenerateUid);
   }