浏览代码

Automatically add an id on the transitions to allow a finer granularity for the deltas.

git-svn-id: http://svn.code.sf.net/p/itop/code/trunk@3287 a333f486-631f-4898-b8df-5754b55c2be0
dflaven 11 年之前
父节点
当前提交
229dc56ac1
共有 1 个文件被更改,包括 14 次插入1 次删除
  1. 14 1
      setup/modelfactory.class.inc.php

+ 14 - 1
setup/modelfactory.class.inc.php

@@ -215,6 +215,9 @@ class ModelFactory
 		$this->oMenus = $this->oDOMDocument->CreateElement('menus');
 		$this->oRoot->AppendChild($this->oMenus);
 		
+		$this->oCombodo = $this->oDOMDocument->CreateElement('combodo');
+		$this->oRoot->AppendChild($this->oCombodo);
+		
 		foreach($aRootNodeExtensions as $sElementName)
 		{
 			$oElement = $this->oDOMDocument->CreateElement($sElementName);
@@ -428,7 +431,17 @@ class ModelFactory
 						$oUserRightsNode->SetAttribute('_created_in', $sModuleName);
 					}
 				}
-	
+				// Adjust the XML to transparently add an id (=stimulus) on all life-cycle transitions
+				// which don't already have one
+				$oNodeList = $oXPath->query('/itop_design/classes//class/lifecycle/states/state/transitions/transition/stimulus');	
+				foreach($oNodeList as $oNode)
+				{
+					if ($oNode->parentNode->getAttribute('id') == '')
+					{
+						$oNode->parentNode->SetAttribute('id', $oNode->textContent);
+					}
+				}
+				
 				$oDeltaRoot = $oDocument->childNodes->item(0);
 				$this->LoadDelta($oDocument, $oDeltaRoot, $this->oDOMDocument);
 			}