Index: modules/system/system.module
===================================================================
RCS file: /cvs/drupal/drupal/modules/system/system.module,v
retrieving revision 1.711
diff -u -p -r1.711 system.module
--- modules/system/system.module	11 Jun 2009 04:36:22 -0000	1.711
+++ modules/system/system.module	23 Jun 2009 00:34:26 -0000
@@ -462,19 +462,19 @@ function system_menu() {
     'title' => 'File download',
     'page callback' => 'file_download',
     'access callback' => TRUE,
-    'type' => MENU_CALLBACK,
+    'hidden' => MENU_LINK_DISABLED,
   );
   $items['system/ahah'] = array(
     'title' => 'AHAH callback',
     'page callback' => 'form_ahah_callback',
     'access callback' => TRUE,
-    'type' => MENU_CALLBACK,
+    'hidden' => MENU_LINK_DISABLED,
   );
   $items['system/timezone'] = array(
     'title' => 'Time zone',
     'page callback' => 'system_timezone',
     'access callback' => TRUE,
-    'type' => MENU_CALLBACK,
+    'hidden' => MENU_LINK_DISABLED,
   );
   $items['admin'] = array(
     'title' => 'Administer',
@@ -487,7 +487,7 @@ function system_menu() {
     'title' => 'Compact mode',
     'page callback' => 'system_admin_compact_page',
     'access arguments' => array('access administration pages'),
-    'type' => MENU_CALLBACK,
+    'hidden' => MENU_LINK_DISABLED,
   );
   $items['admin/by-task'] = array(
     'title' => 'By task',
@@ -583,7 +583,7 @@ function system_menu() {
   $items['admin/build/modules/list/confirm'] = array(
     'title' => 'List',
     'access arguments' => array('administer site configuration'),
-    'type' => MENU_CALLBACK,
+    'hidden' => MENU_LINK_DISABLED,
   );
   $items['admin/build/modules/uninstall'] = array(
     'title' => 'Uninstall',
@@ -594,7 +594,7 @@ function system_menu() {
   $items['admin/build/modules/uninstall/confirm'] = array(
     'title' => 'Uninstall',
     'access arguments' => array('administer site configuration'),
-    'type' => MENU_CALLBACK,
+    'hidden' => MENU_LINK_DISABLED,
   );
 
   // Development menu category.
@@ -627,7 +627,7 @@ function system_menu() {
     'page callback' => 'drupal_get_form',
     'page arguments' => array('system_actions_configure'),
     'access arguments' => array('administer actions'),
-    'type' => MENU_CALLBACK,
+    'hidden' => MENU_LINK_DISABLED,
   );
   $items['admin/settings/actions/delete/%actions'] = array(
     'title' => 'Delete action',
@@ -635,13 +635,13 @@ function system_menu() {
     'page callback' => 'drupal_get_form',
     'page arguments' => array('system_actions_delete_form', 4),
     'access arguments' => array('administer actions'),
-    'type' => MENU_CALLBACK,
+    'hidden' => MENU_LINK_DISABLED,
   );
   $items['admin/settings/actions/orphan'] = array(
     'title' => 'Remove orphans',
     'page callback' => 'system_actions_remove_orphans',
     'access arguments' => array('administer actions'),
-    'type' => MENU_CALLBACK,
+    'hidden' => MENU_LINK_DISABLED,
   );
 
   // IP address blocking.
@@ -656,14 +656,14 @@ function system_menu() {
     'description' => 'Manage blocked IP addresses.',
     'page callback' => 'system_ip_blocking',
     'access arguments' => array('block IP addresses'),
-    'type' => MENU_CALLBACK,
+    'hidden' => MENU_LINK_DISABLED,
   );
   $items['admin/settings/ip-blocking/delete/%blocked_ip'] = array(
     'title' => 'Delete IP address',
     'page callback' => 'drupal_get_form',
     'page arguments' => array('system_ip_blocking_delete', 4),
     'access arguments' => array('block IP addresses'),
-    'type' => MENU_CALLBACK,
+    'hidden' => MENU_LINK_DISABLED,
   );
 
   // Settings.
@@ -724,7 +724,7 @@ function system_menu() {
   );
   $items['admin/settings/regional-settings/lookup'] = array(
     'title' => 'Date and time lookup',
-    'type' => MENU_CALLBACK,
+    'hidden' => MENU_LINK_DISABLED,
     'page callback' => 'system_date_time_lookup',
     'access arguments' => array('administer site configuration'),
   );
@@ -747,7 +747,7 @@ function system_menu() {
     'page callback' => 'drupal_json',
     'page arguments' => array(array('status' => TRUE)),
     'access callback' => TRUE,
-    'type' => MENU_CALLBACK,
+    'hidden' => MENU_LINK_DISABLED,
   );
 
   // Reports.
@@ -771,23 +771,119 @@ function system_menu() {
     'title' => 'Run cron',
     'page callback' => 'system_run_cron',
     'access arguments' => array('administer site configuration'),
-    'type' => MENU_CALLBACK,
+    'hidden' => MENU_LINK_DISABLED,
   );
   $items['admin/reports/status/php'] = array(
     'title' => 'PHP',
     'page callback' => 'system_php',
     'access arguments' => array('administer site configuration'),
-    'type' => MENU_CALLBACK,
+    'hidden' => MENU_LINK_DISABLED,
   );
   // Default page for batch operations.
   $items['batch'] = array(
     'page callback' => 'system_batch_page',
     'access callback' => TRUE,
-    'type' => MENU_CALLBACK,
+    'hidden' => MENU_LINK_DISABLED,
   );
   return $items;
 }
 
+/** 
+ * Implementaiton of hook_menu_local_task()
+ */
+function system_menu_local_task($item) {
+  $tasks = array();
+  
+  // admin
+  if (count($item['link_map']) == 1 && $item['link_map'][0] === 'admin') {
+    if (user_access('access administration pages')) {
+      $tasks['admin/by-task'] = array(
+        'title' => 'By task',
+        'default' => true,
+      );
+
+      $tasks['admin/by-module'] = array(
+        'title' => 'By module',
+        'weight' => 2,
+      );      
+    }
+  }
+  
+  // admin/build/themes
+  if (count($item['link_map']) >= 3 && $item['link_map'][0] === 'admin' && $item['link_map'][1] === 'build' && $item['link_map'][2] === 'themes') {
+    if (user_access('administer site configuration')) {
+      $tasks['admin/build/themes'] = array(
+        'title' => 'List',
+        'description' => 'Select the default theme for your site.',
+        'weight' => -1,
+      );
+
+      $tasks['admin/build/themes/settings'] = array(
+        'title' => 'Configure',
+      );      
+    }
+  }
+  
+  // admin/build/themes/settings
+  if (count($item['link_map']) >= 4 && $item['link_map'][0] === 'admin' && $item['link_map'][1] === 'build' && $item['link_map'][2] === 'themes' && $item['link_map'][3] === 'settings') {
+    if (user_access('administer site configuration')) {
+   
+      $tasks['admin/build/themes/settings/global'] = array(
+        'title' => 'Global settings',
+        'weight' => -1,
+        'parent' => 'admin/build/themes/settings',
+        'default' => !isset($item['link_map'][4]) || (isset($item['link_map'][4]) && $item['link_map'][4] === 'global'),
+      );
+    
+      foreach (list_themes() as $theme) {
+        if (_system_themes_access($theme)) {
+          $tasks['admin/build/themes/settings/' . $theme->name] = array(
+            'title' => $theme->info['name'],
+            'parent' => 'admin/build/themes/settings',
+          );
+        }
+      } 
+    }
+  }
+  
+  // admin/build/modules
+  if (count($item['link_map']) >= 3 && $item['link_map'][0] === 'admin' && $item['link_map'][1] === 'build' && $item['link_map'][2] === 'modules') {
+    if (user_access('administer site configuration')) {
+      $tasks['admin/build/modules'] = array(
+        'title' => 'List',
+        'description' => 'Enable or disable add-on modules for your site.',
+      );
+      $tasks['admin/build/modules/uninstall'] = array(
+        'title' => 'Uninstall',
+      );
+    }
+  }
+
+  // admin/settings/actions
+  if (count($item['link_map']) >= 3 && $item['link_map'][0] === 'admin' && $item['link_map'][1] === 'settings' && $item['link_map'][2] === 'actions') {
+    if (user_access('administer actions')) {
+      $tasks['admin/settings/actions'] = array(
+        'title' => 'Manage actions',
+        'description' => 'Manage the actions defined for your site.',
+        'weight' => -2,
+        'default' => true,
+      );
+    }
+  }
+
+  // admin/settings/loggin
+  if (count($item['link_map']) >= 3 && $item['link_map'][0] === 'admin' && $item['link_map'][1] === 'settings' && $item['link_map'][2] === 'logging') {
+    if (user_access('administer actions')) {
+      $tasks['admin/settings/logging'] = array(
+        'title' => 'Settings',
+        'description' => "Settings for logging and alerts modules. Various modules can route Drupal's system events to different destinations, such as syslog, database, email, etc.",
+      );
+    }
+  }
+
+  return $tasks;
+}
+
 /**
  * Retrieve a blocked IP address from the database.
  *
@@ -1025,6 +1121,14 @@ function system_block_view($delta = '') 
         $block['content'] = menu_tree($delta);
         return $block;
       }
+      $item = menu_get_item();
+      $current_tab = db_query("SELECT * FROM {menu_links} WHERE menu_name = 'system-tabs' AND router_path = :router_path", array(':router_path' => $item['path']))->fetchAssoc();
+      if ($current_tab) {
+        $tree = menu_tree_all_data('system-tabs', $current_tab);
+        $block['content'] = menu_tree_output($tree);
+        $block['subject'] = 'tabs';
+        return $block;
+      }
       break;
   }
 }
@@ -1045,7 +1149,7 @@ function system_admin_menu_block($item) 
   }
   $content = array();
   $result = db_query("
-    SELECT m.load_functions, m.to_arg_functions, m.access_callback, m.access_arguments, m.page_callback, m.page_arguments, m.title, m.title_callback, m.title_arguments, m.type, m.description, ml.*
+    SELECT m.load_functions, m.to_arg_functions, m.access_callback, m.access_arguments, m.page_callback, m.page_arguments, m.title, m.title_callback, m.title_arguments, m.description, ml.*
     FROM {menu_links} ml
     LEFT JOIN {menu_router} m ON ml.router_path = m.path
     WHERE ml.plid = :plid AND ml.menu_name = :name AND hidden = 0", array(':plid' => $item['mlid'], ':name' => $item['menu_name']), array('fetch' => PDO::FETCH_ASSOC));
