From 1fe97a01ef81abb9c4c6eb866e0ade3f391010ee Mon Sep 17 00:00:00 2001 From: Coleman Watts Date: Fri, 20 Dec 2013 15:41:41 -0800 Subject: [PATCH] CRM-14015 CRM-14023 - Extend new enable/disable to acl page (and add acl api) --- CRM/ACL/BAO/ACL.php | 1 + CRM/ACL/Page/ACL.php | 6 +- api/v3/Acl.php | 77 +++++++++++++++++++++++ api/v3/utils.php | 6 +- js/crm.livePage.js | 2 +- js/jquery/jquery.crmeditable.js | 32 +--------- templates/CRM/ACL/Page/ACL.tpl | 8 +-- templates/CRM/common/enableDisableApi.tpl | 15 +++-- 8 files changed, 99 insertions(+), 48 deletions(-) create mode 100644 api/v3/Acl.php diff --git a/CRM/ACL/BAO/ACL.php b/CRM/ACL/BAO/ACL.php index ea17556c6b..6c19cc3d8f 100644 --- a/CRM/ACL/BAO/ACL.php +++ b/CRM/ACL/BAO/ACL.php @@ -648,6 +648,7 @@ SELECT $acl.* $dao = new CRM_ACL_DAO_ACL(); $dao->copyValues($params); $dao->save(); + return $dao; } static function retrieve(&$params, &$defaults) { diff --git a/CRM/ACL/Page/ACL.php b/CRM/ACL/Page/ACL.php index aa19749660..9ac0c75ac7 100644 --- a/CRM/ACL/Page/ACL.php +++ b/CRM/ACL/Page/ACL.php @@ -75,14 +75,12 @@ class CRM_ACL_Page_ACL extends CRM_Core_Page_Basic { ), CRM_Core_Action::DISABLE => array( 'name' => ts('Disable'), - 'extra' => 'onclick = "enableDisable( %%id%%,\'' . 'CRM_ACL_BAO_ACL' . '\',\'' . 'enable-disable' . '\' );"', - 'ref' => 'disable-action', + 'ref' => 'crm-enable-disable', 'title' => ts('Disable ACL'), ), CRM_Core_Action::ENABLE => array( 'name' => ts('Enable'), - 'extra' => 'onclick = "enableDisable( %%id%%,\'' . 'CRM_ACL_BAO_ACL' . '\',\'' . 'disable-enable' . '\' );"', - 'ref' => 'enable-action', + 'ref' => 'crm-enable-disable', 'title' => ts('Enable ACL'), ), CRM_Core_Action::DELETE => array( diff --git a/api/v3/Acl.php b/api/v3/Acl.php new file mode 100644 index 0000000000..93ac3c0dc9 --- /dev/null +++ b/api/v3/Acl.php @@ -0,0 +1,77 @@ + {if $rows} -
{strip} {* handle enable/disable actions*} - {include file="CRM/common/enableDisable.tpl"} + {include file="CRM/common/enableDisableApi.tpl"} {include file="CRM/common/jsortable.tpl"} @@ -59,12 +58,12 @@ {foreach from=$rows item=row key=aclID} - + - + @@ -79,6 +78,7 @@ {/if} +{include file="CRM/common/crmeditable.tpl"} {elseif $action ne 1 and $action ne 2 and $action ne 8}
{ts}status{/ts} diff --git a/templates/CRM/common/enableDisableApi.tpl b/templates/CRM/common/enableDisableApi.tpl index 4f98b8b82b..36ef55d950 100644 --- a/templates/CRM/common/enableDisableApi.tpl +++ b/templates/CRM/common/enableDisableApi.tpl @@ -27,18 +27,21 @@ {literal}
{$row.entity} {$row.operation} {$row.object_name} {$row.object}{$row.name}{$row.name} {if $row.is_active eq 1} {ts}Yes{/ts} {else} {ts}No{/ts} {/if} {$row.action|replace:'xx':$aclID}