changeset 274:f2286c741109

patient protection in Orthanc Explorer
author Sebastien Jodogne <s.jodogne@gmail.com>
date Sat, 08 Dec 2012 22:48:53 +0100
parents d384af918264
children c8123aa17e01
files OrthancExplorer/explorer.css OrthancExplorer/explorer.html OrthancExplorer/explorer.js
diffstat 3 files changed, 33 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/OrthancExplorer/explorer.css	Sat Dec 08 22:34:56 2012 +0100
+++ b/OrthancExplorer/explorer.css	Sat Dec 08 22:48:53 2012 +0100
@@ -37,3 +37,7 @@
     text-decoration: none;
     color: white !important;
 }
+
+.switch-container .ui-slider-switch {
+    width: 100%;
+}
\ No newline at end of file
--- a/OrthancExplorer/explorer.html	Sat Dec 08 22:34:56 2012 +0100
+++ b/OrthancExplorer/explorer.html	Sat Dec 08 22:48:53 2012 +0100
@@ -82,7 +82,13 @@
               <ul data-role="listview" data-inset="true" data-theme="a"  id="patient-info">
               </ul>
               <p>
-                <a href="#find-patients" data-role="button" data-icon="search">Go to patient finder</a>
+                <div class="switch-container">
+                  <select name="protection" id="protection" data-role="slider">
+	            <option value="off">Unprotected</option>
+	            <option value="on">Protected</option>
+                  </select>
+                </div>
+                <!--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>
               </p>
--- 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
+  });
+});