diff OrthancExplorer/explorer.js @ 274:f2286c741109

patient protection in Orthanc Explorer
author Sebastien Jodogne <s.jodogne@gmail.com>
date Sat, 08 Dec 2012 22:48:53 +0100
parents f23318b11b39
children cd6749e53a03
line wrap: on
line diff
--- a/OrthancExplorer/explorer.js	Sat Dec 08 22:34:56 2012 +0100
+++ b/OrthancExplorer/explorer.js	Sat Dec 08 22:48:53 2012 +0100
@@ -378,6 +378,18 @@
         }
 
         target.listview('refresh');
+
+        // Check whether this patient is protected
+        $.ajax({
+          url: '../patients/' + $.mobile.pageData.uuid + '/protected',
+          type: 'GET',
+          dataType: 'text',
+          async: false,
+          success: function (s) {
+            var v = (s == '1') ? 'on' : 'off';
+            $('#protection').val(v).slider('refresh');
+          }
+        });
       });
     });
   }
@@ -786,3 +798,13 @@
   window.location.href = '../series/' + $.mobile.pageData.uuid + '/archive';
 });
 
+$('#protection').live('change', function(e) {
+  var isProtected = e.target.value == "on";
+  $.ajax({
+    url: '../patients/' + $.mobile.pageData.uuid + '/protected',
+    type: 'PUT',
+    dataType: 'text',
+    data: isProtected ? '1' : '0',
+    async: false
+  });
+});