]> _ Git - cubeextranet.git/commitdiff
wait #4993 @0.25
authorvincent@cubedesigners.com <vincent@cubedesigners.com@f5622870-0f3c-0410-866d-9cb505b7a8ef>
Fri, 24 Dec 2021 09:42:06 +0000 (09:42 +0000)
committervincent@cubedesigners.com <vincent@cubedesigners.com@f5622870-0f3c-0410-866d-9cb505b7a8ef>
Fri, 24 Dec 2021 09:42:06 +0000 (09:42 +0000)
inc/ws/Metier/class.ws.book.parametres.php
inc/ws/Util/html5/master/class.ws.html5.compiler.php

index 881083b834a3b8ed60844a74a0a1a6fce6b2514c..9210069c264ba396dd8117992f9ad52f6628b684 100644 (file)
@@ -740,8 +740,9 @@ class wsBookParametres extends wsParametres
         $this->fields['offlineWindowsInstallPath'] = ['type' => 'text', 'default' => '', 'editable' => true, 'label' => __('Chemin d\'installation par défaut'), 'hint' => __('Par défaut') . ': %LOCALAPPDATA%/%title%'];
         $this->fields['offlineWindowsProfilePath'] = ['type' => 'text', 'default' => '', 'editable' => true, 'label' => __('Répertoire de stockage du profile'), 'hint' => __('Par défaut') . ': %LOCALAPPDATA%/%title%'];
         $this->fields['offlineEnableAdvancedPrinting'] = ['type' => 'boolean', 'default' => true, 'editable' => true, 'label' => __('Activer le menu d\'impression avancée')];
+        $this->fields['debugConsole'] = ['type' => 'boolean', 'default' => false, 'editable' => true, 'label' => __('Activer la console de débuggage')];
         $this->forms['offline'] = array('label' => __('Version offline'),
-            'fieldsnames' => array('offlineTitle', 'offlineLink', '|', 'offlineWindowsInstallPath', 'offlineWindowsProfilePath', '|', 'offlineEnableAdvancedPrinting'));
+            'fieldsnames' => array('offlineTitle', 'offlineLink', '|', 'offlineWindowsInstallPath', 'offlineWindowsProfilePath', '|', 'offlineEnableAdvancedPrinting','|','debugConsole'));
 
         $this->fields['mobilefirstFluidbookId'] = ['type' => 'text', 'default' => '', 'editable' => true, 'label' => 'Identifiant du fluidbook "Mobile first"', 'grade' => 5];
         $this->fields['mobilefirstBreakpoint'] = ['type' => 'text', 'default' => '640', 'editable' => true, 'label' => 'Breakpoint du passage à la version "Mobile first" (en pixels)', 'grade' => 5];
index 21f89381b99c9731823cfc859801e4f39fc6f4c2..f52949350384e796d774dde930490ae7c9b2ea37 100644 (file)
@@ -1493,8 +1493,67 @@ height="0" width="0" style="display:none;visibility:hidden"></iframe></noscript>
             }
             $lang = $this->book->lang;
 
+            $console = '';
+            if ($this->book->parametres->debugConsole) {
+                $console = '<div id="consoleHolder" style="position: fixed;bottom:0"><div id="consolelog" style="font-family: \'Courier New\', Courier, monospace; font-size: 12px; margin: 40px 30px 0px; background-color: white; border: 2px solid black; padding: 10px;"></div>
+<input type="text" id="consoleinput" style="margin: 0px 30px; width: 400px;" onkeypress="return evalConsoleInput(event, this.value);" /></div>
+
+<script type="text/javascript">
+       var appendConsole = function(message, type) {
+               var color = "black";
+               if (type === "error") {
+                       color = "red";
+               } else if (type === "debug") {
+                       color = "blue";
+               }
+               var div = document.createElement(\'div\');
+               div.style.color = color;
+               div.style.marginBottom = "10px";
+               div.innerHTML = message;
+               document.getElementById("consolelog").appendChild(div);
+       }
+       var originalConsole = null;
+       if (window.console != null) {
+               originalConsole = window.console;
+       }
+       window.console = {
+               log: function(message) {
+                       appendConsole(message, "info");
+                       originalConsole.log(message);
+               },
+               info: function(message) {
+                       appendConsole(message, "info");
+                       originalConsole.info(message);
+               },
+               debug: function(message) {
+                       appendConsole(message, "debug");
+                       originalConsole.debug(message);
+               },
+               error: function(message) {
+                       appendConsole(message, "error");
+                       originalConsole.error(message);
+               }
+       };
+       function evalConsoleInput(e, message) {
+               if (e.keyCode == 13) { // 13 is the keycode for the enter key
+                       var inputField = document.getElementById("consoleinput");
+                       var evalString = inputField.value;
+                       console.log("> " + evalString);
+                       try {
+                               var returnValue = eval(evalString);
+                               console.log(returnValue);
+                       } catch (e) {
+                               console.error(e.message);
+                       } finally {
+                               inputField.value = "";
+                       }
+               }
+       }
+</script>';
+            }
+
             $this->log('Got index vars 5');
-            $vars = array('lang', 'titre', 'credits', 'style', 'script', 'pagesContents', 'print', 'hiddenContents', 'splash', 'splashstyles', 'cache', 'bgcolor', 'message', 'favicon', 'svg', 'beginbody', 'csp', 'opengraph', 'twittercard', 'description');
+            $vars = array('lang', 'titre', 'credits', 'style', 'script', 'pagesContents', 'print', 'hiddenContents', 'splash', 'splashstyles', 'cache', 'bgcolor', 'message', 'favicon', 'svg', 'beginbody', 'csp', 'opengraph', 'twittercard', 'description', 'console');
 
             $res = [];
             foreach ($vars as $v) {