浏览代码

Forgot to add 3 files in the previous commit

git-svn-id: http://svn.code.sf.net/p/itop/code/trunk@226 a333f486-631f-4898-b8df-5754b55c2be0
romainq 15 年之前
父节点
当前提交
a98c2259d3
共有 3 个文件被更改,包括 536 次插入0 次删除
  1. 238 0
      core/action.class.inc.php
  2. 94 0
      core/event.class.inc.php
  3. 204 0
      core/trigger.class.inc.php

+ 238 - 0
core/action.class.inc.php

@@ -0,0 +1,238 @@
+<?php
+
+/**
+ * A user defined action, to customize the application  
+ *
+ * @package     iTopORM
+ * @author      Romain Quetiez <romainquetiez@yahoo.fr>
+ * @author      Denis Flaven <denisflave@free.fr>
+ * @license     http://www.opensource.org/licenses/lgpl-license.php LGPL
+ * @link        www.itop.com
+ * @since       1.0
+ * @version     1.1.1.1 $
+ */
+abstract class Action extends cmdbAbstractObject
+{
+	public static function Init()
+	{
+		$aParams = array
+		(
+			"category" => "core/cmdb",
+			"name" => "action",
+			"description" => "Custom action",
+			"key_type" => "autoincrement",
+			"key_label" => "",
+			"name_attcode" => "name",
+			"state_attcode" => "",
+			"reconc_keys" => array(),
+			"db_table" => "priv_action",
+			"db_key_field" => "id",
+			"db_finalclass_field" => "realclass",
+			"display_template" => "",
+		);
+		MetaModel::Init_Params($aParams);
+		//MetaModel::Init_InheritAttributes();
+		MetaModel::Init_AddAttribute(new AttributeString("name", array("label"=>"Name", "description"=>"label", "allowed_values"=>null, "sql"=>"name", "default_value"=>null, "is_null_allowed"=>false, "depends_on"=>array())));
+		MetaModel::Init_AddAttribute(new AttributeString("description", array("label"=>"Description", "description"=>"one line description", "allowed_values"=>null, "sql"=>"description", "default_value"=>null, "is_null_allowed"=>true, "depends_on"=>array())));
+
+		//MetaModel::Init_InheritFilters();
+		MetaModel::Init_AddFilterFromAttribute("name");
+		MetaModel::Init_AddFilterFromAttribute("description");
+
+		// Display lists
+		MetaModel::Init_SetZListItems('details', array('name', 'description')); // Attributes to be displayed for the complete details
+		MetaModel::Init_SetZListItems('list', array('name', 'description')); // Attributes to be displayed for a list
+		// Search criteria
+//		MetaModel::Init_SetZListItems('standard_search', array('name')); // Criteria of the std search form
+//		MetaModel::Init_SetZListItems('advanced_search', array('name')); // Criteria of the advanced search form
+	}
+
+	abstract public function DoExecute($oTrigger, $aContextArgs);
+}
+
+/**
+ * A notification  
+ *
+ * @package     iTopORM
+ * @author      Romain Quetiez <romainquetiez@yahoo.fr>
+ * @author      Denis Flaven <denisflave@free.fr>
+ * @license     http://www.opensource.org/licenses/lgpl-license.php LGPL
+ * @link        www.itop.com
+ * @since       1.0
+ * @version     1.1.1.1 $
+ */
+abstract class ActionNotification extends Action
+{
+	public static function Init()
+	{
+		$aParams = array
+		(
+			"category" => "core/cmdb",
+			"name" => "notification",
+			"description" => "Notification (abstract)",
+			"key_type" => "autoincrement",
+			"key_label" => "",
+			"name_attcode" => "",
+			"state_attcode" => "",
+			"reconc_keys" => array(),
+			"db_table" => "priv_action_notification",
+			"db_key_field" => "id",
+			"db_finalclass_field" => "",
+			"display_template" => "",
+		);
+		MetaModel::Init_Params($aParams);
+		MetaModel::Init_InheritAttributes();
+
+		MetaModel::Init_InheritFilters();
+
+		// Display lists
+		MetaModel::Init_SetZListItems('details', array('name', 'description')); // Attributes to be displayed for the complete details
+		MetaModel::Init_SetZListItems('list', array('finalclass', 'name', 'description')); // Attributes to be displayed for a list
+		// Search criteria
+//		MetaModel::Init_SetZListItems('standard_search', array('name')); // Criteria of the std search form
+//		MetaModel::Init_SetZListItems('advanced_search', array('name')); // Criteria of the advanced search form
+	}
+}
+
+/**
+ * An email notification  
+ *
+ * @package     iTopORM
+ * @author      Romain Quetiez <romainquetiez@yahoo.fr>
+ * @author      Denis Flaven <denisflave@free.fr>
+ * @license     http://www.opensource.org/licenses/lgpl-license.php LGPL
+ * @link        www.itop.com
+ * @since       1.0
+ * @version     1.1.1.1 $
+ */
+class ActionEmail extends ActionNotification
+{
+	public static function Init()
+	{
+		$aParams = array
+		(
+			"category" => "core/cmdb",
+			"name" => "email notification",
+			"description" => "Action: Email notification",
+			"key_type" => "autoincrement",
+			"key_label" => "",
+			"name_attcode" => "",
+			"state_attcode" => "",
+			"reconc_keys" => array(),
+			"db_table" => "priv_action_email",
+			"db_key_field" => "id",
+			"db_finalclass_field" => "",
+			"display_template" => "",
+		);
+		MetaModel::Init_Params($aParams);
+		MetaModel::Init_InheritAttributes();
+
+		MetaModel::Init_AddAttribute(new AttributeString("from", array("label"=>"From", "description"=>"Will be sent into the email header", "allowed_values"=>null, "sql"=>"from", "default_value"=>null, "is_null_allowed"=>true, "depends_on"=>array())));
+		MetaModel::Init_AddAttribute(new AttributeString("reply_to", array("label"=>"Reply to", "description"=>"Will be sent into the email header", "allowed_values"=>null, "sql"=>"reply_to", "default_value"=>null, "is_null_allowed"=>true, "depends_on"=>array())));
+		MetaModel::Init_AddAttribute(new AttributeOQL("to", array("label"=>"To", "description"=>"Destination of the email", "allowed_values"=>null, "sql"=>"to", "default_value"=>null, "is_null_allowed"=>true, "depends_on"=>array())));
+		MetaModel::Init_AddAttribute(new AttributeOQL("cc", array("label"=>"Cc", "description"=>"Carbon Copy", "allowed_values"=>null, "sql"=>"cc", "default_value"=>null, "is_null_allowed"=>true, "depends_on"=>array())));
+		MetaModel::Init_AddAttribute(new AttributeOQL("bcc", array("label"=>"bcc", "description"=>"Blind Carbon Copy", "allowed_values"=>null, "sql"=>"bcc", "default_value"=>null, "is_null_allowed"=>true, "depends_on"=>array())));
+		MetaModel::Init_AddAttribute(new AttributeTemplateString("subject", array("label"=>"subject", "description"=>"Title of the email", "allowed_values"=>null, "sql"=>"subject", "default_value"=>null, "is_null_allowed"=>false, "depends_on"=>array())));
+		MetaModel::Init_AddAttribute(new AttributeTemplateText("body", array("label"=>"body", "description"=>"Contents of the email", "allowed_values"=>null, "sql"=>"body", "default_value"=>null, "is_null_allowed"=>false, "depends_on"=>array())));
+		MetaModel::Init_AddAttribute(new AttributeEnum("importance", array("label"=>"importance", "description"=>"Importance flag", "allowed_values"=>new ValueSetEnum('low,normal,high'), "sql"=>"importance", "default_value"=>'normal', "is_null_allowed"=>false, "depends_on"=>array())));
+
+		MetaModel::Init_InheritFilters();
+
+		// Display lists
+		MetaModel::Init_SetZListItems('details', array('name', 'description', 'from', 'reply_to', 'to', 'cc', 'bcc', 'subject', 'body', 'importance')); // Attributes to be displayed for the complete details
+		MetaModel::Init_SetZListItems('list', array('name', 'to', 'subject')); // Attributes to be displayed for a list
+		// Search criteria
+//		MetaModel::Init_SetZListItems('standard_search', array('name')); // Criteria of the std search form
+//		MetaModel::Init_SetZListItems('advanced_search', array('name')); // Criteria of the advanced search form
+	}
+
+	// args: a search object
+	// returns an array of emails
+	protected function FindRecipients($sAttCode, $aArgs)
+	{
+		$sOQL = $this->Get($sAttCode);
+		if (strlen($sOQL) == '') return '';
+
+		$oSearch = DBObjectSearch::FromOQL($sOQL);
+		$sClass = $oSearch->GetClass();
+		// Determine the email attribute (the first one will be our choice)
+		foreach (MetaModel::ListAttributeDefs($sClass) as $sAttCode => $oAttDef)
+		{
+			if ($oAttDef instanceof AttributeEmailAddress)
+			{
+				$sEmailAttCode = $sAttCode;
+				// we've got one, exit the loop
+				break;
+			}
+		}
+
+		$oSet = new DBObjectSet($oSearch, array() /* order */, $aArgs);
+		$aRecipients = array();
+		while ($oObj = $oSet->Fetch())
+		{
+			$aRecipients[] = $oObj->Get($sEmailAttCode);
+		}
+		return implode(', ', $aRecipients);
+	}
+
+	public function DoExecute($oTrigger, $aContextArgs)
+	{
+		// Determine recicipients
+		//
+		$sTo = $this->FindRecipients('to', $aContextArgs);
+		$sCC = $this->FindRecipients('cc', $aContextArgs);
+		$sBCC = $this->FindRecipients('bcc', $aContextArgs);
+
+		$sFrom = $this->Get('from');
+		$sReplyTo = $this->Get('reply_to');
+
+		$sSubject = MetaModel::ApplyParams($this->Get('subject'), $aContextArgs);
+		$sBody = MetaModel::ApplyParams($this->Get('body'), $aContextArgs);
+
+		// To send HTML mail, the Content-type header must be set
+		$sHeaders  = 'MIME-Version: 1.0' . "\r\n";
+		$sHeaders .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n";
+
+		// Additional headers
+		if (strlen($sFrom) > 0)
+		{
+			$sHeaders .= "From: $sFrom\r\n";
+			// This is required on Windows because otherwise I would get the error
+			// "sendmail_from" not set in php.ini" even if it is correctly working
+			// (apparently, once it worked the SMTP server won't claim anymore for it)
+			ini_set("sendmail_from", $sFrom);
+		}
+		if (strlen($sReplyTo) > 0)
+		{
+			$sHeaders .= "Reply-To: $sReplyTo\r\n";
+		}
+		if (strlen($sCC) > 0)
+		{
+			$sHeaders .= "Cc: $sCC\r\n";
+		}
+		if (strlen($sBCC) > 0)
+		{
+			$sHeaders .= "Bcc: $sBCC\r\n";
+		}
+
+		$sOverview = "TO:$sTo, FROM:$sFrom, REPLY-TO:$sReplyTo, CC:$sCC, BCC:$sBCC, SUBJECT:$sSubject, BODY:$sBody";
+
+		// Mail it
+		if (mail($sTo, $sSubject, $sBody, $sHeaders))
+		{
+			$oLog = new EventNotification();
+			$oLog->Set('message', 'Email sent successfully');
+			$oLog->Set('userinfo', UserRights::GetUser());
+			$oLog->Set('trigger_id', $oTrigger->GetKey());
+			$oLog->Set('action_id', $this->GetKey());
+			$oLog->Set('object_id', $aContextArgs['this->id']);
+			$oLog->Set('overview', $sOverview);
+			$oLog->DBInsertNoReload();
+		}
+		else
+		{
+			throw new CoreException('mail not sent', array('action'=>$this->GetKey(), 'to'=>$sTo, 'subject'=>$sSubject, 'headers'=>$sHeaders));
+		}
+	}
+}
+?>

+ 94 - 0
core/event.class.inc.php

@@ -0,0 +1,94 @@
+<?php
+
+/**
+ * An application internal event
+ *
+ * @package     iTopORM
+ * @author      Romain Quetiez <romainquetiez@yahoo.fr>
+ * @author      Denis Flaven <denisflave@free.fr>
+ * @license     http://www.opensource.org/licenses/lgpl-license.php LGPL
+ * @link        www.itop.com
+ * @since       1.0
+ * @version     1.1.1.1 $
+ */
+class Event extends cmdbAbstractObject
+{
+	public static function Init()
+	{
+		$aParams = array
+		(
+			"category" => "core/cmdb",
+			"name" => "Log Event",
+			"description" => "An application internal event",
+			"key_type" => "autoincrement",
+			"key_label" => "",
+			"name_attcode" => "",
+			"state_attcode" => "",
+			"reconc_keys" => array(),
+			"db_table" => "priv_event",
+			"db_key_field" => "id",
+			"db_finalclass_field" => "realclass",
+			"display_template" => "",
+		);
+		MetaModel::Init_Params($aParams);
+		//MetaModel::Init_InheritAttributes();
+		MetaModel::Init_AddAttribute(new AttributeString("message", array("label"=>"Message", "description"=>"one line description", "allowed_values"=>null, "sql"=>"message", "default_value"=>null, "is_null_allowed"=>false, "depends_on"=>array())));
+
+		MetaModel::Init_AddAttribute(new AttributeDate("date", array("label"=>"date", "description"=>"date and time at which the changes have been recorded", "allowed_values"=>null, "sql"=>"date", "default_value"=>"", "is_null_allowed"=>false, "depends_on"=>array())));
+		MetaModel::Init_AddAttribute(new AttributeString("userinfo", array("label"=>"misc. info", "description"=>"caller's defined information", "allowed_values"=>null, "sql"=>"userinfo", "default_value"=>null, "is_null_allowed"=>true, "depends_on"=>array())));
+
+		//MetaModel::Init_InheritFilters();
+		MetaModel::Init_AddFilterFromAttribute("message");
+		MetaModel::Init_AddFilterFromAttribute("date");
+
+		// Display lists
+		MetaModel::Init_SetZListItems('details', array('finalclass', 'date', 'message')); // Attributes to be displayed for the complete details
+		MetaModel::Init_SetZListItems('list', array('finalclass', 'date', 'message')); // Attributes to be displayed for a list
+		// Search criteria
+//		MetaModel::Init_SetZListItems('standard_search', array('name')); // Criteria of the std search form
+//		MetaModel::Init_SetZListItems('advanced_search', array('name')); // Criteria of the advanced search form
+	}
+}
+
+class EventNotification extends Event
+{
+	public static function Init()
+	{
+		$aParams = array
+		(
+			"category" => "core/cmdb",
+			"name" => "Notification event",
+			"description" => "Trace of a notification that has been sent",
+			"key_type" => "autoincrement",
+			"key_label" => "",
+			"name_attcode" => "",
+			"state_attcode" => "",
+			"reconc_keys" => array(),
+			"db_table" => "priv_event_notification",
+			"db_key_field" => "id",
+			"db_finalclass_field" => "",
+			"display_template" => "",
+		);
+		MetaModel::Init_Params($aParams);
+		MetaModel::Init_InheritAttributes();
+		MetaModel::Init_AddAttribute(new AttributeExternalKey("trigger_id", array("targetclass"=>"Trigger", "jointype"=> "", "label"=>"Trigger", "description"=>"user account", "allowed_values"=>null, "sql"=>"trigger_id", "is_null_allowed"=>false, "on_target_delete"=>DEL_AUTO, "depends_on"=>array())));
+		MetaModel::Init_AddAttribute(new AttributeExternalKey("action_id", array("targetclass"=>"Action", "jointype"=> "", "label"=>"user", "description"=>"user account", "allowed_values"=>null, "sql"=>"action_id", "is_null_allowed"=>false, "on_target_delete"=>DEL_AUTO, "depends_on"=>array())));
+		MetaModel::Init_AddAttribute(new AttributeInteger("object_id", array("label"=>"Object id", "description"=>"object id (class defined by the trigger ?)", "allowed_values"=>null, "sql"=>"object_id", "default_value"=>0, "is_null_allowed"=>false, "depends_on"=>array())));
+		MetaModel::Init_AddAttribute(new AttributeText("overview", array("label"=>"Overview", "description"=>"Complete view of the resulting email", "allowed_values"=>null, "sql"=>"overview", "default_value"=>null, "is_null_allowed"=>false, "depends_on"=>array())));
+
+		MetaModel::Init_InheritFilters();
+		MetaModel::Init_AddFilterFromAttribute("trigger_id");
+		MetaModel::Init_AddFilterFromAttribute("action_id");
+
+		// Display lists
+		MetaModel::Init_SetZListItems('details', array('date', 'message', 'userinfo', 'trigger_id', 'action_id', 'object_id', 'overview')); // Attributes to be displayed for the complete details
+		MetaModel::Init_SetZListItems('list', array('date', 'message')); // Attributes to be displayed for a list
+		// Search criteria
+//		MetaModel::Init_SetZListItems('standard_search', array('name')); // Criteria of the std search form
+//		MetaModel::Init_SetZListItems('advanced_search', array('name')); // Criteria of the advanced search form
+	}
+
+}
+
+
+?>

+ 204 - 0
core/trigger.class.inc.php

@@ -0,0 +1,204 @@
+<?php
+
+/**
+ * A user defined trigger, to customize the application 
+ * A trigger will activate an action
+ *
+ * @package     iTopORM
+ * @author      Romain Quetiez <romainquetiez@yahoo.fr>
+ * @author      Denis Flaven <denisflave@free.fr>
+ * @license     http://www.opensource.org/licenses/lgpl-license.php LGPL
+ * @link        www.itop.com
+ * @since       1.0
+ * @version     1.1.1.1 $
+ */
+class Trigger extends cmdbAbstractObject
+{
+	public static function Init()
+	{
+		$aParams = array
+		(
+			"category" => "core/cmdb",
+			"name" => "trigger",
+			"description" => "Custom event handler",
+			"key_type" => "autoincrement",
+			"key_label" => "",
+			"name_attcode" => "",
+			"state_attcode" => "",
+			"reconc_keys" => array(),
+			"db_table" => "priv_trigger",
+			"db_key_field" => "id",
+			"db_finalclass_field" => "realclass",
+			"display_template" => "",
+		);
+		MetaModel::Init_Params($aParams);
+		//MetaModel::Init_InheritAttributes();
+		MetaModel::Init_AddAttribute(new AttributeString("description", array("label"=>"Description", "description"=>"one line description", "allowed_values"=>null, "sql"=>"description", "default_value"=>null, "is_null_allowed"=>true, "depends_on"=>array())));
+
+		MetaModel::Init_AddAttribute(new AttributeLinkedSetIndirect("linked_actions", array("label"=>"Triggered actions", "description"=>"Actions performed when the trigger is activated", "linked_class"=>"lnkTriggerAction", "ext_key_to_me"=>"trigger_id", "ext_key_to_remote"=>"action_id", "allowed_values"=>null, "count_min"=>1, "count_max"=>0, "depends_on"=>array())));
+
+		//MetaModel::Init_InheritFilters();
+		MetaModel::Init_AddFilterFromAttribute("description");
+
+		// Display lists
+		MetaModel::Init_SetZListItems('details', array('finalclass', 'description')); // Attributes to be displayed for the complete details
+		MetaModel::Init_SetZListItems('list', array('finalclass', 'description')); // Attributes to be displayed for a list
+		// Search criteria
+//		MetaModel::Init_SetZListItems('standard_search', array('name')); // Criteria of the std search form
+//		MetaModel::Init_SetZListItems('advanced_search', array('name')); // Criteria of the advanced search form
+	}
+
+	public function DoActivate($aContextArgs)
+	{
+		// Find the related 
+		$oLinkedActions = $this->Get('linked_actions');
+		while ($oLink = $oLinkedActions->Fetch())
+		{
+			$iActionId = $oLink->Get('action_id');
+			$oAction = MetaModel::GetObject('Action', $iActionId);
+			$oAction->DoExecute($this, $aContextArgs);
+		}
+	}
+}
+
+class TriggerOnStateChange extends Trigger
+{
+	public static function Init()
+	{
+		$aParams = array
+		(
+			"category" => "core/cmdb",
+			"name" => "Trigger on object state change",
+			"description" => "Trigger on object state change",
+			"key_type" => "autoincrement",
+			"key_label" => "",
+			"name_attcode" => "",
+			"state_attcode" => "",
+			"reconc_keys" => array(),
+			"db_table" => "priv_trigger_onstatechange",
+			"db_key_field" => "id",
+			"db_finalclass_field" => "",
+			"display_template" => "",
+		);
+		MetaModel::Init_Params($aParams);
+		MetaModel::Init_InheritAttributes();
+		MetaModel::Init_AddAttribute(new AttributeString("target_class", array("label"=>"Target class", "description"=>"label", "allowed_values"=>null, "sql"=>"target_class", "default_value"=>null, "is_null_allowed"=>false, "depends_on"=>array())));
+		MetaModel::Init_AddAttribute(new AttributeString("state", array("label"=>"State", "description"=>"label", "allowed_values"=>null, "sql"=>"state", "default_value"=>null, "is_null_allowed"=>false, "depends_on"=>array())));	
+
+		MetaModel::Init_InheritFilters();
+		MetaModel::Init_AddFilterFromAttribute("target_class");
+		MetaModel::Init_AddFilterFromAttribute("state");
+
+		// Display lists
+		MetaModel::Init_SetZListItems('details', array('description', 'target_class', 'state')); // Attributes to be displayed for the complete details
+		MetaModel::Init_SetZListItems('list', array('finalclass', 'target_class', 'state')); // Attributes to be displayed for a list
+		// Search criteria
+//		MetaModel::Init_SetZListItems('standard_search', array('name')); // Criteria of the std search form
+//		MetaModel::Init_SetZListItems('advanced_search', array('name')); // Criteria of the advanced search form
+	}
+
+}
+
+class TriggerOnStateEnter extends TriggerOnStateChange
+{
+	public static function Init()
+	{
+		$aParams = array
+		(
+			"category" => "core/cmdb",
+			"name" => "Trigger on object entering a state",
+			"description" => "Trigger on object state change - entering",
+			"key_type" => "autoincrement",
+			"key_label" => "",
+			"name_attcode" => "",
+			"state_attcode" => "",
+			"reconc_keys" => array(),
+			"db_table" => "priv_trigger_onstateenter",
+			"db_key_field" => "id",
+			"db_finalclass_field" => "",
+			"display_template" => "",
+		);
+		MetaModel::Init_Params($aParams);
+		MetaModel::Init_InheritAttributes();
+
+		MetaModel::Init_InheritFilters();
+
+		// Display lists
+		MetaModel::Init_SetZListItems('details', array('description', 'target_class', 'state')); // Attributes to be displayed for the complete details
+		MetaModel::Init_SetZListItems('list', array('target_class', 'state')); // Attributes to be displayed for a list
+		// Search criteria
+//		MetaModel::Init_SetZListItems('standard_search', array('name')); // Criteria of the std search form
+//		MetaModel::Init_SetZListItems('advanced_search', array('name')); // Criteria of the advanced search form
+	}
+}
+
+class TriggerOnStateLeave extends TriggerOnStateChange
+{
+	public static function Init()
+	{
+		$aParams = array
+		(
+			"category" => "core/cmdb",
+			"name" => "Trigger on object leaving a state",
+			"description" => "Trigger on object state change - leaving",
+			"key_type" => "autoincrement",
+			"key_label" => "",
+			"name_attcode" => "",
+			"state_attcode" => "",
+			"reconc_keys" => array(),
+			"db_table" => "priv_trigger_onstateleave",
+			"db_key_field" => "id",
+			"db_finalclass_field" => "",
+			"display_template" => "",
+		);
+		MetaModel::Init_Params($aParams);
+		MetaModel::Init_InheritAttributes();
+
+		MetaModel::Init_InheritFilters();
+
+		// Display lists
+		MetaModel::Init_SetZListItems('details', array('description', 'target_class', 'state')); // Attributes to be displayed for the complete details
+		MetaModel::Init_SetZListItems('list', array('target_class', 'state')); // Attributes to be displayed for a list
+		// Search criteria
+//		MetaModel::Init_SetZListItems('standard_search', array('')); // Criteria of the std search form
+//		MetaModel::Init_SetZListItems('advanced_search', array('')); // Criteria of the advanced search form
+	}
+}
+
+class lnkTriggerAction extends cmdbAbstractObject
+{
+	public static function Init()
+	{
+		$aParams = array
+		(
+			"category" => "core/cmdb",
+			"name" => "Actions-Trigger",
+			"description" => "Link between a trigger and an action",
+			"key_type" => "autoincrement",
+			"key_label" => "Link ID",
+			"name_attcode" => "",
+			"state_attcode" => "",
+			"reconc_keys" => array(""),
+			"db_table" => "priv_link_action_trigger",
+			"db_key_field" => "link_id",
+			"db_finalclass_field" => "",
+			"display_template" => "",
+		);
+		MetaModel::Init_Params($aParams);
+		MetaModel::Init_AddAttribute(new AttributeExternalKey("action_id", array("targetclass"=>"Action", "jointype"=> '', "label"=>"Action", "description"=>"The action to be executed", "allowed_values"=>null, "sql"=>"action_id", "is_null_allowed"=>false, "on_target_delete"=>DEL_AUTO, "depends_on"=>array())));
+		MetaModel::Init_AddAttribute(new AttributeExternalField("action_name", array("label"=>"Action Name", "description"=>"Name of the action", "allowed_values"=>null, "extkey_attcode"=> 'action_id', "target_attcode"=>"name")));
+		MetaModel::Init_AddAttribute(new AttributeExternalKey("trigger_id", array("targetclass"=>"Trigger", "jointype"=> '', "label"=>"Trigger", "description"=>"Trigger", "allowed_values"=>null, "sql"=>"trigger_id", "is_null_allowed"=>false, "on_target_delete"=>DEL_AUTO, "depends_on"=>array())));
+		MetaModel::Init_AddAttribute(new AttributeInteger("order", array("label"=>"Order", "description"=>"Actions execution order", "allowed_values"=>null, "sql"=>"order", "default_value"=>0, "is_null_allowed"=>true, "depends_on"=>array())));
+
+		MetaModel::Init_AddFilterFromAttribute("action_id");
+		MetaModel::Init_AddFilterFromAttribute("trigger_id");
+		
+		// Display lists
+		MetaModel::Init_SetZListItems('details', array('action_id', 'trigger_id', 'order')); // Attributes to be displayed for a list
+		MetaModel::Init_SetZListItems('list', array('action_id', 'trigger_id', 'order')); // Attributes to be displayed for a list
+		// Search criteria
+		MetaModel::Init_SetZListItems('standard_search', array('action_id', 'trigger_id', 'order')); // Criteria of the std search form
+		MetaModel::Init_SetZListItems('advanced_search', array('action_id', 'trigger_id', 'order')); // Criteria of the advanced search form
+	}
+}
+?>