changeset 1697:c2802561d7f9

"PrintEnabled" configuration option
author Sebastien Jodogne <s.jodogne@gmail.com>
date Fri, 27 Nov 2020 09:47:46 +0100
parents 572652803929
children 8805a6a01655
files Applications/StoneWebViewer/WebApplication/app.js Applications/StoneWebViewer/WebApplication/configuration.json Applications/StoneWebViewer/WebApplication/index.html
diffstat 3 files changed, 11 insertions(+), 6 deletions(-) [+]
line wrap: on
line diff
--- a/Applications/StoneWebViewer/WebApplication/app.js	Fri Nov 27 09:34:02 2020 +0100
+++ b/Applications/StoneWebViewer/WebApplication/app.js	Fri Nov 27 09:47:46 2020 +0100
@@ -31,8 +31,6 @@
 // Registry of the PDF series for which the instance metadata is still waiting
 var pendingSeriesPdf_ = {};
 
-var globalConfiguration_ = {};
-
 
 function getParameterFromUrl(key) {
   var url = window.location.search.substring(1);
@@ -266,6 +264,7 @@
       showInfo: true,
       showReferenceLines: true,
       synchronizedBrowsing: false,
+      globalConfiguration: {},
 
       modalWarning: false,
       modalNotDiagnostic: false,
@@ -838,8 +837,9 @@
 
   axios.get(CONFIGURATION_SOURCE)
     .then(function(response) {
-      globalConfiguration_ = ParseJsonWithComments(response.data);
-      
+      app.globalConfiguration = ParseJsonWithComments(response.data);
+      console.log(app.globalConfiguration);
+
       // Option 1: Loading script using plain HTML
       
       /*
@@ -882,7 +882,7 @@
 
 window.addEventListener('message', function(e) {
   if ('type' in e.data) {
-    var expectedOrigin = globalConfiguration_['ExpectedMessageOrigin'];
+    var expectedOrigin = app.globalConfiguration['ExpectedMessageOrigin'];
     
     if (expectedOrigin === undefined) {
       alert('Dynamic actions are disabled in the Stone Web viewer, ' +
--- a/Applications/StoneWebViewer/WebApplication/configuration.json	Fri Nov 27 09:34:02 2020 +0100
+++ b/Applications/StoneWebViewer/WebApplication/configuration.json	Fri Nov 27 09:47:46 2020 +0100
@@ -1,5 +1,10 @@
 {
   /**
+   * Enables/disables the print button.
+   **/
+  "PrintEnabled" : true,
+
+  /**
    * The allowed origin for messages corresponding to dynamic actions
    * triggered by another Web page using "window.postMessage()". The
    * special value "*" will allow any origin, which is an insecure
--- a/Applications/StoneWebViewer/WebApplication/index.html	Fri Nov 27 09:34:02 2020 +0100
+++ b/Applications/StoneWebViewer/WebApplication/index.html	Fri Nov 27 09:47:46 2020 +0100
@@ -472,7 +472,7 @@
             </div>
 
 
-            <div class="ng-scope inline-object">
+            <div class="ng-scope inline-object" v-if="globalConfiguration.PrintEnabled">
               <button class="wvButton--underline text-center"
                       data-toggle="tooltip" data-title="Print"
                       onclick="window.print()">