? Drupal6menusplit.kpf
? sites/default/settings.php
Index: /home/lgarfiel/public_html/drupal/drupal6menusplit/includes/menu.inc
===================================================================
RCS file: /cvs/drupal/drupal/includes/menu.inc,v
retrieving revision 1.166
diff -u -r1.166 menu.inc
--- includes/menu.inc	16 May 2007 13:45:16 -0000	1.166
+++ includes/menu.inc	20 May 2007 02:14:45 -0000
@@ -306,7 +306,15 @@
  */
 function menu_execute_active_handler() {
   if ($item = menu_get_item()) {
-    return $item->access ? call_user_func_array($item->page_callback, $item->page_arguments) : MENU_ACCESS_DENIED;
+    if (! $item->access) {
+      return MENU_ACCESS_DENIED;
+    }
+    else {
+      if ($item->file) {
+        include_once($item->file);
+      }
+      return call_user_func_array($item->page_callback, $item->page_arguments);
+    }
   }
   return MENU_NOT_FOUND;
 }
@@ -1060,7 +1068,17 @@
  */
 function menu_router_build() {
   db_query('DELETE FROM {menu_router}');
-  $callbacks = module_invoke_all('menu');
+  // We need to manually call each module so that we can know which module a given item came from.
+  $callbacks = array();
+  foreach (module_implements('menu') as $module) {
+    $items = call_user_func($module . '_menu');
+    if (isset($items) && is_array($items)) {
+      foreach (array_keys($items) as $path) {
+        $items[$path]['module'] = $module;
+      }
+      $callbacks = array_merge($callbacks, $items);
+    }
+  }
   // Alter the menu as defined in modules, keys are like user/%user.
   drupal_alter('menu', $callbacks);
   $menu = _menu_router_build($callbacks);
@@ -1380,6 +1398,12 @@
           if (!isset($item['page arguments']) && isset($parent['page arguments'])) {
             $item['page arguments'] = $parent['page arguments'];
           }
+          if (!isset($item['file']) && isset($parent['file'])) {
+            $item['file'] = $parent['file'];
+          }
+          if (!isset($item['file path']) && isset($parent['file path'])) {
+            $item['file path'] = $parent['file path'];
+          }
         }
       }
     }
@@ -1403,23 +1427,33 @@
       'tab_parent' => '',
       'tab_root' => $path,
       'path' => $path,
+      'file' => '',
+      'file path' => '',
+      'include file' => '',
     );
+    
+    // Calculate out the file to be included for each callback, if any.
+    if ($item['file']) {
+      $file_path = $item['file path'] ? $item['file path'] : drupal_get_path('module', $item['module']);
+      $item['include file'] = $file_path . '/' . $item['file'];
+    }
+    
     db_query("INSERT INTO {menu_router}
       (path, load_functions, to_arg_functions, access_callback,
       access_arguments, page_callback, page_arguments, fit,
       number_parts, tab_parent, tab_root,
       title, title_callback, title_arguments,
-      type, block_callback, description, position, weight)
+      type, block_callback, description, position, weight, file)
       VALUES ('%s', '%s', '%s', '%s',
       '%s', '%s', '%s', %d,
       %d, '%s', '%s',
       '%s', '%s', '%s',
-      %d, '%s', '%s', '%s', %d)",
+      %d, '%s', '%s', '%s', %d, '%s')",
       $path, $item['load_functions'], $item['to_arg_functions'], $item['access callback'],
       serialize($item['access arguments']), $item['page callback'], serialize($item['page arguments']), $item['_fit'],
       $item['_number_parts'], $item['tab_parent'], $item['tab_root'],
       $item['title'], $item['title callback'], serialize($item['title arguments']),
-      $item['type'], $item['block callback'], $item['description'], $item['position'], $item['weight']);
+      $item['type'], $item['block callback'], $item['description'], $item['position'], $item['weight'], $item['include file']);
   }
   return $menu;
 }
Index: /home/lgarfiel/public_html/drupal/drupal6menusplit/modules/node/node.module
===================================================================
RCS file: /cvs/drupal/drupal/modules/node/node.module,v
retrieving revision 1.815
diff -u -r1.815 node.module
--- modules/node/node.module	19 May 2007 13:31:51 -0000	1.815
+++ modules/node/node.module	20 May 2007 02:14:46 -0000
@@ -1135,6 +1135,8 @@
     'weight' => -10,
     'page callback' => 'system_admin_menu_block_page',
     'access arguments' => array('administer site configuration'),
+    'file' => 'system.admin.inc',
+    'file path' => drupal_get_path('module', 'system'),
   );
 
   $items['admin/content/node'] = array(
Index: /home/lgarfiel/public_html/drupal/drupal6menusplit/modules/system/system.admin.inc
===================================================================
RCS file: modules/system/system.admin.inc
diff -N modules/system/system.admin.inc
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ modules/system/system.admin.inc	20 May 2007 02:14:46 -0000
@@ -0,0 +1,52 @@
+<?php
+
+/**
+ * Provide the administration overview page.
+ */
+function system_main_admin_page($arg = NULL) {
+  // If we received an argument, they probably meant some other page.
+  // Let's 404 them since the menu system cannot be told we do not
+  // accept arguments.
+  if (isset($arg) && substr($arg, 0, 3) != 'by-') {
+    return drupal_not_found();
+  }
+
+  // Check for status report errors.
+  if (system_status(TRUE)) {
+    drupal_set_message(t('One or more problems were detected with your Drupal installation. Check the <a href="@status">status report</a> for more information.', array('@status' => url('admin/logs/status'))), 'error');
+  }
+  $result = db_query("SELECT * FROM {menu_links} ml INNER JOIN {menu_router} m ON ml.router_path = m.path
+                      WHERE ml.href like 'admin/%' AND ml.href != 'admin/help' AND ml.depth = 2 AND ml.menu_name = 'navigation'
+                      ORDER BY p1 ASC, p2 ASC, p3 ASC");
+  while ($item = db_fetch_object($result)) {
+    _menu_link_translate($item);
+    if (!$item->access) {
+      continue;
+    }
+    $block = (array)$item;
+    $block['content'] = '';
+    if ($item->block_callback && function_exists($item->block_callback)) {
+      $function = $item->block_callback;
+      $block['content'] .= $function();
+    }
+    $block['content'] .= theme('admin_block_content', system_admin_menu_block($item));
+    $blocks[] = $block;
+  }
+  return theme('admin_page', $blocks);
+}
+
+
+/**
+ * Provide a single block from the administration menu as a page.
+ * This function is often a destination for these blocks.
+ * For example, 'admin/content/types' needs to have a destination to be valid
+ * in the Drupal menu system, but too much information there might be
+ * hidden, so we supply the contents of the block.
+ */
+function system_admin_menu_block_page() {
+  $item = menu_get_item();
+  $content = system_admin_menu_block($item);
+
+  $output = theme('admin_block_content', $content);
+  return $output;
+}
Index: /home/lgarfiel/public_html/drupal/drupal6menusplit/modules/system/system.install
===================================================================
RCS file: /cvs/drupal/drupal/modules/system/system.install,v
retrieving revision 1.112
diff -u -r1.112 system.install
--- modules/system/system.install	18 May 2007 07:03:21 -0000	1.112
+++ modules/system/system.install	20 May 2007 02:14:46 -0000
@@ -371,6 +371,7 @@
         description TEXT,
         position varchar(255) NOT NULL default '',
         weight int NOT NULL default 0,
+        file mediumtext NOT NULL default '',
         PRIMARY KEY  (path),
         KEY fit (fit),
         KEY tab_parent (tab_parent)
@@ -891,6 +892,7 @@
         description TEXT,
         position varchar(255) NOT NULL default '',
         weight int NOT NULL default 0,
+        file text NOT NULL default '',
         PRIMARY KEY (path)
       )");
       db_query("CREATE INDEX {menu_router}_fit_idx ON {menu_router} (fit)");
Index: /home/lgarfiel/public_html/drupal/drupal6menusplit/modules/system/system.module
===================================================================
RCS file: /cvs/drupal/drupal/modules/system/system.module,v
retrieving revision 1.478
diff -u -r1.478 system.module
--- modules/system/system.module	17 May 2007 07:28:42 -0000	1.478
+++ modules/system/system.module	20 May 2007 02:14:47 -0000
@@ -134,6 +134,7 @@
     'access arguments' => array('access administration pages'),
     'page callback' => 'system_main_admin_page',
     'weight' => 9,
+    'file' => 'system.admin.inc',
   );
   $items['admin/compact'] = array(
     'title' => 'Compact mode',
@@ -167,6 +168,7 @@
     'weight' => -10,
     'page callback' => 'system_admin_menu_block_page',
     'access arguments' => array('administer site configuration'),
+    'file' => 'system.admin.inc',
   );
   $items['admin/settings/admin'] = array(
     'title' => 'Administration theme',
@@ -309,6 +311,7 @@
     'page callback' => 'system_admin_menu_block_page',
     'weight' => 5,
     'position' => 'left',
+    'file' => 'system.admin.inc',
   );
   $items['admin/logs/status'] = array(
     'title' => 'Status report',
@@ -385,41 +388,6 @@
 }
 
 /**
- * Provide the administration overview page.
- */
-function system_main_admin_page($arg = NULL) {
-  // If we received an argument, they probably meant some other page.
-  // Let's 404 them since the menu system cannot be told we do not
-  // accept arguments.
-  if (isset($arg) && substr($arg, 0, 3) != 'by-') {
-    return drupal_not_found();
-  }
-
-  // Check for status report errors.
-  if (system_status(TRUE)) {
-    drupal_set_message(t('One or more problems were detected with your Drupal installation. Check the <a href="@status">status report</a> for more information.', array('@status' => url('admin/logs/status'))), 'error');
-  }
-  $result = db_query("SELECT * FROM {menu_links} ml INNER JOIN {menu_router} m ON ml.router_path = m.path
-                      WHERE ml.href like 'admin/%' AND ml.href != 'admin/help' AND ml.depth = 2 AND ml.menu_name = 'navigation'
-                      ORDER BY p1 ASC, p2 ASC, p3 ASC");
-  while ($item = db_fetch_object($result)) {
-    _menu_link_translate($item);
-    if (!$item->access) {
-      continue;
-    }
-    $block = (array)$item;
-    $block['content'] = '';
-    if ($item->block_callback && function_exists($item->block_callback)) {
-      $function = $item->block_callback;
-      $block['content'] .= $function();
-    }
-    $block['content'] .= theme('admin_block_content', system_admin_menu_block($item));
-    $blocks[] = $block;
-  }
-  return theme('admin_page', $blocks);
-}
-
-/**
  * Provide a single block on the administration overview page.
  */
 function system_admin_menu_block($item) {
@@ -439,21 +407,6 @@
   return $content;
 }
 
-/**
- * Provide a single block from the administration menu as a page.
- * This function is often a destination for these blocks.
- * For example, 'admin/content/types' needs to have a destination to be valid
- * in the Drupal menu system, but too much information there might be
- * hidden, so we supply the contents of the block.
- */
-function system_admin_menu_block_page() {
-  $item = menu_get_item();
-  $content = system_admin_menu_block($item);
-
-  $output = theme('admin_block_content', $content);
-  return $output;
-}
-
 function system_admin_compact_page($mode = 'off') {
   global $user;
   user_save($user, array('admin_compact_mode' => ($mode == 'on')));
Index: /home/lgarfiel/public_html/drupal/drupal6menusplit/modules/user/user.module
===================================================================
RCS file: /cvs/drupal/drupal/modules/user/user.module,v
retrieving revision 1.782
diff -u -r1.782 user.module
--- modules/user/user.module	17 May 2007 21:33:59 -0000	1.782
+++ modules/user/user.module	20 May 2007 02:14:47 -0000
@@ -820,6 +820,8 @@
     'position' => 'left',
     'page callback' => 'system_admin_menu_block_page',
     'access arguments' => array('administer site configuration'),
+    'file' => 'system.admin.inc',
+    'file path' => drupal_get_path('module', 'system'),
   );
   $items['admin/user/user'] = array(
     'title' => 'Users',
