From 245454bece3e3a460ed1504117a4dd7eb635fd8d Mon Sep 17 00:00:00 2001
From: Dries Buytaert <dries@buytaert.net>
Date: Tue, 18 May 2010 12:07:39 +0000
Subject: [PATCH] - Patch #790650 by casey: dashboard always appears in
 drag-and-drop mode when Seven is not used (and on 404 pages).

---
 modules/dashboard/dashboard.js     | 3 ---
 modules/dashboard/dashboard.module | 8 ++++++++
 modules/system/system.admin.inc    | 9 +++++----
 3 files changed, 13 insertions(+), 7 deletions(-)

diff --git a/modules/dashboard/dashboard.js b/modules/dashboard/dashboard.js
index 6f89d30d7a8c..c680062b0a74 100644
--- a/modules/dashboard/dashboard.js
+++ b/modules/dashboard/dashboard.js
@@ -8,9 +8,6 @@ Drupal.behaviors.dashboard = {
   attach: function () {
     $('#dashboard').prepend('<div class="customize"><ul class="action-links"><li><a href="#">' + Drupal.t('Customize dashboard') + '</a></li></ul><div class="canvas"></div></div>');
     $('#dashboard .customize .action-links a').click(Drupal.behaviors.dashboard.enterCustomizeMode);
-    if ($('#dashboard .region .block').length == 0) {
-      Drupal.settings.dashboard.launchCustomize = true;
-    }
     Drupal.behaviors.dashboard.addPlaceholders();
     if (Drupal.settings.dashboard.launchCustomize) {
       Drupal.behaviors.dashboard.enterCustomizeMode();
diff --git a/modules/dashboard/dashboard.module b/modules/dashboard/dashboard.module
index 2bde008a9c3e..76a7e2d269ac 100644
--- a/modules/dashboard/dashboard.module
+++ b/modules/dashboard/dashboard.module
@@ -198,6 +198,14 @@ function dashboard_theme() {
  *   Whether to launch in customization mode right away. TRUE or FALSE.
  */
 function dashboard_admin($launch_customize = FALSE) {
+  // Only continue if provided arguments are expected. This function serves
+  // as the callback for the top-level admin/ page, so any unexpected arguments
+  // are likely the result of someone typing in the URL of an administrative
+  // page that doesn't actually exist; for example, admin/some/random/page.
+  if (!is_bool($launch_customize)) {
+    return MENU_NOT_FOUND;
+  }
+
   $js_settings = array(
     'dashboard' => array(
       'drawer' => url('admin/dashboard/drawer'),
diff --git a/modules/system/system.admin.inc b/modules/system/system.admin.inc
index 4777f204fa21..6d9fb5767b67 100644
--- a/modules/system/system.admin.inc
+++ b/modules/system/system.admin.inc
@@ -10,11 +10,12 @@
  * Menu callback; 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.
+  // Only continue if provided arguments are expected. This function serves
+  // as the callback for the top-level admin/ page, so any unexpected arguments
+  // are likely the result of someone typing in the URL of an administrative
+  // page that doesn't actually exist; for example, admin/some/random/page.
   if (isset($arg) && substr($arg, 0, 3) != 'by-') {
-    return drupal_not_found();
+    return MENU_NOT_FOUND;
   }
 
   // Check for status report errors.
-- 
GitLab