Index: includes/handlers.inc
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/views/includes/handlers.inc,v
retrieving revision 1.63
diff -u -p -r1.63 handlers.inc
--- includes/handlers.inc	31 Mar 2008 19:49:56 -0000	1.63
+++ includes/handlers.inc	1 Apr 2008 10:30:17 -0000
@@ -1071,6 +1071,21 @@ class views_handler_sort_date extends vi
   }
 }
 
+/**
+ * Sort in menu hierarchy order.
+ *
+ * Given a field name of 'p' this produces an ORDER BY on p1, p2, ..., p9.
+ * This is only really useful for the {menu_links} table.
+ */
+class views_handler_sort_menu_hierarchy extends views_handler_sort {
+  function query() {
+    $this->ensure_my_table();
+    for ($i = 1; $i <= 9; ++$i) {
+      $this->query->add_orderby($this->table_alias, $this->field . $i, $this->options['order']);
+    }
+  }
+}
+
 
 /**
  * @}
Index: modules/book.views.inc
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/views/modules/book.views.inc,v
retrieving revision 1.1
diff -u -p -r1.1 book.views.inc
--- modules/book.views.inc	31 Mar 2008 19:49:56 -0000	1.1
+++ modules/book.views.inc	1 Apr 2008 10:30:17 -0000
@@ -55,7 +55,7 @@ function book_views_data() {
 
   $data['book_menu_links']['weight'] = array(
     'title' => t('Weight'),
-    'help' => t('The weight of the book page'),
+    'help' => t('The weight of the book page.'),
     'field' => array(
       'handler' => 'views_handler_field',
       'click sortable' => TRUE,
@@ -65,6 +65,32 @@ function book_views_data() {
     ),
   );
 
+  $data['book_menu_links']['depth'] = array(
+    'title' => t('Depth'),
+    'help' => t('The depth of the book page in the hierarchy; top level books have a depth of 1.'),
+    'field' => array(
+      'handler' => 'views_handler_field',
+      'click sortable' => TRUE,
+    ),
+    'sort' => array(
+      'handler' => 'views_handler_sort',
+    ),
+    'filter' => array(
+      'handler' => 'views_handler_filter_numeric',
+    ),
+    'argument' => array(
+      'handler' => 'views_handler_argument',
+    ),
+  );
+
+  $data['book_menu_links']['p'] = array(
+    'title' => t('Hierarchy'),
+    'help' => t('The order of pages in the book hierarchy.  Remember to sort by weight too if you want exactly the right order.'),
+    'sort' => array(
+      'handler' => 'views_handler_sort_menu_hierarchy',
+    ),
+  );
+
   // ----------------------------------------------------------------------
   // book_parent table -- this is an alias of the book table which
   // represents the parent book.
