N°1024 Portal: New portal instances can now be XML only (through ITSM Designer), no more need for a dedicated module !

SVN:trunk[4900]
This commit is contained in:
Guillaume Lajarige
2017-09-07 16:03:55 +00:00
parent 6f474686ad
commit d6707743a9
6 changed files with 89 additions and 13 deletions

View File

@@ -0,0 +1,51 @@
<?php
// Copyright (C) 2010-2017 Combodo SARL
//
// This file is part of iTop.
//
// 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.
//
// iTop is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Affero General Public License for more details.
//
// You should have received a copy of the GNU Affero General Public License
// along with iTop. If not, see <http://www.gnu.org/licenses/>
/**
* Executes a portal without having a dedicated module.
* This allows to make a portal directly from the ITSM Designer.
*/
if (file_exists(__DIR__ . '/../../approot.inc.php'))
{
require_once __DIR__ . '/../../approot.inc.php'; // When in env-xxxx folder
}
else
{
require_once __DIR__ . '/../../../approot.inc.php'; // When in datamodels/x.x folder
}
require_once APPROOT . '/application/startup.inc.php';
// If PORTAL_ID is not already defined, we look for it in a parameter
if(!defined('PORTAL_ID'))
{
// Retrieving portal id from request params
$sPortalId = utils::ReadParam('portal_id', '');
if ($sPortalId == '')
{
echo "Missing argument 'portal_id'";
exit;
}
// Defining portal constants
define('PORTAL_MODULE_ID', $sPortalId);
define('PORTAL_ID', $sPortalId);
}
require_once APPROOT . '/env-' . utils::GetCurrentEnvironment() . '/itop-portal-base/portal/web/index.php';

View File

@@ -37,6 +37,7 @@ use \MetaModel;
use \DBObjectSearch;
use \DBObjectSet;
use \iPortalUIExtension;
use \ApplicationContext;
use \Combodo\iTop\Portal\Brick\AbstractBrick;
/**
@@ -406,6 +407,7 @@ class ApplicationHelper
'layout' => 'itop-portal-base/portal/src/views/layout.html.twig',
'home' => 'itop-portal-base/portal/src/views/home/layout.html.twig'
),
'urlmaker_class' => null,
'triggers_query' => null,
'attachments' => array(
'allow_delete' => true
@@ -433,6 +435,7 @@ class ApplicationHelper
switch ($oPropertyNode->nodeName)
{
case 'name':
case 'urlmaker_class':
case 'triggers_query':
$aPortalConf['properties'][$oPropertyNode->nodeName] = $oPropertyNode->GetText($aPortalConf['properties'][$oPropertyNode->nodeName]);
break;
@@ -539,6 +542,11 @@ class ApplicationHelper
$aPortalConf['ui_extensions'] = static::LoadUIExtensions($oApp);
// - Action rules
static::LoadActionRulesConfiguration($oApp, $oDesign);
// - Setting UrlMakerClass
if($aPortalConf['properties']['urlmaker_class'] !== null)
{
ApplicationContext::SetUrlMakerClass($aPortalConf['properties']['urlmaker_class']);
}
// - Generating CSS files
$aImportPaths = array($oApp['combodo.portal.base.absolute_path'] . 'css/');
foreach ($aPortalConf['properties']['themes'] as $key => $value)

View File

@@ -1,6 +1,6 @@
<?php
// Copyright (C) 2010-2015 Combodo SARL
// Copyright (C) 2010-2017 Combodo SARL
//
// This file is part of iTop.
//
@@ -54,12 +54,17 @@ class UrlGenerator extends SymfonyUrlGenerator
}
// Optional parameters
$sEnvSwitch = utils::ReadParam('env_switch', '', false, 'string');
if ($sEnvSwitch !== '')
{
$parameters['env_switch'] = $sEnvSwitch;
}
$sDebug = utils::ReadParam('debug', '', false, 'string');
$sPortalId = utils::ReadParam('portal_id', '', false, 'string');
if ($sPortalId !== '')
{
$parameters['portal_id'] = $sPortalId;
}
$sEnvSwitch = utils::ReadParam('env_switch', '', false, 'string');
if ($sEnvSwitch !== '')
{
$parameters['env_switch'] = $sEnvSwitch;
}
$sDebug = utils::ReadParam('debug', '', false, 'string');
if ($sDebug !== '')
{
$parameters['debug'] = $sDebug;
@@ -69,5 +74,3 @@ class UrlGenerator extends SymfonyUrlGenerator
}
}
?>