From 2dae21259e7356a6f9f49884d8029e2e08dc0732 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sun, 10 Dec 2017 19:03:18 +0100 Subject: [PATCH] Fix the switch show more/less --- htdocs/core/class/doleditor.class.php | 19 ++++++++++++++++--- htdocs/core/lib/geturl.lib.php | 2 +- htdocs/langs/en_US/main.lang | 2 +- htdocs/website/index.php | 2 +- 4 files changed, 19 insertions(+), 6 deletions(-) diff --git a/htdocs/core/class/doleditor.class.php b/htdocs/core/class/doleditor.class.php index 723ae0d47b1..111f5ff9f57 100644 --- a/htdocs/core/class/doleditor.class.php +++ b/htdocs/core/class/doleditor.class.php @@ -271,10 +271,23 @@ class DolEditor $out.= ' var aceEditor = window.ace.edit("'.$this->htmlname.'aceeditorid"); var StatusBar = window.ace.require("ace/ext/statusbar").StatusBar; // Init status bar. Need lib ext-statusbar var statusBar = new StatusBar(aceEditor, document.getElementById("statusBar'.$this->htmlname.'")); // Init status bar. Need lib ext-statusbar - jQuery(".morelines'.$this->htmlname.'").click(function() { - console.log("We click on more lines"); + var oldNbOfLines = 0 + jQuery(".morelines'.$this->htmlname.'").click(function() { var aceEditor = window.ace.edit("'.$this->htmlname.'aceeditorid"); - aceEditor.setOptions({ maxLines: 500 }); + currentline = aceEditor.getOption("maxLines"); + if (oldNbOfLines == 0) + { + oldNbOfLines = currentline; + } + console.log("We click on more lines - we have currently "+oldNbOfLines); + if (currentline < 500) + { + aceEditor.setOptions({ maxLines: 500 }); + } + else + { + aceEditor.setOptions({ maxLines: oldNbOfLines }); + } }); })'; $out.= ''."\n"; diff --git a/htdocs/core/lib/geturl.lib.php b/htdocs/core/lib/geturl.lib.php index 55cf8290a89..2a45a71c4c9 100644 --- a/htdocs/core/lib/geturl.lib.php +++ b/htdocs/core/lib/geturl.lib.php @@ -124,7 +124,7 @@ function getURLContent($url,$postorget='GET',$param='',$followlocation=1,$addhea dol_syslog("getURLContent request=".$request); //dol_syslog("getURLContent response =".response); // This may contains binary data, so we dont output it - dol_syslog("getURLContent response size =".strlen($response)); // This may contains binary data, so we dont output it + dol_syslog("getURLContent response size=".strlen($response)); // This may contains binary data, so we dont output it $rep=array(); if (curl_errno($ch)) diff --git a/htdocs/langs/en_US/main.lang b/htdocs/langs/en_US/main.lang index a9b135e2e1a..fd9f637cd0d 100644 --- a/htdocs/langs/en_US/main.lang +++ b/htdocs/langs/en_US/main.lang @@ -774,7 +774,7 @@ SetBankAccount=Define Bank Account AccountCurrency=Account currency ViewPrivateNote=View notes XMoreLines=%s line(s) hidden -ShowMoreLines=Show more lines +ShowMoreLines=Show more/less lines PublicUrl=Public URL AddBox=Add box SelectElementAndClick=Select an element and click %s diff --git a/htdocs/website/index.php b/htdocs/website/index.php index 4f8c314b25e..742b308c89f 100644 --- a/htdocs/website/index.php +++ b/htdocs/website/index.php @@ -1901,7 +1901,7 @@ if ($action == 'editmeta' || $action == 'create') print $formadmin->select_language($pagelang?$pagelang:$langs->defaultlang, 'WEBSITE_LANG', 0, null, '1'); print ''; - print ''; + print ''; print $langs->trans('HtmlHeaderPage'); print ''; $doleditor=new DolEditor('htmlheader', $pagehtmlheader, '', '220', 'ace', 'In', true, false, 'ace', 0, '100%', '');