? .DS_Store ? actions_14.patch ? actions_help.patch ? block_dnd-add_drag_drop_to_blocks-181066-86.patch ? block_sane_help.patch ? book_ahahapi_4.patch ? comment_notice.patch ? draggable-menu-181126-16.patch ? drupal_drag_and_drop_12.patch ? drupal_drag_and_drop_14.patch ? files ? fix_garland_and_menu_theme.patch ? form_expand_ahah.patch ? install_profile_notice.patch ? jquery_upgrade.patch ? lower_13.patch ? lower_14.patch ? menu_drag_and_drop_0.patch ? powered_by_drupal.patch ? powered_by_drupal_2.patch ? tracker-union-2.patch ? misc/draggable.png ? misc/tabledrag.js ? misc/tree-bottom.png ? misc/tree.png ? modules/.DS_Store ? modules/block/.DS_Store ? modules/block/block.js ? modules/menu/.DS_Store ? modules/tracker/.DS_Store ? modules/translation/.DS_Store ? profiles/.DS_Store ? profiles/single_user_blog ? sites/.DS_Store ? sites/views ? sites/all/.DS_Store ? sites/all/modules ? sites/all/themes ? sites/default/settings.php ? themes/.DS_Store ? themes/engines/.DS_Store ? themes/garland/.DS_Store Index: modules/menu/menu.admin.inc =================================================================== RCS file: /cvs/drupal/drupal/modules/menu/menu.admin.inc,v retrieving revision 1.6 diff -u -p -r1.6 menu.admin.inc --- modules/menu/menu.admin.inc 11 Nov 2007 06:56:44 -0000 1.6 +++ modules/menu/menu.admin.inc 15 Nov 2007 05:56:08 -0000 @@ -27,7 +27,7 @@ function menu_overview_page() { * relevant operations. */ function menu_overview_form(&$form_state, $menu) { - $sql =" + $sql = " 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, ml.* FROM {menu_links} ml LEFT JOIN {menu_router} m ON m.path = ml.router_path WHERE ml.menu_name = '%s' @@ -66,13 +66,32 @@ function _menu_overview_tree_form($tree) $form[$mlid]['#item'] = $item; $form[$mlid]['#attributes'] = $item['hidden'] ? array('class' => 'menu-disabled') : array('class' => 'menu-enabled'); $form[$mlid]['title']['#value'] = l($item['title'], $item['href'], $item['options']) . ($item['hidden'] ? ' ('. t('disabled') .')' : ''); + $form[$mlid]['title'] = array( + '#value' => l($item['title'], $item['href'], $item['options']) . ($item['hidden'] ? ' ('. t('disabled') .')' : ''), + ); $form[$mlid]['hidden'] = array( '#type' => 'checkbox', - '#default_value' => !$item['hidden'], + '#default_value' => isset($form_state[$mlid]['hidden']) ? $form_state[$mlid]['hidden'] : !$item['hidden'], ); $form[$mlid]['expanded'] = array( - '#type' => 'checkbox', - '#default_value' => $item['has_children'] && $item['expanded'], + '#value' => $item['has_children'] ? (($item['expanded']) ? t('Yes') : t('No')) : '', + ); + $form[$mlid]['weight'] = array( + '#type' => 'weight', + '#default_value' => isset($form_state[$mlid]['weight']) ? $form_state[$mlid]['weight'] : $item['weight'], + ); + $form[$mlid]['depth'] = array( + '#type' => 'hidden', + '#value' => $item['depth'], + ); + $form[$mlid]['mlid'] = array( + '#type' => 'hidden', + '#value' => $item['mlid'], + ); + $form[$mlid]['plid'] = array( + '#type' => 'textfield', + '#default_value' => isset($form_state[$mlid]['plid']) ? $form_state[$mlid]['plid'] : $item['plid'], + '#size' => 6, ); // Build a list of operations. $operations = array(); @@ -90,6 +109,13 @@ function _menu_overview_tree_form($tree) foreach ($operations as $op => $value) { $form[$mlid]['operations'][$op] = array('#value' => $value); } + + $plid = isset($form_state[$mlid]['plid']) ? $form_state[$mlid]['plid'] : $item['plid']; + + // Add special classes to be used for tabledrag.js. + $form[$mlid]['plid']['#attributes']['class'] = 'menu-plid menu-plid-'. $plid; + $form[$mlid]['mlid']['#attributes']['class'] = 'menu-mlid menu-mlid-'. $plid; + $form[$mlid]['weight']['#attributes']['class'] = 'menu-weight menu-weight-'. $plid; } if ($data['below']) { @@ -119,7 +145,9 @@ function menu_overview_form_submit($form * Theme the menu overview form into a table. */ function theme_menu_overview_form($form) { - $header = array(t('Enabled'), t('Expanded'), t('Menu item'), array('data' => t('Operations'), 'colspan' => '3')); + drupal_add_tabledrag('menu-overview', 'menu-plid', 'match', 'parent', 'menu-plid', 'menu-mlid'); + drupal_add_tabledrag('menu-overview', 'menu-weight', 'order', 'sibling', 'menu-weight'); + $header = array(t('Menu item'), t('Expanded'), t('Enabled'), t('Parent'), t('Weight'), array('data' => t('Operations'), 'colspan' => '3')); $rows = array(); foreach (element_children($form) as $mlid) { if (isset($form[$mlid]['hidden'])) { @@ -133,15 +161,23 @@ function theme_menu_overview_form($form) $operations[] = ''; } + // Make indentations. + $indentation = ''; + for ($n = 1; $n < $element['depth']['#value']; $n++) { + $indentation .= '
 
'; + } $row = array(); - $row[] = array('data' => drupal_render($element['hidden']), 'align' => 'center'); - $row[] = array('data' => drupal_render($element['expanded']), 'align' => 'center'); + $row[] = $indentation . drupal_render($element['depth']) . drupal_render($element['title']); + $row[] = drupal_render($element['expanded']); + $row[] = drupal_render($element['hidden']); + $row[] = drupal_render($element['plid']) . drupal_render($element['mlid']); + $row[] = drupal_render($element['weight']); + $depth = $element['#item']['depth']; - $indentation = str_repeat('  ', $depth - 1) . ($depth > 1 ? '- ' : ''); - $row[] = $indentation . drupal_render($element['title']); - $row = array_merge($row, $operations); + $row = array_merge($row, $operations); $row = array_merge(array('data' => $row), $element['#attributes']); + $row['class'] = !empty($row['class'])? $row['class'] .' draggable' : 'draggable'; $rows[] = $row; } }