diff -pruN framework/style.css framework_ao2/style.css --- framework/style.css 2008-11-28 07:14:30.000000000 +0100 +++ framework_ao2/style.css 2009-03-09 16:36:26.000000000 +0100 @@ -544,8 +544,8 @@ ul.menu li.expanded ul { margin-top: .1e /* menu zebra coloring */ ul.menu li { border-bottom: 1px solid #d4e7f3; padding: .2em 0 .2em 0; } ul.menu li a { padding: .2em 0 .2em 1.5em; } -ul.menu li.odd { background-color: #fff; } -ul.menu li.even { background-color: #edf5fa; } +ul li.odd { background-color: #fff; } +ul li.even { background-color: #edf5fa; } ul.menu li.expanded { background-color: #d4e7f3; border: none; padding-bottom: 0; } ul.menu li.expanded ul { border-bottom: 3px solid #d4e7f3; border-top: 1px solid #b4d7f0; margin-top: .2em; } @@ -642,4 +642,4 @@ div.error, tr.error { background-color: table.system-status-report th { border-color: #d4e7f3; } table.system-status-report tr.error, table.system-status-report tr.error th { background-color: #fcc; border-color: #ebb; color: #200; } table.system-status-report tr.warning, table.system-status-report tr.warning th { background-color: #ffd; border-color: #eeb; } -table.system-status-report tr.ok, table.system-status-report tr.ok th { background-color: #dfd; border-color: #beb; } \ No newline at end of file +table.system-status-report tr.ok, table.system-status-report tr.ok th { background-color: #dfd; border-color: #beb; } diff -pruN framework/template.php framework_ao2/template.php --- framework/template.php 2008-11-28 07:14:30.000000000 +0100 +++ framework_ao2/template.php 2009-03-10 19:49:07.000000000 +0100 @@ -103,23 +103,60 @@ function phptemplate_get_ie6_styles() { } /** - * Adds even and odd classes to
  • tags in ul.menu lists - */ -function phptemplate_menu_item($link, $has_children, $menu = '', $in_active_trail = FALSE, $extra_class = NULL) { - static $zebra = FALSE; - $zebra = !$zebra; - $class = ($menu ? 'expanded' : ($has_children ? 'collapsed' : 'leaf')); - if (!empty($extra_class)) { - $class .= ' '. $extra_class; + * Override theme_item_list, see http://api.drupal.org/api/function/theme_item_list + * + * We can't do the same for menu lists because the correspondig function + * menu_tree_output is not themeable yet, see http://drupal.org/node/283723 + */ +function framework_item_list($items = array(), $title = NULL, $type = 'ul', $attributes = NULL) { + $output = '
    '; + if (isset($title)) { + $output .= '

    '. $title .'

    '; } - if ($in_active_trail) { - $class .= ' active-trail'; - } - if ($zebra) { - $class .= ' even'; - } - else { - $class .= ' odd'; + + if (!empty($items)) { + $output .= "<$type". drupal_attributes($attributes) .'>'; + $num_items = count($items); + foreach ($items as $i => $item) { + $attributes = array(); + $children = array(); + if (is_array($item)) { + foreach ($item as $key => $value) { + if ($key == 'data') { + $data = $value; + } + elseif ($key == 'children') { + $children = $value; + } + else { + $attributes[$key] = $value; + } + } + } + else { + $data = $item; + } + if (count($children) > 0) { + $data .= theme_item_list($children, NULL, $type, $attributes); // Render nested list + } + if ($i == 0) { + $attributes['class'] = empty($attributes['class']) ? 'first' : ($attributes['class'] .' first'); + } + if ($i == $num_items - 1) { + $attributes['class'] = empty($attributes['class']) ? 'last' : ($attributes['class'] .' last'); + } + + /* Add zebra coloring, this if-else block is the only addition to the original function */ + if ($i % 2) { + $attributes['class'] = empty($attributes['class']) ? 'even' : ($attributes['class'] .' even'); + } else { + $attributes['class'] = empty($attributes['class']) ? 'odd' : ($attributes['class'] .' odd'); + } + + $output .= ''. $data ."
  • \n"; + } + $output .= ""; } - return '
  • '. $link . $menu ."
  • \n"; + $output .= ''; + return $output; }