diff OrthancExplorer/explorer.js @ 443:be93b666ed79

link anonymized to original resource in OrthancExplorer
author Sebastien Jodogne <s.jodogne@gmail.com>
date Fri, 17 May 2013 16:55:30 +0200
parents 97a00b30abcc
children b05eb8708aee
line wrap: on
line diff
--- a/OrthancExplorer/explorer.js	Fri May 17 16:06:38 2013 +0200
+++ b/OrthancExplorer/explorer.js	Fri May 17 16:55:30 2013 +0200
@@ -356,6 +356,23 @@
 
 
 
+function SetupAnonymizedFrom(buttonSelector, resource, resourceType)
+{
+  if ('AnonymizedFrom' in resource)
+  {
+    $(buttonSelector).closest('li').show();
+    $(buttonSelector).click(function(e) {
+      window.location.assign('explorer.html#' + resourceType + '?uuid=' + resource.AnonymizedFrom);
+      window.location.reload();
+    });
+  }
+  else
+  {
+    $(buttonSelector).closest('li').hide();
+  }
+}
+
+
 $('#patient').live('pagebeforeshow', function() {
   if ($.mobile.pageData) {
     GetSingleResource('patients', $.mobile.pageData.uuid, function(patient) {
@@ -381,6 +398,8 @@
           target.append(FormatStudy(studies[i], '#study?uuid=' + studies[i].ID));
         }
 
+        SetupAnonymizedFrom('#patient-anonymized-from', patient, 'patient');
+
         target.listview('refresh');
 
         // Check whether this patient is protected
@@ -417,6 +436,8 @@
             .append(FormatStudy(study))
             .listview('refresh');
 
+          SetupAnonymizedFrom('#study-anonymized-from', study, 'study');
+
           var target = $('#list-series');
           $('li', target).remove();
           for (var i = 0; i < series.length; i++) {
@@ -456,6 +477,8 @@
               .append(FormatSeries(series))
               .listview('refresh');
 
+            SetupAnonymizedFrom('#series-anonymized-from', series, 'series');
+
             var target = $('#list-instances');
             $('li', target).remove();
             for (var i = 0; i < instances.length; i++) {