CRM-14023 CRM-14015 - Add api for mailing component
authorColeman Watts <coleman@civicrm.org>
Tue, 24 Dec 2013 05:06:29 +0000 (21:06 -0800)
committerColeman Watts <coleman@civicrm.org>
Mon, 6 Jan 2014 19:10:41 +0000 (11:10 -0800)
api/v3/MailingComponent.php [new file with mode: 0644]
api/v3/utils.php
templates/CRM/Mailing/Page/Component.tpl

diff --git a/api/v3/MailingComponent.php b/api/v3/MailingComponent.php
new file mode 100644 (file)
index 0000000..181f4ae
--- /dev/null
@@ -0,0 +1,77 @@
+<?php
+
+/*
+ +--------------------------------------------------------------------+
+ | CiviCRM version 4.4                                                |
+ +--------------------------------------------------------------------+
+ | Copyright CiviCRM LLC (c) 2004-2013                                |
+ +--------------------------------------------------------------------+
+ | This file is a part of CiviCRM.                                    |
+ |                                                                    |
+ | CiviCRM is free software; you can copy, modify, and distribute it  |
+ | under the terms of the GNU Affero General Public License           |
+ | Version 3, 19 November 2007 and the CiviCRM Licensing Exception.   |
+ |                                                                    |
+ | CiviCRM is distributed in the hope that it will be useful, but     |
+ | WITHOUT ANY WARRANTY; without even the implied warranty of         |
+ | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.               |
+ | See the GNU Affero General Public License for more details.        |
+ |                                                                    |
+ | You should have received a copy of the GNU Affero General Public   |
+ | License and the CiviCRM Licensing Exception along                  |
+ | with this program; if not, contact CiviCRM LLC                     |
+ | at info[AT]civicrm[DOT]org. If you have questions about the        |
+ | GNU Affero General Public License or the licensing of CiviCRM,     |
+ | see the CiviCRM license FAQ at http://civicrm.org/licensing        |
+ +--------------------------------------------------------------------+
+*/
+
+/**
+ * File for the CiviCRM APIv3 mailing_component functions
+ *
+ * @package CiviCRM_APIv3
+ * @subpackage API_mailing_component
+ *
+ */
+
+/**
+ * Save a mailing_component
+ *
+ * Allowed @params array keys are:
+ * {@getfields mailing_component_create}
+ * @example mailing_componentCreate.php
+ *
+ * @return array of newly created mailing_component property values.
+ * @access public
+ */
+function civicrm_api3_mailing_component_create($params) {
+  return _civicrm_api3_basic_create(_civicrm_api3_get_BAO(__FUNCTION__), $params);
+}
+
+/**
+ * Get a mailing_component
+ *
+ * Allowed @params array keys are:
+ * {@getfields mailing_component_get}
+ * @example mailing_componentCreate.php
+ *
+ * @return array of retrieved mailing_component property values.
+ * @access public
+ */
+function civicrm_api3_mailing_component_get($params) {
+  return _civicrm_api3_basic_get(_civicrm_api3_get_BAO(__FUNCTION__), $params);
+}
+
+/**
+ * Delete a mailing_component
+ *
+ * Allowed @params array keys are:
+ * {@getfields mailing_component_delete}
+ * @example mailing_componentCreate.php
+ *
+ * @return array of deleted values.
+ * @access public
+ */
+function civicrm_api3_mailing_component_delete($params) {
+  return _civicrm_api3_basic_delete(_civicrm_api3_get_BAO(__FUNCTION__), $params);
+}
index d69abeefdd9b3370768f806e7d62782047361814..4db65b24b7ae16726559528daf4e0268ecb23f9c 100644 (file)
@@ -294,6 +294,10 @@ function _civicrm_api3_get_DAO($name) {
   if ($name == 'MailingRecipients') {
     return 'CRM_Mailing_DAO_Recipients';
   }
+  // FIXME: DAO should be renamed CRM_Mailing_DAO_MailingComponent
+  if ($name == 'MailingComponent') {
+    return 'CRM_Mailing_DAO_Component';
+  }
   // FIXME: DAO should be renamed CRM_ACL_DAO_AclRole
   if ($name == 'AclRole') {
     return 'CRM_ACL_DAO_EntityRole';
index 980e84b4c3e73fb4b26b6110dd65edd3e5729d7d..6df09388cfb8b361bd01b9a169e6802f3cbeb26d 100644 (file)
@@ -46,8 +46,8 @@
         <th></th>
         </thead>
        {foreach from=$rows item=row}
-         <tr id="row_{$row.id}" class="{cycle values="odd-row,even-row"} {$row.class}{if NOT $row.is_active} disabled{/if}">
-           <td>{$row.name}</td>
+         <tr id="mailing_component-{$row.id}" class="crm-entity {cycle values="odd-row,even-row"} {$row.class}{if NOT $row.is_active} disabled{/if}">
+           <td class="crm-editable" data-field="name">{$row.name}</td>
            <td>{$row.component_type}</td>
            <td>{$row.subject}</td>
            <td>{$row.body_text}</td>