$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];
}
$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) {