diff options
-rw-r--r-- | modules/book.module | 35 | ||||
-rw-r--r-- | modules/book/book.module | 35 |
2 files changed, 30 insertions, 40 deletions
diff --git a/modules/book.module b/modules/book.module index 83074d1df..f8148c20e 100644 --- a/modules/book.module +++ b/modules/book.module @@ -621,19 +621,14 @@ function book_print_recurse($parent = "", $depth = 1) { function book_admin_view_line($node, $depth = 0) { - /* - ** Diplay the book page: - */ - - $output .= "<tr>"; - $output .= " <td><div style=\"padding-left: ". (25 * $depth) ."px;\">". form_textfield(NULL, "$node->nid][title", $node->title, 64, 255) ."</div></td>"; - $output .= " <td>". form_weight(NULL, "$node->nid][weight", $node->weight) ."</td>"; - $output .= " <td>". l(t("view node"), "node/view/$node->nid") ."</td>"; - $output .= " <td>". l(t("edit node"), "admin/node/edit/$node->nid") ."</td>"; - $output .= " <td>". l(t("delete node"), "admin/node/delete/$node->nid") ."</td>"; - $output .= "</tr>"; + $row = array( + "<div style=\"padding-left: ". (25 * $depth) ."px;\">". form_textfield(NULL, "$node->nid][title", $node->title, 64, 255) ."</div>", + form_weight(NULL, "$node->nid][weight", $node->weight), + l(t("view node"), "node/view/$node->nid"), + l(t("edit node"), "admin/node/edit/$node->nid"), + l(t("delete node"), "admin/node/delete/$node->nid")); - return $output; + return $row; } function book_admin_view_book($nid, $depth = 1) { @@ -641,11 +636,11 @@ function book_admin_view_book($nid, $depth = 1) { while ($node = db_fetch_object($result)) { $node = node_load(array("nid" => $node->nid)); - $output .= book_admin_view_line($node, $depth); - $output .= book_admin_view_book($node->nid, $depth + 1); + $rows[] = book_admin_view_line($node, $depth); + $rows = array_merge($rows, book_admin_view_book($node->nid, $depth + 1)); } - return $output; + return $rows; } function book_admin_view($nid, $depth = 0) { @@ -653,12 +648,12 @@ function book_admin_view($nid, $depth = 0) { $node = node_load(array("nid" => $nid)); $output .= "<h3>$node->title</h3>"; - $output .= "<table border=\"1\" cellpadding=\"2\" cellspacing=\"2\">"; - $output .= " <tr><th>title</th><th>weight</th><th colspan=\"3\">operations</th></tr>"; - $output .= book_admin_view_line($node); - $output .= book_admin_view_book($nid); - $output .= "</table><br />"; + $header = array(t("title"), t("weight"), array("data" => t("operations"), "colspan" => 3)); + $rows[] = book_admin_view_line($node); + $rows = array_merge($rows, book_admin_view_book($nid)); + + $output .= table($header, $rows); $output .= form_submit(t("Save book pages")); return form($output); diff --git a/modules/book/book.module b/modules/book/book.module index 83074d1df..f8148c20e 100644 --- a/modules/book/book.module +++ b/modules/book/book.module @@ -621,19 +621,14 @@ function book_print_recurse($parent = "", $depth = 1) { function book_admin_view_line($node, $depth = 0) { - /* - ** Diplay the book page: - */ - - $output .= "<tr>"; - $output .= " <td><div style=\"padding-left: ". (25 * $depth) ."px;\">". form_textfield(NULL, "$node->nid][title", $node->title, 64, 255) ."</div></td>"; - $output .= " <td>". form_weight(NULL, "$node->nid][weight", $node->weight) ."</td>"; - $output .= " <td>". l(t("view node"), "node/view/$node->nid") ."</td>"; - $output .= " <td>". l(t("edit node"), "admin/node/edit/$node->nid") ."</td>"; - $output .= " <td>". l(t("delete node"), "admin/node/delete/$node->nid") ."</td>"; - $output .= "</tr>"; + $row = array( + "<div style=\"padding-left: ". (25 * $depth) ."px;\">". form_textfield(NULL, "$node->nid][title", $node->title, 64, 255) ."</div>", + form_weight(NULL, "$node->nid][weight", $node->weight), + l(t("view node"), "node/view/$node->nid"), + l(t("edit node"), "admin/node/edit/$node->nid"), + l(t("delete node"), "admin/node/delete/$node->nid")); - return $output; + return $row; } function book_admin_view_book($nid, $depth = 1) { @@ -641,11 +636,11 @@ function book_admin_view_book($nid, $depth = 1) { while ($node = db_fetch_object($result)) { $node = node_load(array("nid" => $node->nid)); - $output .= book_admin_view_line($node, $depth); - $output .= book_admin_view_book($node->nid, $depth + 1); + $rows[] = book_admin_view_line($node, $depth); + $rows = array_merge($rows, book_admin_view_book($node->nid, $depth + 1)); } - return $output; + return $rows; } function book_admin_view($nid, $depth = 0) { @@ -653,12 +648,12 @@ function book_admin_view($nid, $depth = 0) { $node = node_load(array("nid" => $nid)); $output .= "<h3>$node->title</h3>"; - $output .= "<table border=\"1\" cellpadding=\"2\" cellspacing=\"2\">"; - $output .= " <tr><th>title</th><th>weight</th><th colspan=\"3\">operations</th></tr>"; - $output .= book_admin_view_line($node); - $output .= book_admin_view_book($nid); - $output .= "</table><br />"; + $header = array(t("title"), t("weight"), array("data" => t("operations"), "colspan" => 3)); + $rows[] = book_admin_view_line($node); + $rows = array_merge($rows, book_admin_view_book($nid)); + + $output .= table($header, $rows); $output .= form_submit(t("Save book pages")); return form($output); |