X-Git-Url: https://vcs.fsf.org/?a=blobdiff_plain;f=CRM%2FAdmin%2FForm%2FExtensions.php;h=1d55aeb9ac3da5bc6b261164739452476682b5a5;hb=0d5147553408267419ef1e8fbe3cfecb83dff7ba;hp=50009a888dd60dccfba0ab0a5b70a4c8891a0d97;hpb=42bf93368ea81b2fa70fab038f3c884755e1ab88;p=civicrm-core.git diff --git a/CRM/Admin/Form/Extensions.php b/CRM/Admin/Form/Extensions.php index 50009a888d..1d55aeb9ac 100644 --- a/CRM/Admin/Form/Extensions.php +++ b/CRM/Admin/Form/Extensions.php @@ -1,7 +1,7 @@ assign('id', $this->_id); $this->assign('key', $this->_key); - switch ($this->_action) { case CRM_Core_Action::ADD: case CRM_Core_Action::DELETE: @@ -70,7 +68,7 @@ class CRM_Admin_Form_Extensions extends CRM_Admin_Form { break; case CRM_Core_Action::UPDATE: - if (! CRM_Extension_System::singleton()->getBrowser()->isEnabled()) { + if (!CRM_Extension_System::singleton()->getBrowser()->isEnabled()) { CRM_Core_Error::fatal(ts('The system administrator has disabled this feature.')); } $info = CRM_Extension_System::singleton()->getBrowser()->getExtension($this->_key); @@ -85,50 +83,52 @@ class CRM_Admin_Form_Extensions extends CRM_Admin_Form { } /** - * This function sets the default values for the form. + * Set default values for the form. * the default values are retrieved from the database * - * @access public * * @return void */ - function setDefaultValues() { + public function setDefaultValues() { $defaults = array(); return $defaults; } /** - * Function to build the form + * Build the form object * * @return void - * @access public */ public function buildQuickForm() { + $info = CRM_Extension_System::singleton()->getMapper()->keyToInfo($this->_key); + $extInfo = CRM_Admin_Page_Extensions::createExtendedInfo($info); + $extName = $extInfo['name']; + switch ($this->_action) { case CRM_Core_Action::ADD: $buttonName = ts('Install'); - $title = ts('Install Extension'); + $title = ts('Install ' . $extName . '?'); break; case CRM_Core_Action::UPDATE: $buttonName = ts('Download and Install'); - $title = ts('Download and Install Extension'); + $title = ts('Download and Install ' . $extName . '?'); break; case CRM_Core_Action::DELETE: $buttonName = ts('Uninstall'); - $title = ts('Uninstall Extension'); + $title = ts('Uninstall ' . $extName . '?'); break; case CRM_Core_Action::ENABLE: $buttonName = ts('Enable'); - $title = ts('Enable Extension'); + $title = ts('Enable ' . $extName . '?'); break; case CRM_Core_Action::DISABLE: $buttonName = ts('Disable'); - $title = ts('Disable Extension'); + $title = ts('Disable ' . $extName . '?'); break; } @@ -148,26 +148,27 @@ class CRM_Admin_Form_Extensions extends CRM_Admin_Form { } /** - * global form rule + * Global form rule * - * @param array $fields the input form values - * @param array $files the uploaded files if any - * @param array $self this object. + * @param array $fields + * The input form values. + * @param array $files + * The uploaded files if any. + * @param array $self + * This object. * - * @return true if no errors, else an array of errors - * @access public - * @static + * @return bool|array + * true if no errors, else an array of errors */ - static function formRule($fields, $files, $self) { + public static function formRule($fields, $files, $self) { $errors = array(); return empty($errors) ? TRUE : $errors; } /** - * Function to process the form + * Process the form submission * - * @access public * * @return void */ @@ -178,7 +179,8 @@ class CRM_Admin_Form_Extensions extends CRM_Admin_Form { try { CRM_Extension_System::singleton()->getManager()->uninstall(array($this->_key)); CRM_Core_Session::setStatus("", ts('Extension Uninstalled'), "success"); - } catch (CRM_Extension_Exception_DependencyException $e) { + } + catch (CRM_Extension_Exception_DependencyException $e) { // currently only thrown for payment-processor dependencies CRM_Core_Session::setStatus(ts('Cannot uninstall this extension - there is at least one payment processor using the payment processor type provided by it.'), ts('Uninstall Error'), 'error'); } @@ -204,9 +206,10 @@ class CRM_Admin_Form_Extensions extends CRM_Admin_Form { 'version' => 3, 'key' => $this->_key, )); - if (! CRM_Utils_Array::value('is_error', $result, FALSE)) { + if (!CRM_Utils_Array::value('is_error', $result, FALSE)) { CRM_Core_Session::setStatus("", ts('Extension Upgraded'), "success"); - } else { + } + else { CRM_Core_Session::setStatus($result['error_message'], ts('Extension Upgrade Failed'), "error"); } } @@ -218,5 +221,5 @@ class CRM_Admin_Form_Extensions extends CRM_Admin_Form { ) ); } -} +}