Index: includes/menu.inc
===================================================================
RCS file: /cvs/drupal/drupal/includes/menu.inc,v
retrieving revision 1.84
diff -u -r1.84 menu.inc
--- includes/menu.inc	25 Aug 2005 21:14:16 -0000	1.84
+++ includes/menu.inc	6 Sep 2005 06:17:16 -0000
@@ -549,11 +549,16 @@
  *
  * @param $pid
  *   The parent id of the menu.
+ * @param $dynamic
+ *   Boolean indicating whether the menu should be rendered for dynamic, interactive display.
  *
  * @ingroup themeable
  */
-function theme_menu_tree($pid = 1) {
-  if ($tree = menu_tree($pid)) {
+function theme_menu_tree($pid = 1, $dynamic = NULL) {
+  if ($dynamic == NULL) {
+    $dynamic = theme_get_setting('dynamic_menus');
+  }
+  if ($tree = menu_tree($pid, $dynamic)) {
     return "\n<ul>\n". $tree ."\n</ul>\n";
   }
 }
@@ -563,14 +568,17 @@
  *
  * @param $pid
  *   The parent id of the menu.
+ * @param $dynamic
+ *   Boolean indicating whether the menu should be rendered for dynamic, interactive display.
  */
-function menu_tree($pid = 1) {
+function menu_tree($pid = 1, $dynamic = FALSE) {
   $menu = menu_get_menu();
   $output = '';
 
   if (isset($menu['visible'][$pid]) && $menu['visible'][$pid]['children']) {
     foreach ($menu['visible'][$pid]['children'] as $mid) {
-      $output .= theme('menu_item', $mid, menu_in_active_trail($mid) || ($menu['visible'][$mid]['type'] & MENU_EXPANDED) ? theme('menu_tree', $mid) : '', count($menu['visible'][$mid]['children']) == 0);
+      $state = count($menu['visible'][$mid]['children']) == 0 ? 'leaf' : ((menu_in_active_trail($mid) || ($menu['visible'][$mid]['type'] & MENU_EXPANDED)) ? 'expanded' : 'collapsed');
+      $output .= theme('menu_item', $mid, $state, ((count($menu['visible'][$mid]['children']) > 0) && ($dynamic || ($state == 'expanded')) ? theme('menu_tree', $mid, $dynamic) : ''), $dynamic);
     }
   }
 
@@ -582,15 +590,20 @@
  *
  * @param $mid
  *   The menu id of the item.
+ * @param $class
+ *   A string containing the CSS class.
  * @param $children
  *   A string containing any rendered child items of this menu.
- * @param $leaf
- *   A boolean indicating whether this menu item is a leaf.
+ * @param $dynamic
+ *   Boolean indicating whether the menu should be rendered for dynamic, interactive display.
  *
  * @ingroup themeable
  */
-function theme_menu_item($mid, $children = '', $leaf = TRUE) {
-  return '<li class="'. ($leaf ? 'leaf' : ($children ? 'expanded' : 'collapsed')) .'">'. menu_item_link($mid) . $children ."</li>\n";
+function theme_menu_item($mid, $class = 'leaf', $children = '', $dynamic = FALSE) {
+  if ($dynamic) {
+    drupal_add_js('misc/menu.js');
+  }
+  return '<li class="'. $class .'">'. (($dynamic && (($class == 'collapsed') || ($class == 'expanded'))) ? '<img src="misc/blank.png" class="menu-dynamic-target" onclick="toggleMenuItem(this)"/>' : '') . menu_item_link($mid) . $children ."</li>\n";
 }
 
 /**
Index: includes/theme.inc
===================================================================
RCS file: /cvs/drupal/drupal/includes/theme.inc,v
retrieving revision 1.256
diff -u -r1.256 theme.inc
--- includes/theme.inc	28 Aug 2005 15:29:34 -0000	1.256
+++ includes/theme.inc	6 Sep 2005 16:15:30 -0000
@@ -219,6 +219,7 @@
     'logo_path'                     =>  '',
     'default_favicon'               =>  1,
     'favicon_path'                  =>  '',
+    'dynamic_menus'                 =>  0,
     'toggle_logo'                   =>  1,
     'toggle_favicon'                =>  1,
     'toggle_name'                   =>  1,
Index: misc/drupal.css
===================================================================
RCS file: /cvs/drupal/drupal/misc/drupal.css,v
retrieving revision 1.117
diff -u -r1.117 drupal.css
--- misc/drupal.css	2 Sep 2005 19:18:14 -0000	1.117
+++ misc/drupal.css	6 Sep 2005 14:42:43 -0000
@@ -74,9 +74,23 @@
   padding: 0.2em 0.5em 0 0;
   margin: 0;
 }
+li.expanded ul {
+  display: block;
+}
+li.collapsed ul {
+  display: none;
+}
 li a.active {
   color: #000;
 }
+.menu-dynamic-target {
+  height: 7px;
+  width: 7px;
+  margin-left:-15px;
+  margin-right: 8px;
+  cursor: pointer;
+  cursor: hand;
+}
 td.menu-disabled {
   background: #ccc;
 }
Index: modules/system.module
===================================================================
RCS file: /cvs/drupal/drupal/modules/system.module,v
retrieving revision 1.229
diff -u -r1.229 system.module
--- modules/system.module	28 Aug 2005 18:17:47 -0000	1.229
+++ modules/system.module	6 Sep 2005 14:48:52 -0000
@@ -751,6 +751,13 @@
     $form .= form_group(t('Shortcut icon settings'), $group);
   }
 
+  // Dynamic menus setting
+  if ((!$key) || in_array('dynamic_menus', $features)) {
+    $group = t('Menu navigation can feature dynamic tree menus, which users can click to expand or collapse.');
+    $group .= form_checkbox(t('Use dynamic menus.'), "$var][dynamic_menus", 1, $settings['dynamic_menus'], '');
+    $form .= form_group(t('Dynamic menus'), $group);
+  }
+
   // System wide only settings.
   if (!$key) {
     // Menu settings
Index: themes/engines/phptemplate/phptemplate.engine
===================================================================
RCS file: /cvs/drupal/drupal/themes/engines/phptemplate/phptemplate.engine,v
retrieving revision 1.15
diff -u -r1.15 phptemplate.engine
--- themes/engines/phptemplate/phptemplate.engine	4 Sep 2005 13:52:08 -0000	1.15
+++ themes/engines/phptemplate/phptemplate.engine	6 Sep 2005 14:43:06 -0000
@@ -121,6 +121,7 @@
 function phptemplate_features() {
   return array(
     'logo',
+    'dynamic_menus',
     'toggle_comment_user_picture',
     'toggle_favicon',
     'toggle_mission',
