Merge remote-tracking branch 'upstream/4.4' into 4.4-master-2013-12-04-16-27-01
[civicrm-core.git] / CRM / Admin / Page / Extensions.php
index 9b52e7bbb5ab5de48649eedd3bc67b9384311d89..134f82aecf662e6efb545d86e6a819dfb0d4ca7a 100644 (file)
@@ -1,7 +1,7 @@
 <?php
 /*
  +--------------------------------------------------------------------+
- | CiviCRM version 4.3                                                |
+ | CiviCRM version 4.4                                                |
  +--------------------------------------------------------------------+
  | Copyright CiviCRM LLC (c) 2004-2013                                |
  +--------------------------------------------------------------------+
@@ -58,7 +58,7 @@ class CRM_Admin_Page_Extensions extends CRM_Core_Page_Basic {
     CRM_Utils_System::setTitle(ts('CiviCRM Extensions'));
         $destination = CRM_Utils_System::url( 'civicrm/admin/extensions',
                                               'reset=1' );
-        
+
         $destination = urlencode( $destination );
         $this->assign( 'destination', $destination );
   }
@@ -164,9 +164,7 @@ class CRM_Admin_Page_Extensions extends CRM_Core_Page_Basic {
       try {
         $obj = $mapper->keyToInfo($key);
       } catch (CRM_Extension_Exception $ex) {
-        CRM_Core_Session::setStatus(ts('Failed to read extension (%1). Please refresh the extension list.', array(
-          1 => $key,
-        )));
+        CRM_Core_Session::setStatus(ts('Failed to read extension (%1). Please refresh the extension list.', array(1 => $key)));
         continue;
       }
 
@@ -199,8 +197,15 @@ class CRM_Admin_Page_Extensions extends CRM_Core_Page_Basic {
         array(
           'id' => $row['id'],
           'key' => $obj->key,
-        )
+        ),
+        ts('more'),
+        FALSE,
+        'extension.local.action',
+        'Extension',
+        $row['id']
       );
+      // Key would be better to send, but it's not an integer.  Moreover, sending the
+      // values to hook_civicrm_links means that you can still get at the key
 
       $localExtensionRows[$row['id']] = $row;
     }
@@ -217,8 +222,18 @@ class CRM_Admin_Page_Extensions extends CRM_Core_Page_Basic {
         array(
           'id' => $row['id'],
           'key' => $row['key'],
-        )
+        ),
+        ts('more'),
+        FALSE,
+        'extension.remote.action',
+        'Extension',
+        $row['id']
       );
+      if (isset($localExtensionRows[$info->key])) {
+        if (version_compare($localExtensionRows[$info->key]['version'], $info->version, '<')) {
+          $row['is_upgradeable'] = TRUE;
+        }
+      }
       $remoteExtensionRows[$row['id']] = $row;
     }
     $this->assign('remoteExtensionRows', $remoteExtensionRows);