فهرست منبع

Plug-ins integration: added the ability to manage attachments while creating a new object.

git-svn-id: http://svn.code.sf.net/p/itop/code/trunk@1149 a333f486-631f-4898-b8df-5754b55c2be0
dflaven 14 سال پیش
والد
کامیت
c30814e2aa
2فایلهای تغییر یافته به همراه31 افزوده شده و 1 حذف شده
  1. 10 1
      application/cmdbabstract.class.inc.php
  2. 21 0
      application/webpage.class.inc.php

+ 10 - 1
application/cmdbabstract.class.inc.php

@@ -1403,6 +1403,8 @@ EOF
 		{
 			$sFormAction = $aExtraParams['action'];
 		}
+		$iTransactionId = utils::GetNewTransactionId();
+		$oPage->SetTransactionId($iTransactionId);
 		$oPage->add("<form action=\"$sFormAction\" id=\"form_{$this->m_iFormId}\" enctype=\"multipart/form-data\" method=\"post\" onSubmit=\"return CheckFields('form_{$this->m_iFormId}', true)\">\n");
 
 		$oPage->AddTabContainer(OBJECT_PROPERTIES_TAB, $sPrefix);
@@ -1564,7 +1566,7 @@ EOF
 
 		$oPage->SetCurrentTab('');
 		$oPage->add("<input type=\"hidden\" name=\"class\" value=\"$sClass\">\n");
-		$oPage->add("<input type=\"hidden\" name=\"transaction_id\" value=\"".utils::GetNewTransactionId()."\">\n");
+		$oPage->add("<input type=\"hidden\" name=\"transaction_id\" value=\"$iTransactionId\">\n");
 		foreach($aExtraParams as $sName => $value)
 		{
 			$oPage->add("<input type=\"hidden\" name=\"$sName\" value=\"$value\">\n");
@@ -2078,6 +2080,13 @@ EOF
 				}
 			}
 		}
+		
+		// Invoke extensions after the update of the object from the form
+		foreach (MetaModel::EnumPlugins('iApplicationObjectExtension') as $oExtensionInstance)
+		{
+			$oExtensionInstance->OnFormSubmit($this, $sFormPrefix);
+		}
+		
 		return $aErrors;
 	}
 

+ 21 - 0
application/webpage.class.inc.php

@@ -46,6 +46,7 @@ class WebPage
     protected $a_headers;
     protected $a_base;
     protected $iNextId;
+    protected $iTransactionId;
     
     public function __construct($s_title)
     {
@@ -59,6 +60,7 @@ class WebPage
         $this->a_headers = array();
         $this->a_base = array( 'href' => '', 'target' => '');
         $this->iNextId = 0;
+        $this->iTransactionId = 0;
         ob_start(); // Start capturing the output
     }
 	
@@ -372,5 +374,24 @@ class WebPage
 	{
 		return $this->iNextId++;
 	}
+	
+	/**
+	 * Set the transactionId of the current form
+	 * @param $iTransactionId integer
+	 * @return void
+	 */
+	public function SetTransactionId($iTransactionId)
+	{
+		$this->iTransactionId = $iTransactionId;
+	}
+	
+	/**
+	 * Returns the transactionId of the current form
+	 * @return integer The current transactionID
+	 */
+	public function GetTransactionId()
+	{
+		return $this->iTransactionId;
+	}
 }
 ?>