From b7e8c0de8a5dc62fd5398ee58497e73be714ae0e Mon Sep 17 00:00:00 2001 From: Molkobain Date: Mon, 25 Oct 2021 21:34:03 +0200 Subject: [PATCH] =?UTF-8?q?N=C2=B04400=20-=20Restore=20PHP=20debug=20outpu?= =?UTF-8?q?t=20being=20displayed=20in=20a=20modal?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- js/pages/backoffice/toolbox.js | 7 ++- sources/application/WebPage/iTopWebPage.php | 45 +------------------ .../backoffice/itopwebpage/layout.html.twig | 5 ++- .../pages/backoffice/webpage/layout.html.twig | 4 +- 4 files changed, 12 insertions(+), 49 deletions(-) diff --git a/js/pages/backoffice/toolbox.js b/js/pages/backoffice/toolbox.js index d238f70cf..7b67bd086 100644 --- a/js/pages/backoffice/toolbox.js +++ b/js/pages/backoffice/toolbox.js @@ -26,9 +26,12 @@ function ShowAboutBox() } function ShowDebug() { - if ($('#rawOutput > div').html() != '') + if ($('#ibo-raw-output').html() !== '') { - $('#rawOutput').dialog( {autoOpen: true, modal:false, width: '80%'}); + $('#ibo-raw-output') + // Note: We remove the CSS class before opening the dialog, otherwise the dialog will not be positioned correctly due to its content being still hidden + .removeClass('ibo-is-hidden') + .dialog( {autoOpen: true, modal: true, width: '80%', maxHeight: window.innerHeight * 0.8}); } } function ArchiveMode(bEnable) diff --git a/sources/application/WebPage/iTopWebPage.php b/sources/application/WebPage/iTopWebPage.php index fcf48db3b..9e76a49e4 100644 --- a/sources/application/WebPage/iTopWebPage.php +++ b/sources/application/WebPage/iTopWebPage.php @@ -408,47 +408,6 @@ JS // see GetUserPreference() in utils.js $sUserPrefs = appUserPreferences::GetAsJSON(); $this->add_script("var oUserPreferences = $sUserPrefs;"); - - // TODO 3.0.0: What is this for? - $this->add_script( - << 0) - { - sToken = ''; - if (sOwnershipToken != undefined) - { - sToken = '&token='+sOwnershipToken; - } - window.location.href = AddAppContext(GetAbsoluteUrlAppRoot()+'pages/UI.php?operation=release_lock_and_details&class='+sClass+'&id='+id+sToken); - } - else - { - window.location.href = sDefaultUrl; // Already contains the context... - } - } - - function BackToList(sClass) - { - window.location.href = AddAppContext(GetAbsoluteUrlAppRoot()+'pages/UI.php?operation=search_oql&oql_class='+sClass+'&oql_clause=WHERE id=0'); - } - - function ShowDebug() - { - if ($('#rawOutput > div').html() != '') - { - $('#rawOutput').dialog( {autoOpen: true, modal:false, width: '80%'}); - } - } -JS - ); } } @@ -835,8 +794,6 @@ HTML; // Data to be passed to the view $aData = []; - $s_captured_output = $this->ob_get_clean_safe(); - // Prepare page metadata $sAbsoluteUrlAppRoot = addslashes($this->m_sRootUrl); $sFaviconUrl = $this->GetFaviconAbsoluteUrl(); @@ -930,7 +887,7 @@ HTML; // TODO 3.0.0: TEMP, used while developping, remove it. 'sSanitizedContent' => utils::FilterXSS($this->s_content), 'sDeferredContent' => utils::FilterXSS($this->s_deferred_content), - 'sCapturedOutput' => utils::FilterXSS($s_captured_output), + 'sCapturedOutput' => utils::FilterXSS(trim($this->ob_get_clean_safe())), ] ); diff --git a/templates/pages/backoffice/itopwebpage/layout.html.twig b/templates/pages/backoffice/itopwebpage/layout.html.twig index 3ffe160e7..256ae51f2 100644 --- a/templates/pages/backoffice/itopwebpage/layout.html.twig +++ b/templates/pages/backoffice/itopwebpage/layout.html.twig @@ -35,5 +35,6 @@ {% endif %} {% endblock %} - - +{% block iboCapturedOutput %} +
{{ aPage.sCapturedOutput|raw }}
+{% endblock %} diff --git a/templates/pages/backoffice/webpage/layout.html.twig b/templates/pages/backoffice/webpage/layout.html.twig index cfbc31072..457075bf1 100644 --- a/templates/pages/backoffice/webpage/layout.html.twig +++ b/templates/pages/backoffice/webpage/layout.html.twig @@ -109,7 +109,9 @@ {% endblock %} {% endblock %} -{{ aPage.sCapturedOutput|raw }} +{% block iboCapturedOutput %} + {{ aPage.sCapturedOutput|raw }} +{% endblock %} \ No newline at end of file