Commit 97f4bdb9 authored by Dries's avatar Dries

- Made sure all table headers could be translated.

- Made the book module use the new table rendering function.
parent d1521b48
......@@ -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);
......
......@@ -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);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment