mirror of
https://github.com/Combodo/iTop.git
synced 2026-04-23 02:28:44 +02:00
N°478 - Customizable access to the 'Admin Tools'
SVN:trunk[5364]
This commit is contained in:
@@ -35,7 +35,7 @@
|
||||
* }
|
||||
*/
|
||||
|
||||
define('ITOP_DESIGN_LATEST_VERSION', '1.4'); // iTop >= 2.4.0
|
||||
define('ITOP_DESIGN_LATEST_VERSION', '1.5'); // iTop >= 2.5.0
|
||||
|
||||
class iTopDesignFormat
|
||||
{
|
||||
@@ -67,6 +67,12 @@ class iTopDesignFormat
|
||||
'1.4' => array(
|
||||
'previous' => '1.3',
|
||||
'go_to_previous' => 'From14To13',
|
||||
'next' => '1.5',
|
||||
'go_to_next' => 'From14To15',
|
||||
),
|
||||
'1.5' => array(
|
||||
'previous' => '1.4',
|
||||
'go_to_previous' => 'From15To14',
|
||||
'next' => null,
|
||||
'go_to_next' => null,
|
||||
),
|
||||
@@ -172,8 +178,10 @@ class iTopDesignFormat
|
||||
}
|
||||
|
||||
/**
|
||||
* An alternative to getNodePath, that gives the id of nodes instead of the position within the children
|
||||
*/
|
||||
* An alternative to getNodePath, that gives the id of nodes instead of the position within the children
|
||||
* @param $oNode
|
||||
* @return string
|
||||
*/
|
||||
public static function GetItopNodePath($oNode)
|
||||
{
|
||||
if ($oNode instanceof DOMDocument) return '';
|
||||
@@ -245,7 +253,6 @@ class iTopDesignFormat
|
||||
* @param string $sFrom The source format version
|
||||
* @param string $sTo The desired format version
|
||||
* @param object $oFactory Full data model (not yet used, aimed at allowing conversion that could not be performed without knowing the whole data model)
|
||||
* @return bool True on success
|
||||
*/
|
||||
protected function DoConvert($sFrom, $sTo, $oFactory = null)
|
||||
{
|
||||
@@ -299,6 +306,7 @@ class iTopDesignFormat
|
||||
|
||||
/**
|
||||
* Upgrade the format from version 1.0 to 1.1
|
||||
* @param $oFactory
|
||||
* @return void (Errors are logged)
|
||||
*/
|
||||
protected function From10To11($oFactory)
|
||||
@@ -350,9 +358,10 @@ class iTopDesignFormat
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Downgrade the format from version 1.1 to 1.0
|
||||
* @param $oFactory
|
||||
* @return void (Errors are logged)
|
||||
*/
|
||||
protected function From11To10($oFactory)
|
||||
@@ -422,6 +431,7 @@ class iTopDesignFormat
|
||||
|
||||
/**
|
||||
* Upgrade the format from version 1.1 to 1.2
|
||||
* @param $oFactory
|
||||
* @return void (Errors are logged)
|
||||
*/
|
||||
protected function From11To12($oFactory)
|
||||
@@ -430,6 +440,7 @@ class iTopDesignFormat
|
||||
|
||||
/**
|
||||
* Downgrade the format from version 1.2 to 1.1
|
||||
* @param $oFactory
|
||||
* @return void (Errors are logged)
|
||||
*/
|
||||
protected function From12To11($oFactory)
|
||||
@@ -487,6 +498,7 @@ class iTopDesignFormat
|
||||
|
||||
/**
|
||||
* Upgrade the format from version 1.2 to 1.3
|
||||
* @param $oFactory
|
||||
* @return void (Errors are logged)
|
||||
*/
|
||||
protected function From12To13($oFactory)
|
||||
@@ -495,6 +507,7 @@ class iTopDesignFormat
|
||||
|
||||
/**
|
||||
* Downgrade the format from version 1.3 to 1.2
|
||||
* @param $oFactory
|
||||
* @return void (Errors are logged)
|
||||
*/
|
||||
protected function From13To12($oFactory)
|
||||
@@ -544,17 +557,19 @@ class iTopDesignFormat
|
||||
$oNode->setAttribute('_delta', 'must_exist');
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Upgrade the format from version 1.3 to 1.4
|
||||
* @param $oFactory
|
||||
* @return void (Errors are logged)
|
||||
*/
|
||||
protected function From13To14($oFactory)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Downgrade the format from version 1.4 to 1.3
|
||||
* @param $oFactory
|
||||
* @return void (Errors are logged)
|
||||
*/
|
||||
protected function From14To13($oFactory)
|
||||
@@ -585,8 +600,34 @@ class iTopDesignFormat
|
||||
$this->DeleteNode($oNode);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Downgrade the format from version 1.5 to 1.4
|
||||
* @param $oFactory
|
||||
* @return void (Errors are logged)
|
||||
*/
|
||||
protected function From15To14($oFactory)
|
||||
{
|
||||
$oXPath = new DOMXPath($this->oDocument);
|
||||
|
||||
// Remove nodes on some menus
|
||||
//
|
||||
$sPath = "/itop_design/menus/menu[@xsi:type!='MenuGroup' and @xsi:type!='TemplateMenuNode']";
|
||||
$oNodeList = $oXPath->query("$sPath/enable_class | $sPath/enable_action | $sPath/enable_permission | $sPath/enable_stimulus");
|
||||
foreach ($oNodeList as $oNode)
|
||||
{
|
||||
$this->LogWarning('Node '.self::GetItopNodePath($oNode).' is irrelevant in this version, it will be ignored. Use enable_admin_only instead.');
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Upgrade the format from version 1.4 to 1.5
|
||||
* @param $oFactory
|
||||
* @return void (Errors are logged)
|
||||
*/
|
||||
protected function From14To15($oFactory)
|
||||
{
|
||||
}
|
||||
|
||||
/**
|
||||
* Delete a node from the DOM and make sure to also remove the immediately following line break (DOMText), if any.
|
||||
|
||||
Reference in New Issue
Block a user