summaryrefslogtreecommitdiff
path: root/modules/system/system.admin.inc
diff options
context:
space:
mode:
authorDries Buytaert <dries@buytaert.net>2007-05-22 05:52:17 +0000
committerDries Buytaert <dries@buytaert.net>2007-05-22 05:52:17 +0000
commit5094312d3b76d41aaf41c6a5c9dab04ccb7d1590 (patch)
treee4bb03e8ab3ae3184c3d29db410c27dc9cc78ab2 /modules/system/system.admin.inc
parent760a181c97bbe318af26c98ad53f7c47f26d28d5 (diff)
downloadbrdo-5094312d3b76d41aaf41c6a5c9dab04ccb7d1590.tar.gz
brdo-5094312d3b76d41aaf41c6a5c9dab04ccb7d1590.tar.bz2
- Patch #140218 by Crell et al: make it possible to move page callbacks to their own include files.
Diffstat (limited to 'modules/system/system.admin.inc')
-rw-r--r--modules/system/system.admin.inc52
1 files changed, 52 insertions, 0 deletions
diff --git a/modules/system/system.admin.inc b/modules/system/system.admin.inc
new file mode 100644
index 000000000..41ed65edb
--- /dev/null
+++ b/modules/system/system.admin.inc
@@ -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;
+}