mirror of
https://github.com/Combodo/iTop.git
synced 2026-05-01 14:38:47 +02:00
Merge remote-tracking branch 'origin/develop' into feature/8772_form_dependencies_manager
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
* @copyright Copyright (C) 2010-2024 Combodo SAS
|
||||
* @license http://opensource.org/licenses/AGPL-3.0
|
||||
@@ -25,7 +26,7 @@ class AjaxPage extends WebPage implements iTabbedPage
|
||||
*/
|
||||
protected $m_oTabs;
|
||||
|
||||
const DEFAULT_PAGE_TEMPLATE_REL_PATH = 'pages/backoffice/ajaxpage/layout';
|
||||
public const DEFAULT_PAGE_TEMPLATE_REL_PATH = 'pages/backoffice/ajaxpage/layout';
|
||||
/** @var string */
|
||||
private $sPromiseId;
|
||||
|
||||
@@ -41,7 +42,7 @@ class AjaxPage extends WebPage implements iTabbedPage
|
||||
* @param string $s_title Not used
|
||||
* @param bool $bOutputExtraResources if true will output also JS & CSS resources
|
||||
*/
|
||||
function __construct($s_title)
|
||||
public function __construct($s_title)
|
||||
{
|
||||
$oKpi = new ExecutionKPI();
|
||||
$sPrintable = utils::ReadParam('printable', '0');
|
||||
@@ -288,7 +289,7 @@ class AjaxPage extends WebPage implements iTabbedPage
|
||||
|
||||
if (!empty($sCurrentTabContainer) && !empty($sCurrentTab)) {
|
||||
$iOffset = $this->m_oTabs->GetCurrentTabLength();
|
||||
return array('tc' => $sCurrentTabContainer, 'tab' => $sCurrentTab, 'offset' => $iOffset);
|
||||
return ['tc' => $sCurrentTabContainer, 'tab' => $sCurrentTab, 'offset' => $iOffset];
|
||||
} else {
|
||||
return parent::start_capture();
|
||||
}
|
||||
@@ -335,6 +336,6 @@ class AjaxPage extends WebPage implements iTabbedPage
|
||||
*/
|
||||
public static function FilterXSS($sHTML)
|
||||
{
|
||||
return str_ireplace(array('<script', '</script>'), array('<!-- <removed-script', '</removed-script> -->'), $sHTML);
|
||||
return str_ireplace(['<script', '</script>'], ['<!-- <removed-script', '</removed-script> -->'], $sHTML);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* @copyright Copyright (C) 2010-2024 Combodo SAS
|
||||
* @license http://opensource.org/licenses/AGPL-3.0
|
||||
@@ -8,7 +9,7 @@ namespace Combodo\iTop\Application\WebPage;
|
||||
|
||||
class CLILikeWebPage extends WebPage
|
||||
{
|
||||
const DEFAULT_PAGE_TEMPLATE_REL_PATH = 'pages/backoffice/clilikewebpage/layout';
|
||||
public const DEFAULT_PAGE_TEMPLATE_REL_PATH = 'pages/backoffice/clilikewebpage/layout';
|
||||
public function add_comment($sText)
|
||||
{
|
||||
$this->add('#'.$sText."<br/>\n");
|
||||
|
||||
@@ -1,9 +1,10 @@
|
||||
<?php
|
||||
|
||||
// Copyright (C) 2010-2024 Combodo SAS
|
||||
//
|
||||
// This file is part of iTop.
|
||||
//
|
||||
// iTop is free software; you can redistribute it and/or modify
|
||||
// iTop is free software; you can redistribute it and/or modify
|
||||
// it under the terms of the GNU Affero General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
@@ -22,33 +23,32 @@ use DBSearch;
|
||||
use ExecutionKPI;
|
||||
|
||||
/**
|
||||
* CLI page
|
||||
* CLI page
|
||||
* The page adds the content-type text/XML and the encoding into the headers
|
||||
*
|
||||
* @copyright Copyright (C) 2010-2024 Combodo SAS
|
||||
* @license http://opensource.org/licenses/AGPL-3.0
|
||||
*/
|
||||
|
||||
|
||||
class CLIPage implements Page
|
||||
{
|
||||
/** @var string */
|
||||
public $s_title;
|
||||
|
||||
function __construct($s_title)
|
||||
{
|
||||
$this->s_title = $s_title;
|
||||
}
|
||||
public function __construct($s_title)
|
||||
{
|
||||
$this->s_title = $s_title;
|
||||
}
|
||||
|
||||
public function output()
|
||||
{
|
||||
if (class_exists('DBSearch')) {
|
||||
DBSearch::RecordQueryTrace();
|
||||
}
|
||||
if (class_exists('ExecutionKPI')) {
|
||||
ExecutionKPI::ReportStats();
|
||||
}
|
||||
}
|
||||
public function output()
|
||||
{
|
||||
if (class_exists('DBSearch')) {
|
||||
DBSearch::RecordQueryTrace();
|
||||
}
|
||||
if (class_exists('ExecutionKPI')) {
|
||||
ExecutionKPI::ReportStats();
|
||||
}
|
||||
}
|
||||
|
||||
public function add($sText)
|
||||
{
|
||||
@@ -70,27 +70,21 @@ class CLIPage implements Page
|
||||
echo "#".$sText."\n";
|
||||
}
|
||||
|
||||
public function table($aConfig, $aData, $aParams = array())
|
||||
public function table($aConfig, $aData, $aParams = [])
|
||||
{
|
||||
$aCells = array();
|
||||
foreach($aConfig as $sName=>$aDef)
|
||||
{
|
||||
if (strlen($aDef['description']) > 0)
|
||||
{
|
||||
$aCells = [];
|
||||
foreach ($aConfig as $sName => $aDef) {
|
||||
if (strlen($aDef['description']) > 0) {
|
||||
$aCells[] = $aDef['label'].' ('.$aDef['description'].')';
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
$aCells[] = $aDef['label'];
|
||||
}
|
||||
}
|
||||
echo implode(';', $aCells)."\n";
|
||||
|
||||
foreach($aData as $aRow)
|
||||
{
|
||||
$aCells = array();
|
||||
foreach($aConfig as $sName=>$aAttribs)
|
||||
{
|
||||
foreach ($aData as $aRow) {
|
||||
$aCells = [];
|
||||
foreach ($aConfig as $sName => $aAttribs) {
|
||||
$sValue = $aRow["$sName"];
|
||||
$aCells[] = $sValue;
|
||||
}
|
||||
|
||||
@@ -1,9 +1,10 @@
|
||||
<?php
|
||||
|
||||
// Copyright (C) 2010-2024 Combodo SAS
|
||||
//
|
||||
// This file is part of iTop.
|
||||
//
|
||||
// iTop is free software; you can redistribute it and/or modify
|
||||
// iTop is free software; you can redistribute it and/or modify
|
||||
// it under the terms of the GNU Affero General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
@@ -29,40 +30,39 @@ use ExecutionKPI;
|
||||
* @license http://opensource.org/licenses/AGPL-3.0
|
||||
*/
|
||||
|
||||
|
||||
class CSVPage extends WebPage
|
||||
{
|
||||
function __construct($s_title)
|
||||
{
|
||||
$oKpi = new ExecutionKPI();
|
||||
parent::__construct($s_title);
|
||||
$this->add_header("Content-type: text/plain; charset=".self::PAGES_CHARSET);
|
||||
$this->no_cache();
|
||||
$this->add_http_headers();
|
||||
//$this->add_header("Content-Transfer-Encoding: binary");
|
||||
$oKpi->ComputeStats(get_class($this).' creation', 'CSVPage');
|
||||
}
|
||||
public function __construct($s_title)
|
||||
{
|
||||
$oKpi = new ExecutionKPI();
|
||||
parent::__construct($s_title);
|
||||
$this->add_header("Content-type: text/plain; charset=".self::PAGES_CHARSET);
|
||||
$this->no_cache();
|
||||
$this->add_http_headers();
|
||||
//$this->add_header("Content-Transfer-Encoding: binary");
|
||||
$oKpi->ComputeStats(get_class($this).' creation', 'CSVPage');
|
||||
}
|
||||
|
||||
public function output()
|
||||
{
|
||||
$this->add_header("Content-Length: ".strlen(trim($this->s_content)));
|
||||
public function output()
|
||||
{
|
||||
$this->add_header("Content-Length: ".strlen(trim($this->s_content)));
|
||||
|
||||
// Get the unexpected output but do nothing with it
|
||||
$sTrash = $this->ob_get_clean_safe();
|
||||
// Get the unexpected output but do nothing with it
|
||||
$sTrash = $this->ob_get_clean_safe();
|
||||
|
||||
$oKpi = new ExecutionKPI();
|
||||
foreach ($this->a_headers as $s_header) {
|
||||
header($s_header);
|
||||
}
|
||||
echo trim($this->s_content);
|
||||
echo "\n";
|
||||
$oKpi->ComputeAndReport('Echoing ('.round(strlen($this->s_content) / 1024).' Kb)');
|
||||
$oKpi = new ExecutionKPI();
|
||||
foreach ($this->a_headers as $s_header) {
|
||||
header($s_header);
|
||||
}
|
||||
echo trim($this->s_content);
|
||||
echo "\n";
|
||||
$oKpi->ComputeAndReport('Echoing ('.round(strlen($this->s_content) / 1024).' Kb)');
|
||||
|
||||
if (class_exists('DBSearch')) {
|
||||
DBSearch::RecordQueryTrace();
|
||||
}
|
||||
ExecutionKPI::ReportStats();
|
||||
}
|
||||
if (class_exists('DBSearch')) {
|
||||
DBSearch::RecordQueryTrace();
|
||||
}
|
||||
ExecutionKPI::ReportStats();
|
||||
}
|
||||
|
||||
public function small_p($sText)
|
||||
{
|
||||
@@ -81,29 +81,23 @@ class CSVPage extends WebPage
|
||||
public function add_comment($sText)
|
||||
{
|
||||
$this->s_content .= "#".$sText."\n";
|
||||
}
|
||||
}
|
||||
|
||||
public function table($aConfig, $aData, $aParams = array())
|
||||
public function table($aConfig, $aData, $aParams = [])
|
||||
{
|
||||
$aCells = array();
|
||||
foreach($aConfig as $sName=>$aDef)
|
||||
{
|
||||
if (strlen($aDef['description']) > 0)
|
||||
{
|
||||
$aCells = [];
|
||||
foreach ($aConfig as $sName => $aDef) {
|
||||
if (strlen($aDef['description']) > 0) {
|
||||
$aCells[] = $aDef['label'].' ('.$aDef['description'].')';
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
$aCells[] = $aDef['label'];
|
||||
}
|
||||
}
|
||||
$this->s_content .= implode(';', $aCells)."\n";
|
||||
|
||||
foreach($aData as $aRow)
|
||||
{
|
||||
$aCells = array();
|
||||
foreach($aConfig as $sName=>$aAttribs)
|
||||
{
|
||||
foreach ($aData as $aRow) {
|
||||
$aCells = [];
|
||||
foreach ($aConfig as $sName => $aAttribs) {
|
||||
$sValue = $aRow["$sName"];
|
||||
$aCells[] = $sValue;
|
||||
}
|
||||
@@ -111,4 +105,3 @@ class CSVPage extends WebPage
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1,9 +1,10 @@
|
||||
<?php
|
||||
|
||||
// Copyright (C) 2024 Combodo SAS
|
||||
//
|
||||
// This file is part of iTop.
|
||||
//
|
||||
// iTop is free software; you can redistribute it and/or modify
|
||||
// iTop is free software; you can redistribute it and/or modify
|
||||
// it under the terms of the GNU Affero General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
@@ -30,10 +31,9 @@ use ExecutionKPI;
|
||||
* @license http://opensource.org/licenses/AGPL-3.0
|
||||
*/
|
||||
|
||||
|
||||
class CaptureWebPage extends WebPage
|
||||
{
|
||||
function __construct()
|
||||
public function __construct()
|
||||
{
|
||||
$oKpi = new ExecutionKPI();
|
||||
parent::__construct('capture web page');
|
||||
@@ -51,8 +51,7 @@ class CaptureWebPage extends WebPage
|
||||
public function GetJS()
|
||||
{
|
||||
$sRet = implode("\n", $this->a_scripts);
|
||||
if (!empty($this->s_deferred_content))
|
||||
{
|
||||
if (!empty($this->s_deferred_content)) {
|
||||
$sRet .= "\n\$('body').append('".addslashes(str_replace("\n", '', $this->s_deferred_content))."');";
|
||||
}
|
||||
|
||||
@@ -93,4 +92,3 @@ class CaptureWebPage extends WebPage
|
||||
throw new Exception(__method__.' should not be called');
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
* @copyright Copyright (C) 2010-2024 Combodo SAS
|
||||
* @license http://opensource.org/licenses/AGPL-3.0
|
||||
|
||||
@@ -16,7 +16,6 @@ use utils;
|
||||
* @license http://opensource.org/licenses/AGPL-3.0
|
||||
*/
|
||||
|
||||
|
||||
/**
|
||||
* @since 2.7.1 N°2641 class creation
|
||||
*/
|
||||
@@ -55,10 +54,9 @@ class ErrorPage extends NiceWebPage
|
||||
public function error($sText)
|
||||
{
|
||||
$this->add("<div class=\"message message-error\">$sText</div>");
|
||||
if(utils::IsEasterEggAllowed())
|
||||
{
|
||||
if (utils::IsEasterEggAllowed()) {
|
||||
$this->add('<div class="message message-valid">'.Dict::S('UI:ErrorPage:UnstableVersion').'</div>');
|
||||
$this->add('<img src="' . utils::GetAbsoluteUrlAppRoot() . 'images/alpha-fatal-error.gif">');
|
||||
$this->add('<img src="'.utils::GetAbsoluteUrlAppRoot().'images/alpha-fatal-error.gif">');
|
||||
$this->add('<div class="message message-valid">'.nl2br(Dict::S('UI:ErrorPage:KittyDisclaimer')).'</div>');
|
||||
}
|
||||
$this->log_error($sText);
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
* @copyright Copyright (C) 2010-2024 Combodo SAS
|
||||
* @license http://opensource.org/licenses/AGPL-3.0
|
||||
@@ -73,6 +74,6 @@ class JsonPPage extends JsonPage
|
||||
{
|
||||
$sContent = parent::ComputeContent();
|
||||
|
||||
return $this->sCallbackName . '(' . $sContent . ');';
|
||||
return $this->sCallbackName.'('.$sContent.');';
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
* @copyright Copyright (C) 2010-2024 Combodo SAS
|
||||
* @license http://opensource.org/licenses/AGPL-3.0
|
||||
@@ -89,7 +90,7 @@ class JsonPage extends WebPage
|
||||
*/
|
||||
protected function OutputHeaders(): void
|
||||
{
|
||||
$this->add_header('Content-type: ' . $this->sContentType);
|
||||
$this->add_header('Content-type: '.$this->sContentType);
|
||||
|
||||
foreach ($this->a_headers as $s_header) {
|
||||
header($s_header);
|
||||
@@ -126,4 +127,4 @@ class JsonPage extends WebPage
|
||||
$oKpi->ComputeAndReport('Echoing ('.round(strlen($sContent) / 1024).' Kb)');
|
||||
ExecutionKPI::ReportStats();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Copyright (C) 2013-2024 Combodo SAS
|
||||
*
|
||||
@@ -61,9 +62,9 @@ class NiceWebPage extends WebPage
|
||||
'js/searchformforeignkeys.js',
|
||||
];
|
||||
|
||||
const DEFAULT_PAGE_TEMPLATE_REL_PATH = 'pages/backoffice/nicewebpage/layout';
|
||||
public const DEFAULT_PAGE_TEMPLATE_REL_PATH = 'pages/backoffice/nicewebpage/layout';
|
||||
|
||||
var $m_sRootUrl;
|
||||
public $m_sRootUrl;
|
||||
|
||||
public function __construct($s_title, $bPrintable = false)
|
||||
{
|
||||
@@ -145,8 +146,7 @@ JS
|
||||
$this->LinkScriptFromAppRoot('node_modules/jquery/dist/jquery.min.js');
|
||||
$this->LinkScriptFromAppRoot('js/ajax_hook.js');
|
||||
$this->LinkScriptFromAppRoot('js/jquery.blockUI.js');
|
||||
if (utils::IsDevelopmentEnvironment()) // Needed since many other plugins still rely on oldies like $.browser
|
||||
{
|
||||
if (utils::IsDevelopmentEnvironment()) { // Needed since many other plugins still rely on oldies like $.browser
|
||||
$this->LinkScriptFromAppRoot('js/jquery-migrate.dev-params.js');
|
||||
$this->LinkScriptFromAppRoot('node_modules/jquery-migrate/dist/jquery-migrate.js');
|
||||
} else {
|
||||
@@ -170,11 +170,10 @@ JS
|
||||
$this->add_dict_entries('UI:Combo');
|
||||
}
|
||||
|
||||
|
||||
public function SetRootUrl($sRootUrl)
|
||||
{
|
||||
$this->m_sRootUrl = $sRootUrl;
|
||||
}
|
||||
{
|
||||
$this->m_sRootUrl = $sRootUrl;
|
||||
}
|
||||
|
||||
public function small_p($sText)
|
||||
{
|
||||
@@ -191,7 +190,7 @@ JS
|
||||
return utils::GetAbsoluteUrlModulesRoot();
|
||||
}
|
||||
|
||||
function GetApplicationContext()
|
||||
public function GetApplicationContext()
|
||||
{
|
||||
$oAppContext = new ApplicationContext();
|
||||
return $oAppContext->GetForLink();
|
||||
@@ -203,11 +202,9 @@ JS
|
||||
// $aTopLevelClasses = array('bizService', 'bizContact', 'logInfra', 'bizDocument');
|
||||
// These are classes wich root class is cmdbAbstractObject !
|
||||
$this->add("<select id=\"select_$sName\" name=\"$sName\">");
|
||||
$aValidClasses = array();
|
||||
foreach(MetaModel::GetClasses('bizmodel') as $sClassName)
|
||||
{
|
||||
if (is_null($iActionCode) || UserRights::IsActionAllowed($sClassName, $iActionCode))
|
||||
{
|
||||
$aValidClasses = [];
|
||||
foreach (MetaModel::GetClasses('bizmodel') as $sClassName) {
|
||||
if (is_null($iActionCode) || UserRights::IsActionAllowed($sClassName, $iActionCode)) {
|
||||
$sSelected = ($sClassName == $sDefaultValue) ? " SELECTED" : "";
|
||||
$sDescription = MetaModel::GetClassDescription($sClassName);
|
||||
$sDisplayName = MetaModel::GetName($sClassName);
|
||||
@@ -224,8 +221,7 @@ JS
|
||||
public function add_select($aChoices, $sName, $sDefaultValue, $iWidthPx)
|
||||
{
|
||||
$this->add("<select id=\"select_$sName\" name=\"$sName\">");
|
||||
foreach($aChoices as $sKey => $sValue)
|
||||
{
|
||||
foreach ($aChoices as $sKey => $sValue) {
|
||||
$sSelected = ($sKey == $sDefaultValue) ? " SELECTED" : "";
|
||||
$this->add("<option style=\"width: ".$iWidthPx." px;\" value=\"".htmlspecialchars($sKey)."\"$sSelected>".utils::EscapeHtml($sValue)."</option>");
|
||||
}
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Copyright (C) 2013-2024 Combodo SAS
|
||||
*
|
||||
@@ -22,7 +23,6 @@ namespace Combodo\iTop\Application\WebPage;
|
||||
use Combodo\iTop\Renderer\BlockRenderer;
|
||||
use ExecutionKPI;
|
||||
|
||||
|
||||
/**
|
||||
* Special class of WebPage for printing into a PDF document
|
||||
*/
|
||||
@@ -35,7 +35,7 @@ class PDFPage extends WebPage
|
||||
{
|
||||
$oKpi = new ExecutionKPI();
|
||||
parent::__construct($s_title);
|
||||
if (!defined('K_PATH_FONTS')){
|
||||
if (!defined('K_PATH_FONTS')) {
|
||||
define('K_PATH_FONTS', APPROOT.'lib/combodo/tcpdf/fonts/');
|
||||
}
|
||||
$this->oPdf = new iTopPDF($sPageOrientation, 'mm', $sPageFormat, true, self::PAGES_CHARSET, false);
|
||||
@@ -152,12 +152,10 @@ EOF
|
||||
public function output()
|
||||
{
|
||||
$this->add_header('Content-type: application/x-pdf');
|
||||
if (!empty($this->sContentDisposition))
|
||||
{
|
||||
if (!empty($this->sContentDisposition)) {
|
||||
$this->add_header('Content-Disposition: '.$this->sContentDisposition.'; filename="'.$this->sContentFileName.'"');
|
||||
}
|
||||
foreach ($this->a_headers as $s_header)
|
||||
{
|
||||
foreach ($this->a_headers as $s_header) {
|
||||
header($s_header);
|
||||
}
|
||||
$this->flush();
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* @copyright Copyright (C) 2010-2024 Combodo SAS
|
||||
* @license http://opensource.org/licenses/AGPL-3.0
|
||||
@@ -64,5 +65,5 @@ interface Page
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function table($aConfig, $aData, $aParams = array());
|
||||
public function table($aConfig, $aData, $aParams = []);
|
||||
}
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* @copyright Copyright (C) 2010-2024 Combodo SAS
|
||||
* @license http://opensource.org/licenses/AGPL-3.0
|
||||
@@ -12,16 +13,15 @@ use Combodo\iTop\Application\UI\Base\Layout\TabContainer\TabContainer;
|
||||
use DeprecatedCallsLog;
|
||||
use Dict;
|
||||
|
||||
|
||||
/**
|
||||
* Helper class to implement JQueryUI tabs inside a page
|
||||
*/
|
||||
class TabManager
|
||||
{
|
||||
const ENUM_TAB_TYPE_HTML = 'html';
|
||||
const ENUM_TAB_TYPE_AJAX = 'ajax';
|
||||
public const ENUM_TAB_TYPE_HTML = 'html';
|
||||
public const ENUM_TAB_TYPE_AJAX = 'ajax';
|
||||
|
||||
const DEFAULT_TAB_TYPE = self::ENUM_TAB_TYPE_HTML;
|
||||
public const DEFAULT_TAB_TYPE = self::ENUM_TAB_TYPE_HTML;
|
||||
|
||||
/**
|
||||
* @var TabContainer[]
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Copyright (C) 2013-2024 Combodo SAS
|
||||
*
|
||||
@@ -37,7 +38,7 @@ use utils;
|
||||
*/
|
||||
class UnauthenticatedWebPage extends NiceWebPage
|
||||
{
|
||||
const DEFAULT_PAGE_TEMPLATE_REL_PATH = 'pages/backoffice/unauthenticatedwebpage/layout';
|
||||
public const DEFAULT_PAGE_TEMPLATE_REL_PATH = 'pages/backoffice/unauthenticatedwebpage/layout';
|
||||
private $sContent;
|
||||
private $sPanelTitle;
|
||||
private $sPanelIcon;
|
||||
@@ -77,17 +78,17 @@ class UnauthenticatedWebPage extends NiceWebPage
|
||||
$this->SetContentType('text/html');
|
||||
|
||||
// - bootstrap
|
||||
$this->LinkScriptFromURI(UAWP_PORTAL_PUBLIC_FOLDER_ABSOLUTE_URL . 'lib/bootstrap/js/bootstrap.min.js');
|
||||
$this->LinkScriptFromURI(UAWP_PORTAL_PUBLIC_FOLDER_ABSOLUTE_URL.'lib/bootstrap/js/bootstrap.min.js');
|
||||
|
||||
// Note: Since 2.6.0 moment was moved from portal to iTop core
|
||||
$this->LinkScriptFromAppRoot('node_modules/moment/min/moment-with-locales.min.js');
|
||||
|
||||
$this->LinkScriptFromURI(UAWP_PORTAL_PUBLIC_FOLDER_ABSOLUTE_URL . 'lib/bootstrap-datetimepicker/js/bootstrap-datetimepicker.min.js');
|
||||
$this->LinkScriptFromURI(UAWP_PORTAL_PUBLIC_FOLDER_ABSOLUTE_URL.'lib/bootstrap-datetimepicker/js/bootstrap-datetimepicker.min.js');
|
||||
|
||||
// CSS files
|
||||
$this->LinkStylesheetFromURI(UAWP_PORTAL_PUBLIC_FOLDER_ABSOLUTE_URL . 'lib/bootstrap/css/bootstrap.min.css');
|
||||
$this->add_saas(UAWP_PORTAL_PUBLIC_FOLDER_RELATIVE_PATH . 'css/bootstrap-theme-combodo.scss');
|
||||
$this->LinkStylesheetFromURI(UAWP_PORTAL_PUBLIC_FOLDER_ABSOLUTE_URL . 'lib/bootstrap-datetimepicker/css/bootstrap-datetimepicker.css');
|
||||
$this->LinkStylesheetFromURI(UAWP_PORTAL_PUBLIC_FOLDER_ABSOLUTE_URL.'lib/bootstrap/css/bootstrap.min.css');
|
||||
$this->add_saas(UAWP_PORTAL_PUBLIC_FOLDER_RELATIVE_PATH.'css/bootstrap-theme-combodo.scss');
|
||||
$this->LinkStylesheetFromURI(UAWP_PORTAL_PUBLIC_FOLDER_ABSOLUTE_URL.'lib/bootstrap-datetimepicker/css/bootstrap-datetimepicker.css');
|
||||
|
||||
// Default theme
|
||||
$this->add_saas('css/unauthenticated.scss');
|
||||
@@ -102,24 +103,22 @@ class UnauthenticatedWebPage extends NiceWebPage
|
||||
*/
|
||||
private function Init(): void
|
||||
{
|
||||
$this->sPortalBaseFolderRelPath = 'env-' . utils::GetCurrentEnvironment() . '/itop-portal-base/portal/';
|
||||
$this->sPortalSourcesFolderRelPath = $this->sPortalBaseFolderRelPath . 'src/';
|
||||
$this->sPortalPublicFolderRelPath = $this->sPortalBaseFolderRelPath . 'public/';
|
||||
$this->sPortalBaseFolderRelPath = 'env-'.utils::GetCurrentEnvironment().'/itop-portal-base/portal/';
|
||||
$this->sPortalSourcesFolderRelPath = $this->sPortalBaseFolderRelPath.'src/';
|
||||
$this->sPortalPublicFolderRelPath = $this->sPortalBaseFolderRelPath.'public/';
|
||||
|
||||
$this->sPortalBaseFolderAbsPath = APPROOT . $this->sPortalBaseFolderRelPath;
|
||||
$this->sPortalSourcesFolderAbsPath = APPROOT . $this->sPortalSourcesFolderRelPath;
|
||||
$this->sPortalPublicFolderAbsPath = APPROOT . $this->sPortalPublicFolderRelPath;
|
||||
$this->sPortalBaseFolderAbsPath = APPROOT.$this->sPortalBaseFolderRelPath;
|
||||
$this->sPortalSourcesFolderAbsPath = APPROOT.$this->sPortalSourcesFolderRelPath;
|
||||
$this->sPortalPublicFolderAbsPath = APPROOT.$this->sPortalPublicFolderRelPath;
|
||||
|
||||
/** @noinspection PhpUnhandledExceptionInspection */
|
||||
$this->sPortalPublicFolderAbsUrl = utils::GetAbsoluteUrlModulesRoot().'/itop-portal-base/portal/public/';
|
||||
|
||||
// Constants to be used in the UnauthenticatedWebPage
|
||||
if(!defined('UAWP_PORTAL_PUBLIC_FOLDER_ABSOLUTE_URL'))
|
||||
{
|
||||
if (!defined('UAWP_PORTAL_PUBLIC_FOLDER_ABSOLUTE_URL')) {
|
||||
define('UAWP_PORTAL_PUBLIC_FOLDER_ABSOLUTE_URL', $this->sPortalPublicFolderAbsUrl);
|
||||
}
|
||||
if(!defined('UAWP_PORTAL_PUBLIC_FOLDER_RELATIVE_PATH'))
|
||||
{
|
||||
if (!defined('UAWP_PORTAL_PUBLIC_FOLDER_RELATIVE_PATH')) {
|
||||
define('UAWP_PORTAL_PUBLIC_FOLDER_RELATIVE_PATH', $this->sPortalPublicFolderRelPath);
|
||||
}
|
||||
}
|
||||
@@ -131,7 +130,7 @@ class UnauthenticatedWebPage extends NiceWebPage
|
||||
{
|
||||
$this->sContent .= $sHtml;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @inheritdoc
|
||||
*/
|
||||
@@ -179,7 +178,7 @@ class UnauthenticatedWebPage extends NiceWebPage
|
||||
'sDeferredContent' => utils::FilterXSS($this->s_deferred_content),
|
||||
'sContent' => $this->sContent,
|
||||
'sPanelIcon' => $this->sPanelIcon,
|
||||
'sPanelTitle' => $this->sPanelTitle
|
||||
'sPanelTitle' => $this->sPanelTitle,
|
||||
];
|
||||
|
||||
$aData['aBlockParams'] = $this->GetBlockParams();
|
||||
@@ -196,7 +195,7 @@ class UnauthenticatedWebPage extends NiceWebPage
|
||||
$aData['aPage']['sFaviconUrl'] = $this->GetFaviconAbsoluteUrl();
|
||||
|
||||
$oTwigEnv = TwigHelper::GetTwigEnvironment(BlockRenderer::TWIG_BASE_PATH, BlockRenderer::TWIG_ADDITIONAL_PATHS);
|
||||
|
||||
|
||||
// Render final TWIG into global HTML
|
||||
$sHtml = TwigHelper::RenderTemplate($oTwigEnv, $aData, $this->GetTemplateRelPath());
|
||||
$oKpi->ComputeAndReport(get_class($this).' output');
|
||||
@@ -204,7 +203,7 @@ class UnauthenticatedWebPage extends NiceWebPage
|
||||
$oKpi->ComputeAndReport('Echoing ('.round(strlen($sHtml) / 1024).' Kb)');
|
||||
ExecutionKPI::ReportStats();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Displays a success message.
|
||||
*
|
||||
@@ -271,7 +270,6 @@ class UnauthenticatedWebPage extends NiceWebPage
|
||||
return $this;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @inheritDoc
|
||||
* @throws \Exception
|
||||
@@ -282,8 +280,7 @@ class UnauthenticatedWebPage extends NiceWebPage
|
||||
// Default theme
|
||||
$this->add_saas('css/unauthenticated.scss');
|
||||
// Custom theme to allow admin to override the default one.
|
||||
if(!empty($this->sCustomThemeUrl))
|
||||
{
|
||||
if (!empty($this->sCustomThemeUrl)) {
|
||||
$this->LinkStylesheetFromURI($this->sCustomThemeUrl);
|
||||
}
|
||||
}
|
||||
@@ -296,4 +293,4 @@ class UnauthenticatedWebPage extends NiceWebPage
|
||||
{
|
||||
return Branding::GetLoginFavIconAbsoluteUrl();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
* @copyright Copyright (C) 2010-2024 Combodo SAS
|
||||
* @license http://opensource.org/licenses/AGPL-3.0
|
||||
@@ -30,10 +31,10 @@ use MetaModel;
|
||||
use Symfony\Component\HttpFoundation\Response;
|
||||
use UserRights;
|
||||
use utils;
|
||||
|
||||
use const APPROOT;
|
||||
use const MODULESROOT;
|
||||
|
||||
|
||||
/**
|
||||
* <p>Simple helper class to ease the production of HTML pages
|
||||
*
|
||||
@@ -64,7 +65,7 @@ class WebPage implements Page
|
||||
/**
|
||||
* @since 2.7.0 N°2529
|
||||
*/
|
||||
const PAGES_CHARSET = 'utf-8';
|
||||
public const PAGES_CHARSET = 'utf-8';
|
||||
|
||||
/**
|
||||
* @var string
|
||||
@@ -149,7 +150,7 @@ class WebPage implements Page
|
||||
* @var string Rel. path to the template to use for the rendering. File name must be without the extension.
|
||||
* @since 3.0.0
|
||||
*/
|
||||
const DEFAULT_PAGE_TEMPLATE_REL_PATH = 'pages/backoffice/webpage/layout';
|
||||
public const DEFAULT_PAGE_TEMPLATE_REL_PATH = 'pages/backoffice/webpage/layout';
|
||||
|
||||
protected $s_title;
|
||||
protected $s_content;
|
||||
@@ -210,7 +211,6 @@ class WebPage implements Page
|
||||
protected $oContentLayout;
|
||||
protected $sTemplateRelPath;
|
||||
|
||||
|
||||
/**
|
||||
* @var bool|string|string[]
|
||||
*/
|
||||
@@ -341,7 +341,7 @@ class WebPage implements Page
|
||||
* @return void
|
||||
* @throws \Exception
|
||||
*/
|
||||
public function add_twig_template($sViewPath, $sTemplateName, $aParams = array(), $sDefaultType = 'html')
|
||||
public function add_twig_template($sViewPath, $sTemplateName, $aParams = [], $sDefaultType = 'html')
|
||||
{
|
||||
TwigHelper::RenderIntoPage($this, $sViewPath, $sTemplateName, $aParams, $sDefaultType);
|
||||
}
|
||||
@@ -399,7 +399,7 @@ class WebPage implements Page
|
||||
* @inheritDoc
|
||||
* @throws \Exception
|
||||
*/
|
||||
public function table($aConfig, $aData, $aParams = array())
|
||||
public function table($aConfig, $aData, $aParams = [])
|
||||
{
|
||||
$oDataTable = $this->GetTableBlock($aConfig, $aData);
|
||||
$oDataTable->AddOption("bFullscreen", true);
|
||||
@@ -421,7 +421,7 @@ class WebPage implements Page
|
||||
* @return string
|
||||
* @throws \Exception
|
||||
*/
|
||||
public function GetTable($aConfig, $aData, $aParams = array())
|
||||
public function GetTable($aConfig, $aData, $aParams = [])
|
||||
{
|
||||
static $iNbTables = 0;
|
||||
$iNbTables++;
|
||||
@@ -429,15 +429,13 @@ class WebPage implements Page
|
||||
$sHtml .= "<table class=\"listResults\">\n";
|
||||
$sHtml .= "<thead>\n";
|
||||
$sHtml .= "<tr>\n";
|
||||
foreach ($aConfig as $sName => $aDef)
|
||||
{
|
||||
foreach ($aConfig as $sName => $aDef) {
|
||||
$sHtml .= "<th title=\"".$aDef['description']."\">".$aDef['label']."</th>\n";
|
||||
}
|
||||
$sHtml .= "</tr>\n";
|
||||
$sHtml .= "</thead>\n";
|
||||
$sHtml .= "<tbody>\n";
|
||||
foreach ($aData as $aRow)
|
||||
{
|
||||
foreach ($aData as $aRow) {
|
||||
$sHtml .= $this->GetTableRow($aRow, $aConfig);
|
||||
}
|
||||
$sHtml .= "</tbody>\n";
|
||||
@@ -455,25 +453,19 @@ class WebPage implements Page
|
||||
public function GetTableRow($aRow, $aConfig)
|
||||
{
|
||||
$sHtml = '';
|
||||
if (isset($aRow['@class'])) // Row specific class, for hilighting certain rows
|
||||
{
|
||||
if (isset($aRow['@class'])) { // Row specific class, for hilighting certain rows
|
||||
$sHtml .= "<tr class=\"{$aRow['@class']}\">";
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
$sHtml .= "<tr>";
|
||||
}
|
||||
foreach ($aConfig as $sName => $aAttribs)
|
||||
{
|
||||
foreach ($aConfig as $sName => $aAttribs) {
|
||||
$sClass = isset($aAttribs['class']) ? 'class="'.$aAttribs['class'].'"' : '';
|
||||
|
||||
// Prepare metadata
|
||||
// - From table config.
|
||||
$sMetadata = '';
|
||||
if(isset($aAttribs['metadata']))
|
||||
{
|
||||
foreach($aAttribs['metadata'] as $sMetadataProp => $sMetadataValue)
|
||||
{
|
||||
if (isset($aAttribs['metadata'])) {
|
||||
foreach ($aAttribs['metadata'] as $sMetadataProp => $sMetadataValue) {
|
||||
$sMetadataPropSanitized = str_replace('_', '-', $sMetadataProp);
|
||||
$sMetadataValueSanitized = utils::HtmlEntities($sMetadataValue);
|
||||
$sMetadata .= 'data-'.$sMetadataPropSanitized.'="'.$sMetadataValueSanitized.'" ';
|
||||
@@ -481,13 +473,10 @@ class WebPage implements Page
|
||||
}
|
||||
|
||||
// Prepare value
|
||||
if(is_array($aRow[$sName]))
|
||||
{
|
||||
if (is_array($aRow[$sName])) {
|
||||
$sValueHtml = ($aRow[$sName]['value_html'] === '') ? ' ' : $aRow[$sName]['value_html'];
|
||||
$sMetadata .= 'data-value-raw="'.utils::HtmlEntities($aRow[$sName]['value_raw']).'" ';
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
$sValueHtml = ($aRow[$sName] === '') ? ' ' : $aRow[$sName];
|
||||
}
|
||||
|
||||
@@ -555,7 +544,7 @@ class WebPage implements Page
|
||||
|
||||
// Ensure file is within the app folder
|
||||
$sFileRelPathWithoutQueryParams = explode("?", $sFileRelPath)[0];
|
||||
if (false === utils::RealPath(APPROOT . $sFileRelPathWithoutQueryParams, APPROOT)) {
|
||||
if (false === utils::RealPath(APPROOT.$sFileRelPathWithoutQueryParams, APPROOT)) {
|
||||
IssueLog::Warning("Linked resource added to page with a path from outside app directory, it will be ignored.", LogChannels::CONSOLE, [
|
||||
"linked_resource_uri" => $sFileRelPath,
|
||||
"request_uri" => $_SERVER['REQUEST_URI'] ?? '' /* CLI */,
|
||||
@@ -570,7 +559,7 @@ class WebPage implements Page
|
||||
$sAppRootUrl .= '/';
|
||||
}
|
||||
|
||||
$this->LinkResourceFromURI($sAppRootUrl . $sFileRelPath, $sResourceType);
|
||||
$this->LinkResourceFromURI($sAppRootUrl.$sFileRelPath, $sResourceType);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -593,7 +582,7 @@ class WebPage implements Page
|
||||
|
||||
// Ensure file is within the app folder
|
||||
$sFileRelPathWithoutQueryParams = explode("?", $sFileRelPath)[0];
|
||||
$sFileAbsPath = MODULESROOT . $sFileRelPathWithoutQueryParams;
|
||||
$sFileAbsPath = MODULESROOT.$sFileRelPathWithoutQueryParams;
|
||||
// For modules only, we don't check real path if symlink as the file would not be in under MODULESROOT
|
||||
if (false === is_link($sFileAbsPath) && false === utils::RealPath($sFileAbsPath, MODULESROOT)) {
|
||||
IssueLog::Warning("Linked resource added to page with a path from outside current env. directory, it will be ignored.", LogChannels::CONSOLE, [
|
||||
@@ -603,7 +592,7 @@ class WebPage implements Page
|
||||
return;
|
||||
}
|
||||
|
||||
$this->LinkResourceFromURI(utils::GetAbsoluteUrlModulesRoot() . $sFileRelPath, $sResourceType);
|
||||
$this->LinkResourceFromURI(utils::GetAbsoluteUrlModulesRoot().$sFileRelPath, $sResourceType);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -1019,8 +1008,10 @@ class WebPage implements Page
|
||||
*/
|
||||
protected function get_dict_signature()
|
||||
{
|
||||
return str_replace('_', '', Dict::GetUserLanguage()).'-'.md5(implode(',',
|
||||
$this->a_dict_entries).'|'.implode(',', $this->a_dict_entries_prefixes));
|
||||
return str_replace('_', '', Dict::GetUserLanguage()).'-'.md5(implode(
|
||||
',',
|
||||
$this->a_dict_entries
|
||||
).'|'.implode(',', $this->a_dict_entries_prefixes));
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -1028,13 +1019,11 @@ class WebPage implements Page
|
||||
*/
|
||||
protected function get_dict_file_content()
|
||||
{
|
||||
$aEntries = array();
|
||||
foreach ($this->a_dict_entries as $sCode)
|
||||
{
|
||||
$aEntries = [];
|
||||
foreach ($this->a_dict_entries as $sCode) {
|
||||
$aEntries[$sCode] = Dict::S($sCode);
|
||||
}
|
||||
foreach ($this->a_dict_entries_prefixes as $sPrefix)
|
||||
{
|
||||
foreach ($this->a_dict_entries_prefixes as $sPrefix) {
|
||||
$aEntries = array_merge($aEntries, Dict::ExportEntries($sPrefix));
|
||||
}
|
||||
|
||||
@@ -1168,8 +1157,7 @@ JS;
|
||||
{
|
||||
$sCssRelPath = utils::GetCSSFromSASS($sSaasRelPath);
|
||||
$sRootUrl = utils::GetAbsoluteUrlAppRoot();
|
||||
if ($sRootUrl === '')
|
||||
{
|
||||
if ($sRootUrl === '') {
|
||||
// We're running the setup of the first install...
|
||||
$sRootUrl = '../';
|
||||
}
|
||||
@@ -1323,8 +1311,7 @@ JS;
|
||||
$aPossibleAttFlags = MetaModel::EnumPossibleAttributeFlags();
|
||||
|
||||
$sHtml = "<div class=\"ibo-details\">\n";
|
||||
foreach ($aFields as $aAttrib)
|
||||
{
|
||||
foreach ($aFields as $aAttrib) {
|
||||
$sLayout = isset($aAttrib['layout']) ? $aAttrib['layout'] : 'small';
|
||||
|
||||
// Prepare metadata attributes
|
||||
@@ -1335,13 +1322,10 @@ JS;
|
||||
$sDataInputType = isset($aAttrib['inputtype']) ? 'data-input-type="'.utils::HtmlEntities($aAttrib['inputtype']).'"' : '';
|
||||
// - Attribute flags
|
||||
$sDataAttributeFlags = '';
|
||||
if(isset($aAttrib['attflags']))
|
||||
{
|
||||
foreach($aPossibleAttFlags as $sFlagCode => $iFlagValue)
|
||||
{
|
||||
if (isset($aAttrib['attflags'])) {
|
||||
foreach ($aPossibleAttFlags as $sFlagCode => $iFlagValue) {
|
||||
// Note: Skip normal flag as we don't need it.
|
||||
if($sFlagCode === 'normal')
|
||||
{
|
||||
if ($sFlagCode === 'normal') {
|
||||
continue;
|
||||
}
|
||||
$sFormattedFlagCode = str_ireplace('_', '-', $sFlagCode);
|
||||
@@ -1356,23 +1340,18 @@ JS;
|
||||
$sHtml .= "<div class=\"ibo-field--label\">{$aAttrib['label']}</div>\n";
|
||||
|
||||
// By Rom, for csv import, proposed to show several values for column selection
|
||||
if (is_array($aAttrib['value']))
|
||||
{
|
||||
if (is_array($aAttrib['value'])) {
|
||||
$sHtml .= "<div class=\"ibo-field--value\">".implode("</div><div>", $aAttrib['value'])."</div>\n";
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
$sHtml .= "<div class=\"ibo-field--value\">".$aAttrib['value']."</div>\n";
|
||||
}
|
||||
// Checking if we should add comments & infos
|
||||
$sComment = (isset($aAttrib['comments'])) ? $aAttrib['comments'] : '';
|
||||
$sInfo = (isset($aAttrib['infos'])) ? $aAttrib['infos'] : '';
|
||||
if ($sComment !== '')
|
||||
{
|
||||
if ($sComment !== '') {
|
||||
$sHtml .= "<div class=\"ibo-field--comments\">$sComment</div>\n";
|
||||
}
|
||||
if ($sInfo !== '')
|
||||
{
|
||||
if ($sInfo !== '') {
|
||||
$sHtml .= "<div class=\"ibo-field--infos\">$sInfo</div>\n";
|
||||
}
|
||||
|
||||
@@ -1397,26 +1376,26 @@ JS;
|
||||
* @return string The HTML fragment corresponding to the radio buttons
|
||||
*/
|
||||
public function GetRadioButtons(
|
||||
$aAllowedValues, $value, $iId, $sFieldName, $bMandatory, $bVertical, $sValidationField
|
||||
$aAllowedValues,
|
||||
$value,
|
||||
$iId,
|
||||
$sFieldName,
|
||||
$bMandatory,
|
||||
$bVertical,
|
||||
$sValidationField
|
||||
) {
|
||||
$idx = 0;
|
||||
$sHTMLValue = '';
|
||||
foreach ($aAllowedValues as $key => $display_value)
|
||||
{
|
||||
if ((count($aAllowedValues) == 1) && ($bMandatory == 'true'))
|
||||
{
|
||||
foreach ($aAllowedValues as $key => $display_value) {
|
||||
if ((count($aAllowedValues) == 1) && ($bMandatory == 'true')) {
|
||||
// When there is only once choice, select it by default
|
||||
$sSelected = 'checked';
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
$sSelected = ($value == $key) ? 'checked' : '';
|
||||
}
|
||||
$sHTMLValue .= "<input type=\"radio\" id=\"{$iId}_{$key}\" name=\"radio_$sFieldName\" onChange=\"$('#{$iId}').val(this.value).trigger('change');\" value=\"$key\" $sSelected><label class=\"radio\" for=\"{$iId}_{$key}\"> $display_value</label> ";
|
||||
if ($bVertical)
|
||||
{
|
||||
if ($idx == 0)
|
||||
{
|
||||
if ($bVertical) {
|
||||
if ($idx == 0) {
|
||||
// Validation icon at the end of the first line
|
||||
$sHTMLValue .= " {$sValidationField}\n";
|
||||
}
|
||||
@@ -1425,8 +1404,7 @@ JS;
|
||||
$idx++;
|
||||
}
|
||||
$sHTMLValue .= "<input type=\"hidden\" id=\"$iId\" name=\"$sFieldName\" value=\"$value\"/>";
|
||||
if (!$bVertical)
|
||||
{
|
||||
if (!$bVertical) {
|
||||
// Validation icon at the end of the line
|
||||
$sHTMLValue .= " {$sValidationField}\n";
|
||||
}
|
||||
@@ -1457,26 +1435,18 @@ JS;
|
||||
protected function ob_get_clean_safe()
|
||||
{
|
||||
$sOutput = ob_get_contents();
|
||||
if ($sOutput === false)
|
||||
{
|
||||
if ($sOutput === false) {
|
||||
$sMsg = "Design/integration issue: No output buffer. Some piece of code has called ob_get_clean() or ob_end_clean() without calling ob_start()";
|
||||
if ($this->bTrashUnexpectedOutput)
|
||||
{
|
||||
if ($this->bTrashUnexpectedOutput) {
|
||||
IssueLog::Error($sMsg);
|
||||
$sOutput = '';
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
$sOutput = $sMsg;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
ob_end_clean(); // on some versions of PHP doing so when the output buffering is stopped can cause a notice
|
||||
if ($this->bTrashUnexpectedOutput)
|
||||
{
|
||||
if (trim($sOutput) != '')
|
||||
{
|
||||
if ($this->bTrashUnexpectedOutput) {
|
||||
if (trim($sOutput) != '') {
|
||||
if (Utils::GetConfig() && Utils::GetConfig()->Get('debug_report_spurious_chars')) {
|
||||
IssueLog::Error("Trashing unexpected output:'$sOutput'\n");
|
||||
}
|
||||
@@ -1706,11 +1676,10 @@ JS;
|
||||
*
|
||||
* @return bool True if the format is Ok, false otherwise
|
||||
*/
|
||||
function IsOutputFormatAvailable($sOutputFormat)
|
||||
public function IsOutputFormatAvailable($sOutputFormat)
|
||||
{
|
||||
$bResult = false;
|
||||
switch ($sOutputFormat)
|
||||
{
|
||||
switch ($sOutputFormat) {
|
||||
case 'html':
|
||||
$bResult = true; // Always supported
|
||||
break;
|
||||
@@ -1743,8 +1712,7 @@ JS;
|
||||
*/
|
||||
public function GetOutputOption($sFormat, $sOptionName)
|
||||
{
|
||||
if (isset($this->a_OutputOptions[$sFormat][$sOptionName]))
|
||||
{
|
||||
if (isset($this->a_OutputOptions[$sFormat][$sOptionName])) {
|
||||
return $this->a_OutputOptions[$sFormat][$sOptionName];
|
||||
}
|
||||
|
||||
@@ -1760,12 +1728,9 @@ JS;
|
||||
*/
|
||||
public function SetOutputOption($sFormat, $sOptionName, $sValue)
|
||||
{
|
||||
if (!isset($this->a_OutputOptions[$sFormat]))
|
||||
{
|
||||
$this->a_OutputOptions[$sFormat] = array($sOptionName => $sValue);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (!isset($this->a_OutputOptions[$sFormat])) {
|
||||
$this->a_OutputOptions[$sFormat] = [$sOptionName => $sValue];
|
||||
} else {
|
||||
$this->a_OutputOptions[$sFormat][$sOptionName] = $sValue;
|
||||
}
|
||||
}
|
||||
@@ -1776,7 +1741,7 @@ JS;
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function RenderPopupMenuItems($aActions, $aFavoriteActions = array())
|
||||
public function RenderPopupMenuItems($aActions, $aFavoriteActions = [])
|
||||
{
|
||||
$sPrevUrl = '';
|
||||
$sHtml = '';
|
||||
@@ -1784,12 +1749,14 @@ JS;
|
||||
foreach ($aActions as $sActionId => $aAction) {
|
||||
$sDataActionId = 'data-action-id="'.$sActionId.'"';
|
||||
$sClass = isset($aAction['css_classes']) ? 'class="'.implode(' ', $aAction['css_classes']).'"' : '';
|
||||
$sOnClick = isset($aAction['onclick']) ? 'onclick="'.htmlspecialchars($aAction['onclick'], ENT_QUOTES,
|
||||
"UTF-8").'"' : '';
|
||||
$sOnClick = isset($aAction['onclick']) ? 'onclick="'.htmlspecialchars(
|
||||
$aAction['onclick'],
|
||||
ENT_QUOTES,
|
||||
"UTF-8"
|
||||
).'"' : '';
|
||||
$sTarget = isset($aAction['target']) ? "target=\"{$aAction['target']}\"" : "";
|
||||
if (empty($aAction['url'])) {
|
||||
if ($sPrevUrl != '') // Don't output consecutively two separators...
|
||||
{
|
||||
if ($sPrevUrl != '') { // Don't output consecutively two separators...
|
||||
$sHtml .= "<li $sDataActionId>{$aAction['label']}</li>";
|
||||
}
|
||||
$sPrevUrl = '';
|
||||
@@ -1859,8 +1826,6 @@ JS;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Return the language for the page metadata based on the current user
|
||||
*
|
||||
|
||||
@@ -1,9 +1,10 @@
|
||||
<?php
|
||||
|
||||
// Copyright (C) 2010-2024 Combodo SAS
|
||||
//
|
||||
// This file is part of iTop.
|
||||
//
|
||||
// iTop is free software; you can redistribute it and/or modify
|
||||
// iTop is free software; you can redistribute it and/or modify
|
||||
// it under the terms of the GNU Affero General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
@@ -28,7 +29,6 @@ use ExecutionKPI;
|
||||
* @license http://opensource.org/licenses/AGPL-3.0
|
||||
*/
|
||||
|
||||
|
||||
/**
|
||||
* Simple web page with no includes or fancy formatting, useful to generateXML documents
|
||||
* The page adds the content-type text/XML and the encoding into the headers
|
||||
@@ -38,10 +38,10 @@ class XMLPage extends WebPage
|
||||
/**
|
||||
* For big XML files, it's better NOT to store everything in memory and output the XML piece by piece
|
||||
*/
|
||||
var $m_bPassThrough;
|
||||
var $m_bHeaderSent;
|
||||
|
||||
function __construct($s_title, $bPassThrough = false)
|
||||
public $m_bPassThrough;
|
||||
public $m_bHeaderSent;
|
||||
|
||||
public function __construct($s_title, $bPassThrough = false)
|
||||
{
|
||||
$oKpi = new ExecutionKPI();
|
||||
parent::__construct($s_title);
|
||||
@@ -65,8 +65,7 @@ class XMLPage extends WebPage
|
||||
}
|
||||
public function output()
|
||||
{
|
||||
if (!$this->m_bPassThrough)
|
||||
{
|
||||
if (!$this->m_bPassThrough) {
|
||||
$oKpi = new ExecutionKPI();
|
||||
|
||||
// Get the unexpected output but do nothing with it
|
||||
@@ -75,8 +74,7 @@ class XMLPage extends WebPage
|
||||
$sCharset = self::PAGES_CHARSET;
|
||||
$this->s_content = "<?xml version=\"1.0\" encoding=\"$sCharset\"?".">\n".trim($this->s_content);
|
||||
$this->add_header("Content-Length: ".strlen($this->s_content));
|
||||
foreach($this->a_headers as $s_header)
|
||||
{
|
||||
foreach ($this->a_headers as $s_header) {
|
||||
header($s_header);
|
||||
}
|
||||
$oKpi->ComputeAndReport(get_class($this).' output');
|
||||
@@ -96,12 +94,9 @@ class XMLPage extends WebPage
|
||||
} else {
|
||||
if ($this->m_bHeaderSent) {
|
||||
echo $sText;
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
$s_captured_output = $this->ob_get_clean_safe();
|
||||
foreach($this->a_headers as $s_header)
|
||||
{
|
||||
foreach ($this->a_headers as $s_header) {
|
||||
header($s_header);
|
||||
}
|
||||
$sCharset = self::PAGES_CHARSET;
|
||||
@@ -118,7 +113,7 @@ class XMLPage extends WebPage
|
||||
{
|
||||
}
|
||||
|
||||
public function table($aConfig, $aData, $aParams = array())
|
||||
public function table($aConfig, $aData, $aParams = [])
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* @copyright Copyright (C) 2010-2024 Combodo SAS
|
||||
* @license http://opensource.org/licenses/AGPL-3.0
|
||||
@@ -12,7 +13,6 @@ use TCPDF;
|
||||
use TCPDF_IMAGES;
|
||||
use utils;
|
||||
|
||||
|
||||
/**
|
||||
* Custom class derived from TCPDF for providing custom headers and footers
|
||||
*
|
||||
@@ -65,11 +65,14 @@ class iTopPDF extends TCPDF
|
||||
}*/
|
||||
$imgtype = TCPDF_IMAGES::getImageFileType($sImagePath);
|
||||
if (($imgtype == 'eps') or ($imgtype == 'ai')) {
|
||||
$this->ImageEps($sImagePath, $x, $y, $w, $h);;
|
||||
$this->ImageEps($sImagePath, $x, $y, $w, $h);
|
||||
;
|
||||
} elseif ($imgtype == 'svg') {
|
||||
$this->ImageSVG($sImagePath, $x, $y, $w, $h);;
|
||||
$this->ImageSVG($sImagePath, $x, $y, $w, $h);
|
||||
;
|
||||
} else {
|
||||
$this->Image($sImagePath, $x, $y, $w, $h);;
|
||||
$this->Image($sImagePath, $x, $y, $w, $h);
|
||||
;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -89,14 +92,44 @@ class iTopPDF extends TCPDF
|
||||
|
||||
// Display the title (centered)
|
||||
$this->SetXY($aMargins['left'] + $iPageNumberWidth, 0);
|
||||
$this->MultiCell($this->getPageWidth() - $aMargins['left'] - $aMargins['right'] - 2 * $iPageNumberWidth, 15, $this->sDocumentTitle,
|
||||
0, 'C', false, 0 /* $ln */, '', '', true, 0, false, true, 15, 'M' /* $valign */);
|
||||
$this->MultiCell(
|
||||
$this->getPageWidth() - $aMargins['left'] - $aMargins['right'] - 2 * $iPageNumberWidth,
|
||||
15,
|
||||
$this->sDocumentTitle,
|
||||
0,
|
||||
'C',
|
||||
false,
|
||||
0 /* $ln */,
|
||||
'',
|
||||
'',
|
||||
true,
|
||||
0,
|
||||
false,
|
||||
true,
|
||||
15,
|
||||
'M' /* $valign */
|
||||
);
|
||||
$this->SetFontParams('', 10);
|
||||
|
||||
// Display the page number (right aligned)
|
||||
// Warning: the 'R'ight alignment does not work when using placeholders like $this->getAliasNumPage() or $this->getAliasNbPages()
|
||||
$this->MultiCell($iPageNumberWidth, 15, Dict::Format('Core:BulkExport:PDF:PageNumber', $this->page), 0, 'R', false, 0 /* $ln */, '',
|
||||
'', true, 0, false, true, 15, 'M' /* $valign */);
|
||||
$this->MultiCell(
|
||||
$iPageNumberWidth,
|
||||
15,
|
||||
Dict::Format('Core:BulkExport:PDF:PageNumber', $this->page),
|
||||
0,
|
||||
'R',
|
||||
false,
|
||||
0 /* $ln */,
|
||||
'',
|
||||
'',
|
||||
true,
|
||||
0,
|
||||
false,
|
||||
true,
|
||||
15,
|
||||
'M' /* $valign */
|
||||
);
|
||||
|
||||
// Branding logo
|
||||
$sBrandingIcon = Branding::GetLogoRelativePath(Branding::ENUM_LOGO_TYPE_MAIN_LOGO_FULL);
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
* @copyright Copyright (C) 2010-2024 Combodo SAS
|
||||
* @license http://opensource.org/licenses/AGPL-3.0
|
||||
@@ -46,11 +47,11 @@ use utils;
|
||||
class iTopWebPage extends NiceWebPage implements iTabbedPage
|
||||
{
|
||||
/** @var string ENUM_BREADCRUMB_ENTRY_ICON_TYPE_IMAGE */
|
||||
const ENUM_BREADCRUMB_ENTRY_ICON_TYPE_IMAGE = 'image';
|
||||
public const ENUM_BREADCRUMB_ENTRY_ICON_TYPE_IMAGE = 'image';
|
||||
/** @var string ENUM_BREADCRUMB_ENTRY_ICON_TYPE_CSS_CLASSES */
|
||||
const ENUM_BREADCRUMB_ENTRY_ICON_TYPE_CSS_CLASSES = 'css_classes';
|
||||
public const ENUM_BREADCRUMB_ENTRY_ICON_TYPE_CSS_CLASSES = 'css_classes';
|
||||
/** @var string DEFAULT_BREADCRUMB_ENTRY_ICON_TYPE */
|
||||
const DEFAULT_BREADCRUMB_ENTRY_ICON_TYPE = self::ENUM_BREADCRUMB_ENTRY_ICON_TYPE_IMAGE;
|
||||
public const DEFAULT_BREADCRUMB_ENTRY_ICON_TYPE = self::ENUM_BREADCRUMB_ENTRY_ICON_TYPE_IMAGE;
|
||||
|
||||
/** @inheritDoc */
|
||||
protected const COMPATIBILITY_MOVED_LINKED_SCRIPTS_REL_PATH = [
|
||||
@@ -77,7 +78,7 @@ class iTopWebPage extends NiceWebPage implements iTabbedPage
|
||||
];
|
||||
|
||||
/** @var string DEFAULT_PAGE_TEMPLATE_REL_PATH The relative path (from <ITOP>/templates/) to the default page template */
|
||||
const DEFAULT_PAGE_TEMPLATE_REL_PATH = 'pages/backoffice/itopwebpage/layout';
|
||||
public const DEFAULT_PAGE_TEMPLATE_REL_PATH = 'pages/backoffice/itopwebpage/layout';
|
||||
|
||||
private $m_aMessages;
|
||||
|
||||
@@ -143,7 +144,7 @@ class iTopWebPage extends NiceWebPage implements iTabbedPage
|
||||
|
||||
utils::InitArchiveMode();
|
||||
|
||||
$this->m_aMessages = array();
|
||||
$this->m_aMessages = [];
|
||||
$this->SetRootUrl(utils::GetAbsoluteUrlAppRoot());
|
||||
$this->add_header("Content-type: text/html; charset=".self::PAGES_CHARSET);
|
||||
$this->no_cache();
|
||||
@@ -283,7 +284,7 @@ class iTopWebPage extends NiceWebPage implements iTabbedPage
|
||||
*/
|
||||
protected function PrepareLayout()
|
||||
{
|
||||
$aDaysMin = array(
|
||||
$aDaysMin = [
|
||||
Dict::S('DayOfWeek-Sunday-Min'),
|
||||
Dict::S('DayOfWeek-Monday-Min'),
|
||||
Dict::S('DayOfWeek-Tuesday-Min'),
|
||||
@@ -291,8 +292,8 @@ class iTopWebPage extends NiceWebPage implements iTabbedPage
|
||||
Dict::S('DayOfWeek-Thursday-Min'),
|
||||
Dict::S('DayOfWeek-Friday-Min'),
|
||||
Dict::S('DayOfWeek-Saturday-Min'),
|
||||
);
|
||||
$aMonthsShort = array(
|
||||
];
|
||||
$aMonthsShort = [
|
||||
Dict::S('Month-01-Short'),
|
||||
Dict::S('Month-02-Short'),
|
||||
Dict::S('Month-03-Short'),
|
||||
@@ -305,12 +306,12 @@ class iTopWebPage extends NiceWebPage implements iTabbedPage
|
||||
Dict::S('Month-10-Short'),
|
||||
Dict::S('Month-11-Short'),
|
||||
Dict::S('Month-12-Short'),
|
||||
);
|
||||
];
|
||||
$sTimeFormat = AttributeDateTime::GetFormat()->ToTimeFormat();
|
||||
$oTimeFormat = new DateTimeFormat($sTimeFormat);
|
||||
|
||||
// Date picker options
|
||||
$aPickerOptions = array(
|
||||
$aPickerOptions = [
|
||||
'showOn' => 'button',
|
||||
'buttonText' => '', // N°6455 class will be added after JQuery UI widget
|
||||
'dateFormat' => AttributeDate::GetFormat()->ToDatePicker(),
|
||||
@@ -320,7 +321,7 @@ class iTopWebPage extends NiceWebPage implements iTabbedPage
|
||||
'dayNamesMin' => $aDaysMin,
|
||||
'monthNamesShort' => $aMonthsShort,
|
||||
'firstDay' => (int)Dict::S('Calendar-FirstDayOfWeek'),
|
||||
);
|
||||
];
|
||||
$sJSDatePickerOptions = json_encode($aPickerOptions);
|
||||
|
||||
// Time picker additional options
|
||||
@@ -339,8 +340,7 @@ class iTopWebPage extends NiceWebPage implements iTabbedPage
|
||||
$aPickerOptions['controlType'] = 'select';
|
||||
$aPickerOptions['closeText'] = Dict::S('UI:Button:Ok');
|
||||
$sJSDateTimePickerOptions = json_encode($aPickerOptions);
|
||||
if ($sTimePickerLang != '"en"')
|
||||
{
|
||||
if ($sTimePickerLang != '"en"') {
|
||||
// More options that cannot be passed via json_encode since they must be evaluated client-side
|
||||
$aMoreJSOptions = ",
|
||||
'timeText': $.timepicker.regional[$sTimePickerLang].timeText,
|
||||
@@ -428,19 +428,18 @@ JS
|
||||
$.blockUI.defaults.message= '<i class="fas fa-fw fa-spin fa-sync-alt"></i>';
|
||||
$.blockUI.defaults.overlayCSS = {}
|
||||
JS
|
||||
);
|
||||
);
|
||||
|
||||
// TODO 3.0.0: To preserve
|
||||
$this->add_ready_script(InlineImage::FixImagesWidth());
|
||||
// TODO 3.0.0: To preserve
|
||||
$this->add_ready_script(InlineImage::FixImagesWidth());
|
||||
|
||||
// user pref for client side
|
||||
// see GetUserPreference() in utils.js
|
||||
$sUserPrefs = appUserPreferences::GetAsJSON();
|
||||
$this->add_script("var oUserPreferences = $sUserPrefs;");
|
||||
// user pref for client side
|
||||
// see GetUserPreference() in utils.js
|
||||
$sUserPrefs = appUserPreferences::GetAsJSON();
|
||||
$this->add_script("var oUserPreferences = $sUserPrefs;");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @see static::ENUM_BREADCRUMB_ENTRY_ICON_TYPE_IMAGE, static::ENUM_BREADCRUMB_ENTRY_ICON_TYPE_CSS_CLASSES
|
||||
*
|
||||
@@ -481,7 +480,6 @@ JS
|
||||
$this->GetTopBarLayout()->SetBreadcrumbs(new Breadcrumbs($this->GetBreadCrumbsNewEntry(), Breadcrumbs::BLOCK_CODE));
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @internal
|
||||
* @return \Combodo\iTop\Application\UI\Base\Layout\NavigationMenu\NavigationMenu
|
||||
@@ -592,11 +590,9 @@ JS
|
||||
{
|
||||
$aNewEntry = null;
|
||||
|
||||
if ($this->bBreadCrumbEnabled)
|
||||
{
|
||||
if ($this->bBreadCrumbEnabled) {
|
||||
// Default entry values
|
||||
if (is_null($this->sBreadCrumbEntryId))
|
||||
{
|
||||
if (is_null($this->sBreadCrumbEntryId)) {
|
||||
$this->sBreadCrumbEntryId = $this->s_title;
|
||||
$this->sBreadCrumbEntryLabel = $this->s_title;
|
||||
$this->sBreadCrumbEntryDescription = $this->s_title;
|
||||
@@ -632,8 +628,7 @@ JS
|
||||
|
||||
// Call the extensions to add content to the page, warning they can also add styles or scripts through as they have access to the iTopWebPage
|
||||
/** @var \iPageUIBlockExtension $oExtensionInstance */
|
||||
foreach (MetaModel::EnumPlugins('iPageUIBlockExtension') as $oExtensionInstance)
|
||||
{
|
||||
foreach (MetaModel::EnumPlugins('iPageUIBlockExtension') as $oExtensionInstance) {
|
||||
$oBlock = $oExtensionInstance->GetBannerBlock();
|
||||
if ($oBlock) {
|
||||
$oBanner->AddSubBlock($oBlock);
|
||||
@@ -643,7 +638,6 @@ JS
|
||||
return $oBanner;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Render the header UIBlock which can come from both iTop itself and from extensions
|
||||
*
|
||||
@@ -673,11 +667,10 @@ JS
|
||||
}
|
||||
|
||||
// Access mode
|
||||
$sRestrictionMessage ='';
|
||||
$sRestrictionMessage = '';
|
||||
if (!MetaModel::DBHasAccess(ACCESS_ADMIN_WRITE)) {
|
||||
$sRestrictionMessage = Dict::S('UI:AccessRO-All');
|
||||
}
|
||||
elseif (!MetaModel::DBHasAccess(ACCESS_USER_WRITE)) {
|
||||
} elseif (!MetaModel::DBHasAccess(ACCESS_USER_WRITE)) {
|
||||
$sRestrictionMessage = Dict::S('UI:AccessRO-Users');
|
||||
}
|
||||
|
||||
@@ -707,8 +700,7 @@ HTML;
|
||||
|
||||
// Call the extensions to add content to the page, warning they can also add styles or scripts through as they have access to the iTopWebPage
|
||||
/** @var \iPageUIBlockExtension $oExtensionInstance */
|
||||
foreach (MetaModel::EnumPlugins('iPageUIBlockExtension') as $oExtensionInstance)
|
||||
{
|
||||
foreach (MetaModel::EnumPlugins('iPageUIBlockExtension') as $oExtensionInstance) {
|
||||
$oBlock = $oExtensionInstance->GetHeaderBlock();
|
||||
if ($oBlock) {
|
||||
$oHeader->AddSubBlock($oBlock);
|
||||
@@ -718,7 +710,6 @@ HTML;
|
||||
return $oHeader;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Render the footer UIBlock which can come from both iTop itself and from extensions
|
||||
*
|
||||
@@ -875,7 +866,7 @@ HTML;
|
||||
$aData['aLayouts']['oPageContent'] = $this->GetContentLayout();
|
||||
$aData['aDeferredBlocks']['oPageContent'] = $this->GetDeferredBlocks($this->GetContentLayout());
|
||||
// - Prepare generic templates
|
||||
$aData['aTemplates'] = array();
|
||||
$aData['aTemplates'] = [];
|
||||
|
||||
// TODO 3.1 Replace hardcoded 'Please wait' with dict entries
|
||||
|
||||
@@ -888,12 +879,12 @@ HTML;
|
||||
|
||||
// - Small loader template
|
||||
$oSmallLoaderTemplateContentBlock = new UIContentBlock();
|
||||
$oSmallLoaderTemplateContentBlock->AddSubBlock(SpinnerUIBlockFactory::MakeSmall(null , 'Please wait'));
|
||||
$oSmallLoaderTemplateContentBlock->AddSubBlock(SpinnerUIBlockFactory::MakeSmall(null, 'Please wait'));
|
||||
$aData['aTemplates'][] = TemplateUIBlockFactory::MakeForBlock('ibo-small-loading-placeholder-template', $oSmallLoaderTemplateContentBlock);
|
||||
|
||||
// - Large loader template
|
||||
$oLargeLoaderTemplateContentBlock = new UIContentBlock();
|
||||
$oLargeLoaderTemplateContentBlock->AddSubBlock(SpinnerUIBlockFactory::MakeLarge(null , 'Please wait'));
|
||||
$oLargeLoaderTemplateContentBlock->AddSubBlock(SpinnerUIBlockFactory::MakeLarge(null, 'Please wait'));
|
||||
$aData['aTemplates'][] = TemplateUIBlockFactory::MakeForBlock('ibo-large-loading-placeholder-template', $oLargeLoaderTemplateContentBlock);
|
||||
|
||||
// - Do not show again template
|
||||
@@ -954,7 +945,7 @@ HTML;
|
||||
*/
|
||||
public function AddTabContainer($sTabContainer, $sPrefix = '', iUIContentBlock $oParentBlock = null)
|
||||
{
|
||||
if(is_null($oParentBlock)) {
|
||||
if (is_null($oParentBlock)) {
|
||||
$oParentBlock = PanelUIBlockFactory::MakeNeutral('');
|
||||
$this->AddUiBlock($oParentBlock);
|
||||
}
|
||||
@@ -1056,14 +1047,11 @@ HTML;
|
||||
$sCurrentTabContainer = $this->m_oTabs->GetCurrentTabContainer();
|
||||
$sCurrentTab = $this->m_oTabs->GetCurrentTab();
|
||||
|
||||
if (!empty($sCurrentTabContainer) && !empty($sCurrentTab))
|
||||
{
|
||||
if (!empty($sCurrentTabContainer) && !empty($sCurrentTab)) {
|
||||
$iOffset = $this->m_oTabs->GetCurrentTabLength();
|
||||
|
||||
return array('tc' => $sCurrentTabContainer, 'tab' => $sCurrentTab, 'offset' => $iOffset);
|
||||
}
|
||||
else
|
||||
{
|
||||
return ['tc' => $sCurrentTabContainer, 'tab' => $sCurrentTab, 'offset' => $iOffset];
|
||||
} else {
|
||||
return parent::start_capture();
|
||||
}
|
||||
}
|
||||
@@ -1073,19 +1061,13 @@ HTML;
|
||||
*/
|
||||
public function end_capture($offset)
|
||||
{
|
||||
if (is_array($offset))
|
||||
{
|
||||
if ($this->m_oTabs->TabExists($offset['tc'], $offset['tab']))
|
||||
{
|
||||
if (is_array($offset)) {
|
||||
if ($this->m_oTabs->TabExists($offset['tc'], $offset['tab'])) {
|
||||
$sCaptured = $this->m_oTabs->TruncateTab($offset['tc'], $offset['tab'], $offset['offset']);
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
$sCaptured = '';
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
$sCaptured = parent::end_capture($offset);
|
||||
}
|
||||
|
||||
@@ -1112,13 +1094,12 @@ HTML;
|
||||
*/
|
||||
public function AddApplicationMessage($sHtmlMessage, $sHtmlIcon = null, $sTip = null)
|
||||
{
|
||||
if (strlen($sHtmlMessage))
|
||||
{
|
||||
$this->m_aMessages[] = array(
|
||||
if (strlen($sHtmlMessage)) {
|
||||
$this->m_aMessages[] = [
|
||||
'icon' => $sHtmlIcon,
|
||||
'message' => $sHtmlMessage,
|
||||
'tip' => $sTip,
|
||||
);
|
||||
];
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1,9 +1,10 @@
|
||||
<?php
|
||||
|
||||
// Copyright (C) 2010-2024 Combodo SAS
|
||||
//
|
||||
// This file is part of iTop.
|
||||
//
|
||||
// iTop is free software; you can redistribute it and/or modify
|
||||
// iTop is free software; you can redistribute it and/or modify
|
||||
// it under the terms of the GNU Affero General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
@@ -33,29 +34,28 @@ use utils;
|
||||
*/
|
||||
class iTopWizardWebPage extends iTopWebPage
|
||||
{
|
||||
var $m_iCurrentStep;
|
||||
var $m_aSteps;
|
||||
public function __construct($sTitle, $currentOrganization, $iCurrentStep, $aSteps)
|
||||
{
|
||||
$oKpi = new ExecutionKPI();
|
||||
parent::__construct($sTitle." - step $iCurrentStep of ".count($aSteps)." - ".$aSteps[$iCurrentStep - 1], $currentOrganization);
|
||||
public $m_iCurrentStep;
|
||||
public $m_aSteps;
|
||||
public function __construct($sTitle, $currentOrganization, $iCurrentStep, $aSteps)
|
||||
{
|
||||
$oKpi = new ExecutionKPI();
|
||||
parent::__construct($sTitle." - step $iCurrentStep of ".count($aSteps)." - ".$aSteps[$iCurrentStep - 1], $currentOrganization);
|
||||
$this->m_iCurrentStep = $iCurrentStep;
|
||||
$this->m_aSteps = $aSteps;
|
||||
$oKpi->ComputeStats(get_class($this).' creation', 'iTopWizardWebPage');
|
||||
}
|
||||
|
||||
public function output()
|
||||
{
|
||||
$aSteps = array();
|
||||
$iIndex = 0;
|
||||
foreach($this->m_aSteps as $sStepTitle)
|
||||
{
|
||||
$iIndex++;
|
||||
$sStyle = ($iIndex == $this->m_iCurrentStep) ? 'wizActiveStep' : 'wizStep';
|
||||
$aSteps[] = "<div class=\"$sStyle\"><span>$sStepTitle</span></div>";
|
||||
}
|
||||
$sWizardHeader = "<div class=\"wizHeader\"><h1>".utils::EscapeHtml($this->s_title)."</h1>\n".implode("<div class=\"wizSeparator\"><img align=\"bottom\" src=\"" . utils::GetAbsoluteUrlAppRoot() . "images/wizArrow.gif\"></div>", $aSteps)."<br style=\"clear:both;\"/></div>\n";
|
||||
$this->s_content = "$sWizardHeader<div class=\"wizContainer\">".$this->s_content."</div>";
|
||||
parent::output();
|
||||
$this->m_aSteps = $aSteps;
|
||||
$oKpi->ComputeStats(get_class($this).' creation', 'iTopWizardWebPage');
|
||||
}
|
||||
|
||||
public function output()
|
||||
{
|
||||
$aSteps = [];
|
||||
$iIndex = 0;
|
||||
foreach ($this->m_aSteps as $sStepTitle) {
|
||||
$iIndex++;
|
||||
$sStyle = ($iIndex == $this->m_iCurrentStep) ? 'wizActiveStep' : 'wizStep';
|
||||
$aSteps[] = "<div class=\"$sStyle\"><span>$sStepTitle</span></div>";
|
||||
}
|
||||
$sWizardHeader = "<div class=\"wizHeader\"><h1>".utils::EscapeHtml($this->s_title)."</h1>\n".implode("<div class=\"wizSeparator\"><img align=\"bottom\" src=\"".utils::GetAbsoluteUrlAppRoot()."images/wizArrow.gif\"></div>", $aSteps)."<br style=\"clear:both;\"/></div>\n";
|
||||
$this->s_content = "$sWizardHeader<div class=\"wizContainer\">".$this->s_content."</div>";
|
||||
parent::output();
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user