Bläddra i källkod

Compiler and co: fixed issue with the deletion (read a delta)

git-svn-id: http://svn.code.sf.net/p/itop/code/trunk@1986 a333f486-631f-4898-b8df-5754b55c2be0
romainq 13 år sedan
förälder
incheckning
2ba543742c
1 ändrade filer med 4 tillägg och 46 borttagningar
  1. 4 46
      setup/modelfactory.class.inc.php

+ 4 - 46
setup/modelfactory.class.inc.php

@@ -1171,11 +1171,11 @@ class MFElement extends DOMElement
 	}
 
 	/**
-	 * For debugging purposes
+	 * For debugging purposes - but this is currently buggy: the whole document is rendered
 	 */
 	public function Dump()
 	{
-		echo "<pre>\n";	 	
+		echo "<pre>\n";
 		echo htmlentities($this->ownerDocument->saveXML($this));
 		echo "</pre>\n";	 	
 	}
@@ -1344,48 +1344,6 @@ class MFElement extends DOMElement
 	{
 		return self::FindNode($this, $oRefNode, $sSearchId);
 	}
-	/**
-	 * Find the child node matching the given node
-	 * @param DOMNode   $oParent The node to look into (could be DOMDocument, DOMElement...)
-	 * @param MFElement $oRefNode The node to search for
-	 * @param bool      $sSearchId substitutes to the value of the 'id' attribute 
-	 */	
-	public static function FindNodeSlow(DOMNode $oParent, MFElement $oRefNode, $sSearchId = null)
-	{
-		$oRes = null;
-		if ($oRefNode->hasAttribute('id'))
-		{
-			// Find the first element having the same tag name and id
-			if (!$sSearchId)
-			{
-				$sSearchId = $oRefNode->getAttribute('id');
-			}
-			foreach($oParent->childNodes as $oChildNode)
-			{
-				if (($oChildNode instanceof DOMElement) && ($oChildNode->tagName == $oRefNode->tagName))
-				{
-					if ($oChildNode->hasAttribute('id') && ($oChildNode->getAttribute('id') == $sSearchId))
-					{
-						$oRes = $oChildNode;
-						break;
-					}
-				}
-			}
-		}
-		else
-		{
-			// Get the first one having the same tag name (ignore others)
-			foreach($oParent->childNodes as $oChildNode)
-			{
-				if (($oChildNode instanceof DOMElement) && ($oChildNode->tagName == $oRefNode->tagName))
-				{
-					$oRes = $oChildNode;
-					break;
-				}
-			}
-		}
-		return $oRes;
-	}
 	
 	/**
 	 * Seems to work fine (and is about 10 times faster than above) EXCEPT for menus !!!!
@@ -1554,7 +1512,7 @@ class MFElement extends DOMElement
 		default:
 			$sFlag = 'removed';
 			// Iterate through the parents: reset the flag if any of them has a flag set 
-			for($oParent = $this ; $oParent instanceof MFElement ; $oParent = $oParent->parentNode)
+			for($oParent = $this ; $oParent instanceof MFElement ; $oParent = $this->parentNode->parentNode)
 			{
 				if ($oParent->getAttribute('_alteration') != '')
 				{
@@ -1571,7 +1529,7 @@ class MFElement extends DOMElement
 		else
 		{
 			// Remove the node entirely
-			$oParent->removeChild($this);
+			$this->parentNode->removeChild($this);
 		}
 	}