diff --git a/sources/Renderer/BlockRenderer.php b/sources/Renderer/BlockRenderer.php index 9c2d206b69..2dff4d4a0a 100644 --- a/sources/Renderer/BlockRenderer.php +++ b/sources/Renderer/BlockRenderer.php @@ -21,7 +21,6 @@ namespace Combodo\iTop\Renderer; use Combodo\iTop\Application\TwigBase\Twig\TwigHelper; use Combodo\iTop\Application\UI\iUIBlock; -use utils; /** * Class BlockRenderer @@ -221,8 +220,6 @@ class BlockRenderer HTML; } - // TODO 2.8.0 - //$sOutput .= utils::FilterXSS($this->RenderHtml()); $sOutput .= $this->RenderHtml(); // JS last so all markup is build and ready diff --git a/sources/application/WebPage/TabManager.php b/sources/application/WebPage/TabManager.php index a5530ce9f4..d064e7858b 100644 --- a/sources/application/WebPage/TabManager.php +++ b/sources/application/WebPage/TabManager.php @@ -284,102 +284,7 @@ class TabManager */ public function RenderIntoContent(string $sContent, WebPage $oPage) { - // Render the tabs in the page (if any) - $container_index = 0; - foreach ($this->m_aTabs as $sTabContainerName => $aTabs) { - $sTabs = ''; - $sPrefix = $aTabs['prefix']; - if (count($aTabs['tabs']) > 0) { - // Clean tabs - foreach ($aTabs['tabs'] as $sTabCode => $aTabData) { - // Sometimes people set an empty tab to force content NOT to be rendered in the previous one. We need to remove them. - // Note: Look for "->SetCurrentTab('');" for examples. - if ($sTabCode === '') { - unset($aTabs['tabs'][$sTabCode]); - } - } - - // Render tabs - if ($oPage->IsPrintableVersion()) { - $oPage->add_ready_script( - <<< EOF -oHiddeableChapters = {}; -EOF - ); - $sTabs = "\n
\n"; - $i = 0; - foreach ($aTabs['tabs'] as $sTabCode => $aTabData) { - $sTabCodeForJs = addslashes($sTabCode); - $sTabTitleForHtml = utils::HtmlEntities($aTabData['title']); - $sTabId = "tab_{$sPrefix}{$container_index}$i"; - switch ($aTabData['type']) { - case static::ENUM_TAB_TYPE_AJAX: - $sTabHtml = ''; - $sUrl = $aTabData['url']; - $oPage->add_ready_script( - <<< EOF -$.post('$sUrl', {printable: '1'}, function(data){ - $('#$sTabId > .printable-tab-content').append(data); -}); -EOF - ); - break; - - case static::ENUM_TAB_TYPE_HTML: - default: - $sTabHtml = $aTabData['html']; - } - $sTabs .= "

$sTabTitleForHtml

".$sTabHtml."
\n"; - $oPage->add_ready_script( - <<< EOF -oHiddeableChapters['$sTabId'] = '$sTabTitleForHtml'; -EOF - ); - $i++; - } - $sTabs .= "
\n\n"; - } else { - $sTabs = "\n
\n"; - $sTabs .= "\n"; - // Now add the content of the tabs themselves - $i = 0; - foreach ($aTabs['tabs'] as $sTabCode => $aTabData) { - switch ($aTabData['type']) { - case static::ENUM_TAB_TYPE_AJAX: - // Nothing to add - break; - - case static::ENUM_TAB_TYPE_HTML: - default: - $sTabs .= "
".$aTabData['html']."
\n"; - } - $i++; - } - $sTabs .= "
\n\n"; - } - } - $sContent = str_replace("\$Tabs:$sTabContainerName\$", $sTabs, $sContent); - $container_index++; - } - - return $sContent; + return ''; } /** diff --git a/sources/application/WebPage/WebPage.php b/sources/application/WebPage/WebPage.php index 4dfd05df17..42b26d0202 100644 --- a/sources/application/WebPage/WebPage.php +++ b/sources/application/WebPage/WebPage.php @@ -697,10 +697,8 @@ class WebPage implements Page public function output() { // Send headers - if ($this->GetOutputFormat() === 'html') { - foreach ($this->a_headers as $sHeader) { - header($sHeader); - } + foreach ($this->a_headers as $sHeader) { + header($sHeader); } $this->s_content = $this->ob_get_clean_safe(); @@ -730,7 +728,7 @@ class WebPage implements Page 'aCssInline' => $this->a_styles, 'aJsFiles' => $this->a_linked_scripts, 'aJsInlineLive' => $this->a_scripts, - // TODO 2.8.0: TEMP, used while developping, remove it. + // TODO 2.8.0: TEMP, used while developing, remove it. 'sSanitizedContent' => utils::FilterXSS($this->s_content), 'sDeferredContent' => utils::FilterXSS($this->s_deferred_content), ]; @@ -1012,8 +1010,7 @@ class WebPage implements Page */ protected function outputCollapsibleSectionInit() { - if (!$this->bHasCollapsibleSection) - { + if (!$this->bHasCollapsibleSection) { return; } diff --git a/sources/application/WebPage/iTopWebPage.php b/sources/application/WebPage/iTopWebPage.php index 7aa55f4fbe..99e6461172 100644 --- a/sources/application/WebPage/iTopWebPage.php +++ b/sources/application/WebPage/iTopWebPage.php @@ -40,7 +40,7 @@ class iTopWebPage extends NiceWebPage implements iTabbedPage const DEFAULT_BREADCRUMB_ENTRY_ICON_TYPE = self::ENUM_BREADCRUMB_ENTRY_ICON_TYPE_IMAGE; /** @var string DEFAULT_PAGE_TEMPLATE_REL_PATH The relative path (from /templates/) to the default page template */ - const DEFAULT_PAGE_TEMPLATE_REL_PATH = 'pages/backoffice/layout'; + const DEFAULT_PAGE_TEMPLATE_REL_PATH = 'pages/backoffice/itopwebpage/layout'; private $m_aMessages; private $m_aInitScript = array(); @@ -979,6 +979,9 @@ EOF; $this->output_dict_entries(); $this->GetContentLayout()->SetExtraHtmlContent(utils::FilterXSS($this->s_content)); + // TODO 2.8.0 : to be removed + $this->outputCollapsibleSectionInit(); + // Base structure of data to pass to the TWIG template $aData['aPage'] = [ 'sAbsoluteUrlAppRoot' => $sAbsoluteUrlAppRoot, @@ -1056,10 +1059,8 @@ EOF; $oTwigEnv = TwigHelper::GetTwigEnvironment(BlockRenderer::TWIG_BASE_PATH, BlockRenderer::TWIG_ADDITIONAL_PATHS); // Send headers - if ($this->GetOutputFormat() === 'html') - { - foreach ($this->a_headers as $sHeader) - { + if ($this->GetOutputFormat() === 'html') { + foreach ($this->a_headers as $sHeader) { header($sHeader); } } diff --git a/templates/layouts/contentblock/layout.html.twig b/templates/layouts/contentblock/layout.html.twig index 639a1ca5cf..7a6cc467da 100644 --- a/templates/layouts/contentblock/layout.html.twig +++ b/templates/layouts/contentblock/layout.html.twig @@ -1,9 +1,7 @@ {% apply spaceless %} - {#
#} {% block iboContentBlockContainer %} {% for oSubBlock in oUIBlock.GetSubBlocks() %} {{ render_block(oSubBlock, {aPage: aPage}) }} {% endfor %} {% endblock %} - {#
#} {% endapply %} \ No newline at end of file diff --git a/templates/pages/backoffice/layout.html.twig b/templates/pages/backoffice/itopwebpage/layout.html.twig similarity index 98% rename from templates/pages/backoffice/layout.html.twig rename to templates/pages/backoffice/itopwebpage/layout.html.twig index 12456a3d9d..4e1923da1c 100644 --- a/templates/pages/backoffice/layout.html.twig +++ b/templates/pages/backoffice/itopwebpage/layout.html.twig @@ -23,4 +23,4 @@ {% for sJsInline in aPage.aJsInlineOnInit %} {{ sJsInline|raw }} {% endfor %} -{% endblock %} +{% endblock %} \ No newline at end of file diff --git a/templates/pages/backoffice/nicewebpage/layout.html.twig b/templates/pages/backoffice/nicewebpage/layout.html.twig index 602ebf6f62..b098b7bcb5 100644 --- a/templates/pages/backoffice/nicewebpage/layout.html.twig +++ b/templates/pages/backoffice/nicewebpage/layout.html.twig @@ -6,5 +6,4 @@ {{ sJsInline|raw }} }, 50); {% endfor %} -{% endblock %} - +{% endblock %} \ No newline at end of file diff --git a/templates/pages/backoffice/webpage/layout.html.twig b/templates/pages/backoffice/webpage/layout.html.twig index e652ebd488..314490fdf7 100644 --- a/templates/pages/backoffice/webpage/layout.html.twig +++ b/templates/pages/backoffice/webpage/layout.html.twig @@ -74,4 +74,4 @@ {% endblock %} {% endblock %} - + \ No newline at end of file