From a1a9f5a79e77ed21f35950627ebcfa9298dfe29c Mon Sep 17 00:00:00 2001 From: John Kirk Date: Fri, 14 Oct 2016 18:45:25 +0100 Subject: [PATCH] Further work to pull request 9257 CRM-16243 - Extension API - Automatically enable dependencies Also adjusted interface to show the needed dependencies. --- CRM/Admin/Form/Extensions.php | 4 ++-- CRM/Extension/Manager.php | 2 +- templates/CRM/Admin/Page/ExtensionDetails.tpl | 14 ++++++++++++++ templates/CRM/Admin/Page/Extensions/Main.tpl | 2 +- 4 files changed, 18 insertions(+), 4 deletions(-) diff --git a/CRM/Admin/Form/Extensions.php b/CRM/Admin/Form/Extensions.php index 7f273cb1632f..d17f6e2f9474 100644 --- a/CRM/Admin/Form/Extensions.php +++ b/CRM/Admin/Form/Extensions.php @@ -180,12 +180,12 @@ public function postProcess() { } if ($this->_action & CRM_Core_Action::ADD) { - CRM_Extension_System::singleton()->getManager()->install(array($this->_key)); + civicrm_api3('Extension', 'install', array('keys' => $this->_key)); CRM_Core_Session::setStatus("", ts('Extension Installed'), "success"); } if ($this->_action & CRM_Core_Action::ENABLE) { - CRM_Extension_System::singleton()->getManager()->enable(array($this->_key)); + civicrm_api3('Extension', 'enable', array('keys' => $this->_key)); CRM_Core_Session::setStatus("", ts('Extension Enabled'), "success"); } diff --git a/CRM/Extension/Manager.php b/CRM/Extension/Manager.php index bdddca921114..013c9aa9a03b 100644 --- a/CRM/Extension/Manager.php +++ b/CRM/Extension/Manager.php @@ -610,7 +610,7 @@ public function findInstallRequirements($keys) { $info = @$infos[$key]; if ($this->getStatus($key) === self::STATUS_INSTALLED) { - // skip + $sorter->add($key, $info->requires); } elseif ($info && $info->requires) { $sorter->add($key, $info->requires); diff --git a/templates/CRM/Admin/Page/ExtensionDetails.tpl b/templates/CRM/Admin/Page/ExtensionDetails.tpl index 3b883fd756da..56ca683c5a97 100644 --- a/templates/CRM/Admin/Page/ExtensionDetails.tpl +++ b/templates/CRM/Admin/Page/ExtensionDetails.tpl @@ -31,6 +31,20 @@ {ts}Development stage{/ts}{$extension.develStage} + + {ts}Requires{/ts} + + {foreach from=$extension.requires item=ext} + {if array_key_exists($ext, $localExtensionRows)} + {$localExtensionRows.$ext.name} + {elseif array_key_exists($ext, $remoteExtensionRows)} + {$remoteExtensionRows.$ext.name} (not downloaded) + {else} + {$ext} (not installed locally or available remotely) + {/if} + {/foreach} + + {ts}Compatible with{/ts} diff --git a/templates/CRM/Admin/Page/Extensions/Main.tpl b/templates/CRM/Admin/Page/Extensions/Main.tpl index dfc01d59787b..34d38092bc84 100644 --- a/templates/CRM/Admin/Page/Extensions/Main.tpl +++ b/templates/CRM/Admin/Page/Extensions/Main.tpl @@ -34,7 +34,7 @@ Depends: CRM/common/enableDisableApi.tpl and CRM/common/jsortable.tpl - {include file="CRM/Admin/Page/ExtensionDetails.tpl" extension=$row} + {include file="CRM/Admin/Page/ExtensionDetails.tpl" extension=$row localExtensionRows=$localExtensionRows remoteExtensionRows=$remoteExtensionRows}