Prechádzať zdrojové kódy

Fixed bug with menu and with notices of installed modules

Stephen Ficklin 10 rokov pred
rodič
commit
d413d22c20

+ 8 - 3
tripal_core/includes/tripal_core.extensions.inc

@@ -357,7 +357,8 @@ function tripal_core_extension_form_add_extensions(&$form, $form_state, $extensi
           }
           break;
         case 'Extension Module':
-          if (module_exists($extension[$namespace]['module_name'])) {
+          if (array_key_exists('drupal_project', $extension[$namespace]) and
+              module_exists($extension[$namespace]['drupal_project'])) {
             $is_installed = '<li>A module with this name is already installed.</li>';
           }
           break;
@@ -401,11 +402,14 @@ function tripal_core_extension_form_add_extensions(&$form, $form_state, $extensi
         '#value' => $extension,
       );
 
+      $notices = '';
+      if ($is_installed) {
+        $notices = '<div class="messages status"><ul>' . $is_installed . '</ul></div>';
+      }
       $warnings = '';
-      if ($incompatible or $is_installed  or $project or $other) {
+      if ($incompatible or $project or $other) {
         $warnings = '<div class="messages warning"><ul>' .
           $incompatible . ' ' .
-          $is_installed . ' ' .
           $project .  ' ' .
           $other . '</ul></div>';
       }
@@ -423,6 +427,7 @@ function tripal_core_extension_form_add_extensions(&$form, $form_state, $extensi
         "<strong>Tripal compatible versions: </strong>" . $extension[$namespace]['tripal_version'] . "</br>" .
         $home_page .
         "<strong>tripal.info Page: </strong>" . l($extension['link'], $extension['link']) . "</br>" .
+        $notices .
         $warnings .
         "<p>" . $extension['description'] . "</p>",
       );

+ 6 - 5
tripal_core/tripal_core.module

@@ -163,21 +163,22 @@ function tripal_core_menu() {
     'weight' => -4
   );
   $items['admin/tripal/extension'] = array(
-    'title' => 'Available Extensions',
+    'title' => 'Extensions',
     'description' => t('Configuration for Tripal extensions.'),
     'access arguments' => array('administer tripal'),
     'type' => MENU_NORMAL_ITEM,
     'weight' => 0
   );
-  $items['admin/tripal/extension/available'] = array(
-    'title' => 'Available Extensions',
-    'description' => 'Queries the tripal.info site to find extensions that may be compatible with this site.',
+  $items['admin/tripal/extension/import'] = array(
+    'title' => 'Import Extensions',
+    'description' => 'Provides a list of the available extensions that are registered at the tripal.info site. From this page you can easily import or install extensions to your site.',
     'page callback' => 'drupal_get_form',
     'page arguments' => array('tripal_core_extensions_form'),
     'access arguments' => array('administer tripal'),
-    'type' => MENU_LOCAL_TASK,
+    'type' => MENU_NORMAL_ITEM,
     'file' =>  'includes/tripal_core.extensions.inc',
     'file path' => drupal_get_path('module', 'tripal_core'),
+    'weight' => -100,
   );
 
   // Tripal Setup