Sfoglia il codice sorgente

Fixed Trac#518: properly pass the context (i.e. org_id) to the auto-refresh lists

git-svn-id: http://svn.code.sf.net/p/itop/code/trunk@1811 a333f486-631f-4898-b8df-5754b55c2be0
dflaven 13 anni fa
parent
commit
ccb3b96c45
2 ha cambiato i file con 18 aggiunte e 2 eliminazioni
  1. 6 2
      application/applicationcontext.class.inc.php
  2. 12 0
      pages/ajax.render.php

+ 6 - 2
application/applicationcontext.class.inc.php

@@ -77,12 +77,16 @@ class ApplicationContext
 	protected $aValues;
 	protected static $aDefaultValues; // Cache shared among all instances
 	
-	public function __construct()
+	public function __construct($bReadContext = true)
 	{
 		$this->aNames = array(
 			'org_id', 'menu'
 		);
-		$this->ReadContext();
+		if ($bReadContext)
+		{
+			$this->ReadContext();			
+		}
+
 	}
 	
 	/**

+ 12 - 0
pages/ajax.render.php

@@ -442,6 +442,18 @@ try
 			{
 				$aExtraParams = json_decode(str_replace("'", '"', $sExtraParams), true /* associative array */);
 			}
+			// Restore the app context from the ExtraParams
+			$oAppContext = new ApplicationContext(false); // false => don't read the context yet !
+			$aContext = array();
+			foreach($oAppContext->GetNames() as $sName)
+			{
+				$sParamName = 'c['.$sName.']';
+				if (isset($aExtraParams[$sParamName]))
+				{
+					$aContext[$sName] = $aExtraParams[$sParamName];
+				}
+			}
+			$_REQUEST['c'] = $aContext;
 			if ($sEncoding == 'oql')
 			{
 				$oFilter = CMDBSearchFilter::FromOQL($sFilter);