diff --git a/CRM/ACL/BAO/EntityRole.php b/CRM/ACL/BAO/EntityRole.php index cb041cee78fcd6e06ad1cce732e724a2c1294b8a..173ba7d7eda807b57362e50524cb722b04aad098 100644 --- a/CRM/ACL/BAO/EntityRole.php +++ b/CRM/ACL/BAO/EntityRole.php @@ -52,8 +52,8 @@ class CRM_ACL_BAO_EntityRole extends CRM_ACL_DAO_EntityRole { static function create(&$params) { $dao = new CRM_ACL_DAO_EntityRole(); $dao->copyValues($params); - $dao->save(); + return $dao; } static function retrieve(&$params, &$defaults) { diff --git a/CRM/ACL/Page/EntityRole.php b/CRM/ACL/Page/EntityRole.php index c3c5456e21e3566b78303184e3efb7fac8b70074..d91c6a19b452967c82eaae19c343214bc93411b2 100644 --- a/CRM/ACL/Page/EntityRole.php +++ b/CRM/ACL/Page/EntityRole.php @@ -75,14 +75,12 @@ class CRM_ACL_Page_EntityRole extends CRM_Core_Page_Basic { ), CRM_Core_Action::DISABLE => array( 'name' => ts('Disable'), - 'extra' => 'onclick = "enableDisable( %%id%%,\'' . 'CRM_ACL_BAO_EntityRole' . '\',\'' . 'enable-disable' . '\' );"', - 'ref' => 'disable-action', + 'ref' => 'crm-enable-disable', 'title' => ts('Disable ACL Role Assignment'), ), CRM_Core_Action::ENABLE => array( 'name' => ts('Enable'), - 'extra' => 'onclick = "enableDisable( %%id%%,\'' . 'CRM_ACL_BAO_EntityRole' . '\',\'' . 'disable-enable' . '\' );"', - 'ref' => 'enable-action', + 'ref' => 'crm-enable-disable', 'title' => ts('Enable ACL Role Assignment'), ), CRM_Core_Action::DELETE => array( @@ -141,6 +139,7 @@ class CRM_ACL_Page_EntityRole extends CRM_Core_Page_Basic { // finally browse the acl's if ($action & CRM_Core_Action::BROWSE) { + CRM_Core_Resources::singleton()->addScriptFile('civicrm', 'js/crm.livePage.js'); $this->browse(); } diff --git a/api/v3/AclRole.php b/api/v3/AclRole.php new file mode 100644 index 0000000000000000000000000000000000000000..25d10dab9799240443279ec1b2525133628fdf14 --- /dev/null +++ b/api/v3/AclRole.php @@ -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 acl_role functions + * + * @package CiviCRM_APIv3 + * @subpackage API_acl_role + * + */ + +/** + * Save an acl_role + * + * Allowed @params array keys are: + * {@getfields acl_role_create} + * @example acl_roleCreate.php + * + * @return array of newly created acl_role property values. + * @access public + */ +function civicrm_api3_acl_role_create($params) { + return _civicrm_api3_basic_create(_civicrm_api3_get_BAO(__FUNCTION__), $params); +} + +/** + * Get an acl_role + * + * Allowed @params array keys are: + * {@getfields acl_role_get} + * @example acl_roleCreate.php + * + * @return array of retrieved acl_role property values. + * @access public + */ +function civicrm_api3_acl_role_get($params) { + return _civicrm_api3_basic_get(_civicrm_api3_get_BAO(__FUNCTION__), $params); +} + +/** + * Delete an acl_role + * + * Allowed @params array keys are: + * {@getfields acl_role_delete} + * @example acl_roleCreate.php + * + * @return array of deleted values. + * @access public + */ +function civicrm_api3_acl_role_delete($params) { + return _civicrm_api3_basic_delete(_civicrm_api3_get_BAO(__FUNCTION__), $params); +} diff --git a/api/v3/utils.php b/api/v3/utils.php index b788c167b1d00c1544d43c50bf59150d7b99fcc6..e98ddd42a320eee99d518367c599eb773a30836d 100644 --- a/api/v3/utils.php +++ b/api/v3/utils.php @@ -280,22 +280,27 @@ function _civicrm_api3_get_DAO($name) { // len ('civicrm_api3_') == 13 $name = substr($name, 13, $last - 13); } + + $name = _civicrm_api_get_camel_name($name, 3); - if (strtolower($name) == 'individual' || strtolower($name) == 'household' || strtolower($name) == 'organization') { + if ($name == 'Individual' || $name == 'Household' || $name == 'Organization') { $name = 'Contact'; } //hack to deal with incorrectly named BAO/DAO - see CRM-10859 - // several of these have been removed but am not confident mailing_recipients is // tests so have not tackled. - if($name == 'mailing_recipients' || $name == 'MailingRecipients'){ + if ($name == 'MailingRecipients') { return 'CRM_Mailing_BAO_Recipients'; } + if ($name == 'AclRole') { + return 'CRM_ACL_DAO_EntityRole'; + } // correct approach for im & acl is unclear - if (strtolower($name) == 'im' || strtolower($name) == 'acl') { + if ($name == 'Im' || $name == 'Acl') { $name = strtoupper($name); } - return CRM_Core_DAO_AllCoreTables::getFullName(_civicrm_api_get_camel_name($name, 3)); + return CRM_Core_DAO_AllCoreTables::getFullName($name); } /** diff --git a/templates/CRM/ACL/Page/EntityRole.tpl b/templates/CRM/ACL/Page/EntityRole.tpl index 41f33c69dc3faa57b5a06af86980112e253611bf..0c7ed74f8b574882dbeb20a3d902201142e2b3f8 100644 --- a/templates/CRM/ACL/Page/EntityRole.tpl +++ b/templates/CRM/ACL/Page/EntityRole.tpl @@ -41,7 +41,7 @@ <div id="ltype"> {strip} {* handle enable/disable actions*} - {include file="CRM/common/enableDisable.tpl"} + {include file="CRM/common/enableDisableApi.tpl"} {include file="CRM/common/jsortable.tpl"} <table id="options" class="display"> <thead> @@ -54,7 +54,7 @@ </thead> <tbody> {foreach from=$rows item=row} - <tr id="row_{$row.id}"class="{cycle values="odd-row,even-row"} {$row.class} crm-acl_entity_role {if NOT $row.is_active} disabled{/if}"> + <tr id="acl_role-{$row.id}" class="{cycle values="odd-row,even-row"} {$row.class} crm-acl_entity_role crm-entity {if NOT $row.is_active} disabled{/if}"> <td class="crm-acl_entity_role-acl_role">{$row.acl_role}</td> <td class="crm-acl_entity_role-entity">{$row.entity}</td> <td class="crm-acl_entity_role-is_active" id="row_{$row.id}_status">{if $row.is_active eq 1} {ts}Yes{/ts} {else} {ts}No{/ts} {/if}</td>