summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDries Buytaert <dries@buytaert.net>2004-10-23 13:41:37 +0000
committerDries Buytaert <dries@buytaert.net>2004-10-23 13:41:37 +0000
commita73f63f10c9a1dcd52623d95f34afe77d959cfc9 (patch)
treed692b7493836a8201c0405abedea6cf3359d58c1
parent474beff6407b37c56b87fa552c253b6ab27e5c94 (diff)
downloadbrdo-a73f63f10c9a1dcd52623d95f34afe77d959cfc9.tar.gz
brdo-a73f63f10c9a1dcd52623d95f34afe77d959cfc9.tar.bz2
- Patch #11947 by puregin: ensured that a book node's weight is captured when the book node lists returned by book_location() and book_location_down() are generated. This information is required when selecting next page candidates in book_next().
Note that book_location_down() was missing an explicit field b.weight in the SQL SELECT statement, but this value would usually be supplied implicitly because it is used to ORDER the result.
-rw-r--r--modules/book.module4
-rw-r--r--modules/book/book.module4
2 files changed, 4 insertions, 4 deletions
diff --git a/modules/book.module b/modules/book.module
index 8fc2555b3..65bec14f6 100644
--- a/modules/book.module
+++ b/modules/book.module
@@ -326,7 +326,7 @@ function book_revision_load($page, $conditions = array()) {
* Return the path (call stack) to a certain book page.
*/
function book_location($node, $nodes = array()) {
- $parent = db_fetch_object(db_query('SELECT n.nid, n.title, b.parent FROM {node} n '. node_access_join_sql() .' INNER JOIN {book} b ON n.nid = b.nid WHERE '. node_access_where_sql() .' AND n.nid = %d', $node->parent));
+ $parent = db_fetch_object(db_query('SELECT n.nid, n.title, b.parent, b.weight FROM {node} n '. node_access_join_sql() .' INNER JOIN {book} b ON n.nid = b.nid WHERE '. node_access_where_sql() .' AND n.nid = %d', $node->parent));
if ($parent->title) {
$nodes = book_location($parent, $nodes);
array_push($nodes, $parent);
@@ -335,7 +335,7 @@ function book_location($node, $nodes = array()) {
}
function book_location_down($node, $nodes = array()) {
- $last_direct_child = db_fetch_object(db_query('SELECT n.nid, n.title, b.parent FROM {node} n '. node_access_join_sql() .' INNER JOIN {book} b ON n.nid = b.nid WHERE '. node_access_where_sql() .' AND b.parent = %d ORDER BY b.weight DESC, n.title DESC', $node->nid));
+ $last_direct_child = db_fetch_object(db_query('SELECT n.nid, n.title, b.parent, b.weight FROM {node} n '. node_access_join_sql() .' INNER JOIN {book} b ON n.nid = b.nid WHERE '. node_access_where_sql() .' AND b.parent = %d ORDER BY b.weight DESC, n.title DESC', $node->nid));
if ($last_direct_child) {
array_push($nodes, $last_direct_child);
$nodes = book_location_down($last_direct_child, $nodes);
diff --git a/modules/book/book.module b/modules/book/book.module
index 8fc2555b3..65bec14f6 100644
--- a/modules/book/book.module
+++ b/modules/book/book.module
@@ -326,7 +326,7 @@ function book_revision_load($page, $conditions = array()) {
* Return the path (call stack) to a certain book page.
*/
function book_location($node, $nodes = array()) {
- $parent = db_fetch_object(db_query('SELECT n.nid, n.title, b.parent FROM {node} n '. node_access_join_sql() .' INNER JOIN {book} b ON n.nid = b.nid WHERE '. node_access_where_sql() .' AND n.nid = %d', $node->parent));
+ $parent = db_fetch_object(db_query('SELECT n.nid, n.title, b.parent, b.weight FROM {node} n '. node_access_join_sql() .' INNER JOIN {book} b ON n.nid = b.nid WHERE '. node_access_where_sql() .' AND n.nid = %d', $node->parent));
if ($parent->title) {
$nodes = book_location($parent, $nodes);
array_push($nodes, $parent);
@@ -335,7 +335,7 @@ function book_location($node, $nodes = array()) {
}
function book_location_down($node, $nodes = array()) {
- $last_direct_child = db_fetch_object(db_query('SELECT n.nid, n.title, b.parent FROM {node} n '. node_access_join_sql() .' INNER JOIN {book} b ON n.nid = b.nid WHERE '. node_access_where_sql() .' AND b.parent = %d ORDER BY b.weight DESC, n.title DESC', $node->nid));
+ $last_direct_child = db_fetch_object(db_query('SELECT n.nid, n.title, b.parent, b.weight FROM {node} n '. node_access_join_sql() .' INNER JOIN {book} b ON n.nid = b.nid WHERE '. node_access_where_sql() .' AND b.parent = %d ORDER BY b.weight DESC, n.title DESC', $node->nid));
if ($last_direct_child) {
array_push($nodes, $last_direct_child);
$nodes = book_location_down($last_direct_child, $nodes);