? module_filter-nid.patch
? module_filter.theme.inc
Index: module_filter.admin.inc
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/module_filter/Attic/module_filter.admin.inc,v
retrieving revision 1.1.2.1
diff -u -p -r1.1.2.1 module_filter.admin.inc
--- module_filter.admin.inc	7 Apr 2010 20:55:32 -0000	1.1.2.1
+++ module_filter.admin.inc	25 Jun 2010 20:10:13 -0000
@@ -1,9 +1,32 @@
 <?php
 // $Id: module_filter.admin.inc,v 1.1.2.1 2010/04/07 20:55:32 greenskin Exp $
 
-/*******************************************************************************
+/**
+ * @file
  * Callback Functions, Forms, and Tables
- ******************************************************************************/
+ */
+
+/**
+ * Menu page callback function
+ */
+function module_filter_autocomplete($string) {
+  $files = module_rebuild_cache();
+  $matches = array();
+  $count = 1;
+  foreach (module_rebuild_cache() as $id => $module) {
+    if ($count > 10) {
+      break;
+    }
+
+    $name = $module->info['name'];
+    if (ereg(strtolower($string), strtolower($name)) && strtolower($string) != strtolower($name)) {
+      $matches[$name] = $name;
+      $count++;
+    }
+  }
+  print drupal_to_js($matches);
+  exit();
+}
 
 /**
  * Settings form for module filter.
Index: module_filter.install
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/module_filter/Attic/module_filter.install,v
retrieving revision 1.1.2.2
diff -u -p -r1.1.2.2 module_filter.install
--- module_filter.install	7 Apr 2010 20:55:10 -0000	1.1.2.2
+++ module_filter.install	25 Jun 2010 20:10:13 -0000
@@ -5,9 +5,13 @@
  * Implementation of hook_uninstall().
  */
 function module_filter_uninstall() {
+  variable_del('module_filter_tabs');
   variable_del('module_filter_autocomplete');
 }
 
+/**
+ * Implementation of hook_update_N().
+ */
 function module_filter_update_6000() {
   $ret = array();
   $ret[] = array('success' => TRUE, 'query' => t('Force menu to rebuild.'));
Index: module_filter.module
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/module_filter/module_filter.module,v
retrieving revision 1.2.2.23
diff -u -p -r1.2.2.23 module_filter.module
--- module_filter.module	20 May 2010 17:59:02 -0000	1.2.2.23
+++ module_filter.module	25 Jun 2010 20:10:13 -0000
@@ -12,10 +12,6 @@
  * Code by greenSkin
  */
 
-/*******************************************************************************
- * Hook Functions (Drupal)
- ******************************************************************************/
-
 /**
  * Implementation of hook_perm().
  */
@@ -35,36 +31,43 @@ function module_filter_menu() {
     'page arguments' => array('module_filter_settings'),
     'file' => 'module_filter.admin.inc'
   );
-  $items['module/autocomplete'] = array(
+
+  $items['module_filter/autocomplete'] = array(
     'access arguments' => array('administer site configuration'),
     'page callback' => 'module_filter_autocomplete',
-    'type' => MENU_CALLBACK
+    'type' => MENU_CALLBACK,
+    'file' => 'module_filter.admin.inc'
   );
   return $items;
 }
 
 /**
- * Implementation of hook_form_alter().
+ * Implementation of hook_form_FORM_ID_alter().
  */
-function module_filter_form_alter(&$form, $form_state, $form_id) {
-  if ($form_id == 'system_modules' && !isset($form['confirm'])) {
-    $form['module_filter'] = array('#tree' => TRUE);
-    $form['module_filter']['name'] = array(
-      '#type' => 'textfield',
-      '#title' => t('Filter list')
-    );
-    $form['module_filter']['show'] = array(
-      '#type' => 'checkboxes',
-      '#default_value' => array('enabled', 'disabled', 'required', 'unavailable'),
-      '#options' => array('enabled' => t('Enabled'), 'disabled' => t('Disabled'), 'required' => t('Required'), 'unavailable' => t('Unavailable')),
-      '#prefix' => '<div id="module-filter-show-wrapper">',
-      '#suffix' => '</div>'
-    );
-    if (variable_get('module_filter_autocomplete', 0)) {
-      $form['module_filter']['#autocomplete_path'] = 'module/autocomplete';
-    }
-    $form['#theme'] = 'module_filter_system_modules';
+function module_filter_form_system_modules_alter(&$form, &$form_state) {
+  if (isset($form['confirm'])) {
+    return;
+  }
+
+  $form['module_filter'] = array('#tree' => TRUE);
+  $form['module_filter']['name'] = array(
+    '#type' => 'textfield',
+    '#title' => t('Filter list')
+  );
+
+  if (variable_get('module_filter_autocomplete', 0)) {
+    $form['module_filter']['name']['#autocomplete_path'] = 'module_filter/autocomplete';
   }
+
+  $form['module_filter']['show'] = array(
+    '#type' => 'checkboxes',
+    '#default_value' => array('enabled', 'disabled', 'required', 'unavailable'),
+    '#options' => array('enabled' => t('Enabled'), 'disabled' => t('Disabled'), 'required' => t('Required'), 'unavailable' => t('Unavailable')),
+    '#prefix' => '<div id="module-filter-show-wrapper">',
+    '#suffix' => '</div>'
+  );
+
+  $form['#theme'] = 'module_filter_system_modules';
 }
 
 /**
@@ -73,165 +76,13 @@ function module_filter_form_alter(&$form
 function module_filter_theme() {
   return array(
     'module_filter_system_modules' => array(
-      'arguments' => array('form' => NULL)
+      'arguments' => array('form' => NULL),
+      'file' => 'module_filter.theme.inc',
     ),
+
     'module_filter_system_modules_tabs' => array(
-      'arguments' => array('form' => NULL)
+      'arguments' => array('form' => NULL),
+      'file' => 'module_filter.theme.inc',
     )
   );
 }
-
-/*******************************************************************************
- * Callback Functions, Forms, and Tables
- ******************************************************************************/
-
-function module_filter_autocomplete($string) {
-  $files = module_rebuild_cache();
-  $matches = array();
-  $count = 1;
-  foreach (module_rebuild_cache() as $id => $module) {
-    if ($count > 10) {
-      break;
-    }
-
-    $name = $module->info['name'];
-    if (ereg(strtolower($string), strtolower($name)) && strtolower($string) != strtolower($name)) {
-      $matches[$name] = $name;
-      $count++;
-    }
-  }
-  print drupal_to_js($matches);
-  exit();
-}
-
-/*******************************************************************************
- * Module and Helper Functions
- ******************************************************************************/
-
-
-
-/*******************************************************************************
- * Theme Functions
- ******************************************************************************/
-
-function theme_module_filter_system_modules($form) {
-  if (isset($form['confirm'])) {
-    return drupal_render($form);
-  }
-
-  drupal_add_css(drupal_get_path('module', 'module_filter') .'/css/module_filter.css');
-
-  $output = '';
-  if (variable_get('module_filter_tabs', 1)) {
-    drupal_add_css(drupal_get_path('module', 'module_filter') .'/css/module_filter_tab.css');
-    drupal_add_js(drupal_get_path('module', 'module_filter') .'/js/module_filter_tab.js');
-    $form['module_filter']['#size'] = 45;
-    $output .= theme('module_filter_system_modules_tabs', $form);
-  }
-  else {
-    drupal_add_js(drupal_get_path('module', 'module_filter') .'/js/module_filter.js');
-    $form['module_filter']['#prefix'] = '<div id="module-filter-wrapper" style="display: none;">';
-    $form['module_filter']['#suffix'] = '</div>';
-    $output = drupal_render($form['module_filter']);
-    $form['#theme'] = 'system_modules';
-    $output .= theme('system_modules', $form);
-  }
-  return $output;
-}
-
-/**
- * Theme callback for the modules form.
- *
- * @param $form
- *   An associative array containing the structure of the form.
- * @ingroup themeable
- */
-function theme_module_filter_system_modules_tabs($form) {
-  if (isset($form['confirm'])) {
-    return drupal_render($form);
-  }
-
-  // Individual table headers.
-  $header = array();
-  $header[] = array('data' => t('Enabled'), 'class' => 'checkbox');
-  if (module_exists('throttle')) {
-    $header[] = array('data' => t('Throttle'), 'class' => 'checkbox');
-  }
-  $header[] = t('Name');
-  $header[] = t('Version');
-  $header[] = t('Description');
-
-  // Pull package information from module list and start grouping modules.
-  $modules = $form['validation_modules']['#value'];
-  foreach ($modules as $module) {
-    if (!isset($module->info['package']) || !$module->info['package']) {
-      $module->info['package'] = t('Other');
-    }
-    $packages[$module->info['package']][$module->name] = $module->info;
-  }
-  ksort($packages);
-
-  // Display packages.
-  $rows = array();
-  $tabs = array('all' => '<li class="active"><a id="all-tab" class="project-tab" href="#all">'. t('All') .'</a></li>');
-  foreach ($packages as $package => $modules) {
-    $id = strtolower($package);
-    // $id = preg_replace('/[^a-z ]\//', '', $id);
-    $id = preg_replace('/([^a-z])([\/(  )])*/', '-', $id);
-    foreach ($modules as $key => $module) {
-      $row = array();
-      $description = drupal_render($form['description'][$key]);
-      if (isset($form['status']['#incompatible_modules_core'][$key])) {
-        unset($form['status'][$key]);
-        $status = theme('image', 'misc/watchdog-error.png', t('incompatible'), t('Incompatible with this version of Drupal core'));
-        $description .= '<div class="incompatible">'. t('This version is incompatible with the !core_version version of Drupal core.', array('!core_version' => VERSION)) .'</div>';
-      }
-      elseif (isset($form['status']['#incompatible_modules_php'][$key])) {
-        unset($form['status'][$key]);
-        $status = theme('image', 'misc/watchdog-error.png', t('incompatible'), t('Incompatible with this version of PHP'));
-        $php_required = $form['status']['#incompatible_modules_php'][$key];
-        if (substr_count($php_required, '.') < 2) {
-          $php_required .= '.*';
-        }
-        $description .= '<div class="incompatible">'. t('This module requires PHP version @php_required and is incompatible with PHP version !php_version.', array('@php_required' => $php_required, '!php_version' => phpversion())) .'</div>';
-      }
-      else {
-        $status = drupal_render($form['status'][$key]);
-      }
-      $row[] = array('data' => $status, 'class' => 'checkbox');
-      if (module_exists('throttle')) {
-        $row[] = array('data' => drupal_render($form['throttle'][$key]), 'class' => 'checkbox');
-      }
-
-      // Add labels only when there is also a checkbox.
-      if (isset($form['status'][$key])) {
-        $row[] = '<strong><label for="'. $form['status'][$key]['#id'] .'">'. drupal_render($form['name'][$key]) .'</label></strong>';
-      }
-      else {
-        $row[] = '<strong>'. drupal_render($form['name'][$key]) .'</strong>';
-      }
-
-      $row[] = array('data' => drupal_render($form['version'][$key]), 'class' => 'version');
-      $row[] = array('data' => $description, 'class' => 'description');
-      $rows[$form['name'][$key]['#value']] = array(
-        'data' => $row,
-        'class' => $id .'-tab-content'
-      );
-    }
-    $tabs[$id] = '<li><a id="'. $id .'-tab" class="project-tab" href="#'. str_replace('-', '_', $id) .'">'. $package .'</a></li>';
-  }
-
-  ksort($rows);
-  $output = '<div id="module-filter-wrapper">'.
-  $output .= '<div id="module-filter-left">';
-  $output .= '<div id="module-filter-tabs"><ul>'. implode($tabs) .'</ul></div>';
-  $output .= '<div id="module-filter-submit">'. drupal_render($form['buttons']) .'</div></div>';
-  // $output .= '<div id="module-filter-spacer"></div>';
-  $output .= '<div id="module-filter-right"><div id="module-filter-squeeze">'. drupal_render($form['module_filter']);
-  $output .= theme('table', $header, $rows, array('id' => 'projects')) .'</div></div>';
-  $output .= '<div class="clear-block"></div>';
-  $output .= '</div>';
-
-  $output .= drupal_render($form);
-  return $output;
-}
