From e5682fd2e9f0076035f0f4c4412b1b956e0f3abc Mon Sep 17 00:00:00 2001 From: Denis Flaven Date: Fri, 25 Mar 2011 17:09:50 +0000 Subject: [PATCH] Plug-ins integration: added the ability to manage attachments while creating a new object. SVN:trunk[1149] --- application/cmdbabstract.class.inc.php | 11 ++++++++++- application/webpage.class.inc.php | 21 +++++++++++++++++++++ 2 files changed, 31 insertions(+), 1 deletion(-) diff --git a/application/cmdbabstract.class.inc.php b/application/cmdbabstract.class.inc.php index 8b0dd75c8..121ea44d4 100644 --- a/application/cmdbabstract.class.inc.php +++ b/application/cmdbabstract.class.inc.php @@ -1403,6 +1403,8 @@ EOF { $sFormAction = $aExtraParams['action']; } + $iTransactionId = utils::GetNewTransactionId(); + $oPage->SetTransactionId($iTransactionId); $oPage->add("
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("\n"); - $oPage->add("\n"); + $oPage->add("\n"); foreach($aExtraParams as $sName => $value) { $oPage->add("\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; } diff --git a/application/webpage.class.inc.php b/application/webpage.class.inc.php index e17dc532e..320e702e3 100644 --- a/application/webpage.class.inc.php +++ b/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; + } } ?> \ No newline at end of file